xiaochen 2 роки тому
батько
коміт
ef3ddfbcc1

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

@@ -77,4 +77,14 @@ public class DictionaryController {
     public void userExport(Dictionary dictionary, HttpServletResponse response){
         dictionaryService.export(dictionary, response);
     }
+
+    /**
+     * 字典导出
+     * @param dictionary 参数
+     */
+    @GetMapping("dictionariesExport")
+    public void dictionariesExport(Dictionary dictionary, HttpServletResponse response){
+        dictionaryService.dictionariesExport(dictionary, response);
+    }
+
 }

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

@@ -46,4 +46,13 @@ public class GsPlugOutController {
     public void CreateBOLOutStock(String removalCode){
         askGoodsService.CreateBOLOutStock(removalCode);
     }
+
+    /**
+     * 移库单接口文档
+     * @param removalCode 要货申请单id
+     */
+    @GetMapping("CreateGMReqOutStock")
+    public void CreateGMReqOutStock(String removalCode){
+        askGoodsService.CreateGMReqOutStock(removalCode);
+    }
 }

+ 23 - 2
src/main/java/com/tld/controller/ReceiveGoodsController.java

@@ -1,11 +1,13 @@
 package com.tld.controller;
 
 import com.tld.model.ReceiveGoods;
+import com.tld.model.User;
 import com.tld.service.ReceiveGoodsSerivce;
 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;
 
 /**
@@ -39,7 +41,7 @@ public class ReceiveGoodsController {
     }
 
     /**
-     * 查询采购单
+     * 查询采购单   再用
      * @param receiveGoods 参数
      * @return 返回结果
      */
@@ -49,7 +51,7 @@ public class ReceiveGoodsController {
     }
 
     /**
-     * 查询超时采购单
+     * 查询超时采购单  再用
      * @param receiveGoods 参数
      * @return 返回结果
      */
@@ -68,4 +70,23 @@ public class ReceiveGoodsController {
         return receiveGoodsSerivce.delReceiveGoods(id, request);
     }
 
+    /**
+     * 采购单导出
+     * @param response
+     */
+    @GetMapping("purchaseExport")
+    public void purchaseExport(ReceiveGoods receiveGoods, HttpServletResponse response){
+        receiveGoodsSerivce.purchaseExport(receiveGoods, response);
+    }
+
+    /**
+     * 超时采购单导出
+     * @param response
+     */
+    @GetMapping("overtimePurchaseExport")
+    public void overtimePurchaseExport(ReceiveGoods receiveGoods, HttpServletResponse response){
+        receiveGoodsSerivce.overtimePurchaseExport(receiveGoods, response);
+    }
+
+
 }

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

@@ -117,4 +117,17 @@ public interface AskGoodsMapper {
     Inventory getInventoryWarehousing(AskGoods askGoods);
 
     List<Inventory> getInventoryInfoOther(AskGoods askGoods);
+
+    List<String> getSupplyWarehouseWhere(@Param("removalCode") String removalCode);
+
+    List<Map<String, Object>> getReturnWarehouseTransfer(@Param("removalCode") String removalCode);
+
+    String getSupplyWarehouseWheres(@Param("removalCode") String removalCode);
+
+    List<Map<String, Object>>  getReturnWarehouseTransferZ(@Param("warehouseTransferId") String warehouseTransferId, @Param("warehouseWhere") String warehouseWhere);
+
+    void delReturnWarehouseTransfer(@Param("removalCode") String removalCode);
+
+    void delReturnWarehouseTransferZ(@Param("warehouseTransferTd") String warehouseTransferTd);
+
 }

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

@@ -50,4 +50,11 @@ public interface DictionaryMapper {
     List<Dictionary> getDictionaryPageMaterial(Dictionary dictionary);
 
     void deleteRepertory(Dictionary dictionary);
+
+    List<Dictionary>  getDictionaryPageWarehouse(Dictionary dictionary);
+
+    List<Map<String, Object>> elseExport(Dictionary dictionary);
+
+    List<Map<String, Object>> warehouseExport(Dictionary dictionary);
+
 }

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

@@ -33,4 +33,9 @@ public interface ReceiveGoodsMapper {
     Map<String, Object> getDelReceiveGoods(String id);
 
     void delReceiveGoods(String id);
+
+    List<Map<String, Object>> purchaseExport(ReceiveGoods receiveGoods);
+
+    List<Map<String, Object>> overtimePurchaseExport(ReceiveGoods receiveGoods);
+
 }

+ 12 - 0
src/main/java/com/tld/model/ReturnWarehousing.java

