예제 #1
0
        private void updateTagData(TagReadData tag)
        {
            string EBdData = tag.EPCString;
            int    isMem   = EBdData.IndexOf("A");

            if (isMem == 0)
            {
                if (EBdData.Length != 8)
                {
                    return;
                }
                curEPC = EBdData;

                meb        = InStock.getMemDetailByID(EBdData.Replace("A", ""));
                meb.EPCStr = EBdData;
                if (ID_Text.InvokeRequired)
                {
                    Action <string> IDDel = (x) =>
                    {
                        ID_Text.Text = x.ToString();
                    };
                    ID_Text.Invoke(IDDel, meb.name);
                }
                else
                {
                    ID_Text.Text = meb.ID;
                }
                tagList.Add(new tagInfo(tag));
            }
            else if (EBdData.IndexOf("B") == 0)
            {
                byte[]     TIDByte = tag.EbdData;
                string     TIDStr  = ByteArrayToHexString(TIDByte);
                goodDetail good    = InStock.getDetailByID(TIDStr);
                if (good == null)
                {
                    tagList.Add(new tagInfo(tag));
                    return;
                }
                if (InStock.isSold(TIDStr) == 0)
                {
                    InStock.refreshRFIDInfo(TIDStr, good.ID, 1);
                    goodsDetailList.Add(good);
                    if (details_Num.ContainsKey(good.name))
                    {
                        ArrayList temp = details_Num[good.name];
                        temp[1] = (int)temp[1] + 1;
                        temp[0] = (double)temp[0] + good.cost;
                    }
                    else
                    {
                        ArrayList temp = new ArrayList();
                        temp.Add(good.cost);
                        temp.Add(1);
                        details_Num.Add(good.name, temp);
                    }
                    tagList.Add(new tagInfo(tag));
                }
            }
        }
예제 #2
0
        public void OrderListNullTest()
        {
            InStock i         = new InStock(1, 2, "cofee", 3, 4, 5, 6, "", DateTime.Now);
            Boolean exception = false;

            try
            {
                i.ProductName.Equals(null);

                i.UnitPrice.Equals(null);
                i.SalePrice.Equals(null);
                i.TriggerLevel.Equals(null);
                i.Vendor.Equals(null);
                i.ExpiryDate.Equals(null);
            }
            catch (ArgumentException ex)
            {
                exception = true;
                Assert.Fail("Shoud not be null");
            }



            Assert.AreEqual(exception, false);
        }
예제 #3
0
        private void refreshDataView() // binding source change
        {
            consumeNum = 0;
            foreach (var detail in details_Num)
            {
                ArrayList goodNum = detail.Value;
                goodInfo  temp    = new goodInfo(detail.Key, Convert.ToDouble(goodNum[0]), (int)goodNum[1]);
                consumeNum += temp.tPrice;
                goodsList.Add(temp);
                //BindingList<goodInfo> temp =

                if (Items_Details.InvokeRequired)
                {
                    Action listDel = () =>
                    {
                        bs.DataSource = new BindingList <goodInfo>(goodsList);
                        Items_Details.Refresh();
                    };
                    Items_Details.Invoke(listDel);
                }
                else
                {
                    bs.DataSource = new BindingList <goodInfo>(goodsList);
                    Items_Details.Refresh();
                }
                if (Cost_Text.InvokeRequired)
                {
                    Action <string> CostDel = (x) => {
                        Cost_Text.Text = x.ToString();
                    };
                    Cost_Text.Invoke(CostDel, consumeNum.ToString());
                }
                else
                {
                    Cost_Text.Text = consumeNum.ToString();
                }
            }
            double bal = meb.balance - consumeNum;

            if (bal < 0)
            {
                MessageBox.Show("余额不足");
                return;
            }
            if (billNumber == "")
            {
                billNumber = InStock.getSoldBillNumber();
                billNumber = BillHelper.getNextBillNumber(billNumber);
            }
            foreach (goodDetail goodTemp in goodsDetailList)
            {
                ArrayList detail = details_Num[goodTemp.name];
                InStock.updateMemCostDetail(new costInfo(meb.ID, goodTemp.ID, DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString(), billNumber, Convert.ToInt32(detail[1]), Convert.ToDouble(detail[0]) / Convert.ToInt32(detail[1]), Convert.ToDouble(detail[0])));
            }
            InStock.updateMemBalance(meb.ID, bal);
            //setUserData(bal.ToString());
        }
