Create MFG-STK tran while creating Lot from C#

Hello all,
I’ve been trying to programmatically create a Part Lot to hold inventory which includes its costs from the originating mfg job. The process Epicor uses is somewhat traceable via the “Job receipt to inventory” program, but despite many many attempts, I am having a difficult time (all trial and error) assembling the right collection of methods and objects, in the right sequence, to actually create a costed lot with inventory. Any guidance would be very much appreciated.

Background:
I can create a lot using the LotSelectUpdate adapter, but that doesn’t create a MFG-STK transaction and doesn’t ‘pull’ the lot costs from the Mfg job - which is critical as the lot’s costs are derived from the job (material issued, labor hrs, etc.) at the time the lot is created.

It looks like the correct way to do this is via the “ReceiptsFromMfg” business object.
I’ve been trying to assemble the following process, but it is daunting.

According to the trace AND the BL tester, this process appears to follow this process:

  1. Initialize the ReceiptsFromMfg adapter.
  2. Execute method GetNewReceiptsFromMfgJobAsm() in order to get a dataset.
    The 3 inputs are jobnum, assembly sequence# , and transaction type “MFG-STK”.
  3. Now here, I’m guessing, modify the dataset’s fields in order to prep for the next method.
  4. Execute the method that will create the lot, populate its costs, based on the source job, and add the qty to inventory.

I am stuck and cannot get beyond step 3. I can’t even get a lot created using the BL tester.
I’m hoping that someone has done something like this before.

If you have any insight into how I should proceed with this, I’d really appreciate a tip to get me beyond ground zero.

Thanks all,

Regards,

Andrew Saldivar

I’ve been working on something similar, but had approached it from a slightly different angle. We use Kanban Receipt, which basically creates a Job, pulls method, backflushes, then does a ReceiptFromMfg and completes/closes the Job.

I’m sure in the traces that I’ve done, that process is also calling LotSelectUpdate adapter to actually create the new lot.

Interesting. Thanks Mark.
I’ve been able to create the lot using the LotSelectUpdate adapter, but there’s no transaction record created in PartTran. I may need to play around with that adapter a bit more… as I type, I think its the qty that causes the transaction rather than the creation of the lot - which I guess is really just a location. If that is the case, I suppose I could create the lot, then figure out how to generate a MFG-STK transaction to move a qty of finished product into the lot along with its costs.

I think I’m still going to be stuck with that last part, but you’ve expanded my thinking on this and I appreciate it.

Regards,

Andrew

I think you need to use the Lot adapter to create the lot, the use the ReceiptsFromMfg and specify that newly created lotnum, and it will then create Parttran and costs will follow it.

Once you create the lot, which you can do also thru abl code, you could check the auto receive on the last operation, report a quantity on it and let Epicor handle the rest.

Greg

Gents, I truly appreciate the assistance.
Mark, you’re absolutely right. I first created the lot using the LotSelectUpdate adapter, then executed several required methods from the ReceiptsFromMfg business object - in the order revealed in the trace I performed. Sure enough, the transaction was created, the appropriate qty was entered into inventory AND the costs followed. Now I have to verify those costs, but they look pretty close to other similar transactions, so I feel pretty good about it.

I think that’ll do it for this challenge. Again, thanks very much.

Andrew

@gpayne, regarding your very good recommendation, we create our lot numbers using an external app (a lot # for each unit of finished product), then, when receiving the material, we provide the lot number to Epicor’s receiving programs. Everything’s barcoded and use scanners to speed the process.

This customization links the two programs by creating the lots and initiating the appropriate transactions programatically.

Well this is embarrassing… I thought I was there, but those costs are not coming over to the newly created lot.
I was trying so many different things when I marked this solved… However, the C# code is NOT updating the costs. The only thing that has been updating the lot costs is the program Job Receipt To Inventory.

Here’s a code snippet if anyone thinks they can spot the issue…
This code, which I constructed from a trace of the Job Receipt To Inventory program, results in a transaction for the appropriate qty being inserted into inventory for the specified lot. I just can’t figure out what I’m missing to get the costs to populate.

// The lot (“235285”) has already been successfully created.
string pcTranType = “MFG-STK”;
string jobNum = “003326”;
string lotNum = “235285”;
int asmSeq = 0;
int msgError = 0;
string msgText, msgText2;
ReceiptsFromMfgAdapter adRcpt = new ReceiptsFromMfgAdapter(this.oTrans);
adRcpt.BOConnect();

bool result = adRcpt.GetNewReceiptsFromMfgJobAsm(jobNum, asmSeq, pcTranType);
ReceiptsFromMfgDataSet dsRcpt;
DataRow drRcpt = adRcpt.ReceiptsFromMfgData.PartTran[0];
drRcpt[“ActTranQty”] = 100;
adRcpt.OnChangeActTranQty(out msgText);
// in the BL tester, at this point, I can see the value reflected in the resulting dataset.
adRcpt.EnableSerialNumbers(“RcptToInvEntry”,out result)
adRcpt.OnChangeLotNum(false, lotNum, out msgText, out msgError);
adRcpt.OnChangeLotNum(true, lotNum, out msgText, out msgError);
adRcpt.EnableSerialNumbers(“RcptToInvEntry”, out result);
adRcpt.PreUpdate(out result);
adRcpt.VerifySerialMatch(out msgText, out msgNum);
adRcpt.ReceiveMfgPartToInventory(0, true, out msgText, out msgText2, “RcptToInvEntry”);

adRcpt.Dispose();
adRcpt = null;

I’ve “walked though” this process numerous times with the BL tester, as well, and no joy.
Any addit’l thoughts will be very much appreciated.

To wrap up… the ReceiptsFromMfg BO do, in fact, produce the lot costs. For testing I created a new job, issued material and labor, and, since there were costs to consume, my programmatically created MFG-STK transactions were fully costed.