#
zjj
2023-12-15 9167025bb8fe2f1b2c9b3d446a372c7cba16ef63
#
7个文件已修改
223 ■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/OpenController.java 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/SiteController.java 88 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/SiemensCrnThread.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/SiemensDevpThread.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/deviceOperate/devpOperate.html 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/OpenController.java
@@ -185,12 +185,12 @@
        }
        Map<String,Integer> map = new HashMap<>();
        map.put("J-1101",102);map.put("J-1102",101);
        map.put("J-1103",106);map.put("J-1104",105);
        map.put("J-1105",110);map.put("J-1106",109);
        map.put("J-1107",114);map.put("J-1108",113);
        map.put("J-1109",118);map.put("J-1110",117);
        map.put("J-1111",122);map.put("J-1112",121);
        map.put("J-1102",102);map.put("J-1101",101);
        map.put("J-1103",105);map.put("J-1104",106);
        map.put("J-1105",109);map.put("J-1106",110);
        map.put("J-1107",113);map.put("J-1108",114);
        map.put("J-1109",117);map.put("J-1110",118);
        map.put("J-1111",121);map.put("J-1112",122);
        map.put("H-1102",300);map.put("H-1101",305);
        map.put("G-1102",400);map.put("G-1101",405);
//        StaDesc staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>()
@@ -269,10 +269,21 @@
                StaDesc staDesc = new StaDesc();
                if (param.getTaskType().equals("CK") && param.getTargetWharf().contains("J")){
                    staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>()
                            .eq("crn_no", param.getTaskTunnel()).eq("type_no",2).lt("crn_stn", 200));
                            .eq("crn_no",param.getTaskTunnel())
                            .eq("type_no",2)
                            .lt("stn_no",200));
                }else if (param.getTaskType().equals("CK") && param.getTargetWharf().contains("H")){
                    staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>()
                            .eq("crn_no",param.getTaskTunnel())
                            .eq("type_no",2)
                            .lt("stn_no",400)
                            .gt("stn_no",200));
                }else {
                    staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>()
                            .eq("crn_no", param.getTaskTunnel()).eq("type_no",2).ge("crn_stn", 200));
                            .eq("crn_no",param.getTaskTunnel())
                            .eq("type_no",2)
                            .lt("stn_no",500)
                            .ge("stn_no",400));
                }
                param.setTargetLocationCode(staDesc.getStnNo().toString());
