paidaxin666 2 лет назад
Родитель
Сommit
d23b624015

+ 5 - 2
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/dao/WorkpieceMapper.java

@@ -7,6 +7,7 @@ import com.github.zuihou.base.mapper.SuperMapper;
 import com.github.zuihou.business.operationManagementCenter.entity.TWorkpiece;
 import com.github.zuihou.tenant.dto.ProductDto;
 import com.github.zuihou.tenant.dto.ProductInfoDto;
+import com.github.zuihou.tenant.vo.ProductVo;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
@@ -31,12 +32,14 @@ public interface WorkpieceMapper extends SuperMapper<TWorkpiece> {
     /**
      * 产品流转详情
      * @return
+     * @param vo
      */
-    List<ProductInfoDto> selectProductInfo();
+    List<ProductInfoDto> selectProductInfo(@Param("vo") ProductVo vo);
 
     /**
      * 产品流转汇总
      * @return
+     * @param vo
      */
-    List<ProductDto> getProductStatistics();
+    List<ProductDto> getProductStatistics(@Param("vo") ProductVo vo);
 }

+ 6 - 3
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/statisticalAnalysis/ProductLinePerformanceService.java

@@ -7,6 +7,7 @@ import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 import com.github.zuihou.tenant.dto.ProductDto;
 import com.github.zuihou.tenant.dto.ProductInfoDto;
 import com.github.zuihou.tenant.dto.ProductionStatisticalDto;
+import com.github.zuihou.tenant.vo.ProductVo;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -35,14 +36,15 @@ public interface ProductLinePerformanceService extends SuperCacheService<TaskNod
 
     /**
      * 产品流转详汇总
+     * @param vo
      */
-    List<ProductDto> getProductStatistics();
+    IPage<ProductDto> getProductStatistics(Long page, Long limit, ProductVo vo);
 
     /**
      * 产品流转详情
      * @return
      */
-    IPage<ProductInfoDto>  getProductInfoStatistics(Long page, Long limit);
+    IPage<ProductInfoDto>  getProductInfoStatistics(Long page, Long limit, ProductVo vo);
 
     void expectProductInfo(HttpServletResponse response)  throws IOException;
 
@@ -52,9 +54,10 @@ public interface ProductLinePerformanceService extends SuperCacheService<TaskNod
      * 设备工时统计
      * @param page
      * @param limit
+     * @param vo
      * @return
      */
-    IPage<ProductionStatisticalDto> queryProcedure(Long page, Long limit);
+    IPage<ProductionStatisticalDto> queryProcedure(Long page, Long limit, ProductVo vo);
 
     /**
      * 设备工时导出

+ 3 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/statisticalAnalysis/dao/ProductLinePerformanceMapper.java

@@ -7,6 +7,7 @@ import com.github.zuihou.base.mapper.SuperMapper;
 import com.github.zuihou.business.operationManagementCenter.entity.TaskNode;
 import com.github.zuihou.database.mybatis.auth.DataScope;
 import com.github.zuihou.tenant.dto.ProductionStatisticalDto;
+import com.github.zuihou.tenant.vo.ProductVo;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
@@ -42,6 +43,7 @@ public interface ProductLinePerformanceMapper extends SuperMapper<TaskNode> {
     /**
      * 设备工时统计
      * @return
+     * @param vo
      */
-    List<ProductionStatisticalDto> queryProcedure();
+    List<ProductionStatisticalDto> queryProcedure(@Param("vo") ProductVo vo);
 }

+ 24 - 12
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/statisticalAnalysis/impl/ProductLinePerformanceServiceImpl.java

@@ -21,6 +21,7 @@ import com.github.zuihou.tenant.dto.ProductDto;
 import com.github.zuihou.tenant.dto.ProductInfoDto;
 import com.github.zuihou.tenant.dto.ProductInfoExcelDto;
 import com.github.zuihou.tenant.dto.ProductionStatisticalDto;
