Пример #1
0
 /// <summary>
 /// 提交盘点结果
 /// </summary>
 /// <param name="stNo">盘点单号</param>
 /// <param name="StockTakeDetails">由多个<HuId,Bin>组成的数组</param>
 public void DoStockTake(string stNo, string[][] stockTakeDetails)
 {
     //StockTakeMaster stockTakeMaster = this.GetStockTake(stNo);
     IList<Entity.INV.StockTakeDetail> StockTakeDetailList = new List<Entity.INV.StockTakeDetail>();
     IList<string> huIds = new List<string>();
     IList<Entity.VIEW.HuStatus> huStatuses = new List<Entity.VIEW.HuStatus>();
     foreach (var item in stockTakeDetails)
     {
         huIds.Add(item[0]);
         //Entity.VIEW.HuStatus huStatus = huMgr.GetHuStatus(item[0]);
         //Entity.INV.StockTakeDetail stockTakeDetail = new Entity.INV.StockTakeDetail
         //    { 
         //      HuId = item[0], Bin = item[1], Location = item[2], 
         //      StNo = stNo,
         //      QualityType = huStatus.QualityType,
         //      Item = huStatus.Item,
         //      ItemDescription = huStatus.ItemDescription,
         //      Qty = huStatus.Qty,
         //      BaseUom = huStatus.BaseUom,
         //      Uom = huStatus.Uom,
         //      UnitQty = huStatus.UnitQty,
         //      LotNo = huStatus.LotNo
         //    };
         //StockTakeDetailList.Add(stockTakeDetail);
     }
     huStatuses = huMgr.GetHuStatus(huIds);
     for (int i = 0; i < stockTakeDetails.Length; ++i)
     {
         Entity.VIEW.HuStatus huStatus = huStatuses.Single(h => h.HuId == stockTakeDetails[i][0]);
         Entity.INV.StockTakeDetail stockTakeDetail = new Entity.INV.StockTakeDetail
             {
                 HuId = stockTakeDetails[i][0],
                 Bin = stockTakeDetails[i][1],
                 Location = stockTakeDetails[i][2],
                 StNo = stNo,
                 QualityType = huStatus.QualityType,
                 Item = huStatus.Item,
                 ItemDescription = huStatus.ItemDescription,
                 Qty = huStatus.Qty,
                 BaseUom = huStatus.BaseUom,
                 Uom = huStatus.Uom,
                 UnitQty = huStatus.UnitQty,
                 LotNo = huStatus.LotNo
             };
         StockTakeDetailList.Add(stockTakeDetail);
     }
     stockTakeMgr.RecordStockTakeDetail(stNo, StockTakeDetailList);
 }
Пример #2
0
        public void DoStockTake(string stNo, string[][] stockTakeDetails)
        {
            IList<Entity.INV.StockTakeDetail> StockTakeDetailList = new List<Entity.INV.StockTakeDetail>();
            stockTakeDetails = stockTakeDetails.Where(p => !string.IsNullOrWhiteSpace(p[0])).ToArray();
            var huIds = stockTakeDetails.Select(p => p[0]).Distinct().ToList();
            var huStatuses = huMgr.GetHuStatus(huIds).ToDictionary(d => d.HuId, d => d);

            foreach (var detail in stockTakeDetails)
            {
                Entity.VIEW.HuStatus huStatus = huStatuses.ValueOrDefault(detail[0]);
                Entity.INV.StockTakeDetail stockTakeDetail = new Entity.INV.StockTakeDetail
                {
                    HuId = detail[0],
                    Bin = detail[1],
                    Location = detail[2],
                    StNo = stNo,
                    QualityType = huStatus.QualityType,
                    Item = huStatus.Item,
                    ItemDescription = huStatus.ItemDescription,
                    Qty = huStatus.Qty,
                    BaseUom = huStatus.BaseUom,
                    Uom = huStatus.Uom,
                    UnitQty = huStatus.UnitQty,
                    LotNo = huStatus.LotNo,
                    IsCS = huStatus.IsConsignment
                };
                StockTakeDetailList.Add(stockTakeDetail);
            }
            stockTakeMgr.RecordStockTakeDetail(stNo, StockTakeDetailList);
        }