From 08d8933d3fe66fb83f1e2e7e4038e62b3c5143e1 Mon Sep 17 00:00:00 2001 From: cpT <1@123> Date: 星期四, 19 六月 2025 11:10:43 +0800 Subject: [PATCH] #改造 --- src/main/java/com/zy/asrs/controller/SiteController.java | 160 +++++++++++++++++++++++++++++++---------------------- 1 files changed, 94 insertions(+), 66 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/SiteController.java b/src/main/java/com/zy/asrs/controller/SiteController.java index 1305824..076c199 100644 --- a/src/main/java/com/zy/asrs/controller/SiteController.java +++ b/src/main/java/com/zy/asrs/controller/SiteController.java @@ -113,6 +113,8 @@ vo.setStaNo(staProtocol.getStaNo()); // 鐩爣绔� // vo.setLocType1(staProtocol.isHigh() != staProtocol.isLow() && staProtocol.isLow() ? "浣�" : "楂�"); //楂樹綆搴撲綅 vo.setLocType1(devp.getDevNo()==102 ? "楂�" : "浣�"); + vo.setWeight(staProtocol.getGrossWt().toString()); + vo.setErrorDev(staProtocol.getErrorDev()); } return R.ok().add(list); } @@ -171,7 +173,7 @@ vo.setEmptyMk(staProtocol.isEmptyMk()?"Y":"N"); // 绌烘澘淇″彿 vo.setStaNo(staProtocol.getStaNo()); // 鐩爣绔� vo.setLocType1(staProtocol.isHigh() != staProtocol.isLow() && staProtocol.isLow() ? "浣�" : "楂�"); //楂樹綆搴撲綅 - vo.setCar(staProtocol.isCar() ? "鏈�": "鏃�"); +// vo.setCar(staProtocol.isCar() ? "鏈�": "鏃�"); return R.ok().add(vo); } } @@ -182,8 +184,8 @@ @PostMapping("/detl/update") @ManagerAuth(memo = "淇敼绔欑偣鏁版嵁") public R siteDetlUpdate(@RequestParam Integer devNo, - @RequestParam Short workNo, - @RequestParam Short staNo, + @RequestParam Integer workNo, + @RequestParam Integer staNo, @RequestParam(required = false) String pakMk, @RequestParam(required = false) Boolean inEnable, @RequestParam(required = false) Boolean outEnable @@ -221,7 +223,7 @@ basDevp.setOutEnable(outEnable ? "Y" : "N"); } basDevpService.updateById(basDevp); - boolean result = CommandUtils.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol), false); + boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); if (result) { return R.ok(); } else { @@ -232,72 +234,98 @@ } return R.error("鏇存柊澶辫触"); } + @PostMapping("/detl/out") + @ManagerAuth(memo = "淇敼绔欑偣鏁版嵁") + public R siteDetlout(@RequestParam Integer devNo, + @RequestParam Short workNo, + @RequestParam Short staNo, + @RequestParam(required = false) String pakMk, + @RequestParam(required = false) Boolean inEnable, + @RequestParam(required = false) Boolean outEnable + ) { + BasDevp basDevp = basDevpService.selectById(devNo); + if (basDevp == null) { + return R.error("绔欑偣涓嶅瓨鍦�"); + } + 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 (devNo.equals(entry.getKey())) { + StaProtocol staProtocol = entry.getValue(); + if (staProtocol == null) { + continue; + } else { + staProtocol = staProtocol.clone(); + } + if (pakMk != null) { + staProtocol.setPakMk(pakMk.equals("Y")); + } + if (inEnable != null) { + staProtocol.setInEnable(inEnable); + basDevp.setInEnable(inEnable ? "Y" : "N"); + } + if (outEnable != null) { + staProtocol.setOutEnable(outEnable); + basDevp.setOutEnable(outEnable ? "Y" : "N"); + } + staProtocol.setWorkNo(0); + staProtocol.setStaNo(0); + basDevpService.updateById(basDevp); + boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol)); + if (result) { + return R.ok(); + } else { + return R.error("涓嬪彂鍛戒护澶辫触"); + } + } + } + } + return R.error("鏇存柊澶辫触"); + } + @PostMapping("/detl/in") + @ManagerAuth(memo = "淇敼绔欑偣鏁版嵁") + public R siteDetlint(@RequestParam Integer devNo, + @RequestParam Short workNo, + @RequestParam Short staNo, + @RequestParam(required = false) String pakMk, + @RequestParam(required = false) Boolean inEnable, + @RequestParam(required = false) Boolean outEnable + ) { + BasDevp basDevp = basDevpService.selectById(devNo); + if (basDevp == null) { + return R.error("绔欑偣涓嶅瓨鍦�"); + } + for (DevpSlave devp : slaveProperties.getDevp()) { + // 閬嶅巻鍏ュ簱鍙� + for (DevpSlave.Sta inSta : devp.getInSta()) { + if (!devNo.equals(inSta.getBackSta()) ){ + continue; + } + // 鑾峰彇鍏ュ簱绔欎俊鎭� + DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); + StaProtocol staProtocol = devpThread.getStation().get(inSta.getBackSta()); + if (staProtocol == null) { + continue; + } else { + staProtocol = staProtocol.clone(); + } + staProtocol.setWorkNo( 9999); + staProtocol.setStaNo(inSta.getStaNo()); + boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol)); + if (result) { + return R.ok(); + } else { + return R.error("涓嬪彂鍛戒护澶辫触"); + } + } + } + return R.error("鏇存柊澶辫触"); + } public List<PlcErrorTableVo> staPlcErr(Map.Entry<Integer, StaProtocol> entry){ List<PlcErrorTableVo> list = new ArrayList<>(); StaProtocol staProtocol = entry.getValue(); - if (staProtocol.getBreakerErr()){ - PlcErrorTableVo vo = new PlcErrorTableVo(); - vo.setNo(entry.getKey()); // 搴忓彿 - vo.setPlcDesc("鏂矾鍣ㄦ晠闅�"); - vo.setError("鏂矾鍣ㄦ晠闅�"); - list.add(vo); - } - if (staProtocol.getInfraredErr()){ - PlcErrorTableVo vo = new PlcErrorTableVo(); - vo.setNo(entry.getKey()); // 搴忓彿 - vo.setPlcDesc("鍏夌數寮傚父"); - vo.setError("鍏夌數寮傚父"); - list.add(vo); - } - if (staProtocol.getOutTimeErr()){ - PlcErrorTableVo vo = new PlcErrorTableVo(); - vo.setNo(entry.getKey()); // 搴忓彿 - - vo.setPlcDesc("杩愯瓒呮椂"); - vo.setError("杩愯瓒呮椂"); - list.add(vo); - } - if (staProtocol.getSeizeSeatErr()){ - PlcErrorTableVo vo = new PlcErrorTableVo(); - vo.setNo(entry.getKey()); // 搴忓彿 - - vo.setPlcDesc("鍗犱綅瓒呮椂"); - vo.setError("鍗犱綅瓒呮椂"); - list.add(vo); - } - if (staProtocol.getWrkYgoodsN()){ - PlcErrorTableVo vo = new PlcErrorTableVo(); - vo.setNo(entry.getKey()); // 搴忓彿 - - vo.setPlcDesc("鏈変换鍔℃棤璐ф晠闅�"); - vo.setError("鏈変换鍔℃棤璐ф晠闅�"); - list.add(vo); - } - if (staProtocol.getInverterErr()){ - PlcErrorTableVo vo = new PlcErrorTableVo(); - vo.setNo(entry.getKey()); // 搴忓彿 - - vo.setPlcDesc("鍙橀鍣ㄦ晠闅�"); - vo.setError("鍙橀鍣ㄦ晠闅�"); - list.add(vo); - } - if (staProtocol.getContactErr()){ - PlcErrorTableVo vo = new PlcErrorTableVo(); - vo.setNo(entry.getKey()); // 搴忓彿 - - vo.setPlcDesc("鐢垫満鎺ヨЕ鍣ㄦ晠闅�"); - vo.setError("鐢垫満鎺ヨЕ鍣ㄦ晠闅�"); - list.add(vo); - } - if (staProtocol.getUpcontactErr()){ - PlcErrorTableVo vo = new PlcErrorTableVo(); - vo.setNo(entry.getKey()); // 搴忓彿 - - vo.setPlcDesc("椤跺崌鐢垫満鎺ヨЕ鍣ㄦ晠闅�"); - vo.setError("椤跺崌鐢垫満鎺ヨЕ鍣ㄦ晠闅�"); - list.add(vo); - } if (staProtocol.isFrontErr()){ PlcErrorTableVo vo = new PlcErrorTableVo(); vo.setNo(entry.getKey()); // 搴忓彿 -- Gitblit v1.9.1