public ActionResult DeleteConfirmed(long id)
        {
            OutboundOrderLinesInventoryAllocationPost outboundorderlinesinventoryallocation = _outboundorderlinesinventoryallocationService.GetPost(id);

            outboundorderlinesinventoryallocation.UserName = User.Identity.Name;
            _outboundorderlinesinventoryallocationService.Delete(outboundorderlinesinventoryallocation);
            return(RedirectToAction("Index"));
        }
        public ActionResult Edit([Bind("ixOutboundOrderLineInventoryAllocation,sOutboundOrderLineInventoryAllocation,ixOutboundOrderLine,nBaseUnitQuantityAllocated,nBaseUnitQuantityPicked,ixStatus")] OutboundOrderLinesInventoryAllocationPost outboundorderlinesinventoryallocation)
        {
            if (ModelState.IsValid)
            {
                outboundorderlinesinventoryallocation.UserName = User.Identity.Name;
                _outboundorderlinesinventoryallocationService.Edit(outboundorderlinesinventoryallocation);
                return(RedirectToAction("Index"));
            }
            ViewBag.ixOutboundOrderLine = new SelectList(_outboundorderlinesinventoryallocationService.selectOutboundOrderLines().Select(x => new { x.ixOutboundOrderLine, x.sOutboundOrderLine }), "ixOutboundOrderLine", "sOutboundOrderLine", outboundorderlinesinventoryallocation.ixOutboundOrderLine);
            ViewBag.ixStatus            = new SelectList(_outboundorderlinesinventoryallocationService.selectStatuses().Select(x => new { x.ixStatus, x.sStatus }), "ixStatus", "sStatus", outboundorderlinesinventoryallocation.ixStatus);

            return(View(outboundorderlinesinventoryallocation));
        }
        public ActionResult Edit(long id)
        {
            OutboundOrderLinesInventoryAllocationPost outboundorderlinesinventoryallocation = _outboundorderlinesinventoryallocationService.GetPost(id);

            if (outboundorderlinesinventoryallocation == null)
            {
                return(NotFound());
            }
            ViewBag.ixOutboundOrderLine = new SelectList(_outboundorderlinesinventoryallocationService.selectOutboundOrderLines().Select(x => new { x.ixOutboundOrderLine, x.sOutboundOrderLine }), "ixOutboundOrderLine", "sOutboundOrderLine", outboundorderlinesinventoryallocation.ixOutboundOrderLine);
            ViewBag.ixStatus            = new SelectList(_outboundorderlinesinventoryallocationService.selectStatuses().Select(x => new { x.ixStatus, x.sStatus }), "ixStatus", "sStatus", outboundorderlinesinventoryallocation.ixStatus);

            return(View(outboundorderlinesinventoryallocation));
        }
