feat&refactor: 2026-09-22 半成品业务模型重构与功能完善
- 重构半成品流转逻辑:进度权威源改为 workpiece.currentStationNo,新增 completedText 快照字段,废除 doneProcessCodes - 清理物料品类中半成品类型,存量数据幂等清理,调整物料管理方式文案为批次/序列号 - 新增日排产状态专用更新接口,修复工单工艺校验逻辑 - 新增物料档案代理接口、深路径文件下载接口 - 优化前端界面文案与工位选择逻辑,补充追溯页半成品流转展示 - 调整WMS端物料品类校验与入库接口契约 - 新增/更新数据库表结构与实体类代码
This commit is contained in:
@@ -83,7 +83,7 @@ func StationFlowMapOfWO(items []FlowItem) map[int]int {
|
||||
}
|
||||
|
||||
// ValidateFlowCombination 保存工单时校验工艺组合:
|
||||
// 非空、工艺存在且启用(ACTIVE)、工位存在、工位号不重复;返回按工位号升序的条目。
|
||||
// 非空、工艺存在且启用(ACTIVE)、工位存在且 ENABLED 且当前绑定工艺与工单一致、工位号不重复;返回按工位号升序的条目。
|
||||
func (s *Service) ValidateFlowCombination(ctx context.Context, raw []map[string]int) ([]FlowItem, error) {
|
||||
items := flowMapsToItems(raw)
|
||||
if len(items) == 0 {
|
||||
@@ -103,13 +103,15 @@ func (s *Service) ValidateFlowCombination(ctx context.Context, raw []map[string]
|
||||
if flow.Status != "ACTIVE" {
|
||||
return nil, fmt.Errorf("工艺「%s」已停用", flow.Name)
|
||||
}
|
||||
exist, err := s.ctx.EntClient.Station.Query().Where(station.StationNo(it.StationNo)).Exist(ctx)
|
||||
exist, err := s.ctx.EntClient.Station.Query().Where(station.StationNo(it.StationNo)).First(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exist {
|
||||
return nil, fmt.Errorf("工位 %d 不存在", it.StationNo)
|
||||
}
|
||||
// 工位当前绑定工艺必须与工单一致且工位启用(与排产校验 ValidateWOCombinationForSchedule 同口径同文案),
|
||||
// 否则工单下发后工位被改绑/停用会导致路线漂移
|
||||
if exist.FlowId != it.FlowId || exist.Status != "ENABLED" {
|
||||
return nil, fmt.Errorf("工位%d当前工艺与工单不匹配", it.StationNo)
|
||||
}
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user