1
zhang
昨天 9d82e56ee05e2be1150b98da80b720b4f93f6afd
zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/thread/SiemensDevpThread.java
@@ -8,6 +8,8 @@
import com.zy.acs.conveyor.core.constant.StationStatusField;
import com.zy.acs.conveyor.core.model.StaProtocol;
import com.zy.acs.conveyor.core.properties.DevpSlave;
import com.zy.acs.conveyor.core.service.DevpS7Service;
import com.zy.acs.conveyor.core.service.StationService;
import com.zy.acs.conveyor.entity.Devp;
import com.zy.acs.conveyor.service.DevpService;
import com.zy.acs.conveyor.utils.SpringContextUtil;
@@ -74,7 +76,19 @@
     */
    private void read() throws InterruptedException {
        if (siemensS7Net == null) {
            DevpS7Service devpS7Service = SpringContextUtil.getBean(DevpS7Service.class);
            if (devpS7Service != null) {
                siemensS7Net = devpS7Service.get(slave.getId());
            }
            log.warn("PLC未连接,跳过读取 [id:{}]", slave.getId());
            return;
        }
        if (station == null) {
            StationService stationService = SpringContextUtil.getBean(StationService.class);
            if (stationService != null) {
                station = stationService.getStationMap(slave.getId());
            }
            log.warn("站点未连接,跳过读取 [id:{}]", slave.getId());
            return;
        }
@@ -162,7 +176,7 @@
            if (!Cools.isEmpty(barcode)) {
                StaProtocol staProtocol = station.get(barcodeArr.get(i));
                staProtocol.setBarcode(barcode);
                log.info("料箱码:{}", barcode);
                News.info("料箱码:{}", barcode);
            }
        }
    }