From a1e3e548ea03ceb32d07bf9f73f4719dd14f7f2e Mon Sep 17 00:00:00 2001 From: zrg <z18737863051@163.com> Date: 星期二, 15 十月 2024 10:22:41 +0800 Subject: [PATCH] 1 --- WebAPI/Controllers/CJGL/Sc_ProcExchSendWorkBillController.cs | 309 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 303 insertions(+), 6 deletions(-) diff --git a/WebAPI/Controllers/CJGL/Sc_ProcExchSendWorkBillController.cs b/WebAPI/Controllers/CJGL/Sc_ProcExchSendWorkBillController.cs index 8213492..122ad7f 100644 --- a/WebAPI/Controllers/CJGL/Sc_ProcExchSendWorkBillController.cs +++ b/WebAPI/Controllers/CJGL/Sc_ProcExchSendWorkBillController.cs @@ -16,6 +16,7 @@ public DBUtility.ClsPub.Enum_BillStatus BillStatus; private json objJsonResult = new json(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill(); DataSet ds; #region 宸ュ簭娲惧伐鍗曞垪琛� @@ -68,7 +69,7 @@ { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); string sql = string.Format(@"select * from h_v_Sc_ProcessExchangeBillQuerySub_SendWork"); - ds = oCN.RunProcReturn(sql + sWhere + " order by 娴佹按鍙� ", "h_v_Sc_ProcessExchangeBillQuerySub_SendWork"); + ds = oCN.RunProcReturn(sql + sWhere + " order by convert(int,娴佹按鍙�) asc", "h_v_Sc_ProcessExchangeBillQuerySub_SendWork"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; @@ -150,10 +151,10 @@ oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 //oItemSub.HRemark = ""; //澶囨敞 - oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� - oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� - //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 - //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + oItemSub.HSourceInterID = oItemSub.HSourceInterID; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = oItemSub.HSourceEntryID; //婧愬崟瀛愬唴鐮� + oItemSub.HSourceBillNo = oItemSub.HSourceBillNo; //婧愬崟鍗曞彿 + oItemSub.HSourceBillType = oItemSub.HSourceBillType; //婧愬崟绫诲瀷 oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 oBill.DetailColl.Add(oItemSub); @@ -236,7 +237,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"; @@ -266,5 +290,278 @@ } //#endregion + #region 宸ュ簭娲惧伐鍗曞鏍�/鍙嶅鏍稿姛鑳� + [Route("Sc_ProcExchSendWorkBill/CheckSc_ProcExchSendWorkBill")] + [HttpGet] + public object CheckSc_ProcExchSendWorkBill(string HInterID, int Type, string user) + { + try + { + //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄� + if (!DBUtility.ClsPub.Security_Log("Sc_ProcessSendWork_Check", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳潈闄愬鏍�!"; + objJsonResult.data = null; + return objJsonResult; + } + + if (string.IsNullOrWhiteSpace(HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + ClsPub.CurUserName = user; + BillOld.MvarItemKey = "Sc_ProcExchSendWorkBillMain"; + oCN.BeginTran();//寮�濮嬩簨鍔� + + //Type 1 瀹℃牳 2 鍙嶅鏍� + if (Type == 1) + { + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡瀹℃牳 + DataSet ds; + string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; + ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); + if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶉渶瑕佸啀瀹℃牳!"; + objJsonResult.data = null; + 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), HBillNo, "h_p_Sc_ProcExchSendWorkBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅鏍� + DataSet ds; + string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; + ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); + if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插弽瀹℃牳!涓嶉渶瑕佸啀鍙嶅鏍�!"; + objJsonResult.data = null; + 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), 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"); + ////if (DBUtility.ClsPub.isInt(DSet.Tables[0].Rows[0]["Hback"]) != 0) + ////{ + //// objJsonResult.code = "0"; + //// objJsonResult.count = 1; + //// objJsonResult.Message = "璇ヤ换鍔″崟宸蹭笅鎺ㄦ祦杞崱锛屼笉鍏佽鍙嶅鏍�" + DBUtility.ClsPub.isStrNull(DSet.Tables[0].Rows[0]["HBackRemark"]); + //// objJsonResult.data = null; + //// return objJsonResult; + ////} + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + + oCN.Commit();//鎻愪氦浜嬪姟 + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鎵ц鎴愬姛锛�"; + objJsonResult.data = null; + 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/CloseSc_ProcExchSendWorkBill")] + [HttpGet] + public object CloseSc_ProcExchSendWorkBill(string HInterID, int Type, string user) + { + try + { + //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄� + if (!DBUtility.ClsPub.Security_Log("Sc_ProcessSendWork_Close", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳潈闄愬叧闂�!"; + objJsonResult.data = null; + return objJsonResult; + } + + if (string.IsNullOrWhiteSpace(HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + ClsPub.CurUserName = user; + BillOld.MvarItemKey = "Sc_ProcExchSendWorkBillMain"; + oCN.BeginTran();//寮�濮嬩簨鍔� + + //Type 1 鍏抽棴 2 鍙嶅叧闂� + if (Type == 1) + { + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍏抽棴 + DataSet ds; + string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; + ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); + if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶉渶瑕佸啀鍏抽棴!"; + objJsonResult.data = null; + return objJsonResult; + } + } + //鍏抽棴鍗曟嵁 + if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅叧闂� + DataSet ds; + string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; + ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); + if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插弽鍏抽棴!涓嶉渶瑕佸啀鍙嶅叧闂�!"; + objJsonResult.data = null; + return objJsonResult; + } + } + //鍙嶅叧闂崟鎹� + if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + + oCN.Commit();//鎻愪氦浜嬪姟 + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鎵ц鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + + } } \ No newline at end of file -- Gitblit v1.9.1