Delete demand link by BPM

bpm

(David Arista) #1

I created a persistent method using JobEntry BO to delete a demand link for Job Entry by changing the RowMod to D and executing the Update. The JobProd table is deleted however the ProdQty in JobHead keeps the qty. If I delete the demand manually the JobHead.ProdQty changes to zero, has anyone faced that problem or am I missing something?

PS. the only method that is triggered when deleting is the update.


(Jose C Gomez) #2

What does your code look like? Are you invoking the BO?


(David Arista) #3

Yes I’m invoking the BO, this is the code (I hard coded the Job Num for testing):

Erp.Contracts.JobEntrySvcContract hJob = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.JobEntrySvcContract>(Db);
Erp.Tablesets.JobEntryTableset jobDataSet = new Erp.Tablesets.JobEntryTableset();
if (hJob != null)
{

 jobDataSet = hJob.GetByID("2025");
 
 var jobProdRow = (from row in jobDataSet.JobProd
                   where row.Company == Session.CompanyID && row.JobNum == "2025"
                   select row).FirstOrDefault();
 if (jobProdRow != null)
 {
      jobProdRow.RowMod = "D"; //  Deleting the make to stock demand link 
      hJob.Update(ref jobDataSet);
 }

}
hJob = null;


(Jose C Gomez) #4

Not sure if this will make a difference or not, but instead of using RowMod=“D”
Try setting the RowState

jobProdRow.SetRowState(IceRowState.Deleted);

(Ben Bowtell) #5

Have you tried updating the jobprod quantity yourself on the jobhead table add setting its rowmod to u in the same dataset?

(I’m on mobile so haven’t checked if it is in fact a field in the jobhead table)


(Jose C Gomez) #6

It would also be in the JobAssembly table and the Material Labor, Costs etc calculations would be off. Updating the field in the DB wouldn’t fix those things in my experience.


(Ben Bowtell) #7

It would be passed through the business logic so wouldn’t that take care of things? Having said that I assumed that deleting the demand link would have done the same.


(Jose C Gomez) #8

Ah yeah, however I don’t believe that that field is updatable (directly) in Jobhead (I may be wrong)


(Ben Bowtell) #9

Probably not, if the above code is mimicking what’s happening in the trace then I’ll just shrug


(David Arista) #10

Thank you @josecgomez.sixs and @Ben_Bowtell, setting the rowstate did the trick.

Thanks again!