瀏覽代碼

2.10删除实时库存接口

zhouzh 3 年之前
父節點
當前提交
84b855a076

+ 10 - 3
src/main/java/com/steerinfo/dil/controller/WmspOutboundResultController.java

@@ -5,11 +5,9 @@ import com.steerinfo.dil.mapper.CommonSeq;
 import com.steerinfo.dil.mapper.WmspInboundScanResultMapper;
 import com.steerinfo.dil.model.WmspOutboundResult;
 import com.steerinfo.dil.model.WmspOutboundScanResult;
-import com.steerinfo.dil.service.IWmspOutboundResultService;
 import com.steerinfo.dil.service.impl.WmspOutboundResultServiceImpl;
 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.framework.controller.RESTfulResult;
 import com.steerinfo.framework.service.pagehelper.PageHelper;
@@ -22,7 +20,10 @@ import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * WmspOutboundResult RESTful接口:
@@ -494,5 +495,11 @@ public class WmspOutboundResultController extends BaseRESTfulController {
         return success();
     }
 
+    //创建一个删除实时库的接口
+    @PostMapping("/deleteGridMaterial")
+    public RESTfulResult deleteGridMaterial(@RequestParam Integer resultId){
+        int result = wmspOutboundResultService.deleteGridMaterial(resultId);
+        return success(result);
+    }
 }
 

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

@@ -2,13 +2,11 @@ package com.steerinfo.dil.mapper;
 
 import com.steerinfo.dil.model.WmspGridMaterial;
 import com.steerinfo.framework.mapper.IBaseMapper;
-import org.apache.ibatis.annotations.MapKey;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
 import java.math.BigDecimal;
-import java.text.ParseException;
 import java.util.List;
 import java.util.Map;
 
@@ -51,4 +49,5 @@ public interface WmspGridMaterialMapper extends IBaseMapper<WmspGridMaterial, Bi
   BigDecimal slelectGridIdByMaterialOnlyCode(@Param("materialOnlyCode")String materialOnlyCode);
 
 
+  int updateByMaterialId(BigDecimal materialId);
 }

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

@@ -14,5 +14,6 @@ public interface WmspOutboundScanResultMapper extends IBaseMapper<WmspOutboundSc
     List<Map<String, Object>> getResultMaterial(Integer resultId);
     //通过物资唯一编码找寻物资名称、规格型号、物资唯一编码和物资质检是否合格
     List<Map<String, Object>> getRmsMaterial (String materialOnlyCode);
-
+    //通过物资唯一编码查询钢材物资唯一id
+    List<Map<String, Object>> getMaterialSteelId(String materialOnlyCode);
 }

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

@@ -2,7 +2,6 @@ package com.steerinfo.dil.service;
 
 import com.steerinfo.dil.model.WmspOutboundResult;
 import com.steerinfo.dil.model.WmspOutboundScanResult;
-import com.steerinfo.framework.service.IBaseService;
 
 import java.math.BigDecimal;
 import java.util.List;
@@ -76,4 +75,6 @@ public interface IWmspOutboundResultService {
     int EqualMaterialsNumber(BigDecimal resultId);
 //    根据orderId判断当前运输订单的状态
     int getOutboundStatus(BigDecimal orderId);
+    //删除实时库存
+    int deleteGridMaterial(Integer resultId);
 }

+ 26 - 3
src/main/java/com/steerinfo/dil/service/impl/WmspOutboundResultServiceImpl.java

@@ -1,14 +1,13 @@
 package com.steerinfo.dil.service.impl;
 
 import com.steerinfo.dil.feign.TmstruckFeign;
+import com.steerinfo.dil.mapper.WmspGridMaterialMapper;
 import com.steerinfo.dil.mapper.WmspOutboundResultMapper;
 import com.steerinfo.dil.mapper.WmspOutboundScanResultMapper;
-import com.steerinfo.dil.model.WmspInboundResult;
 import com.steerinfo.dil.model.WmspOutboundResult;
 import com.steerinfo.dil.model.WmspOutboundScanResult;
 import com.steerinfo.dil.service.IWmspOutboundResultService;
-import com.steerinfo.framework.mapper.IBaseMapper;
-import com.steerinfo.framework.service.impl.BaseServiceImpl;
+import com.steerinfo.dil.util.DataChange;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -42,6 +41,10 @@ public class WmspOutboundResultServiceImpl  implements IWmspOutboundResultServic
 
     @Autowired
     private TmstruckFeign tmstruckFeign;
+
+    @Autowired
+    private WmspGridMaterialMapper wmspGridMaterialMapper;
+
     @Override
     public List<Map<String, Object>> selectResultNumber(Map<String, Object> mapval) {
         return wmspOutboundResultMapper.selectResultNumber(mapval);
@@ -224,4 +227,24 @@ public class WmspOutboundResultServiceImpl  implements IWmspOutboundResultServic
     public int getOutboundStatus(BigDecimal orderId) {
         return wmspOutboundResultMapper.getOutboundStatus(orderId);
     }
+
+    @Override
+    public int deleteGridMaterial(Integer resultId) {
+        //获取扫描的物资
+        List<Map<String,Object>> scanList = wmspOutboundScanResultMapper.getResultMaterial(resultId);
+        //根据扫描的吊牌数据查询钢材物资id
+        List<Map<String,Object>> listMap = null;
+        int i=0;
+        for(Map<String,Object> scanMaterial:scanList){
+            String materialOnlyCode = scanMaterial.get("RESULT_MATERIAL").toString();
+            String[] tag1 = materialOnlyCode.split("\\-");
+            listMap = wmspOutboundScanResultMapper.getMaterialSteelId(tag1[7]);
+            for(Map<String,Object> map:listMap) {
+                BigDecimal materialId = DataChange.dataToBigDecimal(map.get("materialId"));
+                //将这些物资钢材id进行逻辑删除
+                i += wmspGridMaterialMapper.updateByMaterialId(materialId);
+            }
+        }
+        return i;
+    }
 }

+ 4 - 0
src/main/resources/com/steerinfo/dil/mapper/WmspGridMaterialMapper.xml

@@ -713,6 +713,10 @@
    WHERE  RMS.MATERIAL_ONLY_CODE=#{materialOnlyCode}
   </select>
 
+  <update id="updateByMaterialId" parameterType="java.math.BigDecimal">
+    update WMSP_GRID_MATERIAL WGM set WGM.DELETED = 1
+    where WGM.MATERIAL_ID = #{materialId}
+  </update>
   
   
 </mapper>

+ 8 - 0
src/main/resources/com/steerinfo/dil/mapper/WmspOutboundScanResultMapper.xml

@@ -446,4 +446,12 @@
     WHERE gcwz.MATERIAL_ONLY_CODE = #{materialOnlyCode}
   </select>
 
+  <select id="getMaterialSteelId" resultType="java.util.LinkedHashMap" parameterType="String">
+    SELECT
+       gcwz.MATERIAL_STEEL_ID "materialId"
+    FROM RMS_MATERIAL_STEEL gcwz
+    LEFT JOIN WMSP_GRID_MATERIAL wgm
+    ON gcwz.MATERIAL_STEEL_ID = wgm.MATERIAL_ID
+    WHERE gcwz.MATERIAL_ONLY_CODE = #{materialOnlyCode}
+  </select>
 </mapper>