Bladeren bron

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

zhouzh 3 jaren geleden
bovenliggende
commit
ad66652c1d

+ 3 - 0
src/main/java/com/steerinfo/dil/controller/WmsInboundResultController.java

@@ -204,6 +204,9 @@ public class WmsInboundResultController extends BaseRESTfulController {
                                              Integer pageNum,
                                              Integer pageSize,
                                              String con) {
+        if (mapValue == null){
+            mapValue = new HashMap<>();
+        }
         if(con != null){
             if(!"undefined".equals(con)){
                 String index = "get_wms_reservedresult";

+ 14 - 2
src/main/java/com/steerinfo/dil/controller/WmspGridMaterialController.java

@@ -63,15 +63,16 @@ public class WmspGridMaterialController extends BaseRESTfulController {
                                                 Integer pageNum,
                                                 Integer pageSize,
                                                 Integer apiId,
+                                                Integer warehouseId,
                                                 String con) {
 
 
         if (con!=null&&!con.equals("undefined")) {
             mapVal.put("con", "%" + con + "%");
         }
-        List<Map<String, Object>>   libaryInBoundList = wmspGridMaterialService.selectGridMaterial(mapVal);
+        List<Map<String, Object>>   libaryInBoundList = wmspGridMaterialService.selectGridMaterial(mapVal,warehouseId);
         PageHelper.startPage(pageNum, pageSize);
-        List<Map<String, Object>> columnList = wmspGridMaterialService.selectGridMaterial(mapVal);
+        List<Map<String, Object>> columnList = wmspGridMaterialService.selectGridMaterial(mapVal,warehouseId);
         PageListAdd pageList = columnDataUtil.tableColumnData(apiId, libaryInBoundList, columnList);
 //        //库龄预警
 //        for (Map mapValue : columnList) {
@@ -261,6 +262,17 @@ public class WmspGridMaterialController extends BaseRESTfulController {
         return success(pageList);
     }
 
+    @ApiOperation(value = "查询仓库中超过库龄预警的物资",notes = "查询仓库中超过库龄预警的物资")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "apiId", value = "442", required = false, dataType = "BigDecimal"),
+    })
+    @PostMapping("/getGridMaterialAgeList")
+    public  RESTfulResult getGridMaterialAgeList(@RequestBody(required = false) Map<String, Object> mapVal,Integer warehouseId){
+        List<Map<String,Object>> list=wmspGridMaterialService.getGridMaterialAgeList(mapVal,warehouseId);
+
+        return success(list);
+    }
+
 //    根据仓库id查询对应库的物资id,没有传库的id直接查询所有钢材的物资
     @ApiOperation(value = "查询所有钢材的物资信息",notes = "查询所有钢材的物资信息")
     @ApiImplicitParams({

+ 12 - 12
src/main/java/com/steerinfo/dil/controller/WmspRestackMakeResultController.java

@@ -91,20 +91,20 @@ public class WmspRestackMakeResultController extends BaseRESTfulController {
             }
         }
         List<Map<String, Object>> libaryInBoundList = null;
-        if (mapVal.size() == count) {
+//        if (mapVal.size() == count) {
             //将查询结果存入索引中
             libaryInBoundList = wmspRestackMakeResultService.selectRestackMakeResultList(mapVal);
-            Map<String, Object> map1 = new HashMap<>();
-            //添加索引
-            map1.put("index", "get_wms_restackresult");
-            //添加id
-            map1.put("indexId", "restackResultId");
-            libaryInBoundList.add(map1);
-            //新建索引
-            esFeign.insertIndex(libaryInBoundList);
-            //删除
-            libaryInBoundList.remove(libaryInBoundList.size() - 1);
-        }
+//            Map<String, Object> map1 = new HashMap<>();
+//            //添加索引
+//            map1.put("index", "get_wms_restackresult");
+//            //添加id
+//            map1.put("indexId", "restackResultId");
+//            libaryInBoundList.add(map1);
+//            //新建索引
+//            esFeign.insertIndex(libaryInBoundList);
+//            //删除
+//            libaryInBoundList.remove(libaryInBoundList.size() - 1);
+//        }
         if (libaryInBoundList == null) {
             libaryInBoundList = wmspRestackMakeResultService.selectRestackMakeResultList(mapVal);
         }

+ 2 - 0
src/main/java/com/steerinfo/dil/mapper/WmspGridMaterialMapper.java

@@ -64,4 +64,6 @@ public interface WmspGridMaterialMapper extends IBaseMapper<WmspGridMaterial, Bi
   int deleteGridMaterial(@Param("thisMaterialDetailedInfos") List<OutBoundMaterialDetailedInfo> thisMaterialDetailedInfos,@Param("now")Date now);
 
   List<Map<String, Object>> getMaterialIdes(String warehouseId, String materialCode, String materialSpecification, String materialModel,Integer status);
+//  查询当前所有已经超过库龄预警的所有数据
+  List<Map<String, Object>> getGridMaterialAgeList(Map<String,Object> mapVal);
 }

+ 1 - 1
src/main/java/com/steerinfo/dil/mapper/WmspRestackScanResultMapper.java

@@ -48,5 +48,5 @@ public interface WmspRestackScanResultMapper extends IBaseMapper<WmspRestackScan
 //    判断当前的物资是否已经存在并且倒垛状态为已倒垛
     int getWmspRestackScanResultCount(String onlyCode);
 
-    BigDecimal getResultId(String content);
+    List<Map<String,Object>> getResultId(BigDecimal restackId);
 }

