From bb221486255fc8ad6189c52d92919f9256de88b9 Mon Sep 17 00:00:00 2001 From: SunYF <123@hard_man.com> Date: Tue, 1 Sep 2026 13:49:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E6=88=90=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E3=80=81=E8=A3=85=E7=AE=B1=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=8E=E6=8E=A5=E5=8F=A3=E6=A0=87=E5=87=86?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增区域状态字段与增删改查接口,支持区域启用/停用 - 重构实体字段JSON标签为camelCase格式统一接口规范 - 优化入库、盘点、装箱流程的交互与提示文案 - 新增装箱管理功能,支持合同号关联与装箱编辑 - 调整前端菜单与帮助文档适配业务场景变更 --- bj_power_wms/ent/inbounddetail.go | 10 +- bj_power_wms/ent/inbounddetail_query.go | 4 +- bj_power_wms/ent/inboundorder.go | 16 +- bj_power_wms/ent/inboundorder_query.go | 4 +- bj_power_wms/ent/inspectionrecord.go | 14 +- bj_power_wms/ent/inspectionrecord_query.go | 4 +- bj_power_wms/ent/inventorybatch.go | 18 +- bj_power_wms/ent/inventorybatch_query.go | 4 +- bj_power_wms/ent/inventorylock.go | 16 +- bj_power_wms/ent/inventorylock_query.go | 4 +- bj_power_wms/ent/material.go | 16 +- bj_power_wms/ent/migrate/schema.go | 14 + bj_power_wms/ent/mutation.go | 345 +++++++++++++++++- bj_power_wms/ent/ordermaterialledger.go | 14 +- bj_power_wms/ent/ordermaterialledger_query.go | 4 +- bj_power_wms/ent/outbounddetail.go | 12 +- bj_power_wms/ent/outbounddetail_query.go | 4 +- bj_power_wms/ent/outboundorder.go | 20 +- bj_power_wms/ent/outboundorder_query.go | 4 +- bj_power_wms/ent/packagebox.go | 34 +- bj_power_wms/ent/packagebox/packagebox.go | 18 + bj_power_wms/ent/packagebox/where.go | 135 +++++++ bj_power_wms/ent/packagebox_create.go | 180 +++++++++ bj_power_wms/ent/packagebox_query.go | 4 +- bj_power_wms/ent/packagebox_update.go | 124 +++++++ bj_power_wms/ent/runtime.go | 16 +- bj_power_wms/ent/semifinished.go | 12 +- bj_power_wms/ent/serialnumber.go | 18 +- bj_power_wms/ent/serialnumber_query.go | 4 +- bj_power_wms/ent/stocktakeitem.go | 18 +- bj_power_wms/ent/stocktakeitem_query.go | 4 +- bj_power_wms/ent/stocktakeorder.go | 8 +- bj_power_wms/ent/stocktakeorder_query.go | 4 +- bj_power_wms/ent/user.go | 10 +- bj_power_wms/ent/zone.go | 32 +- bj_power_wms/ent/zone/where.go | 125 +++++++ bj_power_wms/ent/zone/zone.go | 20 + bj_power_wms/ent/zone_create.go | 167 +++++++++ bj_power_wms/ent/zone_query.go | 4 +- bj_power_wms/ent/zone_update.go | 106 ++++++ bj_power_wms/internal/handler/inbound.go | 13 +- bj_power_wms/internal/handler/misc.go | 68 +++- bj_power_wms/internal/handler/routes.go | 3 + bj_power_wms/internal/handler/zone.go | 79 +++- bj_power_wms/schema/package_box.go | 4 + bj_power_wms/schema/zone.go | 2 + bj_power_wms/tools/generate.go | 49 ++- .../frontend/src/components/PageHelp.vue | 12 +- bj_power_wms_client/frontend/src/help.js | 21 +- .../frontend/src/layouts/MainLayout.vue | 2 +- .../frontend/src/pages/BaseData.vue | 248 ++++++++++--- .../frontend/src/pages/Dashboard.vue | 2 +- .../frontend/src/pages/Inbound.vue | 21 +- .../frontend/src/pages/Package.vue | 268 ++++++++++---- .../frontend/src/pages/Stocktake.vue | 8 +- .../frontend/src/router/index.js | 2 +- bj_power_wms_client/web/static/index.html | 13 - 问题修复记录.md | 38 ++ 问题记录.md | 172 ++++++++- 59 files changed, 2238 insertions(+), 357 deletions(-) delete mode 100644 bj_power_wms_client/web/static/index.html diff --git a/bj_power_wms/ent/inbounddetail.go b/bj_power_wms/ent/inbounddetail.go index 0db9bdd..f6f4550 100644 --- a/bj_power_wms/ent/inbounddetail.go +++ b/bj_power_wms/ent/inbounddetail.go @@ -17,17 +17,17 @@ type InboundDetail struct { // ID of the ent. ID int `json:"id,omitempty"` // 入库单号 - InboundNo string `json:"inbound_no,omitempty"` + InboundNo string `json:"inboundNo,omitempty"` // SN(精密件) - SnCode string `json:"sn_code,omitempty"` + SnCode string `json:"snCode,omitempty"` // 批次号(结构件) - BatchNo string `json:"batch_no,omitempty"` + BatchNo string `json:"batchNo,omitempty"` // 物料编码 - MaterialCode string `json:"material_code,omitempty"` + MaterialCode string `json:"materialCode,omitempty"` // 数量 Quantity int `json:"quantity,omitempty"` // CreatedAt holds the value of the "created_at" field. - CreatedAt int64 `json:"created_at,omitempty"` + CreatedAt int64 `json:"createdAt,omitempty"` selectValues sql.SelectValues } diff --git a/bj_power_wms/ent/inbounddetail_query.go b/bj_power_wms/ent/inbounddetail_query.go index d71c775..4b7f14f 100644 --- a/bj_power_wms/ent/inbounddetail_query.go +++ b/bj_power_wms/ent/inbounddetail_query.go @@ -262,7 +262,7 @@ func (_q *InboundDetailQuery) Clone() *InboundDetailQuery { // Example: // // var v []struct { -// InboundNo string `json:"inbound_no,omitempty"` +// InboundNo string `json:"inboundNo,omitempty"` // Count int `json:"count,omitempty"` // } // @@ -285,7 +285,7 @@ func (_q *InboundDetailQuery) GroupBy(field string, fields ...string) *InboundDe // Example: // // var v []struct { -// InboundNo string `json:"inbound_no,omitempty"` +// InboundNo string `json:"inboundNo,omitempty"` // } // // client.InboundDetail.Query(). diff --git a/bj_power_wms/ent/inboundorder.go b/bj_power_wms/ent/inboundorder.go index c26fefb..6089749 100644 --- a/bj_power_wms/ent/inboundorder.go +++ b/bj_power_wms/ent/inboundorder.go @@ -17,19 +17,19 @@ type InboundOrder struct { // ID of the ent. ID int `json:"id,omitempty"` // 入库单号 - InboundNo string `json:"inbound_no,omitempty"` + InboundNo string `json:"inboundNo,omitempty"` // 入库类型 - InboundType string `json:"inbound_type,omitempty"` + InboundType string `json:"inboundType,omitempty"` // 物料编码 - MaterialCode string `json:"material_code,omitempty"` + MaterialCode string `json:"materialCode,omitempty"` // 物料名称(冗余) - MaterialName string `json:"material_name,omitempty"` + MaterialName string `json:"materialName,omitempty"` // ManageMode holds the value of the "manage_mode" field. - ManageMode int `json:"manage_mode,omitempty"` + ManageMode int `json:"manageMode,omitempty"` // 批次号(结构件) - BatchNo string `json:"batch_no,omitempty"` + BatchNo string `json:"batchNo,omitempty"` // 入库区域 - ZoneCode string `json:"zone_code,omitempty"` + ZoneCode string `json:"zoneCode,omitempty"` // 数量 Quantity int `json:"quantity,omitempty"` // 操作人 @@ -37,7 +37,7 @@ type InboundOrder struct { // 备注 Remark string `json:"remark,omitempty"` // CreatedAt holds the value of the "created_at" field. - CreatedAt int64 `json:"created_at,omitempty"` + CreatedAt int64 `json:"createdAt,omitempty"` selectValues sql.SelectValues } diff --git a/bj_power_wms/ent/inboundorder_query.go b/bj_power_wms/ent/inboundorder_query.go index fa2bb14..913a25d 100644 --- a/bj_power_wms/ent/inboundorder_query.go +++ b/bj_power_wms/ent/inboundorder_query.go @@ -262,7 +262,7 @@ func (_q *InboundOrderQuery) Clone() *InboundOrderQuery { // Example: // // var v []struct { -// InboundNo string `json:"inbound_no,omitempty"` +// InboundNo string `json:"inboundNo,omitempty"` // Count int `json:"count,omitempty"` // } // @@ -285,7 +285,7 @@ func (_q *InboundOrderQuery) GroupBy(field string, fields ...string) *InboundOrd // Example: // // var v []struct { -// InboundNo string `json:"inbound_no,omitempty"` +// InboundNo string `json:"inboundNo,omitempty"` // } // // client.InboundOrder.Query(). diff --git a/bj_power_wms/ent/inspectionrecord.go b/bj_power_wms/ent/inspectionrecord.go index b361d00..eb7a9ab 100644 --- a/bj_power_wms/ent/inspectionrecord.go +++ b/bj_power_wms/ent/inspectionrecord.go @@ -17,25 +17,25 @@ type InspectionRecord struct { // ID of the ent. ID int `json:"id,omitempty"` // BATCH/SN - TargetType string `json:"target_type,omitempty"` + TargetType string `json:"targetType,omitempty"` // 批次号或 SN - TargetID string `json:"target_id,omitempty"` + TargetID string `json:"targetId,omitempty"` // 物料编码 - MaterialCode string `json:"material_code,omitempty"` + MaterialCode string `json:"materialCode,omitempty"` // 来料检/过程检/成品检 - InspectionType string `json:"inspection_type,omitempty"` + InspectionType string `json:"inspectionType,omitempty"` // 未检/合格/不合格 Status string `json:"status,omitempty"` // 实测值(部分检验项) - ResultValue string `json:"result_value,omitempty"` + ResultValue string `json:"resultValue,omitempty"` // 检验人 Inspector string `json:"inspector,omitempty"` // 备注 Remark string `json:"remark,omitempty"` // CreatedAt holds the value of the "created_at" field. - CreatedAt int64 `json:"created_at,omitempty"` + CreatedAt int64 `json:"createdAt,omitempty"` // UpdatedAt holds the value of the "updated_at" field. - UpdatedAt int64 `json:"updated_at,omitempty"` + UpdatedAt int64 `json:"updatedAt,omitempty"` selectValues sql.SelectValues } diff --git a/bj_power_wms/ent/inspectionrecord_query.go b/bj_power_wms/ent/inspectionrecord_query.go index 7016e6a..c11e61a 100644 --- a/bj_power_wms/ent/inspectionrecord_query.go +++ b/bj_power_wms/ent/inspectionrecord_query.go @@ -262,7 +262,7 @@ func (_q *InspectionRecordQuery) Clone() *InspectionRecordQuery { // Example: // // var v []struct { -// TargetType string `json:"target_type,omitempty"` +// TargetType string `json:"targetType,omitempty"` // Count int `json:"count,omitempty"` // } // @@ -285,7 +285,7 @@ func (_q *InspectionRecordQuery) GroupBy(field string, fields ...string) *Inspec // Example: // // var v []struct { -// TargetType string `json:"target_type,omitempty"` +// TargetType string `json:"targetType,omitempty"` // } // // client.InspectionRecord.Query(). diff --git a/bj_power_wms/ent/inventorybatch.go b/bj_power_wms/ent/inventorybatch.go index ecbb452..435c590 100644 --- a/bj_power_wms/ent/inventorybatch.go +++ b/bj_power_wms/ent/inventorybatch.go @@ -17,29 +17,29 @@ type InventoryBatch struct { // ID of the ent. ID int `json:"id,omitempty"` // 批次号(系统自动生成:日期+自增) - BatchNo string `json:"batch_no,omitempty"` + BatchNo string `json:"batchNo,omitempty"` // 物料编码 - MaterialCode string `json:"material_code,omitempty"` + MaterialCode string `json:"materialCode,omitempty"` // 物料名称(冗余) - MaterialName string `json:"material_name,omitempty"` + MaterialName string `json:"materialName,omitempty"` // 当前可用数量 Quantity int `json:"quantity,omitempty"` // 已锁定数量 - LockedQty int `json:"locked_qty,omitempty"` + LockedQty int `json:"lockedQty,omitempty"` // 生产日期 - ProductionDate string `json:"production_date,omitempty"` + ProductionDate string `json:"productionDate,omitempty"` // 供应商 Supplier string `json:"supplier,omitempty"` // 检验状态 未检/合格/不合格 - QualityStatus string `json:"quality_status,omitempty"` + QualityStatus string `json:"qualityStatus,omitempty"` // 所在区域 - ZoneCode string `json:"zone_code,omitempty"` + ZoneCode string `json:"zoneCode,omitempty"` // 备注 Remark string `json:"remark,omitempty"` // CreatedAt holds the value of the "created_at" field. - CreatedAt int64 `json:"created_at,omitempty"` + CreatedAt int64 `json:"createdAt,omitempty"` // UpdatedAt holds the value of the "updated_at" field. - UpdatedAt int64 `json:"updated_at,omitempty"` + UpdatedAt int64 `json:"updatedAt,omitempty"` selectValues sql.SelectValues } diff --git a/bj_power_wms/ent/inventorybatch_query.go b/bj_power_wms/ent/inventorybatch_query.go index 3af7cb6..f2ffd2b 100644 --- a/bj_power_wms/ent/inventorybatch_query.go +++ b/bj_power_wms/ent/inventorybatch_query.go @@ -262,7 +262,7 @@ func (_q *InventoryBatchQuery) Clone() *InventoryBatchQuery { // Example: // // var v []struct { -// BatchNo string `json:"batch_no,omitempty"` +// BatchNo string `json:"batchNo,omitempty"` // Count int `json:"count,omitempty"` // } // @@ -285,7 +285,7 @@ func (_q *InventoryBatchQuery) GroupBy(field string, fields ...string) *Inventor // Example: // // var v []struct { -// BatchNo string `json:"batch_no,omitempty"` +// BatchNo string `json:"batchNo,omitempty"` // } // // client.InventoryBatch.Query(). diff --git a/bj_power_wms/ent/inventorylock.go b/bj_power_wms/ent/inventorylock.go index 2276359..ea5f446 100644 --- a/bj_power_wms/ent/inventorylock.go +++ b/bj_power_wms/ent/inventorylock.go @@ -17,25 +17,25 @@ type InventoryLock struct { // ID of the ent. ID int `json:"id,omitempty"` // BATCH/SN - TargetType string `json:"target_type,omitempty"` + TargetType string `json:"targetType,omitempty"` // 批次号或 SN - TargetID string `json:"target_id,omitempty"` + TargetID string `json:"targetId,omitempty"` // 物料编码 - MaterialCode string `json:"material_code,omitempty"` + MaterialCode string `json:"materialCode,omitempty"` // 锁定数量 - LockedQty int `json:"locked_qty,omitempty"` + LockedQty int `json:"lockedQty,omitempty"` // 关联工单号 - OrderNo string `json:"order_no,omitempty"` + OrderNo string `json:"orderNo,omitempty"` // ACTIVE/RELEASED/CONSUMED Status string `json:"status,omitempty"` // 过期时间戳 - ExpiredAt int64 `json:"expired_at,omitempty"` + ExpiredAt int64 `json:"expiredAt,omitempty"` // 备注 Remark string `json:"remark,omitempty"` // CreatedAt holds the value of the "created_at" field. - CreatedAt int64 `json:"created_at,omitempty"` + CreatedAt int64 `json:"createdAt,omitempty"` // UpdatedAt holds the value of the "updated_at" field. - UpdatedAt int64 `json:"updated_at,omitempty"` + UpdatedAt int64 `json:"updatedAt,omitempty"` selectValues sql.SelectValues } diff --git a/bj_power_wms/ent/inventorylock_query.go b/bj_power_wms/ent/inventorylock_query.go index 9dce66d..cde6c9b 100644 --- a/bj_power_wms/ent/inventorylock_query.go +++ b/bj_power_wms/ent/inventorylock_query.go @@ -262,7 +262,7 @@ func (_q *InventoryLockQuery) Clone() *InventoryLockQuery { // Example: // // var v []struct { -// TargetType string `json:"target_type,omitempty"` +// TargetType string `json:"targetType,omitempty"` // Count int `json:"count,omitempty"` // } // @@ -285,7 +285,7 @@ func (_q *InventoryLockQuery) GroupBy(field string, fields ...string) *Inventory // Example: // // var v []struct { -// TargetType string `json:"target_type,omitempty"` +// TargetType string `json:"targetType,omitempty"` // } // // client.InventoryLock.Query(). diff --git a/bj_power_wms/ent/material.go b/bj_power_wms/ent/material.go index 27fc884..a8936e2 100644 --- a/bj_power_wms/ent/material.go +++ b/bj_power_wms/ent/material.go @@ -21,7 +21,7 @@ type Material struct { // 物料真实名称 Name string `json:"name,omitempty"` // 简称 - ShortName string `json:"short_name,omitempty"` + ShortName string `json:"shortName,omitempty"` // 规格型号 Spec string `json:"spec,omitempty"` // 单位 @@ -29,19 +29,19 @@ type Material struct { // 描述 Description string `json:"description,omitempty"` // 管理粒度 1批次/2序列号 - ManageMode int `json:"manage_mode,omitempty"` + ManageMode int `json:"manageMode,omitempty"` // 是否批次管理 - IsBatchManaged bool `json:"is_batch_managed,omitempty"` + IsBatchManaged bool `json:"isBatchManaged,omitempty"` // 是否序列号管理 - IsSerialManaged bool `json:"is_serial_managed,omitempty"` + IsSerialManaged bool `json:"isSerialManaged,omitempty"` // 物料总状态 raw/semi/finished - MaterialType string `json:"material_type,omitempty"` + MaterialType string `json:"materialType,omitempty"` // 物料模板编码(物料种类) - TemplateCode string `json:"template_code,omitempty"` + TemplateCode string `json:"templateCode,omitempty"` // 创建时间 - CreatedAt int64 `json:"created_at,omitempty"` + CreatedAt int64 `json:"createdAt,omitempty"` // 更新时间 - UpdatedAt int64 `json:"updated_at,omitempty"` + UpdatedAt int64 `json:"updatedAt,omitempty"` selectValues sql.SelectValues } diff --git a/bj_power_wms/ent/migrate/schema.go b/bj_power_wms/ent/migrate/schema.go index a9803b3..d133d50 100644 --- a/bj_power_wms/ent/migrate/schema.go +++ b/bj_power_wms/ent/migrate/schema.go @@ -341,8 +341,10 @@ var ( {Name: "material_code", Type: field.TypeString, Nullable: true}, {Name: "quantity", Type: field.TypeInt, Default: 0}, {Name: "operator", Type: field.TypeString, Nullable: true}, + {Name: "contract_no", Type: field.TypeString, Nullable: true}, {Name: "remark", Type: field.TypeString, Nullable: true}, {Name: "created_at", Type: field.TypeInt64}, + {Name: "updated_at", Type: field.TypeInt64, Nullable: true}, } // PackageBoxesTable holds the schema information for the "package_boxes" table. PackageBoxesTable = &schema.Table{ @@ -355,6 +357,16 @@ var ( Unique: false, Columns: []*schema.Column{PackageBoxesColumns[3]}, }, + { + Name: "packagebox_contract_no", + Unique: false, + Columns: []*schema.Column{PackageBoxesColumns[6]}, + }, + { + Name: "packagebox_operator", + Unique: false, + Columns: []*schema.Column{PackageBoxesColumns[5]}, + }, }, } // SemiFinishedsColumns holds the columns for the "semi_finisheds" table. @@ -514,7 +526,9 @@ var ( {Name: "zone_code", Type: field.TypeString, Unique: true}, {Name: "zone_name", Type: field.TypeString}, {Name: "description", Type: field.TypeString, Nullable: true}, + {Name: "status", Type: field.TypeString, Default: "启用"}, {Name: "created_at", Type: field.TypeInt64}, + {Name: "updated_at", Type: field.TypeInt64, Nullable: true}, } // ZonesTable holds the schema information for the "zones" table. ZonesTable = &schema.Table{ diff --git a/bj_power_wms/ent/mutation.go b/bj_power_wms/ent/mutation.go index 4602a41..0da6da6 100644 --- a/bj_power_wms/ent/mutation.go +++ b/bj_power_wms/ent/mutation.go @@ -9095,9 +9095,12 @@ type PackageBoxMutation struct { quantity *int addquantity *int operator *string + contract_no *string remark *string created_at *int64 addcreated_at *int64 + updated_at *int64 + addupdated_at *int64 clearedFields map[string]struct{} done bool oldValue func(context.Context) (*PackageBox, error) @@ -9441,6 +9444,55 @@ func (m *PackageBoxMutation) ResetOperator() { delete(m.clearedFields, packagebox.FieldOperator) } +// SetContractNo sets the "contract_no" field. +func (m *PackageBoxMutation) SetContractNo(s string) { + m.contract_no = &s +} + +// ContractNo returns the value of the "contract_no" field in the mutation. +func (m *PackageBoxMutation) ContractNo() (r string, exists bool) { + v := m.contract_no + if v == nil { + return + } + return *v, true +} + +// OldContractNo returns the old "contract_no" field's value of the PackageBox entity. +// If the PackageBox object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *PackageBoxMutation) OldContractNo(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldContractNo is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldContractNo requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldContractNo: %w", err) + } + return oldValue.ContractNo, nil +} + +// ClearContractNo clears the value of the "contract_no" field. +func (m *PackageBoxMutation) ClearContractNo() { + m.contract_no = nil + m.clearedFields[packagebox.FieldContractNo] = struct{}{} +} + +// ContractNoCleared returns if the "contract_no" field was cleared in this mutation. +func (m *PackageBoxMutation) ContractNoCleared() bool { + _, ok := m.clearedFields[packagebox.FieldContractNo] + return ok +} + +// ResetContractNo resets all changes to the "contract_no" field. +func (m *PackageBoxMutation) ResetContractNo() { + m.contract_no = nil + delete(m.clearedFields, packagebox.FieldContractNo) +} + // SetRemark sets the "remark" field. func (m *PackageBoxMutation) SetRemark(s string) { m.remark = &s @@ -9546,6 +9598,76 @@ func (m *PackageBoxMutation) ResetCreatedAt() { m.addcreated_at = nil } +// SetUpdatedAt sets the "updated_at" field. +func (m *PackageBoxMutation) SetUpdatedAt(i int64) { + m.updated_at = &i + m.addupdated_at = nil +} + +// UpdatedAt returns the value of the "updated_at" field in the mutation. +func (m *PackageBoxMutation) UpdatedAt() (r int64, exists bool) { + v := m.updated_at + if v == nil { + return + } + return *v, true +} + +// OldUpdatedAt returns the old "updated_at" field's value of the PackageBox entity. +// If the PackageBox object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *PackageBoxMutation) OldUpdatedAt(ctx context.Context) (v int64, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldUpdatedAt requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldUpdatedAt: %w", err) + } + return oldValue.UpdatedAt, nil +} + +// AddUpdatedAt adds i to the "updated_at" field. +func (m *PackageBoxMutation) AddUpdatedAt(i int64) { + if m.addupdated_at != nil { + *m.addupdated_at += i + } else { + m.addupdated_at = &i + } +} + +// AddedUpdatedAt returns the value that was added to the "updated_at" field in this mutation. +func (m *PackageBoxMutation) AddedUpdatedAt() (r int64, exists bool) { + v := m.addupdated_at + if v == nil { + return + } + return *v, true +} + +// ClearUpdatedAt clears the value of the "updated_at" field. +func (m *PackageBoxMutation) ClearUpdatedAt() { + m.updated_at = nil + m.addupdated_at = nil + m.clearedFields[packagebox.FieldUpdatedAt] = struct{}{} +} + +// UpdatedAtCleared returns if the "updated_at" field was cleared in this mutation. +func (m *PackageBoxMutation) UpdatedAtCleared() bool { + _, ok := m.clearedFields[packagebox.FieldUpdatedAt] + return ok +} + +// ResetUpdatedAt resets all changes to the "updated_at" field. +func (m *PackageBoxMutation) ResetUpdatedAt() { + m.updated_at = nil + m.addupdated_at = nil + delete(m.clearedFields, packagebox.FieldUpdatedAt) +} + // Where appends a list predicates to the PackageBoxMutation builder. func (m *PackageBoxMutation) Where(ps ...predicate.PackageBox) { m.predicates = append(m.predicates, ps...) @@ -9580,7 +9702,7 @@ func (m *PackageBoxMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *PackageBoxMutation) Fields() []string { - fields := make([]string, 0, 7) + fields := make([]string, 0, 9) if m.box_no != nil { fields = append(fields, packagebox.FieldBoxNo) } @@ -9596,12 +9718,18 @@ func (m *PackageBoxMutation) Fields() []string { if m.operator != nil { fields = append(fields, packagebox.FieldOperator) } + if m.contract_no != nil { + fields = append(fields, packagebox.FieldContractNo) + } if m.remark != nil { fields = append(fields, packagebox.FieldRemark) } if m.created_at != nil { fields = append(fields, packagebox.FieldCreatedAt) } + if m.updated_at != nil { + fields = append(fields, packagebox.FieldUpdatedAt) + } return fields } @@ -9620,10 +9748,14 @@ func (m *PackageBoxMutation) Field(name string) (ent.Value, bool) { return m.Quantity() case packagebox.FieldOperator: return m.Operator() + case packagebox.FieldContractNo: + return m.ContractNo() case packagebox.FieldRemark: return m.Remark() case packagebox.FieldCreatedAt: return m.CreatedAt() + case packagebox.FieldUpdatedAt: + return m.UpdatedAt() } return nil, false } @@ -9643,10 +9775,14 @@ func (m *PackageBoxMutation) OldField(ctx context.Context, name string) (ent.Val return m.OldQuantity(ctx) case packagebox.FieldOperator: return m.OldOperator(ctx) + case packagebox.FieldContractNo: + return m.OldContractNo(ctx) case packagebox.FieldRemark: return m.OldRemark(ctx) case packagebox.FieldCreatedAt: return m.OldCreatedAt(ctx) + case packagebox.FieldUpdatedAt: + return m.OldUpdatedAt(ctx) } return nil, fmt.Errorf("unknown PackageBox field %s", name) } @@ -9691,6 +9827,13 @@ func (m *PackageBoxMutation) SetField(name string, value ent.Value) error { } m.SetOperator(v) return nil + case packagebox.FieldContractNo: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetContractNo(v) + return nil case packagebox.FieldRemark: v, ok := value.(string) if !ok { @@ -9705,6 +9848,13 @@ func (m *PackageBoxMutation) SetField(name string, value ent.Value) error { } m.SetCreatedAt(v) return nil + case packagebox.FieldUpdatedAt: + v, ok := value.(int64) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetUpdatedAt(v) + return nil } return fmt.Errorf("unknown PackageBox field %s", name) } @@ -9719,6 +9869,9 @@ func (m *PackageBoxMutation) AddedFields() []string { if m.addcreated_at != nil { fields = append(fields, packagebox.FieldCreatedAt) } + if m.addupdated_at != nil { + fields = append(fields, packagebox.FieldUpdatedAt) + } return fields } @@ -9731,6 +9884,8 @@ func (m *PackageBoxMutation) AddedField(name string) (ent.Value, bool) { return m.AddedQuantity() case packagebox.FieldCreatedAt: return m.AddedCreatedAt() + case packagebox.FieldUpdatedAt: + return m.AddedUpdatedAt() } return nil, false } @@ -9754,6 +9909,13 @@ func (m *PackageBoxMutation) AddField(name string, value ent.Value) error { } m.AddCreatedAt(v) return nil + case packagebox.FieldUpdatedAt: + v, ok := value.(int64) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.AddUpdatedAt(v) + return nil } return fmt.Errorf("unknown PackageBox numeric field %s", name) } @@ -9771,9 +9933,15 @@ func (m *PackageBoxMutation) ClearedFields() []string { if m.FieldCleared(packagebox.FieldOperator) { fields = append(fields, packagebox.FieldOperator) } + if m.FieldCleared(packagebox.FieldContractNo) { + fields = append(fields, packagebox.FieldContractNo) + } if m.FieldCleared(packagebox.FieldRemark) { fields = append(fields, packagebox.FieldRemark) } + if m.FieldCleared(packagebox.FieldUpdatedAt) { + fields = append(fields, packagebox.FieldUpdatedAt) + } return fields } @@ -9797,9 +9965,15 @@ func (m *PackageBoxMutation) ClearField(name string) error { case packagebox.FieldOperator: m.ClearOperator() return nil + case packagebox.FieldContractNo: + m.ClearContractNo() + return nil case packagebox.FieldRemark: m.ClearRemark() return nil + case packagebox.FieldUpdatedAt: + m.ClearUpdatedAt() + return nil } return fmt.Errorf("unknown PackageBox nullable field %s", name) } @@ -9823,12 +9997,18 @@ func (m *PackageBoxMutation) ResetField(name string) error { case packagebox.FieldOperator: m.ResetOperator() return nil + case packagebox.FieldContractNo: + m.ResetContractNo() + return nil case packagebox.FieldRemark: m.ResetRemark() return nil case packagebox.FieldCreatedAt: m.ResetCreatedAt() return nil + case packagebox.FieldUpdatedAt: + m.ResetUpdatedAt() + return nil } return fmt.Errorf("unknown PackageBox field %s", name) } @@ -14565,8 +14745,11 @@ type ZoneMutation struct { zone_code *string zone_name *string description *string + status *string created_at *int64 addcreated_at *int64 + updated_at *int64 + addupdated_at *int64 clearedFields map[string]struct{} done bool oldValue func(context.Context) (*Zone, error) @@ -14792,6 +14975,42 @@ func (m *ZoneMutation) ResetDescription() { delete(m.clearedFields, zone.FieldDescription) } +// SetStatus sets the "status" field. +func (m *ZoneMutation) SetStatus(s string) { + m.status = &s +} + +// Status returns the value of the "status" field in the mutation. +func (m *ZoneMutation) Status() (r string, exists bool) { + v := m.status + if v == nil { + return + } + return *v, true +} + +// OldStatus returns the old "status" field's value of the Zone entity. +// If the Zone object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *ZoneMutation) OldStatus(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldStatus is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldStatus requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldStatus: %w", err) + } + return oldValue.Status, nil +} + +// ResetStatus resets all changes to the "status" field. +func (m *ZoneMutation) ResetStatus() { + m.status = nil +} + // SetCreatedAt sets the "created_at" field. func (m *ZoneMutation) SetCreatedAt(i int64) { m.created_at = &i @@ -14848,6 +15067,76 @@ func (m *ZoneMutation) ResetCreatedAt() { m.addcreated_at = nil } +// SetUpdatedAt sets the "updated_at" field. +func (m *ZoneMutation) SetUpdatedAt(i int64) { + m.updated_at = &i + m.addupdated_at = nil +} + +// UpdatedAt returns the value of the "updated_at" field in the mutation. +func (m *ZoneMutation) UpdatedAt() (r int64, exists bool) { + v := m.updated_at + if v == nil { + return + } + return *v, true +} + +// OldUpdatedAt returns the old "updated_at" field's value of the Zone entity. +// If the Zone object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *ZoneMutation) OldUpdatedAt(ctx context.Context) (v int64, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldUpdatedAt requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldUpdatedAt: %w", err) + } + return oldValue.UpdatedAt, nil +} + +// AddUpdatedAt adds i to the "updated_at" field. +func (m *ZoneMutation) AddUpdatedAt(i int64) { + if m.addupdated_at != nil { + *m.addupdated_at += i + } else { + m.addupdated_at = &i + } +} + +// AddedUpdatedAt returns the value that was added to the "updated_at" field in this mutation. +func (m *ZoneMutation) AddedUpdatedAt() (r int64, exists bool) { + v := m.addupdated_at + if v == nil { + return + } + return *v, true +} + +// ClearUpdatedAt clears the value of the "updated_at" field. +func (m *ZoneMutation) ClearUpdatedAt() { + m.updated_at = nil + m.addupdated_at = nil + m.clearedFields[zone.FieldUpdatedAt] = struct{}{} +} + +// UpdatedAtCleared returns if the "updated_at" field was cleared in this mutation. +func (m *ZoneMutation) UpdatedAtCleared() bool { + _, ok := m.clearedFields[zone.FieldUpdatedAt] + return ok +} + +// ResetUpdatedAt resets all changes to the "updated_at" field. +func (m *ZoneMutation) ResetUpdatedAt() { + m.updated_at = nil + m.addupdated_at = nil + delete(m.clearedFields, zone.FieldUpdatedAt) +} + // Where appends a list predicates to the ZoneMutation builder. func (m *ZoneMutation) Where(ps ...predicate.Zone) { m.predicates = append(m.predicates, ps...) @@ -14882,7 +15171,7 @@ func (m *ZoneMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *ZoneMutation) Fields() []string { - fields := make([]string, 0, 4) + fields := make([]string, 0, 6) if m.zone_code != nil { fields = append(fields, zone.FieldZoneCode) } @@ -14892,9 +15181,15 @@ func (m *ZoneMutation) Fields() []string { if m.description != nil { fields = append(fields, zone.FieldDescription) } + if m.status != nil { + fields = append(fields, zone.FieldStatus) + } if m.created_at != nil { fields = append(fields, zone.FieldCreatedAt) } + if m.updated_at != nil { + fields = append(fields, zone.FieldUpdatedAt) + } return fields } @@ -14909,8 +15204,12 @@ func (m *ZoneMutation) Field(name string) (ent.Value, bool) { return m.ZoneName() case zone.FieldDescription: return m.Description() + case zone.FieldStatus: + return m.Status() case zone.FieldCreatedAt: return m.CreatedAt() + case zone.FieldUpdatedAt: + return m.UpdatedAt() } return nil, false } @@ -14926,8 +15225,12 @@ func (m *ZoneMutation) OldField(ctx context.Context, name string) (ent.Value, er return m.OldZoneName(ctx) case zone.FieldDescription: return m.OldDescription(ctx) + case zone.FieldStatus: + return m.OldStatus(ctx) case zone.FieldCreatedAt: return m.OldCreatedAt(ctx) + case zone.FieldUpdatedAt: + return m.OldUpdatedAt(ctx) } return nil, fmt.Errorf("unknown Zone field %s", name) } @@ -14958,6 +15261,13 @@ func (m *ZoneMutation) SetField(name string, value ent.Value) error { } m.SetDescription(v) return nil + case zone.FieldStatus: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetStatus(v) + return nil case zone.FieldCreatedAt: v, ok := value.(int64) if !ok { @@ -14965,6 +15275,13 @@ func (m *ZoneMutation) SetField(name string, value ent.Value) error { } m.SetCreatedAt(v) return nil + case zone.FieldUpdatedAt: + v, ok := value.(int64) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetUpdatedAt(v) + return nil } return fmt.Errorf("unknown Zone field %s", name) } @@ -14976,6 +15293,9 @@ func (m *ZoneMutation) AddedFields() []string { if m.addcreated_at != nil { fields = append(fields, zone.FieldCreatedAt) } + if m.addupdated_at != nil { + fields = append(fields, zone.FieldUpdatedAt) + } return fields } @@ -14986,6 +15306,8 @@ func (m *ZoneMutation) AddedField(name string) (ent.Value, bool) { switch name { case zone.FieldCreatedAt: return m.AddedCreatedAt() + case zone.FieldUpdatedAt: + return m.AddedUpdatedAt() } return nil, false } @@ -15002,6 +15324,13 @@ func (m *ZoneMutation) AddField(name string, value ent.Value) error { } m.AddCreatedAt(v) return nil + case zone.FieldUpdatedAt: + v, ok := value.(int64) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.AddUpdatedAt(v) + return nil } return fmt.Errorf("unknown Zone numeric field %s", name) } @@ -15013,6 +15342,9 @@ func (m *ZoneMutation) ClearedFields() []string { if m.FieldCleared(zone.FieldDescription) { fields = append(fields, zone.FieldDescription) } + if m.FieldCleared(zone.FieldUpdatedAt) { + fields = append(fields, zone.FieldUpdatedAt) + } return fields } @@ -15030,6 +15362,9 @@ func (m *ZoneMutation) ClearField(name string) error { case zone.FieldDescription: m.ClearDescription() return nil + case zone.FieldUpdatedAt: + m.ClearUpdatedAt() + return nil } return fmt.Errorf("unknown Zone nullable field %s", name) } @@ -15047,9 +15382,15 @@ func (m *ZoneMutation) ResetField(name string) error { case zone.FieldDescription: m.ResetDescription() return nil + case zone.FieldStatus: + m.ResetStatus() + return nil case zone.FieldCreatedAt: m.ResetCreatedAt() return nil + case zone.FieldUpdatedAt: + m.ResetUpdatedAt() + return nil } return fmt.Errorf("unknown Zone field %s", name) } diff --git a/bj_power_wms/ent/ordermaterialledger.go b/bj_power_wms/ent/ordermaterialledger.go index b911587..3ccf431 100644 --- a/bj_power_wms/ent/ordermaterialledger.go +++ b/bj_power_wms/ent/ordermaterialledger.go @@ -17,23 +17,23 @@ type OrderMaterialLedger struct { // ID of the ent. ID int `json:"id,omitempty"` // 工单号 - OrderNo string `json:"order_no,omitempty"` + OrderNo string `json:"orderNo,omitempty"` // 物料编码 - MaterialCode string `json:"material_code,omitempty"` + MaterialCode string `json:"materialCode,omitempty"` // 物料名称(冗余) - MaterialName string `json:"material_name,omitempty"` + MaterialName string `json:"materialName,omitempty"` // 物料总需求数量 - TotalQty int `json:"total_qty,omitempty"` + TotalQty int `json:"totalQty,omitempty"` // 累计已出库数量 - OutQty int `json:"out_qty,omitempty"` + OutQty int `json:"outQty,omitempty"` // 进行中/领料完结 Status string `json:"status,omitempty"` // 备注 Remark string `json:"remark,omitempty"` // CreatedAt holds the value of the "created_at" field. - CreatedAt int64 `json:"created_at,omitempty"` + CreatedAt int64 `json:"createdAt,omitempty"` // UpdatedAt holds the value of the "updated_at" field. - UpdatedAt int64 `json:"updated_at,omitempty"` + UpdatedAt int64 `json:"updatedAt,omitempty"` selectValues sql.SelectValues } diff --git a/bj_power_wms/ent/ordermaterialledger_query.go b/bj_power_wms/ent/ordermaterialledger_query.go index fe8808e..346d926 100644 --- a/bj_power_wms/ent/ordermaterialledger_query.go +++ b/bj_power_wms/ent/ordermaterialledger_query.go @@ -262,7 +262,7 @@ func (_q *OrderMaterialLedgerQuery) Clone() *OrderMaterialLedgerQuery { // Example: // // var v []struct { -// OrderNo string `json:"order_no,omitempty"` +// OrderNo string `json:"orderNo,omitempty"` // Count int `json:"count,omitempty"` // } // @@ -285,7 +285,7 @@ func (_q *OrderMaterialLedgerQuery) GroupBy(field string, fields ...string) *Ord // Example: // // var v []struct { -// OrderNo string `json:"order_no,omitempty"` +// OrderNo string `json:"orderNo,omitempty"` // } // // client.OrderMaterialLedger.Query(). diff --git a/bj_power_wms/ent/outbounddetail.go b/bj_power_wms/ent/outbounddetail.go index 1f22548..1da5a04 100644 --- a/bj_power_wms/ent/outbounddetail.go +++ b/bj_power_wms/ent/outbounddetail.go @@ -17,19 +17,19 @@ type OutboundDetail struct { // ID of the ent. ID int `json:"id,omitempty"` // 出库单号 - OutboundNo string `json:"outbound_no,omitempty"` + OutboundNo string `json:"outboundNo,omitempty"` // SN(精密件) - SnCode string `json:"sn_code,omitempty"` + SnCode string `json:"snCode,omitempty"` // 批次号(结构件) - BatchNo string `json:"batch_no,omitempty"` + BatchNo string `json:"batchNo,omitempty"` // 物料编码 - MaterialCode string `json:"material_code,omitempty"` + MaterialCode string `json:"materialCode,omitempty"` // 数量 Quantity int `json:"quantity,omitempty"` // 关联工单号 - OrderNo string `json:"order_no,omitempty"` + OrderNo string `json:"orderNo,omitempty"` // CreatedAt holds the value of the "created_at" field. - CreatedAt int64 `json:"created_at,omitempty"` + CreatedAt int64 `json:"createdAt,omitempty"` selectValues sql.SelectValues } diff --git a/bj_power_wms/ent/outbounddetail_query.go b/bj_power_wms/ent/outbounddetail_query.go index 018cc1f..8e21a62 100644 --- a/bj_power_wms/ent/outbounddetail_query.go +++ b/bj_power_wms/ent/outbounddetail_query.go @@ -262,7 +262,7 @@ func (_q *OutboundDetailQuery) Clone() *OutboundDetailQuery { // Example: // // var v []struct { -// OutboundNo string `json:"outbound_no,omitempty"` +// OutboundNo string `json:"outboundNo,omitempty"` // Count int `json:"count,omitempty"` // } // @@ -285,7 +285,7 @@ func (_q *OutboundDetailQuery) GroupBy(field string, fields ...string) *Outbound // Example: // // var v []struct { -// OutboundNo string `json:"outbound_no,omitempty"` +// OutboundNo string `json:"outboundNo,omitempty"` // } // // client.OutboundDetail.Query(). diff --git a/bj_power_wms/ent/outboundorder.go b/bj_power_wms/ent/outboundorder.go index 575bb83..00b1808 100644 --- a/bj_power_wms/ent/outboundorder.go +++ b/bj_power_wms/ent/outboundorder.go @@ -17,21 +17,21 @@ type OutboundOrder struct { // ID of the ent. ID int `json:"id,omitempty"` // 出库单号 - OutboundNo string `json:"outbound_no,omitempty"` + OutboundNo string `json:"outboundNo,omitempty"` // 出库类型 - OutboundType string `json:"outbound_type,omitempty"` + OutboundType string `json:"outboundType,omitempty"` // 关联工单号(工单为唯一挂靠载体) - OrderNo string `json:"order_no,omitempty"` + OrderNo string `json:"orderNo,omitempty"` // 物料编码 - MaterialCode string `json:"material_code,omitempty"` + MaterialCode string `json:"materialCode,omitempty"` // 物料名称(冗余) - MaterialName string `json:"material_name,omitempty"` + MaterialName string `json:"materialName,omitempty"` // ManageMode holds the value of the "manage_mode" field. - ManageMode int `json:"manage_mode,omitempty"` + ManageMode int `json:"manageMode,omitempty"` // 批次号(结构件) - BatchNo string `json:"batch_no,omitempty"` + BatchNo string `json:"batchNo,omitempty"` // 出库区域 - ZoneCode string `json:"zone_code,omitempty"` + ZoneCode string `json:"zoneCode,omitempty"` // 数量 Quantity int `json:"quantity,omitempty"` // 操作人 @@ -39,11 +39,11 @@ type OutboundOrder struct { // 复核人 Reviewer string `json:"reviewer,omitempty"` // 目标接驳台(AGV配送) - TargetDock string `json:"target_dock,omitempty"` + TargetDock string `json:"targetDock,omitempty"` // 备注 Remark string `json:"remark,omitempty"` // CreatedAt holds the value of the "created_at" field. - CreatedAt int64 `json:"created_at,omitempty"` + CreatedAt int64 `json:"createdAt,omitempty"` selectValues sql.SelectValues } diff --git a/bj_power_wms/ent/outboundorder_query.go b/bj_power_wms/ent/outboundorder_query.go index af3b93b..d6dae2e 100644 --- a/bj_power_wms/ent/outboundorder_query.go +++ b/bj_power_wms/ent/outboundorder_query.go @@ -262,7 +262,7 @@ func (_q *OutboundOrderQuery) Clone() *OutboundOrderQuery { // Example: // // var v []struct { -// OutboundNo string `json:"outbound_no,omitempty"` +// OutboundNo string `json:"outboundNo,omitempty"` // Count int `json:"count,omitempty"` // } // @@ -285,7 +285,7 @@ func (_q *OutboundOrderQuery) GroupBy(field string, fields ...string) *OutboundO // Example: // // var v []struct { -// OutboundNo string `json:"outbound_no,omitempty"` +// OutboundNo string `json:"outboundNo,omitempty"` // } // // client.OutboundOrder.Query(). diff --git a/bj_power_wms/ent/packagebox.go b/bj_power_wms/ent/packagebox.go index f5d3a4a..6a24fe9 100644 --- a/bj_power_wms/ent/packagebox.go +++ b/bj_power_wms/ent/packagebox.go @@ -17,19 +17,23 @@ type PackageBox struct { // ID of the ent. ID int `json:"id,omitempty"` // 箱号 - BoxNo string `json:"box_no,omitempty"` + BoxNo string `json:"boxNo,omitempty"` // 箱内 SN 列表 - SnList string `json:"sn_list,omitempty"` + SnList string `json:"snList,omitempty"` // 物料编码 - MaterialCode string `json:"material_code,omitempty"` + MaterialCode string `json:"materialCode,omitempty"` // 箱内数量 Quantity int `json:"quantity,omitempty"` // 包装人 Operator string `json:"operator,omitempty"` + // 合同号(选填) + ContractNo string `json:"contractNo,omitempty"` // 备注 Remark string `json:"remark,omitempty"` // CreatedAt holds the value of the "created_at" field. - CreatedAt int64 `json:"created_at,omitempty"` + CreatedAt int64 `json:"createdAt,omitempty"` + // 更新时间 + UpdatedAt int64 `json:"updatedAt,omitempty"` selectValues sql.SelectValues } @@ -38,9 +42,9 @@ func (*PackageBox) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { - case packagebox.FieldID, packagebox.FieldQuantity, packagebox.FieldCreatedAt: + case packagebox.FieldID, packagebox.FieldQuantity, packagebox.FieldCreatedAt, packagebox.FieldUpdatedAt: values[i] = new(sql.NullInt64) - case packagebox.FieldBoxNo, packagebox.FieldSnList, packagebox.FieldMaterialCode, packagebox.FieldOperator, packagebox.FieldRemark: + case packagebox.FieldBoxNo, packagebox.FieldSnList, packagebox.FieldMaterialCode, packagebox.FieldOperator, packagebox.FieldContractNo, packagebox.FieldRemark: values[i] = new(sql.NullString) default: values[i] = new(sql.UnknownType) @@ -93,6 +97,12 @@ func (_m *PackageBox) assignValues(columns []string, values []any) error { } else if value.Valid { _m.Operator = value.String } + case packagebox.FieldContractNo: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field contract_no", values[i]) + } else if value.Valid { + _m.ContractNo = value.String + } case packagebox.FieldRemark: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field remark", values[i]) @@ -105,6 +115,12 @@ func (_m *PackageBox) assignValues(columns []string, values []any) error { } else if value.Valid { _m.CreatedAt = value.Int64 } + case packagebox.FieldUpdatedAt: + if value, ok := values[i].(*sql.NullInt64); !ok { + return fmt.Errorf("unexpected type %T for field updated_at", values[i]) + } else if value.Valid { + _m.UpdatedAt = value.Int64 + } default: _m.selectValues.Set(columns[i], values[i]) } @@ -156,11 +172,17 @@ func (_m *PackageBox) String() string { builder.WriteString("operator=") builder.WriteString(_m.Operator) builder.WriteString(", ") + builder.WriteString("contract_no=") + builder.WriteString(_m.ContractNo) + builder.WriteString(", ") builder.WriteString("remark=") builder.WriteString(_m.Remark) builder.WriteString(", ") builder.WriteString("created_at=") builder.WriteString(fmt.Sprintf("%v", _m.CreatedAt)) + builder.WriteString(", ") + builder.WriteString("updated_at=") + builder.WriteString(fmt.Sprintf("%v", _m.UpdatedAt)) builder.WriteByte(')') return builder.String() } diff --git a/bj_power_wms/ent/packagebox/packagebox.go b/bj_power_wms/ent/packagebox/packagebox.go index 6ec970f..7743d54 100644 --- a/bj_power_wms/ent/packagebox/packagebox.go +++ b/bj_power_wms/ent/packagebox/packagebox.go @@ -21,10 +21,14 @@ const ( FieldQuantity = "quantity" // FieldOperator holds the string denoting the operator field in the database. FieldOperator = "operator" + // FieldContractNo holds the string denoting the contract_no field in the database. + FieldContractNo = "contract_no" // FieldRemark holds the string denoting the remark field in the database. FieldRemark = "remark" // FieldCreatedAt holds the string denoting the created_at field in the database. FieldCreatedAt = "created_at" + // FieldUpdatedAt holds the string denoting the updated_at field in the database. + FieldUpdatedAt = "updated_at" // Table holds the table name of the packagebox in the database. Table = "package_boxes" ) @@ -37,8 +41,10 @@ var Columns = []string{ FieldMaterialCode, FieldQuantity, FieldOperator, + FieldContractNo, FieldRemark, FieldCreatedAt, + FieldUpdatedAt, } // ValidColumn reports if the column name is valid (part of the table columns). @@ -56,6 +62,8 @@ var ( DefaultQuantity int // DefaultCreatedAt holds the default value on creation for the "created_at" field. DefaultCreatedAt func() int64 + // DefaultUpdatedAt holds the default value on creation for the "updated_at" field. + DefaultUpdatedAt func() int64 ) // OrderOption defines the ordering options for the PackageBox queries. @@ -91,6 +99,11 @@ func ByOperator(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldOperator, opts...).ToFunc() } +// ByContractNo orders the results by the contract_no field. +func ByContractNo(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldContractNo, opts...).ToFunc() +} + // ByRemark orders the results by the remark field. func ByRemark(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldRemark, opts...).ToFunc() @@ -100,3 +113,8 @@ func ByRemark(opts ...sql.OrderTermOption) OrderOption { func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCreatedAt, opts...).ToFunc() } + +// ByUpdatedAt orders the results by the updated_at field. +func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc() +} diff --git a/bj_power_wms/ent/packagebox/where.go b/bj_power_wms/ent/packagebox/where.go index 813713e..81f6e1c 100644 --- a/bj_power_wms/ent/packagebox/where.go +++ b/bj_power_wms/ent/packagebox/where.go @@ -78,6 +78,11 @@ func Operator(v string) predicate.PackageBox { return predicate.PackageBox(sql.FieldEQ(FieldOperator, v)) } +// ContractNo applies equality check predicate on the "contract_no" field. It's identical to ContractNoEQ. +func ContractNo(v string) predicate.PackageBox { + return predicate.PackageBox(sql.FieldEQ(FieldContractNo, v)) +} + // Remark applies equality check predicate on the "remark" field. It's identical to RemarkEQ. func Remark(v string) predicate.PackageBox { return predicate.PackageBox(sql.FieldEQ(FieldRemark, v)) @@ -88,6 +93,11 @@ func CreatedAt(v int64) predicate.PackageBox { return predicate.PackageBox(sql.FieldEQ(FieldCreatedAt, v)) } +// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ. +func UpdatedAt(v int64) predicate.PackageBox { + return predicate.PackageBox(sql.FieldEQ(FieldUpdatedAt, v)) +} + // BoxNoEQ applies the EQ predicate on the "box_no" field. func BoxNoEQ(v string) predicate.PackageBox { return predicate.PackageBox(sql.FieldEQ(FieldBoxNo, v)) @@ -418,6 +428,81 @@ func OperatorContainsFold(v string) predicate.PackageBox { return predicate.PackageBox(sql.FieldContainsFold(FieldOperator, v)) } +// ContractNoEQ applies the EQ predicate on the "contract_no" field. +func ContractNoEQ(v string) predicate.PackageBox { + return predicate.PackageBox(sql.FieldEQ(FieldContractNo, v)) +} + +// ContractNoNEQ applies the NEQ predicate on the "contract_no" field. +func ContractNoNEQ(v string) predicate.PackageBox { + return predicate.PackageBox(sql.FieldNEQ(FieldContractNo, v)) +} + +// ContractNoIn applies the In predicate on the "contract_no" field. +func ContractNoIn(vs ...string) predicate.PackageBox { + return predicate.PackageBox(sql.FieldIn(FieldContractNo, vs...)) +} + +// ContractNoNotIn applies the NotIn predicate on the "contract_no" field. +func ContractNoNotIn(vs ...string) predicate.PackageBox { + return predicate.PackageBox(sql.FieldNotIn(FieldContractNo, vs...)) +} + +// ContractNoGT applies the GT predicate on the "contract_no" field. +func ContractNoGT(v string) predicate.PackageBox { + return predicate.PackageBox(sql.FieldGT(FieldContractNo, v)) +} + +// ContractNoGTE applies the GTE predicate on the "contract_no" field. +func ContractNoGTE(v string) predicate.PackageBox { + return predicate.PackageBox(sql.FieldGTE(FieldContractNo, v)) +} + +// ContractNoLT applies the LT predicate on the "contract_no" field. +func ContractNoLT(v string) predicate.PackageBox { + return predicate.PackageBox(sql.FieldLT(FieldContractNo, v)) +} + +// ContractNoLTE applies the LTE predicate on the "contract_no" field. +func ContractNoLTE(v string) predicate.PackageBox { + return predicate.PackageBox(sql.FieldLTE(FieldContractNo, v)) +} + +// ContractNoContains applies the Contains predicate on the "contract_no" field. +func ContractNoContains(v string) predicate.PackageBox { + return predicate.PackageBox(sql.FieldContains(FieldContractNo, v)) +} + +// ContractNoHasPrefix applies the HasPrefix predicate on the "contract_no" field. +func ContractNoHasPrefix(v string) predicate.PackageBox { + return predicate.PackageBox(sql.FieldHasPrefix(FieldContractNo, v)) +} + +// ContractNoHasSuffix applies the HasSuffix predicate on the "contract_no" field. +func ContractNoHasSuffix(v string) predicate.PackageBox { + return predicate.PackageBox(sql.FieldHasSuffix(FieldContractNo, v)) +} + +// ContractNoIsNil applies the IsNil predicate on the "contract_no" field. +func ContractNoIsNil() predicate.PackageBox { + return predicate.PackageBox(sql.FieldIsNull(FieldContractNo)) +} + +// ContractNoNotNil applies the NotNil predicate on the "contract_no" field. +func ContractNoNotNil() predicate.PackageBox { + return predicate.PackageBox(sql.FieldNotNull(FieldContractNo)) +} + +// ContractNoEqualFold applies the EqualFold predicate on the "contract_no" field. +func ContractNoEqualFold(v string) predicate.PackageBox { + return predicate.PackageBox(sql.FieldEqualFold(FieldContractNo, v)) +} + +// ContractNoContainsFold applies the ContainsFold predicate on the "contract_no" field. +func ContractNoContainsFold(v string) predicate.PackageBox { + return predicate.PackageBox(sql.FieldContainsFold(FieldContractNo, v)) +} + // RemarkEQ applies the EQ predicate on the "remark" field. func RemarkEQ(v string) predicate.PackageBox { return predicate.PackageBox(sql.FieldEQ(FieldRemark, v)) @@ -533,6 +618,56 @@ func CreatedAtLTE(v int64) predicate.PackageBox { return predicate.PackageBox(sql.FieldLTE(FieldCreatedAt, v)) } +// UpdatedAtEQ applies the EQ predicate on the "updated_at" field. +func UpdatedAtEQ(v int64) predicate.PackageBox { + return predicate.PackageBox(sql.FieldEQ(FieldUpdatedAt, v)) +} + +// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field. +func UpdatedAtNEQ(v int64) predicate.PackageBox { + return predicate.PackageBox(sql.FieldNEQ(FieldUpdatedAt, v)) +} + +// UpdatedAtIn applies the In predicate on the "updated_at" field. +func UpdatedAtIn(vs ...int64) predicate.PackageBox { + return predicate.PackageBox(sql.FieldIn(FieldUpdatedAt, vs...)) +} + +// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field. +func UpdatedAtNotIn(vs ...int64) predicate.PackageBox { + return predicate.PackageBox(sql.FieldNotIn(FieldUpdatedAt, vs...)) +} + +// UpdatedAtGT applies the GT predicate on the "updated_at" field. +func UpdatedAtGT(v int64) predicate.PackageBox { + return predicate.PackageBox(sql.FieldGT(FieldUpdatedAt, v)) +} + +// UpdatedAtGTE applies the GTE predicate on the "updated_at" field. +func UpdatedAtGTE(v int64) predicate.PackageBox { + return predicate.PackageBox(sql.FieldGTE(FieldUpdatedAt, v)) +} + +// UpdatedAtLT applies the LT predicate on the "updated_at" field. +func UpdatedAtLT(v int64) predicate.PackageBox { + return predicate.PackageBox(sql.FieldLT(FieldUpdatedAt, v)) +} + +// UpdatedAtLTE applies the LTE predicate on the "updated_at" field. +func UpdatedAtLTE(v int64) predicate.PackageBox { + return predicate.PackageBox(sql.FieldLTE(FieldUpdatedAt, v)) +} + +// UpdatedAtIsNil applies the IsNil predicate on the "updated_at" field. +func UpdatedAtIsNil() predicate.PackageBox { + return predicate.PackageBox(sql.FieldIsNull(FieldUpdatedAt)) +} + +// UpdatedAtNotNil applies the NotNil predicate on the "updated_at" field. +func UpdatedAtNotNil() predicate.PackageBox { + return predicate.PackageBox(sql.FieldNotNull(FieldUpdatedAt)) +} + // And groups predicates with the AND operator between them. func And(predicates ...predicate.PackageBox) predicate.PackageBox { return predicate.PackageBox(sql.AndPredicates(predicates...)) diff --git a/bj_power_wms/ent/packagebox_create.go b/bj_power_wms/ent/packagebox_create.go index 6473663..7f0d686 100644 --- a/bj_power_wms/ent/packagebox_create.go +++ b/bj_power_wms/ent/packagebox_create.go @@ -83,6 +83,20 @@ func (_c *PackageBoxCreate) SetNillableOperator(v *string) *PackageBoxCreate { return _c } +// SetContractNo sets the "contract_no" field. +func (_c *PackageBoxCreate) SetContractNo(v string) *PackageBoxCreate { + _c.mutation.SetContractNo(v) + return _c +} + +// SetNillableContractNo sets the "contract_no" field if the given value is not nil. +func (_c *PackageBoxCreate) SetNillableContractNo(v *string) *PackageBoxCreate { + if v != nil { + _c.SetContractNo(*v) + } + return _c +} + // SetRemark sets the "remark" field. func (_c *PackageBoxCreate) SetRemark(v string) *PackageBoxCreate { _c.mutation.SetRemark(v) @@ -111,6 +125,20 @@ func (_c *PackageBoxCreate) SetNillableCreatedAt(v *int64) *PackageBoxCreate { return _c } +// SetUpdatedAt sets the "updated_at" field. +func (_c *PackageBoxCreate) SetUpdatedAt(v int64) *PackageBoxCreate { + _c.mutation.SetUpdatedAt(v) + return _c +} + +// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil. +func (_c *PackageBoxCreate) SetNillableUpdatedAt(v *int64) *PackageBoxCreate { + if v != nil { + _c.SetUpdatedAt(*v) + } + return _c +} + // Mutation returns the PackageBoxMutation object of the builder. func (_c *PackageBoxCreate) Mutation() *PackageBoxMutation { return _c.mutation @@ -154,6 +182,10 @@ func (_c *PackageBoxCreate) defaults() { v := packagebox.DefaultCreatedAt() _c.mutation.SetCreatedAt(v) } + if _, ok := _c.mutation.UpdatedAt(); !ok { + v := packagebox.DefaultUpdatedAt() + _c.mutation.SetUpdatedAt(v) + } } // check runs all checks and user-defined validators on the builder. @@ -214,6 +246,10 @@ func (_c *PackageBoxCreate) createSpec() (*PackageBox, *sqlgraph.CreateSpec) { _spec.SetField(packagebox.FieldOperator, field.TypeString, value) _node.Operator = value } + if value, ok := _c.mutation.ContractNo(); ok { + _spec.SetField(packagebox.FieldContractNo, field.TypeString, value) + _node.ContractNo = value + } if value, ok := _c.mutation.Remark(); ok { _spec.SetField(packagebox.FieldRemark, field.TypeString, value) _node.Remark = value @@ -222,6 +258,10 @@ func (_c *PackageBoxCreate) createSpec() (*PackageBox, *sqlgraph.CreateSpec) { _spec.SetField(packagebox.FieldCreatedAt, field.TypeInt64, value) _node.CreatedAt = value } + if value, ok := _c.mutation.UpdatedAt(); ok { + _spec.SetField(packagebox.FieldUpdatedAt, field.TypeInt64, value) + _node.UpdatedAt = value + } return _node, _spec } @@ -358,6 +398,24 @@ func (u *PackageBoxUpsert) ClearOperator() *PackageBoxUpsert { return u } +// SetContractNo sets the "contract_no" field. +func (u *PackageBoxUpsert) SetContractNo(v string) *PackageBoxUpsert { + u.Set(packagebox.FieldContractNo, v) + return u +} + +// UpdateContractNo sets the "contract_no" field to the value that was provided on create. +func (u *PackageBoxUpsert) UpdateContractNo() *PackageBoxUpsert { + u.SetExcluded(packagebox.FieldContractNo) + return u +} + +// ClearContractNo clears the value of the "contract_no" field. +func (u *PackageBoxUpsert) ClearContractNo() *PackageBoxUpsert { + u.SetNull(packagebox.FieldContractNo) + return u +} + // SetRemark sets the "remark" field. func (u *PackageBoxUpsert) SetRemark(v string) *PackageBoxUpsert { u.Set(packagebox.FieldRemark, v) @@ -394,6 +452,30 @@ func (u *PackageBoxUpsert) AddCreatedAt(v int64) *PackageBoxUpsert { return u } +// SetUpdatedAt sets the "updated_at" field. +func (u *PackageBoxUpsert) SetUpdatedAt(v int64) *PackageBoxUpsert { + u.Set(packagebox.FieldUpdatedAt, v) + return u +} + +// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create. +func (u *PackageBoxUpsert) UpdateUpdatedAt() *PackageBoxUpsert { + u.SetExcluded(packagebox.FieldUpdatedAt) + return u +} + +// AddUpdatedAt adds v to the "updated_at" field. +func (u *PackageBoxUpsert) AddUpdatedAt(v int64) *PackageBoxUpsert { + u.Add(packagebox.FieldUpdatedAt, v) + return u +} + +// ClearUpdatedAt clears the value of the "updated_at" field. +func (u *PackageBoxUpsert) ClearUpdatedAt() *PackageBoxUpsert { + u.SetNull(packagebox.FieldUpdatedAt) + return u +} + // UpdateNewValues updates the mutable fields using the new values that were set on create. // Using this option is equivalent to using: // @@ -532,6 +614,27 @@ func (u *PackageBoxUpsertOne) ClearOperator() *PackageBoxUpsertOne { }) } +// SetContractNo sets the "contract_no" field. +func (u *PackageBoxUpsertOne) SetContractNo(v string) *PackageBoxUpsertOne { + return u.Update(func(s *PackageBoxUpsert) { + s.SetContractNo(v) + }) +} + +// UpdateContractNo sets the "contract_no" field to the value that was provided on create. +func (u *PackageBoxUpsertOne) UpdateContractNo() *PackageBoxUpsertOne { + return u.Update(func(s *PackageBoxUpsert) { + s.UpdateContractNo() + }) +} + +// ClearContractNo clears the value of the "contract_no" field. +func (u *PackageBoxUpsertOne) ClearContractNo() *PackageBoxUpsertOne { + return u.Update(func(s *PackageBoxUpsert) { + s.ClearContractNo() + }) +} + // SetRemark sets the "remark" field. func (u *PackageBoxUpsertOne) SetRemark(v string) *PackageBoxUpsertOne { return u.Update(func(s *PackageBoxUpsert) { @@ -574,6 +677,34 @@ func (u *PackageBoxUpsertOne) UpdateCreatedAt() *PackageBoxUpsertOne { }) } +// SetUpdatedAt sets the "updated_at" field. +func (u *PackageBoxUpsertOne) SetUpdatedAt(v int64) *PackageBoxUpsertOne { + return u.Update(func(s *PackageBoxUpsert) { + s.SetUpdatedAt(v) + }) +} + +// AddUpdatedAt adds v to the "updated_at" field. +func (u *PackageBoxUpsertOne) AddUpdatedAt(v int64) *PackageBoxUpsertOne { + return u.Update(func(s *PackageBoxUpsert) { + s.AddUpdatedAt(v) + }) +} + +// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create. +func (u *PackageBoxUpsertOne) UpdateUpdatedAt() *PackageBoxUpsertOne { + return u.Update(func(s *PackageBoxUpsert) { + s.UpdateUpdatedAt() + }) +} + +// ClearUpdatedAt clears the value of the "updated_at" field. +func (u *PackageBoxUpsertOne) ClearUpdatedAt() *PackageBoxUpsertOne { + return u.Update(func(s *PackageBoxUpsert) { + s.ClearUpdatedAt() + }) +} + // Exec executes the query. func (u *PackageBoxUpsertOne) Exec(ctx context.Context) error { if len(u.create.conflict) == 0 { @@ -876,6 +1007,27 @@ func (u *PackageBoxUpsertBulk) ClearOperator() *PackageBoxUpsertBulk { }) } +// SetContractNo sets the "contract_no" field. +func (u *PackageBoxUpsertBulk) SetContractNo(v string) *PackageBoxUpsertBulk { + return u.Update(func(s *PackageBoxUpsert) { + s.SetContractNo(v) + }) +} + +// UpdateContractNo sets the "contract_no" field to the value that was provided on create. +func (u *PackageBoxUpsertBulk) UpdateContractNo() *PackageBoxUpsertBulk { + return u.Update(func(s *PackageBoxUpsert) { + s.UpdateContractNo() + }) +} + +// ClearContractNo clears the value of the "contract_no" field. +func (u *PackageBoxUpsertBulk) ClearContractNo() *PackageBoxUpsertBulk { + return u.Update(func(s *PackageBoxUpsert) { + s.ClearContractNo() + }) +} + // SetRemark sets the "remark" field. func (u *PackageBoxUpsertBulk) SetRemark(v string) *PackageBoxUpsertBulk { return u.Update(func(s *PackageBoxUpsert) { @@ -918,6 +1070,34 @@ func (u *PackageBoxUpsertBulk) UpdateCreatedAt() *PackageBoxUpsertBulk { }) } +// SetUpdatedAt sets the "updated_at" field. +func (u *PackageBoxUpsertBulk) SetUpdatedAt(v int64) *PackageBoxUpsertBulk { + return u.Update(func(s *PackageBoxUpsert) { + s.SetUpdatedAt(v) + }) +} + +// AddUpdatedAt adds v to the "updated_at" field. +func (u *PackageBoxUpsertBulk) AddUpdatedAt(v int64) *PackageBoxUpsertBulk { + return u.Update(func(s *PackageBoxUpsert) { + s.AddUpdatedAt(v) + }) +} + +// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create. +func (u *PackageBoxUpsertBulk) UpdateUpdatedAt() *PackageBoxUpsertBulk { + return u.Update(func(s *PackageBoxUpsert) { + s.UpdateUpdatedAt() + }) +} + +// ClearUpdatedAt clears the value of the "updated_at" field. +func (u *PackageBoxUpsertBulk) ClearUpdatedAt() *PackageBoxUpsertBulk { + return u.Update(func(s *PackageBoxUpsert) { + s.ClearUpdatedAt() + }) +} + // Exec executes the query. func (u *PackageBoxUpsertBulk) Exec(ctx context.Context) error { if u.create.err != nil { diff --git a/bj_power_wms/ent/packagebox_query.go b/bj_power_wms/ent/packagebox_query.go index bf07f93..f686723 100644 --- a/bj_power_wms/ent/packagebox_query.go +++ b/bj_power_wms/ent/packagebox_query.go @@ -262,7 +262,7 @@ func (_q *PackageBoxQuery) Clone() *PackageBoxQuery { // Example: // // var v []struct { -// BoxNo string `json:"box_no,omitempty"` +// BoxNo string `json:"boxNo,omitempty"` // Count int `json:"count,omitempty"` // } // @@ -285,7 +285,7 @@ func (_q *PackageBoxQuery) GroupBy(field string, fields ...string) *PackageBoxGr // Example: // // var v []struct { -// BoxNo string `json:"box_no,omitempty"` +// BoxNo string `json:"boxNo,omitempty"` // } // // client.PackageBox.Query(). diff --git a/bj_power_wms/ent/packagebox_update.go b/bj_power_wms/ent/packagebox_update.go index 1772d9f..494325f 100644 --- a/bj_power_wms/ent/packagebox_update.go +++ b/bj_power_wms/ent/packagebox_update.go @@ -122,6 +122,26 @@ func (_u *PackageBoxUpdate) ClearOperator() *PackageBoxUpdate { return _u } +// SetContractNo sets the "contract_no" field. +func (_u *PackageBoxUpdate) SetContractNo(v string) *PackageBoxUpdate { + _u.mutation.SetContractNo(v) + return _u +} + +// SetNillableContractNo sets the "contract_no" field if the given value is not nil. +func (_u *PackageBoxUpdate) SetNillableContractNo(v *string) *PackageBoxUpdate { + if v != nil { + _u.SetContractNo(*v) + } + return _u +} + +// ClearContractNo clears the value of the "contract_no" field. +func (_u *PackageBoxUpdate) ClearContractNo() *PackageBoxUpdate { + _u.mutation.ClearContractNo() + return _u +} + // SetRemark sets the "remark" field. func (_u *PackageBoxUpdate) SetRemark(v string) *PackageBoxUpdate { _u.mutation.SetRemark(v) @@ -163,6 +183,33 @@ func (_u *PackageBoxUpdate) AddCreatedAt(v int64) *PackageBoxUpdate { return _u } +// SetUpdatedAt sets the "updated_at" field. +func (_u *PackageBoxUpdate) SetUpdatedAt(v int64) *PackageBoxUpdate { + _u.mutation.ResetUpdatedAt() + _u.mutation.SetUpdatedAt(v) + return _u +} + +// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil. +func (_u *PackageBoxUpdate) SetNillableUpdatedAt(v *int64) *PackageBoxUpdate { + if v != nil { + _u.SetUpdatedAt(*v) + } + return _u +} + +// AddUpdatedAt adds value to the "updated_at" field. +func (_u *PackageBoxUpdate) AddUpdatedAt(v int64) *PackageBoxUpdate { + _u.mutation.AddUpdatedAt(v) + return _u +} + +// ClearUpdatedAt clears the value of the "updated_at" field. +func (_u *PackageBoxUpdate) ClearUpdatedAt() *PackageBoxUpdate { + _u.mutation.ClearUpdatedAt() + return _u +} + // Mutation returns the PackageBoxMutation object of the builder. func (_u *PackageBoxUpdate) Mutation() *PackageBoxMutation { return _u.mutation @@ -231,6 +278,12 @@ func (_u *PackageBoxUpdate) sqlSave(ctx context.Context) (_node int, err error) if _u.mutation.OperatorCleared() { _spec.ClearField(packagebox.FieldOperator, field.TypeString) } + if value, ok := _u.mutation.ContractNo(); ok { + _spec.SetField(packagebox.FieldContractNo, field.TypeString, value) + } + if _u.mutation.ContractNoCleared() { + _spec.ClearField(packagebox.FieldContractNo, field.TypeString) + } if value, ok := _u.mutation.Remark(); ok { _spec.SetField(packagebox.FieldRemark, field.TypeString, value) } @@ -243,6 +296,15 @@ func (_u *PackageBoxUpdate) sqlSave(ctx context.Context) (_node int, err error) if value, ok := _u.mutation.AddedCreatedAt(); ok { _spec.AddField(packagebox.FieldCreatedAt, field.TypeInt64, value) } + if value, ok := _u.mutation.UpdatedAt(); ok { + _spec.SetField(packagebox.FieldUpdatedAt, field.TypeInt64, value) + } + if value, ok := _u.mutation.AddedUpdatedAt(); ok { + _spec.AddField(packagebox.FieldUpdatedAt, field.TypeInt64, value) + } + if _u.mutation.UpdatedAtCleared() { + _spec.ClearField(packagebox.FieldUpdatedAt, field.TypeInt64) + } if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{packagebox.Label} @@ -358,6 +420,26 @@ func (_u *PackageBoxUpdateOne) ClearOperator() *PackageBoxUpdateOne { return _u } +// SetContractNo sets the "contract_no" field. +func (_u *PackageBoxUpdateOne) SetContractNo(v string) *PackageBoxUpdateOne { + _u.mutation.SetContractNo(v) + return _u +} + +// SetNillableContractNo sets the "contract_no" field if the given value is not nil. +func (_u *PackageBoxUpdateOne) SetNillableContractNo(v *string) *PackageBoxUpdateOne { + if v != nil { + _u.SetContractNo(*v) + } + return _u +} + +// ClearContractNo clears the value of the "contract_no" field. +func (_u *PackageBoxUpdateOne) ClearContractNo() *PackageBoxUpdateOne { + _u.mutation.ClearContractNo() + return _u +} + // SetRemark sets the "remark" field. func (_u *PackageBoxUpdateOne) SetRemark(v string) *PackageBoxUpdateOne { _u.mutation.SetRemark(v) @@ -399,6 +481,33 @@ func (_u *PackageBoxUpdateOne) AddCreatedAt(v int64) *PackageBoxUpdateOne { return _u } +// SetUpdatedAt sets the "updated_at" field. +func (_u *PackageBoxUpdateOne) SetUpdatedAt(v int64) *PackageBoxUpdateOne { + _u.mutation.ResetUpdatedAt() + _u.mutation.SetUpdatedAt(v) + return _u +} + +// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil. +func (_u *PackageBoxUpdateOne) SetNillableUpdatedAt(v *int64) *PackageBoxUpdateOne { + if v != nil { + _u.SetUpdatedAt(*v) + } + return _u +} + +// AddUpdatedAt adds value to the "updated_at" field. +func (_u *PackageBoxUpdateOne) AddUpdatedAt(v int64) *PackageBoxUpdateOne { + _u.mutation.AddUpdatedAt(v) + return _u +} + +// ClearUpdatedAt clears the value of the "updated_at" field. +func (_u *PackageBoxUpdateOne) ClearUpdatedAt() *PackageBoxUpdateOne { + _u.mutation.ClearUpdatedAt() + return _u +} + // Mutation returns the PackageBoxMutation object of the builder. func (_u *PackageBoxUpdateOne) Mutation() *PackageBoxMutation { return _u.mutation @@ -497,6 +606,12 @@ func (_u *PackageBoxUpdateOne) sqlSave(ctx context.Context) (_node *PackageBox, if _u.mutation.OperatorCleared() { _spec.ClearField(packagebox.FieldOperator, field.TypeString) } + if value, ok := _u.mutation.ContractNo(); ok { + _spec.SetField(packagebox.FieldContractNo, field.TypeString, value) + } + if _u.mutation.ContractNoCleared() { + _spec.ClearField(packagebox.FieldContractNo, field.TypeString) + } if value, ok := _u.mutation.Remark(); ok { _spec.SetField(packagebox.FieldRemark, field.TypeString, value) } @@ -509,6 +624,15 @@ func (_u *PackageBoxUpdateOne) sqlSave(ctx context.Context) (_node *PackageBox, if value, ok := _u.mutation.AddedCreatedAt(); ok { _spec.AddField(packagebox.FieldCreatedAt, field.TypeInt64, value) } + if value, ok := _u.mutation.UpdatedAt(); ok { + _spec.SetField(packagebox.FieldUpdatedAt, field.TypeInt64, value) + } + if value, ok := _u.mutation.AddedUpdatedAt(); ok { + _spec.AddField(packagebox.FieldUpdatedAt, field.TypeInt64, value) + } + if _u.mutation.UpdatedAtCleared() { + _spec.ClearField(packagebox.FieldUpdatedAt, field.TypeInt64) + } _node = &PackageBox{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues diff --git a/bj_power_wms/ent/runtime.go b/bj_power_wms/ent/runtime.go index a9af6c7..2252355 100644 --- a/bj_power_wms/ent/runtime.go +++ b/bj_power_wms/ent/runtime.go @@ -195,9 +195,13 @@ func init() { // packagebox.DefaultQuantity holds the default value on creation for the quantity field. packagebox.DefaultQuantity = packageboxDescQuantity.Default.(int) // packageboxDescCreatedAt is the schema descriptor for created_at field. - packageboxDescCreatedAt := packageboxFields[6].Descriptor() + packageboxDescCreatedAt := packageboxFields[7].Descriptor() // packagebox.DefaultCreatedAt holds the default value on creation for the created_at field. packagebox.DefaultCreatedAt = packageboxDescCreatedAt.Default.(func() int64) + // packageboxDescUpdatedAt is the schema descriptor for updated_at field. + packageboxDescUpdatedAt := packageboxFields[8].Descriptor() + // packagebox.DefaultUpdatedAt holds the default value on creation for the updated_at field. + packagebox.DefaultUpdatedAt = packageboxDescUpdatedAt.Default.(func() int64) semifinishedFields := schema.SemiFinished{}.Fields() _ = semifinishedFields // semifinishedDescQuantity is the schema descriptor for quantity field. @@ -290,8 +294,16 @@ func init() { user.DefaultUpdatedAt = userDescUpdatedAt.Default.(func() int64) zoneFields := schema.Zone{}.Fields() _ = zoneFields + // zoneDescStatus is the schema descriptor for status field. + zoneDescStatus := zoneFields[3].Descriptor() + // zone.DefaultStatus holds the default value on creation for the status field. + zone.DefaultStatus = zoneDescStatus.Default.(string) // zoneDescCreatedAt is the schema descriptor for created_at field. - zoneDescCreatedAt := zoneFields[3].Descriptor() + zoneDescCreatedAt := zoneFields[4].Descriptor() // zone.DefaultCreatedAt holds the default value on creation for the created_at field. zone.DefaultCreatedAt = zoneDescCreatedAt.Default.(func() int64) + // zoneDescUpdatedAt is the schema descriptor for updated_at field. + zoneDescUpdatedAt := zoneFields[5].Descriptor() + // zone.DefaultUpdatedAt holds the default value on creation for the updated_at field. + zone.DefaultUpdatedAt = zoneDescUpdatedAt.Default.(func() int64) } diff --git a/bj_power_wms/ent/semifinished.go b/bj_power_wms/ent/semifinished.go index c9a002b..138e8c4 100644 --- a/bj_power_wms/ent/semifinished.go +++ b/bj_power_wms/ent/semifinished.go @@ -19,21 +19,21 @@ type SemiFinished struct { // 半成品 SN Sn string `json:"sn,omitempty"` // 物料编码 - MaterialCode string `json:"material_code,omitempty"` + MaterialCode string `json:"materialCode,omitempty"` // 已完成工序(如 135) - CompletedProcess string `json:"completed_process,omitempty"` + CompletedProcess string `json:"completedProcess,omitempty"` // 数量 Quantity int `json:"quantity,omitempty"` // 所在区域 - ZoneCode string `json:"zone_code,omitempty"` + ZoneCode string `json:"zoneCode,omitempty"` // 在库/出库/使用 Status string `json:"status,omitempty"` // 关联工单 - OrderNo string `json:"order_no,omitempty"` + OrderNo string `json:"orderNo,omitempty"` // CreatedAt holds the value of the "created_at" field. - CreatedAt int64 `json:"created_at,omitempty"` + CreatedAt int64 `json:"createdAt,omitempty"` // UpdatedAt holds the value of the "updated_at" field. - UpdatedAt int64 `json:"updated_at,omitempty"` + UpdatedAt int64 `json:"updatedAt,omitempty"` selectValues sql.SelectValues } diff --git a/bj_power_wms/ent/serialnumber.go b/bj_power_wms/ent/serialnumber.go index 4ba78aa..95325b0 100644 --- a/bj_power_wms/ent/serialnumber.go +++ b/bj_power_wms/ent/serialnumber.go @@ -17,27 +17,27 @@ type SerialNumber struct { // ID of the ent. ID int `json:"id,omitempty"` // 序列号 - SnCode string `json:"sn_code,omitempty"` + SnCode string `json:"snCode,omitempty"` // 物料编码 - MaterialCode string `json:"material_code,omitempty"` + MaterialCode string `json:"materialCode,omitempty"` // 所属批次 - BatchNo string `json:"batch_no,omitempty"` + BatchNo string `json:"batchNo,omitempty"` // 在库/锁定/出库/使用/报废 Status string `json:"status,omitempty"` // 当前区域 - CurrentZone string `json:"current_zone,omitempty"` + CurrentZone string `json:"currentZone,omitempty"` // 检验状态 未检/合格/不合格 - QualityStatus string `json:"quality_status,omitempty"` + QualityStatus string `json:"qualityStatus,omitempty"` // 最近入库时间 - LastInboundAt string `json:"last_inbound_at,omitempty"` + LastInboundAt string `json:"lastInboundAt,omitempty"` // 最近出库时间 - LastOutboundAt string `json:"last_outbound_at,omitempty"` + LastOutboundAt string `json:"lastOutboundAt,omitempty"` // 备注 Remark string `json:"remark,omitempty"` // CreatedAt holds the value of the "created_at" field. - CreatedAt int64 `json:"created_at,omitempty"` + CreatedAt int64 `json:"createdAt,omitempty"` // UpdatedAt holds the value of the "updated_at" field. - UpdatedAt int64 `json:"updated_at,omitempty"` + UpdatedAt int64 `json:"updatedAt,omitempty"` selectValues sql.SelectValues } diff --git a/bj_power_wms/ent/serialnumber_query.go b/bj_power_wms/ent/serialnumber_query.go index 6a77da6..16f4156 100644 --- a/bj_power_wms/ent/serialnumber_query.go +++ b/bj_power_wms/ent/serialnumber_query.go @@ -262,7 +262,7 @@ func (_q *SerialNumberQuery) Clone() *SerialNumberQuery { // Example: // // var v []struct { -// SnCode string `json:"sn_code,omitempty"` +// SnCode string `json:"snCode,omitempty"` // Count int `json:"count,omitempty"` // } // @@ -285,7 +285,7 @@ func (_q *SerialNumberQuery) GroupBy(field string, fields ...string) *SerialNumb // Example: // // var v []struct { -// SnCode string `json:"sn_code,omitempty"` +// SnCode string `json:"snCode,omitempty"` // } // // client.SerialNumber.Query(). diff --git a/bj_power_wms/ent/stocktakeitem.go b/bj_power_wms/ent/stocktakeitem.go index 14bef48..8571d7b 100644 --- a/bj_power_wms/ent/stocktakeitem.go +++ b/bj_power_wms/ent/stocktakeitem.go @@ -17,25 +17,25 @@ type StocktakeItem struct { // ID of the ent. ID int `json:"id,omitempty"` // 所属盘点单号 - StocktakeNo string `json:"stocktake_no,omitempty"` + StocktakeNo string `json:"stocktakeNo,omitempty"` // BATCH/SN - TargetType string `json:"target_type,omitempty"` + TargetType string `json:"targetType,omitempty"` // 批次号或SN码 - TargetID string `json:"target_id,omitempty"` + TargetID string `json:"targetId,omitempty"` // MaterialCode holds the value of the "material_code" field. - MaterialCode string `json:"material_code,omitempty"` + MaterialCode string `json:"materialCode,omitempty"` // 所在区域 - ZoneCode string `json:"zone_code,omitempty"` + ZoneCode string `json:"zoneCode,omitempty"` // 账面数量 - BookQty int `json:"book_qty,omitempty"` + BookQty int `json:"bookQty,omitempty"` // 实盘数量,-1=未盘 - ScannedQty int `json:"scanned_qty,omitempty"` + ScannedQty int `json:"scannedQty,omitempty"` // 差异 = 实盘 - 账面 - DiffQty int `json:"diff_qty,omitempty"` + DiffQty int `json:"diffQty,omitempty"` // 是否已扫码 Counted bool `json:"counted,omitempty"` // UpdatedAt holds the value of the "updated_at" field. - UpdatedAt int64 `json:"updated_at,omitempty"` + UpdatedAt int64 `json:"updatedAt,omitempty"` selectValues sql.SelectValues } diff --git a/bj_power_wms/ent/stocktakeitem_query.go b/bj_power_wms/ent/stocktakeitem_query.go index 2e96081..f286407 100644 --- a/bj_power_wms/ent/stocktakeitem_query.go +++ b/bj_power_wms/ent/stocktakeitem_query.go @@ -262,7 +262,7 @@ func (_q *StocktakeItemQuery) Clone() *StocktakeItemQuery { // Example: // // var v []struct { -// StocktakeNo string `json:"stocktake_no,omitempty"` +// StocktakeNo string `json:"stocktakeNo,omitempty"` // Count int `json:"count,omitempty"` // } // @@ -285,7 +285,7 @@ func (_q *StocktakeItemQuery) GroupBy(field string, fields ...string) *Stocktake // Example: // // var v []struct { -// StocktakeNo string `json:"stocktake_no,omitempty"` +// StocktakeNo string `json:"stocktakeNo,omitempty"` // } // // client.StocktakeItem.Query(). diff --git a/bj_power_wms/ent/stocktakeorder.go b/bj_power_wms/ent/stocktakeorder.go index a42c783..e4eff6a 100644 --- a/bj_power_wms/ent/stocktakeorder.go +++ b/bj_power_wms/ent/stocktakeorder.go @@ -17,17 +17,17 @@ type StocktakeOrder struct { // ID of the ent. ID int `json:"id,omitempty"` // 盘点单号 - StocktakeNo string `json:"stocktake_no,omitempty"` + StocktakeNo string `json:"stocktakeNo,omitempty"` // 进行中/已完成 Status string `json:"status,omitempty"` // 发起人 Operator string `json:"operator,omitempty"` // 快照目标数 - TotalTargets int `json:"total_targets,omitempty"` + TotalTargets int `json:"totalTargets,omitempty"` // CreatedAt holds the value of the "created_at" field. - CreatedAt int64 `json:"created_at,omitempty"` + CreatedAt int64 `json:"createdAt,omitempty"` // 完成时间 - FinishedAt int64 `json:"finished_at,omitempty"` + FinishedAt int64 `json:"finishedAt,omitempty"` selectValues sql.SelectValues } diff --git a/bj_power_wms/ent/stocktakeorder_query.go b/bj_power_wms/ent/stocktakeorder_query.go index 39f1b6b..7a2a448 100644 --- a/bj_power_wms/ent/stocktakeorder_query.go +++ b/bj_power_wms/ent/stocktakeorder_query.go @@ -262,7 +262,7 @@ func (_q *StocktakeOrderQuery) Clone() *StocktakeOrderQuery { // Example: // // var v []struct { -// StocktakeNo string `json:"stocktake_no,omitempty"` +// StocktakeNo string `json:"stocktakeNo,omitempty"` // Count int `json:"count,omitempty"` // } // @@ -285,7 +285,7 @@ func (_q *StocktakeOrderQuery) GroupBy(field string, fields ...string) *Stocktak // Example: // // var v []struct { -// StocktakeNo string `json:"stocktake_no,omitempty"` +// StocktakeNo string `json:"stocktakeNo,omitempty"` // } // // client.StocktakeOrder.Query(). diff --git a/bj_power_wms/ent/user.go b/bj_power_wms/ent/user.go index 96c614e..9efa1eb 100644 --- a/bj_power_wms/ent/user.go +++ b/bj_power_wms/ent/user.go @@ -21,7 +21,7 @@ type User struct { // 密码(哈希) Password string `json:"password,omitempty"` // 姓名 - RealName string `json:"real_name,omitempty"` + RealName string `json:"realName,omitempty"` // 角色 admin/operator/inspector Role string `json:"role,omitempty"` // 部门 @@ -29,13 +29,13 @@ type User struct { // 电话 Phone string `json:"phone,omitempty"` // 是否启用 - IsActive bool `json:"is_active,omitempty"` + IsActive bool `json:"isActive,omitempty"` // 最近登录时间 - LastLoginAt int64 `json:"last_login_at,omitempty"` + LastLoginAt int64 `json:"lastLoginAt,omitempty"` // CreatedAt holds the value of the "created_at" field. - CreatedAt int64 `json:"created_at,omitempty"` + CreatedAt int64 `json:"createdAt,omitempty"` // UpdatedAt holds the value of the "updated_at" field. - UpdatedAt int64 `json:"updated_at,omitempty"` + UpdatedAt int64 `json:"updatedAt,omitempty"` selectValues sql.SelectValues } diff --git a/bj_power_wms/ent/zone.go b/bj_power_wms/ent/zone.go index 0d528af..f58f8c1 100644 --- a/bj_power_wms/ent/zone.go +++ b/bj_power_wms/ent/zone.go @@ -17,13 +17,17 @@ type Zone struct { // ID of the ent. ID int `json:"id,omitempty"` // 区域编码 - ZoneCode string `json:"zone_code,omitempty"` + ZoneCode string `json:"zoneCode,omitempty"` // 区域名称 - ZoneName string `json:"zone_name,omitempty"` + ZoneName string `json:"zoneName,omitempty"` // 描述 Description string `json:"description,omitempty"` + // 状态:启用/停用 + Status string `json:"status,omitempty"` // CreatedAt holds the value of the "created_at" field. - CreatedAt int64 `json:"created_at,omitempty"` + CreatedAt int64 `json:"createdAt,omitempty"` + // 更新时间 + UpdatedAt int64 `json:"updatedAt,omitempty"` selectValues sql.SelectValues } @@ -32,9 +36,9 @@ func (*Zone) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { - case zone.FieldID, zone.FieldCreatedAt: + case zone.FieldID, zone.FieldCreatedAt, zone.FieldUpdatedAt: values[i] = new(sql.NullInt64) - case zone.FieldZoneCode, zone.FieldZoneName, zone.FieldDescription: + case zone.FieldZoneCode, zone.FieldZoneName, zone.FieldDescription, zone.FieldStatus: values[i] = new(sql.NullString) default: values[i] = new(sql.UnknownType) @@ -75,12 +79,24 @@ func (_m *Zone) assignValues(columns []string, values []any) error { } else if value.Valid { _m.Description = value.String } + case zone.FieldStatus: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field status", values[i]) + } else if value.Valid { + _m.Status = value.String + } case zone.FieldCreatedAt: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field created_at", values[i]) } else if value.Valid { _m.CreatedAt = value.Int64 } + case zone.FieldUpdatedAt: + if value, ok := values[i].(*sql.NullInt64); !ok { + return fmt.Errorf("unexpected type %T for field updated_at", values[i]) + } else if value.Valid { + _m.UpdatedAt = value.Int64 + } default: _m.selectValues.Set(columns[i], values[i]) } @@ -126,8 +142,14 @@ func (_m *Zone) String() string { builder.WriteString("description=") builder.WriteString(_m.Description) builder.WriteString(", ") + builder.WriteString("status=") + builder.WriteString(_m.Status) + builder.WriteString(", ") builder.WriteString("created_at=") builder.WriteString(fmt.Sprintf("%v", _m.CreatedAt)) + builder.WriteString(", ") + builder.WriteString("updated_at=") + builder.WriteString(fmt.Sprintf("%v", _m.UpdatedAt)) builder.WriteByte(')') return builder.String() } diff --git a/bj_power_wms/ent/zone/where.go b/bj_power_wms/ent/zone/where.go index 49df9ff..2ea4206 100644 --- a/bj_power_wms/ent/zone/where.go +++ b/bj_power_wms/ent/zone/where.go @@ -68,11 +68,21 @@ func Description(v string) predicate.Zone { return predicate.Zone(sql.FieldEQ(FieldDescription, v)) } +// Status applies equality check predicate on the "status" field. It's identical to StatusEQ. +func Status(v string) predicate.Zone { + return predicate.Zone(sql.FieldEQ(FieldStatus, v)) +} + // CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ. func CreatedAt(v int64) predicate.Zone { return predicate.Zone(sql.FieldEQ(FieldCreatedAt, v)) } +// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ. +func UpdatedAt(v int64) predicate.Zone { + return predicate.Zone(sql.FieldEQ(FieldUpdatedAt, v)) +} + // ZoneCodeEQ applies the EQ predicate on the "zone_code" field. func ZoneCodeEQ(v string) predicate.Zone { return predicate.Zone(sql.FieldEQ(FieldZoneCode, v)) @@ -278,6 +288,71 @@ func DescriptionContainsFold(v string) predicate.Zone { return predicate.Zone(sql.FieldContainsFold(FieldDescription, v)) } +// StatusEQ applies the EQ predicate on the "status" field. +func StatusEQ(v string) predicate.Zone { + return predicate.Zone(sql.FieldEQ(FieldStatus, v)) +} + +// StatusNEQ applies the NEQ predicate on the "status" field. +func StatusNEQ(v string) predicate.Zone { + return predicate.Zone(sql.FieldNEQ(FieldStatus, v)) +} + +// StatusIn applies the In predicate on the "status" field. +func StatusIn(vs ...string) predicate.Zone { + return predicate.Zone(sql.FieldIn(FieldStatus, vs...)) +} + +// StatusNotIn applies the NotIn predicate on the "status" field. +func StatusNotIn(vs ...string) predicate.Zone { + return predicate.Zone(sql.FieldNotIn(FieldStatus, vs...)) +} + +// StatusGT applies the GT predicate on the "status" field. +func StatusGT(v string) predicate.Zone { + return predicate.Zone(sql.FieldGT(FieldStatus, v)) +} + +// StatusGTE applies the GTE predicate on the "status" field. +func StatusGTE(v string) predicate.Zone { + return predicate.Zone(sql.FieldGTE(FieldStatus, v)) +} + +// StatusLT applies the LT predicate on the "status" field. +func StatusLT(v string) predicate.Zone { + return predicate.Zone(sql.FieldLT(FieldStatus, v)) +} + +// StatusLTE applies the LTE predicate on the "status" field. +func StatusLTE(v string) predicate.Zone { + return predicate.Zone(sql.FieldLTE(FieldStatus, v)) +} + +// StatusContains applies the Contains predicate on the "status" field. +func StatusContains(v string) predicate.Zone { + return predicate.Zone(sql.FieldContains(FieldStatus, v)) +} + +// StatusHasPrefix applies the HasPrefix predicate on the "status" field. +func StatusHasPrefix(v string) predicate.Zone { + return predicate.Zone(sql.FieldHasPrefix(FieldStatus, v)) +} + +// StatusHasSuffix applies the HasSuffix predicate on the "status" field. +func StatusHasSuffix(v string) predicate.Zone { + return predicate.Zone(sql.FieldHasSuffix(FieldStatus, v)) +} + +// StatusEqualFold applies the EqualFold predicate on the "status" field. +func StatusEqualFold(v string) predicate.Zone { + return predicate.Zone(sql.FieldEqualFold(FieldStatus, v)) +} + +// StatusContainsFold applies the ContainsFold predicate on the "status" field. +func StatusContainsFold(v string) predicate.Zone { + return predicate.Zone(sql.FieldContainsFold(FieldStatus, v)) +} + // CreatedAtEQ applies the EQ predicate on the "created_at" field. func CreatedAtEQ(v int64) predicate.Zone { return predicate.Zone(sql.FieldEQ(FieldCreatedAt, v)) @@ -318,6 +393,56 @@ func CreatedAtLTE(v int64) predicate.Zone { return predicate.Zone(sql.FieldLTE(FieldCreatedAt, v)) } +// UpdatedAtEQ applies the EQ predicate on the "updated_at" field. +func UpdatedAtEQ(v int64) predicate.Zone { + return predicate.Zone(sql.FieldEQ(FieldUpdatedAt, v)) +} + +// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field. +func UpdatedAtNEQ(v int64) predicate.Zone { + return predicate.Zone(sql.FieldNEQ(FieldUpdatedAt, v)) +} + +// UpdatedAtIn applies the In predicate on the "updated_at" field. +func UpdatedAtIn(vs ...int64) predicate.Zone { + return predicate.Zone(sql.FieldIn(FieldUpdatedAt, vs...)) +} + +// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field. +func UpdatedAtNotIn(vs ...int64) predicate.Zone { + return predicate.Zone(sql.FieldNotIn(FieldUpdatedAt, vs...)) +} + +// UpdatedAtGT applies the GT predicate on the "updated_at" field. +func UpdatedAtGT(v int64) predicate.Zone { + return predicate.Zone(sql.FieldGT(FieldUpdatedAt, v)) +} + +// UpdatedAtGTE applies the GTE predicate on the "updated_at" field. +func UpdatedAtGTE(v int64) predicate.Zone { + return predicate.Zone(sql.FieldGTE(FieldUpdatedAt, v)) +} + +// UpdatedAtLT applies the LT predicate on the "updated_at" field. +func UpdatedAtLT(v int64) predicate.Zone { + return predicate.Zone(sql.FieldLT(FieldUpdatedAt, v)) +} + +// UpdatedAtLTE applies the LTE predicate on the "updated_at" field. +func UpdatedAtLTE(v int64) predicate.Zone { + return predicate.Zone(sql.FieldLTE(FieldUpdatedAt, v)) +} + +// UpdatedAtIsNil applies the IsNil predicate on the "updated_at" field. +func UpdatedAtIsNil() predicate.Zone { + return predicate.Zone(sql.FieldIsNull(FieldUpdatedAt)) +} + +// UpdatedAtNotNil applies the NotNil predicate on the "updated_at" field. +func UpdatedAtNotNil() predicate.Zone { + return predicate.Zone(sql.FieldNotNull(FieldUpdatedAt)) +} + // And groups predicates with the AND operator between them. func And(predicates ...predicate.Zone) predicate.Zone { return predicate.Zone(sql.AndPredicates(predicates...)) diff --git a/bj_power_wms/ent/zone/zone.go b/bj_power_wms/ent/zone/zone.go index ea04c74..e9f10c7 100644 --- a/bj_power_wms/ent/zone/zone.go +++ b/bj_power_wms/ent/zone/zone.go @@ -17,8 +17,12 @@ const ( FieldZoneName = "zone_name" // FieldDescription holds the string denoting the description field in the database. FieldDescription = "description" + // FieldStatus holds the string denoting the status field in the database. + FieldStatus = "status" // FieldCreatedAt holds the string denoting the created_at field in the database. FieldCreatedAt = "created_at" + // FieldUpdatedAt holds the string denoting the updated_at field in the database. + FieldUpdatedAt = "updated_at" // Table holds the table name of the zone in the database. Table = "zones" ) @@ -29,7 +33,9 @@ var Columns = []string{ FieldZoneCode, FieldZoneName, FieldDescription, + FieldStatus, FieldCreatedAt, + FieldUpdatedAt, } // ValidColumn reports if the column name is valid (part of the table columns). @@ -43,8 +49,12 @@ func ValidColumn(column string) bool { } var ( + // DefaultStatus holds the default value on creation for the "status" field. + DefaultStatus string // DefaultCreatedAt holds the default value on creation for the "created_at" field. DefaultCreatedAt func() int64 + // DefaultUpdatedAt holds the default value on creation for the "updated_at" field. + DefaultUpdatedAt func() int64 ) // OrderOption defines the ordering options for the Zone queries. @@ -70,7 +80,17 @@ func ByDescription(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldDescription, opts...).ToFunc() } +// ByStatus orders the results by the status field. +func ByStatus(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldStatus, opts...).ToFunc() +} + // ByCreatedAt orders the results by the created_at field. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCreatedAt, opts...).ToFunc() } + +// ByUpdatedAt orders the results by the updated_at field. +func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc() +} diff --git a/bj_power_wms/ent/zone_create.go b/bj_power_wms/ent/zone_create.go index 8f5a05b..85ec08b 100644 --- a/bj_power_wms/ent/zone_create.go +++ b/bj_power_wms/ent/zone_create.go @@ -47,6 +47,20 @@ func (_c *ZoneCreate) SetNillableDescription(v *string) *ZoneCreate { return _c } +// SetStatus sets the "status" field. +func (_c *ZoneCreate) SetStatus(v string) *ZoneCreate { + _c.mutation.SetStatus(v) + return _c +} + +// SetNillableStatus sets the "status" field if the given value is not nil. +func (_c *ZoneCreate) SetNillableStatus(v *string) *ZoneCreate { + if v != nil { + _c.SetStatus(*v) + } + return _c +} + // SetCreatedAt sets the "created_at" field. func (_c *ZoneCreate) SetCreatedAt(v int64) *ZoneCreate { _c.mutation.SetCreatedAt(v) @@ -61,6 +75,20 @@ func (_c *ZoneCreate) SetNillableCreatedAt(v *int64) *ZoneCreate { return _c } +// SetUpdatedAt sets the "updated_at" field. +func (_c *ZoneCreate) SetUpdatedAt(v int64) *ZoneCreate { + _c.mutation.SetUpdatedAt(v) + return _c +} + +// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil. +func (_c *ZoneCreate) SetNillableUpdatedAt(v *int64) *ZoneCreate { + if v != nil { + _c.SetUpdatedAt(*v) + } + return _c +} + // Mutation returns the ZoneMutation object of the builder. func (_c *ZoneCreate) Mutation() *ZoneMutation { return _c.mutation @@ -96,10 +124,18 @@ func (_c *ZoneCreate) ExecX(ctx context.Context) { // defaults sets the default values of the builder before save. func (_c *ZoneCreate) defaults() { + if _, ok := _c.mutation.Status(); !ok { + v := zone.DefaultStatus + _c.mutation.SetStatus(v) + } if _, ok := _c.mutation.CreatedAt(); !ok { v := zone.DefaultCreatedAt() _c.mutation.SetCreatedAt(v) } + if _, ok := _c.mutation.UpdatedAt(); !ok { + v := zone.DefaultUpdatedAt() + _c.mutation.SetUpdatedAt(v) + } } // check runs all checks and user-defined validators on the builder. @@ -110,6 +146,9 @@ func (_c *ZoneCreate) check() error { if _, ok := _c.mutation.ZoneName(); !ok { return &ValidationError{Name: "zone_name", err: errors.New(`ent: missing required field "Zone.zone_name"`)} } + if _, ok := _c.mutation.Status(); !ok { + return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "Zone.status"`)} + } if _, ok := _c.mutation.CreatedAt(); !ok { return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Zone.created_at"`)} } @@ -152,10 +191,18 @@ func (_c *ZoneCreate) createSpec() (*Zone, *sqlgraph.CreateSpec) { _spec.SetField(zone.FieldDescription, field.TypeString, value) _node.Description = value } + if value, ok := _c.mutation.Status(); ok { + _spec.SetField(zone.FieldStatus, field.TypeString, value) + _node.Status = value + } if value, ok := _c.mutation.CreatedAt(); ok { _spec.SetField(zone.FieldCreatedAt, field.TypeInt64, value) _node.CreatedAt = value } + if value, ok := _c.mutation.UpdatedAt(); ok { + _spec.SetField(zone.FieldUpdatedAt, field.TypeInt64, value) + _node.UpdatedAt = value + } return _node, _spec } @@ -250,6 +297,18 @@ func (u *ZoneUpsert) ClearDescription() *ZoneUpsert { return u } +// SetStatus sets the "status" field. +func (u *ZoneUpsert) SetStatus(v string) *ZoneUpsert { + u.Set(zone.FieldStatus, v) + return u +} + +// UpdateStatus sets the "status" field to the value that was provided on create. +func (u *ZoneUpsert) UpdateStatus() *ZoneUpsert { + u.SetExcluded(zone.FieldStatus) + return u +} + // SetCreatedAt sets the "created_at" field. func (u *ZoneUpsert) SetCreatedAt(v int64) *ZoneUpsert { u.Set(zone.FieldCreatedAt, v) @@ -268,6 +327,30 @@ func (u *ZoneUpsert) AddCreatedAt(v int64) *ZoneUpsert { return u } +// SetUpdatedAt sets the "updated_at" field. +func (u *ZoneUpsert) SetUpdatedAt(v int64) *ZoneUpsert { + u.Set(zone.FieldUpdatedAt, v) + return u +} + +// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create. +func (u *ZoneUpsert) UpdateUpdatedAt() *ZoneUpsert { + u.SetExcluded(zone.FieldUpdatedAt) + return u +} + +// AddUpdatedAt adds v to the "updated_at" field. +func (u *ZoneUpsert) AddUpdatedAt(v int64) *ZoneUpsert { + u.Add(zone.FieldUpdatedAt, v) + return u +} + +// ClearUpdatedAt clears the value of the "updated_at" field. +func (u *ZoneUpsert) ClearUpdatedAt() *ZoneUpsert { + u.SetNull(zone.FieldUpdatedAt) + return u +} + // UpdateNewValues updates the mutable fields using the new values that were set on create. // Using this option is equivalent to using: // @@ -357,6 +440,20 @@ func (u *ZoneUpsertOne) ClearDescription() *ZoneUpsertOne { }) } +// SetStatus sets the "status" field. +func (u *ZoneUpsertOne) SetStatus(v string) *ZoneUpsertOne { + return u.Update(func(s *ZoneUpsert) { + s.SetStatus(v) + }) +} + +// UpdateStatus sets the "status" field to the value that was provided on create. +func (u *ZoneUpsertOne) UpdateStatus() *ZoneUpsertOne { + return u.Update(func(s *ZoneUpsert) { + s.UpdateStatus() + }) +} + // SetCreatedAt sets the "created_at" field. func (u *ZoneUpsertOne) SetCreatedAt(v int64) *ZoneUpsertOne { return u.Update(func(s *ZoneUpsert) { @@ -378,6 +475,34 @@ func (u *ZoneUpsertOne) UpdateCreatedAt() *ZoneUpsertOne { }) } +// SetUpdatedAt sets the "updated_at" field. +func (u *ZoneUpsertOne) SetUpdatedAt(v int64) *ZoneUpsertOne { + return u.Update(func(s *ZoneUpsert) { + s.SetUpdatedAt(v) + }) +} + +// AddUpdatedAt adds v to the "updated_at" field. +func (u *ZoneUpsertOne) AddUpdatedAt(v int64) *ZoneUpsertOne { + return u.Update(func(s *ZoneUpsert) { + s.AddUpdatedAt(v) + }) +} + +// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create. +func (u *ZoneUpsertOne) UpdateUpdatedAt() *ZoneUpsertOne { + return u.Update(func(s *ZoneUpsert) { + s.UpdateUpdatedAt() + }) +} + +// ClearUpdatedAt clears the value of the "updated_at" field. +func (u *ZoneUpsertOne) ClearUpdatedAt() *ZoneUpsertOne { + return u.Update(func(s *ZoneUpsert) { + s.ClearUpdatedAt() + }) +} + // Exec executes the query. func (u *ZoneUpsertOne) Exec(ctx context.Context) error { if len(u.create.conflict) == 0 { @@ -631,6 +756,20 @@ func (u *ZoneUpsertBulk) ClearDescription() *ZoneUpsertBulk { }) } +// SetStatus sets the "status" field. +func (u *ZoneUpsertBulk) SetStatus(v string) *ZoneUpsertBulk { + return u.Update(func(s *ZoneUpsert) { + s.SetStatus(v) + }) +} + +// UpdateStatus sets the "status" field to the value that was provided on create. +func (u *ZoneUpsertBulk) UpdateStatus() *ZoneUpsertBulk { + return u.Update(func(s *ZoneUpsert) { + s.UpdateStatus() + }) +} + // SetCreatedAt sets the "created_at" field. func (u *ZoneUpsertBulk) SetCreatedAt(v int64) *ZoneUpsertBulk { return u.Update(func(s *ZoneUpsert) { @@ -652,6 +791,34 @@ func (u *ZoneUpsertBulk) UpdateCreatedAt() *ZoneUpsertBulk { }) } +// SetUpdatedAt sets the "updated_at" field. +func (u *ZoneUpsertBulk) SetUpdatedAt(v int64) *ZoneUpsertBulk { + return u.Update(func(s *ZoneUpsert) { + s.SetUpdatedAt(v) + }) +} + +// AddUpdatedAt adds v to the "updated_at" field. +func (u *ZoneUpsertBulk) AddUpdatedAt(v int64) *ZoneUpsertBulk { + return u.Update(func(s *ZoneUpsert) { + s.AddUpdatedAt(v) + }) +} + +// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create. +func (u *ZoneUpsertBulk) UpdateUpdatedAt() *ZoneUpsertBulk { + return u.Update(func(s *ZoneUpsert) { + s.UpdateUpdatedAt() + }) +} + +// ClearUpdatedAt clears the value of the "updated_at" field. +func (u *ZoneUpsertBulk) ClearUpdatedAt() *ZoneUpsertBulk { + return u.Update(func(s *ZoneUpsert) { + s.ClearUpdatedAt() + }) +} + // Exec executes the query. func (u *ZoneUpsertBulk) Exec(ctx context.Context) error { if u.create.err != nil { diff --git a/bj_power_wms/ent/zone_query.go b/bj_power_wms/ent/zone_query.go index abf7012..36439aa 100644 --- a/bj_power_wms/ent/zone_query.go +++ b/bj_power_wms/ent/zone_query.go @@ -262,7 +262,7 @@ func (_q *ZoneQuery) Clone() *ZoneQuery { // Example: // // var v []struct { -// ZoneCode string `json:"zone_code,omitempty"` +// ZoneCode string `json:"zoneCode,omitempty"` // Count int `json:"count,omitempty"` // } // @@ -285,7 +285,7 @@ func (_q *ZoneQuery) GroupBy(field string, fields ...string) *ZoneGroupBy { // Example: // // var v []struct { -// ZoneCode string `json:"zone_code,omitempty"` +// ZoneCode string `json:"zoneCode,omitempty"` // } // // client.Zone.Query(). diff --git a/bj_power_wms/ent/zone_update.go b/bj_power_wms/ent/zone_update.go index 620376f..3111cf5 100644 --- a/bj_power_wms/ent/zone_update.go +++ b/bj_power_wms/ent/zone_update.go @@ -75,6 +75,20 @@ func (_u *ZoneUpdate) ClearDescription() *ZoneUpdate { return _u } +// SetStatus sets the "status" field. +func (_u *ZoneUpdate) SetStatus(v string) *ZoneUpdate { + _u.mutation.SetStatus(v) + return _u +} + +// SetNillableStatus sets the "status" field if the given value is not nil. +func (_u *ZoneUpdate) SetNillableStatus(v *string) *ZoneUpdate { + if v != nil { + _u.SetStatus(*v) + } + return _u +} + // SetCreatedAt sets the "created_at" field. func (_u *ZoneUpdate) SetCreatedAt(v int64) *ZoneUpdate { _u.mutation.ResetCreatedAt() @@ -96,6 +110,33 @@ func (_u *ZoneUpdate) AddCreatedAt(v int64) *ZoneUpdate { return _u } +// SetUpdatedAt sets the "updated_at" field. +func (_u *ZoneUpdate) SetUpdatedAt(v int64) *ZoneUpdate { + _u.mutation.ResetUpdatedAt() + _u.mutation.SetUpdatedAt(v) + return _u +} + +// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil. +func (_u *ZoneUpdate) SetNillableUpdatedAt(v *int64) *ZoneUpdate { + if v != nil { + _u.SetUpdatedAt(*v) + } + return _u +} + +// AddUpdatedAt adds value to the "updated_at" field. +func (_u *ZoneUpdate) AddUpdatedAt(v int64) *ZoneUpdate { + _u.mutation.AddUpdatedAt(v) + return _u +} + +// ClearUpdatedAt clears the value of the "updated_at" field. +func (_u *ZoneUpdate) ClearUpdatedAt() *ZoneUpdate { + _u.mutation.ClearUpdatedAt() + return _u +} + // Mutation returns the ZoneMutation object of the builder. func (_u *ZoneUpdate) Mutation() *ZoneMutation { return _u.mutation @@ -149,12 +190,24 @@ func (_u *ZoneUpdate) sqlSave(ctx context.Context) (_node int, err error) { if _u.mutation.DescriptionCleared() { _spec.ClearField(zone.FieldDescription, field.TypeString) } + if value, ok := _u.mutation.Status(); ok { + _spec.SetField(zone.FieldStatus, field.TypeString, value) + } if value, ok := _u.mutation.CreatedAt(); ok { _spec.SetField(zone.FieldCreatedAt, field.TypeInt64, value) } if value, ok := _u.mutation.AddedCreatedAt(); ok { _spec.AddField(zone.FieldCreatedAt, field.TypeInt64, value) } + if value, ok := _u.mutation.UpdatedAt(); ok { + _spec.SetField(zone.FieldUpdatedAt, field.TypeInt64, value) + } + if value, ok := _u.mutation.AddedUpdatedAt(); ok { + _spec.AddField(zone.FieldUpdatedAt, field.TypeInt64, value) + } + if _u.mutation.UpdatedAtCleared() { + _spec.ClearField(zone.FieldUpdatedAt, field.TypeInt64) + } if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{zone.Label} @@ -223,6 +276,20 @@ func (_u *ZoneUpdateOne) ClearDescription() *ZoneUpdateOne { return _u } +// SetStatus sets the "status" field. +func (_u *ZoneUpdateOne) SetStatus(v string) *ZoneUpdateOne { + _u.mutation.SetStatus(v) + return _u +} + +// SetNillableStatus sets the "status" field if the given value is not nil. +func (_u *ZoneUpdateOne) SetNillableStatus(v *string) *ZoneUpdateOne { + if v != nil { + _u.SetStatus(*v) + } + return _u +} + // SetCreatedAt sets the "created_at" field. func (_u *ZoneUpdateOne) SetCreatedAt(v int64) *ZoneUpdateOne { _u.mutation.ResetCreatedAt() @@ -244,6 +311,33 @@ func (_u *ZoneUpdateOne) AddCreatedAt(v int64) *ZoneUpdateOne { return _u } +// SetUpdatedAt sets the "updated_at" field. +func (_u *ZoneUpdateOne) SetUpdatedAt(v int64) *ZoneUpdateOne { + _u.mutation.ResetUpdatedAt() + _u.mutation.SetUpdatedAt(v) + return _u +} + +// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil. +func (_u *ZoneUpdateOne) SetNillableUpdatedAt(v *int64) *ZoneUpdateOne { + if v != nil { + _u.SetUpdatedAt(*v) + } + return _u +} + +// AddUpdatedAt adds value to the "updated_at" field. +func (_u *ZoneUpdateOne) AddUpdatedAt(v int64) *ZoneUpdateOne { + _u.mutation.AddUpdatedAt(v) + return _u +} + +// ClearUpdatedAt clears the value of the "updated_at" field. +func (_u *ZoneUpdateOne) ClearUpdatedAt() *ZoneUpdateOne { + _u.mutation.ClearUpdatedAt() + return _u +} + // Mutation returns the ZoneMutation object of the builder. func (_u *ZoneUpdateOne) Mutation() *ZoneMutation { return _u.mutation @@ -327,12 +421,24 @@ func (_u *ZoneUpdateOne) sqlSave(ctx context.Context) (_node *Zone, err error) { if _u.mutation.DescriptionCleared() { _spec.ClearField(zone.FieldDescription, field.TypeString) } + if value, ok := _u.mutation.Status(); ok { + _spec.SetField(zone.FieldStatus, field.TypeString, value) + } if value, ok := _u.mutation.CreatedAt(); ok { _spec.SetField(zone.FieldCreatedAt, field.TypeInt64, value) } if value, ok := _u.mutation.AddedCreatedAt(); ok { _spec.AddField(zone.FieldCreatedAt, field.TypeInt64, value) } + if value, ok := _u.mutation.UpdatedAt(); ok { + _spec.SetField(zone.FieldUpdatedAt, field.TypeInt64, value) + } + if value, ok := _u.mutation.AddedUpdatedAt(); ok { + _spec.AddField(zone.FieldUpdatedAt, field.TypeInt64, value) + } + if _u.mutation.UpdatedAtCleared() { + _spec.ClearField(zone.FieldUpdatedAt, field.TypeInt64) + } _node = &Zone{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues diff --git a/bj_power_wms/internal/handler/inbound.go b/bj_power_wms/internal/handler/inbound.go index 864ddc3..2ac798b 100644 --- a/bj_power_wms/internal/handler/inbound.go +++ b/bj_power_wms/internal/handler/inbound.go @@ -40,6 +40,10 @@ func createInboundHandler(ctx *svc.ServiceContext) http.HandlerFunc { fail(w, http.StatusBadRequest, "物料编码必填") return } + if req.ZoneCode == "" { + fail(w, http.StatusBadRequest, "区域必填,请先选择入库区域") + return + } // 物料档案 m, err := ctx.EntClient.Material.Query(). @@ -73,13 +77,18 @@ func createInboundHandler(ctx *svc.ServiceContext) http.HandlerFunc { // 结构件(批次管理) if m.ManageMode == 1 { + // 结构件走批次入库,不允许携带 SN 清单 + if len(req.SnList) > 0 { + fail(w, http.StatusBadRequest, "该物料为结构件(按批次管理),不应提交 SN 清单,请使用『结构件入库』") + return + } batchNo := req.BatchNo if batchNo == "" { batchNo = genBatchNo(req.MaterialCode) } qty := req.Quantity if qty <= 0 { - fail(w, http.StatusBadRequest, "结构件入库 数量必填且大于0") + fail(w, http.StatusBadRequest, "数量必填且大于 0,请输入本次入库数量") return } @@ -119,7 +128,7 @@ func createInboundHandler(ctx *svc.ServiceContext) http.HandlerFunc { // 精密件(SN 管理) if m.ManageMode == 2 { if len(req.SnList) == 0 { - fail(w, http.StatusBadRequest, "精密件入库 序列号(SN)必填") + fail(w, http.StatusBadRequest, "该物料为精密件(按 SN 管理),请至少录入 1 条序列号(SN)") return } for _, sn := range req.SnList { diff --git a/bj_power_wms/internal/handler/misc.go b/bj_power_wms/internal/handler/misc.go index e1c4ca5..9774dfd 100644 --- a/bj_power_wms/internal/handler/misc.go +++ b/bj_power_wms/internal/handler/misc.go @@ -149,21 +149,23 @@ func querySemiHandler(ctx *svc.ServiceContext) http.HandlerFunc { } } -// packageBindHandler 包装绑定(箱号 ↔ SN) +// packageBindHandler 装箱绑定(箱号 ↔ SN),支持合同号 func packageBindHandler(ctx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req struct { BoxNo string `json:"boxNo"` SnList []string `json:"snList"` MaterialCode string `json:"materialCode"` + ContractNo string `json:"contractNo"` Operator string `json:"operator"` + Remark string `json:"remark"` } if err := parseJSON(r, &req); err != nil { fail(w, http.StatusBadRequest, "参数错误") return } if req.BoxNo == "" || len(req.SnList) == 0 { - fail(w, http.StatusBadRequest, "boxNo 和 snList 必填") + fail(w, http.StatusBadRequest, "箱号和 SN 清单必填") return } @@ -187,7 +189,9 @@ func packageBindHandler(ctx *svc.ServiceContext) http.HandlerFunc { SetSnList(snJSON). SetNillableMaterialCode(strPtr(req.MaterialCode)). SetQuantity(len(req.SnList)). + SetNillableContractNo(strPtr(req.ContractNo)). SetNillableOperator(strPtr(req.Operator)). + SetNillableRemark(strPtr(req.Remark)). Save(ctx0()) if err != nil { fail(w, http.StatusInternalServerError, err.Error()) @@ -197,6 +201,38 @@ func packageBindHandler(ctx *svc.ServiceContext) http.HandlerFunc { } } +// packageUpdateHandler 编辑装箱(重新装箱 SN / 修改合同号等) +func packageUpdateHandler(ctx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req struct { + ID int `json:"id"` + SnList []string `json:"snList"` + MaterialCode string `json:"materialCode"` + ContractNo string `json:"contractNo"` + Operator string `json:"operator"` + Remark string `json:"remark"` + } + if err := parseJSON(r, &req); err != nil || req.ID <= 0 { + fail(w, http.StatusBadRequest, "参数错误") + return + } + upd := ctx.EntClient.PackageBox.UpdateOneID(req.ID) + if len(req.SnList) > 0 { + upd.SetSnList(toJSON(req.SnList)).SetQuantity(len(req.SnList)) + } + upd.SetNillableMaterialCode(strPtr(req.MaterialCode)). + SetNillableContractNo(strPtr(req.ContractNo)). + SetNillableOperator(strPtr(req.Operator)). + SetNillableRemark(strPtr(req.Remark)) + pkg, err := upd.Save(ctx0()) + if err != nil { + fail(w, http.StatusInternalServerError, "更新装箱失败: "+err.Error()) + return + } + ok(w, pkg) + } +} + // toJSON 序列化任意值为 JSON 字符串 func toJSON(v any) string { b, err := json.Marshal(v) @@ -206,10 +242,15 @@ func toJSON(v any) string { return string(b) } -// queryPackageHandler 包装查询 +// queryPackageHandler 装箱查询(多条件:箱号/合同号/操作人/物料/时间范围) func queryPackageHandler(ctx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { boxNo := r.URL.Query().Get("boxNo") + contractNo := r.URL.Query().Get("contractNo") + operator := r.URL.Query().Get("operator") + materialCode := r.URL.Query().Get("materialCode") + startAt := r.URL.Query().Get("startAt") + endAt := r.URL.Query().Get("endAt") page := atoi(r.URL.Query().Get("page"), 1) pageSize := atoi(r.URL.Query().Get("pageSize"), 20) @@ -217,6 +258,27 @@ func queryPackageHandler(ctx *svc.ServiceContext) http.HandlerFunc { if boxNo != "" { q = q.Where(packagebox.BoxNoContains(boxNo)) } + if contractNo != "" { + q = q.Where(packagebox.ContractNoContains(contractNo)) + } + if operator != "" { + q = q.Where(packagebox.OperatorContains(operator)) + } + if materialCode != "" { + q = q.Where(packagebox.MaterialCodeEQ(materialCode)) + } + if startAt != "" { + start := atoi64(startAt, 0) + if start > 0 { + q = q.Where(packagebox.CreatedAtGTE(start)) + } + } + if endAt != "" { + end := atoi64(endAt, 0) + if end > 0 { + q = q.Where(packagebox.CreatedAtLTE(end)) + } + } total, err := q.Count(ctx0()) if err != nil { fail(w, http.StatusInternalServerError, err.Error()) diff --git a/bj_power_wms/internal/handler/routes.go b/bj_power_wms/internal/handler/routes.go index 6976b3c..e38e2a4 100644 --- a/bj_power_wms/internal/handler/routes.go +++ b/bj_power_wms/internal/handler/routes.go @@ -78,7 +78,9 @@ func RegisterHandlers(server *rest.Server, ctx *svc.ServiceContext) { server.AddRoutes( []rest.Route{ {Method: http.MethodPost, Path: "/api/zone/create", Handler: createZoneHandler(ctx)}, + {Method: http.MethodPost, Path: "/api/zone/update", Handler: updateZoneHandler(ctx)}, {Method: http.MethodGet, Path: "/api/zone/list", Handler: listZonesHandler(ctx)}, + {Method: http.MethodGet, Path: "/api/zone/picker", Handler: listZonesForPicker(ctx)}, }, ) @@ -105,6 +107,7 @@ func RegisterHandlers(server *rest.Server, ctx *svc.ServiceContext) { server.AddRoutes( []rest.Route{ {Method: http.MethodPost, Path: "/api/package/bind", Handler: packageBindHandler(ctx)}, + {Method: http.MethodPost, Path: "/api/package/update", Handler: packageUpdateHandler(ctx)}, {Method: http.MethodGet, Path: "/api/package/query", Handler: queryPackageHandler(ctx)}, }, ) diff --git a/bj_power_wms/internal/handler/zone.go b/bj_power_wms/internal/handler/zone.go index fb25019..d41f013 100644 --- a/bj_power_wms/internal/handler/zone.go +++ b/bj_power_wms/internal/handler/zone.go @@ -21,7 +21,7 @@ func createZoneHandler(ctx *svc.ServiceContext) http.HandlerFunc { return } if req.ZoneCode == "" || req.ZoneName == "" { - fail(w, http.StatusBadRequest, "zoneCode 和 zoneName 必填") + fail(w, http.StatusBadRequest, "区域编码和区域名称必填") return } @@ -41,6 +41,7 @@ func createZoneHandler(ctx *svc.ServiceContext) http.HandlerFunc { SetZoneCode(req.ZoneCode). SetZoneName(req.ZoneName). SetNillableDescription(strPtr(req.Description)). + SetStatus("启用"). Save(ctx0()) if err != nil { fail(w, http.StatusInternalServerError, err.Error()) @@ -50,10 +51,82 @@ func createZoneHandler(ctx *svc.ServiceContext) http.HandlerFunc { } } -// listZonesHandler 区域列表 +// updateZoneHandler 编辑区域 +func updateZoneHandler(ctx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req struct { + ID int `json:"id"` + ZoneCode string `json:"zoneCode"` + ZoneName string `json:"zoneName"` + Description string `json:"description"` + } + if err := parseJSON(r, &req); err != nil || req.ID <= 0 { + fail(w, http.StatusBadRequest, "参数错误") + return + } + if req.ZoneName == "" { + fail(w, http.StatusBadRequest, "区域名称必填") + return + } + upd := ctx.EntClient.Zone.UpdateOneID(req.ID).SetZoneName(req.ZoneName) + if req.ZoneCode != "" { + upd.SetZoneCode(req.ZoneCode) + } + upd.SetNillableDescription(strPtr(req.Description)) + z, err := upd.Save(ctx0()) + if err != nil { + fail(w, http.StatusInternalServerError, "更新区域失败: "+err.Error()) + return + } + ok(w, z) + } +} + +// listZonesHandler 区域列表(分页 + 关键字) func listZonesHandler(ctx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - list, err := ctx.EntClient.Zone.Query().Order(ent.Desc("id")).All(ctx0()) + page := atoi(r.URL.Query().Get("page"), 1) + pageSize := atoi(r.URL.Query().Get("pageSize"), 20) + keyword := r.URL.Query().Get("keyword") + + q := ctx.EntClient.Zone.Query() + if keyword != "" { + q = q.Where( + zone.Or( + zone.ZoneCodeContains(keyword), + zone.ZoneNameContains(keyword), + ), + ) + } + total, err := q.Count(ctx0()) + if err != nil { + fail(w, http.StatusInternalServerError, err.Error()) + return + } + list, err := q.Order(ent.Desc("id")). + Offset((page - 1) * pageSize). + Limit(pageSize). + All(ctx0()) + if err != nil { + fail(w, http.StatusInternalServerError, err.Error()) + return + } + ok(w, map[string]any{ + "total": total, + "list": list, + "page": page, + "pageSize": pageSize, + }) + } +} + +// listZonesForPicker 区域下拉列表(不分页,仅启用) +func listZonesForPicker(ctx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + list, err := ctx.EntClient.Zone.Query(). + Where(zone.StatusEQ("启用")). + Order(ent.Asc("id")). + All(ctx0()) if err != nil { fail(w, http.StatusInternalServerError, err.Error()) return diff --git a/bj_power_wms/schema/package_box.go b/bj_power_wms/schema/package_box.go index 7ef9440..aac37e0 100644 --- a/bj_power_wms/schema/package_box.go +++ b/bj_power_wms/schema/package_box.go @@ -19,13 +19,17 @@ func (PackageBox) Fields() []ent.Field { field.String("material_code").Optional().Comment("物料编码"), field.Int("quantity").Default(0).Comment("箱内数量"), field.String("operator").Optional().Comment("包装人"), + field.String("contract_no").Optional().Comment("合同号(选填)"), field.String("remark").Optional().Comment("备注"), field.Int64("created_at").DefaultFunc(nowUnix), + field.Int64("updated_at").DefaultFunc(nowUnix).Optional().Comment("更新时间"), } } func (PackageBox) Indexes() []ent.Index { return []ent.Index{ index.Fields("material_code"), + index.Fields("contract_no"), + index.Fields("operator"), } } diff --git a/bj_power_wms/schema/zone.go b/bj_power_wms/schema/zone.go index 60a3fec..674557e 100644 --- a/bj_power_wms/schema/zone.go +++ b/bj_power_wms/schema/zone.go @@ -16,6 +16,8 @@ func (Zone) Fields() []ent.Field { field.String("zone_code").Unique().Comment("区域编码"), field.String("zone_name").Comment("区域名称"), field.String("description").Optional().Comment("描述"), + field.String("status").Default("启用").Comment("状态:启用/停用"), field.Int64("created_at").DefaultFunc(nowUnix), + field.Int64("updated_at").DefaultFunc(nowUnix).Optional().Comment("更新时间"), } } diff --git a/bj_power_wms/tools/generate.go b/bj_power_wms/tools/generate.go index 3f6ad0f..f9bc333 100644 --- a/bj_power_wms/tools/generate.go +++ b/bj_power_wms/tools/generate.go @@ -1,14 +1,59 @@ -//go:build ignore +//go:build entgenerate package main import ( + "fmt" "log" + "strings" "entgo.io/ent/entc" "entgo.io/ent/entc/gen" ) +// camel 把 snake_case 的字段名/边名转成 camelCase。 +// 项目约定:接口 JSON 一律 camelCase(见《技术约束.md》), +// 而 ent 默认生成的 json tag 是 snake_case,这里统一覆盖。 +func camel(s string) string { + parts := strings.Split(s, "_") + for i := 1; i < len(parts); i++ { + if parts[i] != "" { + parts[i] = strings.ToUpper(parts[i][:1]) + parts[i][1:] + } + } + return strings.Join(parts, "") +} + +// camelJSON 扩展:为所有字段与边设置 camelCase 的 json tag。 +type camelJSON struct { + entc.DefaultExtension +} + +func (camelJSON) Hooks() []gen.Hook { + return []gen.Hook{ + func(next gen.Generator) gen.Generator { + return gen.GenerateFunc(func(g *gen.Graph) error { + for _, n := range g.Nodes { + for _, f := range n.Fields { + // schema 中显式声明的标签(如 json:"-")不覆盖 + if f.StructTag != "" && strings.Contains(f.StructTag, `json:"-"`) { + continue + } + f.StructTag = fmt.Sprintf("json:%q", camel(f.Name)+",omitempty") + } + for _, e := range n.Edges { + if e.StructTag != "" && strings.Contains(e.StructTag, `json:"-"`) { + continue + } + e.StructTag = fmt.Sprintf("json:%q", camel(e.Name)+",omitempty") + } + } + return next.Generate(g) + }) + }, + } +} + func main() { err := entc.Generate("./schema", &gen.Config{ Package: "bj_power_wms/ent", @@ -17,7 +62,7 @@ func main() { gen.FeatureVersionedMigration, gen.FeatureUpsert, }, - }) + }, entc.Extensions(camelJSON{})) if err != nil { log.Fatalf("running ent codegen: %v", err) } diff --git a/bj_power_wms_client/frontend/src/components/PageHelp.vue b/bj_power_wms_client/frontend/src/components/PageHelp.vue index b469149..01af71f 100644 --- a/bj_power_wms_client/frontend/src/components/PageHelp.vue +++ b/bj_power_wms_client/frontend/src/components/PageHelp.vue @@ -1,11 +1,6 @@ \ No newline at end of file + diff --git a/bj_power_wms_client/frontend/src/pages/Stocktake.vue b/bj_power_wms_client/frontend/src/pages/Stocktake.vue index 4011ff8..ca5985b 100644 --- a/bj_power_wms_client/frontend/src/pages/Stocktake.vue +++ b/bj_power_wms_client/frontend/src/pages/Stocktake.vue @@ -38,7 +38,7 @@ async function submitRecord() { } const targetId = recordForm.targetId.trim() if (!targetId) { - ElMessage.warning('请扫入目标编号(批次号或 SN)') + ElMessage.warning('请扫入批次号(结构件)或 SN 序列号(精密件)') return } const qty = Number(recordForm.scanQty) @@ -152,8 +152,8 @@ async function loadHistory() { - - + @@ -164,7 +164,7 @@ async function loadHistory() { - + diff --git a/bj_power_wms_client/frontend/src/router/index.js b/bj_power_wms_client/frontend/src/router/index.js index 2c7e5b3..5995607 100644 --- a/bj_power_wms_client/frontend/src/router/index.js +++ b/bj_power_wms_client/frontend/src/router/index.js @@ -16,7 +16,7 @@ const routes = [ { path: 'inspection', name: 'Inspection', component: () => import('../pages/Inspection.vue'), meta: { title: '质量检验' } }, { path: 'stocktake', name: 'Stocktake', component: () => import('../pages/Stocktake.vue'), meta: { title: '库存盘点' } }, { path: 'semi', name: 'Semi', component: () => import('../pages/Semi.vue'), meta: { title: '半成品/成品' } }, - { path: 'package', name: 'Package', component: () => import('../pages/Package.vue'), meta: { title: '包装绑定' } }, + { path: 'package', name: 'Package', component: () => import('../pages/Package.vue'), meta: { title: '装箱管理' } }, { path: 'ledger', name: 'Ledger', component: () => import('../pages/Ledger.vue'), meta: { title: '备料台账' } }, { path: 'base-data', name: 'BaseData', component: () => import('../pages/BaseData.vue'), meta: { title: '基础数据' } }, { path: 'change-password', name: 'ChangePassword', component: () => import('../pages/ChangePassword.vue'), meta: { title: '修改密码' } } diff --git a/bj_power_wms_client/web/static/index.html b/bj_power_wms_client/web/static/index.html deleted file mode 100644 index 3e3606f..0000000 --- a/bj_power_wms_client/web/static/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - 库房客户端 - - - - -
- - \ No newline at end of file diff --git a/问题修复记录.md b/问题修复记录.md index 89fc2dc..c275843 100644 --- a/问题修复记录.md +++ b/问题修复记录.md @@ -547,4 +547,42 @@ mes --- > 工艺流程----> 工位管理 , 1、状态不要用 ENABLED 等英 +20260901 记录 + +一、菜单:工单管理 +1、新建工单, 产品类型 选择框,用户未选择时, 选择框显示“请选择”。所有选择框,都应如此。 +2、工单,不能删除吗。 满足某些条件时,应该可以删除。请考虑一下 +3、查询条件,多一些,比如:产品编码、产品名称 模糊查询 +4、新建工单、工序组合,是不是应该是 工位 ? 你看看,怎么更合适 + + + +二、菜单: 工艺流程 +1、名称起的有些不合适: 工艺流程、 流程名称叫 “工序1_默认” ,流程,和工序,是不一样的。不能叫工序。原设计,一个流程包含多个序 +2、编辑工艺流程 ---> 工序编号 ? 应该是工位编码吧,固定 12个。认真审核,名字统一。 +3、编辑工艺流程 ---> 步骤模板 ? 工序步骤吧。 你好好统一一下,现在非常容易混淆。 比如,去除 工艺 概念 ? 去除 工序 概念。你好好考虑 + +三、菜单: PLC工序下发 +这个全人工操作,挺好的。名称变一下,更符合业务场景,操作人员更容易理解。见名知意。 + + + +四、菜单: 日排产 +工单号:WO1787966513636 , 计划数量 总和,超出了 工单的 工件 数量。是个bug + + +五、菜单: 产品类型 +帮助文档,说清楚,和工单、物料清单、备料单、如何分工,几对几关系,有没有强约束,等。 相关菜单,也要把这些关系写清楚。 如果有和wms关联的,更要说清楚。 + + + +整体建议: +菜单,能不能,分分类。包括 wms,先优化,后分类。 仅思考,判定是否合适,给方案。 + + + + + + + diff --git a/问题记录.md b/问题记录.md index aa9dcb7..274d863 100644 --- a/问题记录.md +++ b/问题记录.md @@ -1,32 +1,168 @@ -一、菜单:工单管理 -1、新建工单, 产品类型 选择框,用户未选择时, 选择框显示“请选择”。所有选择框,都应如此。 -2、工单,不能删除吗。 满足某些条件时,应该可以删除。请考虑一下 -3、查询条件,多一些,比如:产品编码、产品名称 模糊查询 -4、新建工单、工序组合,是不是应该是 工位 ? 你看看,怎么更合适 +wms +1、结构件入库--->提交入库。报错提示: 精密件入库 序列号(SN)必填 +2、结构件入库--->区域 undefined 。并且 区域 ,应该是必填 +3、精密件SN入库-->物料、区域,都应该是必填 +4、基础数据,拆分一下。并且,保存方式,不要再用这种表格上面 。 行内新增 vs 弹窗新增 ? wms和mes 等,都必须用 弹出新增修改。所有项目,大列表时,必须有分页 +5、所有项目,浏览器tab标签页,小图标,不能显示 hardman标,显示一个系统相关图标 +6、基础数据-->区域维护,列表显示有问题。区域编码、区域名称 都没显示出来。还是说,没有保存上呢? +7、wms左下角,还是有 问号帮助标识。去除,只保留右上角 帮助按钮即可 +8、帮助按钮,如果没有数据,合理提示用户 +9、包装绑定,当前也是 行内新增,写法。都去掉,看着难受。并且,新增修改,都添加一个合同号(选填)。 标题添加查询按钮,搜索条件多一些(操作人、时间、合同号、等等等) +10、包装绑定,名称取得,能不能更好听些,能代表实际现场业务,见名知意 +11、半成品出库(重上线) , 跟mes 能闭环不能,什么逻辑 +12、库存查询 里面 叫:批次号、SN 序列号 , 库存盘点 里面叫 目标编号 到底什么意思,对不上号。 要求1、统一 名称 ,结构件和精密件 应该有一个总名称:物料?货物? 叫什么合适? 2、结构件和精密件,主表结构要统一,精密件,仅仅比结构件多了一个子表 记录sn,其他是不是应该一样? 都有批次、和数量 -二、菜单: 工艺流程 -1、名称起的有些不合适: 工艺流程、 流程名称叫 “工序1_默认” ,流程,和工序,是不一样的。不能叫工序。原设计,一个流程包含多个序 -2、编辑工艺流程 ---> 工序编号 ? 应该是工位编码吧,固定 12个。认真审核,名字统一。 -3、编辑工艺流程 ---> 步骤模板 ? 工序步骤吧。 你好好统一一下,现在非常容易混淆。 比如,去除 工艺 概念 ? 去除 工序 概念。你好好考虑 - -三、菜单: PLC工序下发 -这个全人工操作,挺好的。名称变一下,更符合业务场景,操作人员更容易理解。见名知意。 -四、菜单: 日排产 -工单号:WO1787966513636 , 计划数量 总和,超出了 工单的 工件 数量。是个bug -五、菜单: 产品类型 -帮助文档,说清楚,和工单、物料清单、备料单、如何分工,几对几关系,有没有强约束,等。 相关菜单,也要把这些关系写清楚。 如果有和wms关联的,更要说清楚。 +所有项目帮助按钮说明: +DeepSeek,写的说明这么好,你为什么写的说明,如此差??? 你参考参考人家的(至结尾) + +## 工单物料台账 —— 页面设计说明 + +### 一、这个页面是什么 + +**一个「实时看板」,展示某个工单的物料消耗进度,强制约束“不准超领”。** + +把每个物料的三项数据列在一行:**总共要多少 → 已经出了多少 → 还剩多少缺口**。 + + +### 二、数据链路 + +**MES 工单创建时 → 用 BOM 算出物料总需求 → 自动写入 WMS 工单物料台账 → 每次出库自动扣减累计出库 → 缺口实时更新。** + +- 工单号:来自 MES 工单(手动输入查询) +- 需求总量:MES BOM 自动算(产品 × 单台用量) +- 累计已出库:出库单提交时自动累加(WMS 算) +- 剩余缺口:需求总量 - 累计已出库(系统算,只读) + +**核心约束:累计出库 ≥ 需求总量时,该物料“领料完结”,禁止再出库。** 累计出库 **永远不能大于** 需求总量。达到即完结,禁止超额。 + + +### 三、页面功能 + +1. **查询**:输入工单号 → 显示该工单的所有物料台账行 +2. **列表展示**:每行一个物料,显示需求总量、累计已出库、剩余缺口 +3. **状态标识**:剩余缺口 > 0 显示“待领料”/“部分领料”,= 0 显示“领料完结”/绿色对勾 +4. **实时更新**:每次出库提交后,累计出库和剩余缺口自动刷新 + + +### 四、字段说明 + +| 字段 | 来源 | 谁填 | 说明 | +|------|------|------|------| +| 工单号 | MES 工单 | 系统自动带入 | 查询条件,手动输入 | +| 物料编码 | MES BOM | 系统自动带入 | 工单创建时从 BOM 取 | +| 物料名称 | 调 WMS 物料档案 | 系统自动带入 | 按编码查 WMS | +| 规格 | 调 WMS 物料档案 | 系统自动带入 | 同上 | +| 单位 | 调 WMS 物料档案 | 系统自动带入 | 同上 | +| 需求总量 | MES BOM | 系统自动计算 | BOM 单台用量 × 工单计划产量 | +| 累计已出库 | 出库单 | 系统自动累加 | 每次出库提交后 + 出库数量 | +| 剩余缺口 | 系统计算 | 只读 | 需求总量 - 累计已出库 | +| 状态 | 系统判定 | 只读 | 缺口>0 显示“部分领料”,=0 显示“领料完结” | + + +### 五、界面示意 + +``` +┌──────────────────────────────────────────────────────────────────────┐ +│ 工单物料台账 │ +│ ┌──────────────────────────────────────────────────────────────────┐ │ +│ │ 工单号 [WO001___________] [查询] │ │ +│ └──────────────────────────────────────────────────────────────────┘ │ + +┌──────┬────────┬──────┬──────┬──────────┬──────────┬──────────┬──────────┐ +│ 物料 │ 物料 │ 规格 │ 单位 │ 需求总量 │ 累计已出 │ 剩余缺口 │ 状态 │ +│ 编码 │ 名称 │ │ │ │ 库 │ │ │ +├──────┼────────┼──────┼──────┼──────────┼──────────┼──────────┼──────────┤ +│ SCR- │ 螺丝 │ M4× │ 颗 │ 800 │ 600 │ 200 │ 部分领料 │ +│ M4-12 │ M4 │ 12 │ │ │ │ │ │ +├──────┼────────┼──────┼──────┼──────────┼──────────┼──────────┼──────────┤ +│ CHIP- │ 控制 │ │ 片 │ 100 │ 100 │ 0 │ ✅领料完结│ +│ 001 │ 芯片 │ │ │ │ │ │ │ +├──────┼────────┼──────┼──────┼──────────┼──────────┼──────────┼──────────┤ +│ SHELL │ 外壳 │ │ 套 │ 100 │ 80 │ 20 │ 部分领料 │ +│ -01 │ │ │ │ │ │ │ │ +└──────┴────────┴──────┴──────┴──────────┴──────────┴──────────┴──────────┘ +``` + + +### 六、为什么做这个页面,有没有必要 + +**有必要,它不是报表,是WMS的核心约束机制,也是甲方唯一能查“这工单还剩多少料没领”的地方。** + +1. **防止超发**:约束逻辑(累计出库≤需求总量)必须有一个可见的展示载体;光靠后端拦截,甲方会投诉“为什么出不了库,也看不到原因”。这个页面是约束逻辑的可视化出口。 +2. **仓管操作依据**:仓管今天出多少,要看“累计已出库”和“剩余缺口”决定能不能出、出多少。没这个页面,仓管就无法判断。 +3. **拉通MES和WMS**:工单创建后,MES BOM自动生成台账是“工单驱动”模式的关键;没台账,MES和WMS还是割裂的。 +4. **订单完工判断**:“所有物料状态 = 领料完结”是完工的前置条件之一。页面一眼看出哪个料还没领完,不需要查多个页面。 -整体建议: -菜单,能不能,分分类。包括 wms,先优化,后分类。 仅思考,判定是否合适,给方案。 +## 包装绑定(箱号 ↔ SN)—— 页面设计说明 + +### 一、这个页面是什么 + +**把成品/精密件的序列号(SN)装进一个箱号里,形成可追溯的包装箱。** 用于发货、入库、整箱追溯。 + + +### 二、数据链路 + +**拣选出待包装的SN → 扫码绑到同一个箱号下 → 一个箱号关联多个SN → 后续按箱号出库/发货/追溯。** + + +### 三、字段说明 + +| 字段 | 来源 | 谁填 | 说明 | +|------|------|------|------| +| 箱号 | 扫码枪/手动输入 | 操作人 | 包装箱上的条码或手贴码,唯一标识一个箱子 | +| 物料 | 下拉选择(可空) | 操作人 | 箱内物料的类型(限定同一箱只装一种物料) | +| 操作人 | 登录账号 | 自动 | 绑定的操作人 | +| SN清单 | 扫码枪连续扫码 | 操作人 | 扫入一个SN回车追加一个,实时展示在清单列表里 | + + +### 四、界面示意 + +``` +┌──────────────────────────────────────────────────────────────────────┐ +│ 包装绑定 │ +│ ┌──────────────────────────────────────────────────────────────────┐ │ +│ │ 箱号 [___________________________] [扫码] │ │ +│ │ 物料 [下拉选择 ▼] (可空) │ │ +│ │ 操作人 张三 (自动) │ │ +│ │ │ │ +│ │ SN录入 [扫入SN后回车_________] [追加] │ │ +│ │ ✅ 已扫 8 件 │ │ +│ │ ┌──────────────────────────────────────────────────────────────┐ │ │ +│ │ │ 序号 │ SN码 │ 物料名称 │ 状态 │ 操作 │ │ │ +│ │ │ 1 │ SN-HLX-001 │ 汇流箱 │ 已绑 │ 移除 │ │ │ +│ │ │ 2 │ SN-HLX-002 │ 汇流箱 │ 已绑 │ 移除 │ │ │ +│ │ │ ... │ │ │ │ │ │ │ +│ │ └──────────────────────────────────────────────────────────────┘ │ +│ │ │ +│ │ [保存包装] [取消] │ +│ └──────────────────────────────────────────────────────────────────┘ │ +└──────────────────────────────────────────────────────────────────────┘ +``` + + +### 五、业务规则 + +1. **同一箱只能装同一物料**:选择物料后,SN录入只能扫该物料的SN。如果物料为空,不校验(允许混装,但以后不建议,因为出库时容易乱) +2. **SN不能重复装箱**:已绑定到其他箱号的SN,扫码时提示“SN已在箱号XXX中”,不允许重复绑定 +3. **保存时校验**:箱号不能为空,至少扫入1个SN +4. **保存后**:箱号 ↔ SN 关系写入数据库,SN状态变为“已包装”,可追溯 + + +### 六、为什么做这个页面 + +1. **发货/出库需要**:成品出库时按箱出库,而不是按SN逐个扫码。用箱号加速出库操作 +2. **追溯链闭环**:当某个产品出问题时,通过箱号反查箱内所有SN,快速定位问题批次 +3. **库存管理**:成品入库时按箱入库,WMS库存按箱号管理 +4. **甲方实际业务**:产线做完的成品要打包入库/发货,需要箱号管理(录音原文:“一个包装箱里边,我给他规定好一共十个包装箱,每个包装箱里边十台”) \ No newline at end of file