feat: 解耦管理类型与SN管理方式,新增sn_mode字段实现全链路SN管理标准化
本次重构将原manage_mode字段拆分为独立的分类维度(manage_mode)和SN管理维度(sn_mode),实现全链路(MES/WMS/工位终端)的SN管理行为统一依据: 1. 新增sn_mode字段,定义1=序列号件、2=批次件、0=未选择,替代原manage_mode的SN判断逻辑 2. 移除冗余的manage_mode字段在多个实体中的使用,统一使用sn_mode决定业务行为 3. 新增工位接驳台配置,服务端固定接驳台,前端不可修改,确保AGV送达准确性 4. 优化检验记录导出,新增装配物料绑定明细,满足客户追溯需求 5. 修正前端提示文本,统一使用序列号件/批次件表述,与后端逻辑对齐
This commit is contained in:
@@ -143,7 +143,7 @@ func startStocktakeHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
tt := "BATCH"
|
||||
tid := inv.BatchNo
|
||||
book := inv.Quantity
|
||||
if inv.ManageMode == 2 {
|
||||
if inv.SnMode == snModeSN {
|
||||
tt = "SN"
|
||||
tid = inv.SnCode
|
||||
book = 1
|
||||
@@ -409,7 +409,7 @@ func finishStocktakeHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
// 写回:只改库存量,锁定量不动,可用量随之重算(问题11)
|
||||
if it.TargetType == "BATCH" {
|
||||
row, e := tx.Inventory.Query().
|
||||
Where(inventory.ManageModeEQ(1), inventory.BatchNoEQ(it.TargetID)).Only(ctx0())
|
||||
Where(inventory.SnModeEQ(snModeBatch), inventory.BatchNoEQ(it.TargetID)).Only(ctx0())
|
||||
if e != nil || row == nil {
|
||||
continue
|
||||
}
|
||||
@@ -431,7 +431,7 @@ func finishStocktakeHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
} else if it.TargetType == "SN" && diff < 0 {
|
||||
// 账面1实盘0 → 报废(移出在库,库存量随之减少)
|
||||
aff, e := tx.Inventory.Update().
|
||||
Where(inventory.ManageModeEQ(2), inventory.SnCodeEQ(it.TargetID), inventory.StatusIn("在库", "锁定")).
|
||||
Where(inventory.SnModeEQ(snModeSN), inventory.SnCodeEQ(it.TargetID), inventory.StatusIn("在库", "锁定")).
|
||||
SetStatus("报废").SetLockedQty(0).SetUpdatedAt(now).
|
||||
Save(ctx0())
|
||||
if e != nil {
|
||||
|
||||
Reference in New Issue
Block a user