diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java index 9e6e43a4b..4770ad406 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java @@ -7449,7 +7449,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImplupdate().lambda() + .eq(DistributionSignforEntity::getReservationId,reservationList.get(0).getId()) + .eq(DistributionSignforEntity::getDeliveryId,deliveryListEntity.getId()) + .set(DistributionSignforEntity::getIsHaveAbnormalPackage,2) + ); } } else { log.error("一个车次内存在两个同样客户"); diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/controller/WarehouseIndexController.java b/blade-service/logpm-report/src/main/java/com/logpm/report/controller/WarehouseIndexController.java index 373fe9eb4..ba0cd4c10 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/controller/WarehouseIndexController.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/controller/WarehouseIndexController.java @@ -6,6 +6,7 @@ import com.logpm.basicdata.feign.IBasicdataWarehouseClient; import com.logpm.report.dto.IndexDTO; import com.logpm.report.service.IWarehouseIndexService; import com.logpm.report.vo.*; +import com.logpm.report.vo.indexCount.IndexDeliveryDataVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; @@ -17,6 +18,7 @@ import org.springframework.web.bind.annotation.*; import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; @Log4j2 @RestController @@ -282,18 +284,19 @@ public class WarehouseIndexController { //当前登录人选择的仓库 BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); if(Objects.isNull(myCurrentWarehouse)){ - List myWatchWarehouse = warehouseClient.getMyWatchWarehouse(); - myWatchWarehouse.forEach(warehouseEntity -> { - warehouseIds.add(warehouseEntity.getId()); - }); + List myWatchWarehouse = warehouseClient.getMyWarehouseList(); + if (myWatchWarehouse.isEmpty()) { + warehouseIds = myWatchWarehouse.stream().map(BasicdataWarehouseEntity::getId).collect(Collectors.toList()); + } + }else{ warehouseIds.add(myCurrentWarehouse.getId()); } indexDTO.setWarehouseIds(warehouseIds); //查询订制品打托列表 - IndexUnloadAbnormalDataVO indexUnloadAbnormalDataVO = warehouseIndexService.unloadAbnormalData(indexDTO); - return R.data(indexUnloadAbnormalDataVO); + List indexDeliveryDataVO = warehouseIndexService.deliveryData(indexDTO); + return R.data(indexDeliveryDataVO); }catch (CustomerException e){ log.warn(e.message); return R.fail(e.code,e.message); diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/WarehouseIndexMapper.java b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/WarehouseIndexMapper.java index c545ce4b5..d9a5c34ac 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/WarehouseIndexMapper.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/WarehouseIndexMapper.java @@ -4,10 +4,13 @@ import com.alibaba.fastjson.JSONObject; import com.logpm.report.dto.IndexDTO; import com.logpm.report.vo.IndexHandOrderDataVO; import com.logpm.report.vo.IndexTrunklineCarsDataVO; +import com.logpm.report.vo.indexCount.IndexDeliveryDataVO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.math.BigDecimal; +import java.util.List; +import java.util.Map; @Mapper public interface WarehouseIndexMapper { @@ -39,4 +42,100 @@ public interface WarehouseIndexMapper { JSONObject findAbnormalData(@Param("param") IndexDTO indexDTO); Integer findUnloadNum(@Param("param") IndexDTO indexDTO); + + /** + * 查询商、市配的当前配送总数据 + * @param indexDTO + * @return + */ + List findDeliveryTotal(@Param("param")IndexDTO indexDTO); + + /** + * 查询自提当前配送总信息 + * @param indexDTO + * @return + */ + IndexDeliveryDataVO findBillLadingTotal(@Param("param")IndexDTO indexDTO); + + /** + * 查询配送信息 + * @param type + * @param indexDTO + * @return + */ + Integer findDeLiveryTotalNum(@Param("param") IndexDTO indexDTO,@Param("type")String type); + + /** + * 查询当前配送总重量 + * @param indexDTO + * @param type + * @return + */ + BigDecimal findDeliveryTotalWeight(@Param("param")IndexDTO indexDTO, @Param("type")String type); + + /** + * 查询当前配送总体积 + * @param indexDTO + * @param type + * @return + */ + BigDecimal findDeliveryTotalVolume(@Param("param")IndexDTO indexDTO, @Param("type") String type); + + /** + * 查询当前配送总重量 + * @param indexDTO + * @param type + * @return + */ + Integer findDeLiveryTotalRoadNum(@Param("param")IndexDTO indexDTO,@Param("type") String type); + + /** + * 查询自提总件数 + * @return + */ + Integer findBillLadingTotalNum(@Param("param")IndexDTO indexDTO); + + /** + * 查询自提包件总重量 + * @param indexDTO + * @return + */ + BigDecimal findBillLadingTotalWeight(@Param("param")IndexDTO indexDTO); + + /** + * 查询自提包件总体积 + * @param indexDTO + * @return + */ + BigDecimal findBillLadingTotalVolume(@Param("param")IndexDTO indexDTO); + + + /** + * 查询三方配送信息 + * @param indexDTO + * @return + */ + IndexDeliveryDataVO findTripartiteTotal(@Param("param")IndexDTO indexDTO); + + /** + * 查询三方总件数 + * @param indexDTO + * @return + */ + Integer findTripartiteTotalNum(@Param("param")IndexDTO indexDTO); + + /** + * 查询三方总重量 + * @param indexDTO + * @return + */ + BigDecimal findTripartiteTotalWeight(@Param("param")IndexDTO indexDTO); + + /** + * 查询三方配送总体积 + * @param indexDTO + * @return + */ + BigDecimal findTripartiteTotalVolume(@Param("param")IndexDTO indexDTO); + } diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/WarehouseIndexMapper.xml b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/WarehouseIndexMapper.xml index 48588e078..6dd226b2c 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/WarehouseIndexMapper.xml +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/WarehouseIndexMapper.xml @@ -31,11 +31,11 @@ select IFNULL(sum(hand_quantity),0) totalNum, - IFNULL(SUM(IF(is_zero=1,hand_quantity,0)),0) zeroNum, - IFNULL(SUM(IF(type_service='1',hand_quantity,0)),0) mallNum, - IFNULL(SUM(IF(type_service='2',hand_quantity,0)),0) cityNum, - IFNULL(SUM(IF(type_service='3',hand_quantity,0)),0) billNum, - IFNULL(SUM(IF(type_service='4',hand_quantity,0)),0) thirdTransferNum + IFNULL(SUM(IF(is_zero=1,hand_quantity,0)),0) zeroNum, + IFNULL(SUM(IF(type_service='1',hand_quantity,0)),0) mallNum, + IFNULL(SUM(IF(type_service='2',hand_quantity,0)),0) cityNum, + IFNULL(SUM(IF(type_service='3',hand_quantity,0)),0) billNum, + IFNULL(SUM(IF(type_service='4',hand_quantity,0)),0) thirdTransferNum from logpm_distribution_stock_article WHERE 1=1 and warehouse_id in @@ -121,12 +121,13 @@ select IFNULL(count(distinct lww.waybill_no),0) waybillNum, - IFNULL(sum(ldsa.hand_quantity),0) handleNum, - 0 handleWeight, - 0 handleVolume + IFNULL(sum(ldsa.hand_quantity),0) handleNum, + 0 handleWeight, + 0 handleVolume from logpm_distribution_stock_article ldsa - left join logpm_warehouse_waybill lww on lww.departure_warehouse_id = ldsa.warehouse_id and lww.waybill_no = ldsa.order_code + left join logpm_warehouse_waybill lww on lww.departure_warehouse_id = ldsa.warehouse_id and lww.waybill_no = + ldsa.order_code where 1=1 and ldsa.hand_quantity > 0 and ldsa.is_zero = 1 @@ -154,9 +156,9 @@ select IFNULL(count(id),0) sendNum, - IFNULL(sum(abnormal_status),0) dealNum + IFNULL(sum(abnormal_status),0) dealNum from logpm_aftersales_abnormal_record where 1=1 and create_time >= #{param.startDate} - + and create_time <= #{param.endDate} - + and warehouse_id in #{item} @@ -192,13 +194,265 @@ and unload_date >= #{param.startDate} - + and unload_date <= #{param.endDate} - + and node_id in #{item} + + + + + + + + + + + + + diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/IWarehouseIndexService.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/IWarehouseIndexService.java index 775bc2128..1cc196c31 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/service/IWarehouseIndexService.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/IWarehouseIndexService.java @@ -2,6 +2,9 @@ package com.logpm.report.service; import com.logpm.report.dto.IndexDTO; import com.logpm.report.vo.*; +import com.logpm.report.vo.indexCount.IndexDeliveryDataVO; + +import java.util.List; public interface IWarehouseIndexService { IndexOpenOrderDataVO openOrderData(IndexDTO indexDTO); @@ -18,4 +21,10 @@ public interface IWarehouseIndexService { IndexUnloadAbnormalDataVO unloadAbnormalData(IndexDTO indexDTO); + /** + * 查询首页配送数据 + * @param indexDTO + * @return + */ + List deliveryData(IndexDTO indexDTO); } diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/WarehouseIndexServiceImpl.java b/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/WarehouseIndexServiceImpl.java index a245ffb37..f6e772f41 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/WarehouseIndexServiceImpl.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/service/impl/WarehouseIndexServiceImpl.java @@ -5,15 +5,16 @@ import com.logpm.report.dto.IndexDTO; import com.logpm.report.mapper.WarehouseIndexMapper; import com.logpm.report.service.IWarehouseIndexService; import com.logpm.report.vo.*; +import com.logpm.report.vo.indexCount.IndexDeliveryDataVO; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springblade.common.constant.DistributionTypeConstant; import org.springblade.common.utils.CommonUtil; +import org.springblade.core.tool.utils.Func; import org.springframework.stereotype.Service; import java.math.BigDecimal; -import java.util.Calendar; -import java.util.Date; -import java.util.List; +import java.util.*; @Slf4j @Service @@ -26,7 +27,7 @@ public class WarehouseIndexServiceImpl implements IWarehouseIndexService { public IndexOpenOrderDataVO openOrderData(IndexDTO indexDTO) { List warehouseIds = indexDTO.getWarehouseIds(); IndexOpenOrderDataVO indexOpenOrderDataVO = new IndexOpenOrderDataVO(); - if(warehouseIds.isEmpty()){ + if (warehouseIds.isEmpty()) { return indexOpenOrderDataVO; } @@ -76,7 +77,7 @@ public class WarehouseIndexServiceImpl implements IWarehouseIndexService { public IndexOpenOrderIncomeVO openOrderIncome(IndexDTO indexDTO) { List warehouseIds = indexDTO.getWarehouseIds(); IndexOpenOrderIncomeVO indexOpenOrderIncomeVO = new IndexOpenOrderIncomeVO(); - if(warehouseIds.isEmpty()){ + if (warehouseIds.isEmpty()) { return indexOpenOrderIncomeVO; } //总收入 @@ -109,7 +110,7 @@ public class WarehouseIndexServiceImpl implements IWarehouseIndexService { public IndexHandOrderDataVO handOrderData(IndexDTO indexDTO) { List warehouseIds = indexDTO.getWarehouseIds(); IndexHandOrderDataVO indexHandOrderDataVO = new IndexHandOrderDataVO(); - if(warehouseIds.isEmpty()){ + if (warehouseIds.isEmpty()) { return indexHandOrderDataVO; } //当前在库的数据 订制品 零担 @@ -129,7 +130,7 @@ public class WarehouseIndexServiceImpl implements IWarehouseIndexService { public IndexAllocationDataVO allocationData(IndexDTO indexDTO) { List warehouseIds = indexDTO.getWarehouseIds(); IndexAllocationDataVO indexAllocationDataVO = new IndexAllocationDataVO(); - if(warehouseIds.isEmpty()){ + if (warehouseIds.isEmpty()) { return indexAllocationDataVO; } //当前在库的数据 订制品 零担 @@ -149,7 +150,7 @@ public class WarehouseIndexServiceImpl implements IWarehouseIndexService { indexAllocationDataVO.setUseNum(useAllocationNum); indexAllocationDataVO.setNullNum(totalAllocationNum - useAllocationNum); indexAllocationDataVO.setUpshelfNum(upshelfNum); - indexAllocationDataVO.setNoUpshelfNum(totalNum-upshelfNum); + indexAllocationDataVO.setNoUpshelfNum(totalNum - upshelfNum); return indexAllocationDataVO; } @@ -158,7 +159,7 @@ public class WarehouseIndexServiceImpl implements IWarehouseIndexService { public IndexTrunklineHandOrderDataVO trunklineHandOrderData(IndexDTO indexDTO) { List warehouseIds = indexDTO.getWarehouseIds(); IndexTrunklineHandOrderDataVO indexTrunklineHandOrderDataVO = new IndexTrunklineHandOrderDataVO(); - if(warehouseIds.isEmpty()){ + if (warehouseIds.isEmpty()) { return indexTrunklineHandOrderDataVO; } @@ -187,7 +188,7 @@ public class WarehouseIndexServiceImpl implements IWarehouseIndexService { public IndexTrunklineCarsDataVO trunklineCarsData(IndexDTO indexDTO) { List warehouseIds = indexDTO.getWarehouseIds(); IndexTrunklineCarsDataVO indexTrunklineCarsDataVO = new IndexTrunklineCarsDataVO(); - if(warehouseIds.isEmpty()){ + if (warehouseIds.isEmpty()) { return indexTrunklineCarsDataVO; } @@ -200,7 +201,7 @@ public class WarehouseIndexServiceImpl implements IWarehouseIndexService { public IndexUnloadAbnormalDataVO unloadAbnormalData(IndexDTO indexDTO) { List warehouseIds = indexDTO.getWarehouseIds(); IndexUnloadAbnormalDataVO indexUnloadAbnormalDataVO = new IndexUnloadAbnormalDataVO(); - if(warehouseIds.isEmpty()){ + if (warehouseIds.isEmpty()) { return indexUnloadAbnormalDataVO; } @@ -214,7 +215,7 @@ public class WarehouseIndexServiceImpl implements IWarehouseIndexService { indexUnloadAbnormalDataVO.setNoDealDayNum(sendDayNum - dealDayNum); indexUnloadAbnormalDataVO.setUnloadDayNum(unloadDayNum); BigDecimal dayRate = BigDecimal.ZERO; - if(!unloadDayNum.equals(0)){ + if (!unloadDayNum.equals(0)) { dayRate = new BigDecimal(sendDayNum).divide(new BigDecimal(unloadDayNum), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)); } indexUnloadAbnormalDataVO.setAbnormalDayRate(dayRate); @@ -229,11 +230,66 @@ public class WarehouseIndexServiceImpl implements IWarehouseIndexService { indexUnloadAbnormalDataVO.setNoDealMonthNum(sendMonthNum - dealMonthNum); indexUnloadAbnormalDataVO.setUnloadMonthNum(unloadMonthNum); BigDecimal monthRate = BigDecimal.ZERO; - if(!unloadMonthNum.equals(0)){ - monthRate = new BigDecimal(sendMonthNum).divide(new BigDecimal(unloadMonthNum),4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)); + if (!unloadMonthNum.equals(0)) { + monthRate = new BigDecimal(sendMonthNum).divide(new BigDecimal(unloadMonthNum), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)); } indexUnloadAbnormalDataVO.setAbnormalMonthRate(monthRate); return indexUnloadAbnormalDataVO; } + + @Override + public List deliveryData(IndexDTO indexDTO) { + //查询商市配的信息 + List indexDeliveryDataVOList = new ArrayList<>(); + List indexDeliveryDataVOS = warehouseIndexMapper.findDeliveryTotal(indexDTO); + if (!indexDeliveryDataVOS.isEmpty()) { + for (IndexDeliveryDataVO indexDeliveryDataVO : indexDeliveryDataVOS) { + //总包件数量 + Integer deLiveryTotalNum = warehouseIndexMapper.findDeLiveryTotalNum(indexDTO, indexDeliveryDataVO.getType()); + indexDeliveryDataVO.setTotalDeliveryNum(deLiveryTotalNum); + //查询总重量 + BigDecimal totalWeight = warehouseIndexMapper.findDeliveryTotalWeight(indexDTO,indexDeliveryDataVO.getType()); + indexDeliveryDataVO.setTotalWeight(totalWeight); + //查询总包件体积 + BigDecimal totalVolume = warehouseIndexMapper.findDeliveryTotalVolume(indexDTO,indexDeliveryDataVO.getType()); + indexDeliveryDataVO.setTotalVolume(totalVolume); + //查询在途件数 + Integer totalRoadNum = warehouseIndexMapper.findDeLiveryTotalRoadNum(indexDTO, indexDeliveryDataVO.getType()); + indexDeliveryDataVO.setTotalRoadNum(totalRoadNum); + } + indexDeliveryDataVOList.addAll(indexDeliveryDataVOS); + } + + //查询自提信息 + IndexDeliveryDataVO indexDeliveryDataVO = warehouseIndexMapper.findBillLadingTotal(indexDTO); + if (Func.isNotEmpty(indexDeliveryDataVO)) { + //查询自提总件数 + Integer billLadingTotalNum = warehouseIndexMapper.findBillLadingTotalNum(indexDTO); + indexDeliveryDataVO.setTotalDeliveryNum(billLadingTotalNum); + //查询总重量 + BigDecimal billLadingTotalWeight = warehouseIndexMapper.findBillLadingTotalWeight(indexDTO); + indexDeliveryDataVO.setTotalWeight(billLadingTotalWeight); + //查询总包件体积 + BigDecimal billLadingTotalVolume = warehouseIndexMapper.findBillLadingTotalVolume(indexDTO); + indexDeliveryDataVO.setTotalVolume(billLadingTotalVolume); + indexDeliveryDataVOList.add(indexDeliveryDataVO); + } + //查询外协信息 + IndexDeliveryDataVO indexTripartiteDeliveryDataVO = warehouseIndexMapper.findTripartiteTotal(indexDTO); + if (Func.isNotEmpty(indexTripartiteDeliveryDataVO)) { + //查询自提总件数 + Integer tripartiteTotalNum = warehouseIndexMapper.findTripartiteTotalNum(indexDTO); + indexDeliveryDataVO.setTotalDeliveryNum(tripartiteTotalNum); + //查询总重量 + BigDecimal tripartiteTotalWeight = warehouseIndexMapper.findTripartiteTotalWeight(indexDTO); + indexDeliveryDataVO.setTotalWeight(tripartiteTotalWeight); + //查询总包件体积 + BigDecimal tripartiteTotalVolume = warehouseIndexMapper.findTripartiteTotalVolume(indexDTO); + indexDeliveryDataVO.setTotalVolume(tripartiteTotalVolume); + indexDeliveryDataVOList.add(indexDeliveryDataVO); + } + + return indexDeliveryDataVOList; + } } diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/vo/indexCount/IndexDeliveryDataVO.java b/blade-service/logpm-report/src/main/java/com/logpm/report/vo/indexCount/IndexDeliveryDataVO.java new file mode 100644 index 000000000..5cf163b59 --- /dev/null +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/vo/indexCount/IndexDeliveryDataVO.java @@ -0,0 +1,19 @@ +package com.logpm.report.vo.indexCount; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class IndexDeliveryDataVO implements Serializable { + + private String type ; + private Integer totalNum = 0; + private Integer totalDeliveryNum = 0; + private BigDecimal totalWeight ; + private BigDecimal totalVolume ; + private Integer totalRoadNum = 0; + + +}