From f3bc9d0a42aeb58b50050dd5ed9be9367cae755c Mon Sep 17 00:00:00 2001
From: 王 垚 <1402714037@qq.com>
Date: 星期三, 06 四月 2022 14:49:35 +0800
Subject: [PATCH] 1111

---
 .gitignore                                |    3 
 WebAPI/Controllers/POInStockController.cs |   17 ++-
 WebAPI/WebAPI.csproj                      |    2 
 WebAPI/Controllers/BarCodeController.cs   |  238 +++++++++++++++++++++++++++--------------------
 4 files changed, 153 insertions(+), 107 deletions(-)

diff --git a/.gitignore b/.gitignore
index 4ce6fdd..2e55010 100644
--- a/.gitignore
+++ b/.gitignore
@@ -337,4 +337,5 @@
 .localhistory/
 
 # BeatPulse healthcheck temp database
-healthchecksdb
\ No newline at end of file
+healthchecksdb
+/WebAPI/Vlog
diff --git a/WebAPI/Controllers/BarCodeController.cs b/WebAPI/Controllers/BarCodeController.cs
index cb634eb..fce728a 100644
--- a/WebAPI/Controllers/BarCodeController.cs
+++ b/WebAPI/Controllers/BarCodeController.cs
@@ -44,7 +44,8 @@
             try
             {
                 SQLHelper.ClsCNSRM oCn = new SQLHelper.ClsCNSRM();
-                oCn.RunProc("exec H_p_SRM_BarCodeBill_PrintQty '" + msg1 + "'");
+                string sql = $"Update Gy_BarCodeBill set HPrintQty=isnull(HPrintQty,0) + 1  where HItemID in ({msg1})";
+                oCn.RunProc(sql);
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
                 objJsonResult.Message = "鏇存柊鎵撳嵃娆℃暟鎴愬姛锛�";
@@ -1325,36 +1326,36 @@
                 List<Model.ClsGy_BarCodeBill_WMS_Model> ls3 = new List<Model.ClsGy_BarCodeBill_WMS_Model>();
                 ls = oListModels.getObjectByJson_MaterialList(msg3);
 
-                foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls)
-                {
-                    if (oBill.CheckBarCode(oItemSub.HSourceInterID, oItemSub.HSourceEntryID) == false)
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "宸插瓨鍦ㄦ潯鐮侊紝涓嶅厑璁搁噸澶嶇敓鎴愶紒";
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
-                    if (msg2 != string.Empty)
-                    {
-                        if (oItemSub.HBQty == 0 || oItemSub.HMinQty == 0)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "鍐呯鍖呰鏁颁笉鑳戒负0锛�";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        if (oItemSub.HWBQty == 0 || oItemSub.HWXQty == 0)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "澶栫鍖呰鏁颁笉鑳戒负0锛�";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                    }
-                }
+                //foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls)
+                //{
+                //    if (oBill.CheckBarCode(oItemSub.HSourceInterID, oItemSub.HSourceEntryID) == false)
+                //    {
+                //        objJsonResult.code = "0";
+                //        objJsonResult.count = 0;
+                //        objJsonResult.Message = "宸插瓨鍦ㄦ潯鐮侊紝涓嶅厑璁搁噸澶嶇敓鎴愶紒";
+                //        objJsonResult.data = null;
+                //        return objJsonResult;
+                //    }
+                //    if (msg2 != string.Empty)
+                //    {
+                //        if (oItemSub.HBQty == 0 || oItemSub.HMinQty == 0)
+                //        {
+                //            objJsonResult.code = "0";
+                //            objJsonResult.count = 0;
+                //            objJsonResult.Message = "鍐呯鍖呰鏁颁笉鑳戒负0锛�";
+                //            objJsonResult.data = null;
+                //            return objJsonResult;
+                //        }
+                //        if (oItemSub.HWBQty == 0 || oItemSub.HWXQty == 0)
+                //        {
+                //            objJsonResult.code = "0";
+                //            objJsonResult.count = 0;
+                //            objJsonResult.Message = "澶栫鍖呰鏁颁笉鑳戒负0锛�";
+                //            objJsonResult.data = null;
+                //            return objJsonResult;
+                //        }
+                //    }
+                //}
                 long linterid = Pub_Class.ClsPub.CreateBillID_SRMProd("8888", ref DBUtility.ClsPub.sExeReturnInfo);
                 int LSHlen = 6;             //娴佹按鍙烽暱搴�
                 int SumLen = 10;            //鎬婚暱搴�
@@ -1377,6 +1378,9 @@
                 LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
                 foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls)
                 {
+                    //鏁伴噺涓�0 璺宠繃
+                    if (oItemSub.HQty == 0)
+                        continue;
                     if (ClsPub.isLong(oItemSub.HMaterID) != 0)
                     {
                         HNumber = oItemSub.HMaterID.ToString();
@@ -1388,8 +1392,8 @@
                         HSumQty = ClsPub.isDoule(oItemSub.HQty);  //浜у搧鏁伴噺
                         for (int i = 0; i < HBQty; i++)
                         {
-                            //  瀹夌憺鏉$爜瑙勫垯锛氱墿鏂欑紪鐮侊紙绯荤粺浠e叆锛堾鐗╂枡鍚嶇О锛堢郴缁熶唬鍏ワ級@瑙勬牸鍨嬪彿锛堢郴缁熶唬鍏ワ級@鐢熶骇鏃ユ湡锛堟墜宸ヨ緭鍏ワ級@鏁伴噺锛堟墜宸ヨ緭鍏ワ級@澶辨晥鏃ユ湡锛堟墜宸ヨ緭鍏ワ級@鎵规鍙凤紙鎵嬪伐浠e叆锛堾渚涘簲鍟嗗悕绉帮紙绯荤粺浠e叆锛堾閲囪喘璁㈠崟鍙凤紙绯荤粺浠e叆锛�
-                            TM = $"{oItemSub.HMaterNumber}@{oItemSub.HMaterName}@{oItemSub.HMaterModel}@{oItemSub.HKFDate}@{oItemSub.HQty}@{oItemSub.HKFDQDate}@{oItemSub.HBatchNo}@{oItemSub.HSupName}@{oItemSub.HSourceBillNo}";
+                            ////  瀹夌憺鏉$爜瑙勫垯锛氱墿鏂欑紪鐮侊紙绯荤粺浠e叆锛堾鐗╂枡鍚嶇О锛堢郴缁熶唬鍏ワ級@瑙勬牸鍨嬪彿锛堢郴缁熶唬鍏ワ級@鐢熶骇鏃ユ湡锛堟墜宸ヨ緭鍏ワ級@鏁伴噺锛堟墜宸ヨ緭鍏ワ級@澶辨晥鏃ユ湡锛堟墜宸ヨ緭鍏ワ級@鎵规鍙凤紙鎵嬪伐浠e叆锛堾渚涘簲鍟嗗悕绉帮紙绯荤粺浠e叆锛堾閲囪喘璁㈠崟鍙凤紙绯荤粺浠e叆锛�
+                            //TM = $"{oItemSub.HMaterNumber}@{oItemSub.HMaterName}@{oItemSub.HMaterModel}@{oItemSub.HKFDate}@{oItemSub.HQty}@{oItemSub.HKFDQDate}@{oItemSub.HBatchNo}@{oItemSub.HSupName}@{oItemSub.HSourceBillNo}";
 
                             if (HSumQty - HMinQty > 0)
                             {
@@ -1409,7 +1413,10 @@
                                 HMinQty = HSumQty;
                             }
 
+                            //  瀹夌憺鏉$爜瑙勫垯锛氱墿鏂欑紪鐮侊紙绯荤粺浠e叆锛堾鐗╂枡鍚嶇О锛堢郴缁熶唬鍏ワ級@瑙勬牸鍨嬪彿锛堢郴缁熶唬鍏ワ級@鐢熶骇鏃ユ湡锛堟墜宸ヨ緭鍏ワ級@鏁伴噺锛堟墜宸ヨ緭鍏ワ級@澶辨晥鏃ユ湡锛堟墜宸ヨ緭鍏ワ級@鎵规鍙凤紙鎵嬪伐浠e叆锛堾渚涘簲鍟嗗悕绉帮紙绯荤粺浠e叆锛堾閲囪喘璁㈠崟鍙凤紙绯荤粺浠e叆锛�
+                            TM = $"{oItemSub.HMaterNumber}@{oItemSub.HMaterName}@{oItemSub.HMaterModel}@{oItemSub.HKFDate}@{HMinQty}@{oItemSub.HKFDQDate}@{oItemSub.HBatchNo}@{oItemSub.HSupName}@{oItemSub.HSourceBillNo}";
                             Model.ClsGy_BarCodeBill_WMS_Model bar = new Model.ClsGy_BarCodeBill_WMS_Model();
+
                             bar.HBarCode = TM;
                             bar.HMaterID = oItemSub.HMaterID;
                             //bar.HMaterNumber = oItemSub.HMaterNumber;
@@ -1446,6 +1453,7 @@
                         int SumLen2 = 4;
                         string TM2 = "";
                         double HWXQty = 0;
+                        double HBarcodeQty = ClsPub.isDoule(oItemSub2.HQty);
 
                         LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]) + 1;
                         //
@@ -1497,10 +1505,7 @@
                                 TM2 = "0" + TM2;
                             }
                             bar2.HMaterID = oItemSub2.HMaterID;
