I am trying to set Replenishment Material Queue records FromWhse and FromBin and Qty the PartBin on the records creation, sorted by the lowest quantity first and then sort by the earliest transaction date.
It works but i need to only use specific warehouses.
I have a BAQ i wrote which will give me 1 record with the correct details.
(This is setting a criteria as a specific part code but i need it to be the Part code on the MtlQueue record).
select distinct
[PartBin].[PartNum] as [PartBin_PartNum],
[PartBin].[WarehouseCode] as [PartBin_WarehouseCode],
[PartBin].[BinNum] as [PartBin_BinNum],
[PartBin].[OnhandQty] as [PartBin_OnhandQty],
[PartBin].[LastTransDate_c] as [PartBin_LastTransDate_c]
from Erp.PartBin as PartBin
inner join Erp.MtlQueue as MtlQueue on
PartBin.Company = MtlQueue.Company
and PartBin.PartNum = MtlQueue.PartNum
and not PartBin.BinNum = MtlQueue.ToBinNum
and PartBin.WarehouseCode = ‘MAIN’
or PartBin.WarehouseCode = ‘TYLR’
where (PartBin.PartNum = ‘04176’ and PartBin.LastTransDate_c is not null)
order by PartBin.OnhandQty, PartBin.LastTransDate_c, PartBin.BinNum
I tried to replicate in C# custom code but it doesnt do as the above does.
Why not use DynamicQuery business object to retrieve the data from the baq in your bpm? Probably easier than writing a huge linq statement that will be hard to understand years later