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 1bdfd602..d817f335 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 @@ -413,6 +413,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..fb26c9dc --- /dev/null +++ b/klp-admin/src/main/java/com/klp/framework/controller/CoilComparisonController.java @@ -0,0 +1,120 @@ +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.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; + + @GetMapping("/excoil-status") + public R>> getExcoilStatus( + @RequestParam(required = false) String startTime, + @RequestParam(required = false) String endTime, + @RequestParam(required = false) String lineType) { + + 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); + + 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) { + String hotCoilId = excoil.get("HOT_COILID") != null ? String.valueOf(excoil.get("HOT_COILID")) : null; + Map item = new LinkedHashMap<>(); + item.put("excoilId", excoil.get("EXCOILID")); + item.put("coilId", excoil.get("COILID")); + item.put("hotCoilId", hotCoilId); + item.put("endDate", excoil.get("END_DATE")); + item.put("startDate", excoil.get("START_DATE")); + item.put("actualThick", excoil.get("ACTUAL_THICK")); + item.put("actualWidth", excoil.get("ACTUAL_WIDTH")); + item.put("actualWeight", excoil.get("ACTUAL_WEIGHT")); + item.put("processCode", excoil.get("PROCESS_CODE")); + + 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 { + 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 416eb7ce..e5845d22 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 @@ -154,6 +154,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..d2a73c6f 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-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..d8553f4b 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,12 @@ public class CrmOrderItemVo { @ExcelProperty(value = "用途") private String purpose; + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + /** * 订单信息 */ 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..0d34d6b3 --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/eqp/domain/bo/EqpEquipmentChecklistBo.java @@ -0,0 +1,66 @@ +package com.klp.mes.eqp.domain.bo; + +import com.klp.common.core.domain.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; +import javax.validation.constraints.*; + + +/** + * 设备检验清单业务对象 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; + + +} 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..2535a45a --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/eqp/service/impl/EqpEquipmentChecklistServiceImpl.java @@ -0,0 +1,115 @@ +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.mapper.EqpEquipmentChecklistMapper; +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; + + /** + * 查询设备检验清单 + */ + @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); + return TableDataInfo.build(result); + } + + /** + * 查询设备检验清单列表 + */ + @Override + public List queryList(EqpEquipmentChecklistBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + 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..b79232aa --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/eqp/service/impl/EqpEquipmentPartServiceImpl.java @@ -0,0 +1,148 @@ +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 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 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()) { + LambdaQueryWrapper checklistLqw = Wrappers.lambdaQuery(); + checklistLqw.in(EqpEquipmentChecklist::getPartId, partIds); + List checklistList = checklistMapper.selectVoList(checklistLqw); + 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..34493f41 --- /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..348a4736 --- /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..b5363752 --- /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/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/KLPService/ProductSelect/index.vue b/klp-ui/src/components/KLPService/ProductSelect/index.vue index 69890d26..389537a4 100644 --- a/klp-ui/src/components/KLPService/ProductSelect/index.vue +++ b/klp-ui/src/components/KLPService/ProductSelect/index.vue @@ -163,6 +163,10 @@ export default { filters: { type: Object, default: () => ({}) + }, + defaultQueryParams: { + type: Object, + default: () => ({}) } }, data() { @@ -235,6 +239,9 @@ export default { this.getList(); this.listRecentlySelected(); } + }, + defaultQueryParams(val) { + this.queryParams = { ...this.queryParams, ...val }; } }, methods: { diff --git a/klp-ui/src/components/KLPService/RawMaterialSelect/index.vue b/klp-ui/src/components/KLPService/RawMaterialSelect/index.vue index 89d9a7aa..4e4a9de2 100644 --- a/klp-ui/src/components/KLPService/RawMaterialSelect/index.vue +++ b/klp-ui/src/components/KLPService/RawMaterialSelect/index.vue @@ -151,6 +151,10 @@ export default { filters: { type: Object, default: () => ({}) + }, + defaultQueryParams: { + type: Object, + default: () => ({}) } }, data() { @@ -234,6 +238,9 @@ export default { this.listRecentlySelected(); this.getList(); } + }, + defaultQueryParams(val) { + this.queryParams = { ...this.queryParams, ...val }; } }, methods: { diff --git a/klp-ui/src/components/KLPService/SchemeSelect/index.vue b/klp-ui/src/components/KLPService/SchemeSelect/index.vue index 57cf7838..b9c697c0 100644 --- a/klp-ui/src/components/KLPService/SchemeSelect/index.vue +++ b/klp-ui/src/components/KLPService/SchemeSelect/index.vue @@ -72,7 +72,12 @@ -
+ + + + + +
@@ -88,6 +89,7 @@ style="width: 100%" class="order-item-table" :header-cell-style="{ background: '#f5f7fa', color: '#606266', fontWeight: 600 }" + :row-class-name="groupRowClassName" > @@ -343,7 +345,9 @@ export default { // 存储原始数据,用于判断是否有修改 originalData: {}, // 表面处理选项 - surfaceTreatmentOptions: [] + surfaceTreatmentOptions: [], + // 排序状态提示 + sortInfo: '' } }, created() { @@ -378,7 +382,7 @@ export default { // 批量获取合同信息 this.loadContractInfo(orderIds, items) } else { - this.orderItemList = items + this.orderItemList = this.groupSort(items) this.loading = false } }).catch(e => { @@ -402,7 +406,7 @@ export default { this.contractMap[contract.orderId] = contract }) // 合并数据 - this.orderItemList = items.map(item => { + const merged = items.map(item => { const contract = this.contractMap[item.orderId] || {} return { ...item, @@ -413,6 +417,8 @@ export default { deliveryDate: contract.deliveryDate || '' } }) + // 排序后赋值 + this.orderItemList = this.groupSort(merged) // 保存原始数据副本 this.originalData = {} this.orderItemList.forEach(row => { @@ -420,12 +426,63 @@ export default { }) }).catch(e => { console.error(e) - this.orderItemList = items + this.orderItemList = this.groupSort(items) }).finally(() => { this.loading = false }) }, + // 分组排序:组间按交货日期倒序,组内按创建时间倒序 + groupSort(items) { + if (!items || items.length === 0) { + this.sortInfo = '' + this._groupColorIndex = 0 + return items + } + // 构建每个orderId对应的deliveryDate映射 + const deliveryDateMap = {} + items.forEach(item => { + if (item.orderId && !deliveryDateMap[item.orderId]) { + deliveryDateMap[item.orderId] = item.deliveryDate || '' + } + }) + const sorted = [...items].sort((a, b) => { + // 同组:按createTime倒序 + if (a.orderId && a.orderId === b.orderId) { + const timeA = a.createTime || '' + const timeB = b.createTime || '' + if (timeA === timeB) return 0 + if (!timeA) return 1 + if (!timeB) return -1 + return timeB > timeA ? 1 : -1 + } + // 异组:按deliveryDate倒序 + const dateA = deliveryDateMap[a.orderId] || '' + const dateB = deliveryDateMap[b.orderId] || '' + if (dateA === dateB) { + // 交货日期相同或都为空时,按orderId排序保证分组连续 + return (a.orderId || 0) - (b.orderId || 0) + } + if (!dateA) return 1 + if (!dateB) return -1 + return dateB > dateA ? 1 : -1 + }) + // 设置排序状态提示 + const groupCount = Object.keys(deliveryDateMap).length + this.sortInfo = `已按合同交货日期倒序 + 明细创建时间倒序排列(共${groupCount}个合同组)` + return sorted + }, + + // 分组行样式:同一合同组使用交替背景色 + groupRowClassName({ row, rowIndex }) { + // 记录上一个orderId,切换时翻转颜色 + if (rowIndex === 0 || (this._lastOrderId !== undefined && this._lastOrderId !== row.orderId)) { + this._groupColorIndex = (this._groupColorIndex || 0) + 1 + } + this._lastOrderId = row.orderId + return this._groupColorIndex % 2 === 1 ? 'group-row-a' : 'group-row-b' + }, + // 判断数据是否有变化 hasChanged(row) { const id = row.itemId || row.detailId @@ -687,4 +744,20 @@ export default { background: #4d6a8e !important; border-color: #4d6a8e !important; } + +/* 排序状态提示 */ +.sort-hint { + margin-left: auto; + font-size: 12px; + color: #909399; + white-space: nowrap; +} + +/* 分组交替背景色 */ +::v-deep .el-table .group-row-a td { + background-color: #ffffff !important; +} +::v-deep .el-table .group-row-b td { + background-color: #fafcff !important; +} diff --git a/klp-ui/src/views/mes/qc/certificate/chemistry.vue b/klp-ui/src/views/mes/qc/certificate/chemistry.vue index 629747ca..658da095 100644 --- a/klp-ui/src/views/mes/qc/certificate/chemistry.vue +++ b/klp-ui/src/views/mes/qc/certificate/chemistry.vue @@ -1,10 +1,10 @@ diff --git a/klp-ui/src/views/wms/move/batch.vue b/klp-ui/src/views/wms/move/batch.vue index 20a87476..8ddd3327 100644 --- a/klp-ui/src/views/wms/move/batch.vue +++ b/klp-ui/src/views/wms/move/batch.vue @@ -2,26 +2,14 @@
- + - + - @@ -45,42 +33,18 @@ - 新增 + 新增 - 修改 + 修改 - 删除 + 删除 - 导出 + 导出 @@ -96,7 +60,7 @@ - + - + @@ -267,7 +181,7 @@ export default { // 查询参数 queryParams: { pageNum: 1, - pageSize: 10, + pageSize: 50, transferNo: undefined, transferName: undefined, transferStatus: undefined, @@ -317,20 +231,34 @@ export default { }); }, handleResolve(row) { - approveTransferOrder(row.orderId, '2').then(response => { + updateTransferOrder({ + ...row, + approveStatus: '2', + }).then(_ => { this.$modal.msgSuccess('审批成功'); this.getList(); - }).finally(() => { - this.loading = false; - }); + }) + // approveTransferOrder(row.orderId, '2').then(response => { + // this.$modal.msgSuccess('审批成功'); + // this.getList(); + // }).finally(() => { + // this.loading = false; + // }); }, handleReject(row) { - approveTransferOrder(row.orderId, '3').then(response => { - this.$modal.msgSuccess('审批成功'); + updateTransferOrder({ + ...row, + approveStatus: '3', + }).then(_ => { + this.$modal.msgSuccess('已驳回调拨单'); this.getList(); - }).finally(() => { - this.loading = false; - }); + }) + // approveTransferOrder(row.orderId, '3').then(response => { + // this.$modal.msgSuccess('已驳回调拨单'); + // this.getList(); + // }).finally(() => { + // this.loading = false; + // }); }, /** 获取审批状态文本 */ getapproveStatusText(status) { @@ -468,7 +396,7 @@ export default { 'coil_supplierCoilNo': '厂家卷号', // 'coil_warehouseName': '逻辑库区', 'coil_netWeight': '净重', - + // 'coil_itemName': '物品名称', // 'coil_materialType': '物料类型', 'coil_qualityStatus': '质量状态', @@ -484,7 +412,7 @@ export default { // 准备导出数据 const exportData = this.transferOrderItems.map(item => { const flatItem = {}; - + // 处理Before和After字段 exportFields.forEach(field => { if (field.startsWith('coil_')) { @@ -494,7 +422,7 @@ export default { flatItem[field] = item[field] !== null && item[field] !== undefined ? item[field] : ''; } }); - + return flatItem; }); @@ -525,7 +453,7 @@ export default { document.body.appendChild(link); link.click(); document.body.removeChild(link); - }, + }, /** 钢卷选择器改变 */ handleCoilChange(coils) { console.log(coils); @@ -550,25 +478,25 @@ export default { this.reset(); }, // 表单重置 - reset() { - this.form = { - orderId: undefined, - transferNo: undefined, - transferName: undefined, - transferStatus: undefined, - transferTime: undefined, - remark: undefined, - delFlag: undefined, - createBy: undefined, - updateBy: undefined, - createTime: undefined, - updateTime: undefined, - approveStatus: '0', - approver: undefined, - approveTime: undefined - }; - this.resetForm("form"); - }, + reset() { + this.form = { + orderId: undefined, + transferNo: undefined, + transferName: undefined, + transferStatus: undefined, + transferTime: undefined, + remark: undefined, + delFlag: undefined, + createBy: undefined, + updateBy: undefined, + createTime: undefined, + updateTime: undefined, + approveStatus: '0', + approver: undefined, + approveTime: undefined + }; + this.resetForm("form"); + }, getDetailList() { this.handleView({ orderId: this.currentOrderId, approveStatus: this.currentOrderStatus }); }, @@ -601,7 +529,7 @@ export default { // 多选框选中数据 handleSelectionChange(selection) { this.ids = selection.map(item => item.orderId) - this.single = selection.length!==1 + this.single = selection.length !== 1 this.multiple = !selection.length }, /** 新增按钮操作 */ @@ -610,18 +538,18 @@ export default { // 生成当前时间 const currentDate = new Date(); // 生成调拨单号:TR + 年月日时分秒 - const transferNo = 'TR' + currentDate.getFullYear() + - String(currentDate.getMonth() + 1).padStart(2, '0') + - String(currentDate.getDate()).padStart(2, '0') + - String(currentDate.getHours()).padStart(2, '0') + - String(currentDate.getMinutes()).padStart(2, '0') + + const transferNo = 'TR' + currentDate.getFullYear() + + String(currentDate.getMonth() + 1).padStart(2, '0') + + String(currentDate.getDate()).padStart(2, '0') + + String(currentDate.getHours()).padStart(2, '0') + + String(currentDate.getMinutes()).padStart(2, '0') + String(currentDate.getSeconds()).padStart(2, '0'); // 生成调拨时间:YYYY-MM-DD HH:mm:ss - const transferTime = currentDate.getFullYear() + '-' + - String(currentDate.getMonth() + 1).padStart(2, '0') + '-' + - String(currentDate.getDate()).padStart(2, '0') + ' ' + - String(currentDate.getHours()).padStart(2, '0') + ':' + - String(currentDate.getMinutes()).padStart(2, '0') + ':' + + const transferTime = currentDate.getFullYear() + '-' + + String(currentDate.getMonth() + 1).padStart(2, '0') + '-' + + String(currentDate.getDate()).padStart(2, '0') + ' ' + + String(currentDate.getHours()).padStart(2, '0') + ':' + + String(currentDate.getMinutes()).padStart(2, '0') + ':' + String(currentDate.getSeconds()).padStart(2, '0'); // 填充表单 this.form.transferNo = transferNo; diff --git a/klp-ui/src/views/wms/move/components/tranferItemTable.vue b/klp-ui/src/views/wms/move/components/tranferItemTable.vue index e18158d8..684e9483 100644 --- a/klp-ui/src/views/wms/move/components/tranferItemTable.vue +++ b/klp-ui/src/views/wms/move/components/tranferItemTable.vue @@ -1,5 +1,6 @@ + + \ No newline at end of file diff --git a/klp-ui/src/views/wms/move/record.vue b/klp-ui/src/views/wms/move/record.vue index bdff37d7..068b2c1d 100644 --- a/klp-ui/src/views/wms/move/record.vue +++ b/klp-ui/src/views/wms/move/record.vue @@ -23,8 +23,16 @@ + + + + + - + @@ -71,6 +79,7 @@ import TransferItemTable from "@/views/wms/move/components/tranferItemTable.vue"; import WarehouseSelect from "@/components/KLPService/WarehouseSelect"; import { listTransferOrderItem } from "@/api/wms/transferOrderItem"; +import { listTransferOrder } from "@/api/wms/transferOrder"; import { listMaterialCoil } from "@/api/wms/coil"; export default { @@ -87,6 +96,7 @@ export default { queryParams: { warehouseIdBefore: '', warehouseIdAfter: '', + transferNo: '', isTransferred: '', pageSize: 20, pageNum: 1, @@ -94,12 +104,27 @@ export default { transferList: [], tracedCoils: [], warehouseList: [], + transferOrderOptions: [], + transferOrderLoading: false, loading: false, total: 0, dialogVisible: false, }; }, methods: { + async remoteSearchTransferOrder(query) { + this.transferOrderLoading = true + try { + const params = { pageSize: 50, pageNum: 1 } + if (query) params.transferNo = query + const res = await listTransferOrder(params) + this.transferOrderOptions = res.rows || [] + } catch (_) { + this.transferOrderOptions = [] + } finally { + this.transferOrderLoading = false + } + }, async handleTraceSearch() { if (!this.traceParams.currentCoilNo && !this.traceParams.enterCoilNo) { this.$message.warning('请输入当前卷号或入库卷号'); @@ -148,7 +173,7 @@ export default { }, }, mounted() { - + this.remoteSearchTransferOrder('') this.handleRegularSearch(); }, }; diff --git a/klp-ui/src/views/wms/processSpec/index.vue b/klp-ui/src/views/wms/processSpec/index.vue index db4a4c22..59a2a34a 100644 --- a/klp-ui/src/views/wms/processSpec/index.vue +++ b/klp-ui/src/views/wms/processSpec/index.vue @@ -160,6 +160,7 @@ import { delProcessSpecVersion, activateProcessSpecVersion } from '@/api/wms/processSpecVersion' +import { listDrRecipe, listDrRecipeVersions } from '@/api/wms/drMill' const STATUS_OPTIONS = [ { value: 'DRAFT', label: '草稿' }, @@ -179,7 +180,7 @@ export default { versionList: [], versionLoading: false, total: 0, - queryParams: { pageNum: 1, pageSize: 10, specType: '', lineId: '' }, + queryParams: { pageNum: 1, pageSize: 20, specType: '', lineId: '' }, specOpen: false, specTitle: '', @@ -237,18 +238,43 @@ export default { }, onSpecRowClick(row) { this.selectSpec(row) }, - loadVersions() { + async loadVersions() { if (!this.currentSpecId) return this.versionLoading = true - listProcessSpecVersion({ specId: this.currentSpecId, pageNum: 1, pageSize: 200 }).then(res => { + try { + // DR 规程(specCode 以 "DR-" 开头):先触发一次跨库同步, + // 确保 double-rack 库中的版本已写入 master wms_process_spec_version + const specCode = (this.currentSpec && this.currentSpec.specCode) || '' + if (specCode.startsWith('DR-')) { + const recipeNo = specCode.slice(3) + try { + const rRes = await listDrRecipe({ recipeNo }) + const recipe = (rRes.data || [])[0] + if (recipe) { + await listDrRecipeVersions(recipe.recipeId) // 后端自动同步版本到 master + } + } catch (e) { + console.warn('[DR同步] 触发版本同步失败,将直接读取 master 库', e) + } + } + const res = await listProcessSpecVersion({ specId: this.currentSpecId, pageNum: 1, pageSize: 200 }) this.versionList = res.rows || [] - }).catch(e => console.error(e)).finally(() => { this.versionLoading = false }) + } catch (e) { + console.error(e) + } finally { + this.versionLoading = false + } }, goPlanSpec(row) { this.$router.push({ path: `/process/processSpec/planSpec`, - query: { specId: this.currentSpecId, versionId: String(row.versionId), versionCode: row.versionCode } + query: { + specId: this.currentSpecId, + versionId: String(row.versionId), + versionCode: row.versionCode, + specCode: this.currentSpec ? (this.currentSpec.specCode || '') : '' + } }) }, diff --git a/klp-ui/src/views/wms/processSpec/planSpec.vue b/klp-ui/src/views/wms/processSpec/planSpec.vue index 51228f16..83ea7772 100644 --- a/klp-ui/src/views/wms/processSpec/planSpec.vue +++ b/klp-ui/src/views/wms/processSpec/planSpec.vue @@ -16,16 +16,6 @@
- - -
@@ -95,9 +85,19 @@ >模板导入
+ + + - - -