+import com.github.zuihou.tenant.vo.ProductVo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.apache.poi.ss.usermodel.Workbook;
@@ -96,9 +97,13 @@ public class ProductLinePerformanceServiceImpl extends SuperCacheServiceImpl<Pro
 
 
     @Override
-    public List<ProductDto> getProductStatistics(){
-        List<ProductDto> statistics = workpieceMapper.getProductStatistics();
-        return statistics;
+    public IPage<ProductDto> getProductStatistics(Long page, Long limit, ProductVo vo){
+        List<ProductDto> statistics = workpieceMapper.getProductStatistics(vo);
+        if (!CollectionUtil.isEmpty(statistics)) {
+            Page pages = IPageUtils.getPages(page, limit, statistics);
+            return pages;
+        }
+        return null;
     }
 
     /**
@@ -106,8 +111,8 @@ public class ProductLinePerformanceServiceImpl extends SuperCacheServiceImpl<Pro
      * @return
      */
     @Override
-    public IPage<ProductInfoDto> getProductInfoStatistics(Long page, Long limit) {
-        List<ProductInfoDto> productInfoDtos = workpieceMapper.selectProductInfo();
+    public IPage<ProductInfoDto> getProductInfoStatistics(Long page, Long limit, ProductVo vo) {
+        List<ProductInfoDto> productInfoDtos = workpieceMapper.selectProductInfo(vo);
         if (!CollectionUtil.isEmpty(productInfoDtos)) {
             List<ProductInfoDto> productInfos = productInfoDtos.stream().map(item -> {
                 ProductInfoDto productInfoDto = BeanUtil.toBean(item, ProductInfoDto.class);
@@ -132,7 +137,8 @@ public class ProductLinePerformanceServiceImpl extends SuperCacheServiceImpl<Pro
 
     @Override
     public void expectProduct(HttpServletRequest request, HttpServletResponse response) throws IOException {
-        List<ProductDto> productStatistics = getProductStatistics();
+        ProductVo vo = new ProductVo();
+        List<ProductDto> productStatistics = workpieceMapper.getProductStatistics(vo);
         // 设置响应输出的头类型
         // 设置响应输出的头类型
         response.setHeader("content-Type", "application/vnd.ms-excel");
@@ -147,7 +153,8 @@ public class ProductLinePerformanceServiceImpl extends SuperCacheServiceImpl<Pro
 
     @Override
     public void expectProductInfo(HttpServletResponse response) throws IOException {
-        List<ProductInfoDto> productInfoDtos = workpieceMapper.selectProductInfo();
+        ProductVo vo = new ProductVo();
+        List<ProductInfoDto> productInfoDtos = workpieceMapper.selectProductInfo(vo);
         List<ProductInfoDto> productInfos = productInfoDtos.stream().map(item->{
             ProductInfoDto productInfoDto = BeanUtil.toBean(item, ProductInfoDto.class);
             if (item.getEndTime() != null && item.getStartTime() != null) {
@@ -188,13 +195,17 @@ public class ProductLinePerformanceServiceImpl extends SuperCacheServiceImpl<Pro
      * 设备工时统计
      * @param page
      * @param limit
+     * @param vo
      * @return
      */
     @Override
-    public IPage<ProductionStatisticalDto> queryProcedure(Long page, Long limit) {
-        List<ProductionStatisticalDto> list = baseMapper.queryProcedure();
-        Page pages = IPageUtils.getPages(page, limit, list);
-        return pages;
+    public IPage<ProductionStatisticalDto> queryProcedure(Long page, Long limit, ProductVo vo) {
+        List<ProductionStatisticalDto> list = baseMapper.queryProcedure(vo);
+        if (!CollectionUtil.isEmpty(list)){
+            Page pages = IPageUtils.getPages(page, limit, list);
+            return pages;
+        }
+        return null;
     }
 
     /**
@@ -204,7 +215,8 @@ public class ProductLinePerformanceServiceImpl extends SuperCacheServiceImpl<Pro
      */
     @Override
     public void expectProcedure(HttpServletRequest request, HttpServletResponse response) throws IOException {
-        List<ProductionStatisticalDto> list = baseMapper.queryProcedure();
+        ProductVo vo = new ProductVo();
+        List<ProductionStatisticalDto> list = baseMapper.queryProcedure(vo);
         // 设置响应输出的头类型
         // 设置响应输出的头类型
         response.setHeader("content-Type", "application/vnd.ms-excel");

+ 38 - 11
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/operationManagementCenter/TWorkpieceMapper.xml

@@ -50,22 +50,49 @@
             left join imcs_t_task itt on ioo.id = itt.order_id
             left join imcs_t_workpiece itw on ioo.id = itw.order_id
             left join imcs_tenant_productionresource itp on itp.id = itt.resource_id
+        <where>
+        <if test=" vo.bomName != null and vo.bomName != ''">
+            itw.bom_name like concat('%', #{vo.bomName}, '%')
+        </if>
+        <if test="vo.startTime != null and vo.startTime != ''">
+            AND date_format(itt.start_time,'%y-%m-%d') &gt;= date_format(#{vo.startTime},'%y-%m-%d')
+        </if>
+        <if test="vo.endTime != null and vo.endTime != ''">
+            AND date_format(itt.end_time,'%y-%m-%d') &lt;= date_format(#{vo.endTime},'%y-%m-%d')
+        </if>
+        </where>
     </select>
 
 
     <!--产品流转汇总-->
     <select id="getProductStatistics" resultType="com.github.zuihou.tenant.dto.ProductDto">
-        select ioo.order_no,ioo.remark,
-               ipp.start_time as planStartTime,
-               ipp.end_time as planEndTime,
-               min(itt.start_time) as startTime ,max(itt.end_time) as endTime ,count(itt.procedure_no) as num,
-               TIME_TO_SEC(TIMEDIFF( max(itt.end_time),min(itt.start_time)))/3600 as hour,
-       itw.bom_name
-        from imcs_o_order ioo
-            left join imcs_p_plan ipp on ioo.order_no = ipp.order_no
-            left join imcs_t_task itt on ioo.order_no = itt.order_no
-            left join imcs_t_workpiece itw on ioo.order_no = itw.order_no
-        group by ioo.order_no
+        select * from (
+                          select ioo.order_no,
+                                 ioo.remark,
+                                 ipp.start_time                                                       as planStartTime,
+                                 ipp.end_time                                                         as planEndTime,
+                                 min(itt.start_time)                                                  as startTime,
+                                 max(itt.end_time)                                                    as endTime,
+                                 count(itt.procedure_no)                                              as num,
+                                 TIME_TO_SEC(TIMEDIFF(max(itt.end_time), min(itt.start_time))) / 3600 as hour,
+                         itw.bom_name
+                          from imcs_o_order ioo
+                              left join imcs_p_plan ipp on ioo.order_no = ipp.order_no
+                              left join imcs_t_task itt on ioo.order_no = itt.order_no
+                              left join imcs_t_workpiece itw on ioo.order_no = itw.order_no
+                          group by ioo.order_no
+                      ) t
+        <where>
+            <if test=" vo.bomName != null and vo.bomName != ''">
+                t.bom_name like concat('%', #{vo.bomName}, '%')
+            </if>
+            <if test="vo.startTime != null and vo.startTime != ''">
+                AND date_format(t.startTime,'%y-%m-%d') &gt;= date_format(#{vo.startTime},'%y-%m-%d')
+            </if>
+            <if test="vo.endTime != null and vo.endTime != ''">
+                AND date_format(t.endTime,'%y-%m-%d') &lt;= date_format(#{vo.endTime},'%y-%m-%d')
+            </if>
+        </where>
     </select>
 
 </mapper>

+ 12 - 0
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/statisticalAnalysis/ProductLinePerformanceMapper.xml

@@ -94,5 +94,17 @@
                TIME_TO_SEC(TIMEDIFF(itt.end_time,itt.start_time))/3600 as hour
         from imcs_t_task itt
             left join imcs_tenant_productionresource itp on itt.resource_id = itp.id
+        <where>
+            <if test=" vo.bomName != null and vo.bomName != ''">
+                itp.name like concat('%', #{vo.bomName}, '%')
+            </if>
+            <if test="vo.startTime != null and vo.startTime != ''">
+                AND date_format(itt.start_time,'%y-%m-%d') &gt;= date_format(#{vo.startTime},'%y-%m-%d')
+            </if>
+            <if test="vo.endTime != null and vo.endTime != ''">
+                AND date_format(itt.end_time,'%y-%m-%d') &lt;= date_format(#{vo.endTime},'%y-%m-%d')
+            </if>
+        </where>
+        order by itt.start_time desc
     </select>
 </mapper>

+ 12 - 7
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/statisticalAnalysis/ProductLinePerformanceController.java

@@ -16,6 +16,7 @@ import com.github.zuihou.log.annotation.SysLog;
 import com.github.zuihou.tenant.dto.ProductDto;
 import com.github.zuihou.tenant.dto.ProductInfoDto;
 import com.github.zuihou.tenant.dto.ProductionStatisticalDto;
+import com.github.zuihou.tenant.vo.ProductVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
@@ -99,18 +100,21 @@ public class ProductLinePerformanceController extends SuperController<ProductLin
     }
 
     @ApiOperation(value = "产品流转详汇总", notes = "产品流转详汇总")
-    @PostMapping("/getProductStatistics")
+    @PostMapping("/getProductStatistics/{page}/{limit}")
     @SysLog("产品流转详汇总")
-    public R<List<ProductDto>> getProductStatistics() {
-        return success(baseService.getProductStatistics());
+    public R<IPage<ProductDto>> getProductStatistics(@PathVariable long page,
+                                                    @PathVariable long limit,
+                                                    @RequestBody(required = false)ProductVo vo) {
+        return success(baseService.getProductStatistics(page,limit,vo));
     }
 
     @ApiOperation(value = "产品流转详情", notes = "产品流转详情")
     @PostMapping("/getProductInfoStatistics/{page}/{limit}")
     @SysLog("产品流转详情")
     public R<IPage<ProductInfoDto>> getProductInfoStatistics(@PathVariable long page,
-                                                             @PathVariable long limit) {
-        return success(baseService.getProductInfoStatistics(page,limit));
+                                                             @PathVariable long limit,
+                                                             @RequestBody(required = false)ProductVo vo) {
+        return success(baseService.getProductInfoStatistics(page,limit,vo));
     }
 
     @ApiOperation(value = "产品流转详情excle导出", notes = "产品流转详情excle导出")
@@ -136,8 +140,9 @@ public class ProductLinePerformanceController extends SuperController<ProductLin
     @ApiOperation(value = "设备工时统计", notes = "查询设备工时管理")
     @PostMapping("/queryProcedure/{page}/{limit}")
     public R<IPage<ProductionStatisticalDto>> queryProcedure(@PathVariable Long page,
-                                                             @PathVariable Long limit) {
-        return success(baseService.queryProcedure(page,limit));
+                                                             @PathVariable Long limit,
+                                                             @RequestBody(required = false)ProductVo vo) {
+        return success(baseService.queryProcedure(page,limit,vo));
     }
 
     @ApiOperation(value = "设备工时导出", notes = "设备工时导出管理")

+ 0 - 4
imcs-admin-boot/imcs-tenant-entity/src/main/java/com/github/zuihou/tenant/vo/ProductVo.java

@@ -1,6 +1,5 @@
 package com.github.zuihou.tenant.vo;
 
-import cn.afterturn.easypoi.excel.annotation.Excel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
@@ -12,14 +11,11 @@ import lombok.Data;
 public class ProductVo {
 
     @ApiModelProperty(value = "产品名称")
-    @Excel(name = "产品名称" , width = 20)
     private String bomName;
 
     @ApiModelProperty(value = "开始时间")
-    @Excel(name = "开始时间" , width = 25)
     private String startTime;
 
     @ApiModelProperty(value = "结束时间")
-    @Excel(name = "结束时间" , width = 25)
     private String endTime;
 }