Exemple #1
0
 /// <summary>
 /// 生成流水信息,并更新付款单的最新流水信息号
 /// </summary>
 public void GenerateFlowOrders()
 {
     try
     {
         #region 生成流水信息
         T_Pay_Info_DetailsEntity payDetailsEntity = new T_Pay_Info_DetailsEntity()
         {
             Amount                    = this.operationAmount,
             Createtime                = DateTime.Now,
             PayInfoDetailsCode        = CodeNumber,
             Details_Name              = EnumHelper.ToDescription(PayDetailsTypeEnum.Consumption),
             Details_Type              = (int)PayDetailsTypeEnum.Consumption,
             EcommerceGroupID          = inputPayEntity.EcommerceGroupID,
             EcommerceGroupName        = this.EcommerceProjectMoneyCapacity.EcommerceGroupName,
             Electricity_Supplier_Code = inputPayEntity.Electricity_Supplier_Code,
             Electricity_Supplier_Id   = inputPayEntity.EcommerceID,
             Electricity_Supplier_Name = inputPayEntity.Electricity_Supplier_Name,
             Pay_Info_Code             = inputPayEntity.Pay_Info_Code,
             Pay_Info_Details_ID       = Guid.NewGuid().ToString(),
             Pay_Info_ID               = inputPayEntity.Pay_Info_Id,
             Project_Code              = inputPayEntity.Project_Code,
             Project_ID                = inputPayEntity.Project_Id,
             Project_Name              = inputPayEntity.Project_Name,
         };
         Transdb.Insert(payDetailsEntity);
         inputPayEntity.LastPayInfoDetailsCode = CodeNumber;
         Transdb.Update(inputPayEntity);
         #endregion
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Exemple #2
0
 /// <summary>
 /// 生成记账流水信息
 /// </summary>
 public void NoteFlowInformation()
 {
     #region 生成记账流水信息
     var dateNow = DateTime.Now;
     T_PartnerCapitalPoolEntity payDetailsEntity = new T_PartnerCapitalPoolEntity()
     {
         PartnerCapitalPoolID       = Guid.NewGuid().ToString(),
         EcommerceProjectRelationID = EcommerceProjectMoneyCapacity.EcommerceProjectRelationID,
         T_P_PartnerCapitalPoolID   = "0",
         OperationTitle             = "【" + inputPayEntity.Pay_Info_Code + "】消费支出",
         OperationType   = (int)OperationTypeNoteEnum.PayConsumption,
         OperationMoney  = this.operationAmount,
         CurrentMoney    = EcommerceProjectMoneyCapacity.ControlTotalAmount + this.operationAmount,             // CurrentBalance
         AccountingType  = (int)AccountingTypeEnum.Expenditure,
         CurrentBalance  = EcommerceProjectMoneyCapacity.ControlTotalAmount,
         DeleteMark      = 0,
         CreateDate      = dateNow,
         ModifyDate      = dateNow,
         CreateUserId    = "System",
         CreateUserName  = "******",
         ObjectID        = inputPayEntity.Pay_Info_Id,
         StatisticalDate = dateNow
     };
     Transdb.Insert(payDetailsEntity);
     #endregion
 }
Exemple #3
0
        public void Execute()
        {
            string errMsg = string.Empty;

            try
            {
                if (!Check(out errMsg))
                {
                    // 只要这里有错误 必须还原到原来的状态,英文前面已经更新过
                    if (this.existingPayEntity != null)
                    {
                        new RepositoryFactory().BaseRepository().Update(this.existingPayEntity);
                    }
                    else
                    {
                        new RepositoryFactory().BaseRepository().Delete(this.inputPayEntity);
                    }
                    throw new Exception(errMsg);
                }
                AdjustTheFundsPool();
                GenerateFlowOrders();

                Transdb.Commit();
            }
            catch (Exception ex)
            {
                Transdb.Rollback();
                throw new Exception(ex.Message);
            }
        }
Exemple #4
0
 public void Execute()
 {
     try
     {
         AdjustTheFundsPool();
         GenerateFlowOrders();
         NoteFlowInformation();
         Transdb.Commit();
     }
     catch (Exception ex)
     {
         Transdb.Rollback();
         throw new Exception(ex.Message);
     }
 }
Exemple #5
0
 /// <summary>
 /// 调整资金池
 /// </summary>
 public void AdjustTheFundsPool()
 {
     try
     {
         #region 调整资金池金额
         //1、减去可用的资金池
         EcommerceProjectMoneyCapacity.ActualControlTotalAmount = EcommerceProjectMoneyCapacity.ActualControlTotalAmount - this.operationAmount;
         //2、加上占用金额
         EcommerceProjectMoneyCapacity.FlowNopayTotalAmount = EcommerceProjectMoneyCapacity.FlowNopayTotalAmount + this.operationAmount;
         Transdb.Update(EcommerceProjectMoneyCapacity);
         #endregion
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Exemple #6
0
        /// <summary>
        /// 调整资金池
        /// </summary>
        public void AdjustTheFundsPool()
        {
            string errMsg = string.Empty;

            try
            {
                if (!Check(out errMsg))
                {
                    // 只要这里有错误 必须还原到原来的状态,英文前面已经更新过
                    if (this.existingPayEntity != null)
                    {
                        new RepositoryFactory().BaseRepository().Update(this.existingPayEntity);
                    }
                    else
                    {
                        new RepositoryFactory().BaseRepository().Delete(this.inputPayEntity);
                    }
                    throw new Exception(errMsg);
                }
                #region 调整资金池金额

                //1、减去占用金额
                EcommerceProjectMoneyCapacity.FlowNopayTotalAmount = EcommerceProjectMoneyCapacity.FlowNopayTotalAmount - this.operationAmount;
                //2、总资金池扣掉
                EcommerceProjectMoneyCapacity.ControlTotalAmount = EcommerceProjectMoneyCapacity.ControlTotalAmount - this.operationAmount;
                Transdb.Update(EcommerceProjectMoneyCapacity);
                #endregion
            }
            catch (Exception ex)
            {
                // 只要这里有错误 必须还原到原来的状态,英文前面已经更新过
                if (this.existingPayEntity != null)
                {
                    new RepositoryFactory().BaseRepository().Update(this.existingPayEntity);
                }
                else
                {
                    new RepositoryFactory().BaseRepository().Delete(this.inputPayEntity);
                }
                throw new Exception(ex.Message);
            }
        }
Exemple #7
0
        public void Execute()
        {
            string errMsg = string.Empty;

            try
            {
                if (!Check(out errMsg))
                {
                    // 只要这里有错误 必须还原到原来的状态,英文前面已经更新过
                    if (this.existingPayEntity != null)
                    {
                        new RepositoryFactory().BaseRepository().Update(this.existingPayEntity);
                    }
                    else
                    {
                        ////如果是第一次调用占用接口 失败了,应该把刚插入的付款单数据删除了
                        ////判断是不是有过流水记录
                        //if (lastPayInfoDetailsEntity == null)
                        //{
                        new RepositoryFactory().BaseRepository().Delete(this.inputPayEntity);
                        // }
                    }
                    throw new Exception(errMsg);
                }
                //特殊情况判断,因为共享平台会重复调用占用接口,判断最后一条流水是占用状态,且金相同时不用生成流水或调整金额
                if (lastPayInfoDetailsEntity == null || !(lastPayInfoDetailsEntity.Details_Type == (int)PayDetailsTypeEnum.Lock && lastPayInfoDetailsEntity.Amount == operationAmount))
                {
                    AdjustTheFundsPool();
                    GenerateFlowOrders();
                }


                Transdb.Commit();
            }
            catch (Exception ex)
            {
                Transdb.Rollback();
                throw new Exception(ex.Message);
            }
        }