From 517824efcc6234df351d5be71127f438b6abf288 Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期六, 30 三月 2024 15:53:13 +0800
Subject: [PATCH] wms修改委外完成数量

---
 controllers/operation.go |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/controllers/operation.go b/controllers/operation.go
index 9ab5341..c585774 100644
--- a/controllers/operation.go
+++ b/controllers/operation.go
@@ -623,6 +623,7 @@
 	if operation.BaseOperationType == constvar.BaseOperationTypeIncoming {
 		if operation.Source != "" {
 			go UpdatePurchaseStatus(operation.Source, operation.SourceNumber)
+			go UpdateOutsourceOrder(operation.Source, operation.SourceNumber, operation.Id, listDetails)
 		}
 	} else if operation.BaseOperationType == constvar.BaseOperationTypeOutgoing {
 		if operation.Source != "" {
@@ -732,6 +733,28 @@
 	}
 }
 
+func UpdateOutsourceOrder(source, number string, operationId int, details []*models.OperationDetails) {
+	if source == "APS_OUTSOURCING_RECEIVE" {
+		products := make([]*inventory_order.OperationProduct, 0)
+		for _, detail := range details {
+			if operationId == detail.OperationID {
+				var op inventory_order.OperationProduct
+				op.ProductNumber = detail.ProductId
+				op.Amount = detail.Amount.IntPart()
+				products = append(products, &op)
+			}
+		}
+		cl := inventory_order.NewInventoryOrderServiceClient(init_client.ApsConn)
+		_, err := cl.UpdateOutsourceOrder(context.Background(), &inventory_order.UpdateOutsourceOrderRequest{
+			OutsourceNumber: number,
+			Products:        products,
+		})
+		if err != nil {
+			logx.Errorf("grpc dial UpdateOutsourceOrder service error: %v", err)
+		}
+	}
+}
+
 // ListTransfer
 // @Tags      鍏ュ簱/鍑哄簱
 // @Summary   搴撳瓨璋冩嫧鍒楄〃

--
Gitblit v1.8.0