Search in sources :

Example 6 with InstallGroup

use of com.eservice.api.model.install_group.InstallGroup in project sinsim by WilsonHu.

the class InstallPlanController method add.

@PostMapping("/add")
public Result add(String installPlan) {
    Result result = checkTheInstallPlanIsSet(installPlan);
    if (result.getCode() == ResultCode.FAIL.code) {
        logger.warn("不合法的installPlan: " + result.getMessage());
        return result;
    }
    InstallPlan installPlan1 = JSON.parseObject(installPlan, InstallPlan.class);
    installPlan1.setCreateDate(new Date());
    installPlanService.save(installPlan1);
    Machine machine = machineService.findById(installPlan1.getMachineId());
    InstallGroup installGroup = installGroupService.findById(installPlan1.getInstallGroupId());
    logger.info("add install plan, nameplate: " + machine.getNameplate() + ",组: " + installGroup.getGroupName() + ", date: " + installPlan1.getInstallDatePlan());
    return ResultGenerator.genSuccessResult();
}
Also used : InstallGroup(com.eservice.api.model.install_group.InstallGroup) Date(java.util.Date) Machine(com.eservice.api.model.machine.Machine) Result(com.eservice.api.core.Result) InstallPlan(com.eservice.api.model.install_plan.InstallPlan)

Example 7 with InstallGroup

use of com.eservice.api.model.install_group.InstallGroup in project sinsim by WilsonHu.

the class InstallPlanController method isOKtoSetPlan.

/**
 * 一次性添加多个排产。
 * @return
 */
// @PostMapping("/addInstallPlanList")
// public Result addInstallPlanList(
// //            @RequestBody List<String> installPlanList
// @RequestParam(value = "installPlanList") List<InstallPlan> installPlanList
// ) {
// 
// 
// Result result = null;
// logger.warn("aaaaaaaaa:" + installPlanList.get(0));
// return ResultGenerator.genSuccessResult();
// }
// 是否可以安排该机器该安装组(用于检查一些不合法的安排)
boolean isOKtoSetPlan(Integer installGroupId, Integer machineId) {
    InstallGroup installGroup = installGroupService.findById(installGroupId);
    if (installGroup == null) {
        logger.warn("Can not find the installGroup by id " + installGroupId);
        return false;
    }
    Machine machine = machineService.findById(machineId);
    if (machine == null) {
        logger.warn("Can not find the machine by id " + machineId);
        return false;
    }
    List<InstallPlanActualDetails> list = installPlanActualService.selectInstallPlanActualDetails(null, machine.getNameplate(), installGroup.getGroupName(), null, null, null, null);
    if (list == null || list.isEmpty()) {
        return true;
    } else {
        return false;
    }
}
Also used : InstallPlanActualDetails(com.eservice.api.model.install_plan_actual.InstallPlanActualDetails) InstallGroup(com.eservice.api.model.install_group.InstallGroup) Machine(com.eservice.api.model.machine.Machine)

Example 8 with InstallGroup

use of com.eservice.api.model.install_group.InstallGroup in project sinsim by WilsonHu.

the class CommonService method sendMqttMsg.

/**
 * 发送MQTT消息给订阅的app(安装组)。
 * 实例:mqtt topic: /s2c/task_remind/1, msg: {"nameplate":"namePlate123"} 其中1是 taskName为上轴安装的安装组的groupId
 *
 * @param taskName:
 * @param topic : MQTT topic
 * @param nameplate
 * @return  结果信息
 */
public String sendMqttMsg(String taskName, String topic, String nameplate) {
    String resultMsg = null;
    // taskName转groupId, 一个安装组可以有多种任务。
    InstallGroup installGroup = installGroupService.getInstallGroupByTaskName(taskName);
    if (installGroup == null) {
        resultMsg = "错误,根据taskName " + taskName + " 找不到对应的安装组";
        return resultMsg;
    }
    ServerToClientMsg msg = new ServerToClientMsg();
    msg.setNameplate(nameplate);
    mqttMessageHelper.sendToClient(topic + installGroup.getId(), JSON.toJSONString(msg));
    resultMsg = "try to send mqtt: " + topic + installGroup.getId() + " with message " + msg.getNameplate();
    return resultMsg;
}
Also used : ServerToClientMsg(com.eservice.api.service.mqtt.ServerToClientMsg) InstallGroup(com.eservice.api.model.install_group.InstallGroup)

Aggregations

InstallGroup (com.eservice.api.model.install_group.InstallGroup)8 Machine (com.eservice.api.model.machine.Machine)5 InstallPlan (com.eservice.api.model.install_plan.InstallPlan)4 Date (java.util.Date)3 MachineOrder (com.eservice.api.model.machine_order.MachineOrder)2 ProcessRecord (com.eservice.api.model.process_record.ProcessRecord)2 ServerToClientMsg (com.eservice.api.service.mqtt.ServerToClientMsg)2 PageInfo (com.github.pagehelper.PageInfo)2 PostMapping (org.springframework.web.bind.annotation.PostMapping)2 Result (com.eservice.api.core.Result)1 InstallPlanActual (com.eservice.api.model.install_plan_actual.InstallPlanActual)1 InstallPlanActualDetails (com.eservice.api.model.install_plan_actual.InstallPlanActualDetails)1 Task (com.eservice.api.model.task.Task)1 TaskPlan (com.eservice.api.model.task_plan.TaskPlan)1 TaskRecord (com.eservice.api.model.task_record.TaskRecord)1 LinkDataModel (com.eservice.api.service.common.LinkDataModel)1 NodeDataModel (com.eservice.api.service.common.NodeDataModel)1 ArrayList (java.util.ArrayList)1 Transactional (org.springframework.transaction.annotation.Transactional)1 Condition (tk.mybatis.mapper.entity.Condition)1