Search in sources :

Example 1 with ServerToClientMsg

use of com.eservice.api.service.mqtt.ServerToClientMsg in project sinsim by WilsonHu.

the class TaskPlanServiceImpl method addTaskPlans.

// 每新增1个工序,调用一次。
@Transactional(rollbackFor = Exception.class)
public boolean addTaskPlans(@RequestParam List<Integer> taskRecordIds, Integer planType, String machineStrId, Date planDate, Integer userId) {
    for (int i = 0; i < taskRecordIds.size(); i++) {
        Condition tempCondition = new Condition(TaskPlan.class);
        Integer id = taskRecordIds.get(i);
        tempCondition.createCriteria().andCondition("task_record_id = ", id);
        List<TaskPlan> existPlans = findByCondition(tempCondition);
        if (existPlans.size() > 0) {
            return false;
        }
        TaskPlan plan = new TaskPlan();
        plan.setCreateTime(new Date());
        plan.setUserId(userId);
        plan.setTaskRecordId(id);
        plan.setPlanType(Constant.DAILY_PLAN);
        if (planType.intValue() == Constant.DAILY_PLAN.intValue()) {
            plan.setPlanTime(planDate);
        } else if (planType.intValue() == Constant.FLEX_PLAN.intValue()) {
            plan.setDeadline(planDate);
        }
        save(plan);
        // 更改task record状态为已计划
        TaskRecord taskRecord = taskRecordService.findById(id);
        if (taskRecord != null) {
            // 检查是否为第一个计划项,如果是,需要设置为待安装状态
            Integer processRecordId = taskRecord.getProcessRecordId();
            ProcessRecord processRecord = processRecordService.findById(processRecordId);
            List<LinkDataModel> linkDataList = JSON.parseArray(processRecord.getLinkData(), LinkDataModel.class);
            for (LinkDataModel item : linkDataList) {
                if (item.getTo().equals(taskRecord.getNodeKey().intValue())) {
                    if (item.getFrom() == null || item.getFrom() == -1) {
                        taskRecord.setUpdateTime(new Date());
                        taskRecord.setStatus(Constant.TASK_INSTALL_WAITING);
                        break;
                    } else {
                        // TODO:如果是重新配置流程项,比如:改单、拆单以后再最后增加了安装项,则需要设置成待安装状态
                        List<Integer> parentNodeList = new ArrayList<>();
                        String nodeData = processRecord.getNodeData();
                        List<NodeDataModel> ndList = JSON.parseArray(nodeData, NodeDataModel.class);
                        for (LinkDataModel tmp : linkDataList) {
                            if (tmp.getTo() == taskRecord.getNodeKey().intValue()) {
                                parentNodeList.add(tmp.getFrom());
                            }
                        }
                        boolean allParentFinished = true;
                        for (Integer parentNodeKey : parentNodeList) {
                            for (NodeDataModel nodeDataModel : ndList) {
                                if (parentNodeKey.intValue() == Integer.valueOf(nodeDataModel.getKey())) {
                                    if (Integer.valueOf(nodeDataModel.getTaskStatus()) != Constant.TASK_QUALITY_DONE.intValue()) {
                                        allParentFinished = false;
                                        break;
                                    }
                                }
                            }
                            if (!allParentFinished) {
                                break;
                            }
                        }
                        if (allParentFinished) {
                            taskRecord.setUpdateTime(new Date());
                            taskRecord.setStatus(Constant.TASK_INSTALL_WAITING);
                        }
                    }
                }
            }
            if (taskRecord.getStatus().equals(Constant.TASK_INITIAL)) {
                taskRecord.setStatus(Constant.TASK_PLANED);
            }
            taskRecordService.update(taskRecord);
            // 更新task_record以外,但是跟task record相关的状态,机器状态,process_record中的task_status
            commonService.updateTaskRecordRelatedStatus(taskRecord);
            if (taskRecord.getStatus().equals(Constant.TASK_INSTALL_WAITING)) {
                // MQTT 计划后,通知安装组长,可以进行安装
                String taskName = taskRecord.getTaskName();
                Condition condition = new Condition(Task.class);
                condition.createCriteria().andCondition("task_name = ", taskName);
                List<Task> taskList = taskService.findByCondition(condition);
                if (taskList == null || taskList.size() <= 0) {
                    throw new RuntimeException();
                }
                ProcessRecord pr = processRecordService.findById(taskRecord.getProcessRecordId());
                Machine machine = machineService.findById(pr.getMachineId());
                MachineOrder machineOrder = machineOrderService.findById(machine.getOrderId());
                ServerToClientMsg msg = new ServerToClientMsg();
                msg.setOrderNum(machineOrder.getOrderNum());
                msg.setNameplate(machine.getNameplate());
                mqttMessageHelper.sendToClient(Constant.S2C_TASK_INSTALL + taskList.get(0).getGroupId(), JSON.toJSONString(msg));
            }
            // /在”计划管理“中 添加计划安排时,自动添加了 总装排产 InstallPlan。 (InstallPlanActual则在app扫码完成工序时添加)
            // 因为把总装排产,合并到“计划管理”,所以需要在安排计划时 自动生成总装排产(这样在app上扫码完成时,才能有总装完成自动填充完成头数)
            InstallPlan installPlan1 = new InstallPlan();
            installPlan1.setType(Constant.STR_INSTALL_TYPE_WHOLE);
            InstallGroup installGroup = installGroupService.getInstallGroupByTaskName(taskRecord.getTaskName());
            installPlan1.setInstallGroupId(installGroup.getId());
            installPlan1.setInstallDatePlan(plan.getPlanTime());
            ProcessRecord pr = processRecordService.findById(taskRecord.getProcessRecordId());
            Machine machine = machineService.findById(pr.getMachineId());
            MachineOrder machineOrder = machineOrderService.findById(machine.getOrderId());
            installPlan1.setOrderId(machineOrder.getId());
            installPlan1.setMachineId(machine.getId());
            installPlan1.setValid(Byte.valueOf("1"));
            installPlan1.setCreateDate(new Date());
            installPlanService.save(installPlan1);
            logger.info("自动添加了 总装排产 for 铭牌号: " + machine.getNameplate() + ", 工序: " + taskRecord.getTaskName());
        } else {
            // 进行事务操作
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            throw new RuntimeException();
        }
    }
    if (taskRecordIds.size() > 0 && machineStrId != null) {
        List<Machine> machineList = machineService.selectMachines(null, null, null, machineStrId, null, null, null, null, null, null, false);
        if (machineList.size() == 1) {
            // 如果机器状态小于计划中,则更新为计划中
            Machine machine = machineList.get(0);
            if (machine.getStatus() < Constant.MACHINE_PLANING) {
                machine.setStatus(Constant.MACHINE_PLANING);
                machineService.update(machine);
            }
        } else {
            // 进行事务rollback操作
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            throw new RuntimeException();
        }
    }
    return true;
}
Also used : TaskRecord(com.eservice.api.model.task_record.TaskRecord) Task(com.eservice.api.model.task.Task) TaskPlan(com.eservice.api.model.task_plan.TaskPlan) ArrayList(java.util.ArrayList) InstallGroup(com.eservice.api.model.install_group.InstallGroup) Machine(com.eservice.api.model.machine.Machine) NodeDataModel(com.eservice.api.service.common.NodeDataModel) ProcessRecord(com.eservice.api.model.process_record.ProcessRecord) MachineOrder(com.eservice.api.model.machine_order.MachineOrder) Condition(tk.mybatis.mapper.entity.Condition) LinkDataModel(com.eservice.api.service.common.LinkDataModel) ServerToClientMsg(com.eservice.api.service.mqtt.ServerToClientMsg) Date(java.util.Date) InstallPlan(com.eservice.api.model.install_plan.InstallPlan) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with ServerToClientMsg

