浏览代码

出库祖业bug修改

hujh 3 年之前
父节点
当前提交
0c49d8d353
共有 19 个文件被更改,包括 373 次插入113 次删除
  1. 1 1
      pom.xml
  2. 3 0
      src/main/java/com/steerinfo/dil/controller/RmsMaterialController.java
  3. 7 1
      src/main/java/com/steerinfo/dil/controller/WmsInboundResultController.java
  4. 52 0
      src/main/java/com/steerinfo/dil/controller/WmsInboundScanResultController.java
  5. 8 0
      src/main/java/com/steerinfo/dil/controller/WmsReboundResultController.java
  6. 93 82
      src/main/java/com/steerinfo/dil/controller/WmspOutboundResultController.java
  7. 1 1
      src/main/java/com/steerinfo/dil/mapper/WmspInboundResultMapper.java
  8. 6 0
      src/main/java/com/steerinfo/dil/mapper/WmspInboundScanResultMapper.java
  9. 1 1
      src/main/java/com/steerinfo/dil/model/WmspInboundScanResult.java
  10. 15 0
      src/main/java/com/steerinfo/dil/model/WmspOutboundScanResult.java
  11. 6 0
      src/main/java/com/steerinfo/dil/service/IWmsInboundScanResultService.java
  12. 2 0
      src/main/java/com/steerinfo/dil/service/IWmspGridMaterialService.java
  13. 17 14
      src/main/java/com/steerinfo/dil/service/impl/WmsInboundResultServiceImpl.java
  14. 53 0
      src/main/java/com/steerinfo/dil/service/impl/WmsInboundScanResultServiceImpl.java
  15. 33 0
      src/main/java/com/steerinfo/dil/service/impl/WmspGridMaterialServiceImpl.java
  16. 3 3
      src/main/resources/com/steerinfo/dil/mapper/WmspInboundResultMapper.xml
  17. 31 0
      src/main/resources/com/steerinfo/dil/mapper/WmspInboundScanResultMapper.xml
  18. 10 3
      src/main/resources/com/steerinfo/dil/mapper/WmspOutboundResultMapper.xml
  19. 31 7
      src/main/resources/com/steerinfo/dil/mapper/WmspOutboundScanResultMapper.xml

+ 1 - 1
pom.xml

@@ -117,7 +117,7 @@
 <!--                        <param>WMSP_INBOUND_CORRECT_RESULT</param>-->
 <!--                        <param>WMSP_INBOUND_DRIVING_RESULT</param>-->
 <!--                        <param>WMSP_GRID_MATERIAL</param>-->
-                        <param>WMSP_INBOUND_DISTRIBUTE</param>
+                        <param>WMSP_OUTBOUND_SCAN_RESULT</param>
                     </tables>
                 </configuration>
                 <executions>

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

@@ -9,6 +9,9 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.awt.*;
+import java.util.LinkedList;
+
 /**
  * @author luobang
  * @create 2021-10-10 17:59

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

@@ -156,6 +156,8 @@ public class WmsInboundResultController extends BaseRESTfulController {
                 //如果差不多、说明上一个人少扫了一次
                 if (houseGrid==null){
                     houseGrid = rmsPwarehouseGridService.selectGrid(mapList.size()-1, personnelWorkshopid);
+                    //创建实时库存
+                    wmspGridMaterialService.initInsertWmspGridMaterial(item,houseGrid);
                 }
                 //遗留 批次、网格
                 //三、创建一个入库作业实绩
@@ -177,7 +179,8 @@ public class WmsInboundResultController extends BaseRESTfulController {
            }
             //第一、创建批次
             WmspInboundDistribute  wmspInboundDistribute=wmspInboundDistributeService.initAndCreateInboundDistribute(personnelWorkshopid,groupId,userName,batch);
-            //将下面的订单都录入这个批次里面
+
+           //将下面的订单都录入这个批次里面
             for (int i=0;i<mapList.size();i++){
                 Map<String,Object> item=mapList.get(i);
                 //二、智能的设置好这批钢材的位置、网格图
@@ -188,6 +191,9 @@ 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()),wmspInboundResult.getInboundId());
+
+                //创建实时库存
+                wmspGridMaterialService.initInsertWmspGridMaterial(item,houseGrid);
             }
             return success(null);
         }

+ 52 - 0
src/main/java/com/steerinfo/dil/controller/WmsInboundScanResultController.java

@@ -91,6 +91,9 @@ public class WmsInboundScanResultController extends BaseRESTfulController {
 
         return success(mapList);
     }
+
+
+
     /**
      * 1.新增扫描吊牌实绩!!!此时入库实绩未生成
      * @param
@@ -291,4 +294,53 @@ public class WmsInboundScanResultController extends BaseRESTfulController {
         int result =wmsInboundScanResultService.changeInboundIscomplete(stackResultId);
         return success(result);
     }
+
+
+
+
+    /**
+     * 1.新增退货扫描吊牌实绩!!!此时入库实绩未生成
+     * @param
+     * @return
+     */
+    @ApiOperation(value = "新增扫描吊牌实绩")
+    @PostMapping("/insertReboundScanResult")
+    @Transactional
+    public  synchronized RESTfulResult insertReboundScanResult(@RequestBody(required = false)Map<String,Object>map) throws ParseException {
+
+        //判断自己是否已经扫过了、并且没有出库过
+        int isExist= wmsInboundScanResultService.isExist2(map.get("userName").toString(),map.get("resultMaterial").toString().substring(0,map.get("resultMaterial").toString().length()-1));
+        //通过用户ID查询、当前扫描没有下发的物质、最终展示的集合
+        List<Map<String,Object>>mapList= wmsInboundScanResultService.noIssueScanResultList2(map.get("userName").toString());
+        if (isExist>0){
+            //如果已经被少扫过了返回扫码实绩集合
+            //返回结果显示
+            return failed(mapList);
+        }else {
+            //如果没有被扫
+            //创建一个扫码实绩
+            Map<String, Object>  wmspInboundScanResult =wmsInboundScanResultService.createInboundScanResultByResultMaterial2(mapList.size(),map.get("userName").toString(),map.get("resultMaterial").toString());
+            //判断是否创建成功、成功在添加
+            if (wmspInboundScanResult!=null){
+                mapList.add(wmspInboundScanResult);
+            }
+        }
+
+        return success(mapList);
+    }
+
+    /**
+     * 1.查看实时库存物质在实时库存里面没有出库的物质!!!
+     * @param
+     * @return
+     */
+    @ApiOperation(value = "新增扫描吊牌实绩")
+    @PostMapping("/getReboundScanResultByResultMaterial")
+    @Transactional
+    public  synchronized RESTfulResult getReboundScanResultByResultMaterial(@RequestBody(required = false)Map<String,Object>map) throws ParseException {
+        //查询是否未出库
+        //如果没有出库就需要这件钢材放到未出库钢材集合里面
+        //返回回显给用户
+        return null;
+    }
 }

