From e51d4c53de6e9a3ecfe9542d4bfdef215d613229 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期四, 16 十一月 2023 10:56:55 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/aps/SRM
---
model/purchase/purchase.go | 5
model/purchase/request/purchase.go | 5
model/purchase/purchase_products.go | 2
config.yaml | 7
docs/swagger.yaml | 30
proto/purchase_wms.proto | 72 ++
config/system.go | 19
docs/docs.go | 39
docs/swagger.json | 39
api/v1/purchase/purchase.go | 48 +
/dev/null | 11
router/purchase/purchase.go | 2
proto/purchase_wms/purchase_wms_grpc.pb.go | 209 +++++++
proto/purchase_wms/purchase_wms.pb.go | 873 ++++++++++++++++++++++++++++++++
main.go | 41 +
proto/purchase_wms/server.go | 108 ++++
service/purchase/purchase.go | 42
proto/purchase_wms/client.go | 25
18 files changed, 1,453 insertions(+), 124 deletions(-)
diff --git a/api/v1/purchase/purchase.go b/api/v1/purchase/purchase.go
index 0a5c918..c037be0 100644
--- a/api/v1/purchase/purchase.go
+++ b/api/v1/purchase/purchase.go
@@ -1,6 +1,7 @@
package purchase
import (
+ "context"
"fmt"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
@@ -10,6 +11,7 @@
"srm/model/common/response"
"srm/model/purchase"
purchaserequest "srm/model/purchase/request"
+ "srm/proto/purchase_wms"
"strconv"
"strings"
"time"
@@ -55,6 +57,7 @@
purchaseRecord.Creator = "admin"
purchaseRecord.Number = fmt.Sprintf("CG%v", time.Now().Unix())
purchaseRecord.Principal = "admin"
+ purchaseRecord.OrderType = "閲囪喘璁㈠崟"
if !purchaseRecord.WholeDiscountType.IsValid(purchaseRecord.TotalPrice, purchaseRecord.WholeDiscount) {
response.FailWithMessage("鏁村崟鎶樻墸鏁板�间笉姝g‘", c)
@@ -230,14 +233,49 @@
// @Produce application/json
// @Param id path int true "閲囪喘鍗旾D"
// @Success 200 {object} response.Response{msg=string} "鎻愪氦閲囪喘鍗�"
-// @Router /purchase/submit/{id} [post]
+// @Router /purchase/submit [post]
func (e *PurchaseApi) Submit(c *gin.Context) {
- id, _ := strconv.Atoi(c.Param("id"))
- if id == 0 {
- response.FailWithMessage("鍙傛暟缂哄け", c)
+ var params purchaserequest.SubmitPurchase
+ err := c.ShouldBindJSON(¶ms)
+ if err != nil {
+ global.GVA_LOG.Error("Submit failed", zap.Error(err))
+ response.FailWithMessage(err.Error(), c)
return
}
- err := service.NewPurchaseService().Submit(uint(id))
+ if params.Status == purchase.OrderStatusReceived {
+ data, err := service.NewPurchaseService().GetPurchase(uint(params.Id))
+ if err != nil {
+ global.GVA_LOG.Error("鑾峰彇澶辫触!", zap.Error(err))
+ response.FailWithMessage("鑾峰彇澶辫触", c)
+ return
+ }
+ productList, err := service.NewPurchaseService().GetPurchaseProductList(uint(params.Id))
+ if err != nil {
+ global.GVA_LOG.Error("鑾峰彇澶辫触!", zap.Error(err))
+ response.FailWithMessage("鑾峰彇澶辫触", c)
+ return
+ }
+ product := make([]*purchase_wms.PurchaseProduct, 0)
+ for _, products := range productList {
+ var p purchase_wms.PurchaseProduct
+ p.Id = products.Product.Number
+ p.Amount = products.Amount.IntPart()
+ product = append(product, &p)
+ }
+ client := purchase_wms.NewPurchaseServiceClient(purchase_wms.PurchaseConn)
+ _, err = client.PurchaseToWms(context.Background(), &purchase_wms.PurchaseToWmsRequest{
+ Number: data.Number,
+ SupplierName: data.Supplier.Name,
+ Product: product,
+ })
+ if err != nil {
+ global.GVA_LOG.Error("grpc璋冪敤澶辫触!", zap.Error(err))
+ response.FailWithMessage("grpc璋冪敤澶辫触", c)
+ return
+ }
+ }
+
+ err = service.NewPurchaseService().Submit(params.Id, params.Status)
if err != nil {
global.GVA_LOG.Error("鏇存柊澶辫触!", zap.Error(err))
response.FailWithMessage("鏇存柊澶辫触", c)
diff --git a/config.yaml b/config.yaml
index 456869a..cf7226f 100644
--- a/config.yaml
+++ b/config.yaml
@@ -45,15 +45,12 @@
system:
env: public
db-type: mysql
- oss-type: local
router-prefix: "/api"
addr: 8004
- iplimit-count: 15000
- iplimit-time: 3600
- use-multipoint: false
- use-redis: false
+ grpc-port: "9093"
grpc-url: 192.168.20.119:9091
grpc-admin-url: 192.168.20.119:50051
+ grpc-wms-url: 192.168.20.118:8006
tencent-cos:
bucket: xxxxx-10005608
region: ap-shanghai
diff --git a/config/system.go b/config/system.go
index 0f99af3..42ec690 100644
--- a/config/system.go
+++ b/config/system.go
@@ -1,15 +1,12 @@
package config
type System struct {
- Env string `mapstructure:"env" json:"env" yaml:"env"` // 鐜鍊�
- DbType string `mapstructure:"db-type" json:"db-type" yaml:"db-type"` // 鏁版嵁搴撶被鍨�:mysql(榛樿)|sqlite|sqlserver|postgresql
- OssType string `mapstructure:"oss-type" json:"oss-type" yaml:"oss-type"` // Oss绫诲瀷
- RouterPrefix string `mapstructure:"router-prefix" json:"router-prefix" yaml:"router-prefix"`
- Addr int `mapstructure:"addr" json:"addr" yaml:"addr"` // 绔彛鍊�
- LimitCountIP int `mapstructure:"iplimit-count" json:"iplimit-count" yaml:"iplimit-count"`
- LimitTimeIP int `mapstructure:"iplimit-time" json:"iplimit-time" yaml:"iplimit-time"`
- UseMultipoint bool `mapstructure:"use-multipoint" json:"use-multipoint" yaml:"use-multipoint"` // 澶氱偣鐧诲綍鎷︽埅
- UseRedis bool `mapstructure:"use-redis" json:"use-redis" yaml:"use-redis"` // 浣跨敤redis
- GrpcUrl string `mapstructure:"grpc-url" json:"grpc-url" yaml:"grpc-url"` // grpc鏈嶅姟鍦板潃
- GrpcAdminUrl string `mapstructure:"grpc-admin-url" json:"grpc-admin-url" yaml:"grpc-admin-url"` // grpc鏈嶅姟鍦板潃
+ Env string `mapstructure:"env" json:"env" yaml:"env"` // 鐜鍊�
+ DbType string `mapstructure:"db-type" json:"db-type" yaml:"db-type"` // 鏁版嵁搴撶被鍨�:mysql(榛樿)|sqlite|sqlserver|postgresql
+ RouterPrefix string `mapstructure:"router-prefix" json:"router-prefix" yaml:"router-prefix"`
+ Addr int `mapstructure:"addr" json:"addr" yaml:"addr"` // 绔彛鍊�
+ GrpcPort string `mapstructure:"grpc-port" json:"grpc-port" yaml:"grpc-port"` // 瀵瑰鎻愪緵鏈嶅姟grpc绔彛
+ GrpcUrl string `mapstructure:"grpc-url" json:"grpc-url" yaml:"grpc-url"` // aps grpc鏈嶅姟鍦板潃
+ GrpcAdminUrl string `mapstructure:"grpc-admin-url" json:"grpc-admin-url" yaml:"grpc-admin-url"` // admin grpc鏈嶅姟鍦板潃
+ GrpcWmsUrl string `mapstructure:"grpc-wms-url" json:"grpc-wms-url" yaml:"grpc-wms-url"` // wms grpc鏈嶅姟鍦板潃
}
diff --git a/docs/docs.go b/docs/docs.go
index bb1bbe9..089c556 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -1917,7 +1917,7 @@
}
}
},
- "/purchase/submit/{id}": {
+ "/purchase/submit": {
"post": {
"security": [
{
@@ -3306,33 +3306,23 @@
"type": "string"
},
"grpc-admin-url": {
- "description": "grpc鏈嶅姟鍦板潃",
+ "description": "admin grpc鏈嶅姟鍦板潃",
+ "type": "string"
+ },
+ "grpc-port": {
+ "description": "瀵瑰鎻愪緵鏈嶅姟grpc绔彛",
"type": "string"
},
"grpc-url": {
- "description": "grpc鏈嶅姟鍦板潃",
+ "description": "aps grpc鏈嶅姟鍦板潃",
"type": "string"
},
- "iplimit-count": {
- "type": "integer"
- },
- "iplimit-time": {
- "type": "integer"
- },
- "oss-type": {
- "description": "Oss绫诲瀷",
+ "grpc-wms-url": {
+ "description": "wms grpc鏈嶅姟鍦板潃",
"type": "string"
},
"router-prefix": {
"type": "string"
- },
- "use-multipoint": {
- "description": "澶氱偣鐧诲綍鎷︽埅",
- "type": "boolean"
- },
- "use-redis": {
- "description": "浣跨敤redis",
- "type": "boolean"
}
}
},
@@ -3383,19 +3373,22 @@
1,
2,
3,
- 4
+ 4,
+ 5
],
"x-enum-comments": {
+ "OrderStatusCanceled": "宸插彇娑�",
"OrderStatusCompleted": "宸插畬鎴�",
- "OrderStatusConfirmed": "宸蹭笅鍗�",
- "OrderStatusReceived": "宸插埌璐�",
+ "OrderStatusConfirmed": "寰呯‘璁�",
+ "OrderStatusReceived": "寰呭叆搴�",
"OrderStatusStored": "宸插叆搴�"
},
"x-enum-varnames": [
"OrderStatusConfirmed",
"OrderStatusReceived",
"OrderStatusStored",
- "OrderStatusCompleted"
+ "OrderStatusCompleted",
+ "OrderStatusCanceled"
]
},
"purchase.PriceAdjustmentType": {
diff --git a/docs/swagger.json b/docs/swagger.json
index c682e63..2223c6e 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -1908,7 +1908,7 @@
}
}
},
- "/purchase/submit/{id}": {
+ "/purchase/submit": {
"post": {
"security": [
{
@@ -3297,33 +3297,23 @@
"type": "string"
},
"grpc-admin-url": {
- "description": "grpc鏈嶅姟鍦板潃",
+ "description": "admin grpc鏈嶅姟鍦板潃",
+ "type": "string"
+ },
+ "grpc-port": {
+ "description": "瀵瑰鎻愪緵鏈嶅姟grpc绔彛",
"type": "string"
},
"grpc-url": {
- "description": "grpc鏈嶅姟鍦板潃",
+ "description": "aps grpc鏈嶅姟鍦板潃",
"type": "string"
},
- "iplimit-count": {
- "type": "integer"
- },
- "iplimit-time": {
- "type": "integer"
- },
- "oss-type": {
- "description": "Oss绫诲瀷",
+ "grpc-wms-url": {
+ "description": "wms grpc鏈嶅姟鍦板潃",
"type": "string"
},
"router-prefix": {
"type": "string"
- },
- "use-multipoint": {
- "description": "澶氱偣鐧诲綍鎷︽埅",
- "type": "boolean"
- },
- "use-redis": {
- "description": "浣跨敤redis",
- "type": "boolean"
}
}
},
@@ -3374,19 +3364,22 @@
1,
2,
3,
- 4
+ 4,
+ 5
],
"x-enum-comments": {
+ "OrderStatusCanceled": "宸插彇娑�",
"OrderStatusCompleted": "宸插畬鎴�",
- "OrderStatusConfirmed": "宸蹭笅鍗�",
- "OrderStatusReceived": "宸插埌璐�",
+ "OrderStatusConfirmed": "寰呯‘璁�",
+ "OrderStatusReceived": "寰呭叆搴�",
"OrderStatusStored": "宸插叆搴�"
},
"x-enum-varnames": [
"OrderStatusConfirmed",
"OrderStatusReceived",
"OrderStatusStored",
- "OrderStatusCompleted"
+ "OrderStatusCompleted",
+ "OrderStatusCanceled"
]
},
"purchase.PriceAdjustmentType": {
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index f2579ec..2d47c09 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -308,26 +308,19 @@
description: 鐜鍊�
type: string
grpc-admin-url:
- description: grpc鏈嶅姟鍦板潃
+ description: admin grpc鏈嶅姟鍦板潃
+ type: string
+ grpc-port:
+ description: 瀵瑰鎻愪緵鏈嶅姟grpc绔彛
type: string
grpc-url:
- description: grpc鏈嶅姟鍦板潃
+ description: aps grpc鏈嶅姟鍦板潃
type: string
- iplimit-count:
- type: integer
- iplimit-time:
- type: integer
- oss-type:
- description: Oss绫诲瀷
+ grpc-wms-url:
+ description: wms grpc鏈嶅姟鍦板潃
type: string
router-prefix:
type: string
- use-multipoint:
- description: 澶氱偣鐧诲綍鎷︽埅
- type: boolean
- use-redis:
- description: 浣跨敤redis
- type: boolean
type: object
config.Zap:
properties:
@@ -365,17 +358,20 @@
- 2
- 3
- 4
+ - 5
type: integer
x-enum-comments:
+ OrderStatusCanceled: 宸插彇娑�
OrderStatusCompleted: 宸插畬鎴�
- OrderStatusConfirmed: 宸蹭笅鍗�
- OrderStatusReceived: 宸插埌璐�
+ OrderStatusConfirmed: 寰呯‘璁�
+ OrderStatusReceived: 寰呭叆搴�
OrderStatusStored: 宸插叆搴�
x-enum-varnames:
- OrderStatusConfirmed
- OrderStatusReceived
- OrderStatusStored
- OrderStatusCompleted
+ - OrderStatusCanceled
purchase.PriceAdjustmentType:
enum:
- 1
@@ -2053,7 +2049,7 @@
summary: 鍒嗛〉鑾峰彇璐ㄦ鍗曞垪琛�
tags:
- QualityInspect
- /purchase/submit/{id}:
+ /purchase/submit:
post:
consumes:
- application/json
diff --git a/initialize/rpc.go b/initialize/rpc.go
deleted file mode 100644
index 02e2611..0000000
--- a/initialize/rpc.go
+++ /dev/null
@@ -1,11 +0,0 @@
-package initialize
-
-import "srm/proto/qualityinspect"
-
-func InitRpcClient() {
- qualityinspect.InitConn()
-}
-
-func CloseRpcClient() {
- qualityinspect.CloseConn()
-}
diff --git a/main.go b/main.go
index 50fa538..fe6d232 100644
--- a/main.go
+++ b/main.go
@@ -1,8 +1,13 @@
package main
import (
+ "fmt"
"go.uber.org/zap"
+ "google.golang.org/grpc"
+ "net"
"srm/api/v1/test"
+ "srm/proto/purchase_wms"
+ "srm/proto/qualityinspect"
"srm/core"
"srm/global"
@@ -33,11 +38,39 @@
db, _ := global.GVA_DB.DB()
defer db.Close()
}
+ //鍚姩grpc鏈嶅姟
+ go func() {
+ ln, err := net.Listen("tcp", ":"+global.GVA_CONFIG.System.GrpcPort)
+ if err != nil {
+ global.GVA_LOG.Error("grpc server init error: %v", zap.Error(err))
+ panic(fmt.Sprintf("grpc server init error: %v", err.Error()))
+ }
+ s := grpc.NewServer()
+ //todo 娣诲姞鍏蜂綋鏈嶅姟
+ purchase_wms.RegisterPurchaseServiceServer(s, &purchase_wms.Server{})
+ err = s.Serve(ln)
+ if err != nil {
+ global.GVA_LOG.Error("grpc server init error: %v", zap.Error(err))
+ panic(fmt.Sprintf("grpc server init error: %v", err.Error()))
+ }
+ }()
- go test.InitProductServiceConn()
- defer test.CloseProductServiceConn()
- initialize.InitRpcClient()
- defer initialize.CloseRpcClient()
+ go initGrpcClient()
+ defer closeGrpcClient()
core.RunWindowsServer()
}
+
+func initGrpcClient() {
+ test.InitProductServiceConn()
+ qualityinspect.InitConn()
+ purchase_wms.InitPurchaseConn()
+ test.InitProductServiceConn()
+}
+
+func closeGrpcClient() {
+ test.CloseProductServiceConn()
+ qualityinspect.CloseConn()
+ purchase_wms.ClosePurchaseConn()
+ test.CloseProductServiceConn()
+}
diff --git a/model/purchase/purchase.go b/model/purchase/purchase.go
index 01a5e2b..27de935 100644
--- a/model/purchase/purchase.go
+++ b/model/purchase/purchase.go
@@ -46,10 +46,11 @@
type OrderStatus int
const (
- OrderStatusConfirmed OrderStatus = 1 //宸蹭笅鍗�
- OrderStatusReceived OrderStatus = 2 //宸插埌璐�
+ OrderStatusConfirmed OrderStatus = 1 //寰呯‘璁�
+ OrderStatusReceived OrderStatus = 2 //寰呭叆搴�
OrderStatusStored OrderStatus = 3 //宸插叆搴�
OrderStatusCompleted OrderStatus = 4 //宸插畬鎴�
+ OrderStatusCanceled OrderStatus = 5 //宸插彇娑�
)
type WholeDiscountType int
diff --git a/model/purchase/purchase_products.go b/model/purchase/purchase_products.go
index c89a3c3..93a0c0d 100644
--- a/model/purchase/purchase_products.go
+++ b/model/purchase/purchase_products.go
@@ -9,7 +9,7 @@
type PurchaseProducts struct {
global.GVA_MODEL
PurchaseId int `json:"purchaseId" form:"purchaseType" gorm:"type:int(11);not null;default 0;comment:閲囪喘绫诲瀷id"` // 閲囪喘id
- ProductId string `json:"productId" form:"productId" gorm:"type:varchar(255);not null;default '';comment:浜у搧id"` // 浜у搧id
+ ProductId int `json:"productId" form:"productId" gorm:"type:varchar(255);not null;default '';comment:浜у搧id"` // 浜у搧id
Product test.SupplierMaterial `json:"-" gorm:"foreignKey:ProductId"`
Amount decimal.Decimal `json:"amount" form:"amount" gorm:"type:decimal(12,2);not null;default 0;comment:閲囪喘鏁伴噺"` // 閲囪喘鏁伴噺
Price decimal.Decimal `json:"price" form:"price" gorm:"type:decimal(12,2);not null;default 0.00;comment:閲囪喘鍗曚环"` // 閲囪喘鍗曚环
diff --git a/model/purchase/request/purchase.go b/model/purchase/request/purchase.go
index 6bcea8b..c21910a 100644
--- a/model/purchase/request/purchase.go
+++ b/model/purchase/request/purchase.go
@@ -23,6 +23,11 @@
ProductList []*purchase.PurchaseProducts `json:"productList"`
}
+type SubmitPurchase struct {
+ Id int `json:"id"`
+ Status purchase.OrderStatus `json:"status"`
+}
+
type Purchase struct {
ID uint `gorm:"primarykey"` // 涓婚敭ID
PurchaseTypeId int `json:"purchaseTypeId" form:"purchaseType" gorm:"type:int(11);not null;default 0;comment:閲囪喘绫诲瀷id"` // 閲囪喘绫诲瀷id
diff --git a/proto/purchase_wms.proto b/proto/purchase_wms.proto
new file mode 100644
index 0000000..1e8a838
--- /dev/null
+++ b/proto/purchase_wms.proto
@@ -0,0 +1,72 @@
+syntax = "proto3";
+
+option go_package = "./purchase_wms";
+
+service PurchaseService {
+ rpc PurchaseToWms(PurchaseToWmsRequest) returns (PurchaseToWmsResponse);
+ rpc UpdatePurchaseStatus(UpdatePurchaseStatusRequest) returns (UpdatePurchaseStatusResponse) {}
+ rpc GetSupplierListByProductId(GetSupplierListByProductIdRequest) returns (GetSupplierListByProductIdResponse) {}
+ rpc CreatePurchaseByWms(CreatePurchaseByWmsRequest) returns (CreatePurchaseByWmsResponse) {}
+}
+
+//------------------------------------------PurchaseToWms--------------------------------
+
+message PurchaseProduct{
+ string Id = 1;
+ int64 Amount = 2;
+}
+
+message PurchaseToWmsRequest {
+ string Number = 1; //閲囪喘缂栧彿
+ string SupplierName = 2; //渚涘簲鍟�
+ repeated PurchaseProduct Product = 3;
+}
+
+message PurchaseToWmsResponse {
+ int32 code = 1;
+ string message = 2;
+}
+
+//------------------------------------------------UpdatePurchaseStatus-------------------------------------
+
+message UpdatePurchaseStatusRequest {
+ string Number = 1;//閲囪喘缂栧彿
+}
+
+message UpdatePurchaseStatusResponse {
+ int32 Code = 1;
+ string Msg = 2;
+}
+
+//--------------------------------------------------GetSupplierListByProductId------------------------------
+
+message GetSupplierListByProductIdRequest {
+ string ProductId = 1;
+}
+
+message SupplierList {
+ int64 supplierId = 1;
+ string supplierName = 2;
+ float purchasePrice = 3;//閲囪喘浠锋牸
+}
+
+message GetSupplierListByProductIdResponse {
+ int32 Code = 1;
+ string Msg = 2;
+ repeated SupplierList List = 3;
+}
+
+//-----------------------------------------------------CreatePurchaseByWms--------------------------------------
+
+message CreatePurchaseByWmsRequest {
+ int64 SupplierId = 1;
+ string ProductId = 2;
+ int64 Amount = 3;
+}
+
+message CreatePurchaseByWmsResponse {
+ int32 Code = 1;
+ string Msg = 2;
+ string PurchaseNumber = 3;
+}
+
diff --git a/proto/purchase_wms/client.go b/proto/purchase_wms/client.go
new file mode 100644
index 0000000..25909bf
--- /dev/null
+++ b/proto/purchase_wms/client.go
@@ -0,0 +1,25 @@
+package purchase_wms
+
+import (
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/credentials/insecure"
+ "srm/global"
+)
+
+var (
+ PurchaseConn *grpc.ClientConn
+)
+
+func InitPurchaseConn() {
+ var err error
+ PurchaseConn, err = grpc.Dial(global.GVA_CONFIG.System.GrpcWmsUrl, grpc.WithTransportCredentials(insecure.NewCredentials()))
+ if err != nil {
+ return
+ }
+}
+
+func ClosePurchaseConn() {
+ if PurchaseConn != nil {
+ PurchaseConn.Close()
+ }
+}
diff --git a/proto/purchase_wms/purchase_wms.pb.go b/proto/purchase_wms/purchase_wms.pb.go
new file mode 100644
index 0000000..e60e691
--- /dev/null
+++ b/proto/purchase_wms/purchase_wms.pb.go
@@ -0,0 +1,873 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.26.0
+// protoc v4.24.0
+// source: purchase_wms.proto
+
+package purchase_wms
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type PurchaseProduct struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id string `protobuf:"bytes,1,opt,name=Id,proto3" json:"Id,omitempty"`
+ Amount int64 `protobuf:"varint,2,opt,name=Amount,proto3" json:"Amount,omitempty"`
+}
+
+func (x *PurchaseProduct) Reset() {
+ *x = PurchaseProduct{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_purchase_wms_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *PurchaseProduct) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*PurchaseProduct) ProtoMessage() {}
+
+func (x *PurchaseProduct) ProtoReflect() protoreflect.Message {
+ mi := &file_purchase_wms_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use PurchaseProduct.ProtoReflect.Descriptor instead.
+func (*PurchaseProduct) Descriptor() ([]byte, []int) {
+ return file_purchase_wms_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *PurchaseProduct) GetId() string {
+ if x != nil {
+ return x.Id
+ }
+ return ""
+}
+
+func (x *PurchaseProduct) GetAmount() int64 {
+ if x != nil {
+ return x.Amount
+ }
+ return 0
+}
+
+type PurchaseToWmsRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Number string `protobuf:"bytes,1,opt,name=Number,proto3" json:"Number,omitempty"` //閲囪喘缂栧彿
+ SupplierName string `protobuf:"bytes,2,opt,name=SupplierName,proto3" json:"SupplierName,omitempty"` //渚涘簲鍟�
+ Product []*PurchaseProduct `protobuf:"bytes,3,rep,name=Product,proto3" json:"Product,omitempty"`
+}
+
+func (x *PurchaseToWmsRequest) Reset() {
+ *x = PurchaseToWmsRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_purchase_wms_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *PurchaseToWmsRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*PurchaseToWmsRequest) ProtoMessage() {}
+
+func (x *PurchaseToWmsRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_purchase_wms_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use PurchaseToWmsRequest.ProtoReflect.Descriptor instead.
+func (*PurchaseToWmsRequest) Descriptor() ([]byte, []int) {
+ return file_purchase_wms_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *PurchaseToWmsRequest) GetNumber() string {
+ if x != nil {
+ return x.Number
+ }
+ return ""
+}
+
+func (x *PurchaseToWmsRequest) GetSupplierName() string {
+ if x != nil {
+ return x.SupplierName
+ }
+ return ""
+}
+
+func (x *PurchaseToWmsRequest) GetProduct() []*PurchaseProduct {
+ if x != nil {
+ return x.Product
+ }
+ return nil
+}
+
+type PurchaseToWmsResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
+ Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
+}
+
+func (x *PurchaseToWmsResponse) Reset() {
+ *x = PurchaseToWmsResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_purchase_wms_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *PurchaseToWmsResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*PurchaseToWmsResponse) ProtoMessage() {}
+
+func (x *PurchaseToWmsResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_purchase_wms_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use PurchaseToWmsResponse.ProtoReflect.Descriptor instead.
+func (*PurchaseToWmsResponse) Descriptor() ([]byte, []int) {
+ return file_purchase_wms_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *PurchaseToWmsResponse) GetCode() int32 {
+ if x != nil {
+ return x.Code
+ }
+ return 0
+}
+
+func (x *PurchaseToWmsResponse) GetMessage() string {
+ if x != nil {
+ return x.Message
+ }
+ return ""
+}
+
+type UpdatePurchaseStatusRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Number string `protobuf:"bytes,1,opt,name=Number,proto3" json:"Number,omitempty"` //閲囪喘缂栧彿
+}
+
+func (x *UpdatePurchaseStatusRequest) Reset() {
+ *x = UpdatePurchaseStatusRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_purchase_wms_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UpdatePurchaseStatusRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UpdatePurchaseStatusRequest) ProtoMessage() {}
+
+func (x *UpdatePurchaseStatusRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_purchase_wms_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UpdatePurchaseStatusRequest.ProtoReflect.Descriptor instead.
+func (*UpdatePurchaseStatusRequest) Descriptor() ([]byte, []int) {
+ return file_purchase_wms_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *UpdatePurchaseStatusRequest) GetNumber() string {
+ if x != nil {
+ return x.Number
+ }
+ return ""
+}
+
+type UpdatePurchaseStatusResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Code int32 `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"`
+ Msg string `protobuf:"bytes,2,opt,name=Msg,proto3" json:"Msg,omitempty"`
+}
+
+func (x *UpdatePurchaseStatusResponse) Reset() {
+ *x = UpdatePurchaseStatusResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_purchase_wms_proto_msgTypes[4]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UpdatePurchaseStatusResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UpdatePurchaseStatusResponse) ProtoMessage() {}
+
+func (x *UpdatePurchaseStatusResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_purchase_wms_proto_msgTypes[4]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UpdatePurchaseStatusResponse.ProtoReflect.Descriptor instead.
+func (*UpdatePurchaseStatusResponse) Descriptor() ([]byte, []int) {
+ return file_purchase_wms_proto_rawDescGZIP(), []int{4}
+}
+
+func (x *UpdatePurchaseStatusResponse) GetCode() int32 {
+ if x != nil {
+ return x.Code
+ }
+ return 0
+}
+
+func (x *UpdatePurchaseStatusResponse) GetMsg() string {
+ if x != nil {
+ return x.Msg
+ }
+ return ""
+}
+
+type GetSupplierListByProductIdRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ ProductId string `protobuf:"bytes,1,opt,name=ProductId,proto3" json:"ProductId,omitempty"`
+}
+
+func (x *GetSupplierListByProductIdRequest) Reset() {
+ *x = GetSupplierListByProductIdRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_purchase_wms_proto_msgTypes[5]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetSupplierListByProductIdRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetSupplierListByProductIdRequest) ProtoMessage() {}
+
+func (x *GetSupplierListByProductIdRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_purchase_wms_proto_msgTypes[5]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetSupplierListByProductIdRequest.ProtoReflect.Descriptor instead.
+func (*GetSupplierListByProductIdRequest) Descriptor() ([]byte, []int) {
+ return file_purchase_wms_proto_rawDescGZIP(), []int{5}
+}
+
+func (x *GetSupplierListByProductIdRequest) GetProductId() string {
+ if x != nil {
+ return x.ProductId
+ }
+ return ""
+}
+
+type SupplierList struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ SupplierId int64 `protobuf:"varint,1,opt,name=supplierId,proto3" json:"supplierId,omitempty"`
+ SupplierName string `protobuf:"bytes,2,opt,name=supplierName,proto3" json:"supplierName,omitempty"`
+ PurchasePrice float32 `protobuf:"fixed32,3,opt,name=purchasePrice,proto3" json:"purchasePrice,omitempty"` //閲囪喘浠锋牸
+}
+
+func (x *SupplierList) Reset() {
+ *x = SupplierList{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_purchase_wms_proto_msgTypes[6]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SupplierList) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SupplierList) ProtoMessage() {}
+
+func (x *SupplierList) ProtoReflect() protoreflect.Message {
+ mi := &file_purchase_wms_proto_msgTypes[6]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SupplierList.ProtoReflect.Descriptor instead.
+func (*SupplierList) Descriptor() ([]byte, []int) {
+ return file_purchase_wms_proto_rawDescGZIP(), []int{6}
+}
+
+func (x *SupplierList) GetSupplierId() int64 {
+ if x != nil {
+ return x.SupplierId
+ }
+ return 0
+}
+
+func (x *SupplierList) GetSupplierName() string {
+ if x != nil {
+ return x.SupplierName
+ }
+ return ""
+}
+
+func (x *SupplierList) GetPurchasePrice() float32 {
+ if x != nil {
+ return x.PurchasePrice
+ }
+ return 0
+}
+
+type GetSupplierListByProductIdResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Code int32 `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"`
+ Msg string `protobuf:"bytes,2,opt,name=Msg,proto3" json:"Msg,omitempty"`
+ List []*SupplierList `protobuf:"bytes,3,rep,name=List,proto3" json:"List,omitempty"`
+}
+
+func (x *GetSupplierListByProductIdResponse) Reset() {
+ *x = GetSupplierListByProductIdResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_purchase_wms_proto_msgTypes[7]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetSupplierListByProductIdResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetSupplierListByProductIdResponse) ProtoMessage() {}
+
+func (x *GetSupplierListByProductIdResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_purchase_wms_proto_msgTypes[7]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetSupplierListByProductIdResponse.ProtoReflect.Descriptor instead.
+func (*GetSupplierListByProductIdResponse) Descriptor() ([]byte, []int) {
+ return file_purchase_wms_proto_rawDescGZIP(), []int{7}
+}
+
+func (x *GetSupplierListByProductIdResponse) GetCode() int32 {
+ if x != nil {
+ return x.Code
+ }
+ return 0
+}
+
+func (x *GetSupplierListByProductIdResponse) GetMsg() string {
+ if x != nil {
+ return x.Msg
+ }
+ return ""
+}
+
+func (x *GetSupplierListByProductIdResponse) GetList() []*SupplierList {
+ if x != nil {
+ return x.List
+ }
+ return nil
+}
+
+type CreatePurchaseByWmsRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ SupplierId int64 `protobuf:"varint,1,opt,name=SupplierId,proto3" json:"SupplierId,omitempty"`
+ ProductId string `protobuf:"bytes,2,opt,name=ProductId,proto3" json:"ProductId,omitempty"`
+ Amount int64 `protobuf:"varint,3,opt,name=Amount,proto3" json:"Amount,omitempty"`
+}
+
+func (x *CreatePurchaseByWmsRequest) Reset() {
+ *x = CreatePurchaseByWmsRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_purchase_wms_proto_msgTypes[8]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CreatePurchaseByWmsRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CreatePurchaseByWmsRequest) ProtoMessage() {}
+
+func (x *CreatePurchaseByWmsRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_purchase_wms_proto_msgTypes[8]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CreatePurchaseByWmsRequest.ProtoReflect.Descriptor instead.
+func (*CreatePurchaseByWmsRequest) Descriptor() ([]byte, []int) {
+ return file_purchase_wms_proto_rawDescGZIP(), []int{8}
+}
+
+func (x *CreatePurchaseByWmsRequest) GetSupplierId() int64 {
+ if x != nil {
+ return x.SupplierId
+ }
+ return 0
+}
+
+func (x *CreatePurchaseByWmsRequest) GetProductId() string {
+ if x != nil {
+ return x.ProductId
+ }
+ return ""
+}
+
+func (x *CreatePurchaseByWmsRequest) GetAmount() int64 {
+ if x != nil {
+ return x.Amount
+ }
+ return 0
+}
+
+type CreatePurchaseByWmsResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Code int32 `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"`
+ Msg string `protobuf:"bytes,2,opt,name=Msg,proto3" json:"Msg,omitempty"`
+ PurchaseNumber string `protobuf:"bytes,3,opt,name=PurchaseNumber,proto3" json:"PurchaseNumber,omitempty"`
+}
+
+func (x *CreatePurchaseByWmsResponse) Reset() {
+ *x = CreatePurchaseByWmsResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_purchase_wms_proto_msgTypes[9]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CreatePurchaseByWmsResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CreatePurchaseByWmsResponse) ProtoMessage() {}
+
+func (x *CreatePurchaseByWmsResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_purchase_wms_proto_msgTypes[9]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CreatePurchaseByWmsResponse.ProtoReflect.Descriptor instead.
+func (*CreatePurchaseByWmsResponse) Descriptor() ([]byte, []int) {
+ return file_purchase_wms_proto_rawDescGZIP(), []int{9}
+}
+
+func (x *CreatePurchaseByWmsResponse) GetCode() int32 {
+ if x != nil {
+ return x.Code
+ }
+ return 0
+}
+
+func (x *CreatePurchaseByWmsResponse) GetMsg() string {
+ if x != nil {
+ return x.Msg
+ }
+ return ""
+}
+
+func (x *CreatePurchaseByWmsResponse) GetPurchaseNumber() string {
+ if x != nil {
+ return x.PurchaseNumber
+ }
+ return ""
+}
+
+var File_purchase_wms_proto protoreflect.FileDescriptor
+
+var file_purchase_wms_proto_rawDesc = []byte{
+ 0x0a, 0x12, 0x70, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x5f, 0x77, 0x6d, 0x73, 0x2e, 0x70,
+ 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x39, 0x0a, 0x0f, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65,
+ 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e,
+ 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22,
+ 0x7e, 0x0a, 0x14, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x54, 0x6f, 0x57, 0x6d, 0x73,
+ 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65,
+ 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12,
+ 0x22, 0x0a, 0x0c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4e,
+ 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x18, 0x03,
+ 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x50,
+ 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x07, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x22,
+ 0x45, 0x0a, 0x15, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x54, 0x6f, 0x57, 0x6d, 0x73,
+ 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07,
+ 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d,
+ 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x35, 0x0a, 0x1b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
+ 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65,
+ 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x44, 0x0a,
+ 0x1c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x53,
+ 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a,
+ 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x43, 0x6f, 0x64,
+ 0x65, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
+ 0x4d, 0x73, 0x67, 0x22, 0x41, 0x0a, 0x21, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69,
+ 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49,
+ 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x50, 0x72, 0x6f, 0x64,
+ 0x75, 0x63, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x50, 0x72, 0x6f,
+ 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x22, 0x78, 0x0a, 0x0c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69,
+ 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69,
+ 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x73, 0x75, 0x70, 0x70,
+ 0x6c, 0x69, 0x65, 0x72, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69,
+ 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x75,
+ 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x70, 0x75,
+ 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
+ 0x02, 0x52, 0x0d, 0x70, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x50, 0x72, 0x69, 0x63, 0x65,
+ 0x22, 0x6d, 0x0a, 0x22, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4c,
+ 0x69, 0x73, 0x74, 0x42, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x52, 0x65,
+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73,
+ 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x21, 0x0a, 0x04,
+ 0x4c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x53, 0x75, 0x70,
+ 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x22,
+ 0x72, 0x0a, 0x1a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73,
+ 0x65, 0x42, 0x79, 0x57, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a,
+ 0x0a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x03, 0x52, 0x0a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1c, 0x0a,
+ 0x09, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x09, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x41,
+ 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x41, 0x6d, 0x6f,
+ 0x75, 0x6e, 0x74, 0x22, 0x6b, 0x0a, 0x1b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72,
+ 0x63, 0x68, 0x61, 0x73, 0x65, 0x42, 0x79, 0x57, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
+ 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
+ 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x26, 0x0a, 0x0e, 0x50, 0x75, 0x72, 0x63,
+ 0x68, 0x61, 0x73, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x0e, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72,
+ 0x32, 0xe5, 0x02, 0x0a, 0x0f, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x53, 0x65, 0x72,
+ 0x76, 0x69, 0x63, 0x65, 0x12, 0x3e, 0x0a, 0x0d, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65,
+ 0x54, 0x6f, 0x57, 0x6d, 0x73, 0x12, 0x15, 0x2e, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65,
+ 0x54, 0x6f, 0x57, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x50,
+ 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x54, 0x6f, 0x57, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70,
+ 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x75,
+ 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x2e, 0x55,
+ 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61,
+ 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x55, 0x70, 0x64,
+ 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75,
+ 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x67, 0x0a, 0x1a, 0x47,
+ 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79,
+ 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x22, 0x2e, 0x47, 0x65, 0x74, 0x53,
+ 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x50, 0x72, 0x6f,
+ 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e,
+ 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x42,
+ 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
+ 0x73, 0x65, 0x22, 0x00, 0x12, 0x52, 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x75,
+ 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x42, 0x79, 0x57, 0x6d, 0x73, 0x12, 0x1b, 0x2e, 0x43, 0x72,
+ 0x65, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x42, 0x79, 0x57, 0x6d,
+ 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74,
+ 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x42, 0x79, 0x57, 0x6d, 0x73, 0x52, 0x65,
+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x10, 0x5a, 0x0e, 0x2e, 0x2f, 0x70, 0x75,
+ 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x5f, 0x77, 0x6d, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
+ 0x6f, 0x33,
+}
+
+var (
+ file_purchase_wms_proto_rawDescOnce sync.Once
+ file_purchase_wms_proto_rawDescData = file_purchase_wms_proto_rawDesc
+)
+
+func file_purchase_wms_proto_rawDescGZIP() []byte {
+ file_purchase_wms_proto_rawDescOnce.Do(func() {
+ file_purchase_wms_proto_rawDescData = protoimpl.X.CompressGZIP(file_purchase_wms_proto_rawDescData)
+ })
+ return file_purchase_wms_proto_rawDescData
+}
+
+var file_purchase_wms_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
+var file_purchase_wms_proto_goTypes = []interface{}{
+ (*PurchaseProduct)(nil), // 0: PurchaseProduct
+ (*PurchaseToWmsRequest)(nil), // 1: PurchaseToWmsRequest
+ (*PurchaseToWmsResponse)(nil), // 2: PurchaseToWmsResponse
+ (*UpdatePurchaseStatusRequest)(nil), // 3: UpdatePurchaseStatusRequest
+ (*UpdatePurchaseStatusResponse)(nil), // 4: UpdatePurchaseStatusResponse
+ (*GetSupplierListByProductIdRequest)(nil), // 5: GetSupplierListByProductIdRequest
+ (*SupplierList)(nil), // 6: SupplierList
+ (*GetSupplierListByProductIdResponse)(nil), // 7: GetSupplierListByProductIdResponse
+ (*CreatePurchaseByWmsRequest)(nil), // 8: CreatePurchaseByWmsRequest
+ (*CreatePurchaseByWmsResponse)(nil), // 9: CreatePurchaseByWmsResponse
+}
+var file_purchase_wms_proto_depIdxs = []int32{
+ 0, // 0: PurchaseToWmsRequest.Product:type_name -> PurchaseProduct
+ 6, // 1: GetSupplierListByProductIdResponse.List:type_name -> SupplierList
+ 1, // 2: PurchaseService.PurchaseToWms:input_type -> PurchaseToWmsRequest
+ 3, // 3: PurchaseService.UpdatePurchaseStatus:input_type -> UpdatePurchaseStatusRequest
+ 5, // 4: PurchaseService.GetSupplierListByProductId:input_type -> GetSupplierListByProductIdRequest
+ 8, // 5: PurchaseService.CreatePurchaseByWms:input_type -> CreatePurchaseByWmsRequest
+ 2, // 6: PurchaseService.PurchaseToWms:output_type -> PurchaseToWmsResponse
+ 4, // 7: PurchaseService.UpdatePurchaseStatus:output_type -> UpdatePurchaseStatusResponse
+ 7, // 8: PurchaseService.GetSupplierListByProductId:output_type -> GetSupplierListByProductIdResponse
+ 9, // 9: PurchaseService.CreatePurchaseByWms:output_type -> CreatePurchaseByWmsResponse
+ 6, // [6:10] is the sub-list for method output_type
+ 2, // [2:6] is the sub-list for method input_type
+ 2, // [2:2] is the sub-list for extension type_name
+ 2, // [2:2] is the sub-list for extension extendee
+ 0, // [0:2] is the sub-list for field type_name
+}
+
+func init() { file_purchase_wms_proto_init() }
+func file_purchase_wms_proto_init() {
+ if File_purchase_wms_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_purchase_wms_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*PurchaseProduct); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_purchase_wms_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*PurchaseToWmsRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_purchase_wms_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*PurchaseToWmsResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_purchase_wms_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*UpdatePurchaseStatusRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_purchase_wms_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*UpdatePurchaseStatusResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_purchase_wms_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetSupplierListByProductIdRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_purchase_wms_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SupplierList); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_purchase_wms_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetSupplierListByProductIdResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_purchase_wms_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CreatePurchaseByWmsRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_purchase_wms_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CreatePurchaseByWmsResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_purchase_wms_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 10,
+ NumExtensions: 0,
+ NumServices: 1,
+ },
+ GoTypes: file_purchase_wms_proto_goTypes,
+ DependencyIndexes: file_purchase_wms_proto_depIdxs,
+ MessageInfos: file_purchase_wms_proto_msgTypes,
+ }.Build()
+ File_purchase_wms_proto = out.File
+ file_purchase_wms_proto_rawDesc = nil
+ file_purchase_wms_proto_goTypes = nil
+ file_purchase_wms_proto_depIdxs = nil
+}
diff --git a/proto/purchase_wms/purchase_wms_grpc.pb.go b/proto/purchase_wms/purchase_wms_grpc.pb.go
new file mode 100644
index 0000000..bab2cda
--- /dev/null
+++ b/proto/purchase_wms/purchase_wms_grpc.pb.go
@@ -0,0 +1,209 @@
+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
+
+package purchase_wms
+
+import (
+ context "context"
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+ status "google.golang.org/grpc/status"
+)
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+// Requires gRPC-Go v1.32.0 or later.
+const _ = grpc.SupportPackageIsVersion7
+
+// PurchaseServiceClient is the client API for PurchaseService service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+type PurchaseServiceClient interface {
+ PurchaseToWms(ctx context.Context, in *PurchaseToWmsRequest, opts ...grpc.CallOption) (*PurchaseToWmsResponse, error)
+ UpdatePurchaseStatus(ctx context.Context, in *UpdatePurchaseStatusRequest, opts ...grpc.CallOption) (*UpdatePurchaseStatusResponse, error)
+ GetSupplierListByProductId(ctx context.Context, in *GetSupplierListByProductIdRequest, opts ...grpc.CallOption) (*GetSupplierListByProductIdResponse, error)
+ CreatePurchaseByWms(ctx context.Context, in *CreatePurchaseByWmsRequest, opts ...grpc.CallOption) (*CreatePurchaseByWmsResponse, error)
+}
+
+type purchaseServiceClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewPurchaseServiceClient(cc grpc.ClientConnInterface) PurchaseServiceClient {
+ return &purchaseServiceClient{cc}
+}
+
+func (c *purchaseServiceClient) PurchaseToWms(ctx context.Context, in *PurchaseToWmsRequest, opts ...grpc.CallOption) (*PurchaseToWmsResponse, error) {
+ out := new(PurchaseToWmsResponse)
+ err := c.cc.Invoke(ctx, "/PurchaseService/PurchaseToWms", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *purchaseServiceClient) UpdatePurchaseStatus(ctx context.Context, in *UpdatePurchaseStatusRequest, opts ...grpc.CallOption) (*UpdatePurchaseStatusResponse, error) {
+ out := new(UpdatePurchaseStatusResponse)
+ err := c.cc.Invoke(ctx, "/PurchaseService/UpdatePurchaseStatus", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *purchaseServiceClient) GetSupplierListByProductId(ctx context.Context, in *GetSupplierListByProductIdRequest, opts ...grpc.CallOption) (*GetSupplierListByProductIdResponse, error) {
+ out := new(GetSupplierListByProductIdResponse)
+ err := c.cc.Invoke(ctx, "/PurchaseService/GetSupplierListByProductId", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *purchaseServiceClient) CreatePurchaseByWms(ctx context.Context, in *CreatePurchaseByWmsRequest, opts ...grpc.CallOption) (*CreatePurchaseByWmsResponse, error) {
+ out := new(CreatePurchaseByWmsResponse)
+ err := c.cc.Invoke(ctx, "/PurchaseService/CreatePurchaseByWms", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// PurchaseServiceServer is the server API for PurchaseService service.
+// All implementations must embed UnimplementedPurchaseServiceServer
+// for forward compatibility
+type PurchaseServiceServer interface {
+ PurchaseToWms(context.Context, *PurchaseToWmsRequest) (*PurchaseToWmsResponse, error)
+ UpdatePurchaseStatus(context.Context, *UpdatePurchaseStatusRequest) (*UpdatePurchaseStatusResponse, error)
+ GetSupplierListByProductId(context.Context, *GetSupplierListByProductIdRequest) (*GetSupplierListByProductIdResponse, error)
+ CreatePurchaseByWms(context.Context, *CreatePurchaseByWmsRequest) (*CreatePurchaseByWmsResponse, error)
+ mustEmbedUnimplementedPurchaseServiceServer()
+}
+
+// UnimplementedPurchaseServiceServer must be embedded to have forward compatible implementations.
+type UnimplementedPurchaseServiceServer struct {
+}
+
+func (UnimplementedPurchaseServiceServer) PurchaseToWms(context.Context, *PurchaseToWmsRequest) (*PurchaseToWmsResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method PurchaseToWms not implemented")
+}
+func (UnimplementedPurchaseServiceServer) UpdatePurchaseStatus(context.Context, *UpdatePurchaseStatusRequest) (*UpdatePurchaseStatusResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method UpdatePurchaseStatus not implemented")
+}
+func (UnimplementedPurchaseServiceServer) GetSupplierListByProductId(context.Context, *GetSupplierListByProductIdRequest) (*GetSupplierListByProductIdResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetSupplierListByProductId not implemented")
+}
+func (UnimplementedPurchaseServiceServer) CreatePurchaseByWms(context.Context, *CreatePurchaseByWmsRequest) (*CreatePurchaseByWmsResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method CreatePurchaseByWms not implemented")
+}
+func (UnimplementedPurchaseServiceServer) mustEmbedUnimplementedPurchaseServiceServer() {}
+
+// UnsafePurchaseServiceServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to PurchaseServiceServer will
+// result in compilation errors.
+type UnsafePurchaseServiceServer interface {
+ mustEmbedUnimplementedPurchaseServiceServer()
+}
+
+func RegisterPurchaseServiceServer(s grpc.ServiceRegistrar, srv PurchaseServiceServer) {
+ s.RegisterService(&PurchaseService_ServiceDesc, srv)
+}
+
+func _PurchaseService_PurchaseToWms_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(PurchaseToWmsRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(PurchaseServiceServer).PurchaseToWms(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/PurchaseService/PurchaseToWms",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(PurchaseServiceServer).PurchaseToWms(ctx, req.(*PurchaseToWmsRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _PurchaseService_UpdatePurchaseStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(UpdatePurchaseStatusRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(PurchaseServiceServer).UpdatePurchaseStatus(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/PurchaseService/UpdatePurchaseStatus",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(PurchaseServiceServer).UpdatePurchaseStatus(ctx, req.(*UpdatePurchaseStatusRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _PurchaseService_GetSupplierListByProductId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetSupplierListByProductIdRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(PurchaseServiceServer).GetSupplierListByProductId(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/PurchaseService/GetSupplierListByProductId",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(PurchaseServiceServer).GetSupplierListByProductId(ctx, req.(*GetSupplierListByProductIdRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _PurchaseService_CreatePurchaseByWms_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(CreatePurchaseByWmsRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(PurchaseServiceServer).CreatePurchaseByWms(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/PurchaseService/CreatePurchaseByWms",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(PurchaseServiceServer).CreatePurchaseByWms(ctx, req.(*CreatePurchaseByWmsRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// PurchaseService_ServiceDesc is the grpc.ServiceDesc for PurchaseService service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var PurchaseService_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "PurchaseService",
+ HandlerType: (*PurchaseServiceServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "PurchaseToWms",
+ Handler: _PurchaseService_PurchaseToWms_Handler,
+ },
+ {
+ MethodName: "UpdatePurchaseStatus",
+ Handler: _PurchaseService_UpdatePurchaseStatus_Handler,
+ },
+ {
+ MethodName: "GetSupplierListByProductId",
+ Handler: _PurchaseService_GetSupplierListByProductId_Handler,
+ },
+ {
+ MethodName: "CreatePurchaseByWms",
+ Handler: _PurchaseService_CreatePurchaseByWms_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "purchase_wms.proto",
+}
diff --git a/proto/purchase_wms/server.go b/proto/purchase_wms/server.go
new file mode 100644
index 0000000..1e1e099
--- /dev/null
+++ b/proto/purchase_wms/server.go
@@ -0,0 +1,108 @@
+package purchase_wms
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "github.com/shopspring/decimal"
+ "gorm.io/gorm"
+ "srm/global"
+ "srm/model/purchase"
+ "srm/model/test"
+ "time"
+)
+
+type Server struct {
+ UnimplementedPurchaseServiceServer
+}
+
+func (s *Server) UpdatePurchaseStatus(ctx context.Context, req *UpdatePurchaseStatusRequest) (*UpdatePurchaseStatusResponse, error) {
+ if req.Number == "" {
+ return nil, errors.New("閲囪喘缂栧彿涓嶈兘涓虹┖")
+ }
+ err := global.GVA_DB.Model(&purchase.Purchase{}).Where("number = ?", req.Number).
+ Updates(map[string]interface{}{"status": purchase.OrderStatusStored}).Error
+ return new(UpdatePurchaseStatusResponse), err
+}
+
+func (s *Server) GetSupplierListByProductId(ctx context.Context, req *GetSupplierListByProductIdRequest) (*GetSupplierListByProductIdResponse, error) {
+ if req.ProductId == "" {
+ return nil, errors.New("浜у搧缂栧彿涓嶈兘涓虹┖")
+ }
+ var products []test.SupplierMaterial
+ err := global.GVA_DB.Model(&test.SupplierMaterial{}).Where("number = ?", req.ProductId).Preload("Supplier").Find(&products).Error
+ if err != nil {
+ return nil, err
+ }
+ list := make([]*SupplierList, 0)
+ for _, product := range products {
+ if product.Supplier.Status != 1 {
+ continue
+ }
+ var sl SupplierList
+ sl.SupplierId = int64(product.SupplierId)
+ sl.SupplierName = product.Supplier.Name
+ sl.PurchasePrice = float32(product.PurchasePrice)
+ list = append(list, &sl)
+ }
+ resp := new(GetSupplierListByProductIdResponse)
+ resp.List = list
+ return resp, nil
+}
+
+func (s *Server) CreatePurchaseByWms(ctx context.Context, req *CreatePurchaseByWmsRequest) (*CreatePurchaseByWmsResponse, error) {
+ if req.SupplierId == 0 || req.ProductId == "" {
+ return nil, errors.New("渚涘簲鍟唅d鎴栦骇鍝乮d涓虹┖")
+ }
+ var pt purchase.PurchaseType
+ err := global.GVA_DB.Model(&purchase.PurchaseType{}).First(&pt).Error
+ if err != nil {
+ return nil, err
+ }
+ var product test.SupplierMaterial
+ err = global.GVA_DB.Model(&test.SupplierMaterial{}).Where("number = ? and supplier_id = ?", req.ProductId, req.SupplierId).First(&product).Error
+ if err != nil {
+ return nil, err
+ }
+
+ //閲囪喘鍗�
+ var purchaseRecord purchase.Purchase
+ purchaseRecord.PurchaseTypeId = int(pt.ID)
+ purchaseRecord.SupplierId = int(req.SupplierId)
+ purchaseRecord.OrderSource = "WMS鎺ㄩ��"
+ purchaseRecord.Name = "WMS琛ヨ揣"
+ purchaseRecord.ID = 0
+ purchaseRecord.Status = purchase.OrderStatusConfirmed
+ purchaseRecord.HandledBy = "admin"
+ purchaseRecord.Creator = "admin"
+ purchaseRecord.Number = fmt.Sprintf("CG%v", time.Now().Unix())
+ purchaseRecord.Principal = "admin"
+ purchaseRecord.OrderType = "閲囪喘璁㈠崟"
+ purchaseRecord.Quantity = decimal.NewFromInt(req.Amount)
+ purchaseRecord.TotalPrice = purchaseRecord.Quantity.Mul(decimal.NewFromFloat(product.PurchasePrice))
+ purchaseRecord.UnInvoiceAmount = purchaseRecord.TotalPrice
+ purchaseRecord.ShouldPayAmount = purchaseRecord.TotalPrice
+
+ //浜у搧
+ var pp purchase.PurchaseProducts
+ pp.ProductId = int(product.ID)
+ pp.Amount = purchaseRecord.Quantity
+ pp.Price = decimal.NewFromFloat(product.PurchasePrice)
+ pp.Total = purchaseRecord.TotalPrice
+ pp.Remark = "WMS琛ヨ揣"
+
+ err = global.GVA_DB.Transaction(func(tx *gorm.DB) error {
+ err = tx.Create(&purchaseRecord).Error
+ if err != nil {
+ return err
+ }
+ pp.PurchaseId = int(purchaseRecord.ID)
+ return tx.Create(&pp).Error
+ })
+ if err != nil {
+ return nil, err
+ }
+ resp := new(CreatePurchaseByWmsResponse)
+ resp.PurchaseNumber = purchaseRecord.Number
+ return resp, nil
+}
diff --git a/router/purchase/purchase.go b/router/purchase/purchase.go
index 5e8ba4f..34decce 100644
--- a/router/purchase/purchase.go
+++ b/router/purchase/purchase.go
@@ -14,7 +14,7 @@
purchaseRouter.DELETE("purchase/:id", PurchaseApi.DeletePurchase) // 鍒犻櫎閲囪喘鍗�
purchaseRouter.GET("purchase/:id", PurchaseApi.GetPurchase) // 鑾峰彇鍗曚竴閲囪喘鍗曚俊鎭�
purchaseRouter.GET("purchaseList", PurchaseApi.GetPurchaseList) // 鑾峰彇閲囪喘鍗曞垪琛�
- purchaseRouter.POST("submit/:id", PurchaseApi.Submit) // 鎻愪氦閲囪喘鍗�
+ purchaseRouter.POST("submit", PurchaseApi.Submit) // 鎻愪氦閲囪喘鍗�
purchaseRouter.POST("purchaseType", PurchaseApi.SavePurchaseType) // 淇濆瓨閲囪喘绫诲瀷
purchaseRouter.GET("purchaseTypeList", PurchaseApi.GetPurchaseTypeList) // 鏌ヨ閲囪喘绫诲瀷
}
diff --git a/service/purchase/purchase.go b/service/purchase/purchase.go
index 2a3a9cb..b8654f4 100644
--- a/service/purchase/purchase.go
+++ b/service/purchase/purchase.go
@@ -173,33 +173,33 @@
//@param: id uint
//@return: err error
-func (slf *PurchaseService) Submit(id uint) (err error) {
+func (slf *PurchaseService) Submit(id int, status purchase.OrderStatus) (err error) {
- purchaseData, err := slf.GetPurchase(id)
- if err != nil {
- return err
- }
- var targetStatus purchase.OrderStatus
- switch purchaseData.Status {
- case purchase.OrderStatusConfirmed:
- targetStatus = purchase.OrderStatusReceived
- case purchase.OrderStatusReceived:
- targetStatus = purchase.OrderStatusStored
- case purchase.OrderStatusStored:
- targetStatus = purchase.OrderStatusCompleted
- }
+ //purchaseData, err := slf.GetPurchase(id)
+ //if err != nil {
+ // return err
+ //}
+ //var targetStatus purchase.OrderStatus
+ //switch purchaseData.Status {
+ //case purchase.OrderStatusConfirmed:
+ // targetStatus = purchase.OrderStatusReceived
+ //case purchase.OrderStatusReceived:
+ // targetStatus = purchase.OrderStatusStored
+ //case purchase.OrderStatusStored:
+ // targetStatus = purchase.OrderStatusCompleted
+ //}
err = global.GVA_DB.Transaction(func(tx *gorm.DB) error {
- err = tx.Where("id = ?", id).Model(&purchase.Purchase{}).Updates(map[string]interface{}{"status": targetStatus}).Error
+ err = tx.Where("id = ?", id).Model(&purchase.Purchase{}).Updates(map[string]interface{}{"status": status}).Error
if err != nil {
return err
}
- switch targetStatus {
- case purchase.OrderStatusReceived:
- return SendInspect(purchaseData)
- case purchase.OrderStatusStored:
- case purchase.OrderStatusCompleted:
- }
+ //switch targetStatus {
+ //case purchase.OrderStatusReceived:
+ // return SendInspect(purchaseData)
+ //case purchase.OrderStatusStored:
+ //case purchase.OrderStatusCompleted:
+ //}
return nil
})
return err
--
Gitblit v1.8.0