zhs 2 anni fa
parent
commit
2ecb919079

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

@@ -159,5 +159,15 @@ public class QueryListController {
     public Map<String, Object> getLogData(LogData logData){
         return queryListService.getLogData(logData);
     }
+
+    /**
+     * 查询所有库存信息
+     * @param inventory 参数
+     * @return 返回结果
+     */
+    @GetMapping("getQueryInventory")
+    public Map<String, Object> getQueryInventory(Inventory inventory){
+        return queryListService.getQueryInventory(inventory);
+    }
 }
 

+ 1 - 1
src/main/java/com/tld/controller/UploadController.java

@@ -19,7 +19,7 @@ public class UploadController {
         String fileName = "tld-consumer-9560.jar";// 设置文件名,根据业务需要替换成要下载的文件名
         if (fileName != null) {
             //设置文件路径
-            String realPath = "D:\\project\\tld-consumer-9560\\build\\libs";
+            String realPath = "c:\\java";
             File file = new File(realPath , fileName);
             if (file.exists()) {
                 response.setContentType("application/octet-stream");//

+ 11 - 0
src/main/java/com/tld/controller/WarehouseTransferController.java

@@ -1,5 +1,6 @@
 package com.tld.controller;
 
+import com.tld.model.AskGoods;
 import com.tld.model.WarehouseTransfer;
 import com.tld.service.WarehouseTransferService;
 import lombok.RequiredArgsConstructor;
@@ -39,6 +40,16 @@ public class WarehouseTransferController {
         return warehouseTransferService.getRecommend(warehouseTransfer);
     }
 
+    /**
+     * 插入出库虚拟表
+     * @param askGoods 参数
+     * @return 返回结果
+     */
+    @PostMapping("addAskGoodsVitrual")
+    public Map<String, Object> addAskGoodsVitrual(@RequestBody AskGoods askGoods){
+        return warehouseTransferService.addAskGoodsVitrual(askGoods);
+    }
+
     /**
      * 出库
      */

+ 11 - 3
src/main/java/com/tld/controller/WebPrintController.java

@@ -4,9 +4,7 @@ package com.tld.controller;
 import com.tld.model.TldPrint;
 import com.tld.service.WebPrintService;
 import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.Map;
@@ -32,4 +30,14 @@ public class WebPrintController {
         return webPrintService.getSerial(tldPrint, request);
     }
 
+    /**
+     * 新增打印信息
+     * @param tldPrint 参数
+     * @return 返回结果
+     */
+    @PostMapping("addPrint")
+    public Map<String, Object> addPrint(@RequestBody TldPrint tldPrint, HttpServletRequest request){
+        return webPrintService.addPrint(tldPrint, request);
+    }
+
 }

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

@@ -38,4 +38,6 @@ public interface QueryListMapper {
     List<Map<String, Object>> getWarehouseTransferExcel(WarehouseTransfer warehouseTransfer);
 
     List<LogData> getLogData(LogData logData);
+
+    List<Map<String, Object>> getQueryInventory(Inventory inventory);
 }

+ 5 - 0
src/main/java/com/tld/mapper/WarehouseTransferMapper.java

@@ -33,4 +33,9 @@ public interface WarehouseTransferMapper {
 
     void delWarehouseTransfer(@Param("id") String id);
 
+    String getScanNum(WarehouseTransfer warehouseTransfer1);
+
+    String getScanNumWare(WarehouseTransfer warehouseTransfer1);
+
+    WarehouseTransfer getAsknInfo(AskGoods askGoods);
 }

+ 8 - 1
src/main/java/com/tld/model/WarehouseTransfer.java

@@ -102,5 +102,12 @@ public class WarehouseTransfer {
      * 条数
      */
     private int limit;
-
+    /**
+     * PDA唯一标识
+     */
+    private String uniqueCode;
+    /**
+     * 账套
+     */
+    private String accountSleeve;
 }

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

@@ -35,4 +35,5 @@ public interface QueryListService {
 
     Map<String, Object> getLogData(LogData logData);
 
+    Map<String, Object> getQueryInventory(Inventory inventory);
 }

+ 2 - 0
src/main/java/com/tld/service/WarehouseTransferService.java

@@ -1,5 +1,6 @@
 package com.tld.service;
 
+import com.tld.model.AskGoods;
 import com.tld.model.WarehouseTransfer;
 
 import javax.servlet.http.HttpServletRequest;
@@ -16,4 +17,5 @@ public interface WarehouseTransferService {
 
     Map<String, Object> delWarehouseTransfer(String id, HttpServletRequest request);
 
+    Map<String, Object> addAskGoodsVitrual(AskGoods askGoods);
 }

+ 2 - 0
src/main/java/com/tld/service/WebPrintService.java

@@ -7,4 +7,6 @@ import java.util.Map;
 
 public interface WebPrintService {
     Map<String, Object> getSerial(TldPrint tldPrint, HttpServletRequest request);
+
+    Map<String, Object> addPrint(TldPrint tldPrint, HttpServletRequest request);
 }

+ 16 - 0
src/main/java/com/tld/service/impl/QueryListServiceImpl.java

@@ -307,4 +307,20 @@ public class QueryListServiceImpl implements QueryListService {
         }
         return map;
     }
+
+    @Override
+    public Map<String, Object> getQueryInventory(Inventory inventory) {
+        Map<String, Object> map = new HashMap<>();
+        try{
+            PageHelper.startPage(inventory.getPage(), inventory.getLimit());
+            PageInfo<Map<String, Object>> list = new PageInfo<>(queryListMapper.getQueryInventory(inventory));
+            map.put("data", list);
+            map.put("msg", "200");
+        } catch (Exception e){
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg", "服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
 }

+ 53 - 1
src/main/java/com/tld/service/impl/WarehouseTransferServiceImpl.java

@@ -9,6 +9,7 @@ import org.redisson.api.RLock;
 import org.redisson.api.RedissonClient;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.servlet.http.HttpServletRequest;
 import java.text.SimpleDateFormat;
@@ -35,6 +36,23 @@ public class WarehouseTransferServiceImpl implements WarehouseTransferService {
         Map<String, Object> map = new HashMap<>();
         try{
             List<WarehouseTransfer> list = warehouseTransferMapper.getWarehouseTransfer(warehouseTransfer);
+            List<String> scanNum = new LinkedList<>();
+            Map<String, Object> mapVal = new HashMap<>();
+            for(WarehouseTransfer warehouseTransfer1 : list){
+                if(warehouseTransfer1.getAskGoodsWarehouseId().equals("6062e900-b3f0-4a5a-b")){
+                    warehouseTransfer1.setUniqueCode(warehouseTransfer.getUniqueCode());
+                    warehouseTransfer.setMaterialCode(warehouseTransfer.getMaterialCode());
+                    scanNum.add(warehouseTransferMapper.getScanNum(warehouseTransfer1));//扫描总数
+                    mapVal.put(warehouseTransfer1.getWarehouseTransferId(), 0);
+                } else {
+                    warehouseTransfer1.setUniqueCode(warehouseTransfer.getUniqueCode());
+                    warehouseTransfer.setMaterialCode(warehouseTransfer.getMaterialCode());
+                    scanNum.add(warehouseTransferMapper.getScanNumWare(warehouseTransfer1));//扫描总数
+                    mapVal.put(warehouseTransfer1.getWarehouseTransferId(), 1);
+                }
+            }
+            map.put("scanNum", scanNum);
+            map.put("type", mapVal);
             map.put("data", list);
             map.put("msg", "200");
         } catch (Exception e){
@@ -50,7 +68,7 @@ public class WarehouseTransferServiceImpl implements WarehouseTransferService {
         Map<String, Object> map = new HashMap<>();
         try{
             Dictionary dictionary = dictionaryMapper.getWarehouseInfo(warehouseTransfer);
-            if(dictionary.getName().equals("原材料库")){
+            if(dictionary.getName().indexOf("原材料库") != -1){
                 map.put("msg", "500");
                 map.put("errMsg", "请扫描标签");
                 return map;
@@ -240,6 +258,40 @@ public class WarehouseTransferServiceImpl implements WarehouseTransferService {
         return map;
     }
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Map<String, Object> addAskGoodsVitrual(AskGoods askGoods) {
+        Map<String, Object> map = new HashMap<>();
+        try{
+            Map<String, Object> mapVal = askGoodsMapper.getScanIsNot(askGoods);
+            if((Double.parseDouble(mapVal.get("inventoryNum").toString()) - Double.parseDouble(mapVal.get("virtualNum").toString())) == 0){
+                map.put("msg", "500");
+                map.put("errMsg", "已全部出库");
+                return map;
+            }
+            Inventory inventory = askGoodsMapper.getInventory(askGoods); //库存数量
+            WarehouseTransfer askGoods1 = warehouseTransferMapper.getAsknInfo(askGoods); //移库数量
+            int alreadyNum =  askGoodsMapper.getAskInfoNumVitrual(askGoods);//已扫描总数
+            int inventoryAlready =  askGoodsMapper.getInventoryAlready(askGoods);//库存已扫描数量
+            int inventorySurplus = (Integer.parseInt(inventory.getAmount()) - Integer.parseInt(inventory.getAmountLock())) - inventoryAlready; //库存剩余数量
+            Double surplusNum = Double.parseDouble(askGoods1.getNum()) - Double.parseDouble(askGoods1.getOutNum()) - alreadyNum; //剩余要扫描数量
+
+            if(surplusNum >= inventorySurplus){
+                askGoods.setNum(String.valueOf(inventorySurplus));
+            } else {
+                askGoods.setNum(String.valueOf(surplusNum));
+            }
+            askGoods.setStorageLocationCode(inventory.getStorageLocationCode());//库存编号
+            askGoodsMapper.addAskGoodsVitrual(askGoods);
+            map.put("msg", "200");
+        }catch (Exception e){
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg", "失败");
+        }
+        return map;
+    }
+
     /**
      * 移库单生成
      * @return

+ 22 - 0
src/main/java/com/tld/service/impl/WebPrintServiceImpl.java

@@ -1,9 +1,13 @@
 package com.tld.service.impl;
 
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import com.tld.mapper.WebPrintMapper;
 import com.tld.model.TldPrint;
+import com.tld.model.User;
 import com.tld.service.WebPrintService;
 import com.tld.util.DateUtil;
+import com.tld.util.DesDecry;
 import lombok.RequiredArgsConstructor;
 import org.redisson.api.RLock;
 import org.redisson.api.RedissonClient;
@@ -11,7 +15,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 @Service
@@ -53,6 +59,22 @@ public class WebPrintServiceImpl implements WebPrintService {
         }
         return map;
     }
+
+    @Override
+    public Map<String, Object> addPrint(TldPrint tldPrint, HttpServletRequest request) {
+        Map<String, Object> map = new HashMap<>();
+        try{
+            tldPrint.setUserId(request.getHeader("userId"));
+            webPrintMapper.addPrint(tldPrint);
+            map.put("msg", "200");
+        } catch (Exception e){
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg", "服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
+
     /**
      * 供应商编号生成
      * @param code 参数

+ 1 - 1
src/main/resources/mapper/AskGoodsMapper.xml

@@ -394,7 +394,7 @@
     </update>
     <!-- 查询指定pda 指定物料扫描总数 -->
     <select id="getScanNum" resultType="String">
-        select if(AVG(num) is null, 0, num)
+        select if(sum(num) is null, 0, num)
         from tld_ask_goods_vitrual
         where unique_code = #{uniqueCode} and ask_goods_id = #{askGoodsId} and wllb_code = #{wllbCode}
     </select>

+ 1 - 1
src/main/resources/mapper/DictionaryMapper.xml

@@ -66,7 +66,7 @@
     </select>
     <!-- 查询仓库字典 -->
     <select id="getWarehouseInfo" resultType="com.tld.model.Dictionary">
-        select code,name,tld_id from tld_warehouse where code = #{askGoodsWarehouseId}
+        select code,name,tld_id from tld_warehouse where tld_id = #{askGoodsWarehouseId}
     </select>
     <!-- 查询物料库存内容 -->
     <select id="getInventorySumAmount" resultType="int">

+ 1 - 1
src/main/resources/mapper/InviteMapper.xml

@@ -81,7 +81,7 @@
     </select>
     <!-- 查询指定pda 指定物料扫描总数 -->
     <select id="getScanNum" resultType="String">
-        select if(AVG(num) is null, 0, num)
+        select if(sum(num) is null, 0, num)
         from tld_ask_goods_vitrual
         where unique_code = #{uniqueCode} and ask_goods_id = #{askGoodsId}
     </select>

+ 36 - 1
src/main/resources/mapper/QueryListMappeer.xml

@@ -67,11 +67,13 @@
             b.create_time as createTime,
             b.is_product as isProduct,
             c.name as name,
-            c.code as code
+            c.code as code,
+            e.name as supplierName
         FROM
             tld_inventory a
             LEFT JOIN tld_storage_location b ON a.storage_location_code = b.storage_location_code
             LEFT JOIN tld_material c ON a.material_id = c.tld_id
+            LEFT JOIN tld_customer e ON a.supplier_id = e.code
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="storageLocationCode != null and storageLocationCode != ''">
                 and a.storage_location_code = #{storageLocationCode}
@@ -84,6 +86,39 @@
             a.storage_location_code,
             a.material_id
     </select>
+    <!-- 查询库位信息 -->
+    <select id="getQueryInventory" resultType="java.util.Map">
+        SELECT
+            a.storage_location_code as storageLocationCode,
+            a.material_id as materialId,
+            a.amount AS sum,
+            a.serial,
+            a.produc_batch as producBatch,
+            a.supplier_id as supplierId,
+            b.storage_location_name as storageLocationName ,
+            b.warehouse_where as warehouseWhere,
+            b.storage_location_type as storageLocationType,
+            b.storage_location_capacity as storageLocationCapacity,
+            b.is_not_disable as isNotDisable,
+            b.create_time as createTime,
+            b.is_product as isProduct,
+            c.name as name,
+            c.code as code,
+            e.name as supplierName
+        FROM
+        tld_inventory a
+        LEFT JOIN tld_storage_location b ON a.storage_location_code = b.storage_location_code
+        LEFT JOIN tld_material c ON a.material_id = c.tld_id
+        LEFT JOIN tld_customer e ON a.supplier_id = e.code
+        <trim prefix="WHERE" prefixOverrides="and |or">
+            <if test="storageLocationCode != null and storageLocationCode != ''">
+                and a.storage_location_code = #{storageLocationCode}
+            </if>
+            <if test="materialId != null and materialId != ''">
+                and a.material_id = #{materialId}
+            </if>
+        </trim>
+    </select>
     <select id="getStorageLocation" resultType="java.util.LinkedHashMap">
         SELECT
             c.code as code,

+ 4 - 4
src/main/resources/mapper/UserMapper.xml

@@ -117,10 +117,10 @@
         select
             a.code,
             a.user_name,
-            a.real_name,
-            a.email,
-            a.landline,
-            a.phone,
+            if(a.real_name = '', '暂无', a.real_name) as real_name,
+            if(a.email = '', '暂无', a.email) as email,
+            if(a.landline = '', '暂无', a.landline) as landline,
+            if(a.phone = '', '暂无', a.phone) as phone,
             c.name as department,
             b.role_name as role,
             a.create_time

+ 30 - 1
src/main/resources/mapper/WarehouseTransferMapper.xml

@@ -14,6 +14,7 @@
             a.num,
             a.out_num,
             a.type,
+            a.account_sleeve,
             b.warehouse_transfer_code,
             b.ask_goods_warehouse_id,
             b.document_time,
@@ -67,7 +68,7 @@
             b.storage_location_name as storageLocationName
         from tld_inventory a
         join tld_storage_location b on a.storage_location_code = b.storage_location_code
-        where a.material_id = #{materialId} and a.hold = '0' and b.warehouse_where = #{warehouseWhere} order by a.produc_date
+        where a.material_id = #{materialId} and a.hold = '0' and a.account_sleeve = #{accountSleeve} and b.warehouse_where = #{warehouseWhere} order by a.produc_date
     </select>
     <!-- 查询库存是否充足 -->
     <select id="getAsk" resultType="com.tld.model.AskGoods">
@@ -130,4 +131,32 @@
         insert into tld_warehouse_transfer_f(warehouse_transfer_id,warehouse_transfer_code,ask_goods_warehouse_id,warehouse_transfer_type,scrq)
         value(#{warehouseTransferId},#{warehouseTransferCode},#{askGoodsWarehouseId},#{warehouseTransferType},now())
     </insert>
+    <!-- 查询指定pda 指定物料扫描总数 -->
+    <select id="getScanNum" resultType="String">
+        select if(sum(num) is null, 0, num)
+        from tld_ask_goods_vitrual
+        where unique_code = #{uniqueCode} and ask_goods_id = #{warehouseTransferId} and wllb_code = #{materialCode}
+    </select>
+    <!-- 查询指定pda 指定物料扫描总数 -->
+    <select id="getScanNumWare" resultType="String">
+        select if(sum(num) is null, 0, num)
+        from tld_warehousing_virtual
+        where unique_code = #{uniqueCode} and warehouse_transfer_id = #{warehouseTransferId} and wllb_code = #{materialCode}
+    </select>
+    <!-- 查询指定送货单信息 -->
+    <select id="getAsknInfo" resultType="com.tld.model.WarehouseTransfer">
+        SELECT
+            a.id,
+            a.warehouse_transfer_id,
+            a.entry_number,
+            a.material_id,
+            a.wbs,
+            a.measurement_id,
+            a.num,
+            ifnull(a.out_num, 0) as out_num
+        FROM
+            tld_warehouse_transfer a
+            join tld_material b on a.material_id = b.tld_id
+        where a.warehouse_transfer_id = #{askGoodsId} and b.code = #{wllbCode}
+    </select>
 </mapper>