JobMtl BPM

In E9 MRP would raise Jobs when Parts within the JobMtl table were OnHold - eg Part.OnHold = True.
This allowed for scheduling and capacity planning of Jobs that were still to be worked on in some fashion.
In E10 MRP bombs out at the GetDetails stage and only creates an UnFirm Job with no method of manufacture.
To workaround this I have;

  1. Removed all Part.OnHold
  2. Created a UD field to mirror the Part.OnHold
  3. Created a BPM that checks if any JobMtl has the Part.UD_OnHold checkbox checked.
    This is working fine but what I would like to add to this is an output within the Message Box of all the Parts that are UD_OnHold.
    Does anyone know how I can achieve this.?
    Roberto

Where are you looking for the output? In the MRP logs?

I output to a MessageBox.

So to clarify you want to output a messagebox from the MRP Process?

When the Job is Released we pop up a message box stating that there is at least one JobMtl with Part.UD_OnHold True - how can I capture the list of Parts and display list within this message box?

if i were you i will build a BAQ to show me the full list, however you can create a BPM to show all parts in a show message triggered at any Job Entry released method, but this could be confusing as your UI is dealing with one Job Row at the time of the BPM execution, unless you mean all Parts in JobMtl which related to the PartNum on JobHead, then please screen shot some of your development/code and its output here so we can look at it.

BPM


Condition 0
The ttJobHead.JobReleased field has been changed from False to True

Condition 1
Number of rows in the JobMtl query is not equal to 0

ERP.Part criteria
CheckBox02 = true
Or
OnHoldReason_c <> “”

This BPM works but when it returns an exception I would like to publish to the planner the list of Parts that are in the exception state rather than the current generic message.

Roberto.

Hi @rppmorris
i do not know if you are familiar with C# custom code or not, so to answer your question yes you can list your material part numbers which match your criteria, but you need to code this, i have created many BPM’s on JobEntry BO to do similar things, i have modified one of them to suit your use, just paste it in a custom code widget and replace it with your exception widget only, then save and see if it is compile, if yes please test it and let me know,

Erp.Tables.JobHead JobHead;
Erp.Tables.JobOper JobOper;
Erp.Tables.JobMtl JobMtl;
Erp.Tables.Part Part;
string sMtlPartNum = string.Empty;

var ttJobHead_xRow = (from ttJobHead_Row in ttJobHead
where ttJobHead_Row.Company == Session.CompanyID
&& (ttJobHead_Row.Updated()
|| ttJobHead_Row.Added())
select ttJobHead_Row).FirstOrDefault();
if (ttJobHead_xRow != null)
{
JobOper = (from JobOper_Row in Db.JobOper
where JobOper_Row.Company == ttJobHead_xRow.Company
&& JobOper_Row.JobNum == ttJobHead_xRow.JobNum
select JobOper_Row).FirstOrDefault();
if (JobOper != null)
{
foreach (var JobMtl_iterator in (from JobMtl_Row in Db.JobMtl
where JobMtl_Row.Company == ttJobHead_xRow.Company
&& JobMtl_Row.JobNum == ttJobHead_xRow.JobNum
&& JobMtl_Row.AssemblySeq == JobOper.AssemblySeq
select JobMtl_Row).ToList())

		if (JobMtl_iterator != null)
		{

	Part = (from Part_Row in Db.Part
				where Part_Row.Company == ttJobHead_xRow.Company
				&& Part_Row.PartNum == JobMtl_iterator.PartNum
      select Part_Row).FirstOrDefault();
	
				if (Part != null && (Part_Row.CheckBox02==true OR (Convert.ToString(Part["OnHoldReason_c"])) != null))
				{
						sMtlPartNum = sMtlPartNum + " _ " + JobMtl_iterator.PartNum;				
				}
		}
						if (sMtlPartNum != null)
							{

CallContext.Current.ExceptionManager.AddBLException("The following material part No’s: " + sMtlPartNum + " is/are on hold ");

							}
}		

}

Thanks.
I receive the following compilation errors.


replace this line by this
if (Part != null && (Part.CheckBox02==true || (Convert.ToString(Part[“OnHoldReason_c”])) != null))

also save the BPM enabled will give more details about the error if exist

There is at least one compilation error.
Update.Pre.Validate_-JobMt.cs(200,78): error CS1056: Unexpected character ‘“’
Update.Pre.Validate
-JobMt.cs(200,93): error CS1056: Unexpected character ‘”’
Update.Pre.Validate
-_JobMt.cs(200,79): error CS0103: The name ‘OnHoldReason_c’ does not exist in the current context

normal double quotations " " not this ‘”’, my last copy-paste changed them sorry
image

Code compiles :slight_smile:

The message box however lists all Parts - not only the exceptions.

check your logic on the conditions on this code line, be sure
if (Part != null && (Part.CheckBox02==true || (Convert.ToString(Part[“OnHoldReason_c”])) != null))

and to help on that you can show both values within the loop to check your list one by one:

I have added in the error checking message box - but it appears I bypass it and siply display a list of all Parts within JobMtl.

Code as follows:
Erp.Tables.JobHead JobHead;
Erp.Tables.JobOper JobOper;
Erp.Tables.JobMtl JobMtl;
Erp.Tables.Part Part;
string sMtlPartNum = string.Empty;

var ttJobHead_xRow = (from ttJobHead_Row in ttJobHead
where ttJobHead_Row.Company == Session.CompanyID
&& (ttJobHead_Row.Updated()
|| ttJobHead_Row.Added())

select ttJobHead_Row).FirstOrDefault();
if (ttJobHead_xRow != null)
{
JobOper = (from JobOper_Row in Db.JobOper
where JobOper_Row.Company == ttJobHead_xRow.Company
&& JobOper_Row.JobNum == ttJobHead_xRow.JobNum

select JobOper_Row).FirstOrDefault();
if (JobOper != null)
{
foreach (var JobMtl_iterator in (from JobMtl_Row in Db.JobMtl
where JobMtl_Row.Company == ttJobHead_xRow.Company
&& JobMtl_Row.JobNum == ttJobHead_xRow.JobNum
&& JobMtl_Row.AssemblySeq == JobOper.AssemblySeq

select JobMtl_Row).ToList())
if (JobMtl_iterator != null)
{
Part = (from Part_Row in Db.Part
where Part_Row.Company == ttJobHead_xRow.Company
&& Part_Row.PartNum == JobMtl_iterator.PartNum

select Part_Row).FirstOrDefault();
if (Part != null && (Part.CheckBox02==true || (Convert.ToString(Part["OnHoldReason_c"])) != null))
{
PublishInfoMessage(" Part No.: " + JobMtl_iterator.PartNum + " Mtl Seq.:" + JobMtl_iterator.MtlSeq + " CheckBox02: " + Part.CheckBox02 + " Part OnHoldReason: " + Part["OnHoldReason_c"], Ice.Common.BusinessObjectMessageType.Error, Ice.Bpm.InfoMessageDisplayMode.Individual, "JobEntry","ChangeJobHeadJobReleased");

sMtlPartNum = sMtlPartNum + " _ " + JobMtl_iterator.PartNum;
}
}
if (sMtlPartNum != null)
{
CallContext.Current.ExceptionManager.AddBLException("The following material part No’s: " + sMtlPartNum + " is/are on hold ");
}
}
}

could you print screen the output full message, also could change the word null in the condition line to “”

Output message as follows:

Capture5

i see, have you changed null to normal double quotations symbol as per my last suggestion ?

Changing the null to “” has returned.

Capture7

This Part has CheckBox02 ticked.
Part AE5507AA has OnHoldReason_c = 2 but does not display.