修改移动端内容,后端添加了所有查询接口
This commit is contained in:
@@ -72,9 +72,9 @@ spring:
|
||||
lazy: true
|
||||
type: ${spring.datasource.type}
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://localhost:3306/ry-flowable-plus?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&nullCatalogMeansCurrent=true
|
||||
username:
|
||||
password:
|
||||
url: jdbc:mysql://140.143.206.120:13306/klp_pocketfactory?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
|
||||
username: klp
|
||||
password: KeLunPu@123
|
||||
# oracle:
|
||||
# type: ${spring.datasource.type}
|
||||
# driverClassName: oracle.jdbc.OracleDriver
|
||||
|
||||
@@ -23,6 +23,15 @@ public class Klptcm1ProPlantStateDefineController extends BaseController {
|
||||
@Resource
|
||||
private IKlptcm1ProPlantStateDefineService defineService;
|
||||
|
||||
/**
|
||||
* 获取所有定义及其当前值(用于前端初始化缓存)
|
||||
* @return 所有定义列表,每个定义包含对应的当前值
|
||||
*/
|
||||
@GetMapping("/allWithValues")
|
||||
public R<List<PlantStateWithValueVo>> getAllWithValues() {
|
||||
return R.ok(defineService.selectAllWithValues());
|
||||
}
|
||||
|
||||
@GetMapping("/plant/state")
|
||||
public List<PlantStateWithValueVo> getTopByValue(@RequestParam String name) {
|
||||
return defineService.selectByValue(name);
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.klp.pocket.controller;
|
||||
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.pocket.domain.vo.ProductionStatisticsVo;
|
||||
import com.klp.pocket.domain.vo.CrewProductionVo;
|
||||
import com.klp.pocket.domain.vo.SpecDistributionVo;
|
||||
import com.klp.pocket.domain.vo.TeamPerformanceVo;
|
||||
import com.klp.pocket.service.IKlptcm1PdoExcoilService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 生产统计Controller
|
||||
*
|
||||
* @author klp
|
||||
* @date 2025-10-31
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/pocket/productionStatistics")
|
||||
public class Klptcm1ProductionStatisticsController extends BaseController {
|
||||
|
||||
private final IKlptcm1PdoExcoilService excoilService;
|
||||
|
||||
/**
|
||||
* 获取生产统计汇总数据
|
||||
* @param startDate 开始日期(格式:yyyy-MM-dd)
|
||||
* @param endDate 结束日期(格式:yyyy-MM-dd)
|
||||
* @return 统计数据(钢卷数、平均宽度、平均厚度、原料总量、成品总量、成材率)
|
||||
*/
|
||||
@GetMapping("/summary")
|
||||
public R<ProductionStatisticsVo> getSummary(
|
||||
@RequestParam String startDate,
|
||||
@RequestParam String endDate) {
|
||||
return R.ok(excoilService.getProductionStatistics(startDate, endDate));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取班组产量统计
|
||||
* @param startDate 开始日期
|
||||
* @param endDate 结束日期
|
||||
* @return 班组产量列表(按产量倒序)
|
||||
*/
|
||||
@GetMapping("/crewProduction")
|
||||
public R<List<CrewProductionVo>> getCrewProduction(
|
||||
@RequestParam String startDate,
|
||||
@RequestParam String endDate) {
|
||||
return R.ok(excoilService.getCrewProduction(startDate, endDate));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取厚度分布统计
|
||||
* @param startDate 开始日期
|
||||
* @param endDate 结束日期
|
||||
* @return 厚度分布列表
|
||||
*/
|
||||
@GetMapping("/thicknessDistribution")
|
||||
public R<List<SpecDistributionVo>> getThicknessDistribution(
|
||||
@RequestParam String startDate,
|
||||
@RequestParam String endDate) {
|
||||
return R.ok(excoilService.getThicknessDistribution(startDate, endDate));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取宽度分布统计
|
||||
* @param startDate 开始日期
|
||||
* @param endDate 结束日期
|
||||
* @return 宽度分布列表
|
||||
*/
|
||||
@GetMapping("/widthDistribution")
|
||||
public R<List<SpecDistributionVo>> getWidthDistribution(
|
||||
@RequestParam String startDate,
|
||||
@RequestParam String endDate) {
|
||||
return R.ok(excoilService.getWidthDistribution(startDate, endDate));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取班组绩效统计
|
||||
* @param startDate 开始日期
|
||||
* @param endDate 结束日期
|
||||
* @return 班组绩效列表(按综合评分倒序排列)
|
||||
*/
|
||||
@GetMapping("/teamPerformance")
|
||||
public R<List<TeamPerformanceVo>> getTeamPerformance(
|
||||
@RequestParam String startDate,
|
||||
@RequestParam String endDate) {
|
||||
return R.ok(excoilService.getTeamPerformance(startDate, endDate));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.klp.pocket.controller;
|
||||
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.pocket.domain.vo.Klptcm1ShiftCurrentVo;
|
||||
import com.klp.pocket.service.IKlptcm1ShiftCurrentService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 当前班组Controller
|
||||
*
|
||||
* @author klp
|
||||
* @date 2025-10-31
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/pocket/shiftCurrent")
|
||||
public class Klptcm1ShiftCurrentController extends BaseController {
|
||||
|
||||
private final IKlptcm1ShiftCurrentService shiftCurrentService;
|
||||
|
||||
/**
|
||||
* 获取当前班组信息
|
||||
* @return 当前班组信息(班次+班组)
|
||||
*/
|
||||
@GetMapping("/current")
|
||||
public R<Klptcm1ShiftCurrentVo> getCurrentShift() {
|
||||
return R.ok(shiftCurrentService.getCurrentShift());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.klp.pocket.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 成品卷对象 klptcm1_pdo_excoil
|
||||
*/
|
||||
@Data
|
||||
public class Klptcm1PdoExcoil {
|
||||
|
||||
/** 成品卷号 */
|
||||
private String encoilid;
|
||||
|
||||
/** 钢种 */
|
||||
private String grade;
|
||||
|
||||
/** 厚度质量 */
|
||||
private BigDecimal thickQuality;
|
||||
|
||||
/** 板形质量 */
|
||||
private BigDecimal shapeQuality;
|
||||
|
||||
/** 入口厚度 */
|
||||
private BigDecimal entryThick;
|
||||
|
||||
/** 出口厚度 */
|
||||
private BigDecimal exitThick;
|
||||
|
||||
/** 入口宽度 */
|
||||
private BigDecimal entryWidth;
|
||||
|
||||
/** 出口宽度 */
|
||||
private BigDecimal exitWidth;
|
||||
|
||||
/** 入口重量 */
|
||||
private BigDecimal entryWeight;
|
||||
|
||||
/** 出口重量 */
|
||||
private BigDecimal exitWeight;
|
||||
|
||||
/** 上线时间 */
|
||||
private Date onlineDate;
|
||||
|
||||
/** 开始时间 */
|
||||
private Date startDate;
|
||||
|
||||
/** 结束时间 */
|
||||
private Date endDate;
|
||||
|
||||
/** 插入时间 */
|
||||
private Date insdate;
|
||||
|
||||
/** 班次 */
|
||||
private String shift;
|
||||
|
||||
/** 班组 */
|
||||
private String crew;
|
||||
|
||||
/** 出口卷号 */
|
||||
private String excoilid;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.klp.pocket.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 当前班组对象 klptcm1_shift_current
|
||||
*/
|
||||
@Data
|
||||
public class Klptcm1ShiftCurrent {
|
||||
|
||||
/**
|
||||
* 班次(如:A/B/C 或 早/中/晚)
|
||||
*/
|
||||
private String shift;
|
||||
|
||||
/**
|
||||
* 班组编号
|
||||
*/
|
||||
private BigDecimal crew;
|
||||
|
||||
/**
|
||||
* 序列号
|
||||
*/
|
||||
private BigDecimal seqNum;
|
||||
|
||||
/**
|
||||
* 系统时间
|
||||
*/
|
||||
private Date sysTime;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.klp.pocket.domain.bo;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -58,13 +59,15 @@ public class Klptcm1ProStoppageBo extends BaseEntity {
|
||||
private String REMARK;
|
||||
|
||||
/**
|
||||
*
|
||||
* 开始日期(支持多种日期格式)
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date startDate;
|
||||
|
||||
/**
|
||||
*
|
||||
* 结束日期(支持多种日期格式)
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date endDate;
|
||||
|
||||
/**
|
||||
@@ -73,8 +76,9 @@ public class Klptcm1ProStoppageBo extends BaseEntity {
|
||||
private Long DURATION;
|
||||
|
||||
/**
|
||||
*
|
||||
* 插入日期
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date insDate;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.klp.pocket.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 班组产量统计视图对象
|
||||
*/
|
||||
@Data
|
||||
public class CrewProductionVo {
|
||||
|
||||
/** 班组 */
|
||||
private String crew;
|
||||
|
||||
/** 班次 */
|
||||
private String shift;
|
||||
|
||||
/** 钢卷数 */
|
||||
private Long coilCount;
|
||||
|
||||
/** 总产量 */
|
||||
private BigDecimal totalWeight;
|
||||
|
||||
/** 平均厚度 */
|
||||
private BigDecimal avgThick;
|
||||
|
||||
/** 平均宽度 */
|
||||
private BigDecimal avgWidth;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.klp.pocket.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 当前班组视图对象 klptcm1_shift_current
|
||||
*/
|
||||
@Data
|
||||
public class Klptcm1ShiftCurrentVo {
|
||||
|
||||
private String shift;
|
||||
private BigDecimal crew;
|
||||
private BigDecimal seqNum;
|
||||
private Date sysTime;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.klp.pocket.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 生产统计视图对象
|
||||
*/
|
||||
@Data
|
||||
public class ProductionStatisticsVo {
|
||||
|
||||
/** 生产钢卷数 */
|
||||
private Long coilCount;
|
||||
|
||||
/** 平均宽度 */
|
||||
private BigDecimal avgWidth;
|
||||
|
||||
/** 平均厚度 */
|
||||
private BigDecimal avgThick;
|
||||
|
||||
/** 原料总量 */
|
||||
private BigDecimal totalEntryWeight;
|
||||
|
||||
/** 成品总量 */
|
||||
private BigDecimal totalExitWeight;
|
||||
|
||||
/** 成材率 */
|
||||
private BigDecimal yieldRate;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.klp.pocket.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 规格分布视图对象
|
||||
*/
|
||||
@Data
|
||||
public class SpecDistributionVo {
|
||||
|
||||
/** 分类名称 */
|
||||
private String category;
|
||||
|
||||
/** 数量 */
|
||||
private Long count;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.klp.pocket.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 班组绩效视图对象
|
||||
*/
|
||||
@Data
|
||||
public class TeamPerformanceVo {
|
||||
|
||||
/** 班组 */
|
||||
private String crew;
|
||||
|
||||
/** 班次 */
|
||||
private String shift;
|
||||
|
||||
/** 班组-班次组合(用于显示) */
|
||||
private String teamName;
|
||||
|
||||
/** 产量(t) */
|
||||
private BigDecimal output;
|
||||
|
||||
/** 成材率(%) */
|
||||
private BigDecimal yieldRate;
|
||||
|
||||
/** 合格率(%) - 基于厚度质量 */
|
||||
private BigDecimal passRate;
|
||||
|
||||
/** 平均厚度质量 */
|
||||
private BigDecimal avgThickQuality;
|
||||
|
||||
/** 平均板形质量 */
|
||||
private BigDecimal avgShapeQuality;
|
||||
|
||||
/** 效率指标(钢卷数/时间,这里简化为钢卷数) */
|
||||
private Long efficiency;
|
||||
|
||||
/** 综合评分 */
|
||||
private BigDecimal score;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.klp.pocket.mapper;
|
||||
|
||||
import com.klp.pocket.domain.vo.ProductionStatisticsVo;
|
||||
import com.klp.pocket.domain.vo.CrewProductionVo;
|
||||
import com.klp.pocket.domain.vo.SpecDistributionVo;
|
||||
import com.klp.pocket.domain.vo.TeamPerformanceVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 成品卷Mapper接口
|
||||
*/
|
||||
@Mapper
|
||||
public interface Klptcm1PdoExcoilMapper {
|
||||
|
||||
/**
|
||||
* 查询生产统计汇总数据
|
||||
* @param startDate 开始日期
|
||||
* @param endDate 结束日期
|
||||
* @return 统计数据
|
||||
*/
|
||||
ProductionStatisticsVo selectProductionStatistics(@Param("startDate") String startDate,
|
||||
@Param("endDate") String endDate);
|
||||
|
||||
/**
|
||||
* 查询班组产量统计
|
||||
* @param startDate 开始日期
|
||||
* @param endDate 结束日期
|
||||
* @return 班组产量列表
|
||||
*/
|
||||
List<CrewProductionVo> selectCrewProduction(@Param("startDate") String startDate,
|
||||
@Param("endDate") String endDate);
|
||||
|
||||
/**
|
||||
* 查询厚度分布
|
||||
* @param startDate 开始日期
|
||||
* @param endDate 结束日期
|
||||
* @return 厚度分布列表
|
||||
*/
|
||||
List<SpecDistributionVo> selectThicknessDistribution(@Param("startDate") String startDate,
|
||||
@Param("endDate") String endDate);
|
||||
|
||||
/**
|
||||
* 查询宽度分布
|
||||
* @param startDate 开始日期
|
||||
* @param endDate 结束日期
|
||||
* @return 宽度分布列表
|
||||
*/
|
||||
List<SpecDistributionVo> selectWidthDistribution(@Param("startDate") String startDate,
|
||||
@Param("endDate") String endDate);
|
||||
|
||||
/**
|
||||
* 查询班组绩效统计
|
||||
* @param startDate 开始日期
|
||||
* @param endDate 结束日期
|
||||
* @return 班组绩效列表
|
||||
*/
|
||||
List<TeamPerformanceVo> selectTeamPerformance(@Param("startDate") String startDate,
|
||||
@Param("endDate") String endDate);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,12 @@ public interface Klptcm1ProPlantStateDefineMapper {
|
||||
|
||||
List<PlantStateWithValueVo> selectByValue(String name);
|
||||
|
||||
/**
|
||||
* 获取所有定义及其当前值
|
||||
* @return 所有定义列表,每个定义包含对应的当前值
|
||||
*/
|
||||
List<PlantStateWithValueVo> selectAllWithValues();
|
||||
|
||||
/**
|
||||
* 按ID查询
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.klp.pocket.mapper;
|
||||
|
||||
import com.klp.pocket.domain.Klptcm1ShiftCurrent;
|
||||
import com.klp.pocket.domain.vo.Klptcm1ShiftCurrentVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 当前班组Mapper接口
|
||||
*/
|
||||
@Mapper
|
||||
public interface Klptcm1ShiftCurrentMapper {
|
||||
|
||||
/**
|
||||
* 查询当前班组信息(最新一条)
|
||||
* @return 当前班组信息
|
||||
*/
|
||||
Klptcm1ShiftCurrentVo selectCurrent();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.klp.pocket.service;
|
||||
|
||||
import com.klp.pocket.domain.vo.ProductionStatisticsVo;
|
||||
import com.klp.pocket.domain.vo.CrewProductionVo;
|
||||
import com.klp.pocket.domain.vo.SpecDistributionVo;
|
||||
import com.klp.pocket.domain.vo.TeamPerformanceVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 生产统计Service接口
|
||||
*/
|
||||
public interface IKlptcm1PdoExcoilService {
|
||||
|
||||
/**
|
||||
* 查询生产统计汇总数据
|
||||
* @param startDate 开始日期
|
||||
* @param endDate 结束日期
|
||||
* @return 统计数据
|
||||
*/
|
||||
ProductionStatisticsVo getProductionStatistics(String startDate, String endDate);
|
||||
|
||||
/**
|
||||
* 查询班组产量统计
|
||||
* @param startDate 开始日期
|
||||
* @param endDate 结束日期
|
||||
* @return 班组产量列表
|
||||
*/
|
||||
List<CrewProductionVo> getCrewProduction(String startDate, String endDate);
|
||||
|
||||
/**
|
||||
* 查询厚度分布
|
||||
* @param startDate 开始日期
|
||||
* @param endDate 结束日期
|
||||
* @return 厚度分布列表
|
||||
*/
|
||||
List<SpecDistributionVo> getThicknessDistribution(String startDate, String endDate);
|
||||
|
||||
/**
|
||||
* 查询宽度分布
|
||||
* @param startDate 开始日期
|
||||
* @param endDate 结束日期
|
||||
* @return 宽度分布列表
|
||||
*/
|
||||
List<SpecDistributionVo> getWidthDistribution(String startDate, String endDate);
|
||||
|
||||
/**
|
||||
* 查询班组绩效统计
|
||||
* @param startDate 开始日期
|
||||
* @param endDate 结束日期
|
||||
* @return 班组绩效列表(按综合评分倒序)
|
||||
*/
|
||||
List<TeamPerformanceVo> getTeamPerformance(String startDate, String endDate);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,12 @@ public interface IKlptcm1ProPlantStateDefineService {
|
||||
|
||||
List<PlantStateWithValueVo> selectByValue(String name);
|
||||
|
||||
/**
|
||||
* 获取所有定义及其当前值
|
||||
* @return 所有定义列表,每个定义包含对应的当前值
|
||||
*/
|
||||
List<PlantStateWithValueVo> selectAllWithValues();
|
||||
|
||||
Klptcm1ProPlantStateDefine selectById(BigDecimal id);
|
||||
|
||||
int insert(Klptcm1ProPlantStateDefine entity);
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.klp.pocket.service;
|
||||
|
||||
import com.klp.pocket.domain.vo.Klptcm1ShiftCurrentVo;
|
||||
|
||||
/**
|
||||
* 当前班组Service接口
|
||||
*/
|
||||
public interface IKlptcm1ShiftCurrentService {
|
||||
|
||||
/**
|
||||
* 查询当前班组信息
|
||||
* @return 当前班组信息
|
||||
*/
|
||||
Klptcm1ShiftCurrentVo getCurrentShift();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.klp.pocket.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.klp.pocket.domain.vo.ProductionStatisticsVo;
|
||||
import com.klp.pocket.domain.vo.CrewProductionVo;
|
||||
import com.klp.pocket.domain.vo.SpecDistributionVo;
|
||||
import com.klp.pocket.domain.vo.TeamPerformanceVo;
|
||||
import com.klp.pocket.mapper.Klptcm1PdoExcoilMapper;
|
||||
import com.klp.pocket.service.IKlptcm1PdoExcoilService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 生产统计Service实现类
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@DS("slave")
|
||||
@Service
|
||||
public class Klptcm1PdoExcoilServiceImpl implements IKlptcm1PdoExcoilService {
|
||||
|
||||
private final Klptcm1PdoExcoilMapper excoilMapper;
|
||||
|
||||
@Override
|
||||
public ProductionStatisticsVo getProductionStatistics(String startDate, String endDate) {
|
||||
return excoilMapper.selectProductionStatistics(startDate, endDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CrewProductionVo> getCrewProduction(String startDate, String endDate) {
|
||||
return excoilMapper.selectCrewProduction(startDate, endDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SpecDistributionVo> getThicknessDistribution(String startDate, String endDate) {
|
||||
return excoilMapper.selectThicknessDistribution(startDate, endDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SpecDistributionVo> getWidthDistribution(String startDate, String endDate) {
|
||||
return excoilMapper.selectWidthDistribution(startDate, endDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TeamPerformanceVo> getTeamPerformance(String startDate, String endDate) {
|
||||
return excoilMapper.selectTeamPerformance(startDate, endDate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,11 @@ public class Klptcm1ProPlantStateDefineServiceImpl implements IKlptcm1ProPlantSt
|
||||
return defineMapper.selectByValue(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PlantStateWithValueVo> selectAllWithValues() {
|
||||
return defineMapper.selectAllWithValues();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Klptcm1ProPlantStateDefine selectById(BigDecimal id) {
|
||||
return defineMapper.selectById(id);
|
||||
|
||||
@@ -71,12 +71,15 @@ public class Klptcm1ProStoppageServiceImpl implements IKlptcm1ProStoppageService
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getUNIT()), Klptcm1ProStoppage::getUnit, bo.getUNIT());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getSETON()), Klptcm1ProStoppage::getSeton, bo.getSETON());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getREMARK()), Klptcm1ProStoppage::getRemark, bo.getREMARK());
|
||||
lqw.eq(bo.getStartDate() != null, Klptcm1ProStoppage::getStartDate, bo.getStartDate());
|
||||
lqw.eq(bo.getEndDate() != null, Klptcm1ProStoppage::getEndDate, bo.getEndDate());
|
||||
// 日期范围查询:查询停机开始时间在指定范围内的记录
|
||||
// bo.startDate 是查询开始时间,stoppage.startDate 是停机开始时间
|
||||
lqw.ge(bo.getStartDate() != null, Klptcm1ProStoppage::getStartDate, bo.getStartDate());
|
||||
// bo.endDate 是查询结束时间,stoppage.startDate 是停机开始时间
|
||||
lqw.le(bo.getEndDate() != null, Klptcm1ProStoppage::getStartDate, bo.getEndDate());
|
||||
lqw.eq(bo.getDURATION() != null, Klptcm1ProStoppage::getDuration, bo.getDURATION());
|
||||
lqw.eq(bo.getInsDate() != null, Klptcm1ProStoppage::getInsDate, bo.getInsDate());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getStopType()), Klptcm1ProStoppage::getStopType, bo.getStopType());
|
||||
//倒叙
|
||||
//倒序
|
||||
lqw.orderByDesc(Klptcm1ProStoppage::getInsDate);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.klp.pocket.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.klp.pocket.domain.vo.Klptcm1ShiftCurrentVo;
|
||||
import com.klp.pocket.mapper.Klptcm1ShiftCurrentMapper;
|
||||
import com.klp.pocket.service.IKlptcm1ShiftCurrentService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 当前班组Service实现类
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@DS("slave")
|
||||
@Service
|
||||
public class Klptcm1ShiftCurrentServiceImpl implements IKlptcm1ShiftCurrentService {
|
||||
|
||||
private final Klptcm1ShiftCurrentMapper shiftCurrentMapper;
|
||||
|
||||
@Override
|
||||
public Klptcm1ShiftCurrentVo getCurrentShift() {
|
||||
return shiftCurrentMapper.selectCurrent();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.klp.pocket.mapper.Klptcm1PdoExcoilMapper">
|
||||
|
||||
<!-- 生产统计汇总 -->
|
||||
<resultMap id="ProductionStatisticsResultMap" type="com.klp.pocket.domain.vo.ProductionStatisticsVo">
|
||||
<result column="coilCount" property="coilCount" jdbcType="BIGINT"/>
|
||||
<result column="avgWidth" property="avgWidth" jdbcType="DECIMAL"/>
|
||||
<result column="avgThick" property="avgThick" jdbcType="DECIMAL"/>
|
||||
<result column="totalEntryWeight" property="totalEntryWeight" jdbcType="DECIMAL"/>
|
||||
<result column="totalExitWeight" property="totalExitWeight" jdbcType="DECIMAL"/>
|
||||
<result column="yieldRate" property="yieldRate" jdbcType="DECIMAL"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectProductionStatistics" resultMap="ProductionStatisticsResultMap">
|
||||
SELECT
|
||||
COUNT(*) AS coilCount,
|
||||
ROUND(AVG(EXIT_WIDTH), 2) AS avgWidth,
|
||||
ROUND(AVG(EXIT_THICK), 2) AS avgThick,
|
||||
ROUND(SUM(ENTRY_WEIGHT), 2) AS totalEntryWeight,
|
||||
ROUND(SUM(EXIT_WEIGHT), 2) AS totalExitWeight,
|
||||
ROUND(SUM(EXIT_WEIGHT) / SUM(ENTRY_WEIGHT) * 100, 2) AS yieldRate
|
||||
FROM klptcm1_pdo_excoil
|
||||
WHERE DATE(INSDATE) BETWEEN #{startDate} AND #{endDate}
|
||||
</select>
|
||||
|
||||
<!-- 班组产量统计 -->
|
||||
<resultMap id="CrewProductionResultMap" type="com.klp.pocket.domain.vo.CrewProductionVo">
|
||||
<result column="crew" property="crew" jdbcType="VARCHAR"/>
|
||||
<result column="shift" property="shift" jdbcType="VARCHAR"/>
|
||||
<result column="coilCount" property="coilCount" jdbcType="BIGINT"/>
|
||||
<result column="totalWeight" property="totalWeight" jdbcType="DECIMAL"/>
|
||||
<result column="avgThick" property="avgThick" jdbcType="DECIMAL"/>
|
||||
<result column="avgWidth" property="avgWidth" jdbcType="DECIMAL"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectCrewProduction" resultMap="CrewProductionResultMap">
|
||||
SELECT
|
||||
CREW AS crew,
|
||||
SHIFT AS shift,
|
||||
COUNT(*) AS coilCount,
|
||||
ROUND(SUM(EXIT_WEIGHT), 2) AS totalWeight,
|
||||
ROUND(AVG(EXIT_THICK), 2) AS avgThick,
|
||||
ROUND(AVG(EXIT_WIDTH), 2) AS avgWidth
|
||||
FROM klptcm1_pdo_excoil
|
||||
WHERE DATE(INSDATE) BETWEEN #{startDate} AND #{endDate}
|
||||
GROUP BY CREW, SHIFT
|
||||
ORDER BY totalWeight DESC
|
||||
</select>
|
||||
|
||||
<!-- 厚度分布统计 -->
|
||||
<resultMap id="SpecDistributionResultMap" type="com.klp.pocket.domain.vo.SpecDistributionVo">
|
||||
<result column="category" property="category" jdbcType="VARCHAR"/>
|
||||
<result column="count" property="count" jdbcType="BIGINT"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectThicknessDistribution" resultMap="SpecDistributionResultMap">
|
||||
SELECT
|
||||
CASE
|
||||
WHEN EXIT_THICK < 0.8 THEN '0.5-0.8mm'
|
||||
WHEN EXIT_THICK < 1.0 THEN '0.8-1.0mm'
|
||||
WHEN EXIT_THICK < 1.2 THEN '1.0-1.2mm'
|
||||
WHEN EXIT_THICK < 1.5 THEN '1.2-1.5mm'
|
||||
ELSE '1.5mm以上'
|
||||
END AS category,
|
||||
COUNT(*) AS count
|
||||
FROM klptcm1_pdo_excoil
|
||||
WHERE DATE(INSDATE) BETWEEN #{startDate} AND #{endDate}
|
||||
GROUP BY category
|
||||
ORDER BY category
|
||||
</select>
|
||||
|
||||
<!-- 宽度分布统计 -->
|
||||
<select id="selectWidthDistribution" resultMap="SpecDistributionResultMap">
|
||||
SELECT
|
||||
CASE
|
||||
WHEN EXIT_WIDTH < 1000 THEN '800-1000mm'
|
||||
WHEN EXIT_WIDTH < 1200 THEN '1000-1200mm'
|
||||
WHEN EXIT_WIDTH < 1400 THEN '1200-1400mm'
|
||||
ELSE '1400mm以上'
|
||||
END AS category,
|
||||
COUNT(*) AS count
|
||||
FROM klptcm1_pdo_excoil
|
||||
WHERE DATE(INSDATE) BETWEEN #{startDate} AND #{endDate}
|
||||
GROUP BY category
|
||||
ORDER BY category
|
||||
</select>
|
||||
|
||||
<!-- 班组绩效统计 -->
|
||||
<resultMap id="TeamPerformanceResultMap" type="com.klp.pocket.domain.vo.TeamPerformanceVo">
|
||||
<result column="crew" property="crew" jdbcType="VARCHAR"/>
|
||||
<result column="shift" property="shift" jdbcType="VARCHAR"/>
|
||||
<result column="teamName" property="teamName" jdbcType="VARCHAR"/>
|
||||
<result column="output" property="output" jdbcType="DECIMAL"/>
|
||||
<result column="yieldRate" property="yieldRate" jdbcType="DECIMAL"/>
|
||||
<result column="passRate" property="passRate" jdbcType="DECIMAL"/>
|
||||
<result column="avgThickQuality" property="avgThickQuality" jdbcType="DECIMAL"/>
|
||||
<result column="avgShapeQuality" property="avgShapeQuality" jdbcType="DECIMAL"/>
|
||||
<result column="efficiency" property="efficiency" jdbcType="BIGINT"/>
|
||||
<result column="score" property="score" jdbcType="DECIMAL"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectTeamPerformance" resultMap="TeamPerformanceResultMap">
|
||||
SELECT
|
||||
CREW AS crew,
|
||||
SHIFT AS shift,
|
||||
CONCAT(CREW, '-', SHIFT) AS teamName,
|
||||
ROUND(SUM(EXIT_WEIGHT), 2) AS output,
|
||||
ROUND(SUM(EXIT_WEIGHT) / SUM(ENTRY_WEIGHT) * 100, 2) AS yieldRate,
|
||||
ROUND(AVG(THICK_QUALITY), 2) AS passRate,
|
||||
ROUND(AVG(THICK_QUALITY), 2) AS avgThickQuality,
|
||||
ROUND(AVG(SHAPE_QUALITY), 2) AS avgShapeQuality,
|
||||
COUNT(*) AS efficiency,
|
||||
ROUND(
|
||||
(SUM(EXIT_WEIGHT) / SUM(ENTRY_WEIGHT) * 30) +
|
||||
(AVG(THICK_QUALITY) * 0.4) +
|
||||
(AVG(SHAPE_QUALITY) * 0.3),
|
||||
2
|
||||
) AS score
|
||||
FROM klptcm1_pdo_excoil
|
||||
WHERE DATE(INSDATE) BETWEEN #{startDate} AND #{endDate}
|
||||
GROUP BY CREW, SHIFT
|
||||
ORDER BY score DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
<result column="historyInsdate" property="historyInsdate" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
<select id="selectByValue" resultMap="ValueVoResultMap">
|
||||
SELECT
|
||||
SELECT
|
||||
d.ID,
|
||||
d.NAME,
|
||||
d.UNITS,
|
||||
@@ -125,13 +125,13 @@
|
||||
h.INSDATE AS historyInsdate
|
||||
FROM klptcm1_pro_plant_state_define d
|
||||
CROSS JOIN (
|
||||
SELECT * FROM klptcm1_pro_plant_state_current
|
||||
ORDER BY INSDATE DESC
|
||||
SELECT * FROM klptcm1_pro_plant_state_current
|
||||
ORDER BY INSDATE DESC
|
||||
LIMIT 1
|
||||
) c
|
||||
CROSS JOIN (
|
||||
SELECT * FROM klptcm1_pro_plant_state_history
|
||||
ORDER BY INSDATE DESC
|
||||
SELECT * FROM klptcm1_pro_plant_state_history
|
||||
ORDER BY INSDATE DESC
|
||||
LIMIT 200
|
||||
) h
|
||||
WHERE d.NAME = #{name}
|
||||
@@ -139,5 +139,47 @@
|
||||
LIMIT 200
|
||||
</select>
|
||||
|
||||
<!-- 新增:获取所有定义及其当前值(不带name过滤) -->
|
||||
<select id="selectAllWithValues" resultMap="ValueVoResultMap">
|
||||
SELECT
|
||||
d.ID,
|
||||
d.NAME,
|
||||
d.UNITS,
|
||||
d.COMMENTS,
|
||||
d.INSDATE,
|
||||
d.MODELTYPE,
|
||||
-- current表的最新值:根据define的ID取对应的VALUE字段
|
||||
CASE d.ID
|
||||
WHEN 1 THEN c.VALUE1 WHEN 2 THEN c.VALUE2 WHEN 3 THEN c.VALUE3 WHEN 4 THEN c.VALUE4 WHEN 5 THEN c.VALUE5
|
||||
WHEN 6 THEN c.VALUE6 WHEN 7 THEN c.VALUE7 WHEN 8 THEN c.VALUE8 WHEN 9 THEN c.VALUE9 WHEN 10 THEN c.VALUE10
|
||||
WHEN 11 THEN c.VALUE11 WHEN 12 THEN c.VALUE12 WHEN 13 THEN c.VALUE13 WHEN 14 THEN c.VALUE14 WHEN 15 THEN c.VALUE15
|
||||
WHEN 16 THEN c.VALUE16 WHEN 17 THEN c.VALUE17 WHEN 18 THEN c.VALUE18 WHEN 19 THEN c.VALUE19 WHEN 20 THEN c.VALUE20
|
||||
WHEN 21 THEN c.VALUE21 WHEN 22 THEN c.VALUE22 WHEN 23 THEN c.VALUE23 WHEN 24 THEN c.VALUE24 WHEN 25 THEN c.VALUE25
|
||||
WHEN 26 THEN c.VALUE26 WHEN 27 THEN c.VALUE27 WHEN 28 THEN c.VALUE28 WHEN 29 THEN c.VALUE29 WHEN 30 THEN c.VALUE30
|
||||
WHEN 31 THEN c.VALUE31 WHEN 32 THEN c.VALUE32 WHEN 33 THEN c.VALUE33 WHEN 34 THEN c.VALUE34 WHEN 35 THEN c.VALUE35
|
||||
WHEN 36 THEN c.VALUE36 WHEN 37 THEN c.VALUE37 WHEN 38 THEN c.VALUE38 WHEN 39 THEN c.VALUE39 WHEN 40 THEN c.VALUE40
|
||||
WHEN 41 THEN c.VALUE41 WHEN 42 THEN c.VALUE42 WHEN 43 THEN c.VALUE43 WHEN 44 THEN c.VALUE44 WHEN 45 THEN c.VALUE45
|
||||
WHEN 46 THEN c.VALUE46 WHEN 47 THEN c.VALUE47 WHEN 48 THEN c.VALUE48 WHEN 49 THEN c.VALUE49 WHEN 50 THEN c.VALUE50
|
||||
WHEN 51 THEN c.VALUE51 WHEN 52 THEN c.VALUE52 WHEN 53 THEN c.VALUE53 WHEN 54 THEN c.VALUE54 WHEN 55 THEN c.VALUE55
|
||||
WHEN 56 THEN c.VALUE56 WHEN 57 THEN c.VALUE57 WHEN 58 THEN c.VALUE58 WHEN 59 THEN c.VALUE59 WHEN 60 THEN c.VALUE60
|
||||
WHEN 61 THEN c.VALUE61 WHEN 62 THEN c.VALUE62 WHEN 63 THEN c.VALUE63 WHEN 64 THEN c.VALUE64 WHEN 65 THEN c.VALUE65
|
||||
WHEN 66 THEN c.VALUE66 WHEN 67 THEN c.VALUE67 WHEN 68 THEN c.VALUE68 WHEN 69 THEN c.VALUE69 WHEN 70 THEN c.VALUE70
|
||||
WHEN 71 THEN c.VALUE71 WHEN 72 THEN c.VALUE72 WHEN 73 THEN c.VALUE73 WHEN 74 THEN c.VALUE74 WHEN 75 THEN c.VALUE75
|
||||
WHEN 76 THEN c.VALUE76 WHEN 77 THEN c.VALUE77 WHEN 78 THEN c.VALUE78 WHEN 79 THEN c.VALUE79 WHEN 80 THEN c.VALUE80
|
||||
WHEN 81 THEN c.VALUE81 WHEN 82 THEN c.VALUE82 WHEN 83 THEN c.VALUE83 WHEN 84 THEN c.VALUE84 WHEN 85 THEN c.VALUE85
|
||||
WHEN 86 THEN c.VALUE86 WHEN 87 THEN c.VALUE87 WHEN 88 THEN c.VALUE88 WHEN 89 THEN c.VALUE89 WHEN 90 THEN c.VALUE90
|
||||
WHEN 91 THEN c.VALUE91 WHEN 92 THEN c.VALUE92 WHEN 93 THEN c.VALUE93 WHEN 94 THEN c.VALUE94 WHEN 95 THEN c.VALUE95
|
||||
WHEN 96 THEN c.VALUE96 WHEN 97 THEN c.VALUE97 WHEN 98 THEN c.VALUE98 WHEN 99 THEN c.VALUE99
|
||||
ELSE NULL END AS currentValue,
|
||||
c.INSDATE AS currentInsdate
|
||||
FROM klptcm1_pro_plant_state_define d
|
||||
CROSS JOIN (
|
||||
SELECT * FROM klptcm1_pro_plant_state_current
|
||||
ORDER BY INSDATE DESC
|
||||
LIMIT 1
|
||||
) c
|
||||
ORDER BY d.ID
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.klp.pocket.mapper.Klptcm1ShiftCurrentMapper">
|
||||
|
||||
<!-- 结果集映射 -->
|
||||
<resultMap id="ShiftCurrentVoResultMap" type="com.klp.pocket.domain.vo.Klptcm1ShiftCurrentVo">
|
||||
<result column="SHIFT" property="shift" jdbcType="VARCHAR"/>
|
||||
<result column="CREW" property="crew" jdbcType="DECIMAL"/>
|
||||
<result column="SEQ_NUM" property="seqNum" jdbcType="DECIMAL"/>
|
||||
<result column="SYS_TIME" property="sysTime" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 查询当前班组信息 -->
|
||||
<select id="selectCurrent" resultMap="ShiftCurrentVoResultMap">
|
||||
SELECT SHIFT, CREW, SEQ_NUM, SYS_TIME
|
||||
FROM klptcm1_shift_current
|
||||
ORDER BY SYS_TIME DESC
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user