diff --git a/klp-admin/src/main/java/com/klp/framework/client/SqlServerApiClient.java b/klp-admin/src/main/java/com/klp/framework/client/SqlServerApiClient.java index 9d585618..29800020 100644 --- a/klp-admin/src/main/java/com/klp/framework/client/SqlServerApiClient.java +++ b/klp-admin/src/main/java/com/klp/framework/client/SqlServerApiClient.java @@ -466,6 +466,36 @@ public class SqlServerApiClient { return executeSql("oracle", sql.toString(), params); } + public ExecuteSqlResponse queryExcoilByTimeRange(String startTime, String endTime) { + Map params = new java.util.HashMap<>(); + StringBuilder sql = new StringBuilder("SELECT * FROM JXPLTCM.PLTCM_PDO_EXCOIL WHERE 1=1"); + if (startTime != null && !startTime.trim().isEmpty()) { + sql.append(" AND END_DATE >= TO_DATE(:startTime, 'YYYY-MM-DD HH24:MI:SS')"); + params.put("startTime", startTime.trim()); + } + if (endTime != null && !endTime.trim().isEmpty()) { + sql.append(" AND END_DATE <= TO_DATE(:endTime, 'YYYY-MM-DD HH24:MI:SS')"); + params.put("endTime", endTime.trim()); + } + sql.append(" ORDER BY END_DATE DESC"); + return executeSql("oracle", sql.toString(), params); + } + +// public ExecuteSqlResponse queryExcoilByInsdateRange(String startTime, String endTime) { +// Map params = new java.util.HashMap<>(); +// StringBuilder sql = new StringBuilder("SELECT * FROM JXPLTCM.PLTCM_PDO_EXCOIL WHERE 1=1"); +// if (startTime != null && !startTime.trim().isEmpty()) { +// sql.append(" AND INSDATE > TO_DATE(:startTime, 'YYYY-MM-DD HH24:MI:SS')"); +// params.put("startTime", startTime.trim()); +// } +// if (endTime != null && !endTime.trim().isEmpty()) { +// sql.append(" AND INSDATE <= TO_DATE(:endTime, 'YYYY-MM-DD HH24:MI:SS')"); +// params.put("endTime", endTime.trim()); +// } +// sql.append(" ORDER BY INSDATE ASC"); +// return executeSql("oracle", sql.toString(), params); +// } + public ExecuteSqlResponse queryExcoilList(int page, int pageSize) { int endRow = page * pageSize; int startRow = endRow - pageSize; diff --git a/klp-admin/src/main/java/com/klp/framework/controller/CoilComparisonController.java b/klp-admin/src/main/java/com/klp/framework/controller/CoilComparisonController.java new file mode 100644 index 00000000..86f3ee46 --- /dev/null +++ b/klp-admin/src/main/java/com/klp/framework/controller/CoilComparisonController.java @@ -0,0 +1,177 @@ +package com.klp.framework.controller; + +import com.klp.common.core.domain.R; +import com.klp.domain.bo.WmsMaterialCoilBo; +import com.klp.domain.vo.WmsMaterialCoilVo; +import com.klp.framework.service.SqlServerApiBusinessService; +import com.klp.service.IWmsMaterialCoilService; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +@RequiredArgsConstructor +@RestController +@RequestMapping("/wms/coil-comparison") +public class CoilComparisonController { + + private final SqlServerApiBusinessService sqlServerService; + private final IWmsMaterialCoilService wmsMaterialCoilService; + + /** + * 获取钢卷状态信息接口 + * 根据时间范围、产线类型查询钢卷状态,并关联本地系统中的钢卷信息 + * + * @param startTime 开始时间(可选) + * @param endTime 结束时间(可选) + * @param lineType 产线类型(可选) + * @return 返回包含钢卷状态信息的列表,每个钢卷信息包含外系统和本系统的相关数据 + */ + @GetMapping("/excoil-status") + public R>> getExcoilStatus( + @RequestParam(required = false) String startTime, + @RequestParam(required = false) String endTime, + @RequestParam(required = false) String lineType) { + + // 默认时间为今天 + if (startTime == null || startTime.trim().isEmpty()) { + startTime = LocalDate.now().toString() + " 00:00:00"; + } + if (endTime == null || endTime.trim().isEmpty()) { + endTime = LocalDate.now().toString() + " 23:59:59"; + } + // 从SQL Server服务获取指定时间范围内的钢卷数据 + List> excoilRows = sqlServerService.getExcoilByTimeRange(startTime, endTime); + + // 构建查询条件,查询本地系统中的热轧卷板原料信息 + WmsMaterialCoilBo bo = new WmsMaterialCoilBo(); + bo.setItemType("raw_material"); + bo.setMaterialType("原料"); + bo.setItemName("热轧卷板"); + bo.setSelectType("raw_material"); + List localCoils = wmsMaterialCoilService.queryList(bo); + + // 将本地钢卷数据以钢卷号为key存入Map,便于后续查找 + Map localMap = new HashMap<>(); + for (WmsMaterialCoilVo coil : localCoils) { + if (coil.getEnterCoilNo() != null) { + localMap.put(coil.getEnterCoilNo(), coil); + } + } + + // 处理结果集,将外系统和本地系统的钢卷信息合并 + List> result = new ArrayList<>(); + for (Map excoil : excoilRows) { + // 获取热轧卷ID + String hotCoilId = excoil.get("hot_coilid") != null ? String.valueOf(excoil.get("hot_coilid")) : null; + // 创建结果项 + Map item = new LinkedHashMap<>(); + // 添加外系统基本信息 + item.put("excoilId", excoil.get("encoilid")); + item.put("hotCoilId", hotCoilId); + item.put("endDate", excoil.get("end_date")); + item.put("startDate", excoil.get("start_date")); + item.put("excoilid", excoil.get("excoilid")); + item.put("grade", excoil.get("grade")); + item.put("status", excoil.get("status")); + item.put("shift", excoil.get("shift")); + item.put("crew", excoil.get("crew")); + item.put("entryThick", excoil.get("entry_thick")); + item.put("entryWeight", excoil.get("entry_weight")); + item.put("entryWidth", excoil.get("entry_width")); + item.put("exitThick", excoil.get("exit_thick")); + item.put("exitWidth", excoil.get("exit_width")); + item.put("exitLength", excoil.get("exit_length")); + item.put("exitNegDev", excoil.get("exit_neg_dev")); + item.put("exitPosDev", excoil.get("exit_pos_dev")); + item.put("calcExitWeight", excoil.get("calc_exit_weight")); + item.put("measExitWeight", excoil.get("meas_exit_weight")); + item.put("quality", excoil.get("quality")); + item.put("shapeQuality", excoil.get("shape_quality")); + item.put("orderQuality", excoil.get("order_quality")); + item.put("productType", excoil.get("product_type")); + item.put("parkType", excoil.get("park_type")); + item.put("sideTrim", excoil.get("side_trim")); + item.put("innerDiameter", excoil.get("inner_diameter")); + item.put("outerDiameter", excoil.get("outer_diameter")); + item.put("headpos", excoil.get("headpos")); + item.put("tailpos", excoil.get("tailpos")); + item.put("subid", excoil.get("subid")); + item.put("rn", excoil.get("rn")); + item.put("comments", excoil.get("comments")); + item.put("reportFlag", excoil.get("report_flag")); + item.put("usedEntryWeight", excoil.get("used_entry_weight")); + item.put("onlineDate", excoil.get("online_date")); + item.put("insdate", excoil.get("insdate")); + item.put("weldedDate", excoil.get("welded_date")); + + // 如果存在热轧卷ID,则尝试匹配本地系统数据 + if (hotCoilId != null) { + WmsMaterialCoilVo matched = localMap.get(hotCoilId); + if (matched != null) { + // 匹配成功,添加本地系统数据 + item.put("enterCoilNo", matched.getEnterCoilNo()); + item.put("currentCoilNo", matched.getCurrentCoilNo()); + item.put("supplierCoilNo", matched.getSupplierCoilNo()); + item.put("dataType", matched.getDataType()); + item.put("itemName", matched.getItemName()); + item.put("itemCode", matched.getItemCode()); + item.put("specification", matched.getSpecification()); + item.put("material", matched.getMaterial()); + item.put("manufacturer", matched.getManufacturer()); + item.put("coilStatus", matched.getStatus()); + item.put("warehouseName", matched.getWarehouseName()); + // 根据数据类型设置匹配状态 + if (matched.getDataType() != null && matched.getDataType() == 0) { + item.put("matchStatus", 0); + item.put("matchStatusDesc", "已加工"); + } else { + item.put("matchStatus", 1); + item.put("matchStatusDesc", "未加工"); + } + } else { + // 未匹配到本地数据,设置为未入库状态 + item.put("enterCoilNo", null); + item.put("currentCoilNo", null); + item.put("supplierCoilNo", null); + item.put("dataType", null); + item.put("itemName", null); + item.put("itemCode", null); + item.put("specification", null); + item.put("material", null); + item.put("manufacturer", null); + item.put("coilStatus", null); + item.put("warehouseName", null); + item.put("matchStatus", 2); + item.put("matchStatusDesc", "未入库"); + } + } else { + // 热轧卷ID为空,设置为未入库状态 + item.put("enterCoilNo", null); + item.put("currentCoilNo", null); + item.put("supplierCoilNo", null); + item.put("dataType", null); + item.put("itemName", null); + item.put("itemCode", null); + item.put("specification", null); + item.put("material", null); + item.put("manufacturer", null); + item.put("coilStatus", null); + item.put("warehouseName", null); + item.put("matchStatus", 2); + item.put("matchStatusDesc", "未入库"); + } + result.add(item); + } + + return R.ok(result); + } +} diff --git a/klp-admin/src/main/java/com/klp/framework/service/SqlServerApiBusinessService.java b/klp-admin/src/main/java/com/klp/framework/service/SqlServerApiBusinessService.java index afd11e7f..2565fe79 100644 --- a/klp-admin/src/main/java/com/klp/framework/service/SqlServerApiBusinessService.java +++ b/klp-admin/src/main/java/com/klp/framework/service/SqlServerApiBusinessService.java @@ -199,6 +199,20 @@ public class SqlServerApiBusinessService { public List> getExitTrace() { return exitTrace; } } + /** + * 出口卷实绩列表(按时间段),来自 PLTCM_PDO_EXCOIL。 + */ + public List> getExcoilByTimeRange(String startTime, String endTime) { + return asRowList(client.queryExcoilByTimeRange(startTime, endTime)); + } + +// /** +// * 出口卷实绩列表(按数据写入时间),用于增量同步。 +// */ +// public List> getExcoilByInsdateRange(String startTime, String endTime) { +// return asRowList(client.queryExcoilByInsdateRange(startTime, endTime)); +// } + /** * 出口卷实绩列表(分页),来自 PLTCM_PDO_EXCOIL。 */ diff --git a/klp-admin/src/main/java/com/klp/framework/sqlserver/SqlServerApiController.java b/klp-admin/src/main/java/com/klp/framework/sqlserver/SqlServerApiController.java index 52a2e5e3..39ac01d6 100644 --- a/klp-admin/src/main/java/com/klp/framework/sqlserver/SqlServerApiController.java +++ b/klp-admin/src/main/java/com/klp/framework/sqlserver/SqlServerApiController.java @@ -155,6 +155,28 @@ public class SqlServerApiController { return R.ok(businessService.getRollHistoryList(page, pageSize, rollId, standId)); } + /** + * 出口卷实绩列表(按下线时间),来自 PLTCM_PDO_EXCOIL。 + * startTime / endTime 格式:yyyy-MM-dd HH:mm:ss + */ + @GetMapping("/excoil/by-time") + public R>> excoilByTime( + @RequestParam(required = false) String startTime, + @RequestParam(required = false) String endTime) { + return R.ok(businessService.getExcoilByTimeRange(startTime, endTime)); + } + +// /** +// * 出口卷实绩列表(按数据写入时间),用于增量同步。 +// * startTime(exclusive)/ endTime(inclusive),格式:yyyy-MM-dd HH:mm:ss +// */ +// @GetMapping("/excoil/by-insdate") +// public R>> excoilByInsdate( +// @RequestParam(required = false) String startTime, +// @RequestParam(required = false) String endTime) { +// return R.ok(businessService.getExcoilByInsdateRange(startTime, endTime)); +// } + /** * 出口卷实绩列表(分页),来自 PLTCM_PDO_EXCOIL。 */ diff --git a/klp-admin/src/main/resources/application-prod.yml b/klp-admin/src/main/resources/application-prod.yml index 05aa613c..d3bdc321 100644 --- a/klp-admin/src/main/resources/application-prod.yml +++ b/klp-admin/src/main/resources/application-prod.yml @@ -126,9 +126,9 @@ spring: # password: root hikari: # 最大连接池数量 - maxPoolSize: 10 + maxPoolSize: 100 # 最小空闲线程数量 - minIdle: 3 + minIdle: 10 # 配置获取连接等待超时的时间 connectionTimeout: 30000 # 校验超时时间 @@ -172,7 +172,7 @@ redisson: # 最小空闲连接数 connectionMinimumIdleSize: 4 # 连接池大小 - connectionPoolSize: 64 + connectionPoolSize: 128 # 连接空闲超时,单位:毫秒 idleConnectionTimeout: 100000 # 命令等待超时,单位:毫秒 diff --git a/klp-crm/src/main/java/com/klp/crm/domain/vo/CrmOrderItemVo.java b/klp-crm/src/main/java/com/klp/crm/domain/vo/CrmOrderItemVo.java index eded264e..d0a5da63 100644 --- a/klp-crm/src/main/java/com/klp/crm/domain/vo/CrmOrderItemVo.java +++ b/klp-crm/src/main/java/com/klp/crm/domain/vo/CrmOrderItemVo.java @@ -1,8 +1,10 @@ package com.klp.crm.domain.vo; import java.math.BigDecimal; +import java.util.Date; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelProperty; +import com.fasterxml.jackson.annotation.JsonFormat; import com.klp.common.annotation.ExcelDictFormat; import com.klp.common.convert.ExcelDictConvert; import lombok.Data; @@ -173,6 +175,65 @@ public class CrmOrderItemVo { @ExcelProperty(value = "用途") private String purpose; + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + + /** + * 创建人 + */ + private String createBy; + + /** + * 更新时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; + + /** + * 更新人 + */ + private String updateBy; + + /** + * 删除标志 + */ + private Long delFlag; + + /** + * 合同号(联表查询直接映射) + */ + @ExcelProperty(value = "合同号") + private String contractCode; + + /** + * 供方(联表查询直接映射) + */ + @ExcelProperty(value = "供方") + private String supplier; + + /** + * 需方(联表查询直接映射) + */ + @ExcelProperty(value = "需方") + private String customer; + + /** + * 签订时间(联表查询直接映射) + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @ExcelProperty(value = "签订时间") + private Date signTime; + + /** + * 交货日期(联表查询直接映射) + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @ExcelProperty(value = "交货日期") + private Date deliveryDate; + /** * 订单信息 */ diff --git a/klp-crm/src/main/java/com/klp/crm/mapper/CrmOrderItemMapper.java b/klp-crm/src/main/java/com/klp/crm/mapper/CrmOrderItemMapper.java index 530c9a1f..946f6ff5 100644 --- a/klp-crm/src/main/java/com/klp/crm/mapper/CrmOrderItemMapper.java +++ b/klp-crm/src/main/java/com/klp/crm/mapper/CrmOrderItemMapper.java @@ -1,8 +1,10 @@ package com.klp.crm.mapper; import com.klp.crm.domain.CrmOrderItem; +import com.klp.crm.domain.bo.CrmOrderItemBo; import com.klp.crm.domain.vo.CrmOrderItemVo; import com.klp.common.core.mapper.BaseMapperPlus; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -22,4 +24,14 @@ public interface CrmOrderItemMapper extends BaseMapperPlus selectOrderItemsByOrderIds(@Param("orderIds") List orderIds); + + /** + * 联表查询订单明细(支持排序和分页) + * 排序规则:deliveryDate DESC -> orderId ASC -> createTime DESC + * + * @param page 分页对象 + * @param bo 查询条件 + * @return 分页结果 + */ + Page selectVoListWithOrder(Page page, @Param("bo") CrmOrderItemBo bo); } diff --git a/klp-crm/src/main/java/com/klp/crm/service/impl/CrmOrderItemServiceImpl.java b/klp-crm/src/main/java/com/klp/crm/service/impl/CrmOrderItemServiceImpl.java index e8e5a5cd..7d751054 100644 --- a/klp-crm/src/main/java/com/klp/crm/service/impl/CrmOrderItemServiceImpl.java +++ b/klp-crm/src/main/java/com/klp/crm/service/impl/CrmOrderItemServiceImpl.java @@ -69,23 +69,31 @@ public class CrmOrderItemServiceImpl implements ICrmOrderItemService { /** * 查询正式订单明细列表 + * 实现逻辑:SQL联表查询 → 数据库层排序(交货日期倒序→订单ID升序→创建时间倒序)→ 物理分页 + * 排序跨页生效,同一合同明细连续排列,避免内存排序大数据量问题 */ @Override public TableDataInfo queryPageList(CrmOrderItemBo bo, PageQuery pageQuery) { - List orderIdScope = resolveOrderIdScope(bo); - if (orderIdScope != null && orderIdScope.isEmpty()) { - Page emptyPage = new Page<>(ObjectUtil.defaultIfNull(pageQuery.getPageNum(), 1), - ObjectUtil.defaultIfNull(pageQuery.getPageSize(), 10), 0); - emptyPage.setRecords(Collections.emptyList()); - return TableDataInfo.build(emptyPage); - } - LambdaQueryWrapper lqw = buildQueryWrapper(bo); - if (orderIdScope != null) { - lqw.in(CrmOrderItem::getOrderId, orderIdScope); - } - Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); - fillOrderInfoOnItems(result.getRecords()); - return TableDataInfo.build(result); + // 使用MyBatis-Plus分页插件,SQL层完成联表查询、排序和分页 + Page page = new Page<>( + ObjectUtil.defaultIfNull(pageQuery.getPageNum(), 1), + ObjectUtil.defaultIfNull(pageQuery.getPageSize(), 10) + ); + // 联表查询:在SQL层完成排序,避免内存排序 + Page resultPage = baseMapper.selectVoListWithOrder(page, bo); + return TableDataInfo.build(resultPage); + } + + /** + * 比较两个日期,null 值排在末尾 + * @param desc true=倒序,false=升序 + */ + private int compareDate(Date a, Date b, boolean desc) { + if (a == null && b == null) return 0; + if (a == null) return 1; // null 排在后面 + if (b == null) return -1; + int cmp = a.compareTo(b); + return desc ? -cmp : cmp; } /** diff --git a/klp-crm/src/main/resources/mapper/CrmOrderItemMapper.xml b/klp-crm/src/main/resources/mapper/CrmOrderItemMapper.xml index 1df4a74b..040882f6 100644 --- a/klp-crm/src/main/resources/mapper/CrmOrderItemMapper.xml +++ b/klp-crm/src/main/resources/mapper/CrmOrderItemMapper.xml @@ -1,7 +1,7 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> @@ -36,6 +36,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/klp-mes/src/main/java/com/klp/mes/eqp/controller/EqpEquipmentChecklistController.java b/klp-mes/src/main/java/com/klp/mes/eqp/controller/EqpEquipmentChecklistController.java new file mode 100644 index 00000000..f6828641 --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/eqp/controller/EqpEquipmentChecklistController.java @@ -0,0 +1,99 @@ +package com.klp.mes.eqp.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.mes.eqp.domain.vo.EqpEquipmentChecklistVo; +import com.klp.mes.eqp.domain.bo.EqpEquipmentChecklistBo; +import com.klp.mes.eqp.service.IEqpEquipmentChecklistService; +import com.klp.common.core.page.TableDataInfo; + +/** + * 设备检验清单 + * + * @author klp + * @date 2026-05-21 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/eqp/equipmentChecklist") +public class EqpEquipmentChecklistController extends BaseController { + + private final IEqpEquipmentChecklistService iEqpEquipmentChecklistService; + + /** + * 查询设备检验清单列表 + */ + @GetMapping("/list") + public TableDataInfo list(EqpEquipmentChecklistBo bo, PageQuery pageQuery) { + return iEqpEquipmentChecklistService.queryPageList(bo, pageQuery); + } + + /** + * 导出设备检验清单列表 + */ + @Log(title = "设备检验清单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(EqpEquipmentChecklistBo bo, HttpServletResponse response) { + List list = iEqpEquipmentChecklistService.queryList(bo); + ExcelUtil.exportExcel(list, "设备检验清单", EqpEquipmentChecklistVo.class, response); + } + + /** + * 获取设备检验清单详细信息 + * + * @param checkId 主键 + */ + @GetMapping("/{checkId}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long checkId) { + return R.ok(iEqpEquipmentChecklistService.queryById(checkId)); + } + + /** + * 新增设备检验清单 + */ + @Log(title = "设备检验清单", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody EqpEquipmentChecklistBo bo) { + return toAjax(iEqpEquipmentChecklistService.insertByBo(bo)); + } + + /** + * 修改设备检验清单 + */ + @Log(title = "设备检验清单", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody EqpEquipmentChecklistBo bo) { + return toAjax(iEqpEquipmentChecklistService.updateByBo(bo)); + } + + /** + * 删除设备检验清单 + * + * @param checkIds 主键串 + */ + @Log(title = "设备检验清单", businessType = BusinessType.DELETE) + @DeleteMapping("/{checkIds}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] checkIds) { + return toAjax(iEqpEquipmentChecklistService.deleteWithValidByIds(Arrays.asList(checkIds), true)); + } +} diff --git a/klp-mes/src/main/java/com/klp/mes/eqp/controller/EqpEquipmentInspectionRecordController.java b/klp-mes/src/main/java/com/klp/mes/eqp/controller/EqpEquipmentInspectionRecordController.java new file mode 100644 index 00000000..08d43c2c --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/eqp/controller/EqpEquipmentInspectionRecordController.java @@ -0,0 +1,99 @@ +package com.klp.mes.eqp.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.mes.eqp.domain.vo.EqpEquipmentInspectionRecordVo; +import com.klp.mes.eqp.domain.bo.EqpEquipmentInspectionRecordBo; +import com.klp.mes.eqp.service.IEqpEquipmentInspectionRecordService; +import com.klp.common.core.page.TableDataInfo; + +/** + * 设备巡检记录 + * + * @author klp + * @date 2026-05-21 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/eqp/equipmentInspectionRecord") +public class EqpEquipmentInspectionRecordController extends BaseController { + + private final IEqpEquipmentInspectionRecordService iEqpEquipmentInspectionRecordService; + + /** + * 查询设备巡检记录列表 + */ + @GetMapping("/list") + public TableDataInfo list(EqpEquipmentInspectionRecordBo bo, PageQuery pageQuery) { + return iEqpEquipmentInspectionRecordService.queryPageList(bo, pageQuery); + } + + /** + * 导出设备巡检记录列表 + */ + @Log(title = "设备巡检记录", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(EqpEquipmentInspectionRecordBo bo, HttpServletResponse response) { + List list = iEqpEquipmentInspectionRecordService.queryList(bo); + ExcelUtil.exportExcel(list, "设备巡检记录", EqpEquipmentInspectionRecordVo.class, response); + } + + /** + * 获取设备巡检记录详细信息 + * + * @param recordId 主键 + */ + @GetMapping("/{recordId}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long recordId) { + return R.ok(iEqpEquipmentInspectionRecordService.queryById(recordId)); + } + + /** + * 新增设备巡检记录 + */ + @Log(title = "设备巡检记录", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody EqpEquipmentInspectionRecordBo bo) { + return toAjax(iEqpEquipmentInspectionRecordService.insertByBo(bo)); + } + + /** + * 修改设备巡检记录 + */ + @Log(title = "设备巡检记录", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody EqpEquipmentInspectionRecordBo bo) { + return toAjax(iEqpEquipmentInspectionRecordService.updateByBo(bo)); + } + + /** + * 删除设备巡检记录 + * + * @param recordIds 主键串 + */ + @Log(title = "设备巡检记录", businessType = BusinessType.DELETE) + @DeleteMapping("/{recordIds}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] recordIds) { + return toAjax(iEqpEquipmentInspectionRecordService.deleteWithValidByIds(Arrays.asList(recordIds), true)); + } +} diff --git a/klp-mes/src/main/java/com/klp/mes/eqp/controller/EqpEquipmentPartController.java b/klp-mes/src/main/java/com/klp/mes/eqp/controller/EqpEquipmentPartController.java new file mode 100644 index 00000000..96565edc --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/eqp/controller/EqpEquipmentPartController.java @@ -0,0 +1,109 @@ +package com.klp.mes.eqp.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.mes.eqp.domain.vo.EqpEquipmentPartVo; +import com.klp.mes.eqp.domain.bo.EqpEquipmentPartBo; +import com.klp.mes.eqp.service.IEqpEquipmentPartService; +import com.klp.common.core.page.TableDataInfo; + +/** + * 检验部位 + * + * @author klp + * @date 2026-05-21 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/eqp/equipmentPart") +public class EqpEquipmentPartController extends BaseController { + + private final IEqpEquipmentPartService iEqpEquipmentPartService; + + /** + * 查询检验部位列表 + */ + @GetMapping("/list") + public TableDataInfo list(EqpEquipmentPartBo bo, PageQuery pageQuery) { + return iEqpEquipmentPartService.queryPageList(bo, pageQuery); + } + + /** + * 导出检验部位列表 + */ + @Log(title = "检验部位", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(EqpEquipmentPartBo bo, HttpServletResponse response) { + List list = iEqpEquipmentPartService.queryList(bo); + ExcelUtil.exportExcel(list, "检验部位", EqpEquipmentPartVo.class, response); + } + + /** + * 获取检验部位详细信息 + * + * @param partId 主键 + */ + @GetMapping("/{partId}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long partId) { + return R.ok(iEqpEquipmentPartService.queryById(partId)); + } + + /** + * 新增检验部位 + */ + @Log(title = "检验部位", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody EqpEquipmentPartBo bo) { + return toAjax(iEqpEquipmentPartService.insertByBo(bo)); + } + + /** + * 修改检验部位 + */ + @Log(title = "检验部位", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody EqpEquipmentPartBo bo) { + return toAjax(iEqpEquipmentPartService.updateByBo(bo)); + } + + /** + * 删除检验部位 + * + * @param partIds 主键串 + */ + @Log(title = "检验部位", businessType = BusinessType.DELETE) + @DeleteMapping("/{partIds}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] partIds) { + return toAjax(iEqpEquipmentPartService.deleteWithValidByIds(Arrays.asList(partIds), true)); + } + + /** + * 批量新增检验部位及检验清单 + */ + @Log(title = "检验部位", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping("/batch") + public R addBatch(@RequestBody EqpEquipmentPartBo bo) { + return toAjax(iEqpEquipmentPartService.insertBatchByBo(bo)); + } +} diff --git a/klp-mes/src/main/java/com/klp/mes/eqp/domain/EqpEquipmentChecklist.java b/klp-mes/src/main/java/com/klp/mes/eqp/domain/EqpEquipmentChecklist.java new file mode 100644 index 00000000..fcfb654d --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/eqp/domain/EqpEquipmentChecklist.java @@ -0,0 +1,65 @@ +package com.klp.mes.eqp.domain; + +import com.baomidou.mybatisplus.annotation.*; +import com.klp.common.core.domain.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + + +/** + * 设备检验清单对象 eqp_equipment_checklist + * + * @author klp + * @date 2026-05-21 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("eqp_equipment_checklist") +public class EqpEquipmentChecklist extends BaseEntity { + + private static final long serialVersionUID=1L; + + /** + * 检验清单ID + */ + @TableId(value = "check_id") + private Long checkId; + /** + * 检验编号 + */ + private String checkNo; + /** + * 检验部位表 + */ + private Long partId; + /** + * 设备部件名称 + */ + private String partName; + /** + * 检验内容 + */ + private String checkContent; + /** + * 设备状态 运行/停止 + */ + private String equipmentState; + /** + * 检验标准 + */ + private String checkStandard; + /** + * 责任人 + */ + private String responsiblePerson; + /** + * 备注 + */ + private String remark; + /** + * 删除标识 0正常 2删除 + */ + @TableLogic + private Long delFlag; + +} diff --git a/klp-mes/src/main/java/com/klp/mes/eqp/domain/EqpEquipmentInspectionRecord.java b/klp-mes/src/main/java/com/klp/mes/eqp/domain/EqpEquipmentInspectionRecord.java new file mode 100644 index 00000000..6ee806d3 --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/eqp/domain/EqpEquipmentInspectionRecord.java @@ -0,0 +1,63 @@ +package com.klp.mes.eqp.domain; + +import com.baomidou.mybatisplus.annotation.*; +import com.klp.common.core.domain.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 设备巡检记录对象 eqp_equipment_inspection_record + * + * @author klp + * @date 2026-05-21 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("eqp_equipment_inspection_record") +public class EqpEquipmentInspectionRecord extends BaseEntity { + + private static final long serialVersionUID=1L; + + /** + * 巡检记录ID + */ + @TableId(value = "record_id") + private Long recordId; + /** + * 检验清单ID + */ + private Long checkId; + /** + * 班次 1白班 2夜班 + */ + private Integer shift; + /** + * 巡检时间 + */ + private Date inspectTime; + /** + * 运行状态 1正常 2故障 + */ + private Integer runStatus; + /** + * 巡检人 + */ + private String inspector; + /** + * 异常描述 + */ + private String abnormalDesc; + /** + * 备注 + */ + private String remark; + /** + * 删除标识 0正常 2删除 + */ + @TableLogic + private Long delFlag; + +} diff --git a/klp-mes/src/main/java/com/klp/mes/eqp/domain/EqpEquipmentPart.java b/klp-mes/src/main/java/com/klp/mes/eqp/domain/EqpEquipmentPart.java new file mode 100644 index 00000000..88274c9b --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/eqp/domain/EqpEquipmentPart.java @@ -0,0 +1,49 @@ +package com.klp.mes.eqp.domain; + +import com.baomidou.mybatisplus.annotation.*; +import com.klp.common.core.domain.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + + +/** + * 检验部位对象 eqp_equipment_part + * + * @author klp + * @date 2026-05-21 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("eqp_equipment_part") +public class EqpEquipmentPart extends BaseEntity { + + private static final long serialVersionUID=1L; + + /** + * 巡检记录ID + */ + @TableId(value = "part_id") + private Long partId; + /** + * 巡检部位 + */ + private String inspectPart; + /** + * 产线 + */ + private String productionLine; + /** + * 产线段 + */ + private String lineSection; + /** + * 备注 + */ + private String remark; + /** + * 删除标识 0正常 2删除 + */ + @TableLogic + private Long delFlag; + +} diff --git a/klp-mes/src/main/java/com/klp/mes/eqp/domain/bo/EqpEquipmentChecklistBo.java b/klp-mes/src/main/java/com/klp/mes/eqp/domain/bo/EqpEquipmentChecklistBo.java new file mode 100644 index 00000000..5b11e70b --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/eqp/domain/bo/EqpEquipmentChecklistBo.java @@ -0,0 +1,69 @@ +package com.klp.mes.eqp.domain.bo; + +import com.klp.common.core.domain.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; +import javax.validation.constraints.*; +import java.util.List; + + +/** + * 设备检验清单业务对象 eqp_equipment_checklist + * + * @author klp + * @date 2026-05-21 + */ + +@Data +@EqualsAndHashCode(callSuper = true) +public class EqpEquipmentChecklistBo extends BaseEntity { + + /** + * 检验清单ID + */ + private Long checkId; + + /** + * 检验编号 + */ + private String checkNo; + + /** + * 检验部位表 + */ + private Long partId; + + /** + * 设备部件名称 + */ + private String partName; + + /** + * 检验内容 + */ + private String checkContent; + + /** + * 设备状态 运行/停止 + */ + private String equipmentState; + + /** + * 检验标准 + */ + private String checkStandard; + + /** + * 责任人 + */ + private String responsiblePerson; + + /** + * 备注 + */ + private String remark; + + private List partIds; + + +} diff --git a/klp-mes/src/main/java/com/klp/mes/eqp/domain/bo/EqpEquipmentInspectionRecordBo.java b/klp-mes/src/main/java/com/klp/mes/eqp/domain/bo/EqpEquipmentInspectionRecordBo.java new file mode 100644 index 00000000..7b447f2a --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/eqp/domain/bo/EqpEquipmentInspectionRecordBo.java @@ -0,0 +1,63 @@ +package com.klp.mes.eqp.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; + +/** + * 设备巡检记录业务对象 eqp_equipment_inspection_record + * + * @author klp + * @date 2026-05-21 + */ + +@Data +@EqualsAndHashCode(callSuper = true) +public class EqpEquipmentInspectionRecordBo extends BaseEntity { + + /** + * 巡检记录ID + */ + private Long recordId; + + /** + * 检验清单ID + */ + private Long checkId; + + /** + * 班次 1白班 2夜班 + */ + private Integer shift; + + /** + * 巡检时间 + */ + private Date inspectTime; + + /** + * 运行状态 1正常 2故障 + */ + private Integer runStatus; + + /** + * 巡检人 + */ + private String inspector; + + /** + * 异常描述 + */ + private String abnormalDesc; + + /** + * 备注 + */ + private String remark; + + +} diff --git a/klp-mes/src/main/java/com/klp/mes/eqp/domain/bo/EqpEquipmentPartBo.java b/klp-mes/src/main/java/com/klp/mes/eqp/domain/bo/EqpEquipmentPartBo.java new file mode 100644 index 00000000..4f66b435 --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/eqp/domain/bo/EqpEquipmentPartBo.java @@ -0,0 +1,52 @@ +package com.klp.mes.eqp.domain.bo; + +import com.klp.common.core.domain.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; +import javax.validation.constraints.*; +import java.util.List; + + +/** + * 检验部位业务对象 eqp_equipment_part + * + * @author klp + * @date 2026-05-21 + */ + +@Data +@EqualsAndHashCode(callSuper = true) +public class EqpEquipmentPartBo extends BaseEntity { + + /** + * 巡检记录ID + */ + private Long partId; + + /** + * 巡检部位 + */ + private String inspectPart; + + /** + * 产线 + */ + private String productionLine; + + /** + * 产线段 + */ + private String lineSection; + + /** + * 备注 + */ + private String remark; + + /** + * 检验清单列表 + */ + private List checklistList; + + +} diff --git a/klp-mes/src/main/java/com/klp/mes/eqp/domain/vo/EqpEquipmentChecklistVo.java b/klp-mes/src/main/java/com/klp/mes/eqp/domain/vo/EqpEquipmentChecklistVo.java new file mode 100644 index 00000000..35f1701e --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/eqp/domain/vo/EqpEquipmentChecklistVo.java @@ -0,0 +1,77 @@ +package com.klp.mes.eqp.domain.vo; + +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; + + +/** + * 设备检验清单视图对象 eqp_equipment_checklist + * + * @author klp + * @date 2026-05-21 + */ +@Data +@ExcelIgnoreUnannotated +public class EqpEquipmentChecklistVo { + + private static final long serialVersionUID = 1L; + + /** + * 检验清单ID + */ + @ExcelProperty(value = "检验清单ID") + private Long checkId; + + /** + * 检验编号 + */ + @ExcelProperty(value = "检验编号") + private String checkNo; + + /** + * 检验部位表 + */ + @ExcelProperty(value = "检验部位表") + private Long partId; + + /** + * 设备部件名称 + */ + @ExcelProperty(value = "设备部件名称") + private String partName; + + /** + * 检验内容 + */ + @ExcelProperty(value = "检验内容") + private String checkContent; + + /** + * 设备状态 运行/停止 + */ + @ExcelProperty(value = "设备状态 运行/停止") + private String equipmentState; + + /** + * 检验标准 + */ + @ExcelProperty(value = "检验标准") + private String checkStandard; + + /** + * 责任人 + */ + @ExcelProperty(value = "责任人") + private String responsiblePerson; + + /** + * 备注 + */ + @ExcelProperty(value = "备注") + private String remark; + + +} diff --git a/klp-mes/src/main/java/com/klp/mes/eqp/domain/vo/EqpEquipmentInspectionRecordVo.java b/klp-mes/src/main/java/com/klp/mes/eqp/domain/vo/EqpEquipmentInspectionRecordVo.java new file mode 100644 index 00000000..ef7b09de --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/eqp/domain/vo/EqpEquipmentInspectionRecordVo.java @@ -0,0 +1,73 @@ +package com.klp.mes.eqp.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; + + +/** + * 设备巡检记录视图对象 eqp_equipment_inspection_record + * + * @author klp + * @date 2026-05-21 + */ +@Data +@ExcelIgnoreUnannotated +public class EqpEquipmentInspectionRecordVo { + + private static final long serialVersionUID = 1L; + + /** + * 巡检记录ID + */ + @ExcelProperty(value = "巡检记录ID") + private Long recordId; + + /** + * 检验清单ID + */ + @ExcelProperty(value = "检验清单ID") + private Long checkId; + + /** + * 班次 1白班 2夜班 + */ + @ExcelProperty(value = "班次 1白班 2夜班") + private Integer shift; + + /** + * 巡检时间 + */ + @ExcelProperty(value = "巡检时间") + private Date inspectTime; + + /** + * 运行状态 1正常 2故障 + */ + @ExcelProperty(value = "运行状态 1正常 2故障") + private Integer runStatus; + + /** + * 巡检人 + */ + @ExcelProperty(value = "巡检人") + private String inspector; + + /** + * 异常描述 + */ + @ExcelProperty(value = "异常描述") + private String abnormalDesc; + + /** + * 备注 + */ + @ExcelProperty(value = "备注") + private String remark; + + +} diff --git a/klp-mes/src/main/java/com/klp/mes/eqp/domain/vo/EqpEquipmentPartVo.java b/klp-mes/src/main/java/com/klp/mes/eqp/domain/vo/EqpEquipmentPartVo.java new file mode 100644 index 00000000..f82f0f0e --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/eqp/domain/vo/EqpEquipmentPartVo.java @@ -0,0 +1,59 @@ +package com.klp.mes.eqp.domain.vo; + +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; + +import java.util.List; + + +/** + * 检验部位视图对象 eqp_equipment_part + * + * @author klp + * @date 2026-05-21 + */ +@Data +@ExcelIgnoreUnannotated +public class EqpEquipmentPartVo { + + private static final long serialVersionUID = 1L; + + /** + * 巡检记录ID + */ + @ExcelProperty(value = "巡检记录ID") + private Long partId; + + /** + * 巡检部位 + */ + @ExcelProperty(value = "巡检部位") + private String inspectPart; + + /** + * 产线 + */ + @ExcelProperty(value = "产线") + private String productionLine; + + /** + * 产线段 + */ + @ExcelProperty(value = "产线段") + private String lineSection; + + /** + * 备注 + */ + @ExcelProperty(value = "备注") + private String remark; + + /** + * 检验清单列表 + */ + private List checklistList; + +} diff --git a/klp-mes/src/main/java/com/klp/mes/eqp/mapper/EqpEquipmentChecklistMapper.java b/klp-mes/src/main/java/com/klp/mes/eqp/mapper/EqpEquipmentChecklistMapper.java new file mode 100644 index 00000000..eba62bda --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/eqp/mapper/EqpEquipmentChecklistMapper.java @@ -0,0 +1,15 @@ +package com.klp.mes.eqp.mapper; + +import com.klp.mes.eqp.domain.EqpEquipmentChecklist; +import com.klp.mes.eqp.domain.vo.EqpEquipmentChecklistVo; +import com.klp.common.core.mapper.BaseMapperPlus; + +/** + * 设备检验清单Mapper接口 + * + * @author klp + * @date 2026-05-21 + */ +public interface EqpEquipmentChecklistMapper extends BaseMapperPlus { + +} diff --git a/klp-mes/src/main/java/com/klp/mes/eqp/mapper/EqpEquipmentInspectionRecordMapper.java b/klp-mes/src/main/java/com/klp/mes/eqp/mapper/EqpEquipmentInspectionRecordMapper.java new file mode 100644 index 00000000..64fab8d4 --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/eqp/mapper/EqpEquipmentInspectionRecordMapper.java @@ -0,0 +1,15 @@ +package com.klp.mes.eqp.mapper; + +import com.klp.mes.eqp.domain.EqpEquipmentInspectionRecord; +import com.klp.mes.eqp.domain.vo.EqpEquipmentInspectionRecordVo; +import com.klp.common.core.mapper.BaseMapperPlus; + +/** + * 设备巡检记录Mapper接口 + * + * @author klp + * @date 2026-05-21 + */ +public interface EqpEquipmentInspectionRecordMapper extends BaseMapperPlus { + +} diff --git a/klp-mes/src/main/java/com/klp/mes/eqp/mapper/EqpEquipmentPartMapper.java b/klp-mes/src/main/java/com/klp/mes/eqp/mapper/EqpEquipmentPartMapper.java new file mode 100644 index 00000000..dc2c8aab --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/eqp/mapper/EqpEquipmentPartMapper.java @@ -0,0 +1,15 @@ +package com.klp.mes.eqp.mapper; + +import com.klp.mes.eqp.domain.EqpEquipmentPart; +import com.klp.mes.eqp.domain.vo.EqpEquipmentPartVo; +import com.klp.common.core.mapper.BaseMapperPlus; + +/** + * 检验部位Mapper接口 + * + * @author klp + * @date 2026-05-21 + */ +public interface EqpEquipmentPartMapper extends BaseMapperPlus { + +} diff --git a/klp-mes/src/main/java/com/klp/mes/eqp/service/IEqpEquipmentChecklistService.java b/klp-mes/src/main/java/com/klp/mes/eqp/service/IEqpEquipmentChecklistService.java new file mode 100644 index 00000000..a234b9ea --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/eqp/service/IEqpEquipmentChecklistService.java @@ -0,0 +1,49 @@ +package com.klp.mes.eqp.service; + +import com.klp.mes.eqp.domain.EqpEquipmentChecklist; +import com.klp.mes.eqp.domain.vo.EqpEquipmentChecklistVo; +import com.klp.mes.eqp.domain.bo.EqpEquipmentChecklistBo; +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-05-21 + */ +public interface IEqpEquipmentChecklistService { + + /** + * 查询设备检验清单 + */ + EqpEquipmentChecklistVo queryById(Long checkId); + + /** + * 查询设备检验清单列表 + */ + TableDataInfo queryPageList(EqpEquipmentChecklistBo bo, PageQuery pageQuery); + + /** + * 查询设备检验清单列表 + */ + List queryList(EqpEquipmentChecklistBo bo); + + /** + * 新增设备检验清单 + */ + Boolean insertByBo(EqpEquipmentChecklistBo bo); + + /** + * 修改设备检验清单 + */ + Boolean updateByBo(EqpEquipmentChecklistBo bo); + + /** + * 校验并批量删除设备检验清单信息 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); +} diff --git a/klp-mes/src/main/java/com/klp/mes/eqp/service/IEqpEquipmentInspectionRecordService.java b/klp-mes/src/main/java/com/klp/mes/eqp/service/IEqpEquipmentInspectionRecordService.java new file mode 100644 index 00000000..adc97ea2 --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/eqp/service/IEqpEquipmentInspectionRecordService.java @@ -0,0 +1,49 @@ +package com.klp.mes.eqp.service; + +import com.klp.mes.eqp.domain.EqpEquipmentInspectionRecord; +import com.klp.mes.eqp.domain.vo.EqpEquipmentInspectionRecordVo; +import com.klp.mes.eqp.domain.bo.EqpEquipmentInspectionRecordBo; +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-05-21 + */ +public interface IEqpEquipmentInspectionRecordService { + + /** + * 查询设备巡检记录 + */ + EqpEquipmentInspectionRecordVo queryById(Long recordId); + + /** + * 查询设备巡检记录列表 + */ + TableDataInfo queryPageList(EqpEquipmentInspectionRecordBo bo, PageQuery pageQuery); + + /** + * 查询设备巡检记录列表 + */ + List queryList(EqpEquipmentInspectionRecordBo bo); + + /** + * 新增设备巡检记录 + */ + Boolean insertByBo(EqpEquipmentInspectionRecordBo bo); + + /** + * 修改设备巡检记录 + */ + Boolean updateByBo(EqpEquipmentInspectionRecordBo bo); + + /** + * 校验并批量删除设备巡检记录信息 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); +} diff --git a/klp-mes/src/main/java/com/klp/mes/eqp/service/IEqpEquipmentPartService.java b/klp-mes/src/main/java/com/klp/mes/eqp/service/IEqpEquipmentPartService.java new file mode 100644 index 00000000..f1a580ae --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/eqp/service/IEqpEquipmentPartService.java @@ -0,0 +1,54 @@ +package com.klp.mes.eqp.service; + +import com.klp.mes.eqp.domain.EqpEquipmentPart; +import com.klp.mes.eqp.domain.vo.EqpEquipmentPartVo; +import com.klp.mes.eqp.domain.bo.EqpEquipmentPartBo; +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-05-21 + */ +public interface IEqpEquipmentPartService { + + /** + * 查询检验部位 + */ + EqpEquipmentPartVo queryById(Long partId); + + /** + * 查询检验部位列表 + */ + TableDataInfo queryPageList(EqpEquipmentPartBo bo, PageQuery pageQuery); + + /** + * 查询检验部位列表 + */ + List queryList(EqpEquipmentPartBo bo); + + /** + * 新增检验部位 + */ + Boolean insertByBo(EqpEquipmentPartBo bo); + + /** + * 修改检验部位 + */ + Boolean updateByBo(EqpEquipmentPartBo bo); + + /** + * 校验并批量删除检验部位信息 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + + /** + * 批量新增检验部位及检验清单 + */ + Boolean insertBatchByBo(EqpEquipmentPartBo bo); +} diff --git a/klp-mes/src/main/java/com/klp/mes/eqp/service/impl/EqpEquipmentChecklistServiceImpl.java b/klp-mes/src/main/java/com/klp/mes/eqp/service/impl/EqpEquipmentChecklistServiceImpl.java new file mode 100644 index 00000000..e5a164c1 --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/eqp/service/impl/EqpEquipmentChecklistServiceImpl.java @@ -0,0 +1,138 @@ +package com.klp.mes.eqp.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.mes.eqp.domain.bo.EqpEquipmentChecklistBo; +import com.klp.mes.eqp.domain.vo.EqpEquipmentChecklistVo; +import com.klp.mes.eqp.domain.EqpEquipmentChecklist; +import com.klp.mes.eqp.domain.EqpEquipmentPart; +import com.klp.mes.eqp.mapper.EqpEquipmentChecklistMapper; +import com.klp.mes.eqp.mapper.EqpEquipmentPartMapper; +import com.klp.mes.eqp.service.IEqpEquipmentChecklistService; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 设备检验清单Service业务层处理 + * + * @author klp + * @date 2026-05-21 + */ +@RequiredArgsConstructor +@Service +public class EqpEquipmentChecklistServiceImpl implements IEqpEquipmentChecklistService { + + private final EqpEquipmentChecklistMapper baseMapper; + private final EqpEquipmentPartMapper eqpEquipmentPartMapper; + + /** + * 查询设备检验清单 + */ + @Override + public EqpEquipmentChecklistVo queryById(Long checkId){ + return baseMapper.selectVoById(checkId); + } + + /** + * 查询设备检验清单列表 + */ + @Override + public TableDataInfo queryPageList(EqpEquipmentChecklistBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + fillPartName(result.getRecords()); + return TableDataInfo.build(result); + } + + /** + * 查询设备检验清单列表 + */ + @Override + public List queryList(EqpEquipmentChecklistBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + List list = baseMapper.selectVoList(lqw); + fillPartName(list); + return list; + } + + /** + * 填充检验清单的检验部位名称 + */ + private void fillPartName(List list) { + if (list == null || list.isEmpty()) { + return; + } + list.forEach(vo -> { + if (vo.getPartId() != null) { + EqpEquipmentPart part = eqpEquipmentPartMapper.selectById(vo.getPartId()); + if (part != null) { + vo.setPartName(part.getInspectPart()); + } + } + }); + } + + private LambdaQueryWrapper buildQueryWrapper(EqpEquipmentChecklistBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(StringUtils.isNotBlank(bo.getCheckNo()), EqpEquipmentChecklist::getCheckNo, bo.getCheckNo()); + lqw.eq(bo.getPartId() != null, EqpEquipmentChecklist::getPartId, bo.getPartId()); + lqw.like(StringUtils.isNotBlank(bo.getPartName()), EqpEquipmentChecklist::getPartName, bo.getPartName()); + lqw.eq(StringUtils.isNotBlank(bo.getCheckContent()), EqpEquipmentChecklist::getCheckContent, bo.getCheckContent()); + lqw.eq(StringUtils.isNotBlank(bo.getEquipmentState()), EqpEquipmentChecklist::getEquipmentState, bo.getEquipmentState()); + lqw.eq(StringUtils.isNotBlank(bo.getCheckStandard()), EqpEquipmentChecklist::getCheckStandard, bo.getCheckStandard()); + lqw.eq(StringUtils.isNotBlank(bo.getResponsiblePerson()), EqpEquipmentChecklist::getResponsiblePerson, bo.getResponsiblePerson()); + return lqw; + } + + /** + * 新增设备检验清单 + */ + @Override + public Boolean insertByBo(EqpEquipmentChecklistBo bo) { + EqpEquipmentChecklist add = BeanUtil.toBean(bo, EqpEquipmentChecklist.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setCheckId(add.getCheckId()); + } + return flag; + } + + /** + * 修改设备检验清单 + */ + @Override + public Boolean updateByBo(EqpEquipmentChecklistBo bo) { + EqpEquipmentChecklist update = BeanUtil.toBean(bo, EqpEquipmentChecklist.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(EqpEquipmentChecklist entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 批量删除设备检验清单 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteBatchIds(ids) > 0; + } +} diff --git a/klp-mes/src/main/java/com/klp/mes/eqp/service/impl/EqpEquipmentInspectionRecordServiceImpl.java b/klp-mes/src/main/java/com/klp/mes/eqp/service/impl/EqpEquipmentInspectionRecordServiceImpl.java new file mode 100644 index 00000000..00ad8094 --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/eqp/service/impl/EqpEquipmentInspectionRecordServiceImpl.java @@ -0,0 +1,114 @@ +package com.klp.mes.eqp.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.mes.eqp.domain.bo.EqpEquipmentInspectionRecordBo; +import com.klp.mes.eqp.domain.vo.EqpEquipmentInspectionRecordVo; +import com.klp.mes.eqp.domain.EqpEquipmentInspectionRecord; +import com.klp.mes.eqp.mapper.EqpEquipmentInspectionRecordMapper; +import com.klp.mes.eqp.service.IEqpEquipmentInspectionRecordService; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 设备巡检记录Service业务层处理 + * + * @author klp + * @date 2026-05-21 + */ +@RequiredArgsConstructor +@Service +public class EqpEquipmentInspectionRecordServiceImpl implements IEqpEquipmentInspectionRecordService { + + private final EqpEquipmentInspectionRecordMapper baseMapper; + + /** + * 查询设备巡检记录 + */ + @Override + public EqpEquipmentInspectionRecordVo queryById(Long recordId){ + return baseMapper.selectVoById(recordId); + } + + /** + * 查询设备巡检记录列表 + */ + @Override + public TableDataInfo queryPageList(EqpEquipmentInspectionRecordBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询设备巡检记录列表 + */ + @Override + public List queryList(EqpEquipmentInspectionRecordBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(EqpEquipmentInspectionRecordBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(bo.getCheckId() != null, EqpEquipmentInspectionRecord::getCheckId, bo.getCheckId()); + lqw.eq(bo.getShift() != null, EqpEquipmentInspectionRecord::getShift, bo.getShift()); + lqw.eq(bo.getInspectTime() != null, EqpEquipmentInspectionRecord::getInspectTime, bo.getInspectTime()); + lqw.eq(bo.getRunStatus() != null, EqpEquipmentInspectionRecord::getRunStatus, bo.getRunStatus()); + lqw.eq(StringUtils.isNotBlank(bo.getInspector()), EqpEquipmentInspectionRecord::getInspector, bo.getInspector()); + lqw.eq(StringUtils.isNotBlank(bo.getAbnormalDesc()), EqpEquipmentInspectionRecord::getAbnormalDesc, bo.getAbnormalDesc()); + return lqw; + } + + /** + * 新增设备巡检记录 + */ + @Override + public Boolean insertByBo(EqpEquipmentInspectionRecordBo bo) { + EqpEquipmentInspectionRecord add = BeanUtil.toBean(bo, EqpEquipmentInspectionRecord.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setRecordId(add.getRecordId()); + } + return flag; + } + + /** + * 修改设备巡检记录 + */ + @Override + public Boolean updateByBo(EqpEquipmentInspectionRecordBo bo) { + EqpEquipmentInspectionRecord update = BeanUtil.toBean(bo, EqpEquipmentInspectionRecord.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(EqpEquipmentInspectionRecord entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 批量删除设备巡检记录 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteBatchIds(ids) > 0; + } +} diff --git a/klp-mes/src/main/java/com/klp/mes/eqp/service/impl/EqpEquipmentPartServiceImpl.java b/klp-mes/src/main/java/com/klp/mes/eqp/service/impl/EqpEquipmentPartServiceImpl.java new file mode 100644 index 00000000..36f90973 --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/eqp/service/impl/EqpEquipmentPartServiceImpl.java @@ -0,0 +1,151 @@ +package com.klp.mes.eqp.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 com.klp.mes.eqp.domain.bo.EqpEquipmentChecklistBo; +import com.klp.mes.eqp.service.IEqpEquipmentChecklistService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import com.klp.mes.eqp.domain.bo.EqpEquipmentPartBo; +import com.klp.mes.eqp.domain.vo.EqpEquipmentPartVo; +import com.klp.mes.eqp.domain.vo.EqpEquipmentChecklistVo; +import com.klp.mes.eqp.domain.EqpEquipmentPart; +import com.klp.mes.eqp.domain.EqpEquipmentChecklist; +import com.klp.mes.eqp.mapper.EqpEquipmentPartMapper; +import com.klp.mes.eqp.mapper.EqpEquipmentChecklistMapper; +import com.klp.mes.eqp.service.IEqpEquipmentPartService; + +import java.util.*; +import java.util.stream.Collectors; + +import org.springframework.transaction.annotation.Transactional; + +/** + * 检验部位Service业务层处理 + * + * @author klp + * @date 2026-05-21 + */ +@RequiredArgsConstructor +@Service +public class EqpEquipmentPartServiceImpl implements IEqpEquipmentPartService { + + private final EqpEquipmentPartMapper baseMapper; + private final IEqpEquipmentChecklistService checklistService; + private final EqpEquipmentChecklistMapper checklistMapper; + + /** + * 查询检验部位 + */ + @Override + public EqpEquipmentPartVo queryById(Long partId){ + return baseMapper.selectVoById(partId); + } + + /** + * 查询检验部位列表 + */ + @Override + public TableDataInfo queryPageList(EqpEquipmentPartBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + List partIds = result.getRecords().stream() + .map(EqpEquipmentPartVo::getPartId).collect(Collectors.toList()); + if (!partIds.isEmpty()) { + EqpEquipmentChecklistBo eqpEquipmentChecklistBo = new EqpEquipmentChecklistBo(); + eqpEquipmentChecklistBo.setPartIds(partIds); + List checklistList = checklistService.queryList(eqpEquipmentChecklistBo); + Map> checklistMap = checklistList.stream() + .collect(Collectors.groupingBy(EqpEquipmentChecklistVo::getPartId)); + result.getRecords().forEach(vo -> + vo.setChecklistList(checklistMap.getOrDefault(vo.getPartId(), Collections.emptyList())) + ); + } + return TableDataInfo.build(result); + } + + /** + * 查询检验部位列表 + */ + @Override + public List queryList(EqpEquipmentPartBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(EqpEquipmentPartBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(StringUtils.isNotBlank(bo.getInspectPart()), EqpEquipmentPart::getInspectPart, bo.getInspectPart()); + lqw.eq(StringUtils.isNotBlank(bo.getProductionLine()), EqpEquipmentPart::getProductionLine, bo.getProductionLine()); + lqw.eq(StringUtils.isNotBlank(bo.getLineSection()), EqpEquipmentPart::getLineSection, bo.getLineSection()); + return lqw; + } + + /** + * 新增检验部位 + */ + @Override + public Boolean insertByBo(EqpEquipmentPartBo bo) { + EqpEquipmentPart add = BeanUtil.toBean(bo, EqpEquipmentPart.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setPartId(add.getPartId()); + } + return flag; + } + + /** + * 修改检验部位 + */ + @Override + public Boolean updateByBo(EqpEquipmentPartBo bo) { + EqpEquipmentPart update = BeanUtil.toBean(bo, EqpEquipmentPart.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(EqpEquipmentPart entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 批量删除检验部位 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteBatchIds(ids) > 0; + } + + /** + * 批量新增检验部位及检验清单 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean insertBatchByBo(EqpEquipmentPartBo bo) { + EqpEquipmentPart add = BeanUtil.toBean(bo, EqpEquipmentPart.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag && bo.getChecklistList() != null && !bo.getChecklistList().isEmpty()) { + Long partId = add.getPartId(); + for (EqpEquipmentChecklistBo checklistBo : bo.getChecklistList()) { + EqpEquipmentChecklist checklist = BeanUtil.toBean(checklistBo, EqpEquipmentChecklist.class); + checklist.setPartId(partId); + checklistMapper.insert(checklist); + } + } + return flag; + } +} diff --git a/klp-mes/src/main/java/com/klp/mes/excoil/controller/MesExCoilController.java b/klp-mes/src/main/java/com/klp/mes/excoil/controller/MesExCoilController.java new file mode 100644 index 00000000..266daf68 --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/excoil/controller/MesExCoilController.java @@ -0,0 +1,112 @@ +package com.klp.mes.excoil.controller; + +import java.util.List; +import java.util.Arrays; +import java.util.Map; + +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.mes.excoil.domain.vo.MesExCoilVo; +import com.klp.mes.excoil.domain.bo.MesExCoilBo; +import com.klp.mes.excoil.service.IMesExCoilService; +import com.klp.common.core.page.TableDataInfo; + +/** + * 出口卷数据同步 + * + * @author klp + * @date 2026-05-21 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/excoil/exCoil") +public class MesExCoilController extends BaseController { + + private final IMesExCoilService iMesExCoilService; + + /** + * 查询出口卷数据同步列表 + */ + @GetMapping("/list") + public TableDataInfo list(MesExCoilBo bo, PageQuery pageQuery) { + return iMesExCoilService.queryPageList(bo, pageQuery); + } + + /** + * 导出出口卷数据同步列表 + */ + @Log(title = "出口卷数据同步", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(MesExCoilBo bo, HttpServletResponse response) { + List list = iMesExCoilService.queryList(bo); + ExcelUtil.exportExcel(list, "出口卷数据同步", MesExCoilVo.class, response); + } + + /** + * 获取出口卷数据同步详细信息 + * + * @param exId 主键 + */ + @GetMapping("/{exId}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long exId) { + return R.ok(iMesExCoilService.queryById(exId)); + } + + /** + * 新增出口卷数据同步 + */ + @Log(title = "出口卷数据同步", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody MesExCoilBo bo) { + return toAjax(iMesExCoilService.insertByBo(bo)); + } + + /** + * 修改出口卷数据同步 + */ + @Log(title = "出口卷数据同步", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody MesExCoilBo bo) { + return toAjax(iMesExCoilService.updateByBo(bo)); + } + + /** + * 删除出口卷数据同步 + * + * @param exIds 主键串 + */ + @Log(title = "出口卷数据同步", businessType = BusinessType.DELETE) + @DeleteMapping("/{exIds}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] exIds) { + return toAjax(iMesExCoilService.deleteWithValidByIds(Arrays.asList(exIds), true)); + } + +// /** +// * 从 L2 系统同步出口卷实绩数据。 +// * 首次全量同步,后续增量同步(以 insdate 为锚点)。 +// */ +// @Log(title = "出口卷数据同步", businessType = BusinessType.OTHER) +// @RepeatSubmit(interval = 300000, message = "同步任务已提交,请勿重复操作") +// @PostMapping("/sync") +// public R> sync() { +// Map result = iMesExCoilService.syncExCoilData(); +// return R.ok(result); +// } +} diff --git a/klp-mes/src/main/java/com/klp/mes/excoil/domain/MesExCoil.java b/klp-mes/src/main/java/com/klp/mes/excoil/domain/MesExCoil.java new file mode 100644 index 00000000..4a0764ad --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/excoil/domain/MesExCoil.java @@ -0,0 +1,196 @@ +package com.klp.mes.excoil.domain; + +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; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 出口卷数据同步对象 mes_ex_coil + * + * @author klp + * @date 2026-05-21 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("mes_ex_coil") +public class MesExCoil extends BaseEntity { + + private static final long serialVersionUID=1L; + + /** + * 主键ID + */ + @TableId(value = "ex_id") + private Long exId; + /** + * 出口卷号(唯一标识) + */ + private String excoilid; + /** + * 入口卷号 + */ + private String encoilid; + /** + * 热卷号 + */ + private String hotCoilid; + /** + * 钢种 + */ + private String grade; + /** + * 订单质量 + */ + private String orderQuality; + /** + * 产品类型 + */ + private String productType; + /** + * 状态 + */ + private String status; + /** + * 班次 + */ + private String shift; + /** + * 包装类型 + */ + private String parkType; + /** + * 切边类型 + */ + private String sideTrim; + /** + * 入口厚度 + */ + private BigDecimal entryThick; + /** + * 入口宽度 + */ + private BigDecimal entryWidth; + /** + * 入口重量 + */ + private BigDecimal entryWeight; + /** + * 使用入口重量 + */ + private BigDecimal usedEntryWeight; + /** + * 出口厚度 + */ + private BigDecimal exitThick; + /** + * 出口宽度 + */ + private BigDecimal exitWidth; + /** + * 出口长度 + */ + private BigDecimal exitLength; + /** + * 出口重量 + */ + private BigDecimal exitWeight; + /** + * 计算出口重量 + */ + private BigDecimal calcExitWeight; + /** + * 实测出口重量 + */ + private BigDecimal measExitWeight; + /** + * 出口正偏差 + */ + private BigDecimal exitPosDev; + /** + * 出口负偏差 + */ + private BigDecimal exitNegDev; + /** + * 内径 + */ + private BigDecimal innerDiameter; + /** + * 外径 + */ + private BigDecimal outerDiameter; + /** + * 头部位置 + */ + private BigDecimal headpos; + /** + * 尾部位置 + */ + private BigDecimal tailpos; + /** + * 质量 + */ + private BigDecimal quality; + /** + * 板形质量 + */ + private BigDecimal shapeQuality; + /** + * 机组 + */ + private String crew; + /** + * 报告标志 + */ + private Long reportFlag; + /** + * 子ID + */ + private Long subid; + /** + * 序号 + */ + private Long rn; + /** + * 上线时间 + */ + private Date onlineDate; + /** + * 开始时间 + */ + private Date startDate; + /** + * 结束时间 + */ + private Date endDate; + /** + * 焊接时间 + */ + private Date weldedDate; + /** + * 数据写入时间(来源系统) + */ + private Date insdate; + /** + * 同步时间 + */ + private Date syncTime; + /** + * 同步备注 + */ + private String comments; + /** + * 备注 + */ + private String remark; + /** + * 删除标识 0正常 2删除 + */ + @TableLogic + private Long delFlag; + +} diff --git a/klp-mes/src/main/java/com/klp/mes/excoil/domain/bo/MesExCoilBo.java b/klp-mes/src/main/java/com/klp/mes/excoil/domain/bo/MesExCoilBo.java new file mode 100644 index 00000000..41e8e205 --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/excoil/domain/bo/MesExCoilBo.java @@ -0,0 +1,229 @@ +package com.klp.mes.excoil.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; + +/** + * 出口卷数据同步业务对象 mes_ex_coil + * + * @author klp + * @date 2026-05-21 + */ + +@Data +@EqualsAndHashCode(callSuper = true) +public class MesExCoilBo extends BaseEntity { + + /** + * 主键ID + */ + private Long exId; + + /** + * 出口卷号(唯一标识) + */ + private String excoilid; + + /** + * 入口卷号 + */ + private String encoilid; + + /** + * 热卷号 + */ + private String hotCoilid; + + /** + * 钢种 + */ + private String grade; + + /** + * 订单质量 + */ + private String orderQuality; + + /** + * 产品类型 + */ + private String productType; + + /** + * 状态 + */ + private String status; + + /** + * 班次 + */ + private String shift; + + /** + * 包装类型 + */ + private String parkType; + + /** + * 切边类型 + */ + private String sideTrim; + + /** + * 入口厚度 + */ + private BigDecimal entryThick; + + /** + * 入口宽度 + */ + private BigDecimal entryWidth; + + /** + * 入口重量 + */ + private BigDecimal entryWeight; + + /** + * 使用入口重量 + */ + private BigDecimal usedEntryWeight; + + /** + * 出口厚度 + */ + private BigDecimal exitThick; + + /** + * 出口宽度 + */ + private BigDecimal exitWidth; + + /** + * 出口长度 + */ + private BigDecimal exitLength; + + /** + * 出口重量 + */ + private BigDecimal exitWeight; + + /** + * 计算出口重量 + */ + private BigDecimal calcExitWeight; + + /** + * 实测出口重量 + */ + private BigDecimal measExitWeight; + + /** + * 出口正偏差 + */ + private BigDecimal exitPosDev; + + /** + * 出口负偏差 + */ + private BigDecimal exitNegDev; + + /** + * 内径 + */ + private BigDecimal innerDiameter; + + /** + * 外径 + */ + private BigDecimal outerDiameter; + + /** + * 头部位置 + */ + private BigDecimal headpos; + + /** + * 尾部位置 + */ + private BigDecimal tailpos; + + /** + * 质量 + */ + private BigDecimal quality; + + /** + * 板形质量 + */ + private BigDecimal shapeQuality; + + /** + * 机组 + */ + private String crew; + + /** + * 报告标志 + */ + private Long reportFlag; + + /** + * 子ID + */ + private Long subid; + + /** + * 序号 + */ + private Long rn; + + /** + * 上线时间 + */ + private Date onlineDate; + + /** + * 开始时间 + */ + private Date startDate; + + /** + * 结束时间 + */ + private Date endDate; + + /** + * 焊接时间 + */ + private Date weldedDate; + + /** + * 数据写入时间(来源系统) + */ + private Date insdate; + + /** + * 同步时间 + */ + private Date syncTime; + + /** + * 同步备注 + */ + private String comments; + + /** + * 备注 + */ + private String remark; + + +} diff --git a/klp-mes/src/main/java/com/klp/mes/excoil/domain/vo/MesExCoilVo.java b/klp-mes/src/main/java/com/klp/mes/excoil/domain/vo/MesExCoilVo.java new file mode 100644 index 00000000..9f8b61c3 --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/excoil/domain/vo/MesExCoilVo.java @@ -0,0 +1,272 @@ +package com.klp.mes.excoil.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; + + +/** + * 出口卷数据同步视图对象 mes_ex_coil + * + * @author klp + * @date 2026-05-21 + */ +@Data +@ExcelIgnoreUnannotated +public class MesExCoilVo { + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + @ExcelProperty(value = "主键ID") + private Long exId; + + /** + * 出口卷号(唯一标识) + */ + @ExcelProperty(value = "出口卷号(唯一标识)") + private String excoilid; + + /** + * 入口卷号 + */ + @ExcelProperty(value = "入口卷号") + private String encoilid; + + /** + * 热卷号 + */ + @ExcelProperty(value = "热卷号") + private String hotCoilid; + + /** + * 钢种 + */ + @ExcelProperty(value = "钢种") + private String grade; + + /** + * 订单质量 + */ + @ExcelProperty(value = "订单质量") + private String orderQuality; + + /** + * 产品类型 + */ + @ExcelProperty(value = "产品类型") + private String productType; + + /** + * 状态 + */ + @ExcelProperty(value = "状态") + private String status; + + /** + * 班次 + */ + @ExcelProperty(value = "班次") + private String shift; + + /** + * 包装类型 + */ + @ExcelProperty(value = "包装类型") + private String parkType; + + /** + * 切边类型 + */ + @ExcelProperty(value = "切边类型") + private String sideTrim; + + /** + * 入口厚度 + */ + @ExcelProperty(value = "入口厚度") + private BigDecimal entryThick; + + /** + * 入口宽度 + */ + @ExcelProperty(value = "入口宽度") + private BigDecimal entryWidth; + + /** + * 入口重量 + */ + @ExcelProperty(value = "入口重量") + private BigDecimal entryWeight; + + /** + * 使用入口重量 + */ + @ExcelProperty(value = "使用入口重量") + private BigDecimal usedEntryWeight; + + /** + * 出口厚度 + */ + @ExcelProperty(value = "出口厚度") + private BigDecimal exitThick; + + /** + * 出口宽度 + */ + @ExcelProperty(value = "出口宽度") + private BigDecimal exitWidth; + + /** + * 出口长度 + */ + @ExcelProperty(value = "出口长度") + private BigDecimal exitLength; + + /** + * 出口重量 + */ + @ExcelProperty(value = "出口重量") + private BigDecimal exitWeight; + + /** + * 计算出口重量 + */ + @ExcelProperty(value = "计算出口重量") + private BigDecimal calcExitWeight; + + /** + * 实测出口重量 + */ + @ExcelProperty(value = "实测出口重量") + private BigDecimal measExitWeight; + + /** + * 出口正偏差 + */ + @ExcelProperty(value = "出口正偏差") + private BigDecimal exitPosDev; + + /** + * 出口负偏差 + */ + @ExcelProperty(value = "出口负偏差") + private BigDecimal exitNegDev; + + /** + * 内径 + */ + @ExcelProperty(value = "内径") + private BigDecimal innerDiameter; + + /** + * 外径 + */ + @ExcelProperty(value = "外径") + private BigDecimal outerDiameter; + + /** + * 头部位置 + */ + @ExcelProperty(value = "头部位置") + private BigDecimal headpos; + + /** + * 尾部位置 + */ + @ExcelProperty(value = "尾部位置") + private BigDecimal tailpos; + + /** + * 质量 + */ + @ExcelProperty(value = "质量") + private BigDecimal quality; + + /** + * 板形质量 + */ + @ExcelProperty(value = "板形质量") + private BigDecimal shapeQuality; + + /** + * 机组 + */ + @ExcelProperty(value = "机组") + private String crew; + + /** + * 报告标志 + */ + @ExcelProperty(value = "报告标志") + private Long reportFlag; + + /** + * 子ID + */ + @ExcelProperty(value = "子ID") + private Long subid; + + /** + * 序号 + */ + @ExcelProperty(value = "序号") + private Long rn; + + /** + * 上线时间 + */ + @ExcelProperty(value = "上线时间") + private Date onlineDate; + + /** + * 开始时间 + */ + @ExcelProperty(value = "开始时间") + private Date startDate; + + /** + * 结束时间 + */ + @ExcelProperty(value = "结束时间") + private Date endDate; + + /** + * 焊接时间 + */ + @ExcelProperty(value = "焊接时间") + private Date weldedDate; + + /** + * 数据写入时间(来源系统) + */ + @ExcelProperty(value = "数据写入时间(来源系统)") + private Date insdate; + + /** + * 同步时间 + */ + @ExcelProperty(value = "同步时间") + private Date syncTime; + + /** + * 同步备注 + */ + @ExcelProperty(value = "同步备注") + private String comments; + + /** + * 备注 + */ + @ExcelProperty(value = "备注") + private String remark; + + +} diff --git a/klp-mes/src/main/java/com/klp/mes/excoil/mapper/MesExCoilMapper.java b/klp-mes/src/main/java/com/klp/mes/excoil/mapper/MesExCoilMapper.java new file mode 100644 index 00000000..640ce386 --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/excoil/mapper/MesExCoilMapper.java @@ -0,0 +1,17 @@ +package com.klp.mes.excoil.mapper; + +import com.klp.mes.excoil.domain.MesExCoil; +import com.klp.mes.excoil.domain.vo.MesExCoilVo; +import com.klp.common.core.mapper.BaseMapperPlus; +import java.util.Date; + +/** + * 出口卷数据同步Mapper接口 + * + * @author klp + * @date 2026-05-21 + */ +public interface MesExCoilMapper extends BaseMapperPlus { + + Date getMaxInsdate(); +} diff --git a/klp-mes/src/main/java/com/klp/mes/excoil/service/IMesExCoilService.java b/klp-mes/src/main/java/com/klp/mes/excoil/service/IMesExCoilService.java new file mode 100644 index 00000000..809224ee --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/excoil/service/IMesExCoilService.java @@ -0,0 +1,55 @@ +package com.klp.mes.excoil.service; + +import com.klp.mes.excoil.domain.MesExCoil; +import com.klp.mes.excoil.domain.vo.MesExCoilVo; +import com.klp.mes.excoil.domain.bo.MesExCoilBo; +import com.klp.common.core.page.TableDataInfo; +import com.klp.common.core.domain.PageQuery; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** + * 出口卷数据同步Service接口 + * + * @author klp + * @date 2026-05-21 + */ +public interface IMesExCoilService { + + /** + * 查询出口卷数据同步 + */ + MesExCoilVo queryById(Long exId); + + /** + * 查询出口卷数据同步列表 + */ + TableDataInfo queryPageList(MesExCoilBo bo, PageQuery pageQuery); + + /** + * 查询出口卷数据同步列表 + */ + List queryList(MesExCoilBo bo); + + /** + * 新增出口卷数据同步 + */ + Boolean insertByBo(MesExCoilBo bo); + + /** + * 修改出口卷数据同步 + */ + Boolean updateByBo(MesExCoilBo bo); + + /** + * 校验并批量删除出口卷数据同步信息 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + +// /** +// * 从 L2 系统同步出口卷实绩数据 +// */ +// Map syncExCoilData(); +} diff --git a/klp-mes/src/main/java/com/klp/mes/excoil/service/impl/MesExCoilServiceImpl.java b/klp-mes/src/main/java/com/klp/mes/excoil/service/impl/MesExCoilServiceImpl.java new file mode 100644 index 00000000..b31615ac --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/excoil/service/impl/MesExCoilServiceImpl.java @@ -0,0 +1,359 @@ +package com.klp.mes.excoil.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.beans.factory.annotation.Value; +import org.springframework.http.client.SimpleClientHttpRequestFactory; +import org.springframework.stereotype.Service; +import org.springframework.web.client.RestTemplate; +import com.klp.mes.excoil.domain.bo.MesExCoilBo; +import com.klp.mes.excoil.domain.vo.MesExCoilVo; +import com.klp.mes.excoil.domain.MesExCoil; +import com.klp.mes.excoil.mapper.MesExCoilMapper; +import com.klp.mes.excoil.service.IMesExCoilService; + +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RequiredArgsConstructor +@Service +public class MesExCoilServiceImpl implements IMesExCoilService { + + private final MesExCoilMapper baseMapper; + + @Value("${server.port:8080}") + private int serverPort; + + private RestTemplate restTemplate; + + private RestTemplate getRestTemplate() { + if (restTemplate == null) { + SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); + factory.setConnectTimeout(5000); + factory.setReadTimeout(600000); + restTemplate = new RestTemplate(factory); + } + return restTemplate; + } + + private String getInternalApiBaseUrl() { + return "http://127.0.0.1:" + serverPort; + } + + @Override + public MesExCoilVo queryById(Long exId){ + return baseMapper.selectVoById(exId); + } + + @Override + public TableDataInfo queryPageList(MesExCoilBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + @Override + public List queryList(MesExCoilBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(MesExCoilBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(StringUtils.isNotBlank(bo.getExcoilid()), MesExCoil::getExcoilid, bo.getExcoilid()); + lqw.eq(StringUtils.isNotBlank(bo.getEncoilid()), MesExCoil::getEncoilid, bo.getEncoilid()); + lqw.eq(StringUtils.isNotBlank(bo.getHotCoilid()), MesExCoil::getHotCoilid, bo.getHotCoilid()); + lqw.eq(StringUtils.isNotBlank(bo.getGrade()), MesExCoil::getGrade, bo.getGrade()); + lqw.eq(StringUtils.isNotBlank(bo.getOrderQuality()), MesExCoil::getOrderQuality, bo.getOrderQuality()); + lqw.eq(StringUtils.isNotBlank(bo.getProductType()), MesExCoil::getProductType, bo.getProductType()); + lqw.eq(StringUtils.isNotBlank(bo.getStatus()), MesExCoil::getStatus, bo.getStatus()); + lqw.eq(StringUtils.isNotBlank(bo.getShift()), MesExCoil::getShift, bo.getShift()); + lqw.eq(StringUtils.isNotBlank(bo.getParkType()), MesExCoil::getParkType, bo.getParkType()); + lqw.eq(StringUtils.isNotBlank(bo.getSideTrim()), MesExCoil::getSideTrim, bo.getSideTrim()); + lqw.eq(bo.getEntryThick() != null, MesExCoil::getEntryThick, bo.getEntryThick()); + lqw.eq(bo.getEntryWidth() != null, MesExCoil::getEntryWidth, bo.getEntryWidth()); + lqw.eq(bo.getEntryWeight() != null, MesExCoil::getEntryWeight, bo.getEntryWeight()); + lqw.eq(bo.getUsedEntryWeight() != null, MesExCoil::getUsedEntryWeight, bo.getUsedEntryWeight()); + lqw.eq(bo.getExitThick() != null, MesExCoil::getExitThick, bo.getExitThick()); + lqw.eq(bo.getExitWidth() != null, MesExCoil::getExitWidth, bo.getExitWidth()); + lqw.eq(bo.getExitLength() != null, MesExCoil::getExitLength, bo.getExitLength()); + lqw.eq(bo.getExitWeight() != null, MesExCoil::getExitWeight, bo.getExitWeight()); + lqw.eq(bo.getCalcExitWeight() != null, MesExCoil::getCalcExitWeight, bo.getCalcExitWeight()); + lqw.eq(bo.getMeasExitWeight() != null, MesExCoil::getMeasExitWeight, bo.getMeasExitWeight()); + lqw.eq(bo.getExitPosDev() != null, MesExCoil::getExitPosDev, bo.getExitPosDev()); + lqw.eq(bo.getExitNegDev() != null, MesExCoil::getExitNegDev, bo.getExitNegDev()); + lqw.eq(bo.getInnerDiameter() != null, MesExCoil::getInnerDiameter, bo.getInnerDiameter()); + lqw.eq(bo.getOuterDiameter() != null, MesExCoil::getOuterDiameter, bo.getOuterDiameter()); + lqw.eq(bo.getHeadpos() != null, MesExCoil::getHeadpos, bo.getHeadpos()); + lqw.eq(bo.getTailpos() != null, MesExCoil::getTailpos, bo.getTailpos()); + lqw.eq(bo.getQuality() != null, MesExCoil::getQuality, bo.getQuality()); + lqw.eq(bo.getShapeQuality() != null, MesExCoil::getShapeQuality, bo.getShapeQuality()); + lqw.eq(StringUtils.isNotBlank(bo.getCrew()), MesExCoil::getCrew, bo.getCrew()); + lqw.eq(bo.getReportFlag() != null, MesExCoil::getReportFlag, bo.getReportFlag()); + lqw.eq(bo.getSubid() != null, MesExCoil::getSubid, bo.getSubid()); + lqw.eq(bo.getRn() != null, MesExCoil::getRn, bo.getRn()); + lqw.eq(bo.getOnlineDate() != null, MesExCoil::getOnlineDate, bo.getOnlineDate()); + lqw.eq(bo.getStartDate() != null, MesExCoil::getStartDate, bo.getStartDate()); + lqw.eq(bo.getEndDate() != null, MesExCoil::getEndDate, bo.getEndDate()); + lqw.eq(bo.getWeldedDate() != null, MesExCoil::getWeldedDate, bo.getWeldedDate()); + lqw.eq(bo.getInsdate() != null, MesExCoil::getInsdate, bo.getInsdate()); + lqw.eq(bo.getSyncTime() != null, MesExCoil::getSyncTime, bo.getSyncTime()); + lqw.eq(StringUtils.isNotBlank(bo.getComments()), MesExCoil::getComments, bo.getComments()); + return lqw; + } + + @Override + public Boolean insertByBo(MesExCoilBo bo) { + MesExCoil add = BeanUtil.toBean(bo, MesExCoil.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setExId(add.getExId()); + } + return flag; + } + + @Override + public Boolean updateByBo(MesExCoilBo bo) { + MesExCoil update = BeanUtil.toBean(bo, MesExCoil.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + private void validEntityBeforeSave(MesExCoil entity){ + } + + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + } + return baseMapper.deleteBatchIds(ids) > 0; + } + +// @Override +// public Map syncExCoilData() { +// Date maxInsdate = baseMapper.getMaxInsdate(); +// boolean isFullSync = (maxInsdate == null); +// +// List> apiRows; +// if (isFullSync) { +// apiRows = fetchAllFromApi(); +// } else { +// apiRows = fetchIncrementalFromApi(maxInsdate); +// } +// +// if (apiRows == null || apiRows.isEmpty()) { +// Map result = new HashMap<>(); +// result.put("totalFetched", 0); +// result.put("insertCount", 0); +// result.put("updateCount", 0); +// result.put("fullSync", isFullSync); +// return result; +// } +// +// int insertCount = 0; +// int updateCount = 0; +// Date now = new Date(); +// +// // 1. 批量转换所有数据 +// List allEntities = new ArrayList<>(apiRows.size()); +// for (Map row : apiRows) { +// MesExCoil entity = mapRowToEntity(row); +// entity.setSyncTime(now); +// allEntities.add(entity); +// } +// +//// // 2. 收集所有 excoilid +//// List excoilids = allEntities.stream() +//// .map(MesExCoil::getExcoilid) +//// .filter(StringUtils::isNotBlank) +//// .distinct() +//// .collect(java.util.stream.Collectors.toList()); +// +//// // 3. 批量查询已存在的记录 +//// Map existingMap = new HashMap<>(); +//// if (!excoilids.isEmpty()) { +//// LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); +//// wrapper.in(MesExCoil::getExcoilid, excoilids); +//// List existingList = baseMapper.selectList(wrapper); +//// existingMap = existingList.stream() +//// .collect(java.util.stream.Collectors.toMap(MesExCoil::getExcoilid, v -> v, (a, b) -> a)); +//// } +// +// // 4. 分离新增和更新的记录 +// List toInsert = new ArrayList<>(); +//// List toUpdate = new ArrayList<>(); +// +// for (MesExCoil entity : allEntities) { +//// MesExCoil existing = existingMap.get(entity.getExcoilid()); +//// if (existing != null) { +//// // 更新:设置主键 +//// entity.setExId(existing.getExId()); +//// toUpdate.add(entity); +//// } else { +// // 新增 +// toInsert.add(entity); +//// } +// } +// +// // 5. 批量插入 +// if (!toInsert.isEmpty()) { +// // 分批插入,每批500条 +// int batchSize = 500; +// for (int i = 0; i < toInsert.size(); i += batchSize) { +// int end = Math.min(i + batchSize, toInsert.size()); +// List batch = toInsert.subList(i, end); +// baseMapper.insertBatch(batch); +// } +// insertCount = toInsert.size(); +// } +// +//// // 6. 批量更新 +//// if (!toUpdate.isEmpty()) { +//// // 分批更新,每批500条 +//// int batchSize = 500; +//// for (int i = 0; i < toUpdate.size(); i += batchSize) { +//// int end = Math.min(i + batchSize, toUpdate.size()); +//// List batch = toUpdate.subList(i, end); +//// baseMapper.updateBatchById(batch, batch.size()); +//// } +//// updateCount = toUpdate.size(); +//// } +// +// Map result = new HashMap<>(); +// result.put("totalFetched", apiRows.size()); +// result.put("insertCount", insertCount); +// result.put("updateCount", updateCount); +// result.put("fullSync", isFullSync); +// return result; +// } + +// @SuppressWarnings("unchecked") +// private List> fetchAllFromApi() { +// List> all = new ArrayList<>(); +// int page = 1; +// int pageSize = 500; +// String baseUrl = getInternalApiBaseUrl(); +// +// while (true) { +// String url = baseUrl + "/sql-server-api/excoil?page=" + page + "&pageSize=" + pageSize; +// Map response = getRestTemplate().getForObject(url, Map.class); +// if (response == null) break; +// +// Map data = (Map) response.get("data"); +// if (data == null) break; +// +// List> rows = (List>) data.get("rows"); +// if (rows == null || rows.isEmpty()) break; +// +// all.addAll(rows); +// if (rows.size() < pageSize) break; +// page++; +// } +// return all; +// } +// +// @SuppressWarnings("unchecked") +// private List> fetchIncrementalFromApi(Date since) { +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); +// String startTime = sdf.format(since); +// String baseUrl = getInternalApiBaseUrl(); +// String url = baseUrl + "/sql-server-api/excoil/by-insdate?startTime=" + startTime; +// +// Map response = getRestTemplate().getForObject(url, Map.class); +// if (response != null && response.get("data") instanceof List) { +// return (List>) response.get("data"); +// } +// return new ArrayList<>(); +// } +// +// private MesExCoil mapRowToEntity(Map row) { +// MesExCoil entity = new MesExCoil(); +// entity.setExcoilid(str(row.get("excoilid"))); +// entity.setEncoilid(str(row.get("encoilid"))); +// entity.setHotCoilid(str(row.get("hot_coilid"))); +// entity.setGrade(str(row.get("grade"))); +// entity.setOrderQuality(str(row.get("order_quality"))); +// entity.setProductType(str(row.get("product_type"))); +// entity.setStatus(str(row.get("status"))); +// entity.setShift(str(row.get("shift"))); +// entity.setParkType(str(row.get("park_type"))); +// entity.setSideTrim(str(row.get("side_trim"))); +// entity.setEntryThick(bd(row.get("entry_thick"))); +// entity.setEntryWidth(bd(row.get("entry_width"))); +// entity.setEntryWeight(bd(row.get("entry_weight"))); +// entity.setUsedEntryWeight(bd(row.get("used_entry_weight"))); +// entity.setExitThick(bd(row.get("exit_thick"))); +// entity.setExitWidth(bd(row.get("exit_width"))); +// entity.setExitLength(bd(row.get("exit_length"))); +// entity.setExitWeight(bd(row.get("exit_weight"))); +// entity.setCalcExitWeight(bd(row.get("calc_exit_weight"))); +// entity.setMeasExitWeight(bd(row.get("meas_exit_weight"))); +// entity.setExitPosDev(bd(row.get("exit_pos_dev"))); +// entity.setExitNegDev(bd(row.get("exit_neg_dev"))); +// entity.setInnerDiameter(bd(row.get("inner_diameter"))); +// entity.setOuterDiameter(bd(row.get("outer_diameter"))); +// entity.setHeadpos(bd(row.get("headpos"))); +// entity.setTailpos(bd(row.get("tailpos"))); +// entity.setQuality(bd(row.get("quality"))); +// entity.setShapeQuality(bd(row.get("shape_quality"))); +// entity.setCrew(str(row.get("crew"))); +// entity.setReportFlag(longVal(row.get("report_flag"))); +// entity.setSubid(longVal(row.get("subid"))); +// entity.setRn(longVal(row.get("rn"))); +// entity.setOnlineDate(parseDate(row.get("online_date"))); +// entity.setStartDate(parseDate(row.get("start_date"))); +// entity.setEndDate(parseDate(row.get("end_date"))); +// entity.setWeldedDate(parseDate(row.get("welded_date"))); +// entity.setInsdate(parseDate(row.get("insdate"))); +// entity.setComments(str(row.get("comments"))); +// entity.setRemark(str(row.get("remark"))); +// return entity; +// } +// +// private String str(Object value) { +// return value == null ? null : String.valueOf(value); +// } +// +// private BigDecimal bd(Object value) { +// if (value == null) return null; +// if (value instanceof BigDecimal) return (BigDecimal) value; +// if (value instanceof Number) return BigDecimal.valueOf(((Number) value).doubleValue()); +// try { return new BigDecimal(String.valueOf(value)); } catch (Exception e) { return null; } +// } +// +// private Long longVal(Object value) { +// if (value == null) return null; +// if (value instanceof Number) return ((Number) value).longValue(); +// try { return Long.parseLong(String.valueOf(value)); } catch (Exception e) { return null; } +// } +// +// private Date parseDate(Object value) { +// if (value == null) return null; +// if (value instanceof Date) return (Date) value; +// String s = String.valueOf(value); +// if (s.isEmpty() || "null".equals(s)) return null; +// try { +// if (s.contains("T")) { +// s = s.replace("T", " "); +// if (s.length() > 19) s = s.substring(0, 19); +// } +// return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(s); +// } catch (Exception e) { +// return null; +// } +// } +} diff --git a/klp-mes/src/main/java/com/klp/mes/qc/domain/QcInspectionTask.java b/klp-mes/src/main/java/com/klp/mes/qc/domain/QcInspectionTask.java index 5464c0ab..3f4d1092 100644 --- a/klp-mes/src/main/java/com/klp/mes/qc/domain/QcInspectionTask.java +++ b/klp-mes/src/main/java/com/klp/mes/qc/domain/QcInspectionTask.java @@ -86,6 +86,10 @@ public class QcInspectionTask extends BaseEntity { * 钢卷ID集合,多个使用英文逗号分隔 */ private String coilIds; + /** + * 钢卷号集合 + */ + private String enterCoilNos; /** * 删除标志(0=正常,1=已删除) */ diff --git a/klp-mes/src/main/java/com/klp/mes/qc/domain/bo/QcInspectionTaskBo.java b/klp-mes/src/main/java/com/klp/mes/qc/domain/bo/QcInspectionTaskBo.java index ac092ea1..cb8a45e2 100644 --- a/klp-mes/src/main/java/com/klp/mes/qc/domain/bo/QcInspectionTaskBo.java +++ b/klp-mes/src/main/java/com/klp/mes/qc/domain/bo/QcInspectionTaskBo.java @@ -99,5 +99,8 @@ public class QcInspectionTaskBo extends BaseEntity { */ private String coilIds; - + /** + * 钢卷号集合 + */ + private String enterCoilNos; } diff --git a/klp-mes/src/main/java/com/klp/mes/qc/domain/vo/QcInspectionTaskVo.java b/klp-mes/src/main/java/com/klp/mes/qc/domain/vo/QcInspectionTaskVo.java index 9ef1cd0e..898d2876 100644 --- a/klp-mes/src/main/java/com/klp/mes/qc/domain/vo/QcInspectionTaskVo.java +++ b/klp-mes/src/main/java/com/klp/mes/qc/domain/vo/QcInspectionTaskVo.java @@ -124,6 +124,11 @@ public class QcInspectionTaskVo { */ private String coilIds; + /** + * 钢卷号集合 + */ + private String enterCoilNos; + private List coilList; diff --git a/klp-mes/src/main/java/com/klp/mes/qc/service/impl/QcInspectionTaskServiceImpl.java b/klp-mes/src/main/java/com/klp/mes/qc/service/impl/QcInspectionTaskServiceImpl.java index c0aec3cb..71e0b94c 100644 --- a/klp-mes/src/main/java/com/klp/mes/qc/service/impl/QcInspectionTaskServiceImpl.java +++ b/klp-mes/src/main/java/com/klp/mes/qc/service/impl/QcInspectionTaskServiceImpl.java @@ -135,6 +135,7 @@ public class QcInspectionTaskServiceImpl implements IQcInspectionTaskService { lqw.eq(bo.getAuditTime() != null, QcInspectionTask::getAuditTime, bo.getAuditTime()); lqw.eq(StringUtils.isNotBlank(bo.getResult()), QcInspectionTask::getResult, bo.getResult()); lqw.like(StringUtils.isNotBlank(bo.getCoilIds()), QcInspectionTask::getCoilIds, bo.getCoilIds()); + lqw.like(StringUtils.isNotBlank(bo.getEnterCoilNos()), QcInspectionTask::getEnterCoilNos, bo.getEnterCoilNos()); return lqw; } diff --git a/klp-mes/src/main/resources/mapper/eqp/EqpEquipmentChecklistMapper.xml b/klp-mes/src/main/resources/mapper/eqp/EqpEquipmentChecklistMapper.xml new file mode 100644 index 00000000..c85914b9 --- /dev/null +++ b/klp-mes/src/main/resources/mapper/eqp/EqpEquipmentChecklistMapper.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/klp-mes/src/main/resources/mapper/eqp/EqpEquipmentInspectionRecordMapper.xml b/klp-mes/src/main/resources/mapper/eqp/EqpEquipmentInspectionRecordMapper.xml new file mode 100644 index 00000000..a7714b48 --- /dev/null +++ b/klp-mes/src/main/resources/mapper/eqp/EqpEquipmentInspectionRecordMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/klp-mes/src/main/resources/mapper/eqp/EqpEquipmentPartMapper.xml b/klp-mes/src/main/resources/mapper/eqp/EqpEquipmentPartMapper.xml new file mode 100644 index 00000000..39853e5f --- /dev/null +++ b/klp-mes/src/main/resources/mapper/eqp/EqpEquipmentPartMapper.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + diff --git a/klp-mes/src/main/resources/mapper/excoil/MesExCoilMapper.xml b/klp-mes/src/main/resources/mapper/excoil/MesExCoilMapper.xml new file mode 100644 index 00000000..d7abc93e --- /dev/null +++ b/klp-mes/src/main/resources/mapper/excoil/MesExCoilMapper.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/klp-mes/src/main/resources/mapper/qc/QcInspectionTaskMapper.xml b/klp-mes/src/main/resources/mapper/qc/QcInspectionTaskMapper.xml index 860ab064..4c09a356 100644 --- a/klp-mes/src/main/resources/mapper/qc/QcInspectionTaskMapper.xml +++ b/klp-mes/src/main/resources/mapper/qc/QcInspectionTaskMapper.xml @@ -21,6 +21,7 @@ + diff --git a/klp-ui/src/api/wms/coilComparison.js b/klp-ui/src/api/wms/coilComparison.js new file mode 100644 index 00000000..716514d3 --- /dev/null +++ b/klp-ui/src/api/wms/coilComparison.js @@ -0,0 +1,9 @@ +import request from '@/utils/request' + +export function getExcoilStatus(query) { + return request({ + url: '/wms/coil-comparison/excoil-status', + method: 'get', + params: query + }) +} diff --git a/klp-ui/src/api/wms/receivePlan.js b/klp-ui/src/api/wms/receivePlan.js index 48ca3419..6670214f 100644 --- a/klp-ui/src/api/wms/receivePlan.js +++ b/klp-ui/src/api/wms/receivePlan.js @@ -51,3 +51,14 @@ export function checkReceivePlan(data) { data: data }) } + +/** + * 大批量删除应收货物计划明细 + */ +export function delReceivePlanBatch(receiveIdList) { + return request({ + url: '/wms/receivePlan/batchDelete', + method: 'delete', + data: receiveIdList || [] + }) +} diff --git a/klp-ui/src/api/wms/transferOrderItem.js b/klp-ui/src/api/wms/transferOrderItem.js index b1c812e7..0ff3a191 100644 --- a/klp-ui/src/api/wms/transferOrderItem.js +++ b/klp-ui/src/api/wms/transferOrderItem.js @@ -126,6 +126,21 @@ export function confirmTransferOrderItem(item) { }) } +/** + * 批量确认调拨 + */ +export function batchConfirmTransferOrderItem(list) { + if (!list || list.length === 0) { + return Promise.reject('参数错误') + } + + return request({ + url: '/wms/transferOrderItem/batchConfirm', + method: 'post', + data: list + }) +} + /** * 取消调拨 */ diff --git a/klp-ui/src/components/AttendanceTemplateManager/index.vue b/klp-ui/src/components/AttendanceTemplateManager/index.vue new file mode 100644 index 00000000..bee9e2ee --- /dev/null +++ b/klp-ui/src/components/AttendanceTemplateManager/index.vue @@ -0,0 +1,318 @@ + + + + + \ No newline at end of file diff --git a/klp-ui/src/components/EmployeeSelector/index.vue b/klp-ui/src/components/EmployeeSelector/index.vue index 8d46322a..9129dc18 100644 --- a/klp-ui/src/components/EmployeeSelector/index.vue +++ b/klp-ui/src/components/EmployeeSelector/index.vue @@ -16,23 +16,93 @@ - - + +
+ +
+
可选员工 (已选 {{ leftSelectedKeys.length }}/总计 {{ availableList.length }})
+ +
+
+ + + + + {{ item.dept }} - {{ item.name }} ({{ item.jobType }}) + 已选 +
+
暂无数据
+
+
+ + +
+ + 添加 + + + 移除 + +
+ + +
+
已选员工 (共 {{ selectedList.length }}/已选 {{ rightSelectedKeys.length }})
+ +
+
+ + + + + {{ item.dept }} - {{ item.name }} ({{ item.jobType }}) +
+
暂无数据
+
+
+
@@ -101,9 +171,14 @@ export default { open: false, loading: false, searchQuery: '', + leftSearchQuery: '', + rightSearchQuery: '', selectedIds: [], selectedId: '', - selectedEmployee: {} + selectedEmployee: {}, + // 用于记录选中状态(解决重名问题) + leftSelectedKeys: [], + rightSelectedKeys: [] } }, computed: { @@ -132,12 +207,73 @@ export default { disabled: this.disabledIdList.includes(employee[this.keyField].toString()) })) }, - transferData() { - return this.employeeList.map(employee => ({ - [this.keyField]: employee[this.keyField], - label: `${employee.dept} - ${employee.name} (${employee.jobType})`, - disabled: employee.disabled - })) + // 获取重名的姓名列表 + duplicateNames() { + const nameCount = {} + this.rawEmployeeList.forEach(employee => { + const name = employee.name || '' + nameCount[name] = (nameCount[name] || 0) + 1 + }) + return Object.keys(nameCount).filter(name => nameCount[name] > 1) + }, + // 可选列表(显示所有员工,包括已选的) + availableList() { + const duplicates = this.duplicateNames + return this.rawEmployeeList.map(employee => { + // 使用 keyField 作为唯一标识 + const employeeId = employee[this.keyField] + const idStr = String(employeeId) + return { + ...employee, + disabled: this.disabledIdList.includes(idStr), + isDuplicate: duplicates.includes(employee.name || ''), + isSelected: this.selectedIds.includes(idStr) + } + }) + }, + // 已选列表 + selectedList() { + const duplicates = this.duplicateNames + // 使用 keyField 作为唯一标识,支持同名不同ID的员工 + return this.selectedIds + .map(id => { + const idStr = String(id) + const matched = this.rawEmployeeList.filter(item => String(item[this.keyField]) === idStr) + const employee = matched.length > 0 ? matched[0] : null + if (employee) { + // 创建新对象,避免修改原始数据 + return { + ...employee, + isDuplicate: duplicates.includes(employee.name || '') + } + } + return null + }) + .filter(item => item !== null) + }, + // 左侧过滤后的列表 + filteredAvailableList() { + if (!this.leftSearchQuery) { + return this.availableList + } + const query = this.leftSearchQuery.toLowerCase() + return this.availableList.filter(item => { + const name = (item.name || '').toLowerCase() + const dept = (item.dept || '').toLowerCase() + return name.includes(query) || dept.includes(query) + }) + }, + // 右侧过滤后的列表 + filteredSelectedList() { + if (!this.rightSearchQuery) { + return this.selectedList + } + const query = this.rightSearchQuery.toLowerCase() + return this.selectedList.filter(item => { + const name = (item.name || '').toLowerCase() + const dept = (item.dept || '').toLowerCase() + return name.includes(query) || dept.includes(query) + }) } }, watch: { @@ -145,7 +281,12 @@ export default { handler(newVal) { if (this.multiple) { if (newVal) { - this.selectedIds = newVal.split(',').map(id => id.trim()).filter(id => id).map(id => isNaN(Number(id)) ? id : Number(id)) + // 统一使用字符串类型的ID + this.selectedIds = newVal.split(',').map(id => { + const trimmedId = id.trim() + if (!trimmedId) return null + return String(trimmedId) + }).filter(id => id !== null) } else { this.selectedIds = [] } @@ -164,9 +305,37 @@ export default { methods: { toggleDialog() { if (!this.open) { - this.getEmployeeList() + // 清空临时勾选状态 + this.leftSelectedKeys = [] + this.rightSelectedKeys = [] + + if (this.rawEmployeeList.length > 0) { + // 如果列表已加载,直接恢复选中状态 + this.restoreSelectedIds() + this.open = true + } else { + // 如果列表未加载,先加载再恢复 + this.getEmployeeList().then(() => { + this.restoreSelectedIds() + this.open = true + }) + } + } else { + this.open = false + } + }, + + // 恢复选中状态 + restoreSelectedIds() { + if (this.multiple && this.value) { + this.selectedIds = this.value.split(',').map(id => { + const trimmedId = id.trim() + if (!trimmedId) return null + return String(trimmedId) + }).filter(id => id !== null) + } else { + this.selectedIds = [] } - this.open = !this.open }, getEmployeeList() { @@ -177,7 +346,11 @@ export default { } return new Promise((resolve) => { listEmployeeInfo(params).then(response => { - this.rawEmployeeList = response.rows; + // 处理重名情况:确保每个员工有唯一标识 + // 过滤掉已离职的员工 + this.rawEmployeeList = (response.rows || []).filter(employee => { + return !this.isEmployeeResigned(employee) + }) this.loading = false resolve() }).catch(() => { @@ -208,6 +381,12 @@ export default { return isDisabled }, + // 判断员工是否已离职 + isEmployeeResigned(employee) { + // isLeave: 1 表示已离职,0 表示在职 + return employee.isLeave === 1 || employee.isLeave === '1' + }, + rowClassName({ row }) { if (this.isSelected(row)) { return 'selected-row' @@ -235,14 +414,109 @@ export default { } }, - transferFilterMethod(query, item) { - return item.label.toLowerCase().includes(query.toLowerCase()) + // ========== 多选模式方法 ========== + + // 判断左侧是否选中 + isLeftSelected(item) { + return this.leftSelectedKeys.includes(String(item[this.keyField])) + }, + + // 判断右侧是否选中 + isRightSelected(item) { + return this.rightSelectedKeys.includes(String(item[this.keyField])) + }, + + // 切换左侧选中状态 + toggleItem(item) { + if (item.disabled) return + const key = String(item[this.keyField]) + const index = this.leftSelectedKeys.indexOf(key) + if (index > -1) { + this.leftSelectedKeys.splice(index, 1) + } else { + this.leftSelectedKeys.push(key) + } + }, + + // 切换右侧选中状态 + toggleSelectedItem(item) { + const key = String(item[this.keyField]) + const index = this.rightSelectedKeys.indexOf(key) + if (index > -1) { + this.rightSelectedKeys.splice(index, 1) + } else { + this.rightSelectedKeys.push(key) + } + }, + + // 添加单个到已选 + addToSelected(item) { + if (item.disabled) return + // 统一使用字符串类型的ID + const key = String(item[this.keyField]) + // 检查是否已存在 + const exists = this.selectedIds.includes(key) + if (!exists) { + this.selectedIds.push(key) + } + }, + + // 从已选移除单个 + removeFromSelected(item) { + // 统一使用字符串类型的ID + const key = String(item[this.keyField]) + const index = this.selectedIds.indexOf(key) + if (index > -1) { + this.selectedIds.splice(index, 1) + } + }, + + // 添加左侧勾选的员工 + addSelected() { + this.leftSelectedKeys.forEach(key => { + const keyStr = String(key) + if (!this.selectedIds.includes(keyStr)) { + this.selectedIds.push(keyStr) + } + }) + this.leftSelectedKeys = [] + }, + + // 移除右侧勾选的员工 + removeSelected() { + this.rightSelectedKeys.forEach(key => { + const keyStr = String(key) + const index = this.selectedIds.indexOf(keyStr) + if (index > -1) { + this.selectedIds.splice(index, 1) + } + }) + this.rightSelectedKeys = [] + }, + + // 添加所有可选员工(未禁用且未选中的) + addAll() { + this.availableList.forEach(item => { + if (!item.disabled && !item.isSelected) { + const keyStr = String(item[this.keyField]) + if (!this.selectedIds.includes(keyStr)) { + this.selectedIds.push(keyStr) + } + } + }) + }, + + // 移除所有已选员工 + removeAll() { + this.selectedIds = [] + this.rightSelectedKeys = [] }, confirmSelection() { if (this.multiple) { + // 使用ID作为唯一标识,避免重名问题 this.$emit('input', this.selectedIds.join(',')) - const selectedEmployees = this.rawEmployeeList.filter(item => this.selectedIds.includes(item[this.keyField])) + const selectedEmployees = this.selectedList this.$emit('change', selectedEmployees) } this.open = false @@ -251,10 +525,17 @@ export default { cancelSelection() { if (this.multiple) { if (this.value) { - this.selectedIds = this.value.split(',').map(id => id.trim()).filter(id => id).map(id => isNaN(Number(id)) ? id : Number(id)) + // 统一使用字符串类型 + this.selectedIds = this.value.split(',').map(id => { + const trimmedId = id.trim() + if (!trimmedId) return null + return String(trimmedId) + }).filter(id => id !== null) } else { this.selectedIds = [] } + this.leftSelectedKeys = [] + this.rightSelectedKeys = [] } else { if (this.value) { this.findSelectedEmployee(this.value) @@ -295,29 +576,168 @@ export default { margin-top: 15px; } -::v-deep .el-transfer { +/* 自定义穿梭框样式 */ +.custom-transfer { display: flex; justify-content: center; + align-items: flex-start; + gap: 20px; + padding: 10px; +} + +.transfer-panel { + width: 350px; + border: 1px solid #dcdfe6; + border-radius: 4px; + background: #fff; + display: flex; + flex-direction: column; +} + +.panel-header { + padding: 12px 15px; + font-weight: 600; + border-bottom: 1px solid #dcdfe6; + background: #f5f7fa; +} + +.count-info { + font-weight: normal; + font-size: 12px; + color: #909399; + margin-left: 8px; +} + +.panel-search { + padding: 10px; + border-bottom: 1px solid #f2f6fc; +} + +.search-input { + width: 100%; + padding: 6px 10px; + border: 1px solid #dcdfe6; + border-radius: 4px; + font-size: 13px; + box-sizing: border-box; +} + +.search-input:focus { + outline: none; + border-color: #409eff; +} + +.panel-body { + flex: 1; + overflow-y: auto; + max-height: 400px; +} + +.transfer-item { + display: flex; align-items: center; + padding: 10px 15px; + cursor: pointer; + border-bottom: 1px solid #f2f6fc; + transition: background-color 0.2s; } -::v-deep .el-transfer-panel { - width: 380px; +.transfer-item:hover:not(.disabled) { + background-color: #ecf5ff; } -::v-deep .el-transfer-panel__body { - height: 450px; +.transfer-item.disabled { + color: #c0c4cc; + cursor: not-allowed; } -::v-deep .el-transfer__buttons { - padding: 0 15px; +.transfer-item.selected { + background-color: #e8f4fd; +} + +.item-label { + flex: 1; + margin-left: 4px; + font-size: 13px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.duplicate-icon { + display: inline-flex; + align-items: center; + justify-content: center; + width: 18px; + height: 18px; + background-color: #ffb800; + color: #fff; + border-radius: 50%; + font-size: 12px; + margin-left: 2px; +} + +.duplicate-icon i { + font-size: 10px; +} + +.already-selected { + opacity: 0.6; +} + +.selected-tag { + font-size: 11px; + color: #67c23a; + background-color: #f0f9eb; + padding: 1px 4px; + border-radius: 2px; + margin-left: 4px; +} + +.resigned-tag { + font-size: 11px; + color: #f56c6c; + background-color: #fef0f0; + padding: 1px 4px; + border-radius: 2px; + margin-left: 4px; +} + +.id-badge { + font-size: 10px; + color: #909399; + background-color: #f5f7fa; + padding: 1px 3px; + border-radius: 2px; + margin-left: 4px; + font-family: monospace; +} + +/* 自定义 checkbox 样式 */ +.custom-checkbox { + width: 16px; + height: 16px; + cursor: pointer; + accent-color: #409eff; +} + +.custom-checkbox:disabled { + cursor: not-allowed; + opacity: 0.5; +} + +.transfer-buttons { display: flex; flex-direction: column; justify-content: center; + gap: 10px; + padding: 10px; } -::v-deep .el-transfer__button { - margin: 10px 0; +.empty-tip { + text-align: center; + color: #c0c4cc; + padding: 40px 0; } ::v-deep .el-table .selected-row { @@ -327,8 +747,4 @@ export default { ::v-deep .el-table .selected-row:hover { background-color: #ecf5ff !important; } - -::v-deep .el-transfer-panel__list.is-filterable { - height: calc(100% - 60px) -} diff --git a/klp-ui/src/components/KLPService/CustomerSelect/index.vue b/klp-ui/src/components/KLPService/CustomerSelect/index.vue index 0ce3c7c7..12d5bd76 100644 --- a/klp-ui/src/components/KLPService/CustomerSelect/index.vue +++ b/klp-ui/src/components/KLPService/CustomerSelect/index.vue @@ -1,5 +1,5 @@ @@ -21,6 +21,10 @@ style: { type: Object, default: () => ({}) + }, + pager: { + type: Boolean, + default: true } }, computed: { @@ -51,7 +55,7 @@ methods: { remoteSearchCustomer(query) { this.customerLoading = true; - listCustomer({ companyName: query, pageNum: 1, pageSize: 10 }).then(response => { + listCustomer({ companyName: query, pageNum: 1, pageSize: this.pager ? 10 : 10000 }).then(response => { this.customerList = response.rows; }).finally(() => { this.customerLoading = false; diff --git a/klp-ui/src/components/KLPService/OrderSelect/index.vue b/klp-ui/src/components/KLPService/OrderSelect/index.vue index 4d2068ef..efe07f99 100644 --- a/klp-ui/src/components/KLPService/OrderSelect/index.vue +++ b/klp-ui/src/components/KLPService/OrderSelect/index.vue @@ -2,11 +2,11 @@ { + this.options = res.rows.map(item => ({ + value: item.orderId, + label: item.orderCode + })) + }).catch(error => { + console.error('订单加载失败:', error) + }).finally(() => { + this.loading = false + }) + } + }, methods: { remoteMethod(query) { if (query !== '') { this.loading = true listPurchaseOrder({ pageNum: 1, - pageSize: 10, + pageSize: this.pager ? 10 : 10000, orderCode: query }).then(res => { this.loading = false diff --git a/klp-ui/src/components/KLPService/SchemeSelect/index.vue b/klp-ui/src/components/KLPService/SchemeSelect/index.vue index 57cf7838..71b7f138 100644 --- a/klp-ui/src/components/KLPService/SchemeSelect/index.vue +++ b/klp-ui/src/components/KLPService/SchemeSelect/index.vue @@ -72,7 +72,20 @@ -
+ + + + + +