Commit 07289f558482020dafecd164b79b0b57434fe47d
Merge branch 'develop' of http://git.huahengcloud.com/wms/wms4.git into develop
Showing
8 changed files
with
59 additions
and
49 deletions
ant-design-vue-jeecg/src/views/system/receipt/ReceiptHeaderList.vue
@@ -4,6 +4,13 @@ | @@ -4,6 +4,13 @@ | ||
4 | <div class="table-page-search-wrapper"> | 4 | <div class="table-page-search-wrapper"> |
5 | <a-form layout="inline" @keyup.enter.native="searchQuery"> | 5 | <a-form layout="inline" @keyup.enter.native="searchQuery"> |
6 | <a-row :gutter="24"> | 6 | <a-row :gutter="24"> |
7 | + | ||
8 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | ||
9 | + <a-form-item label="单据ID"> | ||
10 | + <a-input placeholder="请输入单据ID" v-model="queryParam.id"></a-input> | ||
11 | + </a-form-item> | ||
12 | + </a-col> | ||
13 | + | ||
7 | <a-col :xl="6" :lg="7" :md="8" :sm="24"> | 14 | <a-col :xl="6" :lg="7" :md="8" :sm="24"> |
8 | <a-form-item label="入库单编码"> | 15 | <a-form-item label="入库单编码"> |
9 | <a-input placeholder="请输入入库单编码" v-model="queryParam.code"></a-input> | 16 | <a-input placeholder="请输入入库单编码" v-model="queryParam.code"></a-input> |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/LocationAllocationServiceImpl.java
@@ -139,7 +139,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService | @@ -139,7 +139,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService | ||
139 | } | 139 | } |
140 | } | 140 | } |
141 | roadWays.removeAll(removeRoadWays); | 141 | roadWays.removeAll(removeRoadWays); |
142 | - if (roadWays == null || roadWays.size() == 0) { | 142 | + if (CollectionUtils.isEmpty(roadWays)) { |
143 | throw new JeecgBootException("分配库位时, 可用巷道为空"); | 143 | throw new JeecgBootException("分配库位时, 可用巷道为空"); |
144 | } | 144 | } |
145 | Integer roadWay = locationAllocationService.getRoadWay(roadWays, materialCode, zoneCode, warehouseCode); | 145 | Integer roadWay = locationAllocationService.getRoadWay(roadWays, materialCode, zoneCode, warehouseCode); |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/monitor/apiLog/mapper/ApiLogMapper.java
1 | package org.jeecg.modules.wms.monitor.apiLog.mapper; | 1 | package org.jeecg.modules.wms.monitor.apiLog.mapper; |
2 | 2 | ||
3 | -import java.util.List; | 3 | +import org.jeecg.modules.wms.monitor.apiLog.entity.ApiLog; |
4 | 4 | ||
5 | -import org.apache.ibatis.annotations.Param; | ||
6 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 5 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
7 | -import org.jeecg.modules.wms.monitor.apiLog.entity.ApiLog; | ||
8 | 6 | ||
9 | /** | 7 | /** |
10 | * @Description: 接口日志 | 8 | * @Description: 接口日志 |
@@ -14,4 +12,6 @@ import org.jeecg.modules.wms.monitor.apiLog.entity.ApiLog; | @@ -14,4 +12,6 @@ import org.jeecg.modules.wms.monitor.apiLog.entity.ApiLog; | ||
14 | */ | 12 | */ |
15 | public interface ApiLogMapper extends BaseMapper<ApiLog> { | 13 | public interface ApiLogMapper extends BaseMapper<ApiLog> { |
16 | 14 | ||
15 | + Integer deleteByCreateTime(String createTime); | ||
16 | + | ||
17 | } | 17 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/monitor/apiLog/mapper/xml/ApiLogMapper.xml
@@ -2,4 +2,11 @@ | @@ -2,4 +2,11 @@ | ||
2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
3 | <mapper namespace="org.jeecg.modules.wms.monitor.apiLog.mapper.ApiLogMapper"> | 3 | <mapper namespace="org.jeecg.modules.wms.monitor.apiLog.mapper.ApiLogMapper"> |
4 | 4 | ||
5 | + <delete id="deleteByCreateTime" parameterType="java.lang.String"> | ||
6 | + DELETE | ||
7 | + FROM api_log | ||
8 | + WHERE create_time <![CDATA[<=]]> #{createTime}) | ||
9 | + order by id asc limit 1000 | ||
10 | + </delete> | ||
11 | + | ||
5 | </mapper> | 12 | </mapper> |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/monitor/apiLog/service/IApiLogService.java
@@ -16,4 +16,5 @@ public interface IApiLogService extends IService<ApiLog> { | @@ -16,4 +16,5 @@ public interface IApiLogService extends IService<ApiLog> { | ||
16 | 16 | ||
17 | public List<String> getApiNameList(); | 17 | public List<String> getApiNameList(); |
18 | 18 | ||
19 | + public Integer deleteByCreateTime(String createTime); | ||
19 | } | 20 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/monitor/apiLog/service/impl/ApiLogServiceImpl.java
@@ -4,6 +4,8 @@ import java.util.Date; | @@ -4,6 +4,8 @@ import java.util.Date; | ||
4 | import java.util.List; | 4 | import java.util.List; |
5 | import java.util.stream.Collectors; | 5 | import java.util.stream.Collectors; |
6 | 6 | ||
7 | +import javax.annotation.Resource; | ||
8 | + | ||
7 | import org.jeecg.modules.wms.monitor.apiLog.entity.ApiLog; | 9 | import org.jeecg.modules.wms.monitor.apiLog.entity.ApiLog; |
8 | import org.jeecg.modules.wms.monitor.apiLog.mapper.ApiLogMapper; | 10 | import org.jeecg.modules.wms.monitor.apiLog.mapper.ApiLogMapper; |
9 | import org.jeecg.modules.wms.monitor.apiLog.service.IApiLogService; | 11 | import org.jeecg.modules.wms.monitor.apiLog.service.IApiLogService; |
@@ -26,6 +28,9 @@ import cn.hutool.core.date.DateUtil; | @@ -26,6 +28,9 @@ import cn.hutool.core.date.DateUtil; | ||
26 | @Service | 28 | @Service |
27 | public class ApiLogServiceImpl extends ServiceImpl<ApiLogMapper, ApiLog> implements IApiLogService { | 29 | public class ApiLogServiceImpl extends ServiceImpl<ApiLogMapper, ApiLog> implements IApiLogService { |
28 | 30 | ||
31 | + @Resource | ||
32 | + private ApiLogMapper apiLogMapper; | ||
33 | + | ||
29 | @Override | 34 | @Override |
30 | @Scheduled(fixedDelay = 1800 * 1000) // 计划任务:每次方法执行后1800秒执行 | 35 | @Scheduled(fixedDelay = 1800 * 1000) // 计划任务:每次方法执行后1800秒执行 |
31 | // @SchedulerLock(name = "getApiNameList", lockAtLeastFor = "PT900S", lockAtMostFor = "PT3600S") // 计划任务锁:最短等待时间1800秒,最长等待时间3600秒 | 36 | // @SchedulerLock(name = "getApiNameList", lockAtLeastFor = "PT900S", lockAtMostFor = "PT3600S") // 计划任务锁:最短等待时间1800秒,最长等待时间3600秒 |
@@ -37,4 +42,10 @@ public class ApiLogServiceImpl extends ServiceImpl<ApiLogMapper, ApiLog> impleme | @@ -37,4 +42,10 @@ public class ApiLogServiceImpl extends ServiceImpl<ApiLogMapper, ApiLog> impleme | ||
37 | return apiLogList.stream().map(t -> t.getApiName()).collect(Collectors.toList()); | 42 | return apiLogList.stream().map(t -> t.getApiName()).collect(Collectors.toList()); |
38 | } | 43 | } |
39 | 44 | ||
45 | + @Override | ||
46 | + public Integer deleteByCreateTime(String createTime) { | ||
47 | + LambdaQueryWrapper<ApiLog> apiLogLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
48 | + apiLogLambdaQueryWrapper.lt(ApiLog::getCreateTime, createTime).orderByAsc(true, ApiLog::getId).last(" limit 1000"); | ||
49 | + return apiLogMapper.delete(apiLogLambdaQueryWrapper); | ||
50 | + } | ||
40 | } | 51 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/monitor/job/TableCleanTask.java
1 | package org.jeecg.modules.wms.monitor.job; | 1 | package org.jeecg.modules.wms.monitor.job; |
2 | 2 | ||
3 | -import java.lang.reflect.Field; | ||
4 | import java.lang.reflect.ParameterizedType; | 3 | import java.lang.reflect.ParameterizedType; |
5 | import java.time.LocalDateTime; | 4 | import java.time.LocalDateTime; |
6 | import java.time.temporal.ChronoUnit; | 5 | import java.time.temporal.ChronoUnit; |
7 | -import java.util.ArrayList; | ||
8 | import java.util.List; | 6 | import java.util.List; |
9 | 7 | ||
10 | import org.apache.ibatis.session.SqlSession; | 8 | import org.apache.ibatis.session.SqlSession; |
11 | import org.jeecg.common.util.DateUtils; | 9 | import org.jeecg.common.util.DateUtils; |
12 | -import org.jeecg.modules.system.mapper.SysLogMapper; | 10 | +import org.jeecg.modules.wms.monitor.apiLog.service.IApiLogService; |
13 | import org.jeecg.modules.wms.monitor.job.dto.TableCleanDto; | 11 | import org.jeecg.modules.wms.monitor.job.dto.TableCleanDto; |
14 | -import org.jeecg.modules.wms.monitor.operation.mapper.OperationLogMapper; | ||
15 | import org.jeecg.utils.LocalDateUtils; | 12 | import org.jeecg.utils.LocalDateUtils; |
16 | -import org.quartz.DisallowConcurrentExecution; | ||
17 | -import org.quartz.Job; | ||
18 | -import org.quartz.JobExecutionContext; | ||
19 | -import org.quartz.JobExecutionException; | ||
20 | -import org.quartz.PersistJobDataAfterExecution; | 13 | +import org.quartz.*; |
21 | import org.springframework.beans.factory.annotation.Autowired; | 14 | import org.springframework.beans.factory.annotation.Autowired; |
22 | 15 | ||
23 | import com.alibaba.fastjson.JSON; | 16 | import com.alibaba.fastjson.JSON; |
24 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 17 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
25 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 18 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
26 | -import com.google.common.base.CaseFormat; | ||
27 | 19 | ||
28 | import cn.hutool.core.util.StrUtil; | 20 | import cn.hutool.core.util.StrUtil; |
29 | -import dm.jdbc.util.ReflectUtil; | ||
30 | import lombok.extern.slf4j.Slf4j; | 21 | import lombok.extern.slf4j.Slf4j; |
31 | 22 | ||
32 | /** | 23 | /** |
@@ -44,56 +35,46 @@ public class TableCleanTask implements Job { | @@ -44,56 +35,46 @@ public class TableCleanTask implements Job { | ||
44 | @Autowired | 35 | @Autowired |
45 | private SqlSession sqlSession; | 36 | private SqlSession sqlSession; |
46 | 37 | ||
38 | + @Autowired | ||
39 | + private IApiLogService apiLogService; | ||
40 | + | ||
47 | public void setParameter(String parameter) { | 41 | public void setParameter(String parameter) { |
48 | this.parameter = parameter; | 42 | this.parameter = parameter; |
49 | } | 43 | } |
50 | 44 | ||
51 | @Override | 45 | @Override |
46 | + @SuppressWarnings({"rawtypes", "unchecked"}) | ||
52 | public void execute(JobExecutionContext context) throws JobExecutionException { | 47 | public void execute(JobExecutionContext context) throws JobExecutionException { |
53 | log.info(StrUtil.format("定时任务 TableCleanTask 参数:{},执行时间:{}", this.parameter, DateUtils.getTimestamp())); | 48 | log.info(StrUtil.format("定时任务 TableCleanTask 参数:{},执行时间:{}", this.parameter, DateUtils.getTimestamp())); |
54 | List<TableCleanDto> tableCleanList = JSON.parseArray(this.parameter, TableCleanDto.class); | 49 | List<TableCleanDto> tableCleanList = JSON.parseArray(this.parameter, TableCleanDto.class); |
55 | if (tableCleanList != null && tableCleanList.size() > 0) { | 50 | if (tableCleanList != null && tableCleanList.size() > 0) { |
56 | for (TableCleanDto tableCleanDto : tableCleanList) { | 51 | for (TableCleanDto tableCleanDto : tableCleanList) { |
57 | try { | 52 | try { |
58 | - Class mapperClass = Class.forName(tableCleanDto.getMapperName()); | ||
59 | - ParameterizedType parameterizedType = (ParameterizedType)mapperClass.getGenericInterfaces()[0]; | ||
60 | - String className = parameterizedType.getActualTypeArguments()[0].getTypeName(); | ||
61 | - String javaTimefieldName = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, tableCleanDto.getTimeFieldName()); | ||
62 | - Field timeField = ReflectUtil.getField(Class.forName(className), javaTimefieldName); | ||
63 | - if (timeField != null) { | ||
64 | - QueryWrapper<?> queryWrapper = new QueryWrapper<>(); | 53 | + if (tableCleanDto.getMapperName().equals("org.jeecg.modules.wms.monitor.apiLog.mapper.ApiLogMapper")) { |
65 | LocalDateTime localDateTimeValue = LocalDateUtils.minus(LocalDateTime.now(), tableCleanDto.getRetentionDays(), ChronoUnit.DAYS); | 54 | LocalDateTime localDateTimeValue = LocalDateUtils.minus(LocalDateTime.now(), tableCleanDto.getRetentionDays(), ChronoUnit.DAYS); |
66 | -// queryWrapper.apply("{0} < {1}", tableCleanDto.getTimeFieldName(), LocalDateUtils.getStartTimeOfDayStr(localDateTimeValue)); | ||
67 | - queryWrapper.lt(tableCleanDto.getTimeFieldName(), LocalDateUtils.getStartTimeOfDayStr(localDateTimeValue)); | ||
68 | - BaseMapper baseMapper = (BaseMapper)this.sqlSession.getMapper(mapperClass); | ||
69 | - Integer deleteCount = baseMapper.delete(queryWrapper); | ||
70 | - log.info("定时任务 TableCleanTask 删除 {} {} 天前数据 {} 行", className, tableCleanDto.getRetentionDays(), deleteCount); | 55 | + Boolean isContinue = true; |
56 | + while (isContinue) { | ||
57 | + Integer deleteCount = apiLogService.deleteByCreateTime(LocalDateUtils.getStartTimeOfDayStr(localDateTimeValue)); | ||
58 | + if (deleteCount.equals(0)) { | ||
59 | + isContinue = false; | ||
60 | + } | ||
61 | + Thread.sleep(1000); | ||
62 | + } | ||
63 | + continue; | ||
71 | } | 64 | } |
72 | - } catch (ClassNotFoundException e) { | 65 | + Class<?> mapperClass = Class.forName(tableCleanDto.getMapperName()); |
66 | + ParameterizedType parameterizedType = (ParameterizedType)mapperClass.getGenericInterfaces()[0]; | ||
67 | + String className = parameterizedType.getActualTypeArguments()[0].getTypeName(); | ||
68 | + QueryWrapper<?> queryWrapper = new QueryWrapper<>(); | ||
69 | + LocalDateTime localDateTimeValue = LocalDateUtils.minus(LocalDateTime.now(), tableCleanDto.getRetentionDays(), ChronoUnit.DAYS); | ||
70 | + queryWrapper.lt(tableCleanDto.getTimeFieldName(), LocalDateUtils.getStartTimeOfDayStr(localDateTimeValue)); | ||
71 | + BaseMapper baseMapper = (BaseMapper<Object>)this.sqlSession.getMapper(mapperClass); | ||
72 | + Integer deleteCount = baseMapper.delete(queryWrapper); | ||
73 | + log.info("定时任务 TableCleanTask 删除 {} {} 天前数据 {} 行", className, tableCleanDto.getRetentionDays(), deleteCount); | ||
74 | + } catch (ClassNotFoundException | InterruptedException e) { | ||
73 | e.printStackTrace(); | 75 | e.printStackTrace(); |
74 | } | 76 | } |
75 | } | 77 | } |
76 | } | 78 | } |
77 | } | 79 | } |
78 | - | ||
79 | - /** | ||
80 | - * 参数范例 | ||
81 | - * @author TanYibin | ||
82 | - * @createDate 2023年3月16日 | ||
83 | - * @param args | ||
84 | - */ | ||
85 | - public static void main(String[] args) { | ||
86 | - List<TableCleanDto> tableCleanList = new ArrayList<TableCleanDto>(); | ||
87 | - TableCleanDto tableCleanDto1 = new TableCleanDto(); | ||
88 | - tableCleanDto1.setMapperName(SysLogMapper.class.getName()); | ||
89 | - tableCleanDto1.setTimeFieldName("create_time"); | ||
90 | - tableCleanDto1.setRetentionDays(90); | ||
91 | - TableCleanDto tableCleanDto2 = new TableCleanDto(); | ||
92 | - tableCleanDto2.setMapperName(OperationLogMapper.class.getName()); | ||
93 | - tableCleanDto2.setTimeFieldName("operation_time"); | ||
94 | - tableCleanDto2.setRetentionDays(90); | ||
95 | - tableCleanList.add(tableCleanDto1); | ||
96 | - tableCleanList.add(tableCleanDto2); | ||
97 | - System.out.println(JSON.toJSONString(tableCleanList)); | ||
98 | - } | ||
99 | } | 80 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentHeaderServiceImpl.java
@@ -435,6 +435,9 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, | @@ -435,6 +435,9 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, | ||
435 | if (shipmentContainerHeader == null) { | 435 | if (shipmentContainerHeader == null) { |
436 | throw new JeecgBootException("自动出库, 没有找到出库表头:" + shipmentContainerId); | 436 | throw new JeecgBootException("自动出库, 没有找到出库表头:" + shipmentContainerId); |
437 | } | 437 | } |
438 | + if (shipmentContainerHeader.getStatus().intValue() == QuantityConstant.SHIPMENT_CONTAINER_FINISHED) { | ||
439 | + continue; | ||
440 | + } | ||
438 | int taskType = shipmentContainerHeader.getTaskType(); | 441 | int taskType = shipmentContainerHeader.getTaskType(); |
439 | int type = QuantityConstant.PORT_TYPE_PICK; | 442 | int type = QuantityConstant.PORT_TYPE_PICK; |
440 | if (taskType == QuantityConstant.TASK_TYPE_WHOLESHIPMENT) { | 443 | if (taskType == QuantityConstant.TASK_TYPE_WHOLESHIPMENT) { |