Pārlūkot izejas kodu

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

胡半仙 3 gadi atpakaļ
vecāks
revīzija
eb49aa5c5d

+ 14 - 0
pom.xml

@@ -48,6 +48,20 @@
     </distributionManagement>
 
     <dependencies>
+        <!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi</artifactId>
+         
+        </dependency>
+    
+        <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml</artifactId>
+          
+        </dependency>
+
         <!--websocket-->
         <dependency>
             <groupId>org.springframework.boot</groupId>

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

@@ -9,6 +9,8 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.io.IOException;
+
 /**
  * @author luobang
  * @create 2021-10-10 17:59
@@ -30,4 +32,11 @@ public class RmsMaterialController extends BaseRESTfulController {
         return success(rmsMaterialServiceImpl.getMaterial());
     }
 
+    @ApiOperation(value = "通过excel创建基础数据")
+    @GetMapping("/createMaterial")
+    public RESTfulResult createMaterial() throws IOException {
+       int count= rmsMaterialServiceImpl.createMaterial();
+       return success(count);
+    }
+
 }

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

@@ -80,8 +80,8 @@ public class WmspOutboundResultController extends BaseRESTfulController {
                                                Integer pageNum,
                                                Integer pageSize,
                                                Integer apiId,
-                                               String con
-    ){
+                                               String con)
+    {
 
         if (con != null) {
             if (!"undefined".equals(con)) {
@@ -494,7 +494,22 @@ public class WmspOutboundResultController extends BaseRESTfulController {
     //创建一个删除实时库的接口
     @PostMapping("/deleteGridMaterial")
     public RESTfulResult deleteGridMaterial(@RequestParam String materialOnlyCode){
+
+
+        //根据物资id查询相对应的入库实绩ID,并将其赋值给相对应的入库扫描实绩表,判断是否入库
+        List<Map<String, Object>> list = wmspInboundScanResultMapper.getInboundResultIdByMaterial(materialOnlyCode);
+
         int result = wmspOutboundResultService.deleteGridMaterial(materialOnlyCode);
+
+        //判断物质是否已经被扫描
+        int isScan = wmspOutboundResultService.ExistScanResult(materialOnlyCode);
+        if (result>0&&isScan==0&&list.size()>0){
+            Map<String, Object> map1 = list.get(0);
+            //创建出库实绩
+            WmspOutboundResult wmspOutboundResult=wmspOutboundResultService.createOutboundResult(new BigDecimal(1),new BigDecimal(2));
+
+            int status= wmspOutboundResultService.createOutboundScanResult(materialOnlyCode,new BigDecimal(1),wmspOutboundResult.getResultId(),(BigDecimal)map1.get("inboundResultId"));
+        }
         if(result == -1){
             return failed(-1,"请勿重复扫码");
         }

+ 14 - 3
src/main/java/com/steerinfo/dil/controller/WmspSendReceiveController.java

@@ -81,10 +81,21 @@ public class WmspSendReceiveController extends BaseRESTfulController {
         return success(result);
     }*/
 
+    /**
+     * 这整各模块会在linux系统中的tomcat加载两次,所有定时器可能会执行两次,或者是由于定时器的方法执行太快,一秒内执行了
+     * @return
+     * @throws InterruptedException
+     */
     @PostMapping("addSendReceive")
-    @Scheduled(cron =  "0 45 23 * * ? ")
-    public RESTfulResult addSendReceive(){
-        int result = iWmspSendReceiveService.addSendReceive();
+    @Scheduled(cron =  "1 45 23 * * ? ")
+    public synchronized RESTfulResult addSendReceive() throws InterruptedException {
+        int result=0;
+        int count =iWmspSendReceiveService.getTodaySendReceiveCount();
+        if (count==0)
+        {
+            result = iWmspSendReceiveService.addSendReceive();
+        }
+
         return success(result);
     }
 }

+ 3 - 0
src/main/java/com/steerinfo/dil/mapper/RmsMaterialMapper.java

@@ -3,6 +3,7 @@ package com.steerinfo.dil.mapper;
 import com.steerinfo.dil.model.RmsMaterial;
 import com.steerinfo.framework.mapper.IBaseMapper;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.poi.xssf.usermodel.XSSFCell;
 
 import java.math.BigDecimal;
 import java.util.HashMap;
@@ -20,4 +21,6 @@ public interface RmsMaterialMapper extends IBaseMapper<RmsMaterial, BigDecimal>
     Map<String, Object> getMaterialId2(HashMap<String, Object> mapMaterial);
 
     String getMaterialCode(BigDecimal materialId);
