From d39e6a7dcb32ab0d8dd4e087106cfd8f6307823b Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期三, 06 三月 2024 15:35:31 +0800
Subject: [PATCH] 设备档案列表 增加 左边树形 器具分类,点击分类,根据分类来过滤,方便选择 设备档案分类 的基础资料 完善禁用 反禁用按钮

---
 DAL/质检管理/ClsQC_FirstPieceCheckBill.cs |  125 +++++++++++++++++++++++++++++++++++++++--
 1 files changed, 117 insertions(+), 8 deletions(-)

diff --git "a/DAL/\350\264\250\346\243\200\347\256\241\347\220\206/ClsQC_FirstPieceCheckBill.cs" "b/DAL/\350\264\250\346\243\200\347\256\241\347\220\206/ClsQC_FirstPieceCheckBill.cs"
index 3e49c7f..3494e2f 100644
--- "a/DAL/\350\264\250\346\243\200\347\256\241\347\220\206/ClsQC_FirstPieceCheckBill.cs"
+++ "b/DAL/\350\264\250\346\243\200\347\256\241\347\220\206/ClsQC_FirstPieceCheckBill.cs"
@@ -9,11 +9,12 @@
     {
         public Model.ClsQC_FirstPieceCheckBillMain omodel = new Model.ClsQC_FirstPieceCheckBillMain();
         public List<Model.ClsQC_FirstPieceCheckBillSub> DetailColl = new List<Model.ClsQC_FirstPieceCheckBillSub>();
+        public List<Model.ClsQC_FirstPieceCheckBillSub_ValueGrid> DetailColl_Value = new List<Model.ClsQC_FirstPieceCheckBillSub_ValueGrid>();
         //public List<Model.ClsQC_FirstPieceCheckBillSub_Item> DetailColl1 = new List<Model.ClsQC_FirstPieceCheckBillSub_Item>();
         public ClsQC_FirstPieceCheckBill()
         {
             base.MvarItemKeySub = "QC_FirstPieceCheckBillSub";
-            base.MvarItemKeySub2 = "";
+            base.MvarItemKeySub2 = "QC_FirstPieceCheckBillSub_ValueGrid";
             base.MvarItemKeySub3 = "";
             base.MvarItemKeySub4 = "";
             base.MvarItemKey="QC_FirstPieceCheckBillMain";
@@ -36,6 +37,22 @@
         {
             try
             {
+                //淇濆瓨鍓嶆帶鍒�=========================================
+                string HBillNote = "";
+                DataSet ds = oCn.RunProcReturn("Exec h_p_QC_FirstPieceCheckBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_QC_FirstPieceCheckBill_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();
                 //鏇存柊涓昏〃
@@ -125,6 +142,25 @@
                 //        return false;
                 //    }
                 //}
+
+
+                //=========================淇濆瓨鍚庢帶鍒�  
+                DataSet ds2 = oCn.RunProcReturn("Exec h_p_QC_FirstPieceCheckBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1 ", "h_p_QC_FirstPieceCheckBill_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;
@@ -142,8 +178,25 @@
             try
             {
                 //寰楀埌mainid
-                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
+                //omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                 //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
+
+                //淇濆瓨鍓嶆帶鍒�=========================================
+                string HBillNote = "";
+                DataSet ds = oCn.RunProcReturn("Exec h_p_QC_FirstPieceCheckBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_QC_FirstPieceCheckBill_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 QC_FirstPieceCheckBillMain " +
@@ -151,13 +204,13 @@
                 ",HYear,HPeriod,HRemark" +
                 ",HSourceID,HICMOInterID,HICMOBillNo,HICMOQty,HProcExchInterID,HProcExchEntryID" +
                 ",HProcExchBillNo,HProcExchQty,HMaterID,HFirstCheckEmp,HLastResult" +
-                ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HICMOEntryID" +
+                ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HICMOEntryID,HQCSchemeID" +
                 ") " +
                 " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + omodel.HBillStatus.ToString() + ",'" + omodel.HDate + "','" + omodel.HMaker + "',getdate()" +
                 "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'" +
                 "," + omodel.HSourceID.ToString() + "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "'," + omodel.HICMOQty.ToString() + "," + omodel.HProcExchInterID.ToString() + "," + omodel.HProcExchEntryID.ToString() +
                 ",'" + omodel.HProcExchBillNo + "'," + omodel.HProcExchQty.ToString() + "," + omodel.HMaterID.ToString() + "," + omodel.HFirstCheckEmp.ToString() + ", " + DBUtility.ClsPub.BoolToString(omodel.HLastResult) +
-                "," + omodel.HMainSourceInterID + "," + omodel.HMainSourceEntryID + ",'" + omodel.HMainSourceBillNo + "','" + omodel.HMainSourceBillType + "'" + "'," + omodel.HICMOEntryID + 
+                "," + omodel.HMainSourceInterID + "," + omodel.HMainSourceEntryID + ",'" + omodel.HMainSourceBillNo + "','" + omodel.HMainSourceBillType  + "'," + omodel.HICMOEntryID + "," + omodel.HQCSchemeID +
                 ") ");
                 //鎻掑叆瀛愯〃
                 foreach (Model.ClsQC_FirstPieceCheckBillSub oSub in DetailColl)
@@ -167,15 +220,19 @@
                       ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" +
                       ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                       ",HQCCheckItemID,HQCStd,HUnit,HQCNote,HResult" +
-                      ",HMax,HMin,HAvg" +
+                      ",HMax,HMin,HAvg,HSampleSchemeID,HSampleQty,HSampleDamageQty,HAcceptQty" +
+                      ",HRejectQty,HSampleUnRightQty,HStatus,HUnitID,HInspectVal,HTargetVal" +
+                      ",HUpLimit,HDownLimit,HUpOffSet,HDownOffSet,HKeyInspect,HAnalysisMethod,HInspectInstruMentID,HInspectResult" +
                       ") 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.HQCCheckItemID.ToString() + ",'" + oSub.HQCStd + "','" + oSub.HUnit + "','" + oSub.HQCNote + "','" + oSub.HResult + "'" +
-                      ",'" + oSub.HMax + "','" + oSub.HMin + "','" + oSub.HAvg + "'" +
-                      ") ");
-                }
+                      ",'" + oSub.HMax + "','" + oSub.HMin + "','" + oSub.HAvg + "'" + "," + oSub.HSampleSchemeID + "," + oSub.HSampleQty + 
+                      "," + oSub.HSampleDamageQty + "," + oSub.HAcceptQty + "," + oSub.HRejectQty + "," + oSub.HSampleUnRightQty + ",'" + oSub.HStatus +
+                      "'," + oSub.HUnitID + ",'" + oSub.HInspectVal + "','" + oSub.HTargetVal + "','" + oSub.HUpLimit + "','" + oSub.HDownLimit +
+                      "','" + oSub.HUpOffSet + "','" + oSub.HDownOffSet + "'," + oSub.HKeyInspect + ",'" + oSub.HAnalysisMethod + "'," + oSub.HInspectInstruMentID + ",'" + oSub.HInspectResult + "'" + ") ");
+    }
                 //foreach (Model.ClsQC_FirstPieceCheckBillSub_Item oSub2 in DetailColl1)
                 //{
                 //    oCn.RunProc("Insert into QC_FirstPieceCheckBillSub_Item " +
@@ -204,6 +261,25 @@
                 //    }
                 //}
                 //
+
+
+                //=========================淇濆瓨鍚庢帶鍒�  
+                DataSet ds2 = oCn.RunProcReturn("Exec h_p_QC_FirstPieceCheckBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1 ", "h_p_QC_FirstPieceCheckBill_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;
@@ -215,6 +291,39 @@
                 throw (e);
             }
         }
+
+        //鏂板妫�楠屽��
+        public virtual bool AddValue(ref string sReturn,ref long HInterID, ref long HEntryID)
+        {
+            try
+            {
+                oCn.BeginTran();
+
+                oCn.RunProc("delete from QC_FirstPieceCheckBillSub_ValueGrid where HInterID = " + HInterID + " and HEntryID = " + HEntryID);
+
+                //鎻掑叆瀛愯〃
+                foreach (Model.ClsQC_FirstPieceCheckBillSub_ValueGrid value in DetailColl_Value)
+                {
+                    oCn.RunProc("Insert into QC_FirstPieceCheckBillSub_ValueGrid " +
+                      " (HInterID,HEntryID,HSEQ,HInSpectResult" +
+                      ",HInSpectValue,HInSpectValueB,HInSpectValueT" +
+                      ") values("
+                      + HInterID + "," + HEntryID + "," + value.HSEQ + ",'" + value.HInSpectResult + "'," +
+                      value.HInSpectValue + "," + value.HInSpectValueB + ",'" + value.HInSpectValueT + "'" +
+                      ") ");
+                }
+                sReturn = "鏂板妫�楠屽�兼垚鍔燂紒";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }           
+        }
+       
         //鏄剧ず鍗曟嵁
         public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
         {

--
Gitblit v1.9.1