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();
}
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;
}
}
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;
}
Aggregations