Exemple #1
0
        protected override void ProcessReferencePayableInfoForCreate(PayItemInfo entity)
        {
            int currencySysNo = 1;

            if (ReferencePayableInfo != null)
            {
                //如果该付款单对应的应付款已经Abandon,那么此时需要重新激活该应付款并将其更新
                if (ReferencePayableInfo.PayStatus == PayableStatus.Abandon)
                {
                    ReferencePayableInfo.OrderAmt  = entity.PayAmt;
                    ReferencePayableInfo.PayStatus = PayableStatus.UnPay;
                    ReferencePayableInfo.EIMSNo    = null;

                    PayableBizProcessor.UpdateStatusAndOrderAmt(ReferencePayableInfo);

                    //计算ETP
                    ReferencePayableInfo.EstimatedTimeOfPay = ETPCalculatorHelper.GetETPByPayPeriod(new PayableInfo
                    {
                        OrderType  = PayableOrderType.CollectionPayment,
                        OrderSysNo = entity.OrderSysNo.Value
                    }, DateTime.Now);
                    PayableBizProcessor.UpdatePayableEGPAndETP(ReferencePayableInfo);

                    entity.PaySysNo      = ReferencePayableInfo.SysNo.Value;
                    entity.CurrencySysNo = currencySysNo;
                    entity.OrderType     = ReferencePayableInfo.OrderType;
                    entity.OrderSysNo    = ReferencePayableInfo.OrderSysNo;
                }

                if (ReferencePayableInfo.PayStatus == PayableStatus.UnPay)
                {
                    //计算ETP
                    ReferencePayableInfo.EstimatedTimeOfPay = ETPCalculatorHelper.GetETPByPayPeriod(new PayableInfo
                    {
                        OrderType  = PayableOrderType.CollectionPayment,
                        OrderSysNo = entity.OrderSysNo.Value
                    }, DateTime.Now);
                    PayableBizProcessor.UpdatePayableETP(ReferencePayableInfo);

                    entity.PaySysNo      = ReferencePayableInfo.SysNo.Value;
                    entity.CurrencySysNo = currencySysNo;
                    entity.OrderType     = ReferencePayableInfo.OrderType;
                    entity.OrderSysNo    = ReferencePayableInfo.OrderSysNo;
                }
            }
            else
            {
                ReferencePayableInfo                   = new PayableInfo();
                ReferencePayableInfo.OrderSysNo        = entity.OrderSysNo.Value;
                ReferencePayableInfo.OrderType         = entity.OrderType.Value;
                ReferencePayableInfo.AlreadyPayAmt     = 0M;
                ReferencePayableInfo.OrderAmt          = entity.PayAmt;
                ReferencePayableInfo.CurrencySysNo     = currencySysNo;
                ReferencePayableInfo.PayStatus         = PayableStatus.UnPay;
                ReferencePayableInfo.InvoiceStatus     = PayableInvoiceStatus.Absent;
                ReferencePayableInfo.AuditStatus       = PayableAuditStatus.NotAudit;
                ReferencePayableInfo.InvoiceFactStatus = PayableInvoiceFactStatus.Corrent;
                ReferencePayableInfo.InStockAmt        = 0M;
                ReferencePayableInfo.Note              = "Auto created CollectionPaymentPayItem!";
                ReferencePayableInfo.CompanyCode       = entity.CompanyCode;

                //计算ETP
                ReferencePayableInfo.EstimatedTimeOfPay = ETPCalculatorHelper.GetETPByPayPeriod(new PayableInfo
                {
                    OrderType  = PayableOrderType.CollectionPayment,
                    OrderSysNo = entity.OrderSysNo.Value
                }, DateTime.Now);
                ReferencePayableInfo.EIMSNo = null;
                ReferencePayableInfo        = PayableBizProcessor.Create(ReferencePayableInfo);

                entity.PaySysNo      = ReferencePayableInfo.SysNo.Value;
                entity.CurrencySysNo = currencySysNo;
                entity.OrderType     = ReferencePayableInfo.OrderType;
                entity.OrderSysNo    = ReferencePayableInfo.OrderSysNo;
            }
        }