feat(mes/wms/终端): 三端统一对时JWT验签 + 盘点按库位拆快照 + 档案删除口径 + 退库单数量修正(2026-11-24 全场整改)

【全系统 · 时间权威与鉴权(核心)】
- 新增 clock 包(三端各一份):谁签发 JWT 就以谁的时间验 exp——验签方向签发方取 /api/server-time(30s 缓存,取不到降级本机 + 10min 容差兜底),本端签发用本机时间
- 三端均注册 GET /api/server-time;MES/WMS/终端配同一份「签发方→取时间地址」映射
- 密钥 SHA256 前 8 位指纹日志([鉴权诊断]),现场比对两端指纹秒定位密钥不一致导致的 401「登录已失效」
- token 由 localStorage 改 sessionStorage;登录响应带服务器时间,偏差只提示「时间已自动校正」不拦截
- 现场人工 w32tm 对时操作卡作废(随文档留存,正常部署无需执行)

【WMS · 库存盘点重构】
- 快照粒度改「物料 × 库位」:同物料 A/B 区拆两条各盘各的;扫码命中多行弹库位清单逐库位录入、写回精确定位,行不存在报错不静默跳过
- GET /api/stocktake/active 返回全部进行中单(旧 .First() 只返一条导致历史多单看不见、库存长期冻结);前端加单号下拉切换,刷新保持当前单
- 历史卡死单只走「完成/取消」事务解冻,严禁删库;写回任何一行失败都强提示,不吞错
- 去「全库」,按区域筛选支持选到区/货架/层/号任意层级;「本次盘点范围」同步加筛选、物料按区域过滤;去多余「(可选)」字样

【WMS/MES · 档案删除与停用口径】
- 产品档案新建默认停用(product_process.status ACTIVE→INACTIVE),配齐工艺路线+总账+分账才允许启用
- 产品/物料档案删除按钮统一为一个(按 WMS 做法),仅「无任何引用」可物理删;引用检查覆盖两库、查库报错一律拒绝删除(fail-close,不再误删)
- 产品编码自动生成,重复则自增保证唯一;权限对齐:停用走「编辑」、删除走独立「删除」码
- WMS 删物料同步核查 MES 引用,MES 不可达/删除失败则拒绝并落同步失败台账,无兼容补录行

【业务整改】
- MES 工单整体完工自动结算遗留 PENDING 叫料单(释放占用额度);已发货 SHIPPED 不动,仅落日志提示人工签收
- WMS 已收货退库单支持直接修正数量(问题14):原单不动、留痕(修正人/时间/原因/前后值),库存差额补扣,SN 件按最终 SN 集合增删行
- 日排产:「排产日期范围」→「排产日期」;平铺补产品编码/名称;「产品型号」→「产品」去产品编号/名称;平均分摊与每日固定互算;删除写操作日志
- 齐套测算:逐日消耗模拟按实际排产日期;工单详情增「总物料清单」(照搬产品档案总账,实时)
- PLC 对账:虚拟/离线工位(OFFLINE,如 15)跳过 PLC 托盘位读取,不再为特例扔给 PLC
- AGV 点位锁与回调细节按 11-20 现场整改继续修正(agv.go / agv_point_lock.go)

【文档】
- 新增《全系统业务深坑审计报告》《全系统串联审计报告》《现场对时操作卡》;更新产线API.md、案例.md、问题临时.md(记录甲方逐条原话与验收口径)
This commit is contained in:
SunYF
2026-11-24 22:11:12 +08:00
parent 5d9140bbd5
commit 20e061c969
107 changed files with 5528 additions and 720 deletions
+26 -2
View File
@@ -755,12 +755,36 @@ func init() {
returnorderDescReceiveNote := returnorderFields[23].Descriptor()
// returnorder.DefaultReceiveNote holds the default value on creation for the receive_note field.
returnorder.DefaultReceiveNote = returnorderDescReceiveNote.Default.(string)
// returnorderDescAdjustQty is the schema descriptor for adjust_qty field.
returnorderDescAdjustQty := returnorderFields[24].Descriptor()
// returnorder.DefaultAdjustQty holds the default value on creation for the adjust_qty field.
returnorder.DefaultAdjustQty = returnorderDescAdjustQty.Default.(int)
// returnorderDescAdjustBeforeQty is the schema descriptor for adjust_before_qty field.
returnorderDescAdjustBeforeQty := returnorderFields[25].Descriptor()
// returnorder.DefaultAdjustBeforeQty holds the default value on creation for the adjust_before_qty field.
returnorder.DefaultAdjustBeforeQty = returnorderDescAdjustBeforeQty.Default.(int)
// returnorderDescAdjustedBy is the schema descriptor for adjusted_by field.
returnorderDescAdjustedBy := returnorderFields[26].Descriptor()
// returnorder.DefaultAdjustedBy holds the default value on creation for the adjusted_by field.
returnorder.DefaultAdjustedBy = returnorderDescAdjustedBy.Default.(string)
// returnorder.AdjustedByValidator is a validator for the "adjusted_by" field. It is called by the builders before save.
returnorder.AdjustedByValidator = returnorderDescAdjustedBy.Validators[0].(func(string) error)
// returnorderDescAdjustReason is the schema descriptor for adjust_reason field.
returnorderDescAdjustReason := returnorderFields[27].Descriptor()
// returnorder.DefaultAdjustReason holds the default value on creation for the adjust_reason field.
returnorder.DefaultAdjustReason = returnorderDescAdjustReason.Default.(string)
// returnorder.AdjustReasonValidator is a validator for the "adjust_reason" field. It is called by the builders before save.
returnorder.AdjustReasonValidator = returnorderDescAdjustReason.Validators[0].(func(string) error)
// returnorderDescAdjustedAt is the schema descriptor for adjusted_at field.
returnorderDescAdjustedAt := returnorderFields[28].Descriptor()
// returnorder.DefaultAdjustedAt holds the default value on creation for the adjusted_at field.
returnorder.DefaultAdjustedAt = returnorderDescAdjustedAt.Default.(int64)
// returnorderDescCreatedAt is the schema descriptor for created_at field.
returnorderDescCreatedAt := returnorderFields[24].Descriptor()
returnorderDescCreatedAt := returnorderFields[29].Descriptor()
// returnorder.DefaultCreatedAt holds the default value on creation for the created_at field.
returnorder.DefaultCreatedAt = returnorderDescCreatedAt.Default.(func() int64)
// returnorderDescReceiveAt is the schema descriptor for receive_at field.
returnorderDescReceiveAt := returnorderFields[25].Descriptor()
returnorderDescReceiveAt := returnorderFields[30].Descriptor()
// returnorder.DefaultReceiveAt holds the default value on creation for the receive_at field.
returnorder.DefaultReceiveAt = returnorderDescReceiveAt.Default.(int64)
roleFields := schema.Role{}.Fields()