From 7bcbdc77bac5fef45a373f44da1bbe3e57efc24a Mon Sep 17 00:00:00 2001 From: "0.0" <1092404103.qq.com> Date: Tue, 19 Sep 2023 15:13:32 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E5=AF=BC=E5=87=BA=E6=95=B0?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/BasicdataGoodsAreaMapper.xml | 42 +++++++------------ .../impl/BasicdataGoodsAreaServiceImpl.java | 42 +++++++++++++++++-- .../WarehouseGoodsAllocationServiceImpl.java | 1 + .../WarehouseWarehousingEntryServiceImpl.java | 2 +- .../wrapper/WarehouseStockVOWrapper.java | 2 + 5 files changed, 56 insertions(+), 33 deletions(-) diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataGoodsAreaMapper.xml b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataGoodsAreaMapper.xml index 4843b1bd8..d4305e43b 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataGoodsAreaMapper.xml +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataGoodsAreaMapper.xml @@ -200,37 +200,23 @@ sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); </select> <select id="exportWarehouseByallocation" resultType="com.logpm.basicdata.excel.BasicdatavisualizationSheetTwo"> - SELECT positionInfo, - GROUP_CONCAT(DISTINCT firsts SEPARATOR '、') firsts, - GROUP_CONCAT(DISTINCT SECOND SEPARATOR '、') SECOND, - GROUP_CONCAT(DISTINCT thirdProduct SEPARATOR '、') thirdProduct, - GROUP_CONCAT(DISTINCT orderCode SEPARATOR '、') orderCode, - GROUP_CONCAT(DISTINCT materialName SEPARATOR '、') materialName, - SUM(num) num - FROM ( - SELECT lwug.position_code AS positionInfo, - CONCAT(ldpl.firsts, '(', SUM(lwug.num), ')') AS firsts, - CONCAT(ldpl.SECOND, '(', SUM(lwug.num), ')') AS SECOND, - CONCAT(ldpl.third_product, '(', SUM(lwug.num), ')') AS thirdProduct, - CONCAT(ldpl.order_code, '(', SUM(lwug.num), ')') AS orderCode, - CONCAT(ldpl.material_name, '(', SUM(lwug.num), ')') AS materialName, - SUM(lwug.num) AS num - FROM - logpm_warehouse_updown_goods lwug - JOIN logpm_distribution_parcel_list ldpl - ON lwug.association_id = ldpl.id + SELECT + lwug.position_code AS positionInfo, + GROUP_CONCAT(ldpl.firsts SEPARATOR '、') AS firsts, + GROUP_CONCAT(ldpl.SECOND SEPARATOR '、') AS SECOND, + GROUP_CONCAT(ldpl.third_product SEPARATOR '、') AS thirdProduct, + GROUP_CONCAT(ldpl.order_code SEPARATOR '、') AS orderCode, + GROUP_CONCAT(ldpl.material_name SEPARATOR '、') AS materialName, + SUM(lwug.num) AS num + FROM + logpm_warehouse_updown_goods lwug + JOIN + logpm_distribution_parcel_list ldpl ON lwug.association_id = ldpl.id <where> ldpl.warehouse_id =#{areaId} </where> - GROUP BY - lwug.position_code, - ldpl.firsts, - ldpl.SECOND, - ldpl.third_product, - ldpl.order_code, - ldpl.material_name - ) AS subquery - GROUP BY positionInfo + GROUP BY + lwug.position_code; </select> <select id="exportWarehouseByStrip" resultType="com.logpm.basicdata.excel.BasicdatavisualizationSheetThree"> SELECT diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataGoodsAreaServiceImpl.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataGoodsAreaServiceImpl.java index 434628e24..4b425c8b7 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataGoodsAreaServiceImpl.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataGoodsAreaServiceImpl.java @@ -24,6 +24,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.logpm.basicdata.entity.BasicdataGoodsAllocationEntity; import com.logpm.basicdata.entity.BasicdataGoodsAreaEntity; @@ -57,10 +58,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; @@ -327,6 +325,13 @@ public class BasicdataGoodsAreaServiceImpl extends BaseServiceImpl<BasicdataGood List<BasicdatavisualizationSheetOne> basicdatavisualizationSheetOnes = baseMapper.exportWarehouseByorderId(areaId); //sheetTwo List<BasicdatavisualizationSheetTwo> basicdatavisualizationSheetTwos = baseMapper.exportWarehouseByallocation(areaId); + basicdatavisualizationSheetTwos.forEach(e->{ + if (StringUtils.isNotBlank(e.getFirsts())){e.setFirsts(this.countUniqueProperties(e.getFirsts())); } + if (StringUtils.isNotBlank(e.getSecond())){e.setSecond(this.countUniqueProperties(e.getSecond()));} + if (StringUtils.isNotBlank(e.getThirdProduct())){e.setThirdProduct(this.countUniqueProperties(e.getThirdProduct()));} + if (StringUtils.isNotBlank(e.getOrderCode())){e.setOrderCode(this.countUniqueProperties(e.getOrderCode()));} + if (StringUtils.isNotBlank(e.getMaterialName())){e.setMaterialName(this.countUniqueProperties(e.getMaterialName()));} + }); //sheetThree List<BasicdatavisualizationSheetThree> basicdatavisualizationSheetThrees = baseMapper.exportWarehouseByStrip(areaId); //转换上架人 @@ -364,4 +369,33 @@ public class BasicdataGoodsAreaServiceImpl extends BaseServiceImpl<BasicdataGood //return warehouseGoodsAreaList; } + + public String countUniqueProperties(String initial){ + + // 对字段进行按逗号分割后的属性去重,并拼接去重后的数量 + String[] propertyArray = initial.split("、"); + List<String> uniqueProperties = new ArrayList<>(); + HashMap<String, Integer> propertyCounts = new HashMap<>(); + + for (String prop : propertyArray) { + String trimmedProp = prop.trim(); + if (!uniqueProperties.contains(trimmedProp)) { + uniqueProperties.add(trimmedProp); + } + propertyCounts.put(trimmedProp, propertyCounts.getOrDefault(trimmedProp, 0) + 1); + } + + StringBuilder resultBuilder = new StringBuilder(); + for (String prop : uniqueProperties) { + int propCount = propertyCounts.get(prop); + if (resultBuilder.length() > 0) { + resultBuilder.append("、"); + } + resultBuilder.append(prop).append(" (").append(propCount).append(")"); + } + + return resultBuilder.toString(); + + } + } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseGoodsAllocationServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseGoodsAllocationServiceImpl.java index 0f529aa04..0654dd1fa 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseGoodsAllocationServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseGoodsAllocationServiceImpl.java @@ -107,6 +107,7 @@ public class WarehouseGoodsAllocationServiceImpl extends BaseServiceImpl<Warehou // map.put(layerNum, new ArrayList<>()); // } WarehouseGoodsAllocationVO warehouseGoodsAllocationVO = this.convert(warehouseGoodsAllocationEntity); + log.info("List>>>>>>>>>>>>>>>>>{}",warehouseGoodsAllocationVO); // map.get(layerNum).add(warehouseGoodsAllocationVO); warehouseGoodsAllocationVOS.add(warehouseGoodsAllocationVO); } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWarehousingEntryServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWarehousingEntryServiceImpl.java index f6f0b554f..11d9ed2a6 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWarehousingEntryServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWarehousingEntryServiceImpl.java @@ -110,7 +110,7 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl<Wareho List<Long> detailEntityList = new ArrayList<>(); List<WarehouseWarehousingDetailEntity> list1 = warehouseWarehousingDetailService.list(Wrappers.<WarehouseWarehousingDetailEntity>query().lambda() .eq(WarehouseWarehousingDetailEntity::getWarehousingEntryId, warehouseWarehousingEntry.getId()) - .apply("conditions in ( 1,2) ") + .apply("conditions in (1,2) ") );//查询不是确定的数据 if(list1.size() > 0){ AtomicReference<Integer> num = new AtomicReference<>(0); diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/wrapper/WarehouseStockVOWrapper.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/wrapper/WarehouseStockVOWrapper.java index 2c3e3043d..18d97eb56 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/wrapper/WarehouseStockVOWrapper.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/wrapper/WarehouseStockVOWrapper.java @@ -42,7 +42,9 @@ public class WarehouseStockVOWrapper extends BaseEntityWrapper<WarehouseScanReco @Override public WarehouseScanRecordVO entityVO(WarehouseScanRecordVO WarehouseStock) { + if (null != WarehouseStock.getOperatorId() && 0 !=WarehouseStock.getOperatorId()){ WarehouseStock.setOperatorName(userCliient.userInfoById(WarehouseStock.getOperatorId()).getData().getName()); + } WarehouseStock.setOrderPackageStatusName(DictBizCache.getValue(DictBizConstant.ORDER_PACKAGE_STATUS, WarehouseStock.getOrderPackageStatus())); WarehouseStock.setOrderPackageFreezeStatusName(DictBizCache.getValue(DictBizConstant.ORDER_PACKAGE_FREEZE_STATUS, WarehouseStock.getOrderPackageFreezeStatus())); WarehouseStock.setOrderPackageGroundingStatusName(DictBizCache.getValue(DictBizConstant.ORDER_PACKAGE_GROUNDING_STATUS, WarehouseStock.getOrderPackageGroundingStatus()));