From 8d301edbe7bd4206a989460da4b6263550aed87e Mon Sep 17 00:00:00 2001
From: YL <YL@LAPTOP-SE03PLUR>
Date: 星期四, 20 一月 2022 10:02:47 +0800
Subject: [PATCH] 组托单查询修改
---
WebAPI/DLL/ClsSc_MESReturnStepWorkBill.cs | 134 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 134 insertions(+), 0 deletions(-)
diff --git a/WebAPI/DLL/ClsSc_MESReturnStepWorkBill.cs b/WebAPI/DLL/ClsSc_MESReturnStepWorkBill.cs
index 19492b6..fb0bd06 100644
--- a/WebAPI/DLL/ClsSc_MESReturnStepWorkBill.cs
+++ b/WebAPI/DLL/ClsSc_MESReturnStepWorkBill.cs
@@ -1,5 +1,6 @@
锘縰sing System;
using System.Collections.Generic;
+using System.Data;
using System.Linq;
using System.Web;
@@ -22,5 +23,138 @@
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" +
+ ") " +
+ " 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() +
+ ") ");
+ //鎻掑叆瀛愯〃
+ oCn.RunProc("Insert Into Sc_ProcessPlanSub " +
+ "(HInterID,HEntryID,HBillNo" +
+ ",HICMOInterID,HICMOBillNo,HProcNo,HProcID" +
+ ",HGroupID,HDeptID,HWorkerID,HQty,HPlanBeginDate,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HSourceID" +
+ ") " +
+ " 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+","+ 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,HSplitPlanQty,HSplitRelationQty,HDatePlanQty
+ ,HUnitFinishQty,HDateFinishQty,HBadQty,HUnitBadQty,HWasterQty,HSumTimes,HFinishFlag,HCurWorkFlag,HCurQualityFlag
+ ,HBeginDate,HEndDate,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo
+ ,HSourceBillType,HRelationInterID,HEnoughMaterFlag,HProcID,HPlanQty)
+ select 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,'"+omodel.HQty.ToString()+"' " +
+ "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(sql);
+ sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
+ oCn.Commit();
+ return true;
+ }
+ catch (Exception e)
+ {
+ sReturn = e.Message;
+ oCn.RollBack();
+ throw (e);
+ }
+ }
}
}
\ No newline at end of file
--
Gitblit v1.9.1