From 23dbc5b616dfa1a2bcb1fa4302637b8df701f43c Mon Sep 17 00:00:00 2001 From: yxj <yxj@hz-kingdee.com> Date: 星期四, 24 四月 2025 13:27:12 +0800 Subject: [PATCH] 1 --- WebAPI/DLL/ClsSc_ICMOReportBill.cs | 163 ++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 121 insertions(+), 42 deletions(-) diff --git a/WebAPI/DLL/ClsSc_ICMOReportBill.cs b/WebAPI/DLL/ClsSc_ICMOReportBill.cs index 5029aa8..73f4972 100644 --- a/WebAPI/DLL/ClsSc_ICMOReportBill.cs +++ b/WebAPI/DLL/ClsSc_ICMOReportBill.cs @@ -71,7 +71,7 @@ //鑾峰彇鏄庣粏琛屼慨鏀瑰墠鏁伴噺 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"); + Ds = oCn.RunProcReturn("select isnull(sum(isnull(HQty,0)),0) + isnull(sum(isnull(HBadQty,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"]); @@ -92,7 +92,7 @@ "HCloseMan,HCloseType,HRemark," + "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + - ",HICMOInterID,HICMOBillNo,HBarCode,HICMOEntryID" + + ",HICMOInterID,HICMOBillNo,HBarCode,HICMOEntryID,HBadQty" + ") 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() + @@ -100,20 +100,19 @@ ",'" + 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.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; - } + "," + oSub.HICMOInterID.ToString() + ",'" + oSub.HICMOBillNo + "','" + oSub.HBarCode + "'," + oSub.HICMOEntryID + "," + oSub.HBadQty + + ") "); + } + //鍙嶅啓浜ч噺姹囨姤鍗曪紝璐ㄩ噺姹囨姤鍗曞叧鑱斿瓧娈�,鐢熶骇璁㈠崟鍏宠仈鏁伴噺 + 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 + "," + DetailColl[0].HICMOTempID + , "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 == "鍚堟牸") { @@ -257,19 +256,18 @@ // " 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; - } + //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 + "," + DetailColl[0].HICMOTempID + , "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) @@ -408,7 +406,7 @@ } //瀹℃牳 - public bool CheckBill(Int64 lngBillKey, ref string sReturn) + public bool CheckBill(Int64 lngBillKey,string HBillNo, string procName, string sUser, ref string sReturn) { try @@ -419,8 +417,10 @@ oCn.RunProc(" Update " + MvarItemKey + " set HBillStatus='2',HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString()); DataSet ds,Ds; + string sql = ""; + ds = oCn.RunProcReturn("select * from Sc_ICMOReportBillMain where HInterID = " + lngBillKey, "Sc_ICMOReportBillMain"); - string HBillNo = ""; + HBillNo = ""; if (ds.Tables[0].Rows.Count > 0) { @@ -437,6 +437,7 @@ } else { + oSystemParameter.ShowBill(ref sReturn); JObject model = new JObject(); model.Add("FBillType", new JObject() { ["FNumber"] = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBillType"]) }); //鍗曟嵁绫诲瀷 model.Add("FDate", Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDate"])); //鍗曟嵁鏃ユ湡 @@ -444,6 +445,8 @@ model.Add("FBillNo", HBillNo); JArray Fentity = new JArray(); + string sErrMsg = ""; + string sJXCode = ""; foreach (DataRow item in Ds.Tables[1].Rows) { JObject FentityModel = new JObject(); @@ -457,7 +460,7 @@ FentityModel.Add("FMTONO", item["FMTONO"].ToString());// 璁″垝璺熻釜鍙� FentityModel.Add("FCheckProduct", item["FCheckProduct"].ToString());// 浜у搧妫�楠� FentityModel.Add("FISENTRUST", item["FISENTRUST"].ToString());// 缁勭粐濮旀墭鍔犲伐 - FentityModel.Add("FSrcBillType", "FSRCBILLTYPE");// 婧愬崟绫诲瀷 + FentityModel.Add("FSrcBillType", item["FSRCBILLTYPE"].ToString());// 婧愬崟绫诲瀷 FentityModel.Add("FMOBILLNO", item["FMOBILLNO"].ToString());// 鐢熶骇璁㈠崟 FentityModel.Add("FSrcBillNo", item["FSrcBillNo"].ToString());// 婧愬崟缂栧彿 FentityModel.Add("FMoEntrySeq", item["FMoEntrySeq"].ToString());//鐢熶骇璁㈠崟琛屽彿 @@ -491,8 +494,14 @@ 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() });// 鎿嶄綔鍛� + // + if (oSystemParameter.omodel.WMS_CampanyName == "涔濊彵") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� 绌虹櫧涓洪�氱敤 + { + 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 + @@ -509,7 +518,7 @@ FentityModel2.Add("FEntity_Link_FSId", item["FEntity_Link_FSId"].ToString()); Fentity2.Add(FentityModel2); FentityModel.Add("FEntity_Link", Fentity2); - FentityModel.Add("FBFLowId", new JObject() { ["FID"] = item["FBFLOWID"].ToString() }); // + FentityModel.Add("FBFLowId", new JObject() { ["FID"] = item["FBFLOWID"].ToString() }); Fentity.Add(FentityModel); } model.Add("FEntity", Fentity); //鏄庣粏淇℃伅 @@ -571,22 +580,54 @@ //鎻愪氦瀹℃牳 string result1 = string.Empty; string result2 = string.Empty; + var fID = JObject.Parse(result)["Result"]["Id"].ToString(); + var fBillNo = JObject.Parse(result)["Result"]["Number"].ToString(); + var json = new + { + Ids = fID, + }; if (oSystemParameter.omodel.Sc_ICMOReportBill_AutoCheck == "Y") //绯荤粺鍙傛暟 鑷姩瀹℃牳 { - result1 = InvokeHelper.Submit("PRD_MORPT", JsonConvert.SerializeObject(jsonRoot));//鎻愪氦 - result2 = InvokeHelper.Audit("PRD_MORPT", JsonConvert.SerializeObject(jsonRoot));//瀹℃牳 + result1 = InvokeHelper.Submit("PRD_MORPT", JsonConvert.SerializeObject(json));//鎻愪氦 + result2 = InvokeHelper.Audit("PRD_MORPT", JsonConvert.SerializeObject(json));//瀹℃牳 if (JObject.Parse(result1)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") { - sReturn = "鐢熶骇姹囨姤鍗曞崟鍙�:" + HBillNo + ",鎻愪氦澶辫触" + result; + sReturn = "鐢熶骇姹囨姤鍗曞崟鍙�:" + HBillNo + ",鎻愪氦澶辫触" + result1; oCn.RollBack(); return false; + } + + if (JObject.Parse(result2)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") + { + sReturn = "鐢熶骇姹囨姤鍗曞崟鍙�:" + HBillNo + ",瀹℃牳澶辫触" + result2; + oCn.RollBack(); + return false; } } } } sReturn = "瀹℃牳鍗曟嵁鎴愬姛锛�"; + + + //瀹℃牳鍚庢帶鍒�===============================================Begin================================================================ + sql = "exec " + procName + " " + lngBillKey + ",'" + HBillNo + "','" + sUser + "'"; + ds = oCn.RunProcReturn(sql, procName); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + sReturn = "瀹℃牳杩囩▼涓嚭閿欙紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + oCn.RollBack(); + return false; + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + sReturn = ds.Tables[0].Rows[0]["HRemark"].ToString(); + oCn.RollBack(); + return false; + } + //瀹℃牳鍚庢帶鍒�===============================================End================================================================ + oCn.Commit(); sReturn = ""; @@ -601,9 +642,10 @@ } //鍙嶅鏍� - public bool AbandonCheck(Int64 lngBillKey, ref string sReturn) + public bool AbandonCheck(Int64 lngBillKey, string HBillNo, string procName, string sUser, ref string sReturn) { - + string sql = ""; + DataSet ds; try { string HChecker = DBUtility.ClsPub.CurUserName; @@ -612,6 +654,25 @@ //杩樺師鍗曟嵁鐘舵�佷负鏈鏍哥姸鎬� oCn.RunProc(" Update " + MvarItemKey + " set HBillStatus='1',HChecker='',HCheckDate='' Where HInterID=" + lngBillKey.ToString()); sReturn = "鍙嶅鏍稿崟鎹垚鍔燂紒"; + + //瀹℃牳鍚庢帶鍒�===============================================Begin================================================================ + sql = "exec " + procName + " " + lngBillKey + ",'" + HBillNo + "','" + sUser + "'"; + ds = oCn.RunProcReturn(sql, procName); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + sReturn = "鍙嶅鏍歌繃绋嬩腑鍑洪敊锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; + oCn.RollBack(); + return false; + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + sReturn = ds.Tables[0].Rows[0]["HRemark"].ToString(); + oCn.RollBack(); + return false; + } + //瀹℃牳鍚庢帶鍒�===============================================End================================================================ + + oCn.Commit(); sReturn = ""; return true; @@ -624,14 +685,14 @@ } //鍒犻櫎鍗曟嵁 - public virtual bool DeleteBill(Int64 lngBillKey, ref string sReturn) + public virtual bool DeleteBill(Int64 lngBillKey, string HBillNo, string procName, string user, ref string sReturn) { try { oCn.BeginTran(); //鏌ヨ鐢熶骇姹囨姤鍗曡〃鏁伴噺 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(); + HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString(); string HICMOInterID = ds.Tables[0].Rows[0]["HICMOInterID"].ToString(); string HICMOEntryID = ds.Tables[0].Rows[0]["HICMOEntryID"].ToString(); // @@ -658,6 +719,24 @@ //鍒犻櫎涓昏〃 DeleteBillMain(lngBillKey); + //鍒犻櫎鍚庢帶鍒�================================================================================== + string sql2 = "exec " + procName + " " + lngBillKey + ",'" + HBillNo + "','" + user + "'"; + ds = oCn.RunProcReturn(sql2, procName); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + + sReturn = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + oCn.RollBack(); + return false; + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + sReturn = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); + oCn.RollBack(); + return false; + } + //============================================================================================== + sReturn = "鍒犻櫎鍗曟嵁鎴愬姛锛�"; oCn.Commit(); return true; -- Gitblit v1.9.1