예제 #4
0
 public string[] ToStringArray()
 {
     string[] s = { PartID.ToString(),
                    Name,
                    Price.ToString(),
                    InStock.ToString(),
                    Min.ToString(),
                    Max.ToString() };
     return(s);
 }
예제 #5
0
파일: Product.cs 프로젝트: Landy-man/Intro
 /**********************Methods*************************/
 /****************Constructur********************/
 public Product(string name, string type, int inventoryID, int location, InStock inStock, int stockCount, double price, int minToOrder)
 {
     this.name        = name;
     this.inventoryID = inventoryID;
     this.location    = location;
     this.inStock     = inStock;
     this.price       = price;
     this.type        = (Type)Enum.Parse(typeof(Type), type);
     this.stockCount  = stockCount;
     this.whenToOrder = minToOrder;
 }
예제 #6
0
        public void AddStockInInventory2(Inventory stock)
        {
            PartWithWeight partWithWeight;

            InStock inStock = new InStock();

            partWithWeight = new PartWithWeight("Fasto Cap", "", 4.5f);
            inStock.Add(partWithWeight);

            StoreInventory.AddToInventory(inStock);
        }
예제 #7
0
 public static void isinStock(string abc)
 {
     try
     {
         InStock tmp = (InStock)Enum.Parse(typeof(InStock), abc);
     }
     catch (ArgumentException)
     {
         throw new Exception("The in stock You Entered Doesnt exist.");
     }
 }
예제 #8
0
        //从采购单入库
        public void CreateInStock(IList <PurchaseViewModel> models, string temp_instockNumber)
        {
            if (models != null && models.Count > 0)
            {
                IList <InStock> listOfInStocks   = new List <InStock>();
                PurchaseHeader  purchaseHeader   = _purchaseHeaderRepository.GetPurchaseHeader(models.FirstOrDefault()?.PurchaseNumber);
                InStockHeader   newInStockHeader = _mapper.Map <InStockHeader>(purchaseHeader);
                int             lastSerialNumber = _inStockHeaderRepository.GetLatestSerialNumber(DateTime.Now);
                newInStockHeader.SerialNo      = ++lastSerialNumber;
                newInStockHeader.InStockNumber = string.IsNullOrEmpty(temp_instockNumber) ? ServiceHelper.GenerateCodeNumber("RK", newInStockHeader.SerialNo) : temp_instockNumber;


                try
                {
                    _inStockHeaderRepository.Add(newInStockHeader);

                    foreach (PurchaseViewModel model in models)
                    {
                        InStock newInstock = _mapper.Map <InStock>(model);
                        newInstock.Total         = (model.PurchaseTotal - model.AlreadyInStock) >= model.ReadyForInStock ? model.ReadyForInStock : model.PurchaseTotal - model.AlreadyInStock;
                        newInstock.Type          = purchaseHeader.RequestCategory;
                        newInstock.InStockNumber = newInStockHeader.InStockNumber;
                        newInstock.Status        = ProcessStatusEnum.采购入库;
                        newInstock.PositionName  = "Stage";
                        if (newInstock.Total <= 0)
                        {
                            continue;
                        }

                        listOfInStocks.Add(newInstock);

                        if (newInstock.Total + model.AlreadyInStock == model.PurchaseTotal)
                        {
                            _purchaseService.UpdatePurchaseProcessStatus(model.PurchaseId, ProcessStatusEnum.采购入库);
                        }
                        else
                        {
                            _purchaseService.UpdatePurchaseProcessStatus(model.PurchaseId, ProcessStatusEnum.采购中);
                        }
                        _managementService.UpdateStorage(model.Code, model.Position, newInstock.Total, newInstock.InStockNumber);
                        _managementService.UpdateItemPrice(model.ItemId, model.Price);
                    }
                    if (listOfInStocks.Count > 0)
                    {
                        _inStockRepository.AddRange(listOfInStocks);
                        _inStockHeaderRepository.Save();
                        _inStockRepository.Save();
                    }
                }
                catch (DbUpdateException)
                {
                }
            }
        }
