コード例 #1
0
ファイル: BillStoringVM.cs プロジェクト: almutama/fashionDRP
 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);
             }
         }
     }
 }
コード例 #2
0
        public BillStoringWhenReceivingVMBase(BillWithBrand bill)
            : base()
        {
            GridDataItems.Clear();
#if UniqueCode
            var ssdetails = BillStoringCannibalizeVM.GetSnapshotDetails(bill.Code);
#endif
            var data = this.GetBillReceiveDetails(bill.ID);
            foreach (var o in data)
            {
#if UniqueCode
                var temp = ssdetails.Where(u => u.ProductID == o.ProductID);
                foreach (var t in temp)
                {
                    o.UniqueCodes.Add(t.UniqueCode);
                }
#endif
                GridDataItems.Add(o);
            }
        }
コード例 #3
0
 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);
             }
         }
     }
 }
コード例 #4
0
        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("没有相关成品信息.");
            }
        }