| | |
| | | |
| | | @GetMapping("/io/mode/info/site") |
| | | @ManagerAuth(memo = "入出库模式") |
| | | public R ioMode(){ |
| | | public R ioMode() { |
| | | List<Map<String, Object>> res = new ArrayList<>(); |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | |
| | | |
| | | @PostMapping("/table/site") |
| | | @ManagerAuth(memo = "站点信息表") |
| | | public R siteTable(){ |
| | | public R siteTable() { |
| | | List<SiteTableVo> list = new ArrayList<>(); |
| | | // 内存数据 |
| | | Map<Integer, StaProtocol> station = new HashMap<>(); |
| | |
| | | // 持久数据 |
| | | List<BasDevp> basDevps = basDevpService.selectList(new EntityWrapper<BasDevp>().orderBy("dev_no")); |
| | | for (BasDevp devp : basDevps) { |
| | | if (devp.getDevNo() < 1100) { |
| | | continue; |
| | | } |
| | | SiteTableVo vo = new SiteTableVo(); |
| | | vo.setDevNo(devp.getDevNo()); // 站点编号 |
| | | |
| | | list.add(vo); |
| | | StaProtocol staProtocol = station.get(devp.getDevNo()); |
| | | if (null == staProtocol) { continue; } |
| | | if (null == staProtocol) { |
| | | continue; |
| | | } |
| | | vo.setWorkNo(staProtocol.getWorkNo().intValue()); |
| | | vo.setAutoing(staProtocol.isAutoing()?"Y":"N"); // 自动 |
| | | vo.setLoading(staProtocol.isLoading()?"Y":"N"); // 有物 |
| | | vo.setInEnable(staProtocol.isInEnable()?"Y":"N"); // 可入 |
| | | vo.setOutEnable(staProtocol.isOutEnable()?"Y":"N"); // 可出 |
| | | vo.setPakMk(staProtocol.isPakMk()?"Y":"N"); // 入库标记 |
| | | vo.setEmptyMk(staProtocol.isEmptyMk()?"Y":"N"); // 空板信号 |
| | | vo.setAutoing(staProtocol.isAutoing() ? "Y" : "N"); // 自动 |
| | | vo.setLoading(staProtocol.isLoading() ? "Y" : "N"); // 有物 |
| | | vo.setInEnable(staProtocol.isInEnable() ? "Y" : "N"); // 可入 |
| | | vo.setOutEnable(staProtocol.isOutEnable() ? "Y" : "N"); // 可出 |
| | | vo.setPakMk(staProtocol.isPakMk() ? "Y" : "N"); // 入库标记 |
| | | vo.setEmptyMk(staProtocol.isEmptyMk() ? "Y" : "N"); // 空板信号 |
| | | vo.setStaNo(staProtocol.getStaNo()); // 目标站 |
| | | // vo.setLocType1(staProtocol.isHigh() != staProtocol.isLow() && staProtocol.isLow() ? "低" : "高"); //高低库位 |
| | | vo.setLocType1(devp.getDevNo()==102 ? "高" : "低"); |
| | | vo.setIn(staProtocol.isIn()?"Y":"N"); |
| | | vo.setOut(staProtocol.isOut()?"Y":"N"); |
| | | vo.setIdle(staProtocol.isIdle()?"Y":"N"); |
| | | vo.setLocType1(staProtocol.isHigh() != staProtocol.isLow() && staProtocol.isLow() ? "低" : "高"); //高低库位 |
| | | //vo.setLocType1(devp.getDevNo() == 102 ? "高" : "低"); |
| | | vo.setIn(staProtocol.isIn() ? "Y" : "N"); |
| | | vo.setOut(staProtocol.isOut() ? "Y" : "N"); |
| | | vo.setIdle(staProtocol.isIdle() ? "Y" : "N"); |
| | | vo.setFinishWorkNo(staProtocol.getFinishWorkNo().toString()); |
| | | } |
| | | |
| | |
| | | |
| | | @PostMapping("/table/plc/errors") |
| | | @ManagerAuth(memo = "输送设备plc异常信息表") |
| | | public R plcErrorTable(){ |
| | | public R plcErrorTable() { |
| | | List<PlcErrorTableVo> list = new ArrayList<>(); |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | Map<Integer, StaProtocol> station = devpThread.getStation(); |
| | | |
| | | for(Map.Entry<Integer, StaProtocol> entry : station.entrySet()) { |
| | | if (!Cools.isEmpty(staPlcErr(entry))){ |
| | | list.add(staPlcErr(entry).get(0)) ; |
| | | for (Map.Entry<Integer, StaProtocol> entry : station.entrySet()) { |
| | | if (!Cools.isEmpty(staPlcErr(entry))) { |
| | | list.add(staPlcErr(entry).get(0)); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | @PostMapping("/output/site") |
| | | @ManagerAuth(memo = "站点设备报文日志输出") |
| | | public R siteOutput(){ |
| | | public R siteOutput() { |
| | | StringBuilder str = new StringBuilder(); |
| | | String s; |
| | | int i = 0; |
| | | while((s = OutputQueue.DEVP.poll()) != null && i <=10) { |
| | | while ((s = OutputQueue.DEVP.poll()) != null && i <= 10) { |
| | | str.append("\n").append(s); |
| | | i++; |
| | | } |
| | |
| | | /****************************************************************/ |
| | | |
| | | @GetMapping("/detl/{siteId}") |
| | | public R siteDetl(@PathVariable("siteId") Integer siteId){ |
| | | public R siteDetl(@PathVariable("siteId") Integer siteId) { |
| | | SiteTableVo vo = new SiteTableVo(); |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | |
| | | StaProtocol staProtocol = entry.getValue(); |
| | | vo.setDevNo(entry.getKey()); // 站点编号 |
| | | vo.setWorkNo(staProtocol.getWorkNo().intValue()); // 工作号 |
| | | vo.setAutoing(staProtocol.isAutoing()?"Y":"N"); // 自动 |
| | | vo.setLoading(staProtocol.isLoading()?"Y":"N"); // 有物 |
| | | vo.setInEnable(staProtocol.isInEnable()?"Y":"N"); // 可入 |
| | | vo.setOutEnable(staProtocol.isOutEnable()?"Y":"N"); // 可出 |
| | | vo.setPakMk(staProtocol.isPakMk()?"Y":"N"); // 需求1 |
| | | vo.setEmptyMk(staProtocol.isEmptyMk()?"Y":"N"); // 空板信号 |
| | | vo.setAutoing(staProtocol.isAutoing() ? "Y" : "N"); // 自动 |
| | | vo.setLoading(staProtocol.isLoading() ? "Y" : "N"); // 有物 |
| | | vo.setInEnable(staProtocol.isInEnable() ? "Y" : "N"); // 可入 |
| | | vo.setOutEnable(staProtocol.isOutEnable() ? "Y" : "N"); // 可出 |
| | | vo.setPakMk(staProtocol.isPakMk() ? "Y" : "N"); // 需求1 |
| | | vo.setEmptyMk(staProtocol.isEmptyMk() ? "Y" : "N"); // 空板信号 |
| | | vo.setStaNo(staProtocol.getStaNo()); // 目标站 |
| | | vo.setLocType1(staProtocol.isHigh() != staProtocol.isLow() && staProtocol.isLow() ? "低" : "高"); //高低库位 |
| | | return R.ok().add(vo); |
| | |
| | | public R siteDetlUpdate(@RequestParam Integer siteId, |
| | | @RequestParam Integer workNo, |
| | | @RequestParam Short staNo, |
| | | @RequestParam String pakMk){ |
| | | @RequestParam String pakMk) { |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | Map<Integer, StaProtocol> station = devpThread.getStation(); |
| | |
| | | return R.error("plc已掉线"); |
| | | } |
| | | |
| | | public List<PlcErrorTableVo> staPlcErr(Map.Entry<Integer, StaProtocol> entry){ |
| | | public List<PlcErrorTableVo> staPlcErr(Map.Entry<Integer, StaProtocol> entry) { |
| | | List<PlcErrorTableVo> list = new ArrayList<>(); |
| | | StaProtocol staProtocol = entry.getValue(); |
| | | if (staProtocol.getBreakerErr()){ |
| | | if (staProtocol.getBreakerErr()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | vo.setPlcDesc("断路器故障"); |
| | | vo.setError("断路器故障"); |
| | | list.add(vo); |
| | | } |
| | | if (staProtocol.getInfraredErr()){ |
| | | if (staProtocol.getInfraredErr()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | vo.setPlcDesc("光电异常"); |
| | | vo.setError("光电异常"); |
| | | list.add(vo); |
| | | } |
| | | if (staProtocol.getOutTimeErr()){ |
| | | if (staProtocol.getOutTimeErr()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | |
| | |
| | | vo.setError("运行超时"); |
| | | list.add(vo); |
| | | } |
| | | if (staProtocol.getSeizeSeatErr()){ |
| | | if (staProtocol.getSeizeSeatErr()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | |
| | |
| | | vo.setError("占位超时"); |
| | | list.add(vo); |
| | | } |
| | | if (staProtocol.getWrkYgoodsN()){ |
| | | if (staProtocol.getWrkYgoodsN()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | |
| | |
| | | vo.setError("有任务无货故障"); |
| | | list.add(vo); |
| | | } |
| | | if (staProtocol.getInverterErr()){ |
| | | if (staProtocol.getInverterErr()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | |
| | |
| | | vo.setError("变频器故障"); |
| | | list.add(vo); |
| | | } |
| | | if (staProtocol.getContactErr()){ |
| | | if (staProtocol.getContactErr()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | |
| | |
| | | vo.setError("电机接触器故障"); |
| | | list.add(vo); |
| | | } |
| | | if (staProtocol.getUpcontactErr()){ |
| | | if (staProtocol.getUpcontactErr()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | |
| | |
| | | /* |
| | | * 宜科定制 150站点异常信息:大托盘目的站错误 |
| | | * */ |
| | | if (entry.getKey()==150){ |
| | | if (entry.getKey() == 150) { |
| | | vo.setPlcDesc("150站点大托盘目的站错误"); |
| | | vo.setError("150站点大托盘目的站错误"); |
| | | } |
| | | list.add(vo); |
| | | } |
| | | if (staProtocol.isFrontErr()){ |
| | | if (staProtocol.isFrontErr()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | vo.setPlcDesc("前超限"); |
| | | vo.setError("前超限"); |
| | | list.add(vo); |
| | | } |
| | | if (staProtocol.isBackErr()){ |
| | | if (staProtocol.isBackErr()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | vo.setPlcDesc("后超限"); |
| | | vo.setError("后超限"); |
| | | list.add(vo); |
| | | } |
| | | if (staProtocol.isHighErr()){ |
| | | if (staProtocol.isHighErr()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | vo.setPlcDesc("高超限"); |
| | | vo.setError("高超限"); |
| | | list.add(vo); |
| | | } |
| | | if (staProtocol.isLeftErr()){ |
| | | if (staProtocol.isLeftErr()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | vo.setPlcDesc("左超限"); |
| | | vo.setError("左超限"); |
| | | list.add(vo); |
| | | } |
| | | if (staProtocol.isRightErr()){ |
| | | if (staProtocol.isRightErr()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | vo.setPlcDesc("右超限"); |
| | | vo.setError("右超限"); |
| | | list.add(vo); |
| | | } |
| | | if (staProtocol.isBarcodeErr()){ |
| | | if (staProtocol.isBarcodeErr()) { |
| | | PlcErrorTableVo vo = new PlcErrorTableVo(); |
| | | vo.setNo(entry.getKey()); // 序号 |
| | | vo.setPlcDesc("扫码失败"); |