Esempio n. 1
0
 public override void AddRangeToItems(IEnumerable <DistributionProductShow> datas)
 {
     foreach (var data in datas)
     {
         if (data.Quantity > 0)
         {
             var item = GridDataItems.FirstOrDefault(o => o.ProductID == data.ProductID);
             if (item != null)
             {
                 item.Quantity += data.Quantity;
             }
             else
             {
                 GridDataItems.Add(data);
             }
         }
     }
 }
 public override void AddRangeToItems(IEnumerable <ProductForStoringWhenReceiving> datas)
 {
     foreach (var data in datas)
     {
         if (data.Quantity != 0)
         {
             var item = GridDataItems.FirstOrDefault(o => o.ProductID == data.ProductID);
             if (item != null)
             {
                 item.ReceiveQuantity += data.Quantity;
             }
             else
             {
                 data.ReceiveQuantity = data.Quantity;
                 data.Quantity        = 0;
                 GridDataItems.Add(data);
             }
         }
     }
 }
        public override void ProductCodeInput(string pcode, Action <IEnumerable <ProductForStoringWhenReceiving> > actionWhenMore)
        {
            if (GridDataItems.Count > 0)
            {
                if (TryReceiveProductOneByOne(pcode))
                {
                    return;
                }
            }
            var datas = this.GetProductForShow(pcode);

            if (datas != null && datas.Count > 0)
            {
                if (datas.Count == 1)
                {
                    var item = GridDataItems.FirstOrDefault(o => o.ProductID == datas[0].ProductID);
                    if (item != null)
                    {
                        item.ReceiveQuantity += 1;
                    }
                    else
                    {
                        datas[0].ReceiveQuantity = 1;
                        GridDataItems.Add(datas[0]);
                    }
                }
                else
                {
                    if (actionWhenMore != null)
                    {
                        actionWhenMore(datas);
                    }
                }
            }
            else
            {
                throw new Exception("没有相关成品信息.");
            }
        }