From 647fd6d88e3e7d4809fecd5b88f3a0f537bc2623 Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期二, 16 四月 2024 17:25:39 +0800
Subject: [PATCH] 产品修改字段

---
 controllers/operation.go |    4 ++++
 conf/config.go           |   17 +++++++++--------
 models/material.go       |   25 ++++++++++++++++++++++++-
 conf/config.yaml         |    2 ++
 4 files changed, 39 insertions(+), 9 deletions(-)

diff --git a/conf/config.go b/conf/config.go
index acb3589..c521566 100644
--- a/conf/config.go
+++ b/conf/config.go
@@ -23,14 +23,15 @@
 
 type (
 	webConf struct {
-		Host       string // 鏈満ip鍦板潃
-		Port       string // 绔彛鍙�
-		NodeId     string // 涓昏处鎴风敤鎴峰悕
-		OssType    string // 瀵硅薄瀛樺偍绫诲瀷
-		JWTSecret  string
-		FileServer string //鏂囦欢鏈嶅姟鍣ㄥ湴鍧�
-		ServerId   string //鏈嶅姟ID
-		GrpcPort   string //grpc绔彛鍙�
+		Host        string // 鏈満ip鍦板潃
+		Port        string // 绔彛鍙�
+		NodeId      string // 涓昏处鎴风敤鎴峰悕
+		OssType     string // 瀵硅薄瀛樺偍绫诲瀷
+		JWTSecret   string
+		FileServer  string //鏂囦欢鏈嶅姟鍣ㄥ湴鍧�
+		ServerId    string //鏈嶅姟ID
+		GrpcPort    string //grpc绔彛鍙�
+		CompanyName string //鍏徃鍚�
 	}
 
 	localConf struct {
diff --git a/conf/config.yaml b/conf/config.yaml
index 2985275..3ae36d8 100644
--- a/conf/config.yaml
+++ b/conf/config.yaml
@@ -7,6 +7,8 @@
   #  fileServer: http://172.20.11.127:9333
   fileServer: http://192.168.20.189:6333
   serverId: wms
+  # 閫氳繃鍏徃鍚嶇О鍖哄垎鍑哄叆搴撴槑缁嗘墦鍗版ā鐗�,鐩墠鏀寔:geruimi,jialian
+  companyName: jialian
 db:
   #  dsn: root:c++java123@tcp(192.168.20.119:3306)/wms?charset=utf8&parseTime=True&loc=Local
   dsn: root:c++java123@tcp(192.168.20.119:3306)/aps_server2?charset=utf8&parseTime=True&loc=Local
diff --git a/controllers/operation.go b/controllers/operation.go
index 406d78c..b9c4058 100644
--- a/controllers/operation.go
+++ b/controllers/operation.go
@@ -890,6 +890,10 @@
 	util.ResponseFormat(c, code.Success, fileUrl)
 }
 
+func JialianInputOperation() {
+
+}
+
 func ExportInputSelfmade(category constvar.FileTemplateCategory, operation *models.Operation) (string, error) {
 	template, err := models.NewFileTemplateAttachmentSearch().SetCategory(category).First()
 	if err != nil {
diff --git a/models/material.go b/models/material.go
index 0cb7165..5c03da9 100644
--- a/models/material.go
+++ b/models/material.go
@@ -1,6 +1,7 @@
 package models
 
 import (
+	"encoding/json"
 	"fmt"
 	"github.com/shopspring/decimal"
 	"github.com/spf13/cast"
@@ -79,7 +80,8 @@
 		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:澶氬崟浣嶅��"`
+		MoreUnitList            []UnitItems     `json:"moreUnitList" gorm:"-"`
+		MoreUnitValue           string          `json:"-" 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:姣涢噸鍗曚綅"`
@@ -113,6 +115,12 @@
 		Id   string `json:"id"`
 		Name string `json:"name"`
 	}
+
+	UnitItems struct {
+		Amount   decimal.Decimal `json:"amount"`
+		Unit     string          `json:"unit"`
+		Floating bool            `json:"floating"`
+	}
 )
 
 func (slf Material) TableName() string {
@@ -127,6 +135,14 @@
 		}
 	} else if slf.PurchaseType != 0 { //鍏煎鏃ф暟鎹�
 		slf.PurchaseTypeList = append(slf.PurchaseTypeList, int(slf.PurchaseType))
+	}
+	if slf.MoreUnitValue != "" {
+		var arr []UnitItems
+		err := json.Unmarshal([]byte(slf.MoreUnitValue), &arr)
+		if err != nil {
+			return err
+		}
+		slf.MoreUnitList = arr
 	}
 	return
 }
@@ -144,6 +160,13 @@
 			slf.PurchaseType = constvar.PurchaseType(slf.PurchaseTypeList[0])
 		}
 	}
+	if len(slf.MoreUnitList) != 0 {
+		str, err := json.Marshal(slf.MoreUnitList)
+		if err != nil {
+			return err
+		}
+		slf.MoreUnitValue = string(str)
+	}
 	return
 }
 

--
Gitblit v1.8.0