package service import ( "leit.com/aps_engine/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.WorkShiftNr wss.Wsstab = wstab } // 基于指定的人数获取效率,默认取班组设置效率 func( wss *WorkShiftSrv)GetEffByPersonQty(pesqty int)(eff float64){ var( i int found bool ) found = false for i = 0; i < len(wss.Wsstab.WorkShiftEffLst); i++ { if pesqty >= wss.Wsstab.WorkShiftEffLst[i].PlanPersonLclQty && pesqty <= wss.Wsstab.WorkShiftEffLst[i].PlanPersonUclQty { found = true eff = wss.Wsstab.WorkShiftEffLst[i].PlanEfficiency break } } if !found { eff = wss.Wsstab.PlanEfficiency } return } // 基于人员出勤等级获取效率,默认取班组设置效率 func( wss *WorkShiftSrv)GetEffByLevel(levelid string)(eff float64){ var( i int found bool ) found = false for i = 0; i < len(wss.Wsstab.WorkShiftEffLst); i++ { if levelid >= wss.Wsstab.WorkShiftEffLst[i].LevelId { found = true eff = wss.Wsstab.WorkShiftEffLst[i].PlanEfficiency break } } if !found { eff = wss.Wsstab.PlanEfficiency } return }