From a6a6045065169ab56c7d44ea32dce743d940e840 Mon Sep 17 00:00:00 2001
From: jiangshuai <291802688@qq.com>
Date: 星期五, 08 十二月 2023 11:15:19 +0800
Subject: [PATCH] collection改为固定12345
---
controllers/reorder_rule_controller.go | 43 ++++++++++++++++++++-----------------------
1 files changed, 20 insertions(+), 23 deletions(-)
diff --git a/controllers/reorder_rule_controller.go b/controllers/reorder_rule_controller.go
index 13002bd..d1fce38 100644
--- a/controllers/reorder_rule_controller.go
+++ b/controllers/reorder_rule_controller.go
@@ -3,19 +3,16 @@
import (
"github.com/gin-gonic/gin"
"github.com/shopspring/decimal"
- "google.golang.org/grpc"
- "google.golang.org/grpc/credentials/insecure"
"gorm.io/gorm"
"strconv"
"strings"
"time"
- "wms/conf"
"wms/constvar"
"wms/extend/code"
"wms/extend/util"
"wms/models"
- "wms/pkg/logx"
"wms/pkg/timex"
+ "wms/proto/init_client"
"wms/proto/inventory_order"
"wms/proto/purchase_wms"
"wms/request"
@@ -260,22 +257,22 @@
util.ResponseFormat(c, code.Success, "鏇存柊鎴愬姛")
}
-var InventoryOrderServiceConn *grpc.ClientConn
-
-func InitInventoryOrderServiceConn() {
- var err error
- InventoryOrderServiceConn, err = grpc.Dial(conf.GrpcServerConf.ApsAddr, grpc.WithTransportCredentials(insecure.NewCredentials()))
- if err != nil {
- logx.Errorf("grpc dial product service error: %v", err.Error())
- return
- }
-}
-
-func CloseInventoryOrderServiceConn() {
- if InventoryOrderServiceConn != nil {
- InventoryOrderServiceConn.Close()
- }
-}
+//var InventoryOrderServiceConn *grpc.ClientConn
+//
+//func InitInventoryOrderServiceConn() {
+// var err error
+// InventoryOrderServiceConn, err = grpc.Dial(conf.GrpcServerConf.ApsAddr, grpc.WithTransportCredentials(insecure.NewCredentials()))
+// if err != nil {
+// logx.Errorf("grpc dial product service error: %v", err.Error())
+// return
+// }
+//}
+//
+//func CloseInventoryOrderServiceConn() {
+// if InventoryOrderServiceConn != nil {
+// InventoryOrderServiceConn.Close()
+// }
+//}
// OrderAgain
// @Tags 閲嶈璐ц鍒�
@@ -291,7 +288,7 @@
return
}
if params.Route == "閲囪喘" {
- client := purchase_wms.NewPurchaseServiceClient(PurchaseServiceConn)
+ client := purchase_wms.NewPurchaseServiceClient(init_client.SrmConn)
resp, err := client.GetSupplierListByProductId(c, &purchase_wms.GetSupplierListByProductIdRequest{ProductId: params.ProductId})
if err != nil {
util.ResponseFormat(c, code.RequestParamError, "grpc璋冪敤澶辫触")
@@ -300,7 +297,7 @@
util.ResponseFormat(c, code.Success, resp.List)
return
}
- client := inventory_order.NewInventoryOrderServiceClient(InventoryOrderServiceConn)
+ client := inventory_order.NewInventoryOrderServiceClient(init_client.ApsConn)
order, err := client.CreateNewOrder(c, &inventory_order.CreateNewOrderRequest{
OrderNumber: params.OrderNumber.IntPart(),
Unit: params.Unit,
@@ -368,7 +365,7 @@
// @Router /api-wms/v1/reorderRule/submitOrder [post]
func (slf ReorderRuleController) SubmitOrder(c *gin.Context) {
var params models.ReorderRule
- client := purchase_wms.NewPurchaseServiceClient(PurchaseServiceConn)
+ client := purchase_wms.NewPurchaseServiceClient(init_client.SrmConn)
resp, err := client.CreatePurchaseByWms(c, &purchase_wms.CreatePurchaseByWmsRequest{
SupplierId: params.SupplierId,
ProductId: params.ProductId,
--
Gitblit v1.8.0