Compare commits

..

2 Commits

Author SHA1 Message Date
75a2623d8b config: 更新生产环境和预发布环境页面标题
- 将生产环境页面标题从"科伦普冷轧涂镀数智运营一体化平台"改为"MES一体化平台"
- 将预发布环境页面标题从"科伦普冷轧涂镀数智运营一体化平台"改为"MES一体化平台"
2026-03-09 16:58:25 +08:00
5d046be15b docs(app): 更新应用名称为MES一体化平台
- 将VUE_APP_TITLE从"科伦普冷轧涂镀数智运营一体化平台"更改为"MES一体化平台"
- 修改Greeting组件中的平台描述为"欢迎使用MES数智一体化平台"
- 将favicon链接从png格式更改为ico格式
- 替换index.vue中的关于页面内容为MES平台相关介绍
- 更新登录页面中的平台描述和公司信息
- 修改侧边栏Logo组件中的平台标题为"MES一体化平台"
- 注释掉dashboard demo组件中的全屏功能代码
2026-03-09 16:27:47 +08:00
469 changed files with 9588 additions and 38342 deletions

View File

@@ -11,7 +11,7 @@ import org.springframework.boot.context.metrics.buffering.BufferingApplicationSt
*/
//@SpringBootApplication
@SpringBootApplication
@SpringBootApplication(exclude = org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration.class)
public class KLPApplication {
public static void main(String[] args) {

View File

@@ -130,6 +130,10 @@ spring:
# 多久检查一次连接的活性
keepaliveTime: 30000
flyway:
baseline-on-migrate: true # 第一次运行时建立记录,不执行历史脚本
clean-disabled: true # 禁止清空库
--- # redis 单机配置(单机与集群只能开启一个另一个需要注释掉)
spring:
redis:

View File

@@ -124,6 +124,10 @@ spring:
# 多久检查一次连接的活性
keepaliveTime: 30000
flyway:
baseline-on-migrate: true # 第一次运行时建立记录,不执行历史脚本
clean-disabled: true # 禁止清空库
--- # redis 单机配置(单机与集群只能开启一个另一个需要注释掉)
spring:
redis:

View File

@@ -101,6 +101,11 @@ spring:
deserialization:
# 允许对象忽略json中不存在的属性
fail_on_unknown_properties: false
# 实时更新数据库结构
flyway:
enabled: true
locations: classpath:db/migration
table: flyway_schema_history
# Sa-Token配置
sa-token:
@@ -337,9 +342,3 @@ stamp:
base-url: http://python-stamp-service.example.com # 替换为实际地址
api-key: changeme # 替换为实际鉴权信息
timeout-ms: 5000 # 可按需调整
# OEE配置
oee:
acid:
# 酸轧入场卷创建人wms_material_coil.create_by
coil-create-by: suanzhakuguan

View File

@@ -1,28 +0,0 @@
CREATE TABLE IF NOT EXISTS aps_quick_sheet (
quick_sheet_id BIGINT AUTO_INCREMENT PRIMARY KEY,
plan_date DATE NOT NULL COMMENT '计划日期',
line_id BIGINT NULL COMMENT '产线ID',
line_name VARCHAR(120) NULL COMMENT '产线名称',
plan_code VARCHAR(60) NOT NULL COMMENT '计划号',
order_code VARCHAR(80) NULL COMMENT '订单号',
customer_name VARCHAR(120) NULL COMMENT '客户',
salesman VARCHAR(60) NULL COMMENT '业务员',
product_name VARCHAR(120) NULL COMMENT '产品',
raw_material_id VARCHAR(64) NULL COMMENT '原料钢卷',
raw_coil_nos VARCHAR(255) NULL COMMENT '原料卷号',
raw_location VARCHAR(120) NULL COMMENT '钢卷位置',
raw_packaging VARCHAR(120) NULL COMMENT '包装要求',
raw_edge_req VARCHAR(120) NULL COMMENT '切边要求',
raw_coating_type VARCHAR(120) NULL COMMENT '镀层种类',
raw_net_weight DECIMAL(18, 3) NULL COMMENT '原料净重',
plan_qty DECIMAL(18, 3) NULL COMMENT '计划数量',
start_time DATETIME NULL COMMENT '开始时间',
end_time DATETIME NULL COMMENT '结束时间',
del_flag TINYINT DEFAULT 0 COMMENT '删除标记(0正常 1删除)',
create_by VARCHAR(64) NULL,
update_by VARCHAR(64) NULL,
create_time DATETIME DEFAULT CURRENT_TIMESTAMP,
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
INDEX idx_aps_quick_sheet_plan_date (plan_date),
INDEX idx_aps_quick_sheet_line_id (line_id)
) COMMENT = '快速排产表(Excel样式)';

View File

@@ -1,47 +0,0 @@
CREATE TABLE IF NOT EXISTS wms_furnace (
furnace_id BIGINT AUTO_INCREMENT PRIMARY KEY,
furnace_code VARCHAR(50) NOT NULL COMMENT '炉编号',
furnace_name VARCHAR(100) NOT NULL COMMENT '名称',
busy_flag TINYINT DEFAULT 0 COMMENT '是否忙碌(0否1是)',
status TINYINT DEFAULT 1 COMMENT '状态(0停用1启用)',
remark VARCHAR(500) NULL COMMENT '备注',
del_flag TINYINT DEFAULT 0 COMMENT '删除标记(0正常 1删除)',
create_by VARCHAR(64) NULL,
update_by VARCHAR(64) NULL,
create_time DATETIME DEFAULT CURRENT_TIMESTAMP,
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
UNIQUE KEY uk_wms_furnace_code (furnace_code)
) COMMENT = '退火炉信息表';
CREATE TABLE IF NOT EXISTS wms_furnace_plan (
plan_id BIGINT AUTO_INCREMENT PRIMARY KEY,
plan_no VARCHAR(60) NOT NULL COMMENT '计划号',
plan_start_time DATETIME NULL COMMENT '计划开始时间',
actual_start_time DATETIME NULL COMMENT '实际开始时间',
end_time DATETIME NULL COMMENT '结束时间',
target_furnace_id BIGINT NOT NULL COMMENT '目标炉子ID',
status TINYINT DEFAULT 0 COMMENT '计划状态(0未开始 1进行中 2已完成)',
remark VARCHAR(500) NULL COMMENT '备注',
del_flag TINYINT DEFAULT 0 COMMENT '删除标记(0正常 1删除)',
create_by VARCHAR(64) NULL,
update_by VARCHAR(64) NULL,
create_time DATETIME DEFAULT CURRENT_TIMESTAMP,
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
UNIQUE KEY uk_wms_furnace_plan_no (plan_no),
INDEX idx_wms_furnace_plan_furnace (target_furnace_id),
INDEX idx_wms_furnace_plan_status (status)
) COMMENT = '退火计划表';
CREATE TABLE IF NOT EXISTS wms_furnace_plan_coil (
plan_coil_id BIGINT AUTO_INCREMENT PRIMARY KEY,
plan_id BIGINT NOT NULL COMMENT '计划ID',
coil_id BIGINT NOT NULL COMMENT '钢卷ID',
del_flag TINYINT DEFAULT 0 COMMENT '删除标记(0正常 1删除)',
create_by VARCHAR(64) NULL,
update_by VARCHAR(64) NULL,
create_time DATETIME DEFAULT CURRENT_TIMESTAMP,
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
UNIQUE KEY uk_wms_furnace_plan_coil (plan_id, coil_id),
INDEX idx_wms_furnace_plan_coil_plan (plan_id),
INDEX idx_wms_furnace_plan_coil_coil (coil_id)
) COMMENT = '退火计划钢卷关系表';

View File

@@ -1,99 +0,0 @@
package com.klp.aps.controller;
import java.util.List;
import java.util.Arrays;
import lombok.RequiredArgsConstructor;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import com.klp.common.annotation.RepeatSubmit;
import com.klp.common.annotation.Log;
import com.klp.common.core.controller.BaseController;
import com.klp.common.core.domain.PageQuery;
import com.klp.common.core.domain.R;
import com.klp.common.core.validate.AddGroup;
import com.klp.common.core.validate.EditGroup;
import com.klp.common.enums.BusinessType;
import com.klp.common.utils.poi.ExcelUtil;
import com.klp.aps.domain.vo.ApsPlanDetailVo;
import com.klp.aps.domain.bo.ApsPlanDetailBo;
import com.klp.aps.service.IApsPlanDetailService;
import com.klp.common.core.page.TableDataInfo;
/**
* 排产单明细
*
* @author klp
* @date 2026-03-26
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/aps/planDetail")
public class ApsPlanDetailController extends BaseController {
private final IApsPlanDetailService iApsPlanDetailService;
/**
* 查询排产单明细列表
*/
@GetMapping("/list")
public TableDataInfo<ApsPlanDetailVo> list(ApsPlanDetailBo bo, PageQuery pageQuery) {
return iApsPlanDetailService.queryPageList(bo, pageQuery);
}
/**
* 导出排产单明细列表
*/
@Log(title = "排产单明细", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(ApsPlanDetailBo bo, HttpServletResponse response) {
List<ApsPlanDetailVo> list = iApsPlanDetailService.queryList(bo);
ExcelUtil.exportExcel(list, "排产单明细", ApsPlanDetailVo.class, response);
}
/**
* 获取排产单明细详细信息
*
* @param planDetailId 主键
*/
@GetMapping("/{planDetailId}")
public R<ApsPlanDetailVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long planDetailId) {
return R.ok(iApsPlanDetailService.queryById(planDetailId));
}
/**
* 新增排产单明细
*/
@Log(title = "排产单明细", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody ApsPlanDetailBo bo) {
return toAjax(iApsPlanDetailService.insertByBo(bo));
}
/**
* 修改排产单明细
*/
@Log(title = "排产单明细", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ApsPlanDetailBo bo) {
return toAjax(iApsPlanDetailService.updateByBo(bo));
}
/**
* 删除排产单明细
*
* @param planDetailIds 主键串
*/
@Log(title = "排产单明细", businessType = BusinessType.DELETE)
@DeleteMapping("/{planDetailIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] planDetailIds) {
return toAjax(iApsPlanDetailService.deleteWithValidByIds(Arrays.asList(planDetailIds), true));
}
}

View File

@@ -1,105 +0,0 @@
package com.klp.aps.controller;
import java.util.List;
import java.util.Arrays;
import com.klp.aps.domain.dto.ApsPlanSheetQueryReq;
import com.klp.aps.domain.dto.ApsQuickSheetQueryReq;
import lombok.RequiredArgsConstructor;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import com.klp.common.annotation.RepeatSubmit;
import com.klp.common.annotation.Log;
import com.klp.common.core.controller.BaseController;
import com.klp.common.core.domain.PageQuery;
import com.klp.common.core.domain.R;
import com.klp.common.core.validate.AddGroup;
import com.klp.common.core.validate.EditGroup;
import com.klp.common.enums.BusinessType;
import com.klp.common.utils.poi.ExcelUtil;
import com.klp.aps.domain.vo.ApsPlanSheetVo;
import com.klp.aps.domain.bo.ApsPlanSheetBo;
import com.klp.aps.service.IApsPlanSheetService;
import com.klp.common.core.page.TableDataInfo;
/**
* 排产单主
*
* @author klp
* @date 2026-03-26
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/aps/planSheet")
public class ApsPlanSheetController extends BaseController {
private final IApsPlanSheetService iApsPlanSheetService;
/**
* 查询排产单主列表
*/
@GetMapping("/list")
public TableDataInfo<ApsPlanSheetVo> list(ApsPlanSheetBo bo, PageQuery pageQuery) {
return iApsPlanSheetService.queryPageList(bo, pageQuery);
}
/**
* 导出排产单主列表
*/
@Log(title = "排产单主", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(ApsPlanSheetBo bo, HttpServletResponse response) {
List<ApsPlanSheetVo> list = iApsPlanSheetService.queryList(bo);
ExcelUtil.exportExcel(list, "排产单主", ApsPlanSheetVo.class, response);
}
@GetMapping("/exportAll")
public void export(@Validated ApsPlanSheetQueryReq req, javax.servlet.http.HttpServletResponse response) {
iApsPlanSheetService.exportExcel(req, response);
}
/**
* 获取排产单主详细信息
*
* @param planSheetId 主键
*/
@GetMapping("/{planSheetId}")
public R<ApsPlanSheetVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long planSheetId) {
return R.ok(iApsPlanSheetService.queryById(planSheetId));
}
/**
* 新增排产单主
*/
@Log(title = "排产单主", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody ApsPlanSheetBo bo) {
return toAjax(iApsPlanSheetService.insertByBo(bo));
}
/**
* 修改排产单主
*/
@Log(title = "排产单主", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ApsPlanSheetBo bo) {
return toAjax(iApsPlanSheetService.updateByBo(bo));
}
/**
* 删除排产单主
*
* @param planSheetIds 主键串
*/
@Log(title = "排产单主", businessType = BusinessType.DELETE)
@DeleteMapping("/{planSheetIds}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] planSheetIds) {
return toAjax(iApsPlanSheetService.deleteWithValidByIds(Arrays.asList(planSheetIds), true));
}
}

View File

@@ -1,55 +0,0 @@
package com.klp.aps.controller;
import com.klp.aps.domain.dto.ApsQuickSheetQueryReq;
import com.klp.aps.domain.dto.ApsQuickSheetSaveReq;
import com.klp.aps.domain.vo.ApsQuickSheetRowVo;
import com.klp.aps.service.ApsQuickSheetService;
import com.klp.common.core.controller.BaseController;
import com.klp.common.core.domain.R;
import com.klp.common.helper.LoginHelper;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RequiredArgsConstructor
@RestController
@RequestMapping("/aps/quick-sheet")
public class ApsQuickSheetController extends BaseController {
private final ApsQuickSheetService quickSheetService;
@GetMapping("/list")
public R<List<ApsQuickSheetRowVo>> list(@Validated ApsQuickSheetQueryReq req) {
return R.ok(quickSheetService.queryList(req));
}
@GetMapping("/preset")
public R<List<ApsQuickSheetRowVo>> preset(@RequestParam(value = "lineId", required = false) Long lineId) {
String salesman = LoginHelper.getNickName();
return R.ok(quickSheetService.buildPresetRows(lineId, salesman));
}
@PostMapping("/save")
public R<Void> save(@Validated @RequestBody ApsQuickSheetSaveReq req) {
quickSheetService.saveRows(req, getUsername());
return R.ok();
}
@GetMapping("/export")
public void export(@Validated ApsQuickSheetQueryReq req, javax.servlet.http.HttpServletResponse response) {
quickSheetService.exportExcel(req, response);
}
@PostMapping("/delete")
public R<Void> delete(@RequestParam("quickSheetId") Long quickSheetId) {
quickSheetService.deleteById(quickSheetId, getUsername());
return R.ok();
}
}

View File

@@ -1,219 +0,0 @@
package com.klp.aps.domain.bo;
import com.klp.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
* 排产单明细业务对象 aps_plan_detail
*
* @author klp
* @date 2026-03-26
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class ApsPlanDetailBo extends BaseEntity {
/**
* 排产明细主键ID
*/
private Long planDetailId;
/**
* 关联排产单ID
*/
private Long planSheetId;
/**
* 内容序号
*/
private String bizSeqNo;
/**
* 订单ID
*/
private Long orderId;
/**
* 销售内容:订单号
*/
private String orderCode;
/**
* 销售内容:订单合同号
*/
private String contractCode;
/**
* 销售内容:客户
*/
private String customerName;
/**
* 销售内容:业务员
*/
private String salesman;
/**
* 原料信息:厂家
*/
private String rawManufacturer;
/**
* 原料信息:材质
*/
private String rawMaterial;
/**
* 原料信息:厚度mm
*/
private BigDecimal rawThick;
/**
* 原料信息:宽度mm
*/
private BigDecimal rawWidth;
/**
* 原料钢卷ID
*/
private Long rawMaterialId;
/**
* 原料卷号
*/
private String rawCoilNos;
/**
* 钢卷位置
*/
private String rawLocation;
/**
* 包装要求
*/
private String rawPackaging;
/**
* 宽度要求
*/
private String rawEdgeReq;
/**
* 镀层种类
*/
private String rawCoatingType;
/**
* 原料净重
*/
private BigDecimal rawNetWeight;
/**
* 成品信息:成品名称
*/
private String productName;
/**
* 成品信息:材质
*/
private String productMaterial;
/**
* 成品信息:镀层g
*/
private BigDecimal coatingG;
/**
* 成品信息:成品宽度
*/
private BigDecimal productWidth;
/**
* 成品信息:轧制厚度
*/
private BigDecimal rollingThick;
/**
* 成品信息:标签厚度
*/
private BigDecimal markCoatThick;
/**
* 成品信息:吨钢长度区间m
*/
private String tonSteelLengthRange;
/**
* 成品信息:数量
*/
private BigDecimal planQty;
/**
* 成品信息:重量
*/
private BigDecimal planWeight;
/**
* 成品信息:表面处理
*/
private String surfaceTreatment;
/**
* 成品信息:切边要求
*/
private String widthReq;
/**
* 成品信息:包装要求
*/
private String productPackaging;
/**
* 成品信息:宽度要求
*/
private String productEdgeReq;
/**
* 成品信息:用途
*/
private String usageReq;
/**
* 后处理
*/
private String postProcess;
/**
* 下工序
*/
private String nextProcess;
/**
* 取样
*/
private String sampleReq;
/**
* 生产开始时间
*/
private Date startTime;
/**
* 生产结束时间
*/
private Date endTime;
/**
* 备注
*/
private String remark;
}

View File

@@ -1,63 +0,0 @@
package com.klp.aps.domain.bo;
import com.klp.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.*;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
* 排产单主业务对象 aps_plan_sheet
*
* @author klp
* @date 2026-03-26
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class ApsPlanSheetBo extends BaseEntity {
/**
* 排产单主键ID
*/
private Long planSheetId;
/**
* 排产日期
*/
private Date planDate;
/**
* 产线ID
*/
private Long lineId;
/**
* 产线名称
*/
private String lineName;
/**
* 排产单号
*/
private String planCode;
/**
* 排产类型
*/
private String planType;
/**
* 排产人
*/
private String scheduler;
/**
* 备注
*/
private String remark;
}

View File

@@ -1,23 +0,0 @@
package com.klp.aps.domain.dto;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDate;
@Data
public class ApsPlanSheetQueryReq {
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate startDate;
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate endDate;
private Long lineId;
// planSheetId
private Long planSheetId;
private String customerName;
}

View File

@@ -1,59 +0,0 @@
package com.klp.aps.domain.dto;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import java.util.List;
@Data
public class ApsPlanSheetSaveReq {
@NotEmpty(message = "rows 不能为空")
private List<ApsQuickSheetSaveReq.Row> rows;
@Data
public static class Row {
private Long quickSheetId;
private Long lineId;
private String lineName;
private String planCode;
private String planType;
private String scheduler;
private String remark;
private String bizSeqNo;
private String orderCode;
private String contractCode;
private String customerName;
private String salesman;
private String productName;
private String productMaterial;
private String coatingG;
private String productWidth;
private String rollingThick;
private String markCoatThick;
private String tonSteelLengthRange;
private String planQty;
private String planWeight;
private String surfaceTreatment;
private String widthReq;
private String usageReq;
private String postProcess;
private String nextProcess;
private String sampleReq;
private String rawManufacturer;
private String rawMaterial;
private String rawThick;
private String rawWidth;
private String rawMaterialId;
private String rawCoilNos;
private String rawLocation;
private String rawPackaging;
private String rawEdgeReq;
private String rawCoatingType;
private String rawNetWeight;
private String startTime;
private String endTime;
}
}

View File

@@ -1,20 +0,0 @@
package com.klp.aps.domain.dto;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDate;
@Data
public class ApsQuickSheetQueryReq {
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate startDate;
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate endDate;
private Long lineId;
private String customerName;
}

View File

@@ -1,60 +0,0 @@
package com.klp.aps.domain.dto;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import java.util.List;
@Data
public class ApsQuickSheetSaveReq {
@NotEmpty(message = "rows 不能为空")
private List<Row> rows;
@Data
public static class Row {
private Long quickSheetId;
private Long lineId;
private String lineName;
private String planCode;
private String planType;
private String scheduler;
private String remark;
private String bizSeqNo;
private String orderCode;
private String contractCode;
private String customerName;
private String salesman;
private String productName;
private String productMaterial;
private String coatingG;
private String productWidth;
private String rollingThick;
private String markCoatThick;
private String tonSteelLengthRange;
private String planQty;
private String planWeight;
private String surfaceTreatment;
private String widthReq;
private String usageReq;
private String postProcess;
private String nextProcess;
private String sampleReq;
private String rawManufacturer;
private String rawMaterial;
private String rawThick;
private String rawWidth;
private String rawMaterialId;
private String rawCoilNos;
private String rawLocation;
private String rawPackaging;
private String rawEdgeReq;
private String rawCoatingType;
private String rawNetWeight;
private String startTime;
private String endTime;
}
}

View File

@@ -1,187 +0,0 @@
package com.klp.aps.domain.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.klp.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
/**
* 排产单明细对象 aps_plan_detail
*
* @author klp
* @date 2026-03-26
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("aps_plan_detail")
public class ApsPlanDetail extends BaseEntity {
private static final long serialVersionUID=1L;
/**
* 排产明细主键ID
*/
@TableId(value = "plan_detail_id")
private Long planDetailId;
/**
* 关联排产单ID
*/
private Long planSheetId;
/**
* 内容序号
*/
private String bizSeqNo;
/**
* 订单ID
*/
private Long orderId;
/**
* 销售内容:订单号
*/
private String orderCode;
/**
* 销售内容:订单合同号
*/
private String contractCode;
/**
* 销售内容:客户
*/
private String customerName;
/**
* 销售内容:业务员
*/
private String salesman;
/**
* 原料信息:厂家
*/
private String rawManufacturer;
/**
* 原料信息:材质
*/
private String rawMaterial;
/**
* 原料信息:厚度mm
*/
private BigDecimal rawThick;
/**
* 原料信息:宽度mm
*/
private BigDecimal rawWidth;
/**
* 原料钢卷ID
*/
private Long rawMaterialId;
/**
* 原料卷号
*/
private String rawCoilNos;
/**
* 钢卷位置
*/
private String rawLocation;
/**
* 包装要求
*/
private String rawPackaging;
/**
* 宽度要求
*/
private String rawEdgeReq;
/**
* 镀层种类
*/
private String rawCoatingType;
/**
* 原料净重
*/
private BigDecimal rawNetWeight;
/**
* 成品信息:成品名称
*/
private String productName;
/**
* 成品信息:材质
*/
private String productMaterial;
/**
* 成品信息:镀层g
*/
private BigDecimal coatingG;
/**
* 成品信息:成品宽度
*/
private BigDecimal productWidth;
/**
* 成品信息:轧制厚度
*/
private BigDecimal rollingThick;
/**
* 成品信息:标签厚度
*/
private BigDecimal markCoatThick;
/**
* 成品信息:吨钢长度区间m
*/
private String tonSteelLengthRange;
/**
* 成品信息:数量
*/
private BigDecimal planQty;
/**
* 成品信息:重量
*/
private BigDecimal planWeight;
/**
* 成品信息:表面处理
*/
private String surfaceTreatment;
/**
* 成品信息:切边要求
*/
private String widthReq;
/**
* 成品信息:包装要求
*/
private String productPackaging;
/**
* 成品信息:宽度要求
*/
private String productEdgeReq;
/**
* 成品信息:用途
*/
private String usageReq;
/**
* 后处理
*/
private String postProcess;
/**
* 下工序
*/
private String nextProcess;
/**
* 取样
*/
private String sampleReq;
/**
* 生产开始时间
*/
private Date startTime;
/**
* 生产结束时间
*/
private Date endTime;
/**
* 备注
*/
private String remark;
/**
* 删除标记(0正常 1删除)
*/
@TableLogic
private Long delFlag;
}

View File

@@ -1,62 +0,0 @@
package com.klp.aps.domain.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.klp.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 排产单主对象 aps_plan_sheet
*
* @author klp
* @date 2026-03-26
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("aps_plan_sheet")
public class ApsPlanSheet extends BaseEntity {
private static final long serialVersionUID=1L;
/**
* 排产单主键ID
*/
@TableId(value = "plan_sheet_id")
private Long planSheetId;
/**
* 排产日期
*/
private Date planDate;
/**
* 产线ID
*/
private Long lineId;
/**
* 产线名称
*/
private String lineName;
/**
* 排产单号
*/
private String planCode;
/**
* 排产类型
*/
private String planType;
/**
* 排产人
*/
private String scheduler;
/**
* 备注
*/
private String remark;
/**
* 删除标记(0正常 1删除)
*/
@TableLogic
private Long delFlag;
}

View File

@@ -1,60 +0,0 @@
package com.klp.aps.domain.entity;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Data
public class ApsQuickSheetEntity {
private Long quickSheetId;
private LocalDate planDate;
private Long lineId;
private String lineName;
private String planCode;
private String planType;
private String scheduler;
private String remark;
private String bizSeqNo;
private String orderCode;
private String contractCode;
private String customerName;
private String salesman;
private String productName;
private String productMaterial;
private BigDecimal coatingG;
private BigDecimal productWidth;
private BigDecimal rollingThick;
private BigDecimal markCoatThick;
private String tonSteelLengthRange;
private BigDecimal planQty;
private BigDecimal planWeight;
private String surfaceTreatment;
private String widthReq;
private String usageReq;
private String postProcess;
private String nextProcess;
private String sampleReq;
private String rawManufacturer;
private String rawMaterial;
private BigDecimal rawThick;
private BigDecimal rawWidth;
private String rawMaterialId;
private String rawCoilNos;
private String rawLocation;
private String rawPackaging;
private String rawEdgeReq;
private String rawCoatingType;
private BigDecimal rawNetWeight;
private LocalDateTime startTime;
private LocalDateTime endTime;
private String createBy;
private String updateBy;
private LocalDateTime createTime;
private LocalDateTime updateTime;
private Integer delFlag;
}

View File

