fix: rebuild MES as compilable go-zero+ent backend (renamed bj_power_mes), restore 3 workstation projects from pristine original, align naming; all Go projects go build clean
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
package dock
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"bj_power_mes/constants"
|
||||
"bj_power_mes/ent"
|
||||
"bj_power_mes/internal/types"
|
||||
)
|
||||
|
||||
func statusToString(s int) string {
|
||||
switch s {
|
||||
case 0:
|
||||
return "EMPTY"
|
||||
case 1:
|
||||
return "FILL"
|
||||
case 2:
|
||||
return "PROCESSING"
|
||||
case 3:
|
||||
return "DONE"
|
||||
default:
|
||||
return fmt.Sprintf("UNKNOWN_%d", s)
|
||||
}
|
||||
}
|
||||
|
||||
func determineDockSlotStatus(slot *ent.DockSlot, job *ent.Job) int {
|
||||
if slot.CurrentJobId == nil || *slot.CurrentJobId == 0 {
|
||||
return 0 // EMPTY
|
||||
}
|
||||
if job.Status == constants.JobStatus_Created {
|
||||
return 1 // FILL
|
||||
}
|
||||
if job.Status == constants.JobStatus_Completed {
|
||||
return 3 // DONE
|
||||
}
|
||||
return 2 // PROCESSING
|
||||
}
|
||||
|
||||
func toJobBrief(j *ent.Job) *types.JobBrief {
|
||||
brief := &types.JobBrief{
|
||||
Id: j.ID,
|
||||
WorkOrderId: j.WorkOrderId,
|
||||
WorkpieceNo: j.WorkpieceNo,
|
||||
ProductTypeId: j.ProductTypeId,
|
||||
Status: string(j.Status),
|
||||
CurrentStepId: j.CurrentStepId,
|
||||
}
|
||||
return brief
|
||||
}
|
||||
Reference in New Issue
Block a user