diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdPlanInfoController.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdPlanInfoController.java index 0521ab29..2a60ef72 100644 --- a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdPlanInfoController.java +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdPlanInfoController.java @@ -1,29 +1,31 @@ package org.dromara.mes.controller; -import java.util.List; - -import lombok.RequiredArgsConstructor; -import jakarta.servlet.http.HttpServletResponse; -import jakarta.validation.constraints.*; import cn.dev33.satoken.annotation.SaCheckPermission; -import org.dromara.mes.domain.ProdBaseRouteProcess; -import org.dromara.mes.domain.vo.MesProductPlanEditVo; -import org.dromara.mes.service.IProdBaseRouteProcessService; -import org.springframework.web.bind.annotation.*; -import org.springframework.validation.annotation.Validated; -import org.dromara.common.idempotent.annotation.RepeatSubmit; -import org.dromara.common.log.annotation.Log; -import org.dromara.common.web.core.BaseController; -import org.dromara.common.mybatis.core.page.PageQuery; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.RequiredArgsConstructor; import org.dromara.common.core.domain.R; import org.dromara.common.core.validate.AddGroup; import org.dromara.common.core.validate.EditGroup; -import org.dromara.common.log.enums.BusinessType; import org.dromara.common.excel.utils.ExcelUtil; -import org.dromara.mes.domain.vo.ProdPlanInfoVo; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.web.core.BaseController; +import org.dromara.mes.domain.ProdBaseRouteProcess; import org.dromara.mes.domain.bo.ProdPlanInfoBo; +import org.dromara.mes.domain.vo.MesProductPlanEditVo; +import org.dromara.mes.domain.vo.PlanMonitorVo; +import org.dromara.mes.domain.vo.ProdPlanInfoVo; +import org.dromara.mes.service.IProdBaseRouteProcessService; import org.dromara.mes.service.IProdPlanInfoService; -import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; /** * 生产工单信息 @@ -174,12 +176,12 @@ public class ProdPlanInfoController extends BaseController { } /** - * 查询生产计划监控列表 + * 查询生产计划监控列表(不分页) */ @SaCheckPermission("mes:planInfo:list") - @GetMapping("/queryMoritorPageList") - public TableDataInfo queryMoritorPageList(ProdPlanInfoBo bo, PageQuery pageQuery) { - return prodPlanInfoService.queryMoritorPageList(bo, pageQuery); + @GetMapping("/queryMoritorList") + public R> queryMoritorList(ProdPlanInfoBo bo) { + return R.ok(prodPlanInfoService.queryMoritorList(bo)); } } diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/PlanMonitorVo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/PlanMonitorVo.java new file mode 100644 index 00000000..1d1c92db --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/PlanMonitorVo.java @@ -0,0 +1,26 @@ +package org.dromara.mes.domain.vo; + +import lombok.Data; +import java.util.List; + +/** + * 生产计划监控视图对象 - 机台分组 + */ +@Data +public class PlanMonitorVo { + /** + * 机台ID + */ + private Long machineId; + + /** + * 机台名称 + */ + private String machineName; + + /** + * 班次分组列表 + */ + private List shifts; +} + diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ShiftGroupVo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ShiftGroupVo.java new file mode 100644 index 00000000..25f7623b --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ShiftGroupVo.java @@ -0,0 +1,26 @@ +package org.dromara.mes.domain.vo; + +import lombok.Data; + +import java.util.List; + +/** + * 计划监控班次分组视图对象 + */ +@Data +public class ShiftGroupVo { + /** + * 班次ID + */ + private Long shiftId; + + /** + * 班次名称 + */ + private String shiftName; + + /** + * 该班次下的物料计划列表 + */ + private List plans; +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdPlanInfoMapper.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdPlanInfoMapper.java index f7f2e9ea..43b88108 100644 --- a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdPlanInfoMapper.java +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdPlanInfoMapper.java @@ -4,12 +4,11 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.ibatis.annotations.Param; -import org.dromara.mes.domain.ProdOrderInfo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; import org.dromara.mes.domain.ProdPlanInfo; import org.dromara.mes.domain.bo.ProdPlanInfoBo; -import org.dromara.mes.domain.vo.ProdOrderInfoVo; +import org.dromara.mes.domain.vo.PlanMonitorVo; import org.dromara.mes.domain.vo.ProdPlanInfoVo; -import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; import java.util.List; @@ -48,10 +47,8 @@ public interface ProdPlanInfoMapper extends BaseMapperPlus queryMoritorPageList(@Param("page") Page page, @Param("tableName")String tableName,@Param(Constants.WRAPPER) Wrapper queryWrapper); + List queryMoritorList(@Param("tableName") String tableName, + @Param(Constants.WRAPPER) Wrapper queryWrapper); } diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdPlanInfoService.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdPlanInfoService.java index 234508e0..c5b3cc08 100644 --- a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdPlanInfoService.java +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdPlanInfoService.java @@ -1,6 +1,7 @@ package org.dromara.mes.service; import org.dromara.mes.domain.vo.MesProductPlanEditVo; +import org.dromara.mes.domain.vo.PlanMonitorVo; import org.dromara.mes.domain.vo.ProdPlanInfoVo; import org.dromara.mes.domain.bo.ProdPlanInfoBo; import org.dromara.common.mybatis.core.page.TableDataInfo; @@ -101,11 +102,9 @@ public interface IProdPlanInfoService { Boolean issuePlanByPlanIds(Long workshopId, List planIds); /** - * 分页查询生产计划监控列表 - * - * @param bo 查询条件 - * @param pageQuery 分页参数 - * @return 生产计划监控分页列表 + * 查询生产计划监控列表(不分页) + * @param bo 查询条件 + * @return 生产计划监控列表 */ - TableDataInfo queryMoritorPageList(ProdPlanInfoBo bo, PageQuery pageQuery); + List queryMoritorList(ProdPlanInfoBo bo); } diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdPlanInfoServiceImpl.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdPlanInfoServiceImpl.java index fbcc5fe8..a613e114 100644 --- a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdPlanInfoServiceImpl.java +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdPlanInfoServiceImpl.java @@ -1,29 +1,31 @@ package org.dromara.mes.service.impl; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.yulichang.toolkit.JoinWrappers; +import com.github.yulichang.wrapper.MPJLambdaWrapper; +import lombok.RequiredArgsConstructor; import org.dromara.common.constant.DatabaseConstants; import org.dromara.common.core.exception.ServiceException; import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.StringUtils; import org.dromara.common.core.utils.uuid.Seq; import org.dromara.common.mapper.DynamicBaseSqlMapper; -import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.PageQuery; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.github.yulichang.toolkit.JoinWrappers; -import com.github.yulichang.wrapper.MPJLambdaWrapper; -import lombok.RequiredArgsConstructor; -import org.dromara.mes.domain.BaseShiftInfo; -import org.dromara.mes.domain.vo.MesProductPlanEditVo; -import org.springframework.stereotype.Service; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.mes.domain.ProdPlanInfo; import org.dromara.mes.domain.bo.ProdPlanInfoBo; +import org.dromara.mes.domain.vo.MesProductPlanEditVo; +import org.dromara.mes.domain.vo.PlanMonitorVo; import org.dromara.mes.domain.vo.ProdPlanInfoVo; -import org.dromara.mes.domain.ProdPlanInfo; import org.dromara.mes.mapper.ProdPlanInfoMapper; import org.dromara.mes.service.IProdPlanInfoService; +import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.ObjectUtils; -import java.util.*; +import java.util.Collection; +import java.util.List; +import java.util.Map; /** * 生产工单信息Service业务层处理 @@ -284,18 +286,18 @@ public class ProdPlanInfoServiceImpl implements IProdPlanInfoService { } /** - * 分页查询生产计划监控列表 - * - * @param bo 查询条件 - * @param pageQuery 分页参数 - * @return 生产计划监控分页列表 + * 查询生产计划监控列表(不分页) */ @Override - public TableDataInfo queryMoritorPageList(ProdPlanInfoBo bo, PageQuery pageQuery) { - MPJLambdaWrapper lqw = buildQW(bo); + public List queryMoritorList(ProdPlanInfoBo bo) { + // 校验时间区间参数 + Map params = bo.getParams(); + if (ObjectUtils.isEmpty(params.get("monitorBeginTime")) || ObjectUtils.isEmpty(params.get("monitorEndTime"))) { + throw new ServiceException("时间区间不能为空"); + } + String tableName = getPlanInfoTableName(bo.getWorkshopId()); - Page result = baseMapper.queryMoritorPageList(pageQuery.build(), tableName, lqw); - return TableDataInfo.build(result); + return baseMapper.queryMoritorList(tableName, buildQW(bo)); } private MPJLambdaWrapper buildQW(ProdPlanInfoBo bo) { diff --git a/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdPlanInfoMapper.xml b/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdPlanInfoMapper.xml index 1e58730d..2da8053f 100644 --- a/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdPlanInfoMapper.xml +++ b/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdPlanInfoMapper.xml @@ -169,38 +169,105 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" order by mpp.dispatch_code,mpp.process_order - + WITH ReleaseInfo AS ( + SELECT + t.release_id as machineId, + t.tenant_id, + CASE + WHEN t.release_type = 1 THEN (SELECT pbmi.machine_name FROM prod_base_machine_info pbmi WHERE t.release_id = pbmi.machine_id) +/* WHEN t.release_type = 2 THEN (SELECT su.nick_name FROM sys_user su WHERE t.release_id = su.user_id) + WHEN t.release_type = 3 THEN (SELECT pbsi.station_name FROM prod_base_station_info pbsi WHERE t.release_id = pbsi.station_id)*/ + END as machineName + FROM ${tableName} t + WHERE t.release_id IS NOT NULL + GROUP BY t.release_id, t.release_type, t.tenant_id + ) + SELECT + r.machineId, + r.machineName, + COALESCE(t.shift_id, 0) as shiftId, + COALESCE(bsi.shift_name, '未分班') as shiftName, + t.plan_id as planId, + t.product_order_id, + t.sale_order_id, + t.saleorder_code, + t.plan_code, + t.dispatch_code, + t.material_id, + bmi.material_name, + t.process_id, + t.process_order, + t.last_process_id, + t.final_process_flag, + t.release_type, + t.release_id, + t.production_time, + t.plan_amount, + t.dispatch_amount, + t.complete_amount, + t.plan_begin_time, + t.plan_end_time, + t.real_begin_time, + t.real_end_time, + t.attach_id, + t.plan_status, + t.import_flag, + t.finish_flag, + t.priority, + t.shift_id, + t.class_team_id, + t.model_code, + t.remark + FROM ReleaseInfo r + LEFT JOIN ${tableName} t ON r.machineId = t.release_id + LEFT JOIN base_shift_info bsi ON t.shift_id = bsi.shift_id + LEFT JOIN base_material_info bmi ON t.material_id = bmi.material_id + ${ew.customSqlSegment} + ORDER BY r.machineId, t.shift_id, t.plan_id