@@ -1,260 +0,0 @@
package com.klp.aps.domain.vo;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.klp.common.annotation.ExcelDictFormat;
import com.klp.common.convert.ExcelDictConvert;
import lombok.Data;
/**
* 排产单明细视图对象 aps_plan_detail
*
* @author klp
* @date 2026-03-26
*/
@Data
@ExcelIgnoreUnannotated
public class ApsPlanDetailVo {
private static final long serialVersionUID = 1L;
/**
* 排产明细主键ID
*/
@ExcelProperty(value = "排产明细主键ID")
private Long planDetailId;
/**
* 关联排产单ID
*/
@ExcelProperty(value = "关联排产单ID")
private Long planSheetId;
/**
* 内容序号
*/
@ExcelProperty(value = "内容序号")
private String bizSeqNo;
/**
* 订单ID
*/
@ExcelProperty(value = "订单ID")
private Long orderId;
/**
* 销售内容:订单号
*/
@ExcelProperty(value = "销售内容:订单号")
private String orderCode;
/**
* 销售内容:订单合同号
*/
@ExcelProperty(value = "销售内容:订单合同号")
private String contractCode;
/**
* 销售内容:客户
*/
@ExcelProperty(value = "销售内容:客户")
private String customerName;
/**
* 销售内容:业务员
*/
@ExcelProperty(value = "销售内容:业务员")
private String salesman;
/**
* 原料信息:厂家
*/
@ExcelProperty(value = "原料信息:厂家")
private String rawManufacturer;
/**
* 原料信息:材质
*/
@ExcelProperty(value = "原料信息:材质")
private String rawMaterial;
/**
* 原料信息:厚度mm
*/
@ExcelProperty(value = "原料信息:厚度mm")
private BigDecimal rawThick;
/**
* 原料信息:宽度mm
*/
@ExcelProperty(value = "原料信息:宽度mm")
private BigDecimal rawWidth;
/**
* 原料钢卷ID
*/
@ExcelProperty(value = "原料钢卷ID")
private Long rawMaterialId;
/**
* 原料卷号
*/
@ExcelProperty(value = "原料卷号")
private String rawCoilNos;
/**
* 钢卷位置
*/
@ExcelProperty(value = "钢卷位置")
private String rawLocation;
/**
* 包装要求
*/
@ExcelProperty(value = "包装要求")
private String rawPackaging;
/**
* 宽度要求
*/
@ExcelProperty(value = "宽度要求")
private String rawEdgeReq;
/**
* 镀层种类
*/
@ExcelProperty(value = "镀层种类")
private String rawCoatingType;
/**
* 原料净重
*/
@ExcelProperty(value = "原料净重")
private BigDecimal rawNetWeight;
/**
* 成品信息:成品名称
*/
@ExcelProperty(value = "成品信息:成品名称")
private String productName;
/**
* 成品信息:材质
*/
@ExcelProperty(value = "成品信息:材质")
private String productMaterial;
/**
* 成品信息:镀层g
*/
@ExcelProperty(value = "成品信息:镀层g")
private BigDecimal coatingG;
/**
* 成品信息:成品宽度
*/
@ExcelProperty(value = "成品信息:成品宽度")
private BigDecimal productWidth;
/**
* 成品信息:轧制厚度
*/
@ExcelProperty(value = "成品信息:轧制厚度")
private BigDecimal rollingThick;
/**
* 成品信息:标签厚度
*/
@ExcelProperty(value = "成品信息:标签厚度")
private BigDecimal markCoatThick;
/**
* 成品信息:吨钢长度区间m
*/
@ExcelProperty(value = "成品信息:吨钢长度区间m")
private String tonSteelLengthRange;
/**
* 成品信息:数量
*/
@ExcelProperty(value = "成品信息:数量")
private BigDecimal planQty;
/**
* 成品信息:重量
*/
@ExcelProperty(value = "成品信息:重量")
private BigDecimal planWeight;
/**
* 成品信息:表面处理
*/
@ExcelProperty(value = "成品信息:表面处理")
private String surfaceTreatment;
/**
* 成品信息:切边要求
*/
@ExcelProperty(value = "成品信息:切边要求")
private String widthReq;
/**
* 成品信息:包装要求
*/
@ExcelProperty(value = "成品信息:包装要求")
private String productPackaging;
/**
* 成品信息:宽度要求
*/
@ExcelProperty(value = "成品信息:宽度要求")
private String productEdgeReq;
/**
* 成品信息:用途
*/
@ExcelProperty(value = "成品信息:用途")
private String usageReq;
/**
* 后处理
*/
@ExcelProperty(value = "后处理")
private String postProcess;
/**
* 下工序
*/
@ExcelProperty(value = "下工序")
private String nextProcess;
/**
* 取样
*/
@ExcelProperty(value = "取样")
private String sampleReq;
/**
* 生产开始时间
*/
@ExcelProperty(value = "生产开始时间")
private Date startTime;
/**
* 生产结束时间
*/
@ExcelProperty(value = "生产结束时间")
private Date endTime;
/**
* 备注
*/
@ExcelProperty(value = "备注")
private String remark;
}

View File

@@ -1,56 +0,0 @@
package com.klp.aps.domain.vo;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
public class ApsPlanSheetRowVo {
private Long detailSheetId;
private java.time.LocalDate planDate;
private Long lineId;
private String lineName;
private String planCode;
private String planType;
private String scheduler;
private String masterRemark;
private String updateBy;
private String bizSeqNo;
private String orderCode;
private String contractCode;
private String customerName;
private String salesman;
private String productName;
private String productMaterial;
private BigDecimal coatingG;
private BigDecimal productWidth;
private BigDecimal rollingThick;
private BigDecimal markCoatThick;
private String tonSteelLengthRange;
private BigDecimal planQty;
private BigDecimal planWeight;
private String surfaceTreatment;
private String widthReq;
private String usageReq;
private String postProcess;
private String nextProcess;
private String sampleReq;
private String rawManufacturer;
private String rawMaterial;
private BigDecimal rawThick;
private BigDecimal rawWidth;
private String rawMaterialId;
private String rawCoilNos;
private String rawLocation;
private String rawPackaging;
private String rawEdgeReq;
private String rawCoatingType;
private BigDecimal rawNetWeight;
private LocalDateTime startTime;
private LocalDateTime endTime;
private String detailRemark;
}

View File

@@ -1,73 +0,0 @@
package com.klp.aps.domain.vo;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.klp.common.annotation.ExcelDictFormat;
import com.klp.common.convert.ExcelDictConvert;
import lombok.Data;
/**
* 排产单主视图对象 aps_plan_sheet
*
* @author klp
* @date 2026-03-26
*/
@Data
@ExcelIgnoreUnannotated
public class ApsPlanSheetVo {
private static final long serialVersionUID = 1L;
/**
* 排产单主键ID
*/
@ExcelProperty(value = "排产单主键ID")
private Long planSheetId;
/**
* 排产日期
*/
@ExcelProperty(value = "排产日期")
private Date planDate;
/**
* 产线ID
*/
@ExcelProperty(value = "产线ID")
private Long lineId;
/**
* 产线名称
*/
@ExcelProperty(value = "产线名称")
private String lineName;
/**
* 排产单号
*/
@ExcelProperty(value = "排产单号")
private String planCode;
/**
* 排产类型
*/
@ExcelProperty(value = "排产类型")
private String planType;
/**
* 排产人
*/
@ExcelProperty(value = "排产人")
private String scheduler;
/**
* 备注
*/
@ExcelProperty(value = "备注")
private String remark;
}

View File

@@ -1,54 +0,0 @@
package com.klp.aps.domain.vo;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
public class ApsQuickSheetRowVo {
private Long quickSheetId;
private java.time.LocalDate planDate;
private Long lineId;
private String lineName;
private String planCode;
private String planType;
private String scheduler;
private String remark;
private String bizSeqNo;
private String orderCode;
private String contractCode;
private String customerName;
private String salesman;
private String productName;
private String productMaterial;
private BigDecimal coatingG;
private BigDecimal productWidth;
private BigDecimal rollingThick;
private BigDecimal markCoatThick;
private String tonSteelLengthRange;
private BigDecimal planQty;
private BigDecimal planWeight;
private String surfaceTreatment;
private String widthReq;
private String usageReq;
private String postProcess;
private String nextProcess;
private String sampleReq;
private String rawManufacturer;
private String rawMaterial;
private BigDecimal rawThick;
private BigDecimal rawWidth;
private String rawMaterialId;
private String rawCoilNos;
private String rawLocation;
private String rawPackaging;
private String rawEdgeReq;
private String rawCoatingType;
private BigDecimal rawNetWeight;
private LocalDateTime startTime;
private LocalDateTime endTime;
}

View File

@@ -1,18 +0,0 @@
package com.klp.aps.mapper;
import com.klp.aps.domain.entity.ApsPlanDetail;
import com.klp.aps.domain.vo.ApsPlanDetailVo;
import com.klp.common.core.mapper.BaseMapperPlus;
import java.util.Collection;
/**
* 排产单明细Mapper接口
*
* @author klp
* @date 2026-03-26
*/
public interface ApsPlanDetailMapper extends BaseMapperPlus<ApsPlanDetailMapper, ApsPlanDetail, ApsPlanDetailVo> {
int deleteByPlanSheetIds(Collection<Long> planSheetIds);
}

View File

@@ -1,22 +0,0 @@
package com.klp.aps.mapper;
import com.klp.aps.domain.dto.ApsPlanSheetQueryReq;
import com.klp.aps.domain.dto.ApsQuickSheetQueryReq;
import com.klp.aps.domain.entity.ApsPlanSheet;
import com.klp.aps.domain.vo.ApsPlanSheetRowVo;
import com.klp.aps.domain.vo.ApsPlanSheetVo;
import com.klp.aps.domain.vo.ApsQuickSheetRowVo;
import com.klp.common.core.mapper.BaseMapperPlus;
import java.util.List;
/**
* 排产单主Mapper接口
*
* @author klp
* @date 2026-03-26
*/
public interface ApsPlanSheetMapper extends BaseMapperPlus<ApsPlanSheetMapper, ApsPlanSheet, ApsPlanSheetVo> {
List<ApsPlanSheetRowVo> selectList(ApsPlanSheetQueryReq req);
}

View File

@@ -1,111 +0,0 @@
package com.klp.aps.mapper;
import com.klp.aps.domain.dto.ApsQuickSheetQueryReq;
import com.klp.aps.domain.vo.ApsQuickSheetRowVo;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
public interface ApsQuickSheetMapper {
List<ApsQuickSheetRowVo> selectList(ApsQuickSheetQueryReq req);
int countToday(@Param("planDate") LocalDate planDate);
Long selectIdByPlanCode(@Param("planCode") String planCode);
int insertRow(@Param("lineId") Long lineId,
@Param("lineName") String lineName,
@Param("planDate") LocalDate planDate,
@Param("planCode") String planCode,
@Param("planType") String planType,
@Param("scheduler") String scheduler,
@Param("remark") String remark,
@Param("bizSeqNo") String bizSeqNo,
@Param("orderCode") String orderCode,
@Param("contractCode") String contractCode,
@Param("customerName") String customerName,
@Param("salesman") String salesman,
@Param("productName") String productName,
@Param("productMaterial") String productMaterial,
@Param("coatingG") BigDecimal coatingG,
@Param("productWidth") BigDecimal productWidth,
@Param("rollingThick") BigDecimal rollingThick,
@Param("markCoatThick") BigDecimal markCoatThick,
@Param("tonSteelLengthRange") String tonSteelLengthRange,
@Param("planQty") BigDecimal planQty,
@Param("planWeight") BigDecimal planWeight,
@Param("surfaceTreatment") String surfaceTreatment,
@Param("widthReq") String widthReq,
@Param("usageReq") String usageReq,
@Param("postProcess") String postProcess,
@Param("nextProcess") String nextProcess,
@Param("sampleReq") String sampleReq,
@Param("rawManufacturer") String rawManufacturer,
@Param("rawMaterial") String rawMaterial,
@Param("rawThick") BigDecimal rawThick,
@Param("rawWidth") BigDecimal rawWidth,
@Param("rawMaterialId") String rawMaterialId,
@Param("rawCoilNos") String rawCoilNos,
@Param("rawLocation") String rawLocation,
@Param("rawPackaging") String rawPackaging,
@Param("rawEdgeReq") String rawEdgeReq,
@Param("rawCoatingType") String rawCoatingType,
@Param("rawNetWeight") BigDecimal rawNetWeight,
@Param("startTime") LocalDateTime startTime,
@Param("endTime") LocalDateTime endTime,
@Param("createBy") String createBy,
@Param("updateBy") String updateBy);
int updateRow(@Param("id") Long id,
@Param("lineId") Long lineId,
@Param("lineName") String lineName,
@Param("planCode") String planCode,
@Param("planType") String planType,
@Param("scheduler") String scheduler,
@Param("remark") String remark,
@Param("bizSeqNo") String bizSeqNo,
@Param("orderCode") String orderCode,
@Param("contractCode") String contractCode,
@Param("customerName") String customerName,
@Param("salesman") String salesman,
@Param("productName") String productName,
@Param("productMaterial") String productMaterial,
@Param("coatingG") BigDecimal coatingG,
@Param("productWidth") BigDecimal productWidth,
@Param("rollingThick") BigDecimal rollingThick,
@Param("markCoatThick") BigDecimal markCoatThick,
@Param("tonSteelLengthRange") String tonSteelLengthRange,
@Param("planQty") BigDecimal planQty,
@Param("planWeight") BigDecimal planWeight,
@Param("surfaceTreatment") String surfaceTreatment,
@Param("widthReq") String widthReq,
@Param("usageReq") String usageReq,
@Param("postProcess") String postProcess,
@Param("nextProcess") String nextProcess,
@Param("sampleReq") String sampleReq,
@Param("rawManufacturer") String rawManufacturer,
@Param("rawMaterial") String rawMaterial,
@Param("rawThick") BigDecimal rawThick,
@Param("rawWidth") BigDecimal rawWidth,
@Param("rawMaterialId") String rawMaterialId,
@Param("rawCoilNos") String rawCoilNos,
@Param("rawLocation") String rawLocation,
@Param("rawPackaging") String rawPackaging,
@Param("rawEdgeReq") String rawEdgeReq,
@Param("rawCoatingType") String rawCoatingType,
@Param("rawNetWeight") BigDecimal rawNetWeight,
@Param("startTime") LocalDateTime startTime,
@Param("endTime") LocalDateTime endTime,
@Param("updateBy") String updateBy);
int deleteRow(@Param("id") Long id, @Param("updateBy") String updateBy);
int softDelete(@Param("id") Long id,
@Param("updateBy") String updateBy);
int deleteById(@Param("id") Long id, @Param("updateBy") String updateBy);
}

View File

@@ -1,20 +0,0 @@
package com.klp.aps.service;
import com.klp.aps.domain.dto.ApsQuickSheetQueryReq;
import com.klp.aps.domain.dto.ApsQuickSheetSaveReq;
import com.klp.aps.domain.vo.ApsQuickSheetRowVo;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
public interface ApsQuickSheetService {
List<ApsQuickSheetRowVo> queryList(ApsQuickSheetQueryReq req);
void saveRows(ApsQuickSheetSaveReq req, String operator);
List<ApsQuickSheetRowVo> buildPresetRows(Long lineId, String salesman);
void exportExcel(ApsQuickSheetQueryReq req, HttpServletResponse response);
void deleteById(Long id, String operator);
}

View File

@@ -1,53 +0,0 @@
package com.klp.aps.service;
import com.klp.aps.domain.vo.ApsPlanDetailVo;
import com.klp.aps.domain.bo.ApsPlanDetailBo;
import com.klp.common.core.page.TableDataInfo;
import com.klp.common.core.domain.PageQuery;
import java.util.Collection;
import java.util.List;
/**
* 排产单明细Service接口
*
* @author klp
* @date 2026-03-26
*/
public interface IApsPlanDetailService {
/**
* 查询排产单明细
*/
ApsPlanDetailVo queryById(Long planDetailId);
/**
* 查询排产单明细列表
*/
TableDataInfo<ApsPlanDetailVo> queryPageList(ApsPlanDetailBo bo, PageQuery pageQuery);
/**
* 查询排产单明细列表
*/
List<ApsPlanDetailVo> queryList(ApsPlanDetailBo bo);
/**
* 新增排产单明细
*/
Boolean insertByBo(ApsPlanDetailBo bo);
/**
* 修改排产单明细
*/
Boolean updateByBo(ApsPlanDetailBo bo);
/**
* 校验并批量删除排产单明细信息
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
* 根据排产单ID删除明细
*/
int deleteByPlanSheetIds(Collection<Long> planSheetIds);
}

View File