+
+    int getCountByCode(String materialCode);
 }

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

@@ -76,4 +76,6 @@ public interface WmspOutboundResultMapper extends IBaseMapper<WmspOutboundResult
     int getOutboundStatus(BigDecimal orderId);
 
     int updateStatus(BigDecimal resultId);
+
+    List<Map<String, Object>> selectOutResult(Map<String, Object> mapval);
 }

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

@@ -38,4 +38,6 @@ public interface WmspSendReceiveMapper extends IBaseMapper<WmspSendReceive, BigD
     BigDecimal countSndReceiveThisdayInbound(Map<String, Object> map2);
     //统计前一天的出库总数
     BigDecimal countSendReceiveThisdayOutbound(Map<String, Object> map2);
+
+    int getTodaySendReceiveCount();
 }

+ 2 - 6
src/main/java/com/steerinfo/dil/service/IRmsMaterialService.java

@@ -1,5 +1,6 @@
 package com.steerinfo.dil.service;
 
+import java.io.IOException;
 import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
@@ -20,10 +21,5 @@ public interface IRmsMaterialService {
     List<Map<String,Object>> getMaterial();
 
 
-
-
-
-
-
-
+    int createMaterial() throws IOException;
 }

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

@@ -86,4 +86,5 @@ public interface IWmspOutboundResultService {
     int deleteGridMaterial(String materialOnlyCode);
 
     int sureOutbount(BigDecimal resultId);
+
 }

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

@@ -27,4 +27,6 @@ public interface IWmspSendReceiveService {
     int count();
     //物资大类id
     BigDecimal getMaterialId(BigDecimal materialSteelId);
+
+    int getTodaySendReceiveCount();
 }

+ 37 - 0
src/main/java/com/steerinfo/dil/service/impl/RmsMaterialServiceImpl.java

@@ -1,11 +1,19 @@
 package com.steerinfo.dil.service.impl;
 
 import com.steerinfo.dil.mapper.RmsMaterialMapper;
+import com.steerinfo.dil.model.RmsMaterial;
 import com.steerinfo.dil.service.IRmsMaterialService;
+import org.apache.poi.xssf.usermodel.XSSFRow;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.apache.tools.ant.filters.StringInputStream;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.io.FileInputStream;
+import java.io.IOException;
 import java.math.BigDecimal;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -29,6 +37,35 @@ public class RmsMaterialServiceImpl implements IRmsMaterialService {
         return rmsMaterialMapper.getMaterial();
     }
 
+    @Override
+    public int createMaterial() throws IOException {
+        FileInputStream is = new FileInputStream("C://Users//24390//Desktop//达州项目//新建 Microsoft Excel 工作表 (2).xlsx");
+        XSSFWorkbook workbook=new XSSFWorkbook(is);
+        int numberOfSheets = workbook.getNumberOfSheets();
+        for (int i=0;i<numberOfSheets;i++){
+            XSSFSheet sheetAt = workbook.getSheetAt(i);
+            int lastRowNum = sheetAt.getLastRowNum();
+            for (int j=1;j<lastRowNum;j++){
+                XSSFRow row = sheetAt.getRow(j);
+                int count =rmsMaterialMapper.getCountByCode(row.getCell(1).toString());
+                if (count==0){
+                    RmsMaterial material=new RmsMaterial();
+
+                    material.setMaterialId(new BigDecimal(99999+j));
+                    material.setMaterialCode(row.getCell(1).toString());
+                    material.setMaterialName(row.getCell(2).toString());
+                    material.setMaterialSpecification(row.getCell(3).toString());
+                    material.setMaterialModel(row.getCell(4).toString());
+
+                    rmsMaterialMapper.insertSelective(material);
+                    System.out.println("-------------------------------------------");
+                }
+
+            }
+        }
+        return 0;
+    }
+
     public String getMaterialCode(BigDecimal materialId) {
         return rmsMaterialMapper.getMaterialCode(materialId);
     }

+ 25 - 22
src/main/java/com/steerinfo/dil/service/impl/WmspOutboundResultServiceImpl.java

@@ -63,9 +63,11 @@ public class WmspOutboundResultServiceImpl  implements IWmspOutboundResultServic
 
     @Override
     public List<Map<String, Object>> selectResultNumber(Map<String, Object> mapval) {
-        return wmspOutboundResultMapper.selectResultNumber(mapval);
+       // return wmspOutboundResultMapper.selectResultNumber(mapval);
+        return wmspOutboundResultMapper.selectOutResult(mapval);
     }
 