-
-
-                            bar2.HBarCode = oItemSub2.HBarCode + "-" + TM2;
-
+                            bar2.HBarCode = oItemSub2.HBarCode.Replace(HBarcodeQty.ToString(), HWXQty.ToString());
                             bar2.HUnitID = oItemSub2.HUnitID;
                             bar2.HQty = HWXQty;
                             bar2.HBatchNo = DBUtility.ClsPub.isStrNull(oItemSub2.HBatchNo);
@@ -1537,72 +1542,100 @@
                 string HWei = "";
                 string HMTONO = "";
                 oCn.BeginTran();
-                int count = 1;
-                foreach (Model.ClsGy_BarCodeBill_WMS_Model oItemSub in ls2)
+                //鏇存柊閲囪喘璁㈠崟鏉$爜鏁伴噺
+                foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls)
                 {
-                    if (ClsPub.isLong(oItemSub.HMaterID) != 0)
+                    //鏁伴噺涓�0 璺宠繃
+                    if (oItemSub.HQty == 0)
+                        continue;
+                    //鏇存柊 宸叉墦鍗版暟閲�
+                    if (oItemSub.HSourceBillType == "1102")
+                        oCn.RunProc($"update Cg_POOrderBillSub set  HBarcodeCount= isnull(HBarcodeCount,0) + {oItemSub.HQty } where HInterID={oItemSub.HSourceInterID} and HEntryID = {oItemSub.HSourceEntryID}");
+                    if (oItemSub.HSourceBillType == "1601")
+                        oCn.RunProc($"update WW_EntrustOrderBillSub  set  HBarcodeCount= isnull(HBarcodeCount,0) + {oItemSub.HQty } where HInterID={oItemSub.HSourceInterID} and HEntryID = {oItemSub.HSourceEntryID}");
+                    //鏇存柊鏉$爜妗f 璇ユ簮鍗曞叾瀹冩潯鐮侀粯璁ゅ凡缁忔墦鍗拌繃涓�娆�
+                    oCn.RunProc($"update Gy_BarCodeBill set  HPrintQty += 1   where HPrintQty = 0 and  HSourceInterID={oItemSub.HSourceInterID} and HSourceEntryID = {oItemSub.HSourceEntryID}");
+                }
+                //澶栫
+                var oItemSubGroup = ls2.GroupBy(x => new { x.HSourceEntryID }).Select(y => new Model.ClsGy_BarCodeBill_WMS_Model { HSourceEntryID = y.Key.HSourceEntryID });
+                foreach (var oitem in oItemSubGroup)
+                {
+                    var SubModel = ls2.Where(x => x.HSourceEntryID == oitem.HSourceEntryID).ToList();
+                    int count = 1;
+                    foreach (var oItemSub in SubModel)
                     {
-                        HBarCode = oItemSub.HBarCode.ToString();
-                        HMTONO = ClsPub.isStrNull(oItemSub.HMTONO);
-                        HBarCodeType = "绠卞彿鏉$爜";
-                        HMaterID = ClsPub.isLong(oItemSub.HMaterID);
-                        HUnitID = ClsPub.isLong(oItemSub.HUnitID);
-                        HQty2 = ClsPub.isDoule(oItemSub.HQty);
-                        HBatchNo = ClsPub.isStrNull(oItemSub.HBatchNo);
-                        HSupID = oItemSub.HSupID;
-                        HKFPeriod = ClsPub.isInt(oItemSub.HKFPeriod);
-                        HKFDate = ClsPub.isStrNull(oItemSub.HKFDate);
-                        HKFDQDate = ClsPub.isStrNull(oItemSub.HKFDQDate);
-                        HSourceInterID = ClsPub.isLong(oItemSub.HSourceInterID);
-                        HSourceEntryID = ClsPub.isLong(oItemSub.HSourceEntryID);
-                        HSourceBillNo = ClsPub.isStrNull(oItemSub.HSourceBillNo);
-                        HSourceBillType = ClsPub.isStrNull(oItemSub.HSourceBillType);
-                        HWei = ClsPub.isStrNull(oItemSub.HEndQty);
 
-                        string sql = "insert into Gy_BarCodeBill (HInterID,HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HKFDate,HKFPeriod,HKFDQDate" +
-                                    ",HBatchNo,HBarcodeQtys,HBarcodeNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HEndQty,HSupflag" +
-                                    ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HMTONO " +
-                                    ") values ("
-                                    + linterid.ToString() + ",'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID + "," + HUnitID + "," + HQty2 + ",'" + HKFDate + "'," + HKFPeriod + ",'" + HKFDQDate
-                                    + "','" + HBatchNo + "','" + ls2.Count + "','" + count + "'," + HSupID + "," + HGroupID + ",'" + ClsPub.CurUserName + "','" + DateTime.Today + "'," + HPrintQty + ",'" + HWei + "',1"
-                                    + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "')";
-                        LogService.Write(sql);
-                        oCn.RunProc(sql);
-                        oCn.RunProc("exec setLSH '" + DateTime.Today + "'");
-                        count++;
+                        if (ClsPub.isLong(oItemSub.HMaterID) != 0)
+                        {
+                            HBarCode = oItemSub.HBarCode.ToString();
+                            HMTONO = ClsPub.isStrNull(oItemSub.HMTONO);
+                            HBarCodeType = "绠卞彿鏉$爜";
+                            HMaterID = ClsPub.isLong(oItemSub.HMaterID);
+                            HUnitID = ClsPub.isLong(oItemSub.HUnitID);
+                            HQty2 = ClsPub.isDoule(oItemSub.HQty);
+                            HBatchNo = ClsPub.isStrNull(oItemSub.HBatchNo);
+                            HSupID = oItemSub.HSupID;
+                            HKFPeriod = ClsPub.isInt(oItemSub.HKFPeriod);
+                            HKFDate = ClsPub.isStrNull(oItemSub.HKFDate);
+                            HKFDQDate = ClsPub.isStrNull(oItemSub.HKFDQDate);
+                            HSourceInterID = ClsPub.isLong(oItemSub.HSourceInterID);
+                            HSourceEntryID = ClsPub.isLong(oItemSub.HSourceEntryID);
+                            HSourceBillNo = ClsPub.isStrNull(oItemSub.HSourceBillNo);
+                            HSourceBillType = ClsPub.isStrNull(oItemSub.HSourceBillType);
+                            HWei = ClsPub.isStrNull(oItemSub.HEndQty);
+
+                            string sql = "insert into Gy_BarCodeBill (HInterID,HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HKFDate,HKFPeriod,HKFDQDate" +
+                                        ",HBatchNo,HBarcodeQtys,HBarcodeNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HEndQty,HSupflag" +
+                                        ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HMTONO " +
+                                        ") values ("
+                                        + linterid.ToString() + ",'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID + "," + HUnitID + "," + HQty2 + ",'" + HKFDate + "'," + HKFPeriod + ",'" + HKFDQDate
+                                        + "','" + HBatchNo + "','" + SubModel.Count + "','" + count + "'," + HSupID + "," + HGroupID + ",'" + ClsPub.CurUserName + "','" + DateTime.Today + "'," + HPrintQty + ",'" + HWei + "',1"
+                                        + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "')";
+                            LogService.Write(sql);
+                            oCn.RunProc(sql);
+                            oCn.RunProc("exec setLSH '" + DateTime.Today + "'");
+                            count++;
+                        }
                     }
                 }
