I would like to fill a few fields on the Start Production Activity form from variables.
This is how I have I have my code set up so far. I have a timer built in so the field won’t fill in until the form is open (not sure if this is necessary, but I thought that was why the field wasn’t getting filled in. I may be able to do this all in StartProdForm_Load).
Once I get the job field to work, I would like to also fill the assembly and operation fields, which are combo boxes.
public class Script
{
EpiTextBox txtJob;
public void InitializeCustomCode()
{
txtJob = (EpiTextBox)csm. GetNativeControlReference("2233c0f7-d359-4959-8387-2a9b8395149b");
}
Timer timer1 = new Timer();
public string job
{
get;
set;
}
// Pull barcode in from MESMenu
public void StartProdForm_Load(object sender, EventArgs e)
{
if(StartProdForm.LaunchFormOptions != null)
{
object barcodeObj = StartProdForm.LaunchFormOptions.ContextValue;
// Convert barcode (object to string)
string barcode = barcodeObj.ToString();
// Split barcode into parts
var items = barcode.Split('-');
string job = items[1];
string asm = items[2];
string opr = items[3];
this.timer1.Interval = 5000;
timer1.Start();
}
}
public void timer1_Tick(object sender, EventArgs e)
{
timer1.Stop();
// Fill fields
txtJob.Text += job;
}
}
It didn’t work with the timer as well…I don’t love the idea of a timer because if the form takes too long to load then it might not enter the data, but the timer can’t be too long. Is there an event that confirms that the form has been loaded?
Yeah timers are awful. Why are you passing this data via the LFO? What’s the end goal? to SCan something in the Main MES Menu and have it automatically start activity?
Yes, I would like to scan a barcode at the MES menu, have it open up Start Activity, and parse the job number, assembly, and operation into the fields and clock the employee onto the job.
I’m not quite sure how to go about that. I tried creating another method called StartProdForm_Start where the filling of fields would happen. No luck. I am not sure what you mean by NotifyEvent?
Application Error
Exception caught in: Erp.UI.StartProductionActivityEntry
Error Detail
============
Message: Object reference not set to an instance of an object.
Program: Erp.UI.StartProductionActivityEntry.dll
Method: LaborDtl_ColumnChanging
Client Stack Trace
==================
at Erp.UI.App.StartProductionActivityEntry.StartProdTransaction.LaborDtl_ColumnChanging(Object sender,
DataColumnChangeEventArgs e)
at System.Data.DataTable.OnColumnChanging(DataColumnChangeEventArgs e)
at Erp.BO.LaborDataSet.LaborDtlDataTable.OnColumnChanging(DataColumnChangeEventArgs e)
at System.Data.DataRow.set_Item(DataColumn column, Object value)
at System.Data.DataRowView.SetColumnValue(DataColumn column, Object value)
at System.Data.DataRowView.set_Item(String property, Object value)
at Script.edvStart_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
at Ice.Lib.Framework.EpiViewNotification.Invoke(EpiDataView view, EpiNotifyArgs args)
at Ice.Lib.Framework.EpiDataView.OnEpiViewNotification(EpiNotifyArgs e)
at Ice.Lib.Framework.EpiDataView.Notify(EpiNotifyArgs args)
at Erp.UI.App.StartProductionActivityEntry.StartProdTransaction.StartActivity(String hed)
A couple questions. Are you passing values into lfo like lfo.ValueIn = “my-values”;
And calling the form passing the lfo like:
ProcessCaller.LaunchForm(this, “Epicor.Mfg.UI.EndActivityEntry”, launchObject);
Have you tested to ensure that your lfo has the values on the receiving form:
object barcodeObj = StartProdForm.LaunchFormOptions.ContextValue;
MessageBox.Show(barcodeObj.ToString());
I assume that “Start” is a valid EpiDataView on that form (in object explorer > data):
var startDV = oTrans.Factory(“Start”);
Yes start is a valid data view the issue is that he is firing this before all the stuff is loaded in the screen. @fredmeissner you may have to resort to that timer… or just move all the logic to the main MES form.
We just did a project where they wanted to minimize the clicks on MES.
So we had the shortcut launch the custom form and do all the work directly on it.
This is like the holy grail for barcode nerds. No one has been able to figure this out that I have seen so far. I hope you do so I can steal it. Hahaha!
LoL @Banderson I’ve done it however not by launching Start Activity form, just put the code in the MES menu itself. It was a pretty cool customization but it took a lot of code