@@ -1,54 +0,0 @@
package com.klp.aps.service;
import com.klp.aps.domain.dto.ApsPlanSheetQueryReq;
import com.klp.aps.domain.dto.ApsQuickSheetQueryReq;
import com.klp.aps.domain.vo.ApsPlanSheetVo;
import com.klp.aps.domain.bo.ApsPlanSheetBo;
import com.klp.common.core.page.TableDataInfo;
import com.klp.common.core.domain.PageQuery;
import javax.servlet.http.HttpServletResponse;
import java.util.Collection;
import java.util.List;
/**
* 排产单主Service接口
*
* @author klp
* @date 2026-03-26
*/
public interface IApsPlanSheetService {
/**
* 查询排产单主
*/
ApsPlanSheetVo queryById(Long planSheetId);
/**
* 查询排产单主列表
*/
TableDataInfo<ApsPlanSheetVo> queryPageList(ApsPlanSheetBo bo, PageQuery pageQuery);
/**
* 查询排产单主列表
*/
List<ApsPlanSheetVo> queryList(ApsPlanSheetBo bo);
/**
* 新增排产单主
*/
Boolean insertByBo(ApsPlanSheetBo bo);
/**
* 修改排产单主
*/
Boolean updateByBo(ApsPlanSheetBo bo);
/**
* 校验并批量删除排产单主信息
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
void exportExcel(ApsPlanSheetQueryReq req, HttpServletResponse response);
}

View File

@@ -1,150 +0,0 @@
package com.klp.aps.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.klp.common.core.page.TableDataInfo;
import com.klp.common.core.domain.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.klp.common.utils.StringUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.klp.aps.domain.bo.ApsPlanDetailBo;
import com.klp.aps.domain.vo.ApsPlanDetailVo;
import com.klp.aps.domain.entity.ApsPlanDetail;
import com.klp.aps.mapper.ApsPlanDetailMapper;
import com.klp.aps.service.IApsPlanDetailService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* 排产单明细Service业务层处理
*
* @author klp
* @date 2026-03-26
*/
@RequiredArgsConstructor
@Service
public class ApsPlanDetailServiceImpl implements IApsPlanDetailService {
private final ApsPlanDetailMapper baseMapper;
/**
* 查询排产单明细
*/
@Override
public ApsPlanDetailVo queryById(Long planDetailId){
return baseMapper.selectVoById(planDetailId);
}
/**
* 查询排产单明细列表
*/
@Override
public TableDataInfo<ApsPlanDetailVo> queryPageList(ApsPlanDetailBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<ApsPlanDetail> lqw = buildQueryWrapper(bo);
Page<ApsPlanDetailVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
* 查询排产单明细列表
*/
@Override
public List<ApsPlanDetailVo> queryList(ApsPlanDetailBo bo) {
LambdaQueryWrapper<ApsPlanDetail> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private LambdaQueryWrapper<ApsPlanDetail> buildQueryWrapper(ApsPlanDetailBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<ApsPlanDetail> lqw = Wrappers.lambdaQuery();
lqw.eq(bo.getPlanSheetId() != null, ApsPlanDetail::getPlanSheetId, bo.getPlanSheetId());
lqw.eq(StringUtils.isNotBlank(bo.getBizSeqNo()), ApsPlanDetail::getBizSeqNo, bo.getBizSeqNo());
lqw.eq(bo.getOrderId() != null, ApsPlanDetail::getOrderId, bo.getOrderId());
lqw.eq(StringUtils.isNotBlank(bo.getOrderCode()), ApsPlanDetail::getOrderCode, bo.getOrderCode());
lqw.eq(StringUtils.isNotBlank(bo.getContractCode()), ApsPlanDetail::getContractCode, bo.getContractCode());
lqw.like(StringUtils.isNotBlank(bo.getCustomerName()), ApsPlanDetail::getCustomerName, bo.getCustomerName());
lqw.eq(StringUtils.isNotBlank(bo.getSalesman()), ApsPlanDetail::getSalesman, bo.getSalesman());
lqw.eq(StringUtils.isNotBlank(bo.getRawManufacturer()), ApsPlanDetail::getRawManufacturer, bo.getRawManufacturer());
lqw.eq(StringUtils.isNotBlank(bo.getRawMaterial()), ApsPlanDetail::getRawMaterial, bo.getRawMaterial());
lqw.eq(bo.getRawThick() != null, ApsPlanDetail::getRawThick, bo.getRawThick());
lqw.eq(bo.getRawWidth() != null, ApsPlanDetail::getRawWidth, bo.getRawWidth());
lqw.eq(bo.getRawMaterialId() != null, ApsPlanDetail::getRawMaterialId, bo.getRawMaterialId());
lqw.eq(StringUtils.isNotBlank(bo.getRawCoilNos()), ApsPlanDetail::getRawCoilNos, bo.getRawCoilNos());
lqw.eq(StringUtils.isNotBlank(bo.getRawLocation()), ApsPlanDetail::getRawLocation, bo.getRawLocation());
lqw.eq(StringUtils.isNotBlank(bo.getRawPackaging()), ApsPlanDetail::getRawPackaging, bo.getRawPackaging());
lqw.eq(StringUtils.isNotBlank(bo.getRawEdgeReq()), ApsPlanDetail::getRawEdgeReq, bo.getRawEdgeReq());
lqw.eq(StringUtils.isNotBlank(bo.getRawCoatingType()), ApsPlanDetail::getRawCoatingType, bo.getRawCoatingType());
lqw.eq(bo.getRawNetWeight() != null, ApsPlanDetail::getRawNetWeight, bo.getRawNetWeight());
lqw.like(StringUtils.isNotBlank(bo.getProductName()), ApsPlanDetail::getProductName, bo.getProductName());
lqw.eq(StringUtils.isNotBlank(bo.getProductMaterial()), ApsPlanDetail::getProductMaterial, bo.getProductMaterial());
lqw.eq(bo.getCoatingG() != null, ApsPlanDetail::getCoatingG, bo.getCoatingG());
lqw.eq(bo.getProductWidth() != null, ApsPlanDetail::getProductWidth, bo.getProductWidth());
lqw.eq(bo.getRollingThick() != null, ApsPlanDetail::getRollingThick, bo.getRollingThick());
lqw.eq(bo.getMarkCoatThick() != null, ApsPlanDetail::getMarkCoatThick, bo.getMarkCoatThick());
lqw.eq(StringUtils.isNotBlank(bo.getTonSteelLengthRange()), ApsPlanDetail::getTonSteelLengthRange, bo.getTonSteelLengthRange());
lqw.eq(bo.getPlanQty() != null, ApsPlanDetail::getPlanQty, bo.getPlanQty());
lqw.eq(bo.getPlanWeight() != null, ApsPlanDetail::getPlanWeight, bo.getPlanWeight());
lqw.eq(StringUtils.isNotBlank(bo.getSurfaceTreatment()), ApsPlanDetail::getSurfaceTreatment, bo.getSurfaceTreatment());
lqw.eq(StringUtils.isNotBlank(bo.getWidthReq()), ApsPlanDetail::getWidthReq, bo.getWidthReq());
lqw.eq(StringUtils.isNotBlank(bo.getProductPackaging()), ApsPlanDetail::getProductPackaging, bo.getProductPackaging());
lqw.eq(StringUtils.isNotBlank(bo.getProductEdgeReq()), ApsPlanDetail::getProductEdgeReq, bo.getProductEdgeReq());
lqw.eq(StringUtils.isNotBlank(bo.getUsageReq()), ApsPlanDetail::getUsageReq, bo.getUsageReq());
lqw.eq(StringUtils.isNotBlank(bo.getPostProcess()), ApsPlanDetail::getPostProcess, bo.getPostProcess());
lqw.eq(StringUtils.isNotBlank(bo.getNextProcess()), ApsPlanDetail::getNextProcess, bo.getNextProcess());
lqw.eq(StringUtils.isNotBlank(bo.getSampleReq()), ApsPlanDetail::getSampleReq, bo.getSampleReq());
lqw.eq(bo.getStartTime() != null, ApsPlanDetail::getStartTime, bo.getStartTime());
lqw.eq(bo.getEndTime() != null, ApsPlanDetail::getEndTime, bo.getEndTime());
return lqw;
}
/**
* 新增排产单明细
*/
@Override
public Boolean insertByBo(ApsPlanDetailBo bo) {
ApsPlanDetail add = BeanUtil.toBean(bo, ApsPlanDetail.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setPlanDetailId(add.getPlanDetailId());
}
return flag;
}
/**
* 修改排产单明细
*/
@Override
public Boolean updateByBo(ApsPlanDetailBo bo) {
ApsPlanDetail update = BeanUtil.toBean(bo, ApsPlanDetail.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(ApsPlanDetail entity){
//TODO 做一些数据校验,如唯一约束
}
/**
* 批量删除排产单明细
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteBatchIds(ids) > 0;
}
@Override
public int deleteByPlanSheetIds(Collection<Long> planSheetIds) {
return baseMapper.deleteByPlanSheetIds(planSheetIds);
}
}

View File

@@ -1,240 +0,0 @@
package com.klp.aps.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.klp.aps.domain.dto.ApsPlanSheetQueryReq;
import com.klp.aps.domain.dto.ApsQuickSheetQueryReq;
import com.klp.aps.domain.vo.ApsPlanSheetRowVo;
import com.klp.aps.domain.vo.ApsQuickSheetRowVo;
import com.klp.common.core.page.TableDataInfo;
import com.klp.common.core.domain.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.klp.common.exception.ServiceException;
import com.klp.common.utils.StringUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.klp.aps.domain.bo.ApsPlanSheetBo;
import com.klp.aps.domain.vo.ApsPlanSheetVo;
import com.klp.aps.domain.entity.ApsPlanSheet;
import com.klp.aps.mapper.ApsPlanSheetMapper;
import com.klp.aps.service.IApsPlanSheetService;
import com.klp.aps.service.IApsPlanDetailService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* 排产单主Service业务层处理
*
* @author klp
* @date 2026-03-26
*/
@RequiredArgsConstructor
@Service
public class ApsPlanSheetServiceImpl implements IApsPlanSheetService {
private final ApsPlanSheetMapper baseMapper;
private final IApsPlanDetailService planDetailService;
/**
* 查询排产单主
*/
@Override
public ApsPlanSheetVo queryById(Long planSheetId){
return baseMapper.selectVoById(planSheetId);
}
/**
* 查询排产单主列表
*/
@Override
public TableDataInfo<ApsPlanSheetVo> queryPageList(ApsPlanSheetBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<ApsPlanSheet> lqw = buildQueryWrapper(bo);
Page<ApsPlanSheetVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
* 查询排产单主列表
*/
@Override
public List<ApsPlanSheetVo> queryList(ApsPlanSheetBo bo) {
LambdaQueryWrapper<ApsPlanSheet> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private LambdaQueryWrapper<ApsPlanSheet> buildQueryWrapper(ApsPlanSheetBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<ApsPlanSheet> lqw = Wrappers.lambdaQuery();
lqw.eq(bo.getPlanDate() != null, ApsPlanSheet::getPlanDate, bo.getPlanDate());
lqw.eq(bo.getLineId() != null, ApsPlanSheet::getLineId, bo.getLineId());
lqw.like(StringUtils.isNotBlank(bo.getLineName()), ApsPlanSheet::getLineName, bo.getLineName());
lqw.eq(StringUtils.isNotBlank(bo.getPlanCode()), ApsPlanSheet::getPlanCode, bo.getPlanCode());
lqw.eq(StringUtils.isNotBlank(bo.getPlanType()), ApsPlanSheet::getPlanType, bo.getPlanType());
lqw.eq(StringUtils.isNotBlank(bo.getScheduler()), ApsPlanSheet::getScheduler, bo.getScheduler());
return lqw;
}
/**
* 新增排产单主
*/
@Override
public Boolean insertByBo(ApsPlanSheetBo bo) {
ApsPlanSheet add = BeanUtil.toBean(bo, ApsPlanSheet.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setPlanSheetId(add.getPlanSheetId());
}
return flag;
}
/**
* 修改排产单主
*/
@Override
public Boolean updateByBo(ApsPlanSheetBo bo) {
ApsPlanSheet update = BeanUtil.toBean(bo, ApsPlanSheet.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(ApsPlanSheet entity){
//TODO 做一些数据校验,如唯一约束
}
/**
* 批量删除排产单主
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
}
planDetailService.deleteByPlanSheetIds(ids);
return baseMapper.deleteBatchIds(ids) > 0;
}
@Override
public void exportExcel(ApsPlanSheetQueryReq req, javax.servlet.http.HttpServletResponse response) {
List<ApsPlanSheetRowVo> rows = queryListAll(req);
try (org.apache.poi.ss.usermodel.Workbook wb = new org.apache.poi.xssf.usermodel.XSSFWorkbook()) {
org.apache.poi.ss.usermodel.Sheet sheet = wb.createSheet("快速排产表");
int r = 0;
org.apache.poi.ss.usermodel.Row title = sheet.createRow(r++);
title.setHeightInPoints(36f);
org.apache.poi.ss.usermodel.Cell t0 = title.createCell(0);
t0.setCellValue("快速排产表");
sheet.addMergedRegion(new org.apache.poi.ss.util.CellRangeAddress(0, 0, 0, 38));
org.apache.poi.ss.usermodel.CellStyle titleStyle = wb.createCellStyle();
titleStyle.setAlignment(org.apache.poi.ss.usermodel.HorizontalAlignment.CENTER);
titleStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
org.apache.poi.xssf.usermodel.XSSFFont titleFont = ((org.apache.poi.xssf.usermodel.XSSFWorkbook) wb).createFont();
titleFont.setBold(true);
titleFont.setFontHeightInPoints((short) 15);
titleStyle.setFont(titleFont);
t0.setCellStyle(titleStyle);
String[] headers = new String[]{
"产线", "排产日期", "排产单号", "排产类型", "排产人", "修改人", "计划备注",
"内容序号", "销售内容", "订单合同号", "客户", "业务员",
"成品名称", "材质", "镀层g", "成品宽度", "轧制厚度", "标丝厚度", "吨钢长度区间m",
"数量", "重量", "表面处理", "切边要求", "宽度要求", "用途", "后处理", "下工序", "取样",
"厂家", "原料信息", "原料厚度mm", "宽度mm", "原料钢卷", "原料卷号", "钢卷位置", "包装要求", "镀层种类", "原料净重",
"开始时间", "结束时间", "明细备注"
};
org.apache.poi.ss.usermodel.Row head = sheet.createRow(r++);
for (int i = 0; i < headers.length; i++) {
head.createCell(i).setCellValue(headers[i]);
}
if (rows != null) {
for (ApsPlanSheetRowVo row : rows) {
org.apache.poi.ss.usermodel.Row rr = sheet.createRow(r++);
int cc = 0;
rr.createCell(cc++).setCellValue(nvl(row.getLineName(), row.getLineId()));
rr.createCell(cc++).setCellValue(row.getPlanDate() == null ? "" : row.getPlanDate().toString());
rr.createCell(cc++).setCellValue(nvl(row.getPlanCode(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getPlanType(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getScheduler(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getUpdateBy(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getMasterRemark(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getBizSeqNo(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getOrderCode(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getContractCode(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getCustomerName(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getSalesman(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getProductName(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getProductMaterial(), ""));
rr.createCell(cc++).setCellValue(row.getCoatingG() == null ? "" : row.getCoatingG().toPlainString());
rr.createCell(cc++).setCellValue(row.getProductWidth() == null ? "" : row.getProductWidth().toPlainString());
rr.createCell(cc++).setCellValue(row.getRollingThick() == null ? "" : row.getRollingThick().toPlainString());
rr.createCell(cc++).setCellValue(row.getMarkCoatThick() == null ? "" : row.getMarkCoatThick().toPlainString());
rr.createCell(cc++).setCellValue(nvl(row.getTonSteelLengthRange(), ""));
rr.createCell(cc++).setCellValue(row.getPlanQty() == null ? "" : row.getPlanQty().toPlainString());
rr.createCell(cc++).setCellValue(row.getPlanWeight() == null ? "" : row.getPlanWeight().toPlainString());
rr.createCell(cc++).setCellValue(nvl(row.getSurfaceTreatment(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getWidthReq(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getRawEdgeReq(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getUsageReq(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getPostProcess(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getNextProcess(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getSampleReq(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getRawManufacturer(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getRawMaterial(), ""));
rr.createCell(cc++).setCellValue(row.getRawThick() == null ? "" : row.getRawThick().toPlainString());
rr.createCell(cc++).setCellValue(row.getRawWidth() == null ? "" : row.getRawWidth().toPlainString());
rr.createCell(cc++).setCellValue(nvl(row.getRawMaterialId(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getRawCoilNos(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getRawLocation(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getRawPackaging(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getRawCoatingType(), ""));
rr.createCell(cc++).setCellValue(row.getRawNetWeight() == null ? "" : row.getRawNetWeight().toPlainString());
rr.createCell(cc++).setCellValue(row.getStartTime() == null ? "" : row.getStartTime().toString());
rr.createCell(cc++).setCellValue(row.getEndTime() == null ? "" : row.getEndTime().toString());
rr.createCell(cc++).setCellValue(nvl(row.getDetailRemark(), ""));
}
}
for (int i = 0; i < headers.length; i++) {
sheet.autoSizeColumn(i, true);
int w = sheet.getColumnWidth(i);
sheet.setColumnWidth(i, Math.min(Math.max(w, 3000), 12000));
}
String filename = "aps_quick_sheet_" + System.currentTimeMillis() + ".xlsx";
String encoded = java.net.URLEncoder.encode(filename, java.nio.charset.StandardCharsets.UTF_8.name());
response.setCharacterEncoding(java.nio.charset.StandardCharsets.UTF_8.name());
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-Disposition", "attachment; filename*=UTF-8''" + encoded);
try (javax.servlet.ServletOutputStream os = response.getOutputStream()) {
wb.write(os);
os.flush();
}
} catch (java.io.IOException e) {
throw new ServiceException("导出失败:" + e.getMessage());
}
}
private List<ApsPlanSheetRowVo> queryListAll(ApsPlanSheetQueryReq req) {
return baseMapper.selectList(req);
}
private String nvl(Object v, Object fallback) {
if (v == null) return String.valueOf(fallback);
String s = String.valueOf(v);
return s == null ? String.valueOf(fallback) : s;
}
}

View File

@@ -1,290 +0,0 @@
package com.klp.aps.service.impl;
import com.klp.aps.domain.dto.ApsQuickSheetSaveReq;
import com.klp.aps.domain.vo.ApsQuickSheetRowVo;
import com.klp.aps.mapper.ApsQuickSheetMapper;
import com.klp.aps.service.ApsQuickSheetService;
import com.klp.common.exception.ServiceException;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
@RequiredArgsConstructor
@Service
public class ApsQuickSheetServiceImpl implements ApsQuickSheetService {
private final ApsQuickSheetMapper quickSheetMapper;
private static final DateTimeFormatter DATE_CODE = DateTimeFormatter.ofPattern("yyyyMMdd");
@Override
public List<ApsQuickSheetRowVo> queryList(com.klp.aps.domain.dto.ApsQuickSheetQueryReq req) {
return quickSheetMapper.selectList(req);
}
@Override
public void saveRows(ApsQuickSheetSaveReq req, String operator) {
if (req == null || req.getRows() == null) {
throw new ServiceException("保存数据不能为空");
}
for (ApsQuickSheetSaveReq.Row row : req.getRows()) {
if (row == null) continue;
Long id = row.getQuickSheetId();
Long lineId = row.getLineId();
String lineName = row.getLineName();
String planCode = row.getPlanCode();
String planType = row.getPlanType();
String scheduler = row.getScheduler();
String remark = row.getRemark();
String bizSeqNo = row.getBizSeqNo();
String orderCode = row.getOrderCode();
String contractCode = row.getContractCode();
String customerName = row.getCustomerName();
String salesman = row.getSalesman();
String productName = row.getProductName();
String productMaterial = row.getProductMaterial();
BigDecimal coatingG = parseQty(row.getCoatingG());
BigDecimal productWidth = parseQty(row.getProductWidth());
BigDecimal rollingThick = parseQty(row.getRollingThick());
BigDecimal markCoatThick = parseQty(row.getMarkCoatThick());
String tonSteelLengthRange = row.getTonSteelLengthRange();
BigDecimal planQty = parseQty(row.getPlanQty());
BigDecimal planWeight = parseQty(row.getPlanWeight());
String surfaceTreatment = row.getSurfaceTreatment();
String widthReq = row.getWidthReq();
String usageReq = row.getUsageReq();
String postProcess = row.getPostProcess();
String nextProcess = row.getNextProcess();
String sampleReq = row.getSampleReq();
String rawManufacturer = row.getRawManufacturer();
String rawMaterial = row.getRawMaterial();
BigDecimal rawThick = parseQty(row.getRawThick());
BigDecimal rawWidth = parseQty(row.getRawWidth());
String rawMaterialId = row.getRawMaterialId();
String rawCoilNos = row.getRawCoilNos();
String rawLocation = row.getRawLocation();
String rawPackaging = row.getRawPackaging();
String rawEdgeReq = row.getRawEdgeReq();
String rawCoatingType = row.getRawCoatingType();
BigDecimal rawNetWeight = parseQty(row.getRawNetWeight());
LocalDateTime startTime = parseTime(row.getStartTime());
LocalDateTime endTime = parseTime(row.getEndTime());
boolean hasAny = lineId != null || isNotBlank(lineName) || isNotBlank(planCode) || isNotBlank(planType)
|| isNotBlank(scheduler) || isNotBlank(remark)
|| isNotBlank(bizSeqNo) || isNotBlank(orderCode) || isNotBlank(contractCode)
|| isNotBlank(customerName) || isNotBlank(salesman)
|| isNotBlank(productName) || isNotBlank(productMaterial)
|| coatingG != null || productWidth != null || rollingThick != null || markCoatThick != null
|| isNotBlank(tonSteelLengthRange) || planQty != null || planWeight != null
|| isNotBlank(surfaceTreatment) || isNotBlank(widthReq) || isNotBlank(usageReq)
|| isNotBlank(postProcess) || isNotBlank(nextProcess) || isNotBlank(sampleReq)
|| isNotBlank(rawManufacturer) || isNotBlank(rawMaterial)
|| rawThick != null || rawWidth != null
|| isNotBlank(rawMaterialId) || isNotBlank(rawCoilNos) || isNotBlank(rawLocation)
|| isNotBlank(rawPackaging) || isNotBlank(rawEdgeReq) || isNotBlank(rawCoatingType)
|| rawNetWeight != null || startTime != null || endTime != null;
if (!hasAny) {
continue;
}
if (id == null) {
if (!isNotBlank(planCode)) {
planCode = buildPlanCode();
}
quickSheetMapper.insertRow(lineId, lineName, LocalDate.now(), planCode, planType, scheduler, remark,
bizSeqNo, orderCode, contractCode, customerName, salesman,
productName, productMaterial, coatingG, productWidth, rollingThick, markCoatThick,
tonSteelLengthRange, planQty, planWeight, surfaceTreatment, widthReq, usageReq,
postProcess, nextProcess, sampleReq,
rawManufacturer, rawMaterial, rawThick, rawWidth, rawMaterialId, rawCoilNos,
rawLocation, rawPackaging, rawEdgeReq, rawCoatingType, rawNetWeight,
startTime, endTime, operator, operator);
} else {
quickSheetMapper.updateRow(id, lineId, lineName, planCode, planType, scheduler, remark,
bizSeqNo, orderCode, contractCode, customerName, salesman,
productName, productMaterial, coatingG, productWidth, rollingThick, markCoatThick,
tonSteelLengthRange, planQty, planWeight, surfaceTreatment, widthReq, usageReq,
postProcess, nextProcess, sampleReq,
rawManufacturer, rawMaterial, rawThick, rawWidth, rawMaterialId, rawCoilNos,
rawLocation, rawPackaging, rawEdgeReq, rawCoatingType, rawNetWeight,
startTime, endTime, operator);
}
}
}
@Override
public List<ApsQuickSheetRowVo> buildPresetRows(Long lineId, String salesman) {
List<ApsQuickSheetRowVo> rows = new ArrayList<>();
LocalDateTime now = LocalDateTime.now();
LocalDateTime end = now.plusHours(1);
for (int i = 0; i < 3; i++) {
ApsQuickSheetRowVo row = new ApsQuickSheetRowVo();
row.setLineId(lineId);
row.setLineName(lineId == null ? null : ("产线" + lineId));
row.setSalesman(salesman);
row.setPlanQty(BigDecimal.ZERO);
row.setStartTime(now);
row.setEndTime(end);
row.setPlanCode(buildPlanCode());
rows.add(row);
}
return rows;
}
@Override
public void exportExcel(com.klp.aps.domain.dto.ApsQuickSheetQueryReq req, javax.servlet.http.HttpServletResponse response) {
List<ApsQuickSheetRowVo> rows = queryList(req);
try (org.apache.poi.ss.usermodel.Workbook wb = new org.apache.poi.xssf.usermodel.XSSFWorkbook()) {
org.apache.poi.ss.usermodel.Sheet sheet = wb.createSheet("快速排产表");
int r = 0;
org.apache.poi.ss.usermodel.Row title = sheet.createRow(r++);
title.setHeightInPoints(36f);
org.apache.poi.ss.usermodel.Cell t0 = title.createCell(0);
t0.setCellValue("快速排产表Excel录入");
sheet.addMergedRegion(new org.apache.poi.ss.util.CellRangeAddress(0, 0, 0, 39));
org.apache.poi.ss.usermodel.CellStyle titleStyle = wb.createCellStyle();
titleStyle.setAlignment(org.apache.poi.ss.usermodel.HorizontalAlignment.CENTER);
titleStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
org.apache.poi.xssf.usermodel.XSSFFont titleFont = ((org.apache.poi.xssf.usermodel.XSSFWorkbook) wb).createFont();
titleFont.setBold(true);
titleFont.setFontHeightInPoints((short) 15);
titleStyle.setFont(titleFont);
t0.setCellStyle(titleStyle);
String[] headers = new String[]{
"产线", "排产日期", "排产单号", "排产类型", "排产人", "修改人", "备注",
"内容序号", "销售内容", "订单合同号", "客户", "业务员",
"成品名称", "材质", "镀层g", "成品宽度", "轧制厚度", "标丝厚度", "吨钢长度区间m",
"数量", "重量", "表面处理", "切边要求", "宽度要求", "用途", "后处理", "下工序", "取样",
"厂家", "原料信息", "原料厚度mm", "宽度mm", "原料钢卷", "原料卷号", "钢卷位置", "包装要求", "镀层种类", "原料净重",
"开始时间", "结束时间"
};
org.apache.poi.ss.usermodel.Row head = sheet.createRow(r++);
for (int i = 0; i < headers.length; i++) {
head.createCell(i).setCellValue(headers[i]);
}
if (rows != null) {
for (ApsQuickSheetRowVo row : rows) {
org.apache.poi.ss.usermodel.Row rr = sheet.createRow(r++);
int cc = 0;
rr.createCell(cc++).setCellValue(nvl(row.getLineName(), row.getLineId()));
rr.createCell(cc++).setCellValue(row.getPlanDate() == null ? "" : row.getPlanDate().toString());
rr.createCell(cc++).setCellValue(nvl(row.getPlanCode(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getPlanType(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getScheduler(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getRemark(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getBizSeqNo(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getOrderCode(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getContractCode(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getCustomerName(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getSalesman(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getProductName(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getProductMaterial(), ""));
rr.createCell(cc++).setCellValue(row.getCoatingG() == null ? "" : row.getCoatingG().toPlainString());
rr.createCell(cc++).setCellValue(row.getProductWidth() == null ? "" : row.getProductWidth().toPlainString());
rr.createCell(cc++).setCellValue(row.getRollingThick() == null ? "" : row.getRollingThick().toPlainString());
rr.createCell(cc++).setCellValue(row.getMarkCoatThick() == null ? "" : row.getMarkCoatThick().toPlainString());
rr.createCell(cc++).setCellValue(nvl(row.getTonSteelLengthRange(), ""));
rr.createCell(cc++).setCellValue(row.getPlanQty() == null ? "" : row.getPlanQty().toPlainString());
rr.createCell(cc++).setCellValue(row.getPlanWeight() == null ? "" : row.getPlanWeight().toPlainString());
rr.createCell(cc++).setCellValue(nvl(row.getSurfaceTreatment(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getWidthReq(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getRawEdgeReq(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getUsageReq(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getPostProcess(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getNextProcess(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getSampleReq(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getRawManufacturer(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getRawMaterial(), ""));
rr.createCell(cc++).setCellValue(row.getRawThick() == null ? "" : row.getRawThick().toPlainString());
rr.createCell(cc++).setCellValue(row.getRawWidth() == null ? "" : row.getRawWidth().toPlainString());
rr.createCell(cc++).setCellValue(nvl(row.getRawMaterialId(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getRawCoilNos(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getRawLocation(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getRawPackaging(), ""));
rr.createCell(cc++).setCellValue(nvl(row.getRawCoatingType(), ""));
rr.createCell(cc++).setCellValue(row.getRawNetWeight() == null ? "" : row.getRawNetWeight().toPlainString());
rr.createCell(cc++).setCellValue(row.getStartTime() == null ? "" : row.getStartTime().toString());
rr.createCell(cc++).setCellValue(row.getEndTime() == null ? "" : row.getEndTime().toString());
}
}
for (int i = 0; i < headers.length; i++) {
sheet.autoSizeColumn(i, true);
int w = sheet.getColumnWidth(i);
sheet.setColumnWidth(i, Math.min(Math.max(w, 3000), 12000));
}
String filename = "aps_quick_sheet_" + System.currentTimeMillis() + ".xlsx";
String encoded = java.net.URLEncoder.encode(filename, java.nio.charset.StandardCharsets.UTF_8.name());
response.setCharacterEncoding(java.nio.charset.StandardCharsets.UTF_8.name());
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-Disposition", "attachment; filename*=UTF-8''" + encoded);
try (javax.servlet.ServletOutputStream os = response.getOutputStream()) {
wb.write(os);
os.flush();
}
} catch (java.io.IOException e) {
throw new ServiceException("导出失败:" + e.getMessage());
}
}
private String buildPlanCode() {
LocalDate today = LocalDate.now();
int seq = quickSheetMapper.countToday(today) + 1;
return today.format(DATE_CODE) + String.format("%03d", seq);
}
private String nvl(Object v, Object fallback) {
if (v == null) return String.valueOf(fallback);
String s = String.valueOf(v);
return s == null ? String.valueOf(fallback) : s;
}
@Override
public void deleteById(Long id, String operator) {
if (id == null) return;
quickSheetMapper.deleteRow(id, operator);
}
private BigDecimal parseQty(String val) {
if (val == null || val.trim().isEmpty()) return null;
try {
return new BigDecimal(val.trim());
} catch (Exception e) {
return null;
}
}
private boolean isNotBlank(String val) {
return val != null && !val.trim().isEmpty();
}
private LocalDateTime parseTime(String val) {
if (val == null || val.trim().isEmpty()) return null;
String v = val.trim();
if (v.length() == 16) v = v + ":00";
try {
return LocalDateTime.parse(v, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
} catch (Exception e) {
return null;
}
}
}

View File

@@ -1,61 +0,0 @@
<?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.aps.mapper.ApsPlanDetailMapper">
<resultMap type="com.klp.aps.domain.entity.ApsPlanDetail" id="ApsPlanDetailResult">
<result property="planDetailId" column="plan_detail_id"/>
<result property="planSheetId" column="plan_sheet_id"/>
<result property="bizSeqNo" column="biz_seq_no"/>
<result property="orderId" column="order_id"/>
<result property="orderCode" column="order_code"/>
<result property="contractCode" column="contract_code"/>
<result property="customerName" column="customer_name"/>
<result property="salesman" column="salesman"/>
<result property="rawManufacturer" column="raw_manufacturer"/>
<result property="rawMaterial" column="raw_material"/>
<result property="rawThick" column="raw_thick"/>
<result property="rawWidth" column="raw_width"/>
<result property="rawMaterialId" column="raw_material_id"/>
<result property="rawCoilNos" column="raw_coil_nos"/>
<result property="rawLocation" column="raw_location"/>
<result property="rawPackaging" column="raw_packaging"/>
<result property="rawEdgeReq" column="raw_edge_req"/>
<result property="rawCoatingType" column="raw_coating_type"/>
<result property="rawNetWeight" column="raw_net_weight"/>
<result property="productName" column="product_name"/>
<result property="productMaterial" column="product_material"/>
<result property="coatingG" column="coating_g"/>
<result property="productWidth" column="product_width"/>
<result property="rollingThick" column="rolling_thick"/>
<result property="markCoatThick" column="mark_coat_thick"/>
<result property="tonSteelLengthRange" column="ton_steel_length_range"/>
<result property="planQty" column="plan_qty"/>
<result property="planWeight" column="plan_weight"/>
<result property="surfaceTreatment" column="surface_treatment"/>
<result property="widthReq" column="width_req"/>
<result property="productPackaging" column="product_packaging"/>
<result property="productEdgeReq" column="product_edge_req"/>
<result property="usageReq" column="usage_req"/>
<result property="postProcess" column="post_process"/>
<result property="nextProcess" column="next_process"/>
<result property="sampleReq" column="sample_req"/>
<result property="startTime" column="start_time"/>
<result property="endTime" column="end_time"/>
<result property="remark" column="remark"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/>
<result property="updateBy" column="update_by"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<delete id="deleteByPlanSheetIds">
UPDATE aps_plan_detail SET del_flag = 2 WHERE plan_sheet_id IN
<foreach collection="collection" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -1,89 +0,0 @@
<?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.aps.mapper.ApsPlanSheetMapper">
<resultMap type="com.klp.aps.domain.entity.ApsPlanSheet" id="ApsPlanSheetResult">
<result property="planSheetId" column="plan_sheet_id"/>
<result property="planDate" column="plan_date"/>
<result property="lineId" column="line_id"/>
<result property="lineName" column="line_name"/>
<result property="planCode" column="plan_code"/>
<result property="planType" column="plan_type"/>
<result property="scheduler" column="scheduler"/>
<result property="remark" column="remark"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/>
<result property="updateBy" column="update_by"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<select id="selectList" parameterType="com.klp.aps.domain.dto.ApsPlanSheetQueryReq" resultType="com.klp.aps.domain.vo.ApsPlanSheetRowVo">
SELECT
d.plan_detail_id AS detailSheetId,
s.plan_date AS planDate,
s.line_id AS lineId,
s.line_name AS lineName,
s.plan_code AS planCode,
s.plan_type AS planType,
s.scheduler AS scheduler,
s.remark AS masterRemark,
d.remark AS detailRemark,
s.update_by AS updateBy,
d.biz_seq_no AS bizSeqNo,
d.order_code AS orderCode,
d.contract_code AS contractCode,
d.customer_name AS customerName,
d.salesman AS salesman,
d.product_name AS productName,
d.product_material AS productMaterial,
d.coating_g AS coatingG,
d.product_width AS productWidth,
d.rolling_thick AS rollingThick,
d.mark_coat_thick AS markCoatThick,
d.ton_steel_length_range AS tonSteelLengthRange,
d.plan_qty AS planQty,
d.plan_weight AS planWeight,
d.surface_treatment AS surfaceTreatment,
d.width_req AS widthReq,
d.usage_req AS usageReq,
d.post_process AS postProcess,
d.next_process AS nextProcess,
d.sample_req AS sampleReq,
d.raw_manufacturer AS rawManufacturer,
d.raw_material AS rawMaterial,
d.raw_thick AS rawThick,
d.raw_width AS rawWidth,
CAST(d.raw_material_id AS CHAR) AS rawMaterialId,
d.raw_coil_nos AS rawCoilNos,
d.raw_location AS rawLocation,
d.raw_packaging AS rawPackaging,
d.raw_edge_req AS rawEdgeReq,
d.raw_coating_type AS rawCoatingType,
d.raw_net_weight AS rawNetWeight,
d.start_time AS startTime,
d.end_time AS endTime
FROM aps_plan_sheet s
INNER JOIN aps_plan_detail d ON d.plan_sheet_id = s.plan_sheet_id AND d.del_flag = 0
WHERE s.del_flag = 0
<if test="startDate != null">
AND d.start_time <![CDATA[>=]]> CONCAT(#{startDate}, ' 00:00:00')
</if>
<if test="endDate != null">
AND d.start_time <![CDATA[<=]]> CONCAT(#{endDate}, ' 23:59:59')
</if>
<if test="lineId != null">
AND s.line_id = #{lineId}
</if>
<if test="planSheetId != null">
AND s.plan_sheet_id = #{planSheetId}
</if>
<if test="customerName != null and customerName != ''">
AND d.customer_name LIKE CONCAT('%', #{customerName}, '%')
</if>
ORDER BY d.plan_detail_id DESC
</select>
</mapper>

View File

@@ -1,176 +0,0 @@
<?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.aps.mapper.ApsQuickSheetMapper">
<select id="selectList" parameterType="com.klp.aps.domain.dto.ApsQuickSheetQueryReq" resultType="com.klp.aps.domain.vo.ApsQuickSheetRowVo">
SELECT
quick_sheet_id AS quickSheetId,
plan_date AS planDate,
line_id AS lineId,
line_name AS lineName,
plan_code AS planCode,
plan_type AS planType,
scheduler,
remark,
biz_seq_no AS bizSeqNo,
order_code AS orderCode,
contract_code AS contractCode,
customer_name AS customerName,
salesman,
product_name AS productName,
product_material AS productMaterial,
coating_g AS coatingG,
product_width AS productWidth,
rolling_thick AS rollingThick,
mark_coat_thick AS markCoatThick,
ton_steel_length_range AS tonSteelLengthRange,
plan_qty AS planQty,
plan_weight AS planWeight,
surface_treatment AS surfaceTreatment,
width_req AS widthReq,
usage_req AS usageReq,
post_process AS postProcess,
next_process AS nextProcess,
sample_req AS sampleReq,
raw_manufacturer AS rawManufacturer,
raw_material AS rawMaterial,
raw_thick AS rawThick,
raw_width AS rawWidth,
raw_material_id AS rawMaterialId,
raw_coil_nos AS rawCoilNos,
raw_location AS rawLocation,
raw_packaging AS rawPackaging,
raw_edge_req AS rawEdgeReq,
raw_coating_type AS rawCoatingType,
raw_net_weight AS rawNetWeight,
start_time AS startTime,
end_time AS endTime
FROM aps_quick_sheet
WHERE del_flag = 0
<if test="startDate != null">
AND start_time <![CDATA[>=]]> CONCAT(#{startDate}, ' 00:00:00')
</if>
<if test="endDate != null">
AND start_time <![CDATA[<=]]> CONCAT(#{endDate}, ' 23:59:59')
</if>
<if test="lineId != null">
AND line_id = #{lineId}
</if>
<if test="customerName != null and customerName != ''">
AND customer_name LIKE CONCAT('%', #{customerName}, '%')
</if>
ORDER BY quick_sheet_id DESC
</select>
<select id="countToday" resultType="int">
SELECT COUNT(1)
FROM aps_quick_sheet
WHERE del_flag = 0
AND plan_date = #{planDate}
</select>
<select id="selectIdByPlanCode" resultType="long">
SELECT quick_sheet_id
FROM aps_quick_sheet
WHERE plan_code = #{planCode}
AND del_flag = 0
LIMIT 1
</select>
<insert id="insertRow">
INSERT INTO aps_quick_sheet (
line_id, line_name, plan_date, plan_code, plan_type, scheduler, remark,
biz_seq_no, order_code, contract_code, customer_name, salesman,
product_name, product_material, coating_g, product_width, rolling_thick, mark_coat_thick,
ton_steel_length_range, plan_qty, plan_weight, surface_treatment, width_req, usage_req,
post_process, next_process, sample_req,
raw_manufacturer, raw_material, raw_thick, raw_width, raw_material_id, raw_coil_nos,
raw_location, raw_packaging, raw_edge_req, raw_coating_type, raw_net_weight,
start_time, end_time,
create_by, update_by, create_time, update_time, del_flag
) VALUES (
#{lineId}, #{lineName}, #{planDate}, #{planCode}, #{planType}, #{scheduler}, #{remark},
#{bizSeqNo}, #{orderCode}, #{contractCode}, #{customerName}, #{salesman},
#{productName}, #{productMaterial}, #{coatingG}, #{productWidth}, #{rollingThick}, #{markCoatThick},
#{tonSteelLengthRange}, #{planQty}, #{planWeight}, #{surfaceTreatment}, #{widthReq}, #{usageReq},
#{postProcess}, #{nextProcess}, #{sampleReq},
#{rawManufacturer}, #{rawMaterial}, #{rawThick}, #{rawWidth}, #{rawMaterialId}, #{rawCoilNos},
#{rawLocation}, #{rawPackaging}, #{rawEdgeReq}, #{rawCoatingType}, #{rawNetWeight},
#{startTime}, #{endTime},
#{createBy}, #{updateBy}, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 0
)
</insert>
<update id="updateRow">
UPDATE aps_quick_sheet
SET line_id = #{lineId},
line_name = #{lineName},
plan_code = #{planCode},
plan_type = #{planType},
scheduler = #{scheduler},
remark = #{remark},
biz_seq_no = #{bizSeqNo},
order_code = #{orderCode},
contract_code = #{contractCode},
customer_name = #{customerName},
salesman = #{salesman},
product_name = #{productName},
product_material = #{productMaterial},
coating_g = #{coatingG},
product_width = #{productWidth},
rolling_thick = #{rollingThick},
mark_coat_thick = #{markCoatThick},
ton_steel_length_range = #{tonSteelLengthRange},
plan_qty = #{planQty},
plan_weight = #{planWeight},
surface_treatment = #{surfaceTreatment},
width_req = #{widthReq},
usage_req = #{usageReq},
post_process = #{postProcess},
next_process = #{nextProcess},
sample_req = #{sampleReq},
raw_manufacturer = #{rawManufacturer},
raw_material = #{rawMaterial},
raw_thick = #{rawThick},
raw_width = #{rawWidth},
raw_material_id = #{rawMaterialId},
raw_coil_nos = #{rawCoilNos},
raw_location = #{rawLocation},
raw_packaging = #{rawPackaging},
raw_edge_req = #{rawEdgeReq},
raw_coating_type = #{rawCoatingType},
raw_net_weight = #{rawNetWeight},
start_time = #{startTime},
end_time = #{endTime},
update_by = #{updateBy},
update_time = CURRENT_TIMESTAMP
WHERE quick_sheet_id = #{id}
</update>
<update id="deleteRow">
UPDATE aps_quick_sheet
SET del_flag = 1,
update_by = #{updateBy},
update_time = CURRENT_TIMESTAMP
WHERE quick_sheet_id = #{id}
</update>
<update id="softDelete">
UPDATE aps_quick_sheet
SET del_flag = 1,
update_by = #{updateBy},
update_time = CURRENT_TIMESTAMP
WHERE quick_sheet_id = #{id}
</update>
<update id="deleteById">
UPDATE aps_quick_sheet
SET del_flag = 1,
update_by = #{updateBy},
update_time = CURRENT_TIMESTAMP
WHERE quick_sheet_id = #{id}
</update>
</mapper>

View File

@@ -170,6 +170,16 @@
<artifactId>ip2region</artifactId>
</dependency>
<!-- 引入flyway -->
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-mysql</artifactId>
</dependency>
<!-- 动态数据源依赖 -->
<dependency>
<groupId>com.baomidou</groupId>

View File

@@ -0,0 +1,68 @@
package com.klp.common.config;
import javax.annotation.Resource;
import javax.sql.DataSource;
import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
import org.flywaydb.core.Flyway;
import org.flywaydb.core.api.output.MigrateResult;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class FlywayConfig {
@Value("${spring.profiles.active}")
private String activeProfile;
@Value("${spring.flyway.baseline-on-migrate}")
private boolean baselineOnMigrate;
@Value("${spring.flyway.locations}")
private String locations;
@Value("${spring.flyway.table}")
private String table;
@Resource
private DataSource dataSource;
@Bean
public Flyway flyway() {
DataSource masterDataSource = ((DynamicRoutingDataSource) dataSource).getDataSource("master");
System.out.println("masterDataSource class: " + masterDataSource.getClass().getName());
// // 如果想显式拿底层 HikariDataSource
// if (masterDataSource instanceof ItemDataSource) {
// masterDataSource = ((ItemDataSource) masterDataSource).getRealDataSource();
// }
System.out.println("masterDataSource class: " + masterDataSource.getClass().getName());
return Flyway.configure()
.dataSource(masterDataSource) // 注意这里是真实主库 DataSource
.baselineOnMigrate(baselineOnMigrate)
.locations(locations)
.table(table)
.load();
}
@Bean
public CommandLineRunner flywayRunner(Flyway flyway) {
return args -> {
System.out.println("========== 当前环境: " + activeProfile + " ==========");
System.out.println("========== 开始执行 Flyway 数据库迁移 ==========");
MigrateResult result = flyway.migrate();
System.out.println("迁移成功版本数: " + result.migrationsExecuted);
result.migrations.forEach(m -> {
System.out.println("执行版本: " + m.version + ",描述: " + m.description);
});
System.out.println("========== Flyway 数据库迁移完成 ==========");
};
}
}

View File

@@ -12,7 +12,6 @@ import com.klp.pocket.acid.domain.vo.AcidOeeIdealCycleVo;
import com.klp.pocket.acid.domain.vo.AcidOeeLoss7Vo;
import com.klp.pocket.acid.domain.vo.Klptcm1ProStoppageVo;
import com.klp.pocket.acid.service.IAcidOeeService;
import com.klp.pocket.galvanize1.service.IGalvanizeOeeService;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import org.apache.poi.xwpf.usermodel.ParagraphAlignment;
@@ -62,7 +61,6 @@ import java.util.stream.Collectors;
public class OeeReportController extends BaseController {
private final IAcidOeeService acidOeeService;
private final IGalvanizeOeeService galvanizeOeeService;
private final StringRedisTemplate stringRedisTemplate;
private final OeeReportJobService oeeReportJobService;
private final OeeWordAiAnalysisService oeeWordAiAnalysisService;
@@ -78,20 +76,26 @@ public class OeeReportController extends BaseController {
*
* 路由GET /oee/line/acid/summary
* 说明:
* - 支持 startDate/endDate 参数yyyy-MM-dd
* - 若不传则默认查询当前月份1号~今天);
* - 仅实时计算,不走缓存。
* - 不接受 start/end 参数固定返回“当前月份1号~今天)”的当月预计算结果
* - 优先从 Redis 当月缓存读取;若缓存缺失则实时计算一次当前月。
*/
@GetMapping("/acid/summary")
public R<List<AcidOeeDailySummaryVo>> getAcidSummary(
@RequestParam(required = false) String startDate,
@RequestParam(required = false) String endDate,
@RequestParam(required = false, defaultValue = "acid") String lineType
) {
String[] range = resolveDateRange(startDate, endDate);
List<AcidOeeDailySummaryVo> dailyList = isGalvanize(lineType)
? galvanizeOeeService.getDailySummary(range[0], range[1])
: acidOeeService.getDailySummary(range[0], range[1]);
public R<List<AcidOeeDailySummaryVo>> getAcidSummary() {
String yyyyMM = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMM"));
String summaryKey = String.format("oee:report:month:summary:%s:SY", yyyyMM);
// 1. 优先从 Redis 读取当月预计算结果
String json = stringRedisTemplate.opsForValue().get(summaryKey);
if (StringUtils.isNotBlank(json)) {
List<AcidOeeDailySummaryVo> cached =
JSON.parseArray(json, AcidOeeDailySummaryVo.class);
return R.ok(cached);
}
// 2. 缓存缺失时,回退为实时计算当前月
String[] range = resolveDateRange(null, null);
List<AcidOeeDailySummaryVo> dailyList =
acidOeeService.getDailySummary(range[0], range[1]);
return R.ok(dailyList);
}
@@ -105,15 +109,21 @@ public class OeeReportController extends BaseController {
*/
@GetMapping("/acid/loss7")
public R<List<AcidOeeLoss7Vo>> getAcidLoss7(
@RequestParam(required = false, defaultValue = "50") Integer topN,
@RequestParam(required = false) String startDate,
@RequestParam(required = false) String endDate,
@RequestParam(required = false, defaultValue = "acid") String lineType
@RequestParam(required = false, defaultValue = "50") Integer topN
) {
String[] range = resolveDateRange(startDate, endDate);
List<AcidOeeLoss7Vo> lossList = isGalvanize(lineType)
? galvanizeOeeService.getLoss7Summary(range[0], range[1])
: acidOeeService.getLoss7Summary(range[0], range[1]);
String yyyyMM = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMM"));
String loss7Key = String.format("oee:report:month:loss7:%s:SY", yyyyMM);
// 1. 优先从 Redis 读取当月 7 大损失预计算结果
String json = stringRedisTemplate.opsForValue().get(loss7Key);
List<AcidOeeLoss7Vo> lossList;
if (StringUtils.isNotBlank(json)) {
lossList = JSON.parseArray(json, AcidOeeLoss7Vo.class);
} else {
// 2. 缓存缺失时,回退为实时计算当前月
String[] range = resolveDateRange(null, null);
lossList = acidOeeService.getLoss7Summary(range[0], range[1]);
}
if (topN != null && topN > 0 && lossList.size() > topN) {
lossList = new ArrayList<>(lossList.subList(0, topN));
@@ -137,16 +147,14 @@ public class OeeReportController extends BaseController {
@RequestParam(required = false) String stopType,
@RequestParam(required = false) String keyword,
@RequestParam(required = false, defaultValue = "1") Integer pageNum,
@RequestParam(required = false, defaultValue = "10") Integer pageSize,
@RequestParam(required = false, defaultValue = "acid") String lineType
@RequestParam(required = false, defaultValue = "10") Integer pageSize
) {
// 事件明细底层按「日期」查询,这里从时间字符串中截取日期部分
String startDate = extractDateOrDefault(startTime, true);
String endDate = extractDateOrDefault(endTime, false);
List<Klptcm1ProStoppageVo> events = isGalvanize(lineType)
? galvanizeOeeService.getStoppageEvents(startDate, endDate)
: acidOeeService.getStoppageEvents(startDate, endDate);
List<Klptcm1ProStoppageVo> events =
acidOeeService.getStoppageEvents(startDate, endDate);
// 业务筛选stopType、关键字目前对 stopType / remark 做 contains 匹配)
List<Klptcm1ProStoppageVo> filtered = events.stream()
@@ -192,12 +200,9 @@ public class OeeReportController extends BaseController {
@GetMapping("/acid/idealCycle")
public R<AcidOeeIdealCycleVo> getAcidIdealCycle(
@RequestParam String startDate,
@RequestParam String endDate,
@RequestParam(required = false, defaultValue = "acid") String lineType
@RequestParam String endDate
) {
AcidOeeIdealCycleVo data = isGalvanize(lineType)
? galvanizeOeeService.getIdealCycle(startDate, endDate)
: acidOeeService.getIdealCycle(startDate, endDate);
AcidOeeIdealCycleVo data = acidOeeService.getIdealCycle(startDate, endDate);
return R.ok(data);
}
@@ -418,10 +423,6 @@ public class OeeReportController extends BaseController {
/**
* 若未显式传入日期范围,则默认当前月 [1号, 今天]。
*/
private boolean isGalvanize(String lineType) {
return "galvanize1".equalsIgnoreCase(lineType) || "galvanize".equalsIgnoreCase(lineType) || "dx".equalsIgnoreCase(lineType);
}
private String[] resolveDateRange(String startDate, String endDate) {
if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)) {
return new String[]{startDate, endDate};

View File

@@ -0,0 +1,137 @@
package com.klp.da.task;
import com.alibaba.fastjson2.JSON;
import com.klp.pocket.acid.domain.vo.AcidOeeDailySummaryVo;
import com.klp.pocket.acid.service.IAcidOeeService;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* 酸轧线 OEE 当月预计算任务
*
* 需求对应 docs/oee-report-design.md 第 12.2 节:
* - 项目启动完成后即计算当月 OEE 聚合结果并写入 Redis
* - 每天凌晨 04:00 重新计算当月数据并覆盖缓存。
*
* 当前仅实现酸轧线SY的当月日汇总预计算
* key 约定:
* - 汇总结果oee:report:month:summary:{yyyyMM}:SY
* - 元信息: oee:report:month:meta:{yyyyMM}:SY
*/
@Slf4j
@RequiredArgsConstructor
@Component
public class AcidOeeMonthTask {
/** Redis 缓存 key 模板:当月 OEE 汇总(酸轧线) */
private static final String SUMMARY_KEY_PATTERN = "oee:report:month:summary:%s:SY";
/** Redis 缓存 key 模板:当月元信息(酸轧线) */
private static final String META_KEY_PATTERN = "oee:report:month:meta:%s:SY";
private static final DateTimeFormatter YEAR_MONTH_FMT = DateTimeFormatter.ofPattern("yyyyMM");
private static final DateTimeFormatter DATE_FMT = DateTimeFormatter.ISO_DATE;
private static final DateTimeFormatter DATE_TIME_FMT = DateTimeFormatter.ISO_LOCAL_DATE_TIME;
private final IAcidOeeService acidOeeService;
private final StringRedisTemplate stringRedisTemplate;
/**
* 项目启动完成后立即计算一次当月酸轧 OEE 汇总并写入 Redis。
*/
@PostConstruct
public void init() {
try {
computeCurrentMonth("startup");
} catch (Exception e) {
log.error("[AcidOeeMonthTask] startup compute failed", e);
}
}
/**
* 每天凌晨 04:00 重新计算当月酸轧 OEE 汇总并覆盖 Redis 缓存。
*/
@Scheduled(cron = "0 0 4 * * ?")
public void scheduleDaily() {
try {
computeCurrentMonth("schedule-04");
} catch (Exception e) {
log.error("[AcidOeeMonthTask] 4am compute failed", e);
}
}
/**
* 计算当前月份从当月1号到今天的酸轧 OEE 日汇总,并写入 Redis。
*
* @param trigger 触发来源标记startup / schedule-04 等)
*/
private void computeCurrentMonth(String trigger) {
long startNs = System.nanoTime();
LocalDate now = LocalDate.now();
String yyyyMM = now.format(YEAR_MONTH_FMT);
LocalDate startDate = now.withDayOfMonth(1);
LocalDate endDate = now;
String startStr = startDate.format(DATE_FMT);
String endStr = endDate.format(DATE_FMT);
log.info("[AcidOeeMonthTask] trigger={}, computing acid OEE month summary for {} ({} ~ {})",
trigger, yyyyMM, startStr, endStr);
// 1. 调用 pocket 的 AcidOeeService 获取当月日汇总
List<AcidOeeDailySummaryVo> dailySummaryList = acidOeeService.getDailySummary(startStr, endStr);
// 2. 写入 Redissummary
String summaryKey = String.format(SUMMARY_KEY_PATTERN, yyyyMM);
String summaryJson = JSON.toJSONString(dailySummaryList);
stringRedisTemplate.opsForValue().set(summaryKey, summaryJson, 1, TimeUnit.DAYS);
long durationMs = (System.nanoTime() - startNs) / 1_000_000L;
// 3. 写入 Redismeta
Meta meta = new Meta();
meta.setComputedAt(LocalDateTime.now().format(DATE_TIME_FMT));
meta.setDurationMs(durationMs);
meta.setStartDate(startStr);
meta.setEndDate(endStr);
meta.setTrigger(trigger);
String metaKey = String.format(META_KEY_PATTERN, yyyyMM);
stringRedisTemplate.opsForValue().set(metaKey, JSON.toJSONString(meta), 1, TimeUnit.DAYS);
log.info("[AcidOeeMonthTask] compute finish for {} dailySize={}, durationMs={}ms, summaryKey={}",
yyyyMM, dailySummaryList.size(), durationMs, summaryKey);
}
/**
* 当月预计算元信息
*/
@Data
private static class Meta {
/** 计算完成时间ISO-8601 字符串) */
private String computedAt;
/** 计算耗时(毫秒) */
private long durationMs;
/** 统计起始日期yyyy-MM-dd */
private String startDate;
/** 统计结束日期yyyy-MM-dd */
private String endDate;
/** 触发来源startup / schedule-04 等) */
private String trigger;
}
}

View File

@@ -10,7 +10,7 @@ import lombok.RequiredArgsConstructor;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.*;
import org.springframework.util.StringUtils;
import org.flywaydb.core.internal.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import com.klp.common.annotation.RepeatSubmit;

View File

@@ -71,8 +71,8 @@ public class EqpAuxiliaryMaterialController extends BaseController {
@Log(title = "辅料", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Long> add(@Validated(AddGroup.class) @RequestBody EqpAuxiliaryMaterialBo bo) {
return R.ok(iEqpAuxiliaryMaterialService.insertByBo(bo));
public R<Void> add(@Validated(AddGroup.class) @RequestBody EqpAuxiliaryMaterialBo bo) {
return toAjax(iEqpAuxiliaryMaterialService.insertByBo(bo));
}
/**

View File

@@ -71,8 +71,8 @@ public class EqpSparePartController extends BaseController {
@Log(title = "备品备件", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Long> add(@Validated(AddGroup.class) @RequestBody EqpSparePartBo bo) {
return R.ok(iEqpSparePartService.insertByBo(bo));
public R<Void> add(@Validated(AddGroup.class) @RequestBody EqpSparePartBo bo) {
return toAjax(iEqpSparePartService.insertByBo(bo));
}
/**

View File

@@ -44,10 +44,6 @@ public class EqpAuxiliaryMaterial extends BaseEntity {
* 关联设备ID可为空通用辅料
*/
private Long equipmentId;
/**
* 机组1#机组、2#机组、公用机组等)
*/
private String unitTeam;
/**
* 当前库存数量
*/

View File

@@ -44,10 +44,6 @@ public class EqpSparePart extends BaseEntity {
* 关联设备ID可为空通用备件
*/
private Long equipmentId;
/**
* 机组1#机组、2#机组、公用机组等)
*/
private String unitTeam;
/**
* 当前库存数量
*/

View File

@@ -47,11 +47,6 @@ public class EqpAuxiliaryMaterialBo extends BaseEntity {
*/
private Long equipmentId;
/**
* 机组1#机组、2#机组、公用机组等)
*/
private String unitTeam;
/**
* 当前库存数量
*/

View File

@@ -47,11 +47,6 @@ public class EqpSparePartBo extends BaseEntity {
*/
private Long equipmentId;
/**
* 机组1#机组、2#机组、公用机组等)
*/
private String unitTeam;
/**
* 当前库存数量
*/

View File

@@ -56,12 +56,6 @@ public class EqpAuxiliaryMaterialVo {
@ExcelDictFormat(readConverterExp = "可=为空,通用辅料")
private Long equipmentId;
/**
* 机组1#机组、2#机组、公用机组等)
*/
@ExcelProperty(value = "机组")
private String unitTeam;
/**
* 当前库存数量
*/

View File

@@ -56,12 +56,6 @@ public class EqpSparePartVo {
@ExcelDictFormat(readConverterExp = "可=为空,通用备件")
private Long equipmentId;
/**
* 机组1#机组、2#机组、公用机组等)
*/
@ExcelProperty(value = "机组")
private String unitTeam;
/**
* 当前库存数量
*/

View File

@@ -35,7 +35,7 @@ public interface IEqpAuxiliaryMaterialService {
/**
* 新增辅料
*/
Long insertByBo(EqpAuxiliaryMaterialBo bo);
Boolean insertByBo(EqpAuxiliaryMaterialBo bo);
/**
* 修改辅料

View File

@@ -35,7 +35,7 @@ public interface IEqpSparePartService {
/**
* 新增备品备件
*/
Long insertByBo(EqpSparePartBo bo);
Boolean insertByBo(EqpSparePartBo bo);
/**
* 修改备品备件

View File

@@ -66,7 +66,6 @@ public class EqpAuxiliaryMaterialServiceImpl implements IEqpAuxiliaryMaterialSer
lqw.eq(StringUtils.isNotBlank(bo.getAuxiliaryModel()), EqpAuxiliaryMaterial::getAuxiliaryModel, bo.getAuxiliaryModel());
lqw.eq(StringUtils.isNotBlank(bo.getUnit()), EqpAuxiliaryMaterial::getUnit, bo.getUnit());
lqw.eq(bo.getEquipmentId() != null, EqpAuxiliaryMaterial::getEquipmentId, bo.getEquipmentId());
lqw.like(StringUtils.isNotBlank(bo.getUnitTeam()), EqpAuxiliaryMaterial::getUnitTeam, bo.getUnitTeam());
lqw.eq(bo.getQuantity() != null, EqpAuxiliaryMaterial::getQuantity, bo.getQuantity());
return lqw;
}
@@ -75,14 +74,14 @@ public class EqpAuxiliaryMaterialServiceImpl implements IEqpAuxiliaryMaterialSer
* 新增辅料
*/
@Override
public Long insertByBo(EqpAuxiliaryMaterialBo bo) {
public Boolean insertByBo(EqpAuxiliaryMaterialBo bo) {
EqpAuxiliaryMaterial add = BeanUtil.toBean(bo, EqpAuxiliaryMaterial.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setAuxiliaryId(add.getAuxiliaryId());
}
return add.getAuxiliaryId();
return flag;
}
/**

View File

@@ -58,7 +58,6 @@ public class EqpSparePartServiceImpl implements IEqpSparePartService {
qw.eq(StringUtils.isNotBlank(bo.getModel()), "sp.model", bo.getModel());
qw.eq(StringUtils.isNotBlank(bo.getUnit()), "sp.unit", bo.getUnit());
qw.eq(bo.getEquipmentId() != null, "sp.equipment_id", bo.getEquipmentId());
qw.like(StringUtils.isNotBlank(bo.getUnitTeam()), "sp.unit_team", bo.getUnitTeam());
qw.eq(bo.getQuantity() != null, "sp.quantity", bo.getQuantity());
//逻辑删除
qw.eq("sp.del_flag", 0);
@@ -82,7 +81,6 @@ public class EqpSparePartServiceImpl implements IEqpSparePartService {
lqw.eq(StringUtils.isNotBlank(bo.getModel()), EqpSparePart::getModel, bo.getModel());
lqw.eq(StringUtils.isNotBlank(bo.getUnit()), EqpSparePart::getUnit, bo.getUnit());
lqw.eq(bo.getEquipmentId() != null, EqpSparePart::getEquipmentId, bo.getEquipmentId());
lqw.like(StringUtils.isNotBlank(bo.getUnitTeam()), EqpSparePart::getUnitTeam, bo.getUnitTeam());
lqw.eq(bo.getQuantity() != null, EqpSparePart::getQuantity, bo.getQuantity());
return lqw;
}
@@ -91,14 +89,14 @@ public class EqpSparePartServiceImpl implements IEqpSparePartService {
* 新增备品备件
*/
@Override
public Long insertByBo(EqpSparePartBo bo) {
public Boolean insertByBo(EqpSparePartBo bo) {
EqpSparePart add = BeanUtil.toBean(bo, EqpSparePart.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setPartId(add.getPartId());
}
return add.getPartId();
return flag;
}
/**

View File

@@ -11,7 +11,6 @@
<result property="auxiliaryModel" column="auxiliary_model"/>
<result property="unit" column="unit"/>
<result property="equipmentId" column="equipment_id"/>
<result property="unitTeam" column="unit_team"/>
<result property="quantity" column="quantity"/>
<result property="createBy" column="create_by"/>
<result property="updateBy" column="update_by"/>

View File

@@ -11,7 +11,6 @@
<result property="model" column="model"/>
<result property="unit" column="unit"/>
<result property="equipmentId" column="equipment_id"/>
<result property="unitTeam" column="unit_team"/>
<result property="quantity" column="quantity"/>
<result property="createBy" column="create_by"/>
<result property="updateBy" column="update_by"/>
@@ -28,7 +27,6 @@
sp.model,
sp.unit,
sp.equipment_id,
sp.unit_team,
em.equipment_name AS equipmentName,
sp.quantity,
sp.remark

View File

@@ -1,24 +0,0 @@
package com.klp.pocket.acid.domain.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
* 酸轧OEE按日钢卷信息主库来源
*/
@Data
public class AcidOeeCoilInfoByDateVo {
/** 统计日期 yyyy-MM-dd */
private String statDate;
/** 当前钢卷号 */
private String coilNo;
/** 重量(吨) */
private BigDecimal weight;
/** 判级 */
private String qualityStatus;
}

View File

@@ -3,6 +3,7 @@ package com.klp.pocket.acid.domain.vo;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 酸轧线OEE日汇总视图对象
@@ -44,36 +45,18 @@ public class AcidOeeDailySummaryVo {
/** 总产量(卷) */
private Long totalOutputCoil;
/** 良品量(A系列吨) */
/** 良品量(吨) */
private BigDecimal goodOutputTon;
/** 良品量(A系列卷) */
/** 良品量(卷) */
private Long goodOutputCoil;
/** 合格品量B系列 */
private BigDecimal qualifiedOutputTon;
/** 合格品量B系列 */
private Long qualifiedOutputCoil;
/** 合格品合计A+B */
private BigDecimal abOutputTon;
/** 合格品合计A+B */
private Long abOutputCoil;
/** 次品量C/D系列 */
/** 不良量(吨)= total_output_ton - good_output_ton */
private BigDecimal defectOutputTon;
/** 次品量C/D系列 */
/** 不良量(卷)= total_output_coil - good_output_coil */
private Long defectOutputCoil;
/** 待判级量O系列 */
private BigDecimal pendingOutputTon;
/** 待判级量O系列 */
private Long pendingOutputCoil;
/** 理论节拍min/吨;回归斜率) */
private BigDecimal idealCycleTimeMinPerTon;
@@ -89,18 +72,9 @@ public class AcidOeeDailySummaryVo {
/** 派生指标:性能稼动率(卷维度) */
private BigDecimal performanceCoil;
/** 派生指标:良品率A/总量) */
/** 派生指标:良品率 */
private BigDecimal quality;
/** 派生指标合格品率A+B/总量) */
private BigDecimal qualifiedRate;
/** 派生指标次品率C/D系列/总量) */
private BigDecimal defectRate;
/** 派生指标待判级率O系列/总量) */
private BigDecimal pendingRate;
/** 派生指标OEE建议以吨维度为主 */
private BigDecimal oee;
}

View File

@@ -1,22 +0,0 @@
package com.klp.pocket.acid.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
/**
* 酸轧线OEE酸轧库Mapper。
*/
@Mapper
@DS("acid")
public interface AcidOeeAcidMapper {
/**
* 查询卷级生产节拍min/吨),用于理论节拍计算。
*/
List<BigDecimal> selectCoilCycleMinPerTon(@Param("startDate") String startDate,
@Param("endDate") String endDate);
}

View File

@@ -0,0 +1,65 @@
package com.klp.pocket.acid.mapper;
import com.klp.pocket.acid.domain.vo.AcidOeeDailySummaryVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 酸轧线OEE Mapper接口
*
* @author klp
* @date 2026-01-30
*/
@Mapper
public interface AcidOeeMapper {
/**
* 查询OEE日汇总按日期范围
* 聚合产量(吨/卷)、停机时间等
*
* @param startDate 开始日期yyyy-MM-dd
* @param endDate 结束日期yyyy-MM-dd
* @return 日汇总列表
*/
List<AcidOeeDailySummaryVo> selectDailySummary(@Param("startDate") String startDate,
@Param("endDate") String endDate);
/**
* 查询每日的钢卷号和重量(用于良品/次品判定)
*
* @param startDate 开始日期yyyy-MM-dd
* @param endDate 结束日期yyyy-MM-dd
* @return Map列表key为日期value为卷号和重量信息
*/
List<CoilInfoByDate> selectCoilInfoByDate(@Param("startDate") String startDate,
@Param("endDate") String endDate);
/**
* 查询卷级生产节拍min/吨),用于理论节拍计算。
*
* @param startDate 开始日期yyyy-MM-dd
* @param endDate 结束日期yyyy-MM-dd
* @return 每卷的生产节拍列表min/吨)
*/
List<java.math.BigDecimal> selectCoilCycleMinPerTon(@Param("startDate") String startDate,
@Param("endDate") String endDate);
/**
* 卷号信息内部类用于Mapper返回
*/
class CoilInfoByDate {
private String statDate;
private String coilNo;
private java.math.BigDecimal weight;
public String getStatDate() { return statDate; }
public void setStatDate(String statDate) { this.statDate = statDate; }
public String getCoilNo() { return coilNo; }
public void setCoilNo(String coilNo) { this.coilNo = coilNo; }
public java.math.BigDecimal getWeight() { return weight; }
public void setWeight(java.math.BigDecimal weight) { this.weight = weight; }
}
}

View File

@@ -1,32 +0,0 @@
package com.klp.pocket.acid.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.klp.pocket.acid.domain.vo.AcidOeeCoilInfoByDateVo;
import com.klp.pocket.acid.domain.vo.AcidOeeDailySummaryVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 酸轧线OEE主库Mapper。
*/
@Mapper
@DS("master")
public interface AcidOeeMasterMapper {
/**
* 查询OEE日汇总总产量来自主库 wms_material_coil
*/
List<AcidOeeDailySummaryVo> selectDailySummary(@Param("startDate") String startDate,
@Param("endDate") String endDate,
@Param("createBy") String createBy);
/**
* 查询每日钢卷重量与判级(来自主库 wms_material_coil
*/
List<AcidOeeCoilInfoByDateVo> selectCoilInfoByDate(@Param("startDate") String startDate,
@Param("endDate") String endDate,
@Param("createBy") String createBy);
}

View File

@@ -1,34 +1,25 @@
package com.klp.pocket.acid.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.klp.common.utils.StringUtils;
import com.klp.pocket.acid.domain.vo.AcidOeeCoilInfoByDateVo;
import com.klp.pocket.acid.domain.vo.AcidOeeDailySummaryVo;
import com.klp.pocket.acid.domain.vo.AcidOeeIdealCycleVo;
import com.klp.pocket.acid.domain.vo.AcidOeeLoss7Vo;
import com.klp.pocket.acid.domain.vo.Klptcm1ProStoppageVo;
import com.klp.pocket.acid.domain.bo.Klptcm1ProStoppageBo;
import com.klp.pocket.acid.mapper.AcidOeeMasterMapper;
import com.klp.pocket.acid.mapper.AcidOeeMapper;
import com.klp.pocket.acid.service.IAcidOeeService;
import com.klp.pocket.acid.service.IKlptcm1ProStoppageService;
import com.klp.pocket.common.service.ICoilQualityJudgeService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.*;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 酸轧线OEE Service实现类
@@ -38,65 +29,53 @@ import java.util.Set;
*/
@Slf4j
@RequiredArgsConstructor
@DS("acid")
@Service
public class AcidOeeServiceImpl implements IAcidOeeService {
/** 次品判级集合C/D系列 */
private static final Set<String> CD_SERIES = new HashSet<>(
Arrays.asList("C+", "C", "C-", "D+", "D", "D-")
);
private final AcidOeeMasterMapper acidOeeMasterMapper;
/** 酸轧成品库库区ID */
private static final Long ACID_FINISHED_WAREHOUSE_ID = 1988150099140866050L;
/** 固定理论节拍min/吨) */
private static final BigDecimal FIXED_IDEAL_CYCLE = BigDecimal.valueOf(0.47);
private final AcidOeeMapper acidOeeMapper;
private final IKlptcm1ProStoppageService stoppageService;
@Value("${oee.acid.coil-create-by}")
private String acidCreateName;
private final ICoilQualityJudgeService coilQualityJudgeService;
@Override
public List<AcidOeeDailySummaryVo> getDailySummary(String startDate, String endDate) {
// 1. 查询基础日汇总(产量、停机时间等)
List<AcidOeeDailySummaryVo> summaries = acidOeeMasterMapper.selectDailySummary(
startDate,
endDate,
acidCreateName
);
List<AcidOeeDailySummaryVo> summaries = acidOeeMapper.selectDailySummary(startDate, endDate);
if (summaries == null || summaries.isEmpty()) {
return Collections.emptyList();
}
// 2. 查询停机事件,按日期聚合停机时间
Map<String, Long> downtimeByDate = aggregateDowntimeByDate(startDate, endDate);
// 3. 查询产量明细,用于良品/次品判定
Map<String, List<CoilInfo>> coilInfoByDate = getCoilNosByDate(startDate, endDate);
// 4. 先按天计算 dailyCycle = runTime/totalOutputTon再取中位数作为理论节拍
List<BigDecimal> dailyCycles = new ArrayList<>();
// 4. 理论节拍使用固定值0.47
BigDecimal idealCycleTon = FIXED_IDEAL_CYCLE;
// 5. 填充每个日汇总的完整数据
for (AcidOeeDailySummaryVo summary : summaries) {
String statDate = summary.getStatDate();
summary.setLineId("SY");
summary.setLineName("酸轧线");
// 填充停机时间
Long downtime = downtimeByDate.getOrDefault(statDate, 0L);
summary.setDowntimeMin(downtime);
// 计算运转时间
Long loadingTime = summary.getLoadingTimeMin() != null ? summary.getLoadingTimeMin() : 0L;
Long runTime = Math.max(0, loadingTime - downtime);
summary.setRunTimeMin(runTime);
BigDecimal totalOutputTon = summary.getTotalOutputTon();
if (runTime > 0 && totalOutputTon != null && totalOutputTon.compareTo(BigDecimal.ZERO) > 0) {
BigDecimal dailyCycle = BigDecimal.valueOf(runTime)
.divide(totalOutputTon, 6, RoundingMode.HALF_UP);
dailyCycles.add(dailyCycle);
}
}
dailyCycles.sort(BigDecimal::compareTo);
BigDecimal idealCycleTon = applyEightyPercent(median(dailyCycles));
// 5. 回填理论节拍、良品次品并计算派生指标
for (AcidOeeDailySummaryVo summary : summaries) {
String statDate = summary.getStatDate();
if (idealCycleTon != null) {
// 理论节拍:若尚未填充,则统一使用“优良日统计”得到的节拍
if (summary.getIdealCycleTimeMinPerTon() == null && idealCycleTon != null) {
summary.setIdealCycleTimeMinPerTon(idealCycleTon);
}
@@ -105,19 +84,18 @@ public class AcidOeeServiceImpl implements IAcidOeeService {
List<CoilInfo> coilInfos = coilInfoByDate.get(statDate);
calculateQualityOutput(summary, coilInfos);
} else {
// 没有卷明细时,全部归待判级
summary.setGoodOutputTon(BigDecimal.ZERO);
summary.setGoodOutputCoil(0L);
summary.setQualifiedOutputTon(BigDecimal.ZERO);
summary.setQualifiedOutputCoil(0L);
summary.setAbOutputTon(BigDecimal.ZERO);
summary.setAbOutputCoil(0L);
// 如果没有卷号,默认全部为良品(或根据业务规则处理)
summary.setGoodOutputTon(summary.getTotalOutputTon());
summary.setGoodOutputCoil(summary.getTotalOutputCoil());
summary.setDefectOutputTon(BigDecimal.ZERO);
summary.setDefectOutputCoil(0L);
summary.setPendingOutputTon(summary.getTotalOutputTon());
summary.setPendingOutputCoil(summary.getTotalOutputCoil());
}
// 填充理论节拍(从回归数据或缓存获取,这里暂时留空,由调用方填充)
// summary.setIdealCycleTimeMinPerTon(...);
// summary.setIdealCycleTimeMinPerCoil(...);
// 计算派生指标
calculateDerivedMetrics(summary);
}
@@ -149,11 +127,7 @@ public class AcidOeeServiceImpl implements IAcidOeeService {
@Override
public AcidOeeIdealCycleVo getIdealCycle(String startDate, String endDate) {
// 1) 取基础日汇总(产量、负荷时间等)
List<AcidOeeDailySummaryVo> daily = acidOeeMasterMapper.selectDailySummary(
startDate,
endDate,
acidCreateName
);
List<AcidOeeDailySummaryVo> daily = acidOeeMapper.selectDailySummary(startDate, endDate);
AcidOeeIdealCycleVo rsp = new AcidOeeIdealCycleVo();
rsp.setLineId("SY");
rsp.setLineName("酸轧线");
@@ -177,31 +151,23 @@ public class AcidOeeServiceImpl implements IAcidOeeService {
d.setRunTimeMin(Math.max(0, loading - downtime));
}
// 3) 理论节拍按“天维度”:每天(运转时间/总吨),再按日样本统计中位数用于展示
List<BigDecimal> dailyCycles = new ArrayList<>();
for (AcidOeeDailySummaryVo d : daily) {
Long run = d.getRunTimeMin();
BigDecimal ton = d.getTotalOutputTon();
if (run == null || run <= 0 || ton == null || ton.compareTo(BigDecimal.ZERO) <= 0) {
continue;
}
dailyCycles.add(BigDecimal.valueOf(run).divide(ton, 6, RoundingMode.HALF_UP));
}
dailyCycles.sort(BigDecimal::compareTo);
BigDecimal medianCycle = median(dailyCycles);
// 理论节拍:按“当天运转时间/当天总吨”逐日计算接口返回前乘以80%
BigDecimal idealCycle = applyEightyPercent(medianCycle);
rsp.setIdealCycleTimeMinPerTon(idealCycle);
// 展示字段保持为中位数
// 3) 卷级节拍 = (END_DATE - START_DATE)/出口重量,计算中位数用于展示不用于OEE计算
List<BigDecimal> coilCycles = acidOeeMapper.selectCoilCycleMinPerTon(startDate, endDate);
coilCycles.removeIf(c -> c == null || c.compareTo(BigDecimal.ZERO) <= 0);
coilCycles.sort(BigDecimal::compareTo);
BigDecimal medianCycle = median(coilCycles);
// 理论节拍使用固定值0.47用于OEE计算
rsp.setIdealCycleTimeMinPerTon(FIXED_IDEAL_CYCLE);
// 中位数理论节拍(用于展示)
rsp.setMedianCycleTimeMinPerTon(medianCycle);
// 样本天数:当前查询区间内有产量的自然日数量(与传入的日期范围一一对应)
rsp.setSampleDays(daily.size());
// 4) 日粒度对比数据:理论耗时 vs 实际运转时间(用于前端展示"有效性"
// 使用“中间50%样本平均理论节拍”计算理论耗时
// 使用固定值0.47计算理论耗时
List<AcidOeeIdealCycleVo.DailyComparePointVo> compare = new ArrayList<>();
if (idealCycle != null) {
if (FIXED_IDEAL_CYCLE != null) {
for (AcidOeeDailySummaryVo d : daily) {
BigDecimal ton = d.getTotalOutputTon();
Long run = d.getRunTimeMin();
@@ -209,7 +175,7 @@ public class AcidOeeServiceImpl implements IAcidOeeService {
AcidOeeIdealCycleVo.DailyComparePointVo p = new AcidOeeIdealCycleVo.DailyComparePointVo();
p.setStatDate(d.getStatDate());
p.setActualRunTimeMin(run);
p.setTheoreticalTimeMin(idealCycle.multiply(ton));
p.setTheoreticalTimeMin(FIXED_IDEAL_CYCLE.multiply(ton));
compare.add(p);
}
}
@@ -304,25 +270,25 @@ public class AcidOeeServiceImpl implements IAcidOeeService {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Calendar cal = Calendar.getInstance();
for (Klptcm1ProStoppageVo event : events) {
if (event.getStartDate() == null || event.getDuration() == null || event.getDuration() <= 0) {
continue;
}
Date eventStart = event.getStartDate();
long durationSec = event.getDuration();
long durationMin = (durationSec + 59) / 60; // 向上取整,避免丢失秒数
// 计算停机结束时间
cal.setTime(eventStart);
cal.add(Calendar.SECOND, (int) durationSec);
Date eventEnd = cal.getTime();
// 如果停机事件在同一天,直接累加
String startDateStr = dateFormat.format(eventStart);
String endDateStr = dateFormat.format(eventEnd);
if (startDateStr.equals(endDateStr)) {
// 同一天,直接累加
downtimeMap.merge(startDateStr, durationMin, Long::sum);
@@ -334,23 +300,23 @@ public class AcidOeeServiceImpl implements IAcidOeeService {
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
Date dayStart = cal.getTime();
Date currentDayStart = dayStart;
while (currentDayStart.before(eventEnd)) {
cal.setTime(currentDayStart);
cal.add(Calendar.DAY_OF_MONTH, 1);
Date nextDayStart = cal.getTime();
// 计算当前天的停机分钟数
Date dayEnd = nextDayStart.before(eventEnd) ? nextDayStart : eventEnd;
long dayMinutes = Math.max(0, (dayEnd.getTime() - Math.max(currentDayStart.getTime(), eventStart.getTime())) / (1000 * 60));
if (dayMinutes > 0) {
String dateKey = dateFormat.format(currentDayStart);
downtimeMap.merge(dateKey, dayMinutes, Long::sum);
}
currentDayStart = nextDayStart;
}
}
@@ -363,18 +329,13 @@ public class AcidOeeServiceImpl implements IAcidOeeService {
* 获取每日的钢卷号和重量(用于良品/次品判定)
*/
private Map<String, List<CoilInfo>> getCoilNosByDate(String startDate, String endDate) {
List<AcidOeeCoilInfoByDateVo> coilInfoList = acidOeeMasterMapper.selectCoilInfoByDate(
startDate,
endDate,
acidCreateName
);
List<AcidOeeMapper.CoilInfoByDate> coilInfoList = acidOeeMapper.selectCoilInfoByDate(startDate, endDate);
Map<String, List<CoilInfo>> result = new HashMap<>();
for (AcidOeeCoilInfoByDateVo info : coilInfoList) {
for (AcidOeeMapper.CoilInfoByDate info : coilInfoList) {
String date = info.getStatDate();
result.computeIfAbsent(date, k -> new ArrayList<>())
.add(new CoilInfo(info.getCoilNo(), info.getWeight(), info.getQualityStatus()));
.add(new CoilInfo(info.getCoilNo(), info.getWeight()));
}
return result;
@@ -384,64 +345,50 @@ public class AcidOeeServiceImpl implements IAcidOeeService {
* 卷号信息内部类
*/
private static class CoilInfo {
final String coilNo;
final BigDecimal weight;
final String qualityStatus;
CoilInfo(String coilNo, BigDecimal weight, String qualityStatus) {
CoilInfo(String coilNo, BigDecimal weight) {
this.coilNo = coilNo;
this.weight = weight;
this.qualityStatus = qualityStatus;
}
}
/**
* 计算质量细分产量A良品、B合格品、C/D次品、O待判级。
* 计算良品/次品产量
*/
private void calculateQualityOutput(AcidOeeDailySummaryVo summary, List<CoilInfo> coilInfos) {
BigDecimal aTon = BigDecimal.ZERO;
long aCoil = 0L;
BigDecimal bTon = BigDecimal.ZERO;
long bCoil = 0L;
BigDecimal cdTon = BigDecimal.ZERO;
long cdCoil = 0L;
BigDecimal oTon = BigDecimal.ZERO;
long oCoil = 0L;
BigDecimal goodTon = BigDecimal.ZERO;
long goodCoil = 0L;
BigDecimal defectTon = BigDecimal.ZERO;
long defectCoil = 0L;
for (CoilInfo coilInfo : coilInfos) {
String coilNo = coilInfo.coilNo;
BigDecimal coilWeight = coilInfo.weight != null ? coilInfo.weight : BigDecimal.ZERO;
String qualityStatus = StringUtils.upperCase(StringUtils.trim(coilInfo.qualityStatus));
if (StringUtils.isBlank(qualityStatus) || "O".equals(qualityStatus)) {
oTon = oTon.add(coilWeight);
oCoil++;
// 通过WMS判定良品/次品
Boolean isScrap = coilQualityJudgeService.isScrap(ACID_FINISHED_WAREHOUSE_ID, coilNo);
if (isScrap == null) {
// 匹配不到,忽略不计
continue;
}
if (qualityStatus.startsWith("A")) {
aTon = aTon.add(coilWeight);
aCoil++;
} else if (qualityStatus.startsWith("B")) {
bTon = bTon.add(coilWeight);
bCoil++;
} else if (CD_SERIES.contains(qualityStatus)) {
cdTon = cdTon.add(coilWeight);
cdCoil++;
if (Boolean.TRUE.equals(isScrap)) {
// 次品
defectTon = defectTon.add(coilWeight);
defectCoil++;
} else {
// 未识别等级统一归待判级
oTon = oTon.add(coilWeight);
oCoil++;
// 良品
goodTon = goodTon.add(coilWeight);
goodCoil++;
}
}
summary.setGoodOutputTon(aTon);
summary.setGoodOutputCoil(aCoil);
summary.setQualifiedOutputTon(bTon);
summary.setQualifiedOutputCoil(bCoil);
summary.setAbOutputTon(aTon.add(bTon));
summary.setAbOutputCoil(aCoil + bCoil);
summary.setDefectOutputTon(cdTon);
summary.setDefectOutputCoil(cdCoil);
summary.setPendingOutputTon(oTon);
summary.setPendingOutputCoil(oCoil);
summary.setGoodOutputTon(goodTon);
summary.setGoodOutputCoil(goodCoil);
summary.setDefectOutputTon(defectTon);
summary.setDefectOutputCoil(defectCoil);
}
/**
@@ -459,7 +406,6 @@ public class AcidOeeServiceImpl implements IAcidOeeService {
}
// 性能稼动率(吨维度)
// 口径:理论节拍单位为 min/吨 时,性能稼动率 = (理论节拍 × 实际产量) / 实际运转时间 × 100
Long runTime = summary.getRunTimeMin() != null ? summary.getRunTimeMin() : 0L;
BigDecimal idealCycleTon = summary.getIdealCycleTimeMinPerTon();
BigDecimal totalOutputTon = summary.getTotalOutputTon();
@@ -469,14 +415,12 @@ public class AcidOeeServiceImpl implements IAcidOeeService {
&& totalOutputTon != null
&& totalOutputTon.compareTo(BigDecimal.ZERO) > 0) {
BigDecimal idealTime = idealCycleTon.multiply(totalOutputTon);
BigDecimal performanceTon = idealTime
.divide(BigDecimal.valueOf(runTime), 4, RoundingMode.HALF_UP)
BigDecimal performanceTon = idealTime.divide(BigDecimal.valueOf(runTime), 4, RoundingMode.HALF_UP)
.multiply(BigDecimal.valueOf(100));
summary.setPerformanceTon(performanceTon);
}
// 性能稼动率(卷维度)
// 口径:理论节拍单位为 min/卷 时,性能稼动率 = (理论节拍 × 实际产量) / 实际运转时间 × 100
Long totalOutputCoil = summary.getTotalOutputCoil() != null ? summary.getTotalOutputCoil() : 0L;
BigDecimal idealCycleCoil = summary.getIdealCycleTimeMinPerCoil();
if (runTime > 0
@@ -484,35 +428,17 @@ public class AcidOeeServiceImpl implements IAcidOeeService {
&& idealCycleCoil.compareTo(BigDecimal.ZERO) > 0
&& totalOutputCoil > 0) {
BigDecimal idealTime = idealCycleCoil.multiply(BigDecimal.valueOf(totalOutputCoil));
BigDecimal performanceCoil = idealTime
.divide(BigDecimal.valueOf(runTime), 4, RoundingMode.HALF_UP)
BigDecimal performanceCoil = idealTime.divide(BigDecimal.valueOf(runTime), 4, RoundingMode.HALF_UP)
.multiply(BigDecimal.valueOf(100));
summary.setPerformanceCoil(performanceCoil);
}
// 质量细分比
// 良品
if (totalOutputTon != null && totalOutputTon.compareTo(BigDecimal.ZERO) > 0) {
BigDecimal aTon = summary.getGoodOutputTon() != null ? summary.getGoodOutputTon() : BigDecimal.ZERO;
BigDecimal bTon = summary.getQualifiedOutputTon() != null ? summary.getQualifiedOutputTon() : BigDecimal.ZERO;
BigDecimal cdTon = summary.getDefectOutputTon() != null ? summary.getDefectOutputTon() : BigDecimal.ZERO;
BigDecimal oTon = summary.getPendingOutputTon() != null ? summary.getPendingOutputTon() : BigDecimal.ZERO;
BigDecimal quality = aTon.divide(totalOutputTon, 4, RoundingMode.HALF_UP)
BigDecimal goodOutputTon = summary.getGoodOutputTon() != null ? summary.getGoodOutputTon() : BigDecimal.ZERO;
BigDecimal quality = goodOutputTon.divide(totalOutputTon, 4, RoundingMode.HALF_UP)
.multiply(BigDecimal.valueOf(100));
summary.setQuality(quality);
BigDecimal qualifiedRate = aTon.add(bTon)
.divide(totalOutputTon, 4, RoundingMode.HALF_UP)
.multiply(BigDecimal.valueOf(100));
summary.setQualifiedRate(qualifiedRate);
BigDecimal defectRate = cdTon.divide(totalOutputTon, 4, RoundingMode.HALF_UP)
.multiply(BigDecimal.valueOf(100));
summary.setDefectRate(defectRate);
BigDecimal pendingRate = oTon.divide(totalOutputTon, 4, RoundingMode.HALF_UP)
.multiply(BigDecimal.valueOf(100));
summary.setPendingRate(pendingRate);
}
// OEE以吨维度为主
@@ -537,15 +463,6 @@ public class AcidOeeServiceImpl implements IAcidOeeService {
return a.add(b).divide(BigDecimal.valueOf(2), 6, RoundingMode.HALF_UP);
}
/** 理论节拍返回前按业务口径乘以70% */
private BigDecimal applyEightyPercent(BigDecimal cycle) {
if (cycle == null) {
return null;
}
return cycle.multiply(BigDecimal.valueOf(0.7)).setScale(6, RoundingMode.HALF_UP);
}
/**
* 解析日期字符串为Date对象
*/

View File

@@ -18,7 +18,6 @@ public class CrmPdiPlan {
private Integer seqid;
private String coilid;
private String enterCoilNo;
private Integer dummyCoilFlag;
private String status;
private String planid;

View File

@@ -19,7 +19,6 @@ public class CrmPdoExcoil {
private String exitMatId;
private String entryMatId;
private String enterCoilNo;
private Integer subId;
private Double startPosition;
private Double endPosition;

View File

@@ -15,7 +15,6 @@ public class CrmPdiPlanBo extends BaseEntity {
private Integer seqid;
private String coilid;
private String enterCoilNo;
private Integer dummyCoilFlag;
private String status;
private String planid;

View File

@@ -15,7 +15,6 @@ public class CrmPdoExcoilBo extends BaseEntity {
private String exitMatId;
private String entryMatId;
private String enterCoilNo;
private Integer subId;
private Double startPosition;
private Double endPosition;

View File

@@ -12,7 +12,6 @@ public class CrmPdiPlanVo {
private Integer seqid;
private String coilid;
private String enterCoilNo;
private Integer dummyCoilFlag;
private String status;
private String planid;

View File

@@ -12,7 +12,6 @@ public class CrmPdoExcoilVo {
private String exitMatId;
private String entryMatId;
private String enterCoilNo;
private Integer subId;
private Double startPosition;
private Double endPosition;

View File

@@ -1,22 +0,0 @@
package com.klp.pocket.galvanize1.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.klp.pocket.acid.domain.vo.AcidOeeCoilInfoByDateVo;
import com.klp.pocket.acid.domain.vo.AcidOeeDailySummaryVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
@DS("master")
public interface GalvanizeOeeMasterMapper {
List<AcidOeeDailySummaryVo> selectDailySummary(@Param("startDate") String startDate,
@Param("endDate") String endDate,
@Param("createBy") String createBy);
List<AcidOeeCoilInfoByDateVo> selectCoilInfoByDate(@Param("startDate") String startDate,
@Param("endDate") String endDate,
@Param("createBy") String createBy);
}

View File

@@ -1,19 +0,0 @@
package com.klp.pocket.galvanize1.service;
import com.klp.pocket.acid.domain.vo.AcidOeeDailySummaryVo;
import com.klp.pocket.acid.domain.vo.AcidOeeIdealCycleVo;
import com.klp.pocket.acid.domain.vo.AcidOeeLoss7Vo;
import com.klp.pocket.acid.domain.vo.Klptcm1ProStoppageVo;
import java.util.List;
public interface IGalvanizeOeeService {
List<AcidOeeDailySummaryVo> getDailySummary(String startDate, String endDate);
List<Klptcm1ProStoppageVo> getStoppageEvents(String startDate, String endDate);
List<AcidOeeLoss7Vo> getLoss7Summary(String startDate, String endDate);
AcidOeeIdealCycleVo getIdealCycle(String startDate, String endDate);
}

View File

@@ -18,6 +18,7 @@ import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@RequiredArgsConstructor
@DS("galvanize1")
@@ -45,11 +46,11 @@ public class CrmPdiPlanServiceImpl implements ICrmPdiPlanService {
}
private LambdaQueryWrapper<CrmPdiPlan> buildQueryWrapper(CrmPdiPlanBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<CrmPdiPlan> lqw = Wrappers.lambdaQuery();
lqw.eq(bo.getId() != null, CrmPdiPlan::getId, bo.getId());
lqw.eq(bo.getSeqid() != null, CrmPdiPlan::getSeqid, bo.getSeqid());
lqw.eq(StringUtils.isNotBlank(bo.getCoilid()), CrmPdiPlan::getCoilid, bo.getCoilid());
lqw.eq(StringUtils.isNotBlank(bo.getEnterCoilNo()), CrmPdiPlan::getEnterCoilNo, bo.getEnterCoilNo());
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), CrmPdiPlan::getStatus, bo.getStatus());
lqw.eq(StringUtils.isNotBlank(bo.getPlanid()), CrmPdiPlan::getPlanid, bo.getPlanid());
lqw.eq(StringUtils.isNotBlank(bo.getPlanType()), CrmPdiPlan::getPlanType, bo.getPlanType());

View File

@@ -18,6 +18,7 @@ import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@RequiredArgsConstructor
@DS("galvanize1")
@@ -45,15 +46,15 @@ public class CrmPdoExcoilServiceImpl implements ICrmPdoExcoilService {
}
private LambdaQueryWrapper<CrmPdoExcoil> buildQueryWrapper(CrmPdoExcoilBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<CrmPdoExcoil> lqw = Wrappers.lambdaQuery();
lqw.eq(bo.getId() != null, CrmPdoExcoil::getId, bo.getId());
lqw.eq(StringUtils.isNotBlank(bo.getExitMatId()), CrmPdoExcoil::getExitMatId, bo.getExitMatId());
lqw.eq(StringUtils.isNotBlank(bo.getEntryMatId()), CrmPdoExcoil::getEntryMatId, bo.getEntryMatId());
lqw.eq(StringUtils.isNotBlank(bo.getEnterCoilNo()), CrmPdoExcoil::getEnterCoilNo, bo.getEnterCoilNo());
lqw.eq(bo.getPlanId() != null, CrmPdoExcoil::getPlanId, bo.getPlanId());
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), CrmPdoExcoil::getStatus, bo.getStatus());
lqw.eq(StringUtils.isNotBlank(bo.getUnitCode()), CrmPdoExcoil::getUnitCode, bo.getUnitCode());
lqw.orderByDesc(CrmPdoExcoil::getCreateTime);
lqw.orderByDesc(CrmPdoExcoil::getId);
return lqw;
}

View File

@@ -1,274 +0,0 @@
package com.klp.pocket.galvanize1.service.impl;
import com.klp.common.utils.StringUtils;
import com.klp.pocket.acid.domain.vo.AcidOeeCoilInfoByDateVo;
import com.klp.pocket.acid.domain.vo.AcidOeeDailySummaryVo;
import com.klp.pocket.acid.domain.vo.AcidOeeIdealCycleVo;
import com.klp.pocket.acid.domain.vo.AcidOeeLoss7Vo;
import com.klp.pocket.acid.domain.vo.Klptcm1ProStoppageVo;
import com.klp.pocket.galvanize1.domain.bo.ProStoppageBo;
import com.klp.pocket.galvanize1.domain.vo.ProStoppageVo;
import com.klp.pocket.galvanize1.mapper.GalvanizeOeeMasterMapper;
import com.klp.pocket.galvanize1.service.IGalvanizeOeeService;
import com.klp.pocket.galvanize1.service.IProStoppageService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.*;
@Slf4j
@RequiredArgsConstructor
@Service
public class GalvanizeOeeServiceImpl implements IGalvanizeOeeService {
private static final Set<String> CD_SERIES = new HashSet<>(Arrays.asList("C+", "C", "C-", "D+", "D", "D-"));
private final GalvanizeOeeMasterMapper galvanizeOeeMasterMapper;
private final IProStoppageService proStoppageService;
@Value("${oee.galvanize1.coil-create-by:duxinkuguan}")
private String galvanizeCreateBy;
@Override
public List<AcidOeeDailySummaryVo> getDailySummary(String startDate, String endDate) {
List<AcidOeeDailySummaryVo> summaries = galvanizeOeeMasterMapper.selectDailySummary(startDate, endDate, galvanizeCreateBy);
if (summaries == null || summaries.isEmpty()) return Collections.emptyList();
Map<String, Long> downtimeByDate = aggregateDowntimeByDate(startDate, endDate);
Map<String, List<CoilInfo>> coilInfoByDate = getCoilNosByDate(startDate, endDate);
List<BigDecimal> dailyCycles = new ArrayList<>();
for (AcidOeeDailySummaryVo s : summaries) {
s.setLineId("DX1");
s.setLineName("镀锌一线");
Long downtime = downtimeByDate.getOrDefault(s.getStatDate(), 0L);
s.setDowntimeMin(downtime);
Long loading = s.getLoadingTimeMin() == null ? 0L : s.getLoadingTimeMin();
Long run = Math.max(0, loading - downtime);
s.setRunTimeMin(run);
BigDecimal ton = s.getTotalOutputTon();
if (run > 0 && ton != null && ton.compareTo(BigDecimal.ZERO) > 0) {
dailyCycles.add(BigDecimal.valueOf(run).divide(ton, 6, RoundingMode.HALF_UP));
}
}
dailyCycles.sort(BigDecimal::compareTo);
BigDecimal ideal = applyEightyPercent(median(dailyCycles));
for (AcidOeeDailySummaryVo s : summaries) {
if (ideal != null) s.setIdealCycleTimeMinPerTon(ideal);
List<CoilInfo> coilInfos = coilInfoByDate.get(s.getStatDate());
if (coilInfos != null) {
calculateQualityOutput(s, coilInfos);
} else {
s.setGoodOutputTon(BigDecimal.ZERO);
s.setGoodOutputCoil(0L);
s.setQualifiedOutputTon(BigDecimal.ZERO);
s.setQualifiedOutputCoil(0L);
s.setAbOutputTon(BigDecimal.ZERO);
s.setAbOutputCoil(0L);
s.setDefectOutputTon(BigDecimal.ZERO);
s.setDefectOutputCoil(0L);
s.setPendingOutputTon(s.getTotalOutputTon());
s.setPendingOutputCoil(s.getTotalOutputCoil());
}
calculateDerivedMetrics(s);
}
return summaries;
}
@Override
public List<Klptcm1ProStoppageVo> getStoppageEvents(String startDate, String endDate) {
ProStoppageBo bo = new ProStoppageBo();
bo.setStartDate(parseDate(startDate));
bo.setEndDate(parseDate(endDate));
List<ProStoppageVo> list = proStoppageService.queryList(bo);
List<Klptcm1ProStoppageVo> out = new ArrayList<>();
for (ProStoppageVo p : list) {
Klptcm1ProStoppageVo v = new Klptcm1ProStoppageVo();
v.setStopid(p.getStopid());
v.setShift(p.getShift());
v.setCrew(p.getCrew());
v.setArea(p.getArea());
v.setUnit(p.getUnit());
v.setSeton(p.getSeton());
v.setStartDate(p.getStartDate());
v.setEndDate(p.getEndDate());
v.setRemark(p.getRemark());
v.setStopType(p.getStopType());
long durationSec = p.getDuration() == null ? 0L : Math.round(p.getDuration());
v.setDuration(durationSec);
out.add(v);
}
return out;
}
@Override
public List<AcidOeeLoss7Vo> getLoss7Summary(String startDate, String endDate) {
List<Klptcm1ProStoppageVo> events = getStoppageEvents(startDate, endDate);
if (events.isEmpty()) return Collections.emptyList();
Map<String, long[]> m = new HashMap<>();
long total = 0L;
for (Klptcm1ProStoppageVo e : events) {
String k = StringUtils.isBlank(e.getStopType()) ? "未分类" : e.getStopType();
long min = Math.max(1, (e.getDuration() == null ? 0L : e.getDuration()) / 60);
if (min <= 0) continue;
m.computeIfAbsent(k, x -> new long[2]);
m.get(k)[0] += min;
m.get(k)[1] += 1;
total += min;
}
List<AcidOeeLoss7Vo> out = new ArrayList<>();
for (Map.Entry<String, long[]> en : m.entrySet()) {
AcidOeeLoss7Vo vo = new AcidOeeLoss7Vo();
vo.setLossCategoryCode(en.getKey());
vo.setLossCategoryName(en.getKey());
vo.setLossTimeMin(en.getValue()[0]);
vo.setCount((int) en.getValue()[1]);
vo.setAvgDurationMin(BigDecimal.valueOf(en.getValue()[0]).divide(BigDecimal.valueOf(Math.max(1, en.getValue()[1])), 2, RoundingMode.HALF_UP));
vo.setLossTimeRate(total == 0 ? BigDecimal.ZERO : BigDecimal.valueOf(en.getValue()[0]).divide(BigDecimal.valueOf(total), 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)));
out.add(vo);
}
out.sort(Comparator.comparingLong(AcidOeeLoss7Vo::getLossTimeMin).reversed());
return out;
}
@Override
public AcidOeeIdealCycleVo getIdealCycle(String startDate, String endDate) {
List<AcidOeeDailySummaryVo> daily = getDailySummary(startDate, endDate);
AcidOeeIdealCycleVo rsp = new AcidOeeIdealCycleVo();
rsp.setLineId("DX1");
rsp.setLineName("镀锌一线");
rsp.setStartDate(startDate);
rsp.setEndDate(endDate);
if (daily.isEmpty()) {
rsp.setDailyComparePoints(Collections.emptyList());
rsp.setSampleDays(0);
return rsp;
}
List<BigDecimal> dailyCycles = new ArrayList<>();
List<AcidOeeIdealCycleVo.DailyComparePointVo> points = new ArrayList<>();
for (AcidOeeDailySummaryVo d : daily) {
if (d.getRunTimeMin() == null || d.getRunTimeMin() <= 0 || d.getTotalOutputTon() == null || d.getTotalOutputTon().compareTo(BigDecimal.ZERO) <= 0) continue;
BigDecimal c = BigDecimal.valueOf(d.getRunTimeMin()).divide(d.getTotalOutputTon(), 6, RoundingMode.HALF_UP);
dailyCycles.add(c);
}
dailyCycles.sort(BigDecimal::compareTo);
BigDecimal med = median(dailyCycles);
BigDecimal ideal = applyEightyPercent(med);
for (AcidOeeDailySummaryVo d : daily) {
if (ideal == null || d.getTotalOutputTon() == null || d.getRunTimeMin() == null) continue;
AcidOeeIdealCycleVo.DailyComparePointVo p = new AcidOeeIdealCycleVo.DailyComparePointVo();
p.setStatDate(d.getStatDate());
p.setActualRunTimeMin(d.getRunTimeMin());
p.setTheoreticalTimeMin(ideal.multiply(d.getTotalOutputTon()));
points.add(p);
}
rsp.setIdealCycleTimeMinPerTon(ideal);
rsp.setMedianCycleTimeMinPerTon(med);
rsp.setSampleDays(daily.size());
rsp.setDailyComparePoints(points);
return rsp;
}
private Map<String, List<CoilInfo>> getCoilNosByDate(String startDate, String endDate) {
List<AcidOeeCoilInfoByDateVo> list = galvanizeOeeMasterMapper.selectCoilInfoByDate(startDate, endDate, galvanizeCreateBy);
Map<String, List<CoilInfo>> map = new HashMap<>();
for (AcidOeeCoilInfoByDateVo i : list) {
map.computeIfAbsent(i.getStatDate(), k -> new ArrayList<>()).add(new CoilInfo(i.getWeight(), i.getQualityStatus()));
}
return map;
}
private void calculateQualityOutput(AcidOeeDailySummaryVo summary, List<CoilInfo> coilInfos) {
BigDecimal aTon = BigDecimal.ZERO, bTon = BigDecimal.ZERO, cdTon = BigDecimal.ZERO, oTon = BigDecimal.ZERO;
long a = 0, b = 0, cd = 0, o = 0;
for (CoilInfo c : coilInfos) {
BigDecimal w = c.weight == null ? BigDecimal.ZERO : c.weight;
String q = StringUtils.upperCase(StringUtils.trim(c.qualityStatus));
if (StringUtils.isBlank(q) || "O".equals(q)) {
oTon = oTon.add(w); o++; continue;
}
if (q.startsWith("A")) { aTon = aTon.add(w); a++; }
else if (q.startsWith("B")) { bTon = bTon.add(w); b++; }
else if (CD_SERIES.contains(q)) { cdTon = cdTon.add(w); cd++; }
else { oTon = oTon.add(w); o++; }
}
summary.setGoodOutputTon(aTon); summary.setGoodOutputCoil(a);
summary.setQualifiedOutputTon(bTon); summary.setQualifiedOutputCoil(b);
summary.setAbOutputTon(aTon.add(bTon)); summary.setAbOutputCoil(a + b);
summary.setDefectOutputTon(cdTon); summary.setDefectOutputCoil(cd);
summary.setPendingOutputTon(oTon); summary.setPendingOutputCoil(o);
}
private void calculateDerivedMetrics(AcidOeeDailySummaryVo s) {
long loading = s.getLoadingTimeMin() == null ? 0 : s.getLoadingTimeMin();
long downtime = s.getDowntimeMin() == null ? 0 : s.getDowntimeMin();
if (loading > 0) s.setAvailability(BigDecimal.valueOf(loading - downtime).divide(BigDecimal.valueOf(loading), 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)));
long run = s.getRunTimeMin() == null ? 0 : s.getRunTimeMin();
BigDecimal ideal = s.getIdealCycleTimeMinPerTon();
BigDecimal ton = s.getTotalOutputTon();
if (run > 0 && ideal != null && ideal.compareTo(BigDecimal.ZERO) > 0 && ton != null && ton.compareTo(BigDecimal.ZERO) > 0) {
s.setPerformanceTon(ideal.multiply(ton).divide(BigDecimal.valueOf(run), 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)));
}
if (ton != null && ton.compareTo(BigDecimal.ZERO) > 0) {
BigDecimal a = Optional.ofNullable(s.getGoodOutputTon()).orElse(BigDecimal.ZERO);
BigDecimal b = Optional.ofNullable(s.getQualifiedOutputTon()).orElse(BigDecimal.ZERO);
BigDecimal cd = Optional.ofNullable(s.getDefectOutputTon()).orElse(BigDecimal.ZERO);
BigDecimal o = Optional.ofNullable(s.getPendingOutputTon()).orElse(BigDecimal.ZERO);
s.setQuality(a.divide(ton, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)));
s.setQualifiedRate(a.add(b).divide(ton, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)));
s.setDefectRate(cd.divide(ton, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)));
s.setPendingRate(o.divide(ton, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)));
}
if (s.getAvailability() != null && s.getPerformanceTon() != null && s.getQuality() != null) {
s.setOee(s.getAvailability().multiply(s.getPerformanceTon()).multiply(s.getQuality()).divide(BigDecimal.valueOf(10000), 4, RoundingMode.HALF_UP));
}
}
private Map<String, Long> aggregateDowntimeByDate(String startDate, String endDate) {
List<Klptcm1ProStoppageVo> events = getStoppageEvents(startDate, endDate);
Map<String, Long> map = new HashMap<>();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
for (Klptcm1ProStoppageVo e : events) {
if (e.getStartDate() == null || e.getDuration() == null || e.getDuration() <= 0) continue;
long min = Math.max(1, (e.getDuration() + 59) / 60);
map.merge(df.format(e.getStartDate()), min, Long::sum);
}
return map;
}
private BigDecimal median(List<BigDecimal> values) {
if (values == null || values.isEmpty()) return null;
int n = values.size();
if (n % 2 == 1) return values.get(n / 2);
return values.get(n / 2 - 1).add(values.get(n / 2)).divide(BigDecimal.valueOf(2), 6, RoundingMode.HALF_UP);
}
private BigDecimal applyEightyPercent(BigDecimal v) {
return v == null ? null : v.multiply(BigDecimal.valueOf(0.7)).setScale(6, RoundingMode.HALF_UP);
}
private Date parseDate(String dateStr) {
if (StringUtils.isBlank(dateStr)) return null;
try {
return new SimpleDateFormat("yyyy-MM-dd").parse(dateStr);
} catch (Exception e) {
return null;
}
}
private static class CoilInfo {
final BigDecimal weight;
final String qualityStatus;
CoilInfo(BigDecimal weight, String qualityStatus) {
this.weight = weight;
this.qualityStatus = qualityStatus;
}
}
}

View File

@@ -1,70 +0,0 @@
<?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.galvanize1.mapper.GalvanizeOeeMasterMapper">
<resultMap id="AcidOeeDailySummaryResultMap" type="com.klp.pocket.acid.domain.vo.AcidOeeDailySummaryVo">
<result column="stat_date" property="statDate" jdbcType="VARCHAR"/>
<result column="line_id" property="lineId" jdbcType="VARCHAR"/>
<result column="line_name" property="lineName" jdbcType="VARCHAR"/>
<result column="planned_time_min" property="plannedTimeMin" jdbcType="BIGINT"/>
<result column="planned_downtime_min" property="plannedDowntimeMin" jdbcType="BIGINT"/>
<result column="loading_time_min" property="loadingTimeMin" jdbcType="BIGINT"/>
<result column="downtime_min" property="downtimeMin" jdbcType="BIGINT"/>
<result column="run_time_min" property="runTimeMin" jdbcType="BIGINT"/>
<result column="total_output_ton" property="totalOutputTon" jdbcType="DECIMAL"/>
<result column="total_output_coil" property="totalOutputCoil" jdbcType="BIGINT"/>
<result column="good_output_ton" property="goodOutputTon" jdbcType="DECIMAL"/>
<result column="good_output_coil" property="goodOutputCoil" jdbcType="BIGINT"/>
<result column="defect_output_ton" property="defectOutputTon" jdbcType="DECIMAL"/>
<result column="defect_output_coil" property="defectOutputCoil" jdbcType="BIGINT"/>
<result column="ideal_cycle_time_min_per_ton" property="idealCycleTimeMinPerTon" jdbcType="DECIMAL"/>
<result column="ideal_cycle_time_min_per_coil" property="idealCycleTimeMinPerCoil" jdbcType="DECIMAL"/>
</resultMap>
<select id="selectDailySummary" resultMap="AcidOeeDailySummaryResultMap">
SELECT
DATE_FORMAT(mc.create_time, '%Y-%m-%d') AS stat_date,
'DX1' AS line_id,
'镀锌一线' AS line_name,
1440 AS planned_time_min,
0 AS planned_downtime_min,
1440 AS loading_time_min,
0 AS downtime_min,
COALESCE(SUM(mc.net_weight / 1000), 0) AS total_output_ton,
COUNT(*) AS total_output_coil,
0 AS good_output_ton,
0 AS good_output_coil,
0 AS defect_output_ton,
0 AS defect_output_coil,
NULL AS ideal_cycle_time_min_per_ton,
NULL AS ideal_cycle_time_min_per_coil
FROM wms_material_coil mc
WHERE DATE(mc.create_time) BETWEEN #{startDate} AND #{endDate}
AND mc.create_by = #{createBy}
AND mc.del_flag = 0
AND mc.data_type = 1
AND mc.current_coil_no IS NOT NULL
AND mc.net_weight IS NOT NULL
AND mc.net_weight > 0
GROUP BY DATE_FORMAT(mc.create_time, '%Y-%m-%d')
ORDER BY stat_date ASC
</select>
<select id="selectCoilInfoByDate" resultType="com.klp.pocket.acid.domain.vo.AcidOeeCoilInfoByDateVo">
SELECT
DATE_FORMAT(mc.create_time, '%Y-%m-%d') AS statDate,
mc.current_coil_no AS coilNo,
(mc.net_weight / 1000) AS weight,
mc.quality_status AS qualityStatus
FROM wms_material_coil mc
WHERE DATE(mc.create_time) BETWEEN #{startDate} AND #{endDate}
AND mc.create_by = #{createBy}
AND mc.del_flag = 0
AND mc.data_type = 1
AND mc.current_coil_no IS NOT NULL
AND mc.net_weight IS NOT NULL
AND mc.net_weight > 0
ORDER BY mc.create_time ASC, mc.current_coil_no ASC
</select>
</mapper>

View File

@@ -1,25 +0,0 @@
<?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.acid.mapper.AcidOeeAcidMapper">
<!-- 查询卷级生产节拍min/吨):(END_DATE - START_DATE)/EXIT_WEIGHT -->
<select id="selectCoilCycleMinPerTon" resultType="java.math.BigDecimal">
SELECT
TIMESTAMPDIFF(MINUTE, e.START_DATE, e.END_DATE) / e.EXIT_WEIGHT AS cycle_min_per_ton
FROM klptcm1_pdo_excoil e
WHERE 1 = 1
<if test="startDate != null and startDate != ''">
AND DATE(e.INSDATE) &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
AND DATE(e.INSDATE) &lt;= #{endDate}
</if>
AND e.START_DATE IS NOT NULL
AND e.END_DATE IS NOT NULL
AND e.END_DATE &gt; e.START_DATE
AND e.EXIT_WEIGHT IS NOT NULL
AND e.EXIT_WEIGHT &gt; 0
AND TIMESTAMPDIFF(MINUTE, e.START_DATE, e.END_DATE) &gt; 0
</select>
</mapper>

View File

@@ -0,0 +1,95 @@
<?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.acid.mapper.AcidOeeMapper">
<!-- OEE日汇总结果映射 -->
<resultMap id="AcidOeeDailySummaryResultMap" type="com.klp.pocket.acid.domain.vo.AcidOeeDailySummaryVo">
<result column="stat_date" property="statDate" jdbcType="VARCHAR"/>
<result column="line_id" property="lineId" jdbcType="VARCHAR"/>
<result column="line_name" property="lineName" jdbcType="VARCHAR"/>
<result column="planned_time_min" property="plannedTimeMin" jdbcType="BIGINT"/>
<result column="planned_downtime_min" property="plannedDowntimeMin" jdbcType="BIGINT"/>
<result column="loading_time_min" property="loadingTimeMin" jdbcType="BIGINT"/>
<result column="downtime_min" property="downtimeMin" jdbcType="BIGINT"/>
<result column="run_time_min" property="runTimeMin" jdbcType="BIGINT"/>
<result column="total_output_ton" property="totalOutputTon" jdbcType="DECIMAL"/>
<result column="total_output_coil" property="totalOutputCoil" jdbcType="BIGINT"/>
<result column="good_output_ton" property="goodOutputTon" jdbcType="DECIMAL"/>
<result column="good_output_coil" property="goodOutputCoil" jdbcType="BIGINT"/>
<result column="defect_output_ton" property="defectOutputTon" jdbcType="DECIMAL"/>
<result column="defect_output_coil" property="defectOutputCoil" jdbcType="BIGINT"/>
<result column="ideal_cycle_time_min_per_ton" property="idealCycleTimeMinPerTon" jdbcType="DECIMAL"/>
<result column="ideal_cycle_time_min_per_coil" property="idealCycleTimeMinPerCoil" jdbcType="DECIMAL"/>
</resultMap>
<!-- 查询OEE日汇总 -->
<select id="selectDailySummary" resultMap="AcidOeeDailySummaryResultMap">
SELECT
DATE_FORMAT(e.INSDATE, '%Y-%m-%d') AS stat_date,
'SY' AS line_id,
'酸轧线' AS line_name,
-- 计划时间暂时使用24小时1440分钟后续可从计划表获取
1440 AS planned_time_min,
-- 计划停机暂时为0后续可从停机事件表中筛选stop_type='计划停机'的汇总
0 AS planned_downtime_min,
-- 负荷时间 = 计划时间 - 计划停机
1440 AS loading_time_min,
-- 停机时间在Service层通过停机事件表聚合填充
0 AS downtime_min,
-- 总产量(吨):出口重量总和
COALESCE(SUM(e.EXIT_WEIGHT), 0) AS total_output_ton,
-- 总产量(卷):记录数
COUNT(*) AS total_output_coil,
-- 良品/次品在Service层通过WMS判定后填充
0 AS good_output_ton,
0 AS good_output_coil,
0 AS defect_output_ton,
0 AS defect_output_coil,
-- 理论节拍在Service层通过回归数据填充
NULL AS ideal_cycle_time_min_per_ton,
NULL AS ideal_cycle_time_min_per_coil
FROM klptcm1_pdo_excoil e
WHERE DATE(e.INSDATE) BETWEEN #{startDate} AND #{endDate}
GROUP BY DATE_FORMAT(e.INSDATE, '%Y-%m-%d')
ORDER BY stat_date ASC
</select>
<!-- 查询每日的钢卷号和重量(用于良品/次品判定) -->
<select id="selectCoilInfoByDate" resultType="com.klp.pocket.acid.mapper.AcidOeeMapper$CoilInfoByDate">
SELECT
DATE_FORMAT(e.INSDATE, '%Y-%m-%d') AS statDate,
-- 当前钢卷号使用出口卷号excoilid或成品卷号encoilid
COALESCE(e.EXCOILID, e.ENCOILID) AS coilNo,
-- 重量(吨):出口重量
e.EXIT_WEIGHT AS weight
FROM klptcm1_pdo_excoil e
WHERE DATE(e.INSDATE) BETWEEN #{startDate} AND #{endDate}
AND e.EXIT_WEIGHT IS NOT NULL
AND e.EXIT_WEIGHT > 0
AND (e.EXCOILID IS NOT NULL OR e.ENCOILID IS NOT NULL)
ORDER BY e.INSDATE ASC, e.ENCOILID ASC
</select>
<!-- 查询卷级生产节拍min/吨):(END_DATE - START_DATE)/EXIT_WEIGHT -->
<select id="selectCoilCycleMinPerTon" resultType="java.math.BigDecimal">
SELECT
-- 生产节拍(分钟/吨)
TIMESTAMPDIFF(MINUTE, e.START_DATE, e.END_DATE) / e.EXIT_WEIGHT AS cycle_min_per_ton
FROM klptcm1_pdo_excoil e
WHERE 1 = 1
<if test="startDate != null and startDate != ''">
AND DATE(e.INSDATE) &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
AND DATE(e.INSDATE) &lt;= #{endDate}
</if>
AND e.START_DATE IS NOT NULL
AND e.END_DATE IS NOT NULL
AND e.END_DATE &gt; e.START_DATE
AND e.EXIT_WEIGHT IS NOT NULL
AND e.EXIT_WEIGHT &gt; 0
AND TIMESTAMPDIFF(MINUTE, e.START_DATE, e.END_DATE) &gt; 0
</select>
</mapper>

View File

@@ -1,68 +0,0 @@
<?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.acid.mapper.AcidOeeMasterMapper">
<!-- OEE日汇总结果映射 -->
<resultMap id="AcidOeeDailySummaryResultMap" type="com.klp.pocket.acid.domain.vo.AcidOeeDailySummaryVo">
<result column="stat_date" property="statDate" jdbcType="VARCHAR"/>
<result column="line_id" property="lineId" jdbcType="VARCHAR"/>
<result column="line_name" property="lineName" jdbcType="VARCHAR"/>
<result column="planned_time_min" property="plannedTimeMin" jdbcType="BIGINT"/>
<result column="planned_downtime_min" property="plannedDowntimeMin" jdbcType="BIGINT"/>
<result column="loading_time_min" property="loadingTimeMin" jdbcType="BIGINT"/>
<result column="downtime_min" property="downtimeMin" jdbcType="BIGINT"/>
<result column="run_time_min" property="runTimeMin" jdbcType="BIGINT"/>
<result column="total_output_ton" property="totalOutputTon" jdbcType="DECIMAL"/>
<result column="total_output_coil" property="totalOutputCoil" jdbcType="BIGINT"/>
<result column="good_output_ton" property="goodOutputTon" jdbcType="DECIMAL"/>
<result column="good_output_coil" property="goodOutputCoil" jdbcType="BIGINT"/>
<result column="defect_output_ton" property="defectOutputTon" jdbcType="DECIMAL"/>
<result column="defect_output_coil" property="defectOutputCoil" jdbcType="BIGINT"/>
<result column="ideal_cycle_time_min_per_ton" property="idealCycleTimeMinPerTon" jdbcType="DECIMAL"/>
<result column="ideal_cycle_time_min_per_coil" property="idealCycleTimeMinPerCoil" jdbcType="DECIMAL"/>
</resultMap>
<!-- 查询OEE日汇总总产量统一使用主库 wms_material_coil -->
<select id="selectDailySummary" resultMap="AcidOeeDailySummaryResultMap">
SELECT
DATE_FORMAT(mc.create_time, '%Y-%m-%d') AS stat_date,
'SY' AS line_id,
'酸轧线' AS line_name,
1440 AS planned_time_min,
0 AS planned_downtime_min,
1440 AS loading_time_min,
0 AS downtime_min,
COALESCE(SUM(mc.net_weight), 0) AS total_output_ton,
COUNT(*) AS total_output_coil,
0 AS good_output_ton,
0 AS good_output_coil,
0 AS defect_output_ton,
0 AS defect_output_coil,
NULL AS ideal_cycle_time_min_per_ton,
NULL AS ideal_cycle_time_min_per_coil
FROM wms_material_coil mc
WHERE DATE(mc.create_time) BETWEEN #{startDate} AND #{endDate}
AND mc.create_by = #{createBy}
AND mc.del_flag = 0
AND mc.net_weight IS NOT NULL
AND mc.net_weight > 0
GROUP BY DATE_FORMAT(mc.create_time, '%Y-%m-%d')
</select>
<!-- 查询每日的钢卷号、重量、判级主库wms_material_coil -->
<select id="selectCoilInfoByDate" resultType="com.klp.pocket.acid.domain.vo.AcidOeeCoilInfoByDateVo">
SELECT
DATE_FORMAT(mc.create_time, '%Y-%m-%d') AS statDate,
mc.current_coil_no AS coilNo,
(mc.net_weight) AS weight,
mc.quality_status AS qualityStatus
FROM wms_material_coil mc
WHERE DATE(mc.create_time) BETWEEN #{startDate} AND #{endDate}
AND mc.create_by = #{createBy}
AND mc.del_flag = 0
AND mc.net_weight IS NOT NULL
AND mc.net_weight > 0
</select>
</mapper>

View File

@@ -1,5 +1,5 @@
# 页面标题
VUE_APP_TITLE = 科伦普冷轧涂镀数智运营一体化平台
VUE_APP_TITLE = MES一体化平台
# 开发环境配置
ENV = 'development'

View File

@@ -1,5 +1,5 @@
# 页面标题
VUE_APP_TITLE = 科伦普冷轧涂镀数智运营一体化平台
VUE_APP_TITLE = MES一体化平台
# 生产环境配置
ENV = 'production'

View File

@@ -1,5 +1,5 @@
# 页面标题
VUE_APP_TITLE = 科伦普冷轧涂镀数智运营一体化平台
VUE_APP_TITLE = MES一体化平台
# 开发环境配置
ENV = 'development'

View File

@@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="icon" href="<%= BASE_URL %>favicon.png">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= webpackConfig.name %></title>
<!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
<style>

View File

@@ -1,42 +0,0 @@
import request from '@/utils/request'
export function fetchQuickSheetList(params) {
return request({
url: '/aps/quick-sheet/list',
method: 'get',
params
})
}
export function fetchQuickSheetPreset(params) {
return request({
url: '/aps/quick-sheet/preset',
method: 'get',
params
})
}
export function saveQuickSheet(data) {
return request({
url: '/aps/quick-sheet/save',
method: 'post',
data
})
}
export function exportQuickSheet(params) {
return request({
url: '/aps/quick-sheet/export',
method: 'get',
params,
responseType: 'blob'
})
}
export function deleteQuickSheetRow(quickSheetId) {
return request({
url: '/aps/quick-sheet/delete',
method: 'post',
params: { quickSheetId }
})
}

View File

@@ -8,10 +8,3 @@ export function getAcidTypingPrefill(currentCoilNo) {
})
}
export function getGalvanize1TypingPrefill(params) {
return request({
url: '/pocket/galvanize1/crmPdoExcoil/list',
method: 'get',
params
})
}

View File

@@ -27,16 +27,3 @@ export function delOss(ossId) {
})
}
/**
* 上传文件
*/
export function uploadFile(file) {
const form = new FormData()
form.append('file', file)
return request({
url: '/system/oss/upload',
method: 'post',
data: form,
})
}

View File

@@ -1,62 +0,0 @@
import request from '@/utils/request'
// 查询退火炉列表
export function listAnnealFurnace(query) {
return request({
url: '/wms/anneal/furnace/list',
method: 'get',
params: query
})
}
// 查询退火炉详情
export function getAnnealFurnace(furnaceId) {
return request({
url: '/wms/anneal/furnace/' + furnaceId,
method: 'get'
})
}
// 新增退火炉
export function addAnnealFurnace(data) {
return request({
url: '/wms/anneal/furnace/add',
method: 'post',
data: data
})
}
// 修改退火炉
export function updateAnnealFurnace(data) {
return request({
url: '/wms/anneal/furnace/edit',
method: 'put',
data: data
})
}
// 启用停用
export function changeAnnealFurnaceStatus(data) {
return request({
url: '/wms/anneal/furnace/status',
method: 'put',
data: data
})
}
// 置忙/置闲
export function changeAnnealFurnaceBusy(data) {
return request({
url: '/wms/anneal/furnace/busy',
method: 'put',
data: data
})
}
// 删除退火炉
export function delAnnealFurnace(furnaceId) {
return request({
url: '/wms/anneal/furnace/' + furnaceId,
method: 'delete'
})
}

View File

@@ -1,9 +0,0 @@
import request from '@/utils/request'
// 查询退火总览信息
export function getAnnealOverview() {
return request({
url: '/wms/anneal/overview',
method: 'get'
})
}

View File

@@ -1,10 +0,0 @@
import request from '@/utils/request'
// 查询炉火实绩
export function getAnnealPerformance(query) {
return request({
url: '/wms/anneal/performance',
method: 'get',
params: query
})
}

View File

@@ -1,109 +0,0 @@
import request from '@/utils/request'
// 查询退火计划列表
export function listAnnealPlan(query) {
return request({
url: '/wms/anneal/plan/list',
method: 'get',
params: query
})
}
// 查询退火计划详情
export function getAnnealPlan(planId) {
return request({
url: '/wms/anneal/plan/' + planId,
method: 'get'
})
}
// 新增退火计划
export function addAnnealPlan(data) {
return request({
url: '/wms/anneal/plan/add',
method: 'post',
data: data
})
}
// 修改退火计划
export function updateAnnealPlan(data) {
return request({
url: '/wms/anneal/plan/edit',
method: 'put',
data: data
})
}
// 删除退火计划
export function delAnnealPlan(planId) {
return request({
url: '/wms/anneal/plan/' + planId,
method: 'delete'
})
}
// 更新计划状态
export function changeAnnealPlanStatus(data) {
return request({
url: '/wms/anneal/plan/status',
method: 'put',
data: data
})
}
// 入炉
export function inFurnace(data) {
return request({
url: '/wms/anneal/plan/in-furnace',
method: 'put',
data: data
})
}
// 完成退火
export function completeAnnealPlan(data) {
return request({
url: '/wms/anneal/plan/complete',
method: 'put',
data: data
})
}
// 查询计划钢卷列表
export function listAnnealPlanCoils(planId) {
return request({
url: '/wms/anneal/plan/coil/list',
method: 'get',
params: { planId }
})
}
// 绑定钢卷
export function bindAnnealPlanCoils(data) {
return request({
url: '/wms/anneal/plan/coil/bind',
method: 'post',
data: data
})
}
// 解绑钢卷
export function unbindAnnealPlanCoil(data) {
return request({
url: '/wms/anneal/plan/coil/unbind',
method: 'delete',
data: data
})
}
/**
* 更新钢卷绑定信息
*/
export function updateAnnealPlanCoil(data) {
return request({
url: '/wms/furnacePlanCoil',
method: 'put',
data: data
})
}

View File

@@ -42,27 +42,3 @@ export function delApproval(approvalId) {
method: 'delete'
})
}
/**
* 撤销审批
*/
export function withdrawApproval(approvalId) {
return request({
url: '/wms/approval/cancel',
method: 'post',
params: {
approvalId: approvalId
}
})
}
/**
* 按业务ID查询审批信息用于用印等业务
*/
export function getApprovalByBizId(bizId) {
return request({
url: '/wms/approval/getByBizId',
method: 'get',
params: { bizId }
})
}

View File

@@ -1,5 +1,4 @@
import request from '@/utils/request'
import { tansParams } from "@/utils/klp";
// 查询钢卷物料表列表
export function listMaterialCoil(query) {
@@ -116,8 +115,8 @@ export function splitMaterialCoil(data) {
// 钢卷合卷
export function mergeMaterialCoil(data) {
return request({
url: '/wms/materialCoil/merge',
method: 'post',
url: '/wms/materialCoil',
method: 'put',
data: data
})
}
@@ -190,8 +189,7 @@ export function listCoilWithIds(data) {
return request({
url: '/wms/materialCoil/listByPost',
method: 'post',
data,
timeout: 600000
data
})
}
@@ -204,14 +202,13 @@ export function cancelExportCoil(coilId) {
}
// 检查入场钢卷号或当前钢卷号是否合法(是否存在)
export function checkCoilNo({ currentCoilNo, enterCoilNo, coilId, supplierCoilNo }) {
export function checkCoilNo({ currentCoilNo, enterCoilNo, coilId }) {
return request({
url: '/wms/materialCoil/checkCoilNoDuplicate',
method: 'get',
params: {
currentCoilNo,
enterCoilNo,
supplierCoilNo,
coilId
}
})
@@ -255,19 +252,15 @@ export function restoreMaterialCoil(coilId) {
/**
* 开始分条,锁定钢卷
*/
export function startSpecialSplit(coilId, actionType) {
export function startSpecialSplit(coilId) {
if (!coilId) {
return Promise.reject(new Error('coilId is required'))
}
if (!actionType) {
return Promise.reject(new Error('actionType is required'))
}
return request({
url: '/wms/materialCoil/specialSplit/start',
method: 'post',
params: {
coilId,
actionType
coilId
}
})
}
@@ -352,30 +345,4 @@ export function categoryWidthStatistics() {
url: '/wms/materialCoil/statistics/categoryWidthStatistics',
method: 'get',
})
}
/**
* 导出钢卷的全部字段
*/
export function exportCoilWithAll(data) {
return request({
url: '/wms/materialCoil/exportAll',
method: 'post',
data: data,
transformRequest: [(params) => { return tansParams(params) }],
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
responseType: 'blob'
})
}
/**
* 查询带有发货绑定信息的钢卷
*/
export function listWithBindInfoCoil(params) {
return request({
url: '/wms/materialCoil/listWithBindInfo',
method: 'get',
params,
timeout: 600000
})
}

View File

@@ -42,16 +42,3 @@ export function delCoilStatisticsSummary(summaryId) {
method: 'delete'
})
}
// 检查今天是否已经创建过该类型的透视表
// 如果已经创建过返回该透视表的id
// 如果没有创建过返回null
export function checkCoilStatisticsSummaryExist(statType) {
return request({
url: '/wms/coilStatisticsSummary/checkToday',
method: 'get',
params: {
statType
}
})
}

View File

@@ -1,75 +0,0 @@
import request from '@/utils/request'
// 查询员工异动(入职/离职)列表
export function listEmployeeChange(query) {
return request({
url: '/wms/employeeChange/list',
method: 'get',
params: query
})
}
// 查询员工异动(入职/离职)详细
export function getEmployeeChange(changeId) {
return request({
url: '/wms/employeeChange/' + changeId,
method: 'get'
})
}
// 新增员工异动(入职/离职)
export function addEmployeeChange(data) {
return request({
url: '/wms/employeeChange',
method: 'post',
data: data
})
}
// 修改员工异动(入职/离职)
export function updateEmployeeChange(data) {
return request({
url: '/wms/employeeChange',
method: 'put',
data: data
})
}
// 删除员工异动(入职/离职)
export function delEmployeeChange(changeId) {
return request({
url: '/wms/employeeChange/' + changeId,
method: 'delete'
})
}
// 员工入职
export function employeeEntry(data) {
return request({
url: '/wms/employeeChange/entry',
method: 'post',
data: data
})
}
/**
* 员工离职
*/
export function employeeLeave(data) {
return request({
url: '/wms/employeeChange/leave',
method: 'post',
data: data
})
}
/**
* 员工转正
*/
export function employeeRegular(data) {
return request({
url: '/wms/employeeChange/regular',
method: 'post',
data: data
})
}

View File

@@ -1,53 +0,0 @@
import request from '@/utils/request'
// 查询员工转岗记录列表
export function listEmployeeTransfer(query) {
return request({
url: '/wms/employeeTransfer/list',
method: 'get',
params: query
})
}
// 查询员工转岗记录详细
export function getEmployeeTransfer(transferId) {
return request({
url: '/wms/employeeTransfer/' + transferId,
method: 'get'
})
}
// 新增员工转岗记录
export function addEmployeeTransfer(data) {
return request({
url: '/wms/employeeTransfer',
method: 'post',
data: data
})
}
// 修改员工转岗记录
export function updateEmployeeTransfer(data) {
return request({
url: '/wms/employeeTransfer',
method: 'put',
data: data
})
}
// 删除员工转岗记录
export function delEmployeeTransfer(transferId) {
return request({
url: '/wms/employeeTransfer/' + transferId,
method: 'delete'
})
}
// 员工转岗
export function transferEmployee(data) {
return request({
url: '/wms/employeeTransfer/transfer',
method: 'post',
data: data
})
}

View File

@@ -1,88 +0,0 @@
import request from '@/utils/request'
// 查询打包单据列表
export function listPacking(query) {
return request({
url: '/wms/coilPackingRecord/list',
method: 'get',
params: query
})
}
// 查询打包单据详细
export function getPacking(packingId) {
return request({
url: '/wms/coilPackingRecord/' + packingId,
method: 'get'
})
}
// 新增打包单据
export function addPacking(data) {
return request({
url: '/wms/coilPackingRecord',
method: 'post',
data: data
})
}
// 修改打包单据
export function updatePacking(data) {
return request({
url: '/wms/coilPackingRecord',
method: 'put',
data: data
})
}
// 删除打包单据
export function delPacking(packingId) {
return request({
url: '/wms/coilPackingRecord/' + packingId,
method: 'delete'
})
}
// 查询打包明细列表
export function listPackingDetail(query) {
return request({
url: '/wms/coilPackingDetail/list',
method: 'get',
params: query
})
}
// 新增打包明细
export function addPackingDetail(data) {
return request({
url: '/wms/coilPackingDetail',
method: 'post',
data: data
})
}
// 修改打包明细
export function updatePackingDetail(data) {
return request({
url: '/wms/coilPackingDetail',
method: 'put',
data: data
})
}
// 删除打包明细
export function delPackingDetail(detailId) {
return request({
url: '/wms/coilPackingDetail/' + detailId,
method: 'delete'
})
}
// 创建打包单据及明细
export function createPacking(data) {
return request({
url: '/wms/coilPackingRecord/execute',
method: 'post',
data: data
})
}

View File

@@ -1,288 +0,0 @@
/**
* 打包模块 API 测试用例
* 测试打包单据和明细表相关的 API 接口
*/
import { expect, test, describe, beforeEach, afterEach, jest } from '@jest/globals';
// Mock request 模块
jest.mock('@/utils/request', () => ({
default: jest.fn(() => Promise.resolve({ code: 200, data: {} }))
}));
import {
listPacking,
getPacking,
addPacking,
updatePacking,
delPacking,
listPackingDetail,
listPackedCoil,
addPackingDetail,
updatePackingDetail,
delPackingDetail,
batchAddPackingDetail,
getPackingByNo,
submitPacking,
cancelSubmitPacking
} from './packing';
import request from '@/utils/request';
describe('Packing API Tests', () => {
beforeEach(() => {
jest.clearAllMocks();
});
describe('打包单据主表 API', () => {
test('listPacking - 查询打包单据列表', () => {
const query = {
pageNum: 1,
pageSize: 20,
packingNo: 'PK20260323001'
};
listPacking(query);
expect(request).toHaveBeenCalledWith({
url: '/wms/packing/list',
method: 'get',
params: query
});
});
test('getPacking - 查询单个打包单据详情', () => {
const packingId = '1';
getPacking(packingId);
expect(request).toHaveBeenCalledWith({
url: '/wms/packing/1',
method: 'get'
});
});
test('addPacking - 新增打包单据', () => {
const data = {
batchNo: 'BATCH001',
packingDate: '2026-03-23',
team: '甲',
operator: '张三',
remark: '测试备注'
};
addPacking(data);
expect(request).toHaveBeenCalledWith({
url: '/wms/packing',
method: 'post',
data: data
});
});
test('updatePacking - 修改打包单据', () => {
const data = {
packingId: '1',
batchNo: 'BATCH001',
packingDate: '2026-03-23',
team: '甲',
operator: '张三',
remark: '修改后的备注'
};
updatePacking(data);
expect(request).toHaveBeenCalledWith({
url: '/wms/packing',
method: 'put',
data: data
});
});
test('delPacking - 删除打包单据', () => {
const packingId = '1';
delPacking(packingId);
expect(request).toHaveBeenCalledWith({
url: '/wms/packing/1',
method: 'delete'
});
});
test('getPackingByNo - 根据单据号查询打包单据', () => {
const packingNo = 'PK20260323001';
getPackingByNo(packingNo);
expect(request).toHaveBeenCalledWith({
url: '/wms/packing/no/PK20260323001',
method: 'get'
});
});
test('submitPacking - 提交打包单据', () => {
const packingId = '1';
submitPacking(packingId);
expect(request).toHaveBeenCalledWith({
url: '/wms/packing/submit/1',
method: 'post'
});
});
test('cancelSubmitPacking - 取消提交打包单据', () => {
const packingId = '1';
cancelSubmitPacking(packingId);
expect(request).toHaveBeenCalledWith({
url: '/wms/packing/cancelSubmit/1',
method: 'post'
});
});
});
describe('打包明细表 API', () => {
test('listPackingDetail - 查询打包明细列表', () => {
const query = {
packingId: '1',
pageNum: 1,
pageSize: 20
};
listPackingDetail(query);
expect(request).toHaveBeenCalledWith({
url: '/wms/packingDetail/list',
method: 'get',
params: query
});
});
test('addPackingDetail - 新增打包明细', () => {
const data = {
packingId: '1',
coilId: '1001',
coilNo: '26L0312345',
itemName: '镀锌板',
specification: '1.0*1000*C',
material: 'DX51D+Z',
netWeight: 5.5,
beforePosition: 'A区01号位',
afterPosition: ''
};
addPackingDetail(data);
expect(request).toHaveBeenCalledWith({
url: '/wms/packingDetail',
method: 'post',
data: data
});
});
test('updatePackingDetail - 修改打包明细', () => {
const data = {
detailId: '1',
packingId: '1',
afterPosition: 'B区02号位'
};
updatePackingDetail(data);
expect(request).toHaveBeenCalledWith({
url: '/wms/packingDetail',
method: 'put',
data: data
});
});
test('delPackingDetail - 删除打包明细', () => {
const detailId = '1';
delPackingDetail(detailId);
expect(request).toHaveBeenCalledWith({
url: '/wms/packingDetail/1',
method: 'delete'
});
});
test('batchAddPackingDetail - 批量新增打包明细', () => {
const data = [
{
packingId: '1',
coilId: '1001',
coilNo: '26L0312345',
itemName: '镀锌板',
specification: '1.0*1000*C',
material: 'DX51D+Z',
netWeight: 5.5,
beforePosition: 'A区01号位',
afterPosition: ''
},
{
packingId: '1',
coilId: '1002',
coilNo: '26L0312346',
itemName: '镀锌板',
specification: '1.0*1000*C',
material: 'DX51D+Z',
netWeight: 5.2,
beforePosition: 'A区02号位',
afterPosition: ''
}
];
batchAddPackingDetail(data);
expect(request).toHaveBeenCalledWith({
url: '/wms/packingDetail/batch',
method: 'post',
data: data
});
});
});
describe('已打包钢卷查询 API', () => {
test('listPackedCoil - 查询已打包钢卷列表', () => {
const query = {
pageNum: 1,
pageSize: 20,
packingNo: 'PK20260323001',
batchNo: 'BATCH001',
coilNo: '26L0312345',
team: '甲'
};
listPackedCoil(query);
expect(request).toHaveBeenCalledWith({
url: '/wms/packing/packedCoilList',
method: 'get',
params: query
});
});
test('listPackedCoil - 带日期范围参数查询已打包钢卷', () => {
const query = {
pageNum: 1,
pageSize: 20,
params: {
beginPackingDate: '2026-03-01',
endPackingDate: '2026-03-31'
}
};
listPackedCoil(query);
expect(request).toHaveBeenCalledWith({
url: '/wms/packing/packedCoilList',
method: 'get',
params: query
});
});
});
});

View File

@@ -1,55 +1,11 @@
import request from '@/utils/request'
function parseDate(date) {
// 修复1参数名和内部变量名冲突改用tempDate
// 修复2如果传入的date为空/无效,默认使用当前时间
const tempDate = date ? new Date(date) : new Date();
// 获取年、月、日、时、分、秒(补零处理,确保是两位数)
const year = tempDate.getFullYear();
// 月份从0开始所以要+1不足两位补0
const month = String(tempDate.getMonth() + 1).padStart(2, '0');
const day = String(tempDate.getDate()).padStart(2, '0');
const hours = String(tempDate.getHours()).padStart(2, '0');
const minutes = String(tempDate.getMinutes()).padStart(2, '0');
const seconds = String(tempDate.getSeconds()).padStart(2, '0');
// 格式化为YYYY-mm-dd HH:mm:ss并返回
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
// 查询钢卷待操作列表
export function listPendingAction(query) {
return request({
url: '/wms/coilPendingAction/list',
method: 'get',
params: query,
timeout: 600000
})
}
// 查询钢卷待操作列表(包含已删除记录)
// includeDeleted: 0=不包含已删除(默认), 1=包含已删除记录, 2=仅查询已删除记录
export function listPendingActionWithDeleted(query) {
return request({
url: '/wms/coilPendingAction/list',
method: 'get',
params: {
...query,
includeDeleted: 1
}
})
}
// 仅查询已删除的钢卷待操作列表
export function listDeletedPendingAction(query) {
return request({
url: '/wms/coilPendingAction/list',
method: 'get',
params: {
...query,
includeDeleted: 2
}
params: query
})
}
@@ -63,37 +19,19 @@ export function getPendingAction(actionId) {
// 新增钢卷待操作
export function addPendingAction(data) {
const payload = { ...data }
if (payload.processTime) {
payload.processTime = parseDate(payload.processTime)
}
if (payload.completeTime) {
payload.completeTime = parseDate(payload.completeTime)
}
return request({
url: '/wms/coilPendingAction',
method: 'post',
data: payload
data: data
})
}
// 修改钢卷待操作
export function updatePendingAction(data) {
const payload = { ...data }
if (payload.processTime) {
payload.processTime = parseDate(payload.processTime)
}
if (payload.completeTime) {
payload.completeTime = parseDate(payload.completeTime)
}
if (payload.scanTime) {
// 扫码日期格式化为yyyy-MM-dd'T'HH:mm:ss.SSSX
payload.scanTime = parseDate(payload.scanTime).replace(' ', 'T') + '.000Z'
}
return request({
url: '/wms/coilPendingAction',
method: 'put',
data: payload
data: data
})
}
@@ -146,12 +84,3 @@ export function exportPendingAction(query) {
})
}
/**
* 还原被删除的钢卷
*/
export function restorePendingAction(actionId) {
return request({
url: `/wms/coilPendingAction/restore/${actionId}`,
method: 'put'
})
}

View File

@@ -1,97 +0,0 @@
import request from '@/utils/request'
// 用印申请
export function listSealReq(query) {
return request({
url: '/wms/seal/list',
method: 'get',
params: query
})
}
export function getSealReq(bizId) {
return request({
url: `/wms/seal/${bizId}`,
method: 'get'
})
}
export function addSealReq(data) {
return request({
url: '/wms/seal',
method: 'post',
data
})
}
export function editSealReq(data) {
return request({
url: '/wms/seal',
method: 'put',
data
})
}
export function delSealReq(bizIds) {
return request({
url: `/wms/seal/${bizIds}`,
method: 'delete'
})
}
export function approveSealReq(bizId, approvalOpinion) {
return request({
url: `/wms/seal/${bizId}/approve`,
method: 'post',
params: { approvalOpinion }
})
}
export function rejectSealReq(bizId, approvalOpinion) {
return request({
url: `/wms/seal/${bizId}/reject`,
method: 'post',
params: { approvalOpinion }
})
}
export function cancelSealReq(bizId) {
return request({
url: `/wms/seal/${bizId}/cancel`,
method: 'post'
})
}
export function stampSealJava(bizId, data) {
const payload = {
targetFileUrl: String(data.targetFileUrl || ''),
stampImageUrl: String(data.stampImageUrl || ''),
pageNo: Number(data.pageNo) || 1,
xPx: Number(data.xPx) || 0,
yPx: Number(data.yPx) || 0,
viewportWidth: data.viewportWidth !== undefined && data.viewportWidth !== null ? Number(data.viewportWidth) : undefined,
viewportHeight: data.viewportHeight !== undefined && data.viewportHeight !== null ? Number(data.viewportHeight) : undefined
}
if (data.widthPx !== undefined && data.widthPx !== null) {
payload.widthPx = Number(data.widthPx)
}
if (data.heightPx !== undefined && data.heightPx !== null) {
payload.heightPx = Number(data.heightPx)
}
if (payload.viewportWidth === undefined) delete payload.viewportWidth
if (payload.viewportHeight === undefined) delete payload.viewportHeight
return request({
url: `/wms/seal/${bizId}/stamp/java`,
method: 'post',
data: payload
})
}
export function stampSealPython(bizId, data) {
return request({
url: `/wms/seal/${bizId}/stamp/python`,
method: 'post',
data
})
}

View File

@@ -1 +0,0 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1773478276971" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="13723" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M630.568421 619.789474h-239.831579c-10.778947 0-18.863158 8.084211-18.863158 18.863158s8.084211 18.863158 18.863158 18.863157h239.831579c10.778947 0 18.863158-8.084211 18.863158-18.863157s-8.084211-18.863158-18.863158-18.863158z" fill="#101010" p-id="13724"></path><path d="M986.273684 714.105263l-78.147368-164.378947c-5.389474-13.473684-18.863158-21.557895-32.336842-21.557895H808.421053V115.873684c0-16.168421-13.473684-29.642105-29.642106-29.642105h-99.705263c-18.863158 0-32.336842 13.473684-32.336842 32.336842v24.252632h-48.505263v-24.252632c0-18.863158-13.473684-32.336842-32.336842-32.336842h-102.4c-18.863158 0-32.336842 13.473684-32.336842 32.336842v24.252632h-48.505263v-24.252632c0-18.863158-13.473684-32.336842-32.336843-32.336842H247.915789c-16.168421 0-29.642105 13.473684-29.642105 29.642105v414.989474H150.905263c-13.473684 0-26.947368 8.084211-32.336842 21.557895l-78.147368 164.378947c-2.694737 5.389474-2.694737 10.778947-2.694737 16.168421v177.852632c0 16.168421 13.473684 29.642105 29.642105 29.642105h164.378947c10.778947 0 21.557895-5.389474 29.642106-13.473684l37.726315-45.810527h431.157895l37.726316 48.505264c8.084211 8.084211 16.168421 13.473684 29.642105 13.473684h164.378948c16.168421 0 29.642105-13.473684 29.642105-29.642106v-177.852631c-2.694737-10.778947-2.694737-16.168421-5.389474-21.557895zM512 840.757895h-158.989474l21.557895-88.926316h269.473684l24.252632 88.926316H512z m137.431579-129.347369H369.178947l-97.010526-142.821052H749.136842l-99.705263 142.821052zM256 123.957895h86.231579v24.252631c0 18.863158 13.473684 32.336842 32.336842 32.336842h59.284211c18.863158 0 32.336842-13.473684 32.336842-32.336842v-24.252631h91.621052v24.252631c0 18.863158 13.473684 32.336842 32.336842 32.336842h59.284211c18.863158 0 32.336842-13.473684 32.336842-32.336842v-24.252631h86.231579v406.905263h-512V123.957895z m8.084211 730.273684l-37.726316 45.810526H72.757895v-169.768421l78.147368-161.68421h75.452632l113.178947 167.073684-26.947368 105.094737h-18.863158c-10.778947 0-21.557895 2.694737-29.642105 13.473684z m687.157894 45.810526h-153.6l-37.726316-48.505263c-8.084211-8.084211-16.168421-13.473684-29.642105-13.473684h-24.252631l-29.642106-105.094737 118.568421-167.073684h78.147369l78.147368 164.378947v169.768421z" fill="#101010" p-id="13725"></path><path d="M563.2 476.968421c24.252632-21.557895 32.336842-53.894737 29.642105-78.147368-2.694737-13.473684-8.084211-21.557895-18.863158-24.252632-8.084211-2.694737-16.168421 0-21.557894 2.694737l-2.694737 2.694737c-2.694737 2.694737-8.084211 8.084211-10.778948 8.08421 0 0 0-2.694737 2.694737-8.08421l2.694737-2.694737c5.389474-10.778947 18.863158-48.505263-32.336842-75.452632-5.389474-2.694737-10.778947-2.694737-16.168421 0-5.389474 2.694737-8.084211 8.084211-10.778947 13.473685 0 5.389474-2.694737 13.473684-2.694737 16.168421-2.694737 2.694737-10.778947 13.473684-16.168421 21.557894-10.778947 10.778947-18.863158 21.557895-24.252632 29.642106-8.084211 10.778947-10.778947 40.421053 0 64.673684 5.389474 16.168421 21.557895 35.031579 53.894737 43.115789 8.084211 2.694737 13.473684 2.694737 18.863158 2.694737 16.168421 2.694737 35.031579-2.694737 48.505263-16.168421z m-61.978947-18.863158c-13.473684-2.694737-21.557895-10.778947-26.947369-18.863158-5.389474-13.473684-2.694737-29.642105 0-32.336842 2.694737-5.389474 13.473684-16.168421 18.863158-24.252631 10.778947-13.473684 16.168421-18.863158 18.863158-24.252632 0 2.694737 0 5.389474-2.694737 8.084211v2.694736c-5.389474 10.778947-10.778947 21.557895-5.389474 40.421053 0 2.694737 2.694737 2.694737 2.694737 5.389474 10.778947 13.473684 24.252632 18.863158 32.336842 18.863158 5.389474 0 10.778947 0 13.473685-2.694737-2.694737 8.084211-8.084211 16.168421-13.473685 21.557894-10.778947 5.389474-24.252632 8.084211-37.726315 5.389474z" fill="#101010" p-id="13726"></path><path d="M417.684211 458.105263h-37.726316v-185.936842h264.08421V458.105263h-37.726316c-10.778947 0-18.863158 8.084211-18.863157 18.863158s8.084211 18.863158 18.863157 18.863158H646.736842c18.863158 0 35.031579-16.168421 35.031579-35.031579V269.473684c0-18.863158-16.168421-35.031579-35.031579-35.031579H377.263158c-18.863158 0-35.031579 16.168421-35.031579 35.031579v194.021053c0 18.863158 16.168421 35.031579 35.031579 35.031579h40.421053c10.778947 0 18.863158-8.084211 18.863157-18.863158s-8.084211-21.557895-18.863157-21.557895z" fill="#101010" p-id="13727"></path></svg>

Before

Width:  |  Height:  |  Size: 4.6 KiB

View File

@@ -1 +0,0 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1774233338203" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5413" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M966.208 246.752L534.144 21.408a47.968 47.968 0 0 0-44.128-0.128L58.08 243.136A47.968 47.968 0 0 0 32 285.824V744.64c0 18.208 10.304 34.848 26.592 42.976l432 215.36a48 48 0 0 0 42.816 0l432-215.36A48 48 0 0 0 992 744.672V289.344c0-17.92-9.952-34.304-25.792-42.592zM508.384 463.68l-162.176-79.808 367.36-196.704 158.4 82.624-363.584 193.888z m3.488-381.696l132.992 69.376-369.312 197.76-144.896-71.328 381.216-195.808zM96 332.096l153.216 75.392v168.256a32 32 0 0 0 64 0v-136.736L480 521.024v405.184L96 734.752V332.096z m448 594.112V517.184l384-204.736v422.304l-384 191.456z" p-id="5414"></path></svg>

Before

Width:  |  Height:  |  Size: 932 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -18,9 +18,9 @@
</div>
<el-dialog title="选择钢卷" :visible.sync="dialogVisible" :width="dialogWidth" :close-on-click-modal="false"
@close="handleClose" append-to-body :fullscreen="orderBy">
@close="handleClose" append-to-body>
<!-- 搜索区域 -->
<el-form v-if="!rangeMode" inline :model="queryParams" class="search-form">
<el-form v-if="!rangeMode" :model="queryParams" class="search-form">
<!-- <el-form-item label="类型">
<el-select v-model="queryParams.selectType" placeholder="请选择类型" size="small">
<el-option label="成品" value="product" />
@@ -62,13 +62,12 @@
</el-form-item>
<el-form-item label="实际库区" v-if="orderBy">
<actual-warehouse-select v-model="queryParams.actualWarehouseId" placeholder="请选择实际库区" canSelectLevel2
canSelectDisabled :clearInput="false" clearable />
canSelectDisabled />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="small" @click="resetQuery">重置</el-button>
<el-checkbox v-if="orderBy" style="margin-left: 10px;" v-model="showCoilMap" size="small">显示钢卷地图</el-checkbox>
</el-form-item>
</el-form>
@@ -78,7 +77,6 @@
<!-- 自定义列 -->
<el-table-column v-for="column in renderColumns" :label="column.label" :align="column.align" :prop="column.prop"
:width="column.width" :show-overflow-tooltip="column.showOverflowTooltip" />
<el-table-column v-if="orderBy" label="品质" prop="qualityStatus"></el-table-column>
<el-table-column v-if="orderBy" label="切边" prop="trimmingRequirement"></el-table-column>
<el-table-column v-if="orderBy" label="包装" prop="packagingRequirement"></el-table-column>
</el-table>
@@ -95,7 +93,6 @@
<!-- 自定义列 -->
<el-table-column v-for="column in renderColumns" :label="column.label" :align="column.align"
:prop="column.prop" :width="column.width" :show-overflow-tooltip="column.showOverflowTooltip" />
<el-table-column v-if="orderBy" label="品质" prop="qualityStatus"></el-table-column>
<el-table-column v-if="orderBy" label="切边" prop="trimmingRequirement"></el-table-column>
<el-table-column v-if="orderBy" label="包装" prop="packagingRequirement"></el-table-column>
</el-table>
@@ -105,23 +102,9 @@
<pagination v-if="!rangeMode" v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" @pagination="getList" />
<div v-if="multiple && selectedCoils.length > 0" class="selected-stats">
<div class="stats-content">
<div class="stat-item">
<span class="stat-label">总卷数</span>
<span class="stat-value">{{ totalCoils }}</span>
</div>
<div class="stat-item">
<span class="stat-label">总净重</span>
<span class="stat-value">{{ totalNetWeight }}t</span>
</div>
</div>
</div>
<el-table v-if="multiple && selectedCoils.length > 0" :data="selectedCoils">
<el-table-column v-for="column in renderColumns" :label="column.label" :align="column.align" :prop="column.prop"
:width="column.width" :show-overflow-tooltip="column.showOverflowTooltip" />
<el-table-column v-if="orderBy" label="品质" prop="qualityStatus"></el-table-column>
<el-table-column label="操作" width="50">
<template slot-scope="scope">
@@ -134,42 +117,23 @@
<el-button type="primary" @click="handleConfirm">确认选择</el-button>
<el-button @click="handleClose">取消</el-button>
</div>
<!-- 一个可以拖拽和调节大小的浮层 -->
<DragResizeBox v-if="showCoilMap" @size-change="handleSizeChange" storageKey="coil-map">
<div style="height: 100%; width: 100%; overflow-y: scroll; display: flex; background-color: #fff;">
<div style="min-width: 150px; position: sticky; top: 0;" v-loading="treeLoading">
<el-tree ref="warehouseTreeRef" :data="warehouseTree" :props="treeProps" node-key="actualWarehouseId"
@node-click="handleNodeClick" :expand-on-click-node="false" highlight-current class="warehouse-tree">
</el-tree>
</div>
<warehouse-bird-mini ref="warehouseBirdMini" v-loading="warehouseLoading" :warehouseList="warehouseList"
:id="selectedNodeId" :canToggle="false" :canRelease="false" />
</div>
</DragResizeBox>
</el-dialog>
</div>
</template>
<script>
import { listMaterialCoil } from '@/api/wms/coil';
import { listActualWarehouse } from "@/api/wms/actualWarehouse";
import { treeActualWarehouseTwoLevel } from "@/api/wms/actualWarehouse";
import MemoInput from '@/components/MemoInput/index.vue';
import MutiSelect from '@/components/MutiSelect/index.vue';
import { defaultColumns } from './data';
import ActualWarehouseSelect from '@/components/KLPService/ActualWarehouseSelect/index.vue';
import WarehouseBirdMini from '@/views/wms/warehouse/components/WarehouseBirdMini.vue';
import DragResizeBox from '@/components/DragResizeBox/index.vue';
export default {
name: 'CoilSelector',
components: {
MemoInput,
MutiSelect,
ActualWarehouseSelect,
WarehouseBirdMini,
DragResizeBox
ActualWarehouseSelect
},
dicts: ['coil_itemname', 'coil_material', 'coil_manufacturer'],
props: {
@@ -232,16 +196,10 @@ export default {
multiple: {
type: Boolean,
default: false
},
// 是否禁用O卷
disableO: {
type: Boolean,
default: false
},
}
},
data() {
return {
showCoilMap: false,
loading: false,
coilList: [],
total: 0,
@@ -265,12 +223,6 @@ export default {
columns: defaultColumns,
currentTab: 'my',
selectedCoils: [],
warehouseList: [],
selectedNodeId: null,
warehouseLoading: false,
warehouseTree: [],
treeProps: { label: "actualWarehouseName", children: "children" },
treeLoading: false,
};
},
computed: {
@@ -308,17 +260,6 @@ export default {
} else {
return this.selectedCoil ? new Set([this.selectedCoil.coilId]) : new Set();
}
},
// 已选钢卷总数量
totalCoils() {
return this.selectedCoils.length;
},
// 已选钢卷总净重
totalNetWeight() {
return this.selectedCoils.reduce((total, item) => {
const weight = parseFloat(item.netWeight) || 0;
return total + weight;
}, 0).toFixed(2);
}
},
watch: {
@@ -342,7 +283,7 @@ export default {
// 同步到v-model
if (this.useTrigger && val.coilId) {
this.$emit('input', val.coilId);
this.$emit('change', val.coilId, val);
this.$emit('change', val.coilId);
}
}
},
@@ -363,56 +304,8 @@ export default {
if (this.initialCoil) {
this.selectedCoil = this.initialCoil;
}
if (this.orderBy) {
this.getWarehouseTree();
}
},
methods: {
// 获取库位列表
getWarehouseList(parentId) {
this.warehouseLoading = true;
return listActualWarehouse({ parentId })
.then((res) => { this.warehouseList = res.data || []; this.warehouseLoading = false; })
.catch((err) => {
this.$message.error("获取库位数据失败:" + err.message);
this.warehouseList = [];
this.warehouseLoading = false;
});
},
handleNodeClick(data) {
console.log('data', data);
if (data.actualWarehouseType != 2) {
return;
}
this.selectedNodeId = data.actualWarehouseId;
this.getWarehouseList(data.actualWarehouseId);
},
// 获取树形数据
getWarehouseTree() {
this.treeLoading = true;
treeActualWarehouseTwoLevel()
.then((res) => { this.warehouseTree = res.data || []; })
.catch((err) => { this.$message.error("获取仓库树形数据失败:" + err.message); })
.finally(() => { this.treeLoading = false; });
},
// 处理大小变化
handleSizeChange(size) {
console.log('size', size);
this.$refs.warehouseBirdMini.resize();
},
// 处理实际库区选择变化
handleWarehouseChange(val) {
console.log('val', val);
if (!val) {
this.selectedNodeId = null;
this.warehouseList = [];
return;
}
if (val.pathIds.length == 2) {
this.selectedNodeId = val;
this.getWarehouseList(val.id);
}
},
// 动态生成表格行类名 - 综合处理选中、禁用等状态
getRowClassName({ row }) {
const classNames = [];
@@ -518,10 +411,6 @@ export default {
this.$message.warning('您没有权限选择此钢卷');
return; // 终止后续逻辑
}
if (this.disableO && row.qualityStatus == 'O') {
this.$message.warning('O卷不能选择');
return;
}
this.handleSelect(row);
},
@@ -553,7 +442,7 @@ export default {
// 触发器模式下支持v-model双向绑定
if (this.useTrigger) {
this.$emit('input', row.coilId);
this.$emit('change', row.coilId, row); // 兼容v-model的change事件
this.$emit('change', row.coilId); // 兼容v-model的change事件
}
// 选择后关闭对话框
this.handleClose();
@@ -564,7 +453,7 @@ export default {
this.selectedCoil = null;
this.selectedCoils = []; // 清空多选数据
this.$emit('input', '');
this.$emit('change', '', null); // 兼容v-model的change事件
this.$emit('change', '');
this.$emit('clear', true); // 触发清除事件
},
@@ -650,6 +539,13 @@ export default {
margin-top: 4px;
}
.search-form {
margin-bottom: 20px;
display: flex;
align-items: center;
gap: 16px;
}
::v-deep .el-dialog__body {
padding: 20px;
max-height: calc(100vh - 200px);
@@ -716,31 +612,6 @@ export default {
text-align: right;
}
// 已选钢卷统计信息样式
.selected-stats {
.stats-content {
display: flex;
gap: 24px;
.stat-item {
display: flex;
align-items: center;
gap: 8px;
.stat-label {
color: #666;
font-size: 14px;
}
.stat-value {
color: #333;
font-size: 16px;
font-weight: 600;
}
}
}
}
// 响应式调整
@media (max-width: 768px) {
.selected-coil-info {

View File

@@ -1,301 +0,0 @@
<template>
<div class="drag-resize-container" ref="containerRef">
<!-- 可拖拽调整的元素 -->
<div
class="draggable-element"
ref="elementRef"
:style="{
left: `${position.x}px`,
top: `${position.y}px`,
width: `${size.width}px`,
height: `${size.height}px`
}"
@mousedown="startDrag"
>
<!-- 元素内容区 -->
<div class="element-content">
<slot>可拖拽调整的元素</slot>
</div>
<!-- 右下角调整大小的控制点 -->
<div class="resize-handle" @mousedown="startResize"></div>
</div>
</div>
</template>
<script>
export default {
name: 'DragResizeBox',
props: {
// 初始位置
initPosition: {
type: Object,
default: () => ({ x: 100, y: 100 })
},
// 初始尺寸
initSize: {
type: Object,
default: () => ({ width: 200, height: 150 })
},
// 移除容器尺寸限制保留prop但默认值改为屏幕尺寸
containerSize: {
type: Object,
default: () => ({
width: window.innerWidth,
height: window.innerHeight
})
},
// 元素最小尺寸
minSize: {
type: Object,
default: () => ({ width: 100, height: 80 })
},
// 用于localStorage存储的唯一标识
storageKey: {
type: String,
default: ''
}
},
data() {
return {
// 当前位置
position: { x: 0, y: 0 },
// 当前尺寸
size: { width: 0, height: 0 },
// 拖拽状态
isDragging: false,
// 调整大小状态
isResizing: false,
// 鼠标初始位置
startMouse: { x: 0, y: 0 },
// 元素初始状态
startState: { x: 0, y: 0, width: 0, height: 0 }
};
},
mounted() {
// 初始化位置和尺寸优先从localStorage读取
this.initFromStorage();
// 监听全局鼠标移动和松开事件
document.addEventListener('mousemove', this.handleMouseMove);
document.addEventListener('mouseup', this.handleMouseUp);
// 监听窗口大小变化,更新屏幕尺寸
window.addEventListener('resize', this.updateScreenSize);
},
beforeDestroy() {
// 移除全局事件监听,防止内存泄漏
document.removeEventListener('mousemove', this.handleMouseMove);
document.removeEventListener('mouseup', this.handleMouseUp);
window.removeEventListener('resize', this.updateScreenSize);
},
methods: {
/**
* 从localStorage初始化位置和尺寸
* 有key时优先读取存储值无则使用props传入的初始值
*/
initFromStorage() {
if (this.storageKey) {
try {
const storageKey = `dnd-ps-${this.storageKey}`;
const storedData = localStorage.getItem(storageKey);
if (storedData) {
const { position, size } = JSON.parse(storedData);
// 验证存储的数据是否合法,防止异常值
const isValidPosition = position && typeof position.x === 'number' && typeof position.y === 'number';
const isValidSize = size && typeof size.width === 'number' && typeof size.height === 'number';
if (isValidPosition && isValidSize) {
// 使用存储的位置和尺寸(确保不小于最小尺寸)
this.position = {
x: Math.max(0, position.x),
y: Math.max(0, position.y)
};
this.size = {
width: Math.max(this.minSize.width, size.width),
height: Math.max(this.minSize.height, size.height)
};
return;
}
}
} catch (error) {
console.warn('读取拖拽元素存储数据失败,使用默认值:', error);
}
}
// 无存储数据或存储异常时使用props初始值
this.position = { ...this.initPosition };
this.size = { ...this.initSize };
},
/**
* 将当前位置和尺寸保存到localStorage
*/
saveToStorage() {
if (this.storageKey) {
try {
const storageKey = `dnd-ps-${this.storageKey}`;
const saveData = {
position: { ...this.position },
size: { ...this.size },
updateTime: new Date().getTime()
};
console.log('saveData', saveData);
localStorage.setItem(storageKey, JSON.stringify(saveData));
// 触发存储成功事件
this.$emit('save-success', saveData);
} catch (error) {
console.error('保存拖拽元素数据失败:', error);
this.$emit('save-fail', error);
}
}
},
/**
* 更新屏幕尺寸(窗口大小变化时)
*/
updateScreenSize() {
this.containerSize = {
width: window.innerWidth,
height: window.innerHeight
};
},
/**
* 开始拖拽(移动位置)
*/
startDrag(e) {
// 阻止事件冒泡,避免和调整大小冲突
if (e.target.classList.contains('resize-handle')) return;
this.isDragging = true;
// 记录鼠标初始位置
this.startMouse = { x: e.clientX, y: e.clientY };
// 记录元素初始位置
this.startState = {
x: this.position.x,
y: this.position.y,
width: this.size.width,
height: this.size.height
};
// 更改鼠标样式
document.body.style.cursor = 'move';
},
/**
* 开始调整大小
*/
startResize(e) {
e.stopPropagation(); // 阻止事件冒泡
this.isResizing = true;
// 记录鼠标初始位置
this.startMouse = { x: e.clientX, y: e.clientY };
// 记录元素初始尺寸
this.startState = {
x: this.position.x,
y: this.position.y,
width: this.size.width,
height: this.size.height
};
// 更改鼠标样式
document.body.style.cursor = 'se-resize';
},
/**
* 处理鼠标移动
*/
handleMouseMove(e) {
if (this.isDragging) {
// 计算鼠标移动的偏移量
const dx = e.clientX - this.startMouse.x;
const dy = e.clientY - this.startMouse.y;
// 核心修改:移除容器边界限制,仅限制不超出屏幕左侧/顶部(右侧/底部可任意移动)
this.position.x = Math.max(0, this.startState.x + dx);
this.position.y = Math.max(0, this.startState.y + dy);
// 触发位置变化事件
this.$emit('position-change', { ...this.position });
}
if (this.isResizing) {
// 计算鼠标移动的偏移量
const dx = e.clientX - this.startMouse.x;
const dy = e.clientY - this.startMouse.y;
// 调整大小仅限制最小尺寸,不限制屏幕边界
this.size.width = Math.max(this.minSize.width, this.startState.width + dx);
this.size.height = Math.max(this.minSize.height, this.startState.height + dy);
// 触发尺寸变化事件
this.$emit('size-change', { ...this.size });
}
},
/**
* 处理鼠标松开
*/
handleMouseUp() {
// 重置状态
this.isDragging = false;
this.isResizing = false;
// 恢复鼠标样式
document.body.style.cursor = 'default';
// 保存当前状态到localStorage有key时
this.saveToStorage();
// 触发结束事件
this.$emit('drag-end', { position: { ...this.position }, size: { ...this.size } });
}
}
};
</script>
<style scoped>
/* 容器样式:改为全屏且无视觉样式 */
.drag-resize-container {
position: fixed; /* 固定定位覆盖整个屏幕 */
top: 0;
left: 0;
width: 100vw;
height: 100vh;
pointer-events: none; /* 容器不拦截鼠标事件,不影响页面其他元素 */
box-sizing: border-box;
}
/* 可拖拽元素样式fixed定位确保基于屏幕移动 */
.draggable-element {
position: fixed;
border-radius: 4px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
user-select: none; /* 禁止文本选中 */
box-sizing: border-box;
overflow: hidden;
pointer-events: auto; /* 元素本身响应鼠标事件 */
z-index: 99999; /* 确保元素在最上层 */
background-color: #ffffff; /* 添加背景色,提升可视性 */
}
/* 元素内容区 */
.element-content {
height: calc(100% - 20px);
padding: 10px;
cursor: move;
}
/* 调整大小控制点 */
.resize-handle {
position: absolute;
right: 0;
bottom: 0;
width: 20px;
height: 20px;
background-color: #1e88e5;
cursor: se-resize;
border-top-left-radius: 4px;
}
/* 控制点hover效果 */
.resize-handle:hover {
background-color: #1976d2;
}
</style>

Some files were not shown because too many files have changed in this diff Show More