From 414e9ac9f6e44d5d427c7e00389a5e4f8be42208 Mon Sep 17 00:00:00 2001
From: 王 垚 <1402714037@qq.com>
Date: 星期三, 28 九月 2022 09:02:27 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/LookingForBillController.cs |   38 ++++++++++++++++++++++----------------
 1 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/WebAPI/Controllers/LookingForBillController.cs b/WebAPI/Controllers/LookingForBillController.cs
index 119212f..923a870 100644
--- a/WebAPI/Controllers/LookingForBillController.cs
+++ b/WebAPI/Controllers/LookingForBillController.cs
@@ -36,16 +36,16 @@
                     return objJsonResult;
                 }
                 else
-                { 
+                {
                     objJsonResult.code = "1";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "鎵爜鎴愬姛锛�";
                     objJsonResult.data = ds.Tables[0];
-                    return objJsonResult; 
+                    return objJsonResult;
                 }
             }
             catch (Exception ex)
-            { 
+            {
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
                 objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString();
@@ -175,16 +175,20 @@
         /// <returns></returns>
         [Route("LookingFor/set_SaveLookingForBill_Json")]
         [HttpPost]
-        public object set_SaveLookingForBill_Json([FromBody]JObject oMain)
+        public object set_SaveLookingForBill_Json([FromBody] JObject oMain)
         {
             string oMainData = oMain["oMain"].ToString();
-            oMainData = oMainData.Substring(8,oMainData.Length-9);
+            string HJiaYe = oMain["HJiaYe"].ToString();
+            oMainData = oMainData.Substring(8, oMainData.Length - 9);
             SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
             try
             {
-                List<LookingForBill> lsmain = new List<LookingForBill>();
                 ListModels oListModels = new ListModels();
                 List<LookingForBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LookingForBill>>(oMainData);
+                //淇濆瓨浜哄憳
+                string saveGroupEmpsql = $"exec h_p_saveGroupEmp '{list[0].HMaker}','{list[0].HGroupID}',{HJiaYe.Split(',')[0]},{HJiaYe.Split(',')[1]},'{HJiaYe}'";
+                LogService.Write(saveGroupEmpsql);
+                oCN.RunProc(saveGroupEmpsql);
                 oCN.BeginTran();
                 //var mainSql1 = "Insert Into Kf_LookingForReturnBillMain " +
                 //    "(HInterID,HBillNo,HSourceInterID,HSourceBillNo,HCreateBy)" +
@@ -192,24 +196,26 @@
                 //    "(" + list[0].HInterID + ",'" + list[0].HBillNo + "'," + list[0].HSourceInterID + ",'" + list[0].HSourceBillNo + "','" + list[0].HMaker + "')";
                 var mainSql = "Insert Into Kf_LookingForBillMain " +
                     "(HInterID,HBillNo,HSourceInterID,HSourceBillNo,HWhID,HWhName,HSPID,HSPName,HGroupID,HGroup" +
-                    ",HSourceID,HSource,HCreateBy)" +
+                    ",HSourceID,HSource,HCreateBy,HJiaYe)" +
                     " values" +
-                    "(" + list[0].HInterID + ",'" + list[0].HBillNo + "'," + list[0].HSourceInterID+ ",'" + list[0].HSourceBillNo + "'," + list[0].HWHID + ",'" + list[0].HWHName + "'," + list[0].HSPID + ",'" + list[0].HSPName + "'," + list[0].HGroupID + ",'" + list[0].HGroup + "',"
-                    + list[0].HSourceID + ",'" + list[0].HSource + "','" + list[0].HMaker + "')";
+                    "(" + list[0].HInterID + ",'" + list[0].HBillNo + "'," + list[0].HSourceInterID + ",'" + list[0].HSourceBillNo + "'," + list[0].HWHID + ",'" + list[0].HWHName + "'," + list[0].HSPID + ",'" + list[0].HSPName + "'," + list[0].HGroupID + ",'" + list[0].HGroup + "',"
+                    + list[0].HSourceID + ",'" + list[0].HSource + "','" + list[0].HMaker + "','" + HJiaYe + "')";
                 oCN.RunProc(mainSql);
                 for (int i = 0; i < list.Count; i++)
                 {
                     var subSql = "Insert Into Kf_LookingForBillSub " +
                     "(HWHID,HWHName,HSPID,HSPName,HMTONo,HQty,HMaterID,HMaterName,HMaterNumber,HMaterModel,HBarCode,HGroupID,HGroup,HSourceID,HSource,HCreateBy,HMainItemID)" +
                     " values" +
-                    "(" + list[i].HWHID + ",'" + list[i].HWHName + "'," + list[i].HSPID + ",'" + list[i].HSPName + "','" + list[i].HMTONo + "',"+ list[i].HQty + ","
-                    + list[i].HMaterID + ",'"+ list[i].HMaterName + "','"+ list[i].HMaterNumber + "','"+ list[i].HMaterModel + "','" + list[i].HBarCode + "',"
-                    + list[i].HGroupID + ",'"+ list[i].HGroup + "',"+ list[i].HSourceID + ",'" + list[i].HSource + "','"+ list[i].HMaker + "',(select HItemID from Kf_LookingForBillMain where HBillNo = '" + list[i].HBillNo + "'))";
+                    "(" + list[i].HWHID + ",'" + list[i].HWHName + "'," + list[i].HSPID + ",'" + list[i].HSPName + "','" + list[i].HMTONo + "'," + list[i].HQty + ","
+                    + list[i].HMaterID + ",'" + list[i].HMaterName + "','" + list[i].HMaterNumber + "','" + list[i].HMaterModel + "','" + list[i].HBarCode + "',"
+                    + list[i].HGroupID + ",'" + list[i].HGroup + "'," + list[i].HSourceID + ",'" + list[i].HSource + "','" + list[i].HMaker + "',(select HItemID from Kf_LookingForBillMain where HBillNo = '" + list[i].HBillNo + "'))";
                     oCN.RunProc(subSql);
-                    var barCodeSql = "update Gy_BarCodeBill set HStatus='瑁佸垏涓�-" + list[i].HSource + "' where HBarCode = '"+ list[i].HBarCode + "'";
+                    var barCodeSql = "update Gy_BarCodeBill set HStatus='瑁佸垏涓�-" + list[i].HSource + "' where HBarCode = '" + list[i].HBarCode + "'";
                     oCN.RunProc(barCodeSql);
                 }
                 oCN.Commit();
+                //鍙嶅啓閲戣澏閿�鍞鍗曠殑鎵捐揣缁勫拰鎵捐揣鏃堕棿
+                oCN.RunProc("exec h_p_IFCLD_DataBackToSeOrderFindGoodsTime " + list[0].HInterID);
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "鐢熸垚鎵捐揣鍗曟垚鍔燂紒鍗曟嵁鍙蜂负锛�" + list[0].HBillNo;
@@ -503,7 +509,7 @@
 
         public static DataSet getPackUnionBillList_s(string HBarCode_Pack)
         {
-            return new SQLHelper.ClsCN().RunProcReturn("EXEC h_p_Kf_getPackUnionBillList " + "'"+HBarCode_Pack+"'", "h_p_Kf_getPackUnionBillList");
+            return new SQLHelper.ClsCN().RunProcReturn("EXEC h_p_Kf_getPackUnionBillList " + "'" + HBarCode_Pack + "'", "h_p_Kf_getPackUnionBillList");
         }
 
         public static DataSet getPackUnionBillListDetailed_s(string HBarCode)
@@ -514,7 +520,7 @@
         public static DataSet getSellOrderList_s(string HSourceBillNo)
         {
             //鍚屾閿�鍞鍗�
-            new SQLHelper.ClsCN().RunProcReturn("EXEC h_p_IFCLD_ERPSourceBillToLocal_SEOrderToICMO '" + HSourceBillNo+ "'", "h_p_IFCLD_ERPSourceBillToLocal_SEOrderToICMO");
+            new SQLHelper.ClsCN().RunProcReturn("EXEC h_p_IFCLD_ERPSourceBillToLocal_SEOrderToICMO '" + HSourceBillNo + "'", "h_p_IFCLD_ERPSourceBillToLocal_SEOrderToICMO");
             string sWhere = " Where HSourceBillNo = '" + HSourceBillNo.Trim() + "'";
             return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_getSellOrderList_s " + sWhere, "h_v_getSellOrderList_s");
         }
@@ -587,7 +593,7 @@
             DataSet ds;
             ds = new SQLHelper.ClsCN().RunProcReturn("EXEC h_p_Xs_SellOutFindSP '" + HbillNo + "'", "h_p_Xs_SellOutFindSP");
 
-            if (Pub_Class.ClsPub.isLong(ds.Tables[0].Rows.Count) >= 0 )
+            if (Pub_Class.ClsPub.isLong(ds.Tables[0].Rows.Count) >= 0)
             {
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;

--
Gitblit v1.9.1