feat: 完成产线MES系统全流程功能迭代与优化
本提交完成了多个核心模块的功能完善与业务对齐: 1. 工位终端:固定工位配置、移除自选工位逻辑、适配配置化工位号 2. MES核心:重构工位组合逻辑、新增工单/流程状态管理、补全报工/追溯逻辑 3. WMS客户端:新增修改密码功能、优化帮助弹窗逻辑 4. 文档与权限:补充完整操作手册、统一菜单名称与权限描述 5. 修复多业务校验:排产数量校验、工单状态校验、工位绑定规则
This commit is contained in:
@@ -37,15 +37,21 @@ func (s *Service) SaveDailyPlan(ctx context.Context, req DailyPlanReq, operator
|
||||
if err != nil {
|
||||
return errors.New("工单不存在")
|
||||
}
|
||||
if wo.Status == "DONE" || wo.Status == "CLOSED" {
|
||||
return errors.New("该工单已完成/关闭,不能排产")
|
||||
}
|
||||
cur, err := s.ctx.EntClient.DailyPlan.Query().
|
||||
Where(dailyplan.OrderNo(req.OrderNo)).All(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// 计算合计:同「工单+日期」的记录无论原状态如何,都以本次新值替换(只算一次),避免旧值+新值重复累计
|
||||
total := 0
|
||||
for _, p := range cur {
|
||||
if p.PlanDate == req.PlanDate && p.Status == "PENDING" {
|
||||
// 覆盖同一 工单+日期 时,旧数量换掉
|
||||
if p.PlanDate == req.PlanDate {
|
||||
if p.CompletedQty > 0 {
|
||||
return errors.New("该排产日已有完工数量,不能修改计划数量")
|
||||
}
|
||||
total += req.PlanQty
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user