|  |  |  | 
|---|
|  |  |  | import com.zy.core.cache.MessageQueue; | 
|---|
|  |  |  | import com.zy.core.cache.SlaveConnection; | 
|---|
|  |  |  | import com.zy.core.enums.*; | 
|---|
|  |  |  | import com.zy.core.model.*; | 
|---|
|  |  |  | import com.zy.core.model.CrnSlave; | 
|---|
|  |  |  | import com.zy.core.model.DevpSlave; | 
|---|
|  |  |  | import com.zy.core.model.LedSlave; | 
|---|
|  |  |  | import com.zy.core.model.Task; | 
|---|
|  |  |  | import com.zy.core.model.command.CrnCommand; | 
|---|
|  |  |  | import com.zy.core.model.command.LedCommand; | 
|---|
|  |  |  | import com.zy.core.model.command.RgvCommand; | 
|---|
|  |  |  | import com.zy.core.model.protocol.CrnProtocol; | 
|---|
|  |  |  | import com.zy.core.model.protocol.RgvProtocol; | 
|---|
|  |  |  | import com.zy.core.model.protocol.StaProtocol; | 
|---|
|  |  |  | import com.zy.core.properties.SlaveProperties; | 
|---|
|  |  |  | import com.zy.core.thread.BarcodeThread; | 
|---|
|  |  |  | import com.zy.core.thread.LedThread; | 
|---|
|  |  |  | import com.zy.core.thread.RgvThread; | 
|---|
|  |  |  | import com.zy.core.thread.SiemensDevpThread; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  | import org.springframework.transaction.interceptor.TransactionAspectSupport; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.io.IOException; | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  | import java.util.concurrent.TimeUnit; | 
|---|
|  |  |  | import java.util.stream.Collectors; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  | for (DevpSlave devp : slaveProperties.getDevp()) { | 
|---|
|  |  |  | // 遍历入库口 | 
|---|
|  |  |  | for (DevpSlave.Sta inSta : devp.getInSta()) { | 
|---|
|  |  |  | if (inSta.getStaNo() == 1035) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 获取条码扫描仪信息 | 
|---|
|  |  |  | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode()); | 
|---|
|  |  |  | BarcodeThread barcodeThreadMat = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcodeMat()); | 
|---|
|  |  |  | 
|---|
|  |  |  | for (DevpSlave devp : slaveProperties.getDevp()) { | 
|---|
|  |  |  | // 遍历入库口 | 
|---|
|  |  |  | for (DevpSlave.Sta inSta : devp.getInSta()) { | 
|---|
|  |  |  | if (inSta.getStaNo() != 1035) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 获取入库站信息 | 
|---|
|  |  |  | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); | 
|---|
|  |  |  | StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo()); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 获取工作档数据 | 
|---|
|  |  |  | WrkMast wrkMast = wrkMastMapper.selectById(staProtocol.getWorkNo()); | 
|---|
|  |  |  | if (null == wrkMast) { continue; } | 
|---|
|  |  |  | if (null == wrkMast) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | wrkMasts.add(wrkMast); | 
|---|
|  |  |  | // 组装命令 | 
|---|
|  |  |  | LedCommand ledCommand = new LedCommand(); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 获取工作档数据 | 
|---|
|  |  |  | WrkMast wrkMast = wrkMastMapper.selectById(staProtocol.getWorkNo()); | 
|---|
|  |  |  | if (null == wrkMast) { continue; } | 
|---|
|  |  |  | if (null == wrkMast) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | wrkMasts.add(wrkMast); | 
|---|
|  |  |  | // 组装命令 | 
|---|
|  |  |  | LedCommand ledCommand = new LedCommand(); | 
|---|
|  |  |  | 
|---|
|  |  |  | for (Integer staNo : staArr) { | 
|---|
|  |  |  | // 获取叉车站点 | 
|---|
|  |  |  | StaProtocol staProtocol = devpThread.getStation().get(staNo); | 
|---|
|  |  |  | if (staProtocol == null) { continue; } | 
|---|
|  |  |  | if (staProtocol == null) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (staProtocol.getWorkNo() != 0 || staProtocol.isErr()) { | 
|---|
|  |  |  | reset = false; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | 
|---|
|  |  |  | for (Integer staNo : staArr) { | 
|---|
|  |  |  | // 获取叉车站点 | 
|---|
|  |  |  | StaProtocol staProtocol = devpThread.getStation().get(staNo); | 
|---|
|  |  |  | if (staProtocol == null) { continue; } | 
|---|
|  |  |  | if (staProtocol == null) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (staProtocol.isLoading() || staProtocol.isErr()) { | 
|---|
|  |  |  | reset = false; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | 
|---|
|  |  |  | public synchronized void autoEmptyOut() { | 
|---|
|  |  |  | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1); | 
|---|
|  |  |  | List<Integer> list = new ArrayList<>(); | 
|---|
|  |  |  | list.add(101);list.add(112); | 
|---|
|  |  |  | list.add(101); | 
|---|
|  |  |  | list.add(112); | 
|---|
|  |  |  | Map<Integer,Integer> map = new HashMap<>(); | 
|---|
|  |  |  | map.put(101,102);map.put(112,111); | 
|---|
|  |  |  | map.put(101, 102); | 
|---|
|  |  |  | map.put(112, 111); | 
|---|
|  |  |  | for (Integer site:list){ | 
|---|
|  |  |  | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("sta_no", map.get(site))); | 
|---|
|  |  |  | if (!Cools.isEmpty(wrkMast)){ | 
|---|