From 2095d4d4920f16a8b493c80bada80db5cedc8c31 Mon Sep 17 00:00:00 2001 From: yusijie <ysj@hz-kingdee.com> Date: 星期二, 23 一月 2024 14:45:28 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API --- WebAPI/DLL/ClsSc_ICMOReportBill.cs | 127 +++++++++++++++++++++++++++++++++++------ 1 files changed, 107 insertions(+), 20 deletions(-) diff --git a/WebAPI/DLL/ClsSc_ICMOReportBill.cs b/WebAPI/DLL/ClsSc_ICMOReportBill.cs index 04de2d0..5029aa8 100644 --- a/WebAPI/DLL/ClsSc_ICMOReportBill.cs +++ b/WebAPI/DLL/ClsSc_ICMOReportBill.cs @@ -68,6 +68,15 @@ ",HGroupID=" + omodel.HGroupID.ToString() + ",HCheckType='" + omodel.HCheckType + "'" + " where HInterID=" + lngBillKey.ToString()); + + //鑾峰彇鏄庣粏琛屼慨鏀瑰墠鏁伴噺 + Int64 HBackQty = 0; + Ds = oCn.RunProcReturn("select isnull(sum(isnull(HQty,0)),0) + isnull(sum(isnull(HWasterQty,0)),0) as HBackQty from Sc_ICMOReportBillSub where HInterID = " + lngBillKey, "Sc_ICMOReportBillSub"); + if (Ds != null && Ds.Tables[0].Rows.Count > 0) + { + HBackQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBackQty"]); + } + //鍒犻櫎鍏宠仈 DeleteRelation(lngBillKey); //鍒犻櫎瀛愯〃 @@ -83,7 +92,7 @@ "HCloseMan,HCloseType,HRemark," + "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + - ",HICMOInterID,HICMOBillNo,HBarCode" + + ",HICMOInterID,HICMOBillNo,HBarCode,HICMOEntryID" + ") values(" + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + ",'" + oSub.HMaterNumber +"'"+ "," + oSub.HQty.ToString() + "," + oSub.HUnitID.ToString() + ",'" + oSub.HUnitNumber + "'," + oSub.HTimes.ToString() + "," + oSub.HSourceID.ToString() + @@ -91,8 +100,20 @@ ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + - "," + oSub.HICMOInterID.ToString() + ",'" + oSub.HICMOBillNo + "','" + oSub.HBarCode + "'" + + "," + oSub.HICMOInterID.ToString() + ",'" + oSub.HICMOBillNo + "','" + oSub.HBarCode + "'," + oSub.HICMOEntryID + ") "); + + //鍙嶅啓浜ч噺姹囨姤鍗曪紝璐ㄩ噺姹囨姤鍗曞叧鑱斿瓧娈�,鐢熶骇璁㈠崟鍏宠仈鏁伴噺 + Ds = oCn.RunProcReturn("exec h_p_Sc_ICMOReportBill_ReverseWriteQty " + omodel.HInterID + "," + oSub.HEntryID + ",'" + omodel.HBillNo + "'," + + DetailColl[0].HICMOInterID + "," + DetailColl[0].HICMOEntryID + "," + DetailColl[0].HICMOBillNo + ",'" + DetailColl[0].HSourceID + "','" + + "Edit" + "'," + HBackQty + , "h_p_Sc_ICMOReportBill_ReverseWriteQty"); + if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBack"]) == "1") + { + sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBackRemark"]); + oCn.RollBack(); + return false; + } } if (omodel.HCheckType == "鍚堟牸") { @@ -100,6 +121,16 @@ "from Sc_ICMOReportBillSub a inner join Gy_BarCodeBill b on a.HBarCode=b.HBarCode " + "Where a.HInterID=" + lngBillKey.ToString() + " "); } + //淇濆瓨鍚庢帶鍒�========================================= + Ds = oCn.RunProcReturn("exec h_p_Sc_ICMOReportBill_AfterSaveCtrl_New " + omodel.HInterID + "," + DetailColl[0].HICMOInterID + "," + DetailColl[0].HICMOEntryID + ",'" + DetailColl[0].HICMOBillNo + "'", "h_p_Sc_ICMOReportBill_AfterSaveCtrl_New"); + + if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBack"]) == "1") + { + sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBackRemark"]); + oCn.RollBack(); + return false; + } + //========================================================= //瀹℃牳鍗曟嵁 Ds = oCn.RunProcReturn("EXEC h_p_Sc_ICMOReportBill_Check " + omodel.HInterID.ToString() + ",'" + omodel.HMaker+ "'", "h_p_Sc_ICMOReportBill_Check"); if (Ds == null) @@ -152,9 +183,21 @@ try { //寰楀埌mainid - omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); + //omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� oCn.BeginTran(); + DataSet ds; + + //淇濆瓨鍓嶆帶鍒�========================================= + ds = oCn.RunProcReturn("exec h_p_Sc_ICMOReportBill_BeforeSaveCtrl_New " + omodel.HInterID + "," + oSub.HICMOInterID + "," + oSub.HICMOEntryID + ",'" + oSub.HICMOBillNo + "'", "h_p_Sc_ICMOReportBill_BeforeSaveCtrl_New"); + + if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "1") + { + sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); + oCn.RollBack(); + return false; + } + //========================================================= //涓昏〃 oCn.RunProc("Insert Into Sc_ICMOReportBillMain " + "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate" + @@ -201,14 +244,32 @@ oSub.HREQENTRYSEQ + "," + oSub.HREQENTRYID + "," + oSub.HMOMAINENTRYID + "," + oSub.HSTOCKINQUASELQTY + "," + oSub.HPRODUCTTYPE + ",'" + oSub.HPROJECTNO + "'," + oSub.HICMOENTRYSEQ + "," + oSub.HSEQ + ",'" + oSub.HPRODUCEDATE + "','" + oSub.HEXPIRYDATE + "'," + oSub.HBASEUNITID + "," + oSub.HDEPTID + "," + oSub.HGroupID + ",'" + oSub.HDESCRIPTION + "','" + oSub.HSourceNumber + "'," + oSub.HQPQty + "," + oSub.HICMOEntryID + "," + oSub.HWhID + "," + oSub.HSPID + ",'" + oSub.HBatChNo + "'," + oSub.HAuxPropID + ",'" + oSub.HMTONo + "'," + oSub.HPlanMode + "," + oSub.HERPInterID + "," + oSub.HERPEntryID + ") "); - //鍙嶅啓浜ч噺姹囨姤鍗曚复鏃惰〃鍏宠仈瀛楁淇℃伅 - string sql = string.Format(@"update Sc_ICMOBillWorkQtyStatus_Tmp set - HICMOReportInterID ='" + omodel.HInterID + - "', HICMOReportBillNo='" + omodel.HBillNo + - "', HRelationInterID='" + omodel.HInterID + - "', HRelationEntryID='" + oSub.HEntryID + - "' from Sc_ICMOBillWorkQtyStatus_Tmp a where a.HICMOBillNo='" + DetailColl[0].HICMOBillNo + "' and a.HSourceID='" + DetailColl[0].HSourceID + "' and HICMOInterID='" + DetailColl[0].HICMOInterID + "' and a.HICMOEntryID='" + DetailColl[0].HICMOEntryID + "' and a.HMaker='" + omodel.HMaker + "' and HRelationInterID='0'"); - oCn.RunProc(sql); + ////鍙嶅啓浜ч噺姹囨姤鍗曚复鏃惰〃鍏宠仈瀛楁淇℃伅 + //string sql = string.Format(@"update Sc_ICMOBillWorkQtyStatus_Tmp set " + + // " HICMOReportBillNo ='" + omodel.HBillNo + + // "', HRelationInterID='" + omodel.HInterID + + // "', HRelationEntryID='" + oSub.HEntryID + + // "' from Sc_ICMOBillWorkQtyStatus_Tmp a where a.HICMOBillNo='" + DetailColl[0].HICMOBillNo + "' and a.HSourceID='" + DetailColl[0].HSourceID + "' and HICMOInterID='" + DetailColl[0].HICMOInterID + "' and a.HICMOEntryID='" + DetailColl[0].HICMOEntryID + "' and HRelationInterID='0'"); + //oCn.RunProc(sql); + + ////鍙嶅啓璐ㄩ噺姹囨姤鍗曚复鏃惰〃鍏宠仈瀛楁淇℃伅 + //string sql2 = string.Format(@"update Sc_ICMOBillQualityStatus_Tmp set " + + // " HRelationBillNo ='" + omodel.HBillNo + + // "', HRelationInterID='" + omodel.HInterID + + // "' from Sc_ICMOBillQualityStatus_Tmp a where a.HICMOBillNo='" + DetailColl[0].HICMOBillNo + "' and a.HSourceID='" + DetailColl[0].HSourceID + "' and HICMOInterID='" + DetailColl[0].HICMOInterID + "' and a.HICMOEntryID='" + DetailColl[0].HICMOEntryID + "' and HRelationInterID='0'"); + //oCn.RunProc(sql2); + + //鍙嶅啓浜ч噺姹囨姤鍗曪紝璐ㄩ噺姹囨姤鍗曞叧鑱斿瓧娈�,鐢熶骇璁㈠崟鍏宠仈鏁伴噺 + ds = oCn.RunProcReturn("exec h_p_Sc_ICMOReportBill_ReverseWriteQty " + omodel.HInterID + "," + oSub.HEntryID + ",'" + omodel.HBillNo + "'," + + DetailColl[0].HICMOInterID + "," + DetailColl[0].HICMOEntryID + "," + DetailColl[0].HICMOBillNo + ",'" + DetailColl[0].HSourceID + "','" + + "Add" + "'," + 0 + , "h_p_Sc_ICMOReportBill_ReverseWriteQty"); + if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "1") + { + sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); + oCn.RollBack(); + return false; + } } // //foreach (Model.ClsSc_ICMOReportBillSub oSub in DetailColl) @@ -222,7 +283,18 @@ // return false; // } //} - // + // + // + //淇濆瓨鍚庢帶鍒�========================================= + ds = oCn.RunProcReturn("exec h_p_Sc_ICMOReportBill_AfterSaveCtrl_New " + omodel.HInterID + "," + DetailColl[0].HICMOInterID + "," + DetailColl[0].HICMOEntryID + ",'" + DetailColl[0].HICMOBillNo + "'", "h_p_Sc_ICMOReportBill_AfterSaveCtrl_New"); + + if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "1") + { + sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); + oCn.RollBack(); + return false; + } + //========================================================= sReturn = "鏂板鍗曟嵁鎴愬姛锛�"; oCn.Commit(); @@ -399,7 +471,6 @@ FentityModel.Add("FMoEntryId", item["FMoEntryId"].ToString());//鐢熶骇璁㈠崟鍒嗗綍鍙� FentityModel.Add("FBaseUnitID", new JObject() { ["FNumber"] = item["FBaseUnitID"].ToString() });//鍗曚綅 FentityModel.Add("FSTOCKINORGID", new JObject() { ["FNumber"] = item["FSTOCKINORGID"].ToString() });//鍏ュ簱缁勭粐 - FentityModel.Add("FBOMID", new JObject() { ["FNumber"] = item["FBOMID"].ToString() });// BOM鐗堟湰 FentityModel.Add("FOwnerTypeId", item["FOwnerTypeId"].ToString());// 璐т富绫诲瀷 FentityModel.Add("FOwnerId", new JObject() { ["FNumber"] = item["FOwnerId"].ToString() });// 璐т富 FentityModel.Add("FSTOCKID", new JObject() { ["FNumber"] = item["FSTOCKID"].ToString() });//浠撳簱 @@ -420,7 +491,10 @@ FentityModel.Add("FBASEFINISHQTY", item["FBASEFINISHQTY"].ToString());//鍩烘湰鍗曚綅瀹屾垚鏁伴噺 FentityModel.Add("FFINISHQTY", item["FFINISHQTY"].ToString());//瀹屾垚鏁伴噺 FentityModel.Add("FLot", new JObject() { ["FNumber"] = item["FLot"].ToString() });//鎵瑰彿 - + FentityModel.Add("FShiftGroupId", new JObject() { ["FNumber"] = item["FShiftGroupId"].ToString() });//鐝粍 + FentityModel.Add("F_UUBK_CZG1", new JObject() { ["FSTAFFNUMBER"] = item["F_UUBK_CZG1"].ToString() });// 鎿嶄綔鍛� + FentityModel.Add("FBOMID", new JObject() { ["FNumber"] = item["FBOMID"].ToString() });// BOM鐗堟湰 + //sJson_BatchNo + //sJson_StockPlace + //" \"FAUXPROPID\":{\"FAUXPROPID__FF100002\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}}," + @@ -520,6 +594,7 @@ } catch (Exception e) { + oCn.RollBack(); sReturn = e.Message; throw (e); } @@ -555,14 +630,26 @@ { oCn.BeginTran(); //鏌ヨ鐢熶骇姹囨姤鍗曡〃鏁伴噺 - DataSet ds = oCn.RunProcReturn("select a.HBillNo,b.HSourceInterID,b.HSourceEntryID from Sc_ICMOReportBillMain a inner join Sc_ICMOReportBillSub b on a.HInterID = b.HInterID where a.HInterID = '" + lngBillKey + "'", "Sc_ICMOReportBillMain"); + DataSet ds = oCn.RunProcReturn("select a.HBillNo,b.HICMOInterID,b.HICMOEntryID from Sc_ICMOReportBillMain a inner join Sc_ICMOReportBillSub b on a.HInterID = b.HInterID where a.HInterID = '" + lngBillKey + "'", "Sc_ICMOReportBillMain"); string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString(); - string HSourceInterID = ds.Tables[0].Rows[0]["HSourceInterID"].ToString(); - string HSourceEntryID = ds.Tables[0].Rows[0]["HSourceEntryID"].ToString(); + string HICMOInterID = ds.Tables[0].Rows[0]["HICMOInterID"].ToString(); + string HICMOEntryID = ds.Tables[0].Rows[0]["HICMOEntryID"].ToString(); // - //鏇存柊浜ч噺姹囨姤涓存椂琛ㄦ槸鍚︽姤妫�鐢宠鐘舵�� - string sql1 = string.Format(@"update Sc_ICMOBillWorkQtyStatus_Tmp set HRelationInterID='0' where HICMOReportBillNo='"+ HBillNo + "' and HICMOInterID='"+ HSourceInterID + "' and HICMOEntryID='"+ HSourceEntryID + "'"); - oCn.RunProc(sql1); + ////鏇存柊浜ч噺姹囨姤涓存椂琛ㄦ槸鍚︽姤妫�鐢宠鐘舵�� + //string sql1 = string.Format(@"update Sc_ICMOBillWorkQtyStatus_Tmp set HRelationInterID='0',HRelationEntryID='0',HICMOReportBillNo=null where HICMOReportBillNo='" + HBillNo + "' and HICMOInterID='"+ HICMOInterID + "' and HICMOEntryID='"+ HICMOEntryID + "'"); + //oCn.RunProc(sql1); + ////鏇存柊璐ㄩ噺姹囨姤涓存椂琛ㄦ槸鍚︽姤妫�鐢宠鐘舵�� + //string sql2 = string.Format(@"update Sc_ICMOBillQualityStatus_Tmp set HRelationInterID='0',HRelationBillNo='' where HRelationBillNo='" + HBillNo + "' and HRelationInterID='" + lngBillKey + "'"); + //oCn.RunProc(sql2); + //鏇存柊浜ч噺/璐ㄩ噺姹囨姤涓存椂琛ㄦ槸鍚︽姤妫�鐢宠鐘舵�侊紝鎾ゅ洖鐢熶骇璁㈠崟鍏宠仈鏁伴噺 + ds = oCn.RunProcReturn("exec h_p_Sc_ICMOReportBill_BeforeDel " + lngBillKey + ",'" + HBillNo + "'," + HICMOInterID + "," + HICMOEntryID , "h_p_Sc_ICMOReportBill_BeforeDel"); + + if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "1") + { + sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); + oCn.RollBack(); + return false; + } //鍒犻櫎鍏宠仈 DeleteRelation(ref sReturn, lngBillKey); -- Gitblit v1.9.1