Browse Source

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

胡半仙 3 years ago
parent
commit
30193afbc8

+ 46 - 24
src/main/java/com/steerinfo/dil/controller/WmspOutboundResultController.java

@@ -10,6 +10,7 @@ import com.steerinfo.dil.service.impl.WmspOutboundResultServiceImpl;
 import com.steerinfo.dil.service.impl.WmspOutboundScanResultServiceImpl;
 import com.steerinfo.dil.util.BaseRESTfulController;
 import com.steerinfo.dil.util.ColumnDataUtil;
+import com.steerinfo.dil.util.DataChange;
 import com.steerinfo.dil.util.PageListAdd;
 import com.steerinfo.dil.vo.OutBoundDetailed;
 import com.steerinfo.framework.controller.RESTfulResult;
@@ -22,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -57,6 +59,9 @@ 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
@@ -80,34 +85,19 @@ public class WmspOutboundResultController extends BaseRESTfulController {
                                                Integer pageNum,
                                                Integer pageSize,
                                                Integer apiId,
-                                               String con)
+                                               String con,
+                                               String startTime,
+                                               String endTime)
     {
 
-        if (con != null) {
-            if (!"undefined".equals(con)) {
-                String index = "get_wms_outResult";//设置要查询的索引名称
-                return success(esFeign.getConResult(mapval, index, apiId, pageNum, pageSize, con));//获取查询结果
-            }
-        }
-
-        List<Map<String, Object>> libaryOutBoundList = null;
-        if (mapval.size() == 0) {
-            //将查询结果存入索引中
-            libaryOutBoundList = wmspOutboundResultService.selectResultNumber(mapval);
-            Map<String, Object> map1 = new HashMap<>();
-            //添加索引
-            map1.put("index", "get_wms_outresult");
-            //添加id
-            map1.put("indexId", "outBoundResultId");
-            libaryOutBoundList.add(map1);
-            //新建索引
-            esFeign.insertIndex(libaryOutBoundList);
-            //删除
-            libaryOutBoundList.remove(libaryOutBoundList.size() - 1);
+        if (mapval.containsKey("starTime")&&mapval.get("starTime")!=null){
+            startTime=mapval.get("starTime").toString();
         }
-        if (libaryOutBoundList == null) {
-            libaryOutBoundList = wmspOutboundResultService.selectResultNumber(mapval);
+        if (mapval.containsKey("endTime")&&mapval.get("endTime")!=null){
+            endTime=mapval.get("endTime").toString();
         }
+        DataChange.queryDataByDateTime(startTime,endTime,mapval,simpleDateFormat);
+        List<Map<String, Object>> libaryOutBoundList  = wmspOutboundResultService.selectResultNumber(mapval);
         PageHelper.startPage(pageNum, pageSize);
         List<Map<String, Object>> columnList =wmspOutboundResultService.selectResultNumber(mapval);
         PageListAdd pageList = columnDataUtil.tableColumnData(apiId, libaryOutBoundList, columnList);
@@ -131,6 +121,7 @@ public class WmspOutboundResultController extends BaseRESTfulController {
      * */
     @PostMapping(value = "/insertWmspOutBoundResult")
     public Map<String, Object> insertWmspOutBoundResult(@RequestBody(required = false) Map<String, Object> mapval){
+
         /**拿到前端传递的运输订单号*/
         String orderNumber = mapval.get("orderNumber").toString();
         /**根据运输订单号,查询运输订单信息,*/
@@ -518,5 +509,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);
 }

+ 7 - 2
src/main/java/com/steerinfo/dil/service/impl/WmspOutboundResultServiceImpl.java

@@ -157,7 +157,7 @@ public class WmspOutboundResultServiceImpl  implements IWmspOutboundResultServic
 
     @Override
     public int scanResultInsert(WmspOutboundScanResult wmspOutboundScanResult) {
-        return wmspOutboundScanResultMapper.insert(wmspOutboundScanResult);
+        return wmspOutboundScanResultMapper.insertSelective(wmspOutboundScanResult);
     }
 
     @Override
@@ -361,7 +361,7 @@ public class WmspOutboundResultServiceImpl  implements IWmspOutboundResultServic
         //插入主键id
         wmspOutboundScanResult.setResultId(new BigDecimal(seq_wmspOutboundScanResult));
         //入库实绩
-        wmspOutboundScanResult.setInboundResultId(inboundResultId);
+        wmspOutboundScanResult.setInboundResultId(inboundResultId==null?new BigDecimal(1):inboundResultId);
         //插入出库实绩ID
         wmspOutboundScanResult.setOutboundResultId(resultId);
         //插入装卸工Id
@@ -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

@@ -1549,16 +1549,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
@@ -1572,63 +1572,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}

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

@@ -734,6 +734,12 @@
           "resultOutboundType" like '%${item}%'
         </foreach>
       </if>
+      <if test="startTime != null and endTime !=null">
+        and ckd.insert_time between to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') and  to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss')
+      </if>
+      <if test="oneDate != null">
+        and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= ckd.insert_time
+      </if>
     </where>
    
   </select>
@@ -1061,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=")">