@@ -40,6 +40,18 @@ public class ReturnWarehousing implements Serializable {
      * wbs
      */
     private String wbs;
+    /**
+     * wbsId
+     */
+    private String wbsId;
+    /**
+     * wbsCode
+     */
+    private String wbsCode;
+    /**
+     * wbsName
+     */
+    private String wbsName;
     /**
      * 物料id
      */

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

@@ -47,4 +47,7 @@ public interface AskGoodsService {
     void CreateBOLOutStock(String removalCode);
 
     Map<String, Object> addWarehouseTransferVitrual(AskGoods askGoods);
+
+    void CreateGMReqOutStock(String removalCode);
+
 }

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

@@ -21,4 +21,6 @@ public interface DictionaryService {
     Map<String, Object> addDiction(Dictionary dictionary, HttpServletRequest request);
 
     void export(Dictionary dictionary, HttpServletResponse response);
+
+    void dictionariesExport(Dictionary dictionary, HttpServletResponse response);
 }

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

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.tld.model.ReceiveGoods;
 
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 import java.util.Map;
 
@@ -24,4 +25,8 @@ public interface ReceiveGoodsSerivce {
     Map<String, Object> timeoutPurchase(ReceiveGoods receiveGoods);
 
     Map<String, Object> delReceiveGoods(String param, HttpServletRequest request);
+
+    void purchaseExport(ReceiveGoods receiveGoods, HttpServletResponse response);
+
+    void overtimePurchaseExport(ReceiveGoods receiveGoods, HttpServletResponse response);
 }

+ 107 - 6
src/main/java/com/tld/service/impl/AskGoodsServiceImpl.java

@@ -299,9 +299,9 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                         BillItems.put("GIReqBillItemID", 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名称
+                        BillItems.put("FlexField1", map.get("wbsId"));//wbs
+                        BillItems.put("FlexField1Code", map.get("wbsCode"));//WBS编号
+                        BillItems.put("FlexField1Name", map.get("wbsName"));//WBS名称
                         list.add(BillItems);
                     }
                     strJson.put("BillItems", list);
@@ -689,9 +689,9 @@ public class AskGoodsServiceImpl implements AskGoodsService {
                         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名称
+                        BillItems.put("FlexField1", map.get("wbsId"));//wbs
+                        BillItems.put("FlexField1Code", map.get("wbsCode"));//WBS编号
+                        BillItems.put("FlexField1Name", map.get("wbsName"));//WBS名称
                         list.add(BillItems);
                     }
                     strJson.put("BillItems", list);
@@ -793,6 +793,107 @@ public class AskGoodsServiceImpl implements AskGoodsService {
         return map;
     }
 
+    /**
+     *移库单接口文档
+     */
+    @Override
+    public void CreateGMReqOutStock(String removalCode) {
+        try {
+            JSONObject returnData = new JSONObject();
+            List<JSONObject> retunList = new LinkedList<>();
+            //通过code查询id
+             String warehouseTransferTd = askGoodsMapper.getSupplyWarehouseWheres(removalCode);
+             //根据id查询子表的供货仓库
+            for (String warehouseWhere : askGoodsMapper.getSupplyWarehouseWhere(warehouseTransferTd)) {
+                //查询父表信息
+                List<Map<String, Object>> mapList = askGoodsMapper.getReturnWarehouseTransfer(removalCode);
+                if (mapList.size() > 0) {
+                    JSONObject strJson = new JSONObject();
+                    //父表
+                    strJson.put("GMReqBillID", mapList.get(0).get("warehouseTransferId").toString());//移库通知ID
+                    strJson.put("WMSID", mapList.get(0).get("id").toString());//利道WMS出库单id
+                    strJson.put("WMSCode", mapList.get(0).get("warehouseTransferCode").toString());//利道WMS出库单编号
+                    strJson.put("TOWareHouse", mapList.get(0).get("askGoodsWarehouseId").toString());//要货仓库ID
+                    strJson.put("FromWareHouse", warehouseWhere);//供货仓库ID
+                    strJson.put("SourceBillDate", DateUtil.dateConversion(mapList.get(0).get("scrq").toString()));//业务日期
+                    strJson.put("MoveType", mapList.get(0).get("warehouseTransferType").toString());//移动类型
+                    strJson.put("IsRed", 0);//是否红单1
+                    strJson.put("Creator", "测试");//制单人姓名1
+                    //子表
+                    List<JSONObject> list = new LinkedList<>();
+                    for (Map<String, Object> map : askGoodsMapper.getReturnWarehouseTransferZ(mapList.get(0).get("warehouseTransferId").toString(), warehouseWhere)) {
+                        JSONObject BillItems = new JSONObject();
+                        BillItems.put("WMSItemID", map.get("id"));//分录ID
+                        BillItems.put("GMReqBillID", map.get("warehouseTransferId"));//移库通知单ID
+                        BillItems.put("GMReqBillItemID", map.get("entryNumber"));//移库通知明细ID
+                        BillItems.put("Material", map.get("materialId"));//物料id
+                        BillItems.put("Quantity", map.get("outNum"));//数量
+                        BillItems.put("FlexField1", map.get("wbsId"));//wbs
+                        BillItems.put("FlexField1Code", map.get("wbsCode"));//WBS编号
+                        BillItems.put("FlexField1Name", map.get("wbsName"));//WBS名称
+                        list.add(BillItems);
+                    }
+                    strJson.put("BillItems", list);
+                    retunList.add(strJson);
+                }
+            }
+            JSONObject ReqOutStocks = new JSONObject();
+            ReqOutStocks.put("BILLs", retunList);
+            List<JSONObject> retunList1 = new LinkedList<>();
+            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/CreateGMReqOutStock", 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/CreateGMReqOutStock");
+                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/CreateGMReqOutStock");
+                    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("FromWareHouse").toString().equals(map.get("FromWareHouse"))) {
+                                    //如果失败存入报错信息跟数据
+                                    error.setErrorInfo(map.get("FailReason").toString());
+                                    error.setUrl("http://42.159.85.29:52480/cwbase/sg/V1/ERP/TELD/DEVTEST/API_WMS_PurInStock/CreateGMReqOutStock");
+                                    error.setDataVal(jsonObject2.toString());
+                                    errorMapper.addError(error);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+            //删除父子表信息
+            //根据code
+//            askGoodsMapper.delReturnWarehouseTransfer(removalCode);
+//            //根据id
+//            askGoodsMapper.delReturnWarehouseTransferZ(warehouseTransferTd);
+            //添加记录到tld_access
+            String names = "出库回传";
+            String accessType = "1";
+            String returnGsRemoval = returnData.toString();
+            askGoodsMapper.addAccess(names, returnGsRemoval, accessType);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+    }
+
     /**
      * 出库单生成
      * @return

+ 85 - 38
src/main/java/com/tld/service/impl/DictionaryServiceImpl.java

@@ -43,10 +43,10 @@ public class DictionaryServiceImpl implements DictionaryService {
     @Transactional(rollbackFor = Exception.class)
     public Map<String, Object> addDictionary(List<Dictionary> dictionarys) {
         Map<String, Object> map = new HashMap<>();
-        boolean flg = false ;
-        try{
-            for(Dictionary dictionary : dictionarys) {
-                if(dictionary.getType().equals("") || dictionary.getType() == null){
+        boolean flg = false;
+        try {
+            for (Dictionary dictionary : dictionarys) {
+                if (dictionary.getType().equals("") || dictionary.getType() == null) {
                     map.put("status", "0002");
                     map.put("msg", "类型不存在请检查");
                     return map;
@@ -65,17 +65,17 @@ public class DictionaryServiceImpl implements DictionaryService {
                     if (dictionary.getType().equals("物料字典")) {
                         dictionaryMapper.addMaterial(dictionary);
                     } else if (dictionary.getType().equals("库账对存")) {
-                        if (!flg){
-                            flg = true ;
+                        if (!flg) {
+                            flg = true;
                             dictionaryMapper.deleteRepertory(dictionary);
                         }
                         dictionaryMapper.addTreasuryAccount(dictionary);
-                    }else if (dictionary.getType().equals("仓库")){
+                    } else if (dictionary.getType().equals("仓库")) {
                         //添加库位信息
-                        String storageLocationCode = "XNKW"+snowflakeUtil.nextId()+"" ; // XN+雪花算法
+                        String storageLocationCode = "XNKW" + snowflakeUtil.nextId() + ""; // XN+雪花算法
                         String warehouseWhere = dictionary.getTldId();// tldId
-                        String storageLocationName = dictionary.getName()+"虚拟库位" ;// 仓库名称+虚拟库位
-                        dictionaryMapper.addStorageLocation(storageLocationCode,warehouseWhere,storageLocationName);
+                        String storageLocationName = dictionary.getName() + "虚拟库位";// 仓库名称+虚拟库位
+                        dictionaryMapper.addStorageLocation(storageLocationCode, warehouseWhere, storageLocationName);
                         dictionaryMapper.addDictionary(dictionary);
                     } else {
                         dictionaryMapper.addDictionary(dictionary);
@@ -86,8 +86,8 @@ public class DictionaryServiceImpl implements DictionaryService {
             Access access = new Access().setType("字典信息").setData(JSON.toJSONString(dictionarys)).setAccessType("0");
             dictionaryMapper.addAccess(access);
             map.put("status", "0000");
-            map.put("msg","成功");
-        }  catch (Exception e){
+            map.put("msg", "成功");
+        } catch (Exception e) {
             e.printStackTrace();
             map.put("status", "0009");
             map.put("msg", "服务器请求异常,请稍后再试");
@@ -98,8 +98,8 @@ public class DictionaryServiceImpl implements DictionaryService {
     @Override
     public Map<String, Object> getDictionary(Dictionary dictionary) {
         Map<String, Object> map = new HashMap<>();
-        try{
-            if(dictionary.getType().equals("") || dictionary.getType() == null){
+        try {
+            if (dictionary.getType().equals("") || dictionary.getType() == null) {
                 map.put("msg", "500");
                 map.put("errMsg", "类型不存在请检查");
                 return map;
@@ -119,7 +119,7 @@ public class DictionaryServiceImpl implements DictionaryService {
 //            }
             map.put("msg", "200");
             map.put("data", list);
-        }  catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
             map.put("msg", "500");
             map.put("errMsg", "失败");
@@ -127,11 +127,14 @@ public class DictionaryServiceImpl implements DictionaryService {
         return map;
     }
 
+    /**
+     * 查询字典分页内容
+     */
     @Override
     public Map<String, Object> getDictionaryPage(Dictionary dictionary) {
         Map<String, Object> map = new HashMap<>();
-        try{
-            if(dictionary.getType().equals("") || dictionary.getType() == null){
+        try {
+            if (dictionary.getType().equals("") || dictionary.getType() == null) {
                 map.put("msg", "500");
                 map.put("errMsg", "类型不存在请检查");
                 return map;
@@ -139,11 +142,14 @@ public class DictionaryServiceImpl implements DictionaryService {
             Map<String, Object> amountMap = new HashMap<>();
             String tableName = dictionaryMapper.getTableName(dictionary.getType());
             dictionary.setTableName(tableName);
-            PageInfo<Dictionary> list = null ;
-            if (tableName.equals("tld_material")){//物料字典
-                PageHelper.startPage(dictionary.getPage(),dictionary.getLimit());
+            PageInfo<Dictionary> list = null;
+            if (tableName.equals("tld_material")) {//物料字典
+                PageHelper.startPage(dictionary.getPage(), dictionary.getLimit());
                 list = new PageInfo<>(dictionaryMapper.getDictionaryPageMaterial(dictionary));
-            }else {
+            } else if (tableName.equals("tld_warehouse")) {
+                PageHelper.startPage(dictionary.getPage(), dictionary.getLimit());
+                list = new PageInfo<>(dictionaryMapper.getDictionaryPageWarehouse(dictionary));
+            } else {
                 PageHelper.startPage(dictionary.getPage(), dictionary.getLimit());
                 list = new PageInfo<>(dictionaryMapper.getDictionaryPage(dictionary));
             }
@@ -159,7 +165,7 @@ public class DictionaryServiceImpl implements DictionaryService {
 //            }
             map.put("msg", "200");
             map.put("data", list);
-        }  catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
             map.put("msg", "500");
             map.put("errMsg", "失败");
@@ -170,8 +176,8 @@ public class DictionaryServiceImpl implements DictionaryService {
     @Override
     public Map<String, Object> updateDictionary(Dictionary dictionary, HttpServletRequest request) {
         Map<String, Object> map = new HashMap<>();
-        try{
-            if(dictionary.getType().equals("") || dictionary.getType() == null){
+        try {
+            if (dictionary.getType().equals("") || dictionary.getType() == null) {
                 map.put("msg", "500");
                 map.put("errMsg", "类型不存在请检查");
                 return map;
@@ -192,7 +198,7 @@ public class DictionaryServiceImpl implements DictionaryService {
                 dictionaryMapper.updateDictionary(dictionary);
             }
             map.put("msg", "200");
-        }  catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
             map.put("msg", "500");
             map.put("errMsg", "失败");
@@ -203,8 +209,8 @@ public class DictionaryServiceImpl implements DictionaryService {
     @Override
     public Map<String, Object> deleteDictionary(Dictionary dictionary, HttpServletRequest request) {
         Map<String, Object> map = new HashMap<>();
-        try{
-            if(dictionary.getType().equals("") || dictionary.getType() == null){
+        try {
+            if (dictionary.getType().equals("") || dictionary.getType() == null) {
                 map.put("msg", "500");
                 map.put("errMsg", "类型不存在请检查");
                 return map;
@@ -226,7 +232,7 @@ public class DictionaryServiceImpl implements DictionaryService {
             dictionaryMapper.addLogdata(logData);
             dictionaryMapper.deleteDictionary(dictionary);
             map.put("msg", "200");
-        }  catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
             map.put("msg", "500");
             map.put("errMsg", "失败");
@@ -237,8 +243,8 @@ public class DictionaryServiceImpl implements DictionaryService {
     @Override
     public Map<String, Object> addDiction(Dictionary dictionary, HttpServletRequest request) {
         Map<String, Object> map = new HashMap<>();
-        try{
-            if(dictionary.getType().equals("") || dictionary.getType() == null){
+        try {
+            if (dictionary.getType().equals("") || dictionary.getType() == null) {
                 map.put("msg", "500");
                 map.put("errMsg", "类型不存在请检查");
                 return map;
@@ -260,7 +266,7 @@ public class DictionaryServiceImpl implements DictionaryService {
                 dictionaryMapper.addDictionary(dictionary);
             }
             map.put("msg", "200");
-        }  catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
             map.put("msg", "500");
             map.put("errMsg", "失败");
@@ -270,21 +276,21 @@ public class DictionaryServiceImpl implements DictionaryService {
 
     /**
      * 物料字典导出
-     * */
+     */
     @Override
     public void export(Dictionary dictionary, HttpServletResponse response) {
-        try{
+        try {
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
             List<Object> head =
-                    Arrays.asList("物料编号", "物料名称", "物料类别","物料类型","存储容量","最大存储容量","最小存储容量","是否混合存储","是否推荐库位");
+                    Arrays.asList("物料编号", "物料名称", "物料类别", "物料类型", "存储容量", "最大存储容量", "最小存储容量", "是否混合存储", "是否推荐库位");
             //查询数据
-            List<Map<String,Object>> list = dictionaryMapper.export(dictionary);
+            List<Map<String, Object>> list = dictionaryMapper.export(dictionary);
             sheetDataList.add(head);
-            for(Map<String, Object> userMap : list){
+            for (Map<String, Object> userMap : list) {
                 List<Object> listSheet = new ArrayList<>();
-                for(String key: userMap.keySet()){
+                for (String key : userMap.keySet()) {
                     listSheet.add(userMap.get(key));
                 }
                 sheetDataList.add(listSheet);
@@ -293,7 +299,48 @@ public class DictionaryServiceImpl implements DictionaryService {
             Date time = new Date();
             SimpleDateFormat sdf = new SimpleDateFormat("yyyyMddHHmmss");
             ExcelUtils.export(response, "物料字典导出" + sdf.format(time), sheetDataList);
-        }catch (Exception e){
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 字典导出
+     */
+    @Override
+    public void dictionariesExport(Dictionary dictionary, HttpServletResponse response) {
+        try {
+            String tableName = dictionaryMapper.getTableName(dictionary.getType());
+            dictionary.setTableName(tableName);
+            //导出数据汇总
+            List<List<Object>> sheetDataList = new ArrayList<>();
+            List<Object> head = null;
+            List<Map<String, Object>> list = null;
+            if (tableName.equals("tld_warehouse")) {//仓库字典
+                //表头数据
+                head = Arrays.asList("编号", "名称", "GSID", "仓库类型");
+                //查询数据
+                list = dictionaryMapper.warehouseExport(dictionary);
+                sheetDataList.add(head);
+            } else {//其他字典导出
+                //表头数据
+                head = Arrays.asList("编号", "名称", "GSID");
+                //查询数据
+                list = dictionaryMapper.elseExport(dictionary);
+                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();
         }
     }

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

@@ -3,6 +3,7 @@ package com.tld.service.impl;
 import com.alibaba.fastjson.JSON;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import com.tld.excel.ExcelUtils;
 import com.tld.mapper.DictionaryMapper;
 import com.tld.mapper.ReceiveGoodsMapper;
 import com.tld.model.Access;
@@ -14,6 +15,8 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.text.SimpleDateFormat;
 import java.util.*;
 
 @Service
@@ -25,6 +28,9 @@ public class ReceiveGoodsSerivceImpl implements ReceiveGoodsSerivce {
     private DictionaryMapper dictionaryMapper;
 
 
+    /**
+     * 查询采购单
+     * */
     @Override
     public Map<String, Object> getReceiveGoods(ReceiveGoods receiveGoods) {
         Map<String, Object> map = new HashMap<>();
@@ -41,6 +47,9 @@ public class ReceiveGoodsSerivceImpl implements ReceiveGoodsSerivce {
         return map;
     }
 
+    /**
+     * 查询超时采购单
+     * */
     @Override
     public Map<String, Object> getPastReceiveGoods(ReceiveGoods receiveGoods) {
         Map<String, Object> map = new HashMap<>();
@@ -162,6 +171,9 @@ public class ReceiveGoodsSerivceImpl implements ReceiveGoodsSerivce {
         return map;
     }
 
+    /**
+     * 查询采购单
+     * */
     @Override
     public Map<String, Object> getPurchase(ReceiveGoods receiveGoods) {
         Map<String, Object> map = new HashMap<>();
@@ -178,6 +190,9 @@ public class ReceiveGoodsSerivceImpl implements ReceiveGoodsSerivce {
         return map;
     }
 
+    /**
+     * 查询超市采购单
+     * */
     @Override
     public Map<String, Object> timeoutPurchase(ReceiveGoods receiveGoods) {
         Map<String, Object> map = new HashMap<>();
@@ -216,4 +231,62 @@ public class ReceiveGoodsSerivceImpl implements ReceiveGoodsSerivce {
         }
         return map;
     }
+
+    /**
+     * 采购单导出
+     * */
+    @Override
+    public void purchaseExport(ReceiveGoods receiveGoods, HttpServletResponse response) {
+        try{
+            //导出数据汇总
+            List<List<Object>> sheetDataList = new ArrayList<>();
+            //表头数据
+            List<Object> head = Arrays.asList("采购单号", "物料编号", "物料名称","供应商名称","到货数量", "到货时间");
+            //查询数据
+            List<Map<String, Object>> list = receiveGoodsMapper.purchaseExport(receiveGoods);
+            sheetDataList.add(head);
+            for(Map<String, Object> userMap : list){
+                List<Object> listSheet = new ArrayList<>();
+                for(String key: userMap.keySet()){
+                    listSheet.add(userMap.get(key));
+                }
+                sheetDataList.add(listSheet);
+            }
+            //当前时间
+            Date time = new Date();
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMddHHmmss");
+            ExcelUtils.export(response, "采购单导出" + sdf.format(time), sheetDataList);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 超时采购单导出
+     * */
+    @Override
+    public void overtimePurchaseExport(ReceiveGoods receiveGoods, HttpServletResponse response) {
+        try{
+            //导出数据汇总
+            List<List<Object>> sheetDataList = new ArrayList<>();
+            //表头数据
+            List<Object> head = Arrays.asList("采购单号", "物料编号", "物料名称","供应商名称","到货数量", "到货时间");
+            //查询数据
+            List<Map<String, Object>> list = receiveGoodsMapper.overtimePurchaseExport(receiveGoods);
+            sheetDataList.add(head);
+            for(Map<String, Object> userMap : list){
+                List<Object> listSheet = new ArrayList<>();
+                for(String key: userMap.keySet()){
+                    listSheet.add(userMap.get(key));
+                }
+                sheetDataList.add(listSheet);
+            }
+            //当前时间
+            Date time = new Date();
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMddHHmmss");
+            ExcelUtils.export(response, "采购单导出" + sdf.format(time), sheetDataList);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
 }

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

@@ -260,8 +260,8 @@ public class WarehousingServiceImpl implements WarehousingService {
                 BillItems.put("Material", returnWarehousing.getMaterialId());//物料id
                 BillItems.put("Quantity", returnWarehousing.getWarehousingNum());//入库数量
                 BillItems.put("FlexField1", returnWarehousing.getWbs());//wbs
-                BillItems.put("FlexField1Code", " ");//WBS编号
-                BillItems.put("FlexField1Name", " ");//WBS名称
+                BillItems.put("FlexField1Code",returnWarehousing.getWbsCode());//WBS编号
+                BillItems.put("FlexField1Name", returnWarehousing.getWbsName());//WBS名称
                 List<JSONObject> list = new LinkedList<>();
                 list.add(BillItems);
                 strJson.put("BillItems", list);

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

@@ -316,10 +316,14 @@
             a.num,
             a.entry_number AS entryNumber,
             a.document_id AS askGoodsId,
-            a.document_points_id AS askId
+            a.document_points_id AS askId,
+            ifnull(a.wbs, '')       as wbsId,
+            ifnull(c.code, '')      as wbsCode,
+            ifnull(c.name, '')      as wbsName
         FROM
             tld_return_gs_removal_z a
             join tld_storage_location b on a.storage_location_code = b.storage_location_code
+            left join tld_wbs c on a.wbs = c.tld_id
         WHERE
             a.document_id = #{askGoodsId} and b.warehouse_where = #{warehouseWhere}
     </select>
@@ -712,8 +716,60 @@
             scrq
         from tld_return_gs_removal where document_id = #{removalCode}
     </select>
+    <!--查询移库子表中的供货仓库仓库-->
+    <select id="getSupplyWarehouseWhere" resultType="java.lang.String">
+        SELECT
+            supply_warehouse_id
+        FROM
+            tld_return_warehouse_transfer_z
+        WHERE
+            warehouse_transfer_id = #{removalCode}
+        GROUP BY
+            supply_warehouse_id
+    </select>
+    <!--查询移库父表信息-->
+    <select id="getReturnWarehouseTransfer" resultType="java.util.Map">
+        select
+            id,
+            warehouse_transfer_id as warehouseTransferId,
+            warehouse_transfer_code as warehouseTransferCode,
+            ask_goods_warehouse_id as askGoodsWarehouseId,
+            warehouse_transfer_type as warehouseTransferType,
+            scrq
+        from tld_return_warehouse_transfer
+        where warehouse_transfer_code = #{removalCode}
+    </select>
+    <!--查询出父表中的移库id根据code-->
+    <select id="getSupplyWarehouseWheres" resultType="java.lang.String">
+        select warehouse_transfer_id as warehouseTransferId from tld_return_warehouse_transfer where warehouse_transfer_code = #{removalCode}
+    </select>
+    <!--查询移库子表信息-->
+    <select id="getReturnWarehouseTransferZ" resultType="java.util.Map">
+        select a.id,
+               a.warehouse_transfer_id as warehouseTransferId,
+               a.entry_number          as entryNumber,
+               a.supply_warehouse_id   as supplyWarehouseId,
+               a.material_id           as materialId,
+               ifnull(a.wbs, '')       as wbsId,
+               a.out_num               as outNum,
+               ifnull(b.code, '')      as wbsCode,
+               ifnull(b.name, '')      as wbsName
+        from tld_return_warehouse_transfer_z a
+                 left join tld_wbs b on a.wbs = b.tld_id
+        where a.warehouse_transfer_id = #{warehouseTransferId}
+          and a.supply_warehouse_id = #{warehouseWhere}
+    </select>
     <!-- 删除生产领料 -->
     <delete id="delAskGoods">
         delete from tld_ask_goods where id = #{id}
     </delete>
+    <!--删除移库父表-->
+    <delete id="delReturnWarehouseTransfer">
+        delete from tld_return_warehouse_transfer where warehouse_transfer_code = #{removalCode}
+    </delete>
+    <!--删除移库子表-->
+    <delete id="delReturnWarehouseTransferZ">
+        delete from tld_return_warehouse_transfer_z where warehouse_transfer_id = #{warehouseTransferTd}
+    </delete>
+
 </mapper>

+ 119 - 2
src/main/resources/mapper/DictionaryMapper.xml

@@ -63,7 +63,7 @@
                 and is_recommend = #{isRecommend}
             </if>
             <if test="tldId != null and tldId != ''">
-                and tld_id = #{tldId}
+                and tld_id like CONCAT(CONCAT('%', #{tldId}), '%')
             </if>
             <if test="typeVal != null and typeVal != ''">
                 and type = #{typeVal}
@@ -187,7 +187,7 @@
                 and a.is_recommend = #{isRecommend}
             </if>
             <if test="tldId != null and tldId != ''">
-                and a.tld_id = #{tldId}
+                and a.tld_id like CONCAT(CONCAT('%', #{tldId}), '%')
             </if>
             <if test="typeVal != null and typeVal != ''">
                 and a.type = #{typeVal}
@@ -195,6 +195,123 @@
         </trim>
         order by a.id desc
     </select>
+    <!--查询仓库字典分页内容-->
+    <select id="getDictionaryPageWarehouse" resultType="com.tld.model.Dictionary">
+        select
+        a.id,
+        a.code,
+        a.name,
+        a.tld_id,
+        a.type,
+        case a.warehouse_type when '0' then '原材料仓库' when '1' then '半成品仓库' when '2' then '产成品仓库'
+        else null
+        end as warehouseType
+        from tld_warehouse a
+        <trim prefix="WHERE" prefixOverrides="and |or">
+            <if test="name != null and name != ''">
+                and a.name like CONCAT(CONCAT('%', #{name}), '%')
+            </if>
+            <if test="code != null and code != ''">
+                and a.code like CONCAT(CONCAT('%', #{code}), '%')
+            </if>
+            <if test="wllbClass != null and wllbClass != ''">
+                and a.wllb_class like CONCAT(CONCAT('%', #{wllbClass}), '%')
+            </if>
+            <if test="materialType != null and materialType != ''">
+                and a.part_type like CONCAT(CONCAT('%', #{materialType}), '%')
+            </if>
+            <if test="isNotDisable != null and isNotDisable != ''">
+                and a.is_not_disable = #{isNotDisable}
+            </if>
+            <if test="warehouseType != null and warehouseType != ''">
+                and a.warehouse_type = #{warehouseType}
+            </if>
+            <if test="isRecommend != null and isRecommend != ''">
+                and a.is_recommend = #{isRecommend}
+            </if>
+            <if test="tldId != null and tldId != ''">
+                and a.tld_id like CONCAT(CONCAT('%', #{tldId}), '%')
+            </if>
+            <if test="typeVal != null and typeVal != ''">
+                and a.type = #{typeVal}
+            </if>
+        </trim>
+        order by a.id desc
+    </select>
+    <!--导出其他字典-->
+    <select id="elseExport" resultType="java.util.LinkedHashMap">
+        select
+        code,
+        name,
+        tld_id
+        from ${tableName}
+        <trim prefix="WHERE" prefixOverrides="and |or">
+            <if test="name != null and name != ''">
+                and name like CONCAT(CONCAT('%', #{name}), '%')
+            </if>
+            <if test="code != null and code != ''">
+                and code like CONCAT(CONCAT('%', #{code}), '%')
+            </if>
+            <if test="wllbClass != null and wllbClass != ''">
+                and wllb_class like CONCAT(CONCAT('%', #{wllbClass}), '%')
+            </if>
+            <if test="materialType != null and materialType != ''">
+                and part_type like CONCAT(CONCAT('%', #{materialType}), '%')
+            </if>
+            <if test="isNotDisable != null and isNotDisable != ''">
+                and is_not_disable = #{isNotDisable}
+            </if>
+            <if test="isRecommend != null and isRecommend != ''">
+                and is_recommend = #{isRecommend}
+            </if>
+            <if test="tldId != null and tldId != ''">
+                and tld_id like CONCAT(CONCAT('%', #{tldId}), '%')
+            </if>
+            <if test="typeVal != null and typeVal != ''">
+                and type = #{typeVal}
+            </if>
+        </trim>
+        order by id desc
+    </select>
+    <!--仓库字典导出-->
+    <select id="warehouseExport" resultType="java.util.LinkedHashMap">
+        select
+        code,
+        name,
+        tld_id,
+        case warehouse_type when '0' then '原材料仓库' when '1' then '半成品仓库' when '2' then '产成品仓库' else null end
+        from tld_warehouse
+        <trim prefix="WHERE" prefixOverrides="and |or">
+            <if test="name != null and name != ''">
+                and name like CONCAT(CONCAT('%', #{name}), '%')
+            </if>
+            <if test="code != null and code != ''">
+                and code like CONCAT(CONCAT('%', #{code}), '%')
+            </if>
+            <if test="wllbClass != null and wllbClass != ''">
+                and wllb_class like CONCAT(CONCAT('%', #{wllbClass}), '%')
+            </if>
+            <if test="materialType != null and materialType != ''">
+                and part_type like CONCAT(CONCAT('%', #{materialType}), '%')
+            </if>
+            <if test="isNotDisable != null and isNotDisable != ''">
+                and is_not_disable = #{isNotDisable}
+            </if>
+            <if test="warehouseType != null and warehouseType != ''">
+                and warehouse_type = #{warehouseType}
+            </if>
+            <if test="isRecommend != null and isRecommend != ''">
+                and is_recommend = #{isRecommend}
+            </if>
+            <if test="tldId != null and tldId != ''">
+                and tld_id like CONCAT(CONCAT('%', #{tldId}), '%')
+            </if>
+            <if test="typeVal != null and typeVal != ''">
+                and type = #{typeVal}
+            </if>
+        </trim>
+        order by id desc
+    </select>
     <!-- 修改物料字典内容 -->
     <update id="updateMaterial">
         update tld_material

+ 166 - 60
src/main/resources/mapper/ReceiveGoodsMapper.xml

@@ -5,24 +5,24 @@
     <!-- 查询收货单 -->
     <select id="getReceiveGoods" resultType="com.tld.model.ReceiveGoods">
         select
-            a.id,
-            a.order_code,
-            b.name as materialName,
-            c.name as supplierName,
-            a.purchase_num,
-            a.arrival_num,
-            a.type,
-            a.qualified_num,
-            a.disqualification_num,
-            a.arrival_time,
-            c.code as wllbCode
+        a.id,
+        a.order_code,
+        b.name as materialName,
+        c.name as supplierName,
+        a.purchase_num,
+        a.arrival_num,
+        a.type,
+        a.qualified_num,
+        a.disqualification_num,
+        a.arrival_time,
+        c.code as wllbCode
         from tld_receive_goods a
         left join tld_material b on a.material_id = b.tld_id
         left join tld_customer c on a.supplier_id = c.code
         <trim prefix="WHERE" prefixOverrides="and |or">
-<!--            <if test="materialId != null and materialId != ''">-->
-<!--                and a.material_id = #{materialId}-->
-<!--            </if>-->
+            <!--            <if test="materialId != null and materialId != ''">-->
+            <!--                and a.material_id = #{materialId}-->
+            <!--            </if>-->
             <if test="type != null and type != ''">
                 and a.type = #{type}
             </if>
@@ -36,21 +36,21 @@
                 and a.order_code = #{orderCode}
             </if>
         </trim>
-    order by a.id desc
+        order by a.id desc
     </select>
     <!-- 查询超时采购单 -->
     <select id="getPastReceiveGoods" resultType="com.tld.model.ReceiveGoods">
         select
-            a.id,
-            a.order_code,
-            b.name as materialName,
-            c.name as supplierName,
-            a.purchase_num,
-            a.arrival_num,
-            a.type,
-            a.qualified_num,
-            a.disqualification_num,
-            a.arrival_time
+        a.id,
+        a.order_code,
+        b.name as materialName,
+        c.name as supplierName,
+        a.purchase_num,
+        a.arrival_num,
+        a.type,
+        a.qualified_num,
+        a.disqualification_num,
+        a.arrival_time
         from tld_receive_goods a
         left join tld_material b on a.material_id = b.tld_id
         left join tld_customer c on a.supplier_id = c.code
@@ -62,17 +62,24 @@
     </select>
     <!-- 查询采购父表是否有次采购单的数据 -->
     <select id="getReceiveGoodsf" resultType="int">
-        select count(*) from tld_receive_goods_f where order_code = #{orderCode}
+        select count(*)
+        from tld_receive_goods_f
+        where order_code = #{orderCode}
     </select>
     <!-- 新增采购单信息 -->
     <insert id="addReceiveGoods">
-        insert into tld_receive_goods(order_code,material_id,purchase_num,arrival_num,type,qualified_num,disqualification_num,wbs,arrival_time,measurement_id,supplier_id,entry_number,warehousing_num)
-        values(#{orderCode},#{materialId},#{purchaseNum},#{arrivalNum},#{type},#{qualifiedNum},#{disqualificationNum},#{wbs},#{arrivalTime},#{measurementId},#{supplierId},#{entryNumber},'0');
+        insert into tld_receive_goods(order_code, material_id, purchase_num, arrival_num, type, qualified_num,
+                                      disqualification_num, wbs, arrival_time, measurement_id, supplier_id,
+                                      entry_number, warehousing_num)
+        values (#{orderCode}, #{materialId}, #{purchaseNum}, #{arrivalNum}, #{type}, #{qualifiedNum},
+                #{disqualificationNum}, #{wbs}, #{arrivalTime}, #{measurementId}, #{supplierId}, #{entryNumber}, '0');
     </insert>
     <!-- 新增采购单信息 -->
     <insert id="addReceiveGoodsf">
-        insert into tld_receive_goods_f(order_number,order_code,company_number,supplier_id,arrival_time,order_type,source_type,move_type)
-        values(#{orderNumber},#{orderCode},#{companyNumber},#{supplierId},#{arrivalTime},#{orderType},#{sourceType},#{moveType})
+        insert into tld_receive_goods_f(order_number, order_code, company_number, supplier_id, arrival_time, order_type,
+                                        source_type, move_type)
+        values (#{orderNumber}, #{orderCode}, #{companyNumber}, #{supplierId}, #{arrivalTime}, #{orderType},
+                #{sourceType}, #{moveType})
     </insert>
     <!-- 修改采购单信息 -->
     <update id="updateReceiveGoods">
@@ -121,8 +128,12 @@
     </update>
     <!-- 采购单日志 -->
     <insert id="addReceiveGoodsLog" keyProperty="id" useGeneratedKeys="true">
-        insert into tld_receive_goods_log(order_number, order_code, company_number, supplier_id, arrival_time, order_type, source_type, move_type, material_id, purchase_num, arrival_num, qualified_num, disqualification_num, wbs, measurement_id)
-        values (#{orderNumber}, #{orderCode}, #{companyNumber}, #{supplierId}, #{arrivalTime}, #{orderType}, #{sourceType}, #{moveType}, #{materialId}, #{purchaseNum}, #{arrivalNum}, #{qualifiedNum}, #{disqualificationNum}, #{wbs}, #{measurementId})
+        insert into tld_receive_goods_log(order_number, order_code, company_number, supplier_id, arrival_time,
+                                          order_type, source_type, move_type, material_id, purchase_num, arrival_num,
+                                          qualified_num, disqualification_num, wbs, measurement_id)
+        values (#{orderNumber}, #{orderCode}, #{companyNumber}, #{supplierId}, #{arrivalTime}, #{orderType},
+                #{sourceType}, #{moveType}, #{materialId}, #{purchaseNum}, #{arrivalNum}, #{qualifiedNum},
+                #{disqualificationNum}, #{wbs}, #{measurementId})
     </insert>
     <!-- 新增采购到料大屏信息 -->
     <insert id="addPurchase">
@@ -134,28 +145,39 @@
     </insert>
     <!-- 修改采购到料状态 -->
     <update id="updatePurchaseType">
-        update tld_purchase set type = '1' where order_code = #{orderCode}
+        update tld_purchase
+        set type = '1'
+        where order_code = #{orderCode}
     </update>
     <!-- 查询采购单 -->
     <select id="getPurchase" resultType="com.tld.model.ReceiveGoods">
         select
-            a.id,
-            a.supplier_id,
-            a.order_code,
-            a.material_id,
-            a.purchase_num,
-            a.arrival_num,
-            a.arrival_time,
-            a.type,
-            b.name as materialName,
-            b.code as wllbCode,
-            c.name as supplierName
+        a.id,
+        a.supplier_id,
+        a.order_code,
+        a.material_id,
+        a.purchase_num,
+        a.arrival_num,
+        a.arrival_time,
+        a.type,
+        b.name as materialName,
+        b.code as wllbCode,
+        c.name as supplierName
         from tld_purchase a
         left join tld_material b on a.material_id = b.tld_id
         left join tld_customer c on a.supplier_id = c.code
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="orderCode != null and orderCode != ''">
-                and a.order_code = #{orderCode}
+                and a.order_code like CONCAT(CONCAT('%', #{orderCode}), '%')
+            </if>
+            <if test="supplierId != null and supplierId != ''">
+                and a.supplier_id = #{supplierId}
+            </if>
+            <if test="materialName != null and materialName != ''">
+                and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
+            </if>
+            <if test="wllbCode != null and wllbCode != ''">
+                and b.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
             </if>
             <if test="startTime != null and startTime != ''">
                 and a.arrival_time <![CDATA[>=]]> #{startTime}
@@ -164,28 +186,29 @@
                 and a.arrival_time <![CDATA[<=]]> #{endTime}
             </if>
         </trim>
+        order by a.id desc
     </select>
     <!-- 查询超时采购单 -->
     <select id="timeoutPurchase" resultType="com.tld.model.ReceiveGoods">
         select
-            a.id,
-            a.supplier_id,
-            a.order_code,
-            a.material_id,
-            a.purchase_num,
-            a.arrival_num,
-            a.arrival_time,
-            a.type,
-            b.name as materialName,
-            b.code as wllbCode,
-            c.name as supplierName
+        a.id,
+        a.supplier_id,
+        a.order_code,
+        a.material_id,
+        a.purchase_num,
+        a.arrival_num,
+        a.arrival_time,
+        a.type,
+        b.name as materialName,
+        b.code as wllbCode,
+        c.name as supplierName
         from tld_purchase a
         left join tld_material b on a.material_id = b.tld_id
         left join tld_customer c on a.supplier_id = c.code
         where
-            a.arrival_time <![CDATA[<]]> CURDATE() and a.type = '0'
+        a.arrival_time <![CDATA[<]]> CURDATE() and a.type = '0'
         <if test="orderCode != null and orderCode != ''">
-            and a.order_code = #{orderCode}
+            and a.order_code like CONCAT(CONCAT('%', #{orderCode}), '%')
         </if>
         <if test="startTime != null and startTime != ''">
             and a.arrival_time <![CDATA[>=]]> #{startTime}
@@ -193,13 +216,96 @@
         <if test="endTime != null and endTime != ''">
             and a.arrival_time <![CDATA[<=]]> #{endTime}
         </if>
+        <if test="supplierId != null and supplierId != ''">
+            and a.supplier_id = #{supplierId}
+        </if>
+        <if test="materialName != null and materialName != ''">
+            and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
+        </if>
+        <if test="wllbCode != null and wllbCode != ''">
+            and b.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
+        </if>
+        order by a.id desc
     </select>
     <!-- 查询 原始记录 -->
     <select id="getDelReceiveGoods" resultType="java.util.Map">
-        select * from tld_receive_goods where id = #{id}
+        select *
+        from tld_receive_goods
+        where id = #{id}
+    </select>
+    <!--采购单导出-->
+    <select id="purchaseExport" resultType="java.util.LinkedHashMap">
+        select
+        a.supplier_id,
+        b.code as wllbCode,
+        b.name as materialName,
+        c.name as supplierName,
+        a.arrival_num,
+        a.arrival_time
+        from tld_purchase a
+        left join tld_material b on a.material_id = b.tld_id
+        left join tld_customer c on a.supplier_id = c.code
+        <trim prefix="WHERE" prefixOverrides="and |or">
+            <if test="orderCode != null and orderCode != ''">
+                and a.order_code like CONCAT(CONCAT('%', #{orderCode}), '%')
+            </if>
+            <if test="supplierId != null and supplierId != ''">
+                and a.supplier_id = #{supplierId}
+            </if>
+            <if test="materialName != null and materialName != ''">
+                and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
+            </if>
+            <if test="wllbCode != null and wllbCode != ''">
+                and b.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
+            </if>
+            <if test="startTime != null and startTime != ''">
+                and a.arrival_time <![CDATA[>=]]> #{startTime}
+            </if>
+            <if test="endTime != null and endTime != ''">
+                and a.arrival_time <![CDATA[<=]]> #{endTime}
+            </if>
+        </trim>
+        order by a.id desc
+    </select>
+    <!--超时采购单导出-->
+    <select id="overtimePurchaseExport" resultType="java.util.LinkedHashMap">
+        select
+        a.supplier_id,
+        b.code as wllbCode,
+        b.name as materialName,
+        c.name as supplierName,
+        a.arrival_num,
+        a.arrival_time
+        from tld_purchase a
+        left join tld_material b on a.material_id = b.tld_id
+        left join tld_customer c on a.supplier_id = c.code
+        where
+        a.arrival_time <![CDATA[<]]> CURDATE() and a.type = '0'
+        <if test="orderCode != null and orderCode != ''">
+            and a.order_code like CONCAT(CONCAT('%', #{orderCode}), '%')
+        </if>
+        <if test="startTime != null and startTime != ''">
+            and a.arrival_time <![CDATA[>=]]> #{startTime}
+        </if>
+        <if test="endTime != null and endTime != ''">
+            and a.arrival_time <![CDATA[<=]]> #{endTime}
+        </if>
+        <if test="supplierId != null and supplierId != ''">
+            and a.supplier_id = #{supplierId}
+        </if>
+        <if test="materialName != null and materialName != ''">
+            and b.name like CONCAT(CONCAT('%', #{materialName}), '%')
+        </if>
+        <if test="wllbCode != null and wllbCode != ''">
+            and b.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
+        </if>
+        order by a.id desc
     </select>
     <!-- 删除原始记录 -->
     <delete id="delReceiveGoods">
-        delete from tld_receive_goods where id = #{id}
+        delete
+        from tld_receive_goods
+        where id = #{id}
     </delete>
+
 </mapper>

+ 8 - 1
src/main/resources/mapper/WarehousingMapper.xml

@@ -178,7 +178,14 @@
     </insert>
     <!-- 入库回传 -->
     <select id="getPlugOutWarehousing" resultType="com.tld.model.ReturnWarehousing">
-        select * from tld_return_gs_warehousing where #{orderNumber} LIKE CONCAT('%', CONCAT(order_number, ','), '%')
+        select
+            a.*,
+            ifnull(a.wbs, '')       as wbsId,
+            ifnull(b.code, '')      as wbsCode,
+            ifnull(b.name, '')      as wbsName
+        from tld_return_gs_warehousing a
+        left join tld_wbs b on a.wbs = b.tld_id
+        where #{orderNumber} LIKE CONCAT('%', CONCAT(order_number, ','), '%')
     </select>
     <!-- 查询入库流水 -->
     <select id="warehousingFlowing" resultType="com.tld.model.Storage">