From 2ac90163499626a2e2c4b4a46219b944dc6c9b17 Mon Sep 17 00:00:00 2001 From: duhe <226547893@qq.com> Date: 星期三, 06 九月 2023 13:45:30 +0800 Subject: [PATCH] 1 --- WebAPI/Controllers/CJGL/Sc_ProcExchWorkBackBillController.cs | 365 ++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 295 insertions(+), 70 deletions(-) diff --git a/WebAPI/Controllers/CJGL/Sc_ProcExchWorkBackBillController.cs b/WebAPI/Controllers/CJGL/Sc_ProcExchWorkBackBillController.cs index 1bc43f2..0a39f2b 100644 --- a/WebAPI/Controllers/CJGL/Sc_ProcExchWorkBackBillController.cs +++ b/WebAPI/Controllers/CJGL/Sc_ProcExchWorkBackBillController.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 宸ュ簭杩斿伐鐢宠鍗曞垪琛� @@ -77,7 +78,7 @@ { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); string sql = string.Format(@"select top 2 * from h_v_Sc_ProcessExchangeBillQuerySub"); - ds = oCN.RunProcReturn(sql + sWhere, "h_v_Sc_ProcessExchangeBillQuerySub"); + ds = oCN.RunProcReturn(sql + sWhere + " order by cast(娴佹按鍙� as int) ", "h_v_Sc_ProcessExchangeBillQuerySub"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; @@ -309,124 +310,348 @@ } #endregion - #region 宸ュ簭杩斿伐鐢宠鍗� 瀹℃牳 - [Route("Sc_ProcExchWorkBackBill/set_CheckBill")] + //#region 宸ュ簭杩斿伐鐢宠鍗� 瀹℃牳 + //[Route("Sc_ProcExchWorkBackBill/set_CheckBill")] + //[HttpGet] + //public object set_CheckBill(int HInterID, string CurUserName) + //{ + // try + // { + // //瀹℃牳鏉冮檺 + // if (!DBUtility.ClsPub.Security_Log("Sc_ProcExchWorkBackBill_Check", 1, false, CurUserName)) + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + // objJsonResult.data = null; + // return objJsonResult; + // } + // if (HInterID == 0) + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鍗曟嵁ID涓�0锛屼笉鑳藉鏍革紒"; + // objJsonResult.data = null; + // return objJsonResult; + // } + + // DataSet Ds = oCN.RunProcReturn("Select * from Sc_ProcExchWorkBackBillMain Where HInterID=" + HInterID, "Sc_ProcExchWorkBackBillMain"); + // if (Ds.Tables[0].Rows.Count > 0) + // { + // //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾 + // if (Ds.Tables[0].Rows[0]["HChecker"].ToString() != "") + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳"; + // objJsonResult.data = null; + // return objJsonResult; + // } + + + // //瀹℃牳 + // if (Cj_StationInBillCheckBill(HInterID,int.Parse( Ds.Tables[0].Rows[0]["HProcExchInterID"].ToString()), CurUserName, ref DBUtility.ClsPub.sExeReturnInfo)) + // { + // objJsonResult.code = "1"; + // objJsonResult.count = 1; + // objJsonResult.Message = "瀹℃牳鎴愬姛!"; + // objJsonResult.data = null; + // return objJsonResult; + // } + // else + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + // objJsonResult.data = null; + // return objJsonResult; + // } + + // } + // else + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // 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; + // } + //} + + ////瀹℃牳 + //public bool Cj_StationInBillCheckBill(Int64 HInterID,int HProcExchInterID, string CurUserName, ref string sReturn) + //{ + // try + // { + // oCN.BeginTran(); + // oCN.RunProc(" Update Sc_ProcExchWorkBackBillMain set HChecker='" + CurUserName + "',HBillStatus=2,HCheckDate=getdate() Where HInterID=" + HInterID.ToString()); + // //鍥炲~宸ュ簭娴佽浆鍗� + // oCN.RunProc("exec h_p_ProcExchWorkBackBill_Check_In " + HInterID.ToString()); + // oCN.RunProc("exec h_p_Sc_ProcessExchangeBill_SetRemark " + HProcExchInterID.ToString()); //璁剧疆 澶囨敞 涓� 宸ヨ壓娴� + // oCN.RunProc("exec h_p_Sc_ProcessExchangeBill_SetUpdate " + HProcExchInterID.ToString()); //璁剧疆 鏈亾 棣栭亾 杞� 绛変俊鎭� 鍣ㄥ叿娓呭崟 宸ヨ壓鍙傛暟娓呭崟锛� + // DataSet ds = new DataSet(); + // //璁剧疆鏉$爜鍙� 鍥炲~ 棰嗘枡鎵规 + // ds = oCN.RunProcReturn("exec h_p_Mes_ProcessExchangeBackBarCode " + HProcExchInterID.ToString(), "h_p_Mes_ProcessExchangeBackBarCode"); + // if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0) + // { + // sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]).ToString(); + // oCN.RollBack(); + // return false; + // } + + // //鎺у埗鍏宠仈鏁伴噺 + // ds = null; + // ds = oCN.RunProcReturn("exec h_p_Sc_ProcessExchangeBill_Checkqty " + HProcExchInterID.ToString(), "h_p_Sc_ProcessExchangeBill_Checkqty"); + // if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0) + // { + // sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]).ToString(); + // oCN.RollBack(); + // return false; + // } + // oCN.Commit(); + // return true; + // } + // catch (Exception e) + // { + // sReturn = e.Message; + // oCN.RollBack(); + // return false; ; + // } + //} + //#endregion + + #region 宸ヨ壓璺嚎瀹℃牳/鍙嶅鏍稿姛鑳� + [Route("Sc_ProcExchWorkBackBill/CheckSc_ProcExchWorkBackBill")] [HttpGet] - public object set_CheckBill(int HInterID, string CurUserName) + public object CheckSc_ProcExchWorkBackBill(string HInterID, int Type, string user) { try { - //瀹℃牳鏉冮檺 - if (!DBUtility.ClsPub.Security_Log("Sc_ProcExchWorkBackBill_Check", 1, false, CurUserName)) + //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄� + if (!DBUtility.ClsPub.Security_Log("Sc_ProcExchWorkBackBill_Check", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; - objJsonResult.data = null; - return objJsonResult; - } - if (HInterID == 0) - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁ID涓�0锛屼笉鑳藉鏍革紒"; + objJsonResult.Message = "鏃犳潈闄愬鏍�!"; objJsonResult.data = null; return objJsonResult; } - DataSet Ds = oCN.RunProcReturn("Select * from Sc_ProcExchWorkBackBillMain Where HInterID=" + HInterID, "Sc_ProcExchWorkBackBillMain"); - if (Ds.Tables[0].Rows.Count > 0) + if (string.IsNullOrWhiteSpace(HInterID)) { - //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾 - if (Ds.Tables[0].Rows[0]["HChecker"].ToString() != "") + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + ClsPub.CurUserName = user; + BillOld.MvarItemKey = "Sc_ProcExchWorkBackBillMain"; + 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; + } + } + //瀹℃牳鍗曟嵁 + if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } - - - //瀹℃牳 - if (Cj_StationInBillCheckBill(HInterID,int.Parse( Ds.Tables[0].Rows[0]["HProcExchInterID"].ToString()), CurUserName, ref DBUtility.ClsPub.sExeReturnInfo)) + } + 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) { - objJsonResult.code = "1"; - objJsonResult.count = 1; - objJsonResult.Message = "瀹℃牳鎴愬姛!"; - objJsonResult.data = null; - return objJsonResult; + 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; + } + } + //鍙嶅鏍稿崟鎹� + if (BillOld.AbandonCheck(Int64.Parse(HInterID), 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 = 0; - objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } + } - } - else - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁鏈壘鍒�!"; - 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.Message = "鎵ц澶辫触锛�" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } + #endregion - //瀹℃牳 - public bool Cj_StationInBillCheckBill(Int64 HInterID,int HProcExchInterID, string CurUserName, ref string sReturn) + #region 宸ヨ壓璺嚎鍗曞叧闂�/鍙嶅叧闂姛鑳� + [Route("Sc_ProcExchWorkBackBill/CloseSc_ProcExchWorkBackBill")] + [HttpGet] + public object CloseSc_ProcExchWorkBackBill(string HInterID, int Type, string user) { try { - oCN.BeginTran(); - oCN.RunProc(" Update Sc_ProcExchWorkBackBillMain set HChecker='" + CurUserName + "',HBillStatus=2,HCheckDate=getdate() Where HInterID=" + HInterID.ToString()); - //鍥炲~宸ュ簭娴佽浆鍗� - oCN.RunProc("exec h_p_ProcExchWorkBackBill_Check_In " + HInterID.ToString()); - oCN.RunProc("exec h_p_Sc_ProcessExchangeBill_SetRemark " + HProcExchInterID.ToString()); //璁剧疆 澶囨敞 涓� 宸ヨ壓娴� - oCN.RunProc("exec h_p_Sc_ProcessExchangeBill_SetUpdate " + HProcExchInterID.ToString()); //璁剧疆 鏈亾 棣栭亾 杞� 绛変俊鎭� 鍣ㄥ叿娓呭崟 宸ヨ壓鍙傛暟娓呭崟锛� - DataSet ds = new DataSet(); - //璁剧疆鏉$爜鍙� 鍥炲~ 棰嗘枡鎵规 - ds = oCN.RunProcReturn("exec h_p_Mes_ProcessExchangeBackBarCode " + HProcExchInterID.ToString(), "h_p_Mes_ProcessExchangeBackBarCode"); - if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0) + //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄� + if (!DBUtility.ClsPub.Security_Log("Sc_ProcExchWorkBackBill_Close", 1, false, user)) { - sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]).ToString(); - oCN.RollBack(); - return false; + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳潈闄愬叧闂�!"; + objJsonResult.data = null; + return objJsonResult; } - //鎺у埗鍏宠仈鏁伴噺 - ds = null; - ds = oCN.RunProcReturn("exec h_p_Sc_ProcessExchangeBill_Checkqty " + HProcExchInterID.ToString(), "h_p_Sc_ProcessExchangeBill_Checkqty"); - if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0) + if (string.IsNullOrWhiteSpace(HInterID)) { - sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]).ToString(); - oCN.RollBack(); - return false; + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; } - oCN.Commit(); - return true; + + ClsPub.CurUserName = user; + BillOld.MvarItemKey = "Sc_ProcExchWorkBackBillMain"; + 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) { - sReturn = e.Message; - oCN.RollBack(); - return false; ; + 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