+
     @Override
     public int insertSelective(WmspOutboundResult wmspOutboundResult) {
         return wmspOutboundResultMapper.insertSelective(wmspOutboundResult);
@@ -388,28 +390,28 @@ public class WmspOutboundResultServiceImpl  implements IWmspOutboundResultServic
             if(map == null){
                 return -2;
             }
-                BigDecimal materialSteelId = DataChange.dataToBigDecimal(map.get("materialId"));
-                Date date = (Date) map.get("updateTime");
-                //如果修改时间为空,就表示该钢材还未出库
-                if(date==null){
-                    //将这些物资钢材id进行逻辑删除
-                    i += wmspGridMaterialMapper.updateByMaterialId(materialSteelId,new Date());
-                    //判断物资是否是预留物资
-                    int isReserve= wmsInboundResultService.getTypeMaterilaId(materialSteelId);
-                    //如果是预留物资
-                    if (isReserve>0){
-                        //将最新的一条真实库数据,状态改为预留状态状态,代替预留库存
-                        int status2= wmsInboundResultService.updateStatusByMaterialId(materialSteelId);
-                        //将预留库出库的钢材,状态改为完全入库状态
-                        int status= wmsInboundResultService.updateStatusByMaterilaId(materialSteelId);
-
-                    }
+            BigDecimal materialSteelId = DataChange.dataToBigDecimal(map.get("materialId"));
+            Date date = (Date) map.get("updateTime");
+            //如果修改时间为空,就表示该钢材还未出库
+            if(date==null){
+                //将这些物资钢材id进行逻辑删除
+                i += wmspGridMaterialMapper.updateByMaterialId(materialSteelId,new Date());
+                //判断物资是否是预留物资
+                int isReserve= wmsInboundResultService.getTypeMaterilaId(materialSteelId);
+                //如果是预留物资
+                if (isReserve>0){
+                    //将最新的一条真实库数据,状态改为预留状态状态,代替预留库存
+                    int status2= wmsInboundResultService.updateStatusByMaterialId(materialSteelId);
+                    //将预留库出库的钢材,状态改为完全入库状态
+                    int status= wmsInboundResultService.updateStatusByMaterilaId(materialSteelId);
 
                 }
-                //表示该钢材已出库,请勿重复扫码
-                else{
-                    return -1;
-                }
+
+            }
+            //表示该钢材已出库,请勿重复扫码
+            else{
+                return -1;
+            }
 
         return i;
     }
@@ -458,7 +460,6 @@ public class WmspOutboundResultServiceImpl  implements IWmspOutboundResultServic
                 //如果所以物资都已经结束,需要改变提货单状态
                 if (outBoundTypeDetailedInfos==null||outBoundTypeDetailedInfos.size()-cunt2==0){
                     int cunt3=wmspOutboundResultMapper.updateStatus(resultId);
-                    //返回结果
                     //表示全部完成
                     return 2;
                 }
@@ -470,4 +471,6 @@ public class WmspOutboundResultServiceImpl  implements IWmspOutboundResultServic
         //返回结果
         return 0;
     }
+
+
 }

+ 107 - 101
src/main/java/com/steerinfo/dil/service/impl/WmspSendReceiveServiceImpl.java

@@ -51,113 +51,118 @@ public class WmspSendReceiveServiceImpl implements IWmspSendReceiveService {
         return wmspSendReceiveMapper.getMaterialId(materialSteelId);
     }
 
