From f34c6a21dc58bc0d40a011d6d7366c5eb3f15f15 Mon Sep 17 00:00:00 2001
From: yxj <yxj@hz-kingdee.com>
Date: 星期五, 20 九月 2024 13:59:34 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/SCGL/Sc_ICMOReportBillController.cs |   92 +++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 87 insertions(+), 5 deletions(-)

diff --git a/WebAPI/Controllers/SCGL/Sc_ICMOReportBillController.cs b/WebAPI/Controllers/SCGL/Sc_ICMOReportBillController.cs
index 97355c4..9ec52fb 100644
--- a/WebAPI/Controllers/SCGL/Sc_ICMOReportBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_ICMOReportBillController.cs
@@ -38,6 +38,7 @@
         {
             try
             {
+                List<object> a = new List<object>();
                 //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
                 if (!DBUtility.ClsPub.Security_Log("Sc_ICMOReportBillQuery", 1, false, user))
                 {
@@ -58,13 +59,19 @@
                     string sql = sql1 + sWhere + " order by hmainid desc ";
                     ds = oCN.RunProcReturn(sql, "h_v_IF_ICMOReportBillList_Edit");
                 }
-
+                foreach (DataColumn col in ds.Tables[0].Columns)//閬嶅巻ds涓涓�涓〃锛圱ables[0]锛夌殑鎵�鏈夊垪锛圕olumns锛夋瘡娆″惊鐜腑锛宑ol鍙橀噺浼氭寔鏈夊綋鍓嶅垪鐨勫紩鐢�
+                {
+                    Type dataType = col.DataType; //鑾峰彇褰撳墠鏁版嵁绫诲瀷浼犲叆 鑷畾涔夊彉閲廳atadataType
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //瀛楃涓叉嫾鎺�         // 灏嗗垪鍚嶅拰鏁版嵁绫诲瀷淇℃伅鎷兼帴鎴愪竴涓狫SON鏍煎紡鐨勫瓧绗︿覆
+                    a.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
                 //if (ds.Tables[0].Rows.Count != 0 || ds != null)
                 //{
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "Sucess锛�";
                 objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = a;
                 return objJsonResult;
                 //}
                 //else
@@ -120,7 +127,7 @@
                                             HUnitID, 璁¢噺鍗曚綅浠g爜 HUnitCode, 璁¢噺鍗曚綅 HUnitName,HSourceID,鐢熶骇璧勬簮浠g爜 HSourceCode,鐢熶骇璧勬簮 HSourceName,
                                             HWorkerid,鎿嶄綔鍛樹唬鐮� HWorkerCode,鎿嶄綔鍛� HWorkerName,鐢熶骇鏁伴噺 HQty,琛ㄤ綋澶囨敞 HRemark,
                                             HICMOInterID,HICMOEntryID,HICMOBillNo,HICMOInterID as HSourceInterID,HICMOEntryID as HSourceEntryID,
-                                            HICMOBillNo as HSourceBillNo,3710 as HSourceBillType
+                                            HICMOBillNo as HSourceBillNo,3710 as HSourceBillType,涓嶈壇鏁伴噺 HBadQty
                                             FROM h_v_IF_ICMOReportBillList_Edit"), "h_v_IF_ICMOReportBillList_Edit");
 
                     objJsonResult.code = "0";
@@ -137,7 +144,7 @@
                                             HWorkerid,鎿嶄綔鍛樹唬鐮� HWorkerCode,鎿嶄綔鍛� HWorkerName,鐢熶骇鏁伴噺 HQty,琛ㄤ綋澶囨敞 
                                             HRemark,HICMOInterID,HICMOEntryID,HICMOBillNo,
                                             HICMOInterID as HSourceInterID,HICMOEntryID as HSourceEntryID,
-                                            HICMOBillNo as HSourceBillNo,3710 as HSourceBillType
+                                            HICMOBillNo as HSourceBillNo,3710 as HSourceBillType,涓嶈壇鏁伴噺 HBadQty
                                             FROM h_v_IF_ICMOReportBillList_Edit where 1 = 1 ");
                     string sql = sql1 + sqlWhere;
                     ds = oCN.RunProcReturn(sql, "h_v_IF_ICMOReportBillList_Edit");
@@ -498,6 +505,8 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
+                string HBillNo = "";
+                oCN.BeginTran();//寮�濮嬩簨鍔�
                 ds = oCN.RunProcReturn("select * from Sc_ICMOReportBillMain where HInterID=" + lngBillKey, "Sc_ICMOReportBillMain");
                 if (ds == null || ds.Tables[0].Rows.Count == 0)
                 {
@@ -505,17 +514,51 @@
                     objJsonResult.count = 0;
                     objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒";
                     objJsonResult.data = null;
+                    oCN.RollBack();
                     return objJsonResult; ;
                 }
+                else
+                {
+                    HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
+                }
+
+                //鍒犻櫎鍓嶆帶鍒�=========================================      
+                DataSet Ds;
+
+                string sql1 = "exec h_p_Sc_ICMOReportBill_BeforeDelCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'";
+                Ds = oCN.RunProcReturn(sql1, "h_p_Sc_ICMOReportBill_BeforeDelCtrl");
+                if (Ds == null || Ds.Tables.Count == 0 || Ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                    objJsonResult.data = null;
+                    oCN.RollBack();
+                    return objJsonResult;
+                }
+
+                if (Ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + Ds.Tables[0].Rows[0]["HRemark"].ToString();
+                    objJsonResult.data = null;
+                    oCN.RollBack();
+                    return objJsonResult;
+                }
+                //==================================================================================    
+
 
                 oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + "" + "','" + "鍒犻櫎鐢熶骇姹囨姤鍗曞崟鎹細" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','LMES-鐢熶骇姹囨姤鍗曟ā鍧�','" + DBUtility.ClsPub.IPAddress + "','鍒犻櫎鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
 
 
-                bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+                bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, HBillNo, "h_p_Sc_ICMOReportBill_AfterDelCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo);
 
 
                 if (IsDete)
                 {
+                    oCN.Commit();//鎻愪氦浜嬪姟
+
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
@@ -524,11 +567,11 @@
                 }
                 else
                 {
-
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
                     objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
                     objJsonResult.data = null;
+                    oCN.RollBack();
                     return objJsonResult;
                 }
             }
@@ -538,6 +581,7 @@
                 objJsonResult.count = 0;
                 objJsonResult.Message = "鍗曟嵁鏈壘鍒�";
                 objJsonResult.data = null;
+                oCN.RollBack();
                 return objJsonResult;
             }
         }
@@ -1233,5 +1277,43 @@
         }
         #endregion
 
+
+        #region 鐢熶骇姹囨姤鍗� 鏍规嵁涓诲唴鐮佷笌瀛愬唴鐮佽幏鍙栫敓浜ф眹鎶ュ崟鏁版嵁
+        [Route("Sc_ICMOReportBill/loadSc_ICMOReportBill_Push")]
+        [HttpGet]
+        public object loadSc_ICMOReportBill_Push(long HInterID, long HSubID)
+        {
+            try
+            {
+
+                ds = oCN.RunProcReturn("select * from h_v_IF_ICMOReportBillList_Edit where hmainid =" + HInterID + " and hsubid = " + HSubID, "h_v_IF_ICMOReportBillList_Edit");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈煡璇㈠埌婧愬崟淇℃伅锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1