From efa57c53b1b4c94e188a52f5a35d0a4ca8a82cb5 Mon Sep 17 00:00:00 2001 From: yusijie <ysj@hz-kingdee.com> Date: 星期四, 29 六月 2023 14:55:30 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API --- WebAPI/DLL/ClsSc_MESReturnStepWorkBill.cs | 297 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 297 insertions(+), 0 deletions(-) diff --git a/WebAPI/DLL/ClsSc_MESReturnStepWorkBill.cs b/WebAPI/DLL/ClsSc_MESReturnStepWorkBill.cs index 19492b6..aca74cd 100644 --- a/WebAPI/DLL/ClsSc_MESReturnStepWorkBill.cs +++ b/WebAPI/DLL/ClsSc_MESReturnStepWorkBill.cs @@ -1,7 +1,9 @@ 锘縰sing System; using System.Collections.Generic; +using System.Data; using System.Linq; using System.Web; +using ViewAPI; namespace WebAPI.DLL { @@ -22,5 +24,300 @@ base.HBillSubType = "3718"; } + + #region 鍥哄畾浠g爜 + + ~ClsSc_MESReturnStepWorkBill() + { + DetailColl = null; + } + + #endregion 鑷畾涔夋柟娉� + + //淇敼鍗曟嵁 + public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) + { + try + { + // + oCn.BeginTran(); + //鏇存柊涓昏〃 + oCn.RunProc("UpDate Sc_ProcessPlanMain set " + + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== + ",HDate='" + omodel.HDate + "'" + + ",HYear='" + omodel.HYear.ToString() + "'" + + ",HPeriod='" + omodel.HPeriod.ToString() + "'" + + ",HBillStatus='" + omodel.HBillStatus + "'" + + ",HRemark='" + omodel.HRemark + "'" + + ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" + + ",HUpDateDate=getdate()" + + //======================================== + //",HSupID=" + omodel.HSupID.ToString() + + //",HEmpID=" + omodel.HEmpID.ToString() + + ",HICMOInterID=" + omodel.HICMOInterID.ToString() + + ",HICMOBillNo='" + omodel.HICMOBillNo + "'" + + ",HMaterID=" + omodel.HMaterID.ToString() + + " where HInterID=" + lngBillKey.ToString()); + //鍒犻櫎鍏宠仈 + DeleteRelation(ref sReturn, lngBillKey); + //鍒犻櫎瀛愯〃 + DeleteBillSub(lngBillKey); + //鎻掑叆瀛愯〃 + omodel.HInterID = lngBillKey; + //鎻掑叆瀛愯〃 + oCn.RunProc("Insert Into Sc_ProcessPlanSub " + + "(HInterID,HEntryID,HBillNo" + + ",HICMOInterID,HICMOBillNo,HProcNo,HProcID" + + ",HGroupID,HDeptID,HWorkerID,HQty,HPlanBeginDate,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" + + ") " + + " values(" + omodel.HInterID.ToString() + ",0,'" + omodel.HBillNo + + "'," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "','" + omodel.HProcNo + "'," + omodel.HProcID.ToString() + "," + omodel.HGroupID.ToString() + + "," + omodel.HDeptID.ToString() + "," + omodel.HWorkerID.ToString() + "," + omodel.HQty.ToString() + ",'" + omodel.HPlanBeginDate.ToString() + "'," + omodel.HSourceInterID.ToString() + + "," + omodel.HSourceEntryID.ToString() + ",'" + omodel.HSourceBillNo + "','" + omodel.HSourceBillType + + "') "); + sReturn = "淇敼鍗曟嵁鎴愬姛锛�"; + oCn.Commit(); + return true; + } + catch (Exception e) + { + sReturn = e.Message; + oCn.RollBack(); + throw (e); + } + } + //鏂板鍗曟嵁 + public override bool AddBill(ref string sReturn) + { + try + { + //鑾峰彇褰撳墠宸ュ簭宸ュ簭鍙蜂互鍙婂垽鏂槸鍚︽湯閬撳伐搴� + //string sql = string.Format(@"select max(b.HProcNo) HProcNo from Sc_ProcessPlanMain a + // inner join Sc_ProcessPlanSub b on a.HInterID=b.HInterID + // where b.HSourceBillNo='" + omodel.HSourceBillNo+"' and b.HSourceInterID='"+omodel.HSourceInterID+"' and b.HSourceEntryID='"+omodel.HSourceEntryID+"'"); + //DataSet ds= oCn.RunProcReturn(sql, "Sc_ProcessPlanMain"); + //鏌ヨ鏈�澶у伐搴忓強鍒ゆ柇褰撳墠宸ュ簭鏄惁灏忎簬鏈�澶у伐搴� + //if (ds.Tables[0].Rows.Count > 0 && int.Parse(ds.Tables[0].Rows[0]["HProcNo"].ToString()) > omodel.HProcID) + //{ + // omodel.HProcNo = omodel.HProcNo + 5; + //} + //else + //{ + // omodel.HProcNo = omodel.HProcNo + 5; //鏈亾宸ュ簭搴忓彿鍔�5 + //} + + //寰楀埌mainid + omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCn.BeginTran(); + //涓昏〃 + oCn.RunProc("Insert Into Sc_ProcessPlanMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" + + ",HYear,HPeriod,HRemark" + + ",HICMOInterID,HICMOBillNo,HMaterID,HMaterNumber,HPlanQty,HExplanation,HInnerBillNo" + + ") " + + " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + omodel.HBillStatus.ToString() + ",getdate(),'" + DBUtility.ClsPub.CurUserName + "',getdate()" + + "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'" + + "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "'," + omodel.HMaterID.ToString() + ",'" + omodel.HMaterNumber + "','" + omodel.HQty + "'" + + ",'鎶ュ伐鍙拌繑宸ュ伐搴忕敵璇�','') "); + + + //鎻掑叆瀛愯〃 + oCn.RunProc("Insert Into Sc_ProcessPlanSub " + + "(HInterID,HEntryID,HBillNo" + + ",HICMOInterID,HICMOBillNo,HProcNo,HProcID,HProcNumber" + + ",HGroupID,HDeptID,HWorkerID,HQty,HPlanBeginDate,HPlanEndDate,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo,HRemark,HRelationQty" + + ",HRelationMoney,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HSourceID" + + ") " + + " values(" + omodel.HInterID.ToString() + ",1,'" + omodel.HBillNo + + "'," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "','" + omodel.HProcNo + "'," + omodel.HProcID.ToString() + ",''," + omodel.HGroupID.ToString() + + "," + omodel.HDeptID.ToString() + "," + omodel.HWorkerID.ToString() + "," + omodel.HQty.ToString() + ",'" + omodel.HPlanBeginDate.ToString() + "',getdate(),'0','0','','鎶ュ伐鍙拌繑宸ュ伐搴�','0'" + + ",'0'," + omodel.HSourceInterID.ToString() + "," + omodel.HSourceEntryID.ToString() + ",'" + omodel.HSourceBillNo + "','" + omodel.HSourceBillType + "'," + omodel.HSourceID.ToString() + ")"); + + //鏂板鐢熶骇鐘舵�佷复鏃惰〃 + string sql1 = string.Format(@"insert into Sc_ICMOBillStatus_Tmp(HYear,HPeriod,HBillType,HDate,HDeptID,HICMOInterID,HICMOEntryID,HICMOBillNo,HYX,HSplitNO,HICMOStatus,HMaterID + ,HMaterNumber,HUnitID,HUnitNumber,HSourceID,HSourceNumber,HPlanQty,HSplitPlanQty,HSplitRelationQty,HDatePlanQty + ,HUnitFinishQty,HDateFinishQty,HBadQty,HUnitBadQty,HWasterQty,HSumTimes,HFinishFlag,HCurWorkFlag,HCurQualityFlag + ,HBeginDate,HEndDate,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo + ,HSourceBillType,HRelationInterID,HEnoughMaterFlag,HProcID) + select datepart(yyyy,GETDATE()),datepart(mm,GETDATE()),'3722',getdate(),'" + omodel.HDeptID+"','"+omodel.HICMOInterID + "','"+omodel.HSourceEntryID+"','"+omodel.HSourceBillNo+"','1','1',0,'"+omodel.HMaterID+"'" + + ",HMaterNumber,HUnitID,HUnitNumber,HSourceID,HSourceNumber,'"+omodel.HQty+"',HSplitPlanQty,HSplitRelationQty,'"+omodel.HQty+"'" + + ",'0','0','0','0','0','0','0','0','0'" + + ",getdate(),getdate(),'杩斿伐璁″垝','"+omodel.HICMOInterID + "','"+omodel.HSourceEntryID+"','"+omodel.HSourceBillNo+"'" + + ",'"+omodel.HSourceBillType+"','0','0','"+omodel.HProcID+"'" + + "from Sc_ICMOBillStatus_Tmp where HSourceBillNo='"+omodel.HSourceBillNo.ToString()+"'" + + " and HSourceInterID='"+omodel.HSourceInterID+"' and HSourceEntryID='"+omodel.HMainSourceEntryID.ToString()+"'" + + " and HSourceID='"+omodel.HSourceID.ToString()+"' and HProcID='"+omodel.HProcID.ToString()+"'"); + oCn.RunProc(sql1); + sReturn = "鏂板鍗曟嵁鎴愬姛锛�"; + oCn.Commit(); + return true; + } + catch (Exception e) + { + sReturn = e.Message; + oCn.RollBack(); + throw (e); + } + } + + //鏄剧ず鍗曟嵁 + public override bool ShowBill(Int64 lngBillKey, ref string sReturn) + { + try + { + //鏌ヨ涓昏〃 + DataSet Ds; + Ds = oCn.RunProcReturn("Select * from Sc_ProcessPlanMain Where HInterID=" + lngBillKey.ToString(), "Sc_ProcessPlanMain"); + if (Ds.Tables[0].Rows.Count == 0) + { + sReturn = "鍗曟嵁鏈壘鍒帮紒"; + return false; + } + //璧嬪�� + omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]); + omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]); + omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]); + omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]); + omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]); + omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]); + omodel.HBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillNo"]); + omodel.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]); + omodel.HCheckItemNowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNowID"]); + omodel.HCheckItemNextID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNextID"]); + // + omodel.HICMOInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HICMOInterID"]); + omodel.HICMOBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HICMOBillNo"]); + omodel.HMaterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMaterID"]); + omodel.HMaterNumber = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaterNumber"]); + omodel.HUnitID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HUnitID"]); + omodel.HUnitNumber = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUnitNumber"]); + omodel.HPlanQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HPlanQty"]); + omodel.HPlanBeginDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HPlanBeginDate"]); + omodel.HPlanEndDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HPlanEndDate"]); + omodel.HExplanation = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HExplanation"]); + omodel.HRemark = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]); + omodel.HInnerBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HInnerBillNo"]); + // + omodel.HBacker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBacker"]); + omodel.HBackDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBackDate"]); + omodel.HChecker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HChecker"]); + omodel.HCheckDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCheckDate"]); + omodel.HMaker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaker"]); + omodel.HMakeDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMakeDate"]); + omodel.HUpDater = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUpDater"]); + omodel.HUpDateDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUpDateDate"]); + omodel.HCloseMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCloseMan"]); + omodel.HCloseDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCloseDate"]); + omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]); + omodel.HDeleteMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDeleteMan"]); + omodel.HDeleteDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDeleteDate"]); + //寰幆 + DataSet DsSub; + DsSub = oCn.RunProcReturn("Select * from Sc_ProcessPlanSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sc_ProcessPlanSub"); + DetailColl.Clear();//娓呯┖ + for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) + { + Model.ClsSc_ProcessPlanSub oSub = new Model.ClsSc_ProcessPlanSub(); + oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]); + oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]); + // + oSub.HBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBillNo"]); + oSub.HBatchNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBatchNo"]); + oSub.HProcNo = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProcNo"]); + oSub.HProcID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProcID"]); + oSub.HProcNumber = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HProcNumber"]); + oSub.HWorkRemark = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HWorkRemark"]); + oSub.HCenterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HCenterID"]); + oSub.HDeptID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HDeptID"]); + oSub.HDeptNumber = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HDeptNumber"]); + oSub.HGroupID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HGroupID"]); + oSub.HGroupNumber = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HGroupNumber"]); + oSub.HWorkerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWorkerID"]); + oSub.HWorkerNumber = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HWorkerNumber"]); + oSub.HSourceID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceID"]); + oSub.HQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQty"]); + oSub.HTimeUnit = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HTimeUnit"]); + oSub.HPlanWorkTimes = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HPlanWorkTimes"]); + oSub.HPlanBeginDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HPlanBeginDate"]); + oSub.HPlanEndDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HPlanEndDate"]); + oSub.HICMOInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HICMOInterID"]); + oSub.HICMOBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HICMOBillNo"]); + oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderInterID"]); + oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderEntryID"]); + oSub.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSeOrderBillNo"]); + oSub.HWorkingQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HWorkingQty"]); + // + oSub.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]); + oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]); + oSub.HRemark = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HRemark"]); + oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceInterID"]); + oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceEntryID"]); + oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSourceBillNo"]); + oSub.HSourceBillType = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSourceBillType"]); + oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty"]); + oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney"]); + oSub.HBeginDayQty = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HBeginDayQty"]); + oSub.HBeginFixQty = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HBeginFixQty"]); + oSub.HFixWorkDays = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HFixWorkDays"]); + oSub.HTrunWorkDays = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HTrunWorkDays"]); + oSub.HReadyTimes = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HReadyTimes"]); + oSub.HReadyTime = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HReadyTime"]); + oSub.HQueueTime = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HQueueTime"]); + oSub.HMoveTime = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HMoveTime"]); + DetailColl.Add(oSub); + } + sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�"; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + + + //瀹℃牳 + public bool CheckBill(Int64 lngBillKey, ref string sReturn) + { + try + { + string HChecker = DBUtility.ClsPub.CurUserName; + string HCheckDate = DBUtility.ClsPub.GetServerDate(-1); + //鏇存柊宸ュ簭璁″垝鍗曞鏍镐汉銆佸鏍告椂闂� + oCn.RunProc(" Update " + MvarItemKey + " set HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString()); + //鏇存柊(宸ュ簭姹囨姤鍗曘�佺敓浜х姸鎬佷复鏃惰〃)涓嶈壇鏁伴噺=涓嶈壇鏁伴噺-杩斿伐鏁伴噺 + sReturn = ""; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + + //鍙嶅鏍� + public bool AbandonCheck(Int64 lngBillKey, ref string sReturn) + { + + if (isUse(lngBillKey, ref sReturn)) + { + return false; + } + try + { + oCn.RunProc(" Update " + MvarItemKey + " set HChecker='',HCheckDate=null Where HInterID=" + lngBillKey.ToString()); + //鏇存柊(宸ュ簭姹囨姤鍗曘�佺敓浜х姸鎬佷复鏃惰〃)涓嶈壇鏁伴噺=涓嶈壇鏁伴噺-杩斿伐鏁伴噺 + sReturn = ""; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } } } \ No newline at end of file -- Gitblit v1.9.1