11
pzy
2024-08-26 dbbcd506929afda0a85ae23bcb5f88c1dccef387
DAL/ÏúÊÛ¹ÜÀí/ClsXs_SeOrderChangeBill.cs
@@ -37,6 +37,21 @@
        {
            try
            {
                //保存前控制=========================================
                string HBillNote = "";
                DataSet ds = oCn.RunProcReturn("Exec h_p_Xs_SeOrderChangeBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_Xs_SeOrderChangeBill_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();
                //更新主表
                string mainSql = "update Xs_SeOrderChangeBillMain set " +
@@ -72,7 +87,7 @@
                {
                    string subSql = "insert into Xs_SeOrderChangeBillSub" +
                        "(HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                        ",HMaterID,HUnitID,HQty_Old,HQty_New,HTaxPrice_Old,HTaxPrice_New,HDate_Old,HDate_New) " +
                        ",HMaterID,HUnitID,HQty_Old,HQty_New,HTaxRate_Old,HTaxRate_New,HTaxPrice_Old,HTaxPrice_New,HDate_Old,HDate_New) " +
                        " values(" +
                        "" + omodel.HInterID.ToString() +
                        "," + oSub.HEntryID.ToString() +
@@ -91,6 +106,8 @@
                        "," + oSub.HUnitID +
                        "," + oSub.HQty_Old +
                        "," + oSub.HQty_New +
                        "," + oSub.HTaxRate_Old +
                        "," + oSub.HTaxRate_New +
                        "," + oSub.HTaxPrice_Old +
                        "," + oSub.HTaxPrice_New +
                        ",'" + oSub.HDate_Old + "'" +
@@ -98,7 +115,23 @@
                        ")";
                    oCn.RunProc(subSql);
                }
                //保存后控制=========================================
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Xs_SeOrderChangeBill_AfterSaveCtrl " + omodel.HInterID.ToString(), "h_p_Xs_SeOrderChangeBill_AfterSaveCtrl");
                if (ds2 == null)
                {
                    sReturn = "保存后判断失败!";
                    oCn.RollBack();
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    oCn.RollBack();
                    return false;
                }
                //=========================================================
                sReturn = "修改单据成功!";
                oCn.Commit();
                return true;
@@ -123,6 +156,21 @@
                    omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                //保存前控制=========================================
                string HBillNote = "";
                DataSet ds = oCn.RunProcReturn("Exec h_p_Xs_SeOrderChangeBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_Xs_SeOrderChangeBill_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();
                //插入主表
@@ -165,7 +213,7 @@
                {
                    string subSql = "insert into Xs_SeOrderChangeBillSub" +
                        "(HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                        ",HMaterID,HUnitID,HQty_Old,HQty_New,HTaxPrice_Old,HTaxPrice_New,HDate_Old,HDate_New) " +
                        ",HMaterID,HUnitID,HQty_Old,HQty_New,HTaxRate_Old,HTaxRate_New,HTaxPrice_Old,HTaxPrice_New,HDate_Old,HDate_New) " +
                        " values(" +
                        "" + omodel.HInterID.ToString() +
                        "," + oSub.HEntryID.ToString() +
@@ -184,6 +232,8 @@
                        "," + oSub.HUnitID +
                        "," + oSub.HQty_Old +
                        "," + oSub.HQty_New +
                        "," + oSub.HTaxRate_Old +
                        "," + oSub.HTaxRate_New +
                        "," + oSub.HTaxPrice_Old +
                        "," + oSub.HTaxPrice_New +
                        ",'" + oSub.HDate_Old + "'" +
@@ -191,6 +241,25 @@
                        ")";
                    oCn.RunProc(subSql);
                }
                //保存后控制=========================================
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Xs_SeOrderChangeBill_AfterSaveCtrl " + omodel.HInterID.ToString(), "h_p_Xs_SeOrderChangeBill_AfterSaveCtrl");
                if (ds2 == null)
                {
                    sReturn = "保存后判断失败!";
                    oCn.RollBack();
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    oCn.RollBack();
                    return false;
                }
                //=========================================================
                sReturn = "新增单据成功!";
                oCn.Commit();
                return true;
@@ -290,10 +359,10 @@
                    //===================================================
                    oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]);
                    oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]);
                    oSub.HQty_Old = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[0]["HQty_Old"]);
                    oSub.HQty_New = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[0]["HQty_New"]);
                    oSub.HTaxPrice_Old = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[0]["HTaxPrice_Old"]);
                    oSub.HTaxPrice_New = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[0]["HTaxPrice_New"]);
                    oSub.HQty_Old = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQty_Old"]);
                    oSub.HQty_New = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQty_New"]);
                    oSub.HTaxPrice_Old = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HTaxPrice_Old"]);
                    oSub.HTaxPrice_New = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HTaxPrice_New"]);
                    oSub.HDate_Old = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HDate_Old"]);
                    oSub.HDate_New = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HDate_New"]);