zhouzh 3 jaren geleden
bovenliggende
commit
451bb517e1

+ 0 - 13
src/main/java/com/steerinfo/dil/controller/WmspInventoryCloseController.java

@@ -11,7 +11,6 @@ import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -65,16 +64,4 @@ public class WmspInventoryCloseController extends BaseRESTfulController {
             return success(pageList);
     }
 
-    //库存结转(在每个月的25号11点45时结算一个月的数据)
-    @PostMapping("/addInventoryClose")
-    @Scheduled(cron =  "3 45 23 25 * ? ")
-    @ApiOperation(value = "库存结转")
-    public RESTfulResult addInventoryClose(){
-            int result = 0;
-            int count = wmspInventoryCloseServiceImpl.getClose();
-            if(count == 0) {
-                result = wmspInventoryCloseServiceImpl.addInventoryClose();
-            }
-            return success(result);
-    }
 }

+ 0 - 17
src/main/java/com/steerinfo/dil/controller/WmspSendReceiveController.java

@@ -12,7 +12,6 @@ import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -83,21 +82,5 @@ public class WmspSendReceiveController extends BaseRESTfulController {
         return success(result);
     }*/
 
-    /**
-     * 这整各模块会在linux系统中的tomcat加载两次,所有定时器可能会执行两次,或者是由于定时器的方法执行太快,一秒内执行了
-     * @return
-     * @throws InterruptedException
-     */
-    @PostMapping("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);
-    }
 }

+ 53 - 48
src/main/java/com/steerinfo/dil/service/impl/WmspInventoryCloseServiceImpl.java

@@ -6,6 +6,7 @@ import com.steerinfo.dil.model.WmspInventoryClose;
 import com.steerinfo.dil.service.IWmspInventoryCloseService;
 import com.steerinfo.dil.util.DataChange;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
@@ -29,67 +30,71 @@ public class WmspInventoryCloseServiceImpl implements IWmspInventoryCloseService
     @Override
     public List<Map<String, Object>> getWmspInventoryClose(Map<String, Object> mapValue) {
         List<Map<String, Object>> maps = wmspInventoryCloseMapper.selectWmspInventoryClose(mapValue);
-
         return maps;
     }
 
     @Override
