From 649122a1ff1d7ef30f087e726d37948f65bede8a Mon Sep 17 00:00:00 2001 From: YL <YL@LAPTOP-SE03PLUR> Date: 星期三, 08 九月 2021 18:38:41 +0800 Subject: [PATCH] 报工台,上料防错单保存、自动审核、反审核 --- DAL/MES/ClsSc_MESMaterToSourceBill .cs | 67 +++++++++++++++++++++++++++++++-- 1 files changed, 63 insertions(+), 4 deletions(-) diff --git a/DAL/MES/ClsSc_MESMaterToSourceBill .cs b/DAL/MES/ClsSc_MESMaterToSourceBill .cs index 217041e..83efea5 100644 --- a/DAL/MES/ClsSc_MESMaterToSourceBill .cs +++ b/DAL/MES/ClsSc_MESMaterToSourceBill .cs @@ -53,7 +53,12 @@ ",HProcExchEntryID=" + omodel.HProcExchEntryID.ToString() + ",HProcExchBillNo='" + omodel.HProcExchBillNo + "'" + ",HICMOInterID=" + omodel.HICMOInterID.ToString() + + ",HICMOEntryID=" + omodel.HICMOEntryID.ToString() + ",HICMOBillNo='" + omodel.HICMOBillNo + "'" + + ",HMainSourceBillType=" + omodel.HMainSourceBillType.ToString() + + ",HMainSourceInterID=" + omodel.HMainSourceInterID.ToString() + + ",HMainSourceEntryID=" + omodel.HMainSourceEntryID.ToString() + + ",HMainSourceBillNo=" + omodel.HMainSourceBillNo.ToString() + ",HSourceID=" + omodel.HSourceID.ToString() + ",HProcID=" + omodel.HProcID.ToString() + ",HMaterID=" + omodel.HMaterID.ToString() + @@ -107,13 +112,15 @@ oCn.RunProc("Insert Into Sc_MaterToSourceBillMain " + "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + - ",HProcExchInterID,HProcExchEntryID,HProcExchBillNo,HICMOInterID,HICMOBillNo" + + ",HProcExchInterID,HProcExchEntryID,HProcExchBillNo,HICMOInterID,HICMOEntryID,HICMOBillNo" + + ",HMainSourceBillType,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo" + ",HSourceID,HProcID,HMaterID,HSourceBarCode,HEquipID,HWorkerID,HWorkerBarCode" + ",HGroupID" + ") " + " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" + ", " + 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.HProcExchInterID.ToString() + "," + omodel.HProcExchEntryID.ToString() + ",'" + omodel.HProcExchBillNo + "'," + omodel.HICMOInterID.ToString() + ","+ omodel.HICMOEntryID.ToString() + ",'" + omodel.HICMOBillNo + "'" + + "," + omodel.HMainSourceBillType.ToString() + "," + omodel.HMainSourceInterID.ToString() + "," + omodel.HMainSourceEntryID.ToString() + ",'" + omodel.HMainSourceBillNo + "'" + "," + omodel.HSourceID.ToString() + "," + omodel.HProcID.ToString() + "," + omodel.HMaterID.ToString() + ",'" + omodel.HSourceBarCode + "'," + omodel.HEquipID.ToString() + "," + omodel.HWorkerID.ToString() + ",'" + omodel.HWorkerBarCode + "'" + "," + omodel.HGroupID.ToString() + ") "); @@ -266,13 +273,28 @@ { string HChecker = DBUtility.ClsPub.CurUserName; string HCheckDate = DBUtility.ClsPub.GetServerDate(-1); - oCn.RunProc(" Update " + MvarItemKey + " set HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString()); + oCn.BeginTran(); + oCn.RunProc(" Update " + MvarItemKey + " set HBillStatus='2', HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString()); //鐢熸垚璋冩嫧鍗� //寰楀埌璋冩嫧鍗� mainid 鍗曟嵁鍙� //long NewInterID = DBUtility.ClsPub.CreateBillID("1207", ref DBUtility.ClsPub.sExeReturnInfo); //string NewBillNo = DBUtility.ClsPub.CreateBillCode("1207", ref DBUtility.ClsPub.sExeReturnInfo, true);//寰楀埌鏂板崟鍙� //oCn.RunProc("exec h_p_Kf_MoveStockBill_Add " + lngBillKey.ToString() + "," + NewInterID.ToString() + ",'" + NewBillNo + "','" + HChecker + "'"); // + //鍐嶆楠岃瘉 淇濆瓨鏄惁 鍚堢悊 + DataSet ds = oCn.RunProcReturn("exec h_p_Sc_MaterToSourceBill_AddRelation @HInterId=" + omodel.HInterID + "", "h_p_Sc_MaterToSourceBill_AddRelation"); + if (ds == null || ds.Tables[0].Rows.Count <= 0) + { + sReturn = "鏃犻獙璇佹暟鎹紒"; + oCn.RollBack(); + } + if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "2") + { + sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); + oCn.RollBack(); + } + + oCn.Commit(); sReturn = ""; return true; } @@ -283,9 +305,46 @@ } } + //鍙嶅鏍� + public bool AbandonCheck(Int64 lngBillKey, ref string sReturn) + { + try + { + string HChecker = DBUtility.ClsPub.CurUserName; + string HCheckDate = DBUtility.ClsPub.GetServerDate(-1); + oCn.BeginTran(); + oCn.RunProc(" Update " + MvarItemKey + " set HBillStatus='1', HChecker='',HCheckDate=null Where HInterID=" + lngBillKey.ToString()); + //鐢熸垚璋冩嫧鍗� + //寰楀埌璋冩嫧鍗� mainid 鍗曟嵁鍙� + //long NewInterID = DBUtility.ClsPub.CreateBillID("1207", ref DBUtility.ClsPub.sExeReturnInfo); + //string NewBillNo = DBUtility.ClsPub.CreateBillCode("1207", ref DBUtility.ClsPub.sExeReturnInfo, true);//寰楀埌鏂板崟鍙� + //oCn.RunProc("exec h_p_Kf_MoveStockBill_Add " + lngBillKey.ToString() + "," + NewInterID.ToString() + ",'" + NewBillNo + "','" + HChecker + "'"); + // + //鍐嶆楠岃瘉 淇濆瓨鏄惁 鍚堢悊 + DataSet ds = oCn.RunProcReturn("exec h_p_Sc_MaterToSourceBill_DelRelation @HInterId=" + omodel.HInterID + "", "h_p_Sc_MaterToSourceBill_DelRelation"); + if (ds == null || ds.Tables[0].Rows.Count <= 0) + { + sReturn = "鏃犻獙璇佹暟鎹紒"; + oCn.RollBack(); + } + if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "2") + { + sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); + oCn.RollBack(); - + } + + oCn.Commit(); + sReturn = ""; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } } } -- Gitblit v1.9.1