| | |
| | | import com.zy.core.model.Task; |
| | | import com.zy.core.model.protocol.StaProtocol; |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.core.thread.DevpThread; |
| | | import com.zy.core.DevpThread; |
| | | import com.zy.core.thread.SiemensDevpThread; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | private SlaveProperties slaveProperties; |
| | | @Autowired |
| | | private BasDevpService basDevpService; |
| | | |
| | | @GetMapping("/io/mode/info/site") |
| | | @ManagerAuth(memo = "充电模式") |
| | | public R ioMode(){ |
| | | List<Map<String, Object>> res = new ArrayList<>(); |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | Map<String, Object> map1 = new HashMap<>(); |
| | | map1.put("floor", 1); |
| | | map1.put("modeVal", devpThread.charge0); |
| | | map1.put("modeDesc", devpThread.charge0?"充电中":"关闭"); |
| | | res.add(map1); |
| | | Map<String, Object> map2 = new HashMap<>(); |
| | | map2.put("floor", 2); |
| | | map2.put("modeVal", devpThread.charge1); |
| | | map2.put("modeDesc", devpThread.charge1?"充电中":"关闭"); |
| | | res.add(map2); |
| | | Map<String, Object> map3 = new HashMap<>(); |
| | | map3.put("floor", 3); |
| | | map3.put("modeVal", devpThread.charge2); |
| | | map3.put("modeDesc", devpThread.charge2?"充电中":"关闭"); |
| | | res.add(map3); |
| | | } |
| | | return R.ok().add(res); |
| | | } |
| | | |
| | | @PostMapping("/io/mode/action/site") |
| | | @ManagerAuth(memo = "充电控制") |
| | | public R ioModeAction(@RequestParam("floor") Integer floor, @RequestParam("charge") Boolean charge){ |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | boolean res = devpThread.charge(floor - 1, charge); |
| | | return res?R.ok():R.error(); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/table/site") |
| | | @ManagerAuth(memo = "站点信息表") |
| | |
| | | for (Map.Entry<Integer, StaProtocol> entry : station.entrySet()) { |
| | | if (siteId.equals(entry.getKey())) { |
| | | StaProtocol staProtocol = entry.getValue(); |
| | | staProtocol = staProtocol.clone(); |
| | | if (workNo != null) { |
| | | staProtocol.setWorkNo(workNo); |
| | | } |