feat: 新增工件生命周期状态流水表及工单状态流转逻辑
新增工件生命周期状态流水表,记录所有工件状态变更动作,替代原半成品质检计数源 调整工单状态流转,将「下发工单」与「开始执行」合并为「下发并开工」,自动启用关联排产 新增工件物理位置字段,区分业务位置与实际物理工位,解决工位对账滞后问题 统一物料类别处理,避免 WMS 同步时覆盖合法值或错误设置为 0 移除已废弃的返修状态,更新相关显示与逻辑
This commit is contained in:
@@ -372,7 +372,7 @@ type UnplannedWorkOrder struct {
|
||||
// 用于日排产页顶部「有 N 个工单尚未排产」入口;每次进入页面查询一次即可(前端缓存 60s)。
|
||||
func (s *Service) ListUnplannedWorkOrders(ctx context.Context) ([]*UnplannedWorkOrder, error) {
|
||||
wos, err := s.ctx.EntClient.WorkOrder.Query().
|
||||
Where(workorder.StatusIn("CREATED", "RELEASED", "IN_PROGRESS")).All(ctx)
|
||||
Where(workorder.StatusIn("CREATED", "IN_PROGRESS")).All(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -409,7 +409,7 @@ func (s *Service) DeleteDailyPlan(ctx context.Context, id int) error {
|
||||
|
||||
// SetDailyPlanStatus 日排产启用/停用(人工专用入口,POST /daily-plans/:id/status):
|
||||
// 仅允许 PENDING(待执行)↔CONFIRMED(已启用) 之间切换;执行中/已完成/已取消由系统联动维护,无人工入口。
|
||||
// 启用(→CONFIRMED)前校验所属工单(按排产 orderNo 查)状态必须为 RELEASED 或 IN_PROGRESS。
|
||||
// 启用(→CONFIRMED)前校验所属工单(按排产 orderNo 查)状态必须为 IN_PROGRESS(下发并开工)。
|
||||
// 只 UPDATE status 字段,绝不触碰计划数量/分产量等其它列。
|
||||
func (s *Service) SetDailyPlanStatus(ctx context.Context, id int, target, operator string) error {
|
||||
if id <= 0 {
|
||||
@@ -433,8 +433,8 @@ func (s *Service) SetDailyPlanStatus(ctx context.Context, id int, target, operat
|
||||
if err != nil {
|
||||
return errors.New("工单不存在")
|
||||
}
|
||||
if wo.Status != "RELEASED" && wo.Status != "IN_PROGRESS" {
|
||||
return errors.New("工单未下发,不能启用排产")
|
||||
if wo.Status != "IN_PROGRESS" {
|
||||
return errors.New("工单未开工,不能启用排产")
|
||||
}
|
||||
}
|
||||
if err := s.ctx.EntClient.DailyPlan.UpdateOneID(id).SetStatus(target).Exec(ctx); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user