hujh 3 éve
szülő
commit
b8e0239d09

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

@@ -161,7 +161,7 @@ public class WmsInboundResultController extends BaseRESTfulController {
                 //三、创建一个入库作业实绩
                 WmspInboundResult wmspInboundResult = wmsInboundResultServiceImpl.initAndWmspInboundResult(i+1,personnelWorkshopid,groupId,userName,new BigDecimal(conditionMap.get("distributeId").toString()),houseGrid,item);
                 //改变扫码实绩里面的状态
-                int status= wmsInboundScanResultServiceImpl.updateInboundScanStatus(new BigDecimal(item.get("resultId").toString()));
+                int status= wmsInboundScanResultServiceImpl.updateInboundScanStatus(new BigDecimal(item.get("resultId").toString()),wmspInboundResult.getInboundId());
                 //当都完成的时候就要去改变这一批的状态改为下发状态
                 if(mapList.size()==i+1){
                     int status2= wmsInboundResultServiceImpl.updateInboundStatus(new BigDecimal(conditionMap.get("distributeId").toString()));
@@ -187,7 +187,7 @@ public class WmsInboundResultController extends BaseRESTfulController {
                 //三、创建一个入库作业实绩
                 WmspInboundResult wmspInboundResult = wmsInboundResultServiceImpl.initAndWmspInboundResult(i+1,personnelWorkshopid,groupId,userName,wmspInboundDistribute.getDistributeId(),houseGrid,item);
                 //改变扫码实绩里面的状态
-                int status= wmsInboundScanResultServiceImpl.updateInboundScanStatus(new BigDecimal(item.get("resultId").toString()));
+                int status= wmsInboundScanResultServiceImpl.updateInboundScanStatus(new BigDecimal(item.get("resultId").toString()),wmspInboundResult.getInboundId());
             }
             return success(null);
         }

+ 4 - 0
src/main/java/com/steerinfo/dil/mapper/WmspInboundResultMapper.java

@@ -50,4 +50,8 @@ public interface WmspInboundResultMapper extends IBaseMapper<WmspInboundResult,
     BigDecimal getGrid(@Param("distributeId") String distributeId,@Param("resultNumber")  int row);
 
     int updateInboundStatus(BigDecimal distributeId);
+//    根据resultId查询对应的物资唯一编码
+    String getResultMaterialByResultId(Integer resultId);
+//    根据resultMaterialId获取相对应入库实绩和仓储网格
+    List<Map<String,Object>> getInboundResult(String resultMaterial);
 }

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

@@ -122,7 +122,7 @@ public interface WmspInboundScanResultMapper extends IBaseMapper<WmspInboundScan
 
     List<Map<String, Object>> noIssueScanResultList(String userName);
 
-    int updataStatusByResultId(BigDecimal resultId);
+    int updataStatusByResultId(BigDecimal resultId ,BigDecimal inboundId);
 
     Integer getResultStatusByResultId(String resultId);
 }

+ 3 - 0
src/main/java/com/steerinfo/dil/service/IWmsInboundResultService.java

@@ -65,4 +65,7 @@ public interface IWmsInboundResultService {
 
     int updateInboundStatus(BigDecimal distributeId);
 
+//    创建一个方法根据出厂的resultId修改对应的入库实绩和仓储网格Id
+    int updateInboundGridStatus(Integer resultId);
+
 }

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

@@ -122,7 +122,7 @@ public interface IWmsInboundScanResultService {
 //    根据index找到对应的成品并改变其入库状态
     int changeInboundIscomplete(BigDecimal index);
     //通过主键改变状态值
-     int updateInboundScanStatus(BigDecimal resultId);
+     int updateInboundScanStatus(BigDecimal resultId,BigDecimal inboundId);
 
     Integer getResultStatusByResultId(String resultId);
 }

+ 28 - 3
src/main/java/com/steerinfo/dil/service/impl/WmsInboundResultServiceImpl.java

@@ -1,6 +1,8 @@
 package com.steerinfo.dil.service.impl;
 
+import com.steerinfo.dil.mapper.WmspGridMaterialMapper;
 import com.steerinfo.dil.mapper.WmspInboundResultMapper;
+import com.steerinfo.dil.model.WmspGridMaterial;
 import com.steerinfo.dil.model.WmspInboundResult;
 import com.steerinfo.dil.service.IWmsInboundResultService;
 import com.steerinfo.dil.util.IDUtils;
