zrg
6 天以前 ab2121649b176fb2b27daf50b967b27f1561d261
DAL/Éú²ú¹ÜÀí/Ä£¾ß¹ÜÀí/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 @@
                }
                //=========================================================
                //若MAINDI重复则重新获取
                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 = "新增单据成功!";