Sfoglia il codice sorgente

周转率修改为周转次数

fgd 1 anno fa
parent
commit
7c04e18da5

+ 2 - 2
sd-business/src/main/java/com/sd/business/entity/apply/vo/ApplyBuyBomAccessoryVo.java

@@ -111,8 +111,8 @@ public class ApplyBuyBomAccessoryVo {
      * 周转率
      */
     @ColumnWidth(15)
-    @ExcelProperty(value = "周转率", index = 13)
-    private String turnoverRate;
+    @ExcelProperty(value = "90天周转次数", index = 13)
+    private BigDecimal turnoverRate;
 
     /**
      * 备注

+ 1 - 1
sd-business/src/main/java/com/sd/business/entity/board/bo/OrderSalesShipmentStatisticsBo.java

@@ -57,5 +57,5 @@ public class OrderSalesShipmentStatisticsBo {
     /**
      * 周转率
      */
-    private String turnoverRate;
+    private BigDecimal turnoverRate;
 }

+ 2 - 2
sd-business/src/main/java/com/sd/business/entity/board/vo/InventoryTurnoverRateVo.java

@@ -34,6 +34,6 @@ public class InventoryTurnoverRateVo {
      * 周转率
      */
     @ColumnWidth(15)
-    @ExcelProperty(value = "周转率", index = 2)
-    private String turnoverRate;
+    @ExcelProperty(value = "90天周转次数", index = 2)
+    private BigDecimal turnoverRate;
 }

+ 3 - 7
sd-business/src/main/java/com/sd/business/entity/board/vo/TurnoverRateStatisticsVo.java

@@ -2,7 +2,6 @@ package com.sd.business.entity.board.vo;
 
 import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
 import com.alibaba.excel.annotation.ExcelProperty;
-import com.alibaba.excel.annotation.format.NumberFormat;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -52,8 +51,7 @@ public class TurnoverRateStatisticsVo {
     /**
      * 周转率
      */
-    @NumberFormat("0.00%")
-    @ExcelProperty(value = "30天周转率", index = 5)
+    @ExcelProperty(value = "30天周转次数", index = 5)
     private BigDecimal turnoverRateThirtyDays;
 
     /**
@@ -65,8 +63,7 @@ public class TurnoverRateStatisticsVo {
     /**
      * 周转率
      */
-    @NumberFormat("0.00%")
-    @ExcelProperty(value = "60天周转率", index = 7)
+    @ExcelProperty(value = "60天周转次数", index = 7)
     private BigDecimal turnoverRateSixtyDays;
 
     /**
@@ -78,8 +75,7 @@ public class TurnoverRateStatisticsVo {
     /**
      * 周转率
      */
-    @NumberFormat("0.00%")
-    @ExcelProperty(value = "90天周转率", index = 9)
+    @ExcelProperty(value = "90天周转次数", index = 9)
     private BigDecimal turnoverRateNinetyDays;
 
     /**

+ 1 - 1
sd-business/src/main/java/com/sd/business/entity/purchase/vo/PurchaseBomBoardVo.java

@@ -102,5 +102,5 @@ public class PurchaseBomBoardVo {
     /**
      * 周转率
      */
-    private String turnoverRate;
+    private BigDecimal turnoverRate;
 }

+ 1 - 1
sd-business/src/main/java/com/sd/business/entity/purchase/vo/PurchaseInTransitBomVo.java

