I have worked out how to call a BO from my BPM code and that works great. The problem I’m running into now is that the process uses different business objects and goes back and forth. I’m not sure how to do that. I am trying to do a quantity adjustment out of inventory. I know my code is not efficient or complete I’m still in the early stages of understanding what I’m doing.
var UD10row = ttUD10.FirstOrDefault();
//get part table
Erp.Tables.Part partTable;
string company = UD10row.Company;
string partNum = UD10row.Character01;
string oldLotNum = UD10row.Character02;
decimal pullQty = UD10row.Number06;
string newLotNum = callContextBpmData.Character01;
string whse = UD10row.ShortChar01;
string bin = UD10row.ShortChar02;
//link ttUD10 and Part tables
partTable = (from Part_row in Db.Part
where Part_row.Company == Session.CompanyID
&& Part_row.PartNum == partNum
select Part_row).FirstOrDefault();
// check in PartLot table that the new lot number doesn't already exist
var newLot = (from nl in Db.PartLot where nl.Company == company && nl.PartNum == partNum && nl.LotNum == newLotNum select nl).FirstOrDefault();
if (newLot == null)
{
//Remove qty from old lot number
//choose which service to get
using (var whseSvc = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.WhseBinSvcContract>(Db))
{
//call bo
bool bool1 = false;
whseSvc.GetRows(whse, bin, 0, 0, out bool1);
}
//choose which service to get
using (var lotSvc = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.LotSelectUpdateSvcContract>(Db))
{
//call bo
lotSvc.GetByID(partNum, oldLotNum);
}
//choose which service to get
using (var qtyAdjSvc = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.InventoryQtyAdjSvcContract>(Db))
{
//Create new tableset for that service
Erp.Tablesets.InventoryQtyAdjTableset qtyAdjData = new Erp.Tablesets.InventoryQtyAdjTableset();
string PCID = "";
string out1;
string out2;
//call bo
qtyAdjSvc.NegativeInventoryTest(partNum, whse, bin, oldLotNum, PCID, partTable.DefaultDim, 1, 0, out out1, out out2);
bool boolean = false;
//call bo
qtyAdjSvc.PreSetInventoryQtyAdj(ref qtyAdjData, out boolean);
qtyAdjData.InventoryQtyAdj[0].AdjustQuantity = (0 - pullQty);
qtyAdjData.InventoryQtyAdj[0].ReasonCode = "INVA";
qtyAdjData.InventoryQtyAdj[0].LotNum = oldLotNum;
qtyAdjData.InventoryQtyAdj[0].Reference = "Lot Split";
}
//Need to call <businessObject>Erp.Proxy.BO.LotSelectUpdateImpl</businessObject> again here:
//do I add it here just like above? Is there a way to reference the one above?
//Should they be nested inside the {} a certain way?
}