#
zjj
2023-12-14 45a87642e46c746802af13bf47bcd70e3b69277a
src/main/java/com/zy/core/thread/SiemensCrnThread.java
@@ -219,7 +219,7 @@
                    taskOverToWms.setTaskNo(taskWrk.getTaskNo()); //任务号
                    taskOverToWms.setTaskType(tasktype); // 任务类型
                    taskOverToWms.setContainerCode(taskWrk.getBarcode()); // 容器编码
                    if (taskWrk.getIoType() ==1 ){
                    if (taskWrk.getIoType() ==1 || taskWrk.getIoType() == 3){
                        taskOverToWms.setEquipmentCode(String.valueOf(taskWrk.getCrnNo())); //设备编码
                        taskOverToWms.setTargetLocationCode(taskWrk.getOriginTargetPoint()); //目标库位
                    }else if (taskWrk.getIoType() ==2){
@@ -230,10 +230,11 @@
                        map1.put(114,"J-1107");
                        map1.put(118,"J-1109");
                        map1.put(122,"J-1111");
                        map1.put(305,"H-1101");
                        map1.put(405,"G-1101");
                        taskOverToWms.setEquipmentCode(map1.get(taskWrk.getTargetPoint())); //设备编码
                        taskOverToWms.setSourceLocationCode(taskWrk.getOriginStartPoint()); //源库位
                    }
                    taskOverToWms.setTaskStatus("location_done"); //任务状态
                    String response = null;
                    try {
@@ -258,6 +259,9 @@
                    );
                    JSONObject jsonObject = JSON.parseObject(response);
                    if (jsonObject.getInteger("code").equals(200)){
                        if (taskWrk.getIoType() == 3){
                            taskWrk.setWrkSts(4);
                        }
                        taskWrk.setStatus(5);
                        if (!taskWrkService.update(taskWrk,new EntityWrapper<TaskWrk>().eq("wrk_no",crnProtocol.getTaskNo()))){
                            log.error("堆垛机任务完成,改变任务状态失败");
@@ -506,38 +510,17 @@
        }
        //更新命令日志
        CommandInfoLogService commandInfoLogService = SpringUtils.getBean(CommandInfoLogService.class);
        CommandInfoService commandInfoService = SpringUtils.getBean(CommandInfoService.class);
        CommandInfo commandInfo = commandInfoService.selectById(command.getCommandId());
        CommandInfoLog commandInfoLog = JSON.parseObject(JSON.toJSONString(commandInfo), CommandInfoLog.class);
        commandInfoLog.setId(null);
        if (result.IsSuccess) {
            log.warn("堆垛机命令下发[id:{},时间:{}] >>>>> {}", slave.getId(), DateUtils.convert(new Date(), DateUtils.yyyyMMddHHmmsssss_F), JSON.toJSON(command));
            OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] >>>>> 命令下发: {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command)));
            //更新指令日志
            commandInfoLog.setDeviceLog("指令下发成功");
            commandInfoLogService.insert(commandInfoLog);
            //更新任务步序
            TaskWrkService taskWrkService = SpringUtils.getBean(TaskWrkService.class);
            TaskWrk taskWrk = taskWrkService.selectByWrkNo(command.getTaskNo().intValue());
            if (taskWrk != null) {
                taskWrk.setCommandStep(taskWrk.getCommandStep() + 1);//更新指令步序
                taskWrkService.updateById(taskWrk);
            }
            return true;
        } else {
            OutputQueue.CRN.offer(MessageFormat.format("【{0}】写入堆垛机plc数据失败 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
            log.error("写入堆垛机plc数据失败 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot());
            //更新指令日志
            commandInfoLog.setDeviceLog("指令下发失败");
            commandInfoLogService.insert(commandInfoLog);
            return false;
        }
    }