select a.site,b.AbnormalDesc as TransNo,a.FeedbackDate AS TransDate,a.OrderNo,C.partNo,c.QtyRequired as TransQty,a.SeqNo,dbo.Get_Part_SpecDesc(c.site,c.PartNo) partDescSpec,'异常反馈' as toTypeFlag,isnull(c.S_ShiftNo,'白班') shiftNo
from AbnormalFeedBack a left join AbnormalItem b on a.AbnormalCode=b.AbnormalCode
LEFT JOIN SOScheduledRouting C ON A.SeqNo=C.SeqNo
where a.Status !='已完结' and b.NeedFeedBackFlag='Y'
left join user_work_center uwc on C.site = uwc.site and C.S_WorkCenterNo = uwc.WorkCenterNo and uwc.userId = 'E0006'
where a.Status !='已完结' and b.NeedFeedBackFlag='Y' and uwc.WorkCenterNo is not null