src/main/java/com/zy/asrs/controller/SiteController.java
@@ -232,6 +232,94 @@
        }
        return R.error("更新失败");
    }
    @PostMapping("/detl/out")
    @ManagerAuth(memo = "修改站点数据")
    public R siteDetlout(@RequestParam Integer devNo,
                            @RequestParam Short workNo,
                            @RequestParam Short staNo,
                            @RequestParam(required = false) String pakMk,
                            @RequestParam(required = false) Boolean inEnable,
                            @RequestParam(required = false) Boolean outEnable
    ) {
        BasDevp basDevp = basDevpService.selectById(devNo);
        if (basDevp == null) {
            return R.error("站点不存在");
        }
        for (DevpSlave devp : slaveProperties.getDevp()) {
            DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
            Map<Integer, StaProtocol> station = devpThread.getStation();
            for (Map.Entry<Integer, StaProtocol> entry : station.entrySet()) {
                if (devNo.equals(entry.getKey())) {
                    StaProtocol staProtocol = entry.getValue();
                    if (staProtocol == null) {
                        continue;
                    } else {
                        staProtocol = staProtocol.clone();
                    }
                    if (pakMk != null) {
                        staProtocol.setPakMk(pakMk.equals("Y"));
                    }
                    if (inEnable != null) {
                        staProtocol.setInEnable(inEnable);
                        basDevp.setInEnable(inEnable ? "Y" : "N");
                    }
                    if (outEnable != null) {
                        staProtocol.setOutEnable(outEnable);
                        basDevp.setOutEnable(outEnable ? "Y" : "N");
                    }
                    staProtocol.setWorkNo((short) 0);
                    staProtocol.setStaNo((short) 0);
                    basDevpService.updateById(basDevp);
                    boolean result = CommandUtils.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol), false);
                    if (result) {
                        return R.ok();
                    } else {
                        return R.error("下发命令失败");
                    }
                }
            }
        }
        return R.error("更新失败");
    }
    @PostMapping("/detl/in")
    @ManagerAuth(memo = "修改站点数据")
    public R siteDetlint(@RequestParam Integer devNo,
                         @RequestParam Short workNo,
                         @RequestParam Short staNo,
                         @RequestParam(required = false) String pakMk,
                         @RequestParam(required = false) Boolean inEnable,
                         @RequestParam(required = false) Boolean outEnable
    ) {
        BasDevp basDevp = basDevpService.selectById(devNo);
        if (basDevp == null) {
            return R.error("站点不存在");
        }
        for (DevpSlave devp : slaveProperties.getDevp()) {
            // 遍历入库口
            for (DevpSlave.Sta inSta : devp.getInSta()) {
                if (!devNo.equals(inSta.getBackSta()) ){
                    continue;
                }
                // 获取入库站信息
                DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
                StaProtocol staProtocol = devpThread.getStation().get(inSta.getBackSta());
                if (staProtocol == null) {
                    continue;
                } else {
                    staProtocol = staProtocol.clone();
                }
                staProtocol.setWorkNo((short) 9999);
                staProtocol.setStaNo(inSta.getStaNo().shortValue());
                boolean result = CommandUtils.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol), false);
                if (result) {
                    return R.ok();
                } else {
                    return R.error("下发命令失败");
                }
            }
        }
        return R.error("更新失败");
    }
    public List<PlcErrorTableVo> staPlcErr(Map.Entry<Integer, StaProtocol> entry){
        List<PlcErrorTableVo> list = new ArrayList<>();
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -89,6 +89,9 @@
    @Autowired
    private StaDescService staDescService;
    @Autowired
    private ApiLogService apiLogService;
    @Value("${wms.url}")
    private String wmsUrl;
    @Value("${wms.movePath}")
@@ -194,10 +197,10 @@
                            StaDesc staDesc = new StaDesc();
                            if (devp.getId() <= 1){
                                staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>()
                                        .eq("crn_no", taskWrk.getCrnNo()).eq("type_no",1).lt("crn_stn", 200));
                                        .eq("crn_no", taskWrk.getCrnNo()).eq("type_no",1).lt("stn_no", 200));
                            }else {
                                staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>()
                                        .eq("crn_no", taskWrk.getCrnNo()).eq("type_no",1).ge("crn_stn", 200));
                                        .eq("crn_no", taskWrk.getCrnNo()).eq("type_no",1).lt("stn_no", 400).ge("stn_no", 250));
                            }
                            staProtocol.setWorkNo(taskWrk.getWrkNo().shortValue());
                            staProtocol.setStaNo(staDesc.getCrnStn().shortValue());
@@ -223,6 +226,14 @@
                                log.error("wms通讯失败,"+e.getMessage());
                                continue;
                            }
                            apiLogService.save("wms请求入库货位接口"
                                    ,wmsUrl+"wcsManager/wcsInterface/inboundTaskApply"
                                    ,null
                                    ,"127.0.0.1"
                                    ,JSON.toJSONString(toWmsDTO)
                                    ,response
                                    ,true
                            );
                            JSONObject jsonObject = JSON.parseObject(response);
                            if (jsonObject.getInteger("code").equals(200)) {
                                GetWmsDto getWmsDto = JSON.parseObject(jsonObject.get("data").toString(), GetWmsDto.class);
@@ -720,7 +731,15 @@
                //获取指令ID
                Integer commandId = crnProtocol.getCommandId();
                CommandInfo commandInfo = commandInfoService.selectById(commandId);
                CommandInfo commandInfo = new CommandInfo();
                if (Cools.isEmpty(commandId)){
                    commandInfo = commandInfoService.selectOne(new EntityWrapper<CommandInfo>()
                            .eq("wrk_no",crnProtocol.getTaskNo())
                            .eq("device","Crn"));
                }else {
                    commandInfo = commandInfoService.selectById(commandId);
                }
                if (commandInfo == null) {
                    //指令不存在
                    continue;
@@ -1023,6 +1042,14 @@
        }catch (Exception e){
            log.error("堆垛机任务完成,请求wms任务完成接口失败");
        }
        apiLogService.save("堆垛机开始运行"
                ,wmsUrl+"wcsManager/wcsInterface/taskStatusFeedback"
                ,null
                ,"127.0.0.1"
                ,JSON.toJSONString(taskOverToWms)
                ,response
                ,true
        );
        return response;
    }
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -150,7 +150,7 @@
                ,wmsUrl+"wcsManager/wcsInterface/inboundTaskApply"
                ,null
                ,"127.0.0.1"
                ,JSON.toJSONString(param)
                ,JSON.toJSONString(toWmsDTO)
                ,response
                ,true
        );
