use of com.eservice.api.model.machine.MachinePlan in project sinsim by WilsonHu.
the class MachineController method selectPlanningMachines.
@PostMapping("/selectPlanningMachines")
public Result selectPlanningMachines(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0") Integer size, String orderNum, String machineStrId, String nameplate, String location, Byte status, Integer machineType, Integer dateType, String query_start_time, String query_finish_time, @RequestParam(defaultValue = "true") Boolean is_fuzzy) {
PageHelper.startPage(page, size);
List<MachinePlan> list = machineService.selectPlanningMachines(orderNum, machineStrId, nameplate, location, status, machineType, dateType, query_start_time, query_finish_time, is_fuzzy);
PageInfo pageInfo = new PageInfo(list);
return ResultGenerator.genSuccessResult(pageInfo);
}
use of com.eservice.api.model.machine.MachinePlan in project sinsim by WilsonHu.
the class MachineServiceImpl method selectPlanningMachines.
public List<MachinePlan> selectPlanningMachines(String orderNum, String machine_strid, String nameplate, String location, Byte status, Integer machineType, Integer dateType, String query_start_time, String query_finish_time, Boolean is_fuzzy) {
List<MachinePlan> machinePlanList = new ArrayList<>();
if (is_fuzzy) {
machinePlanList = machineMapper.selectPlanningMachinesFuzzy(orderNum, machine_strid, nameplate, location, status, machineType, dateType, query_start_time, query_finish_time);
} else {
machinePlanList = machineMapper.selectPlanningMachines(orderNum, machine_strid, nameplate, location, status, machineType, dateType, query_start_time, query_finish_time);
}
for (MachinePlan itemPlan : machinePlanList) {
// 获取机器对应task record,
Condition tempCondition = new Condition(TaskRecord.class);
tempCondition.createCriteria().andCondition("process_record_id = ", itemPlan.getProcessRecordID());
tempCondition.createCriteria().andGreaterThanOrEqualTo("status", Constant.TASK_INITIAL);
List<TaskRecord> taskRecordList = taskRecordService.findByCondition(tempCondition);
HashMap<Byte, Integer> taskStatusMap = new HashMap<>();
for (TaskRecord record : taskRecordList) {
if (record.getStatus().equals(Constant.TASK_PLANED)) {
if (taskStatusMap.get(Constant.TASK_PLANED) != null) {
taskStatusMap.put(Constant.TASK_PLANED, taskStatusMap.get(Constant.TASK_PLANED) + 1);
} else {
taskStatusMap.put(Constant.TASK_PLANED, 1);
}
} else if (record.getStatus().equals(Constant.TASK_INSTALL_WAITING)) {
if (taskStatusMap.get(Constant.TASK_INSTALL_WAITING) != null) {
taskStatusMap.put(Constant.TASK_INSTALL_WAITING, taskStatusMap.get(Constant.TASK_INSTALL_WAITING) + 1);
} else {
taskStatusMap.put(Constant.TASK_INSTALL_WAITING, 1);
}
} else if (record.getStatus().equals(Constant.TASK_INSTALLING)) {
if (taskStatusMap.get(Constant.TASK_INSTALLING) != null) {
taskStatusMap.put(Constant.TASK_INSTALLING, taskStatusMap.get(Constant.TASK_INSTALLING) + 1);
} else {
taskStatusMap.put(Constant.TASK_INSTALLING, 1);
}
} else if (record.getStatus().equals(Constant.TASK_INSTALLED)) {
if (taskStatusMap.get(Constant.TASK_INSTALLED) != null) {
taskStatusMap.put(Constant.TASK_INSTALLED, taskStatusMap.get(Constant.TASK_INSTALLED) + 1);
} else {
taskStatusMap.put(Constant.TASK_INSTALLED, 1);
}
} else if (record.getStatus().equals(Constant.TASK_QUALITY_DOING)) {
if (taskStatusMap.get(Constant.TASK_QUALITY_DOING) != null) {
taskStatusMap.put(Constant.TASK_QUALITY_DOING, taskStatusMap.get(Constant.TASK_QUALITY_DOING) + 1);
} else {
taskStatusMap.put(Constant.TASK_QUALITY_DOING, 1);
}
} else if (record.getStatus().equals(Constant.TASK_QUALITY_DONE)) {
if (taskStatusMap.get(Constant.TASK_QUALITY_DONE) != null) {
taskStatusMap.put(Constant.TASK_QUALITY_DONE, taskStatusMap.get(Constant.TASK_QUALITY_DONE) + 1);
} else {
taskStatusMap.put(Constant.TASK_QUALITY_DONE, 1);
}
} else if (record.getStatus().equals(Constant.TASK_INSTALL_ABNORMAL)) {
if (taskStatusMap.get(Constant.TASK_INSTALL_ABNORMAL) != null) {
taskStatusMap.put(Constant.TASK_INSTALL_ABNORMAL, taskStatusMap.get(Constant.TASK_INSTALL_ABNORMAL) + 1);
} else {
taskStatusMap.put(Constant.TASK_INSTALL_ABNORMAL, 1);
}
} else if (record.getStatus().equals(Constant.TASK_QUALITY_ABNORMAL)) {
if (taskStatusMap.get(Constant.TASK_QUALITY_ABNORMAL) != null) {
taskStatusMap.put(Constant.TASK_QUALITY_ABNORMAL, taskStatusMap.get(Constant.TASK_QUALITY_ABNORMAL) + 1);
} else {
taskStatusMap.put(Constant.TASK_QUALITY_ABNORMAL, 1);
}
}
}
itemPlan.setPlanedTaskNum(taskStatusMap.get(Constant.TASK_PLANED));
itemPlan.setInstallWaitingTaskNum(taskStatusMap.get(Constant.TASK_INSTALL_WAITING));
itemPlan.setInstalledTaskNum(taskStatusMap.get(Constant.TASK_INSTALLED));
itemPlan.setInstallingTaskNum(taskStatusMap.get(Constant.TASK_INSTALLING));
itemPlan.setInstallAbnormalTaskNum(taskStatusMap.get(Constant.TASK_INSTALL_ABNORMAL));
itemPlan.setQualityDoingTaskNum(taskStatusMap.get(Constant.TASK_QUALITY_DOING));
itemPlan.setQualityDoneTaskNum(taskStatusMap.get(Constant.TASK_QUALITY_DONE));
itemPlan.setQualityAbnormalTaskNum(taskStatusMap.get(Constant.TASK_QUALITY_ABNORMAL));
}
return machinePlanList;
}
Aggregations