@@ -108,7 +108,7 @@ public class PurchaseInTransitBomVo {
      * 周转率
      */
     @ColumnWidth(20)
-    @ExcelProperty(value = "周转率", index = 11)
+    @ExcelProperty(value = "90天周转次数", index = 11)
     private String turnoverRate;
 
     /**

+ 2 - 2
sd-business/src/main/java/com/sd/business/service/apply/impl/ApplyBuyServiceImpl.java

@@ -212,7 +212,7 @@ public class ApplyBuyServiceImpl extends ServiceImpl<ApplyBuyMapper, ApplyBuy> i
         List<ApplyBuyBom> list = applyBuyBomService.list(q -> q.eq(ApplyBuyBom::getApplyBuyId, applyBuyId));
         List<Long> bomSpecIds = list.stream().map(ApplyBuyBom::getBomSpecId).collect(Collectors.toList());
         Map<Long, BomSpec> bomSpecMap = bomSpecService.mapKEntity(BaseIdPo::getId, q -> q.in(BaseIdPo::getId, bomSpecIds));
-        Map<Long, String> turnoverRateMap = orderSalesShipmentStatisticsService.getTurnoverRateMapByBomSpecIds(bomSpecIds);
+        Map<Long, BigDecimal> turnoverRateMap = orderSalesShipmentStatisticsService.getTurnoverRateMapByBomSpecIds(bomSpecIds);
         // 在途数据
         List<PurchaseInTransitBomVo> purchaseBomInTransitList = purchaseBomService.getPurchaseBomInTransitSum(bomSpecIds);
         Map<Long, BigDecimal> inTransitMap = purchaseBomInTransitList.stream().collect(Collectors.toMap(PurchaseInTransitBomVo::getBomSpecId, PurchaseInTransitBomVo::getInTransitQuantity));
@@ -301,7 +301,7 @@ public class ApplyBuyServiceImpl extends ServiceImpl<ApplyBuyMapper, ApplyBuy> i
             vo.setActualSalesDays(actualSalesDays);
             vo.setShortageQuantity(shortageQuantity);
             vo.setApplyBuyQuantity(applyBuyBom.getQuantity());
-            vo.setTurnoverRate(turnoverRateMap.getOrDefault(applyBuyBom.getBomSpecId(), "0%"));
+            vo.setTurnoverRate(turnoverRateMap.getOrDefault(applyBuyBom.getBomSpecId(), BigDecimal.ZERO));
             accessoryList.add(vo);
         }
 

+ 2 - 2
sd-business/src/main/java/com/sd/business/service/board/impl/InventoryBoardServiceImpl.java

@@ -79,9 +79,9 @@ public class InventoryBoardServiceImpl implements InventoryBoardService {
         wrapper.eq("bs", BomSpec::getHeight, dto.getBomSpecHeight());
         wrapper.eq("bs", BomSpec::getColour, dto.getColour());
         if (Objects.equals(dto.getSortBy(), 1)) {
-            wrapper.orderByAsc("turnoverRateSort");
+            wrapper.orderByAsc("turnoverRate");
         } else {
-            wrapper.orderByDesc("turnoverRateSort");
+            wrapper.orderByDesc("turnoverRate");
         }
         long days = 30;
         if (dto.getBeginTime() != null && dto.getEndTime() != null) {

+ 2 - 1
sd-business/src/main/java/com/sd/business/service/order/OrderSalesShipmentStatisticsService.java

@@ -4,6 +4,7 @@ import com.sd.business.entity.board.bo.OrderSalesShipmentStatisticsBo;
 import com.sd.business.entity.board.dto.TurnoverRateBoardSelectDto;
 import com.sd.business.entity.board.vo.TurnoverRateStatisticsVo;
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 
@@ -37,5 +38,5 @@ public interface OrderSalesShipmentStatisticsService {
      *
      * @return
      */
-    Map<Long, String> getTurnoverRateMapByBomSpecIds(List<Long> bomSpecIds);
+    Map<Long, BigDecimal> getTurnoverRateMapByBomSpecIds(List<Long> bomSpecIds);
 }

+ 1 - 1
sd-business/src/main/java/com/sd/business/service/order/impl/OrderSalesShipmentStatisticsServiceImpl.java

@@ -208,7 +208,7 @@ public class OrderSalesShipmentStatisticsServiceImpl implements OrderSalesShipme
     }
 
     @Override
