I’ve created a standard DD on the JobOper table. If the new operation is subcontract to a specific vendor it creates a new Purchase Order & Line.
The issue is that it’s not updating some fields like it would if I were to manually enter the PO. Specifically the Summary fields on the Summary tab.
Here’s a manual PO, with updated summary fields:
Here’s one created using the Data Directive:
If I go look at the line\release details, they are exactly the same.
During a manual PO entry, my trace says the methods called, in order, are:
GetNewPOHeader
ChangeVendor
CheckBeforeUpdate
Update
GetNewPODetail
ChangeDetailTransType
ChangeDetailJobNum
ChangeDetailAssemblySeq (if not 0)
ChangeDetailJobSeq
CheckBeforeUpdate
Update
I’ve recreated all these steps, following my trace:
Any ideas or suggestions would be appreciated! TIA!
Chris_Conn
(Chris Conn)
October 12, 2020, 7:07pm
2
Do you see the lines created and the costs associated with them?
Yes, I believe so. If I open the PO and go to the line detail, it displays the costs:
Chris_Conn
(Chris Conn)
October 12, 2020, 7:16pm
4
Before your final update, try to dirty the RowMod (“U”) on the PO header
Like this?
var POApproveSwitchDataSet = POtable;
Erp.Contracts.POSvcContract hPOApproveHandle = null;
if (hPOApproveHandle == null) {
hPOApproveHandle = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.POSvcContract>(Db);
}
var intPONum = POtable.POHeader.FirstOrDefault().PONum;
if (POApproveSwitchDataSet != null) {
POApproveSwitchDataSet.POHeader[0].RowMod= "U";
hPOApproveHandle.CheckBeforeUpdate(out str2, out str3, out str4, "POHeader", POApproveSwitchDataSet);
hPOApproveHandle.Update(ref POApproveSwitchDataSet);
}
I tried it, this didn’t work for me but maybe my code is wrong? My programming skill is somewhere between total noob and beginner.
Chris_Conn
(Chris Conn)
October 12, 2020, 7:32pm
6
You still need that Update at the end though.
Chris_Conn
(Chris Conn)
October 12, 2020, 7:33pm
7
Nm i see its in the code. That looks right.
Yeah, no luck. Still get the same results. Line\Rel look good but it’s not updating the summary. I’ve tried everything I could think of, except coding out the entire thing. I’m not sure I have the skills to pull it all together in code.
I think I could code the methods, but not sure how to create the PO Header \ Line in code.
Chris_Conn
(Chris Conn)
October 12, 2020, 7:52pm
9
Still looking thru the code to see if I can find where those are updated.
1 Like
I’m doing this as a Standard Data Directive on the JobOper table, I created a POtableset variable on the GetNewPOHeader
, named POtable
, and I’m using this tableset throughout the BPM.
Maybe another hint? I closed the order and it updated the summary to a negative number:
When I reopen the order\line it jumps back to zero:
Arul
(Arul Shankar)
October 12, 2020, 10:20pm
12
Please change the BPM to Method Directive instead of Data Directive. There are few limitations in Data Directive. I encountered similar issues with JobAsmbl cost/hour not updating , PartTran not updating ExtCost, etc when using Data Directive.
@Arul , I need this to look at every operation in every job, regardless of how the job is made. That’s why I would like to use Data Directive… if possible. Do you know how I could accomplish this goal using method directive(s)?
I believe our jobs are made in 3 different ways. OrderJobWizard, JobEntry or QuickJobEntry.
I’m assuming I would need 3 method directives then, one for each process? Sounds like too much work lol.
Example:
QuickJobEntry.GenerateJob
OrdJobWiz.CreateJobs
JobEntry.Update
Arul
(Arul Shankar)
October 13, 2020, 9:02pm
14
That’s correct, you need to create three different Method Directive. If you are on 10.2.500 or above, you can create BPM Functions and call from three different methods. Copy the current BPM and Paste in one of the Post-Processing QuickJobEntry.GenerateJobs and modify the parameter.
1 Like
BPM Functions? I’ll have to look into that, we are on 10.2.500
Good news though, I decided to give up on the singular Data Directive, tried using a Method Directive and it works perfectly!!
Here’s the working code I pieced together for QuickJobEntry.GenerateJob, I’m sure with a little editing it will work on the other 2 methods as well.
Erp.Tables.JobOper JobOper;
Erp.Tables.JobAsmbl JobAsmbl;
Erp.Contracts.POSvcContract hPOApproveHandle = null;
if (hPOApproveHandle == null)
{
hPOApproveHandle = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.POSvcContract>(Db);
}
foreach (var ttQuickJob_iterator in (from ttQuickJob_Row in ttQuickJob
select ttQuickJob_Row))
{
var ttQuickJobRow = ttQuickJob_iterator;
JobOper = (from JobOper_Row in Db.JobOper
where string.Compare(JobOper_Row.JobNum, ttQuickJobRow.JobNum, true) == 0
select JobOper_Row).FirstOrDefault();
if(JobOper == null)
{
this.PublishInfoMessage("No job information!!", Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");
}
if(JobOper != null)
{
var PODataSet = new Erp.Tablesets.POTableset();
string JobNum = JobOper.JobNum;
int AssemblySeq = JobOper.AssemblySeq;
int OprSeq = JobOper.OprSeq;
string PartNum = JobOper.PartNum;
hPOApproveHandle.GetNewPOHeader(ref PODataSet);
var poHeader = PODataSet.POHeader[0];
poHeader.OrderDate = DateTime.Today;
poHeader.BuyerID = "JPOWELL";
hPOApproveHandle.ChangeVendor("REACT1", ref PODataSet);
hPOApproveHandle.Update(ref PODataSet);
int intPONum = poHeader.PONum;
hPOApproveHandle.GetNewPODetail(ref PODataSet, intPONum);
hPOApproveHandle.ChangeDetailTranType("PUR-SUB", ref PODataSet);
hPOApproveHandle.ChangeDetailJobNum(JobNum, ref PODataSet);
hPOApproveHandle.ChangeDetailAssemblySeq(AssemblySeq, ref PODataSet);
hPOApproveHandle.ChangeDetailJobSeq(OprSeq, ref PODataSet);
hPOApproveHandle.CheckBeforeUpdate(out str2, out str3, out str4, "PODetail", PODataSet);
hPOApproveHandle.Update(ref PODataSet);
if (PODataSet != null) {
PODataSet.POHeader[0].RowMod= "U";
hPOApproveHandle.ValidateAcctForGLControl(intPONum, out str1);
hPOApproveHandle.ChangeApproveSwitch(true,out ViolationMsg, ref PODataSet);
hPOApproveHandle.CheckBeforeUpdate(out str2, out str3, out str4, "POHeader", PODataSet);
hPOApproveHandle.Update(ref PODataSet);
}
}
}
Thanks @Arul , sorry I didn’t take your advice sooner. Just had to learn the hard way and let me suffer for a week or 2.
1 Like