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.2 KiB

4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
  1. package schedule
  2. import (
  3. "leit.com/LAPP_GAAS_GFrame/models"
  4. "time"
  5. )
  6. type WorkShiftSrv struct {
  7. WorkShiftNr int
  8. ShiftType string
  9. StartTime time.Time
  10. EndTime time.Time
  11. Wsstab models.Workshift
  12. }
  13. func( wss *WorkShiftSrv)Init(wstab models.Workshift){
  14. wss.WorkShiftNr = wstab.Plantnr
  15. wss.Wsstab = wstab
  16. }
  17. // 基于指定的人数获取效率,默认取班组设置效率
  18. func( wss *WorkShiftSrv)GetEffByPersonQty(pesqty int)(eff float32){
  19. var(
  20. i int
  21. found bool
  22. )
  23. found = false
  24. for i = 0; i < len(wss.Wsstab.Efflst); i++ {
  25. if pesqty >= wss.Wsstab.Efflst[i].Planpersonlclqty && pesqty <= wss.Wsstab.Efflst[i].Planpersonuclqty {
  26. found = true
  27. eff = wss.Wsstab.Efflst[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 float32){
  38. var(
  39. i int
  40. found bool
  41. )
  42. found = false
  43. for i = 0; i < len(wss.Wsstab.Efflst); i++ {
  44. if levelid >= wss.Wsstab.Efflst[i].Levelid {
  45. found = true
  46. eff = wss.Wsstab.Efflst[i].Planefficiency
  47. break
  48. }
  49. }
  50. if !found {
  51. eff = wss.Wsstab.Planefficiency
  52. }
  53. return
  54. }