From cac7dffbf8189bd6f316339c032cbb9519eb7c6f Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期三, 22 三月 2023 13:24:35 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/Sc_GroupOrderBillController.cs |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/WebAPI/Controllers/Sc_GroupOrderBillController.cs b/WebAPI/Controllers/Sc_GroupOrderBillController.cs
index 8b22ef6..dc01ad6 100644
--- a/WebAPI/Controllers/Sc_GroupOrderBillController.cs
+++ b/WebAPI/Controllers/Sc_GroupOrderBillController.cs
@@ -101,7 +101,7 @@
             string msg1 = _value.ToString();
             try
             {
-                //濮斿宸ュ簭鍙戝嚭鍙嶅簭鍒楀寲
+                //缁勬墭鍗曞弽搴忓垪鍖�
                 msg1 = "[" + msg1.ToString() + "]";
                 List<GroupOrderBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GroupOrderBill>>(msg1);
                 //鑾峰彇骞存湀鏃ュ苟鎷兼帴鎴愬瓧绗︿覆
@@ -115,6 +115,16 @@
                 string HMaker = list[0].HMaker;//鍒跺崟浜�
                 string HBatchNo = list[0].HBatchNo;//鍏ュ簱鎵规
                 string HBarCode_Cus = list[0].HBarCode_Cus;//瀹㈡埛鏍囩锛堥粦鏍囧彿锛�
+                //鏍¢獙榛戞爣鍙峰敮涓�鎬�
+                ds= oCN.RunProcReturn($"select * from Sc_PackUnionBillMain where HBarCode_Cus ='{HBarCode_Cus}'", "Sc_PackUnionBillMain");
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = $"榛戞爣鍙穥HBarCode_Cus}宸插瓨鍦�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
                 //鐢熸垚鍞竴鏉$爜
                 ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + nowDate + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
                 oCN.RunProc("exec h_p_WMS_SetMaxNo '" + nowDate + "'");
@@ -140,6 +150,8 @@
                 oCN.RunProc("exec h_p_SaveGroupOrder " + HInterID + "");
                 //鏍规嵁瀛愯〃姹囨�荤敓鎴怱c_PackUnionBillSub_Sum琛ㄨ褰�
                 oCN.RunProc("exec h_p_Sc_PackUnionBill_SumSubBill " + HInterID + ",'','',''");
+                //鎻掑叆鏉$爜妗f琛�
+                oCN.RunProc("exec h_p_SaveGroupOrderCodeToGy_BarCodeBill " + HInterID + "");
                 oCN.Commit();
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
@@ -305,7 +317,7 @@
             try
             {
                 SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
-                oCn.RunProc("Delete from KF_PonderationBillMain_Temp where HBarCode = " + BarCode + " and HBillType = '2601'");
+                oCn.RunProc("Delete from KF_PonderationBillMain_Temp where HBarCode = '" + BarCode + "' and HBillType = '2601'");
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
@@ -336,6 +348,7 @@
             {
                 SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                 oCN.BeginTran();
+                oCn.RunProc("Delete from Sc_PackUnionBillMain where HInterID = " + HInterID);
                 oCn.RunProc("Delete from Sc_PackUnionBillSub where HInterID = " + HInterID + " and HEntryID = " + HEntryID);
                 //閲嶆柊鍒锋柊鏇存柊 姹囨�诲瓙琛� 鐨勮褰曞拰鏉$爜妗f
                 oCn.RunProc("Delete from Sc_PackUnionBillSub_Sum where HInterID = " + HInterID);
@@ -373,7 +386,7 @@
             try
             {
                 SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
-                oCn.RunProc("update Sc_PackUnionBillMain set HBarCode_Cus = " + HBarCode_Cus + " where HInterID = " + HInterID);
+                oCn.RunProc("update Sc_PackUnionBillMain set HBarCode_Cus = '" + HBarCode_Cus + "' where HInterID = " + HInterID);
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "淇敼鎴愬姛锛�";

--
Gitblit v1.9.1