コード例 #1
0
        public virtual void CreateByVendor(PayableInfo entity)
        {
            if (!entity.EIMSAmt.HasValue)
            {
                entity.EIMSAmt = 0;
            }
            if (!entity.InStockAmt.HasValue)
            {
                entity.InStockAmt = 0;
            }

            //PO调整单
            if (entity.OrderType == PayableOrderType.POAdjust)
            {
                CreatePOAdjustByVendor(entity);
            }
            else if (entity.OrderType == PayableOrderType.PO)
            {
                #region CRL17366 代销采购单不生成付款单

                var poEntity = ExternalDomainBroker.GetPurchaseOrderInfo(entity.OrderSysNo.Value, entity.BatchNumber.Value);
                if (poEntity != null && poEntity.PurchaseOrderBasicInfo.ConsignFlag == PurchaseOrderConsignFlag.Consign)
                {
                    return;
                }

                #endregion CRL17366 代销采购单不生成付款单

                entity.EstimatedTimeOfPay = ETPCalculatorHelper.GetETPByPayPeriod(entity, DateTime.MinValue);

                //获取付款时间
                DateTime payTime = DateTime.MinValue;
                var      result  = ObjectFactory <PayItemProcessor> .Instance.GetListByCriteria(new PayItemInfo
                {
                    OrderSysNo = entity.OrderSysNo.Value,
                    OrderType  = entity.OrderType,
                    Status     = PayItemStatus.Paid
                });

                if (result.Count > 0 && result[0].PayTime.HasValue)
                {
                    payTime = result[0].PayTime.Value;
                }
                PrePayPOByVendor(entity);
            }
        }