Ejemplo n.º 1
0
        private static string chceckReleaseLine(ReleaseLine releaseLine)
        {
            string errorMsg = null;

            if (releaseLine.Quantity < releaseLine.ReleaseQuantity + releaseLine.ReleasedQuantity)
            {
                errorMsg = "\nIlość do wydania jest niepoprawna dla " + releaseLine.ItemID;
            }
            if (!String.IsNullOrEmpty(errorMsg))
            {
                return(errorMsg);
            }

            if (calculateAvailableQuantity(releaseLine.ItemID, releaseLine.StockKeepUnit, releaseLine.WarehouseNumber, releaseLine.WarehousePlace) < releaseLine.ReleaseQuantity)
            {
                errorMsg = "\nNiewystarczający stan magazynowy dla " + releaseLine.ItemID + " w jednostce " + releaseLine.StockKeepUnit + " w magazynie " + releaseLine.WarehouseNumber + " w miejscu " + releaseLine.WarehousePlace;
            }
            if (!String.IsNullOrEmpty(errorMsg))
            {
                return(errorMsg);
            }
            // calculateAvailableQuantity
            errorMsg = isReleaseLineValid(releaseLine);

            return(errorMsg);
        }
Ejemplo n.º 2
0
        private static void postReleaseLine(ReleaseLine releaseLine, ReleaseHeader releaseHeader)
        {
            WarehouseEntry warehouseEntry = new WarehouseEntry();

            using (DBContext dBCtx = new DBContext())
            {
                StockKeepUnit stku = dBCtx.StockKeepUnits.Single(x => x.Code == releaseLine.StockKeepUnit);


                warehouseEntry.ItemID              = releaseLine.ItemID;
                warehouseEntry.DocumentNumber      = releaseLine.DocumentID;
                warehouseEntry.EntryType           = EntryType.Release;
                warehouseEntry.TotalQuantity       = -(releaseLine.ReleaseQuantity * stku.QuantityPerUnit);
                warehouseEntry.Quantity            = -(releaseLine.ReleaseQuantity);
                warehouseEntry.QuantityPerUnit     = stku.QuantityPerUnit;
                warehouseEntry.KeepUnit            = releaseLine.StockKeepUnit;
                warehouseEntry.WarehouseNumber     = releaseLine.WarehouseNumber;
                warehouseEntry.WarehousePlace      = releaseLine.WarehousePlace;
                warehouseEntry.CustomerID          = releaseHeader.CustomerID;
                warehouseEntry.DocumentDate        = releaseHeader.ReleaseDate;
                warehouseEntry.DocumentDescription = releaseHeader.Description;

                dBCtx.WarehouseEntries.Add(warehouseEntry);

                ReleaseLine releaseLineUpdate = dBCtx.ReleaseLines.First(x => x.DocumentID == releaseLine.DocumentID && x.PositionNumber == releaseLine.PositionNumber);
                dBCtx.ReleaseLines.Attach(releaseLineUpdate);
                releaseLineUpdate.ReleasedQuantity = releaseLineUpdate.ReleasedQuantity + releaseLine.ReleaseQuantity;
                releaseLineUpdate.ReleaseQuantity  = 0.00;
                dBCtx.SaveChanges();
            }
        }
Ejemplo n.º 3
0
        //release line

        public static string isReleaseLineValid(ReleaseLine releaseLine)
        {
            string errorMsg = null;

            if (String.IsNullOrEmpty(releaseLine.DocumentID))
            {
                errorMsg += "\nPusty ID dokumentu";
            }

            if (releaseLine.PositionNumber <= 0)
            {
                errorMsg += "\nNieprawidłowy numer pozycji";
            }


            if (String.IsNullOrEmpty(releaseLine.ItemID))
            {
                errorMsg += "\nNieprawidłowe ID";
            }

            if (String.IsNullOrEmpty(releaseLine.StockKeepUnit))
            {
                errorMsg += "\nNieprawidłowa jednostka";
            }

            if (String.IsNullOrEmpty(releaseLine.WarehouseNumber))
            {
                errorMsg += "\nNieprawidłowy numer magazynu";
            }

            if (String.IsNullOrEmpty(releaseLine.WarehousePlace))
            {
                errorMsg += "\nNieprawidłowe miejsce magazynowe";
            }

            if (releaseLine.Quantity <= 0.0)
            {
                errorMsg += "\nNiepoprawna ilość";
            }

            return(errorMsg);
        }
Ejemplo n.º 4
0
 private static bool chceckQuantityToRelease(ReleaseLine releaseLine)
 {
     return(releaseLine.ReleaseQuantity > 0.00);
 }