From f02c7cbe27d7da079f057b464e2b179f1dc17b08 Mon Sep 17 00:00:00 2001 From: yxj <yxj@hz-kingdee.com> Date: 星期二, 18 三月 2025 09:26:16 +0800 Subject: [PATCH] 新增提料运算(根据欠料单进行计算)调用方法 --- WebAPI/Controllers/BaseSet/Gy_MaterialController.cs | 334 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 332 insertions(+), 2 deletions(-) diff --git a/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs b/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs index d034440..15da306 100644 --- a/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs +++ b/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs @@ -2096,6 +2096,8 @@ int HNowWHID = mainList[0].HNowWHID; int HNowSPID = mainList[0].HNowSPID; string HMouldUseStatus = mainList[0].HMouldUseStatus; + int HCREATEORGID = mainList[0].HCREATEORGID; + int HUSEORGID = mainList[0].HUSEORGID; //淇濆瓨鍓嶆帶鍒�========================================= string HBillNote = ""; @@ -2131,7 +2133,7 @@ ",HPrintQty,HMouldStatus,HWhID,HRoutingID,HCaveQty" + ",HBomID,HVersion,HSPGroupID,HSPID,HDesignLife,HNowSupID,HNowSupTypeID" + ",HUseLife,HLeaveLife,HProdQty,HProdWeight,HMouldOWNER,HSaveLife,HMouldDotCheckRuleInterID,HMouldMaintainRuleInterID,HBarCode,HMadeSupID" + - ",HMouldClass,HNowWHID,HNowSPID,HInitLife,HMouldUseStatus) " + + ",HMouldClass,HNowWHID,HNowSPID,HInitLife,HMouldUseStatus,HCREATEORGID,HUSEORGID) " + " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" + "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HMaker + "',getdate()" + ",'" + HMouldNo + "','" + HName + "','" + HModel + "','" + HModel2 + "','" + HDiameter + "'" + @@ -2141,7 +2143,7 @@ "," + HPrintQty + ",'" + HMouldStatus + "'," + HWHID + "," + HRoutingID + "," + HCaveQty + "," + HBOMID + ",'" + HVersion + "'," + HSPGroupID + "," + HSPID + ",'" + HDesignLife + "','" + HNowSupID + "','" + HNowSupTypeID + "'" + ",'" + HUseLife + "','" + HLeaveLife + "','" + HProdQty + "','" + HProdWeight + "','" + HMouldOWNER + "','" + HSaveLife + "','" + HMouldDotCheckRuleInterID + "','" + HMouldMaintainRuleInterID + "','" + HBarCode + "'," + HMadeSupID + - ",'"+ HMouldClass + "'," + HNowWHID + "," + HNowSPID + ",'" + HInitLife + "','" + HMouldUseStatus + "') "); + ",'"+ HMouldClass + "'," + HNowWHID + "," + HNowSPID + ",'" + HInitLife + "','" + HMouldUseStatus + "',"+ HCREATEORGID + ","+ HUSEORGID + ") "); //瀛愯〃 oCN.RunProc("Insert into Gy_MouldFileSub " + @@ -2292,8 +2294,32 @@ int HNowWHID = mainList[0].HNowWHID; int HNowSPID = mainList[0].HNowSPID; string HMouldUseStatus = mainList[0].HMouldUseStatus; + int HUSEORGID = mainList[0].HUSEORGID; //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� oCN.BeginTran(); + + //淇濆瓨鍓嶆帶鍒�========================================= + string HBillNote = ""; + ds = oCN.RunProcReturn("Exec h_p_Gy_MouldFileMain_BeforeSaveCtrl " + HInterID.ToString() + ", '" + HBillNo + "','" + HBillNote + "',1 ", "h_p_Gy_MouldFileMain_BeforeSaveCtrl"); + 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]["HBackRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //========================================================= + //涓昏〃 oCN.RunProc("UpDate Gy_MouldFileMain set " + " HBillNo='" + HBillNo + "'" + //鍥哄畾璧嬪��=============== @@ -2314,6 +2340,7 @@ ",HPICNo='" + HPICNo + "'" + ",HWorkMaterModel='" + HWorkMaterModel + "'" + ",HMaterID=" + HMaterID.ToString() + + ",HUSEORGID=" + HUSEORGID.ToString() + ",HMaterNumber='" + HMaterNumber + "'" + ",HMouldClass='" + HMouldClass + "'" + ",HMouldType=" + HMouleTypeID.ToString() + @@ -2360,6 +2387,29 @@ oCN.RunProc("delete from Gy_MouldFileSub_MaintainRule where HInterID='" + HInterID + "'"); oCN.RunProc("delete from Gy_MouldFileSub_DotCheckRule where HInterID='" + HInterID + "'"); objJsonResult = AddBillSub(msg5, msg6, msg7, HInterID, HBillNo); + + + //淇濆瓨鍚庢帶鍒�========================================= + ds = oCN.RunProcReturn("Exec h_p_Gy_MouldFileMain_AfterSaveCtrl " + HInterID.ToString() + ", '" + HBillNo + "','" + HBillNote + "',1 ", "h_p_Gy_MouldFileMain_AfterSaveCtrl"); + 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]["HBackRemark"].ToString(); ; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //========================================================= oCN.Commit(); objJsonResult.code = "1"; @@ -2546,8 +2596,56 @@ } if (oBill.DeleteBill(hmainid, ref DBUtility.ClsPub.sExeReturnInfo)) { + oCN.BeginTran(); + //鍒犻櫎鍓嶆帶鍒�========================================= + ds = oCN.RunProcReturn("Exec h_p_Gy_MouldFile_BeforeDelCtrl " + hmainid + ",'" + User + "'", "h_p_Gy_MouldFile_BeforeDelCtrl"); + + if (ds == null) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎鍓嶅垽鏂け璐ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); + objJsonResult.data = null; + return objJsonResult; + } + //========================================================= + oCN.RunProc("Delete From Gy_MouldFileSub_MaintainRule where HInterID=" + hmainid); oCN.RunProc("Delete From Gy_MouldFileSub_DotCheckRule where HInterID=" + hmainid); + + //鍒犻櫎鍚庢帶鍒�========================================= + DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_MouldFile_AfterDelCtrl " + hmainid + ",'" + User + "'", "h_p_Gy_MouldFile_AfterDelCtrl"); + if (ds2 == null) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎鍚庡垽鏂け璐ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0") + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); + objJsonResult.data = null; + return objJsonResult; + } + //========================================================= + + oCN.Commit(); //鍐欏叆鏃ュ織 ClsPub.Add_Log("", "鍒犻櫎椤圭洰锛屼唬鐮侊細" + oBill.omodel.HMouldNo + ",鍚嶇О锛�" + oBill.omodel.HName, ClsPub.CurUserName); //鏇存柊涓婄骇涓� 鏈骇 @@ -2921,6 +3019,26 @@ } if (IsAudit == 0) //瀹℃牳鎻愪氦 { + //瀹℃牳鍓嶆帶鍒�========================================= + ds = oCN.RunProcReturn("Exec h_p_Sc_MouldStockBill_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Sc_MouldStockBill_BeforeCheckCtrl"); + if (ds == null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳鍓嶅垽鏂け璐ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); + objJsonResult.data = null; + return objJsonResult; + } + //========================================================= + //瀹℃牳鎻愪氦 if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { @@ -2938,9 +3056,50 @@ objJsonResult.data = null; return objJsonResult; } + + //瀹℃牳鍚庢帶鍒�========================================= + DataSet ds2 = oCN.RunProcReturn("Exec h_p_Sc_MouldStockBill_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Sc_MouldStockBill_AfterCheckCtrl"); + + if (ds2 == null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳鍚庡垽鏂け璐ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); + objJsonResult.data = null; + return objJsonResult; + } + //========================================================= } if (IsAudit == 1) //鍙嶅鏍告彁浜� { + //鍙嶅鏍稿墠鎺у埗========================================= + ds = oCN.RunProcReturn("Exec h_p_Sc_MouldStockBill_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Sc_MouldStockBill_BeforeUnCheckCtrl"); + if (ds == null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳鍓嶅垽鏂け璐ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); + objJsonResult.data = null; + return objJsonResult; + } + //========================================================= + //鍙嶅鏍告彁浜bandonCheck if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { @@ -2958,6 +3117,29 @@ objJsonResult.data = null; return objJsonResult; } + + //鍙嶅鏍稿悗鎺у埗========================================= + DataSet ds2 = oCN.RunProcReturn("Exec h_p_Sc_MouldStockBill_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'", "h_p_Sc_MouldStockBill_AfterUnCheckCtrl"); + if (ds2 == null) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳鍚庡垽鏂け璐ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0") + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); + objJsonResult.data = null; + return objJsonResult; + } + //========================================================= + } return objJsonResult; } @@ -2972,6 +3154,154 @@ } #endregion + #region 妯″叿妗堝叧闂�/鍙嶅叧闂姛鑳� + [Route("Gy_Mould/CloseGy_Mould")] + [HttpGet] + public object CloseGy_Mould(string HInterID, int Type, string user) + { + try + { + //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄� + if (!DBUtility.ClsPub.Security_Log("Gy_MouldFile_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; + DAL.ClsGy_MouldFile oBill = new DAL.ClsGy_MouldFile(); + oCN.BeginTran();//寮�濮嬩簨鍔� + + //Type 1 鍏抽棴 2 鍙嶅叧闂� + if (Type == 1) + { + if (!oBill.CloseBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + if (!oBill.CancelClose(int.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 + + #region 妯″叿妗f浣滃簾/鍙嶄綔搴熷姛鑳� + [Route("Gy_Mould/DeleteGy_Mould")] + [HttpGet] + public object DeleteGy_Mould(string HInterID, int Type, string user) + { + try + { + //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄� + if (!DBUtility.ClsPub.Security_Log("Gy_MouldFile_Drop", 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_MouldFile oBill = new DAL.ClsGy_MouldFile(); + ClsPub.CurUserName = user; + + oCN.BeginTran();//寮�濮嬩簨鍔� + + //Type 1 浣滃簾 2 鍙嶄綔搴� + if (Type == 1) + { + if (!oBill.Cancelltion(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + if (!oBill.AbandonCancelltion(int.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 + #region [妯″叿妗f鎵归噺鐢熸垚] [Route("Gy_Mould/SaveBatchGen_MouldFile")] [HttpGet] -- Gitblit v1.9.1