From 07079a17b93d1dc2f06d73a5a08f6ba63a87d9a3 Mon Sep 17 00:00:00 2001 From: liujiandao <274878379@qq.com> Date: 星期五, 10 十一月 2023 10:51:32 +0800 Subject: [PATCH] 出入库操作添加物流信息 --- models/operation.go | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/models/operation.go b/models/operation.go index 7a62987..a06bdda 100644 --- a/models/operation.go +++ b/models/operation.go @@ -2,6 +2,7 @@ import ( "fmt" + "github.com/shopspring/decimal" "gorm.io/gorm" "wms/constvar" "wms/pkg/mysqlx" @@ -27,6 +28,11 @@ CompanyID int `json:"companyID" gorm:"type:int;comment:鍏徃ID-瀹㈡埛"` CompanyName string `json:"companyName" gorm:"type:varchar(127);comment:鍏徃鍚嶇О-瀹㈡埛"` Comment string `json:"comment" gorm:"type:text;comment:澶囨敞"` + LogisticCompanyId string `json:"logisticCompanyId" gorm:"type:varchar(191);comment:鐗╂祦鍏徃id"` + LogisticCompany LogisticCompany `json:"logisticCompany" gorm:"foreignKey:LogisticCompanyId"` + WaybillNumber string `json:"waybillNumber" gorm:"type:varchar(255);comment:杩愬崟鍙�"` //杩愬崟鍙� + Weight decimal.Decimal `gorm:"type:decimal(20,2);comment:閲嶉噺" json:"weight"` //閲嶉噺 + LogisticWeight decimal.Decimal `gorm:"type:decimal(20,2);comment:鐗╂祦閲嶉噺" json:"logisticWeight"` //鐗╂祦閲嶉噺 Details []*OperationDetails `json:"details" gorm:"foreignKey:OperationID;references:Id"` BaseOperationType constvar.BaseOperationType `json:"baseOperationType" gorm:"type:tinyint;not null;comment:鍩虹浣滀笟绫诲瀷"` //鍩虹浣滀笟绫诲瀷 @@ -145,7 +151,8 @@ } if slf.Preload { - db = db.Model(&Operation{}).Preload("Details").Preload("Details.Product").Preload("FromLocation").Preload("ToLocation") + db = db.Model(&Operation{}).Preload("Details").Preload("Details.Product").Preload("FromLocation"). + Preload("ToLocation").Preload("LogisticCompany") } if slf.Disuse { -- Gitblit v1.8.0