yzmknpQp2068966(提问者) 回复 snrtuemcSELECT
h.id,
h.Fab,
h.MaterialNo,
i.Typ MaterialType,
i.CODE,
h.STATUS,
i.ProductionDate,
i.ExpiredDate,
i.StockOutDate,
i.LimitDay,
i.ValidateTime,
i.ReadyTime,
h.Loc,
h.EqpId,
i.Unit,
h.Qty,
i.BatchNo,
h.EmpID,
h.Rectime,
h.RelTime,
h.Attr1,
h.Attr2,
h.Attr3,
h.Attr4,
h.Attr5,
h.Attributes,
h.LotID,
h.DeviceName
FROM
MMS_Material_Hist h,
MMS_Material_Info i
WHERE
h.MaterialNo = i.MaterialNo
${if(StartTime==\'\',\"\",\" AND h.Rectime >= (\'\"+StartTime+\"\') \")}
${if(EndTime==\'\',\"\",\" AND h.Rectime <= (\'\"+EndTime+\"\') \")}
${if(len(typ)=0,\"\",\" and i.CODE IN ( select CODE from mms_material_typ_info where typ in (\'\"+typ+\"\')\")}
${if(hFab==\'\',\"\",\" AND h.Fab in (\'\"+hFab+\"\') \")} --厂区
${if(hLoc==\'\',\"\",\" AND h.Loc in (\'\"+hLoc+\"\') \")} --位置
${if(iCODE==\'\',\"\",\" AND i.CODE in (\'\"+iCODE+\"\') \")} --物料号
${if(hmaterialno==\'\',\"\",\" AND h.materialno in (\'\"+hmaterialno+\"\') \")}--条码
order by i.Typ,h.MaterialNo,h.RecTime