Browse Source

问题修改

xiaochen 2 years ago
parent
commit
5aae6fe4fc

+ 30 - 2
src/main/java/com/tld/controller/QueryListController.java

@@ -30,6 +30,15 @@ public class QueryListController {
         return queryListService.dullGoods(inventory);
         return queryListService.dullGoods(inventory);
     }
     }
 
 
+    /**
+     * 呆滞品导出
+     * @param response
+     */
+    @GetMapping("dullGoodsExport")
+    public void dullGoodsExport(Inventory inventory, HttpServletResponse response){
+        queryListService.dullGoodsExport(inventory, response);
+    }
+
     /**
     /**
      * 物料储量预警查询
      * 物料储量预警查询
      * @param wllbCode 物料编号
      * @param wllbCode 物料编号
@@ -38,8 +47,27 @@ public class QueryListController {
      * @return 返回结果
      * @return 返回结果
      */
      */
     @GetMapping("reserveWarning")
     @GetMapping("reserveWarning")
-    public Map<String, Object> reserveWarning(String wllbCode, int page, int limit){
-        return queryListService.reserveWarning(wllbCode, page, limit);
+    public Map<String, Object> reserveWarning(String wllbCode,String materialName, int page, int limit){
+        return queryListService.reserveWarning(wllbCode,materialName, page, limit);
+    }
+
+    /**
+     * 查询物料储量预警查询
+     * @param inventory 参数
+     * @return 返回结果
+     */
+    @GetMapping("reserveWarnings")
+    public Map<String, Object> reserveWarnings(Inventory inventory){
+        return queryListService.reserveWarnings(inventory);
+    }
+
+    /**
+     * 查询物料储量预警查询导出
+     * @param inventory 参数
+     */
+    @GetMapping("reserveWarningsExport")
+    public void reserveWarningsExport(Inventory inventory, HttpServletResponse response){
+        queryListService.reserveWarningsExport(inventory, response);
     }
     }
 
 
 
 

+ 12 - 3
src/main/java/com/tld/controller/ReceiveGoodsController.java

@@ -21,7 +21,7 @@ public class ReceiveGoodsController {
     private ReceiveGoodsSerivce receiveGoodsSerivce;
     private ReceiveGoodsSerivce receiveGoodsSerivce;
 
 
     /**
     /**
-     * 查询采购单
+     * 查询采购单1
      * @param receiveGoods 参数
      * @param receiveGoods 参数
      * @return 返回结果
      * @return 返回结果
      */
      */
@@ -41,7 +41,7 @@ public class ReceiveGoodsController {
     }
     }
 
 
     /**
     /**
-     * 查询采购单   再用
+     * 查询采购单   再用2
      * @param receiveGoods 参数
      * @param receiveGoods 参数
      * @return 返回结果
      * @return 返回结果
      */
      */
@@ -71,7 +71,16 @@ public class ReceiveGoodsController {
     }
     }
 
 
     /**
     /**
-     * 采购单导出
+     * 采购单导出1
+     * @param response
+     */
+    @GetMapping("purchasesExport")
+    public void purchasesExport(ReceiveGoods receiveGoods, HttpServletResponse response){
+        receiveGoodsSerivce.purchasesExport(receiveGoods, response);
+    }
+
+    /**
+     * 采购单导出2
      * @param response
      * @param response
      */
      */
     @GetMapping("purchaseExport")
     @GetMapping("purchaseExport")

+ 6 - 1
src/main/java/com/tld/mapper/QueryListMapper.java

@@ -14,7 +14,7 @@ public interface QueryListMapper {
 
 
     Map<String, Object> reserveWarning(Map<String, Object> map);
     Map<String, Object> reserveWarning(Map<String, Object> map);
 
 
-    List<Map<String, Object>> getMaterial(String wllbCode);
+    List<Map<String, Object>> getMaterial(String wllbCode,String materialName);
 
 
     List<Map<String, Object>> storageLocation(Inventory inventory);
     List<Map<String, Object>> storageLocation(Inventory inventory);
 
 
@@ -42,4 +42,9 @@ public interface QueryListMapper {
 
 
     List<Map<String, Object>> getQueryInventory(Inventory inventory);
     List<Map<String, Object>> getQueryInventory(Inventory inventory);
 
 
+    List<Map<String, Object>> dullGoodsExport(Inventory inventory);
+
+    List<Map<String, Object>> reserveWarnings(Inventory inventory);
+
+    List<Map<String, Object>> reserveWarningsExport(Inventory inventory);
 }
 }

+ 1 - 0
src/main/java/com/tld/mapper/ReceiveGoodsMapper.java

@@ -38,4 +38,5 @@ public interface ReceiveGoodsMapper {
 
 
     List<Map<String, Object>> overtimePurchaseExport(ReceiveGoods receiveGoods);
     List<Map<String, Object>> overtimePurchaseExport(ReceiveGoods receiveGoods);
 
 
+    List<Map<String, Object>> purchasesExport(ReceiveGoods receiveGoods);
 }
 }

+ 16 - 0
src/main/java/com/tld/model/Inventory.java

