|
|
- package schedule
-
- import (
- "leit.com/LAPP_GAAS_GFrame/models"
- "time"
- )
-
- type WorkShiftSrv struct {
- WorkShiftNr int
- ShiftType string
- StartTime time.Time
- EndTime time.Time
- Wsstab models.Workshift
- }
-
- func( wss *WorkShiftSrv)Init(wstab models.Workshift){
- wss.WorkShiftNr = wstab.Plantnr
- wss.Wsstab = wstab
- }
-
- // 基于指定的人数获取效率,默认取班组设置效率
- func( wss *WorkShiftSrv)GetEffByPersonQty(pesqty int)(eff float32){
- var(
- i int
- found bool
- )
-
- found = false
- for i = 0; i < len(wss.Wsstab.Efflst); i++ {
- if pesqty >= wss.Wsstab.Efflst[i].Planpersonlclqty && pesqty <= wss.Wsstab.Efflst[i].Planpersonuclqty {
- found = true
- eff = wss.Wsstab.Efflst[i].Planefficiency
- break
- }
- }
- if !found {
- eff = wss.Wsstab.Planefficiency
- }
- return
- }
-
- // 基于人员出勤等级获取效率,默认取班组设置效率
- func( wss *WorkShiftSrv)GetEffByLevel(levelid string)(eff float32){
- var(
- i int
- found bool
- )
-
- found = false
- for i = 0; i < len(wss.Wsstab.Efflst); i++ {
- if levelid >= wss.Wsstab.Efflst[i].Levelid {
- found = true
- eff = wss.Wsstab.Efflst[i].Planefficiency
- break
- }
- }
- if !found {
- eff = wss.Wsstab.Planefficiency
- }
- return
- }
|