+ 8 - 0
src/main/java/com/steerinfo/dil/controller/WmsReboundResultController.java

@@ -102,4 +102,12 @@ public class WmsReboundResultController extends BaseRESTfulController {
         return success(a);
     }
 
+    //新增退库实绩
+    @PostMapping("/getReIssuedResult")
+    public RESTfulResult getReIssuedResult(@RequestBody Map<String, Object> map){
+
+        //新增退库扫描实绩
+        return success(map);
+    }
+
 }

+ 93 - 82
src/main/java/com/steerinfo/dil/controller/WmspOutboundResultController.java

@@ -2,6 +2,7 @@ package com.steerinfo.dil.controller;
 
 import com.steerinfo.dil.feign.ESFeign;
 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;
@@ -21,10 +22,7 @@ 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;
-import java.util.Map;
+import java.util.*;
 
 /**
  * WmspOutboundResult RESTful接口:
@@ -46,6 +44,8 @@ public class WmspOutboundResultController extends BaseRESTfulController {
     @Autowired
     WmspOutboundResultServiceImpl wmspOutboundResultService;
     @Autowired
+    WmspInboundScanResultMapper wmspInboundScanResultMapper;
+    @Autowired
     CommonSeq commonSeq;
     @Autowired
     ESFeign esFeign;
@@ -150,87 +150,89 @@ public class WmspOutboundResultController extends BaseRESTfulController {
         Map<String,Object> map = new HashMap<>();
         map.put("orderId",orderId);
         map.put("materialId",materialId);
-        int orderNum = wmspOutboundResultService.ExistWmspOutboundResult(map);
         //初始化出库单详情信息
         Map<String, Object> outBoundDetailedInfo=null;
-        if(orderNum == 0){
-            /**创建出库单实体*/
-            WmspOutboundResult wmspOutboundResult = new WmspOutboundResult();
-            /**使用序列号增加生成主键id*/
-            int seq_wmspoutboundresult = commonSeq.getSeqNumber("seq__WMSP_OUTBOUND_RESULT");
-            /**获取到当前时间*/
-            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
-            /**生成出库单编号*/
-            String resultNumber = "XSCK" + sdf.format(new Date());
-            if(seq_wmspoutboundresult < 10){
-                resultNumber += "0000000" + seq_wmspoutboundresult;
-            }else if(seq_wmspoutboundresult < 100){
-                resultNumber += "000000" + seq_wmspoutboundresult;
-            }else if(seq_wmspoutboundresult < 1000){
-                resultNumber += "00000" + seq_wmspoutboundresult;
-            }else if(seq_wmspoutboundresult < 10000){
-                resultNumber += "0000" + seq_wmspoutboundresult;
-            }else  if(seq_wmspoutboundresult < 100000){
-                resultNumber += "000" + seq_wmspoutboundresult;
-            }else if(seq_wmspoutboundresult < 1000000){
-                resultNumber += "00" + seq_wmspoutboundresult;
-            }else if(seq_wmspoutboundresult < 10000000){
-                resultNumber += "0" + seq_wmspoutboundresult;
-            }else{
-                resultNumber += seq_wmspoutboundresult;
-            }
-            /**拿到运输订单类型*/
-            BigDecimal orderType = (BigDecimal) order.get("orderType");
-            /**运输订单类型判断
-             *    orderType : 1 为普通出库
-             *    orderType : 4 为调拨出库
-             * */
-            String resultOutboundType = "普通出库";
-            if(orderType.intValue() == 4){
-                resultOutboundType = "调拨出库";
-            }
-            /**把出库单主键id添加到出库单实体中*/
-            wmspOutboundResult.setResultId(new BigDecimal(seq_wmspoutboundresult));
-            /**把出库单编号添加到出库单实体中*/
-            wmspOutboundResult.setResultNumber(resultNumber);
-            /**把运输订单主键添加到出库单实体中*/
-            wmspOutboundResult.setBillLadingId(orderId);
-            /**把出库类型添加到出库单实体中*/
-            wmspOutboundResult.setResultOutboundType(resultOutboundType);
-            /**第一次添加为待出库*/
-            wmspOutboundResult.setResultStatus(new BigDecimal(0));
-            //常规字段
-            wmspOutboundResult.setInsertUsername("admin");
-            wmspOutboundResult.setInsertTime(new Date());
-            wmspOutboundResult.setUpdateUsername("admin");
-            wmspOutboundResult.setUpdateTime(new Date());
-            wmspOutboundResult.setInsertUpdateRemark("无");
-            wmspOutboundResult.setDeleted(new BigDecimal(0));
-            //还没装货的物资id的第一条添加到出库单实体中
-            wmspOutboundResult.setMaterialId(materialId);
-            Integer res = wmspOutboundResultService.insertSelective(wmspOutboundResult);
-            if(res == 1){
+        if ("".equals(wmspOutboundResultService.ExistWmspOutboundResult(map))){
+            int orderNum = wmspOutboundResultService.ExistWmspOutboundResult(map);
+            if(orderNum == 0){
+                /**创建出库单实体*/
+                WmspOutboundResult wmspOutboundResult = new WmspOutboundResult();
+                /**使用序列号增加生成主键id*/
+                int seq_wmspoutboundresult = commonSeq.getSeqNumber("seq__WMSP_OUTBOUND_RESULT");
+                /**获取到当前时间*/
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+                /**生成出库单编号*/
+                String resultNumber = "XSCK" + sdf.format(new Date());
+                if(seq_wmspoutboundresult < 10){
+                    resultNumber += "0000000" + seq_wmspoutboundresult;
+                }else if(seq_wmspoutboundresult < 100){
+                    resultNumber += "000000" + seq_wmspoutboundresult;
+                }else if(seq_wmspoutboundresult < 1000){
+                    resultNumber += "00000" + seq_wmspoutboundresult;
+                }else if(seq_wmspoutboundresult < 10000){
+                    resultNumber += "0000" + seq_wmspoutboundresult;
+                }else  if(seq_wmspoutboundresult < 100000){
+                    resultNumber += "000" + seq_wmspoutboundresult;
+                }else if(seq_wmspoutboundresult < 1000000){
+                    resultNumber += "00" + seq_wmspoutboundresult;
+                }else if(seq_wmspoutboundresult < 10000000){
+                    resultNumber += "0" + seq_wmspoutboundresult;
+                }else{
+                    resultNumber += seq_wmspoutboundresult;
+                }
+                /**拿到运输订单类型*/
+                BigDecimal orderType = (BigDecimal) order.get("orderType");
+                /**运输订单类型判断
+                 *    orderType : 1 为普通出库
+                 *    orderType : 4 为调拨出库
+                 * */
+                String resultOutboundType = "普通出库";
+                if(orderType.intValue() == 4){
+                    resultOutboundType = "调拨出库";
+                }
+                /**把出库单主键id添加到出库单实体中*/
+                wmspOutboundResult.setResultId(new BigDecimal(seq_wmspoutboundresult));
+                /**把出库单编号添加到出库单实体中*/
+                wmspOutboundResult.setResultNumber(resultNumber);
+                /**把运输订单主键添加到出库单实体中*/
+                wmspOutboundResult.setBillLadingId(orderId);
+                /**把出库类型添加到出库单实体中*/
+                wmspOutboundResult.setResultOutboundType(resultOutboundType);
+                /**第一次添加为待出库*/
+                wmspOutboundResult.setResultStatus(new BigDecimal(0));
+                //常规字段
+                wmspOutboundResult.setInsertUsername("admin");
+                wmspOutboundResult.setInsertTime(new Date());
+                wmspOutboundResult.setUpdateUsername("admin");
+                wmspOutboundResult.setUpdateTime(new Date());
+                wmspOutboundResult.setInsertUpdateRemark("无");
+                wmspOutboundResult.setDeleted(new BigDecimal(0));
+                //还没装货的物资id的第一条添加到出库单实体中
+                wmspOutboundResult.setMaterialId(materialId);
+                Integer res = wmspOutboundResultService.insertSelective(wmspOutboundResult);
+                if(res == 1){
 
+                    //返回出库单详情信息
+                    outBoundDetailedInfo = wmspOutboundResultService.getOutBoundDetailedInfo(orderId);
+                    outBoundDetailedInfo.put("orderNumber",orderNumber);
+//                outBoundDetailedInfo.put("personnelName",personnelName);
+                    outBoundDetailedInfo.put("materialCode",materialCode);
+                    outBoundDetailedInfo.put("materialName",materialName);
+                    outBoundDetailedInfo.put("materialSpecification",materialSpecification);
+                    outBoundDetailedInfo.put("materialModel",materialModel);
+                    outBoundDetailedInfo.put("materialTheoreticalWeight",materialTheoreticalWeight);
+                }
+            }else{
                 //返回出库单详情信息
                 outBoundDetailedInfo = wmspOutboundResultService.getOutBoundDetailedInfo(orderId);
                 outBoundDetailedInfo.put("orderNumber",orderNumber);
-//                outBoundDetailedInfo.put("personnelName",personnelName);
+//            outBoundDetailedInfo.put("personnelName",personnelName);
                 outBoundDetailedInfo.put("materialCode",materialCode);
                 outBoundDetailedInfo.put("materialName",materialName);
                 outBoundDetailedInfo.put("materialSpecification",materialSpecification);
                 outBoundDetailedInfo.put("materialModel",materialModel);
                 outBoundDetailedInfo.put("materialTheoreticalWeight",materialTheoreticalWeight);
             }
-        }else{
-            //返回出库单详情信息
-            outBoundDetailedInfo = wmspOutboundResultService.getOutBoundDetailedInfo(orderId);
-            outBoundDetailedInfo.put("orderNumber",orderNumber);
-//            outBoundDetailedInfo.put("personnelName",personnelName);
-            outBoundDetailedInfo.put("materialCode",materialCode);
-            outBoundDetailedInfo.put("materialName",materialName);
-            outBoundDetailedInfo.put("materialSpecification",materialSpecification);
-            outBoundDetailedInfo.put("materialModel",materialModel);
-            outBoundDetailedInfo.put("materialTheoreticalWeight",materialTheoreticalWeight);
         }
         return outBoundDetailedInfo;
     }