예제 #9
0
파일: Product.cs 프로젝트: Landy-man/Intro
 /*Copy Constractor*/
 public Product(Product p)
 {
     this.name        = p.Name;
     this.inventoryID = p.InventoryID;
     this.location    = p.Location;
     this.inStock     = p.INStock;
     this.price       = p.Price;
     this.type        = p.Type;
     this.stockCount  = p.StockCount;
     this.whenToOrder = p.WhenToOrder;
 }
예제 #10
0
        public void AddInStock(InStock stock)
        {
            PartInWeight tempWeight = new PartInWeight();

            tempWeight.Name   = "Fasto Cap";
            tempWeight.Weight = 100.0f;
            //tempWeight.Parts.Add(new PartWithWeight("Fasto Cap", "Fasto's pen cap", 1.0f));
            //tempWeight.Parts.Add(new PartWithWeight("Fasto Barrel", "Fasto's pen Barrel", 1.0f));
            stock.Add(tempWeight);

            PartInCount tempCount = new PartInCount();

            tempCount.Name  = "Fasto Refill";
            tempCount.Count = 100;
            //tempCount.Parts.Add(new PartWithWeight("Fasto Refill", "Fasto's pen refill", 1));
            stock.Add(tempCount);
        }
예제 #11
0
 //adding stock to the instock list any time a movie is returned
 public static void UpdateStockAdd(Movie yourMovie)
 {
     if (!InStock.Contains(yourMovie))
     {
         InStock.Add(yourMovie);
         yourMovie.Copies++;
     }
     else if (yourMovie.Copies == 0)
     {
         OutOfStock.Remove(yourMovie);
         yourMovie.Copies++;
     }
     else
     {
         yourMovie.Copies++;
     }
 }
예제 #12
0
        public void TestNameLongEnoughINstock()
        {
            InStock s    = new InStock(1, 2, "cofee", 3, 4, 5, 6, "", DateTime.Now);
            String  name = "M";

            try
            {
                for (int i = 2; i <= 50; i++)
                {
                    name += "a";
                    s.ProductName.Equals(name);
                }
            }
            catch (ArgumentException e)
            {
                Assert.Fail("Name(\"" + name + "\") should not throw ArgumentException");
            }
        }
예제 #13
0
 //removing stock from the instock list any time a loan is made
 public static void UpdateStockRemove(Movie yourMovie)
 {
     //if the list out of stock does not contain your movie then add it and take one copie away from stock
     if (!OutOfStock.Contains(yourMovie))
     {
         OutOfStock.Add(yourMovie);
         yourMovie.Copies--;
     }
     else if (yourMovie.Copies == 1) // once your copies is once remove the movie from instock and take a copie away
     {
         InStock.Remove(yourMovie);
         yourMovie.Copies--;
     }
     else //take a copy away any time a loan is added
     {
         yourMovie.Copies--;
     }
 }
예제 #14
0
        public void AddInStock(InStock stock)
        {
            PartInWeight tempWeight = new PartInWeight();

            tempWeight.Name   = "Fasto Cap";
            tempWeight.Weight = 100.0f;
            Console.WriteLine("Part coming in Weight: '{0}', Weight: '{1}'", tempWeight.Name, tempWeight.Weight);
            //tempWeight.Parts.Add(new PartWithWeight("Fasto Cap", "Fasto's pen cap", 1.0f));
            //tempWeight.Parts.Add(new PartWithWeight("Fasto Barrel", "Fasto's pen Barrel", 1.0f));
            stock.Add(tempWeight);

            PartInCount tempCount = new PartInCount();

            tempCount.Name  = "Fasto Refill";
            tempCount.Count = 100;
            Console.WriteLine("Part coming in Count: '{0}', Count: '{1}'", tempCount.Name, tempCount.Count);
            //tempCount.Parts.Add(new PartWithWeight("Fasto Refill", "Fasto's pen refill", 1));
            stock.Add(tempCount);
        }
예제 #15
0
        private void calculateField(MVStockCostDocumentItem o, String fieldName)
        {
            Type         typeBegin = BeginStock.GetType();
            PropertyInfo infoBegin = typeBegin.GetProperty(fieldName);
            double       beginAmt  = CUtil.StringToDouble((String)infoBegin.GetValue(BeginStock, null));

            Type         typeIn = InStock.GetType();
            PropertyInfo infoIn = typeIn.GetProperty(fieldName);
            double       inAmt  = CUtil.StringToDouble((String)infoIn.GetValue(InStock, null));

            Type         typeEnd = EndingStock.GetType();
            PropertyInfo infoEnd = typeEnd.GetProperty(fieldName);
            double       endAmt  = CUtil.StringToDouble((String)infoEnd.GetValue(EndingStock, null));

            double outAmt = beginAmt + inAmt - endAmt;

            Type         typeOut = o.GetType();
            PropertyInfo infoOut = typeOut.GetProperty(fieldName);

            infoOut.SetValue(o, outAmt.ToString());
        }
