From db85ff8c932328047a89a317f4d77fba236daeed Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期日, 02 四月 2023 17:07:21 +0800
Subject: [PATCH] 生产条码添加校验,条码批量删除,

---
 WebAPI/DLL/DAL.dll                        |    0 
 WebAPI/Controllers/POInStockController.cs |   12 +++++++++---
 WebAPI/DLL/Model.dll                      |    0 
 WebAPI/Controllers/BarCodeController.cs   |   40 ++++++++++++++++++++++++++++++++++++++--
 4 files changed, 47 insertions(+), 5 deletions(-)

diff --git a/WebAPI/Controllers/BarCodeController.cs b/WebAPI/Controllers/BarCodeController.cs
index 78e0a18..381d0f1 100644
--- a/WebAPI/Controllers/BarCodeController.cs
+++ b/WebAPI/Controllers/BarCodeController.cs
@@ -1547,6 +1547,7 @@
                 List<Model.ClsGy_MaterialList_WMS_Model> ls = new List<Model.ClsGy_MaterialList_WMS_Model>();
                 List<Model.ClsGy_BarCodeBill_WMS_Model> ls2 = new List<Model.ClsGy_BarCodeBill_WMS_Model>();//澶栫model
                 List<Model.ClsGy_BarCodeBill_WMS_Model> ls3 = new List<Model.ClsGy_BarCodeBill_WMS_Model>();//鍐呯model
+
                 ls = oListModels.getObjectByJson_MaterialList(msg3);//鍒楄〃鏁版嵁model
 
                 long linterid = Pub_Class.ClsPub.CreateBillID_SRMProd("8888", ref DBUtility.ClsPub.sExeReturnInfo);
@@ -1567,6 +1568,7 @@
                 string WeiShu = ""; //灏炬暟
                 DataSet Ds;
                 SQLHelper.ClsCNSRM oCn = new SQLHelper.ClsCNSRM();
+                oCn.BeginTran();
                 Ds = oCn.RunProcReturn("exec GetLSH '" + DateTime.Today + "'", "GetLSH");
                 LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
                 foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls)
@@ -1641,6 +1643,32 @@
                             TM = $"{oItemSub.HMaterNumber}@{oItemSub.HMaterName}@{oItemSub.HMaterModel}@{oItemSub.HKFDate}@{HMinQty}@{oItemSub.HKFDQDate}@{oItemSub.HBatchNo.TrimStart().TrimEnd()}@{oItemSub.HSupName}@{oItemSub.HSourceBillNo}";
                             Model.ClsGy_BarCodeBill_WMS_Model bar = new Model.ClsGy_BarCodeBill_WMS_Model();
 
+                            var HBarCode_verify = TM.Split('@'); //鏍¢獙鏉$爜淇℃伅
+                            var HMaterNumber_verify = HBarCode_verify[0]; //鏍¢獙鐗╂枡缂栫爜
+                            var HMaterName_verify = HBarCode_verify[1]; //鏍¢獙鐗╂枡鍚嶇О
+                            var HMaterModel_verify = HBarCode_verify[2]; //鏍¢獙瑙勬牸鍨嬪彿
+                            var HSupName_verify = HBarCode_verify[7]; //鏍¢獙渚涘簲鍟�
+                            var HSourceBillNo_verify = HBarCode_verify[8]; //鏍¢獙閲囪喘璁㈠崟鍙�
+
+                            sql = $"select * from Gy_Material where HNumber = '{HMaterNumber_verify}' and HName = '{HMaterName_verify}' and HModel = '{HMaterModel_verify}'";
+                            DataSet verifyMatInfo = oCn.RunProcReturn(sql, "tables");
+
+                            sql = $"select * from Cg_POOrderBillMain where HBillNo = '{HSourceBillNo_verify}'";
+                            DataSet verifyBillInfo = oCn.RunProcReturn(sql, "tables");
+
+                            sql = $"select * from Gy_Supplier where HName = '{HSupName_verify}'";
+                            DataSet verifySupInfo = oCn.RunProcReturn(sql, "tables");
+
+                            if (verifyMatInfo.Tables[0].Rows.Count <= 0 || verifyBillInfo.Tables[0].Rows.Count <= 0 || verifySupInfo.Tables[0].Rows.Count <= 0)
+                            {
+                                oCn.RollBack();
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = $"鏉$爜淇℃伅鏍¢獙鍑洪敊锛岃閲嶆柊鐢熸垚鏉$爜";
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+
                             bar.HBarCode = TM;
                             bar.HMaterID = oItemSub.HMaterID;
                             //bar.HMaterNumber = oItemSub.HMaterNumber;
@@ -1667,6 +1695,7 @@
                         }
                     }
                 }
