From 94f24db9393c430e76d8310932bc59d4ff3c0b33 Mon Sep 17 00:00:00 2001
From: yxj <yxj@hz-kingdee.com>
Date: 星期二, 13 五月 2025 15:47:36 +0800
Subject: [PATCH] 新增夏宝专用调拨扫码模块、缓存列表模块调用所需方法
---
WebAPI/DLL/ClsSc_MESBeginWorkBill.cs | 333 ++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 277 insertions(+), 56 deletions(-)
diff --git a/WebAPI/DLL/ClsSc_MESBeginWorkBill.cs b/WebAPI/DLL/ClsSc_MESBeginWorkBill.cs
index d01c8f2..9b90d41 100644
--- a/WebAPI/DLL/ClsSc_MESBeginWorkBill.cs
+++ b/WebAPI/DLL/ClsSc_MESBeginWorkBill.cs
@@ -7,13 +7,15 @@
{
public class ClsSc_MESBeginWorkBill:DBUtility.ClsXt_BaseBill
{
- public Model.ClsSc_MESBeginWorkBillMain omodel = new Model.ClsSc_MESBeginWorkBillMain();
- public List<Model.ClsSc_MESBeginWorkBillSub> DetailColl = new List<Model.ClsSc_MESBeginWorkBillSub>();
+ public Models.ClsSc_MESBeginWorkBillMain omodel = new Models.ClsSc_MESBeginWorkBillMain();
+ public List<Models.ClsSc_MESBeginWorkBillSub> DetailColl = new List<Models.ClsSc_MESBeginWorkBillSub>();
+ public List<Models.ClsSc_MESBeginWorkBillSub_RelationBill> DetailCol2 = new List<Models.ClsSc_MESBeginWorkBillSub_RelationBill>();
//public List<Model.ClsSc_MESBeginWorkBillSub_Item> DetailColl1 = new List<Model.ClsSc_MESBeginWorkBillSub_Item>();
+
public ClsSc_MESBeginWorkBill()
{
base.MvarItemKeySub = "Sc_MESBeginWorkBillSub";
- base.MvarItemKeySub2 = "";
+ base.MvarItemKeySub2 = "Sc_MESBeginWorkBillSub_RelationBill";
base.MvarItemKeySub3 = "";
base.MvarItemKeySub4 = "";
base.MvarItemKey="Sc_MESBeginWorkBillMain";
@@ -29,15 +31,80 @@
{
DetailColl = null;
}
-
+
#endregion 鑷畾涔夋柟娉�
+
+ //淇濆瓨鍓嶆帶鍒�
+ public bool BeforeSave(Int64 HInterID, Int64 HICMOInterID, Int64 HICMOEntryID, string HICMOBillNo, Int64 OperationType, ref string sReturn)
+ {
+ try
+ {
+ DataSet Ds = oCn.RunProcReturn("Exec h_p_Sc_MESBeginWorkBill_BeforeSaveCtrl " + HInterID.ToString() + "," + HICMOInterID.ToString() + "," + HICMOEntryID.ToString() + ",'" + HICMOBillNo + "'," + OperationType.ToString(), "h_p_Sc_MESBeginWorkBill_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, Int64 HICMOInterID, Int64 HICMOEntryID, string HICMOBillNo, Int64 OperationType, ref string sReturn)
+ {
+ try
+ {
+ DataSet Ds = oCn.RunProcReturn("Exec h_p_Sc_MESBeginWorkBill_AfterSaveCtrl " + HInterID.ToString() + "," + HICMOInterID.ToString() + "," + HICMOEntryID.ToString() + ",'" + HICMOBillNo + "'," + OperationType.ToString(), "h_p_Sc_MESBeginWorkBill_AfterSaveCtrl");
+ LogService.Write("寮�宸�:2.6.1");
+
+ if (Ds == null || Ds.Tables[0].Rows.Count == 0)
+ {
+ sReturn = "淇濆瓨鍚庡垽鏂け璐ワ紒";
+ return false;
+ }
+ else
+ {
+ LogService.Write("寮�宸�:2.6.2"+ Ds.Tables[0].Rows[0]["HBack"]);
+ if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1)
+ {
+ LogService.Write("寮�宸�:2.6.3");
+ sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]);
+ LogService.Write("寮�宸�:2.6.4");
+ return false;
+ }
+ }
+ return true;
+ }
+ catch (Exception e)
+ {
+ throw (e);
+ }
+ }
+
//淇敼鍗曟嵁
public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
{
try
{
- //
oCn.BeginTran();
+ //淇濆瓨鍓嶆帶鍒�
+ if (!BeforeSave(lngBillKey, omodel.HICMOInterID, omodel.HICMOEntryID, omodel.HICMOBillNo, 2, ref sReturn))
+ {
+ oCn.RollBack();
+ return false;
+ }
//鏇存柊涓昏〃
oCn.RunProc("UpDate Sc_MESBeginWorkBillMain set " +
" HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��===============
@@ -53,7 +120,7 @@
//",HCheckDate='" + omodel.HCheckDate + "'" +
//",HMaker='" + omodel.HMaker + "'" +
//",HMakeDate='" + omodel.HMakeDate + "'" +
- ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" +
+ ",HUpDater='" +omodel.HMaker + "'" +
",HUpDateDate=getdate()" +
//",HCloseMan='" + omodel.HCloseMan + "'" +
//",HCloseDate='" + omodel.HCloseDate + "'" +
@@ -86,14 +153,48 @@
",HAddr='" + omodel.HAddr + "'" +
",HBarCodeMaker='" + omodel.HBarCodeMaker + "'" +
",HBarCodeMakeDate='" + omodel.HBarCodeMakeDate + "'" +
+ ",HWorkShiftID='" + omodel.HWorkShiftID + "'" +
" where HInterID=" + lngBillKey.ToString());
//鍒犻櫎鍏宠仈
DeleteRelation(ref sReturn, lngBillKey);
//鍒犻櫎瀛愯〃
DeleteBillSub(lngBillKey);
+ DeleteBillSub2(lngBillKey);
//鎻掑叆瀛愯〃
omodel.HInterID = lngBillKey;
- foreach (Model.ClsSc_MESBeginWorkBillSub oSub in DetailColl)
+
+ //鎻掑叆瀛愯〃_鍓骇璁″垝
+ foreach (Models.ClsSc_MESBeginWorkBillSub_RelationBill oSub in DetailCol2)
+ {
+ string subSql = "insert into Sc_MESBeginWorkBillSub_RelationBill " +
+ "(HInterID, HEntryID,HBillNo_bak, HSourceInterID, HSourceEntryID, HSourceBillNo, HSourceBillType, HRemark, " +
+ "HRelationBillInterID, HRelationBillEntryID, HRelationBillNo, HRelationBillType, HICMOInterID, HICMOEntryID, HICMOBillNo, " +
+ "HProcExchInterID, HProcExchEntryID, HProcExchBillNo, HMaterID, HProcID) " +
+ "values(" +
+ "'" + omodel.HInterID.ToString() + "'," +
+ "'" + oSub.HEntryID.ToString() + "'," +
+ "'" + omodel.HBillNo + "'," +
+ "'" + oSub.HSourceInterID + "'," +
+ "'" + oSub.HSourceEntryID + "'," +
+ "'" + oSub.HSourceBillNo + "'," +
+ "'" + oSub.HSourceBillType + "'," +
+ "'" + oSub.HRemark + "'," +
+ "'" + oSub.HRelationBillInterID + "'," +
+ "'" + oSub.HRelationBillEntryID + "'," +
+ "'" + oSub.HRelationBillNo + "'," +
+ "'" + oSub.HRelationBillType + "'," +
+ "'" + oSub.HICMOInterID + "'," +
+ "'" + oSub.HICMOEntryID + "'," +
+ "'" + oSub.HICMOBillNo + "'," +
+ "'" + oSub.HProcExchInterID + "'," +
+ "'" + oSub.HProcExchEntryID + "'," +
+ "'" + oSub.HProcExchBillNo + "'," +
+ "'" + oSub.HMaterID + "'," +
+ "'" + oSub.HProcID + "')";
+ oCn.RunProc(subSql);
+ }
+
+ foreach (Models.ClsSc_MESBeginWorkBillSub oSub in DetailColl)
{
//oCn.RunProc("Insert into Sc_MESBeginWorkBillSub " +
// " (HInterID,HBillNo_bak,HEntryID,HCloseMan" +
@@ -135,7 +236,14 @@
// return false;
// }
//}
- sReturn = "淇敼鍗曟嵁鎴愬姛锛�";
+
+ //淇濆瓨鍚庢帶鍒�
+ if (!AfterSave(lngBillKey, omodel.HICMOInterID, omodel.HICMOEntryID, omodel.HICMOBillNo, 2, ref sReturn))
+ {
+ oCn.RollBack();
+ return false;
+ }
+ sReturn = "鍗曟嵁鍙凤細" + omodel.HBillNo + " 淇敼鎴愬姛锛�";
oCn.Commit();
return true;
}
@@ -151,69 +259,121 @@
{
try
{
+ LogService.Write("寮�宸�:2.2");
+ DataSet ds;
//寰楀埌mainid
omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
//鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
oCn.BeginTran();
+ //淇濆瓨鍓嶆帶鍒�
+ if (!BeforeSave(omodel.HInterID, omodel.HICMOInterID, omodel.HICMOEntryID, omodel.HICMOBillNo, 1, ref sReturn))
+ {
+ return false;
+ }
+ LogService.Write("寮�宸�:2.3");
//涓昏〃
oCn.RunProc("Insert Into Sc_MESBeginWorkBillMain " +
"(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" +
",HYear,HPeriod,HRemark" +
- ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" +
+ ",HICMOInterID,HICMOEntryID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" +
",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HBeginWorkTime,HSourceID" +
- ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" +
+ ",HSourceInterID_Main,HSourceEntryID_Main,HSourceBillNo_Main,HSourceBillType_Main" +
+ ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType" +
+ ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate,HRunStatus,HSourceBeginQty,HWorkShiftID" +
") " +
- " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + omodel.HBillStatus.ToString() + ",getdate(),'" + DBUtility.ClsPub.CurUserName + "',getdate()" +
+ " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + omodel.HBillStatus.ToString() + ",getdate(),'" + omodel.HMaker+ "',getdate()" +
"," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'" +
- "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "'," + omodel.HProcPlanInterID.ToString() + "," + omodel.HProcPlanEntryID.ToString() + ",'" + omodel.HProcPlanBillNo + "'," + omodel.HProcExchInterID.ToString() + "," + omodel.HProcExchEntryID.ToString() +
+ "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOEntryID + "','" + omodel.HICMOBillNo + "'," + omodel.HProcPlanInterID.ToString() + "," + omodel.HProcPlanEntryID.ToString() + ",'" + omodel.HProcPlanBillNo + "'," + omodel.HProcExchInterID.ToString() + "," + omodel.HProcExchEntryID.ToString() +
",'" + omodel.HProcExchBillNo + "'," + omodel.HMaterID.ToString() + "," + omodel.HProcID.ToString() + "," + omodel.HICMOQty.ToString() + "," + omodel.HPlanQty.ToString() + ",getdate()," + omodel.HSourceID.ToString() +
- "," + omodel.HGroupID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + ",'" + omodel.HBarCode + "','" + omodel.HAddr + "','" + omodel.HBarCodeMaker + "',getdate()" +
+ ",'" + omodel.HMainSourceInterID.ToString() + "'," + omodel.HMainSourceEntryID.ToString() + ",'" + omodel.HMainSourceBillNo.ToString() + "','" + omodel.HMainSourceBillType.ToString() + "'" +
+ ",'" + omodel.HMainSourceInterID.ToString() + "'," + omodel.HMainSourceEntryID.ToString() + ",'" + omodel.HMainSourceBillNo.ToString() + "','" + omodel.HMainSourceBillType.ToString() + "'" +
+ "," + omodel.HGroupID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + ",'" + omodel.HBarCode + "','" + omodel.HAddr + "','" + omodel.HBarCodeMaker + "',getdate(),'"+ omodel.HRunStatus + "','"+ omodel.HSourceBeginQty.ToString() + "','" + omodel.HWorkShiftID.ToString() + "'" +
") ");
+
//鎻掑叆瀛愯〃
- foreach (Model.ClsSc_MESBeginWorkBillSub oSub in DetailColl)
+ foreach (Models.ClsSc_MESBeginWorkBillSub_RelationBill oSub in DetailCol2)
{
- //oCn.RunProc("Insert into Sc_MESBeginWorkBillSub " +
- // " (HInterID,HBillNo_bak,HEntryID,HCloseMan" +
- // ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" +
- // ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
- // ",HDotCheckItemID,HDotCheckItem,HDotCheckPart,HClaim,HManagerID" +
-
- // ") values("
- // + omodel.HInterID.ToString() + ",'" + oSub.HBillNo_bak + "'," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'" +
- // ",getdate()," + 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.HDotCheckItemID.ToString() + ",'" + oSub.HDotCheckItem + "','" + oSub.HDotCheckPart + "','" + oSub.HClaim + "'," + oSub.HManagerID.ToString() +
- // ") ");
+ string subSql = "insert into Sc_MESBeginWorkBillSub_RelationBill " +
+ "(HInterID, HEntryID,HBillNo_bak, HSourceInterID, HSourceEntryID, HSourceBillNo, HSourceBillType, HRemark, " +
+ "HRelationBillInterID, HRelationBillEntryID, HRelationBillNo, HRelationBillType, HICMOInterID, HICMOEntryID, HICMOBillNo, " +
+ "HProcExchInterID, HProcExchEntryID, HProcExchBillNo, HMaterID, HProcID) " +
+ "values(" +
+ "'" + omodel.HInterID.ToString() + "'," +
+ "'" + oSub.HEntryID.ToString() + "'," +
+ "'" + omodel.HBillNo + "'," +
+ "'" + oSub.HSourceInterID + "'," +
+ "'" + oSub.HSourceEntryID + "'," +
+ "'" + oSub.HSourceBillNo + "'," +
+ "'" + oSub.HSourceBillType + "'," +
+ "'" + oSub.HRemark + "'," +
+ "'" + oSub.HRelationBillInterID + "'," +
+ "'" + oSub.HRelationBillEntryID + "'," +
+ "'" + oSub.HRelationBillNo + "'," +
+ "'" + oSub.HRelationBillType + "'," +
+ "'" + oSub.HICMOInterID + "'," +
+ "'" + oSub.HICMOEntryID + "'," +
+ "'" + oSub.HICMOBillNo + "'," +
+ "'" + oSub.HProcExchInterID + "'," +
+ "'" + oSub.HProcExchEntryID + "'," +
+ "'" + oSub.HProcExchBillNo + "'," +
+ "'" + oSub.HMaterID + "'," +
+ "'" + oSub.HProcID + "')";
+ oCn.RunProc(subSql);
}
- //foreach (Model.ClsSc_MESBeginWorkBillSub_Item oSub2 in DetailColl1)
- //{
- // oCn.RunProc("Insert into Sc_MESBeginWorkBillSub_Item " +
- // " (HInterID,HBillNo_bak,HEntryID,HCloseMan" +
- // ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" +
- // ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
- // ",HMaintainItemID,HMaintainItem,HMaintainPart,HClaim,HManagerID" +
- // ") values("
- // + omodel.HInterID.ToString() + ",'" + oSub2.HBillNo_bak + "'," + oSub2.HEntryID.ToString() + ",'" + oSub2.HCloseMan + "'" +
- // ",getdate()," + Convert.ToString(oSub2.HCloseType ? 1 : 0) + ",'" + oSub2.HRemark + "'," + oSub2.HSourceInterID.ToString() +
- // "," + oSub2.HSourceEntryID.ToString() + ",'" + oSub2.HSourceBillNo + "','" + oSub2.HSourceBillType + "'," + oSub2.HRelationQty.ToString() + "," + oSub2.HRelationMoney.ToString() +
- // "," + oSub2.HMaintainItemID.ToString() + ",'" + oSub2.HMaintainItem + "','" + oSub2.HMaintainPart + "','" + oSub2.HClaim + "'," + oSub2.HManagerID.ToString() +
- // ") ");
- //}
- //
- //foreach (Model.ClsSc_MESBeginWorkBillSub oSub in DetailColl)
- //{
- // Ds = oCn.RunProcReturn("exec h_p_Sc_MESBeginWorkBill_Qty " + oSub.HICMOInterID, "");
- // if (Ds.Tables[0].Rows.Count == 0)
- // return;
- // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y")
- // {
- // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨";
- // return false;
- // }
- //}
- //
- sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
+ LogService.Write("寮�宸�:2.4");
+ //鍐嶆楠岃瘉 淇濆瓨鏄惁 鍚堢悊
+ ds = oCn.RunProcReturn("exec h_p_JIT_MESBeginWorkBill_SaveCtrl @HInterId=" + omodel.HInterID + "", "h_p_JIT_MESBeginWorkBill_SaveCtrl");
+ if (ds == null || ds.Tables[0].Rows.Count <= 0)
+ {
+ sReturn = "鏃犻獙璇佹暟鎹紒";
+ oCn.RollBack();
+ return false;
+ }
+ if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "2")
+ {
+ sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+ oCn.RollBack();
+ return false;
+ }
+ LogService.Write("寮�宸�:2.5");
+
+ //鑾峰彇鏈�杩戠殑涓婃ā鍗� 鎶婂伐鍗曡窡妯″叿杩涜缁戝畾
+ ds = oCn.RunProcReturn(@"select HICMOInterID,HICMOEntryID,HSourceInterID,HSourceEntryID,HSourceID from Sc_ICMOBillStatus_Tmp where HInterID=" + omodel.HMainSourceInterID.ToString(), "Sc_ICMOBillStatus_Tmp");
+
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ string HICMOInterID = ds.Tables[0].Rows[0]["HICMOInterID"].ToString();
+ string HICMOEntryID = ds.Tables[0].Rows[0]["HICMOEntryID"].ToString();
+ string HSourceInterID = ds.Tables[0].Rows[0]["HSourceInterID"].ToString();
+ string HSourceEntryID = ds.Tables[0].Rows[0]["HSourceEntryID"].ToString();
+ string HSourceID = ds.Tables[0].Rows[0]["HSourceID"].ToString();
+
+ ds = oCn.RunProcReturn(@"select HMouldID from Sc_MouldUpperBillMain a
+ inner join Sc_MouldUpperBillSub b on a.HInterID = b.HInterID where HICMOInterID=" + HICMOInterID + " and HICMOEntryID=" + HICMOEntryID + " and HProcExchInterID=" + HSourceInterID + " and HProcExchEntryID=" + HSourceEntryID + " and HSourceID=" + HSourceID + " order by HMakeDate desc", "Sc_MouldUpperBillMain");
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ oCn.RunProc("update Sc_ICMOBillStatus_Tmp set HMouldID= " + ds.Tables[0].Rows[0]["HMouldID"].ToString() + " where HInterID=" + omodel.HMainSourceInterID.ToString());
+ }
+ else
+ {
+ ds = oCn.RunProcReturn(@"select HMouldID from Sc_MouldUpperBillMain a
+ inner join Sc_MouldUpperBillSub b on a.HInterID = b.HInterID where HSourceID=" + HSourceID + " order by HMakeDate desc", "Sc_MouldUpperBillMain");
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ oCn.RunProc("update Sc_ICMOBillStatus_Tmp set HMouldID= " + ds.Tables[0].Rows[0]["HMouldID"].ToString() + " where HInterID=" + omodel.HMainSourceInterID.ToString());
+ }
+ }
+ }
+ LogService.Write("寮�宸�:2.6 " + omodel.HInterID + "," + omodel.HICMOInterID + ", " + omodel.HICMOEntryID + ", " + omodel.HICMOBillNo + ", 1");
+ //淇濆瓨鍚庢帶鍒�
+ if (!AfterSave(omodel.HInterID, omodel.HICMOInterID, omodel.HICMOEntryID, omodel.HICMOBillNo, 1, ref sReturn))
+ {
+ oCn.RollBack();
+ return false;
+ }
+ LogService.Write("寮�宸�:2.7");
+ sReturn = omodel.HInterID.ToString();
oCn.Commit();
return true;
}
@@ -300,7 +460,7 @@
DetailColl.Clear();//娓呯┖
for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
{
- Model.ClsSc_MESBeginWorkBillSub oSub = new Model.ClsSc_MESBeginWorkBillSub();
+ Models.ClsSc_MESBeginWorkBillSub oSub = new Models.ClsSc_MESBeginWorkBillSub();
// 鍥哄畾璧嬪��===============================================
//oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]);
//oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]);
@@ -419,6 +579,63 @@
}
}
+ //鍒犻櫎鍗曟嵁
+ public bool DeleteBill(Int64 lngBillKey, string HBillNo, string procName, string user, ref string sReturn)
+ {
+ try
+ {
+ oCn.BeginTran();
+ //鍒ゆ柇鏄惁鍏佽鍒犻櫎
+ DataSet ds = oCn.RunProcReturn("exec h_p_JIT_MESBeginWorkBill_DelCtrl @HInterId=" + lngBillKey + "", "h_p_JIT_MESBeginWorkBill_SaveCtrl");
+ 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_JIT_MESBeginWorkBill_DelRelation @HInterId=" + lngBillKey + "");
+
+ //鍒犻櫎鏄庣粏琛�
+ oCn.RunProc("Delete From " + MvarItemKeySub + " where HInterID=" + lngBillKey.ToString());
+ //鍒犻櫎涓昏〃
+ oCn.RunProc("Delete From " + MvarItemKey + " where HInterID=" + lngBillKey.ToString());
+
+ //鍒犻櫎鍚庢帶鍒�==================================================================================
+ string sql2 = "exec " + procName + " " + lngBillKey + ",'" + HBillNo + "','" + user + "'";
+ ds = oCn.RunProcReturn(sql2, procName);
+ if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+ {
+
+ sReturn = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+ oCn.RollBack();
+ return false;
+ }
+ if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ sReturn = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString();
+ oCn.RollBack();
+ return false;
+ }
+ //==============================================================================================
+
+ sReturn = "鍒犻櫎鍗曟嵁鎴愬姛锛�";
+ oCn.Commit();
+ return true;
+ }
+ catch (Exception e)
+ {
+ sReturn = e.Message;
+ oCn.RollBack();
+ throw (e);
+ }
+ }
+
//瀹℃牳
public bool CheckBill(Int64 lngBillKey, ref string sReturn)
{
@@ -427,7 +644,11 @@
{
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());
+ //鏍规嵁寮�宸ュ崟鍐呯爜 璁剧疆 鐢熶骇鐘舵�佽〃 寮�宸ョ姸鎬�(鍏堟妸 鏈祫婧愬叏閮ㄥ伐鍗� 璁剧疆涓洪潪寮�宸ョ姸鎬侊紝鍐嶈缃湰鍗曞搴斿緱婧愬崟 涓哄紑宸ョ姸鎬�)
+ oCn.RunProc("exec h_p_JIT_MESBeginWorkBill_BeginWork @HInterId=" + lngBillKey + ",@flag='寮�宸�'");
+ oCn.Commit();
//鐢熸垚璋冩嫧鍗�
//寰楀埌璋冩嫧鍗� mainid 鍗曟嵁鍙�
//long NewInterID = DBUtility.ClsPub.CreateBillID("1207", ref DBUtility.ClsPub.sExeReturnInfo);
--
Gitblit v1.9.1