From edf6810f2ff9ac32230f58f62a753454b8e24269 Mon Sep 17 00:00:00 2001
From: zhansan <1061428287@qq.com>
Date: 星期一, 18 九月 2023 20:05:38 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/aps/WMS

---
 models/product.go |   74 ++++++++++++++++++++-----------------
 1 files changed, 40 insertions(+), 34 deletions(-)

diff --git a/models/product.go b/models/product.go
index c97e2f1..b44ddbb 100644
--- a/models/product.go
+++ b/models/product.go
@@ -2,7 +2,7 @@
 
 import (
 	"fmt"
-	"google.golang.org/genproto/googleapis/type/decimal"
+	"github.com/shopspring/decimal"
 	"gorm.io/gorm"
 	"wms/constvar"
 	"wms/pkg/mysqlx"
@@ -12,39 +12,45 @@
 	// Product 浜у搧
 	Product struct {
 		WmsModel
-		Id         int                  `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
-		Name       string               `json:"name" gorm:"index;type:varchar(255);not null;comment:浜у搧鍚嶇О"` //浜у搧鍚嶇О
-		Type       constvar.ProductType `gorm:"type:tinyint;comment:浜у搧绫诲瀷" json:"type"`                     //浜у搧绫诲瀷
-		CategoryId int                  `gorm:"type:int(11);comment:浜у搧鍒嗙被" json:"categoryId"`               //浜у搧鍒嗙被id
-		Category   string               `gorm:"type:int(11);comment:浜у搧鍒嗙被" json:"category"`                 //浜у搧鍒嗙被
-		Specs      string               `gorm:"type:varchar(191);comment:浜у搧瑙勬牸" json:"specs"`               //浜у搧瑙勬牸
-		Model      string               `gorm:"type:varchar(191);comment:浜у搧鍨嬪彿" json:"model"`               //浜у搧鍨嬪彿
-		//MinInventory      decimal.Decimal         `gorm:"type:decimal(20,2);comment:鏈�灏忓簱瀛�" json:"minInventory"` //鏈�澶у簱瀛�
-		//MaxInventory      decimal.Decimal         `gorm:"type:decimal(20,2);comment:鏈�澶у簱瀛�" json:"maxInventory"` //鏈�灏忓簱瀛�
-		//Amount            decimal.Decimal         `gorm:"type:decimal(20,2);comment:鏁伴噺" json:"amount"`
-		//LockAmount        decimal.Decimal         `gorm:"type:decimal(20,2);default:0;comment:閿佸畾鏁伴噺" json:"lockAmount"`
-		Unit         string                 `gorm:"type:varchar(100);comment:鍗曚綅" json:"unit"`           //鍗曚綅
-		PurchaseUnit string                 `gorm:"type:varchar(100);comment:閲囪喘鍗曚綅" json:"purchaseUnit"` //閲囪喘鍗曚綅
-		Note         string                 `gorm:"type:varchar(1024);comment:澶囨敞" json:"note"`
-		Status       constvar.ProductStatus `gorm:"type:int(11);comment:鐘舵��" json:"status"`
-		Purchases    []*PurchaseInfo        `gorm:"-" json:"purchases"` //閲囪喘淇℃伅
-		PurchasesStr string                 `gorm:"column:purchase;type:varchar(4096);comment:璐拱淇℃伅" json:"-"`
-
-		//PurchaseType     constvar.PurchaseType `gorm:"type:int(11);comment:閲囪喘绫诲瀷" json:"purchaseType"`            ///閲囪喘绫诲瀷
-		CanBePurchased   bool            `gorm:"type:int(11);not null;comment:鏄惁鍙噰璐�" json:"purchaseType"`           //鏄惁鍙噰璐�
-		IsSale           bool            `gorm:"type:tinyint(1);comment:鏄惁閿�鍞�" json:"isSale"`                        //鏄惁閿�鍞�
-		SalePrice        decimal.Decimal `gorm:"type:decimal(35,18);comment:閿�鍞崟浠�" json:"salePrice"`                 //閿�鍞环鏍�
-		CustomerTaxes    decimal.Decimal `gorm:"type:decimal(20,2);not null;comment:瀹㈡埛绋�" json:"customerTaxes"`      //瀹㈡埛绋庣櫨鍒嗘瘮
-		Cost             decimal.Decimal `gorm:"type:decimal(20,2);not null;comment:鎴愭湰" json:"cost"`                //鎴愭湰
-		OptionalProducts []int           `gorm:"type:varchar(255);not null;comment:鐩镐技浜у搧id" json:"optionalProducts"` //鐩歌瘑浜у搧
-		Principal        string          `gorm:"type:varchar(255);not null;comment:璐熻矗浜�" json:"principal"`           //璐熻矗浜�
-		Weight           string          `gorm:"type:decimal(20,2);not null;comment:閲嶉噺" json:"weight"`              //閲嶉噺
-		Volume           string          `gorm:"type:decimal(20,2);not null;comment:浣撶Н" json:"volume"`              //浣撶Н
-
-		InternalReference string `gorm:"type:varchar(255);not null;comment:鍐呴儴鍙傝��" json:"internalReference"` //鍐呴儴鍙傝��
-		Barcode           string `gorm:"type:varchar(255);not null;comment:鏉$爜" json:"barcode"`             //鏉$爜
-		Tags              string `gorm:"type:varchar(255);not null;comment:浜у搧鏍囩" json:"tags"`              //浜у搧鏍囩
-		InternalNotes     string `gorm:"type:varchar(512);not null;comment:鍐呴儴璇存槑" json:"internalNotes"`     //鍐呴儴璇存槑
+		Id                      int                        `gorm:"column:id;primary_key;AUTO_INCREMENT" json:"id"`
+		Name                    string                     `gorm:"index;type:varchar(255);not null;comment:浜у搧鍚嶇О" json:"name"` //浜у搧鍚嶇О
+		Type                    constvar.ProductType       `gorm:"type:int(11);comment:浜у搧绫诲瀷" json:"type"`                     //浜у搧绫诲瀷
+		InvoicingStrategy       constvar.InvoicingStrategy `gorm:"type:int(11);comment:寮�绁ㄧ瓥鐣�" json:"invoicingStrategy"`
+		OrderCreation           constvar.OrderCreation     `gorm:"type:int(11);comment:璁㈠崟鍒涘缓" json:"orderCreation"`
+		ObjectTemplateId        string                     `gorm:"type:varchar(191);comment:椤圭洰妯$増id" json:"objectTemplateId"`
+		SalePrice               decimal.Decimal            `gorm:"type:decimal(35,18);comment:閿�鍞崟浠�" json:"salePrice"`       //閿�鍞环鏍�
+		CustomerTaxes           decimal.Decimal            `gorm:"type:decimal(20,2);comment:瀹㈡埛绋�" json:"customerTaxes"`     //瀹㈡埛绋庣櫨鍒嗘瘮
+		Cost                    decimal.Decimal            `gorm:"type:decimal(20,2);comment:鎴愭湰" json:"cost"`               //鎴愭湰
+		CategoryId              int                        `gorm:"type:int(11);comment:浜у搧绫诲瀷id" json:"categoryId"`           //浜у搧鍒嗙被id
+		InternalReference       string                     `gorm:"type:varchar(255);comment:鍐呴儴鍙傝��" json:"internalReference"` //鍐呴儴鍙傝��
+		Barcode                 string                     `gorm:"type:varchar(255);comment:鏉$爜" json:"barcode"`             //鏉$爜
+		ProductTagId            int                        `gorm:"type:int(11);comment:浜у搧鏍囩id" json:"productTagId"`         //浜у搧鏍囩
+		ProductTagName          string                     `gorm:"type:varchar(255);comment:浜у搧鏍囩鍚嶇О" json:"productTagName"`
+		CompanyId               int                        `gorm:"type:int(11);comment:鍏徃id" json:"companyId"`
+		CompanyName             string                     `gorm:"type:varchar(255);comment:鍏徃鍚嶇О" json:"companyName"`
+		InternalNotes           string                     `gorm:"type:varchar(512);comment:鍐呴儴璇存槑" json:"internalNotes"` //鍐呴儴璇存槑
+		CanBeSell               bool                       `gorm:"type:tinyint(1);comment:鏄惁鍙攢鍞�" json:"canBeSell"`      //鏄惁閿�鍞�
+		SelectProduct           int                        `gorm:"type:int(11);comment:鍙�変骇鍝乮d" json:"selectProduct"`
+		SellExplain             string                     `gorm:"type:varchar(512);comment:閿�鍞鏄�" json:"sellExplain"`
+		CanBePurchased          bool                       `gorm:"type:int(11);comment:鏄惁鍙噰璐�" json:"canBePurchased"` //鏄惁鍙噰璐�
+		SupplierId              int                        `gorm:"type:int(11);comment:渚涘簲鍟唅d" json:"supplierId"`
+		SupplierName            string                     `gorm:"type:varchar(255);comment:渚涘簲鍟嗗悕绉�" json:"supplierName"`
+		Price                   decimal.Decimal            `gorm:"type:decimal(20,2);comment:浠锋牸" json:"price"`
+		CurrencyId              int                        `gorm:"type:int(11);comment:甯佺id" json:"currencyId"`
+		CurrencyName            string                     `gorm:"type:varchar(255);comment:甯佺鍚嶇О" json:"currencyName"`
+		DeliveryAdvanceTime     decimal.Decimal            `gorm:"type:decimal(20,5);comment:鎻愬墠浜よ揣鏃堕棿" json:"deliveryAdvanceTime"`
+		ControlStrategy         constvar.InvoicingStrategy `gorm:"type:int(11);comment:鎺у埗绛栫暐" json:"controlStrategy"`
+		BuyExplain              string                     `gorm:"type:varchar(512);comment:閲囪喘璇存槑" json:"buyExplain"`
+		Principal               string                     `gorm:"type:varchar(255);comment:璐熻矗浜�" json:"principal"` //璐熻矗浜�
+		Weight                  decimal.Decimal            `gorm:"type:decimal(20,2);comment:閲嶉噺" json:"weight"`    //閲嶉噺
+		Volume                  decimal.Decimal            `gorm:"type:decimal(20,2);comment:浣撶Н" json:"volume"`    //浣撶Н
+		CustomerAdvanceTime     decimal.Decimal            `gorm:"type:decimal(20,5);comment:瀹㈡埛鍓嶇疆鏃堕棿" json:"customerAdvanceTime"`
+		HSCode                  string                     `gorm:"type:varchar(255);comment:HS缂栫爜" json:"HSCode"`
+		OriginCountryId         int                        `gorm:"type:int(11);comment:鍘熶骇鍦癷d" json:"originCountryId"`
+		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"`
 	}
 
 	ProductSearch struct {

--
Gitblit v1.8.0