+    @Scheduled(cron =  "3 45 23 25 * ? ")
     public int addInventoryClose() {
         int i = 0;
-        //高线库,一棒库,二棒库,配送库
-        List<Map<String, Object>> mapList = rmsWarehouseMapper.getWarehouseName();
-        //遍历四个仓库
-        for(Map<String,Object> map:mapList) {
-            BigDecimal warehouseId = DataChange.dataToBigDecimal(map.get("id"));
-            //先获取收发存中的物资
-            List<Map<String,Object>> materialList = wmspInventoryCloseMapper.selectSendReceive(warehouseId);
-            for(Map<String,Object> map1:materialList){
-                WmspInventoryClose wmspInventoryClose = new WmspInventoryClose();
-                //主键自增
-                BigDecimal inventoryCloseId = wmspInventoryCloseMapper.addInventoryCloseId();
-                wmspInventoryClose.setCloseId(inventoryCloseId);
-                //增加仓库id
-                wmspInventoryClose.setWarehouseId(warehouseId);
-                //增加物资id
-                BigDecimal materialId = DataChange.dataToBigDecimal(map1.get("materialId"));
-                wmspInventoryClose.setMaterialId(materialId);
-                //获取一个仓库中的一种物资一个月之内的入库数据
-                BigDecimal closeThismonthInbound = wmspInventoryCloseMapper.selectCloseThismonthInbound(warehouseId,materialId);
-                if(closeThismonthInbound == null){
-                    wmspInventoryClose.setCloseThismonthInbound(new BigDecimal(0));
-                }else {
-                    wmspInventoryClose.setCloseThismonthInbound(closeThismonthInbound);
-                }
-                BigDecimal closeThismonthInbound1 = wmspInventoryClose.getCloseThismonthInbound();
-                //获取一个仓库的一种物资一个月之内的出库数据
-                BigDecimal closeThismonthOutbound = wmspInventoryCloseMapper.selectCloseThismonthOutbound(warehouseId,materialId);
-                if(closeThismonthOutbound == null){
-                    wmspInventoryClose.setCloseThismonthOutbound(new BigDecimal(0));
-                }else {
-                    wmspInventoryClose.setCloseThismonthOutbound(closeThismonthOutbound);
-                }
-                BigDecimal closeThismonthOutbound1 = wmspInventoryClose.getCloseThismonthOutbound();
-                //获取上一个月的一种物资的库存数据
-                BigDecimal closeLastmonthInventory = wmspInventoryCloseMapper.selectCloseLastmonthInventory(warehouseId,materialId);
-                if(closeLastmonthInventory==null){
-                    wmspInventoryClose.setCloseLastmonthInventory(new BigDecimal(0));
-                }else {
-                    wmspInventoryClose.setCloseLastmonthInventory(closeLastmonthInventory);
-                }
-                //获取一个仓库的一种物资一个月之内的总库存数据
-                BigDecimal closeLastmonthInventory1 = wmspInventoryClose.getCloseLastmonthInventory();
+        int count = wmspInventoryCloseMapper.getClose();
+        if(count == 0){
+            //高线库,一棒库,二棒库,配送库
+            List<Map<String, Object>> mapList = rmsWarehouseMapper.getWarehouseName();
+            //遍历四个仓库
+            for(Map<String,Object> map:mapList) {
+                BigDecimal warehouseId = DataChange.dataToBigDecimal(map.get("id"));
+                //先获取收发存中的物资
+                List<Map<String,Object>> materialList = wmspInventoryCloseMapper.selectSendReceive(warehouseId);
+                for(Map<String,Object> map1:materialList){
+                    WmspInventoryClose wmspInventoryClose = new WmspInventoryClose();
+                    //主键自增
+                    BigDecimal inventoryCloseId = wmspInventoryCloseMapper.addInventoryCloseId();
+                    wmspInventoryClose.setCloseId(inventoryCloseId);
+                    //增加仓库id
+                    wmspInventoryClose.setWarehouseId(warehouseId);
+                    //增加物资id
+                    BigDecimal materialId = DataChange.dataToBigDecimal(map1.get("materialId"));
+                    wmspInventoryClose.setMaterialId(materialId);
+                    //获取一个仓库中的一种物资一个月之内的入库数据
+                    BigDecimal closeThismonthInbound = wmspInventoryCloseMapper.selectCloseThismonthInbound(warehouseId,materialId);
+                    if(closeThismonthInbound == null){
+                        wmspInventoryClose.setCloseThismonthInbound(new BigDecimal(0));
+                    }else {
+                        wmspInventoryClose.setCloseThismonthInbound(closeThismonthInbound);
+                    }
+                    BigDecimal closeThismonthInbound1 = wmspInventoryClose.getCloseThismonthInbound();
+                    //获取一个仓库的一种物资一个月之内的出库数据
+                    BigDecimal closeThismonthOutbound = wmspInventoryCloseMapper.selectCloseThismonthOutbound(warehouseId,materialId);
+                    if(closeThismonthOutbound == null){
+                        wmspInventoryClose.setCloseThismonthOutbound(new BigDecimal(0));
+                    }else {
+                        wmspInventoryClose.setCloseThismonthOutbound(closeThismonthOutbound);
+                    }
+                    BigDecimal closeThismonthOutbound1 = wmspInventoryClose.getCloseThismonthOutbound();
+                    //获取上一个月的一种物资的库存数据
+                    BigDecimal closeLastmonthInventory = wmspInventoryCloseMapper.selectCloseLastmonthInventory(warehouseId,materialId);
+                    if(closeLastmonthInventory==null){
+                        wmspInventoryClose.setCloseLastmonthInventory(new BigDecimal(0));
+                    }else {
+                        wmspInventoryClose.setCloseLastmonthInventory(closeLastmonthInventory);
+                    }
+                    //获取一个仓库的一种物资一个月之内的总库存数据
+                    BigDecimal closeLastmonthInventory1 = wmspInventoryClose.getCloseLastmonthInventory();
                     BigDecimal closeThismonthInventory =
                             new BigDecimal(closeThismonthInbound1.intValue() - closeThismonthOutbound1.intValue() + closeLastmonthInventory1.intValue());
 
                     wmspInventoryClose.setCloseThismonthInventory(closeThismonthInventory);
 
-                wmspInventoryClose.setInsertTime(new Date());
-                wmspInventoryClose.setInsertUsername("admin");
-                wmspInventoryClose.setDeleted(new BigDecimal(1));
-                i+=wmspInventoryCloseMapper.insertSelective(wmspInventoryClose);
-            }
+                    wmspInventoryClose.setInsertTime(new Date());
+                    wmspInventoryClose.setInsertUsername("admin");
+                    wmspInventoryClose.setDeleted(new BigDecimal(1));
+                    i+=wmspInventoryCloseMapper.insertSelective(wmspInventoryClose);
+                }
 
+            }
         }
+
         return i;
     }
 

+ 60 - 55
src/main/java/com/steerinfo/dil/service/impl/WmspSendReceiveServiceImpl.java

@@ -8,6 +8,7 @@ import com.steerinfo.dil.model.WmspSendReceive;
 import com.steerinfo.dil.service.IWmspSendReceiveService;
 import com.steerinfo.dil.util.DataChange;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
@@ -161,70 +162,74 @@ public class WmspSendReceiveServiceImpl implements IWmspSendReceiveService {
  */
     //零点生成前一天的入库、出库、库存
     @Override
+    @Scheduled(cron =  "1 45 23 * * ? ")
     public int addSendReceive(){
-
         int i = 0;
-        //高线库,一棒库,二棒库,配送库
-        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) {
-                WmspSendReceive wmspSendReceive = new WmspSendReceive();
-                //收发层主键自增
-                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);
-
-                Map<String,Object> map2 = new HashMap<>();
-                map2.put("warehouseId",warehouseId);
-                map2.put("materialId",materialId);
-                //统计今天的入库总数(只统计当前仓库没有预留的数量,不统计预留库的数量)
-                BigDecimal sendReceiveThisdayInbound = wmspSendReceiveMapper.countSndReceiveThisdayInbound(map2);
-                if(sendReceiveThisdayInbound == null){
-                    wmspSendReceive.setSendReceiveThisdayInbound(new BigDecimal(0));
-                }else{
-                    wmspSendReceive.setSendReceiveThisdayInbound(sendReceiveThisdayInbound);
-                }
-                BigDecimal sendReceiveThisdayInbound1 = wmspSendReceive.getSendReceiveThisdayInbound();
-                //统计今天天的出库总数
-                BigDecimal sendReceiveThisdayOutbound = wmspSendReceiveMapper.countSendReceiveThisdayOutbound(map2);
-                if(sendReceiveThisdayOutbound == null){
-                    wmspSendReceive.setSendReceiveThisdayOutbound(new BigDecimal(0));
-                }else {
-                    wmspSendReceive.setSendReceiveThisdayOutbound(sendReceiveThisdayOutbound);
-                }
-                BigDecimal sendReceiveThisdayOutbound1 = wmspSendReceive.getSendReceiveThisdayOutbound();
-                //昨天库存
-                BigDecimal sendReceiveLastdayInventory = wmspSendReceiveMapper.getSendReceiveLastdayInventory(map2);
-                if(sendReceiveLastdayInventory == null){
-                    wmspSendReceive.setSendReceiveLastdayInventory(new BigDecimal(0));
-                }else{
-                    wmspSendReceive.setSendReceiveLastdayInventory(sendReceiveLastdayInventory);
-                }
-
-                BigDecimal sendReceiveLastdayInventory1 = wmspSendReceive.getSendReceiveLastdayInventory();
+        int count = wmspSendReceiveMapper.getTodaySendReceiveCount();
+        if(count == 0){
+            //高线库,一棒库,二棒库,配送库
+            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) {
+                    WmspSendReceive wmspSendReceive = new WmspSendReceive();
+                    //收发层主键自增
+                    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);
+
+                    Map<String,Object> map2 = new HashMap<>();
+                    map2.put("warehouseId",warehouseId);
+                    map2.put("materialId",materialId);
+                    //统计今天的入库总数(只统计当前仓库没有预留的数量,不统计预留库的数量)
+                    BigDecimal sendReceiveThisdayInbound = wmspSendReceiveMapper.countSndReceiveThisdayInbound(map2);
+                    if(sendReceiveThisdayInbound == null){
+                        wmspSendReceive.setSendReceiveThisdayInbound(new BigDecimal(0));
+                    }else{
+                        wmspSendReceive.setSendReceiveThisdayInbound(sendReceiveThisdayInbound);
+                    }
+                    BigDecimal sendReceiveThisdayInbound1 = wmspSendReceive.getSendReceiveThisdayInbound();
+                    //统计今天天的出库总数
+                    BigDecimal sendReceiveThisdayOutbound = wmspSendReceiveMapper.countSendReceiveThisdayOutbound(map2);
+                    if(sendReceiveThisdayOutbound == null){
+                        wmspSendReceive.setSendReceiveThisdayOutbound(new BigDecimal(0));
+                    }else {
+                        wmspSendReceive.setSendReceiveThisdayOutbound(sendReceiveThisdayOutbound);
+                    }
+                    BigDecimal sendReceiveThisdayOutbound1 = wmspSendReceive.getSendReceiveThisdayOutbound();
+                    //昨天库存
+                    BigDecimal sendReceiveLastdayInventory = wmspSendReceiveMapper.getSendReceiveLastdayInventory(map2);
+                    if(sendReceiveLastdayInventory == null){
+                        wmspSendReceive.setSendReceiveLastdayInventory(new BigDecimal(0));
+                    }else{
+                        wmspSendReceive.setSendReceiveLastdayInventory(sendReceiveLastdayInventory);
+                    }
+
+                    BigDecimal sendReceiveLastdayInventory1 = wmspSendReceive.getSendReceiveLastdayInventory();
 
                     //今天库存
-                BigDecimal sendReceiveThisdayInventory = new BigDecimal(sendReceiveLastdayInventory1.intValue()
-                                +sendReceiveThisdayInbound1.intValue()-sendReceiveThisdayOutbound1.intValue());
+                    BigDecimal sendReceiveThisdayInventory = new BigDecimal(sendReceiveLastdayInventory1.intValue()
+                            +sendReceiveThisdayInbound1.intValue()-sendReceiveThisdayOutbound1.intValue());
 
                     wmspSendReceive.setSendReceiveThisdayInventory(sendReceiveThisdayInventory);
 
-                wmspSendReceive.setInsertUsername("admin");
-                wmspSendReceive.setInsertTime(new Date());
-                wmspSendReceive.setDeleted(new BigDecimal(1));
-                i+=wmspSendReceiveMapper.insertSelective(wmspSendReceive);
+                    wmspSendReceive.setInsertUsername("admin");
+                    wmspSendReceive.setInsertTime(new Date());
+                    wmspSendReceive.setDeleted(new BigDecimal(1));
+                    i+=wmspSendReceiveMapper.insertSelective(wmspSendReceive);
+                }
             }
         }
