Hello,
I’ve written a function to automate splitting jobs, taking two inputs,
JobNum(nvarchar)
ChildJobQty(decimal)
For the moment, i’ve hardcoded the output jobnum for testing (input jobnum + “-test4”)
For some reason that I can’t put my finger on, my child job is coming out with exactly double the quantities requested for split, everywhere except the make to stock demand link, which is coming out as expected.
917315 is source job, ive done all the job splits in the screenshot with the same child job qty, 917315-test and 917315-test4 programmatically, the rest via job entry → split job.
Following the trace, I can’t seem to find any difference in my input vs. Split Job - anyone have any insight?
Code below:
SplitJobTableset sjts = new SplitJobTableset();
JobEntryTableset jets = new JobEntryTableset();
this.CallService<Erp.Contracts.JobEntrySvcContract>(svcJE => {
jets = svcJE.GetByID(JobNum);
});
this.CallService<Erp.Contracts.SplitJobSvcContract>(svcSJ => {
Assembly Erp_Contracts_BO_SplitJob = Assembly.Load("Erp.Contracts.BO.SplitJob");
Type typeJobProdRow = Erp_Contracts_BO_SplitJob.GetType("Erp.Tablesets.JobProdRow");
dynamic jp = Activator.CreateInstance(typeJobProdRow);
string whereClauseJobProd = "JobNum = '" + JobNum + "'";
string whereClauseLegalNumGenOpts = "";
string whereClauseSelectedSerialNumbers = "";
string whereClauseSNFormat = "";
int pageSize = 0;
int absolutePage = 0;
bool morePages = false;
sjts = svcSJ.GetRows(whereClauseJobProd, whereClauseLegalNumGenOpts, whereClauseSelectedSerialNumbers, whereClauseSNFormat, pageSize, absolutePage, out morePages);
sjts.JobProd[0].SplitQty = SplitJobQty;
sjts.JobProd[0].RowMod = "U";
svcSJ.ValidateJobProd(sjts.JobProd[0].SysRowID.ToString(), ref sjts);
string opLbrMessage = "";
string opSerialMatchMsg = "";
string opSerialNumber = "";
bool opSerialMatchErr = false;
string opLLTrkWarning = "";
bool opPartTranCreation = false;
svcSJ.PreProcessValidate(JobNum, SplitJobQty.ToString(), true, ref sjts, out opLbrMessage, out opSerialMatchMsg, out opSerialNumber, out opSerialMatchErr, out opLLTrkWarning, out opPartTranCreation);
bool RequiresUserInput = false;
string SerialNumberQtyAlert = "";
svcSJ.PreProcessSplitJob(ref sjts, DateTime.Today, out RequiresUserInput, out SerialNumberQtyAlert);
string opLegalNumberMessage = "";
svcSJ.ProcessSplitJob(JobNum, JobNum + "-test4", DateTime.Today, opPartTranCreation, out opLegalNumberMessage, ref sjts);
});