| | |
| | | import com.zy.asrs.domain.vo.*; |
| | | import com.zy.asrs.entity.BasDevp; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.mapper.LocMastMapper; |
| | | import com.zy.asrs.service.BasDevpService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.common.CodeRes; |
| | | import com.zy.core.Slave; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.enums.CrnModeType; |
| | | import com.zy.core.enums.SlaveType; |
| | |
| | | import com.zy.core.model.protocol.StaProtocol; |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.core.properties.SystemProperties; |
| | | import com.zy.core.thread.BarcodeThread; |
| | | import com.zy.core.thread.CrnThread; |
| | | import com.zy.core.thread.DevpThread; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.*; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | |
| | | /** |
| | | * 主控图接口 |
| | |
| | | private WrkMastService wrkMastService; |
| | | @Autowired |
| | | private BasDevpService basDevpService; |
| | | |
| | | public static AtomicInteger integer = new AtomicInteger(); |
| | | @Autowired |
| | | private LocMastMapper locMastMapper; |
| | | |
| | | @PostMapping("/system/running/status") |
| | | @ManagerAuth(memo = "系统运行状态") |
| | |
| | | return R.error("口令错误"); |
| | | } |
| | | } |
| | | Thread.sleep(2000L); |
| | | Thread.sleep(200L); |
| | | SystemProperties.WCS_RUNNING_STATUS.set(param.getOperatorType()==1?Boolean.TRUE:Boolean.FALSE); |
| | | return R.ok().add(Cools.add("status", SystemProperties.WCS_RUNNING_STATUS.get())); |
| | | } |
| | |
| | | continue; |
| | | } |
| | | CrnProtocol crnProtocol = crnThread.getCrnProtocol(); |
| | | if (crnProtocol == null) { |
| | | log.error("{}号堆垛机连接失败", crn.getId()); |
| | | continue; |
| | | } |
| | | CrnLatestDataVo vo = new CrnLatestDataVo(); |
| | | vo.setCrnId(crn.getId()); // 堆垛机编号 |
| | | |
| | | // Short totalBay = locMastMapper.selectTotalBay(); |
| | | |
| | | vo.setOffset((double) new Random().nextInt(560)); // 堆垛机偏移量 |
| | | vo.setBay((short) (crnProtocol.getBay() - crn.getOffset())); // 当前列 |
| | | /** |
| | | * 堆垛机状态判断 |
| | | */ |
| | | if (crnProtocol.getTaskNo()>0) { |
| | | WrkMast wrkMast = wrkMastService.selectById(crnProtocol.getTaskNo()); |
| | | if (wrkMast != null) { |
| | | vo.setCrnStatusType(CrnStatusType.process(wrkMast.getIoType())); |
| | | vo.setCrnStatus(CrnStatusType.process(wrkMast.getIoType())); |
| | | } else { |
| | | vo.setCrnStatus(crnProtocol.modeType.equals(CrnModeType.AUTO)? CrnStatusType.MACHINE_AUTO: CrnStatusType.MACHINE_UN_AUTO); |
| | | } |
| | | } else { |
| | | vo.setCrnStatusType(crnProtocol.modeType.equals(CrnModeType.AUTO)? CrnStatusType.AUTO: CrnStatusType.UN_AUTO); |
| | | vo.setCrnStatus(crnProtocol.modeType.equals(CrnModeType.AUTO)? CrnStatusType.MACHINE_AUTO: CrnStatusType.MACHINE_UN_AUTO); |
| | | } |
| | | vos.add(vo); |
| | | |
| | |
| | | @PostMapping("/latest/data/barcode") |
| | | @ManagerAuth(memo = "条码扫描仪实时数据") |
| | | public R barcodeLatestData(){ |
| | | integer.getAndIncrement(); |
| | | List<BarcodeDataVo> list = new ArrayList<>(); |
| | | for (int i=1;i<=1;i++){ |
| | | for (Slave barcode : slaveProperties.getBarcode()) { |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcode.getId()); |
| | | BarcodeDataVo vo = new BarcodeDataVo(); |
| | | vo.setBarcodeId("1"); |
| | | if (integer.get()%5 != 0) { |
| | | vo.setCodeValue("0"); |
| | | } else { |
| | | vo.setCodeValue(String.valueOf(new Random().nextInt(5000))); |
| | | } |
| | | vo.setBarcodeId(barcode.getId()); |
| | | vo.setCodeValue(barcodeThread.getBarcode()); |
| | | list.add(vo); |
| | | } |
| | | return R.ok().add(list); |
| | |
| | | vo.setError(""); // todo |
| | | } |
| | | } |
| | | return R.ok().add(vo); |
| | | } |
| | | } |
| | | return R.ok().add(vo); |
| | | return R.error(); |
| | | } |
| | | |
| | | @Deprecated |