From fd2d833bf010d0be1bb308d9c431eee1dfd931ff Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期五, 20 十二月 2024 16:46:53 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
---
DAL/生产管理/ClsSc_QualityReportBill.cs | 232 ++++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 195 insertions(+), 37 deletions(-)
diff --git "a/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/ClsSc_QualityReportBill.cs" "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/ClsSc_QualityReportBill.cs"
index 3a5a162..9b570d3 100644
--- "a/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/ClsSc_QualityReportBill.cs"
+++ "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/ClsSc_QualityReportBill.cs"
@@ -40,9 +40,25 @@
{
//
DataSet Ds;
+
+ //淇濆瓨鍓嶆帶鍒�=========================================
+ string HBillNote = "";
+ DataSet ds = oCn.RunProcReturn("Exec h_p_Sc_QualityReportBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_Sc_QualityReportBill_BeforeSaveCtrl");
+ if (ds == null)
+ {
+ sReturn = "淇濆瓨鍓嶅垽鏂け璐ワ紒";
+ return false;
+ }
+ if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+ {
+ sReturn = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+ return false;
+ }
+ //=========================================================
+
oCn.BeginTran();
//鏇存柊涓昏〃
- oCn.RunProc("UpDate Sc_QualityReportBillMain set " +
+ string mainSql = "UpDate Sc_QualityReportBillMain set " +
" HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��===============
",HDate='" + omodel.HDate + "'" +
",HYear='" + omodel.HYear.ToString() + "'" +
@@ -50,11 +66,14 @@
",HRemark='" + omodel.HRemark + "'" +
",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" +
",HUpDateDate=getdate()" +
+ ",HSTOCKORGID=" + omodel.HSTOCKORGID +
//========================================
",HDeptID=" + omodel.HDeptID.ToString() +
",HEmpID=" + omodel.HEmpID.ToString() +
",HGroupID=" + omodel.HGroupID.ToString() +
- " where HInterID=" + lngBillKey.ToString());
+ " where HInterID=" + lngBillKey.ToString();
+
+ oCn.RunProc(mainSql);
//鍒犻櫎鍏宠仈
//DeleteRelation(lngBillKey);
//鍒犻櫎瀛愯〃
@@ -63,20 +82,68 @@
omodel.HInterID = lngBillKey;
foreach (Model.ClsSc_QualityReportBillSub oSub in DetailColl)
{
- oCn.RunProc("Insert into Sc_QualityReportBillSub " +
- " (HInterID,HEntryID,HBillNo_bak,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
+ string subSql = "Insert into Sc_QualityReportBillSub " +
+ " (HInterID,HEntryID,HBillNo_bak,HRemark" +
",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
- ",HMaterID,HUnitID,HEmpID,HSourceID,HBarCode" +
- ",HBadReasonID,HICMOInterID,HICMOEntryID,HICMOBillNo,HReportType" +
- ",HAddr,HMaker,HMakeDate,HQty" +
- ") values("
- + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HBillNo_bak + "','" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + 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.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HEmpID.ToString() + "," + oSub.HSourceID.ToString() + ",'" + oSub.HBarCode + "'" +
- "," + oSub.HBadReasonID.ToString() + "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() + ",'" + oSub.HICMOBillNo + "'," + oSub.HReportType.ToString() +
- ",'" + oSub.HAddr + "','" + oSub.HMaker + "','" + oSub.HMakeDate.ToShortDateString() + "'," + oSub.HQty.ToString() +
- ") ");
+ ",HMaterID,HUnitID,HQty,HResult,HEmpID,HSourceID,HBadReasonID" +
+ ",HICMOInterID,HICMOEntryID,HICMOBillNo,HProcExchInterID,HProcExchEntryID,HProcExchBillNo" +
+ ",HBarCode,HReportType,HBadProcID" +
+ ",HAddr,HMaker,HMakeDate,HProcID,HNowProcID" +
+ ") values(" +
+ "" + omodel.HInterID.ToString() + "" +
+ "," + oSub.HEntryID.ToString() + "" +
+ ",'" + omodel.HBillNo + "'" +
+ ",'" + oSub.HRemark + "'" +
+ "," + oSub.HSourceInterID.ToString() + "" +
+ "," + oSub.HSourceEntryID.ToString() + "" +
+ ",'" + oSub.HSourceBillNo + "'" +
+ ",'" + oSub.HSourceBillType + "'" +
+ "," + oSub.HRelationQty.ToString() + "" +
+ "," + oSub.HRelationMoney.ToString() +
+
+ "," + oSub.HMaterID.ToString() + "" +
+ "," + oSub.HUnitID.ToString() + "" +
+ "," + oSub.HQty.ToString() +
+ ",'" + oSub.HResult + "'" +
+ "," + oSub.HEmpID.ToString() + "" +
+ "," + oSub.HSourceID.ToString() + "" +
+ "," + oSub.HBadReasonID.ToString() + "" +
+
+ "," + oSub.HICMOInterID.ToString() + "" +
+ "," + oSub.HICMOEntryID.ToString() + "" +
+ ",'" + oSub.HICMOBillNo + "'" +
+ "," + oSub.HProcExchInterID + "" +
+ "," + oSub.HProcExchEntryID + "" +
+ ",'" + oSub.HProcExchBillNo + "'" +
+ ",'" + oSub.HBarCode + "'" +
+
+ "," + oSub.HReportType.ToString() +
+ ",'" + oSub.HBadProcID.ToString() +
+ "','" + oSub.HAddr + "'" +
+ ",'" + oSub.HMaker + "'" +
+ ",'" + oSub.HMakeDate.ToShortDateString() + "'" +
+ "," + oSub.HProcID.ToString() +
+ "," + oSub.HNowProcID.ToString() +
+ ") ";
+ oCn.RunProc(subSql);
}
+
+ //=========================淇濆瓨鍚庢帶鍒�
+ DataSet ds2 = oCn.RunProcReturn("h_p_Sc_QualityReportBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1 ", "h_p_Sc_QualityReportBill_AfterSaveCtrl");
+ if (ds2 == null)
+ {
+ sReturn = "淇濆瓨鍚庢帶鍒跺垽鏂け璐ワ紒";
+ oCn.RollBack();
+ return false;
+ }
+ if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
+ {
+ sReturn = "淇濆瓨澶辫触2锛�" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
+ oCn.RollBack();
+ return false;
+ }
+ //============================
+
sReturn = "淇敼鍗曟嵁鎴愬姛锛�";
oCn.Commit();
return true;
@@ -93,37 +160,125 @@
{
try
{
- //寰楀埌mainid
- omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
//鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
+ while (IsExistMainID(ref DBUtility.ClsPub.sExeReturnInfo, omodel.HInterID, Pub_Class.ClsPub.Enum_BillStatus.BillStatus_AddNew))
+ {
+ omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
+ }
+
+ //淇濆瓨鍓嶆帶鍒�=========================================
+ string HBillNote = "";
+ DataSet ds = oCn.RunProcReturn("Exec h_p_Sc_QualityReportBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_Sc_QualityReportBill_BeforeSaveCtrl");
+ if (ds == null)
+ {
+ sReturn = "淇濆瓨鍓嶅垽鏂け璐ワ紒";
+ return false;
+ }
+ if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+ {
+ sReturn = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+ return false;
+ }
+ //=========================================================
+
oCn.BeginTran();
+
//涓昏〃
- oCn.RunProc("Insert Into Sc_QualityReportBillMain " +
- "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
- ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
- ",HEmpID,HGroupID,HDeptID" +
- ") " +
- " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate.ToShortDateString() + "'" +
- ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" +
- ", " + omodel.HEmpID.ToString() + "," + omodel.HGroupID.ToString() + "," + omodel.HDeptID.ToString() +
- ") ");
+ string mainSql = "insert into Sc_QualityReportBillMain(" +
+ "HBillType,HBillSubType,HInterID,HBillNo,HDate,HYear,HPeriod,HBillStatus,HRemark,HMaker,HMakeDate,HSTOCKORGID" +
+ ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType" +
+ ",HEmpID,HGroupID,HDeptID" +
+ ") " +
+ " values(" +
+ "'" + this.BillType + "'" +
+ ",'" + this.HBillSubType + "'" +
+ "," + omodel.HInterID + "" +
+ ",'" + omodel.HBillNo + "'" +
+ ",'" + omodel.HDate + "'" +
+ "," + DateTime.Now.Year + "" +
+ "," + DateTime.Now.Month + "" +
+ "," + "1" + "" +
+ ",'" + omodel.HRemark + "'" +
+ ",'" + omodel.HMaker + "'" +
+ "," + "getdate()" + "" +
+ "," + omodel.HSTOCKORGID + "" +
+ "," + omodel.HMainSourceInterID + "" +
+ "," + omodel.HMainSourceEntryID + "" +
+ ",'" + omodel.HMainSourceBillNo + "'" +
+ ",'" + omodel.HMainSourceBillType + "'" +
+ "," + omodel.HEmpID + "" +
+ "," + omodel.HGroupID + "" +
+ "," + omodel.HDeptID + "" +
+ ")";
+
+ oCn.RunProc(mainSql);
+
+
//鎻掑叆瀛愯〃
foreach (Model.ClsSc_QualityReportBillSub oSub in DetailColl)
{
- oCn.RunProc("Insert into Sc_QualityReportBillSub " +
- " (HInterID,HEntryID,HBillNo_bak,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
+ string subSql = "Insert into Sc_QualityReportBillSub " +
+ " (HInterID,HEntryID,HBillNo_bak,HRemark" +
",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
- ",HMaterID,HUnitID,HEmpID,HSourceID,HBarCode" +
- ",HBadReasonID,HICMOInterID,HICMOEntryID,HICMOBillNo,HReportType" +
- ",HAddr,HMaker,HMakeDate,HQty" +
- ") values("
- + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HBillNo_bak + "','" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + 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.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HEmpID.ToString() + "," + oSub.HSourceID.ToString() + ",'" + oSub.HBarCode + "'" +
- "," + oSub.HBadReasonID.ToString() + "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() + ",'" + oSub.HICMOBillNo + "'," + oSub.HReportType.ToString() +
- ",'" + oSub.HAddr + "','" + oSub.HMaker + "','" + oSub.HMakeDate.ToShortDateString() + "'," + oSub.HQty.ToString() +
- ") ");
+ ",HMaterID,HUnitID,HQty,HResult,HEmpID,HSourceID,HBadReasonID" +
+ ",HICMOInterID,HICMOEntryID,HICMOBillNo,HProcExchInterID,HProcExchEntryID,HProcExchBillNo" +
+ ",HBarCode,HReportType,HBadProcID" +
+ ",HAddr,HMaker,HMakeDate,HProcID,HNowProcID" +
+ ") values(" +
+ "" + omodel.HInterID.ToString() + "" +
+ "," + oSub.HEntryID.ToString() + "" +
+ ",'" + omodel.HBillNo + "'" +
+ ",'" + oSub.HRemark + "'" +
+ "," + oSub.HSourceInterID.ToString() + "" +
+ "," + oSub.HSourceEntryID.ToString() + "" +
+ ",'" + oSub.HSourceBillNo + "'" +
+ ",'" + oSub.HSourceBillType + "'" +
+ "," + oSub.HRelationQty.ToString() + "" +
+ "," + oSub.HRelationMoney.ToString() +
+
+ "," + oSub.HMaterID.ToString() + "" +
+ "," + oSub.HUnitID.ToString() + "" +
+ "," + oSub.HQty.ToString() +
+ ",'" + oSub.HResult + "'" +
+ "," + oSub.HEmpID.ToString() + "" +
+ "," + oSub.HSourceID.ToString() + "" +
+ "," + oSub.HBadReasonID.ToString() + "" +
+
+ "," + oSub.HICMOInterID.ToString() + "" +
+ "," + oSub.HICMOEntryID.ToString() + "" +
+ ",'" + oSub.HICMOBillNo + "'" +
+ "," + oSub.HProcExchInterID + "" +
+ "," + oSub.HProcExchEntryID + "" +
+ ",'" + oSub.HProcExchBillNo + "'" +
+ ",'" + oSub.HBarCode + "'" +
+
+ "," + oSub.HReportType.ToString() +
+ "," + oSub.HBadProcID.ToString() +
+ ",'" + oSub.HAddr + "'" +
+ ",'" + oSub.HMaker + "'" +
+ ",'" + oSub.HMakeDate.ToShortDateString() + "'" +
+ "," + oSub.HProcID.ToString() +
+ "," + oSub.HNowProcID.ToString() +
+ ") ";
+ oCn.RunProc(subSql);
}
+
+ //=========================淇濆瓨鍚庢帶鍒�
+ DataSet ds2 = oCn.RunProcReturn("h_p_Sc_QualityReportBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1 ", "h_p_Sc_QualityReportBill_AfterSaveCtrl");
+ if (ds2 == null)
+ {
+ sReturn = "淇濆瓨鍚庢帶鍒跺垽鏂け璐ワ紒";
+ oCn.RollBack();
+ return false;
+ }
+ if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
+ {
+ sReturn = "淇濆瓨澶辫触2锛�" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
+ oCn.RollBack();
+ return false;
+ }
+ //============================
+
sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
oCn.Commit();
return true;
@@ -212,6 +367,9 @@
oSub.HICMOInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HICMOInterID"]);
oSub.HICMOEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HICMOEntryID"]);
oSub.HICMOBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HICMOBillNo"]);
+ oSub.HProcExchInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProcExchInterID"]);
+ oSub.HProcExchEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProcExchEntryID"]);
+ oSub.HProcExchBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HProcExchBillNo"]);
oSub.HReportType = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HReportType"]);
oSub.HAddr = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HAddr"]);
oSub.HMaker = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HMaker"]);
--
Gitblit v1.9.1