???????????????????????????????????????????????д??С?????(?????鯔??)??????????????SQL????????????????????洢??????????????3???????????????£?????????????а?????
???????????
????????????????????й?????????????MES?????????????????????????(3 years+)?????????????????????????У??????????????????5????????????????10?????????????????????…
????(???????????????????????????????????????????ps:??????????…)
???????????????????????й????????????????????SSRS?????е?SQL???
????select distinct b.MaterialID as matl_def_id??c.Descript??case when right(b.MESOrderID??12)<'001000000000'then right(b.MESOrderID??9)
????else right(b.MESOrderID??12)end as pom_order_id??a.LotName??a.SourceLotName as ComLot??
????e.DefID as ComMaterials??e.Descript as ComMatDes??d.VendorID??d.DateCode??d.SNNote??b.OnPlantID??a.SNCUST
????from
????(
????select m.lotname??m.sourcelotname??m.opetypeid??m.OperationDate??n.SNCUST from View1 m
????left join co_sn_link_customer as n on n.SNMes=m.LotName
????where
????(m.LotName in(select val from fn_String_To_Table(@sn??'??'??1))or(@sn)='')and
????(m.sourcelotname in(select val from fn_String_To_Table(@BatchID??'??'??1))or(@BatchID)='')
????and(n.SNCust like'%'+@SN_ext+'%'or(@SN_ext)='')
????)a
????left join
????(
????select*from Table1 where SNType='IntSN'
????and SNRuleName='ProductSNRule'
????and OnPlantID=@OnPlant
????)b on b.SN=a.LotName
????inner join MMdefinitions as c on c.DefID=b.MaterialID
????left join Table1 as d on d.SN=a.SourceLotName
????inner join MMDefinitions as e on e.DefID=d.MaterialID
????where not exists(
????select distinct LotName??SourceLotName from ELCV_ASSEMBLE_OPS
????where LotName=a.SourceLotName and SourceLotName=a.LotName
????)
????and(d.DateCode in(select val from fn_String_To_Table(@DCode??'??'??1))or(@DCode)='')
????and(d.SNNote like'%'+@SNNote+'%'or(@SNNote)='')
????and((case when right(b.MESOrderID??12)<'001000000000'then right(b.MESOrderID??9)
????else right(b.MESOrderID??12)end)in(select val from fn_String_To_Table(@order_id??'??'??1))or(@order_id)='')
????and(e.DefID in(select val from fn_String_To_Table(@comdef??'??'??1))or(@comdef)='')
????--View1????????????????(??????????????????????)????????????????????????????????????????????
????--Table1???????????????1500????
?????????????????????????????飬??B/S????????????????????С????С?…????????????SQL??????????飬??С?????н????
????(????????????????????????3????????????????????)
????????п??????????й???????(????????θ?)??????
???????????????????????·(??????)???????????о????
?????????????
?????????????????????н??????????????????
?????????????????????????????????????????и???????????????????????????????????н?????????????????????????????????????????
?????????б??????£??????????????????????????????????????????????????????“??д????”??
??????????????????????????????????б?????????????????????????????????????????????????????????????????????????“????”??“????”??
????????????????????????±?(???)?????±??????????????????????????
??????????????ɡ?????????????????????????????
???????????SQL?????????????????????????????????к???????????????????????й????”????”(??????????)??
????ó????????????????X????????壡???????????????
???????????????????????????SQL????????