yzc 1 жил өмнө
parent
commit
4be83a0445

+ 19 - 3
hx-form/src/main/java/com/fjhx/form/controller/ReportController.java

@@ -1,9 +1,7 @@
 package com.fjhx.form.controller;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.fjhx.form.entity.ProductionReportBo;
-import com.fjhx.form.entity.ProductionReportSelectDto;
-import com.fjhx.form.entity.SaleReportBo;
+import com.fjhx.form.entity.*;
 import com.fjhx.form.service.ReportService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -11,6 +9,8 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 @RestController
 @RequestMapping("/report")
 public class ReportController {
@@ -38,4 +38,20 @@ public class ReportController {
         return reportService.saleReport(dto);
     }
 
+    /**
+     * 已完工未出货统计
+     */
+    @PostMapping("/waitShipmentReportStatistic")
+    List<WaitShipmentReportStatisticBo> waitShipmentReportStatistic() {
+        return reportService.waitShipmentReportStatistic();
+    }
+
+    /**
+     * 已完工未出货报表
+     */
+    @PostMapping("/waitShipmentReport")
+    Page<WaitShipmentReportBo> waitShipmentReport(@RequestBody ProductionReportSelectDto dto) {
+        return reportService.waitShipmentReport(dto);
+    }
+
 }

+ 81 - 0
hx-form/src/main/java/com/fjhx/form/entity/WaitShipmentReportBo.java

@@ -0,0 +1,81 @@
+package com.fjhx.form.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Getter
+@Setter
+public class WaitShipmentReportBo {
+    private Long id;
+    /**
+     * 业务员id
+     */
+    private Long salesmanId;
+    /**
+     * 业务员id
+     */
+    private String salesmanName;
+    /**
+     * 下单时间
+     */
+    private Date saleDate;
+    /**
+     * 交期
+     */
+    private Date deliveryTime;
+    /**
+     * 订单号
+     */
+    private String code;
+    /**
+     * 产品id
+     */
+    private Long productId;
+    /**
+     * 产品编号
+     */
+    private String productCode;
+    /**
+     * 产品名称
+     */
+    private String productName;
+    /**
+     * 产品长
+     */
+    private BigDecimal productLength;
+    /**
+     * 产品宽
+     */
+    private BigDecimal productWidth;
+    /**
+     * 产品高
+     */
+    private BigDecimal productHeight;
+    /**
+     * 产品颜色
+     */
+    private String productColor;
+    /**
+     * 数量
+     */
+    private BigDecimal quantity;
+    /**
+     * 完工数量
+     */
+    private BigDecimal finishQuantity;
+    /**
+     * 出货数量
+     */
+    private BigDecimal receiptQuantity;
+    /**
+     * 未出货数量
+     */
+    private BigDecimal notQuantity;
+    /**
+     * 超期天数
+     */
+    private Integer overdueDay;
+}

+ 30 - 0
hx-form/src/main/java/com/fjhx/form/entity/WaitShipmentReportStatisticBo.java

@@ -0,0 +1,30 @@
+package com.fjhx.form.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+@Getter
+@Setter
+public class WaitShipmentReportStatisticBo {
+
+    /**
+     * 业务员id
+     */
+    private Long salesmanId;
+    /**
+     * 业务员id
+     */
+    private String salesmanName;
+
+    /**
+     * 数量
+     */
+    private BigDecimal sumQuantity;
+
+    /**
+     * 未出货数量
+     */
+    private BigDecimal sumNotQuantity;
+}

+ 7 - 0
hx-form/src/main/java/com/fjhx/form/mapper/ReportMapper.java

@@ -3,10 +3,14 @@ package com.fjhx.form.mapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.form.entity.ProductionReportBo;
 import com.fjhx.form.entity.SaleReportBo;
