REST Issue Material to Job

We are on 10.2.400.3 and we are looking to issue material to job via REST. I see the mass issue to mfg service but do not see one for a single transaction. I searched the forms here and did not find any current topics. Does anyone have ideas that could point us in the right direction or even some direction?

Thanks

Have you run a trace? You will want to mimic the UI process. FYI, I think it’s called IssueReturn.

Thanks. This completely slipped my mind.

Thanks Jason. I missed that too.

Dave, I am currently on 10.1.600 and in my Erp.BO.IssueReturnSvc there is no PATCH option. Is it in 10.2.400? Were you able to get it working?

Thanks!

To get a IssueReturn Entity for Issuing Materials to Job (in the Epicor Demo DB)

Initialisation

Invoke: api/v1/Erp.BO.IssueReturnSvc/GetNewJobAsmblMultiple
Params:

  • ds: {
  • SelectedJobAsmbl: [{
  •   AssemblySeq: "ASSEMBLYSEQ"
    
  •   Company: "COMPANYID"
    
  •   JobNum: "JOBID"
    
  •   RowMod: "A"
    
  •   SysRowID: "00000000-0000-0000-0000-000000000000"
    
  • }]
  • pCallProcess: “IssueMaterial”
  • pcMtlQueueRowID: “00000000-0000-0000-0000-000000000000”
  • pcTranType: “STK-MTL”

This get a basic dataset for Issue Return Entity. You will then want to select a job sequence
(don’t forget RowMod = “U”)
Invoke: api/v1/Erp.BO.IssueReturnSvc/OnChangingToJobSeq
Params:

  • ds: {
  • IssueReturn:[]…
  • }
  • piToJobSeq: “JOBSEQ”

If you have backflush parts you might then want to invoke
api/v1/Erp.BO.IssueReturnSvc/OnChangeToJobSeq
This can return a field with warning message

  • pcMessage: “The part you are issuing is a backflushed part. Duplicate materials could be issued if the Backflush box is checked in Job Closing when the job is completed or closed.”

Update
You will need to decide what methods you want to call.
Pre-Update

  • PrePerformMaterialMovement
  • MasterInventoryBinTests

Update Method

  • PerformMaterialMovement
2 Likes

You will need to use custom methods for the issue return service

You can see these API’s by clicking switch to custom methods.

1 Like

Thanks Nicholas!

1 Like

I am not sure if I can continue with this post so hopefully this is okay.

We are on 10.2.400.10 and are also looking to issue material to job via rest. We have SMT placement equipment that drop/reject parts (normal process) and we can extract that part/quantity information through a summary text file. Currently, I am just trying to test the Material Issue through Swagger to prove it out but have not been successful so far. I can make it work as a Quantity Adjustment but not as Issue Material as it fails during the PerformMaterialMovement (Parameter plNegQtyAction is not found in the input object).

I’ve read the Rest documentation in Epicor help, the REST Overview Novel, taken an extended education Rest class a couple of years ago and read many, many postings and this posting is exactly what I am looking to do, but I’m sure I’m missing something.

I’ve performed the trace, extracted what I don’t think is necessary and below are what I think are the Methods of importance for Erp.Proxy.BO.IssueReturnImpl;

Erp.Proxy.BO.IssueReturnImpl.GetNewPartNum()
Erp.Proxy.BO.IssueReturnImpl.OnChangingToJobSeq()
Erp.Proxy.BO.IssueReturnImpl.OnChangeToJobSeq()
Erp.Proxy.BO.IssueReturnImpl.OnChangeTranQty()
Erp.Proxy.BO.IssueReturnImpl.PrePerformMaterialMovement()
Erp.Proxy.BO.IssueReturnImpl.MasterInventoryBinTests()
Erp.Proxy.BO.IssueReturnImpl.PerformMaterialMovement()

This is where I am a bit fuzzy on as I think I only need to execute the PerformMaterialMovement call as I will have all the necessary information gathered from an initial Rest/BAQ call. But maybe I need to setup the transaction with one of the previous Methods. The PerformMaterialMovement Input that I am trying to execute is;

{
“plNegQtyAction”: false,
“ds”: {
“IssueReturn”: [
{
“Company”: “AXIO”,
“TranDate”: “2020-08-19T16:49:11.301Z”,
“PartNum”: “0R0-0402”,
“TranQty”: “22”,
“DimCode:” “EA”,
“FromWarehouseCode”: “RM”,
“FromBinNum”: “SMAA1”,
“OnHandQty”: “19241.00000000”,
“QtyRequired”: “600”,
“QtyPreviouslyIssued”: “15”,
“ToJobNum”: “006349”,
“ToAssemblySeq”: 0,
“ToJobSeq”: 40,
“ToJobSeqPartDesc”: “0R0-0402 1% SMD RESISTOR”,
“TranReference”: “RestTest 5”,
“ToJobPartNum”: “SMT-15011-01”,
“ToAssemblyPartNum”: “SMT-15011-01”,
“ToJobSeqPartNum”: “0R0-0402”,
“TranType”: “STK-MTL”,
“DimConvFactor”: “1”,
“UM”: “EA”,
“FromJobPlant”: “MfgSys”,
“ToJobPlant”: “MfgSys”,
“DummyKeyField”: “tpeat1”,
“TreeDisplay”: “006349 : 0”,
“EnableToFields”: true,
“EnableFromFields”: false,
“RequirementUOM”: “EA”,
“RequirementQty”: “15”,
“EnableSN”: false,
“SerialControlPlantIsFromPlt”: false,
“ProcessID”: “IssueMaterial”,
“TrackDimension”: false,
“OnHandUM”: “EA”,
“FromBinNumDescription”: “SHELF SM AA1”,
“FromWarehouseCodeDescription”: “Raw Material”,
“PartSalesUM”: “EA”,
“PartIUM”: “EA”,
“PartPricePerCode”: “E”,
“PartSellingFactor”: “1”,
“PartPartDescription”: “0R0-0402 1% SMD RESISTOR”,
“RowMod”: “A”
}
]
}
}

The Error that I am getting is;
“ErrorMessage”: “Parameter plNegQtyAction is not found in the input object”,
“ErrorType”: “Epicor.RESTApi.ErrorHandling.ApiException”

Any direction would be appreciated. Thanks.

Very strange @tompeat , it looks like you have the plNegQtyAction formatted in the input correctly. After mimicking the input from a trace on the process, I was able to issue material with this call on the API help page. I tried to mimic your input parameters to recreate the error, but I instead get an error about specifying ToWharehouse / ToBinNum.

I think the issue is probably related to your other input parameters. Try adding those To fields. If that doesn’t work, I think setting up the transaction with one of the previous methods is a good idea.

I recently did an IssueMaterial via REST (with the help of this post!), and I used GetNewJobAsmblMultiple, OnChangingToJobSeq, OnChangeToJobSeq, OnChangeTranQty, OnChangeBinNum, PrePerformMaterialMovement, MasterInventoryBinTests, and PerformMaterialMovement in that order, using the outputs of each for the next inputs. Depending on the part I used OnChangeLotNum too. Rather than calling each of these methods via REST, I created a UBAQ that called them with BO widgets. Then called the UBAQ via REST (and passing parameters) to issue the material. I think using the BPM designer makes things much easier/faster to set up when chaining methods. You can also use the BL Tester to test your BO calls, and persist the data from one call to the next.

Thanks for replying and I’ll try what you have suggested today. I’ve done a lot of reading and I can’t seem to find any documented description on what each method is doing (other than what is in Swagger), what to expect/use as an output and whether they are mandatory to run. Some are obvious and some are not. I guess trial and error in this case is the best method.

As for going through a UBAQ/BPM/REST, I will need to do some homework to figure this out. By homework, I mean find an example that will help guide me down the right path. Any chance you have shared this on another post somewhere? Anyway, thanks again.

I am using just two Methods for issue/return in Service Connect if you have required information.
Erp.Proxy.BO.IssueReturnImpl.GetNewPartNum()
Erp.Proxy.BO.IssueReturnImpl.PerformMaterialMovement()

The BL Tester utility is a good place to see inputs/outputs and test the methods. They’re the same ones being called by the REST services. You can take the output from one call and persist it into the input into the next call for testing purposes too. I’ll see if I can find a UBAQ example.

I appreciate the direction on this as this is a big learning curve for me. I added in all missing fields into the PerformMaterialMovement including ToWharehouse and ToBinNum but still received the same error message “Parameter plNegQtyAction is not found in the input object within Swagger. That said, entering the exact same information within the BL Tester for the PerformMaterialMovement method worked like a charm. Exact same information, so I don’t understand why one works and the other does not. I do better understand the method steps as they do help in gathering/verifying the information and I’ll need to determine if running these methods is more effective then running a specific BAQ to get the information. The UBAQ example may be a better solution so if it is found, that would be great. Almost there. Thanks again.

I think I found what’s causing your (syntax) error:

"DimCode:" "EA",

should be

"DimCode": "EA",

That was the issue! I can’t believe you saw that. I successfully POST through Swagger and then was able to POST a transaction through Excel with no issues. Thanks again.

1 Like

Good to hear! If you use a code editor like visual studio and create a .json file it will highlight any syntax issues, that was how I saw it.

1 Like

Hi,
I am trying to do something similar. The Swagger is not returning an error “Will lead to negative quantity” even if I try to issue material more than what is available in the From bin.
Any way I can return the error and stop the transaction?