DAL/³µ¼ä¹ÜÀí/ClsSc_WorkBeginDotCheckBillMain.cs
@@ -38,6 +38,23 @@
            {
                oCn.BeginTran();
                //保存前控制=========================================
                string HBillNote = "";
                DataSet ds = oCn.RunProcReturn("Exec h_p_Sc_WorkBeginDotCheckBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',2", "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.RunProc("UpDate Sc_WorkBeginDotCheckBillMain set  " +
                " HBillNo='" + omodel.HBillNo + "'" +  
@@ -71,25 +88,43 @@
                foreach (Model.ClsSc_WorkBeginDotCheckBillSub oSub in DetailColl)
                {
                    string subSql = "insert into Sc_WorkBeginDotCheckBillSub " +
                        "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRemark" +
                        ",HCheckNoteItemID,HCheckPostID,HCheckResult) " +
                        " values(" +
                        "" + omodel.HInterID.ToString() +
                        "," + oSub.HEntryID.ToString() +
                        "," + oSub.HSourceInterID +
                        "," + oSub.HSourceEntryID +
                        ",'" + oSub.HSourceBillNo +
                        "','" + oSub.HSourceBillType +
                        "','" + oSub.HRemark +
                        "','" + oSub.HCheckNoteItemID +
                        "','" + oSub.HCheckPostID +
                        "','" + oSub.HCheckResult +
                        "')";
                   "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRemark" +
                   ",HCheckNoteItemID,HCheckPostID,HCheckResult,HDotCheckType,HRelationID,HDotCheckVal) " +
                   " values(" +
                   "" + omodel.HInterID.ToString() +
                   "," + oSub.HEntryID.ToString() +
                   "," + oSub.HSourceInterID +
                   "," + oSub.HSourceEntryID +
                   ",'" + oSub.HSourceBillNo +
                   "','" + oSub.HSourceBillType +
                   "','" + oSub.HRemark +
                   "','" + oSub.HCheckNoteItemID +
                   "','" + oSub.HCheckPostID +
                   "','" + oSub.HCheckResult +
                   "','" + oSub.HDotCheckType +
                   "','" + oSub.HRelationID +
                    "','" + oSub.HDotCheckVal +
                   "')";
                    oCn.RunProc(subSql);
                }
                sReturn = "修改单据成功!";
                //=========================保存后控制
                DataSet ds2 = oCn.RunProcReturn("h_p_Sc_WorkBeginDotCheckBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',2 ", "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;
                }
                //============================
                oCn.Commit();
                return true;
            }
@@ -107,8 +142,24 @@
            {
                DataSet ds;
                oCn.BeginTran();
                //保存前控制=========================================
                string HBillNote = "";
                 ds = oCn.RunProcReturn("Exec h_p_Sc_WorkBeginDotCheckBill_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;
                }
                //=========================================================
                //检查主表内码是否重复,若重复则重新生成并继续检查,直到不再重复
                while (true)
@@ -161,7 +212,7 @@
                {
                    string subSql = "insert into Sc_WorkBeginDotCheckBillSub " +
                        "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRemark" +
                        ",HCheckNoteItemID,HCheckPostID,HCheckResult) " +
                        ",HCheckNoteItemID,HCheckPostID,HCheckResult,HDotCheckType,HRelationID,HDotCheckVal) " +
                        " values(" +
                        "" + omodel.HInterID.ToString() +
                        "," + oSub.HEntryID.ToString() +
@@ -173,11 +224,30 @@
                        "','" + oSub.HCheckNoteItemID +
                        "','" + oSub.HCheckPostID +
                        "','" + oSub.HCheckResult +
                        "','" + oSub.HDotCheckType +
                        "','" + oSub.HRelationID +
                        "','" + oSub.HDotCheckVal +
                        "')";
                    oCn.RunProc(subSql);
                }
                sReturn = "新增单据成功!";
                //=========================保存后控制
                DataSet ds2 = oCn.RunProcReturn("h_p_Sc_WorkBeginDotCheckBill_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;
                }
                //============================
                oCn.Commit();
                return true;
            }