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:
@@ -26,6 +26,7 @@ func createSupplierReturnOutbound(ctx *svc.ServiceContext, tx *ent.Tx, inv *ent.
|
||||
SetNillableOutboundCategory(strPtr("supplier_return")).
|
||||
SetMaterialCode(inv.MaterialCode).
|
||||
SetManageMode(inv.ManageMode).
|
||||
SetSnMode(inv.SnMode).
|
||||
SetNillableBatchNo(strPtr(inv.BatchNo)).
|
||||
SetNillableZoneCode(strPtr(inv.ZoneCode)).
|
||||
SetQuantity(inv.Quantity).
|
||||
@@ -34,8 +35,8 @@ func createSupplierReturnOutbound(ctx *svc.ServiceContext, tx *ent.Tx, inv *ent.
|
||||
Save(ctx0()); err != nil {
|
||||
return "", fmt.Errorf("创建退供应商出库单失败: %w", err)
|
||||
}
|
||||
if inv.ManageMode == 2 {
|
||||
// 电气件 SN:库存行置「出库」,出库明细记 SN
|
||||
if inv.SnMode == snModeSN {
|
||||
// 序列号件 SN:库存行置「出库」,出库明细记 SN
|
||||
if _, err = tx.Inventory.UpdateOneID(inv.ID).SetStatus("出库").Save(ctx0()); err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -45,7 +46,7 @@ func createSupplierReturnOutbound(ctx *svc.ServiceContext, tx *ent.Tx, inv *ent.
|
||||
return "", err
|
||||
}
|
||||
} else {
|
||||
// 结构件批次 / 其他:扣减数量(含已锁定量),出库明细记批次
|
||||
// 批次件:扣减数量(含已锁定量),出库明细记批次
|
||||
if _, err = tx.Inventory.UpdateOneID(inv.ID).
|
||||
AddQuantity(-inv.Quantity).AddLockedQty(-min(inv.LockedQty, inv.Quantity)).Save(ctx0()); err != nil {
|
||||
return "", err
|
||||
@@ -180,7 +181,7 @@ func reinspectHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
committed = true
|
||||
|
||||
targetId := inv.BatchNo
|
||||
if inv.ManageMode == 2 {
|
||||
if inv.SnMode == snModeSN {
|
||||
targetId = inv.SnCode
|
||||
}
|
||||
ctx.EventLog.Write(ctx0(), "inspection.reinspect", operator, "inventory", targetId,
|
||||
@@ -195,7 +196,7 @@ func createReinspectTraceRecord(tx *ent.Tx, inv *ent.Inventory, status, disposal
|
||||
targetType := "BATCH"
|
||||
targetId := inv.BatchNo
|
||||
qty := inv.Quantity
|
||||
if inv.ManageMode == 2 {
|
||||
if inv.SnMode == snModeSN {
|
||||
targetType = "SN"
|
||||
targetId = inv.SnCode
|
||||
qty = 1
|
||||
|
||||
Reference in New Issue
Block a user