自动化立体仓库 - WCS系统
#
18516761980
2022-08-11 0a78e1b883668873f5fc4f33866fc4bb64a4f473
#
2个文件已修改
95 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java 93 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/SiemensDevpThread.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -1907,50 +1907,83 @@
    /**
     * 根据PLC按钮测试信号,发送启动申请到测试系统
     */
    @Transactional
    public void startTest() {
        try {
            // 根据输送线plc遍历
            for (DevpSlave devp : slaveProperties.getDevp()) {
                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
                if(null != devpThread){
                    if (devpThread.startSignal1 == 1){
                        TestMast testMast = testMastService.selectOne(new EntityWrapper<TestMast>()
                        .eq("channel",1).eq("status",0));
                        if(null != testMast){
                            Date now = new Date();
                            //http请求测试
                            TestDto testDto = new TestDto();
                            testDto.setLocNo(testMast.getLocNo());
                            testDto.setBarcode(testMast.getBarcode());
                            testDto.setUserId(testMast.getUserId());
                            testDto.setRequestTime(DateUtils.convert(now));
                            String response = new HttpHandler.Builder()
                                    .setUri(testUrl)
                                    .setPath("/testUrlPath")
                                    .setJson(JSON.toJSONString(testDto))
                                    .build()
                                    .doPost();
                            JSONObject jsonObject = JSON.parseObject(response);
                            if (jsonObject.getInteger("code").equals(200)) {
                                //更新测试表状态
                                testMast.setStatus(1);
                                testMast.setModiTime(now);
                                testMastService.update(testMast,new EntityWrapper<TestMast>()
                                        .eq("channel",1).eq("status",0));
                                //复位PLC信号
                                boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, 0));
                            } else {
                                log.error("请求接口失败!!!url:{},request:{},response:{}", testUrl+"/rpc/pakin/loc/v1", JSON.toJSONString(testDto), response);
                            }
                    int channel = 0;
                    for (int i = 0; i < 4; i++){
                        switch (i){
                            case 0:
                                channel = devpThread.startSignal1;
                                break;
                            case 1:
                                channel = devpThread.startSignal2;
                                break;
                            case 2:
                                channel = devpThread.startSignal3;
                                break;
                            case 3:
                                channel = devpThread.startSignal4;
                                break;
                        }
                        if (channel == 1){
                            TestMast testMast = testMastService.selectOne(new EntityWrapper<TestMast>()
                                    .eq("channel",(i+1)).eq("status",0));
                            if(null != testMast){
                                Date now = new Date();
                                //http请求测试
                                TestDto testDto = new TestDto();
                                testDto.setLocNo(testMast.getLocNo());
                                testDto.setBarcode(testMast.getBarcode());
                                testDto.setUserId(testMast.getUserId());
                                testDto.setRequestTime(DateUtils.convert(now));
                                String response = new HttpHandler.Builder()
                                        .setUri(testUrl)
                                        .setPath("/testUrlPath")
                                        .setJson(JSON.toJSONString(testDto))
                                        .build()
                                        .doPost();
                                JSONObject jsonObject = JSON.parseObject(response);
                                if (jsonObject.getInteger("code").equals(200)) {
                                    //更新测试表状态
                                    testMast.setStatus(1);
                                    testMast.setModiTime(now);
                                    if(!testMastService.update(testMast,new EntityWrapper<TestMast>()
                                            .eq("channel",1).eq("status",0))){
                                        throw new CoolException("更新产品测试状态失败");
                                    }
//                                    //更新库位状态,锁定pack状态,禁止入出库作业
//                                    LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",testMast.getLocNo()));
//                                    if(null != locMast){
//                                        locMast.setPackStatus(2);//测试中
//                                        locMast.setModiTime(now);
//                                        if(!locMastService.update(locMast,new EntityWrapper<LocMast>().eq("loc_no",testMast.getLocNo()))){
//                                            throw new CoolException("产品开始测试,更新目标库位锁定状态失败");
//                                        }
//                                    }
                                    //复位PLC信号
                                    boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, i*2));
                                } else {
                                    log.error("请求接口失败!!!url:{},request:{},response:{}", testUrl+"/rpc/pakin/loc/v1", JSON.toJSONString(testDto), response);
                                }
                            }
                        }
                    }
                }
            }
        } catch (Exception e) {
            log.error("启动测试  ===>> 启动测试失败", e);
            e.printStackTrace();
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
        }
    }
src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -84,7 +84,7 @@
                        break;
                    //复位测试信号
                    case 3:
                        siemensS7Net.Write("DB100." + (150 + ((int)task.getData()) * 2), 0);
                        siemensS7Net.Write("DB100." + (150 + (int)task.getData()), 0);
                        break;
                    default:
                        break;