From b28a7f52e8df5889572f86a9422c62c10334f70c Mon Sep 17 00:00:00 2001
From: jiangshuai <291802688@qq.com>
Date: 星期一, 25 九月 2023 10:17:49 +0800
Subject: [PATCH] 1.修改出入库模块的新增、修改、列表,operation_details不再保存产品名称和单位,改为读取material 2.修改报废模块的新增,修改、列表,不再使用productName和unit字段

---
 models/operation_details.go |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/models/operation_details.go b/models/operation_details.go
index e79cbf8..32e8f9a 100644
--- a/models/operation_details.go
+++ b/models/operation_details.go
@@ -11,12 +11,13 @@
 	// OperationDetails 鎿嶄綔鏄庣粏琛�
 	OperationDetails struct {
 		WmsModel
-		Id          int             `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
-		OperationID int             `json:"operationId" gorm:"type:int;not null;comment:鎿嶄綔璁板綍id"`        //鎿嶄綔id
-		ProductId   string          `json:"productId" gorm:"type:varchar(191);not null;comment:浜у搧id"`   //浜у搧id
-		ProductName string          `json:"productName" gorm:"type:varchar(255);not null;comment:浜у搧鍚嶇О"` //浜у搧鍚嶇О
-		Amount      decimal.Decimal `json:"amount" gorm:"type:decimal(20,2);not null;comment:鏁伴噺"`       //鏁伴噺
-		Unit        string          `json:"unit" gorm:"type:varchar(31);comment:鍗曚綅"`
+		Id          int    `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
+		OperationID int    `json:"operationId" gorm:"type:int;not null;comment:鎿嶄綔璁板綍id"`      //鎿嶄綔id
+		ProductId   string `json:"productId" gorm:"type:varchar(191);not null;comment:浜у搧id"` //浜у搧id
+		//ProductName string          `json:"productName" gorm:"type:varchar(255);not null;comment:浜у搧鍚嶇О"` //浜у搧鍚嶇О
+		Amount decimal.Decimal `json:"amount" gorm:"type:decimal(20,2);not null;comment:鏁伴噺"` //鏁伴噺
+		//Unit        string          `json:"unit" gorm:"type:varchar(31);comment:鍗曚綅"`                    //鍗曚綅
+		Product Material `json:"product" gorm:"foreignKey:ProductId;references:ID"`
 	}
 
 	OperationDetailsSearch struct {
@@ -76,8 +77,8 @@
 func (slf *OperationDetailsSearch) build() *gorm.DB {
 	var db = slf.Orm.Model(&OperationDetails{})
 
-	if slf.ID != 0 {
-		db = db.Where("id = ?", slf.ID)
+	if slf.Id != 0 {
+		db = db.Where("id = ?", slf.Id)
 	}
 
 	if slf.Order != "" {

--
Gitblit v1.8.0