feat: 完成多模块迭代更新

- 新增过程巡检按步骤上报、数量不符上报、工位退料功能
- 增加工单工程编号三级归属字段
- 新增物料安全库存与缺货预警
- 新增附件管理、退库单管理模块
- 优化生产看板展示逻辑与前端页面文案
- 清理冗余的工艺路线相关代码与备份文件
This commit is contained in:
SunYF
2026-09-15 16:37:39 +08:00
parent 951f3dfecd
commit 4a5e2d7bac
494 changed files with 24702 additions and 139223 deletions
+9 -2
View File
@@ -126,6 +126,11 @@ func deductStockHandler(ctx *svc.ServiceContext) http.HandlerFunc {
fail(w, http.StatusConflict, "批次库存不足: "+req.BatchNo+" 可用 "+itoa(avail))
return
}
// 质量门禁(P0-2):不合格/待退 批次禁止上线领料(客户诉求 L135:不合格不上产线)
if b.QualityStatus == "不合格" || b.QualityStatus == "待退" {
fail(w, http.StatusConflict, "批次 "+req.BatchNo+" 质量状态为「"+b.QualityStatus+"」,禁止领料上线(请先完成不合格处置)")
return
}
aff, err := tx.Inventory.Update().
Where(inventory.ID(b.ID), inventory.QuantityGTE(req.Qty)).
AddQuantity(-req.Qty).
@@ -149,10 +154,12 @@ func deductStockHandler(ctx *svc.ServiceContext) http.HandlerFunc {
}
// 4. 扣减 SN(原子:仅 在库/锁定 的 SN 可出库 → 置出库)
// 质量门禁(P0-2):不合格/待退 的 SN 禁止领料上线(请走「通用出库」办理退货/报废)
if len(req.SnList) > 0 {
for _, sn := range req.SnList {
aff, err := tx.Inventory.Update().
Where(inventory.ManageModeEQ(2), inventory.SnCodeEQ(sn), inventory.StatusIn("在库", "锁定")).
Where(inventory.ManageModeEQ(2), inventory.SnCodeEQ(sn), inventory.StatusIn("在库", "锁定"),
inventory.QualityStatusNotIn("不合格", "待退")).
SetStatus("出库").
SetNillableZoneCode(strPtr(req.ZoneCode)).
Save(ctx0())
@@ -161,7 +168,7 @@ func deductStockHandler(ctx *svc.ServiceContext) http.HandlerFunc {
return
}
if aff == 0 {
fail(w, http.StatusBadRequest, "SN 不可出库(不存在非在库/锁定): "+sn)
fail(w, http.StatusBadRequest, "SN 不可出库(不存在非在库/锁定,或质量状态为不合格/待退): "+sn)
return
}
if _, err = tx.OutboundDetail.Create().