Fill in labor qty in MES work queue, BPM or customization?

The work queue from 10.0 to 10.1 changed a little bit and now the labor qty does not automatically fill in to match the Qty Left field. This will cause to consternation in the shop so I’m trying to recreate this behavior.

Is this something I can do with a BPM? Keeping in mind I only want to default the grid value to start with and than allow changes before ending actually activity. I’ve been trying to use the WorkQueue method and that seems like a dead end. Next I’m going to go to the labor BO, but I’m not sure if I’ll be able to do it there either.

I’m sure I can do it with a customization and a button, but BPM’s are easier to manage for me. So I was wondering what others opinions are on this.

So I have everything working in the customization except I don’t know how to set the value in the grid. (I know, it’s not hard, I just have no programming experience so I need help with the basics).

Here’s the code that I have so far. I works in the sense that I can get the value to return to a message box and it’s looping through based on what I have selected, so I have the button and grid set correctly. I’m sure I have some casting issues I will have to deal with because labor quantity will need to be a decimal value. What road should I go down to set the grid values of “QtyLeft” into the cells for “LaborQty”? I’ve been reading about DataBinding, but I don’t think that is what I really want.

As always, any help will be appreciated.

// **************************************************
// Custom code for WorkQueueForm
// Created: 5/23/2016 11:46:30 AM
// **************************************************

extern alias Erp_Contracts_BO_EmpBasic;
extern alias Erp_Contracts_BO_ResourceGroup;
extern alias Erp_Contracts_BO_Resource;

using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.UI;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;

public class Script
{
	// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
	// Begin Wizard Added Module Level Variables **

	// End Wizard Added Module Level Variables **

	// Add Custom Module Level Variables Here **

EpiUltraGrid ActiveWorkGrid;
String QtyTransfer;
EpiButton SetLaborQtyButton;

	public void InitializeCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization

		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls


		// End Wizard Added Custom Method Calls
	
ActiveWorkGrid = (EpiUltraGrid)csm.GetNativeControlReference("0ab9e2d6-9433-4727-a6b8-730113cbe9a0");
SetLaborQtyButton = (EpiButton)csm.GetNativeControlReference("a7ea877b-9517-4dab-9273-4643af828ed6");
SetLaborQtyButton.Click += new EventHandler(NewLaborQty);
		
	}

	public void DestroyCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
		// Begin Wizard Added Object Disposal


		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal

		// End Custom Code Disposal
SetLaborQtyButton.Click += new EventHandler(NewLaborQty);

	}

	private void NewLaborQty(object sender, EventArgs args)
	{
		// ** Place Event Handling Code Here **
		foreach(var row in ActiveWorkGrid.Rows)
		{
			if(row.Selected)
			{
			QtyTransfer = row.Cells["QtyLeft"].Value.ToString();
			//I want to set the column "LaborQty" to QtyTransfer here
			MessageBox.Show(QtyTransfer); //This message box will go away once I get this working.
			}
		}
	}
}

row.Cells[“QtyLeft”].Value = 1;

If column expects a decimal use M after the number - like 1.2345M

I don’t want it to be 1. I want LaborQty to be what QtyLeft is. I am able to get the QtyLeft value out I just need to set the LaborQty to match that value

I changed this to the code below, and I can set the first row with Rows[0]. Now I just need to made the rows dynamic to be match the row that the value came from. I thought this would be row, but it’s not working. Do I need to get the row number as I get the QtyLeft value and pass that through?

    {
		// ** Place Event Handling Code Here **
		foreach(var row in ActiveWorkGrid.Rows)
		{
			if(row.Selected)
			{
			QtyTransfer = row.Cells["QtyLeft"].Value.ToString();
			ActiveWorkGrid.Rows[0].Cells["LaborQty"].Value = QtyTransfer;
			MessageBox.Show(QtyTransfer); //This message box will go away once I get this working.
			}
		}
	}

Ok, so I got it working. Here is the code for anyone interested.

// **************************************************
// Custom code for WorkQueueForm
// Created: 5/23/2016 11:46:30 AM
// **************************************************

extern alias Erp_Contracts_BO_EmpBasic;
extern alias Erp_Contracts_BO_ResourceGroup;
extern alias Erp_Contracts_BO_Resource;

using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.UI;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;

public class Script
{
	// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
	// Begin Wizard Added Module Level Variables **

	// End Wizard Added Module Level Variables **

	// Add Custom Module Level Variables Here **

EpiUltraGrid ActiveWorkGrid;
String QtyTransfer;
EpiButton SetLaborQtyButton;
int RowNum;


	public void InitializeCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization

		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls


		// End Wizard Added Custom Method Calls
	
ActiveWorkGrid = (EpiUltraGrid)csm.GetNativeControlReference("0ab9e2d6-9433-4727-a6b8-730113cbe9a0");
SetLaborQtyButton = (EpiButton)csm.GetNativeControlReference("a7ea877b-9517-4dab-9273-4643af828ed6");
SetLaborQtyButton.Click += new EventHandler(NewLaborQty);
		
	}

	public void DestroyCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
		// Begin Wizard Added Object Disposal


		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal

		// End Custom Code Disposal
SetLaborQtyButton.Click += new EventHandler(NewLaborQty);

	}

	private void NewLaborQty(object sender, EventArgs args)
	{
		// ** Place Event Handling Code Here **
		RowNum = -1;
		foreach(var row in ActiveWorkGrid.Rows)
		{
		RowNum = RowNum +1;
			if(row.Selected)
			{
			QtyTransfer = row.Cells["QtyLeft"].Value.ToString();
			ActiveWorkGrid.Rows[RowNum].Cells["LaborQty"].Value = QtyTransfer;
			}
		}
	}
}
1 Like