Example #1
0
        private static void postReceiveLine(ReceiveLine receiveLine, ReceiveHeader receiveHeader)
        {
            WarehouseEntry warehouseEntry = new WarehouseEntry();

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


                warehouseEntry.ItemID              = receiveLine.ItemID;
                warehouseEntry.DocumentNumber      = receiveLine.DocumentID;
                warehouseEntry.EntryType           = EntryType.Receive;
                warehouseEntry.TotalQuantity       = receiveLine.ReceiveQuantity * stku.QuantityPerUnit;
                warehouseEntry.Quantity            = receiveLine.ReceiveQuantity;
                warehouseEntry.QuantityPerUnit     = stku.QuantityPerUnit;
                warehouseEntry.KeepUnit            = receiveLine.StockKeepUnit;
                warehouseEntry.WarehouseNumber     = receiveLine.WarehouseNumber;
                warehouseEntry.WarehousePlace      = receiveLine.WarehousePlace;
                warehouseEntry.VendorID            = receiveHeader.VendorID;
                warehouseEntry.DocumentDate        = receiveHeader.ReceiveDate;
                warehouseEntry.DocumentDescription = receiveHeader.Description;

                dBCtx.WarehouseEntries.Add(warehouseEntry);

                ReceiveLine receiveLineUpdate = dBCtx.ReceiveLines.First(x => x.DocumentID == receiveLine.DocumentID && x.PositionNumber == receiveLine.PositionNumber);
                dBCtx.ReceiveLines.Attach(receiveLineUpdate);
                receiveLineUpdate.ReceivedQuantity = receiveLineUpdate.ReceivedQuantity + receiveLine.ReceiveQuantity;
                receiveLineUpdate.ReceiveQuantity  = 0.00;
                dBCtx.SaveChanges();
            }
        }
Example #2
0
        private static string chceckReceiveLine(ReceiveLine receiveLine)
        {
            string errorMsg = null;

            if (receiveLine.Quantity < receiveLine.ReceiveQuantity + receiveLine.ReceivedQuantity)
            {
                errorMsg = "\nIlość do przyjęcia jest niepoprawna dla " + receiveLine.ItemID;
            }
            if (!String.IsNullOrEmpty(errorMsg))
            {
                return(errorMsg);
            }

            errorMsg = isReceiveLineValid(receiveLine);

            return(errorMsg);
        }
Example #3
0
        //receive line
        public static string isReceiveLineValid(ReceiveLine receiveLine)
        {
            string errorMsg = null;

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

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


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

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

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

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

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

            return(errorMsg);
        }
Example #4
0
 private static bool chceckQuantityToReceive(ReceiveLine receiveLine)
 {
     return(receiveLine.ReceiveQuantity > 0.00);
 }