@@ -175,12 +175,19 @@
                staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>()
                        .eq("crn_no",data.getTaskTunnel())
                        .eq("type_no",1)
                        .lt("crn_stn",200));
                        .lt("stn_no",200));
            }else if (param.getWharfSource().contains("H")){
                staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>()
                        .eq("crn_no",data.getTaskTunnel())
                        .eq("type_no",1)
                        .lt("stn_no",400)
                        .gt("stn_no",200));
            }else {
                staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>()
                        .eq("crn_no",data.getTaskTunnel())
                        .eq("type_no",1)
                        .ge("crn_stn",200));
                        .lt("stn_no",500)
                        .ge("stn_no",400));
            }
            map1.put("taskTunnel", staDesc.getStnDesc());
            //map1.put("taskTunnel", "J-1104");
src/main/java/com/zy/core/thread/SiemensCrnThread.java
@@ -275,7 +275,7 @@
                    CrnCommand crnCommand = new CrnCommand();
                    crnCommand.setAckFinish((short)1);
                    if (write(crnCommand)) {
                    if (write2(crnCommand)) {
                        resetFlag = false;
                    }
                }
src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -670,13 +670,6 @@
                staProtocol.setPakMk(true);
            }
            //更新任务步序
            TaskWrkService taskWrkService = SpringUtils.getBean(TaskWrkService.class);
            TaskWrk taskWrk = taskWrkService.selectByWrkNo(staProtocol.getWorkNo().intValue());
            if (taskWrk != null) {
                taskWrk.setCommandStep(taskWrk.getCommandStep() + 1);//更新指令步序
                taskWrkService.updateById(taskWrk);
            }
        }
    }
src/main/webapp/views/deviceOperate/devpOperate.html
@@ -54,7 +54,9 @@
                            </el-form-item>
                        </el-form>
                        <div>
                            <el-button @click="requestOperate('put')" type="primary">更新</el-button>
                            <el-button @click="requestOperate('update')" type="primary">更新</el-button>
                            <el-button @click="requestOperate('out')" type="warning">取货完成</el-button>
                            <el-button @click="requestOperate('in')" type="warning">放货完成</el-button>
                        </div>
                    </div>
                </el-card>
@@ -158,29 +160,36 @@
                        }
                    });
                },
                requestOperate() {
                requestOperate(method) {
                    let that = this
                    $.ajax({
                        url: baseUrl + "/site/detl/update",
                        headers: {
                            'token': localStorage.getItem('token')
                        },
                        data: this.formParam,
                        method: 'POST',
                        success: function (res) {
                            if (res.code == 200) {
                                that.$message({
                                    message: res.msg,
                                    type: 'success'
                                });
                            } else {
                                that.$message({
                                    message: res.msg,
                                    type: 'error'
                                });
                    that.$confirm('此操作存在风险,是否继续','提示',{
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning'
                    }).then(()=>{
                        $.ajax({
                            url: baseUrl + "/site/detl/"+method,
                            headers: {
                                'token': localStorage.getItem('token')
                            },
                            data: this.formParam,
                            method: 'POST',
                            success: function (res) {
                                if (res.code == 200) {
                                    that.$message({
                                        message: res.msg,
                                        type: 'success'
                                    });
                                } else {
                                    that.$message({
                                        message: res.msg,
                                        type: 'error'
                                    });
                                }
                            }
                        }
                    });
                        });
                    })
                }
            }
        })