-    public Map<Long, String> getTurnoverRateMapByBomSpecIds(List<Long> bomSpecIds) {
+    public Map<Long, BigDecimal> getTurnoverRateMapByBomSpecIds(List<Long> bomSpecIds) {
         IWrapper<OrderSku> wrapper = IWrapper.getWrapper();
         wrapper.in("oq.bom_spec_id", bomSpecIds);
         wrapper.groupBy("oq.bom_spec_id");

+ 1 - 4
sd-business/src/main/java/com/sd/business/service/purchase/impl/PurchaseBomServiceImpl.java

@@ -139,7 +139,7 @@ public class PurchaseBomServiceImpl extends ServiceImpl<PurchaseBomMapper, Purch
         wrapper.like("bs", BomSpec::getCode, dto.getBomSpecCode());
         wrapper.like("bs", BomSpec::getName, dto.getBomSpecName());
         wrapper.apply("(pb.purchase_quantity + pb.return_quantity) > pb.arrival_quantity");
-        wrapper.orderByAsc("ifnull(btr.turnover_rate, 0)");
+        wrapper.orderByAsc("turnoverRate");
         wrapper.orderByAsc("pb", PurchaseBom::getId);
         Page<PurchaseInTransitBomVo> page = this.baseMapper.getPurchaseInTransitBomPage(dto.getPage(), wrapper);
         List<PurchaseInTransitBomVo> records = page.getRecords();
@@ -177,9 +177,6 @@ public class PurchaseBomServiceImpl extends ServiceImpl<PurchaseBomMapper, Purch
         IWrapper<PurchaseBom> wrapper = getWrapper();
         wrapper.like("bs", BomSpec::getName, dto.getBomSpecName());
         wrapper.like("bs", BomSpec::getCode, dto.getBomSpecCode());
-        if ("turnoverRate".equals(dto.getSortField())) {
-            dto.setSortField("ifnull(btr.turnover_rate, 0)");
-        }
 
         if (Objects.equals(dto.getSortBy(), 1)) {
             wrapper.orderByAsc(dto.getSortField());

+ 2 - 7
sd-business/src/main/resources/mapper/board/InventoryBoardMapper.xml

@@ -47,16 +47,11 @@
         select
             bs.name bomSpecName,
             bs.code bomSpecCode,
-            concat(round(${days} / (${days} * 0.5 * (
+            round(${days} / (${days} * 0.5 * (
                     (ibb.quantity + IFNULL(ibb.lock_quantity, 0))
                     +
                     (i.quantity + IFNULL(i.lock_quantity, 0))
-                ) / oq.quantity) * 100, 2), '%') turnoverRate,
-            ${days} / (${days} * 0.5 * (
-                    (ibb.quantity + IFNULL(ibb.lock_quantity, 0))
-                        +
-                    (i.quantity + IFNULL(i.lock_quantity, 0))
-                ) / oq.quantity) * 100 turnoverRateSort
+                ) / oq.quantity), 4) turnoverRate
         from
             bom_spec bs
                 inner join bom b on bs.bom_id = b.id

+ 2 - 2
sd-business/src/main/resources/mapper/order/OrderSalesShipmentStatisticsMapper.xml

@@ -25,14 +25,14 @@
     <select id="getTurnoverRateMapByBomSpecIds" resultType="com.sd.business.entity.board.bo.OrderSalesShipmentStatisticsBo">
         select
             oq.bom_spec_id,
-            concat(ifnull(90 / (90 * 0.5 *
+            ifnull(round(90 / (90 * 0.5 *
                   (ifnull(ib.quantity, 0)
                       +
                   ifnull(ib.lock_quantity, 0)
                       +
                   ifnull(i.quantity, 0)
                       +
-                  ifnull(i.lock_quantity, 0)) / oq.quantity) * 100, 0), '%') turnover_rate
+                  ifnull(i.lock_quantity, 0)) / oq.quantity), 4), 0) turnover_rate
         from (
              select
                  os.bom_spec_id,

+ 4 - 4
sd-business/src/main/resources/mapper/purchase/PurchaseBomMapper.xml

@@ -87,7 +87,7 @@
             pb.purchase_quantity,
             pb.purchase_quantity - pb.arrival_quantity + pb.return_quantity inTransitQuantity,
             p.delivery_date,
-            concat(ifnull(round(btr.turnover_rate, 2), 0), '%') turnoverRate,
+            ifnull(round(btr.turnover_rate, 4), 0) turnoverRate,
             ifnull(btr.quantity, 0) salesQuantity
         from
             purchase_bom pb
@@ -106,7 +106,7 @@
                                +
                           ifnull(i.quantity, 0)
                                +
-                          ifnull(i.lock_quantity, 0)) / oq.quantity) * 100 turnover_rate,
+                          ifnull(i.lock_quantity, 0)) / oq.quantity) turnover_rate,
                     oq.quantity
                 from (
                      select
@@ -169,7 +169,7 @@
             bs.height,
             ifnull((i.quantity + ifnull(i.lock_quantity, 0)) / ((ifnull(osq.quantity, 0) + ifnull(osbq.quantity, 0)) / 7), 0) predictOutStorageDays,
             ifnull(pd.next_delivery_days, 0) nextDeliveryDays,
-            concat(ifnull(round(btr.turnover_rate, 2), 0), '%') turnoverRate
+            ifnull(round(btr.turnover_rate, 4), 0) turnoverRate
         FROM
             bom_spec bs
             left join inventory i on bs.id = i.bom_spec_id and department_id = 0 and warehouse_id in (1684037244354052098, 1684037201379213314)
@@ -220,7 +220,7 @@
                               +
                           ifnull(i.quantity, 0)
                               +
-                          ifnull(i.lock_quantity, 0)) / oq.quantity) * 100 turnover_rate
+                          ifnull(i.lock_quantity, 0)) / oq.quantity) turnover_rate
                 from (
                     select
                         os.bom_spec_id,