feat: 退料闭环定稿(损耗台账/备料清单/退料AGV自动派车/剩余量参考)+ 工位托盘守卫

- MES 新增损耗台账 loss_ledger,差异确认损耗接口 ConfirmReceiveLoss(按工单归集)
- 备料清单 preparation:MES 按 日计划×工单×工位×物料 实时计算,WMS 只读展示 PreparationList
- 退料闭环:N5 工位托盘守卫(未完成禁止退料)、退料 AGV 自动派车(JBT21 空位判定 + 托盘回收链路)、退料参考剩余量接口(应剩余=实备-已耗-已退-已损)
- 新增 AGV 车辆状态表 agv_vehicle_state 及查询
- 整合接驳台/叫料池/库存锁既有闭环,清理 sql 目录注释生成脚本与 catalog,更新文档
This commit is contained in:
SunYF
2026-11-04 19:06:03 +08:00
parent 42bcf395d2
commit 46fcb59079
123 changed files with 10666 additions and 3227 deletions
@@ -346,6 +346,48 @@ func (_c *MaterialRequestCreate) SetNillableLossReason(v *string) *MaterialReque
return _c
}
// SetReceiveQty sets the "receiveQty" field.
func (_c *MaterialRequestCreate) SetReceiveQty(v float64) *MaterialRequestCreate {
_c.mutation.SetReceiveQty(v)
return _c
}
// SetNillableReceiveQty sets the "receiveQty" field if the given value is not nil.
func (_c *MaterialRequestCreate) SetNillableReceiveQty(v *float64) *MaterialRequestCreate {
if v != nil {
_c.SetReceiveQty(*v)
}
return _c
}
// SetReceiveDiff sets the "receiveDiff" field.
func (_c *MaterialRequestCreate) SetReceiveDiff(v float64) *MaterialRequestCreate {
_c.mutation.SetReceiveDiff(v)
return _c
}
// SetNillableReceiveDiff sets the "receiveDiff" field if the given value is not nil.
func (_c *MaterialRequestCreate) SetNillableReceiveDiff(v *float64) *MaterialRequestCreate {
if v != nil {
_c.SetReceiveDiff(*v)
}
return _c
}
// SetReceiveNote sets the "receiveNote" field.
func (_c *MaterialRequestCreate) SetReceiveNote(v string) *MaterialRequestCreate {
_c.mutation.SetReceiveNote(v)
return _c
}
// SetNillableReceiveNote sets the "receiveNote" field if the given value is not nil.
func (_c *MaterialRequestCreate) SetNillableReceiveNote(v *string) *MaterialRequestCreate {
if v != nil {
_c.SetReceiveNote(*v)
}
return _c
}
// SetCreatedAt sets the "createdAt" field.
func (_c *MaterialRequestCreate) SetCreatedAt(v time.Time) *MaterialRequestCreate {
_c.mutation.SetCreatedAt(v)
@@ -495,6 +537,10 @@ func (_c *MaterialRequestCreate) defaults() {
v := materialrequest.DefaultLossReason
_c.mutation.SetLossReason(v)
}
if _, ok := _c.mutation.ReceiveNote(); !ok {
v := materialrequest.DefaultReceiveNote
_c.mutation.SetReceiveNote(v)
}
if _, ok := _c.mutation.CreatedAt(); !ok {
v := materialrequest.DefaultCreatedAt()
_c.mutation.SetCreatedAt(v)
@@ -648,6 +694,14 @@ func (_c *MaterialRequestCreate) check() error {
return &ValidationError{Name: "lossReason", err: fmt.Errorf(`ent: validator failed for field "MaterialRequest.lossReason": %w`, err)}
}
}
if _, ok := _c.mutation.ReceiveNote(); !ok {
return &ValidationError{Name: "receiveNote", err: errors.New(`ent: missing required field "MaterialRequest.receiveNote"`)}
}
if v, ok := _c.mutation.ReceiveNote(); ok {
if err := materialrequest.ReceiveNoteValidator(v); err != nil {
return &ValidationError{Name: "receiveNote", err: fmt.Errorf(`ent: validator failed for field "MaterialRequest.receiveNote": %w`, err)}
}
}
if _, ok := _c.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "createdAt", err: errors.New(`ent: missing required field "MaterialRequest.createdAt"`)}
}
@@ -788,6 +842,18 @@ func (_c *MaterialRequestCreate) createSpec() (*MaterialRequest, *sqlgraph.Creat
_spec.SetField(materialrequest.FieldLossReason, field.TypeString, value)
_node.LossReason = value
}
if value, ok := _c.mutation.ReceiveQty(); ok {
_spec.SetField(materialrequest.FieldReceiveQty, field.TypeFloat64, value)
_node.ReceiveQty = &value
}
if value, ok := _c.mutation.ReceiveDiff(); ok {
_spec.SetField(materialrequest.FieldReceiveDiff, field.TypeFloat64, value)
_node.ReceiveDiff = &value
}
if value, ok := _c.mutation.ReceiveNote(); ok {
_spec.SetField(materialrequest.FieldReceiveNote, field.TypeString, value)
_node.ReceiveNote = value
}
if value, ok := _c.mutation.CreatedAt(); ok {
_spec.SetField(materialrequest.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value