Browse Source

出库修改

Tiroble 3 years ago
parent
commit
51c9d00a49

+ 2 - 0
src/main/java/com/steerinfo/DilApplicationMain.java

@@ -6,6 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.web.servlet.ServletComponentScan;
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
 import org.springframework.cloud.openfeign.EnableFeignClients;
+import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.annotation.EnableScheduling;
 
 /**
@@ -19,6 +20,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
 @MapperScan({"com.steerinfo.dil.mapper"})
 @EnableFeignClients(basePackages = "com.steerinfo.dil.feign")
 @EnableDiscoveryClient
+@EnableAsync(proxyTargetClass=true)
 public class DilApplicationMain {
     public static void main(String[] args) {
         SpringApplication.run(DilApplicationMain.class,args);

+ 36 - 0
src/main/java/com/steerinfo/dil/config/TaskScheduleConfig.java

@@ -0,0 +1,36 @@
+package com.steerinfo.dil.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+import java.util.concurrent.ThreadPoolExecutor;
+
+@Configuration
+@EnableAsync
+public class TaskScheduleConfig {
+    private static final int corePoolSize = 10;            // 默认线程数
+    private static final int maxPoolSize = 100;                // 最大线程数
+    private static final int keepAliveTime = 10;            // 允许线程空闲时间(单位:默认为秒),十秒后就把线程关闭
+    private static final int queueCapacity = 200;            // 缓冲队列数
+    private static final String threadNamePrefix = "it-is-threaddemo-"; // 线程池名前缀
+
+    @Bean("threadPoolTaskExecutor") // bean的名称,默认为首字母小写的方法名
+    public ThreadPoolTaskExecutor getDemoThread() {
+        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+        executor.setCorePoolSize(corePoolSize);
+        executor.setMaxPoolSize(maxPoolSize);
+        executor.setQueueCapacity(keepAliveTime);
+        executor.setKeepAliveSeconds(queueCapacity);
+        executor.setThreadNamePrefix(threadNamePrefix);
+
+        //线程池拒绝任务的处理策略
+        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
+        //初始化
+        executor.initialize();
+
+        return executor;
+
+    }
+}

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

@@ -280,9 +280,10 @@ public class WmsInboundResultController extends BaseRESTfulController {
 
                     Map<String,Object> item=mapList.get(i);
 
-                    //获得一个默认的网格  解释:目前还没有设计出来网格的结构 没有做默认为 第一库、第一月台、第一垛位、第一行、第一列 \推送信息给行车工、让他们抢单代码备注了
-                    BigDecimal houseGrid = new BigDecimal("11330");//rmsPwarehouseGridService.selectGrid(mapList.size()-(i), personnelWorkshopid,new BigDecimal(item.get("materialId").toString()));
-                    //创建一个入库作业实绩
+
+                   // BigDecimal houseGrid = rmsPwarehouseGridService.selectGrid(mapList.size()-(i+1), personnelWorkshopid,new BigDecimal(item.get("materialId").toString()));
+                    BigDecimal houseGrid = new BigDecimal("12335");
+                            //创建一个入库作业实绩
                     WmspInboundResult wmspInboundResult = wmsInboundResultServiceImpl.initAndWmspInboundResult(1,i+1,personnelWorkshopid,groupId,userName,wmspInboundDistribute.getDistributeId(),houseGrid,item);
                     //改变扫码实绩里面的状态
                     int status= wmsInboundScanResultServiceImpl.updateInboundScanStatus(new BigDecimal(item.get("resultId").toString()),wmspInboundResult.getInboundId());

+ 24 - 1
src/main/java/com/steerinfo/dil/controller/WmspGridMaterialController.java

@@ -286,7 +286,9 @@ public class WmspGridMaterialController extends BaseRESTfulController {
                                                Integer apiId,
                                                Integer warehouseId,
                                                String con){
-        mapVal.put("warehouseId",warehouseId);
+        if (warehouseId!=null){
+            mapVal.put("warehouseId",warehouseId);
+        }
         if (con!=null&&!con.equals("undefined")){
             mapVal.put("con","%"+con+"%");
         }
@@ -297,6 +299,27 @@ public class WmspGridMaterialController extends BaseRESTfulController {
         return success(pageList);
     }
 
+    //   查询所有的钢材库名
+    @ApiOperation(value = "查询所有钢材的物资信息",notes = "查询所有钢材的物资信息")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "apiId", value = "443", required = false, dataType = "BigDecimal"),
+    })
+    @PostMapping("/getSteelWarehouseList")
+    public  RESTfulResult getSteelWarehouseList(@RequestBody(required = false) Map<String,Object> mapVal,
+                                               Integer pageNum,
+                                               Integer pageSize,
+                                               Integer apiId,
+                                               String con){
+        if (con!=null&&!con.equals("undefined")){
+            mapVal.put("con","%"+con+"%");
+        }
+        List<Map<String,Object>> columnList=wmspGridMaterialService.getSteelWarehouseList(mapVal);
+        PageHelper.startPage(pageNum,pageSize);
+        List<Map<String,Object>> mapList=wmspGridMaterialService.getSteelWarehouseList(mapVal);
+        PageListAdd pageList = columnDataUtil.tableColumnData(apiId,columnList,mapList);
+        return success(pageList);
+    }
+
     //    根据仓库id查询对应库的物资规格型号
     @ApiOperation(value = "查询所有钢材的物资信息",notes = "查询所有钢材的物资信息")
     @ApiImplicitParams({

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

@@ -14,6 +14,8 @@ public interface WmspCheckWarehouseMapper extends IBaseMapper<WmspCheckWarehouse
     List<Map<String, Object>> getStockTakingList();
 
     BigDecimal getMaxId();
+    //    查找所有钢材库房信息
+    List<Map<String, Object>> getSteelWarehouseList(Map<String,Object> map);
 //    查找钢材物资信息
     List<Map<String, Object>> getSteelMaterialList(Map<String,Object> map);
     //    查找钢材物资规格型号信息以及当前仓储在今天的最大预留量

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

@@ -69,4 +69,6 @@ public interface IWmspGridMaterialService  {
     int updateWmspGridMaterials(List<Map<String,Object>> map,String restackMake);
 //    查询当前仓库下的所有已经超过库龄预警界限的物资
     List<Map<String, Object>> getGridMaterialAgeList(Map<String,Object> mapVal,Integer warehouseId);
+//    查询所有的钢材库信息
+    List<Map<String, Object>> getSteelWarehouseList(Map<String, Object> mapVal);
 }

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

@@ -82,6 +82,7 @@ public class WmspGridMaterialServiceImpl  implements IWmspGridMaterialService {
         List<Map<String ,Object>> list1 = wmspGridMaterialMapper.selectGridMaterial(mapval);
         mapval.put("newDate",newDate);
         List<Map<String ,Object>> list2 = wmspGridMaterialMapper.getGridMaterialAgeList(mapval);
+        mapval.clear();
         for (Map<String,Object> map1:list1){
             Integer status = 0;
             for (Map<String,Object> map2:list2){
@@ -340,6 +341,11 @@ public class WmspGridMaterialServiceImpl  implements IWmspGridMaterialService {
         return wmspCheckWarehouseMapper.getSteelMaterialList(map);
     }
 
+    @Override
+    public List<Map<String, Object>> getSteelWarehouseList(Map<String, Object> mapVal) {
+        return wmspCheckWarehouseMapper.getSteelWarehouseList(mapVal);
+    }
+
     @Override
     public List<Map<String, Object>> getSteelMaterialModelList(Map<String,Object> map) {
         return wmspCheckWarehouseMapper.getSteelMaterialModelList(map);

+ 6 - 4
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.Async;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 
@@ -34,11 +35,12 @@ public class WmspInventoryCloseServiceImpl implements IWmspInventoryCloseService
     }
 
     @Override
-    @Scheduled(cron =  "3 45 23 25 * ? ")
+    @Scheduled(cron =  "5 45 23 25 * ? ")
+    @Async("threadPoolTaskExecutor")
     public int addInventoryClose() {
         int i = 0;
-        int count = wmspInventoryCloseMapper.getClose();
-        if(count == 0){
+       // int count = wmspInventoryCloseMapper.getClose();
+        // if(count == 0){
             //高线库,一棒库,二棒库,配送库
             List<Map<String, Object>> mapList = rmsWarehouseMapper.getWarehouseName();
             //遍历四个仓库
@@ -93,7 +95,7 @@ public class WmspInventoryCloseServiceImpl implements IWmspInventoryCloseService
                 }
 
             }
-        }
+        //}
 
         return i;
     }

+ 6 - 4
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.Async;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 
@@ -163,10 +164,11 @@ public class WmspSendReceiveServiceImpl implements IWmspSendReceiveService {
     //零点生成前一天的入库、出库、库存
     @Override
     @Scheduled(cron =  "1 45 23 * * ? ")
+    @Async("threadPoolTaskExecutor")
     public int addSendReceive(){
         int i = 0;
-        int count = wmspSendReceiveMapper.getTodaySendReceiveCount();
-        if(count == 0){
+      //  int count = wmspSendReceiveMapper.getTodaySendReceiveCount();
+      // if(count == 0){
             //高线库,一棒库,二棒库,配送库
             List<Map<String, Object>> mapList = rmsWarehouseMapper.getWarehouseName();
             //遍历四个仓库
@@ -228,9 +230,9 @@ public class WmspSendReceiveServiceImpl implements IWmspSendReceiveService {
                     i+=wmspSendReceiveMapper.insertSelective(wmspSendReceive);
                 }
             }
-        }
+      //  }
 
-        return i;
+       return i;
     }
 
 }

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

@@ -401,9 +401,12 @@
         ON RMS.MATERIAL_STEEL_ID = WGM.MATERIAL_ID
         LEFT JOIN RMS_PWAREHOUSE_GRID RPG
         ON RPG.GRID_ID = WGM.GRID_ID
-        WHERE WAREHOUSE_ID = #{warehouseId}
+        WHERE RM.MATERIAL_NAME IS NOT NULL
+        <if test="warehouseId!=null">
+          AND RPG.WAREHOUSE_ID = #{warehouseId}
+        </if>
         <if test="con != null" >
-          and con like #{con}
+          AND RM.MATERIAL_NAME like #{con}
         </if>
         )
       <where>
@@ -414,6 +417,7 @@
         </foreach>
       </if>
      </where>
+      <include refid="orderBy"></include>
     </select>
     <select id="getSteelMaterialModelList" resultType="java.util.Map">
       SELECT DISTINCT
@@ -455,7 +459,18 @@
       </if>
       <include refid="orderBy"></include>
     </select>
-    <sql id="orderBy">
+  <select id="getSteelWarehouseList" resultType="java.util.Map">
+    SELECT
+        RW.WAREHOUSE_NAME "warehouseName",
+           RW.WAREHOUSE_ID "warehouseId"
+    FROM RMS_WAREHOUSE RW
+    WHERE RW.WAREHOUSE_TYPE_ID = 1 OR RW.WAREHOUSE_TYPE_ID = 2
+    <if test="con != null" >
+      AND RW.WAREHOUSE_NAME like #{con}
+    </if>
+    <include refid="orderBy"></include>
+  </select>
+  <sql id="orderBy">
       <if test="orderField != null and orderField != ''">
         order by "${orderField}"
         <if test="orderType != null and orderType != ''">

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

@@ -816,105 +816,57 @@
         ORDER BY wir.inbound_time DESC
         )
         <where>
-            <if test="INBOUND_NUMBER != null">
-                and "INBOUND_NUMBER" in
-                <foreach collection="INBOUND_NUMBER" item="item" open="(" separator="," close=")">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="WAREHOUSE_NAME != null">
-                and "WAREHOUSE_NAME" in
-                <foreach collection="WAREHOUSE_NAME" item="item" open="(" separator="," close=")">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="STACKING_NO != null">
-                and "STACKING_NO" in
-                <foreach collection="STACKING_NO" item="item" open="(" separator="," close=")">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="GRID_GRADATION_NUMBER != null">
-                and "GRID_GRADATION_NUMBER" in
-                <foreach collection="GRID_GRADATION_NUMBER" item="item" open="(" separator="," close=")">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="FURNACE_NUMBER != null">
-                and "FURNACE_NUMBER" in
-                <foreach collection="FURNACE_NUMBER" item="item" open="(" separator="," close=")">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="MATERIAL_CODE != null">
-                and "MATERIAL_CODE" in
-                <foreach collection="MATERIAL_CODE" item="item" open="(" separator="," close=")">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="MATERIAL_NAME != null">
-                and "MATERIAL_NAME" in
-                <foreach collection="MATERIAL_NAME" item="item" open="(" separator="," close=")">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="THEORETICAL_WEIGHT != null">
-                and "THEORETICAL_WEIGHT" in
-                <foreach collection="THEORETICAL_WEIGHT" item="item" open="(" separator="," close=")">
+            <if test="inboundId != null">
+                and "inboundId" in
+                <foreach collection="inboundId" item="item" open="(" separator="," close=")">
                     #{item}
                 </foreach>
             </if>
-            <if test="BUNDLE_WEIGHT != null">
-                and "BUNDLE_WEIGHT" in
-                <foreach collection="BUNDLE_WEIGHT" item="item" open="(" separator="," close=")">
+            <if test="materialName != null">
+                and "materialName" in
+                <foreach collection="materialName" item="item" open="(" separator="," close=")">
                     #{item}
                 </foreach>
             </if>
-            <if test="MEASURE_NAME != null">
-                and "MEASURE_NAME" in
-                <foreach collection="MEASURE_NAME" item="item" open="(" separator="," close=")">
+            <if test="inboundTime != null">
+                and "inboundTime" in
+                <foreach collection="inboundTime" item="item" open="(" separator="," close=")">
                     #{item}
                 </foreach>
             </if>
-            <if test="PRODUCTION_DATE != null">
-                and "PRODUCTION_DATE" in
-                <foreach collection="PRODUCTION_DATE" item="item" open="(" separator="," close=")">
-                    to_date('${item}','yyyy-mm-dd hh24:mi:ss')
-                </foreach>
-            </if>
-            <if test="APERSONNEL_NAME != null">
-                and "APERSONNEL_NAME" in
-                <foreach collection="APERSONNEL_NAME" item="item" open="(" separator="," close=")">
+            <if test="isComplete != null">
+                and "isComplete" in
+                <foreach collection="isComplete" item="item" open="(" separator="," close=")">
                     #{item}
                 </foreach>
             </if>
-            <if test="BPERSONNEL_NAME != null">
-                and "BPERSONNEL_NAME" in
-                <foreach collection="BPERSONNEL_NAME" item="item" open="(" separator="," close=")">
+            <if test="warehouseName != null">
+                and "warehouseName" in
+                <foreach collection="warehouseName" item="item" open="(" separator="," close=")">
                     #{item}
                 </foreach>
             </if>
-            <if test="DPERSONNEL_NAME != null">
-                and "DPERSONNEL_NAME" in
-                <foreach collection="DPERSONNEL_NAME" item="item" open="(" separator="," close=")">
+            <if test="stackingNo != null">
+                and "stackingNo" in
+                <foreach collection="stackingNo" item="item" open="(" separator="," close=")">
                     #{item}
                 </foreach>
             </if>
-            <if test="SHIPPER_BRANCH_FACTORY != null">
-                and "SHIPPER_BRANCH_FACTORY" in
-                <foreach collection="SHIPPER_BRANCH_FACTORY" item="item" open="(" separator="," close=")">
+            <if test="gridGradationNumber != null">
+                and "gridGradationNumber" in
+                <foreach collection="gridGradationNumber" item="item" open="(" separator="," close=")">
                     #{item}
                 </foreach>
             </if>
-            <if test="PERSONNEL_WORKSHOP != null">
-                and "PERSONNEL_WORKSHOP" in
-                <foreach collection="PERSONNEL_WORKSHOP" item="item" open="(" separator="," close=")">
+            <if test="furnaceNumber != null">
+                and "furnaceNumber" in
+                <foreach collection="furnaceNumber" item="item" open="(" separator="," close=")">
                     #{item}
                 </foreach>
             </if>
-            <if test="INBOUND_TIME != null">
-                and "INBOUND_TIME" in
-                <foreach collection="INBOUND_TIME" item="item" open="(" separator="," close=")">
+            <if test="theoreticalWeight != null">
+                and "theoreticalWeight" in
+                <foreach collection="theoreticalWeight" item="item" open="(" separator="," close=")">
                     #{item}
                 </foreach>
             </if>

+ 20 - 16
src/main/resources/com/steerinfo/dil/mapper/WmspOutboundResultMapper.xml

@@ -565,6 +565,7 @@
   </select>
   
   <select id="selectOutResult" resultType="java.util.Map" parameterType="java.util.Map">
+    select * from (
     SELECT
     DISTINCT
     ckd.RESULT_NUMBER "resultNumber",
@@ -620,36 +621,39 @@
     ckd.INSERT_UPDATE_REMARK "insertUpdateRemark"
     FROM WMSP_OUTBOUND_RESULT ckd
     LEFT JOIN OMSTRUCK_ORDER ysdd
-        ON ckd.BILL_LADING_ID = ysdd.ORDER_ID
+    ON ckd.BILL_LADING_ID = ysdd.ORDER_ID
     LEFT JOIN RMS_CAPACITY ylxx
-        ON ysdd.CAPACITY_ID = ylxx.CAPACITY_ID
+    ON ysdd.CAPACITY_ID = ylxx.CAPACITY_ID
     LEFT JOIN OMSTRUCK_ORDER_MATERIAL yswz
-        ON ysdd.ORDER_ID = yswz.ORDER_ID
+    ON ysdd.ORDER_ID = yswz.ORDER_ID
     LEFT JOIN WMSP_OUTBOUND_SCAN_RESULT wosr
-        ON wosr.OUTBOUND_RESULT_ID = ckd.RESULT_ID
+    ON wosr.OUTBOUND_RESULT_ID = ckd.RESULT_ID
     LEFT JOIN WMSP_INBOUND_SCAN_RESULT sisr
-        ON wosr.INBOUND_RESULT_ID = sisr.INBOUND_RESULT_ID
+    ON wosr.INBOUND_RESULT_ID = sisr.INBOUND_RESULT_ID
     LEFT JOIN WMSP_GRID_MATERIAL wzwg
-        ON sisr.MATERIAL_ID = wzwg.MATERIAL_ID
+    ON sisr.MATERIAL_ID = wzwg.MATERIAL_ID
     LEFT JOIN RMS_PWAREHOUSE_GRID wg
-        ON wzwg.GRID_ID = wg.GRID_ID
+    ON wzwg.GRID_ID = wg.GRID_ID
     LEFT JOIN RMS_WAREHOUSE ck
-        ON wg.WAREHOUSE_ID = ck.WAREHOUSE_ID
+    ON wg.WAREHOUSE_ID = ck.WAREHOUSE_ID
     LEFT JOIN RMS_STACKING dw
-        ON wg.STACKING_ID = dw.STACKING_ID
+    ON wg.STACKING_ID = dw.STACKING_ID
     LEFT JOIN RMS_MATERIAL_STEEL gcwz
-        ON wzwg.MATERIAL_ID = gcwz.MATERIAL_STEEL_ID
+    ON wzwg.MATERIAL_ID = gcwz.MATERIAL_STEEL_ID
     LEFT JOIN RMS_MATERIAL wz
-        ON gcwz.MATERIAL_ID = wz.MATERIAL_ID
+    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  wg.WAREHOUSE_ID = #{warehouseId}
-    <if test="startTime != null and endTime !=null">
-      and ckd.insert_time between to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') and  to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss')
-    </if>
+    ON wz.UNIT_OF_MEASURE_ID = jldw.UNIT_OF_MEASURE_ID
+    WHERE wg.WAREHOUSE_ID = #{warehouseId}
     <if test="oneDate != null">
       and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= ckd.insert_time
     </if>
+    <if test="startDate != null">
+      and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= ckd.insert_time
+      and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= ckd.insert_time
+    </if>
+    order by ckd.INSERT_TIME desc
+    )
     <where>
       <if test="resultNumber != null">
         and