Пример #1
0
        public void GetBagTypeById(Guid BagId)
        {
            BagTypeBLL bagType = bagTypeCache.GetItem(BagId.ToString());

            this.Id          = bagType.Id;
            this.BagTypeName = bagType.BagTypeName;
            this.Tare        = bagType.Tare;
            this.Capacity    = bagType.Capacity;

            //try
            //{
            //    ECXLookUp.ECXLookup objEcxLookUp = new WarehouseApplication.ECXLookUp.ECXLookup();
            //    ECXLookUp.CBag objBag = objEcxLookUp.GetBag(Utility.GetWorkinglanguage(), BagId);
            //    if (objBag != null)
            //    {
            //        this.Id = objBag.UniqueIdentifier;
            //        this.BagTypeName = objBag.Name;
            //        this.Tare = objBag.Tare;
            //    }
            //    else
            //    {
            //        throw new Exception("Unable to Get Bag Data.");
            //    }
            //}
            //catch (Exception ex)
            //{
            //    throw ex;
            //}
        }
Пример #2
0
        public Nullable <float> CalculateNetWeight(float GrossWeight, Guid BagTypeId, int NoBags)
        {
            float      Tare, netWeight;
            BagTypeBLL objbagType = new BagTypeBLL();

            objbagType.GetBagTypeById(BagTypeId);

            if (objbagType != null)
            {
                Tare = objbagType.Tare;
                if (Tare == -1)
                {
                    throw new InvalidTareException("Tare for the bag type is not provided");
                }
                netWeight = GrossWeight - (Tare * NoBags);
                if (netWeight <= 0)
                {
                    throw new Exception("Net weight can not be below 0.");
                }
                netWeight = (float)(Math.Round(netWeight * 100) / 100);
                return((float)(Math.Round(netWeight * 100, 0)) / 100);
            }
            else
            {
                throw new InvalidTareException("Tare for the bag type is not provided.");
            }
        }
Пример #3
0
        public Nullable <float> CalculateNetWeight(float GrossWeight, Guid BagTypeId, int NoBags, Guid CommodityGradeId)
        {
            //Get Commodity Id
            Guid CommodityID = CommodityGradeBLL.GetCommodityGrade(CommodityGradeId).CommodityId;
            Guid CoffeeId    = new Guid(Utility.GetCommodityId("Coffee").ToString());


            float      Tare, netWeight;
            BagTypeBLL objbagType = new BagTypeBLL();

            objbagType.GetBagTypeById(BagTypeId);

            if (objbagType != null)
            {
                Tare = objbagType.Tare;
                if (Tare == -1)
                {
                    throw new InvalidTareException("Tare for the bag type is not provided");
                }
                // Utility.LogException(new Exception("CC : CoffeeId=" + CoffeeId.ToString() + ", CommodityID=" + CommodityID.ToString()));
                if (CoffeeId != CommodityID)
                {
                    Tare = Tare / 100; // change to quintals
                }
                netWeight = GrossWeight - (Tare * NoBags);
                // Utility.LogException(new Exception("Tare:" + Tare.ToString() + ", NoBags=" + NoBags + ", GrossWeight=" + GrossWeight.ToString() + ", netWeight=" + netWeight.ToString()));

                if (netWeight <= 0)
                {
                    throw new Exception("Net weight can not be below 0.");
                }
                netWeight = (float)(Math.Round(netWeight * 100) / 100);
                return((float)(Math.Round(netWeight * 100, 0)) / 100);
            }
            else
            {
                throw new InvalidTareException("Tare for the bag type is not provided.");
            }
        }