Omron E3S-DS30E41 photoelectric switch.
The device is a general-purpose photoelectric sensor with a built-in amplifier.
It operates on 12 to 24 VDC.
The E3S-DS30E41 model has been discontinued by the manufacturer, but similar alternatives may be available.