Commit 3c4e3dc5bb7199d9d199249e5d51fc091e2f4629
1 parent
a9c2c667
增加定时任务,超过限定移库限定次数 生成出库查看
Showing
10 changed files
with
148 additions
and
20 deletions
ant-design-vue-jeecg/src/views/system/config/ContainerList.vue
... | ... | @@ -254,6 +254,16 @@ export default { |
254 | 254 | scopedSlots: {customRender: 'fillStatus_dictText'} |
255 | 255 | }, |
256 | 256 | { |
257 | + title: '任务总数', | |
258 | + align: "center", | |
259 | + dataIndex: 'taskTimes', | |
260 | + }, | |
261 | + { | |
262 | + title: '移库任务数', | |
263 | + align: "center", | |
264 | + dataIndex: 'moveTaskTimes', | |
265 | + }, | |
266 | + { | |
257 | 267 | title: '库区', |
258 | 268 | align: "center", |
259 | 269 | dataIndex: 'zoneCode', |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/entity/Container.java
1 | 1 | package org.jeecg.modules.wms.config.container.entity; |
2 | 2 | |
3 | 3 | import java.io.Serializable; |
4 | -import java.io.UnsupportedEncodingException; | |
5 | 4 | import java.util.Date; |
6 | -import java.math.BigDecimal; | |
5 | + | |
6 | +import org.jeecg.common.aspect.annotation.Dict; | |
7 | +import org.jeecgframework.poi.excel.annotation.Excel; | |
8 | + | |
7 | 9 | import com.baomidou.mybatisplus.annotation.IdType; |
8 | -import com.baomidou.mybatisplus.annotation.TableField; | |
9 | 10 | import com.baomidou.mybatisplus.annotation.TableId; |
10 | 11 | import com.baomidou.mybatisplus.annotation.TableName; |
11 | -import lombok.Data; | |
12 | -import com.fasterxml.jackson.annotation.JsonFormat; | |
13 | -import org.springframework.format.annotation.DateTimeFormat; | |
14 | -import org.jeecgframework.poi.excel.annotation.Excel; | |
15 | -import org.jeecg.common.aspect.annotation.Dict; | |
12 | + | |
16 | 13 | import io.swagger.annotations.ApiModel; |
17 | 14 | import io.swagger.annotations.ApiModelProperty; |
15 | +import lombok.Data; | |
18 | 16 | import lombok.EqualsAndHashCode; |
19 | 17 | import lombok.experimental.Accessors; |
20 | 18 | |
... | ... | @@ -69,16 +67,17 @@ public class Container implements Serializable { |
69 | 67 | @Dict(dicCode = "fill_status") |
70 | 68 | @ApiModelProperty(value = "填充状态") |
71 | 69 | private String fillStatus; |
70 | + @ApiModelProperty(value = "任务总数") | |
71 | + private Integer taskTimes; | |
72 | + @ApiModelProperty(value = "移库任务数") | |
73 | + private Integer moveTaskTimes; | |
72 | 74 | /** 备用字段1 */ |
73 | - @Excel(name = "备用字段1", width = 15) | |
74 | 75 | @ApiModelProperty(value = "备用字段1") |
75 | 76 | private String userdef1; |
76 | 77 | /** 备用字段2 */ |
77 | - @Excel(name = "备用字段2", width = 15) | |
78 | 78 | @ApiModelProperty(value = "备用字段2") |
79 | 79 | private String userdef2; |
80 | 80 | /** 备用字段3 */ |
81 | - @Excel(name = "备用字段3", width = 15) | |
82 | 81 | @ApiModelProperty(value = "备用字段3") |
83 | 82 | private String userdef3; |
84 | 83 | /** 创建人 */ |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/impl/ContainerServiceImpl.java
... | ... | @@ -77,6 +77,9 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container |
77 | 77 | |
78 | 78 | @Override |
79 | 79 | public Container getContainerByCode(String containCode, String warehouseCode) { |
80 | + if (StringUtils.isEmpty(containCode)) { | |
81 | + throw new JeecgBootException("容器编码为空"); | |
82 | + } | |
80 | 83 | if (StringUtils.havaLowerCase(containCode)) { |
81 | 84 | throw new JeecgBootException("容器不能有小字母" + containCode); |
82 | 85 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/material/entity/Material.java
1 | 1 | package org.jeecg.modules.wms.config.material.entity; |
2 | 2 | |
3 | 3 | import java.io.Serializable; |
4 | -import java.io.UnsupportedEncodingException; | |
5 | -import java.util.Date; | |
6 | 4 | import java.math.BigDecimal; |
5 | +import java.util.Date; | |
6 | + | |
7 | +import org.jeecg.common.aspect.annotation.Dict; | |
8 | +import org.jeecgframework.poi.excel.annotation.Excel; | |
9 | + | |
7 | 10 | import com.baomidou.mybatisplus.annotation.IdType; |
8 | 11 | import com.baomidou.mybatisplus.annotation.TableId; |
9 | 12 | import com.baomidou.mybatisplus.annotation.TableName; |
10 | -import lombok.Data; | |
11 | -import com.fasterxml.jackson.annotation.JsonFormat; | |
12 | -import org.springframework.format.annotation.DateTimeFormat; | |
13 | -import org.jeecgframework.poi.excel.annotation.Excel; | |
14 | -import org.jeecg.common.aspect.annotation.Dict; | |
13 | + | |
15 | 14 | import io.swagger.annotations.ApiModel; |
16 | 15 | import io.swagger.annotations.ApiModelProperty; |
16 | +import lombok.Data; | |
17 | 17 | import lombok.EqualsAndHashCode; |
18 | 18 | import lombok.experimental.Accessors; |
19 | 19 | |
... | ... | @@ -63,6 +63,14 @@ public class Material implements Serializable { |
63 | 63 | @Excel(name = "类别", width = 15) |
64 | 64 | @ApiModelProperty(value = "类别") |
65 | 65 | private String type; |
66 | + /** 入库数 */ | |
67 | + @Excel(name = "入库数", width = 15) | |
68 | + @ApiModelProperty(value = "入库数") | |
69 | + private BigDecimal receiptQty; | |
70 | + /** 任务数 */ | |
71 | + @Excel(name = "任务数", width = 15) | |
72 | + @ApiModelProperty(value = "任务数") | |
73 | + private BigDecimal taskQty; | |
66 | 74 | /** ABC分类 */ |
67 | 75 | @Excel(name = "ABC分类", width = 15) |
68 | 76 | @ApiModelProperty(value = "ABC分类") |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/monitor/job/AutoCheckoutTask.java
0 → 100644
1 | +package org.jeecg.modules.wms.monitor.job; | |
2 | + | |
3 | +import java.util.List; | |
4 | + | |
5 | +import javax.annotation.Resource; | |
6 | + | |
7 | +import org.jeecg.common.util.DateUtils; | |
8 | +import org.jeecg.modules.wms.config.container.entity.Container; | |
9 | +import org.jeecg.modules.wms.config.container.service.IContainerService; | |
10 | +import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService; | |
11 | +import org.jeecg.modules.wms.framework.service.IHuahengMultiHandlerService; | |
12 | +import org.jeecg.modules.wms.monitor.job.dto.AutoCheckOutDto; | |
13 | +import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; | |
14 | +import org.jeecg.utils.StringUtils; | |
15 | +import org.jeecg.utils.constant.QuantityConstant; | |
16 | +import org.quartz.*; | |
17 | + | |
18 | +import com.alibaba.fastjson.JSON; | |
19 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
20 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
21 | + | |
22 | +import lombok.extern.slf4j.Slf4j; | |
23 | + | |
24 | +/** | |
25 | + * 定时任务 | |
26 | + * @author 游杰 | |
27 | + */ | |
28 | + | |
29 | +@Slf4j | |
30 | +@PersistJobDataAfterExecution | |
31 | +@DisallowConcurrentExecution | |
32 | +public class AutoCheckoutTask implements Job { | |
33 | + | |
34 | + @Resource | |
35 | + private ITaskHeaderService taskHeaderService; | |
36 | + | |
37 | + @Resource | |
38 | + private IHuahengMultiHandlerService huahengMultiHandlerService; | |
39 | + | |
40 | + @Resource | |
41 | + private IContainerService containerService; | |
42 | + @Resource | |
43 | + private IParameterConfigurationService parameterConfigurationService; | |
44 | + | |
45 | + private String parameter; | |
46 | + | |
47 | + public void setParameter(String parameter) { | |
48 | + this.parameter = parameter; | |
49 | + } | |
50 | + | |
51 | + @Override | |
52 | + public void execute(JobExecutionContext context) throws JobExecutionException { | |
53 | + | |
54 | + log.info(String.format(" AutoCheckoutTask 执行任务! 时间:" + DateUtils.getTimestamp())); | |
55 | + List<AutoCheckOutDto> autoCheckOutDtoList = JSON.parseArray(this.parameter, AutoCheckOutDto.class); | |
56 | + String value = parameterConfigurationService.getValueByCode(QuantityConstant.CONTAINER_MOVE_QTY); | |
57 | + int containerMoveQty = 5; | |
58 | + if (StringUtils.isNotEmpty(value)) { | |
59 | + containerMoveQty = Integer.parseInt(value); | |
60 | + } | |
61 | + LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
62 | + containerLambdaQueryWrapper.ge(Container::getMoveTaskTimes, containerMoveQty); | |
63 | + List<Container> containerList = containerService.list(containerLambdaQueryWrapper); | |
64 | + for (Container container : containerList) { | |
65 | + String zoneCode = container.getZoneCode(); | |
66 | + String warehouseCode = container.getWarehouseCode(); | |
67 | + String toPort = null; | |
68 | + if (StringUtils.isEmpty(zoneCode)) { | |
69 | + toPort = autoCheckOutDtoList.get(0).getToPort(); | |
70 | + } else { | |
71 | + for (AutoCheckOutDto autoCheckOutDto : autoCheckOutDtoList) { | |
72 | + if (zoneCode.equals(autoCheckOutDto.getZoneCode())) { | |
73 | + toPort = autoCheckOutDto.getToPort(); | |
74 | + } | |
75 | + } | |
76 | + } | |
77 | + taskHeaderService.createCheckOutTask(container.getCode(), toPort, warehouseCode); | |
78 | + } | |
79 | + } | |
80 | +} | |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/monitor/job/dto/AutoCheckOutDto.java
0 → 100644
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/service/impl/ShipmentContainerHeaderServiceImpl.java
... | ... | @@ -217,7 +217,7 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont |
217 | 217 | } |
218 | 218 | int status = shipmentContainerHeader.getStatus(); |
219 | 219 | if (status >= QuantityConstant.SHIPMENT_CONTAINER_TASK) { |
220 | - return Result.error("取消出库配盘失败,已经生成出库任务"); | |
220 | + return Result.error("取消出库配盘失败,出库配盘状态是生成出库任务"); | |
221 | 221 | } |
222 | 222 | List<ShipmentContainerDetail> shipmentContainerDetailList = shipmentContainerDetailService.getShipmentContainerDetailListByHeaderId(id); |
223 | 223 | for (ShipmentContainerDetail shipmentContainerDetail : shipmentContainerDetailList) { |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
... | ... | @@ -62,6 +62,7 @@ import org.jeecg.modules.wms.task.taskHeader.mapper.TaskHeaderMapper; |
62 | 62 | import org.jeecg.modules.wms.task.taskHeader.service.ITaskDetailService; |
63 | 63 | import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; |
64 | 64 | import org.jeecg.modules.wms.task.taskHeaderHistory.service.ITaskHeaderHistoryService; |
65 | +import org.jeecg.utils.HuahengJwtUtil; | |
65 | 66 | import org.jeecg.utils.StringUtils; |
66 | 67 | import org.jeecg.utils.constant.QuantityConstant; |
67 | 68 | import org.springframework.beans.factory.annotation.Autowired; |
... | ... | @@ -69,6 +70,7 @@ import org.springframework.stereotype.Service; |
69 | 70 | import org.springframework.transaction.annotation.Transactional; |
70 | 71 | |
71 | 72 | import com.alibaba.fastjson.JSON; |
73 | +import com.aliyun.oss.ServiceException; | |
72 | 74 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
73 | 75 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
74 | 76 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
... | ... | @@ -1804,6 +1806,17 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1804 | 1806 | if (!success) { |
1805 | 1807 | throw new JeecgBootException("任务类型" + taskType + "完成任务时,更新库存信息失败"); |
1806 | 1808 | } |
1809 | + LambdaUpdateWrapper<Container> lambdaUpdateWrapper = Wrappers.lambdaUpdate(); | |
1810 | + lambdaUpdateWrapper.eq(Container::getCode, containerCode); | |
1811 | + HuahengJwtUtil.calculateQuantity(lambdaUpdateWrapper, "task_times", BigDecimal.ONE); | |
1812 | + if (taskType == QuantityConstant.TASK_TYPE_TRANSFER) { | |
1813 | + HuahengJwtUtil.calculateQuantity(lambdaUpdateWrapper, "move_task_times", BigDecimal.ONE); | |
1814 | + } else { | |
1815 | + lambdaUpdateWrapper.setSql(true, "move_task_times = 0"); | |
1816 | + } | |
1817 | + if (!containerService.update(lambdaUpdateWrapper)) { | |
1818 | + throw new ServiceException("任务类型" + taskType + "更新容器失败"); | |
1819 | + } | |
1807 | 1820 | return Result.OK("任务类型" + taskType + "完成任务成功"); |
1808 | 1821 | } |
1809 | 1822 | |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/utils/HuahengJwtUtil.java
... | ... | @@ -302,7 +302,11 @@ public class HuahengJwtUtil { |
302 | 302 | |
303 | 303 | public static <T> void calculateQuantity(LambdaUpdateWrapper<T> lambdaUpdateWrapper, T t, String fieldName, BigDecimal quantity, Boolean geZero) { |
304 | 304 | String sqlFieldName = StrUtil.toUnderlineCase(fieldName); |
305 | - lambdaUpdateWrapper.setSql(quantity != null, sqlFieldName + " = " + sqlFieldName + " + " + quantity); | |
305 | + if (quantity.compareTo(BigDecimal.ZERO) < 0) { | |
306 | + lambdaUpdateWrapper.setSql(quantity != null, sqlFieldName + " = " + sqlFieldName + quantity); | |
307 | + } else { | |
308 | + lambdaUpdateWrapper.setSql(quantity != null, sqlFieldName + " = " + sqlFieldName + " + " + quantity); | |
309 | + } | |
306 | 310 | if (t != null) { |
307 | 311 | // Object fieldValue = ReflectUtil.getFieldValue(t, fieldName); |
308 | 312 | // lambdaUpdateWrapper.apply(fieldValue != null, sqlFieldName + " = {0}", fieldValue); |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/utils/constant/QuantityConstant.java
... | ... | @@ -485,6 +485,7 @@ public class QuantityConstant { |
485 | 485 | public static final String DOUBLE_FORK_RESERVE_LOCATION = "doubleForkReserveLocation"; |
486 | 486 | public static final String DOUBLE_FORK_SEARCH_LOCATION = "doubleForkSearchLocation"; |
487 | 487 | public static final String MAX_ROADWAY_RECEIPT = "maxRoadWayReceipt"; |
488 | + public static final String CONTAINER_MOVE_QTY = "containerMoveQty"; | |
488 | 489 | public static final String WAREHOUSING_WEIGHING = "warehousingWeighing"; |
489 | 490 | public static final String EXCEPTION_TO_CACHE = "exceptionToCache"; |
490 | 491 | public static final String CONTAINER_SPEC = "containerSpec"; |
... | ... |