/// <summary> /// 统计需调拨商品 /// </summary> /// <param name="pmId"></param> /// <param name="starttime"></param> /// <param name="endtime"></param> /// <param name="warehouseId"></param> /// <returns></returns> public IList <StorageRecordDetailInfo> GetAllocationGoodsList(Guid pmId, DateTime starttime, DateTime endtime, Guid warehouseId) { IList <StorageRecordDetailInfo> datasource = new List <StorageRecordDetailInfo>(); var orderNeedeGoods = _goodsOrderDetail.GetNeedPurchasingGoodses(warehouseId, pmId, starttime, endtime, new List <int> { (int)Enum.OrderState.RequirePurchase }); if (orderNeedeGoods.Count > 0) { // 获取商品的可用库存 Dictionary <Guid, int> stockQuantitys = WMSSao.GetLackQuantity(warehouseId, orderNeedeGoods.Select(ent => ent.RealGoodsId).Distinct()); List <NeedPurchasingGoods> details = GetList(orderNeedeGoods, stockQuantitys); if (details.Any()) { var goodsDics = _goodsCenterSao.GetDictRealGoodsUnitModel(details.Select(ent => ent.RealGoodsId).Distinct().ToList()); foreach (var dic in details.GroupBy(ent => ent.RealGoodsId)) { var goods = goodsDics != null && goodsDics.ContainsKey(dic.Key) ? goodsDics[dic.Key] : null; if (goods == null) { continue; } datasource.Add(new StorageRecordDetailInfo { GoodsCode = goods.GoodsCode, GoodsName = goods.PurchaseName, Specification = goods.Specification, Quantity = dic.Sum(ent => ent.Quantity) }); } } } return(datasource); }