+                oCn.Commit();
                 foreach (Model.ClsGy_BarCodeBill_WMS_Model oItemSub2 in ls2)
                 {
                     if (ClsPub.isLong(oItemSub2.HMaterID) != 0)
@@ -2008,12 +2037,19 @@
         }
 
         [Route("DeltetBarCodeBill")]
-        [HttpGet]
-        public object DeltetBarCodeBill(string HInterID, string HUserName)
+        [HttpPost]
+        public object DeltetBarCodeBill([FromBody] JObject oData)
         {
             SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
             try
             {
+                var _value = oData["oData"].ToString();
+                string msg1 = _value.ToString();
+                string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+                string HInter = sArray[0].ToString();
+                string HInterID = HInter.Replace("\"", "");
+                string HUserName = sArray[1].ToString();
+
                 string FCusName = oSystemParameter.GetSingleSystemParameter("WMS_CampanyName", ref DBUtility.ClsPub.sExeReturnInfo);
                 string sql = "select HItemID,HBarCode,HSourceInterID,HSourceEntryID,HQty,HBarCodeType,HSourceBillType from Gy_BarCodeBill where  HItemID in(" + HInterID + ") ";
                 //LogService.Write("鍒犻櫎sql:" + sql);
diff --git a/WebAPI/Controllers/POInStockController.cs b/WebAPI/Controllers/POInStockController.cs
index 18a0b7a..02e9962 100644
--- a/WebAPI/Controllers/POInStockController.cs
+++ b/WebAPI/Controllers/POInStockController.cs
@@ -900,7 +900,8 @@
                                     return objjson;
                                 }
                                 //LogService.Write("jsonRoot:" + jsonRoot.ToString());
-                                var result = InvokeHelper.Save("PUR_ReceiveBill", jsonRoot.ToString());
+                                var result = InvokeHelper.Save("PUR_ReceiveBill", jsonRoot.ToString());                               
+
                                 //LogService.Write(result);
                                 if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() == "TRUE")
                                 {
@@ -937,6 +938,10 @@
                     }
 
                 }
+
+                ////鏇存柊鐗╂祦瀛楁 锛堢憺涓庣惇锛�
+                //oCn.RunProc("exec h_p_Cg_LocalToKingDee_POInStock " + HBillNo + "," + HInterID);
+
                 //鏇存柊涓昏〃鐘舵�� 瀹℃牳
                 sql = string.Format(@"update Cg_POInStockBillMain set 
 HBillStatus = 2 ,
@@ -985,8 +990,8 @@
             SQLHelper.ClsCNSRM oCn = new SQLHelper.ClsCNSRM();
             int HInterID = 0;
             string sql = "select HInterID from CG_POINSTOCKBILLMAIN where HBILLNO = '" + HBillNo + "'";
-            if (type == "Print")
-                sql += " and HBillStatus = '2' ";//鎵撳嵃鍒ゆ柇鏄惁瀹℃牳
+            //if (type == "Print")
+            //    sql += " and HBillStatus = '2' ";//鎵撳嵃鍒ゆ柇鏄惁瀹℃牳
             DataTable dt = oCn.RunProcReturn(sql, "HInterID").Tables[0];
             if (dt.Rows.Count > 0)
                 HInterID = Convert.ToInt32(dt.Rows[0]["HInterID"]);
@@ -1195,6 +1200,7 @@
                 }
 
                 //鍒ゆ柇鏈叧鑱旀暟閲忔槸鍚︿负0
+                //瀹夌憺锛欰IS20220914133941   鐟炰笌鐞細AIS20220308151944
                 DataSet ds = oCn.RunProcReturn($"select T1.hqty-T1.hrelationqty+q.FMRBQTY as hqty,鍗曟嵁鍙�,鐗╂枡缂栫爜 from H_v_SRM_POOrderBillList t1 left join AIS20220914133941..T_PUR_POORDERENTRY_R q on q.FENTRYID=t1.HEntryID  where hentryid in ({string.Join(", ", entryList)}) ", "H_v_SRM_POOrderBillList");
                 DataTable dt = ds.Tables[0];
                 if (dt.Rows.Count > 0)
diff --git a/WebAPI/DLL/DAL.dll b/WebAPI/DLL/DAL.dll
index 8eb7614..a60eec5 100644
--- a/WebAPI/DLL/DAL.dll
+++ b/WebAPI/DLL/DAL.dll
Binary files differ
diff --git a/WebAPI/DLL/Model.dll b/WebAPI/DLL/Model.dll
index 4937121..cdeff4a 100644
--- a/WebAPI/DLL/Model.dll
+++ b/WebAPI/DLL/Model.dll
Binary files differ

--
Gitblit v1.9.1