| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.Arith; |
| | | import com.core.common.Cools; |
| | |
| | | import com.zy.asrs.domain.vo.*; |
| | | import com.zy.asrs.entity.BasCrnError; |
| | | import com.zy.asrs.entity.BasDevp; |
| | | import com.zy.asrs.entity.BasRgv; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.mapper.BasCrnErrorMapper; |
| | | import com.zy.asrs.mapper.LocMastMapper; |
| | | import com.zy.asrs.service.BasDevpService; |
| | | import com.zy.asrs.service.BasRgvService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.common.CodeRes; |
| | | import com.zy.core.CrnThread; |
| | | import com.zy.core.DevpThread; |
| | | import com.zy.core.RgvThread2; |
| | | import com.zy.core.Slave; |
| | | import com.zy.core.cache.OutputQueue; |
| | | import com.zy.core.cache.SlaveConnection; |
| | |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.model.CrnSlave; |
| | | import com.zy.core.model.DevpSlave; |
| | | import com.zy.core.model.RgvSlave; |
| | | import com.zy.core.model.protocol.CrnProtocol; |
| | | import com.zy.core.model.protocol.RgvProtocol; |
| | | import com.zy.core.model.protocol.StaProtocol; |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.core.properties.SystemProperties; |
| | | import com.zy.core.thread.BarcodeThread; |
| | | import com.zy.core.thread.MelsecCrnThread; |
| | | import com.zy.core.thread.ScaleThread; |
| | | import com.zy.core.thread.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | private LocMastMapper locMastMapper; |
| | | @Autowired |
| | | private BasCrnErrorMapper basCrnErrorMapper; |
| | | @Autowired |
| | | private BasRgvService basRgvService; |
| | | |
| | | public static final ArrayList<Integer> barcodeNos = new ArrayList<Integer>() {{ |
| | | add(1112);add(1114);add(1122);add(1124); |
| | | |
| | | }}; |
| | | |
| | | @PostMapping("/system/running/status") |
| | | @ManagerAuth(memo = "系统运行状态") |
| | |
| | | stations.putAll(devpThread.getStation()); |
| | | } |
| | | } |
| | | |
| | | for (Map.Entry<Integer, StaProtocol> entry : stations.entrySet()) { |
| | | SiteLatestDataVo vo = new SiteLatestDataVo(); |
| | | StaProtocol staProtocol = entry.getValue(); |
| | | vo.setSiteId(String.valueOf(entry.getKey())); // 站点编号 |
| | | vo.setWorkNo(staProtocol.getWorkNo()); // 工作号 |
| | | vo.setWorkNo(staProtocol.getWorkNo().intValue()); // 工作号 |
| | | vo.setSiteStatus(SiteStatusType.process(staProtocol)); // 状态 |
| | | vo.setNearbySta(staProtocol.getNearbySta()); |
| | | vos.add(vo); |
| | |
| | | @ManagerAuth(memo = "条码扫描仪实时数据") |
| | | public R barcodeLatestData(){ |
| | | List<BarcodeDataVo> list = new ArrayList<>(); |
| | | for (Slave barcode : slaveProperties.getBarcode()) { |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcode.getId()); |
| | | if (null == barcodeThread) { |
| | | List<SiteLatestDataVo> vos = new ArrayList<>(); |
| | | Map<Integer, StaProtocol> stations = new HashMap<>(); |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | if (null != devpThread) { |
| | | stations.putAll(devpThread.getStation()); |
| | | } |
| | | } |
| | | |
| | | for (Map.Entry<Integer, StaProtocol> entry : stations.entrySet()) { |
| | | int index = barcodeNos.indexOf(entry.getValue().getSiteId()); |
| | | if (index == -1) { |
| | | continue; |
| | | } |
| | | BarcodeDataVo vo = new BarcodeDataVo(); |
| | | vo.setBarcodeId(barcode.getId()); |
| | | vo.setCodeValue(barcodeThread.getBarcode()); |
| | | vo.setBarcodeId(index); |
| | | vo.setCodeValue(entry.getValue().getBarcode()); |
| | | list.add(vo); |
| | | } |
| | | |
| | | return R.ok().add(list); |
| | | } |
| | | |
| | |
| | | return R.error("数据库维护异常"); |
| | | } |
| | | vo.setSiteId(siteId); // 站点编号 |
| | | vo.setWorkNo(staProtocol.getWorkNo()); // 工作号 |
| | | vo.setWorkNo(staProtocol.getWorkNo().intValue()); // 工作号 |
| | | |
| | | if (staProtocol.getWorkNo() > 0) { |
| | | WrkMast wrkMast = wrkMastService.selectById(staProtocol.getWorkNo()); |
| | |
| | | CrnDetailVo vo = new CrnDetailVo(); |
| | | for (CrnSlave crnSlave : slaveProperties.getCrn()) { |
| | | if (crnSlave.getId().equals(crnNo)) { |
| | | MelsecCrnThread crnThread = (MelsecCrnThread) SlaveConnection.get(SlaveType.Crn, crnSlave.getId()); |
| | | SiemensCrnThread crnThread = (SiemensCrnThread) SlaveConnection.get(SlaveType.Crn, crnSlave.getId()); |
| | | CrnProtocol crnProtocol = crnThread.getCrnProtocol(); |
| | | vo.setCrnNo(crnNo); |
| | | vo.setWorkNo(crnProtocol.getTaskNo()); |