过站设备sql

30 阅读1分钟
select distinct C.SJ_OrigContainName materiallot,pb.ProductName productname,p.ProductRevision rev,e.EquipmentName Equipment,
                                            concat(c.containername,'_',year(getdate()),month(getdate()),day(getdate())) as SampleNo,
											case cl.ContainerLevelName when 'BOX'  then '成型片'
                                            else '成品' end SampelType ,c.ContainerName container
                                            from container c --串联当前过站的设备
                                            left join CurrentStatus cs on cs.CurrentStatusId=c.CurrentStatusId
                                            left join WorkflowStep wsp on wsp.WorkflowStepId=cs.WorkflowStepId
                                            left join A_WIPLot wt on wt.ContainerId=c.ContainerId
                                            left join A_WIPLotDetails wd on wd.WIPLotId=wt.WIPLotId
                                            left join A_WIPEquipment e on e.WIPLotDetailsLinkId=wd.WIPLotDetailsId
											left join product p on c.productid = p.productid
                                            left join productbase pb on p.productbaseid =pb.productbaseid
                                            left join ContainerLevel cl on c.LevelId = cl.ContainerLevelId