Sfoglia il codice sorgente

Merge branch 'master' of https://git.steerinfo.com/luobang/DIL-DAZHOU-WMS2

Tiroble 3 anni fa
parent
commit
5ae7fcd5a7

+ 33 - 0
src/main/java/com/steerinfo/dil/controller/WmspOutboundResultController.java

@@ -59,8 +59,10 @@ public class WmspOutboundResultController extends BaseRESTfulController {
     @Autowired
     private  ESFeign esFeign;
 
+    private final SimpleDateFormat sdfDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
     private SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
+
     /**
      * 编写人:hukui
      * PC端查看钢材出库实绩
@@ -501,5 +503,36 @@ public class WmspOutboundResultController extends BaseRESTfulController {
         }
         return success("操作成功");
     }
+
+    //统计出厂每个炉号生产的支数
+    @PostMapping("/getWmsOutboundResultStatistics")
+    @ApiOperation(value = "展示入库统计信息")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "apiId", value = "371", required = false, dataType = "BigDecimal"),
+    })
+    public RESTfulResult getWmsOutboundResultStatistics(@RequestBody(required = false) Map<String, Object> mapValue,
+                                                       Integer apiId,
+                                                       Integer pageNum,
+                                                       Integer pageSize,
+                                                       Integer warehouseId,
+                                                       String con,
+                                                       String startTime,
+                                                       String endTime) {
+        if (con!=null && !con.equals("undefined") && !"".equals(con)){
+            mapValue.put("con","%"+con+"%");
+        }
+        if(mapValue == null){
+            mapValue =new HashMap<>();
+        }
+        mapValue.put("warehouseId",warehouseId);
+        DataChange.queryDataByDateTime(startTime, endTime, mapValue, sdfDateTime);//根据时间段查询数据
+        List<Map<String,Object>> inboundResultList = wmspOutboundResultService.getWmsOutboundResultStatistics(mapValue);
+
+        /*分页*/
+        PageHelper.startPage(pageNum, pageSize);
+        List<Map<String,Object>> columnList = wmspOutboundResultService.getWmsOutboundResultStatistics(mapValue);
+        PageListAdd pageList = columnDataUtil.tableColumnData(apiId,inboundResultList,columnList);
+        return success(pageList);
+    }
 }
 

+ 6 - 4
src/main/java/com/steerinfo/dil/mapper/WmspOutboundResultMapper.java

@@ -2,13 +2,13 @@ package com.steerinfo.dil.mapper;
 
 import com.steerinfo.dil.model.WmspOutboundResult;
 import com.steerinfo.framework.mapper.IBaseMapper;
