From 2a2281f38c316e6837274d70577bddab758a255c Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期五, 05 十二月 2025 09:08:40 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 DAL/生产管理/模具管理/ClsGy_QCVerificationBillMain.cs |  118 +++++++++++++++++++++++++++++++++--------------------------
 1 files changed, 66 insertions(+), 52 deletions(-)

diff --git "a/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsGy_QCVerificationBillMain.cs" "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsGy_QCVerificationBillMain.cs"
index 25d1ce0..f8c8b3b 100644
--- "a/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsGy_QCVerificationBillMain.cs"
+++ "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsGy_QCVerificationBillMain.cs"
@@ -13,7 +13,7 @@
 
         public ClsGy_QCVerificationBillMain()
         {
-            base.MvarItemKeySub = "Gy_QCVerificationBillMain";
+            base.MvarItemKeySub = "Gy_QCVerificationBillSub";
             base.MvarItemKeySub2 = "";
             base.MvarItemKeySub3 = "";
             base.MvarItemKeySub4 = "";
@@ -39,6 +39,22 @@
             {
                 //
                 oCn.BeginTran();
+
+                //淇濆瓨鍓嶆帶鍒�=========================================
+                string HBillNote = "";
+                DataSet ds = oCn.RunProcReturn("Exec h_p_Gy_QCVerificationBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',2 ", "h_p_Gy_QCVerificationBill_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.RunProc("UpDate Gy_QCVerificationBillMain set  " +
                 " HBillNo='" + omodel.HBillNo + "'" +  //鍥哄畾璧嬪��===============
@@ -71,9 +87,27 @@
                       + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + 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.HInspectInstruMentID.ToString() + ",'" + oSub.HBeginDate + "','" + oSub.HEndDate.ToString() + "','" + oSub.HHCalibrationStatus.ToString() + "'" +
-                      ") ");
-                    oCn.RunProc("update UPDATE from Gy_InspectInstruMent set HValidDate='" + oSub.HBeginDate + "',HExpiryDay='" + oSub.HEndDate + "'where HItemID=" + omodel.HInterID);
+                      ") ");                   
                 }
+
+                //=========================淇濆瓨鍚庢帶鍒�  
+                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_QCVerificationBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',2 ", "h_p_Gy_QCVerificationBill_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;
@@ -95,7 +129,7 @@
 
                 //淇濆瓨鍓嶆帶鍒�=========================================
                 string HBillNote = "";
-                DataSet ds = oCn.RunProcReturn("Exec h_p_Sc_MouldRepairWorkBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1,1 ", "h_p_Sc_MouldRepairWorkBill_BeforeSaveCtrl");
+                DataSet ds = oCn.RunProcReturn("Exec h_p_Gy_QCVerificationBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_Gy_QCVerificationBill_BeforeSaveCtrl");
                 if (ds == null)
                 {
                     sReturn = "淇濆瓨鍓嶅垽鏂け璐ワ紒";
@@ -108,44 +142,26 @@
                 }
                 //=========================================================
 
