From 942642be1995671d65b013e559376ac0bde4e8b9 Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期二, 16 四月 2024 16:26:55 +0800
Subject: [PATCH] 产品添加字段

---
 models/material.go                     |   20 +++++++++++++-------
 request/operation.go                   |    6 ++++--
 models/operation_details.go            |   10 ++++++----
 controllers/location_product_amount.go |    1 +
 4 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/controllers/location_product_amount.go b/controllers/location_product_amount.go
index 62558e7..4b65a15 100644
--- a/controllers/location_product_amount.go
+++ b/controllers/location_product_amount.go
@@ -167,6 +167,7 @@
 		Comment:           "搴撳瓨鐩樼偣",
 		BaseOperationType: constvar.BaseOperationTypeAdjust,
 		Details:           []*models.OperationDetails{detail},
+		LocationID:        location.Id,
 	}
 
 	if err := models.WithTransaction(func(tx *gorm.DB) error {
diff --git a/models/material.go b/models/material.go
index 3db5575..0cb7165 100644
--- a/models/material.go
+++ b/models/material.go
@@ -71,13 +71,19 @@
 		//HSCode                  string                     `gorm:"type:varchar(255);comment:HS缂栫爜" json:"HSCode"`                    //HS缂栫爜
 		//OriginCountryId         int                        `gorm:"type:int(11);comment:鍘熶骇鍦癷d" json:"originCountryId"`               //鍘熶骇鍦癷d
 		//OriginCountryName       string                     `gorm:"type:varchar(255);comment:鍘熶骇鍦板悕绉�" json:"originCountryName"`        //鍘熶骇鍦板悕绉�
-		InStorageExplain        string        `gorm:"type:varchar(512);comment:鍏ュ簱璇存槑" json:"inStorageExplain"`          //鍏ュ簱璇存槑
-		OutStorageExplain       string        `gorm:"type:varchar(512);comment:鍑哄簱璇存槑" json:"outStorageExplain"`         //鍑哄簱璇存槑
-		InternalTransferExplain string        `gorm:"type:varchar(512);comment:鍐呴儴璋冩嫧璇存槑" json:"internalTransferExplain"` //鍐呴儴璋冩嫧璇存槑
-		AttachmentList          []*Attachment `json:"attachmentList" gorm:"many2many:material_attachment"`
-		IsStorage               int           `gorm:"type:tinyint(1);default:1;comment:鏄惁瀛樺簱(1鏄�2鍚�)" json:"isStorage"`   //鏃犲簱瀛樼殑鍦╳ms浠ュ強srm涓渶瑕佽繃婊ゆ帀
-		IsVirtual               int           `json:"isVirtual" gorm:"type:tinyint(1);default:2;comment:鏄惁铏氭嫙鐗╂枡(1鏄�2鍚�)"` //铏氭嫙鐗╂枡鍦∕RP璁$畻鏃惰烦杩囪灞傜骇鐩存帴棰嗙敤涓嬬骇鐗╂枡锛岃櫄鎷熺墿鏂欎笉鐢熸垚宸ュ崟
-		ReorderRuleNum          int64         `json:"reorderRuleNum"`
+		InStorageExplain        string          `gorm:"type:varchar(512);comment:鍏ュ簱璇存槑" json:"inStorageExplain"`          //鍏ュ簱璇存槑
+		OutStorageExplain       string          `gorm:"type:varchar(512);comment:鍑哄簱璇存槑" json:"outStorageExplain"`         //鍑哄簱璇存槑
+		InternalTransferExplain string          `gorm:"type:varchar(512);comment:鍐呴儴璋冩嫧璇存槑" json:"internalTransferExplain"` //鍐呴儴璋冩嫧璇存槑
+		AttachmentList          []*Attachment   `json:"attachmentList" gorm:"many2many:material_attachment"`
+		IsStorage               int             `gorm:"type:tinyint(1);default:1;comment:鏄惁瀛樺簱(1鏄�2鍚�)" json:"isStorage"`   //鏃犲簱瀛樼殑鍦╳ms浠ュ強srm涓渶瑕佽繃婊ゆ帀
+		IsVirtual               int             `json:"isVirtual" gorm:"type:tinyint(1);default:2;comment:鏄惁铏氭嫙鐗╂枡(1鏄�2鍚�)"` //铏氭嫙鐗╂枡鍦∕RP璁$畻鏃惰烦杩囪灞傜骇鐩存帴棰嗙敤涓嬬骇鐗╂枡锛岃櫄鎷熺墿鏂欎笉鐢熸垚宸ュ崟
+		ReorderRuleNum          int64           `json:"reorderRuleNum"`
+		MoreUnit                bool            `json:"moreUnit" gorm:"type:tinyint(1);default:false;comment:鍚姩澶氬崟浣�"`
+		MoreUnitValue           string          `json:"moreUnitValue" gorm:"type:varchar(255);comment:澶氬崟浣嶅��"`
+		GrossWeight             decimal.Decimal `json:"grossWeight" gorm:"type:decimal(20,3);comment:姣涢噸"`
+		NetWeight               decimal.Decimal `json:"netWeight" gorm:"type:decimal(20,3);comment:鍑�閲�"`
+		GrossUnit               string          `json:"grossUnit" gorm:"type:varchar(255);comment:姣涢噸鍗曚綅"`
+		NetUnit                 string          `json:"netUnit" gorm:"type:varchar(255);comment:鍑�閲嶅崟浣�"`
 
 		//浠ヤ笅涓轰笉瀛樺簱鐨勫瓧娈�
 		AttachmentIDs    []uint          `json:"attachmentIDs" gorm:"-"`
diff --git a/models/operation_details.go b/models/operation_details.go
index 0434ac9..13b8463 100644
--- a/models/operation_details.go
+++ b/models/operation_details.go
@@ -19,10 +19,12 @@
 		//Unit        string          `json:"unit" gorm:"type:varchar(31);comment:鍗曚綅"`                    //鍗曚綅
 		Product Material `json:"product" gorm:"foreignKey:ProductId;references:ID"`
 
-		FromLocationID int      `json:"fromLocationId"   gorm:"type:int;not null;comment:婧愪綅缃甶d"`         //婧愪綅缃甶d
-		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"`    //鐩爣浣嶇疆
+		FromLocationID   int             `json:"fromLocationId"   gorm:"type:int;not null;comment:婧愪綅缃甶d"`         //婧愪綅缃甶d
+		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"`    //鐩爣浣嶇疆
+		TotalGrossWeight decimal.Decimal `json:"totalGrossWeight" gorm:"type:decimal(20,3);comment:鎬绘瘺閲�"`
+		TotalNetWeight   decimal.Decimal `json:"totalNetWeight" gorm:"type:decimal(20,3);comment:鎬诲噣閲�"`
 	}
 
 	OperationDetailsSearch struct {
diff --git a/request/operation.go b/request/operation.go
index 2724441..d7ddc4c 100644
--- a/request/operation.go
+++ b/request/operation.go
@@ -45,8 +45,10 @@
 	Amount decimal.Decimal `json:"amount" gorm:"type:decimal(20,2);not null;comment:鏁伴噺"` //鏁伴噺
 	//Unit        string          `json:"unit" gorm:"type:varchar(31);comment:鍗曚綅"`                    //鍗曚綅
 	//Product models.Material `json:"product" gorm:"foreignKey:ProductId;references:ID"`
-	FromLocationId int `json:"fromLocationId"   gorm:"type:int;not null;comment:婧愪綅缃甶d"` //婧愪綅缃甶d
-	ToLocationId   int `json:"toLocationId"    gorm:"type:int;not null;comment:鐩爣浣嶇疆id"` //鐩爣浣嶇疆id
+	FromLocationId   int             `json:"fromLocationId"   gorm:"type:int;not null;comment:婧愪綅缃甶d"` //婧愪綅缃甶d
+	ToLocationId     int             `json:"toLocationId"    gorm:"type:int;not null;comment:鐩爣浣嶇疆id"` //鐩爣浣嶇疆id
+	TotalGrossWeight decimal.Decimal `json:"totalGrossWeight" gorm:"type:decimal(20,3);comment:鎬绘瘺閲�"`  //鎬绘瘺閲�
+	TotalNetWeight   decimal.Decimal `json:"totalNetWeight" gorm:"type:decimal(20,3);comment:鎬诲噣閲�"`    //鎬诲噣閲�
 }
 
 type OperationList struct {

--
Gitblit v1.8.0