From 481cb968859a345133b121c3958f6701b174a060 Mon Sep 17 00:00:00 2001 From: "zangch@mesnac.com" Date: Mon, 19 Jan 2026 16:30:11 +0800 Subject: [PATCH] =?UTF-8?q?feat(base):=20=E6=B7=BB=E5=8A=A0=E5=B7=A5?= =?UTF-8?q?=E5=8D=95=E6=89=A7=E8=A1=8C=E7=8A=B6=E6=80=81=E8=B7=9F=E8=B8=AA?= =?UTF-8?q?=E5=92=8C=E5=B7=A5=E8=89=BA=E5=BF=AB=E7=85=A7=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在BaseOrderInfo实体类中新增执行状态、生产时间、操作员、实际完工数量等字段 - 实现工单开始生产、完工提报、数量更新等生产执行相关接口 - 添加按工单编号查询、获取运行中工单等功能 - 新增ProcessSnapshot实体类用于记录设备参数快照 - 实现工艺快照的创建、查询、对比、备份等管理功能 - 在工单管理中集成设备编号和执行状态过滤条件 - 完善工单信息的数据库映射和增删改查操作 --- .../controller/BaseOrderInfoController.java | 65 + .../controller/ProcessSnapshotController.java | 178 +++ .../com/aucma/base/domain/BaseOrderInfo.java | 107 ++ .../aucma/base/domain/ProcessSnapshot.java | 182 +++ .../base/mapper/ProcessSnapshotMapper.java | 86 ++ .../base/service/IBaseOrderInfoService.java | 52 + .../base/service/IProcessSnapshotService.java | 126 ++ .../impl/BaseOrderInfoServiceImpl.java | 82 ++ .../impl/ProcessSnapshotServiceImpl.java | 188 +++ .../mapper/base/BaseOrderInfoMapper.xml | 37 + .../mapper/base/ProcessSnapshotMapper.xml | 179 +++ .../report/GeneralReportMapper.back.xml | 1261 +++++++++++++++++ .../mapper/report/GeneralReportMapper.xmlback | 1261 +++++++++++++++++ 13 files changed, 3804 insertions(+) create mode 100644 aucma-base/src/main/java/com/aucma/base/controller/ProcessSnapshotController.java create mode 100644 aucma-base/src/main/java/com/aucma/base/domain/ProcessSnapshot.java create mode 100644 aucma-base/src/main/java/com/aucma/base/mapper/ProcessSnapshotMapper.java create mode 100644 aucma-base/src/main/java/com/aucma/base/service/IProcessSnapshotService.java create mode 100644 aucma-base/src/main/java/com/aucma/base/service/impl/ProcessSnapshotServiceImpl.java create mode 100644 aucma-base/src/main/resources/mapper/base/ProcessSnapshotMapper.xml create mode 100644 aucma-report/src/main/resources/mapper/report/GeneralReportMapper.back.xml create mode 100644 aucma-report/src/main/resources/mapper/report/GeneralReportMapper.xmlback diff --git a/aucma-base/src/main/java/com/aucma/base/controller/BaseOrderInfoController.java b/aucma-base/src/main/java/com/aucma/base/controller/BaseOrderInfoController.java index 7808fc5..adabe78 100644 --- a/aucma-base/src/main/java/com/aucma/base/controller/BaseOrderInfoController.java +++ b/aucma-base/src/main/java/com/aucma/base/controller/BaseOrderInfoController.java @@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.aucma.common.annotation.Log; import com.aucma.common.core.controller.BaseController; @@ -98,4 +99,68 @@ public class BaseOrderInfoController extends BaseController { public AjaxResult remove(@PathVariable Long[] objIds) { return toAjax(baseOrderInfoService.deleteBaseOrderInfoByObjIds(objIds)); } + + /** + * 根据工单编号查询工单 + */ + @PreAuthorize("@ss.hasPermi('base:orderInfo:query')") + @GetMapping("/byCode/{orderCode}") + public AjaxResult getByOrderCode(@PathVariable("orderCode") String orderCode) { + return success(baseOrderInfoService.selectBaseOrderInfoByOrderCode(orderCode)); + } + + /** + * 开始生产 + */ + @PreAuthorize("@ss.hasPermi('base:orderInfo:start')") + @Log(title = "工单执行", businessType = BusinessType.UPDATE) + @PostMapping("/startProduction") + public AjaxResult startProduction(@RequestParam String orderCode, @RequestParam String operator) { + int result = baseOrderInfoService.startProduction(orderCode, operator); + return result > 0 ? success("开始生产成功") : error("工单不存在"); + } + + /** + * 完工提报 + */ + @PreAuthorize("@ss.hasPermi('base:orderInfo:complete')") + @Log(title = "工单执行", businessType = BusinessType.UPDATE) + @PostMapping("/completeProduction") + public AjaxResult completeProduction(@RequestParam String orderCode, + @RequestParam Long completeQty, + @RequestParam Long defectQty) { + int result = baseOrderInfoService.completeProduction(orderCode, completeQty, defectQty); + return result > 0 ? success("完工提报成功") : error("工单不存在"); + } + + /** + * 更新完工数量 + */ + @PreAuthorize("@ss.hasPermi('base:orderInfo:updateQty')") + @Log(title = "工单执行", businessType = BusinessType.UPDATE) + @PostMapping("/updateQuantity") + public AjaxResult updateQuantity(@RequestParam String orderCode, + @RequestParam Long completeQty, + @RequestParam Long defectQty) { + int result = baseOrderInfoService.updateQuantity(orderCode, completeQty, defectQty); + return result > 0 ? success("更新数量成功") : error("工单不存在"); + } + + /** + * 获取正在执行的工单列表 + */ + @PreAuthorize("@ss.hasPermi('base:orderInfo:list')") + @GetMapping("/running") + public AjaxResult getRunningOrders() { + return success(baseOrderInfoService.getRunningOrders()); + } + + /** + * 获取指定设备正在执行的工单 + */ + @PreAuthorize("@ss.hasPermi('base:orderInfo:query')") + @GetMapping("/running/{deviceCode}") + public AjaxResult getRunningOrderByDevice(@PathVariable String deviceCode) { + return success(baseOrderInfoService.getRunningOrderByDevice(deviceCode)); + } } diff --git a/aucma-base/src/main/java/com/aucma/base/controller/ProcessSnapshotController.java b/aucma-base/src/main/java/com/aucma/base/controller/ProcessSnapshotController.java new file mode 100644 index 0000000..f8bf360 --- /dev/null +++ b/aucma-base/src/main/java/com/aucma/base/controller/ProcessSnapshotController.java @@ -0,0 +1,178 @@ +package com.aucma.base.controller; + +import java.util.List; +import java.util.Map; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import com.aucma.common.annotation.Log; +import com.aucma.common.core.controller.BaseController; +import com.aucma.common.core.domain.AjaxResult; +import com.aucma.common.enums.BusinessType; +import com.aucma.base.domain.ProcessSnapshot; +import com.aucma.base.service.IProcessSnapshotService; +import com.aucma.common.utils.poi.ExcelUtil; +import com.aucma.common.core.page.TableDataInfo; + +/** + * 工艺快照Controller + * + * @author Cascade + * @date 2026-01-19 + */ +@RestController +@RequestMapping("/base/processSnapshot") +public class ProcessSnapshotController extends BaseController { + @Autowired + private IProcessSnapshotService processSnapshotService; + + /** + * 查询工艺快照列表 + */ + @PreAuthorize("@ss.hasPermi('base:processSnapshot:list')") + @GetMapping("/list") + public TableDataInfo list(ProcessSnapshot processSnapshot) { + startPage(); + List list = processSnapshotService.selectProcessSnapshotList(processSnapshot); + return getDataTable(list); + } + + /** + * 导出工艺快照列表 + */ + @PreAuthorize("@ss.hasPermi('base:processSnapshot:export')") + @Log(title = "工艺快照", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ProcessSnapshot processSnapshot) { + List list = processSnapshotService.selectProcessSnapshotList(processSnapshot); + ExcelUtil util = new ExcelUtil(ProcessSnapshot.class); + util.exportExcel(response, list, "工艺快照数据"); + } + + /** + * 获取工艺快照详情(包含参数列表) + */ + @PreAuthorize("@ss.hasPermi('base:processSnapshot:query')") + @GetMapping("/detail/{snapshotId}") + public AjaxResult detail(@PathVariable("snapshotId") Long snapshotId) { + return success(processSnapshotService.selectSnapshotDetail(snapshotId)); + } + + /** + * 获取工艺快照基本信息 + */ + @PreAuthorize("@ss.hasPermi('base:processSnapshot:query')") + @GetMapping(value = "/{snapshotId}") + public AjaxResult getInfo(@PathVariable("snapshotId") Long snapshotId) { + return success(processSnapshotService.selectProcessSnapshotBySnapshotId(snapshotId)); + } + + /** + * 创建工艺快照 + */ + @PreAuthorize("@ss.hasPermi('base:processSnapshot:add')") + @Log(title = "工艺快照", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ProcessSnapshot processSnapshot) { + return toAjax(processSnapshotService.insertProcessSnapshot(processSnapshot)); + } + + /** + * 修改工艺快照 + */ + @PreAuthorize("@ss.hasPermi('base:processSnapshot:edit')") + @Log(title = "工艺快照", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ProcessSnapshot processSnapshot) { + return toAjax(processSnapshotService.updateProcessSnapshot(processSnapshot)); + } + + /** + * 删除工艺快照 + */ + @PreAuthorize("@ss.hasPermi('base:processSnapshot:remove')") + @Log(title = "工艺快照", businessType = BusinessType.DELETE) + @DeleteMapping("/{snapshotIds}") + public AjaxResult remove(@PathVariable Long[] snapshotIds) { + return toAjax(processSnapshotService.deleteProcessSnapshotBySnapshotIds(snapshotIds)); + } + + /** + * 对比两个快照的参数差异 + */ + @PreAuthorize("@ss.hasPermi('base:processSnapshot:query')") + @GetMapping("/compare") + public AjaxResult compare(@RequestParam("snapshotId1") Long snapshotId1, + @RequestParam("snapshotId2") Long snapshotId2) { + List> result = processSnapshotService.compareSnapshots(snapshotId1, snapshotId2); + if (result == null) { + return error("快照不存在或设备不一致,无法对比"); + } + return success(result); + } + + /** + * 创建调试备份 + */ + @PreAuthorize("@ss.hasPermi('base:processSnapshot:createBackup')") + @Log(title = "调试备份", businessType = BusinessType.INSERT) + @PostMapping("/createBackup") + public AjaxResult createBackup(@RequestParam String deviceCode, + @RequestParam String moldCode, + @RequestParam String productCode, + @RequestParam String backupName) { + int result = processSnapshotService.createDebugBackup(deviceCode, moldCode, productCode, backupName); + return result > 0 ? success("备份创建成功") : error("备份创建失败"); + } + + /** + * 查询调试备份列表 + */ + @PreAuthorize("@ss.hasPermi('base:processSnapshot:list')") + @GetMapping("/backupList") + public AjaxResult getBackupList(@RequestParam(required = false) String moldCode, + @RequestParam(required = false) String deviceCode, + @RequestParam(required = false) String productCode) { + return success(processSnapshotService.getDebugBackups(moldCode, deviceCode, productCode)); + } + + /** + * 获取默认备份 + */ + @PreAuthorize("@ss.hasPermi('base:processSnapshot:query')") + @GetMapping("/defaultBackup") + public AjaxResult getDefaultBackup(@RequestParam String moldCode, + @RequestParam String deviceCode, + @RequestParam String productCode) { + return success(processSnapshotService.getDefaultBackup(moldCode, deviceCode, productCode)); + } + + /** + * 设为默认备份 + */ + @PreAuthorize("@ss.hasPermi('base:processSnapshot:setDefault')") + @Log(title = "调试备份", businessType = BusinessType.UPDATE) + @PutMapping("/setDefault/{snapshotId}") + public AjaxResult setDefaultBackup(@PathVariable Long snapshotId) { + int result = processSnapshotService.setDefaultBackup(snapshotId); + return result > 0 ? success("设置成功") : error("备份不存在"); + } + + /** + * 应用备份(查看参数) + */ + @PreAuthorize("@ss.hasPermi('base:processSnapshot:query')") + @GetMapping("/applyBackup/{snapshotId}") + public AjaxResult applyBackup(@PathVariable Long snapshotId) { + return success(processSnapshotService.applyDebugBackup(snapshotId)); + } +} diff --git a/aucma-base/src/main/java/com/aucma/base/domain/BaseOrderInfo.java b/aucma-base/src/main/java/com/aucma/base/domain/BaseOrderInfo.java index d4d8168..30c6389 100644 --- a/aucma-base/src/main/java/com/aucma/base/domain/BaseOrderInfo.java +++ b/aucma-base/src/main/java/com/aucma/base/domain/BaseOrderInfo.java @@ -168,6 +168,50 @@ public class BaseOrderInfo extends BaseEntity { */ private String manualUpdateFlag; + /** + * 执行状态:PENDING-待执行/RUNNING-运行中/COMPLETED-已完成/PAUSED-已暂停 + */ + @Excel(name = "执行状态") + private String executionStatus; + + /** + * 开始生产时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "开始生产时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date startTime; + + /** + * 完工时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "完工时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date finishTime; + + /** + * 执行操作员 + */ + @Excel(name = "操作员") + private String executionOperator; + + /** + * 实际完工数量 + */ + @Excel(name = "实际完工数量") + private Long actualCompleteQty; + + /** + * 实际不良数量 + */ + @Excel(name = "实际不良数量") + private Long actualDefectQty; + + /** + * 机台/设备编号 + */ + @Excel(name = "设备编号") + private String deviceCode; + public Long getReplaceAmount() { return replaceAmount; } @@ -184,6 +228,62 @@ public class BaseOrderInfo extends BaseEntity { this.manualUpdateFlag = manualUpdateFlag; } + public String getExecutionStatus() { + return executionStatus; + } + + public void setExecutionStatus(String executionStatus) { + this.executionStatus = executionStatus; + } + + public Date getStartTime() { + return startTime; + } + + public void setStartTime(Date startTime) { + this.startTime = startTime; + } + + public Date getFinishTime() { + return finishTime; + } + + public void setFinishTime(Date finishTime) { + this.finishTime = finishTime; + } + + public String getExecutionOperator() { + return executionOperator; + } + + public void setExecutionOperator(String executionOperator) { + this.executionOperator = executionOperator; + } + + public Long getActualCompleteQty() { + return actualCompleteQty; + } + + public void setActualCompleteQty(Long actualCompleteQty) { + this.actualCompleteQty = actualCompleteQty; + } + + public Long getActualDefectQty() { + return actualDefectQty; + } + + public void setActualDefectQty(Long actualDefectQty) { + this.actualDefectQty = actualDefectQty; + } + + public String getDeviceCode() { + return deviceCode; + } + + public void setDeviceCode(String deviceCode) { + this.deviceCode = deviceCode; + } + public String getWorkCenterCode() { return workCenterCode; } @@ -391,6 +491,13 @@ public class BaseOrderInfo extends BaseEntity { .append("updatedBy", getUpdatedBy()) .append("updatedTime", getUpdatedTime()) .append("completeDate", getCompleteDate()) + .append("executionStatus", getExecutionStatus()) + .append("startTime", getStartTime()) + .append("finishTime", getFinishTime()) + .append("executionOperator", getExecutionOperator()) + .append("actualCompleteQty", getActualCompleteQty()) + .append("actualDefectQty", getActualDefectQty()) + .append("deviceCode", getDeviceCode()) .toString(); } } diff --git a/aucma-base/src/main/java/com/aucma/base/domain/ProcessSnapshot.java b/aucma-base/src/main/java/com/aucma/base/domain/ProcessSnapshot.java new file mode 100644 index 0000000..013f3b4 --- /dev/null +++ b/aucma-base/src/main/java/com/aucma/base/domain/ProcessSnapshot.java @@ -0,0 +1,182 @@ +package com.aucma.base.domain; + +import java.util.Date; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.aucma.common.annotation.Excel; +import com.aucma.common.core.domain.BaseEntity; + +/** + * 工艺快照对象 process_snapshot + * + * @author Cascade + * @date 2026-01-19 + */ +public class ProcessSnapshot extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** 快照ID */ + private Long snapshotId; + + /** 设备编号 */ + @Excel(name = "设备编号") + private String deviceCode; + + /** 设备名称(非表字段,关联查询) */ + @Excel(name = "设备名称") + private String deviceName; + + /** 快照时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "快照时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date snapshotTime; + + /** 快照类型:START-开始生产/END-结束生产/MANUAL-手动创建/CHANGE-参数变化 */ + @Excel(name = "快照类型") + private String snapshotType; + + /** 关联工单号 */ + @Excel(name = "工单号") + private String orderCode; + + /** 删除标志 */ + private String isFlag; + + /** 模具编号(调试备份专用) */ + @Excel(name = "模具编号") + private String moldCode; + + /** 产品编号(调试备份专用) */ + @Excel(name = "产品编号") + private String productCode; + + /** 备份名称(调试备份专用) */ + @Excel(name = "备份名称") + private String backupName; + + /** 是否默认备份:1-是/0-否(调试备份专用) */ + private String isDefault; + + /** 快照详情参数列表(非表字段) */ + private List paramList; + + public void setSnapshotId(Long snapshotId) { + this.snapshotId = snapshotId; + } + + public Long getSnapshotId() { + return snapshotId; + } + + public void setDeviceCode(String deviceCode) { + this.deviceCode = deviceCode; + } + + public String getDeviceCode() { + return deviceCode; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + public String getDeviceName() { + return deviceName; + } + + public void setSnapshotTime(Date snapshotTime) { + this.snapshotTime = snapshotTime; + } + + public Date getSnapshotTime() { + return snapshotTime; + } + + public void setSnapshotType(String snapshotType) { + this.snapshotType = snapshotType; + } + + public String getSnapshotType() { + return snapshotType; + } + + public void setOrderCode(String orderCode) { + this.orderCode = orderCode; + } + + public String getOrderCode() { + return orderCode; + } + + public void setIsFlag(String isFlag) { + this.isFlag = isFlag; + } + + public String getIsFlag() { + return isFlag; + } + + public String getMoldCode() { + return moldCode; + } + + public void setMoldCode(String moldCode) { + this.moldCode = moldCode; + } + + public String getProductCode() { + return productCode; + } + + public void setProductCode(String productCode) { + this.productCode = productCode; + } + + public String getBackupName() { + return backupName; + } + + public void setBackupName(String backupName) { + this.backupName = backupName; + } + + public String getIsDefault() { + return isDefault; + } + + public void setIsDefault(String isDefault) { + this.isDefault = isDefault; + } + + public List getParamList() { + return paramList; + } + + public void setParamList(List paramList) { + this.paramList = paramList; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("snapshotId", getSnapshotId()) + .append("deviceCode", getDeviceCode()) + .append("deviceName", getDeviceName()) + .append("snapshotTime", getSnapshotTime()) + .append("snapshotType", getSnapshotType()) + .append("orderCode", getOrderCode()) + .append("remark", getRemark()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("isFlag", getIsFlag()) + .append("moldCode", getMoldCode()) + .append("productCode", getProductCode()) + .append("backupName", getBackupName()) + .append("isDefault", getIsDefault()) + .toString(); + } +} diff --git a/aucma-base/src/main/java/com/aucma/base/mapper/ProcessSnapshotMapper.java b/aucma-base/src/main/java/com/aucma/base/mapper/ProcessSnapshotMapper.java new file mode 100644 index 0000000..4602ce8 --- /dev/null +++ b/aucma-base/src/main/java/com/aucma/base/mapper/ProcessSnapshotMapper.java @@ -0,0 +1,86 @@ +package com.aucma.base.mapper; + +import java.util.Date; +import java.util.List; +import java.util.Map; +import com.aucma.base.domain.ProcessSnapshot; +import com.aucma.base.domain.BaseDeviceParamVal; +import org.apache.ibatis.annotations.Param; + +/** + * 工艺快照Mapper接口 + * + * @author Cascade + * @date 2026-01-19 + */ +public interface ProcessSnapshotMapper { + /** + * 查询工艺快照 + * + * @param snapshotId 快照ID + * @return 工艺快照 + */ + public ProcessSnapshot selectProcessSnapshotBySnapshotId(Long snapshotId); + + /** + * 查询工艺快照列表 + * + * @param processSnapshot 查询条件 + * @return 快照列表 + */ + public List selectProcessSnapshotList(ProcessSnapshot processSnapshot); + + /** + * 新增工艺快照 + * + * @param processSnapshot 快照对象 + * @return 结果 + */ + public int insertProcessSnapshot(ProcessSnapshot processSnapshot); + + /** + * 修改工艺快照 + * + * @param processSnapshot 快照对象 + * @return 结果 + */ + public int updateProcessSnapshot(ProcessSnapshot processSnapshot); + + /** + * 删除工艺快照 + * + * @param snapshotId 快照ID + * @return 结果 + */ + public int deleteProcessSnapshotBySnapshotId(Long snapshotId); + + /** + * 批量删除工艺快照 + * + * @param snapshotIds 快照ID数组 + * @return 结果 + */ + public int deleteProcessSnapshotBySnapshotIds(Long[] snapshotIds); + + /** + * 根据快照时间点查询参数值 + * + * @param deviceCode 设备编号 + * @param snapshotTime 快照时间 + * @return 参数列表 + */ + public List selectParamsBySnapshotTime(@Param("deviceCode") String deviceCode, + @Param("snapshotTime") Date snapshotTime); + + /** + * 对比两个快照的参数差异 + * + * @param deviceCode 设备编号 + * @param snapshotTime1 快照时间1 + * @param snapshotTime2 快照时间2 + * @return 参数对比结果 + */ + public List> compareSnapshots(@Param("deviceCode") String deviceCode, + @Param("snapshotTime1") Date snapshotTime1, + @Param("snapshotTime2") Date snapshotTime2); +} diff --git a/aucma-base/src/main/java/com/aucma/base/service/IBaseOrderInfoService.java b/aucma-base/src/main/java/com/aucma/base/service/IBaseOrderInfoService.java index 3e7ba5c..94a233c 100644 --- a/aucma-base/src/main/java/com/aucma/base/service/IBaseOrderInfoService.java +++ b/aucma-base/src/main/java/com/aucma/base/service/IBaseOrderInfoService.java @@ -66,4 +66,56 @@ public interface IBaseOrderInfoService { * @return 结果 */ public int deleteBaseOrderInfoByObjId(Long objId); + + /** + * 根据工单编号查询工单 + * + * @param orderCode 工单编号 + * @return 工单信息 + */ + public BaseOrderInfo selectBaseOrderInfoByOrderCode(String orderCode); + + /** + * 开始生产 + * + * @param orderCode 工单编号 + * @param operator 操作员 + * @return 结果 + */ + public int startProduction(String orderCode, String operator); + + /** + * 完工提报 + * + * @param orderCode 工单编号 + * @param completeQty 完工数量 + * @param defectQty 不良数量 + * @return 结果 + */ + public int completeProduction(String orderCode, Long completeQty, Long defectQty); + + /** + * 更新完工数量 + * + * @param orderCode 工单编号 + * @param completeQty 完工数量 + * @param defectQty 不良数量 + * @return 结果 + */ + public int updateQuantity(String orderCode, Long completeQty, Long defectQty); + + /** + * 获取正在执行的工单列表 + * + * @return 工单列表 + */ + public List getRunningOrders(); + + /** + * 获取指定设备正在执行的工单 + * + * @param deviceCode 设备编号 + * @return 工单信息 + */ + public BaseOrderInfo getRunningOrderByDevice(String deviceCode); } diff --git a/aucma-base/src/main/java/com/aucma/base/service/IProcessSnapshotService.java b/aucma-base/src/main/java/com/aucma/base/service/IProcessSnapshotService.java new file mode 100644 index 0000000..e753fd8 --- /dev/null +++ b/aucma-base/src/main/java/com/aucma/base/service/IProcessSnapshotService.java @@ -0,0 +1,126 @@ +package com.aucma.base.service; + +import java.util.List; +import java.util.Map; +import com.aucma.base.domain.ProcessSnapshot; +import com.aucma.base.domain.BaseDeviceParamVal; + +/** + * 工艺快照Service接口 + * + * @author Cascade + * @date 2026-01-19 + */ +public interface IProcessSnapshotService { + /** + * 查询工艺快照 + * + * @param snapshotId 快照ID + * @return 工艺快照 + */ + public ProcessSnapshot selectProcessSnapshotBySnapshotId(Long snapshotId); + + /** + * 查询工艺快照列表 + * + * @param processSnapshot 查询条件 + * @return 快照列表 + */ + public List selectProcessSnapshotList(ProcessSnapshot processSnapshot); + + /** + * 新增工艺快照 + * + * @param processSnapshot 快照对象 + * @return 结果 + */ + public int insertProcessSnapshot(ProcessSnapshot processSnapshot); + + /** + * 修改工艺快照 + * + * @param processSnapshot 快照对象 + * @return 结果 + */ + public int updateProcessSnapshot(ProcessSnapshot processSnapshot); + + /** + * 删除工艺快照 + * + * @param snapshotId 快照ID + * @return 结果 + */ + public int deleteProcessSnapshotBySnapshotId(Long snapshotId); + + /** + * 批量删除工艺快照 + * + * @param snapshotIds 快照ID数组 + * @return 结果 + */ + public int deleteProcessSnapshotBySnapshotIds(Long[] snapshotIds); + + /** + * 查询快照详情(包含参数列表) + * + * @param snapshotId 快照ID + * @return 快照详情(含参数) + */ + public ProcessSnapshot selectSnapshotDetail(Long snapshotId); + + /** + * 对比两个快照的参数差异 + * + * @param snapshotId1 快照ID1 + * @param snapshotId2 快照ID2 + * @return 参数对比结果 + */ + public List> compareSnapshots(Long snapshotId1, Long snapshotId2); + + /** + * 创建调试备份 + * + * @param deviceCode 设备编号 + * @param moldCode 模具编号 + * @param productCode 产品编号 + * @param backupName 备份名称 + * @return 结果 + */ + public int createDebugBackup(String deviceCode, String moldCode, String productCode, String backupName); + + /** + * 查询调试备份列表 + * + * @param moldCode 模具编号 + * @param deviceCode 设备编号 + * @param productCode 产品编号 + * @return 备份列表 + */ + public List getDebugBackups(String moldCode, String deviceCode, String productCode); + + /** + * 获取默认备份 + * + * @param moldCode 模具编号 + * @param deviceCode 设备编号 + * @param productCode 产品编号 + * @return 默认备份 + */ + public ProcessSnapshot getDefaultBackup(String moldCode, String deviceCode, String productCode); + + /** + * 设为默认备份 + * + * @param snapshotId 快照ID + * @return 结果 + */ + public int setDefaultBackup(Long snapshotId); + + /** + * 应用备份(获取备份参数详情) + * + * @param snapshotId 快照ID + * @return 快照详情(含参数) + */ + public ProcessSnapshot applyDebugBackup(Long snapshotId); +} diff --git a/aucma-base/src/main/java/com/aucma/base/service/impl/BaseOrderInfoServiceImpl.java b/aucma-base/src/main/java/com/aucma/base/service/impl/BaseOrderInfoServiceImpl.java index c3294ee..65f439a 100644 --- a/aucma-base/src/main/java/com/aucma/base/service/impl/BaseOrderInfoServiceImpl.java +++ b/aucma-base/src/main/java/com/aucma/base/service/impl/BaseOrderInfoServiceImpl.java @@ -1,5 +1,6 @@ package com.aucma.base.service.impl; +import java.util.Date; import java.util.List; import com.aucma.common.utils.DateUtils; @@ -98,4 +99,85 @@ public class BaseOrderInfoServiceImpl implements IBaseOrderInfoService { public int deleteBaseOrderInfoByObjId(Long objId) { return baseOrderInfoMapper.deleteBaseOrderInfoByObjId(objId); } + + /** + * 根据工单编号查询工单 + */ + @Override + public BaseOrderInfo selectBaseOrderInfoByOrderCode(String orderCode) { + BaseOrderInfo query = new BaseOrderInfo(); + query.setOrderCode(orderCode); + List list = baseOrderInfoMapper.selectAllOrderInfoList(query); + return list != null && !list.isEmpty() ? list.get(0) : null; + } + + /** + * 开始生产 + */ + @Override + public int startProduction(String orderCode, String operator) { + BaseOrderInfo order = selectBaseOrderInfoByOrderCode(orderCode); + if (order == null) { + return 0; + } + order.setExecutionStatus("RUNNING"); + order.setStartTime(new Date()); + order.setExecutionOperator(operator); + order.setUpdatedTime(DateUtils.getNowDate()); + return baseOrderInfoMapper.updateBaseOrderInfo(order); + } + + /** + * 完工提报 + */ + @Override + public int completeProduction(String orderCode, Long completeQty, Long defectQty) { + BaseOrderInfo order = selectBaseOrderInfoByOrderCode(orderCode); + if (order == null) { + return 0; + } + order.setExecutionStatus("COMPLETED"); + order.setFinishTime(new Date()); + order.setActualCompleteQty(completeQty); + order.setActualDefectQty(defectQty); + order.setUpdatedTime(DateUtils.getNowDate()); + return baseOrderInfoMapper.updateBaseOrderInfo(order); + } + + /** + * 更新完工数量 + */ + @Override + public int updateQuantity(String orderCode, Long completeQty, Long defectQty) { + BaseOrderInfo order = selectBaseOrderInfoByOrderCode(orderCode); + if (order == null) { + return 0; + } + order.setActualCompleteQty(completeQty); + order.setActualDefectQty(defectQty); + order.setUpdatedTime(DateUtils.getNowDate()); + return baseOrderInfoMapper.updateBaseOrderInfo(order); + } + + /** + * 获取正在执行的工单列表 + */ + @Override + public List getRunningOrders() { + BaseOrderInfo query = new BaseOrderInfo(); + query.setExecutionStatus("RUNNING"); + return baseOrderInfoMapper.selectAllOrderInfoList(query); + } + + /** + * 获取指定设备正在执行的工单 + */ + @Override + public BaseOrderInfo getRunningOrderByDevice(String deviceCode) { + BaseOrderInfo query = new BaseOrderInfo(); + query.setDeviceCode(deviceCode); + query.setExecutionStatus("RUNNING"); + List list = baseOrderInfoMapper.selectAllOrderInfoList(query); + return list != null && !list.isEmpty() ? list.get(0) : null; + } } diff --git a/aucma-base/src/main/java/com/aucma/base/service/impl/ProcessSnapshotServiceImpl.java b/aucma-base/src/main/java/com/aucma/base/service/impl/ProcessSnapshotServiceImpl.java new file mode 100644 index 0000000..ffc9f65 --- /dev/null +++ b/aucma-base/src/main/java/com/aucma/base/service/impl/ProcessSnapshotServiceImpl.java @@ -0,0 +1,188 @@ +package com.aucma.base.service.impl; + +import java.util.Date; +import java.util.List; +import java.util.Map; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.aucma.base.mapper.ProcessSnapshotMapper; +import com.aucma.base.domain.ProcessSnapshot; +import com.aucma.base.domain.BaseDeviceParamVal; +import com.aucma.base.service.IProcessSnapshotService; +import com.aucma.common.utils.DateUtils; +import com.aucma.common.utils.SecurityUtils; + +/** + * 工艺快照Service实现 + * + * @author Cascade + * @date 2026-01-19 + */ +@Service +public class ProcessSnapshotServiceImpl implements IProcessSnapshotService { + @Autowired + private ProcessSnapshotMapper processSnapshotMapper; + + @Override + public ProcessSnapshot selectProcessSnapshotBySnapshotId(Long snapshotId) { + return processSnapshotMapper.selectProcessSnapshotBySnapshotId(snapshotId); + } + + @Override + public List selectProcessSnapshotList(ProcessSnapshot processSnapshot) { + return processSnapshotMapper.selectProcessSnapshotList(processSnapshot); + } + + @Override + public int insertProcessSnapshot(ProcessSnapshot processSnapshot) { + if (processSnapshot.getSnapshotTime() == null) { + processSnapshot.setSnapshotTime(new Date()); + } + if (processSnapshot.getIsFlag() == null || processSnapshot.getIsFlag().isEmpty()) { + processSnapshot.setIsFlag("1"); + } + processSnapshot.setCreateBy(SecurityUtils.getUsername()); + processSnapshot.setCreateTime(DateUtils.getNowDate()); + return processSnapshotMapper.insertProcessSnapshot(processSnapshot); + } + + @Override + public int updateProcessSnapshot(ProcessSnapshot processSnapshot) { + processSnapshot.setUpdateBy(SecurityUtils.getUsername()); + processSnapshot.setUpdateTime(DateUtils.getNowDate()); + return processSnapshotMapper.updateProcessSnapshot(processSnapshot); + } + + @Override + public int deleteProcessSnapshotBySnapshotId(Long snapshotId) { + return processSnapshotMapper.deleteProcessSnapshotBySnapshotId(snapshotId); + } + + @Override + public int deleteProcessSnapshotBySnapshotIds(Long[] snapshotIds) { + return processSnapshotMapper.deleteProcessSnapshotBySnapshotIds(snapshotIds); + } + + @Override + public ProcessSnapshot selectSnapshotDetail(Long snapshotId) { + ProcessSnapshot snapshot = processSnapshotMapper.selectProcessSnapshotBySnapshotId(snapshotId); + if (snapshot != null && snapshot.getDeviceCode() != null && snapshot.getSnapshotTime() != null) { + List paramList = processSnapshotMapper.selectParamsBySnapshotTime( + snapshot.getDeviceCode(), snapshot.getSnapshotTime()); + snapshot.setParamList(paramList); + } + return snapshot; + } + + @Override + public List> compareSnapshots(Long snapshotId1, Long snapshotId2) { + ProcessSnapshot snapshot1 = processSnapshotMapper.selectProcessSnapshotBySnapshotId(snapshotId1); + ProcessSnapshot snapshot2 = processSnapshotMapper.selectProcessSnapshotBySnapshotId(snapshotId2); + + if (snapshot1 == null || snapshot2 == null) { + return null; + } + + if (!snapshot1.getDeviceCode().equals(snapshot2.getDeviceCode())) { + return null; + } + + return processSnapshotMapper.compareSnapshots( + snapshot1.getDeviceCode(), + snapshot1.getSnapshotTime(), + snapshot2.getSnapshotTime()); + } + + /** + * 创建调试备份 + */ + @Override + public int createDebugBackup(String deviceCode, String moldCode, String productCode, String backupName) { + ProcessSnapshot snapshot = new ProcessSnapshot(); + snapshot.setDeviceCode(deviceCode); + snapshot.setSnapshotTime(new Date()); + snapshot.setSnapshotType("BACKUP"); + snapshot.setMoldCode(moldCode); + snapshot.setProductCode(productCode); + snapshot.setBackupName(backupName); + snapshot.setIsDefault("0"); + snapshot.setIsFlag("1"); + snapshot.setCreateBy(SecurityUtils.getUsername()); + snapshot.setCreateTime(DateUtils.getNowDate()); + return processSnapshotMapper.insertProcessSnapshot(snapshot); + } + + /** + * 查询调试备份列表 + */ + @Override + public List getDebugBackups(String moldCode, String deviceCode, String productCode) { + ProcessSnapshot query = new ProcessSnapshot(); + query.setSnapshotType("BACKUP"); + if (moldCode != null && !moldCode.isEmpty()) { + query.setMoldCode(moldCode); + } + if (deviceCode != null && !deviceCode.isEmpty()) { + query.setDeviceCode(deviceCode); + } + if (productCode != null && !productCode.isEmpty()) { + query.setProductCode(productCode); + } + return processSnapshotMapper.selectProcessSnapshotList(query); + } + + /** + * 获取默认备份 + */ + @Override + public ProcessSnapshot getDefaultBackup(String moldCode, String deviceCode, String productCode) { + ProcessSnapshot query = new ProcessSnapshot(); + query.setSnapshotType("BACKUP"); + query.setMoldCode(moldCode); + query.setDeviceCode(deviceCode); + query.setProductCode(productCode); + query.setIsDefault("1"); + List list = processSnapshotMapper.selectProcessSnapshotList(query); + return list != null && !list.isEmpty() ? list.get(0) : null; + } + + /** + * 设为默认备份 + */ + @Override + public int setDefaultBackup(Long snapshotId) { + ProcessSnapshot current = processSnapshotMapper.selectProcessSnapshotBySnapshotId(snapshotId); + if (current == null || !"BACKUP".equals(current.getSnapshotType())) { + return 0; + } + + // 取消其他备份的默认状态 + ProcessSnapshot query = new ProcessSnapshot(); + query.setSnapshotType("BACKUP"); + query.setMoldCode(current.getMoldCode()); + query.setDeviceCode(current.getDeviceCode()); + query.setProductCode(current.getProductCode()); + query.setIsDefault("1"); + List defaultList = processSnapshotMapper.selectProcessSnapshotList(query); + for (ProcessSnapshot ps : defaultList) { + ps.setIsDefault("0"); + ps.setUpdateBy(SecurityUtils.getUsername()); + ps.setUpdateTime(DateUtils.getNowDate()); + processSnapshotMapper.updateProcessSnapshot(ps); + } + + // 设置当前备份为默认 + current.setIsDefault("1"); + current.setUpdateBy(SecurityUtils.getUsername()); + current.setUpdateTime(DateUtils.getNowDate()); + return processSnapshotMapper.updateProcessSnapshot(current); + } + + /** + * 应用备份(获取备份参数详情) + */ + @Override + public ProcessSnapshot applyDebugBackup(Long snapshotId) { + return selectSnapshotDetail(snapshotId); + } +} diff --git a/aucma-base/src/main/resources/mapper/base/BaseOrderInfoMapper.xml b/aucma-base/src/main/resources/mapper/base/BaseOrderInfoMapper.xml index 74004cd..008866c 100644 --- a/aucma-base/src/main/resources/mapper/base/BaseOrderInfoMapper.xml +++ b/aucma-base/src/main/resources/mapper/base/BaseOrderInfoMapper.xml @@ -29,6 +29,13 @@ + + + + + + + @@ -51,6 +58,13 @@ oi.work_center_code, oi.routing_code, oi.manual_update_flag, + oi.execution_status, + oi.start_time, + oi.finish_time, + oi.execution_operator, + oi.actual_complete_qty, + oi.actual_defect_qty, + oi.device_code, oi.created_by, oi.created_time, oi.updated_by, @@ -79,6 +93,8 @@ and oi.order_status LIKE #{orderStatus} || '%' and (oi.order_status LIKE 'REL%' OR oi.order_status LIKE 'CRTD%') and oi.manual_update_flag = #{manualUpdateFlag} + and oi.execution_status = #{executionStatus} + and oi.device_code = #{deviceCode} and oi.begin_date = #{beginDate} and oi.end_date = #{endDate} and oi.factory_code = #{factoryCode} @@ -146,6 +162,13 @@ work_center_code, routing_code, manual_update_flag, + execution_status, + start_time, + finish_time, + execution_operator, + actual_complete_qty, + actual_defect_qty, + device_code, #{objId}, @@ -172,6 +195,13 @@ #{workCenterCode}, #{routingCode}, #{manualUpdateFlag}, + #{executionStatus}, + #{startTime}, + #{finishTime}, + #{executionOperator}, + #{actualCompleteQty}, + #{actualDefectQty}, + #{deviceCode}, @@ -201,6 +231,13 @@ work_center_code = #{workCenterCode}, routing_code = #{routingCode}, manual_update_flag = #{manualUpdateFlag}, + execution_status = #{executionStatus}, + start_time = #{startTime}, + finish_time = #{finishTime}, + execution_operator = #{executionOperator}, + actual_complete_qty = #{actualCompleteQty}, + actual_defect_qty = #{actualDefectQty}, + device_code = #{deviceCode}, where obj_id = #{objId} diff --git a/aucma-base/src/main/resources/mapper/base/ProcessSnapshotMapper.xml b/aucma-base/src/main/resources/mapper/base/ProcessSnapshotMapper.xml new file mode 100644 index 0000000..91f63e8 --- /dev/null +++ b/aucma-base/src/main/resources/mapper/base/ProcessSnapshotMapper.xml @@ -0,0 +1,179 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SELECT s.snapshot_id, s.device_code, d.device_name, s.snapshot_time, s.snapshot_type, + s.order_code, s.remarks, s.create_by, s.create_time, s.update_by, s.update_time, s.is_flag, + s.mold_code, s.product_code, s.backup_name, s.is_default + FROM process_snapshot s + LEFT JOIN base_deviceledger d ON s.device_code = d.device_code + + + + + + + + + SELECT seq_process_snapshot_index.NEXTVAL as snapshotId FROM DUAL + + INSERT INTO process_snapshot + + snapshot_id, + device_code, + snapshot_time, + snapshot_type, + order_code, + remarks, + create_by, + create_time, + is_flag, + mold_code, + product_code, + backup_name, + is_default, + + + #{snapshotId}, + #{deviceCode}, + #{snapshotTime}, + #{snapshotType}, + #{orderCode}, + #{remark}, + #{createBy}, + #{createTime}, + #{isFlag}, + #{moldCode}, + #{productCode}, + #{backupName}, + #{isDefault}, + + + + + UPDATE process_snapshot + + device_code = #{deviceCode}, + snapshot_time = #{snapshotTime}, + snapshot_type = #{snapshotType}, + order_code = #{orderCode}, + remarks = #{remark}, + update_by = #{updateBy}, + update_time = #{updateTime}, + mold_code = #{moldCode}, + product_code = #{productCode}, + backup_name = #{backupName}, + is_default = #{isDefault}, + + WHERE snapshot_id = #{snapshotId} + + + + UPDATE process_snapshot SET is_flag = '0' WHERE snapshot_id = #{snapshotId} + + + + UPDATE process_snapshot SET is_flag = '0' WHERE snapshot_id IN + + #{snapshotId} + + + + + + + + + + diff --git a/aucma-report/src/main/resources/mapper/report/GeneralReportMapper.back.xml b/aucma-report/src/main/resources/mapper/report/GeneralReportMapper.back.xml new file mode 100644 index 0000000..eb433a4 --- /dev/null +++ b/aucma-report/src/main/resources/mapper/report/GeneralReportMapper.back.xml @@ -0,0 +1,1261 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/aucma-report/src/main/resources/mapper/report/GeneralReportMapper.xmlback b/aucma-report/src/main/resources/mapper/report/GeneralReportMapper.xmlback new file mode 100644 index 0000000..eb433a4 --- /dev/null +++ b/aucma-report/src/main/resources/mapper/report/GeneralReportMapper.xmlback @@ -0,0 +1,1261 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +