From f45e4cb8045fe60f96f467dc4ea1e2ae57445712 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期三, 03 七月 2024 23:13:40 +0800
Subject: [PATCH] 默认位置parent_id为视图位置id

---
 main.go |   37 ++++++++++++++++++++++++++-----------
 1 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/main.go b/main.go
index d4a15c9..a2ea7c2 100644
--- a/main.go
+++ b/main.go
@@ -11,14 +11,16 @@
 	"syscall"
 	"time"
 	"wms/conf"
-	"wms/controllers"
 	"wms/models"
 	"wms/pkg/logx"
+	"wms/proto/init_client"
+	"wms/proto/inventory_order"
 	"wms/proto/product_inventory"
 	"wms/proto/purchase_wms"
-	"wms/proto/supplier"
 	"wms/router"
 	"wms/service"
+	"wms/task"
+	"wms/utils/dingtalkrobot"
 )
 
 func main() {
@@ -47,10 +49,12 @@
 	}
 	go shutdown(server)
 	//鍚姩grpc瀹㈡埛绔�
-	go controllers.InitInventoryOrderServiceConn()
-	go controllers.InitProductInventoryServiceConn()
-	go controllers.InitCodeServiceConn()
-	go supplier.InitConn()
+	//go controllers.InitInventoryOrderServiceConn()
+	//go controllers.InitProductInventoryServiceConn()
+	//go controllers.InitCodeServiceConn()
+	//go supplier.InitConn()
+	//go client.InitConn()
+	go init_client.InitClient()
 	//鍚姩grpc鏈嶅姟
 	go func() {
 		ln, err := net.Listen("tcp", ":"+conf.WebConf.GrpcPort)
@@ -58,11 +62,11 @@
 			logx.Errorf("grpc server init error: %v", err.Error())
 			panic(fmt.Sprintf("grpc server init error: %v", err.Error()))
 		}
-		fmt.Println("-----------鐩戝惉绔彛: ", conf.WebConf.GrpcPort)
 		s := grpc.NewServer()
 		//todo 娣诲姞鍏蜂綋鏈嶅姟
 		product_inventory.RegisterProductInventoryServiceServer(s, &product_inventory.Server{})
 		purchase_wms.RegisterPurchaseServiceServer(s, &purchase_wms.Server{})
+		inventory_order.RegisterInventoryOrderServiceServer(s, &inventory_order.Server{})
 		err = s.Serve(ln)
 		if err != nil {
 			logx.Errorf("grpc server init error: %v", err.Error())
@@ -72,6 +76,15 @@
 
 	go service.InitLocationReportData()
 	go service.InitHistoryReportData()
+
+	//瀹氭椂浠诲姟鍒濆鍖�
+	if err := task.Init(); err != nil {
+		logx.Errorf("task init error: %v", err.Error())
+		return
+	}
+
+	//閽夐拤鏈哄櫒浜哄垵濮嬪寲
+	dingtalkrobot.Init(conf.DingTalkConf.AlarmKey, conf.DingTalkConf.AlarmUrl)
 
 	logx.Error(server.ListenAndServe().Error())
 }
@@ -86,10 +99,12 @@
 	ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
 	defer cancel()
 
-	controllers.CloseInventoryOrderServiceConn()
-	controllers.CloseProductInventoryServiceConn()
-	controllers.CloseCodeServiceConn()
-	supplier.CloseConn()
+	//controllers.CloseInventoryOrderServiceConn()
+	//controllers.CloseProductInventoryServiceConn()
+	//controllers.CloseCodeServiceConn()
+	//supplier.CloseConn()
+	//client.CloseConn()
+	init_client.CloseClient()
 	// 鍏抽棴HTTP鏈嶅姟鍣�
 	if err := server.Shutdown(ctx); err != nil {
 		logx.Infof("鏈嶅姟浼橀泤閫�鍑哄け璐�: %v", err)

--
Gitblit v1.8.0