zhouzh 3 anni fa
parent
commit
754c82c663

+ 34 - 0
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,7 @@ public class WmspOutboundResultController extends BaseRESTfulController {
     @Autowired
     private  ESFeign esFeign;
 
+    private final SimpleDateFormat sdfDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
     /**
      * 编写人:hukui
@@ -518,5 +521,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);
+    }
+
 
 }

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

@@ -1540,27 +1540,28 @@
         where MATERIAL_ID=#{materialId} and INBOUND_ISCOMPLETE='2'
     </select>
     <select id="getWmsInboundResultStatistics" resultType="java.util.Map">
+        select *(
         SELECT count(material_furnace_number) coun,
-               count(rm.MATERIAL_THEORETICAL_WEIGHT)  "theoreticalWeight",
-               material_furnace_number "furnaceNumber",
-                rm.MATERIAL_NAME || rm.MATERIAL_SPECIFICATION || '(' ||
-                rm.MATERIAL_MODEL || ')' "materialName",
+        sum (rm.MATERIAL_THEORETICAL_WEIGHT) "theoreticalWeight",
+        material_furnace_number "furnaceNumber",
+        rm.MATERIAL_NAME || rm.MATERIAL_SPECIFICATION || '(' ||
+        rm.MATERIAL_MODEL || ')' "materialName"
 
         FROM WMSP_INBOUND_RESULT wir
-                 left join rms_material_steel  rms
-                           on rms.material_steel_id=wir.MATERIAL_ID
-                left join RMS_MATERIAL rm
-                on rm.MATERIAL_ID = rms.MATERIAL_ID
+        left join rms_material_steel rms
+        on rms.material_steel_id=wir.MATERIAL_ID
+        left join RMS_MATERIAL rm
+        on rm.MATERIAL_ID = rms.MATERIAL_ID
 
         WHERE wir.RESULT_DELETED = 0
-        <if test="oneDate != null">
-        and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= wir.inbound_time
+        <if test="oneDate != null">and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= wir.inbound_time
         </if>
         <if test="startDate != null">
             and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= wir.inbound_time
             and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= wir.inbound_time
         </if>
         group by material_furnace_number
+        )
     </select>
 
 </mapper>

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

@@ -1061,4 +1061,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=")">