-   /* @Override
-    //针对每一个仓库中的每一个物资类型新增一个收发层(初始化收发层)
-    @Scheduled(cron =  "0 0 0 * * ? ")
-    public int addSendReceive() {
-        int i=0;
-        WmspSendReceive wmspSendReceive = new WmspSendReceive();
-        //高线库,一棒库,二棒库,配送库
-        List<Map<String, Object>> mapList = rmsWarehouseMapper.getWarehouseName();
-        //遍历四个仓库
-        for(Map<String,Object> map:mapList){
-            BigDecimal warehouseId = DataChange.dataToBigDecimal(map.get("id"));
-            //查询去重实时库存中的物资id
-            List<Map<String,Object>> materialIdList = wmspGridMaterialMapper.getMaterialId(warehouseId);
-            for(Map<String,Object> map1:materialIdList){
-                //收发层主键自增
-                BigDecimal sendReceiveId = wmspSendReceiveMapper.getSendReceiveId();
-                wmspSendReceive.setSendReceiveId(sendReceiveId);
-                //仓库id
-                wmspSendReceive.setWarehouseId(warehouseId);
-                //收发层日期
-                wmspSendReceive.setSendReceiveDate(new Date());
-                //物资id
-                BigDecimal materialId = DataChange.dataToBigDecimal(map1.get("materialId"));
-                wmspSendReceive.setMaterialId(materialId);
-                //今天入库(今天生产入库+今天退货入库+今天盘盈 = 今天入库)暂只管出入库
-                //从零点开始每入库一件就增加一件
-                //sendReceiveThisdayInbound = wmspSendReceiveMapper.updateSendReceiveThisdayInbound(materialId);
-                //初始化今日入库为零
-                wmspSendReceive.setSendReceiveThisdayInbound(new BigDecimal(0));
-                //今天出库(今天出库+今天盘亏=今天出库)
-                //初始化出库为0
-                wmspSendReceive.setSendReceiveThisdayOutbound(new BigDecimal(0));
-                //昨天库存
-                //查询昨天库存
-                Map<String,Object> map2 = new HashMap<>();
-                map2.put("warehouseId",warehouseId);
-                map2.put("materialId",materialId);
-                BigDecimal sendReceiveLastdayInventory = wmspSendReceiveMapper.getSendReceiveLastdayInventory(map2);
-                if(sendReceiveLastdayInventory == null){
-                    wmspSendReceive.setSendReceiveLastdayInventory(new BigDecimal(0));
-                }else{
-                    wmspSendReceive.setSendReceiveLastdayInventory(sendReceiveLastdayInventory);
-                }
-                //今天库存
-//                BigDecimal sendReceiveLastdayInventory1 = wmspSendReceive.getSendReceiveLastdayInventory();
-//               if(sendReceiveLastdayInventory1.intValue()==0 || sendReceiveLastdayInventory1 == null){
-//                   wmspSendReceive.setSendReceiveThisdayInventory(new BigDecimal(0));
-//               }else {
-//                   addThisdayInventorySendReceive(map2);
-//               }
-                wmspSendReceive.setSendReceiveThisdayInventory(wmspSendReceive.getSendReceiveLastdayInventory());
-                wmspSendReceive.setInsertUsername("admin");
-                wmspSendReceive.setInsertTime(new Date());
-                wmspSendReceive.setDeleted(new BigDecimal(1));
-                i+=wmspSendReceiveMapper.insertSelective(wmspSendReceive);
-            }
-        }
-        return i;
-    }
-
-    //入库的时候调用收发层
-    //传入一个map进来warehouseId,materialId
-    public int addInBoundSendReceive(Map<String,Object> map){
-        //今天入库(今天生产入库+今天退货入库+今天盘盈 = 今天入库)暂只管入库
-        return wmspSendReceiveMapper.updateSendReceiveThisdayInbound(map);
-    }
-
-    //出库的时候调用收发层
-    public int addOutBoundSendReceive(Map<String,Object> map){
-        //今天出库(今天出库+今天盘亏=今天出库)暂只管出库
-        return wmspSendReceiveMapper.updateSendReceiveThisdayOutbound(map);
+    @Override
+    public int getTodaySendReceiveCount() {
+        return wmspSendReceiveMapper.getTodaySendReceiveCount();
     }
 
-    //计算今天库存(昨天库存 + 今天入库 — 今天出库 = 今天库存),实时变动
-    public int addThisdayInventorySendReceive(Map<String,Object> map){
-        BigDecimal materialId = DataChange.dataToBigDecimal(map.get("materialId"));
-        BigDecimal warehouseId = DataChange.dataToBigDecimal(map.get("warehouseId"));
-        //今天入库
-       BigDecimal sendReceiveThisdayInbound = wmspSendReceiveMapper.selectSendReceiveThisdayInbound(map);
-       if(sendReceiveThisdayInbound == null){
-           sendReceiveThisdayInbound = new BigDecimal(0);
-       }
-       //今天出库
-        BigDecimal sendReceiveThisdayOutbound = wmspSendReceiveMapper.selectSendReceiveThisdayOutbound(map);
-       if(sendReceiveThisdayOutbound == null){
-           sendReceiveThisdayOutbound = new BigDecimal(0);
-       }
-       // 昨天库存
-        BigDecimal sendReceiveLastdayInventory = wmspSendReceiveMapper.getSendReceiveLastdayInventory(map);
-        if(sendReceiveLastdayInventory == null){
-             sendReceiveLastdayInventory=new BigDecimal(0);
+    /* @Override
+     //针对每一个仓库中的每一个物资类型新增一个收发层(初始化收发层)
+     @Scheduled(cron =  "0 0 0 * * ? ")
+     public int addSendReceive() {
+         int i=0;
+         WmspSendReceive wmspSendReceive = new WmspSendReceive();
+         //高线库,一棒库,二棒库,配送库
+         List<Map<String, Object>> mapList = rmsWarehouseMapper.getWarehouseName();
+         //遍历四个仓库
+         for(Map<String,Object> map:mapList){
+             BigDecimal warehouseId = DataChange.dataToBigDecimal(map.get("id"));
+             //查询去重实时库存中的物资id
+             List<Map<String,Object>> materialIdList = wmspGridMaterialMapper.getMaterialId(warehouseId);
+             for(Map<String,Object> map1:materialIdList){
+                 //收发层主键自增
+                 BigDecimal sendReceiveId = wmspSendReceiveMapper.getSendReceiveId();
+                 wmspSendReceive.setSendReceiveId(sendReceiveId);
+                 //仓库id
+                 wmspSendReceive.setWarehouseId(warehouseId);
+                 //收发层日期
+                 wmspSendReceive.setSendReceiveDate(new Date());
+                 //物资id
+                 BigDecimal materialId = DataChange.dataToBigDecimal(map1.get("materialId"));
+                 wmspSendReceive.setMaterialId(materialId);
+                 //今天入库(今天生产入库+今天退货入库+今天盘盈 = 今天入库)暂只管出入库
+                 //从零点开始每入库一件就增加一件
+                 //sendReceiveThisdayInbound = wmspSendReceiveMapper.updateSendReceiveThisdayInbound(materialId);
+                 //初始化今日入库为零
+                 wmspSendReceive.setSendReceiveThisdayInbound(new BigDecimal(0));
+                 //今天出库(今天出库+今天盘亏=今天出库)
+                 //初始化出库为0
+                 wmspSendReceive.setSendReceiveThisdayOutbound(new BigDecimal(0));
+                 //昨天库存
+                 //查询昨天库存
+                 Map<String,Object> map2 = new HashMap<>();
+                 map2.put("warehouseId",warehouseId);
+                 map2.put("materialId",materialId);
+                 BigDecimal sendReceiveLastdayInventory = wmspSendReceiveMapper.getSendReceiveLastdayInventory(map2);
+                 if(sendReceiveLastdayInventory == null){
+                     wmspSendReceive.setSendReceiveLastdayInventory(new BigDecimal(0));
+                 }else{
+                     wmspSendReceive.setSendReceiveLastdayInventory(sendReceiveLastdayInventory);
+                 }
+                 //今天库存
+ //                BigDecimal sendReceiveLastdayInventory1 = wmspSendReceive.getSendReceiveLastdayInventory();
+ //               if(sendReceiveLastdayInventory1.intValue()==0 || sendReceiveLastdayInventory1 == null){
+ //                   wmspSendReceive.setSendReceiveThisdayInventory(new BigDecimal(0));
+ //               }else {
+ //                   addThisdayInventorySendReceive(map2);
+ //               }
+                 wmspSendReceive.setSendReceiveThisdayInventory(wmspSendReceive.getSendReceiveLastdayInventory());
+                 wmspSendReceive.setInsertUsername("admin");
+                 wmspSendReceive.setInsertTime(new Date());
+                 wmspSendReceive.setDeleted(new BigDecimal(1));
+                 i+=wmspSendReceiveMapper.insertSelective(wmspSendReceive);
+             }
+         }
+         return i;
+     }
+
+     //入库的时候调用收发层
+     //传入一个map进来warehouseId,materialId
+     public int addInBoundSendReceive(Map<String,Object> map){
+         //今天入库(今天生产入库+今天退货入库+今天盘盈 = 今天入库)暂只管入库
+         return wmspSendReceiveMapper.updateSendReceiveThisdayInbound(map);
+     }
+
+     //出库的时候调用收发层
+     public int addOutBoundSendReceive(Map<String,Object> map){
+         //今天出库(今天出库+今天盘亏=今天出库)暂只管出库
+         return wmspSendReceiveMapper.updateSendReceiveThisdayOutbound(map);
+     }
+
+     //计算今天库存(昨天库存 + 今天入库 — 今天出库 = 今天库存),实时变动
+     public int addThisdayInventorySendReceive(Map<String,Object> map){
+         BigDecimal materialId = DataChange.dataToBigDecimal(map.get("materialId"));
+         BigDecimal warehouseId = DataChange.dataToBigDecimal(map.get("warehouseId"));
+         //今天入库
+        BigDecimal sendReceiveThisdayInbound = wmspSendReceiveMapper.selectSendReceiveThisdayInbound(map);
+        if(sendReceiveThisdayInbound == null){
+            sendReceiveThisdayInbound = new BigDecimal(0);
         }
-        //今天库存
-        BigDecimal sendReceiveThisdayInventory = new BigDecimal(sendReceiveLastdayInventory.intValue()
-                +sendReceiveThisdayInbound.intValue()-sendReceiveThisdayOutbound.intValue());
-        Map<String,Object> map1 = new HashMap<>();
-        map1.put("materialId",materialId);
-        map1.put("warehouseId",warehouseId);
-        map1.put("sendReceiveThisdayInventory",sendReceiveThisdayInventory);
-        return wmspSendReceiveMapper.updateSendReceiveThisdayInventory(map1);
-
-    }
-*/
+        //今天出库
+         BigDecimal sendReceiveThisdayOutbound = wmspSendReceiveMapper.selectSendReceiveThisdayOutbound(map);
+        if(sendReceiveThisdayOutbound == null){
+            sendReceiveThisdayOutbound = new BigDecimal(0);
+        }
+        // 昨天库存
+         BigDecimal sendReceiveLastdayInventory = wmspSendReceiveMapper.getSendReceiveLastdayInventory(map);
+         if(sendReceiveLastdayInventory == null){
+              sendReceiveLastdayInventory=new BigDecimal(0);
+         }
+         //今天库存
+         BigDecimal sendReceiveThisdayInventory = new BigDecimal(sendReceiveLastdayInventory.intValue()
+                 +sendReceiveThisdayInbound.intValue()-sendReceiveThisdayOutbound.intValue());
+         Map<String,Object> map1 = new HashMap<>();
+         map1.put("materialId",materialId);
+         map1.put("warehouseId",warehouseId);
+         map1.put("sendReceiveThisdayInventory",sendReceiveThisdayInventory);
+         return wmspSendReceiveMapper.updateSendReceiveThisdayInventory(map1);
+
+     }
+ */
     //零点生成前一天的入库、出库、库存
     @Override
     public int addSendReceive(){
-        WmspSendReceive wmspSendReceive = new WmspSendReceive();
+
         int i = 0;
         //高线库,一棒库,二棒库,配送库
         List<Map<String, Object>> mapList = rmsWarehouseMapper.getWarehouseName();
@@ -167,6 +172,7 @@ public class WmspSendReceiveServiceImpl implements IWmspSendReceiveService {
             //查询去重实时库存中的物资id
             List<Map<String,Object>> materialIdList = wmspGridMaterialMapper.getMaterialId(warehouseId);
             for(Map<String,Object> map1:materialIdList) {
+                WmspSendReceive wmspSendReceive = new WmspSendReceive();
                 //收发层主键自增
                 BigDecimal sendReceiveId = wmspSendReceiveMapper.getSendReceiveId();
                 wmspSendReceive.setSendReceiveId(sendReceiveId);

+ 2 - 1
src/main/resources/application-dev.yml

@@ -17,4 +17,5 @@ openfeign:
     url: ${TMSTRUCKFEIGN_URL:172.16.33.162:8008}
 
 server:
-  port: 8012
+  port: 8012
+

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

@@ -452,6 +452,9 @@ select rm.material_id "id",
     left join rms_material rm on rms.material_id=rm.material_id
     where  rms.MATERIAL_STEEL_ID =#{materialId}
   </select>
+    <select id="getCountByCode" resultType="java.lang.Integer">
+      select count(*) from rms_material where MATERIAL_CODE=#{materialCode}
+    </select>
 
 
 </mapper>

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

@@ -1525,7 +1525,7 @@
               where rms.material_id=(
                   select distinct rms2.material_id from rms_material_steel rms2
                   where material_steel_id =#{materialId}
-                ) and INBOUND_ISCOMPLETE='1'  and wgm.deleted ='0' and  wir.insert_time between sysdate and trunc(sysdate + 1, 'dd')
+                ) and INBOUND_ISCOMPLETE='1'  and wgm.deleted ='0' and to_char(wir.insert_time,'YYYY-MM-DD')=TO_CHAR(SYSDATE,'YYYY-MM-DD')
               order by wir.insert_time desc
           ) where  Rownum='1'
         )

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