+import com.fjhx.form.entity.WaitShipmentReportBo;
+import com.fjhx.form.entity.WaitShipmentReportStatisticBo;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 @Mapper
 public interface ReportMapper {
 
@@ -14,4 +18,7 @@ public interface ReportMapper {
 
     Page<SaleReportBo> saleReport(@Param("page") Page<Object> page, @Param("ew") IWrapper<Object> wrapper);
 
+    Page<WaitShipmentReportBo> waitShipmentReport(@Param("page") Page<Object> page, @Param("ew") IWrapper<Object> wrapper);
+
+    List<WaitShipmentReportStatisticBo> waitShipmentReportStatistic();
 }

+ 15 - 3
hx-form/src/main/java/com/fjhx/form/service/ReportService.java

@@ -1,9 +1,9 @@
 package com.fjhx.form.service;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.fjhx.form.entity.ProductionReportBo;
-import com.fjhx.form.entity.ProductionReportSelectDto;
-import com.fjhx.form.entity.SaleReportBo;
+import com.fjhx.form.entity.*;
+
+import java.util.List;
 
 public interface ReportService {
 
@@ -13,4 +13,16 @@ public interface ReportService {
     Page<ProductionReportBo> productionReport(ProductionReportSelectDto dto);
 
     Page<SaleReportBo> saleReport(ProductionReportSelectDto dto);
+
+    /**
+     * 已完工未出货报表统计
+     *
+     * @return
+     */
+    List<WaitShipmentReportStatisticBo> waitShipmentReportStatistic();
+
+    /**
+     * 已完工未出货报表
+     */
+    Page<WaitShipmentReportBo> waitShipmentReport(ProductionReportSelectDto dto);
 }

+ 46 - 3
hx-form/src/main/java/com/fjhx/form/service/impl/ReportServiceImpl.java

@@ -2,9 +2,7 @@ package com.fjhx.form.service.impl;
 
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.fjhx.form.entity.ProductionReportBo;
-import com.fjhx.form.entity.ProductionReportSelectDto;
-import com.fjhx.form.entity.SaleReportBo;
+import com.fjhx.form.entity.*;
 import com.fjhx.form.mapper.ReportMapper;
 import com.fjhx.form.service.ReportService;
 import com.fjhx.item.service.product.ProductInfoService;
@@ -13,6 +11,7 @@ import com.fjhx.mes.service.report.ReportLossesDetailsService;
 import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import com.ruoyi.system.service.ISysDeptService;
+import com.ruoyi.system.utils.UserUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -110,4 +109,48 @@ public class ReportServiceImpl implements ReportService {
         }
         return saleReportBoPage;
     }
+
+    @Override
+    public List<WaitShipmentReportStatisticBo> waitShipmentReportStatistic() {
+        List<WaitShipmentReportStatisticBo> records = reportMapper.waitShipmentReportStatistic();
+
+        //赋值业务员
+        UserUtil.assignmentNickName(records, WaitShipmentReportStatisticBo::getSalesmanId, WaitShipmentReportStatisticBo::setSalesmanName);
+
+        return records;
+    }
+
+    /**
+     * 已完工未出货报表
+     */
+    @Override
+    public Page<WaitShipmentReportBo> waitShipmentReport(ProductionReportSelectDto dto) {
+        IWrapper<Object> wrapper = IWrapper.getWrapper();
+        Page<WaitShipmentReportBo> waitShipmentReportBoPage = reportMapper.waitShipmentReport(dto.getPage(), wrapper);
+        if (ObjectUtil.isEmpty(waitShipmentReportBoPage)) {
+            return waitShipmentReportBoPage;
+        }
+        List<WaitShipmentReportBo> records = waitShipmentReportBoPage.getRecords();
+        for (WaitShipmentReportBo record : records) {
+            //超期修正
+            if (ObjectUtil.isEmpty(record.getOverdueDay()) || record.getOverdueDay() < 0) {
+                record.setOverdueDay(0);
+            }
+        }
+
+        //赋值业务员
+        UserUtil.assignmentNickName(records, WaitShipmentReportBo::getSalesmanId, WaitShipmentReportBo::setSalesmanName);
+
+        //赋值产品信息
+        productInfoService.attributeAssign(records, WaitShipmentReportBo::getProductId, (item, productInfo) -> {
+            item.setProductCode(productInfo.getCustomCode());
+            item.setProductName(productInfo.getName());
+            item.setProductLength(productInfo.getLength());
+            item.setProductWidth(productInfo.getWidth());
+            item.setProductHeight(productInfo.getHeight());
+            item.setProductColor(productInfo.getColor());
+        });
+
+        return waitShipmentReportBoPage;
+    }
 }

