|
|
|
@ -6,20 +6,29 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|
|
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|
|
|
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
|
|
|
|
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
|
|
|
|
import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
|
|
|
|
import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.dashboard.vo.DeviceRespVO;
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.dashboard.vo.*;
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.dashboard.vo.TaskReqVO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.dashboard.vo.TaskRespVO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.plan.vo.PlanRespVO;
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.plan.vo.PlanRespVO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.dvrepair.DvRepairDO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldrepair.MoldRepairDO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.moldticketmanagement.MoldTicketManagementDO;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.organization.OrganizationDO;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.organization.OrganizationDO;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.plan.PlanDO;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.plan.PlanDO;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.task.TaskDO;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.task.TaskDO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.ticketmanagement.TicketManagementDO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.mysql.dvrepair.DvRepairMapper;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.mysql.plan.PlanMapper;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.mysql.plan.PlanMapper;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.mysql.task.TaskMapper;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.mysql.task.TaskMapper;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.mysql.ticketmanagement.TicketManagementMapper;
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.mysql.ticketmanagement.TicketManagementMapper;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.mes.service.deviceledger.DeviceLedgerService;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.mes.service.deviceledger.DeviceLedgerServiceImpl;
|
|
|
|
import cn.iocoder.yudao.module.mes.service.dvrepair.DvRepairService;
|
|
|
|
import cn.iocoder.yudao.module.mes.service.dvrepair.DvRepairService;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.mes.service.mold.MoldService;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.mes.service.moldrepair.MoldRepairService;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.mes.service.moldticketmanagement.MoldTicketManagementService;
|
|
|
|
import cn.iocoder.yudao.module.mes.service.organization.OrganizationService;
|
|
|
|
import cn.iocoder.yudao.module.mes.service.organization.OrganizationService;
|
|
|
|
import cn.iocoder.yudao.module.mes.service.plan.PlanService;
|
|
|
|
import cn.iocoder.yudao.module.mes.service.plan.PlanService;
|
|
|
|
import cn.iocoder.yudao.module.mes.service.ticketmanagement.TicketManagementService;
|
|
|
|
import cn.iocoder.yudao.module.mes.service.ticketmanagement.TicketManagementService;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
@ -32,10 +41,11 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.validation.Valid;
|
|
|
|
import javax.validation.Valid;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.time.LocalDate;
|
|
|
|
import java.util.Collection;
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
import java.util.List;
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
|
|
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
|
|
|
@ -59,9 +69,24 @@ public class DashboardController {
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private DvRepairService dvRepairService;
|
|
|
|
private DvRepairService dvRepairService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private DvRepairMapper dvRepairMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private MoldRepairService moldRepairService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private DeviceLedgerService deviceLedgerService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private MoldService moldService;
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private TicketManagementService ticketManagementService;
|
|
|
|
private TicketManagementService ticketManagementService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private MoldTicketManagementService moldTicketManagementService;
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private PlanMapper planMapper;
|
|
|
|
private PlanMapper planMapper;
|
|
|
|
|
|
|
|
|
|
|
|
@ -69,6 +94,7 @@ public class DashboardController {
|
|
|
|
private TaskMapper taskMapper;
|
|
|
|
private TaskMapper taskMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/getProduction")
|
|
|
|
@GetMapping("/getProduction")
|
|
|
|
@Operation(summary = "获得整体生产概况")
|
|
|
|
@Operation(summary = "获得整体生产概况")
|
|
|
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
|
@ -199,7 +225,7 @@ public class DashboardController {
|
|
|
|
statusList.add(2);
|
|
|
|
statusList.add(2);
|
|
|
|
statusList.add(3);
|
|
|
|
statusList.add(3);
|
|
|
|
statusList.add(4);
|
|
|
|
statusList.add(4);
|
|
|
|
statusList.add(5);
|
|
|
|
// statusList.add(5);
|
|
|
|
statusList.add(6);
|
|
|
|
statusList.add(6);
|
|
|
|
List<PlanDO> planDOList = planService.getPlanByStatus(statusList);
|
|
|
|
List<PlanDO> planDOList = planService.getPlanByStatus(statusList);
|
|
|
|
Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
|
|
|
|
Map<Long, ErpProductRespVO> productMap = productService.getProductVOMap(
|
|
|
|
@ -214,7 +240,7 @@ public class DashboardController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/getDevice")
|
|
|
|
@GetMapping("/getDevice")
|
|
|
|
@Operation(summary = "获得设备")
|
|
|
|
@Operation(summary = "获得设备任务")
|
|
|
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
|
@PreAuthorize("@ss.hasPermission('mes:bom:query')")
|
|
|
|
@PreAuthorize("@ss.hasPermission('mes:bom:query')")
|
|
|
|
public CommonResult<List<DeviceRespVO>> getDevice() {
|
|
|
|
public CommonResult<List<DeviceRespVO>> getDevice() {
|
|
|
|
@ -241,6 +267,155 @@ public class DashboardController {
|
|
|
|
deviceRespVO.setLevel("mini-total");
|
|
|
|
deviceRespVO.setLevel("mini-total");
|
|
|
|
deviceRespVOList.add(deviceRespVO);
|
|
|
|
deviceRespVOList.add(deviceRespVO);
|
|
|
|
return success(deviceRespVOList);
|
|
|
|
return success(deviceRespVOList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/getMold")
|
|
|
|
|
|
|
|
@Operation(summary = "获得模具任务")
|
|
|
|
|
|
|
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
|
|
|
|
|
@PreAuthorize("@ss.hasPermission('mes:bom:query')")
|
|
|
|
|
|
|
|
public CommonResult<List<MoldRespVO>> getMold() {
|
|
|
|
|
|
|
|
List<MoldRespVO> moldRespVOList = new ArrayList<>();
|
|
|
|
|
|
|
|
MoldRespVO moldRespVO = new MoldRespVO();
|
|
|
|
|
|
|
|
// 设备维修
|
|
|
|
|
|
|
|
moldRespVO.setKey("1");
|
|
|
|
|
|
|
|
moldRespVO.setLabel("维修");
|
|
|
|
|
|
|
|
moldRespVO.setValue(moldRepairService.getRepairListCountByRepairStatus());
|
|
|
|
|
|
|
|
moldRespVO.setLevel("mini-danger");
|
|
|
|
|
|
|
|
moldRespVOList.add(moldRespVO);
|
|
|
|
|
|
|
|
// 设备点检
|
|
|
|
|
|
|
|
moldRespVO = new MoldRespVO();
|
|
|
|
|
|
|
|
moldRespVO.setKey("2");
|
|
|
|
|
|
|
|
moldRespVO.setLabel("点检");
|
|
|
|
|
|
|
|
moldRespVO.setValue(moldTicketManagementService.getDianjianListCountByJobStatus());
|
|
|
|
|
|
|
|
moldRespVO.setLevel("mini-normal");
|
|
|
|
|
|
|
|
moldRespVOList.add(moldRespVO);
|
|
|
|
|
|
|
|
// 设备保养
|
|
|
|
|
|
|
|
moldRespVO = new MoldRespVO();
|
|
|
|
|
|
|
|
moldRespVO.setKey("3");
|
|
|
|
|
|
|
|
moldRespVO.setLabel("保养");
|
|
|
|
|
|
|
|
moldRespVO.setValue(moldTicketManagementService.getBaoyangListCountByJobStatus());
|
|
|
|
|
|
|
|
moldRespVO.setLevel("mini-total");
|
|
|
|
|
|
|
|
moldRespVOList.add(moldRespVO);
|
|
|
|
|
|
|
|
return success(moldRespVOList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/getTodoList")
|
|
|
|
|
|
|
|
@Operation(summary = "获得待办任务")
|
|
|
|
|
|
|
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
|
|
|
|
|
@PreAuthorize("@ss.hasPermission('mes:bom:query')")
|
|
|
|
|
|
|
|
public CommonResult<List<TodoRespVO>> getTodoList() {
|
|
|
|
|
|
|
|
List<TodoRespVO> todoRespVOList = new ArrayList<>();
|
|
|
|
|
|
|
|
// 设备维修
|
|
|
|
|
|
|
|
List<DvRepairDO> dvRepairDOList = dvRepairService.getDvRepairDOListByStatus();
|
|
|
|
|
|
|
|
for (DvRepairDO dvRepairDO : dvRepairDOList) {
|
|
|
|
|
|
|
|
TodoRespVO todoRespVO = new TodoRespVO();
|
|
|
|
|
|
|
|
todoRespVO.setCode(dvRepairDO.getRepairCode());
|
|
|
|
|
|
|
|
todoRespVO.setName(dvRepairDO.getRepairName());
|
|
|
|
|
|
|
|
todoRespVO.setType("设备维修");
|
|
|
|
|
|
|
|
todoRespVO.setDeviceName(deviceLedgerService.getDeviceLedger(dvRepairDO.getDeviceId()).getDeviceName());
|
|
|
|
|
|
|
|
todoRespVO.setCreateTime(dvRepairDO.getCreateTime());
|
|
|
|
|
|
|
|
todoRespVOList.add(todoRespVO);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 设备保养 点检
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<TicketManagementDO> ticketManagementDOList = ticketManagementService.getListByJobStatus();
|
|
|
|
|
|
|
|
for (TicketManagementDO ticketManagementDO : ticketManagementDOList) {
|
|
|
|
|
|
|
|
TodoRespVO todoRespVO = new TodoRespVO();
|
|
|
|
|
|
|
|
todoRespVO.setCode(ticketManagementDO.getPlanNo());
|
|
|
|
|
|
|
|
todoRespVO.setName(ticketManagementDO.getConfigName());
|
|
|
|
|
|
|
|
if (ticketManagementDO.getPlanType() == 2) {
|
|
|
|
|
|
|
|
todoRespVO.setType("设备保养");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
todoRespVO.setType("设备点检");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
todoRespVO.setDeviceName(ticketManagementDO.getDeviceName());
|
|
|
|
|
|
|
|
todoRespVO.setCreateTime(ticketManagementDO.getCreateTime());
|
|
|
|
|
|
|
|
todoRespVOList.add(todoRespVO);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 模具维修
|
|
|
|
|
|
|
|
List<MoldRepairDO> moldRepairDOList = moldRepairService.getMoldRepairDOListByStatus();
|
|
|
|
|
|
|
|
for (MoldRepairDO moldRepairDO : moldRepairDOList) {
|
|
|
|
|
|
|
|
TodoRespVO todoRespVO = new TodoRespVO();
|
|
|
|
|
|
|
|
todoRespVO.setCode(moldRepairDO.getRepairCode());
|
|
|
|
|
|
|
|
todoRespVO.setName(moldRepairDO.getRepairName());
|
|
|
|
|
|
|
|
todoRespVO.setType("模具维修");
|
|
|
|
|
|
|
|
todoRespVO.setDeviceName(moldService.getMold(moldRepairDO.getMoldId()).getName());
|
|
|
|
|
|
|
|
todoRespVO.setCreateTime(moldRepairDO.getCreateTime());
|
|
|
|
|
|
|
|
todoRespVOList.add(todoRespVO);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 模具保养 点检
|
|
|
|
|
|
|
|
List<MoldTicketManagementDO> moldTicketManagementDOList = moldTicketManagementService.getListByJobStatus();
|
|
|
|
|
|
|
|
for (MoldTicketManagementDO moldTicketManagementDO : moldTicketManagementDOList) {
|
|
|
|
|
|
|
|
TodoRespVO todoRespVO = new TodoRespVO();
|
|
|
|
|
|
|
|
todoRespVO.setCode(moldTicketManagementDO.getPlanNo());
|
|
|
|
|
|
|
|
todoRespVO.setName(moldTicketManagementDO.getConfigName());
|
|
|
|
|
|
|
|
if (moldTicketManagementDO.getPlanType() == 2) {
|
|
|
|
|
|
|
|
todoRespVO.setType("模具保养");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
todoRespVO.setType("模具点检");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
todoRespVO.setDeviceName(moldTicketManagementDO.getMoldName());
|
|
|
|
|
|
|
|
todoRespVO.setCreateTime(moldTicketManagementDO.getCreateTime());
|
|
|
|
|
|
|
|
todoRespVOList.add(todoRespVO);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return success(todoRespVOList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/getDeviceRepairLineOptions")
|
|
|
|
|
|
|
|
@Operation(summary = "获得设备维修数量统计")
|
|
|
|
|
|
|
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
|
|
|
|
|
@PreAuthorize("@ss.hasPermission('mes:bom:query')")
|
|
|
|
|
|
|
|
public CommonResult<DeviceRepairLineOptionsVO> getDeviceRepairLineOptions() {
|
|
|
|
|
|
|
|
DeviceRepairLineOptionsVO deviceRepairLineOptionsVO = new DeviceRepairLineOptionsVO();
|
|
|
|
|
|
|
|
// 计算6个月前的日期
|
|
|
|
|
|
|
|
LocalDateTime sixMonthsAgo = LocalDateTime.now()
|
|
|
|
|
|
|
|
.withDayOfMonth(1) // 取当月第一天
|
|
|
|
|
|
|
|
.withHour(0)
|
|
|
|
|
|
|
|
.withMinute(0)
|
|
|
|
|
|
|
|
.withSecond(0)
|
|
|
|
|
|
|
|
.minusMonths(5); // 注意:这里是5,因为要包含当前月
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> result = dvRepairMapper.selectMaps(
|
|
|
|
|
|
|
|
new QueryWrapper<DvRepairDO>()
|
|
|
|
|
|
|
|
.select(
|
|
|
|
|
|
|
|
"DATE_FORMAT(require_date, '%Y-%m') as month",
|
|
|
|
|
|
|
|
"COUNT(*) as count"
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
.ge("require_date", sixMonthsAgo)
|
|
|
|
|
|
|
|
.groupBy("DATE_FORMAT(require_date, '%Y-%m')")
|
|
|
|
|
|
|
|
.orderByDesc("month")
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
List<String> months = new ArrayList<>();
|
|
|
|
|
|
|
|
LocalDate currentDate = LocalDate.now();
|
|
|
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 往前推5个月(包含当前月共6个月)
|
|
|
|
|
|
|
|
for (int i = 5; i >= 0; i--) {
|
|
|
|
|
|
|
|
LocalDate date = currentDate.minusMonths(i);
|
|
|
|
|
|
|
|
String month = date.format(formatter);
|
|
|
|
|
|
|
|
months.add(month);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
deviceRepairLineOptionsVO.setXAxis(months);
|
|
|
|
|
|
|
|
// 匹配并获取数据
|
|
|
|
|
|
|
|
List<Integer> matchedCounts = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (String month : months) {
|
|
|
|
|
|
|
|
Integer count = 0; // 默认值
|
|
|
|
|
|
|
|
// 在result中查找匹配的月份
|
|
|
|
|
|
|
|
for (Map<String, Object> map : result) {
|
|
|
|
|
|
|
|
String resultMonth = (String) map.get("month");
|
|
|
|
|
|
|
|
if (month.equals(resultMonth)) {
|
|
|
|
|
|
|
|
Object countObj = map.get("count");
|
|
|
|
|
|
|
|
if (countObj instanceof Number) {
|
|
|
|
|
|
|
|
count = ((Number) countObj).intValue();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break; // 找到后跳出内层循环
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
matchedCounts.add(count);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
deviceRepairLineOptionsVO.setSeries(matchedCounts);
|
|
|
|
|
|
|
|
return success(deviceRepairLineOptionsVO);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|