From 3e9a709ecd0a8a739727cef65f3feb0ce8f4a090 Mon Sep 17 00:00:00 2001
From: 王 垚 <1402714037@qq.com>
Date: 星期四, 14 七月 2022 15:53:56 +0800
Subject: [PATCH] 优化

---
 WebAPI/Controllers/POInStockController.cs |    4 ++--
 WebAPI/Controllers/BarCodeController.cs   |   33 ++++++++++++++++++++-------------
 2 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/WebAPI/Controllers/BarCodeController.cs b/WebAPI/Controllers/BarCodeController.cs
index e0164a3..fe7c3b1 100644
--- a/WebAPI/Controllers/BarCodeController.cs
+++ b/WebAPI/Controllers/BarCodeController.cs
@@ -603,7 +603,7 @@
                                 HMinQty = HSumQty;
                             }
                             TM = $"{oItemSub.HMaterID}#{HMinQty}";
-                            
+
                             Model.ClsGy_BarCodeBill_WMS_Model bar = new Model.ClsGy_BarCodeBill_WMS_Model();
                             bar.HBarCode = TM;
                             bar.HMaterID = oItemSub.HMaterID;
@@ -756,14 +756,18 @@
                         HSourceBillNo = ClsPub.isStrNull(oItemSub.HSourceBillNo);
                         HSourceBillType = ClsPub.isStrNull(oItemSub.HSourceBillType);
                         HWei = ClsPub.isStrNull(oItemSub.HEndQty);
-                        oCn.RunProc("insert into Gy_BarCodeBill (HInterID,HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HKFDate,HKFPeriod,HKFDQDate" +
+                        string sql = "insert into Gy_BarCodeBill (HInterID,HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HKFDate,HKFPeriod,HKFDQDate" +
                                     ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HEndQty,HSupflag" +
                                     ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HMTONO " +
                                     ") values ("
                                     + linterid.ToString() + ",'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID + "," + HUnitID + "," + HQty2 + ",'" + HKFDate + "'," + HKFPeriod + ",'" + HKFDQDate
                                     + "','" + HBatchNo + "'," + HSupID + "," + HGroupID + ",'" + ClsPub.CurUserName + "','" + DateTime.Today + "'," + HPrintQty + ",'" + HWei + "',1"
-                                    + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "')");
-                        oCn.RunProc("exec setLSH '" + DateTime.Today + "'");
+                                    + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "')";
+                        oCn.RunProc(sql);
+                        //LogService.Write(sql);
+                        sql = "exec setLSH '" + DateTime.Today + "'";
+                        oCn.RunProc(sql);
+                        //LogService.Write(sql);
                     }
                 }
                 foreach (Model.ClsGy_BarCodeBill_WMS_Model oItemSub in ls3)
@@ -787,17 +791,21 @@
                         HSourceBillNo = ClsPub.isStrNull(oItemSub.HSourceBillNo);
                         HSourceBillType = ClsPub.isStrNull(oItemSub.HSourceBillType);
                         HWei = ClsPub.isStrNull(oItemSub.HEndQty);
-                        oCn.RunProc("insert into Gy_BarCodeBill (HInterID,HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HKFDate,HKFPeriod,HKFDQDate" +
+                        string sql = "insert into Gy_BarCodeBill (HInterID,HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HKFDate,HKFPeriod,HKFDQDate" +
                                     ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HEndQty,HSupflag" +
                                     ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HMTONO " +
                                     ") values ("
                                     + linterid.ToString() + ",'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID + "," + HUnitID + "," + HQty2 + ",'" + HKFDate + "'," + HKFPeriod + ",'" + HKFDQDate
                                     + "','" + HBatchNo + "'," + HSupID + "," + HGroupID + ",'" + ClsPub.CurUserName + "','" + DateTime.Today + "'," + HPrintQty + ",'" + HWei + "',1"
-                                    + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "')");
+                                    + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "')";
+                        oCn.RunProc(sql);
+                        //LogService.Write(sql);
                     }
                 }
                 //鏆傛椂鍙洖濉叧鑱旀暟閲�
-                oCn.RunProc("exec H_p_SRM_BarCodeBill_Update_UpdateBillRelateData " + linterid.ToString());
+                string _sql = "exec H_p_SRM_BarCodeBill_Update_UpdateBillRelateData " + linterid.ToString();
+                //LogService.Write(_sql);
+                oCn.RunProc(_sql);
                 oCn.Commit();
 
             }
