From 9313a14c7c08d4dcf73e2f975537aba6a24479b0 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期三, 27 十二月 2023 18:04:09 +0800 Subject: [PATCH] 虚拟物料无库存,不进行出入库 --- models/operation.go | 27 ++++++++++++++++++++++++++- 1 files changed, 26 insertions(+), 1 deletions(-) diff --git a/models/operation.go b/models/operation.go index 7a62987..2009733 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,9 +28,20 @@ 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"` //鐗╂祦閲嶉噺 + Source string `json:"source" gorm:"type:varchar(255);comment:鏉ユ簮绯荤粺,鐢ㄤ簬杩斿洖淇敼鐘舵��"` Details []*OperationDetails `json:"details" gorm:"foreignKey:OperationID;references:Id"` BaseOperationType constvar.BaseOperationType `json:"baseOperationType" gorm:"type:tinyint;not null;comment:鍩虹浣滀笟绫诲瀷"` //鍩虹浣滀笟绫诲瀷 + + AuditDate string `json:"auditDate" gorm:"type:varchar(31);comment:瀹℃壒鏃堕棿"` + ReceiverName string `json:"receiverName" gorm:"type:varchar(31);comment:鏀惰揣浜哄鍚�"` + ReceiverPhone string `json:"receiverPhone" gorm:"type:varchar(31);comment:鑱旂郴鐢佃瘽"` + ReceiverAddr string `json:"receiverAddr" gorm:"type:varchar(255);comment:鏀惰揣鍦板潃"` } OperationSearch struct { @@ -42,6 +54,7 @@ Preload bool Disuse bool Ids []int + Numbers []string } ) @@ -145,7 +158,7 @@ } 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("LogisticCompany").Preload("FromLocation").Preload("ToLocation") } if slf.Disuse { @@ -324,3 +337,15 @@ return records, nil } + +func (slf *OperationSearch) MaxAutoIncr() (int, error) { + var ( + db = slf.build() + total int64 + ) + + if err := db.Count(&total).Error; err != nil { + return int(total), fmt.Errorf("max err: %v", err) + } + return int(total), nil +} -- Gitblit v1.8.0