Exemplo n.º 1
0
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RAdd(BaseEntity p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                CheckOperation entity = (CheckOperation)p_BE;
                string         sql    = "SELECT FormNo FROM Finance_CheckOperation WHERE FormNo=" + SysString.ToDBString(entity.FormNo);
                DataTable      dt     = sqlTrans.Fill(sql);
                if (dt.Rows.Count > 0)
                {
                    throw new BaseException("对账单号已存在,请重新生成");
                }
                CheckOperationCtl control = new CheckOperationCtl(sqlTrans);
                entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Finance_CheckOperation, sqlTrans);
                control.AddNew(entity);

                FormNoControlRule rulest = new FormNoControlRule();
                rulest.RAddSort((int)FormNoControlEnum.对账单号, sqlTrans);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 删除
        /// </summary>
        public override void EntityDelete()
        {
            CheckOperationRule rule   = new CheckOperationRule();
            CheckOperation     entity = EntityGet();

            rule.RDelete(entity);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 新增
        /// </summary>
        public override int EntityAdd()
        {
            CheckOperationRule rule   = new CheckOperationRule();
            CheckOperation     entity = EntityGet();

            CheckOperationDts[] entitydts = EntityDtsGet();
            //CheckOperationInvDts[] entityInvDts = EntityInvDtsGet();
            //CheckOperationPayDts[] entityPayDts = EntityPayDtsGet();
            decimal TotalCheckAmount = 0;
            decimal TotalQty         = 0;

            for (int i = 0; i < entitydts.Length; i++)
            {
                TotalCheckAmount += SysConvert.ToDecimal(entitydts[i].DCheckAmount);
                TotalQty         += SysConvert.ToDecimal(entitydts[i].DCheckQty);
            }
            entity.TotalCheckAmount = TotalCheckAmount;
            entity.TotalQty         = TotalQty;
            entity.SubmitFlag       = this.HTSubmitFlagInsertGet();

            //ProcThisQty(entity, entitydts, entityInvDts, entityPayDts);//处理本期余数
            //列表中的对账数据不可重复加载 sc 20140123


            rule.RAdd(entity, entitydts);
            return(entity.ID);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 处理本期余额
        /// </summary>
        void ProcThisQty(CheckOperation entity, CheckOperationDts[] entitydts, CheckOperationInvDts[] entityInvDts, CheckOperationPayDts[] entityPayDts)
        {
            decimal totalThisQty       = 0; //本期发生数量
            decimal totalThisAmount    = 0; //本期发生金额
            decimal totalThisInvQty    = 0; //本期发票数量
            decimal totalThisInvAmount = 0; //本期发票金额
            decimal totalThisPayAmount = 0; //本期支付金额

            for (int i = 0; i < entitydts.Length; i++)
            {
                totalThisQty    += entitydts[i].DCheckQty;
                totalThisAmount += entitydts[i].DCheckAmount;
            }
            for (int i = 0; i < entityInvDts.Length; i++)
            {
                totalThisInvQty    += entityInvDts[i].DInvoiceQty;
                totalThisInvAmount += entityInvDts[i].DInvoiceAmount;
            }

            for (int i = 0; i < entityPayDts.Length; i++)
            {
                totalThisPayAmount += entityPayDts[i].ExAmount;
            }

            entity.ThisExAmount      = entity.PreExAmount + totalThisAmount - totalThisPayAmount;
            entity.ThisInvoiceQty    = entity.PreInvoiceQty + totalThisQty - totalThisInvQty;
            entity.ThisInvoiceAmount = entity.PreInvoiceAmount + totalThisAmount - totalThisInvAmount;
        }
Exemplo n.º 5
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Delete(BaseEntity p_Entity)
        {
            try
            {
                CheckOperation MasterEntity = (CheckOperation)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //删除主表数据
                string Sql = "";
                Sql = "DELETE FROM Finance_CheckOperation WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID);
                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(Sql);
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(Sql);
                }

                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBDelete), E);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private CheckOperation EntityGet()
        {
            CheckOperation entity = new CheckOperation();

            entity.ID = HTDataID;
            return(entity);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 设置
        /// </summary>
        public override void EntitySet()
        {
            CheckOperation entity = new CheckOperation();

            entity.ID = HTDataID;
            bool findFlag = entity.SelectByID();


            txtFormNo.Text           = entity.FormNo.ToString();
            txtOrderCode.Text        = entity.OrderCode.ToString();
            txtMakeDate.DateTime     = entity.MakeDate;
            drpVendorID.EditValue    = entity.VendorID;
            txtRemark.Text           = entity.Remark.ToString();
            txtDVendorCon.Text       = entity.DVendorCon.ToString();
            drpSaleOPID.EditValue    = entity.SaleOPID;
            txtTotalAmount.Text      = entity.TotalAmount.ToString();
            txtTotalCheckAmount.Text = entity.TotalCheckAmount.ToString();
            txtTotalCheckQty.Text    = entity.TotalQty.ToString();
            drpDZType.EditValue      = entity.DZTypeID;


            HTDataSubmitFlag = entity.SubmitFlag;
            HTDataDelFlag    = entity.DelFlag;
            if (!findFlag)
            {
            }

            BindGridDts();
        }
Exemplo n.º 8
0
        /// <summary>
        /// 保存(传入事务处理)
        /// </summary>
        /// <param name="p_Entity"></param>
        /// <param name="p_BE"></param>
        /// <param name="sqlTrans"></param>
        public void RSave(CheckOperation p_Entity, BaseEntity[] p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                string sql = "DELETE FROM Finance_CheckOperationDts WHERE MainID=" + p_Entity.ID.ToString();
                sql += " AND ID NOT IN" + string.Format("({0})", GetIDExist(p_BE));
                sqlTrans.ExecuteNonQuery(sql);                                                                                     //删除原单据里应该删除的明细数据,即数据库里有但是UI里已经删除的数据
                sql = "SELECT ISNULL(MAX(Seq),0)+1 As MSEQ FROM Finance_CheckOperationDts WHERE MainID=" + p_Entity.ID.ToString(); ////找到最大的Seq    将获得最大Seq的语句放到循环外更高效(多人操作时会有问题吗?)
                int MSEQ = SysConvert.ToInt32(sqlTrans.Fill(sql).Rows[0][0].ToString());
                for (int i = 0; i < p_BE.Length; i++)
                {
                    CheckOperationDts entitydts = (CheckOperationDts)p_BE[i];
                    if (entitydts.ID != 0)//ID不为0说明数据库中已经存在
                    {
                        this.RUpdate(entitydts, sqlTrans);
                    }
                    else
                    {
                        entitydts.Seq    = MSEQ;
                        entitydts.MainID = p_Entity.ID;
                        this.RAdd(entitydts, sqlTrans);

                        MSEQ++;//最大值加1
                    }
                }
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Exemplo n.º 9
0
 public static bool AllOf(string[] arr, CheckOperation uo)
 {
     foreach (string item in arr)
     {
         if (uo(item))
         {
             return(false);
         }
     }
     return(true);
 }
Exemplo n.º 10
0
        /// <summary>
        /// 检验字段值是否已存在
        /// </summary>
        /// <param name="p_TableName">表名</param>
        /// <param name="p_FieldName">字段名</param>
        /// <param name="p_FieldValue">字段值</param>
        /// <param name="p_KeyField">主键(只考虑主键为ID的情况)</param>
        /// <param name="p_KeyValue">主键值</param>
        /// <param name="p_sqlTrans"></param>
        /// <returns></returns>
        private bool CheckFieldValueIsExist(BaseEntity p_BE, string p_FieldName, string p_FieldValue, IDBTransAccess p_sqlTrans)
        {
            CheckOperation entity = (CheckOperation)p_BE;
            bool           ret    = false;
            string         sql    = string.Format(" SELECT {0} FROM {1} WHERE 1=1 AND {0}={2} AND {3}<>{4}", p_FieldName, CheckOperation.TableName, SysString.ToDBString(p_FieldValue), "ID", entity.ID);
            DataTable      dt     = p_sqlTrans.Fill(sql);

            if (dt.Rows.Count != 0)
            {
                ret = true;
            }

            return(ret);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 设置
        /// </summary>
        public override void EntitySet()
        {
            CheckOperation entity = new CheckOperation();

            entity.ID = HTDataID;
            bool findFlag = entity.SelectByID();


            txtFormNo.Text       = entity.FormNo.ToString();
            txtOrderCode.Text    = entity.OrderCode.ToString();
            txtMakeDate.DateTime = entity.MakeDate;
            drpDZType.EditValue  = entity.DZTypeID;

            drpVendorID.EditValue = entity.VendorID;


            txtRemark.Text           = entity.Remark.ToString();
            txtDVendorCon.Text       = entity.DVendorCon.ToString();
            drpSaleOPID.EditValue    = entity.SaleOPID;
            txtTotalAmount.Text      = entity.TotalAmount.ToString();
            txtTotalCheckAmount.Text = entity.TotalCheckAmount.ToString();
            txtTotalQty.Text         = entity.TotalQty.ToString();

            drpCheckMethodType.EditValue = entity.CheckMethodTypeID;
            HTDataSubmitFlag             = entity.SubmitFlag;
            HTDataDelFlag = entity.DelFlag;

            txtThisExAmount.Text      = entity.ThisExAmount.ToString();
            txtThisInvoiceAmount.Text = entity.ThisInvoiceAmount.ToString();
            txtThisInvoiceQty.Text    = entity.ThisInvoiceQty.ToString();

            txtPreExAmount.Text      = entity.PreExAmount.ToString();
            txtPreInvoiceAmount.Text = entity.PreInvoiceAmount.ToString();
            txtPreInvoiceQty.Text    = entity.PreInvoiceQty.ToString();
            txtFormDate.DateTime     = entity.FormDate;
            IsMerge = entity.MergeFlage;
            txtInvoiceApplyNo.Text = entity.InvoiceApplyNo;

            if (!findFlag)
            {
            }

            BindGridDts();
            //BindGrid2();
            //BindGrid3();
        }
Exemplo n.º 12
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="p_BE">要修改的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RUpdate(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         CheckOperation    entity  = (CheckOperation)p_BE;
         CheckOperationCtl control = new CheckOperationCtl(sqlTrans);
         control.Update(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Exemplo n.º 13
0
        /// <summary>
        /// 修改
        /// </summary>
        public override void EntityUpdate()
        {
            CheckOperationRule rule   = new CheckOperationRule();
            CheckOperation     entity = EntityGet();

            CheckOperationDts[] entitydts        = EntityDtsGet();
            decimal             TotalCheckAmount = 0;
            decimal             TotalCheckQty    = 0;

            for (int i = 0; i < entitydts.Length; i++)
            {
                TotalCheckAmount += SysConvert.ToDecimal(entitydts[i].DCheckAmount);
                TotalCheckQty    += SysConvert.ToDecimal(entitydts[i].DCheckQty);
            }
            entity.TotalCheckAmount = TotalCheckAmount;
            entity.TotalQty         = TotalCheckQty;
            entity.SubmitFlag       = this.HTSubmitFlagUpdateGet();
            rule.RUpdate(entity, entitydts);
        }
Exemplo n.º 14
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="p_BE">要删除的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RDelete(BaseEntity p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                CheckOperation    entity  = (CheckOperation)p_BE;
                CheckOperationCtl control = new CheckOperationCtl(sqlTrans);


                string sql = "DELETE FROM Finance_CheckOperationDts WHERE MainID=" + entity.ID.ToString();
                sqlTrans.ExecuteNonQuery(sql);//删除原单据明细数据

                control.Delete(entity);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Exemplo n.º 15
0
 private void frmCheckOperation2Edit_FormClosing(object sender, FormClosingEventArgs e)
 {
     try
     {
         if (HTDataID > 0)
         {
             CheckOperation entity = new CheckOperation();
             entity.ID = HTDataID;
             entity.SelectByID();
             if (entity.SubmitFlag == 0)
             {
                 if (DialogResult.Yes != ShowConfirmMessage(this.Text + Environment.NewLine + "没有提交单据,是否确认关闭窗体"))
                 {
                     e.Cancel = true;
                 }
             }
         }
     }
     catch (Exception E)
     {
         this.ShowMessage(E.Message);
     }
 }
Exemplo n.º 16
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private CheckOperation EntityGet()
        {
            CheckOperation entity = new CheckOperation();

            entity.ID = HTDataID;
            entity.SelectByID();

            entity.FormNo    = txtFormNo.Text.Trim();
            entity.OrderCode = txtOrderCode.Text.Trim();

            entity.VendorID          = SysConvert.ToString(drpVendorID.EditValue);
            entity.FormDate          = txtFormDate.DateTime;
            entity.Remark            = txtRemark.Text.Trim();
            entity.DVendorCon        = txtDVendorCon.Text.Trim();
            entity.SaleOPID          = SysConvert.ToString(drpSaleOPID.EditValue);
            entity.TotalAmount       = SysConvert.ToDecimal(txtTotalAmount.Text.Trim());
            entity.TotalCheckAmount  = SysConvert.ToDecimal(txtTotalCheckAmount.Text.Trim());
            entity.DZTypeID          = SysConvert.ToInt32(drpDZType.EditValue);
            entity.CheckMethodTypeID = SysConvert.ToInt32(drpCheckMethodType.EditValue);
            entity.PreExAmount       = SysConvert.ToDecimal(txtPreExAmount.Text.Trim());
            entity.PreInvoiceAmount  = SysConvert.ToDecimal(txtPreInvoiceAmount.Text.Trim());
            entity.PreInvoiceQty     = SysConvert.ToDecimal(txtPreInvoiceQty.Text.Trim());
            entity.ThisExAmount      = SysConvert.ToDecimal(txtThisExAmount.Text.Trim());
            entity.ThisInvoiceAmount = SysConvert.ToDecimal(txtThisInvoiceAmount.Text.Trim());
            entity.ThisInvoiceQty    = SysConvert.ToDecimal(txtThisInvoiceQty.Text.Trim());
            entity.MergeFlage        = IsMerge;
            entity.InvoiceApplyNo    = txtInvoiceApplyNo.Text.Trim();

            if (HTFormStatus == FormStatus.新增)
            {
                entity.MakeOPID   = FParamConfig.LoginID;
                entity.MakeOPName = FParamConfig.LoginName;
                entity.MakeDate   = txtMakeDate.DateTime.Date;
            }

            return(entity);
        }
Exemplo n.º 17
0
        public Operation CreateOperation(Guid logGuid, TransactionOperation transactionOperation, IOperationProvider operationProvider)
        {
            Operation operation = null;

            if (operationProvider != null)
            {
                OperationProvider = operationProvider;
            }
            else
            {
                throw new ArgumentException("Provider cann't be null");
            }
            switch (transactionOperation)
            {
            case TransactionOperation.CheckPayment:
                operation = new CheckOperation(logGuid, OperationProvider);
                break;

            case TransactionOperation.IPayment:
                operation = new IPaymentOperation(logGuid, OperationProvider);
                break;

            case TransactionOperation.ICommit:
                operation = new ICommitOperation(logGuid, OperationProvider);
                break;

            case TransactionOperation.Cancel:
                operation = new CancelOperation(logGuid, OperationProvider);
                break;

            default:
                string msg = $"TransactionOperation {OperationProvider} not supported";
                Logger.WriteLoggerError(msg);
                throw new ArgumentOutOfRangeException(msg);
            }
            return(operation);
        }
Exemplo n.º 18
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private CheckOperation EntityGet()
        {
            CheckOperation entity = new CheckOperation();

            entity.ID = HTDataID;
            entity.SelectByID();

            entity.FormNo           = txtFormNo.Text.Trim();
            entity.OrderCode        = txtOrderCode.Text.Trim();
            entity.MakeOPID         = FParamConfig.LoginID;
            entity.MakeOPName       = FParamConfig.LoginName;
            entity.MakeDate         = txtMakeDate.DateTime.Date;
            entity.VendorID         = SysConvert.ToString(drpVendorID.EditValue);
            entity.FormDate         = DateTime.Now.Date;
            entity.Remark           = txtRemark.Text.Trim();
            entity.DVendorCon       = txtDVendorCon.Text.Trim();
            entity.SaleOPID         = SysConvert.ToString(drpSaleOPID.EditValue);
            entity.TotalAmount      = SysConvert.ToDecimal(txtTotalAmount.Text.Trim());
            entity.TotalCheckAmount = SysConvert.ToDecimal(txtTotalCheckAmount.Text.Trim());
            entity.DZTypeID         = SysConvert.ToInt32(drpDZType.EditValue);


            return(entity);
        }
Exemplo n.º 19
0
        /// <summary>
        /// 审核
        /// </summary>
        /// <param name="p_FormID">单据ID</param>
        /// <param name="p_Type">0/1/2/3:弃审/审核</param>
        public void RSubmit(int p_FormID, int p_Type, IDBTransAccess sqlTrans)
        {
            try
            {
                int            p_TempType = p_Type;//处理状态
                string         sql        = string.Empty;
                CheckOperation entity     = new CheckOperation(sqlTrans);
                entity.ID = p_FormID;
                entity.SelectByID();
                if (entity.SubmitFlag == p_Type)//如果相同异常
                {
                    throw new Exception("单据状态重复设置,请关闭程序重新打开操作");
                }

                //更新状态
                sql = "UPDATE  Finance_CheckOperation SET SubmitFlag=" + SysString.ToDBString(p_Type) + " WHERE ID=" + p_FormID;
                sqlTrans.ExecuteNonQuery(sql);

                if (entity.MergeFlage == 1)
                {
                    SetCheckOperationTotal(p_FormID, p_Type, sqlTrans);
                }
                else
                {
                    SetCheckOperation(p_FormID, p_Type, sqlTrans);//回填数据处理
                }
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// 处理对账回填数据
        /// </summary>
        /// <param name="p_FormID"></param>
        /// <param name="p_Type"></param>
        /// <param name="sqlTrans"></param>
        private void SetCheckOperationTotal(int p_FormID, int p_Type, IDBTransAccess sqlTrans)
        {
            string sql = "SELECT ID,MainID,Seq FROM Finance_CheckOperationDts WHERE MainID=" + SysString.ToDBString(p_FormID);

            sql += " ORDER BY Seq";
            DataTable dt = sqlTrans.Fill(sql);

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    //对账单
                    CheckOperation entity = new CheckOperation();
                    entity.ID = p_FormID;

                    ///对账单明细
                    CheckOperationDts entityDts = new CheckOperationDts();
                    entityDts.ID = SysConvert.ToInt32(dr["ID"]);
                    entityDts.SelectByID();

                    ///仓库单据明细
                    IOForm entityIOF = new IOForm(sqlTrans);
                    entityIOF.ID = entityDts.DLOADID;
                    entityIOF.SelectByID();
                    if (entityDts.DLOADID > 0) ///回填仓库出入库数据
                    {
                        if (entityIOF.SelectByID())
                        {
                        }
                        else
                        {
                            throw new Exception("操作异常,没有找到出入库记录 ID:" + entityDts.DLOADID);
                        }
                        if (p_Type == (int)YesOrNo.Yes)//提交
                        {
                            //if (entityIOF.DZFlag == (int)YesOrNo.Yes && entityIOF.Qty == entityDts.DCheckQty)
                            //{
                            //    throw new Exception("不能操作,数据已对账 ID:" + entityDts.DLOADDtsID + " " + entityIOF.ItemCode + " " + entityIOF.ColorNum);
                            //}

                            ///回填数据到出库明细表中:对账数量、对账金额、对账单价、对账标志、对账单、对账日期、对账单号
                            ///
                            sql  = "UPDATE WH_IOForm SET DZQty=ISNULL(DZQty,0)+(" + SysString.ToDBString(entityDts.DCheckQty) + ")";
                            sql += ",DZAmount=ISNULL(DZAmount,0)+(" + SysString.ToDBString(entityDts.DCheckAmount) + ")";
                            sql += ",DZSinglePrice=" + SysString.ToDBString(entityDts.DCheckSinglePrice);
                            sql += ",DZFlag=1";
                            sql += ",DZOPID=" + SysString.ToDBString(entity.SaleOPID);
                            sql += ",DZTime=GetDate()";
                            sql += ",DZNo=" + SysString.ToDBString(entity.FormNo);
                            sql += " WHERE ID=" + SysString.ToDBString(entityIOF.ID);
                            sqlTrans.ExecuteNonQuery(sql);
                        }
                        else//撤销提交
                        {
                            //if (entityIOF.InvoiceQty != 0 && entityIOF.Qty == entityDts.DCheckQty)
                            //{
                            //    throw new Exception("不能操作,数据已有开票数据 ID:" + entityDts.DLOADDtsID + " " + entityIOF.ItemCode + " " + entityIOF.ColorNum);
                            //}

                            sql  = "UPDATE WH_IOForm SET DZQty=ISNULL(DZQty,0)-(" + SysString.ToDBString(entityDts.DCheckQty) + ")";
                            sql += ",DZAmount=ISNULL(DZAmount,0)-(" + SysString.ToDBString(entityDts.DCheckAmount) + ")";
                            sql += ",DZSinglePrice=NULL";
                            if (entityIOF.DZQty == entityDts.DCheckQty)
                            {
                                sql += ",DZFlag=0";
                            }
                            sql += ",DZOPID=''";
                            sql += ",DZTime=NULL";
                            sql += ",DZNo=''";
                            sql += " WHERE ID=" + SysString.ToDBString(entityIOF.ID);
                            sqlTrans.ExecuteNonQuery(sql);
                        }
                    }
                }
            }
        }
Exemplo n.º 21
0
 /// <summary>
 /// 检查将要操作的数据是否符合业务规则
 /// </summary>
 /// <param name="p_BE"></param>
 private void CheckCorrect(BaseEntity p_BE)
 {
     CheckOperation entity = (CheckOperation)p_BE;
 }
Exemplo n.º 22
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int AddNew(BaseEntity p_Entity)
        {
            try
            {
                CheckOperation MasterEntity = (CheckOperation)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //新增主表数据
                StringBuilder MasterField = new StringBuilder();
                StringBuilder MasterValue = new StringBuilder();
                MasterField.Append("INSERT INTO Finance_CheckOperation(");
                MasterValue.Append(" VALUES(");
                MasterField.Append("ID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ID) + ",");
                MasterField.Append("CompanyTypeID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.CompanyTypeID) + ",");
                MasterField.Append("FormNo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.FormNo) + ",");
                MasterField.Append("OrderCode" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.OrderCode) + ",");
                MasterField.Append("MakeOPID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.MakeOPID) + ",");
                MasterField.Append("MakeOPName" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.MakeOPName) + ",");
                MasterField.Append("MakeDate" + ",");
                if (MasterEntity.MakeDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.MakeDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("CheckOPID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.CheckOPID) + ",");
                MasterField.Append("CheckDate" + ",");
                if (MasterEntity.CheckDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.CheckDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("SubmitFlag" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.SubmitFlag) + ",");
                MasterField.Append("DelFlag" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DelFlag) + ",");
                MasterField.Append("VendorID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.VendorID) + ",");
                MasterField.Append("FormDate" + ",");
                if (MasterEntity.FormDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.FormDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("Remark" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Remark) + ",");
                MasterField.Append("DVendorCon" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DVendorCon) + ",");
                MasterField.Append("SaleOPID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.SaleOPID) + ",");
                MasterField.Append("TotalAmount" + ",");
                if (MasterEntity.TotalAmount != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.TotalAmount) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("TotalCheckAmount" + ",");
                if (MasterEntity.TotalCheckAmount != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.TotalCheckAmount) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("DZTypeID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DZTypeID) + ",");
                MasterField.Append("CheckMethodTypeID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.CheckMethodTypeID) + ",");
                MasterField.Append("PreInvoiceAmount" + ",");
                if (MasterEntity.PreInvoiceAmount != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.PreInvoiceAmount) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("PreInvoiceQty" + ",");
                if (MasterEntity.PreInvoiceQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.PreInvoiceQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("PreExAmount" + ",");
                if (MasterEntity.PreExAmount != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.PreExAmount) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("ThisInvoiceAmount" + ",");
                if (MasterEntity.ThisInvoiceAmount != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.ThisInvoiceAmount) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("ThisInvoiceQty" + ",");
                if (MasterEntity.ThisInvoiceQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.ThisInvoiceQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("ThisExAmount" + ",");
                if (MasterEntity.ThisExAmount != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.ThisExAmount) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("TotalQty" + ",");
                if (MasterEntity.TotalQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.TotalQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("InvoiceApplyNo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.InvoiceApplyNo) + ",");
                MasterField.Append("MergeFlage" + ")");
                MasterValue.Append(SysString.ToDBString(MasterEntity.MergeFlage) + ")");



                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString());
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString());
                }
                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBInsert), E);
            }
        }
Exemplo n.º 23
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Update(BaseEntity p_Entity)
        {
            try
            {
                CheckOperation MasterEntity = (CheckOperation)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //更新主表数据
                StringBuilder UpdateBuilder = new StringBuilder();
                UpdateBuilder.Append("UPDATE Finance_CheckOperation SET ");
                UpdateBuilder.Append(" ID=" + SysString.ToDBString(MasterEntity.ID) + ",");
                UpdateBuilder.Append(" CompanyTypeID=" + SysString.ToDBString(MasterEntity.CompanyTypeID) + ",");
                UpdateBuilder.Append(" FormNo=" + SysString.ToDBString(MasterEntity.FormNo) + ",");
                UpdateBuilder.Append(" OrderCode=" + SysString.ToDBString(MasterEntity.OrderCode) + ",");
                UpdateBuilder.Append(" MakeOPID=" + SysString.ToDBString(MasterEntity.MakeOPID) + ",");
                UpdateBuilder.Append(" MakeOPName=" + SysString.ToDBString(MasterEntity.MakeOPName) + ",");

                if (MasterEntity.MakeDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    UpdateBuilder.Append(" MakeDate=" + SysString.ToDBString(MasterEntity.MakeDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" MakeDate=null,");
                }

                UpdateBuilder.Append(" CheckOPID=" + SysString.ToDBString(MasterEntity.CheckOPID) + ",");

                if (MasterEntity.CheckDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    UpdateBuilder.Append(" CheckDate=" + SysString.ToDBString(MasterEntity.CheckDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" CheckDate=null,");
                }

                UpdateBuilder.Append(" SubmitFlag=" + SysString.ToDBString(MasterEntity.SubmitFlag) + ",");
                UpdateBuilder.Append(" DelFlag=" + SysString.ToDBString(MasterEntity.DelFlag) + ",");
                UpdateBuilder.Append(" VendorID=" + SysString.ToDBString(MasterEntity.VendorID) + ",");

                if (MasterEntity.FormDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    UpdateBuilder.Append(" FormDate=" + SysString.ToDBString(MasterEntity.FormDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" FormDate=null,");
                }

                UpdateBuilder.Append(" Remark=" + SysString.ToDBString(MasterEntity.Remark) + ",");
                UpdateBuilder.Append(" DVendorCon=" + SysString.ToDBString(MasterEntity.DVendorCon) + ",");
                UpdateBuilder.Append(" SaleOPID=" + SysString.ToDBString(MasterEntity.SaleOPID) + ",");

                if (MasterEntity.TotalAmount != 0)
                {
                    UpdateBuilder.Append(" TotalAmount=" + SysString.ToDBString(MasterEntity.TotalAmount) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" TotalAmount=null,");
                }


                if (MasterEntity.TotalCheckAmount != 0)
                {
                    UpdateBuilder.Append(" TotalCheckAmount=" + SysString.ToDBString(MasterEntity.TotalCheckAmount) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" TotalCheckAmount=null,");
                }

                UpdateBuilder.Append(" DZTypeID=" + SysString.ToDBString(MasterEntity.DZTypeID) + ",");
                UpdateBuilder.Append(" CheckMethodTypeID=" + SysString.ToDBString(MasterEntity.CheckMethodTypeID) + ",");

                if (MasterEntity.PreInvoiceAmount != 0)
                {
                    UpdateBuilder.Append(" PreInvoiceAmount=" + SysString.ToDBString(MasterEntity.PreInvoiceAmount) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" PreInvoiceAmount=null,");
                }


                if (MasterEntity.PreInvoiceQty != 0)
                {
                    UpdateBuilder.Append(" PreInvoiceQty=" + SysString.ToDBString(MasterEntity.PreInvoiceQty) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" PreInvoiceQty=null,");
                }


                if (MasterEntity.PreExAmount != 0)
                {
                    UpdateBuilder.Append(" PreExAmount=" + SysString.ToDBString(MasterEntity.PreExAmount) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" PreExAmount=null,");
                }


                if (MasterEntity.ThisInvoiceAmount != 0)
                {
                    UpdateBuilder.Append(" ThisInvoiceAmount=" + SysString.ToDBString(MasterEntity.ThisInvoiceAmount) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" ThisInvoiceAmount=null,");
                }


                if (MasterEntity.ThisInvoiceQty != 0)
                {
                    UpdateBuilder.Append(" ThisInvoiceQty=" + SysString.ToDBString(MasterEntity.ThisInvoiceQty) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" ThisInvoiceQty=null,");
                }


                if (MasterEntity.ThisExAmount != 0)
                {
                    UpdateBuilder.Append(" ThisExAmount=" + SysString.ToDBString(MasterEntity.ThisExAmount) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" ThisExAmount=null,");
                }


                if (MasterEntity.TotalQty != 0)
                {
                    UpdateBuilder.Append(" TotalQty=" + SysString.ToDBString(MasterEntity.TotalQty) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" TotalQty=null,");
                }

                UpdateBuilder.Append(" InvoiceApplyNo=" + SysString.ToDBString(MasterEntity.InvoiceApplyNo) + ",");
                UpdateBuilder.Append(" MergeFlage=" + SysString.ToDBString(MasterEntity.MergeFlage));

                UpdateBuilder.Append(" WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID));



                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(UpdateBuilder.ToString());
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(UpdateBuilder.ToString());
                }
                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBUpdate), E);
            }
        }