Ver código fonte

问题修改

xiaochen 2 anos atrás
pai
commit
57d9576fac

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

@@ -62,7 +62,7 @@ public class GsAccessController {
     }
 
     /**
-     * gs存入采购信息
+     * gs存入采购信息/新增质检单
      * @param jsonData 参数
      * @return 返回结果
      */

+ 9 - 0
src/main/java/com/tld/controller/GsPlugOutController.java

@@ -37,4 +37,13 @@ public class GsPlugOutController {
     public void plugOutRemoval(String removalCode){
         askGoodsService.plugOutRemoval(removalCode);
     }
+
+    /**
+     * 出销售发货单接口文档
+     * @param removalCode 要货申请单id
+     */
+    @GetMapping("CreateBOLOutStock")
+    public void CreateBOLOutStock(String removalCode){
+        askGoodsService.CreateBOLOutStock(removalCode);
+    }
 }

+ 54 - 0
src/main/java/com/tld/controller/InventoryController.java

@@ -0,0 +1,54 @@
+package com.tld.controller;
+
+
+import com.tld.model.AskGoods;
+import com.tld.model.MakeInventory;
+import com.tld.service.InventoryService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.Map;
+
+/**
+ * 盘点
+ */
+@RestController
+@RequestMapping("inventory")
+public class InventoryController {
+
+    @Autowired
+    private InventoryService inventoryService;
+
+
+    /**
+     * 查询盘点信息
+     * @param makeInventory 参数
+     * @return 返回结果
+     */
+    @GetMapping("getInventoryList")
+    public Map<String, Object> getInventoryList(MakeInventory makeInventory){
+        return inventoryService.getInventoryList(makeInventory);
+    }
+
+    /**
+     * 添加盘点信息
+     * @param makeInventory 参数
+     * @return 返回结果
+     */
+    @PostMapping("addInventory")
+    public Map<String, Object> addInventory(@RequestBody MakeInventory makeInventory){
+        return inventoryService.addInventory(makeInventory);
+    }
+
+    /**
+     * 导出盘点信息
+     * @param makeInventory 参数
+     * @return 返回结果
+     */
+    @GetMapping("export")
+    public void export(MakeInventory makeInventory , HttpServletResponse response){
+         inventoryService.export(makeInventory,response);
+    }
+
+}

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

@@ -11,6 +11,7 @@ import java.io.*;
 
 @RestController
 @RequestMapping("upload")
+@PassToken
 public class UploadController {
 
     @GetMapping("downloadFile")

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

@@ -110,4 +110,6 @@ public interface AskGoodsMapper {
 
     void delAskGoods(String id);
 
+    List<Map<String, Object>> getGsRemoval(@Param("removalCode") String removalCode);
+
 }

+ 17 - 0
src/main/java/com/tld/mapper/InventoryMapper.java

@@ -0,0 +1,17 @@
+package com.tld.mapper;
+
+import com.tld.model.MakeInventory;
+import org.apache.ibatis.annotations.Mapper;
+
+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);
+
+}

+ 127 - 0
src/main/java/com/tld/model/MakeInventory.java

@@ -0,0 +1,127 @@
+package com.tld.model;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * 盘点
+ */
+@Data
+@Accessors(chain = true)
+public class MakeInventory implements Serializable {
+    /**
+     * 主键
+     */
+    private String id;
+    /**
+     * 库位编号
+     */
+    private String storageLocationCode;
+    /**
+     * 物料分类
+     */
+    private String wllbClass;
+    /**
+     * 库位类别
+     */
+    private String libraryType;
+    /**
+     * 物料id
+     */
+    private String materialId;
+    /**
+     * 实际数量
+     */
+    private String amount;
+    /**
+     * 占用数量
+     */
+    private String total;
+    /**
+     * 占用时间
+     */
+    private String totime;
+    /**
+     * 物料状态 0开放1锁定
+     */
+    private String hold;
+    /**
+     * 数量锁定
+     */
+    private String amountLock;
+    /**
+     * 所属公司
+     */
+    private String accountSleeve;
+    /**
+     * wbs
+     */
+    private String wbs;
+    /**
+     * 供应商id
+     */
+    private String supplierId;
+    /**
+     * 连翻号
+     */
+    private String serial;
+    /**
+     * 物料编号
+     */
+    private String wllbCode;
+    /**
+     * 生产日期
+     */
+    private String producDate;
+    /**
+     * 入库时间
+     */
+    private String scrq;
+    /**
+     * 生产批次
+     */
+    private String producBatch;
+    /**
+     * 属性
+     */
+    private String attribute;
+    /**
+     * 物料名称
+     */
+    private String name;
+
+    /**
+     * gsid
+     */
+    private String gsId;
+    /**
+     * gs物料id
+     */
+    private String gsMaterialId;
+    /**
+     * gs实际数量
+     */
+    private String gsAmount;
+    /**
+     * gs所属公司
+     */
+    private String gsAccountSleeve;
+    /**
+     * 页数
+     */
+    private int page;
+    /**
+     * 条数
+     */
+    private int limit;
+    /**
+     * 修改人
+     */
+    private String modifyUser;
+    /**
+     * 修改时间
+     */
+    private String modifyTime;
+}

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