-                int _count = 1;
-                foreach (Model.ClsGy_BarCodeBill_WMS_Model oItemSub in ls3)
+
+                //鍐呯
+                var _oItemSubGroup = ls3.GroupBy(x => new { x.HSourceEntryID }).Select(y => new Model.ClsGy_BarCodeBill_WMS_Model { HSourceEntryID = y.Key.HSourceEntryID });
+                foreach (var oitem in _oItemSubGroup)
                 {
-                    if (ClsPub.isLong(oItemSub.HMaterID) != 0)
+                    var SubModel = ls3.Where(x => x.HSourceEntryID == oitem.HSourceEntryID).ToList();
+                    int _count = 1;
+                    foreach (var oItemSub in SubModel)
                     {
-                        HBarCode = oItemSub.HBarCode.ToString();
-                        HMTONO = ClsPub.isStrNull(oItemSub.HMTONO);
-                        HBarCodeType = "绠卞彿鍐呮潯鐮�";
-                        HMaterID = ClsPub.isLong(oItemSub.HMaterID);
-                        HUnitID = ClsPub.isLong(oItemSub.HUnitID);
-                        HQty2 = ClsPub.isDoule(oItemSub.HQty);
-                        HBatchNo = ClsPub.isStrNull(oItemSub.HBatchNo);
-                        HSupID = oItemSub.HSupID;
-                        HKFPeriod = ClsPub.isInt(oItemSub.HKFPeriod);
-                        HKFDate = ClsPub.isStrNull(oItemSub.HKFDate);
-                        HKFDQDate = ClsPub.isStrNull(oItemSub.HKFDQDate);
-                        HSourceInterID = ClsPub.isLong(oItemSub.HSourceInterID);
-                        HSourceEntryID = ClsPub.isLong(oItemSub.HSourceEntryID);
-                        HSourceBillNo = ClsPub.isStrNull(oItemSub.HSourceBillNo);
-                        HSourceBillType = ClsPub.isStrNull(oItemSub.HSourceBillType);
-                        HWei = ClsPub.isStrNull(oItemSub.HEndQty);
-                        string sql = "insert into Gy_BarCodeBill (HInterID,HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HKFDate,HKFPeriod,HKFDQDate" +
-                                  ",HBatchNo,HBarcodeQtys,HBarcodeNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HEndQty,HSupflag" +
-                                  ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HMTONO " +
-                                  ") values ("
-                                  + linterid.ToString() + ",'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID + "," + HUnitID + "," + HQty2 + ",'" + HKFDate + "'," + HKFPeriod + ",'" + HKFDQDate
-                                  + "','" + HBatchNo + "','" + ls3.Count + "','" + _count + "'," + HSupID + "," + HGroupID + ",'" + ClsPub.CurUserName + "','" + DateTime.Today + "'," + HPrintQty + ",'" + HWei + "',1"
-                                  + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "')";
-                        LogService.Write(sql);
-                        oCn.RunProc(sql);
-                        _count++;
+                        if (ClsPub.isLong(oItemSub.HMaterID) != 0)
+                        {
+                            HBarCode = oItemSub.HBarCode.ToString();
+                            HMTONO = ClsPub.isStrNull(oItemSub.HMTONO);
+                            HBarCodeType = "绠卞彿鍐呮潯鐮�";
+                            HMaterID = ClsPub.isLong(oItemSub.HMaterID);
+                            HUnitID = ClsPub.isLong(oItemSub.HUnitID);
+                            HQty2 = ClsPub.isDoule(oItemSub.HQty);
+                            HBatchNo = ClsPub.isStrNull(oItemSub.HBatchNo);
+                            HSupID = oItemSub.HSupID;
+                            HKFPeriod = ClsPub.isInt(oItemSub.HKFPeriod);
+                            HKFDate = ClsPub.isStrNull(oItemSub.HKFDate);
+                            HKFDQDate = ClsPub.isStrNull(oItemSub.HKFDQDate);
+                            HSourceInterID = ClsPub.isLong(oItemSub.HSourceInterID);
+                            HSourceEntryID = ClsPub.isLong(oItemSub.HSourceEntryID);
+                            HSourceBillNo = ClsPub.isStrNull(oItemSub.HSourceBillNo);
+                            HSourceBillType = ClsPub.isStrNull(oItemSub.HSourceBillType);
+                            HWei = ClsPub.isStrNull(oItemSub.HEndQty);
+                            string sql = "insert into Gy_BarCodeBill (HInterID,HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HKFDate,HKFPeriod,HKFDQDate" +
+                                      ",HBatchNo,HBarcodeQtys,HBarcodeNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HEndQty,HSupflag" +
+                                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HMTONO " +
+                                      ") values ("
+                                      + linterid.ToString() + ",'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID + "," + HUnitID + "," + HQty2 + ",'" + HKFDate + "'," + HKFPeriod + ",'" + HKFDQDate
+                                      + "','" + HBatchNo + "','" + SubModel.Count + "','" + _count + "'," + HSupID + "," + HGroupID + ",'" + ClsPub.CurUserName + "','" + DateTime.Today + "'," + HPrintQty + ",'" + HWei + "',1"
+                                      + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "')";
+                            LogService.Write(sql);
+                            oCn.RunProc(sql);
+                            _count++;
+                        }
                     }
                 }
                 //鏆傛椂鍙洖濉叧鑱旀暟閲�
