Explorar el Código

燃料辅料统计报表

txf hace 3 años
padre
commit
c818d8c4bd

+ 1 - 1
pom.xml

@@ -147,7 +147,7 @@
                     <!--包名-->
                     <targetPackage>com.steerinfo.dil</targetPackage>
                     <tables>
-<!--                        <param>TMSTRUCK_MEASURE_COMMISSION</param>-->
+                        <param>DIL_VERSION</param>
 <!--                        <param>TMSTRUCK_LOAD_RESULT</param>-->
 <!--                        <param>TMSTRUCK_LEAVE_FACTORY_RESULT</param>-->
 <!--                        <param>TMSTRUCK_UNLOAD_RESULT</param>-->

+ 60 - 0
src/main/java/com/steerinfo/dil/controller/StatisticalReportController.java

@@ -0,0 +1,60 @@
+package com.steerinfo.dil.controller;
+
+import com.steerinfo.dil.service.impl.StatisticalReportImpl;
+import com.steerinfo.dil.util.BaseRESTfulController;
+import com.steerinfo.dil.util.ColumnDataUtil;
+import com.steerinfo.dil.util.PageListAdd;
+import com.steerinfo.framework.controller.RESTfulResult;
+import com.steerinfo.framework.service.pagehelper.PageHelper;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ author    :TXF
+ * @ time      :2021/12/14 18:05
+ */
+
+@RestController
+@RequestMapping("/${api.version}/statisticalReport")
+public class StatisticalReportController extends BaseRESTfulController {
+
+    @Autowired
+    StatisticalReportImpl statisticalReportService;
+
+    @Autowired
+    ColumnDataUtil columnDataUtil;
+
+    @ApiOperation(value="查询辅料燃料统计报表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
+            @ApiImplicitParam(name = "apiId(220)", value = "动态表头", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
+    })
+    @PostMapping("/getRLFLReport")
+    public RESTfulResult getRLFLReport(@RequestBody(required=false) Map<String,Object> mapValue,
+                                               Integer apiId,
+                                               Integer pageNum,
+                                               Integer pageSize,
+                                               Integer orderType
+    ){
+        mapValue.put("orderTypee", orderType);
+        List<Map<String, Object>> allReport =  statisticalReportService.getAllPurchaseFLRLReport(mapValue);
+        PageHelper.startPage(pageNum, pageSize);
+        //分页数据
+        List<Map<String, Object>> report = statisticalReportService.getRLFLReport(mapValue);
+        PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allReport,report);
+        return success(pageList);
+    }
+}

+ 8 - 0
src/main/java/com/steerinfo/dil/service/IStatisticalReportService.java

@@ -1,5 +1,8 @@
 package com.steerinfo.dil.service;
 