@@ -43,4 +43,6 @@ public interface AskGoodsService {
     Map<String, Object> otherAskGoods(AskGoods askGoods);
 
     Map<String, Object> delAskGoods(String id, HttpServletRequest request);
+
+    void CreateBOLOutStock(String removalCode);
 }

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

@@ -0,0 +1,16 @@
+package com.tld.service;
+
+import com.tld.model.MakeInventory;
+
+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);
+
+}

+ 94 - 0
src/main/java/com/tld/service/impl/AskGoodsServiceImpl.java

@@ -646,6 +646,100 @@ public class AskGoodsServiceImpl implements AskGoodsService {
         return map;
     }
 
+    /**
+     * 销售发货单接口
+     * @return
+     */
+    @Override
+    public void CreateBOLOutStock(String removalCode) {
+        try{
+            JSONObject returnData = new JSONObject();
+            List<JSONObject> retunList = new LinkedList<>();
+            for(String warehouseWhere : askGoodsMapper.getWarehouseWhere(removalCode)){
+                List<Map<String, Object>> mapList = askGoodsMapper.getGsRemoval(removalCode);
+                if(mapList.size() >0 ) {
+                    JSONObject strJson = new JSONObject();
+                    //父表
+                    strJson.put("BOLID", mapList.get(0).get("askGoodsId").toString());//要货单id
+                    strJson.put("WMSID", mapList.get(0).get("id").toString());//出库单id
+                    strJson.put("WMSCode", mapList.get(0).get("removalCode").toString());//出库单编号
+                    strJson.put("WareHouse", warehouseWhere);//仓库ID
+                    strJson.put("SourceBillDate",DateUtil.dateConversion(mapList.get(0).get("scrq").toString()));//业务日期
+                    strJson.put("SourceType", mapList.get(0).get("sourceType").toString());//来源类型
+                    strJson.put("MoveType", mapList.get(0).get("moveType").toString());//移动类型
+                    strJson.put("IsRed", 0);//是否红单1
+                    strJson.put("Creator", "测试");//制单人姓名1
+                    //子表
+                    List<JSONObject> list = new LinkedList<>();
+                    for (Map<String, Object> map : askGoodsMapper.getRemovalz(mapList.get(0).get("askGoodsId").toString(), warehouseWhere)) {
+                        JSONObject BillItems = new JSONObject();
+                        BillItems.put("WMSItemID", map.get("id"));//分录ID
+                        BillItems.put("BOLID", map.get("askGoodsId"));//要货申请单ID
+                        BillItems.put("BOLItemID", map.get("entryNumber"));//要货申请明细ID
+                        BillItems.put("Material", map.get("materialId"));//物料id
+                        BillItems.put("Quantity", map.get("num"));//数量
+                        BillItems.put("FlexField1", map.get("wbs"));//wbs
+                        BillItems.put("FlexField1Code", " ");//WBS编号
+                        BillItems.put("FlexField1Name", " ");//WBS名称
+                        list.add(BillItems);
+                    }
+                    strJson.put("BillItems", list);
+                    retunList.add(strJson);
+                }
+            }
+            JSONObject ReqOutStocks = new JSONObject();
+            ReqOutStocks.put("BILLs",retunList);
+            returnData.put("strJson", JSON.toJSONString(ReqOutStocks));
+            System.out.println(returnData);
+            HttpClientUtil httpClientUtil1 = new HttpClientUtil();
+            Map<String, Object> result = httpClientUtil1.doPost("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateBOLOutStock", returnData);
+            System.out.println("result:"+result);
+            Error error = new Error();
+            if(Integer.parseInt(result.get("msg").toString()) != 200){
+                //如果失败存入报错信息跟数据
+                error.setErrorInfo(result.get("data").toString());
+                error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateBOLOutStock");
+                error.setDataVal(returnData.toJSONString());
+                errorMapper.addError(error);
+            }else {
+                JSONObject jsonObject = (JSONObject) JSONObject.parse(result.get("data").toString());
+                JSONObject jsonObject1 = (JSONObject) JSONObject.parse(jsonObject.get("result").toString());
+                if ( jsonObject1.get("State").toString().equals("0") ){
+                    //如果失败存入报错信息跟数据
+                    error.setErrorInfo(jsonObject1.get("Msg").toString());
+                    error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateBOLOutStock");
+                    error.setDataVal(returnData.toJSONString());
+                    errorMapper.addError(error);
+                }else {
+                    List<JSONObject>  data1 = (List<JSONObject>) JSONObject.parse(jsonObject1.get("data").toString());
+                    for (JSONObject map : data1) {
+                        if (map.get("State").toString().equals("0")){
+                            for(JSONObject jsonObject2 : retunList){
+                                if(jsonObject2.get("WMSCode").toString().equals(map.get("WMSCode")) && jsonObject2.get("WareHouse").toString().equals(map.get("WareHouse"))){
+                                    //如果失败存入报错信息跟数据
+                                    error.setErrorInfo(map.get("FailReason").toString());
+                                    error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateProductiveOutStock");
+                                    error.setDataVal(jsonObject2.toString());
+                                    errorMapper.addError(error);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+            //删除父子表信息
+            askGoodsMapper.delPlugOutRemoval(removalCode);
+            askGoodsMapper.delRemovalz(removalCode);
+            //添加记录到tld_access
+            String names = "出库回传" ;
+            String accessType = "1" ;
+            String returnGsRemoval = returnData.toString() ;
+            askGoodsMapper.addAccess(names,returnGsRemoval,accessType);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
+
     /**
      * 出库单生成
      * @return

+ 92 - 0
src/main/java/com/tld/service/impl/InventoryServiceImpl.java

@@ -0,0 +1,92 @@
+package com.tld.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.tld.excel.ExcelUtils;
+import com.tld.mapper.InventoryMapper;
+import com.tld.model.MakeInventory;
+import com.tld.service.InventoryService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletResponse;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@Service
+public class InventoryServiceImpl implements InventoryService {
+
+    @Autowired
+    private InventoryMapper inventoryMapper;
+
+
+    /**
+     * 盘点查询
+     * @return
+     */
+    @Override
+    public Map<String, Object> getInventoryList(MakeInventory makeInventory) {
+        Map<String, Object> map = new HashMap<>();
+        try {
+            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 ;
+    }
+
+    /**
+     * 添加盘点
+     * @return
+     */
+    @Override
+    public Map<String, Object> addInventory(MakeInventory makeInventory) {
+        Map<String, Object> map = new HashMap<>();
+        try {
+            inventoryMapper.addInventory(makeInventory);
+            map.put("msg", "200");
+        }catch (Exception e){
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg","服务器请求异常,请稍后再试");
+        }
+        return map ;
+    }
+
+    /**
+     * 导出盘点
+     * @return
+     */
+    @Override
+    public void export(MakeInventory makeInventory, HttpServletResponse response) {
+        try{
+            //导出数据汇总
+            List<List<Object>> sheetDataList = new ArrayList<>();
+            //表头数据
+            List<Object> head =
+                    Arrays.asList("库位编号", "实际数量", "所属公司","物料编号","供应商id","生产批次","物料id");
+            //查询数据
+            PageHelper.startPage(makeInventory.getPage(), makeInventory.getLimit());
+            PageInfo<Map<String, Object>> list = new PageInfo<>(inventoryMapper.export(makeInventory));
+            sheetDataList.add(head);
+            for(Map<String, Object> userMap : list.getList()){
+                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();
+        }
+    }
+}

+ 11 - 0
src/main/resources/mapper/AskGoodsMapper.xml

@@ -614,6 +614,17 @@
     <select id="getDelAskGoods" resultType="java.util.Map">
         select * from tld_ask_goods where id = #{id}
     </select>
+    <!-- 销售发货单接口文档 父表信息 -->
+    <select id="getGsRemoval" resultType="java.util.Map">
+        select
+            id,
+            document_id as askGoodsId,
+            removal_code as removalCode,
+            source_type as sourceType,
+            move_type as moveType,
+            scrq
+        from tld_return_gs_removal where document_id = #{removalCode}
+    </select>
     <!-- 删除生产领料 -->
     <delete id="delAskGoods">
         delete from tld_ask_goods where id = #{id}

+ 67 - 0
src/main/resources/mapper/InventoryMapper.xml

@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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>
+
+    <!--查询盘点-->
+    <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
+        <trim prefix="WHERE" prefixOverrides="and |or">
+            <if test="storageLocationCode != null and storageLocationCode != ''">
+                and a.storage_location_code = #{storageLocationCode}
+            </if>
+            <if test="wllbClass != null and wllbClass != ''">
+                and a.wllb_class = #{wllbClass}
+            </if>
+            <if test="accountSleeve != null and accountSleeve != ''">
+                and a.account_sleeve = #{accountSleeve}
+            </if>
+            <if test="id != null and id != ''">
+                and a.id = #{id}
+            </if>
+            <if test="libraryType != null and libraryType != ''">
+                and a.library_type = #{libraryType}
+            </if>
+            <if test="wllbCode != null and wllbCode != ''">
+                and a.wllb_code = #{wllbCode}
+            </if>
+            <if test="materialId != null and materialId != ''">
+                and a.material_id = #{materialId}
+            </if>
+            <if test="name != null and name != ''">
+                and b.name like CONCAT(CONCAT('%', #{name}), '%')
+            </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
+    </select>
+</mapper>

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

@@ -321,19 +321,19 @@
             (#{item.transferNoticeOrderId},#{item.transferNoticeOrderNo},#{item.requestWarehouseId},#{item.docDate},#{item.moveType})
         </foreach>
         ;
-        insert into tld_warehouse_transfer ( warehouse_transfer_id, entry_number, supply_warehouse_id, material_id, wbs, measurement_id, num, out_num, type)
+        insert into tld_warehouse_transfer ( warehouse_transfer_id, entry_number, supply_warehouse_id, material_id, wbs, measurement_id, num, out_num, type,account_sleeve)
         values
         <foreach collection="list" index="index" item="item" separator=",">
             <foreach collection="item.datalist" index="index" item="items" separator=",">
-                (#{item.transferNoticeOrderId},#{items.entryNo},#{items.supplyWarehouseId},#{items.materialId},#{items.WBS},#{items.measUnitId},#{items.orderCount},0,0)
+                (#{item.transferNoticeOrderId},#{items.entryNo},#{items.supplyWarehouseId},#{items.materialId},#{items.WBS},#{items.measUnitId},#{items.orderCount},0,0,#{items.accountSleeve})
             </foreach>
         </foreach>
         ;
-        insert into tld_warehouse_transfer_log (warehouse_transfer_id, warehouse_transfer_code, ask_goods_warehouse_id, document_time, warehouse_transfer_type, entry_number, supply_warehouse_id, material_id, wbs, measurement_id, num, out_num, type)
+        insert into tld_warehouse_transfer_log (warehouse_transfer_id, warehouse_transfer_code, ask_goods_warehouse_id, document_time, warehouse_transfer_type, entry_number, supply_warehouse_id, material_id, wbs, measurement_id, num, out_num, type,account_sleeve)
         values
         <foreach collection="list" index="index" item="item" separator=",">
             <foreach collection="item.datalist" index="index" item="items" separator=",">
-                (#{item.transferNoticeOrderId},#{item.transferNoticeOrderNo},#{item.requestWarehouseId},#{item.docDate},#{item.moveType},#{items.entryNo},#{items.supplyWarehouseId},#{items.materialId},#{items.WBS},#{items.measUnitId},#{items.orderCount},0,0)
+                (#{item.transferNoticeOrderId},#{item.transferNoticeOrderNo},#{item.requestWarehouseId},#{item.docDate},#{item.moveType},#{items.entryNo},#{items.supplyWarehouseId},#{items.materialId},#{items.WBS},#{items.measUnitId},#{items.orderCount},0,0,#{items.accountSleeve})
             </foreach>
         </foreach>
         ;

+ 38 - 32
src/main/resources/mapper/QueryListMappeer.xml

@@ -171,22 +171,24 @@
             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 b.ask_goods_code = #{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>
+       /* WHERE e.part_type != '半成品' and e.part_type != '产成品'*/
+        <trim prefix="WHERE" prefixOverrides="and |or">
+            <if test="askGoodsId != null and askGoodsId != ''">
+                and b.ask_goods_code = #{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>
+        </trim>
     </select>
     <!-- 查询生产领料要货 -->
     <select id="getAskGoodsExcel" resultType="java.util.LinkedHashMap">
@@ -239,22 +241,25 @@
             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 b.ask_goods_code = #{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>
+        /*WHERE*/
+            /*e.part_type != '半成品' and e.part_type != '产成品'*/
+        <trim prefix="WHERE" prefixOverrides="and |or">
+            <if test="askGoodsId != null and askGoodsId != ''">
+                and b.ask_goods_code = #{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>
+        </trim>
     </select>
     <!-- 导出生产领料要货 -->
     <select id="getInviteExcel" resultType="java.util.LinkedHashMap">
@@ -476,6 +481,7 @@
                 and scrq <![CDATA[<=]]> #{endTime}
             </if>
         </trim>
+        ORDER BY a.scrq DESC
     </select>
 
 </mapper>

+ 3 - 0
src/main/resources/mapper/UserMaterialMapper.xml

@@ -27,6 +27,9 @@
             <if test="userId != null and userId != ''">
                 and a.user_id = #{userId}
             </if>
+            <if test="id != null and id != ''">
+                and a.id = #{id}
+            </if>
         </trim>
         order by a.scrq desc
     </select>