-                //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
+
                 oCn.BeginTran();
                 oCn.RunProc("Insert Into Gy_QCVerificationBillMain " +
-           "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
-           ",HYear,HPeriod,HRemark,HMaker,HMakeDate," +
-           "HMainSourceBillType,HMainSourceBillNo,HMainSourceInterID,HMainSourceEntryID," +
-           "HCheckEmp,HDeptID) " +
-           "values('" + (this.BillType ?? "") + "','" + (this.HBillSubType ?? "") + "'," +
-           (omodel.HInterID.ToString() ?? "0") + ",'" + (omodel.HBillNo ?? "") + "','" + (omodel.HDate) + "'" +
-           "," + (omodel.HYear.ToString() ?? "0") + "," + (omodel.HPeriod.ToString() ?? "0") +
-           ",'" + (omodel.HRemark ?? "") + "','" + (omodel.HMaker ?? "") + "',getdate(),'" +
-           (omodel.HMainSourceBillType ?? "") + "','" + (omodel.HMainSourceBillNo ?? "") + "'," +
-           (omodel.HMainSourceInterID.ToString() ?? "0") + "," + (omodel.HMainSourceEntryID.ToString() ?? "0") +
-           "," + (omodel.HCheckEmp.ToString() ?? "0") + "," + (omodel.HDeptID.ToString() ?? "0") + ")");
-                //涓昏〃
-                //oCn.RunProc("Insert Into Gy_QCVerificationBillMain   " +
-                //"(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
-                //",HYear,HPeriod,HRemark,HMaker,HMakeDate," +
-                //"HMainSourceBillType,HMainSourceBillNo,HMainSourceInterID,HMainSourceEntryID,"
-                //+ "HCheckEmp,HDeptID" +
-                //") " +
-                //" values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" +
-                //"," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker + "',getdate()" + ",'" + omodel.HMainSourceBillType + "','" + omodel.HMainSourceBillNo + "'," + omodel.HMainSourceInterID.ToString() + "," + omodel.HMainSourceEntryID.ToString() + "," + omodel.HCheckEmp.ToString() + "," + omodel.HDeptID.ToString() + "') ");
+               "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
+               ",HYear,HPeriod,HRemark,HMaker,HMakeDate," +
+               "HMainSourceBillType,HMainSourceBillNo,HMainSourceInterID,HMainSourceEntryID," +
+               "HCheckEmp,HDeptID,HOrgID) " +
+               "values('" + (this.BillType ?? "") + "','" + (this.HBillSubType ?? "") + "'," +
+               (omodel.HInterID.ToString() ?? "0") + ",'" + (omodel.HBillNo ?? "") + "','" + (omodel.HDate) + "'" +
+               "," + (omodel.HYear.ToString() ?? "0") + "," + (omodel.HPeriod.ToString() ?? "0") +
+               ",'" + (omodel.HRemark ?? "") + "','" + (omodel.HMaker ?? "") + "',getdate(),'" +
+               (omodel.HMainSourceBillType ?? "") + "','" + (omodel.HMainSourceBillNo ?? "") + "'," +
+               (omodel.HMainSourceInterID.ToString() ?? "0") + "," + (omodel.HMainSourceEntryID.ToString() ?? "0") +
+               "," + (omodel.HCheckEmp.ToString() ?? "0") + "," + (omodel.HDeptID.ToString() ?? "0") + "," + (omodel.HOrgID.ToString() ?? "0") + ")");
+                //涓昏〃              
                 //鎻掑叆瀛愯〃
                 
                 foreach (Model.ClsGy_QCVerificationBillSub oSub in DetailColl)
                 {
-                    if (oSub.HBeginDate.Trim()==""|| oSub.HBeginDate.Trim() == null)
-                    {
-                        oSub.HBeginDate = DateTime.Now.ToString();
-                        oSub.HEndDate = DateTime.Now.AddYears(10).ToString();
-
-                    }
-                    if(oSub.HHCalibrationStatus==""|| oSub.HHCalibrationStatus==null)
-                    {
-                        oSub.HHCalibrationStatus = "鍚堟牸";
-                    }
-                        oCn.RunProc("Insert into Gy_QCVerificationBillSub " +
+                    oCn.RunProc("Insert into Gy_QCVerificationBillSub " +
                        " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
                        ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                        ",HInspectInstruMentID,HBeginDate,HEndDate,HHCalibrationStatus" +
@@ -153,26 +169,24 @@
                        + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + 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.HInspectInstruMentID.ToString() + ",'" + oSub.HBeginDate + "','" + oSub.HEndDate.ToString() + "','" + oSub.HHCalibrationStatus.ToString() +"'"+
-                       ") ");
-                    oCn.RunProc("update UPDATE from Gy_InspectInstruMent set HValidDate='" + oSub.HBeginDate + "',HExpiryDay='" + oSub.HEndDate + "'where HItemID="+ omodel.HInterID );
+                       ") ");                   
                 }
 
                 //=========================淇濆瓨鍚庢帶鍒�  
-                //DataSet ds2 = oCn.RunProcReturn("Exec h_p_Sc_MouldRepairWorkBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1,1 ", "h_p_Sc_MouldRepairWorkBill_AfterSaveCtrl");
-                
+                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_QCVerificationBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1", "h_p_Gy_QCVerificationBill_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;
-                //}
+                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 = "鏂板鍗曟嵁鎴愬姛锛�";

--
Gitblit v1.9.1