public virtual void OnPackStationOverviewRunPackRowForPackStation(WorkItem context, object caller, object target) { if (target is Imi.SupplyChain.Warehouse.UX.Views.PickLoadCarrier.PackStationOverviewPackRowEventArgs) { WorkItem wi = GetModuleWorkItem(context); if (wi.Items.FindByType <RunPackRowForPackStationAction>().Count == 0) { wi.Items.AddNew <RunPackRowForPackStationAction>(); } Imi.SupplyChain.Warehouse.UX.Views.PickLoadCarrier.PackStationOverviewPackRowEventArgs args = target as Imi.SupplyChain.Warehouse.UX.Views.PickLoadCarrier.PackStationOverviewPackRowEventArgs; RunPackRowForPackStationActionParameters actionParameters = new RunPackRowForPackStationActionParameters(); actionParameters.FromLoadCarrierId = args.FromLoadCarrier; actionParameters.ToLoadCarrierId = args.ToLoadCarrier; actionParameters.PickOrderLineNumber = args.PickOrderLineNumber; actionParameters.PickedQuantity = args.QuantityToPack; actionParameters.IsItemSelected = true; IPackStationOverviewView packStationOverviewView = context.SmartParts.FindByType <IPackStationOverviewView>().LastOrDefault(); IPackStationFromLCView packStationFromLcView = context.SmartParts.FindByType <IPackStationFromLCView>().LastOrDefault(); IPackStationToLCView packStationToLcView = context.SmartParts.FindByType <IPackStationToLCView>().LastOrDefault(); try { ActionCatalog.Execute(ActionNames.RunPackRowForPackStation, context, caller, actionParameters); if (context.Items.Contains("RefreshPackStationOverview")) { if (((bool)context.Items["RefreshPackStationOverview"])) { packStationOverviewView.Refresh(); } else { if (packStationFromLcView != null) { packStationFromLcView.Refresh(); } if (packStationToLcView != null) { packStationToLcView.Refresh(); } } } else { if (packStationFromLcView != null) { packStationFromLcView.Refresh(); } if (packStationToLcView != null) { packStationToLcView.Refresh(); } } } catch { throw; } } }
public override void OnPackStationFromLcEditRunPackRowForPackStation(WorkItem context, object caller, object target) { WorkItem wi = GetModuleWorkItem(context); if (wi.Items.FindByType <RunPackRowForPackStationAction>().Count == 0) { wi.Items.AddNew <RunPackRowForPackStationAction>(); } PackStationFromLcEditViewResult viewResult = null; RunPackRowForPackStationActionParameters actionParameters = null; PackStationFromLcEditViewToRunPackRowForPackStationActionTranslator translator = null; bool isItemSelected = false; if (context.Items.FindByType <PackStationFromLcEditViewToRunPackRowForPackStationActionTranslator>().Count > 0) { translator = context.Items.FindByType <PackStationFromLcEditViewToRunPackRowForPackStationActionTranslator>().Last(); } else { translator = context.Items.AddNew <PackStationFromLcEditViewToRunPackRowForPackStationActionTranslator>(); } if (context.Items.FindByType <PackStationFromLcEditViewResult>().Count > 0) { viewResult = context.Items.FindByType <PackStationFromLcEditViewResult>().Last(); isItemSelected = true; } else { viewResult = new PackStationFromLcEditViewResult(); if (context.Items.FindByType <PackStationFromLcEditViewParameters>().Count() > 0) { PackStationFromLcEditViewParameters viewParameters = context.Items.FindByType <PackStationFromLcEditViewParameters>().Last(); } } actionParameters = translator.Translate(viewResult); if (context.Items.FindByType <PackStationOverviewPresenter>().Count > 0) { if (!string.IsNullOrEmpty(context.Items.FindByType <PackStationOverviewPresenter>().Last().ToLoadCarrierId)) { actionParameters.ToLoadCarrierId = context.Items.FindByType <PackStationOverviewPresenter>().Last().ToLoadCarrierId; } else { actionParameters.ToLoadCarrierId = string.Empty; } } actionParameters.IsItemSelected = isItemSelected; actionParameters.IsMultipleItemsSelected = false; IPackStationFromLcEditView view = context.SmartParts.FindByType <PackStationFromLcEditView>().Last(); IPackStationOverviewView packStationOverviewView = context.SmartParts.FindByType <IPackStationOverviewView>().LastOrDefault(); IPackStationFromLCView packStationFromLcView = context.SmartParts.FindByType <IPackStationFromLCView>().LastOrDefault(); IPackStationToLCView packStationToLcView = context.SmartParts.FindByType <IPackStationToLCView>().LastOrDefault(); try { if (!view.Validate()) { return; } ActionCatalog.Execute(ActionNames.RunPackRowForPackStation, context, caller, actionParameters); // Check if view should be closed. bool ignoreClosing = ((context.Items.Get("IgnoreClose") != null) && ((bool)(context.Items.Get("IgnoreClose")))); if (context.Items.Contains("RefreshPackStationOverview")) { if (((bool)context.Items["RefreshPackStationOverview"])) { packStationOverviewView.Refresh(); } else { if (packStationFromLcView != null) { packStationFromLcView.Refresh(); } if (packStationToLcView != null) { packStationToLcView.Refresh(); } } } else { if (packStationFromLcView != null) { packStationFromLcView.Refresh(); } if (packStationToLcView != null) { packStationToLcView.Refresh(); } } } catch (Imi.SupplyChain.UX.ValidationException ex) { view.HandleValidationResult(ValidationHelper.ConvertToResult((Imi.SupplyChain.UX.ValidationException)ex)); } }