| | |
| | | import com.core.common.R; |
| | | import com.zy.asrs.domain.vo.PlcErrorTableVo; |
| | | import com.zy.asrs.domain.vo.SiteTableVo; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.model.DevpSlave; |
| | | import com.zy.core.model.protocol.StaProtocol; |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.core.thread.DevpThread; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Random; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 输送设备接口 |
| | |
| | | @RequestMapping("/site") |
| | | public class SiteController { |
| | | |
| | | private AtomicInteger integer = new AtomicInteger(); |
| | | @Autowired |
| | | private SlaveProperties slaveProperties; |
| | | |
| | | @PostMapping("/table/site") |
| | | @ManagerAuth(memo = "站点信息表") |
| | | public R siteTable(){ |
| | | List<SiteTableVo> list = new ArrayList<>(); |
| | | for (int i=0;i<32;i++){ |
| | | SiteTableVo vo = new SiteTableVo(); |
| | | vo.setDevNo(String.valueOf(i)); |
| | | vo.setWorkNo("1204"); |
| | | vo.setAutoing("Y"); |
| | | vo.setCanining("Y"); |
| | | vo.setCanouting("N"); |
| | | vo.setHighLow("1"); |
| | | vo.setInreqIn("Y"); |
| | | vo.setInreqOut("N"); |
| | | vo.setLoading("Y"); |
| | | if (integer.get()%5 == 0) { |
| | | vo.setStaNo("0000"); |
| | | } else { |
| | | vo.setStaNo("9998"); |
| | | |
| | | 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()) { |
| | | StaProtocol staProtocol = entry.getValue(); |
| | | SiteTableVo vo = new SiteTableVo(); |
| | | |
| | | vo.setDevNo(entry.getKey()); // 站点编号 |
| | | vo.setWorkNo(staProtocol.getWorkNo()); // 工作号 |
| | | 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.setInreq1(staProtocol.isInreq1()?"Y":"N"); // 需求1 |
| | | vo.setEmptyMk(staProtocol.isEmptyMk()?"Y":"N"); // 空板信号 |
| | | vo.setStaNo(staProtocol.getStaNo()); // 目标站 |
| | | |
| | | list.add(vo); |
| | | } |
| | | list.add(vo); |
| | | } |
| | | integer.getAndIncrement(); |
| | | return R.ok().add(list); |
| | | } |
| | | |