高级排程
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

  1. package service
  2. import (
  3. base_model "LAPP_AS/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 base_model.WorkShift
  12. }
  13. func( wss *WorkShiftSrv)Init(wstab base_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. }