feat: 新增工件生命周期状态流水表及工单状态流转逻辑
新增工件生命周期状态流水表,记录所有工件状态变更动作,替代原半成品质检计数源 调整工单状态流转,将「下发工单」与「开始执行」合并为「下发并开工」,自动启用关联排产 新增工件物理位置字段,区分业务位置与实际物理工位,解决工位对账滞后问题 统一物料类别处理,避免 WMS 同步时覆盖合法值或错误设置为 0 移除已废弃的返修状态,更新相关显示与逻辑
This commit is contained in:
@@ -68,12 +68,17 @@ func (s *Service) UpsertLocalMaterial(ctx context.Context, req MaterialUpsertReq
|
||||
if req.SnMode == 1 || req.SnMode == 2 {
|
||||
snMode = req.SnMode
|
||||
}
|
||||
// 物料类别防落 0:显式合法值(1原材料/2半成品/3成品/4其他)才覆盖,否则保留本地值(与 snMode 禁止落 0 同款口径)。
|
||||
itemType := existing.ItemType
|
||||
if req.ItemType >= 1 && req.ItemType <= 4 {
|
||||
itemType = req.ItemType
|
||||
}
|
||||
_, err = s.ctx.EntClient.Material.UpdateOneID(existing.ID).
|
||||
SetName(req.Name).
|
||||
SetSpec(req.Spec).
|
||||
SetUnit(req.Unit).
|
||||
SetDescription(req.Description).
|
||||
SetItemType(req.ItemType).
|
||||
SetItemType(itemType).
|
||||
SetManageMode(req.ManageMode).
|
||||
SetSnMode(snMode).
|
||||
SetTemplateCode(req.TemplateCode).
|
||||
@@ -92,7 +97,7 @@ func (s *Service) UpsertLocalMaterial(ctx context.Context, req MaterialUpsertReq
|
||||
SetSpec(req.Spec).
|
||||
SetUnit(req.Unit).
|
||||
SetDescription(req.Description).
|
||||
SetItemType(req.ItemType).
|
||||
SetItemType(resolveItemType(req.ItemType)).
|
||||
SetManageMode(req.ManageMode).
|
||||
SetSnMode(resolveSnMode(req.SnMode, req.ManageMode)).
|
||||
SetTemplateCode(req.TemplateCode).
|
||||
@@ -103,6 +108,15 @@ func (s *Service) UpsertLocalMaterial(ctx context.Context, req MaterialUpsertReq
|
||||
return err == nil, err
|
||||
}
|
||||
|
||||
// resolveItemType 物料类别兜底:MES 物料档案=WMS 成品物料视图,来源未带合法类别(1原材料/2半成品/3成品/4其他)
|
||||
// 时兜底 3 成品,避免落 0/1 导致列表误显示「原材料」(问题.md 待办3,2026-10-12)。
|
||||
func resolveItemType(v int) int {
|
||||
if v >= 1 && v <= 4 {
|
||||
return v
|
||||
}
|
||||
return 3
|
||||
}
|
||||
|
||||
// materialUpsertOf 本地物料行 → 推 WMS 载荷。
|
||||
func materialUpsertOf(m *ent.Material) wmsclient.MaterialUpsert {
|
||||
active := m.IsActive
|
||||
|
||||
Reference in New Issue
Block a user