コード例 #1
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);
                        }
                    }
                                      );
                }
                                               );
            }
        }
コード例 #2
0
        public IQueryable <HandlingUnits> Index()
        {
            //Custom Code Start | Added Code Block
            var statusInactive = _statusesRepository.IndexDb().Where(x => x.sStatus == "Inactive").Select(x => x.ixStatus).FirstOrDefault();
            //Custom Code End

            //Custom Code Start | Replaced Code Block
            //Replaced Code Block Start
            //var handlingunits = _context.HandlingUnits.Include(a => a.HandlingUnitTypes).AsNoTracking();
            //Replaced Code Block End
            var handlingunits = _context.HandlingUnits.Where(a => (a.ixStatus ?? 0) != statusInactive).Include(a => a.HandlingUnitTypes).AsNoTracking();

            //Custom Code End
            return(handlingunits);
        }
コード例 #3
0
 public IQueryable <Statuses> IndexDb() => _statusesRepository.IndexDb();
コード例 #4
0
 public List <Statuses> getStatuses()
 {
     return(_statusesRepository.IndexDb().ToList());
 }