Exemple #4
0
        public void allocateBatch(Int64 ixPickBatch, String UserName)
        {
            //We check that the batch is not already allocated and activated - if so we do nothing
            var pickBatch = _pickbatchesRepository.Get(ixPickBatch);

            if (pickBatch.Statuses.sStatus == "Inactive")
            {
                //We get the orders associated with the batch
                var ordersInBatch = _outboundordersRepository.IndexDb().Where(x => x.ixPickBatch == ixPickBatch && x.Statuses.sStatus == "Active").Select(x => new { x.ixOutboundOrder, x.ixFacility, x.ixCompany });
                ordersInBatch.ToList().ForEach(x =>
                {
                    var linesInOrders = _outboundorderlinesRepository.IndexDb().Where(l => l.ixOutboundOrder == x.ixOutboundOrder && l.Statuses.sStatus == "Active").Select(l => new { l.ixOutboundOrderLine, l.ixMaterial, l.nBaseUnitQuantityOrdered });
                    linesInOrders
                    .ToList().ForEach(l =>
                    {
                        var qtyAvailableToAllocate = getQtyAvailable(x.ixFacility, x.ixCompany, l.ixMaterial) - getQtyAllocated(x.ixFacility, x.ixCompany, l.ixMaterial);
                        if (qtyAvailableToAllocate > 0)
                        {
                            OutboundOrderLinesInventoryAllocationPost outboundOrderLineInventoryAllocation = new OutboundOrderLinesInventoryAllocationPost();
                            outboundOrderLineInventoryAllocation.ixOutboundOrderLine = l.ixOutboundOrderLine;
                            var orderLine = _outboundorderlinesRepository.GetPost(l.ixOutboundOrderLine);
                            if (qtyAvailableToAllocate >= l.nBaseUnitQuantityOrdered)
                            {
                                outboundOrderLineInventoryAllocation.nBaseUnitQuantityAllocated = l.nBaseUnitQuantityOrdered;
                                orderLine.ixStatus = _statusesRepository.IndexDb().Where(s => s.sStatus == "Allocated").Select(s => s.ixStatus).FirstOrDefault();
                                orderLine.UserName = UserName;
                                _outboundorderlinesService.Edit(orderLine);
                            }
                            else
                            {
                                outboundOrderLineInventoryAllocation.nBaseUnitQuantityAllocated = qtyAvailableToAllocate;
                                orderLine.ixStatus = _statusesRepository.IndexDb().Where(s => s.sStatus == "Partially Allocated").Select(s => s.ixStatus).FirstOrDefault();
                                orderLine.UserName = UserName;
                                _outboundorderlinesService.Edit(orderLine);
                            }
                            outboundOrderLineInventoryAllocation.ixStatus = _statusesRepository.IndexDb().Where(s => s.sStatus == "Active").Select(s => s.ixStatus).FirstOrDefault();
                            outboundOrderLineInventoryAllocation.UserName = UserName;
                            _outboundorderlinesinventoryallocationService.Create(outboundOrderLineInventoryAllocation);
                        }
                    }
                                      );
                }
                                               );
            }
        }
Exemple #5
0
        public Task Delete(OutboundOrderLinesInventoryAllocationPost outboundorderlinesinventoryallocationPost)
        {
            // Additional validations

            // Pre-process

            // Process
            this._outboundorderlinesinventoryallocationRepository.RegisterDelete(outboundorderlinesinventoryallocationPost);
            try
            {
                this._outboundorderlinesinventoryallocationRepository.Commit();
            }
            catch (Exception ex)
            {
                this._outboundorderlinesinventoryallocationRepository.Rollback();
                // Log exception
                throw;
            }

            // Post-process

            return(Task.CompletedTask);
        }
Exemple #6
0
        public Task <Int64> Create(OutboundOrderLinesInventoryAllocationPost outboundorderlinesinventoryallocationPost)
        {
            // Additional validations

            // Pre-process

            // Process
            this._outboundorderlinesinventoryallocationRepository.RegisterCreate(outboundorderlinesinventoryallocationPost);
            try
            {
                this._outboundorderlinesinventoryallocationRepository.Commit();
            }
            catch (Exception ex)
            {
                this._outboundorderlinesinventoryallocationRepository.Rollback();
                // Log exception
                throw;
            }

            // Post-process

            return(Task.FromResult(outboundorderlinesinventoryallocationPost.ixOutboundOrderLineInventoryAllocation));
        }
Exemple #7
0
 public void RegisterDelete(OutboundOrderLinesInventoryAllocationPost outboundorderlinesinventoryallocationPost)
 {
     _context.OutboundOrderLinesInventoryAllocationPost.Remove(outboundorderlinesinventoryallocationPost);
 }
Exemple #8
0
 public void RegisterEdit(OutboundOrderLinesInventoryAllocationPost outboundorderlinesinventoryallocationPost)
 {
     _context.Entry(outboundorderlinesinventoryallocationPost).State = EntityState.Modified;
 }
Exemple #9
0
 public void RegisterCreate(OutboundOrderLinesInventoryAllocationPost outboundorderlinesinventoryallocationPost)
 {
     _context.OutboundOrderLinesInventoryAllocationPost.Add(outboundorderlinesinventoryallocationPost);
 }