feat: 完成客户第12条需求+多系统改造
1. 新增预警表添加工单号字段,支持按工单号检索预警 2. 添加工单过滤在制品/绩效报表/预警中心查询 3. 补全WMS台账字段口径与权限配置 4. 修复备料单与数量不符处理流程 5. 新增配送进度/库位联动/自动出库功能 6. 修复AGV配送状态更新逻辑 7. 优化退料与库存管理细节
This commit is contained in:
@@ -59,14 +59,16 @@ type QtyReportReq struct {
|
||||
}
|
||||
|
||||
// CreateQtyReport 数量不符上报:落 material_qty_report + 预警中心消息(type=qty_diff)。
|
||||
// MES 侧仅预警,不承载明细处理流程:相关内容融合为一段文字描述写入预警内容,
|
||||
// 由预警中心与右上角铃铛统一呈现;明细与闭环由 WMS 负责。
|
||||
//
|
||||
// 归属(2026-09-19 定稿):MES 是唯一真源与处理侧 —— 上报、明细、处理(补发/退库/调整)
|
||||
// 全在 MES(见 logic/qty_report.go:HandleQtyReport),WMS 只经内部接口被动建单。
|
||||
// 预警 refId 存差异单业务号 QR{id},处理完成后可精确定位并闭环该预警。
|
||||
func (s *Service) CreateQtyReport(ctx context.Context, req QtyReportReq) error {
|
||||
if req.StationNo <= 0 || req.MaterialCode == "" {
|
||||
return errors.New("工位号与物料编码必填")
|
||||
}
|
||||
diff := req.PlanQty - req.ActualQty
|
||||
_, err := s.ctx.EntClient.MaterialQtyReport.Create().
|
||||
rec, err := s.ctx.EntClient.MaterialQtyReport.Create().
|
||||
SetStationNo(req.StationNo).
|
||||
SetOrderNo(req.OrderNo).
|
||||
SetSn(req.Sn).
|
||||
@@ -87,7 +89,7 @@ func (s *Service) CreateQtyReport(ctx context.Context, req QtyReportReq) error {
|
||||
if cause == "" {
|
||||
cause = "未填写"
|
||||
}
|
||||
content := fmt.Sprintf("工位%d 数量不符:物料 %s", req.StationNo, req.MaterialCode)
|
||||
content := fmt.Sprintf("差异单 %s|工位%d 数量不符:物料 %s", qtyReportNo(rec.ID), req.StationNo, req.MaterialCode)
|
||||
if req.MaterialName != "" {
|
||||
content += "(" + req.MaterialName + ")"
|
||||
}
|
||||
@@ -105,12 +107,12 @@ func (s *Service) CreateQtyReport(ctx context.Context, req QtyReportReq) error {
|
||||
SetTitle("数量不符预警").
|
||||
SetContent(content).
|
||||
SetRefType("material_qty_report").
|
||||
SetRefId(req.MaterialCode).
|
||||
SetRefId(qtyReportNo(rec.ID)).
|
||||
SetReceiver("").
|
||||
SetStatus("UNREAD").
|
||||
Save(ctx)
|
||||
s.ctx.EventLog.Write(ctx, "station.qty_report", req.OrderNo, req.Operator, "material_qty_report",
|
||||
req.MaterialCode, "数量不符上报", map[string]any{"stationNo": req.StationNo, "diff": diff})
|
||||
req.MaterialCode, "数量不符上报", map[string]any{"stationNo": req.StationNo, "diff": diff, "reportNo": qtyReportNo(rec.ID)})
|
||||
s.notifyDashboard()
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user