From eb858e6be89e639a997d03deee816dc7970af248 Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期四, 23 十月 2025 16:57:47 +0800
Subject: [PATCH] 调整 客户、供应商、物料、部门、仓库 基础资料 公有云 调用WEBAPI 同步方式

---
 WebAPI/Controllers/CJGL/Sc_ProcExchSendWorkBillController.cs |  274 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 269 insertions(+), 5 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Sc_ProcExchSendWorkBillController.cs b/WebAPI/Controllers/CJGL/Sc_ProcExchSendWorkBillController.cs
index b1163f9..fe44422 100644
--- a/WebAPI/Controllers/CJGL/Sc_ProcExchSendWorkBillController.cs
+++ b/WebAPI/Controllers/CJGL/Sc_ProcExchSendWorkBillController.cs
@@ -59,6 +59,199 @@
         }
         #endregion
 
+        #region 宸ュ簭娲惧伐鍗曞垪琛�(鑱屽憳鏌ョ湅鑷繁浠诲姟)
+        [Route("Sc_ProcExchSendWorkBill/Sc_ProcExchSendWorkBillListByEmp")]
+        [HttpGet]
+        public object Sc_ProcExchSendWorkBillListByEmp(string sWhere, string user,int HEmpID)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                string sql = $"exec  h_p_Sc_ProcExchSendWorkBillListByEmp '{sWhere}','{user}',{HEmpID} ";
+                ds = oCN.RunProcReturn(sql, "h_p_Sc_ProcExchSendWorkBillListByEmp");
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.list = columnNameList;
+                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
+
+        #region 宸ュ簭娲惧伐 鍒犻櫎锛堝瓙琛級鐢ㄤ簬鍙栨秷娲惧崟
+        [Route("Sc_ProcExchSendWorkBill/DelProcessSendWork_Sec")]
+        [HttpGet]
+        public object DelProcessSendWork_Sec(string HInterID, string HEntryID, string User)
+        {
+            try
+            {
+                //鍒犻櫎鏉冮檺
+                //if (!DBUtility.ClsPub.Security_Log_second("Cg_PODemandPlanConfigBill_Drop", 1, false, User))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犳潈闄愬垹闄わ紒";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+
+                ds = oCN.RunProcReturn("select a.* from Sc_ProcExchSendWorkBillMain a left join Sc_ProcExchSendWorkBillSub b on b.HInterID= a.HInterID where 1=1 and a.HInterID=" + HInterID, "Sc_ProcExchSendWorkBillMain");
+
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    if (ds.Tables[0].Rows[0]["HBillStatus"].ToString() != "1"&& ds.Tables[0].Rows[0]["HBillStatus"].ToString() != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "褰撳墠鍗曟嵁涓嶈兘鍒犻櫎锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    //鍒犻櫎鍓嶆帶鍒�=========================================      
+                    string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
+                    string sql1 = "exec h_p_Sc_ProcExchSendWorkBill_BeforeDelCtrl " + HInterID + ",'" + HBillNo + "','" + User + "'";
+                    DataSet ds1 = oCN.RunProcReturn(sql1, "h_p_Sc_ProcExchSendWorkBill_BeforeDelCtrl");
+                    if (ds1 == null || ds1.Tables.Count == 0 || ds1.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    if (ds1.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds1.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //==================================================================================      
+                    oCN.BeginTran();//寮�鍚簨鍔�
+
+                    if (ds.Tables[0].Rows.Count == 1)
+                    {
+                        oCN.RunProc($"delete from Sc_ProcExchSendWorkBillMain where HInterID={HInterID}");
+                    }
+                    oCN.RunProc($"delete from Sc_ProcExchSendWorkBillSub where HInterID={HInterID} and HEntryID={HEntryID}");
+
+                    //鍒犻櫎鍚庢帶鍒�=========================================      
+                    string sql2 = "exec h_p_Sc_ProcExchSendWorkBill_AfterDelCtrl " + HInterID + ",'" + HBillNo + "','" + User + "'";
+                    DataSet ds2 = oCN.RunProcReturn(sql2, "h_p_Sc_ProcExchSendWorkBill_AfterDelCtrl");
+                    if (ds2 == null || ds2.Tables.Count == 0 || ds2.Tables[0].Rows.Count == 0)
+                    {
+                        oCN.RollBack();
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    if (ds2.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        oCN.RollBack();
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds2.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //==================================================================================  
+
+
+                    oCN.Commit();//缁撴潫浜嬪姟
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "褰撳墠鍗曟嵁涓嶅瓨鍦�,鏃犳硶鍒犻櫎锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();//鍥炴粴浜嬪姟
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+
+        #region 娲惧伐骞冲彴鏌ヨ宸ュ簭娴佽浆鍗℃暟鎹�
+        [Route("Sc_ProcExchSendWorkBill/Sc_ProcessExchangeHEmpList")]
+        [HttpGet]
+        public object Sc_ProcessExchangeHEmpList(string sWhere, string user)
+        {
+            DataSet ds;
+            try
+            {
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                List<object> columnNameList = new List<object>();
+                //寰楀埌淇℃伅锛堝澶栨爣璁颁负0鏃讹紝娴佽浆鏍囪涓�1鏃讹級
+                //ds = oCN.RunProcReturn("select  * from h_v_Sc_ProcessExchangeBillList_Sec  where 涓嬮亾娴佽浆宸ュ簭<>'杞�' and 濮斿鏍囪=0 and 娴佽浆鏍囪=1  and 宸ュ簭鍙�='" + sProcNo + "' and 搴忓垪鍙�='" + HSEQNumber + "'", "h_v_Sc_ProcessExchangeBillList_Sec");
+                ds = oCN.RunProcReturn("select Top 1000 * from h_v_Sc_ProcessExchangeArrangementHEmpList  where 1=1 " + sWhere, "h_v_Sc_ProcessExchangeArrangementHEmpList");
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+                
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "[0000-1-037]Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+                
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString();
+                objJsonResult.data = null;
+            }
+            return objJsonResult;
+        }
+        #endregion
+
         #region 鏌ヨ宸ュ簭娴佽浆鍗℃暟鎹�
         [Route("Sc_ProcExchSendWorkBill/GetProcessExchangeBillSub")]
         [HttpGet]
@@ -200,7 +393,7 @@
         }
         #endregion
 
-        //#region 宸ュ簭娲惧伐鍗� 鍒犻櫎
+        #region 宸ュ簭娲惧伐鍗� 鍒犻櫎
         [Route("Sc_ProcExchSendWorkBill/DelProcessSendWork")]
         [HttpGet]
         public object DelProcessSendWork(string HInterID, string user)
@@ -237,7 +430,30 @@
                     return objJsonResult;
                 }
 
-                bool IsDete = oBill.DeleteBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo);
+                //鍒犻櫎鍓嶆帶鍒�=========================================      
+                string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
+                string sql1 = "exec h_p_Sc_ProcExchSendWorkBill_BeforeDelCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'";
+                ds = oCN.RunProcReturn(sql1, "h_p_Sc_ProcExchSendWorkBill_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;
+                    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;
+                    return objJsonResult;
+                }
+                //==================================================================================      
+
+                bool IsDete = oBill.DeleteBill(lngBillKey, HBillNo, "h_p_Sc_ProcExchSendWorkBill_AfterDelCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo);
                 if (IsDete)
                 {
                     objJsonResult.code = "0";
@@ -265,7 +481,7 @@
                 return objJsonResult;
             }
         }
-        //#endregion
+        #endregion
 
         #region 宸ュ簭娲惧伐鍗曞鏍�/鍙嶅鏍稿姛鑳�
         [Route("Sc_ProcExchSendWorkBill/CheckSc_ProcExchSendWorkBill")]
@@ -315,8 +531,31 @@
                             return objJsonResult;
                         }
                     }
+
+                    //瀹℃牳鍓嶆帶鍒�
+                    string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
+                    sql = "exec h_p_Sc_ProcExchSendWorkBill_BeforeCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
+                    ds = oCN.RunProcReturn(sql, "h_p_Sc_ProcExchSendWorkBill_BeforeCheckCtrl");
+                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+
+                    }
+                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
                     //瀹℃牳鍗曟嵁
-                    if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    if (!BillOld.CheckBill(Int64.Parse(HInterID), HBillNo, "h_p_Sc_ProcExchSendWorkBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 1;
@@ -342,8 +581,31 @@
                             return objJsonResult;
                         }
                     }
+
+                    //鍙嶅鏍稿墠鎺у埗
+                    string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
+                    sql = "exec h_p_Sc_ProcExchSendWorkBill_BeforeUnCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
+                    ds = oCN.RunProcReturn(sql, "h_p_Sc_ProcExchSendWorkBill_BeforeUnCheckCtrl");
+                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+
+                    }
+                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
                     //鍙嶅鏍稿崟鎹�
-                    if (BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    if (BillOld.AbandonCheck(Int64.Parse(HInterID), HBillNo, "h_p_Sc_ProcExchSendWorkBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                     {
                         //SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                         //DataSet DSet = oCn.RunProcReturn("exec h_p_Sc_ICMOBill_AbandonCheckCtrl " + int.Parse(HInterID), "h_p_Sc_ICMOBill_AbandonCheckCtrl");
@@ -492,5 +754,7 @@
         }
         #endregion
 
+
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1