use of com.eservice.api.service.mqtt.ServerToClientMsg in project sinsim by WilsonHu.

the class InstallPlanController method addAndsendInstallPlanNow.

/**
 * 添加并立即发送(MQTT) 该排产计划 给该计划所在组的所有安装组长
 */
@PostMapping("/addAndsendInstallPlanNow")
public Result addAndsendInstallPlanNow(String installPlan) {
    InstallPlan installPlan1 = JSON.parseObject(installPlan, InstallPlan.class);
    if (installPlan1 == null) {
        return ResultGenerator.genFailResult("installPlan 解析得到null");
    }
    installPlan1.setCreateDate(new Date());
    ServerToClientMsg msg = new ServerToClientMsg();
    String str = null;
    msg.setNameplate(machineService.findById(installPlan1.getMachineId()).getNameplate());
    msg.setOrderNum(machineOrderService.findById(installPlan1.getOrderId()).getOrderNum());
    msg.setType(ServerToClientMsg.MsgType.INSTALL_PLAN);
    msg.setCmtSend(installPlan1.getCmtSend());
    msg.setInstallDatePlan(installPlan1.getInstallDatePlan());
    mqttMessageHelper.sendToClient(Constant.S2C_INSTALL_PLAN + installPlan1.getInstallGroupId(), JSON.toJSONString(msg));
    str = "MQTT SEND topic: " + Constant.S2C_INSTALL_PLAN + installPlan1.getInstallGroupId() + ", nameplate: " + msg.getNameplate();
    logger.info(str);
    /**
     * 即使没有安装组长,也安排排产
     */
    installPlan1.setSendTime(new Date());
    installPlanService.save(installPlan1);
    logger.info(str);
    return ResultGenerator.genSuccessResult(str);
}
Also used : ServerToClientMsg(com.eservice.api.service.mqtt.ServerToClientMsg) Date(java.util.Date) InstallPlan(com.eservice.api.model.install_plan.InstallPlan)

