From 8bbddac33b29a8d5091d97456622886b4fb0b022 Mon Sep 17 00:00:00 2001 From: yusijie <ysj@hz-kingdee.com> Date: 星期四, 01 二月 2024 14:04:04 +0800 Subject: [PATCH] 删除前后控制(产量汇报单,质量汇报单,生产汇报单,开工单,完工单,停工挂起单) --- WebAPI/Controllers/生产管理/报工台工序/Sc_MESBeginStepWorkBillController.cs | 96 +++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 91 insertions(+), 5 deletions(-) diff --git "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\346\212\245\345\267\245\345\217\260\345\267\245\345\272\217/Sc_MESBeginStepWorkBillController.cs" "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\346\212\245\345\267\245\345\217\260\345\267\245\345\272\217/Sc_MESBeginStepWorkBillController.cs" index 29ecca9..3c32689 100644 --- "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\346\212\245\345\267\245\345\217\260\345\267\245\345\272\217/Sc_MESBeginStepWorkBillController.cs" +++ "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\346\212\245\345\267\245\345\217\260\345\267\245\345\272\217/Sc_MESBeginStepWorkBillController.cs" @@ -160,9 +160,39 @@ return objJsonResult; } - bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + oCN.BeginTran();//寮�濮嬩簨鍔� + + //鍒犻櫎鍓嶆帶鍒�========================================= + DataSet Ds; + + string sql1 = "exec h_p_Sc_MESBeginWorkBill_BeforeDelCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + UserName + "'"; + Ds = oCN.RunProcReturn(sql1, "h_p_Sc_MESBeginWorkBill_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; + oCN.RollBack(); + 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; + oCN.RollBack(); + return objJsonResult; + } + //================================================================================== + + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Sc_MESBeginWorkBill_AfterDelCtrl", UserName, ref DBUtility.ClsPub.sExeReturnInfo); if (IsDete) { + oCN.Commit();//鎻愪氦浜嬪姟 + objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; @@ -176,6 +206,7 @@ objJsonResult.count = 0; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; + oCN.RollBack(); return objJsonResult; } } @@ -185,6 +216,7 @@ objJsonResult.count = 0; objJsonResult.Message = "鍗曟嵁鏈壘鍒�"; objJsonResult.data = null; + oCN.RollBack(); return objJsonResult; } } @@ -1072,6 +1104,7 @@ } ds = oCN.RunProcReturn("select * from Sc_ICMOBillWorkQtyStatus_Tmp where HInterID=" + HInterID + " and HSourceInterID=" + HICMOInterID + " and HSourceEntryID=" + HICMOEntryID, "Sc_ICMOBillWorkQtyStatus_Tmp"); + string HBillNo = ""; if (ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; @@ -1079,31 +1112,84 @@ objJsonResult.data = null; return objJsonResult; } + else + { + HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString(); + } + oCN.BeginTran(); + + //鍒犻櫎鍓嶆帶鍒�========================================= + DataSet Ds; + + string sql1 = "exec h_p_Sc_ICMOBillWorkQtyStatus_BeforeDelCtrl " + HInterID + ",'" + HBillNo + "','" + UserName + "'"; + Ds = oCN.RunProcReturn(sql1, "h_p_Sc_ICMOBillWorkQtyStatus_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; + oCN.RollBack(); + 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; + oCN.RollBack(); + return objJsonResult; + } + //================================================================================== + //鍒犻櫎浜ч噺姹囨姤琛� string sql = string.Format(@"delete Sc_ICMOBillWorkQtyStatus_Tmp where HInterID='" + HInterID + "'"); oCN.RunProc(sql); double sumqty = double.Parse(ds.Tables[0].Rows[0]["HQty"].ToString()) + double.Parse(ds.Tables[0].Rows[0]["HBadQty"].ToString()) + double.Parse(ds.Tables[0].Rows[0]["HWasterQty"].ToString()); //姹囨姤鏁伴噺+涓嶈壇+鎶ュ簾 //鍥炲啓鐢熶骇鐘舵�佷复鏃惰〃Sc_ICMOBillStatus_Tmp鎷嗗垎姹囨姤鏁伴噺 HSplitRelationQty oCN.RunProc("update Sc_ICMOBillStatus_Tmp set HSplitRelationQty=HSplitRelationQty-" + sumqty + " where HICMOBillNo='" + ds.Tables[0].Rows[0]["HICMOBillNo"].ToString() + "' and HSourceID='" + ds.Tables[0].Rows[0]["HSourceID"].ToString() + "' and HICMOInterID='" + ds.Tables[0].Rows[0]["HICMOInterID"].ToString() + "' and HICMOEntryID='" + ds.Tables[0].Rows[0]["HICMOEntryID"].ToString() + "' and HInterID=" + ds.Tables[0].Rows[0]["HSourceInterID"].ToString()); - + + //鍒犻櫎鍚庢帶鍒�================================================================================== + string sql2 = "exec h_p_Sc_ICMOBillWorkQtyStatus_AfterDelCtrl " + HInterID + ",'" + HBillNo + "','" + UserName + "'"; + Ds = oCN.RunProcReturn(sql2, "h_p_Sc_ICMOBillWorkQtyStatus_AfterDelCtrl"); + if (Ds == null || Ds.Tables.Count == 0 || Ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + Ds.Tables[0].Rows[0]["HRemark"].ToString(); + objJsonResult.data = null; + oCN.RollBack(); + 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; + oCN.RollBack(); + return objJsonResult; + } + //============================================================================================== oCN.Commit(); objJsonResult.code = "1"; objJsonResult.count = 1; - objJsonResult.Message = "鍒犻櫎璧勬簮鎴愬姛锛�"; + objJsonResult.Message = "鍒犻櫎浜ч噺姹囨姤鍗曟垚鍔燂紒"; objJsonResult.data = ds; return objJsonResult; } catch (Exception e) { - objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = e.Message.ToString(); objJsonResult.data = null; - + oCN.RollBack(); } return objJsonResult; } -- Gitblit v1.9.1