广汽安道拓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

package schedule
import (
model "LAPP_ACURA_MOM_BACKEND/models/base"
"time"
)
type WorkShiftSrv struct {
WorkShiftNr int
ShiftType string
StartTime time.Time
EndTime time.Time
Wsstab model.WorkShift
}
func (wss *WorkShiftSrv) Init(wstab model.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
}