浏览代码

问题修改

xiaochen 2 年之前
父节点
当前提交
e0b82896f4

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

@@ -47,6 +47,10 @@ public class AskGoods implements Serializable {
      * wbs
      */
     private String wbs;
+    /**
+     * wbsName
+     */
+    private String wbsName;
     /**
      * wbs编号
      */

+ 4 - 4
src/main/java/com/tld/model/Delivery.java

@@ -79,6 +79,10 @@ public class Delivery implements Serializable {
      * wbs
      */
     private String wbs;
+    /**
+     * wbsName
+     */
+    private String wbsName;
     /**
      * 计量单位
      */
@@ -143,10 +147,6 @@ public class Delivery implements Serializable {
      * wbs编号
      */
     private String wbsCode;
-    /**
-     * WBS名称
-     */
-    private String wbsName;
     /**
      * 连翻号
      */

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

@@ -76,6 +76,10 @@ public class Inventory implements Serializable {
      * wbs
      */
     private String wbs;
+    /**
+     * wbsName
+     */
+    private String wbsName;
     /**
      * 供应商
      */

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

@@ -87,6 +87,10 @@ public class ReceiveGoods implements Serializable {
      * wbs
      */
     private String wbs;
+    /**
+     * wbsName
+     */
+    private String wbsName;
     /**
      * wbs编号
      */

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

@@ -120,6 +120,10 @@ public class Storage implements Serializable {
      * wbs
      */
     private String wbs;
+    /**
+     * wbsName
+     */
+    private String wbsName;
     /**
      * 公司编号
      */

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

@@ -72,6 +72,10 @@ public class TraceBack implements Serializable {
      * WBS
      */
     private String wbs;
+    /**
+     * WBS
+     */
+    private String wbsName;
     /**
      * 发货数量
      */

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

@@ -78,6 +78,10 @@ public class WarehouseTransfer {
      * wbs
      */
     private String wbs;
+    /**
+     * wbsName
+     */
+    private String wbsName;
     /**
      * 计量单位
      */

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

@@ -461,7 +461,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
-            List<Object> head = Arrays.asList("物料名称", "供应商名称", "连番号", "类型", "出库用户", "领用部门", "库位名称", "出库日期", "出库数量","要货单编号","真实姓名","公司名称");
+            List<Object> head = Arrays.asList("物料名称", "供应商名称", "连番号", "类型", "出库用户", "领用部门", "库位名称", "出库日期", "出库数量","要货单编号","真实姓名","公司名称","WBS","WBS名称");
             //查询数据
             List<Map<String, Object>> list = askGoodsMapper.export(askGoods);
             sheetDataList.add(head);
@@ -555,7 +555,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
-            List<Object> head = Arrays.asList("要货单", "出库编号","物料编号","物料名称", "出库数量", "出库人", "领用部门", "WBS编号", "出库时间","真实姓名","所属公司");
+            List<Object> head = Arrays.asList("要货单", "出库编号","物料编号","物料名称", "出库数量", "出库人", "领用部门", "WBS编号","WBS名称", "出库时间","真实姓名","所属公司");
             //查询数据
             List<Map<String, Object>> list = askGoodsMapper.getRemovalHalfProductExcel(askGoods);
             sheetDataList.add(head);
@@ -598,7 +598,7 @@ public class AskGoodsServiceImpl implements AskGoodsService {
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
-            List<Object> head = Arrays.asList("交货单编号","物料名称", "出库数量", "用户名称", "出库时间", "公司名称", "客户名称", "出库单编号", "WBS","真实姓名");
+            List<Object> head = Arrays.asList("交货单编号","物料名称", "出库数量", "用户名称", "出库时间", "公司名称", "客户名称", "出库单编号", "WBS","WBS名称","真实姓名");
             //查询数据
             List<Map<String, Object>> list = askGoodsMapper.getRemovalHalfExcel(askGoods);
             sheetDataList.add(head);

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

@@ -105,7 +105,7 @@ public class QueryListServiceImpl implements QueryListService {
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
-            List<Object> head = Arrays.asList("会计年度", "会计期间", "仓库编号", "仓库名称", "库位名称", "物料编号", "物料名称", "主计量单位", "库存数量", "WBS编号", "安全库存", "库龄(天)", "核算分类名称", "物料分类名称", "公司编号", "所属公司");
+            List<Object> head = Arrays.asList("会计年度", "会计期间", "仓库编号", "仓库名称", "库位名称", "物料编号", "物料名称", "主计量单位", "库存数量", "WBS编号","WBS名称", "安全库存", "库龄(天)", "核算分类名称", "物料分类名称", "公司编号", "所属公司");
             //查询数据
             List<Map<String, Object>> list = queryListMapper.getStorageLocation(inventory);
             sheetDataList.add(head);
@@ -167,7 +167,7 @@ public class QueryListServiceImpl implements QueryListService {
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
-            List<Object> head = Arrays.asList("生产订单号", "要货数量", "已出库数量", "物料名称", "物料编号", "要料单编号","WBS编号", "公司编号","公司名称");
+            List<Object> head = Arrays.asList("生产订单号", "要货数量", "已出库数量", "物料名称", "物料编号", "要料单编号","WBS","WBS名称", "公司编号","公司名称");
             //查询数据
             List<Map<String, Object>> list = queryListMapper.getAskGoodsExcel(askGoods);
             sheetDataList.add(head);
@@ -213,7 +213,7 @@ public class QueryListServiceImpl implements QueryListService {
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
-            List<Object> head = Arrays.asList("生产领料单", "物料ID", "要货数量", "已出库数量", "物料名称", "物料编号", "要料单编号", "WBS编号" ,"公司编号","公司名称");
+            List<Object> head = Arrays.asList("生产领料单", "物料ID", "要货数量", "已出库数量", "物料名称", "物料编号", "要料单编号", "WBS" ,"WBS名称" ,"公司编号","公司名称");
             //查询数据
             List<Map<String, Object>> list = queryListMapper.getInviteExcel(askGoods);
             sheetDataList.add(head);
@@ -259,7 +259,7 @@ public class QueryListServiceImpl implements QueryListService {
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
-            List<Object> head = Arrays.asList("销售单编号", "物料ID", "WBS", "交货数量", "取消数量", "出库数量", "公司名称", "销售日期", "物料名称", "物料编号","客户名称","来源类型","移动类型","交货类型","分录号");
+            List<Object> head = Arrays.asList("销售单编号", "物料ID", "WBS","WBS名称", "交货数量", "取消数量", "出库数量", "公司名称", "销售日期", "物料名称", "物料编号","客户名称","来源类型","移动类型","交货类型","分录号");
             //查询数据
             List<Map<String, Object>> list = queryListMapper.getDeliveryExcel(delivery);
             sheetDataList.add(head);
@@ -304,7 +304,7 @@ public class QueryListServiceImpl implements QueryListService {
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
-            List<Object> head = Arrays.asList("移库单ID", "移库单编号", "物料名称", "物料编号", "WBS", "移库数量", "已移库数量", "要货仓库", "出货仓库", "单据日期");
+            List<Object> head = Arrays.asList("移库单ID", "移库单编号", "物料名称", "物料编号", "WBS","WBS名称", "移库数量", "已移库数量", "要货仓库", "出货仓库", "单据日期");
             //查询数据
             List<Map<String, Object>> list = queryListMapper.getWarehouseTransferExcel(warehouseTransfer);
             sheetDataList.add(head);
@@ -384,7 +384,7 @@ public class QueryListServiceImpl implements QueryListService {
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
-            List<Object> head = Arrays.asList("物料编号", "物料名称", "库位名称","所属公司","供应商", "WBS编号", "数量", "入库时间");
+            List<Object> head = Arrays.asList("物料编号", "物料名称", "库位名称","所属公司","供应商", "WBS编号","WBS名称", "数量", "入库时间");
             //查询数据
             List<Map<String, Object>> list = queryListMapper.dullGoodsExport(inventory);
             sheetDataList.add(head);

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

@@ -73,7 +73,7 @@ public class TraceBackServiceImpl implements TraceBackService {
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
             List<Object> head = Arrays.asList("交货单号(发货任务号)", "发货日期", "订单类型", "销售订单编号", "负责子公司", "销售公司编号",
-                    "销售部门名称", "客户名称", "商机编号", "商机名称", "电站名称", "物料编号", "物料名称", "WBS编号", "发货数量", "省", "市", "详细地址");
+                    "销售部门名称", "客户名称", "商机编号", "商机名称", "电站名称", "物料编号", "物料名称", "WBS","WBS名称", "发货数量", "省", "市", "详细地址");
             //查询数据
             List<Map<String, Object>> list = traceBackMapper.export(traceBack);
             sheetDataList.add(head);

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

@@ -383,7 +383,7 @@ public class WarehousingServiceImpl implements WarehousingService {
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
-            List<Object> head = Arrays.asList("物料名称", "物料编号", "供应商", "连番号", "生产批次", "入库数量", "类型", "工号", "库位名称", "入库日期", "入库单编号", "WBS编号","姓名","采购订单号", "所属公司", "公司编号" ,"采购数量");
+            List<Object> head = Arrays.asList("物料名称", "物料编号", "供应商", "连番号", "生产批次", "入库数量", "类型", "工号", "库位名称", "入库日期", "入库单编号", "WBS编号","WBS名称","姓名","采购订单号", "所属公司", "公司编号" ,"采购数量");
             //查询数据
             List<Map<String, Object>> list = new ArrayList<>(warehousingMapper.export(storage));
             sheetDataList.add(head);
@@ -434,7 +434,7 @@ public class WarehousingServiceImpl implements WarehousingService {
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
-            List<Object> head = Arrays.asList("生产订单号", "报工单号", "物料编号", "物料名称", "数量", "已入库数量", "报工时间", "分录号", "所属公司", "公司编号", "WBS", "移动类型", "来源类型", "状态");
+            List<Object> head = Arrays.asList("生产订单号", "报工单号", "物料编号", "物料名称", "数量", "已入库数量", "报工时间", "分录号", "所属公司", "公司编号", "WBS", "WBS名称", "移动类型", "来源类型", "状态");
             //查询数据
             List<Map<String, Object>> list = new ArrayList<>(warehousingMapper.exportNotice(notice));
             sheetDataList.add(head);
@@ -621,7 +621,7 @@ public class WarehousingServiceImpl implements WarehousingService {
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
-            List<Object> head = Arrays.asList("物料名称", "物料编号", "生产批次", "入库数量", "工号", "入库时间", "入库编号", "WBS编号","姓名","生产订单号","所属公司","公司编号");
+            List<Object> head = Arrays.asList("物料名称", "物料编号", "生产批次", "入库数量", "工号", "入库时间", "入库编号", "WBS编号","WBS名称","姓名","生产订单号","所属公司","公司编号");
             //查询数据
             List<Map<String, Object>> list = warehousingMapper.productExcel(notice);
             sheetDataList.add(head);
@@ -866,7 +866,7 @@ public class WarehousingServiceImpl implements WarehousingService {
             //导出数据汇总
             List<List<Object>> sheetDataList = new ArrayList<>();
             //表头数据
-            List<Object> head = Arrays.asList("物料名称", "物料编号", "生产批次", "数量", "工号", "库位名称", "入库时间", "连番号", "属性", "入库单编号", "WBS编号","姓名","生产订单号","所属公司","公司编号");
+            List<Object> head = Arrays.asList("物料名称", "物料编号", "生产批次", "数量", "工号", "库位名称", "入库时间", "连番号", "属性", "入库单编号", "WBS编号", "WBS名称","姓名","生产订单号","所属公司","公司编号");
             //查询数据
             List<Map<String, Object>> list = warehousingMapper.getHalfExcel(notice);
             sheetDataList.add(head);

+ 26 - 9
src/main/resources/mapper/AskGoodsMapper.xml

@@ -60,12 +60,14 @@
                b.move_type,
                a.entry_number,
                a.production_code,
-               a.wbs
+               a.wbs,
+               w.name as wbsName
         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
          left join tld_company g on b.company_number = g.code
+         left join tld_wbs w on a.wbs = w.tld_id
         WHERE (a.num + 0) <![CDATA[>]]> (
             IFNULL(a.out_num, 0) + 0)
           and e.part_type != '半成品' and e.part_type != '产成品'
@@ -485,6 +487,7 @@
             a.num,
             a.storage_code,
             a.wbs,
+            w.name as wbsName,
             a.ask_goods_id,
             c.real_name as realName,
             a.account_sleeve,
@@ -498,6 +501,7 @@
         left join tld_customer h on a.supplier_id = h.code
         left join tld_company f on a.account_sleeve = f.code
         left join tld_ask_goods_f p on a.ask_goods_id = p.ask_goods_id
+        left join tld_wbs w on a.wbs = w.tld_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="startTime != null and startTime != ''">
                 and a.scrq <![CDATA[>=]]> #{startTime}
@@ -539,7 +543,7 @@
                 and p.ask_goods_code like CONCAT(CONCAT('%', #{askGoodsCode}), '%')
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and w.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
             <if test="accountSleeve != null and accountSleeve != ''">
                 and a.account_sleeve = #{accountSleeve}
@@ -561,7 +565,9 @@
             a.num,
             p.ask_goods_code,
             c.real_name,
-            f.name as accountName
+            f.name as accountName,
+            if(a.wbs = '' , null , a.wbs ) as wbs,
+            if(w.name = '' , null , w.name ) as wbsName
         from tld_removal a
         left join tld_material b on a.wllb_code = b.code
         left join tld_user c on a.user_id = c.id
@@ -570,6 +576,7 @@
         left join tld_customer h on a.supplier_id = h.code
         left join tld_company f on a.account_sleeve = f.code
         left join tld_ask_goods_f p on a.ask_goods_id = p.ask_goods_id
+        left join tld_wbs w on a.wbs = w.tld_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="startTime != null and startTime != ''">
                 and a.scrq <![CDATA[>=]]> #{startTime}
@@ -611,7 +618,7 @@
                 and p.ask_goods_code like CONCAT(CONCAT('%', #{askGoodsCode}), '%')
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and w.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
             <if test="accountSleeve != null and accountSleeve != ''">
                 and a.account_sleeve = #{accountSleeve}
@@ -701,6 +708,8 @@
             a.type,
             a.wbs,
             f.name as wbsCode,
+            f.name as wbsName,
+            f.code as wbsCode,
             a.entry_number,
             g.name as companyName,
             c.source_type,
@@ -779,6 +788,7 @@
             b.code as materialCode,
             a.storage_code,
             a.wbs,
+            w.name as wbsName,
             e.real_name as realName,
             a.account_sleeve,
             f.name as accountName,
@@ -789,6 +799,7 @@
         left join tld_user e on a.user_id = e.id
         left join tld_company f on a.account_sleeve = f.code
         left join tld_ask_goods_f p on a.ask_goods_id = p.ask_goods_id
+        left join tld_wbs w on a.wbs = w.tld_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="wllbCode != null and wllbCode != ''">
                 and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
@@ -821,7 +832,7 @@
                 and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and w.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
             <if test="accountSleeve != null and accountSleeve != ''">
                 and a.account_sleeve = #{accountSleeve}
@@ -840,6 +851,7 @@
             e.user_name as userName,
             if(c.name = '' , null , c.name ) as department,
             if(a.wbs = '' , null , a.wbs ) as wbs,
+            if(w.name = '' , null , w.name ) as wbsName,
             a.scrq,
             e.real_name as realName,
             f.name as accountName
@@ -849,6 +861,7 @@
         left join tld_user e on a.user_id = e.id
         left join tld_company f on a.account_sleeve = f.code
         left join tld_ask_goods_f p on a.ask_goods_id = p.ask_goods_id
+        left join tld_wbs w on a.wbs = w.tld_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="wllbCode != null and wllbCode != ''">
                 and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
@@ -881,7 +894,7 @@
                 and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and w.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
             <if test="accountSleeve != null and accountSleeve != ''">
                 and a.account_sleeve = #{accountSleeve}
@@ -908,6 +921,7 @@
             a.serial,
             a.storage_code,
             a.wbs,
+            w.name as wbsName,
             c.real_name as realName,
             p.delivery_code as deliveryCode
         from tld_removal_half a
@@ -916,6 +930,7 @@
         left join tld_customer e on a.customer_code = e.code
         left join tld_company f on a.company_number = f.code
         left join tld_delivery_f p on a.delivery_id = p.delivery_id
+        left join tld_wbs w on a.wbs = w.tld_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="wllbCode != null and wllbCode != ''">
                 and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
@@ -945,7 +960,7 @@
                 and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and w.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
             <if test="startTime != null and startTime != ''">
                 and a.scrq <![CDATA[>=]]> #{startTime}
@@ -970,7 +985,8 @@
             f.name as companyName,
             e.name,
             a.storage_code,
-            a.wbs,
+            if(a.wbs = '' , null , a.wbs ) as wbs,
+            if(w.name = '' , null , w.name ) as wbsName,
             c.real_name as realName
         from tld_removal_half a
         left join tld_material b on a.wllb_code = b.code
@@ -978,6 +994,7 @@
         left join tld_customer e on a.customer_code = e.code
         left join tld_company f on a.company_number = f.code
         left join tld_delivery_f p on a.delivery_id = p.delivery_id
+        left join tld_wbs w on a.wbs = w.tld_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="wllbCode != null and wllbCode != ''">
                 and a.wllb_code like CONCAT(CONCAT('%', #{wllbCode}), '%')
@@ -1007,7 +1024,7 @@
                 and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and w.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
             <if test="startTime != null and startTime != ''">
                 and a.scrq <![CDATA[>=]]> #{startTime}

+ 47 - 21
src/main/resources/mapper/QueryListMappeer.xml

@@ -19,6 +19,7 @@
         c.storage_location_name as storageLocationName,
         b.code as wllbCode,
         a.wbs as wbs,
+        h.name as wbsName,
         e.name as ustomerName,
         a.account_sleeve as accountSleeve,
         f.name as companyName
@@ -27,6 +28,7 @@
         LEFT JOIN tld_storage_location c ON a.storage_location_code = c.storage_location_code
         LEFT JOIN tld_customer e ON a.supplier_id = e.code
         LEFT JOIN tld_company f ON a.account_sleeve = f.code
+        left join tld_wbs h on a.wbs = h.tld_id
         WHERE datediff(now(), a.scrq) <![CDATA[>]]> 90
         <if test="storageLocationCode != null and storageLocationCode != ''">
             and a.storage_location_code = #{storageLocationCode}
@@ -38,7 +40,7 @@
             and b.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
         </if>
         <if test="wbs != null and wbs != ''">
-            and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+            and h.name like CONCAT(CONCAT('%', #{wbs}), '%')
         </if>
         <if test="storageLocationName != null and storageLocationName != ''">
             and c.storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
@@ -92,6 +94,7 @@
             m.name as unitOfMeasurement,
             sum( a.amount ) AS sum,
             a.wbs as wbs,
+            h.name as wbsName,
             c.max_num as maxNum,
             DATEDIFF(now(), scrq) as day,
             c.part_type as partType,
@@ -110,6 +113,7 @@
         LEFT JOIN tld_warehouse f on b.warehouse_where = f.tld_id
         LEFT JOIN tld_company p on a.account_sleeve = p.code
         LEFT JOIN tld_measurement m on c.unit_of_measurement = m.tld_id
+        left join tld_wbs h on a.wbs = h.tld_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="storageLocationCode != null and storageLocationCode != ''">
                 and a.storage_location_code = #{storageLocationCode}
@@ -136,7 +140,7 @@
                 and a.supplier_id like CONCAT(CONCAT('%', #{supplierId}), '%')
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and h.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
             <if test="warehouseId != null and warehouseId != ''">
                 and f.tld_id = #{warehouseId}
@@ -210,7 +214,8 @@
             c.name as name,
             ifnull(c.unit_of_measurement, "暂无单位") as unit_of_measurement,
             sum( a.amount ) AS sum,
-            if(a.wbs = "", " ", a.wbs) as wbs,
+            if(a.wbs = " ", null, a.wbs) as wbs,
+            if(h.name = " ", null, h.name) as wbsName,
             ifnull(c.max_num, 0) as max_num,
             DATEDIFF(now(),scrq) as day,
             ifnull(c.part_type, "暂无分类") as part_type,
@@ -223,6 +228,7 @@
         LEFT JOIN tld_customer e ON a.supplier_id = e.code
         LEFT JOIN tld_warehouse f on b.warehouse_where = f.tld_id
         LEFT JOIN tld_company p on a.account_sleeve = p.code
+        left join tld_wbs h on a.wbs = h.tld_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="storageLocationCode != null and storageLocationCode != ''">
                 and a.storage_location_code = #{storageLocationCode}
@@ -246,7 +252,7 @@
                 and a.supplier_id like CONCAT(CONCAT('%', #{supplierId}), '%')
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and h.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
             <if test="warehouseId != null and warehouseId != ''">
                 and f.tld_id =  #{warehouseId}
@@ -300,13 +306,15 @@
         b.move_type,
         a.entry_number,
         a.production_code,
-        a.wbs
+        a.wbs,
+        w.name as wbsName
         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
         left join tld_company g on b.company_number = g.code
+        left join tld_wbs w on a.wbs = w.tld_id
         /* WHERE e.part_type != '半成品' and e.part_type != '产成品'*/
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="materialCode != null and materialCode != ''">
@@ -337,7 +345,7 @@
                 and a.entry_number like CONCAT(CONCAT('%', #{entryNumber}), '%')
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and  w.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
             <if test="askGoodsCode != null and askGoodsCode != ''">
                 and b.ask_goods_code like CONCAT(CONCAT('%', #{askGoodsCode}), '%')
@@ -357,7 +365,8 @@
             e.NAME AS materialName,
             e.CODE AS materialCode,
             b.ask_goods_code,
-            a.wbs,
+            if(a.wbs = '' , null , a.wbs ) as wbs,
+            if(w.name = '' , null , w.name ) as wbsName,
             b.company_number,
             g.name as companyName
         FROM
@@ -366,6 +375,7 @@
         LEFT JOIN tld_department c ON b.department = c.code
         JOIN tld_material e ON a.material_id = e.tld_id
         left join tld_company g on b.company_number = g.code
+        left join tld_wbs w on a.wbs = w.tld_id
         /*WHERE e.part_type != '半成品' and e.part_type != '产成品'*/
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="materialCode != null and materialCode != ''">
@@ -396,7 +406,7 @@
                 and a.entry_number like CONCAT(CONCAT('%', #{entryNumber}), '%')
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and w.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
             <if test="askGoodsCode != null and askGoodsCode != ''">
                 and b.ask_goods_code like CONCAT(CONCAT('%', #{askGoodsCode}), '%')
@@ -426,13 +436,15 @@
         b.move_type ,
         a.entry_number,
         a.production_code,
-        a.wbs
+        a.wbs,
+        w.name as wbsName
         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
         left join tld_company g on b.company_number = g.code
+        left join tld_wbs w on a.wbs = w.tld_id
         /*WHERE*/
         /*e.part_type != '半成品' and e.part_type != '产成品'*/
         <trim prefix="WHERE" prefixOverrides="and |or">
@@ -464,7 +476,7 @@
                 and a.entry_number like CONCAT(CONCAT('%', #{entryNumber}), '%')
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and w.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
             <if test="askGoodsCode != null and askGoodsCode != ''">
                 and b.ask_goods_code like CONCAT(CONCAT('%', #{askGoodsCode}), '%')
@@ -485,7 +497,8 @@
         e.NAME AS materialName,
         e.CODE AS materialCode,
         b.ask_goods_code,
-        a.wbs,
+        if(a.wbs = '' , null , a.wbs ) as wbs,
+        if(w.name = '' , null , w.name ) as wbsName,
         b.company_number,
         g.name as companyName
         FROM
@@ -494,6 +507,7 @@
         LEFT JOIN tld_department c ON b.department = c.code
         JOIN tld_material e ON a.material_id = e.tld_id
         left join tld_company g on b.company_number = g.code
+        left join tld_wbs w on a.wbs = w.tld_id
         /*WHERE e.part_type != '半成品' and e.part_type != '产成品'*/
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="materialCode != null and materialCode != ''">
@@ -524,7 +538,7 @@
                 and a.entry_number like CONCAT(CONCAT('%', #{entryNumber}), '%')
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and w.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
             <if test="askGoodsCode != null and askGoodsCode != ''">
                 and b.ask_goods_code like CONCAT(CONCAT('%', #{askGoodsCode}), '%')
@@ -542,6 +556,7 @@
         a.delivery_id,
         a.material_id,
         a.wbs,
+        w.name as wbsName,
         a.gs_delivery_num,
         a.gs_cancel_num,
         ifnull(a.out_num, 0) as out_num,
@@ -562,6 +577,7 @@
         join tld_material c on a.material_id = c.tld_id
         left join tld_customer g on b.customer_code = g.code
         left join tld_company v on b.company_number = v.code
+        left join tld_wbs w on a.wbs = w.tld_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="deliveryId != null and deliveryId != ''">
                 and a.delivery_id like CONCAT(CONCAT('%', #{deliveryId}), '%')
@@ -582,7 +598,7 @@
                 and b.bills_time <![CDATA[<=]]> #{endTime}
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and w.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
             <if test="companyNumber != null and companyNumber != ''">
                 and b.company_number = #{companyNumber}
@@ -617,6 +633,7 @@
         b.delivery_code,
         a.material_id,
         if(a.wbs = '', null, a.wbs) as wbs,
+        if(w.name = '' , null , w.name ) as wbsName,
         a.gs_delivery_num,
         a.gs_cancel_num,
         a.out_num,
@@ -634,6 +651,7 @@
         join tld_material c on a.material_id = c.tld_id
         left join tld_customer g on b.customer_code = g.code
         left join tld_company v on b.company_number = v.code
+        left join tld_wbs w on a.wbs = w.tld_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="deliveryId != null and deliveryId != ''">
                 and a.delivery_id like CONCAT(CONCAT('%', #{deliveryId}), '%')
@@ -654,7 +672,7 @@
                 and b.bills_time <![CDATA[<=]]> #{endTime}
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and w.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
             <if test="companyNumber != null and companyNumber != ''">
                 and b.company_number = #{companyNumber}
@@ -685,6 +703,7 @@
         a.supply_warehouse_id,
         a.material_id,
         a.wbs,
+        h.name as wbsName,
         a.num,
         a.out_num,
         a.type,
@@ -704,6 +723,7 @@
         join tld_warehouse e on a.supply_warehouse_id = e.tld_id
         join tld_warehouse f on b.ask_goods_warehouse_id = f.tld_id
         join tld_company k on a.account_sleeve = k.code
+        left join tld_wbs h on a.wbs = h.tld_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="type != null and type != ''">
                 and a.type = #{type}
@@ -739,7 +759,7 @@
                 and a.entry_number like CONCAT(CONCAT('%', #{entryNumber}), '%')
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and h.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
         </trim>
         order by a.id desc
@@ -751,7 +771,8 @@
         b.warehouse_transfer_code,
         c.name as materialName,
         c.code as materialCode,
-        a.wbs,
+        if(a.wbs = '', null, a.wbs) as wbs,
+        if( h.name = '', null,  h.name) as wbsName,
         a.num,
         a.out_num,
         f.name as askGoodsWarehouseaName,
@@ -763,6 +784,7 @@
         join tld_warehouse e on a.supply_warehouse_id = e.tld_id
         join tld_warehouse f on b.ask_goods_warehouse_id = f.tld_id
         join tld_company k on a.account_sleeve = k.code
+        left join tld_wbs h on a.wbs = h.tld_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="type != null and type != ''">
                 and a.type = #{type}
@@ -798,7 +820,7 @@
                 and a.entry_number like CONCAT(CONCAT('%', #{entryNumber}), '%')
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and h.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
         </trim>
         order by a.id desc
@@ -843,7 +865,8 @@
         c.storage_location_name as storageLocationName,
         f.name as companyName,
         e.name as ustomerName,
-        a.wbs as wbs,
+        if(a.wbs = '', null,a.wbs) as wbs,
+        if(h.name = '', null, h.name) as wbsName,
         a.amount as amount,
         a.scrq as scrq
         FROM tld_inventory a
@@ -851,6 +874,7 @@
         LEFT JOIN tld_storage_location c ON a.storage_location_code = c.storage_location_code
         LEFT JOIN tld_customer e ON a.supplier_id = e.code
         LEFT JOIN tld_company f ON a.account_sleeve = f.code
+        left join tld_wbs h on a.wbs = h.tld_id
         WHERE datediff(now(), a.scrq) <![CDATA[>]]> 90
         <if test="storageLocationCode != null and storageLocationCode != ''">
             and a.storage_location_code = #{storageLocationCode}
@@ -862,7 +886,7 @@
             and b.code like CONCAT(CONCAT('%', #{wllbCode}), '%')
         </if>
         <if test="wbs != null and wbs != ''">
-            and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+            and h.name like CONCAT(CONCAT('%', #{wbs}), '%')
         </if>
         <if test="storageLocationName != null and storageLocationName != ''">
             and c.storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
@@ -997,6 +1021,7 @@
             a.entry_number,
             a.material_id,
             a.wbs,
+            g.name as wbsName,
             a.measurement_id,
             a.num,
             a.entry_number,
@@ -1050,7 +1075,7 @@
                 and b.company_number = #{companyNumber}
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and g.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
         </trim>
         order by a.id desc
@@ -1089,6 +1114,7 @@
             a.ask_goods_id,
             a.material_id,
             a.wbs,
+            g.name as wbsName,
             a.measurement_id,
             a.num,
             a.out_num,
@@ -1149,7 +1175,7 @@
                 and b.company_number = #{companyNumber}
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and g.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
         </trim>
         order by a.id desc

+ 5 - 3
src/main/resources/mapper/ReceiveGoodsMapper.xml

@@ -16,11 +16,12 @@
         a.disqualification_num,
         a.arrival_time,
         b.code as wllbCode,
-        g.code as wbs,
+        a.wbs,
+--         g.code as wbs,
         e.company_number as companyNumber,
         e.supplier_id as supplierId,
-        p.name as compName
+        p.name as compName,
+        g.name as wbsName
         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
@@ -56,7 +57,7 @@
                 and a.order_code like CONCAT(CONCAT('%',#{orderCode},'%'))
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%',#{wbs},'%'))
+                and g.name like CONCAT(CONCAT('%',#{wbs},'%'))
             </if>
         </trim>
         order by a.id desc

+ 86 - 82
src/main/resources/mapper/TraceBackMapper.xml

@@ -26,90 +26,92 @@
     <!-- 查询销售发货单 -->
     <select id="getTraceBack" resultType="com.tld.model.TraceBack">
         select
-            id,
-            delivery_order,
-            delivery_time,
-            delivery_type,
-            delivery_code,
-            subsidiary_code as subsidiaryName,
-            delivery_company,
-            delivery_department,
-            customer_name,
-            commercial_opportunity_code,
-            commercial_opportunity_name,
-            power_station_name,
-            material_code,
-            material_name,
-            wbs,
-            num,
-            out_num,
-            province,
-            city,
-            address
-        from tld_trace_back
+            a.id,
+            a.delivery_order,
+            a.delivery_time,
+            a.delivery_type,
+            a.delivery_code,
+            a.subsidiary_code as subsidiaryName,
+            a.delivery_company,
+            a.delivery_department,
+            a.customer_name,
+            a.commercial_opportunity_code,
+            a.commercial_opportunity_name,
+            a.power_station_name,
+            a.material_code,
+            a.material_name,
+            a.wbs,
+            w.name as wbsName,
+            a.num,
+            a.out_num,
+            a.province,
+            a.city,
+            a.address
+        from tld_trace_back a
+        left join tld_wbs w on a.wbs = w.tld_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="id != null and id != ''">
-                and id = #{id}
+                and a.id = #{id}
             </if>
             <if test="deliveryOrder != null and deliveryOrder != ''">
-                and delivery_order like CONCAT(CONCAT('%', #{deliveryOrder}), '%')
+                and a.delivery_order like CONCAT(CONCAT('%', #{deliveryOrder}), '%')
             </if>
             <if test="startTime != null and startTime != ''">
-                and delivery_time <![CDATA[>=]]> #{startTime}
+                and a.delivery_time <![CDATA[>=]]> #{startTime}
             </if>
             <if test="endTime != null and endTime != ''">
-                and delivery_time <![CDATA[<=]]> #{endTime}
+                and a.delivery_time <![CDATA[<=]]> #{endTime}
             </if>
             <if test="deliveryType != null and deliveryType != ''">
-                and delivery_type like CONCAT(CONCAT('%', #{deliveryType}), '%')
+                and a.delivery_type like CONCAT(CONCAT('%', #{deliveryType}), '%')
             </if>
             <if test="deliveryCode != null and deliveryCode != ''">
-                and delivery_code like CONCAT(CONCAT('%', #{deliveryCode}), '%')
+                and a.delivery_code like CONCAT(CONCAT('%', #{deliveryCode}), '%')
             </if>
             <if test="subsidiaryName != null and subsidiaryName != ''">
-                and subsidiary_code = #{subsidiaryName}
+                and a.subsidiary_code = #{subsidiaryName}
             </if>
             <if test="deliveryCompany != null and deliveryCompany != ''">
-                and delivery_company = #{deliveryCompany}
+                and a.delivery_company = #{deliveryCompany}
             </if>
             <if test="deliveryDepartment != null and deliveryDepartment != ''">
-                and delivery_department like CONCAT(CONCAT('%', #{deliveryDepartment}), '%')
+                and a.delivery_department like CONCAT(CONCAT('%', #{deliveryDepartment}), '%')
             </if>
             <if test="customerName != null and customerName != ''">
-                and customer_name like CONCAT(CONCAT('%', #{customerName}), '%')
+                and a.customer_name like CONCAT(CONCAT('%', #{customerName}), '%')
             </if>
             <if test="commercialOpportunityCode != null and commercialOpportunityCode != ''">
-                and commercial_opportunity_code like CONCAT(CONCAT('%', #{commercialOpportunityCode}), '%')
+                and a.commercial_opportunity_code like CONCAT(CONCAT('%', #{commercialOpportunityCode}), '%')
             </if>
             <if test="commercialOpportunityName != null and commercialOpportunityName != ''">
-                and commercial_opportunity_name like CONCAT(CONCAT('%', #{commercialOpportunityName}), '%')
+                and a.commercial_opportunity_name like CONCAT(CONCAT('%', #{commercialOpportunityName}), '%')
             </if>
             <if test="powerStationName != null and powerStationName != ''">
-                and power_station_name like CONCAT(CONCAT('%', #{powerStationName}), '%')
+                and a.power_station_name like CONCAT(CONCAT('%', #{powerStationName}), '%')
             </if>
             <if test="materialCode != null and materialCode != ''">
-                and material_code = #{materialCode}
+                and a.material_code = #{materialCode}
             </if>
             <if test="materialName != null and materialName != ''">
-                and material_name = #{materialName}
+                and a.material_name = #{materialName}
             </if>
             <if test="wbs != null and wbs != ''">
-                and wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and w.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
             <if test="province != null and province != ''">
-                and province like CONCAT(CONCAT('%', #{province}), '%')
+                and a.province like CONCAT(CONCAT('%', #{province}), '%')
             </if>
             <if test="city != null and city != ''">
-                and city like CONCAT(CONCAT('%', #{city}), '%')
+                and a.city like CONCAT(CONCAT('%', #{city}), '%')
             </if>
             <if test="address != null and address != ''">
-                and address like CONCAT(CONCAT('%', #{address}), '%')
+                and a.address like CONCAT(CONCAT('%', #{address}), '%')
             </if>
             <if test="num != null and num != ''">
-                and (num + 0) <![CDATA[>]]> out_num
+                and (a.num + 0) <![CDATA[>]]> a.out_num
             </if>
         </trim>
-        order by id desc
+        order by a.id desc
     </select>
     <!-- 删除交货单 -->
     <delete id="delTraceBack">
@@ -118,88 +120,90 @@
     <!-- 导出查询 -->
     <select id="export" resultType="java.util.LinkedHashMap">
         select
-            delivery_order,
-            delivery_time,
-            delivery_type,
-            delivery_code,
-            subsidiary_code,
-            delivery_company,
-            delivery_department,
-            customer_name,
-            commercial_opportunity_code,
-            commercial_opportunity_name,
-            power_station_name,
-            material_code,
-            material_name,
-            if(wbs = "", " ", wbs) as wbs,
-            num,
-            province,
-            city,
-            address
-        from tld_trace_back
+            a.delivery_order,
+            a.delivery_time,
+            a.delivery_type,
+            a.delivery_code,
+            a.subsidiary_code,
+            a.delivery_company,
+            a.delivery_department,
+            a.customer_name,
+            a.commercial_opportunity_code,
+            a.commercial_opportunity_name,
+            a.power_station_name,
+            a.material_code,
+            a.material_name,
+            if(a.wbs = "", null, a.wbs) as wbs,
+            if(w.name = "", null, w.name) as wbsName,
+            a.num,
+            a.province,
+            a.city,
+            a.address
+        from tld_trace_back a
+        left join tld_wbs w on a.wbs = w.tld_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="id != null and id != ''">
-                and id = #{id}
+                and a.id = #{id}
             </if>
             <if test="deliveryOrder != null and deliveryOrder != ''">
-                and delivery_order like CONCAT(CONCAT('%', #{deliveryOrder}), '%')
+                and a.delivery_order like CONCAT(CONCAT('%', #{deliveryOrder}), '%')
             </if>
             <if test="startTime != null and startTime != ''">
-                and delivery_time <![CDATA[>=]]> #{startTime}
+                and a.delivery_time <![CDATA[>=]]> #{startTime}
             </if>
             <if test="endTime != null and endTime != ''">
-                and delivery_time <![CDATA[<=]]> #{endTime}
+                and a.delivery_time <![CDATA[<=]]> #{endTime}
             </if>
             <if test="deliveryType != null and deliveryType != ''">
-                and delivery_type like CONCAT(CONCAT('%', #{deliveryType}), '%')
+                and a.delivery_type like CONCAT(CONCAT('%', #{deliveryType}), '%')
             </if>
             <if test="deliveryCode != null and deliveryCode != ''">
-                and delivery_code like CONCAT(CONCAT('%', #{deliveryCode}), '%')
+                and a.delivery_code like CONCAT(CONCAT('%', #{deliveryCode}), '%')
             </if>
             <if test="subsidiaryName != null and subsidiaryName != ''">
-                and subsidiary_code = #{subsidiaryName}
+                and a.subsidiary_code = #{subsidiaryName}
             </if>
             <if test="deliveryCompany != null and deliveryCompany != ''">
-                and delivery_company = #{deliveryCompany}
+                and a.delivery_company = #{deliveryCompany}
             </if>
             <if test="deliveryDepartment != null and deliveryDepartment != ''">
-                and delivery_department like CONCAT(CONCAT('%', #{deliveryDepartment}), '%')
+                and a.delivery_department like CONCAT(CONCAT('%', #{deliveryDepartment}), '%')
             </if>
             <if test="customerName != null and customerName != ''">
-                and customer_name like CONCAT(CONCAT('%', #{customerName}), '%')
+                and a.customer_name like CONCAT(CONCAT('%', #{customerName}), '%')
             </if>
             <if test="commercialOpportunityCode != null and commercialOpportunityCode != ''">
-                and commercial_opportunity_code like CONCAT(CONCAT('%', #{commercialOpportunityCode}), '%')
+                and a.commercial_opportunity_code like CONCAT(CONCAT('%', #{commercialOpportunityCode}), '%')
             </if>
             <if test="commercialOpportunityName != null and commercialOpportunityName != ''">
-                and commercial_opportunity_name like CONCAT(CONCAT('%', #{commercialOpportunityName}), '%')
+                and a.commercial_opportunity_name like CONCAT(CONCAT('%', #{commercialOpportunityName}), '%')
             </if>
             <if test="powerStationName != null and powerStationName != ''">
-                and power_station_name like CONCAT(CONCAT('%', #{powerStationName}), '%')
+                and a.power_station_name like CONCAT(CONCAT('%', #{powerStationName}), '%')
             </if>
             <if test="materialCode != null and materialCode != ''">
-                and material_code = #{materialCode}
+                and a.material_code = #{materialCode}
             </if>
             <if test="materialName != null and materialName != ''">
-                and material_name = #{materialName}
+                and a.material_name = #{materialName}
             </if>
             <if test="wbs != null and wbs != ''">
-                and wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and w.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
             <if test="province != null and province != ''">
-                and province like CONCAT(CONCAT('%', #{province}), '%')
+                and a.province like CONCAT(CONCAT('%', #{province}), '%')
             </if>
             <if test="city != null and city != ''">
-                and city like CONCAT(CONCAT('%', #{city}), '%')
+                and a.city like CONCAT(CONCAT('%', #{city}), '%')
             </if>
             <if test="address != null and address != ''">
-                and address like CONCAT(CONCAT('%', #{address}), '%')
+                and a.address like CONCAT(CONCAT('%', #{address}), '%')
             </if>
             <if test="num != null and num != ''">
-                and (num + 0) <![CDATA[>]]> out_num
+                and (a.num + 0) <![CDATA[>]]> a.out_num
             </if>
         </trim>
-        order by id desc
+        order by a.id desc
     </select>
     <!-- 查询追溯单绑定的SN码 -->
     <select id="getTraceBackSn" resultType="com.tld.model.TraceBack">

+ 27 - 13
src/main/resources/mapper/WarehousingMapper.xml

@@ -242,7 +242,8 @@
             a.account_sleeve,
             f.name as accountName,
             a.purchase_num,
-            a.transmission_type
+            a.transmission_type,
+            v.name as wbsName
         from tld_storage a
         left join tld_material b on a.wllb_code = b.code
         left join tld_user c on a.user_id = c.id
@@ -250,6 +251,7 @@
         left join tld_storage_location g on a.storage_location_code = g.storage_location_code
         left join tld_customer h on a.supplier_id = h.code
         left join tld_company f on a.account_sleeve = f.code
+        left join tld_wbs v on a.wbs = v.tld_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="storageCode != null and storageCode != ''">
                 and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
@@ -270,7 +272,7 @@
                 and g.storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and v.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
             <if test="orderCode != null and orderCode != ''">
                 and a.order_code like CONCAT(CONCAT('%', #{orderCode}), '%')
@@ -329,7 +331,8 @@
             g.storage_location_name as storageLocationName,
             a.scrq,
             a.storage_code,
-            e.code as wbs,
+            if(a.wbs = '', null, a.wbs) as wbs,
+            if(e.name = '', null, e.name) as wbsName,
             c.real_name as realName,
             a.order_code as orderCode,
             f.name as accountName,
@@ -338,7 +341,7 @@
         from tld_storage a
         left join tld_material b on a.wllb_code = b.code
         left join tld_user c on a.user_id = c.id
-        left JOIN tld_wbs e ON a.wbs = e.code
+        left JOIN tld_wbs e ON a.wbs = e.tld_id
         left join tld_storage_location g on a.storage_location_code = g.storage_location_code
         left join tld_customer h on a.supplier_id = h.code
         left join tld_company f on a.account_sleeve = f.code
@@ -362,7 +365,7 @@
                 and g.storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and e.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
             <if test="orderCode != null and orderCode != ''">
                 and a.order_code like CONCAT(CONCAT('%', #{orderCode}), '%')
@@ -443,7 +446,8 @@
             b.notice_time as noticeTime,
             b.source_type as sourceType,
             b.move_type as moveType,
-            b.notice_code as noticeCode
+            b.notice_code as noticeCode,
+            f.name as wbsName
         from tld_notice a
         join tld_notice_f b on a.notice_id = b.notice_id
         join tld_material c on a.material_id = c.tld_id
@@ -487,7 +491,7 @@
                 and a.production_code like CONCAT(CONCAT('%', #{productionCode}), '%')
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and f.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
             <if test="moveType != null and moveType != ''">
                 and b.move_type like CONCAT(CONCAT('%', #{moveType}), '%')
@@ -515,6 +519,7 @@
             e.name as companyName,
             b.company_number,
             if(a.wbs = "", null, a.wbs) as wbs,
+            if(h.name = "", null, h.name) as wbsName,
             b.source_type as sourceType,
             b.move_type as moveType,
             (case a.type when "0" then "未入库" when "1" then "已入库" end) as type
@@ -522,6 +527,7 @@
         join tld_notice_f b on a.notice_id = b.notice_id
         join tld_material c on a.material_id = c.tld_id
         join tld_company e on b.company_number = e.code
+        left join tld_wbs h on a.wbs = h.tld_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="type != null and type != ''">
                 and a.type = #{type}
@@ -557,7 +563,7 @@
                 and a.production_code like CONCAT(CONCAT('%', #{productionCode}), '%')
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and g.wbsName like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
             <if test="moveType != null and moveType != ''">
                 and b.move_type like CONCAT(CONCAT('%', #{moveType}), '%')
@@ -674,6 +680,7 @@
             b.code as materialCode,
             a.storage_code,
             a.wbs,
+            h.name as wbsName,
             a.production_code,
             c.real_name as realName,
             a.production_code as productionCode,
@@ -683,6 +690,7 @@
         left join tld_material b on a.wllb_code = b.code
         left join tld_user c on a.user_id = c.id
         left join tld_company e on a.account_sleeve = e.code
+        left join tld_wbs h on a.wbs = h.tld_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="startTime != null and startTime != ''">
                 and a.scrq <![CDATA[>=]]> #{startTime}
@@ -715,7 +723,7 @@
                 and a.production_code like CONCAT(CONCAT('%', #{productionCode}), '%')
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and h.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
             <if test="companyNumber != null and companyNumber != ''">
                 and a.account_sleeve = #{companyNumber}
@@ -733,7 +741,8 @@
             c.user_name,
             a.scrq,
             a.storage_code,
-            if(a.wbs = '' , null ,a.wbs) wbs,
+            if(a.wbs = '' , null ,a.wbs)  wbs,
+            if(h.name = '' , null ,h.name) as  wbsName,
             c.real_name as realName,
             if(a.production_code = '' , null ,a.production_code)  as productionCode,
             e.name as accountName,
@@ -742,6 +751,7 @@
         left join tld_material b on a.wllb_code = b.code
         left join tld_user c on a.user_id = c.id
         left join tld_company e on a.account_sleeve = e.code
+        left join tld_wbs h on a.wbs = h.tld_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="startTime != null and startTime != ''">
                 and a.scrq <![CDATA[>=]]> #{startTime}
@@ -771,7 +781,7 @@
                 and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and h.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
             <if test="companyNumber != null and companyNumber != ''">
                 and a.account_sleeve = #{companyNumber}
@@ -910,6 +920,7 @@
             b.code as materialCode,
             a.storage_code,
             a.wbs,
+            h.name as wbsName,
             c.real_name as realName,
             a.production_code as productionCode,
             a.account_sleeve as companyNumber,
@@ -919,6 +930,7 @@
         left join tld_user c on a.user_id = c.id
         left join tld_storage_location e on a.storage_location_code = e.storage_location_code
         left join tld_company f on a.account_sleeve = f.code
+        left join tld_wbs h on a.wbs = h.tld_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="startTime != null and startTime != ''">
                 and a.scrq <![CDATA[>=]]> #{startTime}
@@ -945,7 +957,7 @@
                 and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and h.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
             <if test="storageLocationName != null and storageLocationName != ''">
                 and e.storage_location_name like CONCAT(CONCAT('%', #{storageLocationName}), '%')
@@ -973,6 +985,7 @@
             if(a.attribute = '' , null , a.attribute) as attribute,
             a.storage_code,
             if(a.wbs = '' , null , a.wbs) as wbs,
+            if(h.name = '' , null , h.name) as wbsName,
             c.real_name as realName,
             a.production_code as productionCode,
             f.name as accountName,
@@ -981,6 +994,7 @@
         left join tld_material b on a.wllb_code = b.code
         left join tld_user c on a.user_id = c.id
         left join tld_company f on a.account_sleeve = f.code
+        left join tld_wbs h on a.wbs = h.tld_id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="startTime != null and startTime != ''">
                 and a.scrq <![CDATA[>=]]> #{startTime}
@@ -1007,7 +1021,7 @@
                 and a.storage_code like CONCAT(CONCAT('%', #{storageCode}), '%')
             </if>
             <if test="wbs != null and wbs != ''">
-                and a.wbs like CONCAT(CONCAT('%', #{wbs}), '%')
+                and h.name like CONCAT(CONCAT('%', #{wbs}), '%')
             </if>
             <if test="productionCode != null and productionCode != ''">
                 and a.production_code like CONCAT(CONCAT('%', #{productionCode}), '%')