This article describes how to display information related to the sales order line level after selecting the item in Ad-Hoc picking.
On my sales order lines, I got a field named "U_RemarkToPicker" to give instruction to warehouse picker for every sales order line.
I will then show that field on the mobile device when a picker will select a line, but only if there is a value to show.
Changing the workflow script
There is a HookScript in the system that is triggered after selecting an item.
Click on "Edit" button for the script AdHocAfterItemToPickSelectedHookScript from Organizational Structure > Company object > Workflows tab, and replace the content of the script by the script below.
For Picking flow you can use PickingAfterItemToPickIdentifiedHookScript.
The example code was made for the AdHoc process.
You can customize the select query to meet your expectations.
I am using two variables
- DataRow value 5 is my sales order line number (RDR1.LineNum)
- DataRow value 6 is my sales order code (RDR1.DocEntry)
- DataRow value 7 is my object type (17 for Sales Order)
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data;
using System.Globalization;
using System.Reflection;
using System.Text;
using System.Transactions;
using Produmex.Foundation;
using Produmex.Foundation.Barcode;
using Produmex.Foundation.Data;
using Produmex.Foundation.Data.Sbo;
using Produmex.Foundation.Data.Sbo.BusinessObjects;
using Produmex.Foundation.Data.Sbo.BusinessObjects.Convertors;
using Produmex.Foundation.Data.Sbo.BusinessObjects.Definitions;
using Produmex.Foundation.Data.Sbo.BusinessObjects.Definitions.Tables;
using Produmex.Foundation.Data.Sbo.DataObjects;
using Produmex.Foundation.Data.Sbo.Providers;
using Produmex.Foundation.Data.Sbo.Utilities;
using Produmex.Foundation.Data.SqlClient;
using Produmex.Foundation.Diagnostics;
using Produmex.Foundation.GS1;
using Produmex.Foundation.Messages;
using Produmex.Foundation.SlimScreen;
using Produmex.Foundation.SlimScreen.Interfaces;
using Produmex.Foundation.SlimScreen.Interfaces.Definitions;
using Produmex.Foundation.SlimScreen.Interfaces.Definitions.DataObjects;
using Produmex.Foundation.SlimScreen.Interfaces.Definitions.KnownDataSets;
using Produmex.Foundation.SlimScreen.WinGui;
using Produmex.Foundation.Utilities;
using Produmex.Foundation.Workflows;
using Produmex.Foundation.Workflows.Parameters;
using Produmex.Foundation.Wwf.Sbo;
using Produmex.Foundation.Wwf.Sbo.DataObjects;
using Produmex.Foundation.Wwf.Sbo.LocalServices;
using Produmex.Sbo.Logex.Data.BusinessObjects;
using Produmex.Sbo.Logex.Data.BusinessObjects.Definitions;
using Produmex.Sbo.Logex.Data.BusinessObjects.Definitions.Tables;
using Produmex.Sbo.Logex.Data.DataObjects;
using Produmex.Sbo.Logex.Data.Devices;
using Produmex.Sbo.Logex.Data.Generators.BatchNumberGenerators;
using Produmex.Sbo.Logex.Data.Generators.PackingController;
using Produmex.Sbo.Logex.Data.Providers;
using Produmex.Sbo.Logex.Data.ViewObjects.Definitions.Views;
namespace Produmex.Sbo.Logex.WorkflowScripts
{
public class WorkflowScript_AdHocAfterItemToPickSelectedHookScript : WorkflowInstanceScriptBase
{
private static readonly ILog s_log = LogProvider.GetLogger(MethodInfo.GetCurrentMethod().DeclaringType);
// Input parameters * do not change *
public ReadOnlyBinder<CultureInfo> DefaultCultureInfo;
public ReadOnlyBinder<PmxOseCompany> PmxOseCompany;
public ReadOnlyBinder<PmxItemInfo> ItemInfo;
public ReadOnlyBinder<int> PickListDocEntry;
public ReadOnlyBinder<string> PmxWhsCode;
public ReadOnlyBinder<DataRow> SelectedProductDataRow;
// Output parameters * do not change *
public ReadWriteBinder<bool> BackRequested;
// Sub-flows
// <none>
public WorkflowScript_AdHocAfterItemToPickSelectedHookScript(WorkflowInstanceBase parent, WorkflowInstanceFactory factory)
: base(parent, factory)
{
}
#region WorkflowInstanceScriptBase Members
protected override void Execute()
{
// Parameters in scope
Session session = GetScopeParameter("Session") as Session;
ISboProviderService sboProviderService = GetScopeParameter("<WwfService>ISboService") as ISboProviderService;
string initialErrorKey = null;
Message msg = null;
DataSet dsItems = null;
string TextToShow = null;
If (SelectedProductDataRow.Get()[7].ToString() = 17)
string query = "SELECT U_RemarkToPicker as TextToShow FROM RDR1 WHERE 1=1 AND DocEntry = '" + SelectedProductDataRow.Get()[6].ToString() + "' And LineNum = '" + SelectedProductDataRow.Get()[5].ToString() + "'";
msg = null;
dsItems = sboProviderService.RunView(false, null, null, query);
if ( dsItems.Tables.Count > 0 )
TextToShow = dsItems.Tables[0].Rows[0]["TextToShow"].ToString();
if (TextToShow.Length > 0 )
{
msg = null;
session.ShowScreen(typeof(Produmex.Foundation.SlimScreen.Interfaces.IShowMessageScreen),
this.DefaultCultureInfo, BuildParamCollection(
"MessageKey", "Info to picker: " + dsItems.Tables[0].Rows[0]["TextToShow"].ToString(),
"ShowButton", true
));
msg = WaitForMessage();
}
}
#endregion
}
}
Comments
0 comments
Please sign in to leave a comment.