示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="applyId"></param>
        /// <returns></returns>
        public IList <ApplyStockDetailInfo> FindDetailList(Guid applyId)
        {
            var infoList    = _applyStockDao.FindDetailList(applyId);
            var applyInfo   = _applyStockDao.FindById(applyId);
            var quantityDic = new Dictionary <Guid, int>();

            if (applyInfo != null)
            {
                quantityDic = WMSSao.GoodsEffitiveStockBySaleFilialeId(applyInfo.CompanyWarehouseId, null,
                                                                       infoList.GroupBy(ent => new { ent.GoodsId, ent.CompGoodsID }).ToDictionary(k => k.Key.GoodsId, v => v.Key.CompGoodsID), applyInfo.CompanyId);
                if (quantityDic == null)
                {
                    throw new ApplicationException("库存中心异常FindDetailList");
                }
            }
            foreach (var info in infoList)
            {
                info.GoodsStock = quantityDic.ContainsKey(info.GoodsId) ? quantityDic[info.GoodsId] : 0;
            }
            return(infoList);
        }