-import java.math.*;
-import java.util.List;
-import java.util.Map;
-
 import org.apache.ibatis.annotations.MapKey;
 import org.apache.ibatis.annotations.Mapper;
 
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
+
 @Mapper
 public interface WmspOutboundResultMapper extends IBaseMapper<WmspOutboundResult, BigDecimal> {
     /**
@@ -78,4 +78,6 @@ public interface WmspOutboundResultMapper extends IBaseMapper<WmspOutboundResult
     int updateStatus(BigDecimal resultId);
 
     List<Map<String, Object>> selectOutResult(Map<String, Object> mapval);
+
+    List<Map<String, Object>> getWmsOutboundResultStatistics(Map<String, Object> mapValue);
 }

+ 1 - 0
src/main/java/com/steerinfo/dil/service/IWmspOutboundResultService.java

@@ -87,4 +87,5 @@ public interface IWmspOutboundResultService {
 
     int sureOutbount(BigDecimal resultId);
 
+    List<Map<String, Object>> getWmsOutboundResultStatistics(Map<String, Object> mapValue);
 }

+ 5 - 0
src/main/java/com/steerinfo/dil/service/impl/WmspOutboundResultServiceImpl.java

@@ -472,5 +472,10 @@ public class WmspOutboundResultServiceImpl  implements IWmspOutboundResultServic
         return 0;
     }
 
+    @Override
+    public List<Map<String, Object>> getWmsOutboundResultStatistics(Map<String, Object> mapValue) {
+        return wmspOutboundResultMapper.getWmsOutboundResultStatistics(mapValue);
+    }
+
 
 }

+ 56 - 56
src/main/resources/com/steerinfo/dil/mapper/WmspInboundResultMapper.xml

@@ -1541,16 +1541,16 @@
     </select>
     <select id="getWmsInboundResultStatistics" parameterType="java.util.Map" resultType="java.util.Map">
         SELECT DISTINCT
---                         炉号生产总数量
+        --                         炉号生产总数量
         table1.count "count",
---                         炉号生产总重量
+        --                         炉号生产总重量
         table2.weight "weight",
---                         炉号生产的第一件钢材时间
+        --                         炉号生产的第一件钢材时间
         table3.onetime "onetime",
---                         生产物资型号
+        --                         生产物资型号
         RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || '(' ||
         RM.MATERIAL_MODEL || ')' "materialName",
---                         炉号
+        --                         炉号
         MATERIAL_FURNACE_NUMBER "furnaceNumber1"
 
         FROM
@@ -1564,63 +1564,63 @@
         LEFT JOIN RMS_PWAREHOUSE_GRID RPG
         ON RPG.GRID_ID = WGM.GRID_ID
         LEFT JOIN (
-            SELECT
-                count(MATERIAL_FURNACE_NUMBER) count,
-                MATERIAL_FURNACE_NUMBER  "furnaceNumber1"
-            FROM
-            WMSP_INBOUND_RESULT WIR2
-            LEFT JOIN RMS_MATERIAL_STEEL RMS2
-            ON RMS2.MATERIAL_STEEL_ID = WIR2.MATERIAL_ID
-            WHERE RMS2.DELETED IS NULL OR RMS2.DELETED = 0
-            <if test="oneDate != null">
-                AND to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= WIR2.INBOUND_TIME
-            </if>
-            <if test="startDate != null">
-                AND to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= WIR2.INBOUND_TIME
-                AND to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= WIR2.INBOUND_TIME
-            </if>
-            GROUP BY
-            MATERIAL_FURNACE_NUMBER
+        SELECT
+        count(MATERIAL_FURNACE_NUMBER) count,
+        MATERIAL_FURNACE_NUMBER  "furnaceNumber1"
+        FROM
+        WMSP_INBOUND_RESULT WIR2
+        LEFT JOIN RMS_MATERIAL_STEEL RMS2
+        ON RMS2.MATERIAL_STEEL_ID = WIR2.MATERIAL_ID
+        WHERE RMS2.DELETED IS NULL OR RMS2.DELETED = 0
+        <if test="oneDate != null">
+            AND to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= WIR2.INBOUND_TIME
+        </if>
+        <if test="startDate != null">
+            AND to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= WIR2.INBOUND_TIME
+            AND to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= WIR2.INBOUND_TIME
+        </if>
+        GROUP BY
+        MATERIAL_FURNACE_NUMBER
         ) table1
         ON RMS.MATERIAL_FURNACE_NUMBER = table1."furnaceNumber1"
         LEFT JOIN (
-            SELECT
-                sum(MATERIAL_THEORETICAL_WEIGHT) weight,
-                MATERIAL_FURNACE_NUMBER  "furnaceNumber2"
-            FROM
-            WMSP_INBOUND_RESULT WIR3
-            LEFT JOIN RMS_MATERIAL_STEEL RMS3
-            ON RMS3.MATERIAL_STEEL_ID = WIR3.MATERIAL_ID
-            WHERE RMS3.DELETED IS NULL OR RMS3.DELETED = 0
-            <if test="oneDate != null">
-                AND to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= WIR3.INBOUND_TIME
-            </if>
-            <if test="startDate != null">
-                AND to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= WIR3.INBOUND_TIME
-                AND to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= WIR3.INBOUND_TIME
-            </if>
-            GROUP BY
-            MATERIAL_FURNACE_NUMBER
+        SELECT
+        sum(MATERIAL_THEORETICAL_WEIGHT) weight,
+        MATERIAL_FURNACE_NUMBER  "furnaceNumber2"
+        FROM
+        WMSP_INBOUND_RESULT WIR3
+        LEFT JOIN RMS_MATERIAL_STEEL RMS3
+        ON RMS3.MATERIAL_STEEL_ID = WIR3.MATERIAL_ID
+        WHERE RMS3.DELETED IS NULL OR RMS3.DELETED = 0
+        <if test="oneDate != null">
+            AND to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= WIR3.INBOUND_TIME
+        </if>
+        <if test="startDate != null">
+            AND to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= WIR3.INBOUND_TIME
+            AND to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= WIR3.INBOUND_TIME
+        </if>
+        GROUP BY
+        MATERIAL_FURNACE_NUMBER
         ) table2
         ON table1."furnaceNumber1" = table2."furnaceNumber2"
         LEFT JOIN(
-            SELECT
-               MIN(WIR4.INSERT_TIME) onetime,
-               MATERIAL_FURNACE_NUMBER  "furnaceNumber3"
-            FROM
-            WMSP_INBOUND_RESULT WIR4
-            LEFT JOIN RMS_MATERIAL_STEEL RMS4
-            ON RMS4.MATERIAL_STEEL_ID = WIR4.MATERIAL_ID
-            WHERE RMS4.DELETED IS NULL OR RMS4.DELETED = 0
-            <if test="oneDate != null">
-                AND to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= WIR4.INBOUND_TIME
-            </if>
-            <if test="startDate != null">
-                AND to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= WIR4.INBOUND_TIME
-                AND to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= WIR4.INBOUND_TIME
-            </if>
-            GROUP BY
-            MATERIAL_FURNACE_NUMBER
+        SELECT
+        MIN(WIR4.INSERT_TIME) onetime,
+        MATERIAL_FURNACE_NUMBER  "furnaceNumber3"
+        FROM
+        WMSP_INBOUND_RESULT WIR4
+        LEFT JOIN RMS_MATERIAL_STEEL RMS4
+        ON RMS4.MATERIAL_STEEL_ID = WIR4.MATERIAL_ID
+        WHERE RMS4.DELETED IS NULL OR RMS4.DELETED = 0
+        <if test="oneDate != null">
+            AND to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= WIR4.INBOUND_TIME
+        </if>
+        <if test="startDate != null">
+            AND to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= WIR4.INBOUND_TIME
+            AND to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= WIR4.INBOUND_TIME
+        </if>
+        GROUP BY
+        MATERIAL_FURNACE_NUMBER
         )table3
         ON table3."furnaceNumber3" = table2."furnaceNumber2"
         WHERE RPG.WAREHOUSE_ID = #{warehouseId}

+ 66 - 0
src/main/resources/com/steerinfo/dil/mapper/WmspOutboundResultMapper.xml

@@ -1067,4 +1067,70 @@
     SET RESULT_STATUS = 1
     WHERE RESULT_ID = #{resultId}
   </update>
+
+  <select id="getWmsOutboundResultStatistics" resultType="java.util.Map">
+    select * from(
+    SELECT count(material_furnace_number) "coun",
+    sum (rms.MATERIAL_THEORETICAL_WEIGHT) "theoreticalWeight",
+    material_furnace_number "furnaceNumber",
+    rm.MATERIAL_NAME || rm.MATERIAL_SPECIFICATION || '(' ||
+    rm.MATERIAL_MODEL || ')' "materialName"
+    FROM WMSP_GRID_MATERIAL wgm
+    left join rms_material_steel rms
+    on rms.material_steel_id=wgm.MATERIAL_ID
+    left join RMS_MATERIAL rm
+    on rm.MATERIAL_ID = rms.MATERIAL_ID
+    left join RMS_PWAREHOUSE_GRID rpg
+    on rpg.GRID_ID = wgm.GRID_ID
+    WHERE wgm.DELETED = 1 and wgm.UPDATE_TIME is not null
+    and rpg.WAREHOUSE_ID = #{warehouseId}
+    <if test="oneDate != null and (con ==null || con == '') ">
+      and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = wgm.update_time
+    </if>
+    <if test="startDate != null">
+      and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= wgm.update_time
+      and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= wgm.update_time
+    </if>
+    <if test="con!=null">
+     and material_furnace_number like #{con}
+    </if>
+    group by material_furnace_number,rm.MATERIAL_NAME || rm.MATERIAL_SPECIFICATION || '(' ||
+        rm.MATERIAL_MODEL || ')'
+    )
+    <where>
+    <if test="coun != null">
+      and
+      <foreach collection="coun" item="item" open="(" separator="or" close=")">
+        "coun" like '%${item}%'
+      </foreach>
+    </if>
+      <if test="theoreticalWeight != null">
+        and
+        <foreach collection="theoreticalWeight" item="item" open="(" separator="or" close=")">
+          "theoreticalWeight" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="furnaceNumber != null">
+        and
+        <foreach collection="furnaceNumber" item="item" open="(" separator="or" close=")">
+          "furnaceNumber" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="materialName != null">
+        and
+        <foreach collection="materialName" item="item" open="(" separator="or" close=")">
+          "materialName" like '%${item}%'
+        </foreach>
+      </if>
+    </where>
+     <include refid="orderBy"></include>
+  </select>
+  <sql id="orderBy">
+    <if test="orderField != null and orderField != ''">
+      order by "${orderField}"
+      <if test="orderType != null and orderType != ''">
+        ${orderType}
+      </if>
+    </if>
+  </sql>
 </mapper>

+ 2 - 15
src/main/resources/com/steerinfo/dil/mapper/WmspSendReceiveMapper.xml

@@ -453,9 +453,8 @@
     select * from (
     select
     rw.warehouse_name "warehouse_name",
-    rm.material_name "material_name",
-    rm.material_specification "material_specification",
-    rm.material_model "material_model",
+    rm.MATERIAL_NAME || rm.MATERIAL_SPECIFICATION || '(' ||
+    rm.MATERIAL_MODEL || ')' "material_name",
     wsr.send_receive_lastday_inventory "send_receive_lastday_inventory" ,
     wsr.send_receive_thisday_inbound "send_receive_thisday_inbound",
     wsr.send_receive_thisday_outbound "send_receive_thisday_outbound",
@@ -492,18 +491,6 @@
           #{item}
         </foreach>
       </if>
-      <if test="material_specification != null">
-        and "material_specification" in
-        <foreach collection="material_specification" item="item" open="(" separator="," close=")">
-          #{item}
-        </foreach>
-      </if>
-      <if test="material_model != null">
-        and "material_model" in
-        <foreach collection="material_model" item="item" open="(" separator="," close=")">
-          #{item}
-        </foreach>
-      </if>
       <if test="send_receive_lastday_inventory != null">
         and "send_receive_lastday_inventory" in
         <foreach collection="send_receive_lastday_inventory" item="item" open="(" separator="," close=")">