+ 3 - 1
src/main/java/com/steerinfo/dil/service/IWmspGridMaterialService.java

@@ -28,7 +28,7 @@ public interface IWmspGridMaterialService  {
    int updateByPrimaryKeySelective(WmspGridMaterial wmspGridMaterial);
 
    //查询实时库存数据
-   List<Map<String, Object>> selectGridMaterial(Map<String, Object> mapval);
+   List<Map<String, Object>> selectGridMaterial(Map<String, Object> mapval,Integer warehouseId);
 
    //统计实时库存当前表格数据
    Long countByGmId();
@@ -67,4 +67,6 @@ public interface IWmspGridMaterialService  {
 
     //修改实时库存
     int updateWmspGridMaterials(List<Map<String,Object>> map,String restackMake);
+//    查询当前仓库下的所有已经超过库龄预警界限的物资
+    List<Map<String, Object>> getGridMaterialAgeList(Map<String,Object> mapVal,Integer warehouseId);
 }

+ 69 - 8
src/main/java/com/steerinfo/dil/service/impl/WmspGridMaterialServiceImpl.java

@@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
 import java.util.*;
 
 /**
@@ -64,8 +65,31 @@ public class WmspGridMaterialServiceImpl  implements IWmspGridMaterialService {
     }
     //查询实时库存数据
     @Override
-    public List<Map<String, Object>> selectGridMaterial(Map<String, Object> mapval) {
-        return wmspGridMaterialMapper.selectGridMaterial(mapval);
+    public List<Map<String, Object>> selectGridMaterial(Map<String, Object> mapval,Integer warehouseId) {
+        //        通过当前时间获得前一个月的时间
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Calendar cal= Calendar.getInstance();
+        cal.add(Calendar.MONTH, -1);
+        long date2 = cal.getTimeInMillis();
+        String newDate=simpleDateFormat.format(new Date(date2));
+        mapval.put("warehouseId",warehouseId);
+        List<Map<String ,Object>> list1 = wmspGridMaterialMapper.selectGridMaterial(mapval);
+        mapval.put("newDate",newDate);
+        List<Map<String ,Object>> list2 = wmspGridMaterialMapper.getGridMaterialAgeList(mapval);
+        for (Map<String,Object> map1:list1){
+            Integer status = 0;
+            for (Map<String,Object> map2:list2){
+                String onlyCode1 = (String) map1.get("materialOnlyCode");
+                String onlyCode2 = (String) map2.get("onlyCode");
+//                当两个onlyeCode相等时,设置状态
+                if (onlyCode1.equals(onlyCode2)){
+//                    设置状态为入库预警超过界限
+                    status = 1;
+                }
+            }
+            map1.put("status",status);
+        }
+        return list1;
     }
     //根据仓储网格统计数据
     @Override
@@ -221,7 +245,8 @@ public class WmspGridMaterialServiceImpl  implements IWmspGridMaterialService {
 
 //        4、改变当前订单中已经稽核的吊牌的状态,改为已倒垛
 //            根据吊牌扫描结果查找对应的吊牌扫描实绩Id
-            BigDecimal resultId=wmspRestackScanResultMapper.getResultId(content);
+            List<Map<String,Object>> list1=wmspRestackScanResultMapper.getResultId(new BigDecimal(content));
+            BigDecimal resultId =(BigDecimal) list1.get(0).get("resultId");
             WmspRestackScanResult wmspRestackScanResult = new WmspRestackScanResult();
             wmspRestackScanResult.setResultId(resultId);
             wmspRestackScanResult.setStatus(new BigDecimal(1));
@@ -406,17 +431,53 @@ public class WmspGridMaterialServiceImpl  implements IWmspGridMaterialService {
             rmsPwarehouseGrid.setGridId((BigDecimal) map.get("gridId"));
             rmsPwarehouseGrid.setGridGradationNumber(new BigDecimal(CC));
             rmsPwarehouseGrid.setGridSequenceNumber(new BigDecimal(CX));
-            rmsPwarehouseGridMapper.updateByPrimaryKeySelective(rmsPwarehouseGrid);
+            i+= rmsPwarehouseGridMapper.updateByPrimaryKeySelective(rmsPwarehouseGrid);
 
 //            3.修改倒垛单的数量
 //            创建倒垛实绩表
+            WmspRestackMakeResult wmspRestackMakeResult = new WmspRestackMakeResult();
+            BigDecimal quantitys = (BigDecimal) map.get("quantity");
+            BigDecimal quantity = quantitys.subtract(new BigDecimal(1));
+            wmspRestackMakeResult.setQuantity(quantity);
+            wmspRestackMakeResult.setResultId((BigDecimal) map.get("restackId"));
+            i+= wmspRestackMakeResultMapper.updateByPrimaryKeySelective(wmspRestackMakeResult);
 //            4.判断当前倒垛单剩余数量是否小于等于0(小于则修改所有的符合条件的倒垛单状态),并且逻辑删除当前倒垛单
-              BigDecimal quantity =(BigDecimal) map.get("quantity");
-              if (quantity.compareTo(new BigDecimal(0))==-1){
+
+            if (quantity.compareTo(new BigDecimal(0))==-1){
 //                  当数量小于零的时候,将所有的入库扫描的实绩状态都变成已倒垛
-              }
+//                  查询该订单下的所有未倒垛的的订单
+                List<Map<String,Object>> list1 = wmspRestackScanResultMapper.getResultId((BigDecimal) map.get("restackId"));
+//                  创建入库扫描实体类
+                for (Map<String,Object> map2:list1){
+                    BigDecimal resultId = (BigDecimal) map2.get("resultId");
+                    WmspRestackScanResult wmspRestackScanResult = new WmspRestackScanResult();
+                    wmspRestackScanResult.setResultId(resultId);
+                    wmspRestackMakeResult.setResultStatus(new BigDecimal(1));
+                    i+=wmspRestackScanResultMapper.updateByPrimaryKeySelective(wmspRestackScanResult);
+                }
 
+//                将该订单的状态变为已完成
+                WmspRestackMakeResult wmspRestackMakeResult1 = new WmspRestackMakeResult();
+                wmspRestackMakeResult1.setResultId((BigDecimal) map.get("restackId"));
+                wmspRestackMakeResult1.setResultStatus(new BigDecimal(1));
+                i+= wmspRestackMakeResultMapper.updateByPrimaryKeySelective(wmspRestackMakeResult1);
+            }
+            return i;
         }
-        return 0;
+        return i;
+    }
+
+    @Override
+    public List<Map<String, Object>> getGridMaterialAgeList(Map<String,Object> mapVal,Integer warehouseId) {
+//        通过当前时间获得前一个月的时间
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Calendar cal= Calendar.getInstance();
+        cal.add(Calendar.MONTH, -1);
+        long date2 = cal.getTimeInMillis();
+        String newDate=simpleDateFormat.format(new Date(date2));
+        mapVal.put("warehouseId",warehouseId);
+        mapVal.put("newDate",newDate);
+        List<Map<String, Object>> list =wmspGridMaterialMapper.getGridMaterialAgeList(mapVal);
+        return list;
     }
 }

+ 1 - 1
src/main/java/com/steerinfo/dil/service/impl/WmspRestackMakeResultServiceImpl.java

@@ -381,6 +381,6 @@ public class WmspRestackMakeResultServiceImpl  implements IWmspRestackMakeResult
 //        查询当前订单下所有已经稽核且未倒垛的吊牌
         List<Map<String, Object>> materialScanTagMap = wmspRestackMakeTypeResultMapper.getRestackMakeMaterialScanTag(restackMake);
 
-        return wmspGridMaterialService.updateWmspGridMaterial(materialScanTagMap,restackMake);
+        return wmspGridMaterialService.updateWmspGridMaterials(materialScanTagMap,restackMake);
     }
 }

+ 12 - 2
src/main/resources/com/steerinfo/dil/mapper/WmspGridMaterialMapper.xml

@@ -446,7 +446,7 @@
     on RM.MATERIAL_TYPE_ID=RMT.MATERIAL_TYPE_ID
     left join WMSP_INBOUND_RESULT WIR
     on WIR.MATERIAL_ID = WGM.MATERIAL_ID
-    where WGM.DELETED = 0 and WIR.INBOUND_ISCOMPLETE = 1 order by WGM.INSERT_TIME DESC
+    where RPG.WAREHOUSE_ID = #{warehouseId} AND WGM.DELETED = 0 and WIR.INBOUND_ISCOMPLETE = 1 order by WGM.INSERT_TIME DESC
     )
    <if test="con!=null">
     where "materialName" like #{con} or "warehouseName" like #{con} or "stackingNo" like #{con}
@@ -785,7 +785,17 @@
       AND RM.MATERIAL_MODEL= #{materialModel}
       AND RM.MATERIAL_SPECIFICATION = #{materialSpecification}
   </select>
-  <delete id="deleteGridMaterial">
+    <select id="getGridMaterialAgeList" resultType="java.util.Map">
+      SELECT
+        RMS.MATERIAL_ONLY_CODE "onlyCode"
+        FROM WMSP_GRID_MATERIAL WGM
+        LEFT JOIN RMS_PWAREHOUSE_GRID RPG
+        ON RPG.GRID_ID = WGM.GRID_ID
+        LEFT JOIN RMS_MATERIAL_STEEL RMS
+        ON RMS.MATERIAL_STEEL_ID = WGM.MATERIAL_ID
+        WHERE WGM.INSERT_TIME &lt;= to_date(#{newDate}, 'yyyy-mm-dd hh24:mi:ss' )   AND WGM.UPDATE_TIME IS NULL AND RPG.WAREHOUSE_ID =#{warehouseId}
+    </select>
+    <delete id="deleteGridMaterial">
     update WMSP_GRID_MATERIAL WGM set WGM.DELETED = 1,UPDATE_TIME = #{now}
     where WGM.MATERIAL_ID in
     <foreach collection="thisMaterialDetailedInfos" item="item" open="(" separator="or" close=")">

+ 2 - 1
src/main/resources/com/steerinfo/dil/mapper/WmspRestackMakeTypeResultMapper.xml

@@ -388,7 +388,8 @@
            WGM.GM_NUMBER "gmNumber",
 --            物资重量
            WGM.GM_WEIGHT "weight",
-           RPG.GRID_ID "gridId"
+           RPG.GRID_ID "gridId",
+           WRCR.RESULT_RESTACK_ID "restackId"
     FROM WMSP_RESTACK_SCAN_RESULT WRCR
            LEFT JOIN WMSP_RESTACK_MAKE_RESULT WRMR
            ON WRMR.RESULT_ID = WRCR.RESULT_RESTACK_ID

+ 6 - 3
src/main/resources/com/steerinfo/dil/mapper/WmspRestackScanResultMapper.xml

@@ -685,9 +685,12 @@
     select count(*) from WMSP_RESTACK_SCAN_RESULT WRSR
     where RESULT_LOADER_AUDIT =1 AND  WRSR.MATERIAL_ONLY_CODE=#{onlyCode}
   </select>
-  <select id="getResultId" resultType="java.math.BigDecimal">
-    SELECT WRSR.RESULT_ID
+  <select id="getResultId" resultType="java.util.Map">
+    SELECT
+           WRSR.RESULT_ID "resultId"
     FROM WMSP_RESTACK_SCAN_RESULT WRSR
-    WHERE  WRSR.RESULT_SCAN_TAG = #{content}
+    LEFT JOIN WMSP_RESTACK_MAKE_RESULT WRMR
+    ON WRSR.RESULT_RESTACK_ID = WRMR.RESULT_ID
+    WHERE WRSR.STATUS = 0 AND WRSR.RESULT_SCAN_TAG = #{restackId}
   </select>
 </mapper>