Commit fa8c6bd467126bf8024fe5f9ce51eff426275776
1 parent
b3cdd002
开发标准版本的AGV库 出入库功能
Showing
17 changed files
with
247 additions
and
51 deletions
ant-design-vue-jeecg/src/api/api.js
... | ... | @@ -135,7 +135,7 @@ export const createReceiptBatchTask = (params) => postAction('/receipt/receiptCo |
135 | 135 | export const completeTaskByWMS = (params) => postAction('/task/taskHeader/completeTaskByWMS', params); |
136 | 136 | //下发任务给WCS |
137 | 137 | export const execute = (params) => postAction('/task/taskHeader/execute', params); |
138 | -//取消任务 | |
138 | +//取消任务/////////// | |
139 | 139 | export const cancelTask = (params) => postAction('/task/taskHeader/cancelTask?ids=' + params, params); |
140 | 140 | |
141 | 141 | //盘点任务创建 |
... | ... |
ant-design-vue-jeecg/src/views/system/shipment/modules/ShipmentHeaderModal.vue
... | ... | @@ -117,6 +117,9 @@ export default { |
117 | 117 | type: [ |
118 | 118 | {required: true, message: '请选择出库单类型!'}, |
119 | 119 | ], |
120 | + zoneCode: [ | |
121 | + {required: true, message: '请选择库区!'}, | |
122 | + ], | |
120 | 123 | }, |
121 | 124 | url: { |
122 | 125 | add: "/shipment/shipmentHeader/add", |
... | ... | @@ -132,7 +135,8 @@ export default { |
132 | 135 | }, |
133 | 136 | methods: { |
134 | 137 | add() { |
135 | - this.edit(this.modelDefault); | |
138 | + let record={type:'YCLC',zoneCode: 'L'} | |
139 | + this.edit(record); | |
136 | 140 | this.model.companyCode = this.companyList[0].code; |
137 | 141 | }, |
138 | 142 | edit(record) { |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/acs/service/impl/AcsServiceImpl.java
... | ... | @@ -270,8 +270,8 @@ public class AcsServiceImpl implements IAcsService { |
270 | 270 | |
271 | 271 | Location location = locationService.getLocationByCode(locationCode, warehouseCode); |
272 | 272 | |
273 | - int agvTaskId = taskHeader.getId(); | |
274 | - if (agvTaskId != 0) { | |
273 | + int agvTaskId = taskHeader.getAgvTaskId(); | |
274 | + if (agvTaskId == 0) { | |
275 | 275 | AgvTask agvTask = new AgvTask(); |
276 | 276 | agvTask.setWarehouseCode(warehouseCode); |
277 | 277 | agvTask.setZoneCode(zoneCode); |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/agvcall/controller/AgvCallController.java deleted
1 | -package org.jeecg.modules.wms.api.agvcall.controller; | |
2 | - | |
3 | -import javax.annotation.Resource; | |
4 | - | |
5 | -import org.jeecg.modules.wms.framework.controller.HuahengBaseController; | |
6 | -import org.jeecg.modules.wms.receipt.receiving.service.IReceiveService; | |
7 | -import org.springframework.web.bind.annotation.RequestMapping; | |
8 | -import org.springframework.web.bind.annotation.RestController; | |
9 | - | |
10 | -import io.swagger.annotations.Api; | |
11 | - | |
12 | -/** | |
13 | - * @author 游杰 | |
14 | - */ | |
15 | -@RestController | |
16 | -@RequestMapping("/api/agvcall") | |
17 | -@Api(tags = "AGV接口") | |
18 | -public class AgvCallController extends HuahengBaseController { | |
19 | - | |
20 | - @Resource | |
21 | - private IReceiveService receiveService; | |
22 | - | |
23 | -} |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/LocationAllocationServiceImpl.java
... | ... | @@ -136,7 +136,6 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
136 | 136 | if (roadWays == null || roadWays.size() == 0) { |
137 | 137 | throw new JeecgBootException("分配库位时, 可用巷道为空"); |
138 | 138 | } |
139 | -// Collections.shuffle(roadWays); | |
140 | 139 | Integer roadWay = locationAllocationService.getRoadWay(roadWays, materialCode, zoneCode, warehouseCode); |
141 | 140 | // 优先找外侧库位 |
142 | 141 | LambdaQueryWrapper<Location> locationLambda = Wrappers.lambdaQuery(); |
... | ... | @@ -216,7 +215,6 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
216 | 215 | if (roadWays == null || roadWays.size() == 0) { |
217 | 216 | throw new JeecgBootException("分配库位时, 可用巷道为空"); |
218 | 217 | } |
219 | -// Collections.shuffle(roadWays); | |
220 | 218 | Integer roadWay = locationAllocationService.getRoadWay(roadWays, materialCode, zoneCode, warehouseCode); |
221 | 219 | LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); |
222 | 220 | locationLambdaQueryWrapper.eq(Location::getZoneCode, zoneCode).eq(Location::getWarehouseCode, warehouseCode).eq(Location::getRoadWay, roadWay) |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/monitor/job/AutoCheckoutTask.java
... | ... | @@ -50,7 +50,6 @@ public class AutoCheckoutTask implements Job { |
50 | 50 | |
51 | 51 | @Override |
52 | 52 | public void execute(JobExecutionContext context) throws JobExecutionException { |
53 | - | |
54 | 53 | log.info(String.format(" AutoCheckoutTask 执行任务! 时间:" + DateUtils.getTimestamp())); |
55 | 54 | List<AutoCheckOutDto> autoCheckOutDtoList = JSON.parseArray(this.parameter, AutoCheckOutDto.class); |
56 | 55 | String value = parameterConfigurationService.getValueByCode(QuantityConstant.CONTAINER_MOVE_QTY); |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/monitor/job/AutoCreateAgvTask.java
0 → 100644
1 | +package org.jeecg.modules.wms.monitor.job; | |
2 | + | |
3 | +import java.util.Date; | |
4 | +import java.util.List; | |
5 | + | |
6 | +import javax.annotation.Resource; | |
7 | + | |
8 | +import org.jeecg.common.api.vo.Result; | |
9 | +import org.jeecg.common.exception.JeecgBootException; | |
10 | +import org.jeecg.common.util.DateUtils; | |
11 | +import org.jeecg.modules.wms.task.agvTask.entity.AgvTask; | |
12 | +import org.jeecg.modules.wms.task.agvTask.service.IAgvTaskService; | |
13 | +import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; | |
14 | +import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; | |
15 | +import org.jeecg.utils.constant.QuantityConstant; | |
16 | +import org.quartz.*; | |
17 | + | |
18 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
19 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
20 | + | |
21 | +import cn.hutool.core.date.DateUtil; | |
22 | +import lombok.extern.slf4j.Slf4j; | |
23 | + | |
24 | +/** | |
25 | + * @author 游杰 | |
26 | + */ | |
27 | +@Slf4j | |
28 | +@PersistJobDataAfterExecution | |
29 | +@DisallowConcurrentExecution | |
30 | +public class AutoCreateAgvTask implements Job { | |
31 | + | |
32 | + @Resource | |
33 | + private ITaskHeaderService taskHeaderService; | |
34 | + @Resource | |
35 | + private IAgvTaskService agvTaskService; | |
36 | + | |
37 | + @Override | |
38 | + public void execute(JobExecutionContext context) throws JobExecutionException { | |
39 | + log.info(String.format("AutoSendAgvTask 下发AGV任务开始执行,时间:" + DateUtils.getTimestamp())); | |
40 | + LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
41 | + taskHeaderLambdaQueryWrapper.eq(TaskHeader::getSendAgv, QuantityConstant.AGV_NEED_SEND).le(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_RELEASE) | |
42 | + .eq(TaskHeader::getTaskType, QuantityConstant.TASK_TYPE_WHOLESHIPMENT).ge(TaskHeader::getCreateTime, DateUtil.offsetDay(new Date(), -180)) | |
43 | + .orderByAsc(TaskHeader::getCreateTime); | |
44 | + List<TaskHeader> taskHeaderList = taskHeaderService.list(taskHeaderLambdaQueryWrapper); | |
45 | + for (TaskHeader taskHeader : taskHeaderList) { | |
46 | + String containerCode = taskHeader.getContainerCode(); | |
47 | + String warehouseCode = taskHeader.getWarehouseCode(); | |
48 | + String zoneCode = taskHeader.getZoneCode(); | |
49 | + String fromPortCode = taskHeader.getFromLocationCode(); | |
50 | + String toPortCode = taskHeader.getToPortCode(); | |
51 | + AgvTask agvTask = new AgvTask(); | |
52 | + agvTask.setWarehouseCode(warehouseCode); | |
53 | + agvTask.setZoneCode(zoneCode); | |
54 | + agvTask.setTaskType(QuantityConstant.AGV_TYPE_TAKE_AND_RELEASE); | |
55 | + agvTask.setStatus(QuantityConstant.AGV_TASK_STATUS_BUILD); | |
56 | + agvTask.setContainerCode(containerCode); | |
57 | + agvTask.setFromPort(fromPortCode); | |
58 | + agvTask.setToPort(toPortCode); | |
59 | + agvTask.setPriority(10); | |
60 | + Result result = agvTaskService.addAgvTask(agvTask, warehouseCode); | |
61 | + if (result.isSuccess()) { | |
62 | + int taskHeaderId = taskHeader.getId(); | |
63 | + taskHeader = new TaskHeader(); | |
64 | + taskHeader.setId(taskHeaderId); | |
65 | + taskHeader.setAgvTaskId(agvTask.getId()); | |
66 | + taskHeader.setSendAgv(QuantityConstant.AGV_SEND_OK); | |
67 | + if (!taskHeaderService.updateById(taskHeader)) { | |
68 | + throw new JeecgBootException("更新下发任务状态失败"); | |
69 | + } | |
70 | + } | |
71 | + } | |
72 | + } | |
73 | +} | |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/monitor/job/AutoSendAgvTask.java
0 → 100644
1 | +package org.jeecg.modules.wms.monitor.job; | |
2 | + | |
3 | +import java.util.Date; | |
4 | +import java.util.List; | |
5 | + | |
6 | +import javax.annotation.Resource; | |
7 | + | |
8 | +import org.jeecg.common.util.DateUtils; | |
9 | +import org.jeecg.modules.wms.task.agvTask.entity.AgvTask; | |
10 | +import org.jeecg.modules.wms.task.agvTask.service.IAgvTaskService; | |
11 | +import org.jeecg.utils.constant.QuantityConstant; | |
12 | +import org.quartz.*; | |
13 | + | |
14 | +import com.alibaba.fastjson.JSON; | |
15 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
16 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
17 | + | |
18 | +import cn.hutool.core.date.DateUtil; | |
19 | +import lombok.extern.slf4j.Slf4j; | |
20 | + | |
21 | +/** | |
22 | + * @author 游杰 | |
23 | + */ | |
24 | +@Slf4j | |
25 | +@PersistJobDataAfterExecution | |
26 | +@DisallowConcurrentExecution | |
27 | +public class AutoSendAgvTask implements Job { | |
28 | + | |
29 | + @Resource | |
30 | + private IAgvTaskService agvTaskService; | |
31 | + | |
32 | + @Override | |
33 | + public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { | |
34 | + log.info(String.format("AutoSendAgvTask 下发AGV任务开始执行,时间:" + DateUtils.getTimestamp())); | |
35 | + LambdaQueryWrapper<AgvTask> agvTaskLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
36 | + agvTaskLambdaQueryWrapper.isNotNull(AgvTask::getToPort).eq(AgvTask::getStatus, QuantityConstant.TASK_STATUS_BUILD) | |
37 | + .ge(AgvTask::getCreateTime, DateUtil.offsetDay(new Date(), -180)).orderByAsc(AgvTask::getCreateTime); | |
38 | + List<AgvTask> agvTaskList = agvTaskService.list(agvTaskLambdaQueryWrapper); | |
39 | + for (AgvTask agvTask : agvTaskList) { | |
40 | + try { | |
41 | + agvTaskService.sendAgvTaskToAcs(agvTask.getId()); | |
42 | + } catch (Exception e) { | |
43 | + log.error("下发AGV任务执行异常,agvTask:{}", JSON.toJSONString(agvTask), e); | |
44 | + } | |
45 | + } | |
46 | + } | |
47 | +} | |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/monitor/job/WcsTask.java renamed to huaheng-wms-core/src/main/java/org/jeecg/modules/wms/monitor/job/AutoSendWcsTask.java
... | ... | @@ -14,11 +14,7 @@ import org.jeecg.modules.wms.framework.service.IHuahengMultiHandlerService; |
14 | 14 | import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; |
15 | 15 | import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; |
16 | 16 | import org.jeecg.utils.constant.QuantityConstant; |
17 | -import org.quartz.DisallowConcurrentExecution; | |
18 | -import org.quartz.Job; | |
19 | -import org.quartz.JobExecutionContext; | |
20 | -import org.quartz.JobExecutionException; | |
21 | -import org.quartz.PersistJobDataAfterExecution; | |
17 | +import org.quartz.*; | |
22 | 18 | import org.springframework.util.CollectionUtils; |
23 | 19 | import org.springframework.util.StringUtils; |
24 | 20 | |
... | ... | @@ -32,11 +28,10 @@ import lombok.extern.slf4j.Slf4j; |
32 | 28 | * 定时任务 |
33 | 29 | * @author 游杰 |
34 | 30 | */ |
35 | - | |
36 | 31 | @Slf4j |
37 | 32 | @PersistJobDataAfterExecution |
38 | 33 | @DisallowConcurrentExecution |
39 | -public class WcsTask implements Job { | |
34 | +public class AutoSendWcsTask implements Job { | |
40 | 35 | |
41 | 36 | @Resource |
42 | 37 | private ITaskHeaderService taskHeaderService; |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/controller/ShipmentCombinationController.java
... | ... | @@ -238,4 +238,17 @@ public class ShipmentCombinationController { |
238 | 238 | String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); |
239 | 239 | return shipmentCombinationService.flatShipmentByLocationCode(locationCode, flatShipmentList, warehouseCode); |
240 | 240 | } |
241 | + | |
242 | + /** | |
243 | + * 创建出库任务,AGV去接 | |
244 | + * @return | |
245 | + */ | |
246 | + @ApiOperation(value = "创建出库任务,AGV去接", notes = "创建出库任务,AGV去接") | |
247 | + @PostMapping("/createShipmentTaskByAgv") | |
248 | + @ResponseBody | |
249 | + public Result createShipmentTaskByAgv(@RequestBody ShipmentContainerHeader shipmentContainerHeader, HttpServletRequest req) { | |
250 | + String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); | |
251 | + Result result = shipmentCombinationService.createShipmentTask(shipmentContainerHeader, QuantityConstant.TASK_TYPE_WHOLESHIPMENT, warehouseCode, 0, 0, 0); | |
252 | + return result; | |
253 | + } | |
241 | 254 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/IShipmentCombinationService.java
... | ... | @@ -26,6 +26,11 @@ public interface IShipmentCombinationService { |
26 | 26 | |
27 | 27 | Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, String warehouseCode, long shipmentOrder, int sequence, int sequenceNumber); |
28 | 28 | |
29 | + Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, int forceTaskType, String warehouseCode); | |
30 | + | |
31 | + Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, int forceTaskType, String warehouseCode, long shipmentOrder, int sequence, | |
32 | + int sequenceNumber); | |
33 | + | |
29 | 34 | Result getInventoryFromShipmentDetail(Integer shipmentDetailId); |
30 | 35 | |
31 | 36 | Result combination(CombinationModel combinationModel); |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java
... | ... | @@ -249,6 +249,16 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi |
249 | 249 | } |
250 | 250 | |
251 | 251 | @Override |
252 | + public Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, String warehouseCode, long shipmentOrder, int sequence, int sequenceNumber) { | |
253 | + return createShipmentTask(shipmentContainerHeader, 0, warehouseCode, shipmentOrder, sequence, sequenceNumber); | |
254 | + } | |
255 | + | |
256 | + @Override | |
257 | + public Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, int forceTaskType, String warehouseCode) { | |
258 | + return createShipmentTask(shipmentContainerHeader, forceTaskType, warehouseCode, 0, 0, 0); | |
259 | + } | |
260 | + | |
261 | + @Override | |
252 | 262 | @Transactional(rollbackFor = JeecgBootException.class) |
253 | 263 | public Result autoCombinationDetail(ShipmentDetail shipmentDetail, BigDecimal shipQty) { |
254 | 264 | // 出库数量 |
... | ... | @@ -611,7 +621,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi |
611 | 621 | } |
612 | 622 | inventoryList.removeAll(removeInventoryList); |
613 | 623 | if (inventoryList.size() < 1) { |
614 | - throw new JeecgBootException(shipmentDetail.getMaterialName() + "没有符合出库条件的库存"); | |
624 | + throw new JeecgBootException(shipmentDetail.getMaterialName() + "没有符合出库条件的库存!!"); | |
615 | 625 | } |
616 | 626 | |
617 | 627 | for (InventoryDetail inventoryDetail : inventoryList) { |
... | ... | @@ -797,9 +807,11 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi |
797 | 807 | @OperationLog(bizId = "''", bizType = "'任务追踪'", tag = "'出库任务生成'", extra = "#extraJsonString2", |
798 | 808 | msg = "'任务类型:' + #taskHeader.getTaskType() + ',起始库位:' + #taskHeader.getFromLocationCode() + ',目标库位:' + #taskHeader.getToLocationCode() + ',容器编码:' + #taskHeader.getContainerCode()", |
799 | 809 | condition = "#taskDetailList.size() > 0", recordReturnValue = true) |
800 | - public Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, String warehouseCode, long shipmentOrder, int sequence, int sequenceNumber) { | |
810 | + public Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, int forceTaskType, String warehouseCode, long shipmentOrder, int sequence, | |
811 | + int sequenceNumber) { | |
801 | 812 | Integer preTaskNo = 0; |
802 | 813 | boolean success = false; |
814 | + shipmentContainerHeader = shipmentContainerHeaderService.getById(shipmentContainerHeader.getId()); | |
803 | 815 | if (shipmentContainerHeader == null) { |
804 | 816 | return Result.error("生成出库任务时, 出库组盘头" + "未找到,操作中止"); |
805 | 817 | } |
... | ... | @@ -864,6 +876,9 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi |
864 | 876 | if (shipmentTaskRule == QuantityConstant.RULE_TASK_PICK_SHIPMENT) { |
865 | 877 | taskType = QuantityConstant.TASK_TYPE_SORTINGSHIPMENT; |
866 | 878 | } |
879 | + if (forceTaskType != 0) { | |
880 | + taskType = forceTaskType; | |
881 | + } | |
867 | 882 | int taskHeaderId = 0; |
868 | 883 | TaskHeader taskHeader = taskHeaderService.getUnCompleteTaskByContainerCode(containerCode, warehouseCode); |
869 | 884 | if (taskHeader == null) { |
... | ... | @@ -880,6 +895,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi |
880 | 895 | taskHeader.setInnernalTaskType(QuantityConstant.TASK_INTENERTYPE_SHIPMENT); |
881 | 896 | taskHeader.setZoneCode(zoneCode); |
882 | 897 | taskHeader.setShipmentOrder(shipmentOrder); |
898 | + taskHeader.setToAgvPort(shipmentContainerHeader.getToAgvPort()); | |
883 | 899 | taskHeader.setSequence(sequence); |
884 | 900 | taskHeader.setSequenceNumber(sequenceNumber); |
885 | 901 | taskHeader.setWarehouseCode(warehouseCode); |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/entity/ShipmentContainerHeader.java
1 | 1 | package org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity; |
2 | 2 | |
3 | 3 | import java.io.Serializable; |
4 | -import java.io.UnsupportedEncodingException; | |
5 | 4 | import java.util.Date; |
5 | + | |
6 | +import org.jeecg.common.aspect.annotation.Dict; | |
7 | +import org.jeecgframework.poi.excel.annotation.Excel; | |
8 | + | |
6 | 9 | import com.baomidou.mybatisplus.annotation.IdType; |
10 | +import com.baomidou.mybatisplus.annotation.TableField; | |
7 | 11 | import com.baomidou.mybatisplus.annotation.TableId; |
8 | 12 | import com.baomidou.mybatisplus.annotation.TableName; |
9 | -import org.jeecgframework.poi.excel.annotation.Excel; | |
10 | -import lombok.Data; | |
11 | -import com.fasterxml.jackson.annotation.JsonFormat; | |
12 | -import org.springframework.format.annotation.DateTimeFormat; | |
13 | -import org.jeecg.common.aspect.annotation.Dict; | |
13 | + | |
14 | 14 | import io.swagger.annotations.ApiModel; |
15 | 15 | import io.swagger.annotations.ApiModelProperty; |
16 | +import lombok.Data; | |
16 | 17 | |
17 | 18 | /** |
18 | 19 | * @Description: 出库组盘 |
... | ... | @@ -92,4 +93,8 @@ public class ShipmentContainerHeader implements Serializable { |
92 | 93 | /** 更新日期 */ |
93 | 94 | @ApiModelProperty(value = "更新日期") |
94 | 95 | private Date updateTime; |
96 | + | |
97 | + @TableField(exist = false) | |
98 | + @ApiModelProperty(value = "去向AGV位置") | |
99 | + private String toAgvPort; | |
95 | 100 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/entity/TaskHeader.java
... | ... | @@ -118,6 +118,8 @@ public class TaskHeader implements Serializable { |
118 | 118 | @Excel(name = "目标出入口", width = 15) |
119 | 119 | @ApiModelProperty(value = "目标出入口") |
120 | 120 | private String toPortCode; |
121 | + @ApiModelProperty(value = "去向AGV位置") | |
122 | + private String toAgvPort; | |
121 | 123 | @ApiModelProperty(value = "AGV关联任务ID") |
122 | 124 | private Integer agvTaskId; |
123 | 125 | @ApiModelProperty(value = "生成agv任务") |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskHeaderService.java
... | ... | @@ -6,6 +6,7 @@ import java.util.List; |
6 | 6 | |
7 | 7 | import org.jeecg.common.api.vo.Result; |
8 | 8 | import org.jeecg.modules.wms.config.location.entity.Location; |
9 | +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; | |
9 | 10 | import org.jeecg.modules.wms.task.taskHeader.entity.QucikReceiptEntity; |
10 | 11 | import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; |
11 | 12 | |
... | ... | @@ -240,6 +241,13 @@ public interface ITaskHeaderService extends IService<TaskHeader> { |
240 | 241 | Result completeShipmentTask(TaskHeader taskHeader); |
241 | 242 | |
242 | 243 | /** |
244 | + * 完成整出出库,清空库存 | |
245 | + * @param inventoryDetailList | |
246 | + * @return | |
247 | + */ | |
248 | + Result completeWholeShipmentTaskClearInventory(List<InventoryDetail> inventoryDetailList); | |
249 | + | |
250 | + /** | |
243 | 251 | * 完成盘点 |
244 | 252 | * @param taskHeader |
245 | 253 | * @return |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
... | ... | @@ -1391,6 +1391,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1391 | 1391 | inventoryTransactionList.add(inventoryTransaction); |
1392 | 1392 | shipmentIdList.add(taskDetail.getShipmentId()); |
1393 | 1393 | } |
1394 | + success = inventoryTransactionService.saveBatch(inventoryTransactionList); | |
1395 | + if (!success) { | |
1396 | + throw new JeecgBootException("完成出库任务,保存库存详情失败"); | |
1397 | + } | |
1394 | 1398 | List<InventoryDetail> inventoryDetailList = inventoryDetailService.getInventoryDetailListByInventoryHeaderId(inventoryHeader.getId()); |
1395 | 1399 | if (inventoryDetailList.size() == 0) { |
1396 | 1400 | success = inventoryHeaderService.removeById(inventoryHeader.getId()); |
... | ... | @@ -1398,14 +1402,22 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1398 | 1402 | throw new JeecgBootException("完成出库任务,删除库存头失败"); |
1399 | 1403 | } |
1400 | 1404 | } else { |
1401 | - if (taskType == QuantityConstant.TASK_TYPE_WHOLESHIPMENT) { | |
1402 | - throw new JeecgBootException("完成整盘出库任务,不能还剩库存详情"); | |
1405 | + String value = parameterConfigurationService.getValueByCode(QuantityConstant.SHIPMENT_WHOLE_TASK_CLEAR_INVENTORY); | |
1406 | + if (StringUtils.isNotEmpty(value)) { | |
1407 | + int shipmentWholeRule = Integer.parseInt(value); | |
1408 | + if (shipmentWholeRule == QuantityConstant.RULE_TASK_AllOW_CLEAR) { | |
1409 | + taskHeaderService.completeWholeShipmentTaskClearInventory(inventoryDetailList); | |
1410 | + } else { | |
1411 | + if (taskType == QuantityConstant.TASK_TYPE_WHOLESHIPMENT) { | |
1412 | + throw new JeecgBootException("完成整盘出库任务,不能还剩库存详情"); | |
1413 | + } | |
1414 | + } | |
1415 | + } else { | |
1416 | + if (taskType == QuantityConstant.TASK_TYPE_WHOLESHIPMENT) { | |
1417 | + throw new JeecgBootException("完成整盘出库任务,不能还剩库存详情"); | |
1418 | + } | |
1403 | 1419 | } |
1404 | 1420 | } |
1405 | - success = inventoryTransactionService.saveBatch(inventoryTransactionList); | |
1406 | - if (!success) { | |
1407 | - throw new JeecgBootException("完成出库任务,保存库存详情失败"); | |
1408 | - } | |
1409 | 1421 | ShipmentContainerHeader shipmentContainerHeader = shipmentContainerHeaderService.getById(taskHeader.getShipmentContainerHeaderId()); |
1410 | 1422 | if (shipmentContainerHeader == null) { |
1411 | 1423 | throw new JeecgBootException("完成出库任务,获取出库组盘头失败"); |
... | ... | @@ -1415,6 +1427,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1415 | 1427 | if (!success) { |
1416 | 1428 | throw new JeecgBootException("完成出库任务,更新出库组盘头失败"); |
1417 | 1429 | } |
1430 | + inventoryDetailList = inventoryDetailService.getInventoryDetailListByInventoryHeaderId(inventoryHeader.getId()); | |
1418 | 1431 | if (inventoryDetailList.size() != 0) { |
1419 | 1432 | if (!taskHeaderService.combineInventoryDetail(containerCode, warehouseCode)) { |
1420 | 1433 | throw new JeecgBootException("合并入库库存失败"); |
... | ... | @@ -1450,6 +1463,41 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1450 | 1463 | } |
1451 | 1464 | |
1452 | 1465 | @Override |
1466 | + public Result completeWholeShipmentTaskClearInventory(List<InventoryDetail> inventoryDetailList) { | |
1467 | + List<InventoryTransaction> inventoryTransactionList = new ArrayList<>(); | |
1468 | + for (InventoryDetail inventoryDetail : inventoryDetailList) { | |
1469 | + InventoryTransaction inventoryTransaction = new InventoryTransaction(); | |
1470 | + inventoryTransaction.setType(QuantityConstant.INVENTORY_TRANSACTION_SHIPMENT); | |
1471 | + inventoryTransaction.setWarehouseCode(inventoryDetail.getWarehouseCode()); | |
1472 | + inventoryTransaction.setCompanyCode(inventoryDetail.getCompanyCode()); | |
1473 | + inventoryTransaction.setContainerCode(inventoryDetail.getContainerCode()); | |
1474 | + inventoryTransaction.setZoneCode(inventoryDetail.getZoneCode()); | |
1475 | + inventoryTransaction.setFromLocationCode(inventoryDetail.getLocationCode()); | |
1476 | + inventoryTransaction.setToLocationCode(inventoryDetail.getLocationCode()); | |
1477 | + inventoryTransaction.setMaterialCode(inventoryDetail.getMaterialCode()); | |
1478 | + inventoryTransaction.setMaterialName(inventoryDetail.getMaterialName()); | |
1479 | + inventoryTransaction.setMaterialSpec(inventoryDetail.getMaterialSpec()); | |
1480 | + inventoryTransaction.setMaterialUnit(inventoryDetail.getMaterialUnit()); | |
1481 | + inventoryTransaction.setInventoryStatus(inventoryDetail.getInventoryStatus()); | |
1482 | + inventoryTransaction.setBatch(inventoryDetail.getBatch()); | |
1483 | + inventoryTransaction.setLot(inventoryDetail.getLot()); | |
1484 | + inventoryTransaction.setProject(inventoryDetail.getProject()); | |
1485 | + inventoryTransaction.setQty(inventoryDetail.getQty()); | |
1486 | + inventoryTransaction.setShipmentQty(inventoryDetail.getQty()); | |
1487 | + BigDecimal inventoryQty = inventoryDetailService.getInventorySumQty(inventoryDetail); | |
1488 | + inventoryTransaction.setInventoryQty(inventoryQty); | |
1489 | + inventoryTransactionList.add(inventoryTransaction); | |
1490 | + if (!inventoryDetailService.removeById(inventoryDetail)) { | |
1491 | + throw new JeecgBootException("完成整盘出库任务,删除库存详情失败" + inventoryDetail.getId()); | |
1492 | + } | |
1493 | + } | |
1494 | + if (!inventoryTransactionService.saveBatch(inventoryTransactionList)) { | |
1495 | + throw new JeecgBootException("完成整盘出库任务,保存库存详情失败"); | |
1496 | + } | |
1497 | + return Result.ok("完成出库任务"); | |
1498 | + } | |
1499 | + | |
1500 | + @Override | |
1453 | 1501 | @Transactional(rollbackFor = Exception.class) |
1454 | 1502 | public boolean combineInventoryDetail(String containerCode, String warehouseCode) { |
1455 | 1503 | boolean success = false; |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/utils/constant/QuantityConstant.java
... | ... | @@ -451,6 +451,8 @@ public class QuantityConstant { |
451 | 451 | public static final String QUALITY_GOOD = "good"; |
452 | 452 | |
453 | 453 | // 发送AGV任务成功 |
454 | + public static final int AGV_NEED_SEND = 0; | |
455 | + // 发送AGV任务成功 | |
454 | 456 | public static final int AGV_SEND_OK = 1; |
455 | 457 | // 发送AGV任务异常 |
456 | 458 | public static final int AGV_SEND_ERROR = 2; |
... | ... | @@ -496,6 +498,7 @@ public class QuantityConstant { |
496 | 498 | public static final String RULE_DOWN_ADDRESS = "downAdress"; |
497 | 499 | public static final String TV_VERSION = "Tv-Ver"; |
498 | 500 | public static final String RULE_SHIPMENT_ZONE = "shipmentZoneRule"; |
501 | + public static final String SHIPMENT_WHOLE_TASK_CLEAR_INVENTORY = "shipmentWholeTaskClearInventory"; | |
499 | 502 | |
500 | 503 | public static final int DOUBLE_FORK = 1; |
501 | 504 | public static final int SINGLE_FORK = 0; |
... | ... | @@ -509,6 +512,9 @@ public class QuantityConstant { |
509 | 512 | */ |
510 | 513 | public static final int SHIPMENT_BY_ZONE = 1; |
511 | 514 | |
515 | + public static final int RULE_TASK_NOT_CLEAR = 0; | |
516 | + public static final int RULE_TASK_AllOW_CLEAR = 1; | |
517 | + | |
512 | 518 | // 取消任务,不取消配盘 |
513 | 519 | public static final int RULE_TASK_CANCEL_NORMAL = 0; |
514 | 520 | // 取消任务,顺便取消配盘 |
... | ... |