Here’s our work around (fix stupid ass Epicor logic is what you want) the rest is just gravy
It took 2 days to figure this stupid thing out, we had to Debug Step into the Epicor Server logic to see what the error was… IMO this is a bug… but you try explaining this to support.
csts = csSvc.GetByID(packNum);
csts.ShipDtl.Clear(); // Fix stupid ass Epicor Logic
csSvc.GetNewOrdrShipDtl(ref csts, packNum, tt.OrderRel_OrderNum);
var currPackLine = csts.ShipDtl.Where(x => x.Added()).FirstOrDefault();
// Load order info
currPackLine.OrderNum = tt.OrderRel_OrderNum;
csSvc.GetOrderInfo(tt.OrderRel_OrderNum, out outMessage, ref csts);
if(!string.IsNullOrEmpty(outMessage))
{
throw new Ice.BLException(outMessage);
}
// Get order line rel info
currPackLine.OrderLine = tt.OrderRel_OrderLine;
csSvc.GetOrderLineInfo(ref csts, currPackLine.PackLine, tt.OrderRel_OrderLine, string.Empty);
currPackLine.OrderRelNum = tt.OrderRel_OrderRelNum;
csSvc.GetOrderRelInfo(ref csts, currPackLine.PackLine, tt.OrderRel_OrderRelNum, true);
//Fix stupid ass Part number
string outPartNum = tt.OrderRel_PartNum;
string outStr2 = "";
bool outBool;
currPackLine.PartNum = outPartNum;
csSvc.GetPartInfo(ref csts, currPackLine.PackLine, ref outPartNum, Guid.Empty,string.Empty,out outStr2,out outStr2,out outBool, out outStr2);
// Load the job number if it's from job.
if(!string.IsNullOrEmpty(tt.Calculated_JobNum))
{
currPackLine.JobNum = tt.Calculated_JobNum;
currPackLine.OurJobShipQty = tt.Calculated_ShipQty;
currPackLine.WIPWarehouseCode = tt.Calculated_Whse;
currPackLine.WIPBinNum = tt.Calculated_BinNum;
csSvc.GetQtyInfo(ref csts, currPackLine.PackLine, 0.00M, tt.Calculated_ShipQty);
}
else
{
// Ensure job info empty
currPackLine.JobNum = string.Empty;
currPackLine.OurJobShipQty = 0.00M;
currPackLine.WIPWarehouseCode = string.Empty;
currPackLine.WIPBinNum = string.Empty;
// Fill Inv info
currPackLine.OurInventoryShipQty = tt.Calculated_ShipQty;
currPackLine.WarehouseCode = tt.Calculated_Whse;
currPackLine.BinNum = tt.Calculated_BinNum;
csSvc.GetQtyInfo(ref csts, currPackLine.PackLine, tt.Calculated_ShipQty, 0.00M);
}
csSvc.Update(ref csts);