+
         return i;
     }
 

+ 41 - 41
src/main/resources/com/steerinfo/dil/mapper/WmspIntransitInventoryMapper.xml

@@ -368,48 +368,48 @@
   <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
   <select id="selectTransitInventory" resultType="java.util.LinkedHashMap" parameterType="java.util.Map">
     select  RC.CAPACITY_NUMBER "number",
-            OOT.ORDER_WAGON_NO "No",
-            ARD.DAYPLAN_NO "dayplanNo",
-            OO.ORDER_NUMBER "orderNumber",
-            RM.MATERIAL_CODE "materialCode",
-            RM.MATERIAL_NAME "materialName",
-            RM.MATERIAL_SPECIFICATION || '(' || RM.MATERIAL_MODEL || ')' "specification",
-            RMS.MATERIAL_SINGLE_BUNDLE_WEIGHT  "bundleWeight",
-            RMS.MATERIAL_THEORETICAL_WEIGHT "theoreticalWeight",
-            OOM.ORDER_MATERIAL_NUMBER "materialNumber",
-            TWR.RESULT_POUND_NO "poundNo",
-            RW.WAREHOUSE_NAME "warehouseName",
-            WII.INSERT_TIME "insertTime"
+    OOT.ORDER_WAGON_NO "No",
+    ARD.DAYPLAN_NO "dayplanNo",
+    OO.ORDER_NUMBER "orderNumber",
+    RM.MATERIAL_CODE "materialCode",
+    RM.MATERIAL_NAME "materialName",
+    RM.MATERIAL_SPECIFICATION || '(' || RM.MATERIAL_MODEL || ')' "specification",
+    RMS.MATERIAL_SINGLE_BUNDLE_WEIGHT  "bundleWeight",
+    RMS.MATERIAL_THEORETICAL_WEIGHT "theoreticalWeight",
+    OOM.ORDER_MATERIAL_NUMBER "materialNumber",
+    TWR.RESULT_POUND_NO "poundNo",
+    RW.WAREHOUSE_NAME "warehouseName",
+    WII.INSERT_TIME "insertTime"
 
