Multiple MES Customizations

I am trying to create different MES customization for different areas of the company (in classic mode). Each area needs to be able to “Report Quantity” in a unique way. For example, early in the process they will report quantity in individual units, later in different area they need to Report Quantity into PCIDs.

So I need to be able to apply different customizations to the “Report Quantity” button in the production area of MES. I have tried to create my own buttons and use ProcessCaller.LaunchForm(MESMenu, “PR000077”). I created copies of menuID “PR000077” (Report Quantity) and applied different customizations. Then in the different main MES customizations I would replace PR000077 with the new menuID. These always open the form in a read only state.

I believe the PR000077 creates some LaborHed and LaborDtl items and passes those in, but my copies do not.

Using Process Calling Maintenance does bring up the customization, but I don’t know how to change that in the context of the unique main MES customizations.

Any help on how to solve this would be greatly appreciated.

Thanks!!

This should help

	// ** 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 **
	
	EpiDataView                edvLaborHed;
	EpiDataView                edvLaborDtl;


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

		your_btnReportQty.Click += new System.EventHandler(your_btnReportQty_Click);

		// End Wizard Added Variable Initialization
		// Begin Wizard Added Custom Method Calls
		// End Wizard Added Custom Method Calls

		edvLaborHed = ((EpiDataView)(oTrans.EpiDataViews["LaborHed"]));
		edvLaborDtl = ((EpiDataView)(oTrans.EpiDataViews["LaborDtl"]));
	}

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

		your_btnReportQty.Click -= new System.EventHandler(your_btnReportQty_Click);

		// End Wizard Added Object Disposal
		// Begin Custom Code Disposal

		edvLaborHed = null;
		edvLaborDtl = null;

		// End Custom Code Disposal
	}


	//Report Qty
	private void your_btnReportQty_Click(object sender, System.EventArgs args)
	{
		if(edvLaborHed.Row > -1 && ((EpiDataView)oTrans.EpiDataViews["LaborDtl"]).Row > -1)
		{
			LaunchFormOptions lfo = new LaunchFormOptions();
			lfo.IsModal = false;
			lfo.SuppressFormSearch = true;

			string laborHed = edvLaborHed.CurrentDataRow["laborHedSeq"].ToString();
			string laborDtl = edvLaborDtl.CurrentDataRow["laborDtlSeq"].ToString();

			StringDictionary myDict = new StringDictionary();
			
			//Report Qty
			myDict.Add("laborhead", laborHed);
			myDict.Add("labordet", laborDtl);
			myDict.Add("jobover", "False");

			lfo.ValueIn = myDict;
			object res = ProcessCaller.LaunchForm(oTrans, "PR000077", lfo);
		}
	}

Kevin, thanks for the reply. I think I am very close but I am hung up on a couple of things. 1st, we don’t want the users to have to “Start Production Activity” just be able to report quantity. Meaning there is no LaborDtl record started at the time the button is being clicked. The code errors out at that point.

How can I start a Labor Dtl record at this part of the code? Is there a shortcut to that?

Once I am past that, can you specify a customization to use in the LaunchFormOptions()?

No, what you’ll want to do is create a new menu item, assign the customization to that, and launch that menu id the same way.

I’m working on your other question. The short answer is no shortcut.

You are going to have to start production activity. Either through the MES, or through code.

Why would you have employees report quantity without having them logged into a job?

You can select the job in the “Report Qty” screen. This is actually going to be an employee sitting in a fork lift with a long range scanner. The plan is for them drive up to a machine, scan a bar code for job number, then scan a PCID, then pick up the material and put it away. The 2 scans will be reporting qty. Then they will go to next machine (different job and different part). Having to start and end activity for each job is too much. Plus their time on a specific job is not relevant.

Maybe someone else will chime in, but if you’re going to use the Report Qty Screen, you’re going to have to have an active laborHed and laborDtl for the job you are on.

You can obtain this with Start Production Activity of course, and end with End Activity.
That being said, that’s not the only way to do it.

Here is one way to do it:

  1. Log in to MES
  2. Have a prompt/box on the MES screen that accepts your job number. (from scan)
  3. From that event, code using the Erp.BO.LaborImpl,StartActivity to create your labor dtl record
  4. Open ReportQty Modal. When the laborDtl record is created/job opened, pass that and open Report Qty and do your actions
  5. When Report Qty is closed, use the same BO to end activity.
  6. Move on to the next machine and scan again

You could also do the steps above but instead of the report qty screen, use the proper BO to report qty
The other steps will be basically the same. You’ll need a laborhed and labordtl regardless to report qty.

Kevin, thanks for your help, I figured it out, and feeling pretty silly. Was way over thinking it. Slight tweak to your code, just have to pass a 0 in for LaborDtlSeq.

Now I just need swap out MenuID in here => ProcessCaller.LaunchForm(MESMenu, “UDRptQty”, lfo);

Overall, I have a copy of the MES menu item for each of the different areas, each with there own customization. I also have a copy of the Repot Qty menu item for each are with it’s own customization.

Then in each MES customization I point to the appropriate Report Qty customization.

It just works now.

	private void btnTest2_Click(object sender, System.EventArgs args)
	{

		LaunchFormOptions lfo = new LaunchFormOptions();
		lfo.IsModal = false;
		lfo.SuppressFormSearch = true;

		string laborHed = edvLaborHed.CurrentDataRow["laborHedSeq"].ToString();

		CallLaborAdapterGetNewLaborDtlNoHdrMethod();

		string laborDtl = "0" ;

		StringDictionary myDict = new StringDictionary();
		
		//Report Qty
		myDict.Add("laborhead", laborHed);
		myDict.Add("labordet", laborDtl);
		myDict.Add("jobover", "False");

		lfo.ValueIn = myDict;


		object res = ProcessCaller.LaunchForm(MESMenu, "UDRptQty", lfo);
		
	}

I’m assuming this creates a new labordtl record. Why not pass it in? I’m not sure how happy the system is going to be with 0.

It doesn’t leave it at zero, as soon as you hit OK button it saves it as a new LaborDtl record with an appropriate number. Just like Sales Order starts as zero until you hit save the first time.

I’ll have to try that out.

You can probably remove that CallLaborAdapterGetNewLaborDtlNoHdrMethod(); then

I DID! Sorry for got to take that out of the code I posted.