+import java.util.List;
+import java.util.Map;
+
 /**
  * 查询汽运统计报表
  * @ author    :TXF
@@ -8,4 +11,9 @@ package com.steerinfo.dil.service;
 
 public interface IStatisticalReportService {
 
+    //查询辅料燃料统计报表
+    List<Map<String, Object>> getRLFLReport(Map<String, Object> map);
+
+    //查询采购统计报表 (辅料、燃料、内转)
+    List<Map<String, Object>> getAllPurchaseFLRLReport(Map<String, Object> map);
 }

+ 39 - 0
src/main/java/com/steerinfo/dil/service/impl/StatisticalReportImpl.java

@@ -1,8 +1,15 @@
 package com.steerinfo.dil.service.impl;
 
+import com.steerinfo.dil.mapper.StatisticalReportMapper;
 import com.steerinfo.dil.service.IStatisticalReportService;
+import com.steerinfo.dil.util.DataChange;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
 /**
  * @ author    :TXF
  * @ time      :2021/12/14 15:26
@@ -10,4 +17,36 @@ import org.springframework.stereotype.Service;
 @Service
 public class StatisticalReportImpl implements IStatisticalReportService {
 
+    @Autowired
+    StatisticalReportMapper statisticalReportMapper;
+
+    //查询辅料燃料统计报表
+    public List<Map<String, Object>> getRLFLReport(Map<String, Object> map){
+        List<Map<String, Object>> mapList = statisticalReportMapper.getAllPurchaseFLRLReport(map);
+        for (Map<String, Object> mesMap : mapList) {
+            Object resultEntryGateTime = mesMap.get("resultEntryGateTime");
+            Object resultOutGateTime = mesMap.get("resultOutGateTime");
+            if(resultEntryGateTime != null && resultOutGateTime != null){
+                Date enterDate = (Date) resultEntryGateTime;
+                Date outDate = (Date) resultOutGateTime;
+                //计算相差时间
+                long dTime = outDate.getTime() - enterDate.getTime();
+                mesMap.put("inPlantDwellTime", dTime / 60000 + "分钟");
+            }
+            if(resultEntryGateTime != null && resultOutGateTime == null){
+                //如果没有出厂时间则以当前时间减去进厂时间
+                Date enterDate = (Date) resultEntryGateTime;
+                long dTime = new Date().getTime() - enterDate.getTime();
+                mesMap.put("inPlantDwellTime", dTime / 60000 + "分钟");
+            }
+        }
+        return mapList;
+    }
+
+    @Override
+    public List<Map<String, Object>> getAllPurchaseFLRLReport(Map<String, Object> map) {
+        return statisticalReportMapper.getAllPurchaseFLRLReport(map);
+    }
+
+
 }

+ 101 - 8
src/main/resources/com/steerinfo/dil/mapper/StatisticalReportMapper.xml

@@ -1,16 +1,109 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.steerinfo.dil.mapper.StatisticalReportMapper">
-
+    <sql id="orderBy">
+        <if test="orderField != null and orderField != ''">
+            order by "${orderField}"
+            <if test="orderType != null and orderType != ''">
+                ${orderType}
+            </if>
+        </if>
+    </sql>
 <!--查询采购统计报表-->
     <select id="getAllPurchaseFLRLReport" parameterType="map" resultType="java.util.Map">
         select *
-        from OMSTRUCK_ORDER OO
-        left join TMSTRUCK_TOTAL_RESULT TTR
-            on TTR.ORDER_ID = OO.ORDER_ID
-
-        left join TMSTRUCK_ENFACTORY_RESULT TER
-            on TTR.RESULT_TOTAL_ID = TER.RESULT_TOTAL_ID
-
+        from (select OO.ORDER_NUMBER            "orderNumber",
+                     RC.CAPACITY_NUMBER         "capacityNumber",
+                     TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
+                     TWR.RESULT_NET_WEIGHT      "resultNetWeight",
+                     TQR.RESULT_DEDUCTION       "resultDeduction",
+                     TUR.RESULT_END_TIME        "resultEndTime",
+                     RW.WAREHOUSE_NAME          "warehouseName",
+                     TRR.INSERT_TIME            "insertTime",
+                     TLFR.RESULT_OUT_GATE_TIME  "resultOutGateTime",
+                     OO.INSERT_TIME             "insertTimee"
+              from OMSTRUCK_ORDER OO
+                       left join TMSTRUCK_TOTAL_RESULT TTR
+                                 on TTR.ORDER_ID = OO.ORDER_ID
+                       left join RMS_CAPACITY RC
+                                 on RC.CAPACITY_ID = OO.CAPACITY_ID
+                       left join TMSTRUCK_ENFACTORY_RESULT TER
+                                 on TTR.RESULT_TOTAL_ID = TER.RESULT_TOTAL_ID
+                       left join OMSTRUCK_ORDER_MATERIAL OOM
+                                 on OOM.ORDER_ID = OO.ORDER_ID
+                       left join TMSTRUCK_WEIGHT_RESULT TWR
+                                 on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+                       left join TMSTRUCK_UNLOAD_RESULT TUR
+                                 on TUR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+                       left join RMS_WAREHOUSE RW
+                                 on RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
+                       left join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
+                                 on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+                       left join TMSTRUCK_RECEIPT_RESULT TRR
+                                 on TRR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+                       left join TMSTRUCK_QUALITY_RESULT TQR
+                                 on TQR.TOTAL_RESULT_ID = TTR.RESULT_TOTAL_ID
+              where OO.ORDER_STATUS in (5, 8, 9, 1, 2)
+                and OO.ORDER_TYPE = #{orderTypee}
+             )
+        <where>
+            <if test="orderNumber != null">
+                <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
+                    "orderNumber" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="capacityNumber != null">
+                and
+                <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
+                    "capacityNumber" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="resultEntryGateTime != null">
+                and
+                <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
+                    "resultEntryGateTime" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="resultNetWeight != null">
+                and
+                <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
+                    "resultNetWeight" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="resultDeduction != null">
+                and
+                <foreach collection="resultDeduction" item="item" open="(" separator="or" close=")">
+                    "resultDeduction" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="resultEndTime != null">
+                and
+                <foreach collection="resultEndTime" item="item" open="(" separator="or" close=")">
+                    "resultEndTime" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="warehouseName != null">
+                and
+                <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
+                    "warehouseName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="insertTime != null">
+                and
+                <foreach collection="insertTime" item="item" open="(" separator="or" close=")">
+                    "insertTime" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="resultOutGateTime != null">
+                and
+                <foreach collection="resultOutGateTime" item="item" open="(" separator="or" close=")">
+                    "resultOutGateTime" like '%${item}%'
+                </foreach>
+            </if>
+        </where>
+        <include refid="orderBy"></include>
+        <if test="orderField == null  ">
+            order by "insertTimee" desc
+        </if>
     </select>
 </mapper>