From 6dec2342316aecf4084c8f4efb43f33fbb72892f Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期二, 09 四月 2024 14:07:43 +0800
Subject: [PATCH] 更新计量单位字典
---
models/operation.go | 73 +++++++++++++++++++++++++-----------
1 files changed, 51 insertions(+), 22 deletions(-)
diff --git a/models/operation.go b/models/operation.go
index a04df18..bd56ea2 100644
--- a/models/operation.go
+++ b/models/operation.go
@@ -14,7 +14,7 @@
WmsModel
Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
Number string `json:"number" gorm:"type:varchar(255)"` //鍗曞彿
- SourceNumber string `json:"sourceNumber" gorm:"type:varchar(255)"` //婧愬崟鍙�
+ SourceNumber string `json:"sourceNumber" gorm:"index;type:varchar(255)"` //婧愬崟鍙�
OperationTypeId int `json:"operationTypeId" gorm:"type:int;not null;comment:浣滀笟绫诲瀷id"` //浣滀笟绫诲瀷id
OperationTypeName string `json:"operationTypeName" gorm:"type:varchar(127);comment:浣滀笟绫诲瀷鍚嶇О"` //浣滀笟绫诲瀷鍚嶇О
Status constvar.OperationStatus `json:"status" gorm:"type:int(11);not null;comment:鐘舵��"` //鐘舵��
@@ -22,18 +22,19 @@
//FromLocation Location `json:"fromLocation" gorm:"foreignKey:FromLocationID;references:Id"` //婧愪綅缃�
//ToLocationID int `json:"toLocationId" gorm:"type:int;not null;comment:鐩爣浣嶇疆id"` //鐩爣浣嶇疆id
//ToLocation Location `json:"toLocation" gorm:"foreignKey:ToLocationID;references:Id"` //鐩爣浣嶇疆
- OperationDate string `json:"operationDate" gorm:"type:varchar(31);comment:瀹夋帓鏃ユ湡"`
- ContacterID int `json:"contacterID" gorm:"type:int;comment:鑱旂郴浜篒D"`
- ContacterName string `json:"contacterName" gorm:"type:varchar(63);comment:鑱旂郴浜哄鍚�"`
- 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:鏉ユ簮绯荤粺,鐢ㄤ簬杩斿洖淇敼鐘舵��"`
+ OperationDate string `json:"operationDate" gorm:"type:varchar(31);comment:瀹夋帓鏃ユ湡"`
+ ContacterID int `json:"contacterID" gorm:"type:int;comment:鑱旂郴浜篒D"`
+ ContacterName string `json:"contacterName" gorm:"type:varchar(63);comment:鑱旂郴浜哄鍚�"`
+ 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:鏉ユ簮绯荤粺,鐢ㄤ簬杩斿洖淇敼鐘舵��"`
+ OperationSource constvar.OperationSource `json:"operationSource" gorm:"type:tinyint(3);not null;default:0;comment:鎿嶄綔鏉ユ簮"` //鎿嶄綔鏉ユ簮
Details []*OperationDetails `json:"details" gorm:"foreignKey:OperationID;references:Id"`
BaseOperationType constvar.BaseOperationType `json:"baseOperationType" gorm:"type:tinyint;not null;comment:鍩虹浣滀笟绫诲瀷"` //鍩虹浣滀笟绫诲瀷
@@ -52,15 +53,16 @@
OperationSearch struct {
Operation
- Order string
- PageNum int
- PageSize int
- Keyword string
- Orm *gorm.DB
- Preload bool
- Disuse bool
- Ids []int
- Numbers []string
+ Order string
+ PageNum int
+ PageSize int
+ Keyword string
+ Orm *gorm.DB
+ Preload bool
+ Disuse bool
+ Ids []int
+ SourceNumbers []string
+ SalesDetailsNumbers []string
}
)
@@ -117,6 +119,11 @@
return slf
}
+func (slf *OperationSearch) SetSourceNumbers(numbers []string) *OperationSearch {
+ slf.SourceNumbers = numbers
+ return slf
+}
+
func (slf *OperationSearch) SetDisuse(disuse bool) *OperationSearch {
slf.Disuse = disuse
return slf
@@ -142,6 +149,16 @@
return slf
}
+func (slf *OperationSearch) SetSalesDetailsNumbers(salesDetailsNumbers []string) *OperationSearch {
+ slf.SalesDetailsNumbers = salesDetailsNumbers
+ return slf
+}
+
+func (slf *OperationSearch) SetOperationSource(operationSource constvar.OperationSource) *OperationSearch {
+ slf.OperationSource = operationSource
+ return slf
+}
+
func (slf *OperationSearch) build() *gorm.DB {
var db = slf.Orm.Model(&Operation{})
@@ -158,6 +175,10 @@
if slf.SourceNumber != "" {
db = db.Where("source_number = ?", slf.SourceNumber)
+ }
+
+ if len(slf.SourceNumbers) > 0 {
+ db = db.Where("source_number in (?)", slf.SourceNumbers)
}
if slf.Number != "" {
@@ -192,6 +213,14 @@
db = db.Where("sales_details_number = ?", slf.SalesDetailsNumber)
}
+ if len(slf.SalesDetailsNumbers) > 0 {
+ db = db.Where("sales_details_number in (?)", slf.SalesDetailsNumbers)
+ }
+
+ if slf.OperationSource != 0 {
+ db = db.Where("operation_source = ?", slf.OperationSource)
+ }
+
return db
}
--
Gitblit v1.8.0