use of com.eservice.api.model.quality_inspect.QualityInspect in project sinsim by WilsonHu.
the class QualityInspectController method list.
@PostMapping("/list")
public Result list(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0") Integer size) {
PageHelper.startPage(page, size);
List<QualityInspect> list = qualityInspectService.findAll();
PageInfo pageInfo = new PageInfo(list);
return ResultGenerator.genSuccessResult(pageInfo);
}
use of com.eservice.api.model.quality_inspect.QualityInspect in project sinsim by WilsonHu.
the class QualityInspectController method getQualityInspectByTaskName.
/**
* 根据工序名称,查找该工序所要做的质检项。
*/
@PostMapping("/getQualityInspectByTaskName")
public Result getQualityInspectByTaskName(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0") Integer size, String taskName) {
PageHelper.startPage(page, size);
List<QualityInspect> list = qualityInspectService.getQualityInspectByTaskName(taskName);
PageInfo pageInfo = new PageInfo(list);
return ResultGenerator.genSuccessResult(pageInfo);
}
use of com.eservice.api.model.quality_inspect.QualityInspect in project sinsim by WilsonHu.
the class QualityInspectController method getQualityInspect.
@PostMapping("/getQualityInspect")
public Result getQualityInspect(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0") Integer size, String taskName, String inspectName, String inspectType, String inspectPhase, String inspectContent, Byte isValid) {
PageHelper.startPage(page, size);
// Condition condition = new Condition(QualityInspect.class);
// condition.createCriteria().andCondition("valid = ", isValid);
// if(inspectName !=null && !inspectName.isEmpty()) {
// // condition.createCriteria().andLike("inspect_name ",inspectName);
// // condition.createCriteria().andLike("inspectName",inspectName);
// // condition.createCriteria().andLike("inspectName","%"+ inspectName +"%");
//
// }
List<QualityInspect> list = qualityInspectService.getQualityInspect(taskName, inspectName, inspectType, inspectPhase, inspectContent, isValid);
PageInfo pageInfo = new PageInfo(list);
return ResultGenerator.genSuccessResult(pageInfo);
}
use of com.eservice.api.model.quality_inspect.QualityInspect in project sinsim by WilsonHu.
the class QualityInspectController method add.
@PostMapping("/add")
public Result add(QualityInspect qualityInspect) {
// 质检名称唯一性
Condition condition = new Condition(QualityInspect.class);
// 1 is valid
condition.createCriteria().andCondition("valid = ", 1);
List<QualityInspect> list = qualityInspectService.findByCondition(condition);
for (int k = 0; k < list.size(); k++) {
if (list.get(k).getInspectName().equals(qualityInspect.getInspectName())) {
return ResultGenerator.genFailResult(qualityInspect.getInspectName() + "已经存在该名称,请换一个名称");
}
}
qualityInspectService.save(qualityInspect);
return ResultGenerator.genSuccessResult();
}
use of com.eservice.api.model.quality_inspect.QualityInspect in project sinsim by WilsonHu.
the class MachineController method update.
@PostMapping("/update")
public Result update(String machine) {
logger.info(machine);
Machine machine1 = JSON.parseObject(machine, Machine.class);
machine1.setUpdateTime(new Date());
// 如果该机器有对应的工序是跳过未完成的,不允许设置为已完成。
if (machine1.getNameplate() != null && !machine1.getNameplate().isEmpty()) {
List<TaskRecordDetail> list = taskRecordService.selectTaskRecordByMachineNameplate(machine1.getNameplate());
for (int i = 0; i < list.size(); i++) {
if (list.get(i).getStatus().equals(Constant.TASK_SKIP)) {
return ResultGenerator.genFailResult("该机器还有处于跳过状态的工序:" + list.get(i).getTaskName() + ",不允许设置为完成!");
}
}
}
/**
* 3期新质检:
* 如果是设置了 机器位置(从无到有),则创建质检记录(状态为未质检),发消息给质检人员,表示要开始安装了,可以过来看了。
* 大概是因为有些质检需要在安装过程中看。
*
* 创建该机器的所有工序对应的所有质检项, 注意: 如果工序没有包含质检项,则不会生成该工序的质检项。
*/
Machine machineOld = machineService.findById(machine1.getId());
if (machineOld != null) {
if ((machineOld.getLocation() == null || machineOld.getLocation().isEmpty()) && (machine1.getLocation() != null)) {
MachineOrder machineOrder = machineOrderService.getMachineOrderByNameplate(machine1.getNameplate());
List<Task> taskList = taskService.getTaskByNameplate(machine1.getNameplate());
if (taskList != null) {
logger.info("该机器包含的工序数:" + taskList.size());
for (int i = 0; i < taskList.size(); i++) {
// 找到该工序名下的质检项
List<QualityInspect> qualityInspectListlist = qualityInspectService.getQualityInspectByTaskName(taskList.get(i).getTaskName());
if (qualityInspectListlist != null) {
logger.info(taskList.get(i).getTaskName() + " 工序包含的质检项有:" + qualityInspectListlist.size());
for (int q = 0; q < qualityInspectListlist.size(); q++) {
QualityInspectRecord qualityInspectRecord = new QualityInspectRecord();
qualityInspectRecord.setCreateTime(new Date());
qualityInspectRecord.setTaskName(taskList.get(i).getTaskName());
qualityInspectRecord.setInspectName(qualityInspectListlist.get(q).getInspectName());
qualityInspectRecord.setMachineNameplate(machine1.getNameplate());
if (machineOrder != null) {
qualityInspectRecord.setOrderNumber(machineOrder.getOrderNum());
} else {
logger.warn("根据" + machine1.getNameplate() + " 找不到订单号");
}
/**
* 因为要和APP其他状态共用一些代码,所以这里不要用字符串,用数字
*/
// qualityInspectRecord.setRecordStatus(Constant.STR_QUALITY_INSPECT_NOT_START);
qualityInspectRecord.setRecordStatus(Constant.TASK_QUALITY_INSPECT_NOT_STARTED.toString());
qualityInspectRecordService.save(qualityInspectRecord);
logger.info("生成qualityInspectRecord成功, 铭牌号:" + qualityInspectRecord.getMachineNameplate() + ",inspectName:" + qualityInspectRecord.getInspectName() + ",taskName:" + qualityInspectRecord.getTaskName() + ",状态:" + qualityInspectRecord.getRecordStatus());
}
}
}
}
/**
* 发MQTT消息给质检 (一个机器发一次,发给所有质检员/质检组长 谁订阅谁收到)
*/
ServerToClientMsg msg = new ServerToClientMsg();
msg.setOrderNum(machineOrder.getOrderNum());
msg.setNameplate(machine1.getNameplate());
msg.setType(ServerToClientMsg.MsgType.QUALITY_INSPECT);
mqttMessageHelper.sendToClient(Constant.S2C_MACHINE_QUALITY_INSPECT, JSON.toJSONString(msg));
logger.info("MQTT " + Constant.S2C_MACHINE_QUALITY_INSPECT + ", 铭牌号:" + msg.getNameplate() + "设置了区域位置");
}
}
machineService.update(machine1);
return ResultGenerator.genSuccessResult();
}
Aggregations