chenhaozhe
2025-10-16 2fa71a673f27b62038ceba4da0413dd7bc0f3497
DAL/³µ¼ä¹ÜÀí/ClsGy_WorkBeginDotCheckListBillMain.cs
@@ -38,6 +38,22 @@
            {
                oCn.BeginTran();
                //保存前控制=========================================
                string HBillNote = "";
                DataSet ds = oCn.RunProcReturn("Exec h_p_Gy_WorkBeginDotCheckListBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',2 ", "h_p_Gy_WorkBeginDotCheckListBill_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_WorkBeginDotCheckListBillMain set  " +
                " HBillNo='" + omodel.HBillNo + "'" +  
@@ -63,7 +79,7 @@
                {
                    string subSql = "insert into Gy_WorkBeginDotCheckListBillSub " +
                        "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRemark" +
                        ",HCheckNoteItemID,HCheckPostID) " +
                        ",HCheckNoteItemID,HCheckPostID,HDotCheckType,HRelationID) " +
                        " values(" +
                        "" + omodel.HInterID.ToString() +
                        "," + oSub.HEntryID.ToString() +
@@ -74,11 +90,27 @@
                        "','" + oSub.HRemark +
                        "','" + oSub.HCheckNoteItemID +
                        "','" + oSub.HCheckPostID +
                        "','" + oSub.HDotCheckType +
                        "','" + oSub.HRelationID +
                        "')";
                    oCn.RunProc(subSql);
                }
                //=========================保存后控制
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_WorkBeginDotCheckListBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',2 ", "h_p_Gy_WorkBeginDotCheckListBill_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;
@@ -100,6 +132,20 @@
                oCn.BeginTran();
                //保存前控制=========================================
                string HBillNote = "";
                 ds = oCn.RunProcReturn("Exec h_p_Gy_WorkBeginDotCheckListBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_Gy_WorkBeginDotCheckListBill_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)
                {
@@ -117,7 +163,7 @@
                //主表
                string mainSql = "insert into Gy_WorkBeginDotCheckListBillMain" +
                    "(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate,HBillNo,HRemark,HMaker,HMakeDate" +
                    ",HMaterID,HSourceID,HProcID,HNote) " +
                    ",HMaterID,HSourceID,HProcID,HNote,HOrgID) " +
                    "values(" +
                    "" + (omodel.HYear.ToString() != "0" ? omodel.HYear.ToString() : DateTime.Now.Year.ToString()) +
                    "," + omodel.HPeriod.ToString() +
@@ -133,6 +179,7 @@
                    "','" + omodel.HSourceID +
                    "','" + omodel.HProcID +                   
                    "','" + omodel.HNote +
                      "','" + omodel.HOrgID +
                    "')";
                oCn.RunProc(mainSql);
@@ -142,7 +189,7 @@
                {
                    string subSql = "insert into Gy_WorkBeginDotCheckListBillSub " +
                        "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRemark" +
                        ",HCheckNoteItemID,HCheckPostID) " +
                        ",HCheckNoteItemID,HCheckPostID,HDotCheckType,HRelationID) " +
                        " values(" +
                        "" + omodel.HInterID.ToString() +
                        "," + oSub.HEntryID.ToString() +
@@ -153,10 +200,28 @@
                        "','" + oSub.HRemark +
                        "','" + oSub.HCheckNoteItemID +
                        "','" + oSub.HCheckPostID +
                        "','" + oSub.HDotCheckType +
                        "','" + oSub.HRelationID +
                        "')";
                    oCn.RunProc(subSql);
                }
                //=========================保存后控制
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Gy_WorkBeginDotCheckListBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1 ", "h_p_Gy_WorkBeginDotCheckListBill_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;