feat(mes): 添加定时同步可生产数量到WMS及BOM项相关标准字段

- 在main.go中添加定时任务每10分钟同步可生产数量到WMS系统
- 为BomItem实体添加relatedStandard字段及相关CRUD方法
- 为InspectionRecord实体添加reportNo、materialCode、materialName等字段
- 更新ent schema确保新字段的验证和默认值设置
- 添加必要的数据库迁移和字段映射逻辑
This commit is contained in:
SunYF
2026-09-17 12:49:07 +08:00
parent b4b274301d
commit 1cc93795ce
191 changed files with 24504 additions and 1250 deletions
@@ -59,6 +59,9 @@ func processDoneHandler(ctx *svc.ServiceContext) http.HandlerFunc {
BindValue string `json:"bindValue"`
} `json:"binds"`
Operator string `json:"operator"`
// 作业时长采集(P0-3):上料时刻/报工时刻(ISO8601),原样转发 MES 算 durationSec;离线重传时同 payload 保留
StartedAt string `json:"startedAt"`
EndedAt string `json:"endedAt"`
}
if err := parseJSON(r, &req); err != nil {
fail(w, http.StatusBadRequest, "参数错误")
@@ -83,6 +86,12 @@ func processDoneHandler(ctx *svc.ServiceContext) http.HandlerFunc {
if len(req.Binds) > 0 {
body["binds"] = req.Binds
}
if req.StartedAt != "" {
body["startedAt"] = req.StartedAt
}
if req.EndedAt != "" {
body["endedAt"] = req.EndedAt
}
payloadBytes, _ := json.Marshal(body)
ctx.Store.AddEventLog(req.OrderNo, req.Operator, "process_done",