Commit a5e1eab8768a0dada1e55fdb3a1da52a3be0afe7
1 parent
971046fc
增加入库到 AGV库的处理
Showing
16 changed files
with
363 additions
and
48 deletions
ant-design-vue-jeecg/src/views/system/config/ZoneList.vue
... | ... | @@ -90,6 +90,12 @@ |
90 | 90 | </a-tag> |
91 | 91 | </span> |
92 | 92 | |
93 | + <span slot="type_dictText" slot-scope="type_dictText"> | |
94 | + <a-tag :key="type_dictText" :color="getStatusColor(type_dictText)"> | |
95 | + {{ type_dictText }} | |
96 | + </a-tag> | |
97 | + </span> | |
98 | + | |
93 | 99 | <template slot="htmlSlot" slot-scope="text"> |
94 | 100 | <div v-html="text"></div> |
95 | 101 | </template> |
... | ... | @@ -173,6 +179,12 @@ export default { |
173 | 179 | dataIndex: 'name' |
174 | 180 | }, |
175 | 181 | { |
182 | + title: '类型', | |
183 | + align: 'center', | |
184 | + dataIndex: 'type_dictText', | |
185 | + scopedSlots: {customRender: 'type_dictText'} | |
186 | + }, | |
187 | + { | |
176 | 188 | title: '包含库位类型', |
177 | 189 | align: 'center', |
178 | 190 | dataIndex: 'locationTypeCodes', |
... | ... | @@ -229,6 +241,12 @@ export default { |
229 | 241 | } |
230 | 242 | }, |
231 | 243 | methods: { |
244 | + getStatusColor(status) { | |
245 | + const colors = { | |
246 | + default: 'blue' | |
247 | + }; | |
248 | + return colors[status] || colors.default; | |
249 | + }, | |
232 | 250 | initDictConfig() { |
233 | 251 | }, |
234 | 252 | getSuperFieldList() { |
... | ... |
ant-design-vue-jeecg/src/views/system/config/modules/LocationForm.vue
ant-design-vue-jeecg/src/views/system/config/modules/ZoneForm.vue
... | ... | @@ -14,6 +14,11 @@ |
14 | 14 | </a-form-model-item> |
15 | 15 | </a-col> |
16 | 16 | <a-col :span="24"> |
17 | + <a-form-model-item label="类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="type"> | |
18 | + <j-dict-select-tag type="list" v-model="model.type" dictCode="zoneType" placeholder="请选择类型"/> | |
19 | + </a-form-model-item> | |
20 | + </a-col> | |
21 | + <a-col :span="24"> | |
17 | 22 | <a-form-model-item label="绑定的库位类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="locationTypeCode"> |
18 | 23 | <j-select-multiple |
19 | 24 | v-model="model.locationTypeCode" |
... | ... | @@ -65,6 +70,9 @@ export default { |
65 | 70 | name: [ |
66 | 71 | {required: true, message: '请输入名称!'}, |
67 | 72 | ], |
73 | + type: [ | |
74 | + {required: true, message: '请输入类型!'}, | |
75 | + ], | |
68 | 76 | }, |
69 | 77 | url: { |
70 | 78 | add: "/config/zone/add", |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/acs/controller/AcsController.java
1 | 1 | package org.jeecg.modules.wms.api.acs.controller; |
2 | 2 | |
3 | -import java.util.Map; | |
4 | - | |
5 | 3 | import javax.annotation.Resource; |
6 | -import javax.servlet.http.HttpServletRequest; | |
7 | 4 | |
8 | 5 | import org.jeecg.common.api.vo.Result; |
9 | 6 | import org.jeecg.modules.wms.api.acs.entity.AcsStatus; |
7 | +import org.jeecg.modules.wms.api.acs.entity.AgvWarecell; | |
10 | 8 | import org.jeecg.modules.wms.api.acs.service.IAcsService; |
11 | 9 | import org.jeecg.modules.wms.config.address.service.IAddressService; |
12 | 10 | import org.jeecg.modules.wms.framework.controller.HuahengBaseController; |
... | ... | @@ -14,13 +12,8 @@ import org.jeecg.modules.wms.task.agvTask.service.IAgvTaskService; |
14 | 12 | import org.jeecg.utils.StringUtils; |
15 | 13 | import org.jeecg.utils.constant.QuantityConstant; |
16 | 14 | import org.jeecg.utils.support.ApiLogger; |
17 | -import org.springframework.web.bind.annotation.PostMapping; | |
18 | -import org.springframework.web.bind.annotation.RequestBody; | |
19 | -import org.springframework.web.bind.annotation.RequestMapping; | |
20 | -import org.springframework.web.bind.annotation.ResponseBody; | |
21 | -import org.springframework.web.bind.annotation.RestController; | |
15 | +import org.springframework.web.bind.annotation.*; | |
22 | 16 | |
23 | -import cn.monitor4all.logRecord.annotation.OperationLog; | |
24 | 17 | import io.swagger.annotations.Api; |
25 | 18 | import io.swagger.annotations.ApiOperation; |
26 | 19 | |
... | ... | @@ -38,14 +31,6 @@ public class AcsController extends HuahengBaseController { |
38 | 31 | @Resource |
39 | 32 | private IAddressService addressService; |
40 | 33 | |
41 | -// @PassApiAuthentication | |
42 | -// @ApiLogger(apiName = "API接口第三方Token校验测试", from = "TEST") | |
43 | -// @ResponseBody | |
44 | -// @PostMapping(value = "/testTokenCheck") | |
45 | -// public Result<?> testTokenCheck(@RequestBody Map<String, String> paramMap, HttpServletRequest request) { | |
46 | -// return Result.ok(); | |
47 | -// } | |
48 | - | |
49 | 34 | @PostMapping("/notifyAGVTask") |
50 | 35 | @ResponseBody |
51 | 36 | @ApiOperation("更新AGV状态") |
... | ... | @@ -75,4 +60,33 @@ public class AcsController extends HuahengBaseController { |
75 | 60 | return result; |
76 | 61 | } |
77 | 62 | |
63 | + @PostMapping("/agvWarecell") | |
64 | + @ResponseBody | |
65 | + @ApiOperation("分配AGV库位") | |
66 | + @ApiLogger(apiName = "分配AGV库位", from = "ACS") | |
67 | + public Result agvWarecell(@RequestBody AgvWarecell agvWarecell) { | |
68 | + if (agvWarecell == null) { | |
69 | + return Result.error("分配AGV库位,数据为空"); | |
70 | + } | |
71 | + String warehouseCode = agvWarecell.getWarehouseCode(); | |
72 | + String taskNo = agvWarecell.getTaskNo(); | |
73 | + String zoneCode = agvWarecell.getZoneCode(); | |
74 | + if (StringUtils.isEmpty(warehouseCode)) { | |
75 | + return Result.error("仓位分配, 仓库号为空"); | |
76 | + } | |
77 | + if (StringUtils.isEmpty(taskNo)) { | |
78 | + return Result.error("仓位分配, 任务号为空"); | |
79 | + } | |
80 | + if (StringUtils.isEmpty(zoneCode)) { | |
81 | + return Result.error("仓位分配, 目的区域为空"); | |
82 | + } | |
83 | + String lockKey = warehouseCode + zoneCode; | |
84 | + Result result = handleMultiProcess("agvWarecell", lockKey, new MultiProcessListener() { | |
85 | + @Override | |
86 | + public Result<?> doProcess() { | |
87 | + return acsService.warecellAllocation(agvWarecell); | |
88 | + } | |
89 | + }); | |
90 | + return result; | |
91 | + } | |
78 | 92 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/acs/entity/AgvWarecell.java
0 → 100644
1 | +package org.jeecg.modules.wms.api.acs.entity; | |
2 | + | |
3 | +import io.swagger.annotations.ApiModelProperty; | |
4 | +import lombok.Data; | |
5 | + | |
6 | +@Data | |
7 | +public class AgvWarecell { | |
8 | + | |
9 | + /** | |
10 | + * 任务号 | |
11 | + */ | |
12 | + @ApiModelProperty(value = "任务号", required = true) | |
13 | + private String taskNo; | |
14 | + | |
15 | + /** | |
16 | + * 仓库编号 | |
17 | + */ | |
18 | + @ApiModelProperty(value = "仓库编号", required = true) | |
19 | + private String warehouseCode; | |
20 | + | |
21 | + /** | |
22 | + * 区域 | |
23 | + */ | |
24 | + @ApiModelProperty(value = "区域", required = true) | |
25 | + private String zoneCode; | |
26 | + | |
27 | + /** | |
28 | + * 长度 | |
29 | + */ | |
30 | + @ApiModelProperty(value = "长度") | |
31 | + private String length; | |
32 | + | |
33 | + /** | |
34 | + * 宽度 | |
35 | + */ | |
36 | + @ApiModelProperty(value = "宽度") | |
37 | + private String width; | |
38 | + | |
39 | + /** | |
40 | + * 高度 | |
41 | + */ | |
42 | + @ApiModelProperty(value = "高度") | |
43 | + private String height; | |
44 | + | |
45 | + /** | |
46 | + * 重量 | |
47 | + */ | |
48 | + @ApiModelProperty(value = "重量") | |
49 | + private String weight; | |
50 | + | |
51 | + /** | |
52 | + * 起始站点 | |
53 | + */ | |
54 | + @ApiModelProperty(value = "起始站点") | |
55 | + private String fromPortCode; | |
56 | +} | |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/acs/service/IAcsService.java
1 | 1 | package org.jeecg.modules.wms.api.acs.service; |
2 | 2 | |
3 | 3 | import org.jeecg.common.api.vo.Result; |
4 | +import org.jeecg.modules.wms.api.acs.entity.AgvWarecell; | |
4 | 5 | import org.jeecg.modules.wms.task.agvTask.entity.AgvTask; |
5 | 6 | |
6 | 7 | public interface IAcsService { |
... | ... | @@ -12,4 +13,11 @@ public interface IAcsService { |
12 | 13 | Result updateAGVTask(AgvTask agvTask); |
13 | 14 | |
14 | 15 | Result notifyAGVTask(String taskNo, String carNo, int status); |
16 | + | |
17 | + /** | |
18 | + * 仓位分配 | |
19 | + * @param agvWarecell | |
20 | + * @return | |
21 | + */ | |
22 | + Result warecellAllocation(AgvWarecell agvWarecell); | |
15 | 23 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/acs/service/impl/AcsServiceImpl.java
1 | 1 | package org.jeecg.modules.wms.api.acs.service.impl; |
2 | 2 | |
3 | +import java.util.Date; | |
4 | +import java.util.List; | |
5 | +import java.util.stream.Collectors; | |
6 | + | |
3 | 7 | import javax.annotation.Resource; |
4 | 8 | |
5 | 9 | import org.jeecg.common.api.vo.Result; |
6 | 10 | import org.jeecg.common.exception.JeecgBootException; |
7 | 11 | import org.jeecg.modules.wms.api.acs.entity.AgvEntity; |
12 | +import org.jeecg.modules.wms.api.acs.entity.AgvWarecell; | |
8 | 13 | import org.jeecg.modules.wms.api.acs.service.IAcsService; |
14 | +import org.jeecg.modules.wms.api.wcs.entity.WcsTask; | |
15 | +import org.jeecg.modules.wms.api.wcs.service.LocationAllocationService; | |
9 | 16 | import org.jeecg.modules.wms.config.address.service.IAddressService; |
17 | +import org.jeecg.modules.wms.config.container.entity.Container; | |
18 | +import org.jeecg.modules.wms.config.container.service.IContainerService; | |
19 | +import org.jeecg.modules.wms.config.containerType.entity.ContainerType; | |
20 | +import org.jeecg.modules.wms.config.containerType.service.IContainerTypeService; | |
10 | 21 | import org.jeecg.modules.wms.config.location.entity.Location; |
11 | 22 | import org.jeecg.modules.wms.config.location.service.ILocationService; |
23 | +import org.jeecg.modules.wms.config.locationHigh.entity.LocationHigh; | |
24 | +import org.jeecg.modules.wms.config.locationHigh.service.ILocationHighService; | |
25 | +import org.jeecg.modules.wms.config.locationType.entity.LocationType; | |
26 | +import org.jeecg.modules.wms.config.locationType.service.ILocationTypeService; | |
27 | +import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService; | |
28 | +import org.jeecg.modules.wms.config.zone.entity.Zone; | |
29 | +import org.jeecg.modules.wms.config.zone.service.IZoneService; | |
12 | 30 | import org.jeecg.modules.wms.task.agvTask.entity.AgvTask; |
13 | 31 | import org.jeecg.modules.wms.task.agvTask.service.IAgvTaskService; |
32 | +import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; | |
33 | +import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; | |
14 | 34 | import org.jeecg.utils.OkHttpUtils; |
15 | 35 | import org.jeecg.utils.StringUtils; |
16 | 36 | import org.jeecg.utils.constant.QuantityConstant; |
17 | 37 | import org.springframework.stereotype.Service; |
38 | +import org.springframework.transaction.annotation.Transactional; | |
18 | 39 | |
19 | 40 | import com.alibaba.fastjson.JSON; |
41 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
42 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
43 | + | |
44 | +import lombok.extern.slf4j.Slf4j; | |
20 | 45 | |
46 | +/** | |
47 | + * @author 游杰 | |
48 | + */ | |
49 | +@Slf4j | |
21 | 50 | @Service |
22 | 51 | public class AcsServiceImpl implements IAcsService { |
23 | 52 | |
... | ... | @@ -27,6 +56,22 @@ public class AcsServiceImpl implements IAcsService { |
27 | 56 | private IAgvTaskService agvTaskService; |
28 | 57 | @Resource |
29 | 58 | private IAddressService addressService; |
59 | + @Resource | |
60 | + private IZoneService zoneService; | |
61 | + @Resource | |
62 | + private ITaskHeaderService taskHeaderService; | |
63 | + @Resource | |
64 | + private IContainerService containerService; | |
65 | + @Resource | |
66 | + private IContainerTypeService containerTypeService; | |
67 | + @Resource | |
68 | + private ILocationTypeService locationTypeService; | |
69 | + @Resource | |
70 | + private ILocationHighService locationHighService; | |
71 | + @Resource | |
72 | + private IParameterConfigurationService parameterConfigurationService; | |
73 | + @Resource | |
74 | + private LocationAllocationService locationAllocationService; | |
30 | 75 | |
31 | 76 | @Override |
32 | 77 | public Result executeAGVTask(AgvTask agvTask) { |
... | ... | @@ -136,4 +181,129 @@ public class AcsServiceImpl implements IAcsService { |
136 | 181 | } |
137 | 182 | return Result.ok("更新任务信息成功"); |
138 | 183 | } |
184 | + | |
185 | + @Override | |
186 | + @Transactional(rollbackFor = Exception.class) | |
187 | + public Result warecellAllocation(AgvWarecell agvWarecell) { | |
188 | + String warehouseCode = agvWarecell.getWarehouseCode(); | |
189 | + String zoneCode = agvWarecell.getZoneCode(); | |
190 | + String height = agvWarecell.getHeight(); | |
191 | + String taskNo = agvWarecell.getTaskNo(); | |
192 | + String fromPortCode = agvWarecell.getFromPortCode(); | |
193 | + | |
194 | + Zone zone = zoneService.getZoneByCode(zoneCode, warehouseCode); | |
195 | + if (zone == null) { | |
196 | + return Result.error("分配库位时,没有找到库区"); | |
197 | + } | |
198 | + if (StringUtils.isEmpty(fromPortCode)) { | |
199 | + return Result.error("分配库位时,起始站台为空"); | |
200 | + } | |
201 | + TaskHeader taskHeader = taskHeaderService.getById(taskNo); | |
202 | + if (taskHeader == null) { | |
203 | + return Result.error("分配库位时,根据任务号没有找到任务"); | |
204 | + } | |
205 | + if (taskHeader.getStatus() == QuantityConstant.TASK_STATUS_COMPLETED) { | |
206 | + return Result.error("分配库位时,任务已经完成不能再分库位"); | |
207 | + } | |
208 | + int taskType = taskHeader.getTaskType(); | |
209 | + if (taskType == QuantityConstant.TASK_TYPE_WHOLESHIPMENT || taskType == QuantityConstant.TASK_TYPE_EMPTYSHIPMENT | |
210 | + || taskType == QuantityConstant.TASK_TYPE_MANY_EMPTYSHIPMENT) { | |
211 | + return Result.error("分配库位时,整出类型的任务不需要分配库位"); | |
212 | + } | |
213 | + String containerCode = taskHeader.getContainerCode(); | |
214 | + if (StringUtils.isEmpty(containerCode)) { | |
215 | + return Result.error("分配库位时,任务托盘为空"); | |
216 | + } | |
217 | + Container container = containerService.getContainerByCode(containerCode, warehouseCode); | |
218 | + if (container == null) { | |
219 | + return Result.error("分配库位时,没有找到容器" + containerCode); | |
220 | + } | |
221 | + String containerTypeCode = container.getContainerTypeCode(); | |
222 | + if (StringUtils.isEmpty(containerTypeCode)) { | |
223 | + return Result.error("分配库位时,任务托盘没有库位类型,托盘号为" + containerCode); | |
224 | + } | |
225 | + ContainerType containerType = containerTypeService.getContainerTypeByCode(containerTypeCode, warehouseCode); | |
226 | + if (containerType == null) { | |
227 | + return Result.error("分配库位时,托盘类型为空,托盘类型值为" + containerTypeCode); | |
228 | + } | |
229 | + List<String> locationTypeCodes = containerType.getLocationTypes(); | |
230 | + // 查询满足条件的库位类型 | |
231 | + LambdaQueryWrapper<LocationType> locationTypeLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
232 | + locationTypeLambdaQueryWrapper.in(LocationType::getCode, locationTypeCodes).eq(LocationType::getWarehouseCode, warehouseCode); | |
233 | + List<LocationType> locationTypeList = locationTypeService.list(locationTypeLambdaQueryWrapper); | |
234 | + if (locationTypeList.size() == 0) { | |
235 | + return Result.error("分配库位时,没有找到库位类型"); | |
236 | + } | |
237 | + int highHeight = Float.valueOf(height).intValue(); | |
238 | + List<String> locationTypeCodeList = locationTypeList.stream().map(t -> t.getCode()).collect(Collectors.toList()); | |
239 | + LambdaQueryWrapper<LocationHigh> locationHighLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
240 | + locationHighLambdaQueryWrapper.eq(LocationHigh::getHighLevel, highHeight).in(LocationHigh::getLocationTypeCode, locationTypeCodeList) | |
241 | + .eq(LocationHigh::getZoneCode, zoneCode); | |
242 | + LocationHigh locationHigh = locationHighService.getOne(locationHighLambdaQueryWrapper); | |
243 | + if (locationHigh == null) { | |
244 | + return Result.error("分配库位时,高度不匹配,WCS给的高度值" + highHeight + "不在WMS系统配置范围内"); | |
245 | + } | |
246 | + int high = locationHigh.getHigh(); | |
247 | + String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_ALLOCATION, zoneCode); | |
248 | + if (StringUtils.isEmpty(value)) { | |
249 | + return Result.error("分配库位时, 未绑定定位规则"); | |
250 | + } | |
251 | + int allocationRule = Integer.parseInt(value); | |
252 | + String materialAreaCode = null; | |
253 | + | |
254 | + String locationCode = | |
255 | + locationAllocationService.allocation(allocationRule, locationTypeCodeList, high, zoneCode, null, warehouseCode, containerCode, materialAreaCode, null); | |
256 | + if (StringUtils.isEmpty(locationCode)) { | |
257 | + return Result.error("分配库位时,没有库位可分配"); | |
258 | + } | |
259 | + | |
260 | + boolean success = locationService.updateStatus(locationCode, QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); | |
261 | + if (!success) { | |
262 | + throw new JeecgBootException("分配库位时,更新库位状态失败"); | |
263 | + } | |
264 | + if (StringUtils.isNotEmpty(taskHeader.getToLocationCode()) && !locationCode.equals(taskHeader.getToLocationCode())) { | |
265 | + success = locationService.updateStatus(taskHeader.getToLocationCode(), QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
266 | + if (!success) { | |
267 | + throw new JeecgBootException("分配库位时,更新之前分配的库位状态失败"); | |
268 | + } | |
269 | + } | |
270 | + | |
271 | + Location location = locationService.getLocationByCode(locationCode, warehouseCode); | |
272 | + | |
273 | + int agvTaskId = taskHeader.getId(); | |
274 | + if (agvTaskId != 0) { | |
275 | + AgvTask agvTask = new AgvTask(); | |
276 | + agvTask.setWarehouseCode(warehouseCode); | |
277 | + agvTask.setZoneCode(zoneCode); | |
278 | + agvTask.setTaskType(QuantityConstant.AGV_TYPE_TAKE_AND_RELEASE); | |
279 | + agvTask.setStatus(QuantityConstant.AGV_TASK_STATUS_BUILD); | |
280 | + agvTask.setContainerCode(containerCode); | |
281 | + agvTask.setFromPort(fromPortCode); | |
282 | + agvTask.setToPort(locationCode); | |
283 | + agvTask.setPriority(10); | |
284 | + Result result = agvTaskService.addAgvTask(agvTask, warehouseCode); | |
285 | + if (!result.isSuccess()) { | |
286 | + throw new JeecgBootException("完成分配库位, 新增AGV任务失败"); | |
287 | + } | |
288 | + agvTaskId = agvTask.getId(); | |
289 | + } | |
290 | + | |
291 | + taskHeader = new TaskHeader(); | |
292 | + taskHeader.setId(Integer.parseInt(taskNo)); | |
293 | + taskHeader.setZoneCode(location.getZoneCode()); | |
294 | + taskHeader.setAgvTaskId(agvTaskId); | |
295 | + taskHeader.setRoadWay(location.getRoadWay()); | |
296 | + taskHeader.setAllocationTime(new Date()); | |
297 | + taskHeader.setWeight(Integer.parseInt(agvWarecell.getWeight())); | |
298 | + taskHeader.setToLocationCode(locationCode); | |
299 | + if (!taskHeaderService.updateById(taskHeader)) { | |
300 | + throw new JeecgBootException("更新任务头表目标库位失败"); | |
301 | + } | |
302 | + | |
303 | + WcsTask wcsTask = new WcsTask(); | |
304 | + wcsTask.setToLocationCode(locationCode); | |
305 | + | |
306 | + log.info("完成分配库位,任务号:" + taskNo + ", 库位编码:" + locationCode); | |
307 | + return Result.OK(wcsTask); | |
308 | + } | |
139 | 309 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/agvcall/controller/AgvCallController.java
1 | 1 | package org.jeecg.modules.wms.api.agvcall.controller; |
2 | 2 | |
3 | +import javax.annotation.Resource; | |
4 | + | |
3 | 5 | import org.jeecg.modules.wms.framework.controller.HuahengBaseController; |
6 | +import org.jeecg.modules.wms.receipt.receiving.service.IReceiveService; | |
4 | 7 | import org.springframework.web.bind.annotation.RequestMapping; |
5 | 8 | import org.springframework.web.bind.annotation.RestController; |
6 | 9 | |
... | ... | @@ -14,4 +17,7 @@ import io.swagger.annotations.Api; |
14 | 17 | @Api(tags = "AGV接口") |
15 | 18 | public class AgvCallController extends HuahengBaseController { |
16 | 19 | |
20 | + @Resource | |
21 | + private IReceiveService receiveService; | |
22 | + | |
17 | 23 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/entity/WarecellDomain.java
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/zone/entity/Zone.java
... | ... | @@ -5,6 +5,7 @@ import java.util.Arrays; |
5 | 5 | import java.util.Date; |
6 | 6 | import java.util.List; |
7 | 7 | |
8 | +import org.jeecg.common.aspect.annotation.Dict; | |
8 | 9 | import org.jeecgframework.poi.excel.annotation.Excel; |
9 | 10 | |
10 | 11 | import com.baomidou.mybatisplus.annotation.IdType; |
... | ... | @@ -50,6 +51,7 @@ public class Zone implements Serializable { |
50 | 51 | /** 类型 */ |
51 | 52 | @Excel(name = "类型", width = 15) |
52 | 53 | @ApiModelProperty(value = "类型") |
54 | + @Dict(dicCode = "zoneType") | |
53 | 55 | private String type; |
54 | 56 | |
55 | 57 | /** 仓库编码 */ |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiveHeader/controller/ReceiveHeaderController.java
... | ... | @@ -12,7 +12,6 @@ import javax.servlet.http.HttpServletRequest; |
12 | 12 | import javax.servlet.http.HttpServletResponse; |
13 | 13 | |
14 | 14 | import org.apache.shiro.SecurityUtils; |
15 | -import org.apache.shiro.authz.annotation.RequiresPermissions; | |
16 | 15 | import org.jeecg.common.api.vo.Result; |
17 | 16 | import org.jeecg.common.aspect.annotation.AutoLog; |
18 | 17 | import org.jeecg.common.exception.JeecgBootException; |
... | ... | @@ -359,4 +358,5 @@ public class ReceiveHeaderController extends JeecgController<ReceiveHeader, IRec |
359 | 358 | Result result = receiveDetailService.receive(receiveList, warehouseCode); |
360 | 359 | return result; |
361 | 360 | } |
361 | + | |
362 | 362 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/controller/ReceiveController.java
... | ... | @@ -207,4 +207,26 @@ public class ReceiveController extends HuahengBaseController { |
207 | 207 | }); |
208 | 208 | return result; |
209 | 209 | } |
210 | + | |
211 | + /** | |
212 | + * 组盘 | |
213 | + * @return | |
214 | + */ | |
215 | + @AutoLog("入库单-AGV入库") | |
216 | + @ApiOperation(value = "入库单-AGV入库", notes = "入库单-AGV入库") | |
217 | + @PostMapping("/agvReceipt") | |
218 | + @ResponseBody | |
219 | + public Result agvReceipt(@RequestBody List<Receive> receiveList, HttpServletRequest req) { | |
220 | + String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); | |
221 | + String lockKey = warehouseCode; | |
222 | + Result result = handleMultiProcess("agvReceipt", lockKey, new MultiProcessListener() { | |
223 | + @Override | |
224 | + public Result<?> doProcess() { | |
225 | + Result result = receiveService.receivingAndCreateTask(receiveList, warehouseCode); | |
226 | + | |
227 | + return result; | |
228 | + } | |
229 | + }); | |
230 | + return result; | |
231 | + } | |
210 | 232 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/domain/Receive.java
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/service/impl/ReceiveServiceImpl.java
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/agvTask/service/impl/AgvTaskServiceImpl.java
... | ... | @@ -50,12 +50,14 @@ public class AgvTaskServiceImpl extends ServiceImpl<AgvTaskMapper, AgvTask> impl |
50 | 50 | if (StringUtils.isEmpty(containerCode)) { |
51 | 51 | return Result.error("生成AGV任务,容器号不能为空"); |
52 | 52 | } |
53 | - Container containerByCode = containerService.getContainerByCode(containerCode, warehouseCode); | |
54 | - if (containerByCode == null) { | |
53 | + Container container = containerService.getContainerByCode(containerCode, warehouseCode); | |
54 | + if (container == null) { | |
55 | 55 | return Result.error("生成AGV任务,容器号:" + containerCode + "未找到"); |
56 | 56 | } |
57 | - if (!containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_LOCK, warehouseCode)) { | |
58 | - throw new JeecgBootException("生成AGV任务,锁定容器失败:" + containerCode); | |
57 | + if (!container.getStatus().equals(QuantityConstant.STATUS_CONTAINER_LOCK)) { | |
58 | + if (!containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_LOCK, warehouseCode)) { | |
59 | + throw new JeecgBootException("生成AGV任务,锁定容器失败:" + containerCode); | |
60 | + } | |
59 | 61 | } |
60 | 62 | agvTask.setWarehouseCode(warehouseCode); |
61 | 63 | agvTask.setTaskType(QuantityConstant.AGV_TYPE_TAKE_AND_RELEASE); |
... | ... | @@ -103,38 +105,46 @@ public class AgvTaskServiceImpl extends ServiceImpl<AgvTaskMapper, AgvTask> impl |
103 | 105 | String toPort = agvTask.getToPort(); |
104 | 106 | String warehouseCode = agvTask.getWarehouseCode(); |
105 | 107 | String containerCode = agvTask.getContainerCode(); |
106 | - Location fromLocation = locationService.getLocationByCode(fromPort, warehouseCode); | |
107 | - if (fromLocation != null) { | |
108 | - success = locationService.updateContainerCodeAndStatus(fromPort, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
108 | + Container container = containerService.getContainerByCode(containerCode, warehouseCode); | |
109 | + if (container == null) { | |
110 | + throw new JeecgBootException("完成AGV任务时,根据容器编码没有找到容器"); | |
111 | + } | |
112 | + TaskHeader taskHeader = taskHeaderService.getTaskHeaderByAgvTaskId(agvTask.getId()); | |
113 | + if (taskHeader == null) { | |
114 | + Location fromLocation = locationService.getLocationByCode(fromPort, warehouseCode); | |
115 | + if (fromLocation != null) { | |
116 | + success = | |
117 | + locationService.updateContainerCodeAndStatus(fromPort, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
118 | + if (!success) { | |
119 | + throw new JeecgBootException("完成AGV任务时,更新起始库位数据失败"); | |
120 | + } | |
121 | + } else { | |
122 | + fromPort = QuantityConstant.EMPTY_STRING; | |
123 | + } | |
124 | + Location toLocation = locationService.getLocationByCode(toPort, warehouseCode); | |
125 | + if (toLocation != null) { | |
126 | + success = locationService.updateContainerCodeAndStatus(toPort, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
127 | + if (!success) { | |
128 | + throw new JeecgBootException("完成AGV任务时,更新终点库位数据失败"); | |
129 | + } | |
130 | + } else { | |
131 | + toPort = QuantityConstant.EMPTY_STRING; | |
132 | + } | |
133 | + success = containerService.updateLocationCodeAndStatus(containerCode, toPort, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | |
109 | 134 | if (!success) { |
110 | - throw new JeecgBootException("完成AGV任务时,更新起始库位数据失败"); | |
135 | + throw new JeecgBootException("完成AGV任务时,更新容器数据失败"); | |
111 | 136 | } |
112 | 137 | } else { |
113 | - fromPort = QuantityConstant.EMPTY_STRING; | |
114 | - } | |
115 | - Location toLocation = locationService.getLocationByCode(toPort, warehouseCode); | |
116 | - if (toLocation != null) { | |
117 | - success = locationService.updateContainerCodeAndStatus(toPort, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
138 | + success = containerService.updateLocationCode(containerCode, toPort, warehouseCode); | |
118 | 139 | if (!success) { |
119 | - throw new JeecgBootException("完成AGV任务时,更新终点库位数据失败"); | |
140 | + throw new JeecgBootException("完成AGV任务时,更新容器数据失败"); | |
120 | 141 | } |
121 | - } else { | |
122 | - toPort = QuantityConstant.EMPTY_STRING; | |
123 | - } | |
124 | - Container container = containerService.getContainerByCode(containerCode, warehouseCode); | |
125 | - if (container == null) { | |
126 | - throw new JeecgBootException("完成AGV任务时,根据容器编码没有找到容器"); | |
127 | - } | |
128 | - success = containerService.updateLocationCodeAndStatus(containerCode, toPort, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | |
129 | - if (!success) { | |
130 | - throw new JeecgBootException("完成AGV任务时,更新容器数据失败"); | |
131 | 142 | } |
132 | 143 | agvTask.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
133 | 144 | success = updateById(agvTask); |
134 | 145 | if (!success) { |
135 | 146 | throw new JeecgBootException("完成AGV任务时, 更新AGV任务失败"); |
136 | 147 | } |
137 | - TaskHeader taskHeader = taskHeaderService.getTaskHeaderByAgvTaskId(taskId); | |
138 | 148 | if (taskHeader != null) { |
139 | 149 | Result result = taskHeaderService.completeTaskByWMS(taskHeader.getId(), false); |
140 | 150 | if (!result.isSuccess()) { |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
... | ... | @@ -910,6 +910,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
910 | 910 | case QuantityConstant.TASK_TYPE_WHOLESHIPMENT: |
911 | 911 | case QuantityConstant.TASK_TYPE_SORTINGSHIPMENT: |
912 | 912 | result = taskHeaderService.cancelShipmentTask(taskHeader); |
913 | + break; | |
913 | 914 | case QuantityConstant.TASK_TYPE_CYCLECOUNT: |
914 | 915 | result = taskHeaderService.updateCycleCountDetailByEnableStatus(taskHeader); |
915 | 916 | break; |
... | ... | @@ -2777,8 +2778,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
2777 | 2778 | public Result updateCycleCountDetailByEnableStatus(TaskHeader taskHeader) { |
2778 | 2779 | log.info("开始取消盘点任务"); |
2779 | 2780 | LambdaQueryWrapper<CycleCountDetail> cycleCountDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); |
2780 | - cycleCountDetailLambdaQueryWrapper.eq(CycleCountDetail::getContainerCode, taskHeader.getContainerCode()) | |
2781 | - .ne(CycleCountDetail::getEnableStatus, QuantityConstant.SHIPMENT_RECEIVE_SUCCESS); | |
2781 | + cycleCountDetailLambdaQueryWrapper.eq(CycleCountDetail::getContainerCode, taskHeader.getContainerCode()).ne(CycleCountDetail::getEnableStatus, | |
2782 | + QuantityConstant.SHIPMENT_RECEIVE_SUCCESS); | |
2782 | 2783 | CycleCountDetail cycleCountDetail = cycleCountDetailService.getOne(cycleCountDetailLambdaQueryWrapper); |
2783 | 2784 | if (cycleCountDetail == null) { |
2784 | 2785 | throw new JeecgBootException("取消盘点任务,没有找到盘点明细"); |
... | ... |