From 612f93dba4a45edea9d0300a1977e66fe7ce355f Mon Sep 17 00:00:00 2001 From: yxj <1qaz@123> Date: 星期五, 26 八月 2022 16:41:15 +0800 Subject: [PATCH] WEBAPI采购入库上传方法增加递入组织、制单人 --- DAL/MES/ClsSc_MESMaterToSourceBill .cs | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 103 insertions(+), 5 deletions(-) diff --git a/DAL/MES/ClsSc_MESMaterToSourceBill .cs b/DAL/MES/ClsSc_MESMaterToSourceBill .cs index 217041e..d13ee07 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() + @@ -83,7 +88,7 @@ ",'" + oSub.HBarCode + "','" + oSub.HBarCode_Pack + "','" + oSub.HBillNo_bak + "'" + ") "); } - sReturn = "淇敼鍗曟嵁鎴愬姛锛�"; + sReturn = omodel.HInterID.ToString(); oCn.Commit(); return true; } @@ -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() + ") "); @@ -258,6 +265,45 @@ } } + //鍒犻櫎鍗曟嵁 + public override bool DeleteBill(Int64 lngBillKey, ref string sReturn) + { + try + { + oCn.BeginTran(); + //鍒ゆ柇鏄惁鍏佽鍒犻櫎 + DataSet ds = oCn.RunProcReturn("exec h_p_Sc_MaterToSourceBill_DelCtrl @HInterId=" + lngBillKey + "", "h_p_Sc_MaterToSourceBill_DelCtrl"); + if (ds == null || ds.Tables[0].Rows.Count <= 0) + { + sReturn = "鏃犻獙璇佹暟鎹紒"; + return false; + } + if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "2") + { + sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); + return false; + } + + //鍒犻櫎鍏宠仈鍏崇郴 + oCn.RunProc("exec h_p_Sc_MaterToSourceBill_DelRelation @HInterId=" + lngBillKey + ""); + + //鍒犻櫎鏄庣粏琛� + oCn.RunProc("Delete From " + MvarItemKeySub + " where HInterID=" + lngBillKey.ToString()); + //鍒犻櫎涓昏〃 + oCn.RunProc("Delete From " + MvarItemKey + " where HInterID=" + lngBillKey.ToString()); + + sReturn = "鍒犻櫎鍗曟嵁鎴愬姛锛�"; + oCn.Commit(); + return true; + } + catch (Exception e) + { + sReturn = e.Message; + oCn.RollBack(); + throw (e); + } + } + //瀹℃牳 public bool CheckBill(Int64 lngBillKey, ref string sReturn) { @@ -266,13 +312,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 +344,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