I have created a BAQ (mostly with the help of posts on this site…thanks all!) that will eventually be turned into our Job pick list (shows all job material with inventory that needs to be picked.
I’m trying to create a concatenate so the material line for a specific job material/requirements shows all inventory BINS for a specific part that has inventory.
The report is running, but instead of showing me the bins specific to the part in question every warehouse bin we have is showing (with the inventory amount). And if a specific job material has inventory in multiple locations the report is listing a line for every bin location (I don’t want multiple lines for fear that lead to picking errors).
Any ideas what I’m doing wrong?
select
[JobHead].[JobClosed] as [JobHead_JobClosed],
[JobHead].[JobNum] as [JobHead_JobNum],
[JobMtl].[IssuedComplete] as [JobMtl_IssuedComplete],
[JobMtl].[BackFlush] as [JobMtl_BackFlush],
[JobHead].[PartNum] as [JobHead_PartNum],
[JobHead].[PartDescription] as [JobHead_PartDescription],
[JobMtl].[AssemblySeq] as [JobMtl_AssemblySeq],
[JobMtl].[MtlSeq] as [JobMtl_MtlSeq],
[JobMtl].[PartNum] as [JobMtl_PartNum],
[JobMtl].[Description] as [JobMtl_Description],
[JobMtl].[RequiredQty] as [JobMtl_RequiredQty],
[JobMtl].[IssuedQty] as [JobMtl_IssuedQty],
[JobMtl].[IUM] as [JobMtl_IUM],
[Part].[ClassID] as [Part_ClassID],
(REPLACE(REPLACE(((select
(CAST(PartBin.BinNum AS VARCHAR)+’,’) as [Calculated_PART_BIN],
[PartBin].[OnhandQty] as [PartBin_OnhandQty]
from Erp.PartBin as PartBin
where PartBin.PartNum = PartBin.PartNum FOR XML PATH(’’))) , ‘</
Calculated_PART_BIN>’,’’),’<Calculated_PART_BIN>’,’’)) as [Calculated_CONCATENATE_PARTBIN]
from Erp.JobHead as JobHead
inner join Erp.JobMtl as JobMtl on
JobHead.Company = JobMtl.Company
and JobHead.JobNum = JobMtl.JobNum
and ( JobMtl.BackFlush = FALSE and JobMtl.IssuedComplete = FALSE )
inner join Erp.Part as Part on
JobMtl.Company = Part.Company
and JobMtl.PartNum = Part.PartNum
and ( Part.ClassID <> ‘0022’ and Part.ClassID <> ‘0009’ and Part.ClassID <> ‘0010’ and Part.ClassID <> ‘0006’ and Part.ClassID <> ‘0008’ )
inner join Erp.PartBin as PartBin1 on
Part.Company = PartBin1.Company
and Part.PartNum = PartBin1.PartNum
and ( PartBin1.OnhandQty > 0 )
where (JobHead.JobClosed = FALSE)
order by JobHead.JobNum, JobMtl.PartNum