From 7d4f02f6a8066018911d09bad42c5c540abaa66b Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期一, 11 三月 2024 15:18:29 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/aps/WMS
---
controllers/code.go | 55 +++++++++++++++++++++++++++++++------------------------
1 files changed, 31 insertions(+), 24 deletions(-)
diff --git a/controllers/code.go b/controllers/code.go
index f293bb3..eea0f4a 100644
--- a/controllers/code.go
+++ b/controllers/code.go
@@ -3,38 +3,37 @@
import (
"github.com/gin-gonic/gin"
"github.com/spf13/cast"
- "google.golang.org/grpc"
- "google.golang.org/grpc/credentials/insecure"
- "wms/conf"
+ "wms/constvar"
cd "wms/extend/code"
"wms/extend/util"
"wms/models"
"wms/pkg/contextx"
"wms/pkg/logx"
"wms/proto/code"
+ "wms/proto/init_client"
"wms/request"
)
type CodeApi struct{}
-var (
- codeServiceConn *grpc.ClientConn
-)
-
-func InitCodeServiceConn() {
- var err error
- codeServiceConn, 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 CloseCodeServiceConn() {
- if codeServiceConn != nil {
- codeServiceConn.Close()
- }
-}
+//var (
+// codeServiceConn *grpc.ClientConn
+//)
+//
+//func InitCodeServiceConn() {
+// var err error
+// codeServiceConn, 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 CloseCodeServiceConn() {
+// if codeServiceConn != nil {
+// codeServiceConn.Close()
+// }
+//}
// GetCodeList
//
@@ -54,7 +53,7 @@
params.CodeStandID = c.Query("codeStandID")
params.Name = c.Query("name")
params.Type = c.Query("type")
- client := code.NewCodeServiceClient(codeServiceConn)
+ client := code.NewCodeServiceClient(init_client.ApsConn)
list, err := client.GetCodeList(ctx.GetCtx(), &code.GetCodeListRequest{
Page: cast.ToInt32(params.Page),
PageSize: cast.ToInt32(params.PageSize),
@@ -89,9 +88,17 @@
id = 0
err error
)
- switch params.Type {
- case "鐗╂枡缂栫爜":
+ switch constvar.CodeStandardType(params.Type) {
+ case constvar.CodeStandardType_Material:
id, err = models.NewMaterialSearch().MaxAutoIncr()
+ case constvar.CodeStandardType_Incoming:
+ id, err = models.NewOperationSearch().SetBaseOperationType(constvar.BaseOperationTypeIncoming).MaxAutoIncr()
+ case constvar.CodeStandardType_Outgoing:
+ id, err = models.NewOperationSearch().SetBaseOperationType(constvar.BaseOperationTypeOutgoing).MaxAutoIncr()
+ case constvar.CodeStandardType_Internal:
+ id, err = models.NewOperationSearch().SetBaseOperationType(constvar.BaseOperationTypeInternal).MaxAutoIncr()
+ case constvar.CodeStandardType_Disuse:
+ id, err = models.NewOperationSearch().SetBaseOperationType(constvar.BaseOperationTypeDisuse).MaxAutoIncr()
default:
util.ResponseFormat(c, cd.RequestError, "缂栫爜瑙勫垯涓嶅瓨鍦�")
return
--
Gitblit v1.8.0