From 6aabbf1bd500cad1fc3be2c983601ded513d4fa9 Mon Sep 17 00:00:00 2001 From: yusijie <ysj@hz-kingdee.com> Date: 星期五, 31 五月 2024 13:13:17 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API --- DAL/车间管理/ClsSc_MaterToSourceBill.cs | 152 +++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 129 insertions(+), 23 deletions(-) diff --git "a/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_MaterToSourceBill.cs" "b/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_MaterToSourceBill.cs" index 3a13dcd..2dfc622 100644 --- "a/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_MaterToSourceBill.cs" +++ "b/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_MaterToSourceBill.cs" @@ -18,7 +18,8 @@ base.MvarItemKeySub4 = ""; base.MvarItemKey="Sc_MaterToSourceBillMain"; base.MvarReportTitle="涓婃枡鍗�"; - base.BillType="3786"; + base.BillType="3786"; + base.HBillSubType = "3786"; } #region 鍥哄畾浠g爜 @@ -27,8 +28,63 @@ { DetailColl = null; } - + #endregion 鑷畾涔夋柟娉� + + //淇濆瓨鍓嶆帶鍒� + public bool BeforeSave(Int64 HInterID, string HBillNo, Int64 HSourceID, Int64 OperationType, ref string sReturn) + { + try + { + DataSet Ds = oCn.RunProcReturn("Exec h_p_Sc_MaterToSourceBill_BeforeSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + HSourceID.ToString() + "," + OperationType.ToString(), "h_p_Sc_MaterToSourceBill_BeforeSaveCtrl"); + if (Ds == null || Ds.Tables[0].Rows.Count == 0) + { + sReturn = "淇濆瓨鍓嶅垽鏂け璐ワ紒"; + return false; + } + else + { + if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1) + { + sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]); + return false; + } + } + return true; + } + catch (Exception e) + { + throw (e); + } + } + + //淇濆瓨鍚庢帶鍒� + public bool AfterSave(Int64 HInterID, string HBillNo, Int64 OperationType, ref string sReturn) + { + try + { + DataSet Ds = oCn.RunProcReturn("Exec h_p_Sc_MaterToSourceBill_AfterSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Sc_MaterToSourceBill_AfterSaveCtrl"); + if (Ds == null || Ds.Tables[0].Rows.Count == 0) + { + sReturn = "淇濆瓨鍚庡垽鏂け璐ワ紒"; + return false; + } + else + { + if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1) + { + sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]); + return false; + } + } + return true; + } + catch (Exception e) + { + throw (e); + } + } + //淇敼鍗曟嵁 public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) { @@ -36,6 +92,12 @@ { // oCn.BeginTran(); + //淇濆瓨鍓嶆帶鍒� + if (!BeforeSave(lngBillKey, omodel.HBillNo, omodel.HSourceID, 2, ref sReturn)) + { + oCn.RollBack(); + return false; + } //鏇存柊涓昏〃 oCn.RunProc("UpDate Sc_MaterToSourceBillMain set " + //鍥哄畾璧嬪��=============== @@ -46,7 +108,7 @@ ",HRemark='" + omodel.HRemark + "'" + ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" + ",HUpDateDate=getdate()" + - //======================================== + //======================================== ",HProcExchInterID=" + omodel.HProcExchInterID.ToString() + ",HProcExchEntryID=" + omodel.HProcExchEntryID.ToString() + ",HProcExchBillNo='" + omodel.HProcExchBillNo + "'" + @@ -60,6 +122,11 @@ ",HWorkerID=" + omodel.HWorkerID.ToString() + ",HWorkerBarCode='" + omodel.HWorkerBarCode + "'" + ",HGroupID=" + omodel.HGroupID.ToString() + + ",HMainSourceInterID='" + omodel.HMainSourceInterID.ToString() + "'" + + ",HMainSourceEntryID='" + omodel.HMainSourceEntryID.ToString() + "'" + + ",HMainSourceBillNo='" + omodel.HMainSourceBillNo + "'" + + ",HMainSourceBillType='" + omodel.HMainSourceBillType + "'" + + ",HStockOrgID=" + omodel.HSTOCKORGID.ToString() + " where HInterID=" + lngBillKey.ToString()); //鍒犻櫎鍏宠仈 DeleteRelation(ref sReturn, lngBillKey); @@ -70,18 +137,24 @@ foreach (Model.ClsSc_MaterToSourceBillSub oSub in DetailColl) { oCn.RunProc("Insert into Sc_MaterToSourceBillSub " + - " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + - ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + " (HInterID,HEntryID,HRemark,HRelationQty,HRelationMoney" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" + ",HMaterID,HUnitID,HQty,HPieceQty,HScanDate" + ",HBarCode,HBarCode_Pack,HBillNo_bak" + ") values(" - + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + - "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'" + "," + oSub.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPieceQty.ToString() + ",'" + oSub.HScanDate.ToShortDateString() + "'" + ",'" + oSub.HBarCode + "','" + oSub.HBarCode_Pack + "','" + oSub.HBillNo_bak + "'" + - ") "); + ") "); } - sReturn = "淇敼鍗曟嵁鎴愬姛锛�"; + //淇濆瓨鍚庢帶鍒� + if (!AfterSave(lngBillKey, omodel.HBillNo, 2, ref sReturn)) + { + oCn.RollBack(); + return false; + } + sReturn = "鍗曟嵁鍙凤細" + omodel.HBillNo + " 淇敼鎴愬姛锛�"; oCn.Commit(); return true; } @@ -97,40 +170,73 @@ { try { + //鑾峰彇绯荤粺鍙傛暟 + Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); + if (oSystemParameter.ShowBillByOrgID(omodel.HSTOCKORGID, ref sReturn) == false) + { + sReturn = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sReturn; + return false; + } //寰楀埌mainid - omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); - //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + if (omodel.HInterID == 0) + { + omodel.HInterID = DBUtility.ClsPub.CreateBillID_Prod(BillType, ref DBUtility.ClsPub.sExeReturnInfo); + } + //淇濆瓨鍓嶆帶鍒� + if (!BeforeSave(omodel.HInterID, omodel.HBillNo, omodel.HSourceID, 1, ref sReturn)) + { + return false; + } + oCn.BeginTran(); //涓昏〃 oCn.RunProc("Insert Into Sc_MaterToSourceBillMain " + "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + - ",HProcExchInterID,HProcExchEntryID,HProcExchBillNo,HICMOInterID,HICMOBillNo" + + ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType" + + ",HProcExchInterID,HProcExchEntryID,HProcExchBillNo,HICMOInterID,HICMOEntryID,HICMOBillNo" + ",HSourceID,HProcID,HMaterID,HSourceBarCode,HEquipID,HWorkerID,HWorkerBarCode" + - ",HGroupID" + + ",HGroupID,HStockOrgID" + ") " + - " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" + + " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate.ToShortDateString() + "'" + ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" + - "," + omodel.HProcExchInterID.ToString() + "," + omodel.HProcExchEntryID.ToString() + ",'" + omodel.HProcExchBillNo + "'," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "'" + + "," + omodel.HMainSourceInterID.ToString() + "," + omodel.HMainSourceEntryID.ToString() + ",'" + omodel.HMainSourceBillNo + "','" + omodel.HMainSourceBillType + "'" + + "," + omodel.HProcExchInterID.ToString() + "," + omodel.HProcExchEntryID.ToString() + ",'" + omodel.HProcExchBillNo + "'," + omodel.HICMOInterID.ToString() + "," + omodel.HICMOEntryID.ToString() + ",'" + omodel.HICMOBillNo + "'" + "," + omodel.HSourceID.ToString() + "," + omodel.HProcID.ToString() + "," + omodel.HMaterID.ToString() + ",'" + omodel.HSourceBarCode + "'," + omodel.HEquipID.ToString() + "," + omodel.HWorkerID.ToString() + ",'" + omodel.HWorkerBarCode + "'" + - "," + omodel.HGroupID.ToString() + + "," + omodel.HGroupID.ToString() +"," + omodel.HSTOCKORGID.ToString() + ") "); //鎻掑叆瀛愯〃 foreach (Model.ClsSc_MaterToSourceBillSub oSub in DetailColl) { oCn.RunProc("Insert into Sc_MaterToSourceBillSub " + - " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + - ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + " (HInterID,HEntryID,HRemark,HRelationQty,HRelationMoney" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" + ",HMaterID,HUnitID,HQty,HPieceQty,HScanDate" + ",HBarCode,HBarCode_Pack,HBillNo_bak" + ") values(" - + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + 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.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPieceQty.ToString() + ",'" + oSub.HScanDate.ToShortDateString() + "'" + + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'" + + "," + oSub.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPieceQty.ToString() + ",'" + oSub.HScanDate + "'" + ",'" + oSub.HBarCode + "','" + oSub.HBarCode_Pack + "','" + oSub.HBillNo_bak + "'" + - ") "); + ") "); } - sReturn = "鏂板鍗曟嵁鎴愬姛锛�"; + //淇濆瓨鍚庢帶鍒� + if (!AfterSave(omodel.HInterID, omodel.HBillNo, 1, ref sReturn)) + { + oCn.RollBack(); + return false; + } + + if (oSystemParameter.omodel.Sc_MaterToSourceBill_AutoCheck.ToUpper() == "Y") //绯荤粺鍙傛暟 鑷姩瀹℃牳 + { + //瀹℃牳鍗曟嵁 + oCn.RunProc("Update Sc_MaterToSourceBillMain Set HChecker='" + DBUtility.ClsPub.CurUserName + "',HCheckDate=getdate(),HBillStatus=2 where HInterID= " + omodel.HInterID.ToString()); + sReturn = "鍗曟嵁鍙凤細" + omodel.HBillNo + " 鏂板瀹℃牳鎴愬姛锛�"; + } + else + { + sReturn = "鍗曟嵁鍙凤細" + omodel.HBillNo + " 鏂板鎴愬姛锛�"; + } oCn.Commit(); return true; } -- Gitblit v1.9.1