From 10be6891dceb6e622ee980e9687c7ffa2544e564 Mon Sep 17 00:00:00 2001 From: zzr99 <1940172413@qq.com> Date: 星期四, 16 九月 2021 17:45:03 +0800 Subject: [PATCH] 完善器具采购单 --- WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs | 358 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 343 insertions(+), 15 deletions(-) diff --git a/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs index 5707fd9..f7fba1e 100644 --- a/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs +++ b/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs @@ -20,11 +20,7 @@ DataSet ds; - /// <summary> - /// 杩斿洖濮斿宸ュ簭鎺ユ敹鍗曞垪琛� - ///鍙傛暟锛歴tring sql銆� - ///杩斿洖鍊硷細object銆� - /// </summary> + #region 杩斿洖濮斿宸ュ簭鎺ユ敹鍗曞垪琛� [Route("Cj_StationEntrustOutBill/list")] [HttpGet] public object list(string sWhere) @@ -67,12 +63,9 @@ return objJsonResult; } } + #endregion - /// <summary> - /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳 - ///鍙傛暟锛歴tring sql銆� - ///杩斿洖鍊硷細object銆� - /// </summary> + #region 鏂板鍗曟嵁-淇濆瓨鎸夐挳 [Route("Cj_StationEntrustOutBill/AddBill")] [HttpPost] public object AddBill([FromBody] JObject oMain) @@ -228,6 +221,7 @@ oCN.BeginTran(); if ("Add".Equals(eventType)) { + //楠岃瘉鍗曟嵁鍙锋槸鍚﹂噸澶� if (!AllowbillNo(HBillNo)) { oCN.RollBack(); @@ -338,6 +332,8 @@ return objJsonResult; } } + + //楠岃瘉鍗曟嵁鍙锋槸鍚﹂噸澶� private bool AllowbillNo(string HBillNo) { ds = oCN.RunProcReturn("select HBillNo from Sc_StationOutBillMain where HBillNo = '" + HBillNo + "'", "Sc_StationOutBillMain"); @@ -347,11 +343,9 @@ } return false; } - /// <summary> - /// 缂栬緫椤甸潰鏍规嵁id鑾峰彇濮斿宸ュ簭鎺ユ敹鍗曚俊鎭� - ///鍙傛暟锛歴tring sql銆� - ///杩斿洖鍊硷細object銆� - /// </summary> + #endregion + + #region 缂栬緫椤甸潰鏍规嵁id鑾峰彇濮斿宸ュ簭鎺ユ敹鍗曚俊鎭� [Route("Cj_StationEntrustOutBill/GetStationEntrustOutBill")] [HttpGet] public object GetStationEntrustOutBill(int HInterID) @@ -385,6 +379,7 @@ return objJsonResult; } } + #endregion #region 鏍规嵁id鍒犻櫎濮斿鎺ユ敹鍗� [Route("Cj_StationEntrustOutBill/del_StationEntrustOutBill")] @@ -482,6 +477,339 @@ } } #endregion + + #region 缂栬緫鍓嶅垽鏂� + [Route("Cj_StationEntrustOutBill/set_ShowBillJudge")] + [HttpGet] + public object set_ShowBillJudge(string HBillNo, string CurUserName, long HInterID) + { + try + { + ds = oCN.RunProcReturn("exec h_p_MES_StationOutBill_DelCtrl '" + HBillNo + "'", "h_p_MES_StationOutBill_DelCtrl"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒ゆ柇鍏宠仈澶辫触锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else if (ds.Tables[0].Rows.Count > 0 && Pub_Class.ClsPub.isInt(ds.Tables[0].Rows[0][0]) == 2) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[0][1]); + objJsonResult.data = null; + return objJsonResult; + } + + //鍒ゆ柇鏉冮檺 + if (!ClsPub.Security_Log("MES_StationEntrustOutBill_Edit", 1, true, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + ////鍒ゆ柇璇ョ敤鎴峰悕鏄惁鏈夎宸ョ珯鏉冮檺 + //if (BillNew.CheckCenterIDByUser(DBUtility.ClsPub.isLong(66865)) == false) + //{ + // MessageBox.Show("娌℃湁璇ュ伐绔欐潈闄愶紒", "鎻愮ず"); + // return; + //} + ////妫�鏌ユ槸鍚﹀紑绁� + //string d = ""; + //if (BillOld.CheckIsKP(BillOld.omodel.HInterID, ref d) == false) + //{ + // MessageBox.Show(d, "鎻愮ず"); + // return; + //} + string s = ""; + DAL.ClsSc_StationEntrustOutBill BillOld = new DAL.ClsSc_StationEntrustOutBill(); + if (BillOld.ShowBill(HInterID, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹湁閿欒锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //鍒ゆ柇鏄惁鍙紪杈� + if (BillOld.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�"; + objJsonResult.data = null; + return objJsonResult; + } + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 瀹℃牳 + [Route("Cj_StationEntrustOutBill/set_CheckBill")] + [HttpGet] + public object set_CheckBill(int HInterID, string CurUserName) + { + try + { + //string ModRightNameCheck = "MES_StationEntrustOutBill_Check"; + ////瀹℃牳鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, 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; + } + DAL.ClsSc_StationEntrustOutBill oBill = new DAL.ClsSc_StationEntrustOutBill(); + //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾 + if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HChecker.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳"; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + //瀹℃牳 + if (Cj_StationEntrustOutBillCheckBill(HInterID, 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; + } + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + //瀹℃牳 + public bool Cj_StationEntrustOutBillCheckBill(Int64 lngBillKey, string CurUserName, ref string sReturn) + { + try + { + string HChecker = CurUserName; + string HCheckDate = DBUtility.ClsPub.GetServerDate(-1); + oCN.BeginTran(); + ds = oCN.RunProcReturn("Select * from Sc_StationOutBillMain Where HInterID=" + lngBillKey.ToString(), "Sc_StationOutBillMain"); + if (ds.Tables[0].Rows.Count == 0) + { + sReturn = "鍗曟嵁鏈壘鍒帮紒"; + return false; + } + oCN.RunProc(" Update Sc_StationOutBillMain set HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString()); + oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Check_Out " + lngBillKey.ToString() + ",1"); + //鍒ゆ柇鏄惁鏄� 鏈亾宸ュ簭 + DataSet ds1; + ds1 = oCN.RunProcReturn(" select HLastProc,HFstProc from Sc_ProcessExchangeBillMain a " + + " inner join Sc_ProcessExchangeBillSub b on a.HInterID=b.HInterID " + + " Where a.HInterID=(Select HProcExchInterID from Sc_StationOutBillMain Where HInterID=" + lngBillKey + ") " + + " and b.HEntryID=(Select HProcExchEntryID from Sc_StationOutBillMain Where HInterID=" + lngBillKey + ")", "Sc_ProcessExchangeBillMain"); + if (ds1 == null || ds1.Tables[0].Rows.Count == 0) + { + } + else if (Pub_Class.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HFstProc"]) == "鏄�") + { + } + sReturn = sReturn + " 瀹℃牳鍔熻兘锛�"; + oCN.Commit(); + return true; + } + catch (Exception e) + { + sReturn = e.Message; + oCN.RollBack(); + return false; ; + } + } + #endregion + + #region 鍙嶅鏍� + [Route("Cj_StationEntrustOutBill/set_AbandonCheck")] + [HttpGet] + public object set_AbandonCheck(int HInterID, string CurUserName) + { + try + { + if (HInterID == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁ID涓�0锛屼笉鑳藉弽瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + DAL.ClsSc_StationEntrustOutBill oBill = new DAL.ClsSc_StationEntrustOutBill(); + //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾 + if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HChecker.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!"; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + //鍙嶅鏍� + if (Cj_StationEntrustOutBillAbandonCheckBill(HInterID, 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; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍙嶅鏍稿け璐ワ紒" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + //鍙嶅鏍� + public bool Cj_StationEntrustOutBillAbandonCheckBill(Int64 lngBillKey, string CurUserName, ref string sReturn) + { + if (Cj_StationEntrustOutBillisUse(lngBillKey, ref sReturn)) + { + return false; + } + try + { + string HChecker = CurUserName; + string HCheckDate = DBUtility.ClsPub.GetServerDate(-1); + oCN.BeginTran(); + ds = oCN.RunProcReturn("Select * from Sc_StationOutBillMain Where HInterID=" + lngBillKey.ToString(), "Sc_StationOutBillMain"); + if (ds.Tables[0].Rows.Count == 0) + { + sReturn = "鍗曟嵁鏈壘鍒帮紒"; + return false; + } + + oCN.RunProc(" Update Sc_StationOutBillMain set HChecker='',HCheckDate=null Where HInterID=" + lngBillKey.ToString()); + oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Check_Out " + lngBillKey.ToString() + ",-1"); + //鍒ゆ柇鏄惁鏄� 棣栭亾宸ュ簭 + DataSet ds1; + ds1 = oCN.RunProcReturn("select HLastProc,HFstProc " + + " from Sc_ProcessExchangeBillMain a " + + " inner join Sc_ProcessExchangeBillSub b on a.HInterID=b.HInterID " + + " Where a.HInterID=(Select HProcExchInterID from Sc_StationOutBillMain Where HInterID=" + lngBillKey + ") " + + " and b.HEntryID=(Select HProcExchEntryID from Sc_StationOutBillMain Where HInterID=" + lngBillKey + ")", "Sc_ProcessExchangeBillMain"); + if (ds1 == null || ds1.Tables[0].Rows.Count == 0) + { + } + else if (Pub_Class.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HFstProc"]) == "鏄�") + { + } + sReturn = sReturn + "鍙嶅鏍稿姛鑳斤紒"; + oCN.Commit(); + return true; + } + catch (Exception e) + { + sReturn = e.Message; + oCN.RollBack(); + return false; ; + } + } + + //鏄惁琚叧鑱� + public bool Cj_StationEntrustOutBillisUse(Int64 lngBillKey, ref string sReturn) + { + try + { + //鏌ヨ涓昏〃 + DataSet Ds; + Ds = oCN.RunProcReturn("Select HinterID from Sc_StationOutBillSub Where HInterID=" + lngBillKey.ToString() + " and isnull(HRelationQty,0)<>0 ", "Sc_StationOutBillSub"); + if (Ds.Tables[0].Rows.Count != 0) + { + sReturn = "鍗曟嵁宸茶鍏宠仈,涓嶈兘鎿嶄綔锛�"; + return true; + } + sReturn = ""; + return false; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + #endregion // } } \ No newline at end of file -- Gitblit v1.9.1