@@ -1561,7 +1569,6 @@
                 //鏆傛椂鍙洖濉叧鑱旀暟閲�
                 oCn.RunProc("exec H_p_SRM_BarCodeBill_Update_UpdateBillRelateData " + linterid.ToString());
                 oCn.Commit();
-
             }
             catch (Exception e)
             {
@@ -1694,7 +1701,7 @@
             SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
             try
             {
-                string sql = "select HBarCode,HSourceInterID,HSourceEntryID,HQty,HBarCodeType,HSourceBillType from Gy_BarCodeBill where  HItemID in(" + HInterID + ") ";
+                string sql = "select HItemID,HBarCode,HSourceInterID,HSourceEntryID,HQty,HBarCodeType,HSourceBillType from Gy_BarCodeBill where  HItemID in(" + HInterID + ") ";
                 //LogService.Write("鍒犻櫎sql:" + sql);
                 oCN.BeginTran();
                 DataTable dt = oCN.RunProcReturn(sql, "deleteTable").Tables[0];
@@ -1710,12 +1717,12 @@
                         if (dr["HBarCodeType"].ToString() == "绠卞彿鍐呮潯鐮�" && dr["HSourceBillType"].ToString() == "1601")
                             oCN.RunProc($"update WW_EntrustOrderBillSub set HBarcodeCount -= {dr["HQty"]} where  HInterID ={dr["HSourceInterID"]} and  HEntryID ={dr["HSourceEntryID"]}");
                         //鍙嶅啓鎵撳嵃鏁伴噺鍒伴�佽揣鍗� 锛堜笉闇�瑕佸弽鍐� 閫佽揣鍗曠洿鎺ユ槸鍏宠仈鏌ヨ鍙栫殑鏁伴噺 娌℃湁鍦ㄦ簮鍗曚笂鍋氫繚瀛橈級
-                        if (dr["HBarCodeType"].ToString() == "绠卞彿鍐呮潯鐮�" && dr["HSourceBillType"].ToString() == "1103")
-                            continue;
-                            //oCN.RunProc($"update WW_EntrustOrderBillSub set HBarcodeCount -= {dr["HQty"]} where  HInterID ={dr["HSourceInterID"]} and  HEntryID ={dr["HSourceEntryID"]}");
+                        if (dr["HSourceBillType"].ToString() == "1103")
+                            oCN.RunProc("Delete From Gy_BarCodeBill where HItemID in(" + dr["HItemID"] + ") ");
+                        //oCN.RunProc($"update WW_EntrustOrderBillSub set HBarcodeCount -= {dr["HQty"]} where  HInterID ={dr["HSourceInterID"]} and  HEntryID ={dr["HSourceEntryID"]}");
                     }
                 }
-                oCN.RunProc("Delete From Gy_BarCodeBill where HItemID in(" + HInterID + ") ");
+                //oCN.RunProc("Delete From Gy_BarCodeBill where HItemID in(" + HInterID + ") ");
                 oCN.Commit();
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
diff --git a/WebAPI/Controllers/POInStockController.cs b/WebAPI/Controllers/POInStockController.cs
index 70aab5e..fd86a81 100644
--- a/WebAPI/Controllers/POInStockController.cs
+++ b/WebAPI/Controllers/POInStockController.cs
@@ -759,7 +759,7 @@
                                 objjson.data = null;
                                 return objjson;
                             }
-                            LogService.Write("jsonRoot:" + jsonRoot.ToString());
+                            //LogService.Write("jsonRoot:" + jsonRoot.ToString());
                             var result = InvokeHelper.Save("PUR_ReceiveBill", jsonRoot.ToString());
                             //LogService.Write(result);
                             if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() == "TRUE")
@@ -911,7 +911,7 @@
                                 objjson.data = null;
                                 return objjson;
                             }
-                            LogService.Write("jsonRoot:" + jsonRoot.ToString());
+                            //LogService.Write("jsonRoot:" + jsonRoot.ToString());
                             var result = InvokeHelper.Save("PUR_ReceiveBill", jsonRoot.ToString());
                             //LogService.Write(result);
                             if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() == "TRUE")

--
Gitblit v1.9.1