예제 #16
0
        /// <summary>
        /// Creates a string representation of the inventory details
        /// </summary>
        /// <returns>A string representation of the inventory details</returns>
        public override string ToString()
        {
            string result = "ProductId : " + _ProductId.ToString();

            if (!String.IsNullOrEmpty(_OptionList))
            {
                result += "\tOption List: " + _OptionList;
            }
            result += "\tInventory Mode : " + _InventoryMode.ToString();
            result += "\tIn Stock : " + InStock.ToString();
            result += "\tAllow Backorder : " + AllowBackorder.ToString();
            if (_ChildItemInventoryData != null)
            {
                result += "\r\nSub Items - " + _ChildItemInventoryData.Count + "\r\n";
                foreach (InventoryManagerData invD in _ChildItemInventoryData)
                {
                    result += invD.ToString();
                }
            }
            return(result + "\r\n");
        }
예제 #17
0
        public void AddStockInInventory(Inventory stock)
        {
            PartWithWeight partWithWeight;
            PartWithCount  partWithCount;

            InStock inStock = new InStock();

            partWithWeight = new PartWithWeight("Fasto Cap", "", 10.0f);
            inStock.Add(partWithWeight);

            partWithWeight = new PartWithWeight("Fasto Barrel", "", 15.0f);
            inStock.Add(partWithWeight);

            partWithWeight = new PartWithWeight("Gripper Cap", "", 5.0f);
            inStock.Add(partWithWeight);

            partWithCount = new PartWithCount("Fasto Refill", "", 1000);
            inStock.Add(partWithCount);
            Console.WriteLine("");
            StoreInventory.AddToInventory(inStock);
        }
        public List <ValidationResult> TryAddInStockFilter(int minInStock)
        {
            List <ValidationResult> Results = new List <ValidationResult>();

            if (CanAddNewInStock())
            {
                InStock           NewInStock        = new InStock(minInStock);
                ValidationContext ValidationContext = new ValidationContext(NewInStock);

                if (Validator.TryValidateObject(NewInStock, ValidationContext, Results, true))
                {
                    AddNewInStock(minInStock);
                    Results.Add(new ValidationResult("Successfully added new in stock filter."));
                }
            }
            else
            {
                Results.Add(new ValidationResult("Can't add in stock filter. There already is one."));
            }

            return(Results);
        }
예제 #19
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = Attributes != null?Attributes.GetHashCode() : 0;

                hashCode = (hashCode * 397) ^ (CatalogVisibility != null ? CatalogVisibility.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Categories != null ? Categories.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (ExternalUrl != null ? ExternalUrl.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ Featured.GetHashCode();
                hashCode = (hashCode * 397) ^ Id;
                hashCode = (hashCode * 397) ^ (Images != null ? Images.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ InStock.GetHashCode();
                hashCode = (hashCode * 397) ^ ManageStock.GetHashCode();
                hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ OnSale.GetHashCode();
                hashCode = (hashCode * 397) ^ ParentId;
                hashCode = (hashCode * 397) ^ (Permalink != null ? Permalink.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Price != null ? Price.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (PriceHtml != null ? PriceHtml.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ Purchasable.GetHashCode();
                hashCode = (hashCode * 397) ^ (RegularPrice != null ? RegularPrice.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (RelatedIds != null ? RelatedIds.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (SalePrice != null ? SalePrice.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (ShortDescription != null ? ShortDescription.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Sku != null ? Sku.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Slug != null ? Slug.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Status != null ? Status.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (StockQuantity != null ? StockQuantity.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Tags != null ? Tags.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (TaxClass != null ? TaxClass.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (TaxStatus != null ? TaxStatus.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ TotalSales;
                hashCode = (hashCode * 397) ^ (Type != null ? Type.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ Virtual.GetHashCode();
                return(hashCode);
            }
        }