浏览代码

问题修改

xiaochen 2 年之前
父节点
当前提交
1b409e7e6f

+ 47 - 6
src/main/java/com/tld/controller/InventoryController.java

@@ -7,11 +7,12 @@ import com.tld.service.InventoryService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.util.Map;
 
 /**
- * 盘点
+ * 盘点库存信息
  */
 @RestController
 @RequestMapping("inventory")
@@ -20,19 +21,28 @@ public class InventoryController {
     @Autowired
     private InventoryService inventoryService;
 
+    /**
+     * 查询盘点主表
+     * @param makeInventory 参数
+     * @return 返回结果
+     */
+    @GetMapping("getInventoryDataList")
+    public Map<String, Object> getInventoryDataList( MakeInventory makeInventory){
+        return inventoryService.getInventoryDataList(makeInventory);
+    }
 
     /**
-     * 查询盘点信息
+     * 添加盘点主表
      * @param makeInventory 参数
      * @return 返回结果
      */
-    @GetMapping("getInventoryList")
-    public Map<String, Object> getInventoryList(MakeInventory makeInventory){
-        return inventoryService.getInventoryList(makeInventory);
+    @PostMapping("addInventoryPlate")
+    public Map<String, Object> addInventoryPlate(@RequestBody MakeInventory makeInventory, HttpServletRequest request){
+        return inventoryService.addInventoryPlate(makeInventory,request);
     }
 
     /**
-     * 添加盘点信息
+     * 录入盘点信息
      * @param makeInventory 参数
      * @return 返回结果
      */
@@ -41,6 +51,37 @@ public class InventoryController {
         return inventoryService.addInventory(makeInventory);
     }
 
+    /**
+     * 查询录入盘点信息
+     * @param makeInventory 参数
+     * @return 返回结果
+     */
+    @GetMapping("getInventory")
+    public Map<String, Object> getInventory(MakeInventory makeInventory){
+        return inventoryService.getInventory(makeInventory);
+    }
+
+    /**
+     * 生成盘点信息(盘点子表信息)
+     * @param makeInventory 参数
+     * @return 返回结果
+     */
+    @GetMapping("getInventoryPlate")
+    public Map<String, Object> getInventoryPlate(MakeInventory makeInventory){
+        return inventoryService.getInventoryPlate(makeInventory);
+    }
+
+    /**
+     * 查询z盘点信息(盘点子表信息)
+     * @param makeInventory 参数
+     * @return 返回结果
+     */
+    @GetMapping("getInventoryPlates")
+    public Map<String, Object> getInventoryPlates(MakeInventory makeInventory){
+        return inventoryService.getInventoryPlates(makeInventory);
+    }
+
+
     /**
      * 导出盘点信息
      * @param makeInventory 参数

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

@@ -1,5 +1,6 @@
 package com.tld.controller;
 
+import com.tld.model.Warehouse;
 import com.tld.service.MaintenanceService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -34,4 +35,14 @@ public class MaintenanceController {
     public Map<String, Object> updateMaintenance(Map<String, Object> map){
         return maintenanceService.updateMaintenance(map);
     }
+
+    /**
+     * 修改仓库类型
+     * @param warehouse 参数
+     * @return 返回结果
+     */
+    @PutMapping("updateWarehouse")
+    public Map<String, Object> updateWarehouse( @RequestBody Warehouse warehouse){
+        return maintenanceService.updateWarehouse(warehouse);
+    }
 }

+ 6 - 0
src/main/java/com/tld/mapper/DictionaryMapper.java

@@ -2,6 +2,7 @@ package com.tld.mapper;
 
 import com.tld.model.*;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 import java.util.Map;
@@ -39,4 +40,9 @@ public interface DictionaryMapper {
     void addAccess(Access access);
 
     void addLogdata(LogData logData);
+
+    Dictionary getTableNameList(Dictionary dictionary);
+
+    void addStorageLocation(@Param("storageLocationCode") String storageLocationCode, @Param("warehouseWhere") String warehouseWhere, @Param("storageLocationName") String storageLocationName);
+
 }

+ 21 - 2
src/main/java/com/tld/mapper/InventoryMapper.java

@@ -3,16 +3,35 @@ package com.tld.mapper;
 import com.tld.model.MakeInventory;
 import org.apache.ibatis.annotations.Mapper;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 import java.util.Map;
 
 @Mapper
 public interface InventoryMapper {
-    List<MakeInventory> getInventoryList(MakeInventory makeInventory);
 
     void addInventory(MakeInventory makeInventory);
 
     List<Map<String,Object>> export(MakeInventory makeInventory);
 
-    void addInventoryLogging(MakeInventory makeInventory);
+
+    List<MakeInventory> getInventory(MakeInventory makeInventory);
+
+    void addInventoryPlate(MakeInventory makeInventory);
+
+    void updateInventoryPlate(MakeInventory makeInventory);
+
+    List<MakeInventory> getInventoryDataList(MakeInventory makeInventory);
+
+    MakeInventory getInventoryRepetition(MakeInventory makeInventory);
+
+    void delInventoryRepetition(MakeInventory makeInventory1);
+
+    List<MakeInventory> getInventoryPlate(MakeInventory makeInventory);
+
+    MakeInventory getInventoryPlates(MakeInventory inventory);
+
+    void addInventoryPlates(MakeInventory inventory);
+
+    List<MakeInventory> getInventoryPlatesList(MakeInventory makeInventory);
 }

+ 3 - 0
src/main/java/com/tld/mapper/MaintenanceMapper.java

@@ -1,5 +1,6 @@
 package com.tld.mapper;
 
+import com.tld.model.Warehouse;
 import org.apache.ibatis.annotations.Mapper;
 import java.util.List;
 import java.util.Map;
@@ -10,4 +11,6 @@ public interface MaintenanceMapper {
 
     void updateMaterial(Map<String, Object> map);
 
+    void updateWarehouse(Warehouse warehouse);
+
 }

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

@@ -111,4 +111,8 @@ public class Dictionary  implements Serializable {
      * 公司编号
      */
     private String companyNumber;
+    /**
+     * 仓库类型
+     */
+    private String warehouseType;
 }

+ 1 - 0
src/main/java/com/tld/model/Error.java

@@ -10,6 +10,7 @@ import java.io.Serializable;
  */
 @Data
 @Accessors(chain = true)
+@SuppressWarnings("serial")
 public class Error implements Serializable {
     /**
      * 主键

+ 38 - 38
src/main/java/com/tld/model/MakeInventory.java

@@ -6,7 +6,7 @@ import lombok.experimental.Accessors;
 import java.io.Serializable;
 
 /**
- * 盘点/库存表信息
+ * 录入盘点/库存表信息
  */
 @Data
 @Accessors(chain = true)
@@ -20,45 +20,45 @@ public class MakeInventory implements Serializable {
      */
     private String storageLocationCode;
     /**
-     * 物料分类
+     * 实际数量
      */
-    private String wllbClass;
+    private String amount;
     /**
-     * 库位类别
+     * gs实际数量
      */
-    private String libraryType;
+    private String gsAmount;
     /**
-     * 物料id
+     * 录入实际数量
      */
-    private String materialId;
+    private String plateAmount;
     /**
-     * 实际数量
+     * 物料名称
      */
-    private String amount;
+    private String name;
     /**
      * 占用数量
      */
     private String total;
     /**
-     * 占用时间
+     * 物料编号
      */
-    private String totime;
+    private String wllbCode;
     /**
-     * 物料状态 0开放1锁定
+     * 物料id
      */
-    private String hold;
+    private String materialId;
     /**
-     * 数量锁定
+     * 录入时间/操作时间
      */
-    private String amountLock;
+    private String scrq;
     /**
-     * 所属公司
+     * 盘点主表id
      */
-    private String accountSleeve;
+    private String plateId;
     /**
-     * wbs
+     * 所属公司
      */
-    private String wbs;
+    private String accountSleeve;
     /**
      * 供应商id
      */
@@ -68,46 +68,46 @@ public class MakeInventory implements Serializable {
      */
     private String serial;
     /**
-     * 物料编号
+     * 属性
      */
-    private String wllbCode;
+    private String attribute;
     /**
-     * 生产日期
+     * uuid
      */
-    private String producDate;
+    private String uuid;
     /**
-     * 入库时间
+     * 标题
      */
-    private String scrq;
+    private String title;
     /**
      * 生产批次
      */
     private String producBatch;
     /**
-     * 属性
+     * 物料编号查询条件
      */
-    private String attribute;
+    private String wllbCodes;
     /**
-     * 物料名称
+     * 库位编号查询条件
      */
-    private String name;
-
+    private String storageLocationCodes;
     /**
-     * gsid
+     * 所属公司查询条件
      */
-    private String gsId;
+    private String accountSleeves;
     /**
-     * gs物料id
+     * 开始时间
      */
-    private String gsMaterialId;
+    private String startTime;
     /**
-     * gs实际数量
+     * 结束时间
      */
-    private String gsAmount;
+    private String endTime;
     /**
-     * gs所属公司
+     * 操作人
      */
-    private String gsAccountSleeve;
+    private String userId;
+
     /**
      * 页数
      */

+ 49 - 0
src/main/java/com/tld/model/Warehouse.java

@@ -0,0 +1,49 @@
+package com.tld.model;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+
+/**
+ * 仓库信息
+ */
+@Data
+@Accessors(chain = true)
+@SuppressWarnings("serial")
+public class Warehouse implements Serializable {
+    /**
+     * 主键
+     */
+    private String id;
+    /**
+     * code
+     */
+    private String code;
+    /**
+     * name
+     */
+    private String name;
+    /**
+     * tld_id
+     */
+    private String tldId;
+    /**
+     * 0接入1自主新增
+     */
+    private String type;
+    /**
+     * 仓库类型
+     */
+    private String warehouseType;
+    /**
+     * 页数
+     */
+    private int page;
+    /**
+     * 条数
+     */
+    private int limit;
+
+}

+ 10 - 2
src/main/java/com/tld/service/InventoryService.java

@@ -2,15 +2,23 @@ package com.tld.service;
 
 import com.tld.model.MakeInventory;
 
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.util.Map;
 
 public interface InventoryService {
 
-    Map<String, Object> getInventoryList(MakeInventory makeInventory);
-
     Map<String, Object> addInventory(MakeInventory makeInventory);
 
     void export(MakeInventory makeInventory, HttpServletResponse response);
 
+    Map<String, Object> getInventory(MakeInventory makeInventory);
+
+    Map<String, Object> addInventoryPlate(MakeInventory makeInventory, HttpServletRequest request);
+
+    Map<String, Object> getInventoryPlate(MakeInventory makeInventory);
+
+    Map<String, Object> getInventoryDataList(MakeInventory makeInventory);
+
+    Map<String, Object> getInventoryPlates(MakeInventory makeInventory);
 }

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

@@ -1,9 +1,13 @@
 package com.tld.service;
 
+import com.tld.model.Warehouse;
+
 import java.util.Map;
 
 public interface MaintenanceService {
     Map<String, Object> getMaintenance(Map<String, Object> map);
 
     Map<String, Object> updateMaintenance(Map<String, Object> map);
+    Map<String, Object> updateWarehouse(Warehouse warehouse);
+
 }

+ 28 - 13
src/main/java/com/tld/service/impl/DictionaryServiceImpl.java

@@ -10,18 +10,18 @@ import com.tld.model.Goods;
 import com.tld.model.LogData;
 import com.tld.service.DictionaryService;
 import com.tld.util.RedisUtil;
+import com.tld.util.SnowflakeUtil;
 import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.tld.model.Dictionary;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.concurrent.TimeUnit;
 
 @Service
@@ -32,6 +32,9 @@ public class DictionaryServiceImpl implements DictionaryService {
     @Autowired
     private RedisUtil redisUtil;
 
+    //雪花算法
+    private SnowflakeUtil snowflakeUtil = new SnowflakeUtil(1, 1, 1);
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Map<String, Object> addDictionary(List<Dictionary> dictionarys) {
@@ -51,22 +54,34 @@ public class DictionaryServiceImpl implements DictionaryService {
                 }
                 dictionary.setTableName(tableName);
                 dictionary.setTypeVal("0");
-                if (dictionary.getType().equals("物料字典")) {
-                    dictionaryMapper.addMaterial(dictionary);
-                } else if (dictionary.getType().equals("库账对存")) {
-                    dictionaryMapper.addTreasuryAccount(dictionary);
-                } else {
-                    dictionaryMapper.addDictionary(dictionary);
+                //判断数据是否有重复的
+                Dictionary dictionary2 = dictionaryMapper.getTableNameList(dictionary);
+                if (dictionary2 == null) {
+                    if (dictionary.getType().equals("物料字典")) {
+                        dictionaryMapper.addMaterial(dictionary);
+                    } else if (dictionary.getType().equals("库账对存")) {
+                        dictionaryMapper.addTreasuryAccount(dictionary);
+                    }else if (dictionary.getType().equals("仓库")){
+                        //添加库位信息
+                        String storageLocationCode = "XN"+snowflakeUtil.nextId()+"" ; // XN+雪花算法
+                        String warehouseWhere = dictionary.getTldId();// tldId
+                        String storageLocationName = dictionary.getName()+"虚拟库位" ;// 仓库名称+虚拟库位
+                        dictionaryMapper.addStorageLocation(storageLocationCode,warehouseWhere,storageLocationName);
+                        dictionaryMapper.addDictionary(dictionary);
+                    } else {
+                        dictionaryMapper.addDictionary(dictionary);
+                    }
                 }
             }
             //新增日志
             Access access = new Access().setType("字典信息").setData(JSON.toJSONString(dictionarys)).setAccessType("0");
             dictionaryMapper.addAccess(access);
-            map.put("msg", "200");
+            map.put("status", "0000");
+            map.put("msg","成功");
         }  catch (Exception e){
             e.printStackTrace();
-            map.put("msg", "500");
-            map.put("errMsg", "失败");
+            map.put("status", "0009");
+            map.put("msg", "服务器请求异常,请稍后再试");
         }
         return map;
     }

+ 116 - 22
src/main/java/com/tld/service/impl/InventoryServiceImpl.java

@@ -6,9 +6,12 @@ import com.tld.excel.ExcelUtils;
 import com.tld.mapper.InventoryMapper;
 import com.tld.model.MakeInventory;
 import com.tld.service.InventoryService;
+import com.tld.util.SnowflakeUtil;
+import org.apache.poi.ss.formula.functions.Count;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -19,28 +22,9 @@ public class InventoryServiceImpl implements InventoryService {
     @Autowired
     private InventoryMapper inventoryMapper;
 
+    //雪花算法
+    private SnowflakeUtil snowflakeUtil = new SnowflakeUtil(1, 1, 1);
 
-    /**
-     * 盘点查询
-     * @return
-     */
-    @Override
-    public Map<String, Object> getInventoryList(MakeInventory makeInventory) {
-        Map<String, Object> map = new HashMap<>();
-        try {
-            //添加录入信息
-            inventoryMapper.addInventoryLogging(makeInventory);
-            PageHelper.startPage(makeInventory.getPage(),makeInventory.getLimit());
-            PageInfo<MakeInventory> list =  new PageInfo<>(inventoryMapper.getInventoryList(makeInventory));
-            map.put("data", list);
-            map.put("msg", "200");
-        }catch (Exception e){
-         e.printStackTrace();
-         map.put("msg", "500");
-         map.put("errMsg","服务器请求异常,请稍后再试");
-        }
-        return map ;
-    }
 
     /**
      * 添加盘点
@@ -50,6 +34,12 @@ public class InventoryServiceImpl implements InventoryService {
     public Map<String, Object> addInventory(MakeInventory makeInventory) {
         Map<String, Object> map = new HashMap<>();
         try {
+            //判断是否重复
+            MakeInventory makeInventory1 = inventoryMapper.getInventoryRepetition(makeInventory);
+            if (makeInventory1 != null){
+                //根据录入信息的主键id删除信息
+                inventoryMapper.delInventoryRepetition(makeInventory1);
+            }
             inventoryMapper.addInventory(makeInventory);
             map.put("msg", "200");
         }catch (Exception e){
@@ -71,7 +61,7 @@ public class InventoryServiceImpl implements InventoryService {
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
             List<Object> head =
-                    Arrays.asList("库位编号", "实际数量", "所属公司","物料编号","供应商id","生产批次","物料id");
+                    Arrays.asList("物料id", "物料编号", "物料名称","系统物料数量","gs物料数量","uuid","物料id");
             //查询数据
             PageHelper.startPage(makeInventory.getPage(), makeInventory.getLimit());
             PageInfo<Map<String, Object>> list = new PageInfo<>(inventoryMapper.export(makeInventory));
@@ -91,4 +81,108 @@ public class InventoryServiceImpl implements InventoryService {
             e.printStackTrace();
         }
     }
+
+    /**
+     * 查询录入盘点信息
+     * */
+    @Override
+    public Map<String, Object> getInventory(MakeInventory makeInventory) {
+        Map<String, Object> map = new HashMap<>();
+        try {
+            PageHelper.startPage(makeInventory.getPage(),makeInventory.getLimit());
+            PageInfo<MakeInventory> list =  new PageInfo<>(inventoryMapper.getInventory(makeInventory));
+            map.put("data", list);
+            map.put("msg", "200");
+        }catch (Exception e){
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg","服务器请求异常,请稍后再试");
+        }
+        return map ;
+    }
+
+    /**
+     * 添加盘点主表信息
+     */
+    @Override
+    public Map<String, Object> addInventoryPlate(MakeInventory makeInventory, HttpServletRequest request) {
+        Map<String, Object> map = new HashMap<>();
+        try {
+            makeInventory.setModifyUser(request.getHeader("userId"));
+            makeInventory.setUuid(snowflakeUtil.nextId()+"");
+            inventoryMapper.addInventoryPlate(makeInventory);
+            map.put("msg", "200");
+        } catch (Exception e) {
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg", "服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
+
+    /**
+     * 查询盘点子表信息
+     * */
+    @Override
+    public Map<String, Object> getInventoryPlate(MakeInventory makeInventory) {
+        Map<String, Object> map = new HashMap<>();
+        try {
+            //查询系统库存gs库存的数据
+            List<MakeInventory> list = inventoryMapper.getInventoryPlate(makeInventory);
+            for (MakeInventory inventory : list) {
+                inventory.setPlateId(makeInventory.getPlateId());
+                inventory.setUuid(makeInventory.getUuid());
+                MakeInventory makeInventory1 = inventoryMapper.getInventoryPlates(inventory);
+                if (makeInventory1 == null){
+                    //添加子表信息
+                    inventoryMapper.addInventoryPlates(inventory);
+                }
+            }
+            map.put("msg", "200");
+        }catch (Exception e){
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg","服务器请求异常,请稍后再试");
+        }
+        return map ;
+    }
+
+    /**
+     * 查询盘点主表
+     * */
+    @Override
+    public Map<String, Object> getInventoryDataList(MakeInventory makeInventory) {
+        Map<String, Object> map = new HashMap<>();
+        try {
+            PageHelper.startPage(makeInventory.getPage(),makeInventory.getLimit());
+            PageInfo<MakeInventory> list =  new PageInfo<>(inventoryMapper.getInventoryDataList(makeInventory));
+            map.put("data", list);
+            map.put("msg", "200");
+        }catch (Exception e){
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg","服务器请求异常,请稍后再试");
+        }
+        return map ;
+    }
+
+    /**
+     * 查询盘点z子表信息
+     * */
+    @Override
+    public Map<String, Object> getInventoryPlates(MakeInventory makeInventory) {
+        Map<String, Object> map = new HashMap<>();
+        try {
+            PageHelper.startPage(makeInventory.getPage(),makeInventory.getLimit());
+            PageInfo<MakeInventory> data =  new PageInfo<>(inventoryMapper.getInventoryPlatesList(makeInventory));
+            map.put("data", data);
+            map.put("msg", "200");
+        }catch (Exception e){
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg","服务器请求异常,请稍后再试");
+        }
+        return map ;
+    }
+
 }

+ 18 - 0
src/main/java/com/tld/service/impl/MaintenanceServiceImpl.java

@@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.tld.mapper.DictionaryMapper;
 import com.tld.mapper.MaintenanceMapper;
+import com.tld.model.Warehouse;
 import com.tld.service.MaintenanceService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -56,4 +57,21 @@ public class MaintenanceServiceImpl implements MaintenanceService {
         }
         return map1;
     }
+
+    /**
+     * 修改仓库内容
+     * */
+    @Override
+    public Map<String, Object> updateWarehouse(Warehouse warehouse) {
+        Map<String, Object> map = new HashMap<>();
+        try{
+            maintenanceMapper.updateWarehouse(warehouse);
+            map.put("msg", "200");
+        }catch (Exception e){
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg", "失败");
+        }
+        return map;
+    }
 }

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

@@ -93,7 +93,7 @@ public class RoleServiceImpl implements RoleService {
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
-            List<Object> head = Arrays.asList("角色编号", "角色名", "创建时间","备注");
+            List<Object> head = Arrays.asList("角色编号", "角色名", "创建时间","备注","修改时间","修改人");
             //查询数据
             List<Map<String, Object>> list = roleMapper.export(role);
             sheetDataList.add(head);

+ 7 - 7
src/main/java/com/tld/service/impl/UserServiceImpl.java

@@ -75,12 +75,12 @@ public class UserServiceImpl implements UserService {
         Map<String, Object> map = new HashMap<>();
         try{
             PageHelper.startPage(user.getPage(), user.getLimit());
-            List<User> list = new ArrayList<>();
-            for(User user1 : userMapper.getAllUser(user)) {
-                user1.setPassword(DesDecry.decrypt(user1.getPassword()));
-                list.add(user1);
-            }
-            PageInfo<User> pageInfo = new PageInfo<>(list);
+//            List<User> list = new ArrayList<>();
+//            for(User user1 : userMapper.getAllUser(user)) {
+//                user1.setPassword(DesDecry.decrypt(user1.getPassword()));
+//                list.add(user1);
+//            }
+            PageInfo<User> pageInfo = new PageInfo<>(userMapper.getAllUser(user));
             map.put("data", pageInfo);
             map.put("msg", "200");
         } catch (Exception e){
@@ -162,7 +162,7 @@ public class UserServiceImpl implements UserService {
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
-            List<Object> head = Arrays.asList("用户编号", "用户名", "真名","邮箱","电话", "手机", "部门", "角色", "创建时间");
+            List<Object> head = Arrays.asList("用户编号", "用户名", "真实姓名","邮箱","电话", "手机", "部门", "角色", "创建时间","修改时间","修改人");
             //查询数据
             PageHelper.startPage(1, 10);
             List<Map<String, Object>> list = userMapper.getUserExportData(user);

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

@@ -9,7 +9,7 @@
     <!-- 物料字典新增 -->
     <insert id="addMaterial">
         insert into tld_material(code,name,tld_id,specification_and_model,unit_of_measurement,size,is_not_disable,is_recommend,min_num,max_num,type,company_number)
-        values(#{code},#{name},#{tldId},#{specificationAndModel},#{unitOfMeasurement},'0','0','0',"0","0",#{typeVal},#{companyNumber})
+        values(#{code},#{name},#{tldId},#{specificationAndModel},#{unitOfMeasurement},'0','0','0',"0","0",#{typeVal},'0')
     </insert>
     <!-- 字典新增 -->
     <insert id="addDictionary">
@@ -94,6 +94,10 @@
             </if>
         </trim>
     </select>
+    <!--判断是否是重复数据-->
+    <select id="getTableNameList" resultType="com.tld.model.Dictionary">
+        select * from ${tableName} where code = #{code}
+    </select>
     <!-- 修改物料字典内容 -->
     <update id="updateMaterial">
         update tld_material
@@ -193,4 +197,8 @@
     <insert id="addLogdata">
         insert into tld_log_data(user_id,scrq,data,type,document_type) value(#{userId},now(),#{data},#{type},#{documentType})
     </insert>
+    <!-- 增加仓库的时候新增库位信息-->
+    <insert id="addStorageLocation">
+        insert into tld_storage_location(storage_location_code,storage_location_name,warehouse_where) value(#{storageLocationCode},#{storageLocationName},#{warehouseWhere})
+    </insert>
 </mapper>

+ 207 - 49
src/main/resources/mapper/InventoryMapper.xml

@@ -2,70 +2,228 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.tld.mapper.InventoryMapper">
-    <!--添加盘点-->
+    <!--录入盘点-->
     <insert id="addInventory">
-        insert into tld_inventory(storage_location_code,wllb_class,library_type,material_id,amount,total,totime,hold,amount_lock,account_sleeve,wbs,supplier_id,serial,wllb_code,produc_date,scrq,produc_batch,attribute)
-        values (#{storageLocationCode},#{wllbClass},#{libraryType},#{materialId},#{amount},#{total},#{totime},#{hold},#{amountLock},#{accountSleeve},#{wbs},#{supplierId},#{serial},#{wllbCode},#{producDate},#{scrq},#{producBatch},#{attribute})
+        insert into tld_plate(storage_location_code, amount, total, wllb_code, scrq, material_id, plate_id,
+                              account_sleeve, supplier_id, serial, attribute, uuid)
+        values (#{storageLocationCode}, #{amount}, #{total}, #{wllbCode}, now(), #{materialId}, #{plateId},
+                #{accountSleeve}, #{supplierId}, #{serial}, #{attribute}, #{uuid})
     </insert>
-    <!--添加录入盘点信息-->
-    <insert id="addInventoryLogging">
-        insert into tld_inventory_logging(storage_location_code,wllb_class,library_type,material_id,amount,total,totime,hold,amount_lock,account_sleeve,wbs,supplier_id,serial,wllb_code,produc_date,scrq,produc_batch,attribute)
-        values (#{storageLocationCode},#{wllbClass},#{libraryType},#{materialId},#{amount},#{total},#{totime},#{hold},#{amountLock},#{accountSleeve},#{wbs},#{supplierId},#{serial},#{wllbCode},#{producDate},#{scrq},#{producBatch},#{attribute})
+    <!--添加盘点主表信息-->
+    <insert id="addInventoryPlate">
+        insert into tld_plate_f(user_id, scrq, uuid, title)
+        values (#{modifyUser}, now(), #{uuid}, #{title})
     </insert>
-    <!--查询盘点-->
-    <select id="getInventoryList" resultType="com.tld.model.MakeInventory">
-        SELECT
-        a.storage_location_code,
-        a.amount,
-        a.account_sleeve,
-        a.wllb_code,
-        a.supplier_id,
-        a.produc_batch,
-        a.material_id,
-        c.material_id AS gsMaterialId,
-        c.amount AS gsAmount,
-        c.account_sleeve AS gsaccountSleeve,
-        b.NAME
-        FROM
-        tld_inventory a
-        LEFT JOIN tld_material b ON a.wllb_code = b.CODE
-        LEFT JOIN tld_inventory_gs c ON a.material_id = c.material_id
+    <!--添加盘点子表信息-->
+    <insert id="addInventoryPlates">
+        insert into tld_plate_z(plate_id, material_id, wllb_code, name, amount, gs_amount)
+        values (#{plateId}, #{materialId}, #{wllbCode}, #{name}, #{amount}, #{gsAmount})
+    </insert>
+    <!--修改录入信息为主表id为空的添加主表uuid进行关联-->
+    <update id="updateInventoryPlate">
+        update tld_plate
+        set plate_id = #{uuid}
+        where scrq like CONCAT(CONCAT('%', #{scrq}), '%')
+          and (plate_id is null or plate_id = '')
+    </update>
+    <!--删除重复录入的信息-->
+    <delete id="delInventoryRepetition">
+        delete
+        from tld_plate
+        where id = #{id}
+    </delete>
+    <!--导出盘点数据-->
+    <select id="export" resultType="java.util.LinkedHashMap">
+        SELECT storage_location_code,
+               amount,
+               account_sleeve,
+               wllb_code,
+               supplier_id,
+               produc_batch,
+               material_id
+        FROM tld_inventory
+    </select>
+    <!--查询录入盘点信息-->
+    <select id="getInventory" resultType="com.tld.model.MakeInventory">
+        select
+        id,
+        storage_location_code,
+        amount,
+        total,
+        wllb_code,
+        scrq,
+        material_id,
+        plate_id,
+        account_sleeve,
+        supplier_id,
+        serial,
+        attribute,
+        uuid
+        from tld_plate
         <trim prefix="WHERE" prefixOverrides="and |or">
-            <if test="storageLocationCode != null and storageLocationCode != ''">
-                and a.storage_location_code = #{storageLocationCode}
+            <if test="wllbCodes != null and wllbCodes != ''">
+                and wllb_code = #{wllbCodes}
+            </if>
+            <if test="materialId != null and materialId != ''">
+                and material_id = #{materialId}
+            </if>
+            <if test="amount != null and amount != ''">
+                and amount = #{amount}
             </if>
-            <if test="wllbClass != null and wllbClass != ''">
-                and a.wllb_class = #{wllbClass}
+            <if test="total != null and total != ''">
+                and total = #{total}
+            </if>
+            <if test="storageLocationCodes != null and storageLocationCodes != ''">
+                and storage_location_code = #{storageLocationCodes}
+            </if>
+            <if test="plateId != null and plateId != ''">
+                and plate_id = #{plateId}
             </if>
             <if test="accountSleeve != null and accountSleeve != ''">
-                and a.account_sleeve = #{accountSleeve}
+                and account_sleeve = #{accountSleeve}
             </if>
-            <if test="id != null and id != ''">
-                and a.id = #{id}
+            <if test="supplierId != null and supplierId != ''">
+                and supplier_id = #{supplierId}
             </if>
-            <if test="libraryType != null and libraryType != ''">
-                and a.library_type = #{libraryType}
+            <if test="serial != null and serial != ''">
+                and serial = #{serial}
             </if>
-            <if test="wllbCode != null and wllbCode != ''">
-                and a.wllb_code = #{wllbCode}
+            <if test="attribute != null and attribute != ''">
+                and attribute = #{attribute}
+            </if>
+            <if test="uuid != null and uuid != ''">
+                and uuid = #{uuid}
+            </if>
+            <if test="scrq != null and scrq != ''">
+                and scrq like CONCAT(CONCAT('%', #{scrq}), '%')
+            </if>
+            <if test="startTime != null and startTime != ''">
+                and sqrq <![CDATA[>=]]> #{startTime}
+            </if>
+            <if test="endTime != null and endTime != ''">
+                and sqrq <![CDATA[<=]]> #{endTime}
+            </if>
+        </trim>
+        order by scrq desc
+    </select>
+    <!--查询盘点主表信息-->
+    <select id="getInventoryDataList" resultType="com.tld.model.MakeInventory">
+        select
+        id,
+        user_id,
+        scrq,
+        uuid,
+        title
+        from tld_plate_f
+        <trim prefix="WHERE" prefixOverrides="and |or">
+            <if test="userId != null and userId != ''">
+                and user_id = #{userId}
+            </if>
+            <if test="uuid != null and uuid != ''">
+                and uuid = #{uuid}
+            </if>
+            <if test="scrq != null and scrq != ''">
+                and scrq like CONCAT(CONCAT('%', #{scrq}), '%')
+            </if>
+            <if test="title != null and title != ''">
+                and title like CONCAT(CONCAT('%', #{title}), '%')
+            </if>
+            <if test="plateId != null and plateId != ''">
+                and id = #{plateId}
             </if>
+            <if test="startTime != null and startTime != ''">
+                and sqrq <![CDATA[>=]]> #{startTime}
+            </if>
+            <if test="endTime != null and endTime != ''">
+                and sqrq <![CDATA[<=]]> #{endTime}
+            </if>
+        </trim>
+        order by scrq desc
+    </select>
+    <!--查询盘点录入信息是否重复-->
+    <select id="getInventoryRepetition" resultType="com.tld.model.MakeInventory">
+        select
+        id,
+        storage_location_code,
+        amount,
+        total,
+        wllb_code,
+        scrq,
+        material_id,
+        plate_id,
+        account_sleeve,
+        supplier_id,
+        serial,
+        attribute,
+        uuid
+        from tld_plate
+        <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="materialId != null and materialId != ''">
-                and a.material_id = #{materialId}
+                and material_id = #{materialId}
+            </if>
+            <if test="accountSleeve != null and accountSleeve != ''">
+                and account_sleeve = #{accountSleeve}
+            </if>
+            <if test="supplierId != null and supplierId != ''">
+                and supplier_id = #{supplierId}
             </if>
-            <if test="name != null and name != ''">
-                and b.name like CONCAT(CONCAT('%', #{name}), '%')
+            <if test="serial != null and serial != ''">
+                and serial = #{serial}
+            </if>
+            <if test="attribute != null and attribute != ''">
+                and attribute = #{attribute}
+            </if>
+            <if test="uuid != null and uuid != ''">
+                and uuid = #{uuid}
             </if>
         </trim>
     </select>
-    <!--导出盘点数据-->
-    <select id="export" resultType="java.util.LinkedHashMap">
-        SELECT storage_location_code,
-               amount,
-               account_sleeve,
-               wllb_code,
-               supplier_id,
-               produc_batch,
-               material_id
-        FROM tld_inventory
+    <!--查询本地库存.gs库存.录入库存 数量-->
+    <select id="getInventoryPlate" resultType="com.tld.model.MakeInventory">
+        SELECT a.storage_location_code,
+               a.account_sleeve,
+               a.wllb_code,
+               a.supplier_id,
+               a.produc_batch,
+               a.material_id,
+               b.NAME,
+               a.amount,
+               c.amount AS gsAmount
+        FROM tld_inventory a
+                 LEFT JOIN tld_material b ON a.wllb_code = b.CODE
+                 INNER JOIN tld_inventory_gs c ON a.material_id = c.material_id
+    </select>
+    <!--查询是否重复-->
+    <select id="getInventoryPlates" resultType="com.tld.model.MakeInventory">
+        select *
+        from tld_plate_z
+        where material_id = #{materialId}
+          and plate_id = #{plateId}
+          and uuid = #{uuid}
+    </select>
+    <!--查询盘点子表信息-->
+    <select id="getInventoryPlatesList" resultType="com.tld.model.MakeInventory">
+        select
+        id,
+        plate_id,
+        material_id,
+        wllb_code,
+        name,
+        amount,
+        gs_amount,
+        plate_amount,
+        uuid
+        from tld_plate_z
+        <trim prefix="WHERE" prefixOverrides="and |or">
+            <if test="materialId != null and materialId != ''">
+                and material_id = #{materialId}
+            </if>
+            <if test="wllbCode != null and wllbCode != ''">
+                and wllb_code = #{wllbCode}
+            </if>
+            <if test="uuid != null and uuid != ''">
+                and uuid = #{uuid}
+            </if>
+        </trim>
     </select>
 </mapper>

+ 4 - 0
src/main/resources/mapper/MaintenanceMapper.xml

@@ -15,4 +15,8 @@
     <update id="updateMaterial">
         update tld_material set size = #{size} where tld_id = #{tldId}
     </update>
+    <!-- 修改仓库类型 -->
+    <update id="updateWarehouse">
+        update tld_warehouse set warehouse_type = #{warehouseType} where id = #{id}
+    </update>
 </mapper>

+ 6 - 6
src/main/resources/mapper/MenuMapper.xml

@@ -58,22 +58,22 @@
         update tld_menu
         <set>
             <trim suffixOverrides=",">
-                <if test="name != null and name != ''">
+                <if test="name != null">
                     name = #{name},
                 </if>
-                <if test="url != null and url != ''">
+                <if test="url != null">
                     url = #{url},
                 </if>
-                <if test="pId != null and pId != ''">
+                <if test="pId != null">
                     p_id = #{pId},
                 </if>
-                <if test="orderBy != null and orderBy != ''">
+                <if test="orderBy != null">
                     order_by = #{orderBy},
                 </if>
-                <if test="type != null and type != ''">
+                <if test="type != null">
                     type = #{type},
                 </if>
-                <if test="img != null and img != ''">
+                <if test="img != null">
                     img = #{img},
                 </if>
                 modify_user = #{modifyUser},modify_time=now(),

+ 15 - 9
src/main/resources/mapper/RoleMapper.xml

@@ -19,19 +19,19 @@
         update tld_role
         <set>
             <trim suffixOverrides=",">
-                <if test="roleCode != null and roleCode != ''">
+                <if test="roleCode != null">
                     role_code = #{roleCode},
                 </if>
-                <if test="roleName != null and roleName != ''">
+                <if test="roleName != null">
                     role_name = #{roleName},
                 </if>
-                <if test="remarks != null and remarks != ''">
+                <if test="remarks != null ">
                     remarks = #{remarks},
                 </if>
-                <if test="menu != null and menu != ''">
+                <if test="menu != null">
                     menu = #{menu},
                 </if>
-                <if test="menuBefore != null and menuBefore != ''">
+                <if test="menuBefore != null">
                     menu_before = #{menuBefore},
                 </if>
                 <if test="menuPda != null">
@@ -77,16 +77,22 @@
     <!-- 查询导出数据 -->
     <select id="export" resultType="java.util.LinkedHashMap">
         select
-               role_code,role_name,create_time,remarks
-        from tld_role
+        a.role_code,
+        a.role_name,
+        a.create_time,
+        if(a.remarks = '', '暂无', a.remarks) as remarks,
+        a.modify_time as modifyTime,
+        f.user_name as modifyUser
+        from tld_role a
+        left join tld_user f on a.modify_user = f.id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="roleCode != null and roleCode != ''">
-                and role_code = #{roleCode}
+                and role_code like CONCAT(CONCAT('%', #{roleCode}), '%')
             </if>
             <if test="roleName != null and roleName != ''">
                 and role_name like CONCAT(CONCAT('%', #{roleName}), '%')
             </if>
         </trim>
-        order by id desc
+        order by a.id desc
     </select>
 </mapper>

+ 12 - 9
src/main/resources/mapper/StorageLocationMapper.xml

@@ -18,13 +18,13 @@
             a.storage_location_capacity,
             a.create_time,
             a.is_product,
-            b.name as materialName,
+            a.storage_location_type as materialName,
             c.name as wareHouseName,
             c.tld_id as tldId,
             a.modify_time as modifyTime,
             f.user_name as modifyUser
         from tld_storage_location a
-        left join tld_material_type b on a.storage_location_type = b.tld_id
+        /*left join tld_material_type b on a.storage_location_type = b.tld_id*/
         left join tld_warehouse c on a.warehouse_where = c.tld_id
         left join tld_user f on a.modify_user = f.id
         <trim prefix="WHERE" prefixOverrides="and |or">
@@ -66,25 +66,25 @@
         update tld_storage_location
         <set>
             <trim suffixOverrides=",">
-                <if test="storageLocationCode != null and storageLocationCode != ''">
+                <if test="storageLocationCode != null and">
                     storage_location_code = #{storageLocationCode},
                 </if>
-                <if test="storageLocationName != null and storageLocationName != ''">
+                <if test="storageLocationName != null and">
                     storage_location_name = #{storageLocationName},
                 </if>
                 <if test="warehouseWhere != null and warehouseWhere != ''">
                     warehouse_where = #{warehouseWhere},
                 </if>
-                <if test="storageLocationType != null and storageLocationType != ''">
+                <if test="storageLocationType != null and">
                     storage_location_type = #{storageLocationType},
                 </if>
-                <if test="storageLocationCapacity != null and storageLocationCapacity != ''">
+                <if test="storageLocationCapacity != null and">
                     storage_location_capacity = #{storageLocationCapacity},
                 </if>
-                <if test="isNotDisable != null and isNotDisable != ''">
+                <if test="isNotDisable != null and">
                     is_not_disable = #{isNotDisable},
                 </if>
-                <if test="isProduct != null and isProduct != ''">
+                <if test="isProduct != null and">
                     is_product = #{isProduct},
                 </if>
                 modify_user = #{modifyUser},modify_time=now(),
@@ -105,7 +105,7 @@
         from tld_storage_location
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="storageLocationCode != null and storageLocationCode != ''">
-                and storage_location_code like CONCAT(CONCAT('%', #{storageLocationCode}), '%')
+                and storage_location_code like CONCAT(CONCAT('%', #
             </if>
             <if test="storageLocationName != null and storageLocationName != ''">
                 and storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
@@ -116,6 +116,9 @@
             <if test="isNotDisable != null and isNotDisable != ''">
                 and is_not_disable = #{isNotDisable}
             </if>
+            <if test="warehouseWhere != null and warehouseWhere != ''">
+                and a.warehouse_where = #{warehouseWhere}
+            </if>
             <if test="id != null and id != ''">
                 and id = #{id}
             </if>

+ 57 - 18
src/main/resources/mapper/UserMapper.xml

@@ -53,6 +53,24 @@
             <if test="userName != null and userName != ''">
                 and a.user_name like CONCAT(CONCAT('%', #{userName}), '%')
             </if>
+            <if test="realName != null and realName != ''">
+                and a.real_name like CONCAT(CONCAT('%', #{realName}), '%')
+            </if>
+            <if test="role != null and role != ''">
+                and b.role_name like CONCAT(CONCAT('%', #{role}), '%')
+            </if>
+            <if test="email != null and email != ''">
+                and a.email like CONCAT(CONCAT('%', #{email}), '%')
+            </if>
+            <if test="landline != null and landline != ''">
+                and a.landline like CONCAT(CONCAT('%', #{landline}), '%')
+            </if>
+            <if test="phone != null and phone != ''">
+                and a.phone like CONCAT(CONCAT('%', #{phone}), '%')
+            </if>
+            <if test="department != null and department != ''">
+                and a.department = #{department}
+            </if>
             <if test="id != null and id != ''">
                 and a.id = #{id}
             </if>
@@ -72,31 +90,31 @@
         update tld_user
         <set>
             <trim suffixOverrides=",">
-                <if test="code != null and code != ''">
+                <if test="code != null">
                     code = #{code},
                 </if>
-                <if test="userName != null and userName != ''">
+                <if test="userName != null">
                     user_name = #{userName},
                 </if>
-                <if test="password != null and password != ''">
+                <if test="password != null">
                     password = #{password},
                 </if>
-                <if test="realName != null and realName != ''">
+                <if test="realName != null">
                     real_name = #{realName},
                 </if>
-                <if test="email != null and email != ''">
+                <if test="email != null">
                     email = #{email},
                 </if>
-                <if test="landline != null and landline != ''">
+                <if test="landline != null">
                     landline = #{landline},
                 </if>
-                <if test="phone != null and phone != ''">
+                <if test="phone != null">
                     phone = #{phone},
                 </if>
-                <if test="department != null and department != ''">
+                <if test="department != null">
                     department = #{department},
                 </if>
-                <if test="role != null and role != ''">
+                <if test="role != null">
                     role = #{role},
                 </if>
                 modify_user = #{modifyUser},modify_time=now(),
@@ -115,18 +133,21 @@
     <!-- 查询导出数据 -->
     <select id="getUserExportData" resultType="java.util.LinkedHashMap">
         select
-            a.code,
-            a.user_name,
-            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
+        a.code,
+        a.user_name,
+        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,
+        a.modify_time as modifyTime,
+        f.user_name as modifyUser
         from tld_user a
         left join tld_role b on a.role = b.id
         left join tld_department c on a.department = c.code
+        left join tld_user f on a.modify_user = f.id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="code != null and code != ''">
                 and a.code like CONCAT(CONCAT('%', #{code}), '%')
@@ -134,6 +155,24 @@
             <if test="userName != null and userName != ''">
                 and a.user_name like CONCAT(CONCAT('%', #{userName}), '%')
             </if>
+            <if test="realName != null and realName != ''">
+                and a.real_name like CONCAT(CONCAT('%', #{realName}), '%')
+            </if>
+            <if test="role != null and role != ''">
+                and b.role_name like CONCAT(CONCAT('%', #{role}), '%')
+            </if>
+            <if test="email != null and email != ''">
+                and a.email like CONCAT(CONCAT('%', #{email}), '%')
+            </if>
+            <if test="landline != null and landline != ''">
+                and a.landline like CONCAT(CONCAT('%', #{landline}), '%')
+            </if>
+            <if test="phone != null and phone != ''">
+                and a.phone like CONCAT(CONCAT('%', #{phone}), '%')
+            </if>
+            <if test="department != null and department != ''">
+                and a.department = #{department}
+            </if>
         </trim>
         order by a.id desc
     </select>