广汽安道拓Acura项目MES后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.3 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. package schedule
  2. import (
  3. model "LAPP_ACURA_MOM_BACKEND/models/base"
  4. "time"
  5. )
  6. type WorkShiftSrv struct {
  7. WorkShiftNr int
  8. ShiftType string
  9. StartTime time.Time
  10. EndTime time.Time
  11. Wsstab model.WorkShift
  12. }
  13. func (wss *WorkShiftSrv) Init(wstab model.WorkShift) {
  14. wss.WorkShiftNr = wstab.WorkShiftNr
  15. wss.Wsstab = wstab
  16. }
  17. // 基于指定的人数获取效率,默认取班组设置效率
  18. func (wss *WorkShiftSrv) GetEffByPersonQty(pesqty int) (eff float64) {
  19. var (
  20. i int
  21. found bool
  22. )
  23. found = false
  24. for i = 0; i < len(wss.Wsstab.WorkShiftEffLst); i++ {
  25. if pesqty >= wss.Wsstab.WorkShiftEffLst[i].PlanPersonLclQty && pesqty <= wss.Wsstab.WorkShiftEffLst[i].PlanPersonUclQty {
  26. found = true
  27. eff = wss.Wsstab.WorkShiftEffLst[i].PlanEfficiency
  28. break
  29. }
  30. }
  31. if !found {
  32. eff = wss.Wsstab.PlanEfficiency
  33. }
  34. return
  35. }
  36. // 基于人员出勤等级获取效率,默认取班组设置效率
  37. func (wss *WorkShiftSrv) GetEffByLevel(levelid string) (eff float64) {
  38. var (
  39. i int
  40. found bool
  41. )
  42. found = false
  43. for i = 0; i < len(wss.Wsstab.WorkShiftEffLst); i++ {
  44. if levelid >= wss.Wsstab.WorkShiftEffLst[i].LevelId {
  45. found = true
  46. eff = wss.Wsstab.WorkShiftEffLst[i].PlanEfficiency
  47. break
  48. }
  49. }
  50. if !found {
  51. eff = wss.Wsstab.PlanEfficiency
  52. }
  53. return
  54. }