#
yxFwq
2024-07-18 bf7f18b252078aa07b7df4a2b51a36e320663730
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -3739,37 +3739,43 @@
                }
                if (emptyInSta.getStaNo()==607 && staProtocol.getStaNo()==607 && staProtocol.getWorkNo()>20000){
                    try {
                        LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
                        BasDevp basDevp = basDevpService.selectById(staProtocol.getStaNo());
                        if (basDevp.getReportSign()==0){
                            LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
                        SearchLocParam param = new SearchLocParam();
                        param.setIoType(10);
                        param.setSourceStaNo(emptyInSta.getStaNo());
                        param.setLocType1(locTypeDto.getLocType1());
                        String response = new HttpHandler.Builder()
                                .setUri(wmsUrl)
                                .setPath("/rpc/pakin/loc/v1")
                                .setJson(JSON.toJSONString(param))
                                .build()
                                .doPost();
                        JSONObject jsonObject = JSON.parseObject(response);
                        if (jsonObject.getInteger("code").equals(200)) {
                            StartupDto dto = jsonObject.getObject("data", StartupDto.class);
                            SearchLocParam param = new SearchLocParam();
                            param.setIoType(10);
                            param.setSourceStaNo(emptyInSta.getStaNo());
                            param.setLocType1(locTypeDto.getLocType1());
                            String response = new HttpHandler.Builder()
                                    .setUri(wmsUrl)
                                    .setPath("/rpc/pakin/loc/v1")
                                    .setJson(JSON.toJSONString(param))
                                    .build()
                                    .doPost();
                            JSONObject jsonObject = JSON.parseObject(response);
                            if (jsonObject.getInteger("code").equals(200)) {
                                basDevp.setReportSign(1);
                                basDevpService.updateById(basDevp);
                                StartupDto dto = jsonObject.getObject("data", StartupDto.class);
                            // 更新站点信息 且 下发plc命令
                            staProtocol.setWorkNo(dto.getWorkNo());
                            staProtocol.setStaNo(607);
                            devpThread.setPakMk(staProtocol.getSiteId(), false);
                            boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(5, staProtocol));
                            if (!result) {
                                throw new CoolException("更新plc站点信息失败");
                                // 更新站点信息 且 下发plc命令
                                staProtocol.setWorkNo(dto.getWorkNo());
                                staProtocol.setStaNo(607);
                                devpThread.setPakMk(staProtocol.getSiteId(), false);
                                boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(5, staProtocol));
                                if (!result) {
                                    throw new CoolException("更新plc站点信息失败");
                                }
                            } else {
                                log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
                            }
                        } else {
                            log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                    }
                    return;
                }
                // 站点条件判断
@@ -7895,7 +7901,7 @@
                    List<BasJarMast> basJarMastList = basJarMastService.getJarMastByJarIdAndStatusListCharge(steSlave.getId(), new ArrayList<Integer>() {{
                        add(5);
                        add(11);
                        add(16);
                        add(17);
                    }});
                    if(!basJarMastList.isEmpty()){
                        continue;
@@ -8058,7 +8064,7 @@
        if (staNo1!=0){
            SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 2);
            StaProtocol staProtocol607 = devpThread.getStation().get(607);
            if (staProtocol607.getWorkNo()<9001){
            if (staProtocol607.getWorkNo()<9001 && staProtocol607.getWorkNo()!=0 && staProtocol607.isLoading() && staProtocol607.isAutoing()){
                staProtocol607.setStaNo(staNo1);
                boolean result2 = MessageQueue.offer(SlaveType.Devp, 2, new Task(5, staProtocol607));
            }
@@ -8128,7 +8134,6 @@
                }});
                DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 2);
                Integer count = basJarMastList.size();
                Integer staNoEnd = 0;
                ArrayList<Integer> wrkNoList = new ArrayList<>();
                for (Integer staNoEnt : staNos){
@@ -8136,13 +8141,12 @@
                    if (staProtocolEnt != null && staProtocolEnt.getWorkNo()!=0 && !wrkNoList.contains(staProtocolEnt.getWorkNo())){
                        if (staProtocolEnt.getStaNo().equals(basJar.getEntStaNo$())){
                            count++;
                            staNoEnd = staProtocolEnt.getWorkNo();
                            wrkNoList.add(staProtocolEnt.getWorkNo());
                        }
                    }
                }
                if (count<7){
                    return staNoEnd;
                    return basJar.getEntStaNo$();
                }
            }
        }catch (Exception e){