| | |
| | | import com.zy.asrs.mapper.BasCrnErrorMapper; |
| | | import com.zy.asrs.mapper.LocMastMapper; |
| | | import com.zy.asrs.mapper.ReportQueryMapper; |
| | | import com.zy.asrs.service.BasCrnpService; |
| | | import com.zy.asrs.service.BasDevpService; |
| | | import com.zy.asrs.service.DeviceErrorService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | |
| | | private ReportQueryMapper reportQueryMapper; |
| | | @Autowired |
| | | private DeviceErrorService deviceErrorService; |
| | | @Autowired |
| | | private BasCrnpService basCrnpService; |
| | | |
| | | @PostMapping("/system/running/status") |
| | | @ManagerAuth(memo = "系统运行状态") |
| | | public R systemRunningStatus(){ |
| | | public R systemRunningStatus() { |
| | | return R.ok().add(Cools.add("status", SystemProperties.WCS_RUNNING_STATUS.get())); |
| | | } |
| | | |
| | | @PostMapping("/system/switch") |
| | | @ManagerAuth(memo = "系统运行开关操作") |
| | | public R systemSwitch(SystemSwitchParam param) throws InterruptedException { |
| | | if (Cools.isEmpty(param.getOperatorType())){ |
| | | if (Cools.isEmpty(param.getOperatorType())) { |
| | | return R.error(); |
| | | } |
| | | if (param.getOperatorType() == 0) { |
| | | if (Cools.isEmpty(param.getPassword())){ |
| | | if (Cools.isEmpty(param.getPassword())) { |
| | | return R.error("请输入口令"); |
| | | } |
| | | if (!param.getPassword().equals(SystemProperties.WCS_PASSWORD)){ |
| | | if (!param.getPassword().equals(SystemProperties.WCS_PASSWORD)) { |
| | | return R.error("口令错误"); |
| | | } |
| | | } |
| | | Thread.sleep(200L); |
| | | SystemProperties.WCS_RUNNING_STATUS.set(param.getOperatorType()==1?Boolean.TRUE:Boolean.FALSE); |
| | | SystemProperties.WCS_RUNNING_STATUS.set(param.getOperatorType() == 1 ? Boolean.TRUE : Boolean.FALSE); |
| | | return R.ok().add(Cools.add("status", SystemProperties.WCS_RUNNING_STATUS.get())); |
| | | } |
| | | |
| | |
| | | |
| | | @PostMapping("/latest/data/site") |
| | | @ManagerAuth(memo = "站点实时数据") |
| | | public R siteLatestData(){ |
| | | public R siteLatestData() { |
| | | List<SiteLatestDataVo> vos = new ArrayList<>(); |
| | | Map<Integer, StaProtocol> stations = new HashMap<>(); |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | |
| | | |
| | | @PostMapping("/latest/data/crn") |
| | | @ManagerAuth(memo = "堆垛机实时数据") |
| | | public R crnLatestData(){ |
| | | public R crnLatestData() { |
| | | List<CrnLatestDataVo> vos = new ArrayList<>(); |
| | | for (CrnSlave crn : slaveProperties.getCrn()) { |
| | | // 获取堆垛机信息 |
| | |
| | | if (crnProtocol.getAlarm1() > 0) { |
| | | vo.setCrnStatus(CrnStatusType.MACHINE_ERROR); |
| | | } else { |
| | | if (crnProtocol.getTaskNo()>0) { |
| | | if (crnProtocol.getTaskNo() > 0) { |
| | | WrkMast wrkMast = wrkMastService.selectById(crnProtocol.getTaskNo()); |
| | | if (wrkMast != null) { |
| | | vo.setCrnStatus(CrnStatusType.process(wrkMast.getIoType())); |
| | | } else { |
| | | vo.setCrnStatus(crnProtocol.modeType.equals(CrnModeType.AUTO)? CrnStatusType.MACHINE_AUTO: CrnStatusType.MACHINE_UN_AUTO); |
| | | vo.setCrnStatus(crnProtocol.modeType.equals(CrnModeType.AUTO) ? CrnStatusType.MACHINE_AUTO : CrnStatusType.MACHINE_UN_AUTO); |
| | | } |
| | | } else { |
| | | vo.setCrnStatus(crnProtocol.modeType.equals(CrnModeType.AUTO)? CrnStatusType.MACHINE_AUTO: CrnStatusType.MACHINE_UN_AUTO); |
| | | vo.setCrnStatus(crnProtocol.modeType.equals(CrnModeType.AUTO) ? CrnStatusType.MACHINE_AUTO : CrnStatusType.MACHINE_UN_AUTO); |
| | | } |
| | | } |
| | | vos.add(vo); |
| | |
| | | |
| | | @PostMapping("/latest/data/barcode") |
| | | @ManagerAuth(memo = "条码扫描仪实时数据") |
| | | public R barcodeLatestData(){ |
| | | public R barcodeLatestData() { |
| | | List<BarcodeDataVo> list = new ArrayList<>(); |
| | | for (Slave barcode : slaveProperties.getBarcode()) { |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcode.getId()); |
| | |
| | | |
| | | @PostMapping("/latest/data/scale") |
| | | @ManagerAuth(memo = "磅秤实时数据") |
| | | public R scaleLatestData(){ |
| | | public R scaleLatestData() { |
| | | List<ScaleDataVo> list = new ArrayList<>(); |
| | | for (Slave scale : slaveProperties.getScale()) { |
| | | ScaleThread scaleThread = (ScaleThread) SlaveConnection.get(SlaveType.Scale, scale.getId()); |
| | |
| | | |
| | | @PostMapping("/site/detail") |
| | | @ManagerAuth(memo = "输送设备数据详情") |
| | | public R siteDetail(@RequestParam Integer siteId){ |
| | | if (Cools.isEmpty(siteId)){ |
| | | public R siteDetail(@RequestParam Integer siteId) { |
| | | if (Cools.isEmpty(siteId)) { |
| | | return R.parse(CodeRes.EMPTY); |
| | | } |
| | | SiteDetailVo vo = new SiteDetailVo(); |
| | |
| | | } |
| | | } |
| | | |
| | | vo.setAutoing(staProtocol.isAutoing()?"Y":"N"); // 自动 |
| | | vo.setLoading(staProtocol.isLoading()?"Y":"N"); // 有物 |
| | | vo.setAutoing(staProtocol.isAutoing() ? "Y" : "N"); // 自动 |
| | | vo.setLoading(staProtocol.isLoading() ? "Y" : "N"); // 有物 |
| | | |
| | | vo.setCanining(basDevp.getCanining()); // 能入 |
| | | vo.setCanouting(basDevp.getCanouting()); // 能出 |
| | |
| | | |
| | | @PostMapping("/crn/detail") |
| | | @ManagerAuth(memo = "堆垛机设备数据详情") |
| | | public R crnDetail(@RequestParam Integer crnNo){ |
| | | if (Cools.isEmpty(crnNo)){ |
| | | public R crnDetail(@RequestParam Integer crnNo) { |
| | | if (Cools.isEmpty(crnNo)) { |
| | | return R.parse(CodeRes.EMPTY); |
| | | } |
| | | CrnDetailVo vo = new CrnDetailVo(); |
| | | for (CrnSlave crnSlave : slaveProperties.getCrn()) { |
| | | if (crnSlave.getId().equals(crnNo)) { |
| | | BasCrnp basCrnp = basCrnpService.selectById(crnNo); |
| | | if (basCrnp == null) { |
| | | return R.error("数据库维护异常"); |
| | | } |
| | | |
| | | SiemensCrnThread crnThread = (SiemensCrnThread) SlaveConnection.get(SlaveType.Crn, crnSlave.getId()); |
| | | CrnProtocol crnProtocol = crnThread.getCrnProtocol(); |
| | | vo.setCrnNo(crnNo); |
| | |
| | | vo.setError(""); // todo |
| | | } |
| | | } |
| | | vo.setInEnable(basCrnp.getInEnable());//可入 |
| | | vo.setOutEnable(basCrnp.getOutEnable());//可出 |
| | | return R.ok().add(vo); |
| | | } |
| | | } |
| | |
| | | @Deprecated |
| | | @PostMapping("/site/update") |
| | | @ManagerAuth(memo = "输送设备数据修改") |
| | | public R updateSite(){ |
| | | public R updateSite() { |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Deprecated |
| | | @PostMapping("/crn/update") |
| | | @ManagerAuth(memo = "堆垛机数据修改") |
| | | public R updateCrn(){ |
| | | public R updateCrn() { |
| | | return R.ok(); |
| | | } |
| | | |
| | | @GetMapping("/barcode/output/site") |
| | | public R crnOutput(){ |
| | | public R crnOutput() { |
| | | ArrayList<JSONObject> jsonObjects = new ArrayList<>(OutputQueue.SCALE); |
| | | jsonObjects.sort(new Comparator<JSONObject>() { |
| | | @Override |
| | |
| | | } |
| | | |
| | | @PostMapping("loc/pie/charts") |
| | | public R dsa(){ |
| | | Map<String,Object> map=new HashMap<String, Object>(); |
| | | List<ChartBean> list = new ArrayList<ChartBean>(); |
| | | public R dsa() { |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | List<ChartBean> list = new ArrayList<ChartBean>(); |
| | | |
| | | LocChartPie locUseRate = reportQueryMapper.getLocUseRate(); |
| | | if(locUseRate!=null) { |
| | | if (locUseRate != null) { |
| | | ChartBean fqty = new ChartBean(); |
| | | fqty.setName("在库库位"); |
| | | fqty.setY(locUseRate.getFqty()); |
| | |
| | | xqty.setY(locUseRate.getXqty()); |
| | | list.add(xqty); |
| | | } |
| | | map.put("rows",list); |
| | | map.put("rows", list); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | @PostMapping("locIo/line/charts") |
| | | public R locIoLineCharts(){ |
| | | Map<String,Object> map=new HashMap<String, Object>(); |
| | | public R locIoLineCharts() { |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | List<AxisBean> list = new ArrayList<AxisBean>(); |
| | | |
| | | List<WorkChartAxis> listChart = reportQueryMapper.getChartAxis(); |
| | | |
| | | if(listChart!=null) { |
| | | if (listChart != null) { |
| | | ArrayList<Integer> data1 = new ArrayList<Integer>(); |
| | | ArrayList<Integer> data2 = new ArrayList<Integer>(); |
| | | |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.add(Calendar.DATE, -12); |
| | | for(int i=0;i<12;i++) { |
| | | for (int i = 0; i < 12; i++) { |
| | | boolean flag = true; |
| | | calendar.add(Calendar.DATE, 1); |
| | | String str = sf.format(calendar.getTime()); |
| | | for(WorkChartAxis workChart : listChart) { |
| | | if(str.equals(workChart.getYmd())) { |
| | | for (WorkChartAxis workChart : listChart) { |
| | | if (str.equals(workChart.getYmd())) { |
| | | data1.add(workChart.getInqty()); |
| | | data2.add(workChart.getOutqty()); |
| | | flag = false; |
| | | break; |
| | | } |
| | | } |
| | | if(flag) { |
| | | if (flag) { |
| | | data1.add(0); |
| | | data2.add(0); |
| | | } |
| | |
| | | outqty.setData(data2.toArray(array2)); |
| | | list.add(outqty); |
| | | } |
| | | map.put("rows",list); |
| | | map.put("rows", list); |
| | | return R.ok(map); |
| | | } |
| | | |