Example 3 with ServerToClientMsg

use of com.eservice.api.service.mqtt.ServerToClientMsg in project sinsim by WilsonHu.

the class CommonService method updateTaskRecordRelatedStatus.

public boolean updateTaskRecordRelatedStatus(TaskRecord tr) {
    if (tr == null || tr.getProcessRecordId() == null) {
        return false;
    } else {
        Integer prId = tr.getProcessRecordId();
        ProcessRecord pr = processRecordService.findById(prId);
        Machine machine = machineService.findById(pr.getMachineId());
        boolean isNeedUpdateMachine = false;
        if (pr != null) {
            String nodeData = pr.getNodeData();
            List<NodeDataModel> ndList = JSON.parseArray(nodeData, NodeDataModel.class);
            NodeDataModel ndItem = null;
            Integer index = -1;
            for (int i = 0; i < ndList.size(); i++) {
                if (Integer.parseInt(ndList.get(i).getKey()) == tr.getNodeKey()) {
                    index = i;
                    break;
                }
            }
            if (index > -1) {
                ndItem = ndList.get(index);
                ndItem.setTaskStatus(tr.getStatus().toString());
                if (tr.getStatus().intValue() == Constant.TASK_PLANED.intValue() || tr.getStatus().intValue() == Constant.TASK_INSTALL_WAITING.intValue()) {
                    if (tr.getInstallBeginTime() == null) {
                        String date = Utils.getFormatStringDate(new Date(), "yyyy-MM-dd HH:mm:ss");
                        ndItem.setBeginTime(date);
                    }
                }
                if (tr.getInstallBeginTime() != null) {
                    String date = Utils.getFormatStringDate(tr.getInstallBeginTime(), "yyyy-MM-dd HH:mm:ss");
                    ndItem.setBeginTime(date);
                }
                // 质检完成,工序才算完成
                if (tr.getQualityEndTime() != null) {
                    String date = Utils.getFormatStringDate(tr.getQualityEndTime(), "yyyy-MM-dd HH:mm:ss");
                    ndItem.setEndTime(date);
                }
                // 组长信息
                if (tr.getLeader() != null && tr.getLeader().length() > 0) {
                    ndItem.setLeader(tr.getLeader());
                }
                // 工作人员信息
                if (tr.getWorkerList() != null && tr.getWorkerList().length() > 0) {
                    ndItem.setWorkList(tr.getWorkerList());
                }
                ndList.set(index, ndItem);
                // 如果当前工序是质检完成状态或者跳过状态,需要检查其子节点是否可以开始 -->3期时,工序安装完成,状态不再是“质检完成”而是“安装完成”
                if (tr.getStatus().intValue() == Constant.TASK_QUALITY_DONE.intValue() || tr.getStatus().intValue() == Constant.TASK_INSTALLED.intValue() || tr.getStatus().intValue() == Constant.TASK_SKIP.intValue()) {
                    List<LinkDataModel> linkDataList = JSON.parseArray(pr.getLinkData(), LinkDataModel.class);
                    for (LinkDataModel item : linkDataList) {
                        if (String.valueOf(item.getFrom()).equals(String.valueOf(ndItem.getKey()))) {
                            for (NodeDataModel childNode : ndList) {
                                // 先找到子节点
                                if (childNode.getKey().equals(String.valueOf(item.getTo()))) {
                                    // 找到子节点的所有父节点
                                    boolean allParentFinished = true;
                                    for (LinkDataModel parentOfChild : linkDataList) {
                                        if (!allParentFinished) {
                                            break;
                                        }
                                        if (String.valueOf(parentOfChild.getTo()).equals(childNode.getKey())) {
                                            for (NodeDataModel parentOfChildNode : ndList) {
                                                if (!allParentFinished) {
                                                    break;
                                                }
                                                if (String.valueOf(parentOfChild.getFrom()).equals(parentOfChildNode.getKey())) {
                                                    if (parentOfChildNode.getCategory() != null && (parentOfChildNode.getCategory().equals("Start") || parentOfChildNode.getCategory().equals("End"))) {
                                                        break;
                                                    }
                                                    // 3期质检,安装完成是真的“安装完成”。3期之前,安装完成时,状态是“质检完成”
                                                    if ((Integer.valueOf(parentOfChildNode.getTaskStatus()) != Constant.TASK_QUALITY_DONE.intValue() && Integer.valueOf(parentOfChildNode.getTaskStatus()) != Constant.TASK_INSTALLED.intValue()) && Integer.valueOf(parentOfChildNode.getTaskStatus()) != Constant.TASK_SKIP.intValue()) {
                                                        allParentFinished = false;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    // 子节点的所有父节点都已经完成,则更新子节点的状态
                                    if (allParentFinished) {
                                        // 如果子工序不是结束“End”
                                        if (!"End".equals(childNode.getCategory())) {
                                            if (Integer.valueOf(childNode.getTaskStatus()) < Constant.TASK_INSTALL_WAITING.intValue()) {
                                                String dateStr = Utils.getFormatStringDate(new Date(), "yyyy-MM-dd HH:mm:ss");
                                                childNode.setBeginTime(dateStr);
                                                childNode.setTaskStatus(Constant.TASK_INSTALL_WAITING.toString());
                                                List<TaskRecord> taskRecordList = taskRecordService.getTaskRecordData(null, prId);
                                                for (TaskRecord record : taskRecordList) {
                                                    if (String.valueOf(record.getNodeKey().intValue()).equals(childNode.getKey())) {
                                                        record.setUpdateTime(new Date());
                                                        record.setStatus(Constant.TASK_INSTALL_WAITING);
                                                        taskRecordService.update(record);
                                                        // MQTT 通知下一道工序可以开始安装
                                                        ServerToClientMsg msg = new ServerToClientMsg();
                                                        MachineOrder machineOrder = machineOrderService.findById(machine.getOrderId());
                                                        msg.setOrderNum(machineOrder.getOrderNum());
                                                        msg.setNameplate(machine.getNameplate());
                                                        // 找到工序对应的group_id
                                                        String taskName = record.getTaskName();
                                                        Condition condition = new Condition(Task.class);
                                                        condition.createCriteria().andCondition("task_name = ", taskName);
                                                        List<Task> taskList = taskService.findByCondition(condition);
                                                        if (taskList == null || taskList.size() <= 0) {
                                                            throw new RuntimeException();
                                                        }
                                                        mqttMessageHelper.sendToClient(Constant.S2C_TASK_INSTALL + taskList.get(0).getGroupId(), JSON.toJSONString(msg));
                                                    // 这个break需要去掉,因为存在多个子工序可以安装的情况
                                                    // break;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            Boolean isFinished = true;
            for (int i = 0; i < ndList.size() && isFinished; i++) {
                // 开始和结束节点不考虑在内
                if (ndList.get(i).getCategory() != null && (ndList.get(i).getCategory().equals("Start") || ndList.get(i).getCategory().equals("End"))) {
                    continue;
                }
                if (ndList.get(i).getTaskStatus() != null && (Integer.parseInt(ndList.get(i).getTaskStatus()) != Constant.TASK_QUALITY_DONE.intValue() && Integer.parseInt(ndList.get(i).getTaskStatus()) != Constant.TASK_INSTALLED.intValue())) {
                    isFinished = false;
                }
            }
            // 所有工序完成
            if (isFinished && (tr.getStatus() == Constant.TASK_QUALITY_DONE.intValue() || tr.getStatus() == Constant.TASK_INSTALLED.intValue())) {
                pr.setEndTime(new Date());
                // 安装完成
                machine.setStatus(Constant.MACHINE_INSTALLED);
                isNeedUpdateMachine = true;
            }
            if (machine.getStatus().equals(Constant.MACHINE_PLANING)) {
                // 安装中
                machine.setStatus(Constant.MACHINE_INSTALLING);
                isNeedUpdateMachine = true;
            }
            if (isNeedUpdateMachine) {
                machine.setUpdateTime(new Date());
                machineService.update(machine);
            }
            pr.setNodeData(JSON.toJSONString(ndList));
            processRecordService.update(pr);
            return true;
        } else {
            return false;
        }
    }
}
Also used : Condition(tk.mybatis.mapper.entity.Condition) TaskRecord(com.eservice.api.model.task_record.TaskRecord) Task(com.eservice.api.model.task.Task) ServerToClientMsg(com.eservice.api.service.mqtt.ServerToClientMsg) Machine(com.eservice.api.model.machine.Machine) ProcessRecord(com.eservice.api.model.process_record.ProcessRecord) MachineOrder(com.eservice.api.model.machine_order.MachineOrder)

Example 4 with ServerToClientMsg

use of com.eservice.api.service.mqtt.ServerToClientMsg in project sinsim by WilsonHu.

the class AbnormalRecordController method update.

@PostMapping("/update")
@Transactional(rollbackFor = Exception.class)
public Result update(String abnormalRecord) {
    AbnormalRecord abnormalRecord1 = JSON.parseObject(abnormalRecord, AbnormalRecord.class);
    abnormalRecord1.setSolveTime(new Date());
    if (abnormalRecord1.getSolution() == null || abnormalRecord1.getSolution().isEmpty()) {
        // abnormalRecord1.setSolution("空");
        return ResultGenerator.genFailResult("请填写解决内容");
    }
    // 修改对应工序的状态为"安装中"或者“质检中”,需要检查安装开始时间和质检开始时间,质检已开始则状态为质检中
    AbnormalRecord completeInfo = abnormalRecordService.findById(abnormalRecord1.getId());
    Integer taskRecordId = completeInfo.getTaskRecordId();
    if (taskRecordId != null && taskRecordId > 0) {
        TaskRecord tr = taskRecordService.findById(taskRecordId);
        // MQTT 异常解决后,通知工序的安装组长
        String taskName = tr.getTaskName();
        Condition condition = new Condition(Task.class);
        condition.createCriteria().andCondition("task_name = ", taskName);
        List<Task> taskList = taskService.findByCondition(condition);
        if (taskList == null || taskList.size() <= 0) {
            throw new RuntimeException();
        }
        tr.setStatus(Constant.TASK_INSTALLING);
        taskRecordService.update(tr);
        // 更新task record状态时候,必须去更新process record中对应task的状态
        commonService.updateTaskRecordRelatedStatus(tr);
        ProcessRecord pr = processRecordService.findById(tr.getProcessRecordId());
        Machine machine = machineService.findById(pr.getMachineId());
        MachineOrder machineOrder = machineOrderService.findById(machine.getOrderId());
        ServerToClientMsg msg = new ServerToClientMsg();
        msg.setOrderNum(machineOrder.getOrderNum());
        msg.setNameplate(machine.getNameplate());
        mqttMessageHelper.sendToClient(Constant.S2C_INSTALL_ABNORMAL_RESOLVE + taskList.get(0).getGroupId(), JSON.toJSONString(msg));
    } else {
        throw new RuntimeException();
    }
    abnormalRecordService.update(abnormalRecord1);
    return ResultGenerator.genSuccessResult();
}
Also used : Condition(tk.mybatis.mapper.entity.Condition) TaskRecord(com.eservice.api.model.task_record.TaskRecord) Task(com.eservice.api.model.task.Task) ServerToClientMsg(com.eservice.api.service.mqtt.ServerToClientMsg) Date(java.util.Date) Machine(com.eservice.api.model.machine.Machine) AbnormalRecord(com.eservice.api.model.abnormal_record.AbnormalRecord) ProcessRecord(com.eservice.api.model.process_record.ProcessRecord) MachineOrder(com.eservice.api.model.machine_order.MachineOrder) PostMapping(org.springframework.web.bind.annotation.PostMapping) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with ServerToClientMsg

use of com.eservice.api.service.mqtt.ServerToClientMsg in project sinsim by WilsonHu.

the class TaskRecordController method addTrTqrQri.

/**
 * 3个表 task_record/TaskQualityRecord/QualityRecordImage 更新。
 * app端,上传质检异常状态,task_record(update),增加 TaskQualityRecord(add), QualityRecordImage (add)
 * 没有质检员了,这个接口没在用。
 */
@Transactional(rollbackFor = Exception.class)
@PostMapping("/addTrTqrQri")
public Result addTrTqrQri(@RequestParam String taskRecord, @RequestParam String taskQualityRecord, @RequestParam MultipartFile[] files) {
    // task_record(update)
    TaskRecord taskRecord1 = JSON.parseObject(taskRecord, TaskRecord.class);
    taskRecordService.update(taskRecord1);
    TaskQualityRecord taskQualityRecord1 = JSON.parseObject(taskQualityRecord, TaskQualityRecord.class);
    // 质检异常类型,目前未使用,default值为1
    taskQualityRecord1.setAbnormalType(1);
    taskQualityRecordService.saveAndGetID(taskQualityRecord1);
    // 获取保存后分配到的id
    Integer taskQualityRecordId = taskQualityRecord1.getId();
    // 构建 qualityRecordImage1
    QualityRecordImage qualityRecordImage1 = new QualityRecordImage();
    File dir = new File(qualityImagesSavedDir);
    if (!dir.exists()) {
        dir.mkdir();
    }
    String machineID = machineService.searchMachineByTaskQualityRecordId(taskQualityRecordId).getMachineStrId();
    Integer orderId = machineService.searchMachineByTaskQualityRecordId(taskQualityRecordId).getOrderId();
    String orderNum = machineOrderService.findById(orderId).getOrderNum();
    List<String> listResultPath = new ArrayList<>();
    for (int i = 0; i < files.length; i++) {
        try {
            listResultPath.add(commonService.saveFile(qualityImagesSavedDir, files[i], machineID, orderNum, Constant.QUALITY_IMAGE, i));
        } catch (IOException e) {
            e.printStackTrace();
            // 抛异常引发回滚,防止数据只更新了前面部分。
            throw new RuntimeException();
        }
    }
    if (listResultPath.size() != files.length) {
        throw new RuntimeException();
    } else {
        qualityRecordImage1.setTaskQualityRecordId(taskQualityRecordId);
        qualityRecordImage1.setImage(listResultPath.toString());
        qualityRecordImage1.setCreateTime(taskQualityRecord1.getCreateTime());
        qualityRecordImageService.save(qualityRecordImage1);
    }
    // 找到工序对应的quality_user_id
    String taskName = taskRecord1.getTaskName();
    Condition condition = new Condition(Task.class);
    condition.createCriteria().andCondition("task_name = ", taskName);
    List<Task> taskList = taskService.findByCondition(condition);
    if (taskList == null || taskList.size() <= 0) {
        throw new RuntimeException();
    }
    Integer prId = taskRecord1.getProcessRecordId();
    if (prId == null || prId < 0) {
        Logger.getLogger("").log(Level.INFO, "processrecord Id 为空");
    } else {
        // Update task record相关的状态
        if (!commonService.updateTaskRecordRelatedStatus(taskRecord1)) {
            // 更新出错进行事务回退
            throw new RuntimeException();
        }
    }
    ProcessRecord pr = processRecordService.findById(prId);
    Machine machine = machineService.findById(pr.getMachineId());
    MachineOrder machineOrder = machineOrderService.findById(machine.getOrderId());
    ServerToClientMsg msg = new ServerToClientMsg();
    msg.setOrderNum(machineOrder.getOrderNum());
    msg.setNameplate(machine.getNameplate());
    if (taskRecord1.getStatus().equals(Constant.TASK_QUALITY_ABNORMAL)) {
        // MQTT 发生质检异常时,通知安装组长以及生产部管理员
        mqttMessageHelper.sendToClient(Constant.S2C_QUALITY_ABNORMAL + taskList.get(0).getGroupId(), JSON.toJSONString(msg));
    }
    return ResultGenerator.genSuccessResult("3个表 task_record + TaskQualityRecord + QualityRecordImage 更新成功");
}
Also used : Condition(tk.mybatis.mapper.entity.Condition) TaskRecord(com.eservice.api.model.task_record.TaskRecord) Task(com.eservice.api.model.task.Task) ArrayList(java.util.ArrayList) ServerToClientMsg(com.eservice.api.service.mqtt.ServerToClientMsg) TaskQualityRecord(com.eservice.api.model.task_quality_record.TaskQualityRecord) QualityRecordImage(com.eservice.api.model.quality_record_image.QualityRecordImage) Machine(com.eservice.api.model.machine.Machine) ProcessRecord(com.eservice.api.model.process_record.ProcessRecord) MachineOrder(com.eservice.api.model.machine_order.MachineOrder) MultipartFile(org.springframework.web.multipart.MultipartFile) PostMapping(org.springframework.web.bind.annotation.PostMapping) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

ServerToClientMsg (com.eservice.api.service.mqtt.ServerToClientMsg)13 Machine (com.eservice.api.model.machine.Machine)10 MachineOrder (com.eservice.api.model.machine_order.MachineOrder)10 Date (java.util.Date)9 Task (com.eservice.api.model.task.Task)8 PostMapping (org.springframework.web.bind.annotation.PostMapping)8 Condition (tk.mybatis.mapper.entity.Condition)8 ProcessRecord (com.eservice.api.model.process_record.ProcessRecord)7 TaskRecord (com.eservice.api.model.task_record.TaskRecord)7 Transactional (org.springframework.transaction.annotation.Transactional)7 ArrayList (java.util.ArrayList)4 InstallPlan (com.eservice.api.model.install_plan.InstallPlan)3 AbnormalRecord (com.eservice.api.model.abnormal_record.AbnormalRecord)2 Contract (com.eservice.api.model.contract.Contract)2 MachineOrderWrapper (com.eservice.api.model.contract.MachineOrderWrapper)2 ContractSign (com.eservice.api.model.contract_sign.ContractSign)2 InstallGroup (com.eservice.api.model.install_group.InstallGroup)2 MachineOrderDetail (com.eservice.api.model.machine_order.MachineOrderDetail)2 OrderDetail (com.eservice.api.model.order_detail.OrderDetail)2 OrderSign (com.eservice.api.model.order_sign.OrderSign)2