The users want a message to show if they are shipping a partial shipment when OrderHed.ShipComplete or OrderDtl.ShipLineComplete is checked and the Shipping Qtys <> the Order Qtys during the Freight Action in Single Packs and Master Packs.
I did this in FreightService.BuildCustFreightRequest Post Process Method Directive for the single packs, which works.
For the Master Pack, I am trying to do the same thing in FreightService.BuildMasterPackFreightRequest. The ttMasterPackInfo_Row.PackIDList is a tilde delimited list of the packs in the MasterPack. My thought was to get all the ShipDtl in that list and group them by OrderNum, OrderLine to sum SellingJobShipQty & SellingInventoryShipQty. Then compare that to the OrderDtl.SellingQuantity to set the exception.
My problem is in sql this code works fine:
select sd.ordernum, sd.orderline, sum(sd.sellingjobshipqty), sum(sd.SellingInventoryShipQty)
from erp.shipdtl sd
join erp.OrderDtl od
on sd.ordernum = od.ordernum and sd.orderline = od.orderline
where sd.packnum in (618962, 618963)
group by sd.ordernum, sd.orderline
But, the C# version does not. I get a random order# and Part# back. What am I doing wrong?
Erp.Tables.ShipDtl ShipDtl;
Erp.Tables.OrderDtl OrderDtl;
Erp.Tables.OrderRel OrderRel;
dspException = false;
foreach (var ttMasterPackInfo_Row in result.MasterPackInfo)
{
packList = ttMasterPackInfo_Row.PackIDList;
var shipdtlrows = from shipdtl in Db.ShipDtl
where shipdtl.Company == ttMasterPackInfo_Row.Company && packList.Contains(shipdtl.PackNum.ToString()) //shipdtl.PackNum == 618962 //packList.Contains(“618962”) //packList.Contains(shipdtl.PackNum.ToString())
group shipdtl by new { shipdtl.Company, shipdtl.OrderNum, shipdtl.OrderLine } into sd
orderby sd.Key.OrderNum, sd.Key.OrderLine
select new
{
sd.Key.Company,
sd.Key.OrderNum,
sd.Key.OrderLine,
sjsq = sd.Sum(shipdtl => shipdtl.SellingJobShipQty),
sisq = sd.Sum(shipdtl => shipdtl.SellingInventoryShipQty)
};
The packList.Contains doesn’t work, it only seems to work when I hardcode it like shipdtl.PackNum = 618962.
Any ideas?