Example #1
0
        /// <summary>
        /// 创建销售订单商品结算价
        /// </summary>
        /// <param name="orderInfo">关联的订单</param>
        /// <returns></returns>
        public IList <SaleOrderGoodsSettlementInfo> Create(SampleSaleOrderInfo orderInfo)
        {
            List <SaleOrderGoodsSettlementInfo> result = new List <SaleOrderGoodsSettlementInfo>();

            if (orderInfo == null || string.IsNullOrEmpty(orderInfo.TradeNo) || orderInfo.FilialeId == Guid.Empty || orderInfo.GoodsIds == null || orderInfo.GoodsIds.Count == 0)
            {
                return(result);
            }
            var settlementList = _realTimeGrossSettlementDal.GetLatestUnitPriceListBeforeSpecificTimeByMultiGoods(orderInfo.FilialeId, orderInfo.GoodsIds, orderInfo.OccurTime);

            result = orderInfo.GoodsIds.Select(m => new SaleOrderGoodsSettlementInfo
            {
                FilialeId        = orderInfo.FilialeId,
                GoodsId          = m,
                SettlementPrice  = settlementList.ContainsKey(m) ? settlementList[m] : 0,
                RelatedTradeNo   = orderInfo.TradeNo,
                RelatedTradeType = (int)orderInfo.TradeType,
                OccurTime        = orderInfo.OccurTime,
                CreateTime       = DateTime.Now
            }).ToList();
            return(result);
        }
 /// <summary>
 /// 在指定时间之前,按主商品列表获取最新即时结算价列表
 /// </summary>
 /// <param name="filialeId">公司ID</param>
 /// <param name="goodsId">主商品ID列表</param>
 /// <param name="specificTime">指定时间</param>
 /// <returns></returns>
 public IDictionary <Guid, decimal> GetLatestUnitPriceListBeforeSpecificTimeByMultiGoods(Guid filialeId, IEnumerable <Guid> goodsIds, DateTime specificTime)
 {
     return(_realTimeGrossSettlementDal.GetLatestUnitPriceListBeforeSpecificTimeByMultiGoods(filialeId, goodsIds, specificTime));
 }