-           from WMSP_INTRANSIT_INVENTORY WII
-           left join  AMSTRUCK_RAIL_DAYPLAN ARD
-           on ARD.DAYPLAN_ID=WII.RAIL_DAYPLAY_ID
-           left  join OMSTRUCK_ORDER OO
-           on OO.ORDER_ID=WII.ORDER_ID
-           left join OMSTRUCK_ORDER_MATERIAL OOM
-           on OOM.ORDER_ID=OO.ORDER_ID
-           left join RMS_CAPACITY RC
-           on RC.CAPACITY_ID=OO.CAPACITY_ID
-           left join  OMSTRAIN_ORDER OOT
-           on  WII.ORDER_ID=OO.ORDER_ID
-           left join  WMSP_GRID_MATERIAL WGM
-           on WGM.MATERIAL_ID=OOM.MATERIAL_ID
-           left join RMS_MATERIAL_STEEL RMS
-           on RMS.MATERIAL_STEEL_ID=WGM.MATERIAL_ID
-           left join RMS_MATERIAL RM
-           on RM.MATERIAL_ID=RMS.MATERIAL_ID
-           left join RMS_PWAREHOUSE_GRID RPG
-           on RPG.GRID_ID=WGM.GRID_ID
-           left join RMS_WAREHOUSE RW
-           on RW.WAREHOUSE_ID=RPG.WAREHOUSE_ID
-           left join RMS_WAREHOUSE_TYPE RWT
-           on RWT.WAREHOUSE_TYPE_ID=RW.WAREHOUSE_TYPE_ID
-           left join TMSTRUCK_TOTAL_RESULT TTR
-           on OO.ORDER_ID=TTR.ORDER_ID
-           left join TMSTRUCK_WEIGHT_RESULT TWR
-           on TWR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
-           where RW.WAREHOUSE_TYPE_ID=2
-<where>
+    from WMSP_INTRANSIT_INVENTORY WII
+    left join  AMSTRUCK_RAIL_DAYPLAN ARD
+    on ARD.DAYPLAN_ID=WII.RAIL_DAYPLAY_ID
+    left  join OMSTRUCK_ORDER OO
+    on OO.ORDER_ID=WII.ORDER_ID
+    left join OMSTRUCK_ORDER_MATERIAL OOM
+    on OOM.ORDER_ID=OO.ORDER_ID
+    left join RMS_CAPACITY RC
+    on RC.CAPACITY_ID=OO.CAPACITY_ID
+    left join  OMSTRAIN_ORDER OOT
+    on  WII.ORDER_ID=OO.ORDER_ID
+    left join RMS_MATERIAL RM
+    on RM.MATERIAL_ID = OOM.MATERIAL_ID
+    left join RMS_MATERIAL_STEEL RMS
+    on RMS.MATERIAL_ID =RM.MATERIAL_ID
+    left join WMSP_GRID_MATERIAL WGM
+    on WGM.MATERIAL_ID = RMS.MATERIAL_STEEL_ID
+    left join RMS_PWAREHOUSE_GRID RPG
+    on RPG.GRID_ID=WGM.GRID_ID
+    left join RMS_WAREHOUSE RW
+    on RW.WAREHOUSE_ID=RPG.WAREHOUSE_ID
+    left join RMS_WAREHOUSE_TYPE RWT
+    on RWT.WAREHOUSE_TYPE_ID=RW.WAREHOUSE_TYPE_ID
+    left join TMSTRUCK_TOTAL_RESULT TTR
+    on OO.ORDER_ID=TTR.ORDER_ID
+    left join TMSTRUCK_WEIGHT_RESULT TWR
+    on TWR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
+    where RW.WAREHOUSE_TYPE_ID=2 and OO.ORDER_STATUS = 5 and TWR.RESULT_GROSS_WEIGHT is not null
+    <where>
   <if test="number!= null">
     and
     <foreach collection="number" item="item" open="(" separator="or" close=")">