From 98b459aeb7019b6ff534f09ef68e5fbb7676b15b Mon Sep 17 00:00:00 2001 From: TanYibin <5491541@qq.com> Date: Sat, 24 Jun 2023 18:24:17 +0800 Subject: [PATCH] 库位监控问题及性能优化 --- ant-design-vue-jeecg/src/views/system/compare/CompareWcsLocation.vue | 28 ++++++++++++++-------------- ant-design-vue-jeecg/src/views/system/config/ContainerList.vue | 28 ++++++++++++++-------------- huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++-------------------- 3 files changed, 79 insertions(+), 48 deletions(-) diff --git a/ant-design-vue-jeecg/src/views/system/compare/CompareWcsLocation.vue b/ant-design-vue-jeecg/src/views/system/compare/CompareWcsLocation.vue index 5d7fe77..0a5d48b 100644 --- a/ant-design-vue-jeecg/src/views/system/compare/CompareWcsLocation.vue +++ b/ant-design-vue-jeecg/src/views/system/compare/CompareWcsLocation.vue @@ -129,6 +129,20 @@ export default { dataIndex: 'locationCode' }, { + title: '库位表状态', + align: 'center', + dataIndex: 'locationStatus', + key: 'locationStatus', + scopedSlots: { customRender: 'locationStatus' } + }, + { + title: 'WCS库位表状态', + align: 'center', + dataIndex: 'wcsLocationStatus', + key: 'wcsLocationStatus', + scopedSlots: { customRender: 'wcsLocationStatus' } + }, + { title: '库位表容器编码', align: 'center', dataIndex: 'locationContainerCode' @@ -149,13 +163,6 @@ export default { dataIndex: 'wcsContainerCode' }, { - title: '库位表状态', - align: 'center', - dataIndex: 'locationStatus', - key: 'locationStatus', - scopedSlots: { customRender: 'locationStatus' } - }, - { title: '托盘表状态', align: 'center', dataIndex: 'containerStatus', @@ -163,13 +170,6 @@ export default { scopedSlots: { customRender: 'containerStatus' } }, { - title: 'WCS库位表状态', - align: 'center', - dataIndex: 'wcsLocationStatus', - key: 'wcsLocationStatus', - scopedSlots: { customRender: 'wcsLocationStatus' } - }, - { title: '数据状态', align: 'center', dataIndex: 'consistencyStatus', diff --git a/ant-design-vue-jeecg/src/views/system/config/ContainerList.vue b/ant-design-vue-jeecg/src/views/system/config/ContainerList.vue index c7a21ec..c247fbc 100644 --- a/ant-design-vue-jeecg/src/views/system/config/ContainerList.vue +++ b/ant-design-vue-jeecg/src/views/system/config/ContainerList.vue @@ -14,22 +14,22 @@ <a-input placeholder="请输入库位编码" v-model="queryParam.locationCode"></a-input> </a-form-item> </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="容器类型"> + <a-select + show-search + placeholder="请选择容器类型" + option-filter-prop="children" + v-model="queryParam.containerTypeCode" + > + <a-select-option v-for="item in containerTypeList" :key="item.name" :value="item.code" + >{{ item.name }} + </a-select-option> + </a-select> + </a-form-item> + </a-col> <template v-if="toggleSearchStatus"> <a-col :xl="6" :lg="7" :md="8" :sm="24"> - <a-form-item label="容器类型"> - <a-select - show-search - placeholder="请选择容器类型" - option-filter-prop="children" - v-model="queryParam.containerTypeCode" - > - <a-select-option v-for="item in containerTypeList" :key="item.name" :value="item.code" - >{{ item.name }} - </a-select-option> - </a-select> - </a-form-item> - </a-col> - <a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-form-item label="容器状态"> <j-dict-select-tag placeholder="请选择容器状态" diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java index e40ad7f..e6e2aef 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java @@ -6,7 +6,6 @@ import java.util.Collections; import java.util.Comparator; import java.util.Date; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -94,7 +93,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i @Resource private IInventoryDetailService inventoryDetailService; - + @Autowired private ILocationService locationService; @@ -471,7 +470,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i locationCodes.addAll(locationList.stream().map(t -> t.getCode()).distinct().collect(Collectors.toSet())); } if (!CollectionUtils.isEmpty(locationCodes)) { - List<List<String>> partitionList = ListUtils.partition(locationCodes, 200); + List<List<String>> partitionList = ListUtils.partition(locationCodes, 1000); for (List<String> list : partitionList) { // 2.获取WMS托盘表库位信息 LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); @@ -484,8 +483,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i // 3.获取WMS库存表库位信息 LambdaQueryWrapper<InventoryDetail> inventoryDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); inventoryDetailLambdaQueryWrapper - .select(InventoryDetail::getWarehouseCode, InventoryDetail::getLocationCode, InventoryDetail::getContainerCode, - InventoryDetail::getInventoryStatus) + .select(InventoryDetail::getWarehouseCode, InventoryDetail::getLocationCode, InventoryDetail::getContainerCode) .eq(InventoryDetail::getWarehouseCode, queryCompareLocationDto.getWarehouseCode()).in(InventoryDetail::getLocationCode, list); List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper); if (!CollectionUtils.isEmpty(inventoryDetailList)) { @@ -536,9 +534,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i List<InventoryDetail> inventoryGroupList = inventoryDetailMap.get(locationCode); if (!CollectionUtils.isEmpty(inventoryGroupList)) { Set<String> inventoryContainerCodes = inventoryGroupList.stream().map(t -> t.getContainerCode()).collect(Collectors.toSet()); - Set<String> inventoryStatus = inventoryGroupList.stream().map(t -> t.getInventoryStatus()).collect(Collectors.toSet()); compareLocationDto.setInventoryContainerCode(StringUtils.join(inventoryContainerCodes, ",")); - compareLocationDto.setInventoryStatus(StringUtils.join(inventoryStatus, ",")); } List<WcsLocationDto> wcsLocationGroupList = wcsLocationMap.get(locationCode); if (!CollectionUtils.isEmpty(wcsLocationGroupList)) { @@ -547,15 +543,32 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i compareLocationDto.setWcsContainerCode(StringUtils.join(wcsContainerCodes, ",")); compareLocationDto.setWcsLocationStatus(StringUtils.join(wcsContainerStatus, ",")); } - if (ObjectUtil.compare(compareLocationDto.getLocationContainerCode(), compareLocationDto.getContainerContainerCode()) != 0 - || ObjectUtil.compare(compareLocationDto.getLocationContainerCode(), compareLocationDto.getInventoryContainerCode()) != 0 - || ObjectUtil.compare(compareLocationDto.getLocationContainerCode(), compareLocationDto.getWcsContainerCode()) != 0 - || ObjectUtil.compare(compareLocationDto.getLocationStatus(), compareLocationDto.getWcsLocationStatus()) != 0) { - compareLocationDto.setConsistencyStatus(0); + // 值不为null时 ,才比较数据是否匹配 + if (!StringUtils.isEmpty(compareLocationDto.getLocationContainerCode()) || !StringUtils.isEmpty(compareLocationDto.getContainerContainerCode())) { + if (ObjectUtil.compare(compareLocationDto.getLocationContainerCode(), compareLocationDto.getContainerContainerCode()) != 0) { + compareLocationDto.setConsistencyStatus(0); + } + } + // 库存表有库存信息时才比较库存表容器信息 + if (!StringUtils.isEmpty(compareLocationDto.getLocationContainerCode()) && !StringUtils.isEmpty(compareLocationDto.getInventoryContainerCode())) { + if (ObjectUtil.compare(compareLocationDto.getLocationContainerCode(), compareLocationDto.getInventoryContainerCode()) != 0) { + compareLocationDto.setConsistencyStatus(0); + } + } + if (!StringUtils.isEmpty(compareLocationDto.getLocationContainerCode()) || !StringUtils.isEmpty(compareLocationDto.getWcsContainerCode())) { + if (ObjectUtil.compare(compareLocationDto.getLocationContainerCode(), compareLocationDto.getWcsContainerCode()) != 0) { + compareLocationDto.setConsistencyStatus(0); + } + } + if (!StringUtils.isEmpty(compareLocationDto.getLocationStatus()) || !StringUtils.isEmpty(compareLocationDto.getWcsLocationStatus())) { + if (ObjectUtil.compare(compareLocationDto.getLocationStatus(), compareLocationDto.getWcsLocationStatus()) != 0) { + compareLocationDto.setConsistencyStatus(0); + } } - if (!StringUtils.isEmpty(location.getContainerCode()) - && ObjectUtil.compare(compareLocationDto.getLocationStatus(), compareLocationDto.getContainerStatus()) != 0) { - compareLocationDto.setConsistencyStatus(0); + if (!StringUtils.isEmpty(location.getContainerCode())) { + if (ObjectUtil.compare(compareLocationDto.getLocationStatus(), compareLocationDto.getContainerStatus()) != 0) { + compareLocationDto.setConsistencyStatus(0); + } } compareLocationDtoList.add(compareLocationDto); } @@ -650,11 +663,29 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i compareLocationTaskDto.setWcsContainerCode(wcsTaskDto.getContainerCode()); compareLocationTaskDto.setWcsTaskStatus(wcsTaskDto.getTaskStatus()); compareLocationTaskDto.setWcsTaskCreateTime(wcsTaskDto.getCreated()); - if (ObjectUtil.compare(compareLocationTaskDto.getFromLocationCode(), compareLocationTaskDto.getWcsFromLocationCode()) != 0 - || ObjectUtil.compare(compareLocationTaskDto.getToLocationCode(), compareLocationTaskDto.getWcsToLocationCode()) != 0 - || ObjectUtil.compare(compareLocationTaskDto.getContainerCode(), compareLocationTaskDto.getWcsContainerCode()) != 0 - || ObjectUtil.compare(compareLocationTaskDto.getTaskStatus(), compareLocationTaskDto.getWcsTaskStatus()) != 0) { - compareLocationTaskDto.setConsistencyStatus(0); + // 值不为null时 ,才比较数据是否匹配 + if (!StringUtils.isEmpty(compareLocationTaskDto.getFromLocationCode()) + || !StringUtils.isEmpty(compareLocationTaskDto.getWcsFromLocationCode())) { + if (ObjectUtil.compare(compareLocationTaskDto.getFromLocationCode(), compareLocationTaskDto.getWcsFromLocationCode()) != 0) { + compareLocationTaskDto.setConsistencyStatus(0); + } + } + if (!StringUtils.isEmpty(compareLocationTaskDto.getToLocationCode()) + || !StringUtils.isEmpty(compareLocationTaskDto.getWcsToLocationCode())) { + if (ObjectUtil.compare(compareLocationTaskDto.getToLocationCode(), compareLocationTaskDto.getWcsToLocationCode()) != 0) { + compareLocationTaskDto.setConsistencyStatus(0); + } + } + if (!StringUtils.isEmpty(compareLocationTaskDto.getContainerCode()) || !StringUtils.isEmpty(compareLocationTaskDto.getWcsContainerCode())) { + if (ObjectUtil.compare(compareLocationTaskDto.getContainerCode(), compareLocationTaskDto.getWcsContainerCode()) != 0) { + compareLocationTaskDto.setConsistencyStatus(0); + } + } + if (!StringUtils.isEmpty(compareLocationTaskDto.getTaskStatus() + "") + || !StringUtils.isEmpty(compareLocationTaskDto.getWcsTaskStatus() + "")) { + if (ObjectUtil.compare(compareLocationTaskDto.getTaskStatus(), compareLocationTaskDto.getWcsTaskStatus()) != 0) { + compareLocationTaskDto.setConsistencyStatus(0); + } } wcsCompareLocationTaskList.add(compareLocationTaskDto); } -- libgit2 0.22.2