| | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.domain.vo.PlcErrorTableVo; |
| | | import com.zy.asrs.domain.vo.SiteTableVo; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 输送设备接口 |
| | |
| | | |
| | | @PostMapping("/detl/update") |
| | | @ManagerAuth(memo = "修改站点数据") |
| | | public R siteDetlUpdate(@RequestParam Integer siteId, |
| | | public R siteDetlUpdate(@RequestParam Integer devNo, |
| | | @RequestParam Short workNo, |
| | | @RequestParam Short staNo, |
| | | @RequestParam String pakMk){ |
| | | @RequestParam String pakMk, |
| | | @RequestParam Boolean inEnable, |
| | | @RequestParam 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 (siteId.equals(entry.getKey())) { |
| | | if (devNo.equals(entry.getKey())) { |
| | | StaProtocol staProtocol = entry.getValue(); |
| | | if (staProtocol == null) { |
| | | continue; |
| | |
| | | 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"); |
| | | } |
| | | basDevpService.updateById(basDevp); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | if (result) { |
| | | return R.ok(); |
| | |
| | | } |
| | | } |
| | | } |
| | | return R.error("plc已掉线"); |
| | | return R.error("更新失败"); |
| | | } |
| | | |
| | | |