LotDetail=$@"LEFT JOIN ICSInventoryDetail detail ON inv.InvCode= detail.INVCode AND (SELECT top 1 hh.FromWarehouseCode FROM ICSWareHouseLotInfoLog hh WHERE hh.InvCode=a.InvCode AND hh.LotNo=a.LotNo) = detail.WHCode AND a.WorkPoint = detail.WorkPoint ";
sql=sql+@" AND log.BusinessCode IN('"+type+@"') GROUP BY log.ID,a.ID,con.ContainerCode,con.ContainerName,a.LotNo,a.InvCode,inv.InvName,inv.InvStd,inv.InvUnit,inv.LotEnable,inv.EATTRIBUTE1,a.WarehouseCode,