duhe
2023-10-26 6f242d5de973bde5f93e1443f46c97e23009d9ab
DAL/ÏúÊÛ¹ÜÀí/ClsXs_CusRatingChangeBill.cs
@@ -37,7 +37,7 @@
                //
                oCn.BeginTran();
                //更新主表
                oCn.RunProc("UpDate Xs_CusRatingChangeBillMain set  " +
                string mainSql = "UpDate Xs_CusRatingChangeBillMain set  " +
                " HBillNo='" + omodel.HBillNo + "'" +
                ",HDeptID=" + omodel.HDeptID.ToString() +
                ",HEmpID=" + omodel.HEmpID.ToString() +
@@ -46,13 +46,22 @@
                ",HOldRating=" + omodel.HOldRating.ToString() +
                ",HNewRating=" + omodel.HNewRating.ToString() +
                ",HReason='" + omodel.HReason + "'" +
                ",HManagerID=" + omodel.HManagerID +
                ",HOrgID=" + omodel.HOrgID +
                ",HRemark='" + omodel.HRemark + "'" +
                ",HOldRatingDate=" + omodel.HOldRatingDate +
                ",HNewRatingDate=" + omodel.HNewRatingDate +
                ",HOldRedRatingDate=" + omodel.HOldRedRatingDate +
                ",HNewRedRatingDate=" + omodel.HNewRedRatingDate +
                ",HFinanceCheck='" + omodel.HFinanceCheck + "'" +
                ",HFinanceCheckStatus='" + omodel.HFinanceCheckStatus + "'" +
                ",HGeneralManager='" + omodel.HGeneralManager + "'" +
                ",HGeneralManagerStatus='" + omodel.HGeneralManagerStatus + "'" +
                ",HUpDater='" + omodel.HUpDater + "'" +
                ",HUpDateDate='" + omodel.HUpDateDate + "'" +
                " where HInterID=" + lngBillKey.ToString());
                " where HInterID=" + lngBillKey.ToString();
                oCn.RunProc(mainSql);
                //删除关联
                DeleteRelation(ref sReturn, lngBillKey);
                ////删除子表
@@ -86,33 +95,42 @@
            try
            {
                //得到mainid
                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                omodel.HBillNo = DBUtility.ClsPub.CreateBillCode(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true);
                //omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                //omodel.HBillNo = DBUtility.ClsPub.CreateBillCode(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true);
                //若MAINDI重复则重新获取
                if (IsExistBillNo(ref DBUtility.ClsPub.sExeReturnInfo, omodel.HBillNo, Pub_Class.ClsPub.Enum_BillStatus.BillStatus_AddNew, omodel.HInterID))
                {
                    omodel.HBillNo = DBUtility.ClsPub.CreateBillCode(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true);
                }
                if (IsExistMainID(ref DBUtility.ClsPub.sExeReturnInfo, omodel.HInterID, Pub_Class.ClsPub.Enum_BillStatus.BillStatus_AddNew))
                //if (IsExistBillNo(ref DBUtility.ClsPub.sExeReturnInfo, omodel.HBillNo, Pub_Class.ClsPub.Enum_BillStatus.BillStatus_AddNew, omodel.HInterID))
                //{
                //    omodel.HBillNo = DBUtility.ClsPub.CreateBillCode(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true);
                //}
                //if (IsExistMainID(ref DBUtility.ClsPub.sExeReturnInfo, omodel.HInterID, Pub_Class.ClsPub.Enum_BillStatus.BillStatus_AddNew))
                //{
                //    omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                //}
                //
                //若MAINDI重复则重新获取
                while (IsExistMainID(ref DBUtility.ClsPub.sExeReturnInfo, omodel.HInterID, Pub_Class.ClsPub.Enum_BillStatus.BillStatus_AddNew))
                {
                    omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                //
                oCn.BeginTran();
                //主表
                oCn.RunProc("Insert Into Xs_CusRatingChangeBillMain   " +
                "(HBillType,HInterID,HBillNo,HDate" +
                ",HYear,HPeriod,HMaker,HMakeDate" +
                ",HEmpID,HDeptID,HCusID" +
                ",HReason,HFinanceCheck,HFinanceCheckStatus,HGeneralManager,HGeneralManagerStatus" +
                ",HOldRating,HNewRating" +
                string mainSql = "Insert Into Xs_CusRatingChangeBillMain   " +
                "(HBillType,HInterID,HBillNo,HDate,HYear,HPeriod,HMaker,HMakeDate" +
                ",HEmpID,HDeptID,HCusID,HReason,HFinanceCheck,HFinanceCheckStatus,HGeneralManager,HGeneralManagerStatus" +
                ",HOldRating,HNewRating,HManagerID,HOldRatingDate,HNewRatingDate,HOldRedRatingDate,HNewRedRatingDate,HOrgID,HRemark" +
                ") " +
                " values('" + this.BillType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate.ToShortDateString() + "'" +
                "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + DBUtility.ClsPub.CurUserName + "',getdate()" +
                "," + omodel.HEmpID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HCusID.ToString() +
                ",'" + omodel.HReason + "','" + omodel.HFinanceCheck + "','" + omodel.HFinanceCheckStatus + "','" + omodel.HGeneralManager + "','" + omodel.HGeneralManagerStatus + "'" +
                "," + omodel.HOldRating.ToString() + "," + omodel.HNewRating.ToString() +
                ") ");
                "," + omodel.HOldRating.ToString() + "," + omodel.HNewRating.ToString() +
                "," + omodel.HManagerID + "," + omodel.HOldRatingDate + "," + omodel.HNewRatingDate + "," + omodel.HOldRedRatingDate + "," + omodel.HNewRedRatingDate + "," + omodel.HOrgID + ",'" + omodel.HRemark + "'" +
                ") ";
                oCn.RunProc(mainSql);
                ////插入子表
                //foreach (Model.ClsXs_CusRatingChangeBillSub oSub in DetailColl)
                //{
@@ -161,6 +179,14 @@
                //
                omodel.HOldRating = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HOldRating"]);
                omodel.HNewRating = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HNewRating"]);
                omodel.HManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HManagerID"]);
                omodel.HOrgID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HOrgID"]);
                omodel.HRemark = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]);
                omodel.HOldRatingDate = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HOldRatingDate"]);
                omodel.HNewRatingDate = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HNewRatingDate"]);
                omodel.HOldRedRatingDate = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HOldRedRatingDate"]);
                omodel.HNewRedRatingDate = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HNewRedRatingDate"]);
                //
                omodel.HReason = Ds.Tables[0].Rows[0]["HReason"].ToString().Trim();
                omodel.HFinanceCheck = Ds.Tables[0].Rows[0]["HFinanceCheck"].ToString().Trim();