refactor: 重构工艺工序相关命名与数据模型
1. 全局替换"工序"为"工艺"统一术语,包括页面文案、枚举、注释
2. 重构工单与工件工艺数据模型:
- 新增工艺组合表flow_material作为备料/齐套唯一源头
- 新增工位状态表station_state支持自主停单/恢复接单
- 移除station_process派工表,改用工单工艺组合作为路线唯一源头
- 替换processCode为flowId作为工艺关联标识
- 重构工件当前进度字段为currentStationNo
3. 删除冗余的静态备份资源文件
4. 调整物料选择组件默认启用仅显示激活物料
5. 优化工单创建/编辑逻辑,新增工艺组合校验与保存
This commit is contained in:
@@ -31,6 +31,8 @@ type WorkOrderReq struct {
|
||||
ProductSerial string `json:"productSerial"`
|
||||
// 完成日期(必填,前端强制;yyyy-MM-dd)
|
||||
DueDate string `json:"dueDate"`
|
||||
// 工艺组合(唯一路线源头):[{flowId,stationNo}],工位号即顺序号,按工位号升序执行、可跳过未选工位
|
||||
FlowCombination []map[string]int `json:"flowCombination"`
|
||||
}
|
||||
|
||||
// CreateWorkOrder 创建工单(状态恒 CREATED,后续用状态流转按钮推进)
|
||||
@@ -58,7 +60,7 @@ func (s *Service) CreateWorkOrder(ctx context.Context, req WorkOrderReq, operato
|
||||
if status != "CREATED" {
|
||||
status = "CREATED" // 创建恒为已创建;不允许直接创建到后续状态
|
||||
}
|
||||
// 工位↔工序路线现由「工位派工(station_process)」按日定义,工单不再存路线串
|
||||
// 工艺组合 = 唯一路线源头([{flowId,stationNo}],工位号升序执行)
|
||||
b := s.ctx.EntClient.WorkOrder.Create().
|
||||
SetWorkOrderNo(req.WorkOrderNo).
|
||||
SetProductTypeId(req.ProductTypeId).
|
||||
@@ -85,6 +87,14 @@ func (s *Service) CreateWorkOrder(ctx context.Context, req WorkOrderReq, operato
|
||||
b.SetDueDate(t)
|
||||
}
|
||||
}
|
||||
// 工艺组合(唯一路线源头):传了才校验并写入
|
||||
if len(req.FlowCombination) > 0 {
|
||||
items, err := s.ValidateFlowCombination(ctx, req.FlowCombination)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
b.SetFlowCombination(flowItemsToMaps(items))
|
||||
}
|
||||
// 创建人(Item M):取当前登录用户
|
||||
b.SetCreatedBy(operator)
|
||||
if _, err := b.Save(ctx); err != nil {
|
||||
@@ -143,6 +153,14 @@ func (s *Service) UpdateWorkOrder(ctx context.Context, req WorkOrderReq, operato
|
||||
}
|
||||
u := s.ctx.EntClient.WorkOrder.UpdateOneID(req.Id).
|
||||
SetContractNo(req.ContractNo).SetProjectNo(req.ProjectNo).SetProductSerial(req.ProductSerial)
|
||||
// 工艺组合(唯一路线源头):传了才校验并覆盖写入(编辑仅限「已创建」状态,上方已校验)
|
||||
if req.FlowCombination != nil {
|
||||
items, err := s.ValidateFlowCombination(ctx, req.FlowCombination)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
u.SetFlowCombination(flowItemsToMaps(items))
|
||||
}
|
||||
if req.Quantity > 0 {
|
||||
u.SetQuantity(req.Quantity)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user