@@ -286,11 +288,6 @@ public class WmspOutboundResultController extends BaseRESTfulController {
             //通过装卸工工号查询装卸工Id
             BigDecimal personnelId = wmspOutboundResultService.getPersonnelIdByJobnumber(personnelJobNumber);
             //通过出库实绩Id判断出库单已扫描的件数是否等于运输订单物资表的物资件数
-            int EqualMaterialsNumber = wmspOutboundResultService.EqualMaterialsNumber(resultId);
-            if(EqualMaterialsNumber==1){
-                //相等返回装货数量已够
-                return failed("装货数量已够");
-            }else {
                 ///解析物质二维码信息
                 //截取扫描结果,得到物资唯一编码
                 String[] split = resultMaterial.split("-");
@@ -308,6 +305,11 @@ public class WmspOutboundResultController extends BaseRESTfulController {
                 int seq_wmspOutboundScanResult = commonSeq.getSeqNumber("seq__WMSP_OUTBOUND_SCAN_RESULT");
                 //插入主键id
                 wmspOutboundScanResult.setResultId(new BigDecimal(seq_wmspOutboundScanResult));
+                //根据物资id查询相对应的入库实绩ID,并将其赋值给相对应的入库扫描实绩表
+                List<Map<String, Object>> list= wmspInboundScanResultMapper.getInboundResultIdByMaterial(subResultMaterial);
+//                默认以获取到的第一个值作为入库实绩Id
+                Map<String ,Object> map1 = list.get(0);
+                wmspOutboundScanResult.setInboundResultId((BigDecimal) map1.get("inboundResultId"));
                 //插入出库实绩ID
                 wmspOutboundScanResult.setOutboundResultId(resultId);
                 //插入装卸工Id
@@ -325,8 +327,15 @@ public class WmspOutboundResultController extends BaseRESTfulController {
                 wmspOutboundScanResult.setUpdateTime(new Date());
                 wmspOutboundScanResult.setInsertUpdateRemark("无");
                 if(SteelMaterialId.intValue()==OutboundMaterialId.intValue()){
-                    //稽核成功,设定扫描实绩稽核结果为成功
-                    wmspOutboundScanResult.setResultCheck(new BigDecimal(0));
+                    int EqualMaterialsNumber = wmspOutboundResultService.EqualMaterialsNumber(resultId);
+                    if(EqualMaterialsNumber==1){
+                        //相等返回装货数量已够
+                        wmspOutboundScanResult.setResultCheck(new BigDecimal(1));
+                    }else {
+                        //稽核成功,设定扫描实绩稽核结果为成功
+                        wmspOutboundScanResult.setResultCheck(new BigDecimal(0));
+                    }
+
                     //插入扫描实绩
                     wmspOutboundResultService.scanResultInsert(wmspOutboundScanResult);
                 }else {
@@ -346,7 +355,9 @@ public class WmspOutboundResultController extends BaseRESTfulController {
                 //theSameOutboundInfo.put("warehouseName",warehouseName);
                 //2、获取出库扫描实绩数据
                 List<Map<String,Object>> scanAuditSuccessInfo = wmspOutboundResultService.scanAuditSuccessInfo(resultId);
-                //补全出库扫描实绩数据的信息
+                //补全出库扫描实绩数据的信息,对扫描实绩进行去重
+
+
                 for (Map<String, Object> stringObjectMap : scanAuditSuccessInfo) {
                     String resultMaterial1 = (String) stringObjectMap.get("resultMaterial");
                     //截取扫描结果,得到一件物资的详细信息
@@ -381,7 +392,7 @@ public class WmspOutboundResultController extends BaseRESTfulController {
                     stringObjectMap.putAll(theSameOutboundInfo);
                 }
                 return success(scanAuditSuccessInfo);
-            }
+
         }else{
             //返回已扫描并并稽核成功的物资信息
             //1、获取出库单统一信息

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

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

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

@@ -125,4 +125,10 @@ public interface WmspInboundScanResultMapper extends IBaseMapper<WmspInboundScan
     int updataStatusByResultId(BigDecimal resultId ,BigDecimal inboundId);
 
     Integer getResultStatusByResultId(String resultId);
+
+    int isExist2(String userName, String resultMaterial);
+
+    List<Map<String, Object>> noIssueScanResultList2(String userName);
+//    根据物资Id查询相对应的入库实绩ID
+    List<Map<String, Object>> getInboundResultIdByMaterial(String subResultMaterial);
 }

+ 1 - 1
src/main/java/com/steerinfo/dil/model/WmspInboundScanResult.java

@@ -29,7 +29,7 @@ public class WmspInboundScanResult implements IBasePO<BigDecimal> {
     private BigDecimal loadId;
 
     /**
-     * 分组 ID(LOAD_ID,DECIMAL,0)
+     * 分组 ID(LOAD_ID,DECIMAL,0) 如果分组为空说明可能是退回、不需要扫两次的
      */
     @ApiModelProperty(value="分组 ID",required=false)
     private BigDecimal inboundGroupId;

+ 15 - 0
src/main/java/com/steerinfo/dil/model/WmspOutboundScanResult.java

@@ -81,8 +81,22 @@ public class WmspOutboundScanResult implements IBasePO<BigDecimal> {
     @ApiModelProperty(value="记录创建或修改备注",required=false)
     private String insertUpdateRemark;
 
+    /**
+     * 分组信息
+     */
+    @ApiModelProperty(value="分组信息",required=false)
+    private BigDecimal inboundResultId;
+
     private static final long serialVersionUID = 1L;
 
+    public BigDecimal getInboundResultId() {
+        return inboundResultId;
+    }
+
+    public void setInboundResultId(BigDecimal inboundResultId) {
+        this.inboundResultId = inboundResultId;
+    }
+
     @Override
     public BigDecimal getId() {
         return this.resultId;
@@ -208,6 +222,7 @@ public class WmspOutboundScanResult implements IBasePO<BigDecimal> {
         sb.append(", updateTime=").append(updateTime);
         sb.append(", insertUpdateRemark=").append(insertUpdateRemark);
         sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append(", inboundResultId=").append(inboundResultId);
         sb.append("]");
         return sb.toString();
     }

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

@@ -125,4 +125,10 @@ public interface IWmsInboundScanResultService {
      int updateInboundScanStatus(BigDecimal resultId,BigDecimal inboundId);
 
     Integer getResultStatusByResultId(String resultId);
+    //判断只扫一次的是否已经被扫过了
+    int isExist2(String userName, String substring);
+    //通过用户明查询只扫一次的集合
+     List<Map<String, Object>> noIssueScanResultList2(String userName);
+    //创建只扫一次的扫描实绩
+    Map<String, Object> createInboundScanResultByResultMaterial2(int size, String userName, String resultMaterial) throws ParseException;
 }

+ 2 - 0
src/main/java/com/steerinfo/dil/service/IWmspGridMaterialService.java

@@ -44,4 +44,6 @@ public interface IWmspGridMaterialService  {
 
    //修改物资钢材表的质量是否合格字段和逻辑删除
    int updateRmsMaterialSteelDemotion(Map<String, Object> map);
+
+    void initInsertWmspGridMaterial(Map<String, Object> item, BigDecimal houseGrid);
 }

+ 17 - 14
src/main/java/com/steerinfo/dil/service/impl/WmsInboundResultServiceImpl.java

@@ -181,22 +181,25 @@ public class WmsInboundResultServiceImpl implements IWmsInboundResultService {
     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");
+        List<Map<String ,Object>> resultMaterial = wmspInboundResultMapper.getResultMaterialByResultId(resultId);
+        for (Map<String, Object> map1: resultMaterial){
+            String material = (String) map1.get("resultMaterial");
+            //        根据扫描吊牌得到的物资唯一编码修改对应的入库实绩状态和仓储网格状态
+            List<Map<String ,Object>> list =wmspInboundResultMapper.getInboundResult(material);
+            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);
+                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);
+                WmspGridMaterial wmspGridMaterial = new WmspGridMaterial();
+                wmspGridMaterial.setGmId(grmId);
+                wmspGridMaterial.setDeleted(new BigDecimal(1));
+                i+= wmspGridMaterialMapper.updateByPrimaryKeySelective(wmspGridMaterial);
+            }
         }
         return i;
     }

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

@@ -333,4 +333,57 @@ public class WmsInboundScanResultServiceImpl implements IWmsInboundScanResultSer
     public Integer getResultStatusByResultId(String resultId) {
         return wmspInboundScanResultMapper.getResultStatusByResultId(resultId);
     }
+
+    @Override
+    public int isExist2(String userName, String resultMaterial) {
+        return wmspInboundScanResultMapper.isExist2(userName,resultMaterial);
+    }
+
+    @Override
+    public Map<String, Object> createInboundScanResultByResultMaterial2(int scanedCount, String userName, String resultMaterial) throws ParseException {
+        //创建入库扫描实绩、并且给对象赋值
+        WmspInboundScanResult wmspInboundScanResult=new WmspInboundScanResult();
+        //设置主键自增,这里需要修改
+        wmspInboundScanResult.setId(count());
+
+        //分组 只需要扫一次没有分组信息
+        //根据用户名和分组状态查询到分组信息
+//        BigDecimal groupId= wmspInboundGroupService.getGroupIdByUserName(userName);
+//        wmspInboundScanResult.setInboundGroupId(groupId);
+        //吊钢工扫描吊牌结果
+        wmspInboundScanResult.setResultMaterial(resultMaterial);
+        //扫描吊牌信息
+        wmspInboundScanResult.setResultLoadTime(new Date());
+        //新增钢材物资ID
+        Map<String,Object> materialSteel = rmsMaterialSteelService.insertRmsMaterialSteel2(resultMaterial);
+        wmspInboundScanResult.setMaterialId(new BigDecimal(materialSteel.get("materialSteelId").toString()));
+        //创建用户
+        //insertUsername
+        wmspInboundScanResult.setInboundAbnormalis(new BigDecimal(0));
+        //设置入库物资件数,默认一件
+        wmspInboundScanResult.setInboundMaterialNumber(new BigDecimal(1));
+        // 状态:0:未下发;1:已下发
+        wmspInboundScanResult.setResultStatus(new BigDecimal(0));
+        //吊钢工已扫物资次数 ,目前已扫描为没有下发的物质
+        //BigDecimal scanCount= wmspInboundScanResultMapper.getScanedNumber(userId);
+        wmspInboundScanResult.setResultNumber(new BigDecimal(scanedCount));
+        //逻辑删除:1:删除,0:未删除
+        wmspInboundScanResult.setResultDeleted(new BigDecimal(0));
+        //扫码用户
+        wmspInboundScanResult.setInsertUsername(userName);
+        //创建时间
+        wmspInboundScanResult.setInsertTime(new Date());
+        int status = wmspInboundScanResultMapper.insertSelective(wmspInboundScanResult);
+        //判断是否创建成功
+        if (status>0){
+            materialSteel.putAll(JSON.parseObject(JSON.toJSONString(wmspInboundScanResult),new TypeReference<Map<String,Object>>(){}));
+            return materialSteel;
+        }
+        return null;
+    }
+
+    @Override
+    public List<Map<String, Object>> noIssueScanResultList2(String userName) {
+        return wmspInboundScanResultMapper.noIssueScanResultList2(userName);
+    }
 }

+ 33 - 0
src/main/java/com/steerinfo/dil/service/impl/WmspGridMaterialServiceImpl.java

@@ -3,12 +3,14 @@ package com.steerinfo.dil.service.impl;
 import com.steerinfo.dil.mapper.WmspGridMaterialMapper;
 import com.steerinfo.dil.model.WmspGridMaterial;
 import com.steerinfo.dil.service.IWmspGridMaterialService;
+import com.steerinfo.dil.util.DataChange;
 import com.steerinfo.framework.mapper.IBaseMapper;
 import com.steerinfo.framework.service.impl.BaseServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -102,4 +104,35 @@ public class WmspGridMaterialServiceImpl  implements IWmspGridMaterialService {
         return wmspGridMaterialMapper.updateInboundStackByInboundId(inboundId);
     }
 
+    /**
+     * 创建实时库存
+     * @param item
+     * @param houseGrid
+     */
+    @Override
+    public void initInsertWmspGridMaterial(Map<String, Object> item, BigDecimal houseGrid) {
+          /*
+            插入一条网格物资中间表
+             */
+        WmspGridMaterial wmspGridMaterial = new WmspGridMaterial();
+        //设置主键ID
+        wmspGridMaterial.setGmId(wmspGridMaterialMapper.getCount());
+        wmspGridMaterial.setGridId(houseGrid);
+        wmspGridMaterial.setGmNumber(new BigDecimal(1));
+        wmspGridMaterial.setStandardDataId(new BigDecimal(1));
+        //设置网格物资表里面的物资ID
+        BigDecimal materialId= DataChange.dataToBigDecimal(item.get("materialId"));
+        wmspGridMaterial.setMaterialId(materialId);
+        //设置逻辑删除字段
+        wmspGridMaterial.setDeleted(new BigDecimal(0));
+        //设置常规字段
+        wmspGridMaterial.setInsertUsername("admin");
+        wmspGridMaterial.setInsertTime(new Date());
+        wmspGridMaterial.setUpdateUsername("admin");
+        wmspGridMaterial.setUpdateTime(new Date());
+        wmspGridMaterial.setInsertUpdateRemark("无");
+        wmspGridMaterial.setStatus(new BigDecimal(2));
+        insertWmspGridMaterial(wmspGridMaterial);
+    }
+
 }

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

@@ -1173,11 +1173,11 @@
         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 id="getResultMaterialByResultId" resultType="java.util.LinkedHashMap">
         SELECT  wosr.RESULT_MATERIAL "resultMaterial"
         FROM WMSP_OUTBOUND_SCAN_RESULT wosr
-        WHERE wosr.OUTBOUND_RESULT_ID = #{resultId}
-
+        WHERE wosr.RESULT_CHECK = 0
+        AND wosr.OUTBOUND_RESULT_ID = #{resultId}
     </select>
     <select id="getInboundResult" resultType="java.util.LinkedHashMap"
             parameterType="java.util.Map">

+ 31 - 0
src/main/resources/com/steerinfo/dil/mapper/WmspInboundScanResultMapper.xml

@@ -1040,6 +1040,37 @@ where wisr.result_id = #{stackResultId}
     <select id="getResultStatusByResultId" resultType="java.lang.Integer">
         SELECT RESULT_STATUS_ FROM WMSP_INBOUND_SCAN_RESULT WHERE RESULT_ID=#{resultId}
     </select>
+    <select id="isExist2" resultType="java.lang.Integer">
+        select * from  WMSP_INBOUND_SCAN_RESULT wisr
+        left join  WMSP_INBOUND_RESULT wir
+        on wisr.INBOUND_RESULT_ID=wir.INBOUND_ID
+        where  wisr.result_material=#{resultMaterial} and wisr.INSERT_USERNAME =  #{userName} and wisr.inbound_Group_Id is null and wir.RESULT_DELETED ! =0
+    </select>
+    <select id="noIssueScanResultList2" resultType="java.util.Map">
+         select
+               rm.material_name             "materialName",
+               rm.material_specification    "materialSpecification",
+               rm.material_model            "materialMode",
+               rms.material_furnace_number  "materialFurnaceNo",
+               rms.material_production_date "materialProDate",
+               wisr.RESULT_ID as            "resultId",
+               wisr.INBOUND_ABNORMALIS     "abnormalis",
+               wisr.material_id as          "materialId"
+              from wmsp_inbound_scan_result wisr
+              left join rms_material_steel rms
+              on rms.material_steel_id = wisr.material_id
+              left join rms_material rm
+              on rm.material_id = rms.material_id
+              where wisr.INSERT_USERNAME = #{userName}
+              and wisr.RESULT_STATUS_ = 0
+              and wisr.inbound_Group_Id is null
+    </select>
+<!--    根据物资Id查询相对应的入库实绩ID-->
+    <select id="getInboundResultIdByMaterial" resultType="java.util.LinkedHashMap">
+        SELECT wisr.INBOUND_RESULT_ID "inboundResultId"
+        FROM WMSP_INBOUND_SCAN_RESULT wisr
+        WHERE wisr.RESULT_MATERIAL = #{subResultMaterial}
+    </select>
 
 
 </mapper>

+ 10 - 3
src/main/resources/com/steerinfo/dil/mapper/WmspOutboundResultMapper.xml

@@ -711,7 +711,7 @@
   <select id="ExistWmspOutboundResult" parameterType="java.util.Map" resultType="int">
     select count(*)
     from WMSP_OUTBOUND_RESULT w_outbound
-    where w_outbound.BILL_LADING_ID=#{orderId} and w_outbound.MATERIAL_ID=#{materialId} and w_outbound.DELETED=0
+    where (w_outbound.DELETED=0 and w_outbound.RESULT_STATUS =1) and w_outbound.BILL_LADING_ID=#{orderId} and w_outbound.MATERIAL_ID=#{materialId}
   </select>
 
   <select id="getOutBoundDetailedInfo" parameterType="java.math.BigDecimal" resultType="java.util.LinkedHashMap">
@@ -754,8 +754,15 @@
   <!--  根据扫描结果查询扫描实绩是否存在-->
   <select id="ExistScanResult" parameterType="String" resultType="int">
     select count(*)
-    from WMSP_OUTBOUND_SCAN_RESULT outbound_scan
-    where outbound_scan.RESULT_MATERIAL = #{resultMaterial}
+    from WMSP_OUTBOUND_SCAN_RESULT wosr
+            join WMSP_OUTBOUND_RESULT wor
+            on wor.RESULT_ID = wosr.OUTBOUND_RESULT_ID
+           join WMSP_INBOUND_SCAN_RESULT wisr
+            on wosr.RESULT_MATERIAL = wisr.RESULT_MATERIAL
+            join WMSP_INBOUND_RESULT wir
+            on wisr.INBOUND_RESULT_ID = wir.INBOUND_ID
+    where  (wir.RESULT_DELETED = 0 or  wor.RESULT_STATUS = 1)
+          or wosr.RESULT_MATERIAL = #{resultMaterial}
   </select>
 
   <!--  通过物资物资唯一编码查询钢材物资表的物资Id-->

+ 31 - 7
src/main/resources/com/steerinfo/dil/mapper/WmspOutboundScanResultMapper.xml

@@ -14,15 +14,16 @@
     <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
     <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
     <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
+    <result column="INBOUND_RESULT_ID" jdbcType="DECIMAL" property="inboundResultId" />
   </resultMap>
   <sql id="columns">
     RESULT_ID, OUTBOUND_RESULT_ID, LOAD_ID, RESULT_MATERIAL, RESULT_LOAD_TIME, OUTBOUND_MATERIAL_NUMBER, 
-    RESULT_CHECK, INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK
+    RESULT_CHECK, INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,INBOUND_RESULT_ID
   </sql>
   <sql id="columns_alias">
     t.RESULT_ID, t.OUTBOUND_RESULT_ID, t.LOAD_ID, t.RESULT_MATERIAL, t.RESULT_LOAD_TIME, 
     t.OUTBOUND_MATERIAL_NUMBER, t.RESULT_CHECK, t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, 
-    t.UPDATE_TIME, t.INSERT_UPDATE_REMARK
+    t.UPDATE_TIME, t.INSERT_UPDATE_REMARK ,t.INBOUND_RESULT_ID
   </sql>
   <sql id="select">
     SELECT <include refid="columns"/> FROM WMSP_OUTBOUND_SCAN_RESULT
@@ -68,6 +69,9 @@
       <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
         and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
       </if>
+      <if test="inboundResultId != null">
+        and INBOUND_RESULT_ID = #{inboundResultId}
+      </if>
     </where>
   </sql>
   <sql id="whereLike">
@@ -108,6 +112,9 @@
       <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
         and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
       </if>
+      <if test="inboundResultId != null and inboundResultId != ''">
+        and INBOUND_RESULT_ID LIKE '%${inboundResultId}%'
+      </if>
     </where>
   </sql>
   <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
@@ -150,17 +157,20 @@
       <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
         or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
       </if>
+      <if test="inboundResultId != null and inboundResultId != ''">
+        or INBOUND_RESULT_ID = #{inboundResultId}
+      </if>
   </delete>
   <insert id="insert" parameterType="com.steerinfo.dil.model.WmspOutboundScanResult">
     insert into WMSP_OUTBOUND_SCAN_RESULT (RESULT_ID, OUTBOUND_RESULT_ID, LOAD_ID, 
       RESULT_MATERIAL, RESULT_LOAD_TIME, OUTBOUND_MATERIAL_NUMBER, 
       RESULT_CHECK, INSERT_USERNAME, INSERT_TIME, 
-      UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK
+      UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,INBOUND_RESULT_ID
       )
     values (#{resultId,jdbcType=DECIMAL}, #{outboundResultId,jdbcType=DECIMAL}, #{loadId,jdbcType=DECIMAL}, 
       #{resultMaterial,jdbcType=VARCHAR}, #{resultLoadTime,jdbcType=TIMESTAMP}, #{outboundMaterialNumber,jdbcType=DECIMAL}, 
       #{resultCheck,jdbcType=DECIMAL}, #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP}, 
-      #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR}
+      #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR},#{inboundResultId,jdbcType=DECIMAL}
       )
   </insert>
   <insert id="insertSelective" parameterType="com.steerinfo.dil.model.WmspOutboundScanResult">
@@ -202,6 +212,9 @@
       <if test="insertUpdateRemark != null">
         INSERT_UPDATE_REMARK,
       </if>
+      <if test="inboundResultId != null">
+        INBOUND_RESULT_ID,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="resultId != null">
@@ -240,6 +253,9 @@
       <if test="insertUpdateRemark != null">
         #{insertUpdateRemark,jdbcType=VARCHAR},
       </if>
+      <if test="inboundResultId != null">
+        #{inboundResultId,jdbcType=DECIMAL},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.WmspOutboundScanResult">
@@ -254,7 +270,8 @@
       INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
       UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
       UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
-      INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR}
+      INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
+      INBOUND_RESULT_ID = #{inboundResultId,jdbcType=DECIMAL},
     where RESULT_ID = #{resultId,jdbcType=DECIMAL}
   </update>
   <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.WmspOutboundScanResult">
@@ -293,6 +310,9 @@
       <if test="insertUpdateRemark != null">
         INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
       </if>
+      <if test="inboundResultId != null">
+        INBOUND_RESULT_ID = #{inboundResultId,jdbcType=DECIMAL},
+      </if>
     </set>
     where RESULT_ID = #{resultId,jdbcType=DECIMAL}
   </update>
@@ -315,7 +335,7 @@
       RESULT_LOAD_TIME, OUTBOUND_MATERIAL_NUMBER, 
       RESULT_CHECK, INSERT_USERNAME, 
       INSERT_TIME, UPDATE_USERNAME, 
-      UPDATE_TIME, INSERT_UPDATE_REMARK
+      UPDATE_TIME, INSERT_UPDATE_REMARK,INBOUND_RESULT_ID
       )
     ( <foreach collection="list" item="item" separator="union all"> 
    select  
@@ -324,7 +344,7 @@
       #{item.resultLoadTime,jdbcType=TIMESTAMP}, #{item.outboundMaterialNumber,jdbcType=DECIMAL}, 
       #{item.resultCheck,jdbcType=DECIMAL}, #{item.insertUsername,jdbcType=VARCHAR}, 
       #{item.insertTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR}, 
-      #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR}
+      #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.inboundResultId,jdbcType=DECIMAL}
        from dual  
    </foreach> )
   </insert>
@@ -379,6 +399,10 @@
        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
           when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
        </foreach>
+      ,INBOUND_RESULT_ID=
+      <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+        when #{item.resultId,jdbcType=DECIMAL} then #{item.inboundResultId,jdbcType=DECIMAL}
+      </foreach>
      where RESULT_ID in 
      <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
     #{item.resultId,jdbcType=DECIMAL}