From 0cd68eed0f7b2054011a8cbfd4c38c904695899c Mon Sep 17 00:00:00 2001 From: "zangch@mesnac.com" Date: Mon, 9 Feb 2026 14:55:01 +0800 Subject: [PATCH] =?UTF-8?q?feat(dms):=20=E6=96=B0=E5=A2=9E=E5=81=9C?= =?UTF-8?q?=E6=9C=BA=E8=AE=B0=E5=BD=95=E5=8A=9F=E8=83=BD=E5=B9=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96PDA=E6=8E=A5=E5=8F=A3=EF=BC=88=E6=96=B0=E8=80=81?= =?UTF-8?q?=E4=B8=A4=E7=A7=8D=E8=AE=BE=E5=A4=87=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 有两种设备,旧设备不能采集数据只能由PDA手持提交停机记录,另一种是新设备可以自动生成停机记录(包括停机开始时间和结束时间),但停机原因默认为1自动填写,需要手持PDA或者网页进行统计原因的修改更新。listOldDevices返回的就是全部旧设备用于提交插入停机记录。getShutDownForPda返回给PDA的停机记录只有停机结束时间shutEndTime为空或者停机原因SHUT_REASON_ID为1的停机记录列表。completeShutDownForPda若是遇到停机结束时间shutEndTime为空的就需要更新停机结束时间和停机原因主键SHUT_REASON_ID(老设备),若是停机结束时间shutEndTime不为空则只更新停机原因主键SHUT_REASON_ID(新设备)。 - 添加SEQ_DMS_REC_SHUT_DOWN序列用于停机记录ID生成 - 新增shutReasonId和downtimeFlag字段到DmsRecordShutDown实体类 - 实现PDA停机记录增删改查接口,支持待处理记录查询 - 添加异常处理机制,统一抛出ServiceException - 更新三色灯状态参数映射,将机台状态参数ID改为991-993 - 优化停机记录更新逻辑,区分新老设备处理方式 - 添加设备编码和名称关联查询功能 --- aucma-dms/DMS_SEQUENCES.sql | 22 +- .../dms/controller/DmsMobileController.java | 210 ++++++++++++------ .../aucma/dms/domain/DmsRecordShutDown.java | 41 +++- .../dms/mapper/DmsRecordShutDownMapper.java | 7 + .../service/IDmsRecordShutDownService.java | 7 + .../impl/DmsRecordShutDownServiceImpl.java | 11 + .../mapper/dms/DmsRecordShutDownMapper.xml | 89 +++++--- 7 files changed, 282 insertions(+), 105 deletions(-) diff --git a/aucma-dms/DMS_SEQUENCES.sql b/aucma-dms/DMS_SEQUENCES.sql index 2d616e2..0a4ec07 100644 --- a/aucma-dms/DMS_SEQUENCES.sql +++ b/aucma-dms/DMS_SEQUENCES.sql @@ -463,6 +463,23 @@ CREATE SEQUENCE "HAIWEI"."SEQ_DMS_REPAIR_WORK_ORDER" INCREMENT BY 1 CACHE 20; +-- ---------------------------- +-- 28. SEQ_DMS_REC_SHUT_DOWN (停机记录) +-- 表: DMS_RECORD_SHUT_DOWN +-- ---------------------------- +BEGIN + EXECUTE IMMEDIATE 'DROP SEQUENCE "HAIWEI"."SEQ_DMS_REC_SHUT_DOWN"'; +EXCEPTION + WHEN OTHERS THEN NULL; +END; +/ +CREATE SEQUENCE "HAIWEI"."SEQ_DMS_REC_SHUT_DOWN" + MINVALUE 1 + MAXVALUE 9999999999999999999999999999 + START WITH 1 + INCREMENT BY 1 + CACHE 20; + -- ============================================ -- 序列对齐:按 MAX(主键列)+1 设置 NEXTVAL(Oracle 11g 兼容方案) -- ============================================ @@ -569,6 +586,8 @@ BEGIN sync_seq('HAIWEI.SEQ_DMS_REPAIR_RECORD', 'HAIWEI.DMS_REPAIR_RECORD', 'RECORD_ID'); -- 27. 维修工单 sync_seq('HAIWEI.SEQ_DMS_REPAIR_WORK_ORDER', 'HAIWEI.DMS_REPAIR_WORK_ORDER', 'WORK_ORDER_ID'); + -- 28. 停机记录 + sync_seq('HAIWEI.SEQ_DMS_REC_SHUT_DOWN', 'HAIWEI.DMS_RECORD_SHUT_DOWN', 'RECORD_SHUT_DOWN_ID'); -- 为所有序列授权 + 创建公共同义词(保证跨 schema 应用可用) grant_and_synonym('SEQ_DMS_INSPECT_PROJ'); @@ -598,12 +617,13 @@ BEGIN grant_and_synonym('SEQ_DMS_REPAIR_PROJECT'); grant_and_synonym('SEQ_DMS_REPAIR_RECORD'); grant_and_synonym('SEQ_DMS_REPAIR_WORK_ORDER'); + grant_and_synonym('SEQ_DMS_REC_SHUT_DOWN'); END; / -- ============================================ -- 执行完成提示 -- ============================================ --- 共创建 27 个序列,已按 MAX(主键)+1 对齐,已授权+同义词 +-- 共创建 28 个序列,已按 MAX(主键)+1 对齐,已授权+同义词 -- 验证: -- SELECT SEQUENCE_NAME, LAST_NUMBER FROM ALL_SEQUENCES WHERE SEQUENCE_OWNER='HAIWEI' AND (SEQUENCE_NAME LIKE 'SEQ_DMS%' OR SEQUENCE_NAME LIKE 'SEQ_FAULT%'); diff --git a/aucma-dms/src/main/java/com/aucma/dms/controller/DmsMobileController.java b/aucma-dms/src/main/java/com/aucma/dms/controller/DmsMobileController.java index 483899c..688a288 100644 --- a/aucma-dms/src/main/java/com/aucma/dms/controller/DmsMobileController.java +++ b/aucma-dms/src/main/java/com/aucma/dms/controller/DmsMobileController.java @@ -4,6 +4,7 @@ package com.aucma.dms.controller; import com.aucma.common.core.controller.BaseController; import com.aucma.common.core.domain.AjaxResult; import com.aucma.common.core.page.TableDataInfo; +import com.aucma.common.exception.ServiceException; import com.aucma.dms.domain.*; import com.aucma.dms.domain.dto.DmsBaseDeviceLedgerDTO; import com.aucma.dms.domain.vo.DmsBillsFaultInstanceScanVo; @@ -92,16 +93,21 @@ public class DmsMobileController extends BaseController { */ @GetMapping("/getDeviceByDeviceCode/{deviceCode}") public AjaxResult getDeviceByDeviceCode(@PathVariable("deviceCode") String deviceCode) { - BaseDeviceLedger query = new BaseDeviceLedger(); - query.setDeviceCode(deviceCode); - query.setIsFlag(1L); // 只查询有效设备 - List list = baseDeviceLedgerService.selectBaseDeviceLedgerList(query); - if (CollectionUtils.isEmpty(list)) { - return success(null); + try { + BaseDeviceLedger query = new BaseDeviceLedger(); + query.setDeviceCode(deviceCode); + query.setIsFlag(1L); // 只查询有效设备 + List list = baseDeviceLedgerService.selectBaseDeviceLedgerList(query); + if (CollectionUtils.isEmpty(list)) { + return success(null); + } + // 转换为DmsBaseDeviceLedger返回,保持PDA兼容性 + DmsBaseDeviceLedger result = convertToDeviceLedger(list.get(0)); + return success(convertDeviceLedgerToDto(result)); + } catch (Exception e) { + log.error("PDA查询设备信息失败 | deviceCode={}, 异常信息: {}", deviceCode, e.getMessage(), e); + throw new ServiceException("获取设备信息失败: " + e.getMessage()); } - // 转换为DmsBaseDeviceLedger返回,保持PDA兼容性 - DmsBaseDeviceLedger result = convertToDeviceLedger(list.get(0)); - return success(convertDeviceLedgerToDto(result)); } /** @@ -113,18 +119,23 @@ public class DmsMobileController extends BaseController { */ @GetMapping("/likeDeviceName") public AjaxResult likeDeviceName(String deviceName) { - BaseDeviceLedger query = new BaseDeviceLedger(); - query.setDeviceName(deviceName); - query.setIsFlag(1L); // 只查询有效设备 - List list = baseDeviceLedgerService.selectBaseDeviceLedgerList(query); - // 转换为DmsBaseDeviceLedger列表返回,保持PDA兼容性 - List resultList = new ArrayList<>(); - if (!CollectionUtils.isEmpty(list)) { - for (BaseDeviceLedger base : list) { - resultList.add(convertDeviceLedgerToDto(convertToDeviceLedger(base))); + try { + BaseDeviceLedger query = new BaseDeviceLedger(); + query.setDeviceName(deviceName); + query.setIsFlag(1L); // 只查询有效设备 + List list = baseDeviceLedgerService.selectBaseDeviceLedgerList(query); + // 转换为DmsBaseDeviceLedger列表返回,保持PDA兼容性 + List resultList = new ArrayList<>(); + if (!CollectionUtils.isEmpty(list)) { + for (BaseDeviceLedger base : list) { + resultList.add(convertDeviceLedgerToDto(convertToDeviceLedger(base))); + } } + return success(resultList); + } catch (Exception e) { + log.error("PDA模糊查询设备失败 | deviceName={}, 异常信息: {}", deviceName, e.getMessage(), e); + throw new ServiceException("查询设备失败: " + e.getMessage()); } - return success(resultList); } /** @@ -265,72 +276,129 @@ public class DmsMobileController extends BaseController { @PostMapping("/shutDown/add") @Transactional(rollbackFor = Exception.class) public AjaxResult addShutDownForPda(@RequestBody DmsRecordShutDown shutDown) { - // 若传入了停机原因ID,则查询原因并回填类型 - if (shutDown.getShutReason() != null) { - DmsBaseShutReason query = new DmsBaseShutReason(); - query.setShutReason(shutDown.getShutReason()); - query.setIsFlag("1"); - List reasons = dmsBaseShutReasonService.selectDmsBaseShutReasonList(query); - if (!reasons.isEmpty()) { - shutDown.setShutType(reasons.get(0).getShutTypeId()); - // 若前端未传 deviceId,尝试从原因带出 - if (shutDown.getDeviceId() == null) { - shutDown.setDeviceId(reasons.get(0).getDeviceId()); + try { + // 若传入了停机原因ID,则查询原因并回填类型 + if (shutDown.getShutReason() != null) { + DmsBaseShutReason query = new DmsBaseShutReason(); + query.setShutReason(shutDown.getShutReason()); + query.setIsFlag("1"); + List reasons = dmsBaseShutReasonService.selectDmsBaseShutReasonList(query); + if (!reasons.isEmpty()) { + shutDown.setShutType(reasons.get(0).getShutTypeId()); + shutDown.setShutReasonId(reasons.get(0).getShutReasonId()); + // 若前端未传 deviceId,尝试从原因带出 + if (shutDown.getDeviceId() == null) { + shutDown.setDeviceId(reasons.get(0).getDeviceId()); + } } } - } - // 默认启用标识 - if (shutDown.getIsFlag() == null) { - shutDown.setIsFlag(1L); - } - // 若未传入开始时间,则使用当前时间 - if (shutDown.getShutBeginTime() == null) { - shutDown.setShutBeginTime(new Date()); - } - int rows = dmsRecordShutDownService.insertDmsRecordShutDown(shutDown); + // 默认启用标识 + if (shutDown.getIsFlag() == null) { + shutDown.setIsFlag(1L); + } + // 新增停机记录默认未结束 + if (shutDown.getDowntimeFlag() == null) { + shutDown.setDowntimeFlag("0"); + } + // 若未传入开始时间,则使用当前时间 + if (shutDown.getShutBeginTime() == null) { + shutDown.setShutBeginTime(new Date()); + } + int rows = dmsRecordShutDownService.insertDmsRecordShutDown(shutDown); - // 对指定设备(OLD-01~OLD-05)同步写入三色灯状态参数,供设备状态统计使用 - String deviceCode = shutDown.getDeviceCode(); - if (deviceCode != null && deviceCode.startsWith("OLD-")) { - // 新增停机记录代表进入停机,三色灯置为“暂停” - insertTriColorStatusParams(deviceCode, shutDown.getDeviceId(), false); - } + // 对指定设备(OLD-01~OLD-05)同步写入三色灯状态参数,供设备状态统计使用 + String deviceCode = shutDown.getDeviceCode(); + if (deviceCode != null && deviceCode.startsWith("OLD-")) { + // 新增停机记录代表进入停机,三色灯置为“暂停” + insertTriColorStatusParams(deviceCode, shutDown.getDeviceId(), false); + } - return success(rows); + return success(rows); + } catch (Exception e) { + log.error("PDA新增停机记录失败 | deviceCode={}, shutReason={}, deviceId={}, 异常信息: {}", + shutDown.getDeviceCode(), shutDown.getShutReason(), shutDown.getDeviceId(), e.getMessage(), e); + throw new ServiceException("新增停机记录失败: " + e.getMessage()); + } } /** - * PDA-更新停机记录:设置结束时间并计算停机时长(秒) + * PDA-获取待处理停机记录列表 + * 返回条件:停机结束时间为空(老设备未完成)或 停机原因ID=1(新设备默认原因待修改) + */ + @GetMapping("/shutDown/get") + public AjaxResult getShutDownForPda() { + try { + List list = dmsRecordShutDownService.selectPdaShutDownList(); + return success(list); + } catch (Exception e) { + log.error("PDA获取待处理停机记录失败 | 异常信息: {}", e.getMessage(), e); + throw new ServiceException("获取停机记录失败: " + e.getMessage()); + } + } + + /** + * PDA-更新停机记录 + * 老设备(shutEndTime为空):更新停机结束时间、计算停机时长、更新停机原因ID + * 新设备(shutEndTime不为空):仅更新停机原因ID */ @PostMapping("/shutDown/complete") @Transactional(rollbackFor = Exception.class) public AjaxResult completeShutDownForPda(@RequestBody DmsRecordShutDown shutDown) { if (shutDown.getRecordShutDownId() == null) { - return error("recordShutDownId不能为空"); + throw new ServiceException("recordShutDownId不能为空"); } - // 查询原记录以获取开始时间 - DmsRecordShutDown origin = dmsRecordShutDownService.selectDmsRecordShutDownByRecordShutDownId(shutDown.getRecordShutDownId()); - if (origin == null) { - return error("停机记录不存在"); + if (shutDown.getShutReasonId() == null) { + throw new ServiceException("shutReasonId不能为空"); } + try { + // 查询原记录 + DmsRecordShutDown origin = dmsRecordShutDownService.selectDmsRecordShutDownByRecordShutDownId(shutDown.getRecordShutDownId()); + if (origin == null) { + throw new ServiceException("停机记录不存在"); + } - Date end = new Date(); - Date begin = origin.getShutBeginTime(); - shutDown.setShutEndTime(end); - if (begin != null) { - long minutes = Math.max(0, (end.getTime() - begin.getTime()) / 60000); - shutDown.setShutTime(BigDecimal.valueOf(minutes)); - } + // 构建更新对象,仅设置需要更新的字段 + DmsRecordShutDown updateRecord = new DmsRecordShutDown(); + updateRecord.setRecordShutDownId(shutDown.getRecordShutDownId()); + updateRecord.setShutReasonId(shutDown.getShutReasonId()); - int rows = dmsRecordShutDownService.updateDmsRecordShutDown(shutDown); - // 对指定设备(OLD-01~OLD-05)同步写入三色灯状态参数,供设备状态统计使用 - String deviceCode = shutDown.getDeviceCode() != null ? shutDown.getDeviceCode() : origin.getDeviceCode(); - Long deviceId = shutDown.getDeviceId() != null ? shutDown.getDeviceId() : origin.getDeviceId(); - if (deviceCode != null && deviceCode.startsWith("OLD-")) { - // 完成停机代表重新运行,三色灯置为“运行” - insertTriColorStatusParams(deviceCode, deviceId, true); + if (origin.getShutEndTime() == null) { + // 老设备:标记停机已结束 + updateRecord.setDowntimeFlag("1"); + // 老设备:补充结束时间和停机时长 + Date end = new Date(); + Date begin = origin.getShutBeginTime(); + updateRecord.setShutEndTime(end); + if (begin != null) { + long minutes = Math.max(0, (end.getTime() - begin.getTime()) / 60000); + updateRecord.setShutTime(BigDecimal.valueOf(minutes)); + } + } + // 新设备(shutEndTime已有值):仅更新shutReasonId,无需额外处理 + + int rows = dmsRecordShutDownService.updateDmsRecordShutDown(updateRecord); + + // 对老设备(OLD-01~OLD-05)同步写入三色灯状态参数 + if (origin.getShutEndTime() == null && origin.getDeviceId() != null) { + // 原记录不含deviceCode,需通过deviceId反查设备编号 + BaseDeviceLedger deviceQuery = new BaseDeviceLedger(); + deviceQuery.setObjId(origin.getDeviceId()); + List devices = baseDeviceLedgerService.selectBaseDeviceLedgerList(deviceQuery); + if (!devices.isEmpty()) { + String deviceCode = devices.get(0).getDeviceCode(); + if (deviceCode != null && deviceCode.startsWith("OLD-")) { + // 完成停机代表重新运行,三色灯置为"运行" + insertTriColorStatusParams(deviceCode, origin.getDeviceId(), true); + } + } + } + + return rows > 0 ? success(origin.getRecordShutDownId()) : error("更新停机记录失败"); + } catch (Exception e) { + log.error("PDA完成停机记录失败 | recordShutDownId={}, shutReasonId={}, 异常信息: {}", + shutDown.getRecordShutDownId(), shutDown.getShutReasonId(), e.getMessage(), e); + throw new ServiceException("完成停机失败: " + e.getMessage()); } - return rows > 0 ? success(origin.getRecordShutDownId()) : error("更新停机记录失败"); } /** @@ -361,9 +429,9 @@ public class DmsMobileController extends BaseController { List records = new ArrayList<>(); String runVal = running ? "True" : "False"; String pauseVal = running ? "False" : "True"; - records.add(buildParamVal("295", deviceCode, resolvedDeviceId, "机台状态-三色灯机器运行", runVal, now)); - records.add(buildParamVal("296", deviceCode, resolvedDeviceId, "机台状态-三色灯机器暂停", pauseVal, now)); - records.add(buildParamVal("297", deviceCode, resolvedDeviceId, "机台状态-三色灯机器报警", "False", now)); + records.add(buildParamVal("991", deviceCode, resolvedDeviceId, "机台状态-三色灯机器运行", runVal, now)); + records.add(buildParamVal("992", deviceCode, resolvedDeviceId, "机台状态-三色灯机器暂停", pauseVal, now)); + records.add(buildParamVal("993", deviceCode, resolvedDeviceId, "机台状态-三色灯机器报警", "False", now)); for (BaseDeviceParamVal rec : records) { baseDeviceParamValService.insertBaseDeviceParamVal(rec); diff --git a/aucma-dms/src/main/java/com/aucma/dms/domain/DmsRecordShutDown.java b/aucma-dms/src/main/java/com/aucma/dms/domain/DmsRecordShutDown.java index 9cedb76..ecea1c1 100644 --- a/aucma-dms/src/main/java/com/aucma/dms/domain/DmsRecordShutDown.java +++ b/aucma-dms/src/main/java/com/aucma/dms/domain/DmsRecordShutDown.java @@ -8,8 +8,6 @@ import org.apache.commons.lang3.builder.ToStringStyle; import java.math.BigDecimal; import java.util.Date; - - /** * 停机记录对象 dms_record_shut_down * @@ -31,6 +29,10 @@ public class DmsRecordShutDown extends DmsBaseEntity @Excel(name = "停机类型ID,关联dm_base_shut_type的shut_type_id") private Long shutType; + /** 停机原因ID,关联dms_base_shut_reason的shut_reason_id */ + @Excel(name = "停机原因ID") + private Long shutReasonId; + /** 停机原因 */ @Excel(name = "停机原因") private String shutReason; @@ -49,6 +51,10 @@ public class DmsRecordShutDown extends DmsBaseEntity @Excel(name = "停机时长") private BigDecimal shutTime; + /** 停机标识(0未结束 1已结束) */ + @Excel(name = "停机标识") + private String downtimeFlag; + /** 是否标识:1-是;2-否 */ @Excel(name = "是否标识:1-是;2-否") private Long isFlag; @@ -56,6 +62,9 @@ public class DmsRecordShutDown extends DmsBaseEntity /** 设备编码(查询用,非持久化字段) */ private String deviceCode; + /** 设备名称(查询用,非持久化字段) */ + private String deviceName; + public String getDeviceCode() { return deviceCode; } @@ -64,6 +73,30 @@ public class DmsRecordShutDown extends DmsBaseEntity this.deviceCode = deviceCode; } + public String getDeviceName() { + return deviceName; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + public Long getShutReasonId() { + return shutReasonId; + } + + public void setShutReasonId(Long shutReasonId) { + this.shutReasonId = shutReasonId; + } + + public String getDowntimeFlag() { + return downtimeFlag; + } + + public void setDowntimeFlag(String downtimeFlag) { + this.downtimeFlag = downtimeFlag; + } + public void setRecordShutDownId(Long recordShutDownId) { this.recordShutDownId = recordShutDownId; @@ -143,10 +176,14 @@ public class DmsRecordShutDown extends DmsBaseEntity .append("recordShutDownId", getRecordShutDownId()) .append("deviceId", getDeviceId()) .append("shutType", getShutType()) + .append("shutReasonId", getShutReasonId()) .append("shutReason", getShutReason()) + .append("deviceCode", getDeviceCode()) + .append("deviceName", getDeviceName()) .append("shutBeginTime", getShutBeginTime()) .append("shutEndTime", getShutEndTime()) .append("shutTime", getShutTime()) + .append("downtimeFlag", getDowntimeFlag()) .append("isFlag", getIsFlag()) .append("remark", getRemark()) .append("createBy", getCreateBy()) diff --git a/aucma-dms/src/main/java/com/aucma/dms/mapper/DmsRecordShutDownMapper.java b/aucma-dms/src/main/java/com/aucma/dms/mapper/DmsRecordShutDownMapper.java index 7dfc404..9a0c6ee 100644 --- a/aucma-dms/src/main/java/com/aucma/dms/mapper/DmsRecordShutDownMapper.java +++ b/aucma-dms/src/main/java/com/aucma/dms/mapper/DmsRecordShutDownMapper.java @@ -59,4 +59,11 @@ public interface DmsRecordShutDownMapper * @return 结果 */ public int deleteDmsRecordShutDownByRecordShutDownIds(Long[] recordShutDownIds); + + /** + * 查询PDA待处理停机记录(结束时间为空 或 停机原因ID=1) + * + * @return 停机记录集合 + */ + public List selectPdaShutDownList(); } diff --git a/aucma-dms/src/main/java/com/aucma/dms/service/IDmsRecordShutDownService.java b/aucma-dms/src/main/java/com/aucma/dms/service/IDmsRecordShutDownService.java index c52d692..bdbd528 100644 --- a/aucma-dms/src/main/java/com/aucma/dms/service/IDmsRecordShutDownService.java +++ b/aucma-dms/src/main/java/com/aucma/dms/service/IDmsRecordShutDownService.java @@ -59,4 +59,11 @@ public interface IDmsRecordShutDownService * @return 结果 */ public int deleteDmsRecordShutDownByRecordShutDownId(Long recordShutDownId); + + /** + * 查询PDA待处理停机记录(结束时间为空 或 停机原因ID=1) + * + * @return 停机记录集合 + */ + public List selectPdaShutDownList(); } diff --git a/aucma-dms/src/main/java/com/aucma/dms/service/impl/DmsRecordShutDownServiceImpl.java b/aucma-dms/src/main/java/com/aucma/dms/service/impl/DmsRecordShutDownServiceImpl.java index 2de945b..0b6a133 100644 --- a/aucma-dms/src/main/java/com/aucma/dms/service/impl/DmsRecordShutDownServiceImpl.java +++ b/aucma-dms/src/main/java/com/aucma/dms/service/impl/DmsRecordShutDownServiceImpl.java @@ -99,4 +99,15 @@ public class DmsRecordShutDownServiceImpl implements IDmsRecordShutDownService { return dmsRecordShutDownMapper.deleteDmsRecordShutDownByRecordShutDownId(recordShutDownId); } + + /** + * 查询PDA待处理停机记录(结束时间为空 或 停机原因ID=1) + * + * @return 停机记录集合 + */ + @Override + public List selectPdaShutDownList() + { + return dmsRecordShutDownMapper.selectPdaShutDownList(); + } } diff --git a/aucma-dms/src/main/resources/mapper/dms/DmsRecordShutDownMapper.xml b/aucma-dms/src/main/resources/mapper/dms/DmsRecordShutDownMapper.xml index ce2af2c..c74dc37 100644 --- a/aucma-dms/src/main/resources/mapper/dms/DmsRecordShutDownMapper.xml +++ b/aucma-dms/src/main/resources/mapper/dms/DmsRecordShutDownMapper.xml @@ -8,67 +8,82 @@ + + + + - + - select record_shut_down_id, - machine_id as device_id, - shut_type_id as shut_type, - shut_reason, - shut_begin_time, - shut_end_time, - shut_time, - active_flag as is_flag, - remark, - create_by, - create_time, - update_by, - update_time - from dms_record_shut_down + select r.record_shut_down_id, + r.machine_id as device_id, + r.shut_type_id as shut_type, + r.shut_reason_id, + r.shut_reason, + r.shut_begin_time, + r.shut_end_time, + r.shut_time, + r.downtime_flag, + r.active_flag as is_flag, + r.remark, + r.create_by, + r.create_time, + r.update_by, + r.update_time, + d.device_code as device_code, + d.device_name as device_name + from dms_record_shut_down r + left join base_deviceledger d on r.machine_id = d.OBJ_ID - + + + SELECT SEQ_DMS_REC_SHUT_DOWN.NEXTVAL FROM DUAL + insert into dms_record_shut_down - device_id, - shut_type, + record_shut_down_id, + machine_id, + shut_type_id, + shut_reason_id, shut_reason, shut_begin_time, shut_end_time, shut_time, - is_flag, + downtime_flag, + active_flag, remark, create_by, create_time, @@ -76,12 +91,15 @@ update_time, + #{recordShutDownId}, #{deviceId}, #{shutType}, + #{shutReasonId}, #{shutReason}, #{shutBeginTime}, #{shutEndTime}, #{shutTime}, + #{downtimeFlag}, #{isFlag}, #{remark}, #{createBy}, @@ -94,13 +112,15 @@ update dms_record_shut_down - device_id = #{deviceId}, - shut_type = #{shutType}, + machine_id = #{deviceId}, + shut_type_id = #{shutType}, + shut_reason_id = #{shutReasonId}, shut_reason = #{shutReason}, shut_begin_time = #{shutBeginTime}, shut_end_time = #{shutEndTime}, shut_time = #{shutTime}, - is_flag = #{isFlag}, + downtime_flag = #{downtimeFlag}, + active_flag = #{isFlag}, remark = #{remark}, create_by = #{createBy}, create_time = #{createTime}, @@ -110,6 +130,13 @@ where record_shut_down_id = #{recordShutDownId} + + delete from dms_record_shut_down