| | |
| | | String A02glassid1 = spianService.queGlassid("DB103.156", 14).toString(); |
| | | String B01glassid = spianService.queGlassid("DB103.184", 14).toString(); |
| | | String B02glassid = spianService.queGlassid("DB103.198", 14).toString(); |
| | | List<Short> DeviceList = S7control.getinstance().ReadWord("DB103.0", 10); |
| | | if (types == 0) {// 终止进片任务 |
| | | List<StorageTask> cageList = homeMapper.SelectTaskByState(types); |
| | | for (StorageTask storageTask : cageList) { |
| | | // 判断出片任务位置并清除对应玻璃id |
| | | if (storageTask.getGlassId() == A01glassid1 || storageTask.getGlassId() == A01glassid2) { |
| | | if ((storageTask.getGlassId() == A01glassid1 || storageTask.getGlassId() == A01glassid2)&&DeviceList.get(4)==0) { |
| | | outSliceServive.StopTask(storageTask.getGlassId(), types); |
| | | ClearGlassId("DB101.10.0"); |
| | | } else if (storageTask.getGlassId() == B01glassid) { |
| | | } else if (storageTask.getGlassId() == B01glassid&&DeviceList.get(2)==0) { |
| | | outSliceServive.StopTask(storageTask.getGlassId(), types); |
| | | ClearGlassId("DB101.10.2"); |
| | | } else if (storageTask.getGlassId() == B02glassid) { |
| | | } else if (storageTask.getGlassId() == B02glassid&&DeviceList.get(3)==0) { |
| | | ClearGlassId("DB101.10.3"); |
| | | outSliceServive.StopTask(storageTask.getGlassId(), types); |
| | | } |
| | | } |
| | | // 发送终止进片任务信号 |
| | | } else {// 终止出片任务 |
| | | List<StorageCage> storageCages = homeMapper.selectinout(3); |
| | | for (StorageCage storageCage : storageCages) { |
| | | List<StorageCage> storageCagess = homeMapper.SelectStoragesGlassById(storageCage.getGlassId()); |
| | | for (StorageCage storageCagez : storageCagess) { |
| | | if (storageCagez.getState().equals("2")) {// 调拨进片 |
| | | outSliceServive.StopTask(storageCagez.getGlassId(), 0); |
| | | } else {// 出片 |
| | | outSliceServive.StopTask(storageCagez.getGlassId(), types); |
| | | } |
| | | // 判断出片任务位置并清除对应玻璃id |
| | | if (storageCagez.getGlassId() == A02glassid1) { |
| | | outSliceServive.StopTask(storageCagez.getGlassId(), types); |
| | | List<StorageTask> cageLists = homeMapper.SelectTaskByState(types); |
| | | List<StorageTask> cageList2 = homeMapper.SelectTaskByState(2); |
| | | if (cageList2.size()>0) { |
| | | cageLists.add(cageList2.get(0)); |
| | | } |
| | | for (StorageTask cageList : cageLists) { |
| | | if (cageList.getTaskType().equals("1")) { |
| | | |
| | | System.out.println(DeviceList.get(5)); |
| | | if(cageList.getGlassId().equals(A02glassid1)&&DeviceList.get(5)==0){ |
| | | outSliceServive.StopTask(cageList.getGlassId(), types); |
| | | ClearGlassId("DB101.10.1"); |
| | | } else if (storageCagez.getGlassId() == B01glassid) { |
| | | outSliceServive.StopTask(storageCagez.getGlassId(), types); |
| | | } |
| | | if(cageList.getGlassId().equals(B01glassid)&&DeviceList.get(2)==0){ |
| | | outSliceServive.StopTask(cageList.getGlassId(), types); |
| | | ClearGlassId("DB101.10.2"); |
| | | } else if (storageCagez.getGlassId() == B02glassid) { |
| | | } |
| | | if(cageList.getGlassId().equals(B02glassid)&&DeviceList.get(3)==0){ |
| | | outSliceServive.StopTask(cageList.getGlassId(), types); |
| | | ClearGlassId("DB101.10.3"); |
| | | outSliceServive.StopTask(storageCagez.getGlassId(), types); |
| | | } |
| | | }else if (cageList.getTaskType().equals("2")) { |
| | | if(cageList.getGlassId().equals(A02glassid1)&&DeviceList.get(5)==0){ |
| | | outSliceServive.StopTask(cageList.getGlassId(), 2); |
| | | ClearGlassId("DB101.10.1"); |
| | | } |
| | | if(cageList.getGlassId().equals(B01glassid)&&DeviceList.get(2)==0){ |
| | | outSliceServive.StopTask(cageList.getGlassId(), 2); |
| | | ClearGlassId("DB101.10.2"); |
| | | } |
| | | if(cageList.getGlassId().equals(B02glassid)&&DeviceList.get(3)==0){ |
| | | outSliceServive.StopTask(cageList.getGlassId(), 2); |
| | | ClearGlassId("DB101.10.3"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // List<StorageCage> storageCages = homeMapper.selectinout(3); |
| | | // for (StorageCage storageCage : storageCages) { |
| | | // List<StorageCage> storageCagess = homeMapper.SelectStoragesGlassById(storageCage.getGlassId()); |
| | | |
| | | // for (StorageCage storageCagez : storageCagess) { |
| | | |
| | | // if (storageCagez.getState().equals("2")) {// 调拨进片 |
| | | // outSliceServive.StopTask(storageCagez.getGlassId(), 0); |
| | | // } else {// 出片 |
| | | // outSliceServive.StopTask(storageCagez.getGlassId(), types); |
| | | // } |
| | | |
| | | // // 判断出片任务位置并清除对应玻璃id |
| | | // if (storageCagez.getGlassId() == A02glassid1&&DeviceList.get(5)==0) { |
| | | // outSliceServive.StopTask(storageCagez.getGlassId(), types); |
| | | // ClearGlassId("DB101.10.1"); |
| | | // } else if (storageCagez.getGlassId() == B01glassid&&DeviceList.get(2)==0) { |
| | | // outSliceServive.StopTask(storageCagez.getGlassId(), types); |
| | | // ClearGlassId("DB101.10.2"); |
| | | // } else if (storageCagez.getGlassId() == B02glassid&&DeviceList.get(3)==0) { |
| | | // ClearGlassId("DB101.10.3"); |
| | | // outSliceServive.StopTask(storageCagez.getGlassId(), types); |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | } |
| | | |
| | | //手动完成任务 |
| | | // 手动完成任务 |
| | | public void UpdateTask(Integer types, Integer shelfrack, String glassid) { |
| | | if (types == 0) {// 完成进片 |
| | | spianService.overtask(glassid); |
| | | } else if (types == 1) {// 完成出片 |
| | | spianService.overtask(glassid); |
| | | } |
| | | } |
| | | // else if (types == 2) {// 终止进片任务 |
| | | // outSliceServive.StopTask(glassid, 0); |
| | | // // 发送终止进片任务信号 |
| | | // outSliceServive.StopTask(glassid, 0); |
| | | // // 发送终止进片任务信号 |
| | | // } else {// 终止出片任务 |
| | | // outSliceServive.StopTask(glassid, 1); |
| | | // outSliceServive.StopTask(glassid, 1); |
| | | // } |
| | | } |
| | | |
| | | //判断任务类型后清除对应玻璃id |
| | | // 判断任务类型后清除对应玻璃id |
| | | public Result ClearGlassId(String position, String glassid) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | if (S7control.getinstance().CheckConnected() == true) { |
| | | // 判断进出还是出片任务 |
| | | Short type = homeMapper.SelectTaskByGlassId(glassid); |
| | | if (type == 0) { |
| | | // 进片 |
| | | outSliceServive.StopTask(glassid, 0); |
| | | } else if (type == 1) { |
| | | // 出片 |
| | | outSliceServive.StopTask(glassid, 1); |
| | | } else { |
| | | // 调拨 |
| | | outSliceServive.StopTask(glassid, 0); |
| | | outSliceServive.StopTask(glassid, 1); |
| | | if (type != null) { |
| | | if (type == 0) { |
| | | // 进片 |
| | | outSliceServive.StopTask(glassid, 0); |
| | | } else if (type == 1) { |
| | | // 出片 |
| | | outSliceServive.StopTask(glassid, 1); |
| | | } else { |
| | | // 调拨 |
| | | outSliceServive.StopTask(glassid, 0); |
| | | outSliceServive.StopTask(glassid, 1); |
| | | } |
| | | } |
| | | ClearGlassId(position); |
| | | map.put("message", "200"); |
| | |
| | | return Result.success(map); |
| | | } |
| | | |
| | | //清除玻璃id |
| | | // 清除玻璃id |
| | | public Result ClearGlassId(String position) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | if (S7control.getinstance().CheckConnected() == true) { |