From 9470654094f38a66e7a54c2ce135a7a5bc67b8ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B8=B8=E7=86=9F=E5=90=B4=E5=BD=A6=E7=A5=96?= Date: Tue, 11 Nov 2025 22:03:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BD=92=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/DataArchiveMapper.java | 112 +++++++++++ .../service/DataArchiveService.java | 42 ++++ .../service/impl/DataArchiveServiceImpl.java | 189 ++++++++++++++++++ .../task/DataArchiveScheduler.java | 146 ++++++++++++++ .../automatedWarehouse/DataArchiveMapper.xml | 148 ++++++++++++++ 5 files changed, 637 insertions(+) create mode 100644 src/main/java/com/gaotao/modules/automatedWarehouse/mapper/DataArchiveMapper.java create mode 100644 src/main/java/com/gaotao/modules/automatedWarehouse/service/DataArchiveService.java create mode 100644 src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/DataArchiveServiceImpl.java create mode 100644 src/main/java/com/gaotao/modules/automatedWarehouse/task/DataArchiveScheduler.java create mode 100644 src/main/resources/mapper/automatedWarehouse/DataArchiveMapper.xml diff --git a/src/main/java/com/gaotao/modules/automatedWarehouse/mapper/DataArchiveMapper.java b/src/main/java/com/gaotao/modules/automatedWarehouse/mapper/DataArchiveMapper.java new file mode 100644 index 0000000..b11cce2 --- /dev/null +++ b/src/main/java/com/gaotao/modules/automatedWarehouse/mapper/DataArchiveMapper.java @@ -0,0 +1,112 @@ +package com.gaotao.modules.automatedWarehouse.mapper; + +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * @Description 数据归档Mapper接口 - rqrq + * @Author rqrq + * @Date 2025/11/11 + */ +@Mapper +public interface DataArchiveMapper { + + /** + * @Description 查询倒数第N条记录的ID(通用方法)- rqrq + * @param tableName 表名 + * @param keepCount 保留记录数量 + * @return 倒数第N条的ID + * @author rqrq + */ + Long getThresholdIdByKeepCount(@Param("tableName") String tableName, + @Param("keepCount") int keepCount); + + // ========== interface_call_log 归档相关方法 ========== - rqrq + + /** + * @Description 插入interface_call_log数据到历史表 - rqrq + * @param thresholdId 阈值ID,小于此ID的数据将被归档 + * @return 插入的记录数 + * @author rqrq + */ + int insertInterfaceCallLogToHistory(@Param("thresholdId") Long thresholdId); + + /** + * @Description 删除interface_call_log中小于阈值ID的数据 - rqrq + * @param thresholdId 阈值ID + * @return 删除的记录数 + * @author rqrq + */ + int deleteInterfaceCallLogByThresholdId(@Param("thresholdId") Long thresholdId); + + // ========== wcs_callback_pallet_scan 归档相关方法 ========== - rqrq + + /** + * @Description 插入wcs_callback_pallet_scan数据到历史表 - rqrq + * @param thresholdId 阈值ID + * @return 插入的记录数 + * @author rqrq + */ + int insertWcsCallbackPalletScanToHistory(@Param("thresholdId") Long thresholdId); + + /** + * @Description 删除wcs_callback_pallet_scan中小于阈值ID的数据 - rqrq + * @param thresholdId 阈值ID + * @return 删除的记录数 + * @author rqrq + */ + int deleteWcsCallbackPalletScanByThresholdId(@Param("thresholdId") Long thresholdId); + + // ========== wcs_callback_task 归档相关方法 ========== - rqrq + + /** + * @Description 插入wcs_callback_task数据到历史表 - rqrq + * @param thresholdId 阈值ID + * @return 插入的记录数 + * @author rqrq + */ + int insertWcsCallbackTaskToHistory(@Param("thresholdId") Long thresholdId); + + /** + * @Description 删除wcs_callback_task中小于阈值ID的数据 - rqrq + * @param thresholdId 阈值ID + * @return 删除的记录数 + * @author rqrq + */ + int deleteWcsCallbackTaskByThresholdId(@Param("thresholdId") Long thresholdId); + + // ========== wms_transport_task 归档相关方法 ========== - rqrq + + /** + * @Description 插入wms_transport_task_detail数据到历史表(通过task_no关联主表)- rqrq + * @param thresholdId 主表阈值ID + * @return 插入的记录数 + * @author rqrq + */ + int insertWmsTransportTaskDetailToHistory(@Param("thresholdId") Long thresholdId); + + /** + * @Description 插入wms_transport_task数据到历史表 - rqrq + * @param thresholdId 阈值ID + * @return 插入的记录数 + * @author rqrq + */ + int insertWmsTransportTaskToHistory(@Param("thresholdId") Long thresholdId); + + /** + * @Description 删除wms_transport_task_detail中关联的数据 - rqrq + * @param thresholdId 主表阈值ID + * @return 删除的记录数 + * @author rqrq + */ + int deleteWmsTransportTaskDetailByThresholdId(@Param("thresholdId") Long thresholdId); + + /** + * @Description 删除wms_transport_task中小于阈值ID的数据 - rqrq + * @param thresholdId 阈值ID + * @return 删除的记录数 + * @author rqrq + */ + int deleteWmsTransportTaskByThresholdId(@Param("thresholdId") Long thresholdId); +} + diff --git a/src/main/java/com/gaotao/modules/automatedWarehouse/service/DataArchiveService.java b/src/main/java/com/gaotao/modules/automatedWarehouse/service/DataArchiveService.java new file mode 100644 index 0000000..801e6a6 --- /dev/null +++ b/src/main/java/com/gaotao/modules/automatedWarehouse/service/DataArchiveService.java @@ -0,0 +1,42 @@ +package com.gaotao.modules.automatedWarehouse.service; + +/** + * @Description 数据归档服务接口 - rqrq + * @Author rqrq + * @Date 2025/11/11 + */ +public interface DataArchiveService { + + /** + * @Description 归档接口调用日志 - rqrq + * @param keepCount 保留最新记录数量 + * @return 归档的记录数量 + * @author rqrq + */ + int archiveInterfaceCallLog(int keepCount); + + /** + * @Description 归档WCS回调栈板扫描数据 - rqrq + * @param keepCount 保留最新记录数量 + * @return 归档的记录数量 + * @author rqrq + */ + int archiveWcsCallbackPalletScan(int keepCount); + + /** + * @Description 归档WCS回调任务数据 - rqrq + * @param keepCount 保留最新记录数量 + * @return 归档的记录数量 + * @author rqrq + */ + int archiveWcsCallbackTask(int keepCount); + + /** + * @Description 归档WMS运输任务数据(包含主表和明细表)- rqrq + * @param keepCount 保留最新记录数量 + * @return 归档的主表记录数量 + * @author rqrq + */ + int archiveWmsTransportTask(int keepCount); +} + diff --git a/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/DataArchiveServiceImpl.java b/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/DataArchiveServiceImpl.java new file mode 100644 index 0000000..b2e8256 --- /dev/null +++ b/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/DataArchiveServiceImpl.java @@ -0,0 +1,189 @@ +package com.gaotao.modules.automatedWarehouse.service.impl; + +import com.gaotao.modules.automatedWarehouse.mapper.DataArchiveMapper; +import com.gaotao.modules.automatedWarehouse.service.DataArchiveService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * @Description 数据归档服务实现类 - rqrq + * @Author rqrq + * @Date 2025/11/11 + */ +@Slf4j +@Service +public class DataArchiveServiceImpl implements DataArchiveService { + + @Autowired + private DataArchiveMapper dataArchiveMapper; + + /** + * @Description 归档接口调用日志 - rqrq + * @param keepCount 保留最新记录数量 + * @return 归档的记录数量 + * @author rqrq + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int archiveInterfaceCallLog(int keepCount) { + System.out.println("开始归档interface_call_log数据 - rqrq,保留最新" + keepCount + "条"); + + try { + // 1. 查询倒数第N条的ID - rqrq + Long thresholdId = dataArchiveMapper.getThresholdIdByKeepCount("interface_call_log", keepCount); + + if (thresholdId == null) { + System.out.println("数据量不足" + keepCount + "条,无需归档 - rqrq"); + return 0; + } + + System.out.println("查询到阈值ID=" + thresholdId + ",将归档小于此ID的数据 - rqrq"); + + // 2. 插入到历史表(不带id字段)- rqrq + int insertCount = dataArchiveMapper.insertInterfaceCallLogToHistory(thresholdId); + System.out.println("已插入" + insertCount + "条数据到interface_call_log_history - rqrq"); + + // 3. 删除原表数据 - rqrq + int deleteCount = dataArchiveMapper.deleteInterfaceCallLogByThresholdId(thresholdId); + System.out.println("已删除" + deleteCount + "条数据从interface_call_log - rqrq"); + + System.out.println("interface_call_log归档完成 - rqrq,归档数量=" + deleteCount); + return deleteCount; + + } catch (Exception e) { + System.out.println("归档interface_call_log失败 - rqrq:" + e.getMessage()); + throw new RuntimeException("归档interface_call_log失败:" + e.getMessage(), e); + } + } + + /** + * @Description 归档WCS回调栈板扫描数据 - rqrq + * @param keepCount 保留最新记录数量 + * @return 归档的记录数量 + * @author rqrq + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int archiveWcsCallbackPalletScan(int keepCount) { + System.out.println("开始归档wcs_callback_pallet_scan数据 - rqrq,保留最新" + keepCount + "条"); + + try { + // 1. 查询倒数第N条的ID - rqrq + Long thresholdId = dataArchiveMapper.getThresholdIdByKeepCount("wcs_callback_pallet_scan", keepCount); + + if (thresholdId == null) { + System.out.println("数据量不足" + keepCount + "条,无需归档 - rqrq"); + return 0; + } + + System.out.println("查询到阈值ID=" + thresholdId + ",将归档小于此ID的数据 - rqrq"); + + // 2. 插入到历史表(不带id字段)- rqrq + int insertCount = dataArchiveMapper.insertWcsCallbackPalletScanToHistory(thresholdId); + System.out.println("已插入" + insertCount + "条数据到wcs_callback_pallet_scan_history - rqrq"); + + // 3. 删除原表数据 - rqrq + int deleteCount = dataArchiveMapper.deleteWcsCallbackPalletScanByThresholdId(thresholdId); + System.out.println("已删除" + deleteCount + "条数据从wcs_callback_pallet_scan - rqrq"); + + System.out.println("wcs_callback_pallet_scan归档完成 - rqrq,归档数量=" + deleteCount); + return deleteCount; + + } catch (Exception e) { + System.out.println("归档wcs_callback_pallet_scan失败 - rqrq:" + e.getMessage()); + throw new RuntimeException("归档wcs_callback_pallet_scan失败:" + e.getMessage(), e); + } + } + + /** + * @Description 归档WCS回调任务数据 - rqrq + * @param keepCount 保留最新记录数量 + * @return 归档的记录数量 + * @author rqrq + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int archiveWcsCallbackTask(int keepCount) { + System.out.println("开始归档wcs_callback_task数据 - rqrq,保留最新" + keepCount + "条"); + + try { + // 1. 查询倒数第N条的ID - rqrq + Long thresholdId = dataArchiveMapper.getThresholdIdByKeepCount("wcs_callback_task", keepCount); + + if (thresholdId == null) { + System.out.println("数据量不足" + keepCount + "条,无需归档 - rqrq"); + return 0; + } + + System.out.println("查询到阈值ID=" + thresholdId + ",将归档小于此ID的数据 - rqrq"); + + // 2. 插入到历史表(不带id字段)- rqrq + int insertCount = dataArchiveMapper.insertWcsCallbackTaskToHistory(thresholdId); + System.out.println("已插入" + insertCount + "条数据到wcs_callback_task_history - rqrq"); + + // 3. 删除原表数据 - rqrq + int deleteCount = dataArchiveMapper.deleteWcsCallbackTaskByThresholdId(thresholdId); + System.out.println("已删除" + deleteCount + "条数据从wcs_callback_task - rqrq"); + + System.out.println("wcs_callback_task归档完成 - rqrq,归档数量=" + deleteCount); + return deleteCount; + + } catch (Exception e) { + System.out.println("归档wcs_callback_task失败 - rqrq:" + e.getMessage()); + throw new RuntimeException("归档wcs_callback_task失败:" + e.getMessage(), e); + } + } + + /** + * @Description 归档WMS运输任务数据(包含主表和明细表)- rqrq + * @param keepCount 保留最新记录数量 + * @return 归档的主表记录数量 + * @author rqrq + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int archiveWmsTransportTask(int keepCount) { + System.out.println("开始归档wms_transport_task及明细数据 - rqrq,保留最新" + keepCount + "条"); + + try { + // 1. 查询倒数第N条的ID - rqrq + Long thresholdId = dataArchiveMapper.getThresholdIdByKeepCount("wms_transport_task", keepCount); + + if (thresholdId == null) { + System.out.println("数据量不足" + keepCount + "条,无需归档 - rqrq"); + return 0; + } + + System.out.println("查询到阈值ID=" + thresholdId + ",将归档小于此ID的数据 - rqrq"); + + // 2. 先归档明细表 wms_transport_task_detail - rqrq + // 2.1 插入明细数据到历史表(根据task_no关联)- rqrq + int detailInsertCount = dataArchiveMapper.insertWmsTransportTaskDetailToHistory(thresholdId); + System.out.println("已插入" + detailInsertCount + "条数据到wms_transport_task_detail_history - rqrq"); + + // 3. 再归档主表 wms_transport_task - rqrq + // 3.1 插入主表数据到历史表 - rqrq + int taskInsertCount = dataArchiveMapper.insertWmsTransportTaskToHistory(thresholdId); + System.out.println("已插入" + taskInsertCount + "条数据到wms_transport_task_history - rqrq"); + + // 4. 删除原表数据(先删明细,再删主表)- rqrq + // 4.1 删除明细表数据 - rqrq + int detailDeleteCount = dataArchiveMapper.deleteWmsTransportTaskDetailByThresholdId(thresholdId); + System.out.println("已删除" + detailDeleteCount + "条数据从wms_transport_task_detail - rqrq"); + + // 4.2 删除主表数据 - rqrq + int taskDeleteCount = dataArchiveMapper.deleteWmsTransportTaskByThresholdId(thresholdId); + System.out.println("已删除" + taskDeleteCount + "条数据从wms_transport_task - rqrq"); + + System.out.println("wms_transport_task及明细归档完成 - rqrq,归档任务数=" + taskDeleteCount + ",明细数=" + detailDeleteCount); + return taskDeleteCount; + + } catch (Exception e) { + System.out.println("归档wms_transport_task失败 - rqrq:" + e.getMessage()); + throw new RuntimeException("归档wms_transport_task失败:" + e.getMessage(), e); + } + } +} + diff --git a/src/main/java/com/gaotao/modules/automatedWarehouse/task/DataArchiveScheduler.java b/src/main/java/com/gaotao/modules/automatedWarehouse/task/DataArchiveScheduler.java new file mode 100644 index 0000000..392427c --- /dev/null +++ b/src/main/java/com/gaotao/modules/automatedWarehouse/task/DataArchiveScheduler.java @@ -0,0 +1,146 @@ +package com.gaotao.modules.automatedWarehouse.task; + +import com.gaotao.modules.automatedWarehouse.service.DataArchiveService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +/** + * @Description 数据归档定时任务类 - rqrq + * @Author rqrq + * @Date 2025/11/11 + * + * 功能说明: + * 1. 将历史数据定期归档到历史表,防止主表数据过多导致查询效率降低 + * 2. 所有定时任务统一在每天晚上11:30执行 + * 3. 通过配置文件控制定时任务的执行时间和开关 + */ +@Slf4j +@Component +public class DataArchiveScheduler { + + @Autowired + private DataArchiveService dataArchiveService; + + /** + * 数据归档任务开关 - rqrq + */ + @Value("${scheduler.dataArchive.enabled:false}") + private boolean enabled; + + /** + * @Description 定时任务:归档接口调用日志 - rqrq + * @Title archiveInterfaceCallLog + * @author rqrq + * @date 2025/11/11 + * + * 业务逻辑: + * 1. 保留interface_call_log表中ID最大的2000条记录 + * 2. 将多余的数据转移到interface_call_log_history表 + * 3. 删除interface_call_log表中的多余数据 + */ + @Scheduled(cron = "${scheduler.dataArchive.interfaceCallLog.cron:0 30 23 * * ?}") + public void archiveInterfaceCallLog() { + // 检查定时任务开关 - rqrq + if (!enabled) { + return; + } + + log.info("=== 开始归档接口调用日志数据 - rqrq ==="); + + try { + int archivedCount = dataArchiveService.archiveInterfaceCallLog(2000); + log.info("=== 接口调用日志归档完成 - rqrq:归档数量={} ===", archivedCount); + } catch (Exception e) { + log.error("=== 接口调用日志归档失败 - rqrq ===", e); + } + } + + /** + * @Description 定时任务:归档WCS回调栈板扫描数据 - rqrq + * @Title archiveWcsCallbackPalletScan + * @author rqrq + * @date 2025/11/11 + * + * 业务逻辑: + * 1. 保留wcs_callback_pallet_scan表中ID最大的2000条记录 + * 2. 将多余的数据转移到wcs_callback_pallet_scan_history表 + * 3. 删除wcs_callback_pallet_scan表中的多余数据 + */ + @Scheduled(cron = "${scheduler.dataArchive.wcsCallbackPalletScan.cron:0 30 23 * * ?}") + public void archiveWcsCallbackPalletScan() { + // 检查定时任务开关 - rqrq + if (!enabled) { + return; + } + + log.info("=== 开始归档WCS回调栈板扫描数据 - rqrq ==="); + + try { + int archivedCount = dataArchiveService.archiveWcsCallbackPalletScan(2000); + log.info("=== WCS回调栈板扫描数据归档完成 - rqrq:归档数量={} ===", archivedCount); + } catch (Exception e) { + log.error("=== WCS回调栈板扫描数据归档失败 - rqrq ===", e); + } + } + + /** + * @Description 定时任务:归档WCS回调任务数据 - rqrq + * @Title archiveWcsCallbackTask + * @author rqrq + * @date 2025/11/11 + * + * 业务逻辑: + * 1. 保留wcs_callback_task表中ID最大的2000条记录 + * 2. 将多余的数据转移到wcs_callback_task_history表 + * 3. 删除wcs_callback_task表中的多余数据 + */ + @Scheduled(cron = "${scheduler.dataArchive.wcsCallbackTask.cron:0 30 23 * * ?}") + public void archiveWcsCallbackTask() { + // 检查定时任务开关 - rqrq + if (!enabled) { + return; + } + + log.info("=== 开始归档WCS回调任务数据 - rqrq ==="); + + try { + int archivedCount = dataArchiveService.archiveWcsCallbackTask(2000); + log.info("=== WCS回调任务数据归档完成 - rqrq:归档数量={} ===", archivedCount); + } catch (Exception e) { + log.error("=== WCS回调任务数据归档失败 - rqrq ===", e); + } + } + + /** + * @Description 定时任务:归档WMS运输任务数据 - rqrq + * @Title archiveWmsTransportTask + * @author rqrq + * @date 2025/11/11 + * + * 业务逻辑: + * 1. 保留wms_transport_task表中ID最大的2000条记录 + * 2. 根据task_no关联,先转移wms_transport_task_detail到历史表 + * 3. 再转移wms_transport_task到历史表 + * 4. 删除原表中的多余数据(先删detail,再删主表) + */ + @Scheduled(cron = "${scheduler.dataArchive.wmsTransportTask.cron:0 30 23 * * ?}") + public void archiveWmsTransportTask() { + // 检查定时任务开关 - rqrq + if (!enabled) { + return; + } + + log.info("=== 开始归档WMS运输任务数据 - rqrq ==="); + + try { + int archivedCount = dataArchiveService.archiveWmsTransportTask(2000); + log.info("=== WMS运输任务数据归档完成 - rqrq:归档任务数量={} ===", archivedCount); + } catch (Exception e) { + log.error("=== WMS运输任务数据归档失败 - rqrq ===", e); + } + } +} + diff --git a/src/main/resources/mapper/automatedWarehouse/DataArchiveMapper.xml b/src/main/resources/mapper/automatedWarehouse/DataArchiveMapper.xml new file mode 100644 index 0000000..1a6d2cc --- /dev/null +++ b/src/main/resources/mapper/automatedWarehouse/DataArchiveMapper.xml @@ -0,0 +1,148 @@ + + + + + + + + + + + + INSERT INTO interface_call_log_history ( + interface_name, method_name, request_data, response_data, + status, error_message, execution_time, site, business_key, + created_time, created_by, remark + ) + SELECT + interface_name, method_name, request_data, response_data, + status, error_message, execution_time, site, business_key, + created_time, created_by, remark + FROM interface_call_log WITH (NOLOCK) + WHERE id < #{thresholdId} + + + + + DELETE FROM interface_call_log + WHERE id < #{thresholdId} + + + + + + + INSERT INTO wcs_callback_pallet_scan_history ( + site, pallet_id, task_no, item_no, wcs_scan_time, + wcs_barcode_list, wcs_total_quantity, sore_type, process_status, + process_time, error_msg, retry_count, created_at, + updated_at, json_str, action_type + ) + SELECT + site, pallet_id, task_no, item_no, wcs_scan_time, + wcs_barcode_list, wcs_total_quantity, sore_type, process_status, + process_time, error_msg, retry_count, created_at, + updated_at, json_str, action_type + FROM wcs_callback_pallet_scan WITH (NOLOCK) + WHERE id < #{thresholdId} + + + + + DELETE FROM wcs_callback_pallet_scan + WHERE id < #{thresholdId} + + + + + + + INSERT INTO wcs_callback_task_history ( + site, pallet_id, trans_type_desc, to_warehouse_id, + to_location_id, status, created_time, process_start_time, + process_end_time, error_msg, retry_count, remark, + task_no, item_no, to_station + ) + SELECT + site, pallet_id, trans_type_desc, to_warehouse_id, + to_location_id, status, created_time, process_start_time, + process_end_time, error_msg, retry_count, remark, + task_no, item_no, to_station + FROM wcs_callback_task WITH (NOLOCK) + WHERE id < #{thresholdId} + + + + + DELETE FROM wcs_callback_task + WHERE id < #{thresholdId} + + + + + + + INSERT INTO wms_transport_task_detail_history ( + site, task_no, item_no, seq_no, action_type, comment, + from_location, to_location, agv_code, status, + start_time, complete_time, error_code, error_msg + ) + SELECT + d.site, d.task_no, d.item_no, d.seq_no, d.action_type, d.comment, + d.from_location, d.to_location, d.agv_code, d.status, + d.start_time, d.complete_time, d.error_code, d.error_msg + FROM wms_transport_task_detail d WITH (NOLOCK) + WHERE d.task_no IN ( + SELECT task_no + FROM wms_transport_task WITH (NOLOCK) + WHERE id < #{thresholdId} + ) + + + + + INSERT INTO wms_transport_task_history ( + site, task_no, item_no, source_type, source_bill_no, + source_line_id, part_no, qty, batch_no, serial_no, + from_location, to_location, pallet_id, agv_code, priority, + status, wms_send_time, wcs_receive_time, start_time, + complete_time, error_code, error_msg, created_by, + created_time, updated_time, wcs_task_id, finish_qty, + wms_status, pallet_type, to_area + ) + SELECT + site, task_no, item_no, source_type, source_bill_no, + source_line_id, part_no, qty, batch_no, serial_no, + from_location, to_location, pallet_id, agv_code, priority, + status, wms_send_time, wcs_receive_time, start_time, + complete_time, error_code, error_msg, created_by, + created_time, updated_time, wcs_task_id, finish_qty, + wms_status, pallet_type, to_area + FROM wms_transport_task WITH (NOLOCK) + WHERE id < #{thresholdId} + + + + + DELETE FROM wms_transport_task_detail + WHERE task_no IN ( + SELECT task_no + FROM wms_transport_task WITH (NOLOCK) + WHERE id < #{thresholdId} + ) + + + + + DELETE FROM wms_transport_task + WHERE id < #{thresholdId} + + + +