@@ -1741,18 +1774,23 @@
             SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
             try
             {
-                string sql = "select HBarCode from Gy_BarCodeBill where  HItemID in(" + HInterID + ") ";
+                string sql = "select 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];
                 if (dt.Rows.Count > 0)
                 {
                     foreach (DataRow dr in dt.Rows)
                     {
-                        WebAPIController.Add_Log("鏉$爜妗f鍒犻櫎", HUserName, "鍗曞彿" + dr["HBarCode"].ToString()); ;
+                        WebAPIController.Add_Log("鏉$爜妗f鍒犻櫎", HUserName, "鍗曞彿" + dr["HBarCode"].ToString());
+                        //鍙嶅啓鎵撳嵃鏁伴噺鍒伴噰璐鍗曞瓙琛�
+                        if (dr["HBarCodeType"].ToString() == "绠卞彿鍐呮潯鐮�" && dr["HSourceBillType"].ToString() == "1102")
+                            oCN.RunProc($"update Cg_POOrderBillSub set HBarcodeCount -= {dr["HQty"]} where  HInterID ={dr["HSourceInterID"]} and  HEntryID ={dr["HSourceEntryID"]}");
+                        //鍙嶅啓鎵撳嵃鏁伴噺鍒板澶栬鍗�
+                        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"]}");
                     }
                 }
-                oCN.BeginTran();
-                //LogService.Write("Delete From Gy_BarCodeBill where HItemID in(" + HInterID + ")") ;
                 oCN.RunProc("Delete From Gy_BarCodeBill where HItemID in(" + HInterID + ") ");
                 oCN.Commit();
                 objJsonResult.code = "1";
diff --git a/WebAPI/Controllers/POInStockController.cs b/WebAPI/Controllers/POInStockController.cs
index cf532bf..464f640 100644
--- a/WebAPI/Controllers/POInStockController.cs
+++ b/WebAPI/Controllers/POInStockController.cs
@@ -394,8 +394,13 @@
                 bool bResult;
                 if (oBill.omodel.HInterID == 0)
                 {
+                    LogService.Write("淇濆瓨娴嬭瘯1");
+                    LogService.Write("model:"+ oBill.omodel);
                     // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                     bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                    LogService.Write("娴嬭瘯闂"+ DBUtility.ClsPub.sExeReturnInfo);
+                    LogService.Write("淇濆瓨娴嬭瘯2");
+
                 }
                 else
                 {
@@ -421,6 +426,8 @@
             }
             catch (Exception e)
             {
+                LogService.Write("鎶涘嚭寮傚父:" + e.Message.ToString());
+
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
                 objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
@@ -846,11 +853,11 @@
             try
             {
                 DAL.ClsCg_POInStockBill oBill = new DAL.ClsCg_POInStockBill();
-                //鍏堝垹闄� 閲戣澏鏁版嵁
-                objjson = DeleteKingDee(HInterID);
-                //LogService.Write(objjson.ToString());
-                if (objjson.code == "0")
-                    return objjson;
+                ////鍏堝垹闄� 閲戣澏鏁版嵁
+                //objjson = DeleteKingDee(HInterID);
+                ////LogService.Write(objjson.ToString());
+                //if (objjson.code == "0")
+                //    return objjson;
 
                 WebAPIController.Add_Log("閫佽揣鍗曞垹闄�", HUserName, "閫佽揣鍗曞垹闄わ紝鍗曞彿锛�" + HBillNo);
                 oCN.BeginTran();
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index fabc815..5925d3d 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -92,7 +92,7 @@
     </Reference>
     <Reference Include="Model, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\SRM-MES\SRM-MES\DAL\bin\Debug\Model.dll</HintPath>
+      <HintPath>DLL\Model.dll</HintPath>
     </Reference>
     <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>

--
Gitblit v1.9.1