From 8658c02633f9746781d2e6f5da9998eef8c0e0a7 Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期五, 28 十月 2022 16:31:52 +0800
Subject: [PATCH] 动态列(点检项目、维修项目、维修检验项目、保养项目、产品与器具清单及维护、工作中心、工序、生产资源、生产班组、不良原因、故障原因、检验项目、检验项目分类、工序工价及维护、系统上机日志查询、系统参数查询、系统模块信息查询、系统单据类型、会计期间、公告信息维护)

---
 WebAPI/Controllers/POStockInBillController.cs |   68 ++++++++++++++++++++++++++++------
 1 files changed, 56 insertions(+), 12 deletions(-)

diff --git a/WebAPI/Controllers/POStockInBillController.cs b/WebAPI/Controllers/POStockInBillController.cs
index aa1353d..2aa0519 100644
--- a/WebAPI/Controllers/POStockInBillController.cs
+++ b/WebAPI/Controllers/POStockInBillController.cs
@@ -1474,8 +1474,25 @@
                 DAL.ClsCg_POInStockBill oBill = new DAL.ClsCg_POInStockBill();
                 var hinterID = list[0].HInterID;
                 var FID = list[0].FID;
+
+                #region 鏍¢獙鏄惁鎵弿鏉$爜
+                var HInterID = list[0].HInterID;
+                string jysql = string.Format(@"select * from KF_PonderationBillMain_Temp where HSourceInterID = {0}", HInterID);
+                DataTable jyDt =oCn.RunProcReturn(jysql, "jysql").Tables[0];
+                if (jyDt.Rows.Count == 0 || jyDt == null)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "璇锋壂鎻忔潯鐮�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                #endregion
+                #region 閲戣澏瀹℃牳鍚庝細閲嶆柊鍚屾鍗曟嵁鍒癿es 鏁呬笉闇�瑕佹洿鏂癿es鐨勬敹鏂欓�氱煡鍗� 
+                /*
                 oCn.BeginTran();
                 string sql = string.Empty;
+
                 foreach (var item in list)
                 {
                     if (item.HSQty == 0)
@@ -1484,6 +1501,15 @@
                     oCn.RunProc(sql);
                 }
                 oCn.RunProc("exec h_p_Cg_UpDatePOOrderRelation_Del " + hinterID);//鍒犻櫎鍏宠仈鍏崇郴
+                sql = string.Format(@"update Cg_POInStockBillMain set 
+HBillStatus = 2 ,
+HCheckDate   = getdate()
+where HInterID in ({0})", HInterID);
+                oCn.RunProc(sql);//鏇存柊mes鐘舵��  
+                //鏇存柊鎴愬姛鍚� 鍚屾鏇存柊閲戣澏
+                oCn.Commit();
+                **/
+                #endregion
 
                 JObject jsonRoot = new JObject();
                 jsonRoot.Add("Creator", "");
@@ -1502,10 +1528,10 @@
                         continue;
                     JObject jsonFPOOrderEntry = new JObject();
                     jsonFPOOrderEntry.Add("FEntryID", item.FEntryID);
-                    jsonFPOOrderEntry.Add("FHQty ", item.HSQty); ;
+                    jsonFPOOrderEntry.Add("FActReceiveQty ", item.HSQty); ;
                     Entry.Add(jsonFPOOrderEntry);
                 }
-                jsonModel.Add("FEntity", Entry);
+                jsonModel.Add("FDetailEntity", Entry);
                 jsonRoot.Add("Model", jsonModel);
                 var loginRet = InvokeHelper.Login();
                 var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>();
@@ -1519,7 +1545,7 @@
                 }
                 var result = InvokeHelper.Save("PUR_ReceiveBill", jsonRoot.ToString());
                 //LogService.Write(result);
-                if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() == "TRUE")
+                if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE")
                 {
                     LogService.Write("鏀舵枡閫氱煡鍗曚慨鏀瑰け璐sonRoot:" + jsonRoot.ToString());
                     objJsonResult.code = "0";
@@ -1559,13 +1585,7 @@
 
                 }
 
-                sql = string.Format(@"update Cg_POInStockBillMain set 
-HBillStatus = 2 ,
-HCheckDate   = getdate()
-where HInterID in ({0})",  HInterID);
-                oCn.RunProc(sql);//鏇存柊mes鐘舵��
-                //鏇存柊鎴愬姛鍚� 鍚屾鏇存柊閲戣澏
-                oCn.Commit();
+
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "鎿嶄綔鎴愬姛锛�";
@@ -1574,7 +1594,7 @@
             }
             catch (Exception e)
             {
-                oCn.RollBack();
+                //oCn.RollBack();
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
                 objJsonResult.Message = "寮傚父锛�" + e.ToString();
@@ -1596,8 +1616,9 @@
         {
             try
             {
+                //var code = HBarcode.Split('#')[0];
                 //鏍¢獙鏉$爜鏄惁瀛樺湪
-                string sql = $"select* from  Gy_BarCodeBill where HSourceInterID ={HInterID} and HBarCode = '{HBarcode}'";
+                string sql = $"select HItemID,HSourceBillNo from  Gy_BarCodeBill where HSourceInterID ={HInterID} and HBarCode = '{HBarcode.Split('#')[0]}' and HQty = {HBarcode.Split('#')[1]}";
                 DataSet ds = oCn.RunProcReturn(sql, "H_v_SRM_POOrderBillList");
                 if (ds.Tables[0].Rows.Count == 0)
                 {
@@ -1607,6 +1628,29 @@
                     objJsonResult.data = ds.Tables[0];
                     return objJsonResult;
                 }
+                else
+                {
+                    //瀛樺叆鏉$爜涓存椂琛�
+                    sql = $"delete from KF_PonderationBillMain_Temp Where HBillNo='{ds.Tables[0].Rows[0]["HSourceBillNo"]}' ";
+                    oCn.RunProc(sql);
+                    sql = string.Format(@"Insert into KF_PonderationBillMain_Temp 
+	(HInterID,HBillNo,HBillType,HMaterID,HProcID,HWhID,HSCWHID
+	,HStockPlaceID,HOutStockPlaceID,HGroupID,HQty,HQtyMust,HPieceQty
+	,HAuxPropID,HBatchNo,HBarCode,HAddr,HMaker,HMakeDate
+	,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo,HMTONo
+	,HSTOCKORGID,HOWNERID,HExpressNumber,HSubBillType
+	,HRelationInterID,HRelationEntryID,HRelationBillNo,HRedBlueFlag
+	,HCusID)
+	select HInterID,HSourceBillNo,HBillType,HMaterID,0,0,0
+	,0,0,0,HQty,HQty,0
+	,HAuxPropID,HBatchNo,'','','System',getdate()
+	,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo,HMTONo
+	,HSTOCKORGID,HOWNERID,'',HBillType
+	,0,0,'',0
+	,0 from Gy_BarCodeBill  
+	where HItemID = {0}", ds.Tables[0].Rows[0]["HItemID"]);
+                    oCn.RunProc(sql);
+                }
 
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;

--
Gitblit v1.9.1