@@ -20,6 +20,14 @@ public class Inventory implements Serializable {
      * 库位编号
      * 库位编号
      */
      */
     private String storageLocationCode;
     private String storageLocationCode;
+    /**
+     * 供应商code
+     */
+    private String ustomerCode;
+    /**
+     * 所属公司code
+     */
+    private String companyCode;
     /**
     /**
      * 库位名称
      * 库位名称
      */
      */
@@ -84,6 +92,10 @@ public class Inventory implements Serializable {
      * 物料id
      * 物料id
      */
      */
     private String materialId;
     private String materialId;
+    /**
+     * 物料名称
+     */
+    private String materialName;
     /**
     /**
      * 生成批次
      * 生成批次
      */
      */
@@ -112,6 +124,10 @@ public class Inventory implements Serializable {
      * 公司名称
      * 公司名称
      */
      */
     private String accountName;
     private String accountName;
+    /**
+     * 公司名称
+     */
+    private String companyName;
     /**
     /**
      * 页数
      * 页数
      */
      */

+ 8 - 0
src/main/java/com/tld/model/Notice.java

@@ -92,6 +92,10 @@ public class Notice implements Serializable {
      * 物料名称
      * 物料名称
      */
      */
     private String materialName;
     private String materialName;
+    /**
+     * 公司名称
+     */
+    private String companyName;
     /**
     /**
      * 物料类别
      * 物料类别
      */
      */
@@ -128,6 +132,10 @@ public class Notice implements Serializable {
      * 库位编号
      * 库位编号
      */
      */
     private String storageLocationCode;
     private String storageLocationCode;
+    /**
+     * 库位名称
+     */
+    private String storageLocationName;
     /**
     /**
      * 入库单编号
      * 入库单编号
      */
      */

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

@@ -75,6 +75,10 @@ public class ReceiveGoods implements Serializable {
      * 公司编号
      * 公司编号
      */
      */
     private String companyNumber;
     private String companyNumber;
+    /**
+     * 公司名称
+     */
+    private String compName;
     /**
     /**
      * wbs
      * wbs
      */
      */

+ 1 - 1
src/main/java/com/tld/model/User.java

@@ -15,7 +15,7 @@ public class User implements Serializable {
     /**
     /**
      * 主键
      * 主键
      */
      */
-    private int id;
+    private String id;
     /**
     /**
      * 用户编号
      * 用户编号
      */
      */

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

@@ -62,6 +62,14 @@ public class WarehouseTransfer {
      * 物料编号
      * 物料编号
      */
      */
     private String materialCode;
     private String materialCode;
+    /**
+     * 公司名称
+     */
+    private String companyName;
+    /**
+     * 公司code
+     */
+    private String companyCode;
     /**
     /**
      * wbs
      * wbs
      */
      */

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

@@ -10,7 +10,7 @@ import java.util.Map;
 public interface QueryListService {
 public interface QueryListService {
     Map<String, Object> dullGoods(Inventory inventory);
     Map<String, Object> dullGoods(Inventory inventory);
 
 
-    Map<String, Object> reserveWarning(String wllbCode, int page, int limit);
+    Map<String, Object> reserveWarning(String wllbCode,String materialName, int page, int limit);
 
 
     Map<String, Object> storageLocation(Inventory inventory);
     Map<String, Object> storageLocation(Inventory inventory);
 
 
@@ -40,4 +40,9 @@ public interface QueryListService {
 
 
     Map<String, Object> getErrorList(Error error);
     Map<String, Object> getErrorList(Error error);
 
 
+    void dullGoodsExport(Inventory inventory, HttpServletResponse response);
+
+    Map<String, Object> reserveWarnings(Inventory inventory);
+
+    void reserveWarningsExport(Inventory inventory, HttpServletResponse response);
 }
 }

+ 3 - 0
src/main/java/com/tld/service/ReceiveGoodsSerivce.java

@@ -29,4 +29,7 @@ public interface ReceiveGoodsSerivce {
     void purchaseExport(ReceiveGoods receiveGoods, HttpServletResponse response);
     void purchaseExport(ReceiveGoods receiveGoods, HttpServletResponse response);
 
 
     void overtimePurchaseExport(ReceiveGoods receiveGoods, HttpServletResponse response);
     void overtimePurchaseExport(ReceiveGoods receiveGoods, HttpServletResponse response);
+
+    void purchasesExport(ReceiveGoods receiveGoods, HttpServletResponse response);
+
 }
 }

+ 82 - 5
src/main/java/com/tld/service/impl/QueryListServiceImpl.java

@@ -43,24 +43,24 @@ public class QueryListServiceImpl implements QueryListService {
     }
     }
 
 
     @Override
     @Override
-    public Map<String, Object> reserveWarning(String wllbCode, int page, int limit) {
+    public Map<String, Object> reserveWarning(String wllbCode,String materialName, int page, int limit) {
         Map<String, Object> map = new HashMap<>();
         Map<String, Object> map = new HashMap<>();
         try{
         try{
             List<Map<String, Object>> mapList = new LinkedList<>();
             List<Map<String, Object>> mapList = new LinkedList<>();
             PageHelper.startPage(page, limit);
             PageHelper.startPage(page, limit);
-            List<Map<String, Object>> list = queryListMapper.getMaterial(wllbCode);
+            List<Map<String, Object>> list = queryListMapper.getMaterial(wllbCode,materialName);
             for(Map<String, Object> data : list){
             for(Map<String, Object> data : list){
                 Map<String, Object> map1 = queryListMapper.reserveWarning(data);
                 Map<String, Object> map1 = queryListMapper.reserveWarning(data);
                 map1.put("materialName", data.get("name"));
                 map1.put("materialName", data.get("name"));
                 map1.put("wllbCode", data.get("code"));
                 map1.put("wllbCode", data.get("code"));
                 if(Double.parseDouble(map1.get("minNum").toString()) > Double.parseDouble(map1.get("amount").toString())
                 if(Double.parseDouble(map1.get("minNum").toString()) > Double.parseDouble(map1.get("amount").toString())
                 || Double.parseDouble(map1.get("maxNum").toString()) < Double.parseDouble(map1.get("amount").toString())
                 || Double.parseDouble(map1.get("maxNum").toString()) < Double.parseDouble(map1.get("amount").toString())
-                || map1.get("amount").toString().equals("0")
                 ){
                 ){
                     mapList.add(map1);
                     mapList.add(map1);
                 }
                 }
             }
             }
             PageInfo<Map<String, Object>> listVal = new PageInfo<>(mapList);
             PageInfo<Map<String, Object>> listVal = new PageInfo<>(mapList);
+            listVal.setTotal(list.size());
             map.put("data", listVal);
             map.put("data", listVal);
             map.put("msg", "200");
             map.put("msg", "200");
         } catch (Exception e){
         } catch (Exception e){
@@ -93,7 +93,7 @@ public class QueryListServiceImpl implements QueryListService {
             //导出数据汇总
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
             //表头数据
-            List<Object> head = Arrays.asList("物料code", "物料名称", "库位名称", "数量");
+            List<Object> head = Arrays.asList("物料编号", "物料名称", "数量","库位名称","所属公司","供应商","WBS编号");
             //查询数据
             //查询数据
             PageHelper.startPage(inventory.getPage(), inventory.getLimit());
             PageHelper.startPage(inventory.getPage(), inventory.getLimit());
             List<Map<String, Object>> list = queryListMapper.getStorageLocation(inventory);
             List<Map<String, Object>> list = queryListMapper.getStorageLocation(inventory);
@@ -278,7 +278,7 @@ public class QueryListServiceImpl implements QueryListService {
             //导出数据汇总
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
             //表头数据
-            List<Object> head = Arrays.asList("移库单ID", "移库单编号", "物料ID", "物料名称", "物料编号", "WBS", "移库数量", "已移库数量", "要货仓库ID", "出货仓库ID", "要货仓库名称", "出货仓库名称", "单据日期","状态");
+            List<Object> head = Arrays.asList("移库单ID", "移库单编号", "物料名称", "物料编号", "WBS", "移库数量", "已移库数量", "要货仓库", "出货仓库", "单据日期");
             //查询数据
             //查询数据
             List<Map<String, Object>> list = queryListMapper.getWarehouseTransferExcel(warehouseTransfer);
             List<Map<String, Object>> list = queryListMapper.getWarehouseTransferExcel(warehouseTransfer);
             sheetDataList.add(head);
             sheetDataList.add(head);
@@ -348,4 +348,81 @@ public class QueryListServiceImpl implements QueryListService {
         }
         }
         return map;
         return map;
     }
     }
+
+    /**
+     * 呆滞品导出
+     * */
+    @Override
+    public void dullGoodsExport(Inventory inventory, HttpServletResponse response) {
+        try{
+            //导出数据汇总
+            List<List<Object>> sheetDataList = new ArrayList<>();
+            //表头数据
+            List<Object> head = Arrays.asList("物料编号", "物料名称", "库位名称","所属公司","供应商", "WBS编号", "数量", "入库时间");
+            //查询数据
+            List<Map<String, Object>> list = queryListMapper.dullGoodsExport(inventory);
+            sheetDataList.add(head);
+            for(Map<String, Object> userMap : list){
+                List<Object> listSheet = new ArrayList<>();
+                for(String key: userMap.keySet()){
+                    listSheet.add(userMap.get(key));
+                }
+                sheetDataList.add(listSheet);
+            }
+            //当前时间
+            Date time = new Date();
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMddHHmmss");
+            ExcelUtils.export(response, "用户数据导出" + sdf.format(time), sheetDataList);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 查询物料储量预警查询
+     * */
+    @Override
+    public Map<String, Object> reserveWarnings(Inventory inventory) {
+        Map<String, Object> map = new HashMap<>();
+        try{
+            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;
+    }
+
+    /**
+     * 查询物料储量预警查询导出
+     * */
+    @Override
+    public void reserveWarningsExport(Inventory inventory, HttpServletResponse response) {
+        try{
+            //导出数据汇总
+            List<List<Object>> sheetDataList = new ArrayList<>();
+            //表头数据
+            List<Object> head = Arrays.asList("物料编号", "物料名称", "数量","最小数量","最大数量");
+            //查询数据
+            List<Map<String, Object>> list = queryListMapper.reserveWarningsExport(inventory);
+            sheetDataList.add(head);
+            for(Map<String, Object> userMap : list){
+                List<Object> listSheet = new ArrayList<>();
+                for(String key: userMap.keySet()){
+                    listSheet.add(userMap.get(key));
+                }
+                sheetDataList.add(listSheet);
+            }
+            //当前时间
+            Date time = new Date();
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMddHHmmss");
+            ExcelUtils.export(response, "查询物料储量预警查询导出" + sdf.format(time), sheetDataList);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
 }
 }

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

@@ -289,4 +289,33 @@ public class ReceiveGoodsSerivceImpl implements ReceiveGoodsSerivce {
             e.printStackTrace();
             e.printStackTrace();
         }
         }
     }
     }
+
+    /**
+     * 采购单导出1
+     * */
+    @Override
+    public void purchasesExport(ReceiveGoods receiveGoods, HttpServletResponse response) {
+        try{
+            //导出数据汇总
+            List<List<Object>> sheetDataList = new ArrayList<>();
+            //表头数据
+            List<Object> head = Arrays.asList("采购单号", "物料名称", "物料编号","WBS编号","供应商名称","采购数量", "到货数量","合格数量","不合格数量");
+            //查询数据
+            List<Map<String, Object>> list = receiveGoodsMapper.purchasesExport(receiveGoods);
+            sheetDataList.add(head);
+            for(Map<String, Object> userMap : list){
+                List<Object> listSheet = new ArrayList<>();
+                for(String key: userMap.keySet()){
+                    listSheet.add(userMap.get(key));
+                }
+                sheetDataList.add(listSheet);
+            }
+            //当前时间
+            Date time = new Date();
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMddHHmmss");
+            ExcelUtils.export(response, "采购单导出" + sdf.format(time), sheetDataList);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
 }
 }

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

@@ -207,7 +207,7 @@ public class WarehouseTransferServiceImpl implements WarehouseTransferService {
                     warehousingVirtual.setAccountSleeve(warehouseTransfer.getAccountSleeve());
                     warehousingVirtual.setAccountSleeve(warehouseTransfer.getAccountSleeve());
                 }
                 }
                 //查询部门编号
                 //查询部门编号
-                List<User> listUser = userMapper.getAllUser(new User().setId(Integer.parseInt(warehousingVirtual.getUserId())));
+                List<User> listUser = userMapper.getAllUser(new User().setId(warehousingVirtual.getUserId()));
                 warehousingVirtual.setDepartmentId(listUser.get(0).getDepartmentId());
                 warehousingVirtual.setDepartmentId(listUser.get(0).getDepartmentId());
                 //查询物料分类
                 //查询物料分类
                 WarehousingVirtual warehousingVirtual1 = warehousingMapper.getWlClass(warehousingVirtual);
                 WarehousingVirtual warehousingVirtual1 = warehousingMapper.getWlClass(warehousingVirtual);

+ 6 - 8
src/main/java/com/tld/service/impl/WarehousingServiceImpl.java

@@ -171,7 +171,7 @@ public class WarehousingServiceImpl implements WarehousingService {
                     warehousingVirtual.setStorageCode(receiveGoods.get(0).getOrderCode());
                     warehousingVirtual.setStorageCode(receiveGoods.get(0).getOrderCode());
                 }
                 }
                 //查询部门编号
                 //查询部门编号
-                List<User> listUser = userMapper.getAllUser(new User().setId(Integer.parseInt(warehousingVirtual.getUserId())));
+                List<User> listUser = userMapper.getAllUser(new User().setId(warehousingVirtual.getUserId()));
                 warehousingVirtual.setDepartmentId(listUser.get(0).getDepartmentId());
                 warehousingVirtual.setDepartmentId(listUser.get(0).getDepartmentId());
                 //查询物料分类
                 //查询物料分类
                 WarehousingVirtual warehousingVirtual1 = warehousingMapper.getWlClass(warehousingVirtual);
                 WarehousingVirtual warehousingVirtual1 = warehousingMapper.getWlClass(warehousingVirtual);
@@ -338,12 +338,11 @@ public class WarehousingServiceImpl implements WarehousingService {
             //导出数据汇总
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
             //表头数据
-            List<Object> head = Arrays.asList("物料名称", "供应商名称", "连番号", "生产日期", "生产批次", "容量", "序列号", "类型", "用户名称", "部门", "库位名称", "入库日期", "采购单号", "WBS");
+            List<Object> head = Arrays.asList("物料名称","物料编号", "供应商名称", "连番号", "生产日期", "生产批次", "容量", "序列号", "类型", "用户名称", "部门", "库位名称", "入库日期", "采购单号", "WBS");
             //查询数据
             //查询数据
-            PageHelper.startPage(storage.getPage(), storage.getLimit());
-            PageInfo<Map<String, Object>> list = new PageInfo<>(warehousingMapper.export(storage));
+            List<Map<String, Object>> list = new ArrayList<>(warehousingMapper.export(storage));
             sheetDataList.add(head);
             sheetDataList.add(head);
-            for(Map<String, Object> userMap : list.getList()){
+            for(Map<String, Object> userMap : list){
                 List<Object> listSheet = new ArrayList<>();
                 List<Object> listSheet = new ArrayList<>();
                 for(String key: userMap.keySet()){
                 for(String key: userMap.keySet()){
                     listSheet.add(userMap.get(key));
                     listSheet.add(userMap.get(key));
@@ -537,9 +536,8 @@ public class WarehousingServiceImpl implements WarehousingService {
             //导出数据汇总
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
             //表头数据
-            List<Object> head = Arrays.asList("物料名称", "生产时间", "数量", "用户名称", "入库时间", "入库单编号", "WBS");
+            List<Object> head = Arrays.asList("物料名称","物料编号", "生产时间", "数量", "用户名称", "入库时间", "入库单编号", "WBS");
             //查询数据
             //查询数据
-            PageHelper.startPage(notice.getPage(), notice.getLimit());
             List<Map<String, Object>> list = warehousingMapper.productExcel(notice);
             List<Map<String, Object>> list = warehousingMapper.productExcel(notice);
             sheetDataList.add(head);
             sheetDataList.add(head);
             for(Map<String, Object> userMap : list){
             for(Map<String, Object> userMap : list){
@@ -748,7 +746,7 @@ public class WarehousingServiceImpl implements WarehousingService {
             //导出数据汇总
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
             //表头数据
-            List<Object> head = Arrays.asList("物料名称", "生产批次", "数量", "用户名称", "库位编号", "入库时间", "连番号", "序列号", "属性", "入库单编号", "WBS");
+            List<Object> head = Arrays.asList("物料名称","物料编号", "生产批次", "数量", "用户名称", "库位编号", "入库时间", "连番号", "序列号", "属性", "入库单编号", "WBS");
             //查询数据
             //查询数据
             List<Map<String, Object>> list = warehousingMapper.getHalfExcel(notice);
             List<Map<String, Object>> list = warehousingMapper.getHalfExcel(notice);
             sheetDataList.add(head);
             sheetDataList.add(head);

+ 381 - 193
src/main/resources/mapper/QueryListMappeer.xml

@@ -3,81 +3,104 @@
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.tld.mapper.QueryListMapper">
 <mapper namespace="com.tld.mapper.QueryListMapper">
     <!-- 呆滞品查询 -->
     <!-- 呆滞品查询 -->
-   <select id="dullGoods" resultType="java.util.Map">
-       SELECT
-            a.id as id,
-            a.material_id as materialId,
-            a.amount as amount,
-            a.scrq as scrq,
-            a.storage_location_code as storageLocationCode,
-            b.name as materialName,
-            c.storage_location_name as storageLocationName,
-            b.code as wllbCode,
-            a.wbs as wbs
-       FROM tld_inventory a
-       JOIN tld_material b ON a.material_id = b.tld_id
-       LEFT JOIN  tld_storage_location c ON a.storage_location_code = c.storage_location_code
-       WHERE datediff(now(), a.scrq) <![CDATA[>]]> 90
+    <select id="dullGoods" resultType="java.util.Map">
+        SELECT
+        a.id as id,
+        a.material_id as materialId,
+        a.amount as amount,
+        a.scrq as scrq,
+        a.storage_location_code as storageLocationCode,
+        b.name as materialName,
+        c.storage_location_name as storageLocationName,
+        b.code as wllbCode,
+        a.wbs as wbs,
+        e.name as ustomerName,
+        f.name as companyName
+        FROM tld_inventory a
+        JOIN tld_material b ON a.material_id = b.tld_id
+        LEFT JOIN tld_storage_location c ON a.storage_location_code = c.storage_location_code
+        LEFT JOIN tld_customer e ON a.supplier_id = e.code
+        LEFT JOIN tld_company f ON a.account_sleeve = f.code
+        WHERE datediff(now(), a.scrq) <![CDATA[>]]> 90
         <if test="storageLocationCode != null and storageLocationCode != ''">
         <if test="storageLocationCode != null and storageLocationCode != ''">
             and a.storage_location_code = #{storageLocationCode}
             and a.storage_location_code = #{storageLocationCode}
         </if>
         </if>
+        <if test="materialName != null and materialName != ''">
+            and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
+        </if>
         <if test="wllbCode != null and wllbCode != ''">
         <if test="wllbCode != null and wllbCode != ''">
-           and b.code = #{wllbCode}
+            and b.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
+        </if>
+        <if test="wbs != null and wbs != ''">
+            and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
         </if>
         </if>
-   </select>
+        <if test="storageLocationName != null and storageLocationName != ''">
+            and c.storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
+        </if>
+        <if test="ustomerCode != null and ustomerCode != ''">
+            and a.supplier_id = #{ustomerCode}
+        </if>
+        <if test="companyCode != null and companyCode != ''">
+            and a.account_sleeve = #{companyCode}
+        </if>
+    </select>
     <!-- 查询所有物料 -->
     <!-- 查询所有物料 -->
     <select id="getMaterial" resultType="java.util.Map">
     <select id="getMaterial" resultType="java.util.Map">
         select
         select
-            tld_id as tldId,
-            ifnull(min_num, 0) as minNum,
-            ifnull(max_num, 0) as maxNum,
-            name as name,
-            code as code
+        tld_id as tldId,
+        ifnull(min_num, 0) as minNum,
+        ifnull(max_num, 0) as maxNum,
+        name as name,
+        code as code
         from tld_material
         from tld_material
         <trim prefix="WHERE" prefixOverrides="and |or">
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="wllbCode != null and wllbCode != ''">
             <if test="wllbCode != null and wllbCode != ''">
-                and code = #{wllbCode}
+                and code like CONCAT(CONCAT('%', #{wllbCode}), '%')
+            </if>
+            <if test="materialName != null and materialName != ''">
+                and name like CONCAT(CONCAT('%', #{materialName}), '%')
             </if>
             </if>
         </trim>
         </trim>
     </select>
     </select>
     <!-- 物料储量预警查询 -->
     <!-- 物料储量预警查询 -->
     <select id="reserveWarning" resultType="java.util.Map" parameterType="java.util.Map">
     <select id="reserveWarning" resultType="java.util.Map" parameterType="java.util.Map">
-        SELECT
-            ifnull(sum( a.amount ), "0" ) as amount,
-            ${tldId} as materialId,
-            ${minNum} as minNum,
-            ${maxNum} as maxNum
+        SELECT ifnull(sum(a.amount), "0") as amount,
+               ${tldId}                   as materialId,
+               ${minNum}                  as minNum,
+               ${maxNum}                  as maxNum
         FROM tld_inventory a
         FROM tld_inventory a
-        LEFT JOIN tld_material b ON a.material_id = b.tld_id
+                 LEFT JOIN tld_material b ON a.material_id = b.tld_id
         WHERE material_id = #{tldId}
         WHERE material_id = #{tldId}
     </select>
     </select>
     <!-- 查询库位信息 -->
     <!-- 查询库位信息 -->
     <select id="storageLocation" resultType="java.util.Map">
     <select id="storageLocation" resultType="java.util.Map">
         SELECT
         SELECT
-            a.storage_location_code as storageLocationCode,
-            a.material_id as materialId,
-            sum( a.amount ) AS sum,
-            a.serial,
-            a.wbs as wbs,
-            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,
-            f.name as warehouseName
+        a.storage_location_code as storageLocationCode,
+        a.material_id as materialId,
+        sum( a.amount ) AS sum,
+        a.serial,
+        a.wbs as wbs,
+        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,
+        f.name as warehouseName,
+        p.name as companyName
         FROM
         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
-            LEFT JOIN tld_warehouse f on b.warehouse_where = f.tld_id
+        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
+        LEFT JOIN tld_warehouse f on b.warehouse_where = f.tld_id
+        LEFT JOIN tld_company p on a.account_sleeve = p.code
         <trim prefix="WHERE" prefixOverrides="and |or">
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="storageLocationCode != null and storageLocationCode != ''">
             <if test="storageLocationCode != null and storageLocationCode != ''">
                 and a.storage_location_code = #{storageLocationCode}
                 and a.storage_location_code = #{storageLocationCode}
@@ -85,30 +108,48 @@
             <if test="materialId != null and materialId != ''">
             <if test="materialId != null and materialId != ''">
                 and a.material_id = #{materialId}
                 and a.material_id = #{materialId}
             </if>
             </if>
+            <if test="wllbCode != null and wllbCode != ''">
+                and c.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
+            </if>
+            <if test="materialName != null and materialName != ''">
+                and c.name like CONCAT(CONCAT('%', #{materialName}), '%')
+            </if>
+            <if test="storageLocationName != null and storageLocationName != ''">
+                and b.storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
+            </if>
+            <if test="companyName != null and companyName != ''">
+                and p.name like CONCAT(CONCAT('%', #{companyName}), '%')
+            </if>
+            <if test="supplierId != null and supplierId != ''">
+                and a.supplier_id like CONCAT(CONCAT('%', #{supplierId}), '%')
+            </if>
+            <if test="wbs != null and wbs != ''">
+                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+            </if>
         </trim>
         </trim>
         GROUP BY
         GROUP BY
-            a.storage_location_code,
-            a.material_id
+        a.storage_location_code,
+        a.material_id
     </select>
     </select>
     <!-- 查询库位信息 -->
     <!-- 查询库位信息 -->
     <select id="getQueryInventory" resultType="java.util.Map">
     <select id="getQueryInventory" resultType="java.util.Map">
         SELECT
         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
+        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
         FROM
         tld_inventory a
         tld_inventory a
         LEFT JOIN tld_storage_location b ON a.storage_location_code = b.storage_location_code
         LEFT JOIN tld_storage_location b ON a.storage_location_code = b.storage_location_code
@@ -125,14 +166,20 @@
     </select>
     </select>
     <select id="getStorageLocation" resultType="java.util.LinkedHashMap">
     <select id="getStorageLocation" resultType="java.util.LinkedHashMap">
         SELECT
         SELECT
-            c.code as code,
-            c.name as name,
-            b.storage_location_name as storageLocationName ,
-            sum( a.amount ) AS sum
+        c.code as code,
+        c.name as name,
+        sum( a.amount ) AS sum,
+        b.storage_location_name as storageLocationName ,
+        p.name as companyName,
+        e.name as supplierName,
+        a.wbs as wbs
         FROM
         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
+        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
+        LEFT JOIN tld_warehouse f on b.warehouse_where = f.tld_id
+        LEFT JOIN tld_company p on a.account_sleeve = p.code
         <trim prefix="WHERE" prefixOverrides="and |or">
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="storageLocationCode != null and storageLocationCode != ''">
             <if test="storageLocationCode != null and storageLocationCode != ''">
                 and a.storage_location_code = #{storageLocationCode}
                 and a.storage_location_code = #{storageLocationCode}
@@ -140,6 +187,24 @@
             <if test="materialId != null and materialId != ''">
             <if test="materialId != null and materialId != ''">
                 and a.material_id = #{materialId}
                 and a.material_id = #{materialId}
             </if>
             </if>
+            <if test="wllbCode != null and wllbCode != ''">
+                and c.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
+            </if>
+            <if test="materialName != null and materialName != ''">
+                and c.name like CONCAT(CONCAT('%', #{materialName}), '%')
+            </if>
+            <if test="storageLocationName != null and storageLocationName != ''">
+                and b.storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
+            </if>
+            <if test="companyName != null and companyName != ''">
+                and p.name like CONCAT(CONCAT('%', #{companyName}), '%')
+            </if>
+            <if test="supplierId != null and supplierId != ''">
+                and a.supplier_id like CONCAT(CONCAT('%', #{supplierId}), '%')
+            </if>
+            <if test="wbs != null and wbs != ''">
+                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+            </if>
         </trim>
         </trim>
         GROUP BY
         GROUP BY
         a.storage_location_code,
         a.storage_location_code,
@@ -160,22 +225,22 @@
     <!-- 查询生产领料要货 -->
     <!-- 查询生产领料要货 -->
     <select id="getAskGoods" resultType="com.tld.model.AskGoods">
     <select id="getAskGoods" resultType="com.tld.model.AskGoods">
         SELECT
         SELECT
-            a.id,
-            a.ask_goods_id,
-            a.material_id,
-            IFNULL( a.out_num, 0 ) AS out_num,
-            a.num,
-            e.NAME AS materialName,
-            e.CODE AS materialCode,
-            b.ask_goods_code,
-            b.company_number,
-            b.sqrq
+        a.id,
+        a.ask_goods_id,
+        a.material_id,
+        IFNULL( a.out_num, 0 ) AS out_num,
+        a.num,
+        e.NAME AS materialName,
+        e.CODE AS materialCode,
+        b.ask_goods_code,
+        b.company_number,
+        b.sqrq
         FROM
         FROM
-            tld_ask_goods a
-            JOIN tld_ask_goods_f b ON a.ask_goods_id = b.ask_goods_id
-            LEFT JOIN tld_department c ON b.department = c.code
-            JOIN tld_material e ON a.material_id = e.tld_id
-       /* WHERE e.part_type != '半成品' and e.part_type != '产成品'*/
+        tld_ask_goods a
+        JOIN tld_ask_goods_f b ON a.ask_goods_id = b.ask_goods_id
+        LEFT JOIN tld_department c ON b.department = c.code
+        JOIN tld_material e ON a.material_id = e.tld_id
+        /* WHERE e.part_type != '半成品' and e.part_type != '产成品'*/
         <trim prefix="WHERE" prefixOverrides="and |or">
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="askGoodsId != null and askGoodsId != ''">
             <if test="askGoodsId != null and askGoodsId != ''">
                 and b.ask_goods_code = #{askGoodsId}
                 and b.ask_goods_code = #{askGoodsId}
@@ -197,19 +262,19 @@
     <!-- 查询生产领料要货 -->
     <!-- 查询生产领料要货 -->
     <select id="getAskGoodsExcel" resultType="java.util.LinkedHashMap">
     <select id="getAskGoodsExcel" resultType="java.util.LinkedHashMap">
         SELECT
         SELECT
-            a.ask_goods_id,
-            a.material_id,
-            a.num,
-            IFNULL( a.out_num, 0 ) AS out_num,
-            e.NAME AS materialName,
-            e.CODE AS materialCode,
-            b.ask_goods_code,
-            b.company_number
+        a.ask_goods_id,
+        a.material_id,
+        a.num,
+        IFNULL( a.out_num, 0 ) AS out_num,
+        e.NAME AS materialName,
+        e.CODE AS materialCode,
+        b.ask_goods_code,
+        b.company_number
         FROM
         FROM
-            tld_ask_goods a
-            JOIN tld_ask_goods_f b ON a.ask_goods_id = b.ask_goods_id
-            LEFT JOIN tld_department c ON b.department = c.code
-            JOIN tld_material e ON a.material_id = e.tld_id
+        tld_ask_goods a
+        JOIN tld_ask_goods_f b ON a.ask_goods_id = b.ask_goods_id
+        LEFT JOIN tld_department c ON b.department = c.code
+        JOIN tld_material e ON a.material_id = e.tld_id
         WHERE e.part_type != '半成品' and e.part_type != '产成品'
         WHERE e.part_type != '半成品' and e.part_type != '产成品'
         <if test="askGoodsId != null and askGoodsId != ''">
         <if test="askGoodsId != null and askGoodsId != ''">
             and a.ask_goods_id = #{askGoodsId}
             and a.ask_goods_id = #{askGoodsId}
@@ -230,23 +295,23 @@
     <!-- 查询非生产领料单 -->
     <!-- 查询非生产领料单 -->
     <select id="getInvite" resultType="com.tld.model.AskGoods">
     <select id="getInvite" resultType="com.tld.model.AskGoods">
         SELECT
         SELECT
-            a.id,
-            a.ask_goods_id,
-            a.material_id,
-            IFNULL( a.out_num, 0 ) AS out_num,
-            a.num,
-            e.NAME AS materialName,
-            e.CODE AS materialCode,
-            b.ask_goods_code,
-            b.company_number,
-            b.sqrq
+        a.id,
+        a.ask_goods_id,
+        a.material_id,
+        IFNULL( a.out_num, 0 ) AS out_num,
+        a.num,
+        e.NAME AS materialName,
+        e.CODE AS materialCode,
+        b.ask_goods_code,
+        b.company_number,
+        b.sqrq
         FROM
         FROM
-            tld_invite a
-            JOIN tld_invite_f b ON a.ask_goods_id = b.ask_goods_id
-            LEFT JOIN tld_department c ON b.department = c.code
-            JOIN tld_material e ON a.material_id = e.tld_id
+        tld_invite a
+        JOIN tld_invite_f b ON a.ask_goods_id = b.ask_goods_id
+        LEFT JOIN tld_department c ON b.department = c.code
+        JOIN tld_material e ON a.material_id = e.tld_id
         /*WHERE*/
         /*WHERE*/
-            /*e.part_type != '半成品' and e.part_type != '产成品'*/
+        /*e.part_type != '半成品' and e.part_type != '产成品'*/
         <trim prefix="WHERE" prefixOverrides="and |or">
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="askGoodsId != null and askGoodsId != ''">
             <if test="askGoodsId != null and askGoodsId != ''">
                 and b.ask_goods_code = #{askGoodsId}
                 and b.ask_goods_code = #{askGoodsId}
@@ -268,19 +333,19 @@
     <!-- 导出生产领料要货 -->
     <!-- 导出生产领料要货 -->
     <select id="getInviteExcel" resultType="java.util.LinkedHashMap">
     <select id="getInviteExcel" resultType="java.util.LinkedHashMap">
         SELECT
         SELECT
-            a.ask_goods_id,
-            a.material_id,
-            a.num,
-            IFNULL( a.out_num, 0 ) AS out_num,
-            e.NAME AS materialName,
-            e.CODE AS materialCode,
-            b.ask_goods_code,
-            b.company_number
+        a.ask_goods_id,
+        a.material_id,
+        a.num,
+        IFNULL( a.out_num, 0 ) AS out_num,
+        e.NAME AS materialName,
+        e.CODE AS materialCode,
+        b.ask_goods_code,
+        b.company_number
         FROM
         FROM
-            tld_invite a
-            JOIN tld_invite_f b ON a.ask_goods_id = b.ask_goods_id
-            LEFT JOIN tld_department c ON b.department = c.code
-            JOIN tld_material e ON a.material_id = e.tld_id
+        tld_invite a
+        JOIN tld_invite_f b ON a.ask_goods_id = b.ask_goods_id
+        LEFT JOIN tld_department c ON b.department = c.code
+        JOIN tld_material e ON a.material_id = e.tld_id
         WHERE e.part_type != '半成品' and e.part_type != '产成品'
         WHERE e.part_type != '半成品' and e.part_type != '产成品'
         <if test="askGoodsId != null and askGoodsId != ''">
         <if test="askGoodsId != null and askGoodsId != ''">
             and a.ask_goods_id = #{askGoodsId}
             and a.ask_goods_id = #{askGoodsId}
@@ -301,17 +366,17 @@
     <!-- 查询销售单 -->
     <!-- 查询销售单 -->
     <select id="getDelivery" resultType="com.tld.model.Delivery">
     <select id="getDelivery" resultType="com.tld.model.Delivery">
         select
         select
-            a.id,
-            a.delivery_id,
-            a.material_id,
-            a.wbs,
-            a.gs_delivery_num,
-            a.gs_cancel_num,
-            ifnull(a.out_num, 0) as out_num,
-            b.company_number,
-            b.bills_time,
-            c.name as materialName,
-            c.code as materialCode
+        a.id,
+        a.delivery_id,
+        a.material_id,
+        a.wbs,
+        a.gs_delivery_num,
+        a.gs_cancel_num,
+        ifnull(a.out_num, 0) as out_num,
+        b.company_number,
+        b.bills_time,
+        c.name as materialName,
+        c.code as materialCode
         from tld_delivery a
         from tld_delivery a
         join tld_delivery_f b on a.delivery_id = b.delivery_id
         join tld_delivery_f b on a.delivery_id = b.delivery_id
         join tld_material c on a.material_id = c.tld_id
         join tld_material c on a.material_id = c.tld_id
@@ -336,16 +401,16 @@
     <!-- 导出销售单 -->
     <!-- 导出销售单 -->
     <select id="getDeliveryExcel" resultType="java.util.LinkedHashMap">
     <select id="getDeliveryExcel" resultType="java.util.LinkedHashMap">
         select
         select
-            a.delivery_id,
-            a.material_id,
-            a.wbs,
-            a.gs_delivery_num,
-            a.gs_cancel_num,
-            a.out_num,
-            b.company_number,
-            b.bills_time,
-            c.name as materialName,
-            c.code as materialCode
+        a.delivery_id,
+        a.material_id,
+        a.wbs,
+        a.gs_delivery_num,
+        a.gs_cancel_num,
+        a.out_num,
+        b.company_number,
+        b.bills_time,
+        c.name as materialName,
+        c.code as materialCode
         from tld_delivery a
         from tld_delivery a
         join tld_delivery_f b on a.delivery_id = b.delivery_id
         join tld_delivery_f b on a.delivery_id = b.delivery_id
         join tld_material c on a.material_id = c.tld_id
         join tld_material c on a.material_id = c.tld_id
@@ -370,28 +435,30 @@
     <!-- 查询移库单 -->
     <!-- 查询移库单 -->
     <select id="getWarehouseTransfer" resultType="com.tld.model.WarehouseTransfer">
     <select id="getWarehouseTransfer" resultType="com.tld.model.WarehouseTransfer">
         select
         select
-            a.id,
-            a.warehouse_transfer_id,
-            a.entry_number,
-            a.supply_warehouse_id,
-            a.material_id,
-            a.wbs,
-            a.num,
-            a.out_num,
-            a.type,
-            b.warehouse_transfer_code,
-            b.ask_goods_warehouse_id,
-            b.document_time,
-            b.warehouse_transfer_type,
-            c.name as materialName,
-            c.code as materialCode,
-            f.name as askGoodsWarehouseName,
-            e.name as supplyWarehouseName
+        a.id,
+        a.warehouse_transfer_id,
+        a.entry_number,
+        a.supply_warehouse_id,
+        a.material_id,
+        a.wbs,
+        a.num,
+        a.out_num,
+        a.type,
+        b.warehouse_transfer_code,
+        b.ask_goods_warehouse_id,
+        b.document_time,
+        b.warehouse_transfer_type,
+        c.name as materialName,
+        c.code as materialCode,
+        f.name as askGoodsWarehouseName,
+        e.name as supplyWarehouseName,
+        k.name as companyName
         from tld_warehouse_transfer a
         from tld_warehouse_transfer a
         join tld_warehouse_transfer_f b on a.warehouse_transfer_id = b.warehouse_transfer_id
         join tld_warehouse_transfer_f b on a.warehouse_transfer_id = b.warehouse_transfer_id
         join tld_material c on a.material_id = c.tld_id
         join tld_material c on a.material_id = c.tld_id
         join tld_warehouse e on a.supply_warehouse_id = e.tld_id
         join tld_warehouse e on a.supply_warehouse_id = e.tld_id
         join tld_warehouse f on b.ask_goods_warehouse_id = f.tld_id
         join tld_warehouse f on b.ask_goods_warehouse_id = f.tld_id
+        join tld_company k on a.account_sleeve = k.code
         <trim prefix="WHERE" prefixOverrides="and |or">
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="type != null and type != ''">
             <if test="type != null and type != ''">
                 and a.type = #{type}
                 and a.type = #{type}
@@ -403,38 +470,48 @@
                 and c.name like CONCAT(CONCAT('%', #{materialName}), '%')
                 and c.name like CONCAT(CONCAT('%', #{materialName}), '%')
             </if>
             </if>
             <if test="warehouseTransferCode != null and warehouseTransferCode != ''">
             <if test="warehouseTransferCode != null and warehouseTransferCode != ''">
-                and b.warehouse_transfer_code like CONCAT(CONCAT('%', #{warehouseTransferCode}), '%')
+                and b.warehouse_transfer_code like CONCAT(CONCAT('%',#{warehouseTransferCode}),'%')
             </if>
             </if>
             <if test="startTime != null and startTime != ''">
             <if test="startTime != null and startTime != ''">
-                and a.document_time <![CDATA[>=]]> #{startTime}
+                and b.document_time <![CDATA[>=]]> #{startTime}
             </if>
             </if>
             <if test="endTime != null and endTime != ''">
             <if test="endTime != null and endTime != ''">
-                and a.document_time <![CDATA[<=]]> #{endTime}
+                and b.document_time <![CDATA[<=]]> #{endTime}
+            </if>
+            <if test="askGoodsWarehouseId != null and askGoodsWarehouseId != ''">
+                and b.ask_goods_warehouse_id = #{askGoodsWarehouseId}
+            </if>
+            <if test="supplyWarehouseId != null and supplyWarehouseId != ''">
+                and a.supply_warehouse_id = #{supplyWarehouseId}
+            </if>
+            <if test="warehouseTransferType != null and warehouseTransferType != ''">
+                and b.warehouse_transfer_type like CONCAT(CONCAT('%', #{warehouseTransferType}), '%')
+            </if>
+            <if test="companyCode != null and companyCode != ''">
+                and a.account_sleeve = #{companyCode}
+            </if>
+            <if test="entryNumber != null and entryNumber != ''">
+                and a.entry_number like CONCAT(CONCAT('%', #{entryNumber}), '%')
+            </if>
+            <if test="wbs != null and wbs != ''">
+                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
             </if>
         </trim>
         </trim>
+        order by a.id desc
     </select>
     </select>
     <!-- 移库单导出 -->
     <!-- 移库单导出 -->
     <select id="getWarehouseTransferExcel" resultType="java.util.LinkedHashMap">
     <select id="getWarehouseTransferExcel" resultType="java.util.LinkedHashMap">
         select
         select
-            a.warehouse_transfer_id,
-            b.warehouse_transfer_code,
-            a.material_id,
-            c.name as materialName,
-            c.code as materialCode,
-            a.wbs,
-            a.num,
-            a.out_num,
-            b.ask_goods_warehouse_id,
-            a.supply_warehouse_id,
-            f.name as askGoodsWarehouseaName,
-            e.name as supplyWarehouseName,
-            b.document_time,
-            case
-            when a.type = '0' then
-            '未移库'
-            when a.type = '1' then
-            '已移库'
-            end as type
+        a.warehouse_transfer_id,
+        b.warehouse_transfer_code,
+        c.name as materialName,
+        c.code as materialCode,
+        a.wbs,
+        a.num,
+        a.out_num,
+        f.name as askGoodsWarehouseaName,
+        e.name as supplyWarehouseName,
+        b.document_time
         from tld_warehouse_transfer a
         from tld_warehouse_transfer a
         join tld_warehouse_transfer_f b on a.warehouse_transfer_id = b.warehouse_transfer_id
         join tld_warehouse_transfer_f b on a.warehouse_transfer_id = b.warehouse_transfer_id
         join tld_material c on a.material_id = c.tld_id
         join tld_material c on a.material_id = c.tld_id
@@ -450,13 +527,35 @@
             <if test="materialName != null and materialName != ''">
             <if test="materialName != null and materialName != ''">
                 and c.name like CONCAT(CONCAT('%', #{materialName}), '%')
                 and c.name like CONCAT(CONCAT('%', #{materialName}), '%')
             </if>
             </if>
+            <if test="warehouseTransferCode != null and warehouseTransferCode != ''">
+                and b.warehouse_transfer_code like CONCAT(CONCAT('%',#{warehouseTransferCode}),'%')
+            </if>
             <if test="startTime != null and startTime != ''">
             <if test="startTime != null and startTime != ''">
-                and a.document_time <![CDATA[>=]]> #{startTime}
+                and b.document_time <![CDATA[>=]]> #{startTime}
             </if>
             </if>
             <if test="endTime != null and endTime != ''">
             <if test="endTime != null and endTime != ''">
-                and a.document_time <![CDATA[<=]]> #{endTime}
+                and b.document_time <![CDATA[<=]]> #{endTime}
+            </if>
+            <if test="askGoodsWarehouseId != null and askGoodsWarehouseId != ''">
+                and b.ask_goods_warehouse_id = #{askGoodsWarehouseId}
+            </if>
+            <if test="supplyWarehouseId != null and supplyWarehouseId != ''">
+                and a.supply_warehouse_id = #{supplyWarehouseId}
+            </if>
+            <if test="warehouseTransferType != null and warehouseTransferType != ''">
+                and b.warehouse_transfer_type like CONCAT(CONCAT('%', #{warehouseTransferType}), '%')
+            </if>
+            <if test="companyCode != null and companyCode != ''">
+                and a.account_sleeve = #{companyCode}
+            </if>
+            <if test="entryNumber != null and entryNumber != ''">
+                and a.entry_number like CONCAT(CONCAT('%', #{entryNumber}), '%')
+            </if>
+            <if test="wbs != null and wbs != ''">
+                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
             </if>
         </trim>
         </trim>
+        order by a.id desc
     </select>
     </select>
     <!-- 查询日志信息 -->
     <!-- 查询日志信息 -->
     <select id="getLogData" resultType="com.tld.model.LogData">
     <select id="getLogData" resultType="com.tld.model.LogData">
@@ -487,5 +586,94 @@
         </trim>
         </trim>
         ORDER BY a.scrq DESC
         ORDER BY a.scrq DESC
     </select>
     </select>
+    <!--呆滞品导出-->
+    <select id="dullGoodsExport" resultType="java.util.LinkedHashMap">
+        SELECT
+        b.code as wllbCode,
+        b.name as materialName,
+        c.storage_location_name as storageLocationName,
+        f.name as companyName,
+        e.name as ustomerName,
+        a.wbs as wbs,
+        a.amount as amount,
+        a.scrq as scrq
+        FROM tld_inventory a
+        JOIN tld_material b ON a.material_id = b.tld_id
+        LEFT JOIN tld_storage_location c ON a.storage_location_code = c.storage_location_code
+        LEFT JOIN tld_customer e ON a.supplier_id = e.code
+        LEFT JOIN tld_company f ON a.account_sleeve = f.code
+        WHERE datediff(now(), a.scrq) <![CDATA[>]]> 90
+        <if test="storageLocationCode != null and storageLocationCode != ''">
+            and a.storage_location_code = #{storageLocationCode}
+        </if>
+        <if test="materialName != null and materialName != ''">
+            and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
+        </if>
+        <if test="wllbCode != null and wllbCode != ''">
+            and b.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
+        </if>
+        <if test="wbs != null and wbs != ''">
+            and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+        </if>
+        <if test="storageLocationName != null and storageLocationName != ''">
+            and c.storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
+        </if>
+        <if test="ustomerCode != null and ustomerCode != ''">
+            and a.supplier_id = #{ustomerCode}
+        </if>
+        <if test="companyCode != null and companyCode != ''">
+            and a.account_sleeve = #{companyCode}
+        </if>
+    </select>
+    <!--查询物料储量预警查询-->
+    <select id="reserveWarnings" resultType="java.util.Map">
+        SELECT
+        a.NAME as materialName,
+        a.CODE as wllbCode,
+        ifnull(b.sum,0) AS amount,
+        ifnull(a.max_num,'0') AS maxNum,
+        ifnull(a.min_num,'0') AS minNum
+        FROM
+        tld_material a
+        LEFT JOIN ( SELECT SUM( amount ) AS sum, material_id FROM tld_inventory GROUP BY material_id ) b ON a.tld_id =
+        b.material_id
+        WHERE
+        (
+        IF(a.max_num IS NULL,FALSE,IF( b.sum IS NULL, 0, b.sum + 0 ) <![CDATA[>]]> a.max_num)
+        OR
+        IF(a.min_num IS NULL,FALSE,IF( b.sum IS NULL, 0, b.sum + 0 ) <![CDATA[<]]> a.min_num)
+        )
+        <if test="materialName != null and materialName != ''">
+            and a.name like CONCAT(CONCAT('%', #{materialName}), '%')
+        </if>
+        <if test="wllbCode != null and wllbCode != ''">
+            and a.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
+        </if>
+    </select>
+    <!--查询物料储量预警查询导出-->
+    <select id="reserveWarningsExport" resultType="java.util.LinkedHashMap">
+        SELECT
+        a.CODE as wllbCode,
+        a.NAME as materialName,
+        ifnull(b.sum,0) AS amount,
+        ifnull(a.max_num,'0') AS maxNum,
+        ifnull(a.min_num,'0') AS minNum
+        FROM
+        tld_material a
+        LEFT JOIN ( SELECT SUM( amount ) AS sum, material_id FROM tld_inventory GROUP BY material_id ) b ON a.tld_id =
+        b.material_id
+        WHERE
+        (
+        IF(a.max_num IS NULL,FALSE,IF( b.sum IS NULL, 0, b.sum + 0 ) <![CDATA[>]]> a.max_num)
+        OR
+        IF(a.min_num IS NULL,FALSE,IF( b.sum IS NULL, 0, b.sum + 0 ) <![CDATA[<]]> a.min_num)
+        )
+        <if test="materialName != null and materialName != ''">
+            and a.name like CONCAT(CONCAT('%', #{materialName}), '%')
+        </if>
+        <if test="wllbCode != null and wllbCode != ''">
+            and a.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
+        </if>
+    </select>
 
 
 </mapper>
 </mapper>

+ 81 - 16
src/main/resources/mapper/ReceiveGoodsMapper.xml

@@ -5,25 +5,39 @@
     <!-- 查询收货单 -->
     <!-- 查询收货单 -->
     <select id="getReceiveGoods" resultType="com.tld.model.ReceiveGoods">
     <select id="getReceiveGoods" resultType="com.tld.model.ReceiveGoods">
         select
         select
-            a.id,
-            a.order_code,
-            b.name as materialName,
-            c.name as supplierName,
-            a.purchase_num,
-            a.arrival_num,
-            a.type,
-            a.qualified_num,
-            a.disqualification_num,
-            a.arrival_time,
-            c.code as wllbCode,
-            a.wbs
+        a.id,
+        a.order_code,
+        b.name as materialName,
+        c.name as supplierName,
+        a.purchase_num,
+        a.arrival_num,
+        a.type,
+        a.qualified_num,
+        a.disqualification_num,
+        a.arrival_time,
+        b.code as wllbCode,
+        a.wbs,
+        e.company_number as companyNumber,
+        e.supplier_id as supplierId,
+        p.name as compName
         from tld_receive_goods a
         from tld_receive_goods a
         left join tld_material b on a.material_id = b.tld_id
         left join tld_material b on a.material_id = b.tld_id
         left join tld_customer c on a.supplier_id = c.code
         left join tld_customer c on a.supplier_id = c.code
+        left join tld_receive_goods_f e on a.order_code = e.order_code
+        left join tld_company p on e.company_number = p.code
         <trim prefix="WHERE" prefixOverrides="and |or">
         <trim prefix="WHERE" prefixOverrides="and |or">
-            <!--            <if test="materialId != null and materialId != ''">-->
-            <!--                and a.material_id = #{materialId}-->
-            <!--            </if>-->
+            <if test="materialId != null and materialId != ''">
+                and a.material_id like CONCAT(CONCAT('%',#{materialId},'%'))
+            </if>
+            <if test="supplierId != null and supplierId != ''">
+                and a.supplier_id = #{supplierId}
+            </if>
+            <if test="companyNumber != null and companyNumber != ''">
+                and e.company_number = #{companyNumber}
+            </if>
+            <if test="materialName != null and materialName != ''">
+                and b.name like CONCAT(CONCAT('%',#{materialName},'%'))
+            </if>
             <if test="type != null and type != ''">
             <if test="type != null and type != ''">
                 and a.type = #{type}
                 and a.type = #{type}
             </if>
             </if>
@@ -34,7 +48,10 @@
                 and a.arrival_time <![CDATA[<=]]> #{endTime}
                 and a.arrival_time <![CDATA[<=]]> #{endTime}
             </if>
             </if>
             <if test="orderCode != null and orderCode != ''">
             <if test="orderCode != null and orderCode != ''">
-                and a.order_code = #{orderCode}
+                and a.order_code like CONCAT(CONCAT('%',#{orderCode},'%'))
+            </if>
+            <if test="wbs != null and wbs != ''">
+                and a.wbs like CONCAT(CONCAT('%',#{wbs},'%'))
             </if>
             </if>
         </trim>
         </trim>
         order by a.id desc
         order by a.id desc
@@ -302,6 +319,54 @@
         </if>
         </if>
         order by a.id desc
         order by a.id desc
     </select>
     </select>
+    <!--查询采购单1导出-->
+    <select id="purchasesExport" resultType="java.util.LinkedHashMap">
+        select
+        a.order_code,
+        b.name as materialName,
+        b.code as wllbCode,
+        a.wbs,
+        c.name as supplierName,
+        a.purchase_num,
+        a.arrival_num,
+        a.qualified_num,
+        a.disqualification_num
+        from tld_receive_goods a
+        left join tld_material b on a.material_id = b.tld_id
+        left join tld_customer c on a.supplier_id = c.code
+        left join tld_receive_goods_f e on a.order_code = e.order_code
+        left join tld_company p on e.company_number = p.code
+        <trim prefix="WHERE" prefixOverrides="and |or">
+            <if test="materialId != null and materialId != ''">
+                and a.material_id like CONCAT(CONCAT('%',#{materialId},'%'))
+            </if>
+            <if test="supplierId != null and supplierId != ''">
+                and a.supplier_id = #{supplierId}
+            </if>
+            <if test="companyNumber != null and companyNumber != ''">
+                and e.company_number = #{companyNumber}
+            </if>
+            <if test="materialName != null and materialName != ''">
+                and b.name like CONCAT(CONCAT('%',#{materialName},'%'))
+            </if>
+            <if test="type != null and type != ''">
+                and a.type = #{type}
+            </if>
+            <if test="startTime != null and startTime != ''">
+                and a.arrival_time <![CDATA[>=]]> #{startTime}
+            </if>
+            <if test="endTime != null and endTime != ''">
+                and a.arrival_time <![CDATA[<=]]> #{endTime}
+            </if>
+            <if test="orderCode != null and orderCode != ''">
+                and a.order_code like CONCAT(CONCAT('%',#{orderCode},'%'))
+            </if>
+            <if test="wbs != null and wbs != ''">
+                and a.wbs like CONCAT(CONCAT('%',#{wbs},'%'))
+            </if>
+        </trim>
+        order by a.id desc
+    </select>
     <!-- 删除原始记录 -->
     <!-- 删除原始记录 -->
     <delete id="delReceiveGoods">
     <delete id="delReceiveGoods">
         delete
         delete

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

@@ -75,7 +75,7 @@
                 and a.id = #{id}
                 and a.id = #{id}
             </if>
             </if>
         </trim>
         </trim>
-        order by id desc
+        order by a.id desc
     </select>
     </select>
     <!-- 新增用户 -->
     <!-- 新增用户 -->
     <insert id="addUser">
     <insert id="addUser">

File diff suppressed because it is too large
+ 602 - 380
src/main/resources/mapper/WarehousingMapper.xml