@@ -563,7 +563,180 @@
     </where>
     ORDER BY ckd.RESULT_STATUS
   </select>
-
+  
+  <select id="selectOutResult" resultType="java.util.Map">
+    SELECT
+    DISTINCT
+    ckd.RESULT_NUMBER "resultNumber",
+    ysdd.ORDER_NUMBER "orderNumber1",
+    ylxx.CAPACITY_NUMBER "capacityNumber",
+    (
+    CASE
+    WHEN ysdd.ORDER_TYPE = 1 THEN
+    (
+    SELECT
+    kh.CONSIGNEE_COMPANY_NAME
+    FROM
+    AMS_SALE_ORDER xsdd
+    LEFT JOIN RMS_CONSIGNEE kh ON xsdd.RECEIVE_ID = kh.CONSIGNEE_ID
+    WHERE
+    ysdd.ORDER_PLAN_ID = xsdd.SALE_ORDER_ID
+    )
+    WHEN ysdd.ORDER_TYPE = 2 THEN
+    (
+    SELECT
+    kh.CONSIGNEE_COMPANY_NAME
+    FROM
+    AMS_RAIL_OFFSET_DAYPLAN fyjh
+    LEFT JOIN RMS_CONSIGNEE kh ON fyjh.RECEIVING_UNIT_ID = kh.CONSIGNEE_ID
+    WHERE
+    ysdd.ORDER_PLAN_ID = fyjh.DAYPLAN_ID
+    )
+    END
+    ) consigneeCompanyName,
+    ck.WAREHOUSE_NAME "warehouseName",
+    dw.STACKING_NO "stackingNo",
+    wg.GRID_GRADATION_NUMBER "gridGradationNumber",
+    wz.MATERIAL_CODE "materialCode",
+    wz.MATERIAL_NAME "materialName",
+    wz.MATERIAL_SPECIFICATION || '(' || wz.MATERIAL_MODEL || ')' "specification",
+    gcwz.MATERIAL_THEORETICAL_WEIGHT "materialTheoreticalWeight",
+    gcwz.MATERIAL_SINGLE_BUNDLE_WEIGHT "materialSingleBundleWeight",
+    gcwz.MATERIAL_FURNACE_NUMBER "materialFurnaceNumber",
+    jldw.UNIT_OF_MEASURE_NAME "unitOfMeasureName",
+    ckd.INSERT_USERNAME "insertUsername",
+    ckd.INSERT_TIME "insertTime",
+    ckd.RESULT_OUTBOUND_TYPE "resultOutboundType",
+    CASE
+    WHEN gcwz.MATERIAL_QUALIFIED = 0 THEN
+    '不合格且判废'
+    WHEN gcwz.MATERIAL_QUALIFIED = 1 THEN
+    '不合格且降级'
+    WHEN gcwz.MATERIAL_QUALIFIED = 2 THEN
+    '不合格且不降级且卖本地经销商'
+    WHEN gcwz.MATERIAL_QUALIFIED = 3 THEN
+    '合格'
+    END MATERIAL_QUALIFIED,
+    ckd.INSERT_UPDATE_REMARK "insertUpdateRemark"
+    FROM WMSP_OUTBOUND_RESULT ckd
+    LEFT JOIN OMSTRUCK_ORDER ysdd ON ckd.BILL_LADING_ID = ysdd.ORDER_ID
+    LEFT JOIN RMS_CAPACITY ylxx ON ysdd.CAPACITY_ID = ylxx.CAPACITY_ID
+    LEFT JOIN OMSTRUCK_ORDER_MATERIAL yswz ON ysdd.ORDER_ID = yswz.ORDER_ID
+    LEFT JOIN WMSP_OUTBOUND_SCAN_RESULT wosr ON wosr.OUTBOUND_RESULT_ID = ckd.RESULT_ID
+    LEFT JOIN WMSP_INBOUND_SCAN_RESULT sisr ON wosr.INBOUND_RESULT_ID = sisr.INBOUND_RESULT_ID
+    LEFT JOIN WMSP_GRID_MATERIAL wzwg ON sisr.MATERIAL_ID = wzwg.MATERIAL_ID
+    LEFT JOIN RMS_PWAREHOUSE_GRID wg ON wzwg.GRID_ID = wg.GRID_ID
+    LEFT JOIN RMS_WAREHOUSE ck ON wg.WAREHOUSE_ID = ck.WAREHOUSE_ID
+    LEFT JOIN RMS_STACKING dw ON wg.STACKING_ID = dw.STACKING_ID
+    LEFT JOIN RMS_MATERIAL_STEEL gcwz ON wzwg.MATERIAL_ID = gcwz.MATERIAL_STEEL_ID
+    LEFT JOIN RMS_MATERIAL wz ON gcwz.MATERIAL_ID = wz.MATERIAL_ID
+    LEFT JOIN RMS_UNIT_OF_MEASURE jldw ON wz.UNIT_OF_MEASURE_ID = jldw.UNIT_OF_MEASURE_ID
+    <where>
+      <if test="resultNumber != null">
+        and
+        <foreach collection="resultNumber" item="item" open="(" separator="or" close=")">
+          "resultNumber" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="orderNumber1 != null">
+        and
+        <foreach collection="orderNumber1" item="item" open="(" separator="or" close=")">
+          "orderNumber1" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="capacityNumber != null">
+        and
+        <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
+          "capacityNumber" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="consigneeCompanyName != null">
+        and
+        <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
+          "consigneeCompanyName" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="warehouseName != null">
+        and
+        <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
+          "warehouseName" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="stackingNo != null">
+        and
+        <foreach collection="stackingNo" item="item" open="(" separator="or" close=")">
+          "stackingNo" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="gridGradationNumber != null">
+        and
+        <foreach collection="gridGradationNumber" item="item" open="(" separator="or" close=")">
+          "gridGradationNumber" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="materialCode != null">
+        and
+        <foreach collection="materialCode" item="item" open="(" separator="or" close=")">
+          "materialCode" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="materialName != null">
+        and
+        <foreach collection="materialName" item="item" open="(" separator="or" close=")">
+          "materialName" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="specification != null">
+        and
+        <foreach collection="specification" item="item" open="(" separator="or" close=")">
+          "specification" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="materialTheoreticalWeight != null">
+        and
+        <foreach collection="materialTheoreticalWeight" item="item" open="(" separator="or" close=")">
+          "materialTheoreticalWeight" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="materialSingleBundleWeight != null">
+        and
+        <foreach collection="materialSingleBundleWeight" item="item" open="(" separator="or" close=")">
+          "materialSingleBundleWeight" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="materialFurnaceNumber != null">
+        and
+        <foreach collection="materialFurnaceNumber" item="item" open="(" separator="or" close=")">
+          "materialFurnaceNumber" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="unitOfMeasureName != null">
+        and
+        <foreach collection="unitOfMeasureName" item="item" open="(" separator="or" close=")">
+          "unitOfMeasureName" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="insertUsername != null">
+        and
+        <foreach collection="insertUsername" item="item" open="(" separator="or" close=")">
+          "insertUsername" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="insertTime != null">
+        and
+        <foreach collection="insertTime" item="item" open="(" separator="or" close=")">
+          "insertTime" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="resultOutboundType != null">
+        and
+        <foreach collection="resultOutboundType" item="item" open="(" separator="or" close=")">
+          "resultOutboundType" like '%${item}%'
+        </foreach>
+      </if>
+    </where>
+   
+  </select>
   <!--  根据运输订单号获取运输订单id-->
   <select id="getOrder" parameterType="String" resultType="java.util.Map">
     SELECT
