feat: 新增预警定时扫描器,移除附件归档字段并为角色表补充更新时间
This commit is contained in:
@@ -144,19 +144,27 @@ type generalOutboundRequest struct {
|
||||
NeedAgv bool `json:"needAgv"` // 是否叫AGV配送到接驳台(可选)
|
||||
}
|
||||
|
||||
// generalOutboundHandler 通用出库(手动出库,不依赖工单)
|
||||
// 适用:退料 / 样品 / 报废 / 发货 等不挂靠 MES 工单的场景。
|
||||
// makeOutboundHandler 通用出库 / 科技项目出库 共用工厂(B1/B2 逻辑拆分)。
|
||||
// 两者底层完全一致(出库单 + 库存扣减 + 出库明细 原子提交;库存用条件原子更新避免负库存),
|
||||
// 仅 outboundType(单据类型)与归属(ownership) 不同:
|
||||
// - outboundType="general" → 通用出库(归属可选 合同号/其他,拒绝科技项目号)
|
||||
// - outboundType="project" → 科技项目出库(强锁归属=科技项目号)
|
||||
// 支持序列号=否(数量)与序列号=是(SN),序列号方式按物料档案 sn_mode 分叉(2026-09-30 解耦);
|
||||
// 填箱号时一并把装箱信息(箱号/SN清单/合同号)
|
||||
// 落到统一的出库主表,不再另建装箱表。
|
||||
// 事务保证:出库单 + 库存扣减 + 出库明细 原子提交;库存用条件原子更新避免负库存。
|
||||
func generalOutboundHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
// 填箱号时一并把装箱信息(箱号/SN清单/合同号)落到统一的出库主表,不再另建装箱表。
|
||||
func makeOutboundHandler(ctx *svc.ServiceContext, outboundType string) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req generalOutboundRequest
|
||||
if err := parseJSON(r, &req); err != nil {
|
||||
fail(w, http.StatusBadRequest, "参数错误: "+err.Error())
|
||||
return
|
||||
}
|
||||
// B1/B2 逻辑拆分:科技项目出库(project) 与 通用出库(general) 共用本流程,仅单据类型与归属不同。
|
||||
if outboundType == "project" {
|
||||
req.OwnershipType = "project" // 科技项目出库强锁归属=科技项目号
|
||||
} else if req.OwnershipType == "project" {
|
||||
fail(w, http.StatusBadRequest, "通用出库不支持「科技项目号」归属,请使用「科技项目出库」入口")
|
||||
return
|
||||
}
|
||||
if req.MaterialCode == "" {
|
||||
fail(w, http.StatusBadRequest, "materialCode 必填")
|
||||
return
|
||||
@@ -247,7 +255,7 @@ func generalOutboundHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
pw := "" // 产品工号:从源库存取,出库单创建后回填(五页带出)
|
||||
ob, err := tx.OutboundOrder.Create().
|
||||
SetOutboundNo(outboundNo).
|
||||
SetOutboundType("general").
|
||||
SetOutboundType(outboundType).
|
||||
SetStatus("已出库").
|
||||
SetNeedAgv(req.NeedAgv).
|
||||
SetNillableTargetDock(strPtr(req.TargetDock)).
|
||||
@@ -426,15 +434,19 @@ func generalOutboundHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
}
|
||||
committed = true
|
||||
|
||||
ctx.EventLog.Write(ctx0(), "outbound.general", r.Header.Get("X-Username"), "outbound", outboundNo,
|
||||
"通用出库 "+req.MaterialCode+" ×"+itoa(actualQty),
|
||||
typeLabel := "通用出库"
|
||||
if outboundType == "project" {
|
||||
typeLabel = "科技项目出库"
|
||||
}
|
||||
ctx.EventLog.Write(ctx0(), "outbound."+outboundType, r.Header.Get("X-Username"), "outbound", outboundNo,
|
||||
typeLabel+" "+req.MaterialCode+" ×"+itoa(actualQty),
|
||||
map[string]any{"qty": actualQty, "boxNo": req.BoxNo, "snCount": len(req.SnList)})
|
||||
logx.Infof("general outbound: material=%s qty=%d box=%s", req.MaterialCode, actualQty, req.BoxNo)
|
||||
logx.Infof("%s outbound: material=%s qty=%d box=%s", outboundType, req.MaterialCode, actualQty, req.BoxNo)
|
||||
ok(w, map[string]any{
|
||||
"outboundNo": outboundNo,
|
||||
"qty": actualQty,
|
||||
"boxNo": req.BoxNo,
|
||||
"type": "general",
|
||||
"type": outboundType,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -645,6 +657,8 @@ func outboundTypeLabel(v string) string {
|
||||
return "补料出库"
|
||||
case "general":
|
||||
return "通用出库"
|
||||
case "project":
|
||||
return "科技项目出库"
|
||||
default:
|
||||
return "通用出库"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user