+ 36 - 4
hx-form/src/main/resources/mapper/ReportMapper.xml

@@ -4,18 +4,18 @@
 
     <select id="productionReport" resultType="com.fjhx.form.entity.ProductionReportBo">
         SELECT pod.id,
-               pod.company_id                                                     AS factoryId,
-               po.`code`                                                          AS orderCode,
+               pod.company_id                                                 AS factoryId,
+               po.`code`                                                      AS orderCode,
                pod.product_id,
                pod.quantity,
                po.delivery_period,
                pod.finish_time,
                IF(DATE_FORMAT(IFNULL(po.finish_time, NOW()), '%Y-%m-%d') > DATE_FORMAT(po.delivery_period, '%Y-%m-%d'),
-                  1, 0)                                                           as isOverdue,
+                  1, 0)                                                       as isOverdue,
                IF(DATE_FORMAT(IFNULL(po.finish_time, NOW()), '%Y-%m-%d') > DATE_FORMAT(po.delivery_period, '%Y-%m-%d'),
                   DATEDIFF(IFNULL(po.finish_time, NOW()), po.delivery_period), 0) as overdueDay,
                DATEDIFF(po.delivery_period, po.produce_time) /
-               DATEDIFF(IFNULL(po.finish_time, NOW()), po.produce_time) * 100     as timelyRate
+               DATEDIFF(IFNULL(po.finish_time, NOW()), po.produce_time) * 100 as timelyRate
         FROM production_order_detail pod
                  LEFT JOIN production_order po ON pod.produce_order_id = po.id
     </select>
@@ -35,4 +35,36 @@
         FROM contract c
                  LEFT JOIN production_order po ON po.contract_id = c.id
     </select>
+
+    <select id="waitShipmentReport" resultType="com.fjhx.form.entity.WaitShipmentReportBo">
+        SELECT pod.id,
+               c.salesman_id,
+               c.sale_date,
+               c.delivery_time,
+               c.`code`,
+               pod.product_id,
+               pod.quantity,
+               pod.finish_quantity,
+               swd.receipt_quantity,
+               (swd.quantity - swd.receipt_quantity) AS not_quantity,
+               DATEDIFF(NOW(), c.delivery_time)      AS overdueDay
+        FROM production_order_detail pod
+                 JOIN production_order po ON pod.produce_order_id = po.id
+                 JOIN contract c ON po.contract_id = c.id
+                 LEFT JOIN stock_wait_details swd ON swd.contract_detail_id = pod.contract_detail_id
+        WHERE pod.produce_status = 2
+          AND po.produce_status = 5
+    </select>
+    <select id="waitShipmentReportStatistic" resultType="com.fjhx.form.entity.WaitShipmentReportStatisticBo">
+        SELECT c.salesman_id,
+               sum(pod.quantity)                        as sumQuantity,
+               sum(swd.quantity - swd.receipt_quantity) AS sumNotQuantity
+        FROM production_order_detail pod
+                 JOIN production_order po ON pod.produce_order_id = po.id
+                 JOIN contract c ON po.contract_id = c.id
+                 LEFT JOIN stock_wait_details swd ON swd.contract_detail_id = pod.contract_detail_id
+        WHERE pod.produce_status = 2
+          AND po.produce_status = 5
+        GROUP BY c.salesman_id
+    </select>
 </mapper>