/// <summary> /// Class extension for <c>WHSRFMenuItemTable</c> table. /// </summary> [ExtensionOf(tableStr(WHSRFMenuItemTable))] final class VKWHSRFMenuItemTableTbl_Extension { /// <summary> /// Checks if the work activity is required to use process guide framework. /// </summary> /// <returns>true if process guide framework must be used; otherwise, false</returns> protected boolean workActivityMustUseProcessGuideFramework() { boolean ret = next workActivityMustUseProcessGuideFramework(); // or this.WorkCreationProcess == WHSWorkCreationProcess::NewValue if (!ret && this.WorkActivity == WHSWorkActivity::VKPrintShippingLabel) { ret = true; } return ret; } }
/// <summary> /// Pring shipping label process guide controller /// </summary> [WHSWorkExecuteMode(WHSWorkExecuteMode::VKPrintShippingLabel)] public class VKProcessGuidePrintShippingLabelController extends ProcessGuideController { protected ProcessGuideStepName initialStepName() { return classStr(VKProcessGuidePrintShippingLabelLPStep); } protected ProcessGuideNavigationRoute initializeNavigationRoute() { ProcessGuideNavigationRoute navigationRoute = new ProcessGuideNavigationRoute(); // In this case, the process is circular, after successful step execution we again ask for a license place to print another label navigationRoute.addFollowingStep(classStr(VKProcessGuidePrintShippingLabelLPStep), classStr(VKProcessGuidePrintShippingLabelLPStep)); return navigationRoute; } }
protected ProcessGuideNavigationAgentAbstractFactory navigationAgentFactory() { return new WHSProcessGuideSortPutawayNavigationAgentFactory(); }
protected void addControls(ProcessGuidePage _page) { super(_page); WhsrfPassthrough pass = controller.parmSessionState().parmPass(); WHSRFMenuItemTable menuItemTable = WHSRFMenuItemTable::find(pass.lookup(ProcessGuideDataTypeNames::MenuItem)); this.buildHeader(_page, menuItemTable, this.defaultFilter(pass)); this.buildTableContents(_page, menuItemTable, pass); this.buildPagingControls(_page, menuItemTable); }WHSProcessGuidePromptWaveLabelSeriesStep step class where you can find what item the user is clicked on controller.parmClickedData().
/// <summary> /// Builder page class for Print shippint label / Container ID step /// </summary> [ProcessGuidePageBuilderName(classStr(VKProcessGuidePrintShippingLabelContainerIdPageBuilder))] public class VKProcessGuidePrintShippingLabelContainerIdPageBuilder extends ProcessGuidePageBuilder { protected WhsrfPassthrough pass; protected void addDataControls(ProcessGuidePage _page) { // to access information in the pass if you need to display something pass = controller.parmSessionState().parmPass(); str successMessage = pass.lookupStr(VKProcessGuideDataTypeNamesPrintShippingLabel::VKSuccessMessage); if (successMessage) { _page.addLabel(VKProcessGuideDataTypeNamesPrintShippingLabel::VKSuccessMessage, successMessage, #WHSRFUndefinedDataType); pass.remove(VKProcessGuideDataTypeNamesPrintShippingLabel::VKSuccessMessage); } _page.addTextBox(ProcessGuideDataTypeNames::ContainerId, "@WAX1422", extendedTypeNum(WHSContainerId)); // Use to identify that process is in detour session if (this.isInDetourSession()) { } } protected void addActionControls(ProcessGuidePage _page) { _page.addButton(step.createAction(ProcessGuideActionNames::ActionOk), true); _page.addButton(step.createAction(ProcessGuideActionNames::ActionCancelExitProcess)); } }
/// <summary> /// The <c>VKProcessGuidePrintShippingLabelContainerIdStep</c> represents a step that prompts the user for container id information /// </summary> [ProcessGuideStepName(classStr(VKProcessGuidePrintShippingLabelContainerIdStep))] public class VKProcessGuidePrintShippingLabelContainerIdStep extends ProcessGuideStep { WhsrfPassthrough pass; WHSContainerTable containerTable; TMSRouteSegmentContainer routeSegmentContainer; WHSPrinterName printerName; protected boolean isComplete() { pass = controller.parmSessionState().parmPass(); boolean complete = true; if (complete && !containerTable.ShipCarrierTrackingNum) { this.addError("@TRX:NoShippingTrackingNumberFound"); complete = false; } else { routeSegmentContainer = containerTable.findRouteSegmentContainerVK(); } if (complete && !routeSegmentContainer.ContainerShippingLabel) { this.addError("@TRX:NoContainerShippingLabelFound"); complete = false; } if (complete) { printerName = this.identifyPrinterName(); if (!printerName) { this.addError("Unable to identify printer name."); complete = false; } } return complete; } protected void validateControls() { if (controller.parmClickedAction() == ProcessGuideActionNames::ActionOK) { this.validateContainerId(); } } private void validateContainerId() { WHSContainerId containerId = processingResult.fieldValues.lookupStr(ProcessGuideDataTypeNames::ContainerId); containerTable = WHSContainerTable::findByContainerId(containerId); if (!containerTable) { throw error(strFmt("@WAX:WHSProcessGuideScanParametersToPrintContainerLabelStep_ContNotExistError", containerId)); } } protected void doExecute() { super(); if (!processingResult.isErrorState && containerTable && routeSegmentContainer.ContainerShippingLabel) { TMSPrintContainerShippingLabel printShippingContainerLabel = TMSPrintContainerShippingLabel::createInstanceVK(routeSegmentContainer.ContainerShippingLabelType); printShippingContainerLabel.printLabel(printerName, routeSegmentContainer.ContainerShippingLabel); pass.insert(VKProcessGuideDataTypeNamesPrintShippingLabel::VKSuccessMessage, strFmt("Shipping label for container ID %1 sent to %2 printer.", containerTable.ContainerId, printerName)); pass.remove(ProcessGuideDataTypeNames::ContainerId); printerName = ''; containerTable.clear(); routeSegmentContainer.clear(); } } protected ProcessGuidePageBuilderName pageBuilderName() { return classStr(VKProcessGuidePrintShippingLabelContainerIdPageBuilder); } /// <summary> /// Identifies printer name by mobile device user and warehouse /// </summary> /// <returns>Printer name</returns> protected WHSPrinterName identifyPrinterName() { WHSWorkUserDefaultLabelPrinterTable workUserDefaultLabelPrinterTable; InventLocationId inventLocationId = InventDim::find(containerTable.InventDimId).InventLocationId; if (inventLocationId) { select firstonly RecId, PrinterName from workUserDefaultLabelPrinterTable where workUserDefaultLabelPrinterTable.UserId == pass.parmUserId() &&workUserDefaultLabelPrinterTable.InventLocationId == InventLocationId; } if (!workUserDefaultLabelPrinterTable) { select firstonly RecId, PrinterName from workUserDefaultLabelPrinterTable where workUserDefaultLabelPrinterTable.UserId == pass.parmUserId(); } return workUserDefaultLabelPrinterTable.PrinterName; } }
/// <summary> /// CoC extension for WhsrfPassthrough class /// WhsrfPassthrough "parm" extensions /// WHSRFPassthrough_Extension - standard /// WhsrfPassthroughProcessGuide_Extension - internal (why?) /// </summary> [ExtensionOf(classStr(WhsrfPassthrough))] final class VKWhsrfPassthrough_Extension { public WHSContainerId parmContainerIdVK(WHSContainerId _containerId = '') { if (!prmIsDefault(_containerId)) { this.insert(ProcessGuideDataTypeNames::ContainerId, _containerId); } return this.lookupStr(ProcessGuideDataTypeNames::ContainerId); } /// <summary> /// Cleans product inventory dimensions from the pass /// Work simular to: /// - initProductInventDimFromPass() /// - initInventDimFromPass() /// - initTrackingInventDimFromPass() /// - createProductInventDimFromPass() /// /// However they are internal/private /// </summary> public void cleanProductInventDimFromPassVK() { Enumerator fieldEnumerator = InventDim::dimProductDimFieldList().getEnumerator(); while (fieldEnumerator.moveNext()) { FieldId inventDimFieldId = fieldEnumerator.current(); FieldName fieldName = fieldId2name(tableNum(InventDim), inventDimFieldId); if (this.hasValue(fieldName)) { this.remove(fieldName); } } } }
/// <summary> /// CoC for ProcessGuideStep class /// </summary> [ExtensionOf(classstr(ProcessGuideStep))] final class VKProcessGuideStepCls_Extension { public void addError(str _error) { ProcessGuideMessageData processGuideMessageData = ProcessGuideMessageData::construct(); processGuideMessageData.message = _error; processGuideMessageData.level = WHSRFColorText::Error; processingResult.messageData = processGuideMessageData; processingResult.isErrorState = true; } public void addWarning(str _warning) { ProcessGuideMessageData processGuideMessageData = ProcessGuideMessageData::construct(); processGuideMessageData.message = _warning; processGuideMessageData.level = WHSRFColorText::Warning; processingResult.messageData = processGuideMessageData; } public void addMessage(str _message) { ProcessGuideMessageData processGuideMessageData = ProcessGuideMessageData::construct(); processGuideMessageData.message = _message; processGuideMessageData.level = WHSRFColorText::Success; processingResult.messageData = processGuideMessageData; } }
DaxOnline.org is free platform that allows you to quickly store and reuse snippets, notes, articles related to Dynamics AX.
Authors are allowed to set their own AdSense units.
Join us.