plsam
(Pedro Sanchez)
August 12, 2019, 6:42pm
1
I have to use a function from Erp.Contracts.BO.JobEntry in a data directive.
I added it’s reference in the assemblies section and added the following usages:
using Erp.BO;
using Erp.Contracts;
using Erp;
I looked up the syntax and no matter what still cannot use the BO.
Does someone has a code sample to show me how to declare and call a BO’s function in a data directive.
Banderson
(Brandon Anderson)
August 12, 2019, 6:59pm
3
Do you know how to use it in a method directive? Or are you just asking about using BO’s in BPM’s in general?
plsam
(Pedro Sanchez)
August 12, 2019, 7:08pm
4
BO’s in BPM’s in general. I added the references, and know the arguments for the function I need. I’m just not sure on how to declare and use the BO’s in the code.
I’ve been doing direct sql DB calls until now, but it is not an option in this case, I really need to go through the BO. (Erp.Contracts.BO.JobEntry.GetDetails)
Banderson
(Brandon Anderson)
August 12, 2019, 7:12pm
5
Here is an example of using the UD table code.
Creating a new UDXX Recprd
using(var UD02svc = Ice.Assemblies.ServiceRenderer.GetService<Ice.Contracts.UD02SvcContract>(Db))
{
UD02Tableset ds = new UD02Tableset();
UD02svc.GetaNewUD02(ref ds);
ds.UD02[0].Key1 = table;
ds.UD02[0].Key2 = action;
ds.UD02[0].Key3 = custNum;
UD02svc.Update(ref ds);
}
Instantiating the contract is similar for all of the services. Look at this one, try to see what you would modify, and let me know where you get stuck.
adding: , and I don’t know what you are trying to do with (Erp.Contracts.BO.JobEntry.GetDetails)
, but that’s going to be doing a lot of stuff. I would maybe think carefully about what you are trying to accomplish.
plsam
(Pedro Sanchez)
August 12, 2019, 7:21pm
6
Yeah, I’ve been adding to UD tables like your example but the BO function call seems different. I tried to switch the service to no avail.
Regarding your edit, basically when a job is created from an order, I’m adding a pre-made BOM based on the revision #.
Banderson
(Brandon Anderson)
August 12, 2019, 7:26pm
7
Why not simply use the Job Manager on order entry? It’s only a couple of button clicks and you can get the details and schedule the job right from there.
var jobSvc = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.JobEntrySvcContract>(Db))
This is how you instantiate the JobEntry service contract.
Also, don’t forget that BPM’s have autofill. Just hit Ctrl+space to kick that off. You can find a lot of stuff that way.
2 Likes
plsam
(Pedro Sanchez)
August 12, 2019, 9:16pm
8
I’m trying to bypass the Job Manger, this is part of a bigger scale project to automate our work orders.
I got it thanks to you! Here’s the code if anyone else was needing this solution:
var JobHeadDs = (from JobHead_Row in Db.JobHead where JobHead_Row.SysRowID ==
currentGroupSeq select JobHead_Row);
var PartNum = (from JobHead_Row in JobHeadDs select
JobHead_Row.PartNum).FirstOrDefault();
var JobNum = (from JobHead_Row in JobHeadDs select
JobHead_Row.JobNum).FirstOrDefault();
var QuoteNum = (from JobHead_Row in JobHeadDs select
JobHead_Row.QuoteNum).FirstOrDefault();
var QuoteLine = (from JobHead_Row in JobHeadDs select
JobHead_Row.QuoteLine).FirstOrDefault();
var jobSvc = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.JobEntrySvcContract>(Db);
using(jobSvc)
{
var jobEntryTableSet = jobSvc.GetDetails(JobNum, 0, "Method", QuoteNum, QuoteLine, JobNum, 0, PartNum, "PART_REV", "", true, false, false, false);
}