Commit cdf954ed5b49d66c80be963b6de0f353c3239023
1 parent
0e71c0b9
库位监控问题及性能优化
Signed-off-by: TanYibin <5491541@qq.com>
Showing
5 changed files
with
97 additions
and
63 deletions
ant-design-vue-jeecg/src/views/system/compare/CompareWcsLocation.vue
@@ -5,15 +5,29 @@ | @@ -5,15 +5,29 @@ | ||
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 | <a-col :xl="6" :lg="7" :md="8" :sm="24"> | 7 | <a-col :xl="6" :lg="7" :md="8" :sm="24"> |
8 | + <a-form-item label="库区"> | ||
9 | + <a-select | ||
10 | + show-search | ||
11 | + placeholder="请选择库区" | ||
12 | + option-filter-prop="children" | ||
13 | + v-model="queryParam.zoneCode" | ||
14 | + > | ||
15 | + <a-select-option v-for="item in zoneList" :key="item.name" :value="item.code"> | ||
16 | + {{ item.name }} | ||
17 | + </a-select-option> | ||
18 | + </a-select> | ||
19 | + </a-form-item> | ||
20 | + </a-col> | ||
21 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | ||
8 | <a-form-item label="库位编码"> | 22 | <a-form-item label="库位编码"> |
9 | <a-input placeholder="请输入库位编码" v-model="queryParam.locationCode"></a-input> | 23 | <a-input placeholder="请输入库位编码" v-model="queryParam.locationCode"></a-input> |
10 | </a-form-item> | 24 | </a-form-item> |
11 | </a-col> | 25 | </a-col> |
12 | - <a-col :xl="6" :lg="7" :md="8" :sm="24"> | 26 | + <!-- <a-col :xl="6" :lg="7" :md="8" :sm="24"> |
13 | <a-form-item label="库位表容器编码"> | 27 | <a-form-item label="库位表容器编码"> |
14 | <a-input placeholder="请输入库位表容器编码" v-model="queryParam.containerCode"></a-input> | 28 | <a-input placeholder="请输入库位表容器编码" v-model="queryParam.containerCode"></a-input> |
15 | </a-form-item> | 29 | </a-form-item> |
16 | - </a-col> | 30 | + </a-col> --> |
17 | <a-col :xl="6" :lg="7" :md="8" :sm="24"> | 31 | <a-col :xl="6" :lg="7" :md="8" :sm="24"> |
18 | <a-form-item label="数据状态"> | 32 | <a-form-item label="数据状态"> |
19 | <j-dict-select-tag | 33 | <j-dict-select-tag |
@@ -90,7 +104,7 @@ import { JeecgListMixin } from '@/mixins/JeecgListMixin' | @@ -90,7 +104,7 @@ import { JeecgListMixin } from '@/mixins/JeecgListMixin' | ||
90 | import { getAction } from '@/api/manage' | 104 | import { getAction } from '@/api/manage' |
91 | import CompareWcsLocationTask from './CompareWcsLocationTask' | 105 | import CompareWcsLocationTask from './CompareWcsLocationTask' |
92 | import { initDictOptions, filterMultiDictText } from '@/components/dict/JDictSelectUtil' | 106 | import { initDictOptions, filterMultiDictText } from '@/components/dict/JDictSelectUtil' |
93 | -import { ajaxGetDictItems, getDictItemsFromCache } from '@/api/api' | 107 | +import { getZoneList, ajaxGetDictItems, getDictItemsFromCache } from '@/api/api' |
94 | 108 | ||
95 | export default { | 109 | export default { |
96 | name: 'CompareWcsLocation', | 110 | name: 'CompareWcsLocation', |
@@ -106,6 +120,7 @@ export default { | @@ -106,6 +120,7 @@ export default { | ||
106 | containerStatusList: [], | 120 | containerStatusList: [], |
107 | wcsLocationStatusList: [], | 121 | wcsLocationStatusList: [], |
108 | consistencyStatusList: [], | 122 | consistencyStatusList: [], |
123 | + zoneList:[], | ||
109 | // 表头 | 124 | // 表头 |
110 | columns: [ | 125 | columns: [ |
111 | { | 126 | { |
@@ -182,6 +197,7 @@ export default { | @@ -182,6 +197,7 @@ export default { | ||
182 | } | 197 | } |
183 | }, | 198 | }, |
184 | created() { | 199 | created() { |
200 | + this.loadFrom() | ||
185 | this.initDictData() | 201 | this.initDictData() |
186 | }, | 202 | }, |
187 | methods: { | 203 | methods: { |
@@ -280,6 +296,13 @@ export default { | @@ -280,6 +296,13 @@ export default { | ||
280 | return color | 296 | return color |
281 | }, | 297 | }, |
282 | initDictConfig() {}, | 298 | initDictConfig() {}, |
299 | + loadFrom() { | ||
300 | + getZoneList().then(res => { | ||
301 | + if (res.success) { | ||
302 | + this.zoneList = res.result | ||
303 | + } | ||
304 | + }) | ||
305 | + }, | ||
283 | clickThenSelect(record) { | 306 | clickThenSelect(record) { |
284 | return { | 307 | return { |
285 | on: { | 308 | on: { |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/address/service/impl/AddressServiceImpl.java
1 | package org.jeecg.modules.wms.config.address.service.impl; | 1 | package org.jeecg.modules.wms.config.address.service.impl; |
2 | 2 | ||
3 | -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
4 | -import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||
5 | -import org.apache.commons.math3.analysis.function.Add; | ||
6 | import org.jeecg.modules.wms.config.address.entity.Address; | 3 | import org.jeecg.modules.wms.config.address.entity.Address; |
7 | import org.jeecg.modules.wms.config.address.mapper.AddressMapper; | 4 | import org.jeecg.modules.wms.config.address.mapper.AddressMapper; |
8 | import org.jeecg.modules.wms.config.address.service.IAddressService; | 5 | import org.jeecg.modules.wms.config.address.service.IAddressService; |
9 | import org.springframework.cache.annotation.Cacheable; | 6 | import org.springframework.cache.annotation.Cacheable; |
10 | import org.springframework.stereotype.Service; | 7 | import org.springframework.stereotype.Service; |
11 | 8 | ||
9 | +import com.aliyuncs.utils.StringUtils; | ||
10 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
11 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||
12 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 12 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
13 | 13 | ||
14 | /** | 14 | /** |
@@ -21,30 +21,28 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | @@ -21,30 +21,28 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||
21 | public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements IAddressService { | 21 | public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements IAddressService { |
22 | 22 | ||
23 | @Override | 23 | @Override |
24 | - @Cacheable(cacheNames = "getAddressByUrl#300", key = "#root.methodName") | 24 | + @Cacheable(cacheNames = "getAddressByUrl#1", key = "#root.methodName + '_' + #url", unless = "#result == null ") |
25 | public Address getAddressByUrl(String url) { | 25 | public Address getAddressByUrl(String url) { |
26 | LambdaQueryWrapper<Address> addressLambdaQueryWrapper = Wrappers.lambdaQuery(); | 26 | LambdaQueryWrapper<Address> addressLambdaQueryWrapper = Wrappers.lambdaQuery(); |
27 | - addressLambdaQueryWrapper.eq(Address::getUrl, url).last(" limit 1"); | ||
28 | - Address address = getOne(addressLambdaQueryWrapper); | ||
29 | - return address; | 27 | + addressLambdaQueryWrapper.eq(Address::getUrl, url); |
28 | + return getOne(addressLambdaQueryWrapper); | ||
30 | } | 29 | } |
31 | 30 | ||
32 | @Override | 31 | @Override |
33 | - @Cacheable(cacheNames = "getUrlByParam#300", key = "#root.methodName + '_' + #param + '_' + #warehouseCode + '_' + #zoneCode") | 32 | + @Cacheable(cacheNames = "getUrlByParam#1", key = "#root.methodName + '_' + #param + '_' + #warehouseCode + '_' + #zoneCode", unless = "#result == null ") |
34 | public String getUrlByParam(String param, String warehouseCode, String zoneCode) { | 33 | public String getUrlByParam(String param, String warehouseCode, String zoneCode) { |
35 | LambdaQueryWrapper<Address> addressLambdaQueryWrapper = Wrappers.lambdaQuery(); | 34 | LambdaQueryWrapper<Address> addressLambdaQueryWrapper = Wrappers.lambdaQuery(); |
36 | - addressLambdaQueryWrapper.eq(Address::getParam, param).eq(Address::getWarehouseCode, warehouseCode).eq(Address::getZoneCode, zoneCode); | 35 | + addressLambdaQueryWrapper.eq(Address::getParam, param).eq(!StringUtils.isEmpty(warehouseCode), Address::getWarehouseCode, warehouseCode) |
36 | + .eq(!StringUtils.isEmpty(zoneCode), Address::getZoneCode, zoneCode); | ||
37 | Address address = getOne(addressLambdaQueryWrapper); | 37 | Address address = getOne(addressLambdaQueryWrapper); |
38 | if (address == null) { | 38 | if (address == null) { |
39 | return null; | 39 | return null; |
40 | } | 40 | } |
41 | - String url = address.getUrl(); | ||
42 | - return url; | 41 | + return address.getUrl(); |
43 | } | 42 | } |
44 | 43 | ||
45 | - /** #300 缓存300秒 */ | ||
46 | @Override | 44 | @Override |
47 | - @Cacheable(cacheNames = "getUrlByParam#300", key = "#root.methodName + '_' + #param") | 45 | + @Cacheable(cacheNames = "getUrlByParam#1", key = "#root.methodName + '_' + #param", unless = "#result == null ") |
48 | public String getUrlByParam(String param) { | 46 | public String getUrlByParam(String param) { |
49 | LambdaQueryWrapper<Address> addressLambdaQueryWrapper = Wrappers.lambdaQuery(); | 47 | LambdaQueryWrapper<Address> addressLambdaQueryWrapper = Wrappers.lambdaQuery(); |
50 | addressLambdaQueryWrapper.eq(Address::getParam, param); | 48 | addressLambdaQueryWrapper.eq(Address::getParam, param); |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/CompareLocationDto.java
@@ -17,28 +17,28 @@ public class CompareLocationDto { | @@ -17,28 +17,28 @@ public class CompareLocationDto { | ||
17 | private String locationCode; | 17 | private String locationCode; |
18 | 18 | ||
19 | /** 库位表容器编码 */ | 19 | /** 库位表容器编码 */ |
20 | - private String locationContainerCode; | 20 | + private String locationContainerCode = ""; |
21 | 21 | ||
22 | /** 库位表状态 */ | 22 | /** 库位表状态 */ |
23 | - private String locationStatus; | 23 | + private String locationStatus = ""; |
24 | 24 | ||
25 | /** 托盘表容器编码 */ | 25 | /** 托盘表容器编码 */ |
26 | - private String containerContainerCode; | 26 | + private String containerContainerCode = ""; |
27 | 27 | ||
28 | /** 托盘表状态 */ | 28 | /** 托盘表状态 */ |
29 | - private String containerStatus; | 29 | + private String containerStatus = ""; |
30 | 30 | ||
31 | /** 库存表容器编码 */ | 31 | /** 库存表容器编码 */ |
32 | - private String inventoryContainerCode; | 32 | + private String inventoryContainerCode = ""; |
33 | 33 | ||
34 | /** 库存表状态 */ | 34 | /** 库存表状态 */ |
35 | - private String inventoryStatus; | 35 | + private String inventoryStatus = ""; |
36 | 36 | ||
37 | /** WCS库位容器编码 */ | 37 | /** WCS库位容器编码 */ |
38 | - private String wcsContainerCode; | 38 | + private String wcsContainerCode = ""; |
39 | 39 | ||
40 | /** WCS库位表状态 */ | 40 | /** WCS库位表状态 */ |
41 | - private String wcsLocationStatus; | 41 | + private String wcsLocationStatus = ""; |
42 | 42 | ||
43 | /** 数据状态 */ | 43 | /** 数据状态 */ |
44 | private Integer consistencyStatus = 1; | 44 | private Integer consistencyStatus = 1; |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/QueryCompareLocationDto.java
@@ -5,6 +5,9 @@ import lombok.Data; | @@ -5,6 +5,9 @@ import lombok.Data; | ||
5 | @Data | 5 | @Data |
6 | public class QueryCompareLocationDto { | 6 | public class QueryCompareLocationDto { |
7 | 7 | ||
8 | + /** 库区编码 */ | ||
9 | + private String zoneCode; | ||
10 | + | ||
8 | /** 仓库编码 */ | 11 | /** 仓库编码 */ |
9 | private String warehouseCode; | 12 | private String warehouseCode; |
10 | 13 |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java
@@ -4,6 +4,7 @@ import java.text.MessageFormat; | @@ -4,6 +4,7 @@ import java.text.MessageFormat; | ||
4 | import java.util.ArrayList; | 4 | import java.util.ArrayList; |
5 | import java.util.Collections; | 5 | import java.util.Collections; |
6 | import java.util.Comparator; | 6 | import java.util.Comparator; |
7 | +import java.util.Date; | ||
7 | import java.util.HashMap; | 8 | import java.util.HashMap; |
8 | import java.util.HashSet; | 9 | import java.util.HashSet; |
9 | import java.util.List; | 10 | import java.util.List; |
@@ -14,6 +15,7 @@ import java.util.stream.Collectors; | @@ -14,6 +15,7 @@ import java.util.stream.Collectors; | ||
14 | 15 | ||
15 | import javax.annotation.Resource; | 16 | import javax.annotation.Resource; |
16 | 17 | ||
18 | +import org.apache.commons.collections4.ListUtils; | ||
17 | import org.apache.shiro.util.CollectionUtils; | 19 | import org.apache.shiro.util.CollectionUtils; |
18 | import org.jeecg.common.api.vo.Result; | 20 | import org.jeecg.common.api.vo.Result; |
19 | import org.jeecg.common.exception.JeecgBootException; | 21 | import org.jeecg.common.exception.JeecgBootException; |
@@ -446,47 +448,53 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -446,47 +448,53 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
446 | 448 | ||
447 | @Override | 449 | @Override |
448 | public PageUtil<CompareLocationDto> compareWcsLocation(QueryCompareLocationDto queryCompareLocationDto) { | 450 | public PageUtil<CompareLocationDto> compareWcsLocation(QueryCompareLocationDto queryCompareLocationDto) { |
451 | + List<CompareLocationDto> compareLocationDtoList = new ArrayList<CompareLocationDto>(); | ||
452 | + if (StringUtils.isEmpty(queryCompareLocationDto.getZoneCode())) { | ||
453 | + return PageUtil.create(compareLocationDtoList, queryCompareLocationDto.getPageNo(), queryCompareLocationDto.getPageSize()); | ||
454 | + } | ||
449 | // 初始化数据 | 455 | // 初始化数据 |
450 | - Set<String> locationCodes = new HashSet<String>(); | 456 | + List<String> locationCodes = new ArrayList<String>(); |
451 | Map<String, Location> locationMap = new HashMap<String, Location>(); | 457 | Map<String, Location> locationMap = new HashMap<String, Location>(); |
452 | Map<String, List<Container>> containerMap = new HashMap<String, List<Container>>(); | 458 | Map<String, List<Container>> containerMap = new HashMap<String, List<Container>>(); |
453 | Map<String, List<InventoryDetail>> inventoryDetailMap = new HashMap<String, List<InventoryDetail>>(); | 459 | Map<String, List<InventoryDetail>> inventoryDetailMap = new HashMap<String, List<InventoryDetail>>(); |
454 | Map<String, List<WcsLocationDto>> wcsLocationMap = new HashMap<String, List<WcsLocationDto>>(); | 460 | Map<String, List<WcsLocationDto>> wcsLocationMap = new HashMap<String, List<WcsLocationDto>>(); |
455 | - | ||
456 | // 1.获取WMS库位表库位信息 | 461 | // 1.获取WMS库位表库位信息 |
457 | LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); | 462 | LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); |
458 | locationLambdaQueryWrapper.select(Location::getWarehouseCode, Location::getCode, Location::getContainerCode, Location::getStatus) | 463 | locationLambdaQueryWrapper.select(Location::getWarehouseCode, Location::getCode, Location::getContainerCode, Location::getStatus) |
459 | .eq(Location::getWarehouseCode, queryCompareLocationDto.getWarehouseCode()) | 464 | .eq(Location::getWarehouseCode, queryCompareLocationDto.getWarehouseCode()) |
465 | + .eq(StringUtils.isNotEmpty(queryCompareLocationDto.getZoneCode()), Location::getZoneCode, queryCompareLocationDto.getZoneCode()) | ||
460 | .eq(StringUtils.isNotEmpty(queryCompareLocationDto.getLocationCode()), Location::getCode, queryCompareLocationDto.getLocationCode()) | 466 | .eq(StringUtils.isNotEmpty(queryCompareLocationDto.getLocationCode()), Location::getCode, queryCompareLocationDto.getLocationCode()) |
461 | .eq(StringUtils.isNotEmpty(queryCompareLocationDto.getContainerCode()), Location::getContainerCode, queryCompareLocationDto.getContainerCode()); | 467 | .eq(StringUtils.isNotEmpty(queryCompareLocationDto.getContainerCode()), Location::getContainerCode, queryCompareLocationDto.getContainerCode()); |
462 | List<Location> locationList = list(locationLambdaQueryWrapper); | 468 | List<Location> locationList = list(locationLambdaQueryWrapper); |
463 | if (!CollectionUtils.isEmpty(locationList)) { | 469 | if (!CollectionUtils.isEmpty(locationList)) { |
464 | locationMap.putAll(locationList.stream().collect(Collectors.toMap(Location::getCode, Function.identity(), (key1, key2) -> key2))); | 470 | locationMap.putAll(locationList.stream().collect(Collectors.toMap(Location::getCode, Function.identity(), (key1, key2) -> key2))); |
465 | - locationCodes.addAll(locationList.stream().map(t -> t.getCode()).collect(Collectors.toSet())); | 471 | + locationCodes.addAll(locationList.stream().map(t -> t.getCode()).distinct().collect(Collectors.toSet())); |
466 | } | 472 | } |
467 | - | ||
468 | if (!CollectionUtils.isEmpty(locationCodes)) { | 473 | if (!CollectionUtils.isEmpty(locationCodes)) { |
469 | - // 2.获取WMS托盘表库位信息 | ||
470 | - LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
471 | - containerLambdaQueryWrapper.select(Container::getWarehouseCode, Container::getLocationCode, Container::getCode, Container::getStatus) | ||
472 | - .eq(Container::getWarehouseCode, queryCompareLocationDto.getWarehouseCode()).in(Container::getLocationCode, locationCodes); | ||
473 | - List<Container> containerList = containerService.list(containerLambdaQueryWrapper); | ||
474 | - if (!CollectionUtils.isEmpty(containerList)) { | ||
475 | - containerMap.putAll(containerList.stream().collect(Collectors.groupingBy(Container::getLocationCode))); | ||
476 | - } | ||
477 | - | ||
478 | - // 3.获取WMS库存表库位信息 | ||
479 | - LambdaQueryWrapper<InventoryDetail> inventoryDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
480 | - inventoryDetailLambdaQueryWrapper | ||
481 | - .select(InventoryDetail::getWarehouseCode, InventoryDetail::getLocationCode, InventoryDetail::getContainerCode, InventoryDetail::getInventoryStatus) | ||
482 | - .eq(InventoryDetail::getWarehouseCode, queryCompareLocationDto.getWarehouseCode()).in(InventoryDetail::getLocationCode, locationCodes); | ||
483 | - List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper); | ||
484 | - if (!CollectionUtils.isEmpty(inventoryDetailList)) { | ||
485 | - inventoryDetailMap.putAll(inventoryDetailList.stream().collect(Collectors.groupingBy(InventoryDetail::getLocationCode))); | 474 | + List<List<String>> partitionList = ListUtils.partition(locationCodes, 200); |
475 | + for (List<String> list : partitionList) { | ||
476 | + // 2.获取WMS托盘表库位信息 | ||
477 | + LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
478 | + containerLambdaQueryWrapper.select(Container::getWarehouseCode, Container::getLocationCode, Container::getCode, Container::getStatus) | ||
479 | + .eq(Container::getWarehouseCode, queryCompareLocationDto.getWarehouseCode()).in(Container::getLocationCode, list); | ||
480 | + List<Container> containerList = containerService.list(containerLambdaQueryWrapper); | ||
481 | + if (!CollectionUtils.isEmpty(containerList)) { | ||
482 | + containerMap.putAll(containerList.stream().collect(Collectors.groupingBy(Container::getLocationCode))); | ||
483 | + } | ||
484 | + // 3.获取WMS库存表库位信息 | ||
485 | + LambdaQueryWrapper<InventoryDetail> inventoryDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
486 | + inventoryDetailLambdaQueryWrapper | ||
487 | + .select(InventoryDetail::getWarehouseCode, InventoryDetail::getLocationCode, InventoryDetail::getContainerCode, | ||
488 | + InventoryDetail::getInventoryStatus) | ||
489 | + .eq(InventoryDetail::getWarehouseCode, queryCompareLocationDto.getWarehouseCode()).in(InventoryDetail::getLocationCode, list); | ||
490 | + List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper); | ||
491 | + if (!CollectionUtils.isEmpty(inventoryDetailList)) { | ||
492 | + inventoryDetailMap.putAll(inventoryDetailList.stream().collect(Collectors.groupingBy(InventoryDetail::getLocationCode))); | ||
493 | + } | ||
486 | } | 494 | } |
487 | - | ||
488 | // 4.获取WCS库位信息 | 495 | // 4.获取WCS库位信息 |
489 | - String url = addressService.getUrlByParam(QuantityConstant.ADDRESS_WCS_LOCATION_INFO); | 496 | + String url = addressService.getUrlByParam(QuantityConstant.ADDRESS_WCS_LOCATION_INFO, queryCompareLocationDto.getWarehouseCode(), |
497 | + queryCompareLocationDto.getZoneCode()); | ||
490 | Map<String, Object> queryParamMap = new HashMap<String, Object>(); | 498 | Map<String, Object> queryParamMap = new HashMap<String, Object>(); |
491 | if (StringUtils.isNotEmpty(queryCompareLocationDto.getWarehouseCode())) { | 499 | if (StringUtils.isNotEmpty(queryCompareLocationDto.getWarehouseCode())) { |
492 | queryParamMap.put("warehouseCode", queryCompareLocationDto.getWarehouseCode()); | 500 | queryParamMap.put("warehouseCode", queryCompareLocationDto.getWarehouseCode()); |
@@ -504,9 +512,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -504,9 +512,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
504 | } | 512 | } |
505 | } | 513 | } |
506 | } | 514 | } |
507 | - | ||
508 | // 对返回数据进行组装 | 515 | // 对返回数据进行组装 |
509 | - List<CompareLocationDto> compareLocationDtoList = new ArrayList<CompareLocationDto>(); | ||
510 | if (!CollectionUtils.isEmpty(locationCodes)) { | 516 | if (!CollectionUtils.isEmpty(locationCodes)) { |
511 | for (String locationCode : locationCodes) { | 517 | for (String locationCode : locationCodes) { |
512 | if (StringUtils.isEmpty(locationCode)) { | 518 | if (StringUtils.isEmpty(locationCode)) { |
@@ -524,7 +530,6 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -524,7 +530,6 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
524 | if (!CollectionUtils.isEmpty(containerGroupList)) { | 530 | if (!CollectionUtils.isEmpty(containerGroupList)) { |
525 | Set<String> containerCodes = containerGroupList.stream().map(t -> t.getCode()).collect(Collectors.toSet()); | 531 | Set<String> containerCodes = containerGroupList.stream().map(t -> t.getCode()).collect(Collectors.toSet()); |
526 | Set<String> containerStatus = containerGroupList.stream().map(t -> t.getStatus()).collect(Collectors.toSet()); | 532 | Set<String> containerStatus = containerGroupList.stream().map(t -> t.getStatus()).collect(Collectors.toSet()); |
527 | - | ||
528 | compareLocationDto.setContainerContainerCode(StringUtils.join(containerCodes, ",")); | 533 | compareLocationDto.setContainerContainerCode(StringUtils.join(containerCodes, ",")); |
529 | compareLocationDto.setContainerStatus(StringUtils.join(containerStatus, ",")); | 534 | compareLocationDto.setContainerStatus(StringUtils.join(containerStatus, ",")); |
530 | } | 535 | } |
@@ -545,10 +550,13 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -545,10 +550,13 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
545 | if (ObjectUtil.compare(compareLocationDto.getLocationContainerCode(), compareLocationDto.getContainerContainerCode()) != 0 | 550 | if (ObjectUtil.compare(compareLocationDto.getLocationContainerCode(), compareLocationDto.getContainerContainerCode()) != 0 |
546 | || ObjectUtil.compare(compareLocationDto.getLocationContainerCode(), compareLocationDto.getInventoryContainerCode()) != 0 | 551 | || ObjectUtil.compare(compareLocationDto.getLocationContainerCode(), compareLocationDto.getInventoryContainerCode()) != 0 |
547 | || ObjectUtil.compare(compareLocationDto.getLocationContainerCode(), compareLocationDto.getWcsContainerCode()) != 0 | 552 | || ObjectUtil.compare(compareLocationDto.getLocationContainerCode(), compareLocationDto.getWcsContainerCode()) != 0 |
548 | - || ObjectUtil.compare(compareLocationDto.getLocationStatus(), compareLocationDto.getContainerStatus()) != 0 | ||
549 | || ObjectUtil.compare(compareLocationDto.getLocationStatus(), compareLocationDto.getWcsLocationStatus()) != 0) { | 553 | || ObjectUtil.compare(compareLocationDto.getLocationStatus(), compareLocationDto.getWcsLocationStatus()) != 0) { |
550 | compareLocationDto.setConsistencyStatus(0); | 554 | compareLocationDto.setConsistencyStatus(0); |
551 | } | 555 | } |
556 | + if (!StringUtils.isEmpty(location.getContainerCode()) | ||
557 | + && ObjectUtil.compare(compareLocationDto.getLocationStatus(), compareLocationDto.getContainerStatus()) != 0) { | ||
558 | + compareLocationDto.setConsistencyStatus(0); | ||
559 | + } | ||
552 | compareLocationDtoList.add(compareLocationDto); | 560 | compareLocationDtoList.add(compareLocationDto); |
553 | } | 561 | } |
554 | if (queryCompareLocationDto.getConsistencyStatus() != null) { | 562 | if (queryCompareLocationDto.getConsistencyStatus() != null) { |
@@ -563,11 +571,11 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -563,11 +571,11 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
563 | @Override | 571 | @Override |
564 | public PageUtil<CompareLocationTaskDto> compareWcsLocationTask(QueryCompareLocationTaskDto queryCompareLocationTaskDto) { | 572 | public PageUtil<CompareLocationTaskDto> compareWcsLocationTask(QueryCompareLocationTaskDto queryCompareLocationTaskDto) { |
565 | List<CompareLocationTaskDto> finalCompareLocationTaskList = new ArrayList<CompareLocationTaskDto>(); | 573 | List<CompareLocationTaskDto> finalCompareLocationTaskList = new ArrayList<CompareLocationTaskDto>(); |
566 | -// if (queryCompareLocationTaskDto.getLocationCode() == null) { | ||
567 | -// return PageUtil.create(finalCompareLocationTaskList, queryCompareLocationTaskDto.getPageNo(), queryCompareLocationTaskDto.getPageSize()); | ||
568 | -// } | ||
569 | - // 只查询近90天的数据 | ||
570 | -// String queryCreateTime = DateUtil.format(DateUtil.offsetDay(new Date(), -90), DatePattern.NORM_DATE_PATTERN); | 574 | + if (StringUtils.isEmpty(queryCompareLocationTaskDto.getLocationCode())) { |
575 | + return PageUtil.create(finalCompareLocationTaskList, queryCompareLocationTaskDto.getPageNo(), queryCompareLocationTaskDto.getPageSize()); | ||
576 | + } | ||
577 | + // 只查询近180天的数据 | ||
578 | + String queryCreateTime = DateUtil.format(DateUtil.offsetDay(new Date(), -180), DatePattern.NORM_DATE_PATTERN); | ||
571 | // 1.获取WMS任务信息 | 579 | // 1.获取WMS任务信息 |
572 | LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | 580 | LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); |
573 | taskHeaderLambdaQueryWrapper | 581 | taskHeaderLambdaQueryWrapper |
@@ -577,15 +585,20 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -577,15 +585,20 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
577 | .gt(StringUtils.isNotEmpty(queryCompareLocationTaskDto.getTaskCreateTimeBegin()), TaskHeader::getCreateTime, | 585 | .gt(StringUtils.isNotEmpty(queryCompareLocationTaskDto.getTaskCreateTimeBegin()), TaskHeader::getCreateTime, |
578 | queryCompareLocationTaskDto.getTaskCreateTimeBegin()) | 586 | queryCompareLocationTaskDto.getTaskCreateTimeBegin()) |
579 | .lt(StringUtils.isNotEmpty(queryCompareLocationTaskDto.getTaskCreateTimeEnd()), TaskHeader::getCreateTime, | 587 | .lt(StringUtils.isNotEmpty(queryCompareLocationTaskDto.getTaskCreateTimeEnd()), TaskHeader::getCreateTime, |
580 | - queryCompareLocationTaskDto.getTaskCreateTimeEnd()); | ||
581 | -// .ge(TaskHeader::getCreateTime, queryCreateTime) | 588 | + queryCompareLocationTaskDto.getTaskCreateTimeEnd()) |
589 | + .ge(TaskHeader::getCreateTime, queryCreateTime); | ||
582 | if (StringUtils.isNotEmpty(queryCompareLocationTaskDto.getLocationCode())) { | 590 | if (StringUtils.isNotEmpty(queryCompareLocationTaskDto.getLocationCode())) { |
583 | taskHeaderLambdaQueryWrapper.and(t -> t.eq(TaskHeader::getFromLocationCode, queryCompareLocationTaskDto.getLocationCode()).or() | 591 | taskHeaderLambdaQueryWrapper.and(t -> t.eq(TaskHeader::getFromLocationCode, queryCompareLocationTaskDto.getLocationCode()).or() |
584 | .eq(TaskHeader::getToLocationCode, queryCompareLocationTaskDto.getLocationCode())); | 592 | .eq(TaskHeader::getToLocationCode, queryCompareLocationTaskDto.getLocationCode())); |
585 | } | 593 | } |
586 | List<TaskHeader> taskHeaderList = taskHeaderService.list(taskHeaderLambdaQueryWrapper); | 594 | List<TaskHeader> taskHeaderList = taskHeaderService.list(taskHeaderLambdaQueryWrapper); |
595 | + if (CollectionUtils.isEmpty(taskHeaderList)) { | ||
596 | + return PageUtil.create(finalCompareLocationTaskList, queryCompareLocationTaskDto.getPageNo(), queryCompareLocationTaskDto.getPageSize()); | ||
597 | + } | ||
587 | // 2.获取WCS任务信息 | 598 | // 2.获取WCS任务信息 |
588 | - String url = addressService.getUrlByParam(QuantityConstant.ADDRESS_WCS_TAKS_INFOS); | 599 | + Map<Integer, List<WcsTaskDto>> wcsTaskMap = new HashMap<Integer, List<WcsTaskDto>>(); |
600 | + String url = addressService.getUrlByParam(QuantityConstant.ADDRESS_WCS_TAKS_INFOS, queryCompareLocationTaskDto.getWarehouseCode(), | ||
601 | + taskHeaderList.get(0).getZoneCode()); | ||
589 | Map<String, Object> queryParamMap = new HashMap<String, Object>(); | 602 | Map<String, Object> queryParamMap = new HashMap<String, Object>(); |
590 | if (StringUtils.isNotEmpty(queryCompareLocationTaskDto.getWarehouseCode())) { | 603 | if (StringUtils.isNotEmpty(queryCompareLocationTaskDto.getWarehouseCode())) { |
591 | queryParamMap.put("warehouseCode", queryCompareLocationTaskDto.getWarehouseCode()); | 604 | queryParamMap.put("warehouseCode", queryCompareLocationTaskDto.getWarehouseCode()); |
@@ -599,18 +612,15 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -599,18 +612,15 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
599 | if (StringUtils.isNotEmpty(queryCompareLocationTaskDto.getTaskCreateTimeEnd())) { | 612 | if (StringUtils.isNotEmpty(queryCompareLocationTaskDto.getTaskCreateTimeEnd())) { |
600 | queryParamMap.put("end", queryCompareLocationTaskDto.getTaskCreateTimeEnd()); | 613 | queryParamMap.put("end", queryCompareLocationTaskDto.getTaskCreateTimeEnd()); |
601 | } | 614 | } |
602 | -// queryParamMap.put("begin", queryCreateTime); | 615 | + queryParamMap.put("begin", queryCreateTime); |
603 | String jsonStringResult = OkHttpUtils.sendPostByJsonStr(url, JSON.toJSONString(queryParamMap)); | 616 | String jsonStringResult = OkHttpUtils.sendPostByJsonStr(url, JSON.toJSONString(queryParamMap)); |
604 | WcsResultDto<List<WcsTaskDto>> wcsResult = JSON.parseObject(jsonStringResult, new TypeReference<WcsResultDto<List<WcsTaskDto>>>() {}); | 617 | WcsResultDto<List<WcsTaskDto>> wcsResult = JSON.parseObject(jsonStringResult, new TypeReference<WcsResultDto<List<WcsTaskDto>>>() {}); |
605 | - | ||
606 | - Map<Integer, List<WcsTaskDto>> wcsTaskMap = new HashMap<Integer, List<WcsTaskDto>>(); | ||
607 | if (wcsResult.getCode() != null && wcsResult.getCode().equals(200)) { | 618 | if (wcsResult.getCode() != null && wcsResult.getCode().equals(200)) { |
608 | List<WcsTaskDto> wcsTaskList = wcsResult.getData(); | 619 | List<WcsTaskDto> wcsTaskList = wcsResult.getData(); |
609 | if (wcsTaskList != null && wcsTaskList.size() > 0) { | 620 | if (wcsTaskList != null && wcsTaskList.size() > 0) { |
610 | wcsTaskMap.putAll(wcsTaskList.stream().collect(Collectors.groupingBy(WcsTaskDto::getTaskNo))); | 621 | wcsTaskMap.putAll(wcsTaskList.stream().collect(Collectors.groupingBy(WcsTaskDto::getTaskNo))); |
611 | } | 622 | } |
612 | } | 623 | } |
613 | - | ||
614 | // 对返回数据进行组装 | 624 | // 对返回数据进行组装 |
615 | List<CompareLocationTaskDto> wcsCompareLocationTaskList = new ArrayList<CompareLocationTaskDto>(); | 625 | List<CompareLocationTaskDto> wcsCompareLocationTaskList = new ArrayList<CompareLocationTaskDto>(); |
616 | if (!CollectionUtils.isEmpty(taskHeaderList)) { | 626 | if (!CollectionUtils.isEmpty(taskHeaderList)) { |