From b38be3b76d6169692a7907b7f33cd488a5345279 Mon Sep 17 00:00:00 2001 From: yusijie <ysj@hz-kingdee.com> Date: 星期二, 18 三月 2025 16:58:58 +0800 Subject: [PATCH] 单据基础资料优化:器具主档,器具保养规程,器具点检规程,产品器具清单 ,设备档案,设备点检规程,设备保养规程 --- WebAPI/Controllers/MJGL/Sc_MouldinventoryBillController.cs | 212 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 211 insertions(+), 1 deletions(-) diff --git a/WebAPI/Controllers/MJGL/Sc_MouldinventoryBillController.cs b/WebAPI/Controllers/MJGL/Sc_MouldinventoryBillController.cs index 9a1c25d..721bad5 100644 --- a/WebAPI/Controllers/MJGL/Sc_MouldinventoryBillController.cs +++ b/WebAPI/Controllers/MJGL/Sc_MouldinventoryBillController.cs @@ -215,7 +215,6 @@ bool bResult; if (refSav == "Add") { - bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); } else if (refSav == "Update") @@ -331,10 +330,56 @@ return objJsonResult; } + //鍒犻櫎鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_Gy_MaterialMouldBill_BeforeDelCtrl " + BillOld1.omodel.HInterID + ",'" + BillOld1.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaterialMouldBill_BeforeDelCtrl"); + 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; + } + //================================================================================== + oCN.BeginTran(); oCN.RunProc("delete from Gy_MaterialMouldBillMain where HInterID = " + HInterID); oCN.RunProc("delete from Gy_MaterialMouldBillSub where HInterID = " + HInterID); + + //鍒犻櫎鍚庢帶鍒�========================================= + string sql2 = "exec h_p_Gy_MaterialMouldBill_AfterDelCtrl " + BillOld1.omodel.HInterID + ",'" + BillOld1.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql2, "h_p_Gy_MaterialMouldBill_AfterDelCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //================================================================================== oCN.Commit(); @@ -643,5 +688,170 @@ } } #endregion + + #region 浜у搧鍣ㄥ叿娓呭崟浣滃簾/鍙嶄綔搴熷姛鑳� + [Route("Sc_MouldinventoryBill/DeleteGy_MaterialMouldBillMain")] + [HttpGet] + public object DeleteGy_MaterialMouldBillMain(string HInterID, int Type, string user) + { + try + { + //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄� + if (!DBUtility.ClsPub.Security_Log("Gy_MaterialMouldBillMain_Delete", 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; + } + DAL.ClsGy_MaterialMouldBillMain oBill = new DAL.ClsGy_MaterialMouldBillMain(); + ClsPub.CurUserName = user; + Int64 lngBillKey = 0; + lngBillKey = DBUtility.ClsPub.isLong(HInterID); + //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁 + { + if (oBill.omodel.HChecker.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (Type == 1) //浣滃簾鍒ゆ柇 + { + if (oBill.omodel.HDeleteMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶄綔搴燂紒"; + objJsonResult.data = null; + return objJsonResult; + } + } + if (Type == 2) //鍙嶄綔搴熷垽鏂� + { + if (oBill.omodel.HDeleteMan.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; + } + + oCN.BeginTran();//寮�濮嬩簨鍔� + + //Type 1 浣滃簾 2 鍙嶄綔搴� + if (Type == 1) + { + //浣滃簾鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_Gy_MaterialMouldBill_BeforeDropCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaterialMouldBill_BeforeDropCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:浣滃簾鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + oCN.RollBack(); + 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; + oCN.RollBack(); + return objJsonResult; + } + //================================================================================== + + if (!oBill.Cancelltion(int.Parse(HInterID), oBill.omodel.HBillNo, "h_p_Gy_MaterialMouldBill_AfterDropCtrl", user, ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + //鍙嶄綔搴熷墠鎺у埗========================================= + string sql1 = "exec h_p_Gy_MaterialMouldBill_BeforeUnDropCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaterialMouldBill_BeforeUnDropCtrl"); + 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 (!oBill.AbandonCancelltion(int.Parse(HInterID), oBill.omodel.HBillNo, "h_p_Gy_MaterialMouldBill_AfterUnDropCtrl", user, 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