@@ -23,7 +25,8 @@ public class WmsInboundResultServiceImpl implements IWmsInboundResultService {
 
     @Autowired
     WmspInboundResultMapper wmspInboundResultMapper;
-
+    @Autowired
+    WmspGridMaterialMapper wmspGridMaterialMapper;
     /**
      * 1.展示入库实绩所有信息
      * @param mapValue
@@ -173,6 +176,28 @@ public class WmsInboundResultServiceImpl implements IWmsInboundResultService {
         return wmspInboundResultMapper.updateInboundStatus(distributeId);
     }
 
-
-
+//    根据出库的resultId修改入库实绩的逻辑删除状态和仓储网格的状态
+    @Override
+    public int updateInboundGridStatus(Integer resultId) {
+        int i=0;
+//        根据出库的resultId获取当前的吊刚工扫描结果
+        String resultMaterial = wmspInboundResultMapper.getResultMaterialByResultId(resultId);
+//        根据扫描吊牌得到的物资唯一编码修改对应的入库实绩状态和仓储网格状态
+        List<Map<String ,Object>> list =wmspInboundResultMapper.getInboundResult(resultMaterial);
+        for (Map<String, Object> map:list){
+            BigDecimal inboundId = (BigDecimal) map.get("inboundId");
+            BigDecimal grmId = (BigDecimal) map.get("gmId");
+//        创建入库实绩实体类
+            WmspInboundResult wmspInboundResult = new WmspInboundResult();
+            wmspInboundResult.setInboundId(inboundId);
+            wmspInboundResult.setResultDeleted(new BigDecimal(1));
+            i+= wmspInboundResultMapper.updateByPrimaryKeySelective(wmspInboundResult);
+//        创建仓储网格实体类
+            WmspGridMaterial wmspGridMaterial = new WmspGridMaterial();
+            wmspGridMaterial.setGmId(grmId);
+            wmspGridMaterial.setDeleted(new BigDecimal(1));
+            i+= wmspGridMaterialMapper.updateByPrimaryKeySelective(wmspGridMaterial);
+        }
+        return i;
+    }
 }

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

@@ -325,8 +325,8 @@ public class WmsInboundScanResultServiceImpl implements IWmsInboundScanResultSer
         return wmspInboundStackResultMapper.updateByPrimaryKeySelective(wmspInboundStackResult);
     }
 
-    public int updateInboundScanStatus(BigDecimal resultId) {
-        return wmspInboundScanResultMapper.updataStatusByResultId(resultId);
+    public int updateInboundScanStatus(BigDecimal resultId,BigDecimal inboundId) {
+        return wmspInboundScanResultMapper.updataStatusByResultId(resultId,inboundId);
     }
 
     @Override

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

@@ -3,6 +3,7 @@ package com.steerinfo.dil.service.impl;
 import com.steerinfo.dil.feign.TmstruckFeign;
 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;
@@ -36,6 +37,8 @@ public class WmspOutboundResultServiceImpl  implements IWmspOutboundResultServic
 
     @Autowired
     private WmspOutboundScanResultMapper wmspOutboundScanResultMapper;
+    @Autowired
+    private WmsInboundResultServiceImpl wmsInboundResultService;
 
     @Autowired
     private TmstruckFeign tmstruckFeign;
@@ -179,13 +182,17 @@ public class WmspOutboundResultServiceImpl  implements IWmspOutboundResultServic
             // 设置出库实绩为成功、将出库实绩改完已经出库
             WmspOutboundResult wmspOutboundResult = wmspOutboundResultMapper.selectByPrimaryKey(new BigDecimal(resultId));
             wmspOutboundResult.setResultStatus(new BigDecimal(1));
-            result += wmspOutboundResultMapper.updateByPrimaryKeySelective(wmspOutboundResult);
+
             // 调用装货
             BigDecimal orderId = wmspOutboundResult.getBillLadingId();
             //result += tmstruckFeign.addSaleLoadResult(orderId.intValue());
             // 修改实时库存(逻辑删除) grid
             BigDecimal materialId = wmspOutboundResult.getMaterialId();
-            result += wmspOutboundResultMapper.updateGrid(materialId);
+//            创建一个方法用来修改入库实绩id的状态和仓储网格的状态,当且仅当返回值为2的时候是成功的
+            if (wmsInboundResultService.updateInboundGridStatus(resultId)%2 == 0){
+                result += wmspOutboundResultMapper.updateByPrimaryKeySelective(wmspOutboundResult);
+                result += wmspOutboundResultMapper.updateGrid(materialId);
+            }
         }
         return result;
     }

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

@@ -1172,8 +1172,30 @@
     <select id="getGrid" resultType="java.math.BigDecimal">
         select "gridId",rownum rm  from (select t.grid_Id "gridId" from WMSP_INBOUND_RESULT t where t.inbound_distribute_id=#{distributeId} and t.RESULT_NUMBER=#{resultNumber} ORDER BY inbound_time DESC )
     </select>
+<!--    根据resultId查询出对应的物资Id-->
+    <select id="getResultMaterialByResultId" resultType="java.lang.String">
+        SELECT  wosr.RESULT_MATERIAL "resultMaterial"
+        FROM WMSP_OUTBOUND_SCAN_RESULT wosr
+        WHERE wosr.OUTBOUND_RESULT_ID = #{resultId}
+
+    </select>
+    <select id="getInboundResult" resultType="java.util.LinkedHashMap"
+            parameterType="java.util.Map">
+        SELECT
+               wir.INBOUND_ID "inboundId",
+               wgm.GM_ID "gmId"
+        FROM WMSP_INBOUND_RESULT wir
+        JOIN WMSP_INBOUND_SCAN_RESULT wisr
+        ON wisr.INBOUND_RESULT_ID = wir.INBOUND_ID
+        JOIN WMSP_GRID_MATERIAL wgm
+        ON wgm.GRID_ID = wir.GRID_ID
+        WHERE wisr.RESULT_MATERIAL = #{resultMaterial}
+    </select>
+
     <update id="updateInboundStatus">
        update WMSP_INBOUND_RESULT set RESULT_STATUS= 2 where INBOUND_DISTRIBUTE_ID =  #{distributeId}
     </update>
 
+
+
 </mapper>

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

@@ -568,7 +568,8 @@ where wisr.result_id = #{stackResultId}
     <update id="updataStatusByResultId">
          update wmsp_inbound_scan_result wisr
          set wisr.result_number=0,
-            wisr.result_status_=1
+            wisr.result_status_=1,
+             wisr.INBOUND_RESULT_ID =#{inboundId}
          where wisr.result_id = #{resultId}
     </update>
     <select id="selectScanTagResult" resultType="java.util.Map">