feat(mes): 添加定时同步可生产数量到WMS及BOM项相关标准字段
- 在main.go中添加定时任务每10分钟同步可生产数量到WMS系统 - 为BomItem实体添加relatedStandard字段及相关CRUD方法 - 为InspectionRecord实体添加reportNo、materialCode、materialName等字段 - 更新ent schema确保新字段的验证和默认值设置 - 添加必要的数据库迁移和字段映射逻辑
This commit is contained in:
+55
-29
@@ -13,10 +13,12 @@ import (
|
||||
"bj_power_wms/ent/inventory"
|
||||
"bj_power_wms/ent/inventorylock"
|
||||
"bj_power_wms/ent/material"
|
||||
"bj_power_wms/ent/materialdemand"
|
||||
"bj_power_wms/ent/ordermaterialledger"
|
||||
"bj_power_wms/ent/outbounddetail"
|
||||
"bj_power_wms/ent/outboundorder"
|
||||
"bj_power_wms/ent/permission"
|
||||
"bj_power_wms/ent/produciblesnapshot"
|
||||
"bj_power_wms/ent/returnorder"
|
||||
"bj_power_wms/ent/role"
|
||||
"bj_power_wms/ent/semifinished"
|
||||
@@ -202,45 +204,45 @@ func init() {
|
||||
// inboundorder.DefaultManageMode holds the default value on creation for the manage_mode field.
|
||||
inboundorder.DefaultManageMode = inboundorderDescManageMode.Default.(int)
|
||||
// inboundorderDescQuantity is the schema descriptor for quantity field.
|
||||
inboundorderDescQuantity := inboundorderFields[7].Descriptor()
|
||||
inboundorderDescQuantity := inboundorderFields[10].Descriptor()
|
||||
// inboundorder.DefaultQuantity holds the default value on creation for the quantity field.
|
||||
inboundorder.DefaultQuantity = inboundorderDescQuantity.Default.(int)
|
||||
// inboundorderDescOwnershipType is the schema descriptor for ownership_type field.
|
||||
inboundorderDescOwnershipType := inboundorderFields[11].Descriptor()
|
||||
inboundorderDescOwnershipType := inboundorderFields[14].Descriptor()
|
||||
// inboundorder.DefaultOwnershipType holds the default value on creation for the ownership_type field.
|
||||
inboundorder.DefaultOwnershipType = inboundorderDescOwnershipType.Default.(string)
|
||||
// inboundorderDescCreatedAt is the schema descriptor for created_at field.
|
||||
inboundorderDescCreatedAt := inboundorderFields[13].Descriptor()
|
||||
inboundorderDescCreatedAt := inboundorderFields[17].Descriptor()
|
||||
// inboundorder.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||||
inboundorder.DefaultCreatedAt = inboundorderDescCreatedAt.Default.(func() int64)
|
||||
inspectionrecordFields := schema.InspectionRecord{}.Fields()
|
||||
_ = inspectionrecordFields
|
||||
// inspectionrecordDescInspectionType is the schema descriptor for inspection_type field.
|
||||
inspectionrecordDescInspectionType := inspectionrecordFields[3].Descriptor()
|
||||
inspectionrecordDescInspectionType := inspectionrecordFields[8].Descriptor()
|
||||
// inspectionrecord.DefaultInspectionType holds the default value on creation for the inspection_type field.
|
||||
inspectionrecord.DefaultInspectionType = inspectionrecordDescInspectionType.Default.(string)
|
||||
// inspectionrecordDescStatus is the schema descriptor for status field.
|
||||
inspectionrecordDescStatus := inspectionrecordFields[4].Descriptor()
|
||||
inspectionrecordDescStatus := inspectionrecordFields[9].Descriptor()
|
||||
// inspectionrecord.DefaultStatus holds the default value on creation for the status field.
|
||||
inspectionrecord.DefaultStatus = inspectionrecordDescStatus.Default.(string)
|
||||
// inspectionrecordDescInspectQty is the schema descriptor for inspect_qty field.
|
||||
inspectionrecordDescInspectQty := inspectionrecordFields[6].Descriptor()
|
||||
inspectionrecordDescInspectQty := inspectionrecordFields[11].Descriptor()
|
||||
// inspectionrecord.DefaultInspectQty holds the default value on creation for the inspect_qty field.
|
||||
inspectionrecord.DefaultInspectQty = inspectionrecordDescInspectQty.Default.(int)
|
||||
// inspectionrecordDescPassQty is the schema descriptor for pass_qty field.
|
||||
inspectionrecordDescPassQty := inspectionrecordFields[7].Descriptor()
|
||||
inspectionrecordDescPassQty := inspectionrecordFields[12].Descriptor()
|
||||
// inspectionrecord.DefaultPassQty holds the default value on creation for the pass_qty field.
|
||||
inspectionrecord.DefaultPassQty = inspectionrecordDescPassQty.Default.(int)
|
||||
// inspectionrecordDescDisposalType is the schema descriptor for disposal_type field.
|
||||
inspectionrecordDescDisposalType := inspectionrecordFields[12].Descriptor()
|
||||
inspectionrecordDescDisposalType := inspectionrecordFields[17].Descriptor()
|
||||
// inspectionrecord.DefaultDisposalType holds the default value on creation for the disposal_type field.
|
||||
inspectionrecord.DefaultDisposalType = inspectionrecordDescDisposalType.Default.(string)
|
||||
// inspectionrecordDescCreatedAt is the schema descriptor for created_at field.
|
||||
inspectionrecordDescCreatedAt := inspectionrecordFields[16].Descriptor()
|
||||
inspectionrecordDescCreatedAt := inspectionrecordFields[21].Descriptor()
|
||||
// inspectionrecord.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||||
inspectionrecord.DefaultCreatedAt = inspectionrecordDescCreatedAt.Default.(func() int64)
|
||||
// inspectionrecordDescUpdatedAt is the schema descriptor for updated_at field.
|
||||
inspectionrecordDescUpdatedAt := inspectionrecordFields[17].Descriptor()
|
||||
inspectionrecordDescUpdatedAt := inspectionrecordFields[22].Descriptor()
|
||||
// inspectionrecord.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
||||
inspectionrecord.DefaultUpdatedAt = inspectionrecordDescUpdatedAt.Default.(func() int64)
|
||||
inventoryFields := schema.Inventory{}.Fields()
|
||||
@@ -262,27 +264,27 @@ func init() {
|
||||
// inventory.DefaultQualityStatus holds the default value on creation for the quality_status field.
|
||||
inventory.DefaultQualityStatus = inventoryDescQualityStatus.Default.(string)
|
||||
// inventoryDescStatus is the schema descriptor for status field.
|
||||
inventoryDescStatus := inventoryFields[10].Descriptor()
|
||||
inventoryDescStatus := inventoryFields[13].Descriptor()
|
||||
// inventory.DefaultStatus holds the default value on creation for the status field.
|
||||
inventory.DefaultStatus = inventoryDescStatus.Default.(string)
|
||||
// inventoryDescOrderNo is the schema descriptor for order_no field.
|
||||
inventoryDescOrderNo := inventoryFields[14].Descriptor()
|
||||
inventoryDescOrderNo := inventoryFields[17].Descriptor()
|
||||
// inventory.DefaultOrderNo holds the default value on creation for the order_no field.
|
||||
inventory.DefaultOrderNo = inventoryDescOrderNo.Default.(string)
|
||||
// inventory.OrderNoValidator is a validator for the "order_no" field. It is called by the builders before save.
|
||||
inventory.OrderNoValidator = inventoryDescOrderNo.Validators[0].(func(string) error)
|
||||
// inventoryDescCompletedProcess is the schema descriptor for completed_process field.
|
||||
inventoryDescCompletedProcess := inventoryFields[15].Descriptor()
|
||||
inventoryDescCompletedProcess := inventoryFields[18].Descriptor()
|
||||
// inventory.DefaultCompletedProcess holds the default value on creation for the completed_process field.
|
||||
inventory.DefaultCompletedProcess = inventoryDescCompletedProcess.Default.(string)
|
||||
// inventory.CompletedProcessValidator is a validator for the "completed_process" field. It is called by the builders before save.
|
||||
inventory.CompletedProcessValidator = inventoryDescCompletedProcess.Validators[0].(func(string) error)
|
||||
// inventoryDescCreatedAt is the schema descriptor for created_at field.
|
||||
inventoryDescCreatedAt := inventoryFields[17].Descriptor()
|
||||
inventoryDescCreatedAt := inventoryFields[28].Descriptor()
|
||||
// inventory.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||||
inventory.DefaultCreatedAt = inventoryDescCreatedAt.Default.(func() int64)
|
||||
// inventoryDescUpdatedAt is the schema descriptor for updated_at field.
|
||||
inventoryDescUpdatedAt := inventoryFields[18].Descriptor()
|
||||
inventoryDescUpdatedAt := inventoryFields[29].Descriptor()
|
||||
// inventory.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
||||
inventory.DefaultUpdatedAt = inventoryDescUpdatedAt.Default.(func() int64)
|
||||
inventorylockFields := schema.InventoryLock{}.Fields()
|
||||
@@ -322,21 +324,31 @@ func init() {
|
||||
// material.DefaultIsSerialManaged holds the default value on creation for the is_serial_managed field.
|
||||
material.DefaultIsSerialManaged = materialDescIsSerialManaged.Default.(bool)
|
||||
// materialDescSafetyStock is the schema descriptor for safety_stock field.
|
||||
materialDescSafetyStock := materialFields[12].Descriptor()
|
||||
materialDescSafetyStock := materialFields[11].Descriptor()
|
||||
// material.DefaultSafetyStock holds the default value on creation for the safety_stock field.
|
||||
material.DefaultSafetyStock = materialDescSafetyStock.Default.(int)
|
||||
// materialDescIsActive is the schema descriptor for is_active field.
|
||||
materialDescIsActive := materialFields[13].Descriptor()
|
||||
materialDescIsActive := materialFields[12].Descriptor()
|
||||
// material.DefaultIsActive holds the default value on creation for the is_active field.
|
||||
material.DefaultIsActive = materialDescIsActive.Default.(bool)
|
||||
// materialDescCreatedAt is the schema descriptor for created_at field.
|
||||
materialDescCreatedAt := materialFields[14].Descriptor()
|
||||
materialDescCreatedAt := materialFields[13].Descriptor()
|
||||
// material.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||||
material.DefaultCreatedAt = materialDescCreatedAt.Default.(func() int64)
|
||||
// materialDescUpdatedAt is the schema descriptor for updated_at field.
|
||||
materialDescUpdatedAt := materialFields[15].Descriptor()
|
||||
materialDescUpdatedAt := materialFields[14].Descriptor()
|
||||
// material.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
||||
material.DefaultUpdatedAt = materialDescUpdatedAt.Default.(func() int64)
|
||||
materialdemandFields := schema.MaterialDemand{}.Fields()
|
||||
_ = materialdemandFields
|
||||
// materialdemandDescFuture5Qty is the schema descriptor for future5_qty field.
|
||||
materialdemandDescFuture5Qty := materialdemandFields[1].Descriptor()
|
||||
// materialdemand.DefaultFuture5Qty holds the default value on creation for the future5_qty field.
|
||||
materialdemand.DefaultFuture5Qty = materialdemandDescFuture5Qty.Default.(int)
|
||||
// materialdemandDescUpdatedAt is the schema descriptor for updated_at field.
|
||||
materialdemandDescUpdatedAt := materialdemandFields[2].Descriptor()
|
||||
// materialdemand.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
||||
materialdemand.DefaultUpdatedAt = materialdemandDescUpdatedAt.Default.(func() int64)
|
||||
ordermaterialledgerFields := schema.OrderMaterialLedger{}.Fields()
|
||||
_ = ordermaterialledgerFields
|
||||
// ordermaterialledgerDescTotalQty is the schema descriptor for total_qty field.
|
||||
@@ -352,11 +364,11 @@ func init() {
|
||||
// ordermaterialledger.DefaultStatus holds the default value on creation for the status field.
|
||||
ordermaterialledger.DefaultStatus = ordermaterialledgerDescStatus.Default.(string)
|
||||
// ordermaterialledgerDescCreatedAt is the schema descriptor for created_at field.
|
||||
ordermaterialledgerDescCreatedAt := ordermaterialledgerFields[8].Descriptor()
|
||||
ordermaterialledgerDescCreatedAt := ordermaterialledgerFields[9].Descriptor()
|
||||
// ordermaterialledger.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||||
ordermaterialledger.DefaultCreatedAt = ordermaterialledgerDescCreatedAt.Default.(func() int64)
|
||||
// ordermaterialledgerDescUpdatedAt is the schema descriptor for updated_at field.
|
||||
ordermaterialledgerDescUpdatedAt := ordermaterialledgerFields[9].Descriptor()
|
||||
ordermaterialledgerDescUpdatedAt := ordermaterialledgerFields[10].Descriptor()
|
||||
// ordermaterialledger.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
||||
ordermaterialledger.DefaultUpdatedAt = ordermaterialledgerDescUpdatedAt.Default.(func() int64)
|
||||
outbounddetailFields := schema.OutboundDetail{}.Fields()
|
||||
@@ -376,15 +388,15 @@ func init() {
|
||||
// outboundorder.DefaultOutboundType holds the default value on creation for the outbound_type field.
|
||||
outboundorder.DefaultOutboundType = outboundorderDescOutboundType.Default.(string)
|
||||
// outboundorderDescManageMode is the schema descriptor for manage_mode field.
|
||||
outboundorderDescManageMode := outboundorderFields[5].Descriptor()
|
||||
outboundorderDescManageMode := outboundorderFields[9].Descriptor()
|
||||
// outboundorder.DefaultManageMode holds the default value on creation for the manage_mode field.
|
||||
outboundorder.DefaultManageMode = outboundorderDescManageMode.Default.(int)
|
||||
// outboundorderDescQuantity is the schema descriptor for quantity field.
|
||||
outboundorderDescQuantity := outboundorderFields[8].Descriptor()
|
||||
outboundorderDescQuantity := outboundorderFields[12].Descriptor()
|
||||
// outboundorder.DefaultQuantity holds the default value on creation for the quantity field.
|
||||
outboundorder.DefaultQuantity = outboundorderDescQuantity.Default.(int)
|
||||
// outboundorderDescCreatedAt is the schema descriptor for created_at field.
|
||||
outboundorderDescCreatedAt := outboundorderFields[16].Descriptor()
|
||||
outboundorderDescCreatedAt := outboundorderFields[20].Descriptor()
|
||||
// outboundorder.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||||
outboundorder.DefaultCreatedAt = outboundorderDescCreatedAt.Default.(func() int64)
|
||||
permissionFields := schema.Permission{}.Fields()
|
||||
@@ -439,6 +451,20 @@ func init() {
|
||||
permissionDescUpdatedAt := permissionFields[9].Descriptor()
|
||||
// permission.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
||||
permission.DefaultUpdatedAt = permissionDescUpdatedAt.Default.(func() int64)
|
||||
produciblesnapshotFields := schema.ProducibleSnapshot{}.Fields()
|
||||
_ = produciblesnapshotFields
|
||||
// produciblesnapshotDescProducibleQty is the schema descriptor for producible_qty field.
|
||||
produciblesnapshotDescProducibleQty := produciblesnapshotFields[2].Descriptor()
|
||||
// produciblesnapshot.DefaultProducibleQty holds the default value on creation for the producible_qty field.
|
||||
produciblesnapshot.DefaultProducibleQty = produciblesnapshotDescProducibleQty.Default.(int)
|
||||
// produciblesnapshotDescComputedAt is the schema descriptor for computed_at field.
|
||||
produciblesnapshotDescComputedAt := produciblesnapshotFields[4].Descriptor()
|
||||
// produciblesnapshot.DefaultComputedAt holds the default value on creation for the computed_at field.
|
||||
produciblesnapshot.DefaultComputedAt = produciblesnapshotDescComputedAt.Default.(int64)
|
||||
// produciblesnapshotDescSyncedAt is the schema descriptor for synced_at field.
|
||||
produciblesnapshotDescSyncedAt := produciblesnapshotFields[5].Descriptor()
|
||||
// produciblesnapshot.DefaultSyncedAt holds the default value on creation for the synced_at field.
|
||||
produciblesnapshot.DefaultSyncedAt = produciblesnapshotDescSyncedAt.Default.(func() int64)
|
||||
returnorderFields := schema.ReturnOrder{}.Fields()
|
||||
_ = returnorderFields
|
||||
// returnorderDescSourceType is the schema descriptor for source_type field.
|
||||
@@ -534,23 +560,23 @@ func init() {
|
||||
stocktakeitemFields := schema.StocktakeItem{}.Fields()
|
||||
_ = stocktakeitemFields
|
||||
// stocktakeitemDescBookQty is the schema descriptor for book_qty field.
|
||||
stocktakeitemDescBookQty := stocktakeitemFields[5].Descriptor()
|
||||
stocktakeitemDescBookQty := stocktakeitemFields[8].Descriptor()
|
||||
// stocktakeitem.DefaultBookQty holds the default value on creation for the book_qty field.
|
||||
stocktakeitem.DefaultBookQty = stocktakeitemDescBookQty.Default.(int)
|
||||
// stocktakeitemDescScannedQty is the schema descriptor for scanned_qty field.
|
||||
stocktakeitemDescScannedQty := stocktakeitemFields[6].Descriptor()
|
||||
stocktakeitemDescScannedQty := stocktakeitemFields[9].Descriptor()
|
||||
// stocktakeitem.DefaultScannedQty holds the default value on creation for the scanned_qty field.
|
||||
stocktakeitem.DefaultScannedQty = stocktakeitemDescScannedQty.Default.(int)
|
||||
// stocktakeitemDescDiffQty is the schema descriptor for diff_qty field.
|
||||
stocktakeitemDescDiffQty := stocktakeitemFields[7].Descriptor()
|
||||
stocktakeitemDescDiffQty := stocktakeitemFields[10].Descriptor()
|
||||
// stocktakeitem.DefaultDiffQty holds the default value on creation for the diff_qty field.
|
||||
stocktakeitem.DefaultDiffQty = stocktakeitemDescDiffQty.Default.(int)
|
||||
// stocktakeitemDescCounted is the schema descriptor for counted field.
|
||||
stocktakeitemDescCounted := stocktakeitemFields[8].Descriptor()
|
||||
stocktakeitemDescCounted := stocktakeitemFields[11].Descriptor()
|
||||
// stocktakeitem.DefaultCounted holds the default value on creation for the counted field.
|
||||
stocktakeitem.DefaultCounted = stocktakeitemDescCounted.Default.(bool)
|
||||
// stocktakeitemDescUpdatedAt is the schema descriptor for updated_at field.
|
||||
stocktakeitemDescUpdatedAt := stocktakeitemFields[9].Descriptor()
|
||||
stocktakeitemDescUpdatedAt := stocktakeitemFields[12].Descriptor()
|
||||
// stocktakeitem.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
||||
stocktakeitem.DefaultUpdatedAt = stocktakeitemDescUpdatedAt.Default.(func() int64)
|
||||
stocktakeorderFields := schema.StocktakeOrder{}.Fields()
|
||||
|
||||
Reference in New Issue
Block a user