zhs 2 år sedan
förälder
incheckning
9e0cbc2e85

+ 2 - 2
src/main/java/com/tld/controller/DictionaryController.java

@@ -45,7 +45,7 @@ public class DictionaryController {
      * @return 返回结果
      */
     @PostMapping("addDictionary")
-    public Map<String, Object> addDictionary(Dictionary dictionary, HttpServletRequest request){
+    public Map<String, Object> addDictionary(@RequestBody Dictionary dictionary, HttpServletRequest request){
         return dictionaryService.addDiction(dictionary, request);
     }
     /**
@@ -54,7 +54,7 @@ public class DictionaryController {
      * @return 返回结果
      */
     @PostMapping("updateDictionary")
-    public Map<String, Object> updateDictionary(Dictionary dictionary, HttpServletRequest request){
+    public Map<String, Object> updateDictionary(@RequestBody Dictionary dictionary, HttpServletRequest request){
         return dictionaryService.updateDictionary(dictionary, request);
     }
     /**

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

@@ -1,7 +1,6 @@
 package com.tld.controller;
 
-import com.tld.model.Access;
-import com.tld.model.Inventory;
+import com.tld.model.*;
 import com.tld.service.QueryListService;
 import lombok.RequiredArgsConstructor;
 import org.springframework.web.bind.annotation.*;
@@ -71,5 +70,59 @@ public class QueryListController {
     public Map<String, Object> getAccess(Access access){
         return queryListService.getAccess(access);
     }
+
+    /**
+     * 生产领用查询
+     * @param askGoods 参数
+     * @return 返回结果
+     */
+    @GetMapping("getAskGoods")
+    public Map<String, Object> getAskGoods(AskGoods askGoods){
+        return queryListService.getAskGoods(askGoods);
+    }
+
+    /**
+     * 生产领用导出
+     * @param askGoods 参数
+     * @param response 参数
+     */
+    @GetMapping("getAskGoodsExcel")
+    public void getAskGoodsExcel(AskGoods askGoods, HttpServletResponse response){
+        queryListService.getAskGoodsExcel(askGoods, response);
+    }
+
+    /**
+     * 非生产领用查询
+     * @param askGoods 参数
+     * @return 返回结果
+     */
+    @GetMapping("getInvite")
+    public Map<String, Object> getInvite(AskGoods askGoods){
+        return queryListService.getInvite(askGoods);
+    }
+
+    /**
+     * 非生产领料单导出
+     * @param askGoods 参数
+     */
+    @GetMapping("getInviteExcel")
+    public void getInviteExcel(AskGoods askGoods, HttpServletResponse response){
+        queryListService.getInviteExcel(askGoods, response);
+    }
+
+    /**
+     * 查询销售单
+     * @param delivery 参数
+     * @return 返回结果
+     */
+    @GetMapping("getDelivery")
+    public Map<String, Object> getDelivery(Delivery delivery){
+        return queryListService.getDelivery(delivery);
+    }
+
+    @GetMapping("getDeliveryExcel")
+    public void getDeliveryExcel(Delivery delivery, HttpServletResponse response){
+        queryListService.getDeliveryExcel(delivery, response);
+    }
 }
 

+ 0 - 2
src/main/java/com/tld/controller/WarehousingController.java

@@ -1,11 +1,9 @@
 package com.tld.controller;
 
-import com.tld.model.AskGoods;
 import com.tld.model.Notice;
 import com.tld.model.Storage;
 import com.tld.model.WarehousingVirtual;
 import com.tld.service.WarehousingService;
-import com.tld.util.DateUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import javax.servlet.http.HttpServletResponse;

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

@@ -1,7 +1,6 @@
 package com.tld.mapper;
 
-import com.tld.model.Access;
-import com.tld.model.Inventory;
+import com.tld.model.*;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -21,4 +20,16 @@ public interface QueryListMapper {
     List<Map<String, Object>> getStorageLocation(Inventory inventory);
 
     List<Access> getAccess(Access access);
+
+    List<AskGoods> getAskGoods(AskGoods askGoods);
+
+    List<Map<String, Object>> getAskGoodsExcel(AskGoods askGoods);
+
+    List<AskGoods> getInvite(AskGoods askGoods);
+
+    List<Map<String, Object>> getInviteExcel(AskGoods askGoods);
+
+    List<Delivery> getDelivery(Delivery delivery);
+
+    List<Map<String, Object>> getDeliveryExcel(Delivery delivery);
 }

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

@@ -91,4 +91,20 @@ public class Delivery implements Serializable {
      * 出库单id
      */
     private String storageCode;
+    /**
+     * 开始时间
+     */
+    private String startTime;
+    /**
+     * 结束时间
+     */
+    private String endTime;
+    /**
+     * 页数
+     */
+    private int page;
+    /**
+     * 条数
+     */
+    private int limit;
 }

+ 13 - 2
src/main/java/com/tld/service/QueryListService.java

@@ -1,7 +1,6 @@
 package com.tld.service;
 
-import com.tld.model.Access;
-import com.tld.model.Inventory;
+import com.tld.model.*;
 
 import javax.servlet.http.HttpServletResponse;
 import java.util.Map;
@@ -16,4 +15,16 @@ public interface QueryListService {
     void exportStorageLocation(Inventory inventory, HttpServletResponse response);
 
     Map<String, Object> getAccess(Access access);
+
+    Map<String, Object> getAskGoods(AskGoods askGoods);
+
+    void getAskGoodsExcel(AskGoods askGoods, HttpServletResponse response);
+
+    Map<String, Object> getInvite(AskGoods askGoods);
+
+    void getInviteExcel(AskGoods askGoods, HttpServletResponse response);
+
+    Map<String, Object> getDelivery(Delivery delivery);
+
+    void getDeliveryExcel(Delivery delivery, HttpServletResponse response);
 }

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

@@ -165,6 +165,7 @@ public class DictionaryServiceImpl implements DictionaryService {
             }
             dictionary.setTableName(tableName);
             dictionary.setTypeVal("1");
+            dictionary.setModifyUser(request.getHeader("userId"));
             if (dictionary.getType().equals("物料字典")) {
                 dictionaryMapper.addMaterial(dictionary);
             } else if (dictionary.getType().equals("库账对存")) {

+ 127 - 3
src/main/java/com/tld/service/impl/QueryListServiceImpl.java

@@ -4,9 +4,7 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.tld.excel.ExcelUtils;
 import com.tld.mapper.QueryListMapper;
-import com.tld.model.Access;
-import com.tld.model.Inventory;
-import com.tld.model.Notice;
+import com.tld.model.*;
 import com.tld.service.QueryListService;
 import lombok.RequiredArgsConstructor;
 import org.springframework.stereotype.Service;
@@ -124,4 +122,130 @@ public class QueryListServiceImpl implements QueryListService {
         }
         return map;
     }
+
+    @Override
+    public Map<String, Object> getAskGoods(AskGoods askGoods) {
+        Map<String, Object> map = new HashMap<>();
+        try{
+            PageHelper.startPage(askGoods.getPage(), askGoods.getLimit());
+            PageInfo<AskGoods> list = new PageInfo<>(queryListMapper.getAskGoods(askGoods));
+            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 getAskGoodsExcel(AskGoods askGoods, HttpServletResponse response) {
+        try {
+            //导出数据汇总
+            List<List<Object>> sheetDataList = new ArrayList<>();
+            //表头数据
+            List<Object> head = Arrays.asList("生产领料单", "物料ID", "要货数量", "已出库数量", "物料名称", "物料编号", "要料单编号", "公司编号");
+            //查询数据
+            List<Map<String, Object>> list = queryListMapper.getAskGoodsExcel(askGoods);
+            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> getInvite(AskGoods askGoods) {
+        Map<String, Object> map = new HashMap<>();
+        try{
+            PageHelper.startPage(askGoods.getPage(), askGoods.getLimit());
+            PageInfo<AskGoods> list = new PageInfo<>(queryListMapper.getInvite(askGoods));
+            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 getInviteExcel(AskGoods askGoods, HttpServletResponse response) {
+        try {
+            //导出数据汇总
+            List<List<Object>> sheetDataList = new ArrayList<>();
+            //表头数据
+            List<Object> head = Arrays.asList("生产领料单", "物料ID", "要货数量", "已出库数量", "物料名称", "物料编号", "要料单编号", "公司编号");
+            //查询数据
+            List<Map<String, Object>> list = queryListMapper.getInviteExcel(askGoods);
+            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> getDelivery(Delivery delivery) {
+        Map<String, Object> map = new HashMap<>();
+        try{
+            PageHelper.startPage(delivery.getPage(), delivery.getLimit());
+            PageInfo<Delivery> list = new PageInfo<>(queryListMapper.getDelivery(delivery));
+            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 getDeliveryExcel(Delivery delivery, HttpServletResponse response) {
+        try {
+            //导出数据汇总
+            List<List<Object>> sheetDataList = new ArrayList<>();
+            //表头数据
+            List<Object> head = Arrays.asList("生产领料单", "物料ID", "要货数量", "已出库数量", "物料名称", "物料编号", "要料单编号", "公司编号");
+            //查询数据
+            List<Map<String, Object>> list = queryListMapper.getDeliveryExcel(delivery);
+            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 - 0
src/main/resources/mapper/DictionaryMapper.xml

@@ -50,6 +50,7 @@
                 and type = #{typeVal}
             </if>
         </trim>
+        order by id desc
     </select>
     <!-- 库账对存字典新增 -->
     <insert id="addTreasuryAccount">

+ 2 - 2
src/main/resources/mapper/MaterialClassMapper.xml

@@ -5,7 +5,7 @@
     <!-- 查询物料类别 -->
    <select id="getMaterialClass" resultType="com.tld.model.MaterialClass">
        select
-            a.wllb_code,
+            DISTINCT a.wllb_code,
             a.storage_location_code,
             b.storage_location_name as storageLocationName,
             c.name as wllbName,
@@ -14,7 +14,7 @@
             f.user_name as modifyUser
        from tld_material_class a
        left join tld_storage_location b on a.storage_location_code = b.storage_location_code
-       left join tld_material c on a.wllb_code = c.tld_id
+       left join tld_material c on a.wllb_code = c.code
        left join tld_user f on a.modify_user = f.id
        <trim prefix="WHERE" prefixOverrides="and |or">
            <if test="storageLocationCode != null and storageLocationCode != ''">

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

@@ -115,4 +115,182 @@
             </if>
         </trim>
     </select>
+    <!-- 查询生产领料要货 -->
+    <select id="getAskGoods" resultType="com.tld.model.AskGoods">
+        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
+        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 != '产成品'
+        <if test="askGoodsId != null and askGoodsId != ''">
+            and a.ask_goods_id = #{askGoodsId}
+        </if>
+        <if test="materialCode != null and materialCode != ''">
+            and e.code like CONCAT(CONCAT('%', #{materialCode}), '%')
+        </if>
+        <if test="materialName != null and materialName != ''">
+            and e.name like CONCAT(CONCAT('%', #{materialName}), '%')
+        </if>
+        <if test="startTime != null and startTime != ''">
+            and b.sqrq <![CDATA[>=]]> #{startTime}
+        </if>
+        <if test="endTime != null and endTime != ''">
+            and b.sqrq <![CDATA[<=]]> #{endTime}
+        </if>
+    </select>
+    <!-- 查询生产领料要货 -->
+    <select id="getAskGoodsExcel" resultType="java.util.LinkedHashMap">
+        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
+        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 != '产成品'
+        <if test="askGoodsId != null and askGoodsId != ''">
+            and a.ask_goods_id = #{askGoodsId}
+        </if>
+        <if test="materialCode != null and materialCode != ''">
+            and e.code like CONCAT(CONCAT('%', #{materialCode}), '%')
+        </if>
+        <if test="materialName != null and materialName != ''">
+            and e.name like CONCAT(CONCAT('%', #{materialName}), '%')
+        </if>
+        <if test="startTime != null and startTime != ''">
+            and b.sqrq <![CDATA[>=]]> #{startTime}
+        </if>
+        <if test="endTime != null and endTime != ''">
+            and b.sqrq <![CDATA[<=]]> #{endTime}
+        </if>
+    </select>
+    <!-- 查询非生产领料单 -->
+    <select id="getInvite" resultType="com.tld.model.AskGoods">
+        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
+        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
+        WHERE e.part_type != '半成品' and e.part_type != '产成品'
+        <if test="askGoodsId != null and askGoodsId != ''">
+            and a.ask_goods_id = #{askGoodsId}
+        </if>
+        <if test="materialCode != null and materialCode != ''">
+            and e.code like CONCAT(CONCAT('%', #{materialCode}), '%')
+        </if>
+        <if test="materialName != null and materialName != ''">
+            and e.name like CONCAT(CONCAT('%', #{materialName}), '%')
+        </if>
+        <if test="startTime != null and startTime != ''">
+            and b.sqrq <![CDATA[>=]]> #{startTime}
+        </if>
+        <if test="endTime != null and endTime != ''">
+            and b.sqrq <![CDATA[<=]]> #{endTime}
+        </if>
+    </select>
+    <!-- 导出生产领料要货 -->
+    <select id="getInviteExcel" resultType="java.util.LinkedHashMap">
+        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
+        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
+        WHERE e.part_type != '半成品' and e.part_type != '产成品'
+        <if test="askGoodsId != null and askGoodsId != ''">
+            and a.ask_goods_id = #{askGoodsId}
+        </if>
+        <if test="materialCode != null and materialCode != ''">
+            and e.code like CONCAT(CONCAT('%', #{materialCode}), '%')
+        </if>
+        <if test="materialName != null and materialName != ''">
+            and e.name like CONCAT(CONCAT('%', #{materialName}), '%')
+        </if>
+        <if test="startTime != null and startTime != ''">
+            and b.sqrq <![CDATA[>=]]> #{startTime}
+        </if>
+        <if test="endTime != null and endTime != ''">
+            and b.sqrq <![CDATA[<=]]> #{endTime}
+        </if>
+    </select>
+    <!-- 查询销售单 -->
+    <select id="getDelivery" resultType="com.tld.model.Delivery">
+        select
+            a.id,
+            a.delivery_id,
+            a.entry_number,
+            a.material_id,
+            a.wbs,
+            a.measurement_id,
+            a.gs_delivery_num,
+            a.gs_cancel_num,
+            a.out_num,
+            b.company_number,
+            b.bills_time,
+            b.delivery_type,
+            b.source_type,
+            b.move_type,
+            c.name as materialName,
+            c.code as materialCode
+        from tld_delivery a
+        join tld_delivery_f b on a.delivery_id = b.delivery_id
+        join tld_material c on a.material_id = c.tld_id
+        <trim prefix="WHERE" prefixOverrides="and |or">
+            <if test="deliveryId != null and deliveryId != ''">
+                and a.delivery_id = #{deliveryId}
+            </if>
+            <if test="materialCode != null and materialCode != ''">
+                and c.code like CONCAT(CONCAT('%', #{materialCode}), '%')
+            </if>
+            <if test="materialName != null and materialName != ''">
+                and c.name like CONCAT(CONCAT('%', #{materialName}), '%')
+            </if>
+            <if test="startTime != null and startTime != ''">
+                and a.bills_time <![CDATA[>=]]> #{startTime}
+            </if>
+            <if test="endTime != null and endTime != ''">
+                and a.bills_time <![CDATA[<=]]> #{endTime}
+            </if>
+        </trim>
+    </select>
+    <!-- 导出销售单 -->
+    <select id="getDeliveryExcel" resultType="java.util.LinkedHashMap">
+
+    </select>
 </mapper>