public ActionResult Edit([Bind("ixHandlingUnit,sHandlingUnit,ixHandlingUnitType,ixParentHandlingUnit,ixPackingMaterial,ixMaterialHandlingUnitConfiguration,nLength,ixLengthUnit,nWidth,ixWidthUnit,nHeight,ixHeightUnit,nWeight,ixWeightUnit,ixStatus")] HandlingUnitsPost handlingunits)
 {
     if (ModelState.IsValid)
     {
         handlingunits.UserName = User.Identity.Name;
         _handlingunitsService.Edit(handlingunits);
         return(RedirectToAction("Index"));
     }
     ViewBag.ixHandlingUnitType = new SelectList(_handlingunitsService.selectHandlingUnitTypes().Select(x => new { x.ixHandlingUnitType, x.sHandlingUnitType }), "ixHandlingUnitType", "sHandlingUnitType", handlingunits.ixHandlingUnitType);
     //Custom Code Start | Replaced Code Block
     //Replaced Code Block Start
     //ViewBag.ixHeightUnit = new SelectList(_handlingunitsService.selectUnitsOfMeasurementNullable().Select( x => new { ixUnitOfMeasurement = x.Key, sUnitOfMeasurement = x.Value }), "ixUnitOfMeasurement", "sUnitOfMeasurement", handlingunits.ixHeightUnit);
     //ViewBag.ixLengthUnit = new SelectList(_handlingunitsService.selectUnitsOfMeasurementNullable().Select( x => new { ixUnitOfMeasurement = x.Key, sUnitOfMeasurement = x.Value }), "ixUnitOfMeasurement", "sUnitOfMeasurement", handlingunits.ixLengthUnit);
     //ViewBag.ixMaterialHandlingUnitConfiguration = new SelectList(_handlingunitsService.selectMaterialHandlingUnitConfigurationsNullable().Select( x => new { ixMaterialHandlingUnitConfiguration = x.Key, sMaterialHandlingUnitConfiguration = x.Value }), "ixMaterialHandlingUnitConfiguration", "sMaterialHandlingUnitConfiguration", handlingunits.ixMaterialHandlingUnitConfiguration);
     //ViewBag.ixPackingMaterial = new SelectList(_handlingunitsService.selectMaterialsNullable().Select(x => new { ixMaterial = x.Key, sMaterial = x.Value }), "ixMaterial", "sMaterial", handlingunits.ixPackingMaterial);
     //ViewBag.ixParentHandlingUnit = new SelectList(_handlingunitsService.selectHandlingUnitsNullable().Select( x => new { ixHandlingUnit = x.Key, sHandlingUnit = x.Value }), "ixHandlingUnit", "sHandlingUnit", handlingunits.ixParentHandlingUnit);
     //ViewBag.ixStatus = new SelectList(_handlingunitsService.selectStatusesNullable().Select( x => new { ixStatus = x.Key, sStatus = x.Value }), "ixStatus", "sStatus", handlingunits.ixStatus);
     //ViewBag.ixWeightUnit = new SelectList(_handlingunitsService.selectUnitsOfMeasurementNullable().Select( x => new { ixUnitOfMeasurement = x.Key, sUnitOfMeasurement = x.Value }), "ixUnitOfMeasurement", "sUnitOfMeasurement", handlingunits.ixWeightUnit);
     //ViewBag.ixWidthUnit = new SelectList(_handlingunitsService.selectUnitsOfMeasurementNullable().Select( x => new { ixUnitOfMeasurement = x.Key, sUnitOfMeasurement = x.Value }), "ixUnitOfMeasurement", "sUnitOfMeasurement", handlingunits.ixWidthUnit);
     //Replaced Code Block End
     ViewBag.ixHeightUnit      = new SelectList(_commonlyUsedSelects.selectUnitsOfMeasurementLength().Select(x => new { x.ixUnitOfMeasurement, x.sUnitOfMeasurement }), "ixUnitOfMeasurement", "sUnitOfMeasurement", handlingunits.ixHeightUnit);
     ViewBag.ixLengthUnit      = new SelectList(_commonlyUsedSelects.selectUnitsOfMeasurementLength().Select(x => new { x.ixUnitOfMeasurement, x.sUnitOfMeasurement }), "ixUnitOfMeasurement", "sUnitOfMeasurement", handlingunits.ixLengthUnit);
     ViewBag.ixPackingMaterial = new SelectList(_handlingunitsService.selectMaterialsNullable().Select(x => new { ixMaterial = x.Key, sMaterial = x.Value }), "ixMaterial", "sMaterial", handlingunits.ixPackingMaterial);
     ViewBag.ixMaterialHandlingUnitConfiguration = new SelectList(_handlingunitsService.selectMaterialHandlingUnitConfigurationsNullable().Select(x => new { ixMaterialHandlingUnitConfiguration = x.Key, sMaterialHandlingUnitConfiguration = x.Value }), "ixMaterialHandlingUnitConfiguration", "sMaterialHandlingUnitConfiguration", handlingunits.ixMaterialHandlingUnitConfiguration);
     ViewBag.ixParentHandlingUnit = new SelectList(_handlingunitsService.selectHandlingUnitsNullable().Select(x => new { ixHandlingUnit = x.Key, sHandlingUnit = x.Value }), "ixHandlingUnit", "sHandlingUnit", handlingunits.ixParentHandlingUnit);
     ViewBag.ixStatus             = new SelectList(_handlingunitsService.selectStatusesNullable().Select(x => new { ixStatus = x.Key, sStatus = x.Value }), "ixStatus", "sStatus", handlingunits.ixStatus);
     ViewBag.ixWeightUnit         = new SelectList(_commonlyUsedSelects.selectUnitsOfMeasurementWeight().Select(x => new { x.ixUnitOfMeasurement, x.sUnitOfMeasurement }), "ixUnitOfMeasurement", "sUnitOfMeasurement", handlingunits.ixWeightUnit);
     ViewBag.ixWidthUnit          = new SelectList(_commonlyUsedSelects.selectUnitsOfMeasurementLength().Select(x => new { x.ixUnitOfMeasurement, x.sUnitOfMeasurement }), "ixUnitOfMeasurement", "sUnitOfMeasurement", handlingunits.ixWidthUnit);
     //Custom Code End
     return(View(handlingunits));
 }
        public ActionResult Edit(long id)
        {
            HandlingUnitsPost handlingunits = _handlingunitsService.GetPost(id);

            if (handlingunits == null)
            {
                return(NotFound());
            }
            ViewBag.ixHandlingUnitType = new SelectList(_handlingunitsService.selectHandlingUnitTypes().Select(x => new { x.ixHandlingUnitType, x.sHandlingUnitType }), "ixHandlingUnitType", "sHandlingUnitType", handlingunits.ixHandlingUnitType);
            //Custom Code Start | Replaced Code Block
            //Replaced Code Block Start
            //ViewBag.ixHeightUnit = new SelectList(_handlingunitsService.selectUnitsOfMeasurementNullable().Select( x => new { ixUnitOfMeasurement = x.Key, sUnitOfMeasurement = x.Value }), "ixUnitOfMeasurement", "sUnitOfMeasurement", handlingunits.ixHeightUnit);
            //ViewBag.ixLengthUnit = new SelectList(_handlingunitsService.selectUnitsOfMeasurementNullable().Select( x => new { ixUnitOfMeasurement = x.Key, sUnitOfMeasurement = x.Value }), "ixUnitOfMeasurement", "sUnitOfMeasurement", handlingunits.ixLengthUnit);
            //ViewBag.ixMaterialHandlingUnitConfiguration = new SelectList(_handlingunitsService.selectMaterialHandlingUnitConfigurationsNullable().Select( x => new { ixMaterialHandlingUnitConfiguration = x.Key, sMaterialHandlingUnitConfiguration = x.Value }), "ixMaterialHandlingUnitConfiguration", "sMaterialHandlingUnitConfiguration", handlingunits.ixMaterialHandlingUnitConfiguration);
            //ViewBag.ixPackingMaterial = new SelectList(_handlingunitsService.selectMaterialsNullable().Select(x => new { ixMaterial = x.Key, sMaterial = x.Value }), "ixMaterial", "sMaterial", handlingunits.ixPackingMaterial);
            //ViewBag.ixParentHandlingUnit = new SelectList(_handlingunitsService.selectHandlingUnitsNullable().Select( x => new { ixHandlingUnit = x.Key, sHandlingUnit = x.Value }), "ixHandlingUnit", "sHandlingUnit", handlingunits.ixParentHandlingUnit);
            //ViewBag.ixStatus = new SelectList(_handlingunitsService.selectStatusesNullable().Select( x => new { ixStatus = x.Key, sStatus = x.Value }), "ixStatus", "sStatus", handlingunits.ixStatus);
            //ViewBag.ixWeightUnit = new SelectList(_handlingunitsService.selectUnitsOfMeasurementNullable().Select( x => new { ixUnitOfMeasurement = x.Key, sUnitOfMeasurement = x.Value }), "ixUnitOfMeasurement", "sUnitOfMeasurement", handlingunits.ixWeightUnit);
            //ViewBag.ixWidthUnit = new SelectList(_handlingunitsService.selectUnitsOfMeasurementNullable().Select( x => new { ixUnitOfMeasurement = x.Key, sUnitOfMeasurement = x.Value }), "ixUnitOfMeasurement", "sUnitOfMeasurement", handlingunits.ixWidthUnit);
            //Replaced Code Block End
            ViewBag.ixHeightUnit      = new SelectList(_commonlyUsedSelects.selectUnitsOfMeasurementLength().Select(x => new { x.ixUnitOfMeasurement, x.sUnitOfMeasurement }), "ixUnitOfMeasurement", "sUnitOfMeasurement", handlingunits.ixHeightUnit);
            ViewBag.ixLengthUnit      = new SelectList(_commonlyUsedSelects.selectUnitsOfMeasurementLength().Select(x => new { x.ixUnitOfMeasurement, x.sUnitOfMeasurement }), "ixUnitOfMeasurement", "sUnitOfMeasurement", handlingunits.ixLengthUnit);
            ViewBag.ixPackingMaterial = new SelectList(_handlingunitsService.selectMaterialsNullable().Select(x => new { ixMaterial = x.Key, sMaterial = x.Value }), "ixMaterial", "sMaterial", handlingunits.ixPackingMaterial);
            ViewBag.ixMaterialHandlingUnitConfiguration = new SelectList(_handlingunitsService.selectMaterialHandlingUnitConfigurationsNullable().Select(x => new { ixMaterialHandlingUnitConfiguration = x.Key, sMaterialHandlingUnitConfiguration = x.Value }), "ixMaterialHandlingUnitConfiguration", "sMaterialHandlingUnitConfiguration", handlingunits.ixMaterialHandlingUnitConfiguration);
            ViewBag.ixParentHandlingUnit = new SelectList(_handlingunitsService.selectHandlingUnitsNullable().Select(x => new { ixHandlingUnit = x.Key, sHandlingUnit = x.Value }), "ixHandlingUnit", "sHandlingUnit", handlingunits.ixParentHandlingUnit);
            ViewBag.ixStatus             = new SelectList(_handlingunitsService.selectStatusesNullable().Select(x => new { ixStatus = x.Key, sStatus = x.Value }), "ixStatus", "sStatus", handlingunits.ixStatus);
            ViewBag.ixWeightUnit         = new SelectList(_commonlyUsedSelects.selectUnitsOfMeasurementWeight().Select(x => new { x.ixUnitOfMeasurement, x.sUnitOfMeasurement }), "ixUnitOfMeasurement", "sUnitOfMeasurement", handlingunits.ixWeightUnit);
            ViewBag.ixWidthUnit          = new SelectList(_commonlyUsedSelects.selectUnitsOfMeasurementLength().Select(x => new { x.ixUnitOfMeasurement, x.sUnitOfMeasurement }), "ixUnitOfMeasurement", "sUnitOfMeasurement", handlingunits.ixWidthUnit);
            //Custom Code End
            return(View(handlingunits));
        }
        public ActionResult DeleteConfirmed(long id)
        {
            HandlingUnitsPost handlingunits = _handlingunitsService.GetPost(id);

            handlingunits.UserName = User.Identity.Name;
            _handlingunitsService.Delete(handlingunits);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 4
0
        public Task Edit(HandlingUnitsPost handlingunitsPost)
        {
            // Additional validations

            // Pre-process

            // Process
            this._handlingunitsRepository.RegisterEdit(handlingunitsPost);
            try
            {
                this._handlingunitsRepository.Commit();
            }
            catch (Exception ex)
            {
                this._handlingunitsRepository.Rollback();
                // Log exception
                throw;
            }

            // Post-process

            return(Task.CompletedTask);
        }
Exemplo n.º 5
0
        public Task <Int64> Create(HandlingUnitsPost handlingunitsPost)
        {
            // Additional validations

            // Pre-process

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

            // Post-process

            return(Task.FromResult(handlingunitsPost.ixHandlingUnit));
        }
        private async Task <DialogTurnResult> donePrompt(
            WaterfallStepContext step,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            var sPackToHandlingUnit = (string)step.Result;

            ((PickBatchPickingPost)step.Values[DialogKey]).sPackToHandlingUnit = sPackToHandlingUnit;

            //Custom Code Start | Added Code Block
            //If the handling unit does not exist we create it

            long ixHandlingUnit = 0;

            if (!_movequeuesService.HandlingUnitsDb().Where(x => x.sHandlingUnit.Trim() == sPackToHandlingUnit.Trim()).Any())
            {
                HandlingUnitsPost handlingUnitsPost = new HandlingUnitsPost();
                handlingUnitsPost.sHandlingUnit      = sPackToHandlingUnit.Trim();
                handlingUnitsPost.ixHandlingUnitType = _commonLookUps.getHandlingUnitTypes().Where(x => x.sHandlingUnitType == "Carton").Select(x => x.ixHandlingUnitType).FirstOrDefault();
                handlingUnitsPost.UserName           = step.Context.Activity.Conversation.Id;
                ixHandlingUnit = _handlingunitsService.Create(handlingUnitsPost).Result;
            }
            else
            {
                ixHandlingUnit = _movequeuesService.HandlingUnitsDb().Where(x => x.sHandlingUnit == sPackToHandlingUnit.Trim()).Select(x => x.ixHandlingUnit).FirstOrDefault();
            }
            ((PickBatchPickingPost)step.Values[DialogKey]).ixHandlingUnit = ixHandlingUnit;

            var inventoryUnitPicked = _inventoryunitsService.GetPost((long)step.Values[PickedInventoryUnitKey]);

            inventoryUnitPicked.ixHandlingUnit = ixHandlingUnit;
            inventoryUnitPicked.UserName       = step.Context.Activity.Conversation.Id;
            await _inventoryunitsService.Edit(inventoryUnitPicked, _commonLookUps.getInventoryUnitTransactionContext().Where(x => x.sInventoryUnitTransactionContext == "Inventory Adjustment").Select(x => x.ixInventoryUnitTransactionContext).FirstOrDefault());

            //We create the packing record
            var orderLinesToPack = ((List <Tuple <Int64, double> >)step.Values[LineQtysPickedKey]).GroupBy(x => x.Item1).Select(x => new { ixOutboundOrderLine = x.Key, Total = x.Sum(s => s.Item2) }).ToList();

            orderLinesToPack.ForEach(x =>
            {
                //We check if there is an existing pack record we can use
                if (
                    _outboundorderlinepackingService.IndexDb().Where(p =>
                                                                     p.ixHandlingUnit == ((PickBatchPickingPost)step.Values[DialogKey]).ixHandlingUnit &&
                                                                     p.ixOutboundOrderLine == x.ixOutboundOrderLine
                                                                     ).Any()
                    )
                {
                    var outboundorderlinepack = _outboundorderlinepackingService.GetPost(_outboundorderlinepackingService.IndexDb().Where(p =>
                                                                                                                                          p.ixHandlingUnit == ((PickBatchPickingPost)step.Values[DialogKey]).ixHandlingUnit &&
                                                                                                                                          p.ixOutboundOrderLine == x.ixOutboundOrderLine
                                                                                                                                          ).Select(p => p.ixOutboundOrderLinePack).FirstOrDefault()
                                                                                         );
                    outboundorderlinepack.nBaseUnitQuantityPacked += x.Total;
                    outboundorderlinepack.UserName = step.Context.Activity.Conversation.Id;
                    _outboundorderlinepackingService.Edit(outboundorderlinepack);
                }
                else
                {
                    var outboundorderlinepack = new OutboundOrderLinePackingPost();
                    outboundorderlinepack.ixOutboundOrderLine     = x.ixOutboundOrderLine;
                    outboundorderlinepack.ixHandlingUnit          = ((PickBatchPickingPost)step.Values[DialogKey]).ixHandlingUnit;
                    outboundorderlinepack.nBaseUnitQuantityPacked = x.Total;
                    outboundorderlinepack.ixStatus = _commonLookUps.getStatuses().Where(s => s.sStatus == "Active").Select(s => s.ixStatus).FirstOrDefault();
                    outboundorderlinepack.UserName = step.Context.Activity.Conversation.Id;
                    _outboundorderlinepackingService.Create(outboundorderlinepack);
                }
            }
                                     );

            //Custom Code End

            return(await step.EndDialogAsync(
                       (PickBatchPickingPost)step.Values[DialogKey],
                       cancellationToken));
        }
        public Task <Int64> Create(ReceivingPost receivingPost)
        {
            // Additional validations

            // Pre-process

            //Custom Code Start | Added Code Block
            //If the handling unit does not exist we create it
            if (!HandlingUnitsDb().Where(x => x.sHandlingUnit == receivingPost.sReceipt.Trim()).Any())
            {
                HandlingUnitsPost handlingUnitsPost = new HandlingUnitsPost();
                handlingUnitsPost.sHandlingUnit      = receivingPost.sReceipt;
                handlingUnitsPost.ixHandlingUnitType = receivingPost.ixHandlingUnitType ?? 0;
                handlingUnitsPost.UserName           = receivingPost.UserName;
                receivingPost.ixHandlingUnit         = _handlingunitsService.Create(handlingUnitsPost).Result;
            }
            else
            {
                receivingPost.ixHandlingUnit = HandlingUnitsDb().Where(x => x.sHandlingUnit == receivingPost.sReceipt.Trim()).Select(x => x.ixHandlingUnit).FirstOrDefault();
            }

            InventoryUnitsPost inventoryUnit = new InventoryUnitsPost();
            var inboundOrder = _inboundordersService.GetPost(receivingPost.ixInboundOrder);

            inventoryUnit.ixFacility          = inboundOrder.ixFacility;
            inventoryUnit.ixCompany           = inboundOrder.ixCompany;
            inventoryUnit.ixMaterial          = receivingPost.ixMaterial;
            inventoryUnit.ixInventoryState    = receivingPost.ixInventoryState;
            inventoryUnit.ixHandlingUnit      = receivingPost.ixHandlingUnit;
            inventoryUnit.ixInventoryLocation = receivingPost.ixInventoryLocation;
            inventoryUnit.sSerialNumber       = receivingPost.sSerialNumber;
            inventoryUnit.sBatchNumber        = receivingPost.sBatchNumber;
            inventoryUnit.dtExpireAt          = receivingPost.dtExpireAt;
            inventoryUnit.UserName            = receivingPost.UserName;

            if ((inventoryUnit.sSerialNumber ?? "").Trim() != "")
            {
                //We create an iu
                inventoryUnit.nBaseUnitQuantity = receivingPost.nBaseUnitQuantityReceived;
                _inventoryunitsService.Create(inventoryUnit, _ixInventoryUnitTransactionContext);
            }
            else if (_inventoryunitsService.IndexDb().Where(x =>
                                                            x.ixFacility == inventoryUnit.ixFacility &&
                                                            x.ixCompany == inventoryUnit.ixCompany &&
                                                            x.ixMaterial == inventoryUnit.ixMaterial &&
                                                            x.ixInventoryState == inventoryUnit.ixInventoryState &&
                                                            x.ixHandlingUnit == inventoryUnit.ixHandlingUnit &&
                                                            x.ixInventoryLocation == inventoryUnit.ixInventoryLocation &&
                                                            x.sBatchNumber == inventoryUnit.sBatchNumber &&
                                                            x.dtExpireAt == inventoryUnit.dtExpireAt && x.ixStatus == 5
                                                            ).Select(x => x.ixInventoryUnit).Any()
                     )
            {
                //We edit the iu
                inventoryUnit.ixInventoryUnit = _inventoryunitsService.IndexDb().Where(x =>
                                                                                       x.ixFacility == inventoryUnit.ixFacility &&
                                                                                       x.ixCompany == inventoryUnit.ixCompany &&
                                                                                       x.ixMaterial == inventoryUnit.ixMaterial &&
                                                                                       x.ixInventoryState == inventoryUnit.ixInventoryState &&
                                                                                       x.ixHandlingUnit == inventoryUnit.ixHandlingUnit &&
                                                                                       x.ixInventoryLocation == inventoryUnit.ixInventoryLocation &&
                                                                                       x.sBatchNumber == inventoryUnit.sBatchNumber &&
                                                                                       x.dtExpireAt == inventoryUnit.dtExpireAt && x.ixStatus == 5
                                                                                       ).Select(x => x.ixInventoryUnit).FirstOrDefault();
                inventoryUnit.nBaseUnitQuantity = _inventoryunitsService.GetPost(inventoryUnit.ixInventoryUnit).nBaseUnitQuantity + receivingPost.nBaseUnitQuantityReceived;
                _inventoryunitsService.Edit(inventoryUnit, _ixInventoryUnitTransactionContext);
            }
            else
            {
                //We create an iu
                inventoryUnit.nBaseUnitQuantity = receivingPost.nBaseUnitQuantityReceived;
                _inventoryunitsService.Create(inventoryUnit, _ixInventoryUnitTransactionContext);
            }


            //Custom Code End

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

            // Post-process

            //Custom Code Start | Added Code Block
            //Now we update the inbound order lines - for now we apply entire qty to the matching line
            var _ixInboundOrderLine = _inboundorderlinesService.IndexDb().Where(x => x.ixInboundOrder == receivingPost.ixInboundOrder && x.ixMaterial == receivingPost.ixMaterial).Select(x => x.ixInboundOrderLine).FirstOrDefault();
            var inboundOrderLine    = _inboundorderlinesService.GetPost(_ixInboundOrderLine);

            inboundOrderLine.nBaseUnitQuantityReceived += receivingPost.nBaseUnitQuantityReceived;
            inboundOrderLine.UserName = receivingPost.UserName;
            if ((inboundOrderLine.nBaseUnitQuantityExpected - inboundOrderLine.nBaseUnitQuantityReceived) == 0)
            {
                inboundOrderLine.ixStatus = _commonLookUps.getStatuses().Where(x => x.sStatus == "Complete").Select(x => x.ixStatus).FirstOrDefault();
            }
            _inboundorderlinesService.Edit(inboundOrderLine);

            //If there are no open qtys we set the inbound order/line status to complete
            if (_inboundorderlinesService.IndexDb().Where(x => x.ixInboundOrder == receivingPost.ixInboundOrder).Select(x => x.nBaseUnitQuantityExpected - x.nBaseUnitQuantityReceived).Sum() == 0)
            {
                var inboundorder = _inboundordersService.GetPost(receivingPost.ixInboundOrder);
                inboundorder.ixStatus = _commonLookUps.getStatuses().Where(x => x.sStatus == "Complete").Select(x => x.ixStatus).FirstOrDefault();
                _inboundordersService.Edit(inboundorder);
            }

            //Custom Code End

            return(Task.FromResult(receivingPost.ixReceipt));
        }
Exemplo n.º 8
0
 public void RegisterDelete(HandlingUnitsPost handlingunitsPost)
 {
     _context.HandlingUnitsPost.Remove(handlingunitsPost);
 }
Exemplo n.º 9
0
 public void RegisterEdit(HandlingUnitsPost handlingunitsPost)
 {
     _context.Entry(handlingunitsPost).State = EntityState.Modified;
 }
Exemplo n.º 10
0
 public void RegisterCreate(HandlingUnitsPost handlingunitsPost)
 {
     _context.HandlingUnitsPost.Add(handlingunitsPost);
 }