@@ -875,8 +1048,9 @@
     FROM WMSP_OUTBOUND_RESULT wor
     WHERE wor.RESULT_STATUS = 1 AND wor.BILL_LADING_ID =#{orderId}
   </select>
-
-  <update id="updateGrid" parameterType="DECIMAL" >
+    
+    
+    <update id="updateGrid" parameterType="DECIMAL" >
     UPDATE WMSP_GRID_MATERIAL WGM
     SET WGM.DELETED = 1
     WHERE WGM.MATERIAL_ID = #{materialId}

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

@@ -607,6 +607,7 @@
     trunc(wir.INSERT_TIME) = trunc(sysdate)
   </select>
 
+  
   <select id="countSendReceiveThisdayOutbound" parameterType="java.util.Map" resultType="java.math.BigDecimal">
     select count(*) from WMSP_GRID_MATERIAL wgm
      left join RMS_MATERIAL_STEEL rms
@@ -619,4 +620,7 @@
     rpg.WAREHOUSE_ID = #{warehouseId} and
     trunc(wgm.UPDATE_TIME) = trunc(sysdate)
   </select>
+    <select id="getTodaySendReceiveCount" resultType="java.lang.Integer">
+        select count(*) from WMSP_SEND_RECEIVE where  to_char(insert_time,'YYYY-MM-DD')=TO_CHAR(SYSDATE,'YYYY-MM-DD')
+    </select>
 </mapper>