BPM/Code to display message on the MES

I am new to custom code within E10 so please be gentle…

To deal with issues with employees not reading operation comments on printed route cards and potentially missing important operation comments I have been asked to add a pop up on the MES to display the comments when they start production activity. I have managed to get this working with the code below via a bpm that executes custom code as below.


**Erp.Tables.JobOper JobOper;

foreach (var ttLaborDtlRow in ttLaborDtl)
{
foreach (var LaborDtl_iterator in (from JobOper_Row in Db.JobOper
where JobOper_Row.Company == ttLaborDtlRow.Company
&& JobOper_Row.JobNum == ttLaborDtlRow.JobNum && JobOper_Row.AssemblySeq == ttLaborDtlRow.AssemblySeq && JobOper_Row.OprSeq == ttLaborDtlRow.OprSeq
select JobOper_Row))
{
string msg =LaborDtl_iterator.CommentText;
this.PublishInfoMessage(msg, Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, “”, “”);
callContextBpmData.Character01=LaborDtl_iterator.CommentText;
}

}**

This works on the MES, the user starts the activity and the comment is displayed with an ok message.

However for more lengthy comments this only displays 120 characters of text and the user then has to scroll down. My first thought was to use a bpm data form with customization to get this to work - hence the last line setting the call context field. If I link a bpm data form the bpm saves and compiles. But when I try and start an operation I get the following messages

“MenuID Ice.UI.InfoPromptForm is not valid from the MES menu”

and

“The value for column “Buttonvalue” in table BPMData is DBNull”

I get this even if I call a BPM data form that does nothing other than display the word “Test” and an ok button.

I’m guessing that you cannot call BPM Data forms in the MES?!?!

Can anyone point me in the direction of how to get a message box that shows much more of the comments - say 500 chars via a bpm/custom code.

Alternatively if someone has achieved the same thing via a different means, would you mind sharing?

Any help will be greatly appreciated.

I know there was a bug in 10.0.700.4 that prevented BPM data forms being displayed from MES.

I can say this is fixed in the version we are currently on (10.1.500.14).

Thanks for the reply. Unfortunately we are stuck on 10.0.700.4 with no maintenance.

You could dynamically create a form, slap on a text box or label and
populate. You could even have it read that from a text file so you can
update without recompile. When I get to a PC I’ll try to get you some
sample code

This is an example of a dynamic user form. I use this as a modal dialog.

You can modify the form size, the text box size (or change to a different control type). It’s just an option if all else fails.

private static DialogResult ShowInputDialog(ref string input)
    {
        System.Drawing.Size size = new System.Drawing.Size(350, 70);
        Form inputBox = new Form();

        inputBox.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
        inputBox.ClientSize = size;
        inputBox.Text = "Comments";

        System.Windows.Forms.TextBox textBox = new TextBox();
        textBox.Size = new System.Drawing.Size(size.Width - 10, 23);
        textBox.Location = new System.Drawing.Point(5, 5);
        textBox.Text = input;
        inputBox.Controls.Add(textBox);

        Button okButton = new Button();
        okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
        okButton.Name = "okButton";
        okButton.Size = new System.Drawing.Size(75, 23);
        okButton.Text = "&OK";
        okButton.Location = new System.Drawing.Point(size.Width - 80 - 80, 39);
        inputBox.Controls.Add(okButton);

        Button cancelButton = new Button();
        cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
        cancelButton.Name = "cancelButton";
        cancelButton.Size = new System.Drawing.Size(75, 23);
        cancelButton.Text = "&Cancel";
        cancelButton.Location = new System.Drawing.Point(size.Width - 80, 39);
        inputBox.Controls.Add(cancelButton);

        inputBox.AcceptButton = okButton;
        inputBox.CancelButton = cancelButton; 

        DialogResult result = inputBox.ShowDialog();
        input = textBox.Text;
        return result;
    }
3 Likes

Chris,

Thank you so much for sharing this.

I will give it a bash and let you know how I get on.

Chris I managed to get this working by adding to the OK button on the Start Production Activity Screen. All works great. Thanks so much for your help

1 Like