Browse Source

问题修改

xiaochen 2 years ago
parent
commit
2c4417220c

+ 2 - 2
src/main/java/com/tld/config/MyRedissonConfig.java

@@ -16,8 +16,8 @@ public class MyRedissonConfig {
     public RedissonClient redissonClient(){
         // 创建配置 指定redis地址及节点信息
         Config config = new Config();
-//        config.useSingleServer().setAddress("redis://8.142.144.205:6379").setPassword("#09SilverB");
-        config.useSingleServer().setAddress("redis://10.2.111.91:6379").setPassword("#09SilverB");
+        config.useSingleServer().setAddress("redis://8.142.144.205:6379").setPassword("#09SilverB");
+//        config.useSingleServer().setAddress("redis://10.2.111.91:6379").setPassword("#09SilverB");
         //redis集群使用
 //        config.useClusterServers().addNodeAddress("redis://8.142.144.205:6379");
         // 根据config创建出RedissonClient实例

+ 25 - 0
src/main/java/com/tld/controller/QueryListController.java

@@ -52,6 +52,20 @@ public class QueryListController {
         return queryListService.reserveWarning(wllbCode,materialName, page, limit);
     }
 
+
+    /**
+    * @Description: 储量预警查询NotToken
+    * @Param: inventory
+    * @return: Map<String, Object>
+    * @Author: XiaoChen
+    * @Date: 2023/5/4
+    */
+    @GetMapping("reserveWarningNotToken")
+    @PassToken
+    public Map<String, Object> reserveWarningNotToken(Inventory inventory){
+        return queryListService.reserveWarningNotToken(inventory);
+    }
+
     /**
      * 查询物料储量预警查询
      * @param inventory 参数
@@ -257,5 +271,16 @@ public class QueryListController {
         return queryListService.getOtherShipments(askGoods);
     }
 
+    /**
+     * 查询采购大屏信息
+     * @param receiveGoods 参数
+     * @return 返回结果
+     */
+    @GetMapping("getProcurementScreen")
+    @PassToken
+    public Map<String, Object> getProcurementScreen(ReceiveGoods receiveGoods){
+        return queryListService.getProcurementScreen(receiveGoods);
+    }
+
 }
 

+ 10 - 0
src/main/java/com/tld/mapper/QueryListMapper.java

@@ -61,4 +61,14 @@ public interface QueryListMapper {
     void updateType(@Param("wmsCode") String wmsCode, @Param("type") int type, @Param("code") String code);
 
     List<AskGoods> getOtherShipments(AskGoods askGoods);
+
+    List<ReceiveGoods> getProcurementScreen(ReceiveGoods receiveGoods);
+
+    Integer getTotalQuantity(ReceiveGoods receiveGoods);
+
+    Integer getQuantityArrived(ReceiveGoods receiveGoods);
+
+    Integer getUnarrivedQuantity(ReceiveGoods receiveGoods);
+
+    Integer getTimeoutQuantity(ReceiveGoods receiveGoods);
 }

+ 4 - 1
src/main/java/com/tld/model/ReceiveGoods.java

@@ -127,5 +127,8 @@ public class ReceiveGoods implements Serializable {
      * 物料code
      */
     private String wllbCode;
-
+    /**
+     * 物料类型
+     */
+    private String wllbClass;
 }

+ 4 - 0
src/main/java/com/tld/service/QueryListService.java

@@ -57,4 +57,8 @@ public interface QueryListService {
     Map<String, Object> getOtherReceivingGoods(Notice notice);
 
     Map<String, Object> getOtherShipments(AskGoods askGoods);
+
+    Map<String, Object> getProcurementScreen(ReceiveGoods receiveGoods);
+
+    Map<String, Object> reserveWarningNotToken(Inventory inventory);
 }

+ 55 - 1
src/main/java/com/tld/service/impl/QueryListServiceImpl.java

@@ -659,7 +659,6 @@ public class QueryListServiceImpl implements QueryListService {
     * @Author: XiaoChen
     * @Date: 2023/4/12
     */
-    
     @Override
     public Map<String, Object> getOtherShipments(AskGoods askGoods) {
         Map<String, Object> map = new HashMap<>();
@@ -675,4 +674,59 @@ public class QueryListServiceImpl implements QueryListService {
         }
         return map;
     }
+
+    /**
+     * 查询采购大屏信息
+     * @param receiveGoods 参数
+     * @return 返回结果
+     */
+    @Override
+    public Map<String, Object> getProcurementScreen(ReceiveGoods receiveGoods) {
+        Map<String, Object> map = new HashMap<>();
+        try {
+            List<ReceiveGoods> list = queryListMapper.getProcurementScreen(receiveGoods);
+            Integer totalQuantity = queryListMapper.getTotalQuantity(receiveGoods);
+            Integer quantityArrived = queryListMapper.getQuantityArrived(receiveGoods);
+            Integer unarrivedQuantity = queryListMapper.getUnarrivedQuantity(receiveGoods);
+            Integer timeoutQuantity = queryListMapper.getTimeoutQuantity(receiveGoods);
+            Map<String, Object> map1 = new HashMap<>();
+            map1.put("list",list);
+            map1.put("totalQuantity",totalQuantity);//总数量
+            map1.put("quantityArrived",quantityArrived);//收货数量
+            map1.put("unarrivedQuantity",unarrivedQuantity);//未收货数量
+            map1.put("timeoutQuantity",timeoutQuantity);//超时数量
+            map.put("data",map1);
+            map.put("msg","200");
+        }catch (Exception e){
+            e.printStackTrace();
+            map.put("msg","500");
+            map.put("errMsg","服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
+
+    /**
+     * @Description: 储量预警查询
+     * @Param: inventory
+     * @return: Map<String, Object>
+     * @Author: XiaoChen
+     * @Date: 2023/5/4
+     */
+    @Override
+    public Map<String, Object> reserveWarningNotToken(Inventory inventory) {
+        Map<String, Object> map = new HashMap<>();
+        try{
+            inventory.setPage(1);
+            inventory.setLimit(6);
+            PageHelper.startPage(inventory.getPage(), inventory.getLimit());
+            PageInfo<Map<String, Object>> list = new PageInfo<>(queryListMapper.reserveWarnings(inventory));
+            map.put("data", list);
+            map.put("msg", "200");
+        } catch (Exception e){
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg", "服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
 }

+ 9 - 0
src/main/java/com/tld/service/impl/ReceiveGoodsSerivceImpl.java

@@ -19,6 +19,8 @@ import javax.servlet.http.HttpServletResponse;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
+import static com.fasterxml.jackson.databind.type.LogicalType.DateTime;
+
 @Service
 public class ReceiveGoodsSerivceImpl implements ReceiveGoodsSerivce {
 
@@ -161,6 +163,13 @@ public class ReceiveGoodsSerivceImpl implements ReceiveGoodsSerivce {
     public Map<String, Object> addPurchase(List<Map<String, Object>> jsonData) {
         Map<String, Object> map = new HashMap<>();
         try{
+            for (Map<String, Object> jsonDatum : jsonData) {
+                String arrivalTime = (String) jsonDatum.get("arrivalTime");
+                Date parse = new SimpleDateFormat("yyMMdd").parse(arrivalTime);
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd 17:00:00");
+                String format = simpleDateFormat.format(parse);
+                jsonDatum.put("DateTime",format);
+            }
             receiveGoodsMapper.addPurchase(jsonData);
             //新增日志
             Access access = new Access().setType("采购信息").setData(JSON.toJSONString(jsonData)).setAccessType("0");

+ 40 - 0
src/main/resources/mapper/QueryListMappeer.xml

@@ -1130,4 +1130,44 @@
         </trim>
         order by a.id desc
     </select>
+    <!--采购大屏信息-->
+    <select id="getProcurementScreen" resultType="com.tld.model.ReceiveGoods">
+        select
+            a.id,
+            a.supplier_id,
+            a.order_code,
+            a.material_id,
+            a.purchase_num,
+            a.arrival_num,
+            a.arrival_time,
+            a.type,
+            b.name as materialName,
+            b.code as wllbCode,
+            b.wllb_class as wllbClass,
+            c.name as supplierName
+        from tld_purchase a
+        left join tld_material b on a.material_id = b.tld_id
+        left join tld_customer c on a.supplier_id = c.code
+        where DATE(a.arrival_time) <![CDATA[=]]>  DATE(NOW())
+        and a.type = '0'
+    </select>
+    <!--采购大屏总数量-->
+    <select id="getTotalQuantity" resultType="java.lang.Integer">
+        select sum(arrival_num) from tld_purchase where DATE(arrival_time) <![CDATA[=]]>  DATE(NOW())
+    </select>
+    <!-- 已收货数量-->
+    <select id="getQuantityArrived" resultType="java.lang.Integer">
+        select sum(arrival_num) from tld_purchase where DATE(arrival_time) <![CDATA[=]]>  DATE(NOW()) and type = '1'
+    </select>
+    <!--未收货数量-->
+    <select id="getUnarrivedQuantity" resultType="java.lang.Integer">
+        select sum(arrival_num) from tld_purchase where DATE(arrival_time) <![CDATA[=]]>  DATE(NOW()) and type = '0'
+    </select>
+    <!--超时未送达数量-->
+    <select id="getTimeoutQuantity" resultType="java.lang.Integer">
+        select  sum(arrival_num) from tld_purchase
+        where DATE(arrival_time) <![CDATA[=]]>  DATE(NOW())
+        and arrival_time <![CDATA[<]]> NOW()
+        and type = '0'
+    </select>
 </mapper>

+ 12 - 12
src/main/resources/mapper/ReceiveGoodsMapper.xml

@@ -161,7 +161,7 @@
         insert into tld_purchase(supplier_id,order_code,material_id,purchase_num,arrival_num,arrival_time,type)
         values
         <foreach collection="jsonData" index="index" item="item" separator=",">
-            (#{item.supplierId},#{item.orderCode},#{item.materialId},#{item.purchaseNum},#{item.arrivalNum},#{item.arrivalTime},'0')
+            (#{item.supplierId},#{item.orderCode},#{item.materialId},#{item.purchaseNum},#{item.arrivalNum},#{item.DateTime},'0')
         </foreach>
     </insert>
     <!-- 修改采购到料状态 -->
@@ -173,17 +173,17 @@
     <!-- 查询采购单 -->
     <select id="getPurchase" resultType="com.tld.model.ReceiveGoods">
         select
-        a.id,
-        a.supplier_id,
-        a.order_code,
-        a.material_id,
-        a.purchase_num,
-        a.arrival_num,
-        a.arrival_time,
-        a.type,
-        b.name as materialName,
-        b.code as wllbCode,
-        c.name as supplierName
+            a.id,
+            a.supplier_id,
+            a.order_code,
+            a.material_id,
+            a.purchase_num,
+            a.arrival_num,
+            a.arrival_time,
+            a.type,
+            b.name as materialName,
+            b.code as wllbCode,
+            c.name as supplierName
         from tld_purchase a
         left join tld_material b on a.material_id = b.tld_id
         left join tld_customer c on a.supplier_id = c.code