yxj
2023-08-31 02dabb543b5e1699d0e1ad7d1283dd7a3beafb8e
DAL/ÐÅϢƽ̨/ClsOA_ErrMsgBackBill.cs
@@ -125,47 +125,87 @@
            try
            {
                //得到mainid
                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                //omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                //若MAINDI重复则重新获取
                oCn.BeginTran();
                string sql = "";
                sql = "Insert Into OA_ErrMsgBackBillMain" +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HYear,HPeriod,HRemark,HMaker,HMakeDate,HContext,HDeptID,HDescription,HSendMan,HReceiveMan,HCopyMan,HHasten,HLevel,HReTransmitMan,HBillTypeName" +
                ",HPlanBillNo,HMaterName,HMaterModel,HQty,HSendType) " +
                " values(" +
                "'" + this.BillType +
                "','" + this.HBillSubType +
                "'," + omodel.HInterID.ToString() +
                ",'" + omodel.HBillNo +
                "','" + omodel.HDate +
                "'," + omodel.HYear +
                "," + omodel.HPeriod +
                ",'" + omodel.HRemark +
                "','" + omodel.HSendMan +
                "',getdate()" +
                ",'" + omodel.HContext +
                "'," + omodel.HDeptID.ToString() +
                ",'" + omodel.HDescription +
                "','" + omodel.HSendMan +
                "','" + omodel.HReceiveMan +
                "','" + omodel.HCopyMan +
                "'," + omodel.HHasten.ToString() +
                ",'" + omodel.HLevel +
                "','" + omodel.HReTransmitMan +
                "','" + omodel.HBillTypeName +
                "','" + omodel.HPlanBillNo +
                "','" + omodel.HMaterName +
                "','" + omodel.HMaterModel +
                "'," + omodel.HQty.ToString() +
                ",'" + omodel.HSendType +
                "') ";
                //主表
                oCn.RunProc("Insert Into OA_ErrMsgBackBillMain   " +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
                ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
                ",HContext,HDeptID,HDescription,HSendMan,HReceiveMan" +
                ",HCopyMan,HHasten,HLevel,HReTransmitMan,HBillTypeName"+
                ",HPlanBillNo,HMaterName,HMaterModel,HQty,HSendType"+
                ") " +
                " values('" + this.BillType + "','"  + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" +
                "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" +
                ",'" + omodel.HContext + "'," + omodel.HDeptID.ToString() + ",'" + omodel.HDescription + "','" + omodel.HSendMan + "','" + omodel.HReceiveMan + "'" +
                ",'" + omodel.HCopyMan + "'," + omodel.HHasten.ToString() + ",'" + omodel.HLevel + "','" + omodel.HReTransmitMan + "','" + omodel.HBillTypeName + "'" +
                ",'" + omodel.HPlanBillNo + "','" + omodel.HMaterName + "','" + omodel.HMaterModel + "'," + omodel.HQty.ToString() + ",'" + omodel.HSendType + "'" +
                ") ");
                //插入子表
                oCn.RunProc(sql);
                //插入子表1
                foreach (Model.ClsOA_ErrMsgBackBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into OA_ErrMsgBackBillSub " +
                      " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                      ",HSendStatus,HSendMan,HDescription,HDate" +
                      ") values("
                      + 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.HSendStatus.ToString() + ",'" + oSub.HSendMan + "','" + oSub.HDescription + "','" + oSub.HDate.ToShortDateString() + "'" +
                      ") ");
                    sql = "Insert into OA_ErrMsgBackBillSub" +
                        "(HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                        ",HSendStatus,HSendMan,HDescription,HDate)" +
                        " values(" +
                        "" + 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.HSendStatus.ToString() +
                        ",'" + oSub.HSendMan +
                        "','" + oSub.HDescription +
                        "','" + oSub.HDate.ToShortDateString() +
                        "') ";
                    oCn.RunProc(sql);
                }
                //
                //插入子表2
                foreach (Model.ClsOA_ErrMsgBackBillSub2 oSubSec in DetailColl2)
                {
                    oCn.RunProc("Insert into OA_ErrMsgBackBillSub2 " +
                      " (HInterID,HEntryID" +
                      ",HReceiveMan,HReadFlag" +
                      ")" +
                      " values("
                      + omodel.HInterID.ToString() + "," + oSubSec.HEntryID.ToString() +
                      ",'" + oSubSec.HReceiveMan + "'," + Convert.ToString(oSubSec.HReadFlag ? 1 : 0) +
                      ") ");
                    sql = "Insert into OA_ErrMsgBackBillSub2" +
                      "(HInterID,HEntryID,HReceiveMan,HReadFlag)" +
                      " values(" +
                      "" + omodel.HInterID.ToString() +
                      "," + oSubSec.HEntryID.ToString() +
                      ",'" + oSubSec.HReceiveMan +
                      "'," + Convert.ToString(oSubSec.HReadFlag ? 1 : 0) +
                      ") ";
                    oCn.RunProc(sql);
                }
                //foreach (Model.ClsOA_ErrMsgBackBillSub oSub in DetailColl)
                //{