Browse Source

2026-01-09

新增收货入库任务、拣货出库任务
master
fengyuan_yang 3 days ago
parent
commit
9cc53e966e
  1. 46
      src/main/java/com/gaotao/modules/report/controller/InboundNotificationReportController.java
  2. 46
      src/main/java/com/gaotao/modules/report/controller/OutboundNotificationReportController.java
  3. 47
      src/main/java/com/gaotao/modules/report/dao/InboundNotificationReportMapper.java
  4. 47
      src/main/java/com/gaotao/modules/report/dao/OutboundNotificationReportMapper.java
  5. 84
      src/main/java/com/gaotao/modules/report/entity/InboundNotificationReportData.java
  6. 87
      src/main/java/com/gaotao/modules/report/entity/OutboundNotificationReportData.java
  7. 29
      src/main/java/com/gaotao/modules/report/service/InboundNotificationReportService.java
  8. 29
      src/main/java/com/gaotao/modules/report/service/OutboundNotificationReportService.java
  9. 45
      src/main/java/com/gaotao/modules/report/service/impl/InboundNotificationReportServiceImpl.java
  10. 45
      src/main/java/com/gaotao/modules/report/service/impl/OutboundNotificationReportServiceImpl.java
  11. 154
      src/main/resources/mapper/report/InboundNotificationReportMapper.xml
  12. 174
      src/main/resources/mapper/report/OutboundNotificationReportMapper.xml

46
src/main/java/com/gaotao/modules/report/controller/InboundNotificationReportController.java

@ -0,0 +1,46 @@
package com.gaotao.modules.report.controller;
import com.gaotao.common.utils.PageUtils;
import com.gaotao.common.utils.R;
import com.gaotao.modules.report.entity.InboundNotificationReportData;
import com.gaotao.modules.report.service.InboundNotificationReportService;
import com.gaotao.modules.sys.controller.AbstractController;
import com.gaotao.modules.sys.entity.SysUserEntity;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 收货入库任务报表控制器
* @author system
* @date 2026/01/09
*/
@RestController
@RequestMapping("/report/inboundNotificationReport")
public class InboundNotificationReportController extends AbstractController {
@Autowired
private InboundNotificationReportService inboundNotificationReportService;
/**
* 查询收货入库任务报表数据分页
*/
@PostMapping("/list")
public R list(@RequestBody InboundNotificationReportData params) {
String userName = ((SysUserEntity) SecurityUtils.getSubject().getPrincipal()).getUsername();
PageUtils page = inboundNotificationReportService.searchInboundNotificationReport(params, userName);
return R.ok().put("page", page);
}
/**
* 获取用户可访问的site列表
*/
@GetMapping("/getSiteList")
public R getSiteList() {
String userName = ((SysUserEntity) SecurityUtils.getSubject().getPrincipal()).getUsername();
List<String> siteList = inboundNotificationReportService.getAccessSiteList(userName);
return R.ok().put("siteList", siteList);
}
}

46
src/main/java/com/gaotao/modules/report/controller/OutboundNotificationReportController.java

@ -0,0 +1,46 @@
package com.gaotao.modules.report.controller;
import com.gaotao.common.utils.PageUtils;
import com.gaotao.common.utils.R;
import com.gaotao.modules.report.entity.OutboundNotificationReportData;
import com.gaotao.modules.report.service.OutboundNotificationReportService;
import com.gaotao.modules.sys.controller.AbstractController;
import com.gaotao.modules.sys.entity.SysUserEntity;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 拣货出库任务报表控制器
* @author system
* @date 2026/01/09
*/
@RestController
@RequestMapping("/report/outboundNotificationReport")
public class OutboundNotificationReportController extends AbstractController {
@Autowired
private OutboundNotificationReportService outboundNotificationReportService;
/**
* 查询拣货出库任务报表数据分页
*/
@PostMapping("/list")
public R list(@RequestBody OutboundNotificationReportData params) {
String userName = ((SysUserEntity) SecurityUtils.getSubject().getPrincipal()).getUsername();
PageUtils page = outboundNotificationReportService.searchOutboundNotificationReport(params, userName);
return R.ok().put("page", page);
}
/**
* 获取用户可访问的site列表
*/
@GetMapping("/getSiteList")
public R getSiteList() {
String userName = ((SysUserEntity) SecurityUtils.getSubject().getPrincipal()).getUsername();
List<String> siteList = outboundNotificationReportService.getAccessSiteList(userName);
return R.ok().put("siteList", siteList);
}
}

47
src/main/java/com/gaotao/modules/report/dao/InboundNotificationReportMapper.java

@ -0,0 +1,47 @@
package com.gaotao.modules.report.dao;
import com.gaotao.modules.report.entity.InboundNotificationReportData;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 收货入库任务报表Mapper
* @author system
* @date 2026/01/09
*/
@Mapper
public interface InboundNotificationReportMapper {
/**
* 查询收货入库任务报表数据分页
* @param query 查询条件
* @param userName 用户名
* @param offset 偏移量
* @param limit 每页数量
* @return 报表数据列表
*/
List<InboundNotificationReportData> searchInboundNotificationReport(
@Param("query") InboundNotificationReportData query,
@Param("userName") String userName,
@Param("offset") int offset,
@Param("limit") int limit);
/**
* 查询收货入库任务报表数据总数
* @param query 查询条件
* @param userName 用户名
* @return 总数
*/
int countInboundNotificationReport(
@Param("query") InboundNotificationReportData query,
@Param("userName") String userName);
/**
* 获取用户可访问的site列表
* @param userName 用户名
* @return site列表
*/
List<String> getAccessSiteList(@Param("userName") String userName);
}

47
src/main/java/com/gaotao/modules/report/dao/OutboundNotificationReportMapper.java

@ -0,0 +1,47 @@
package com.gaotao.modules.report.dao;
import com.gaotao.modules.report.entity.OutboundNotificationReportData;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 拣货出库任务报表Mapper
* @author system
* @date 2026/01/09
*/
@Mapper
public interface OutboundNotificationReportMapper {
/**
* 查询拣货出库任务报表数据分页
* @param query 查询条件
* @param userName 用户名
* @param offset 偏移量
* @param limit 每页数量
* @return 报表数据列表
*/
List<OutboundNotificationReportData> searchOutboundNotificationReport(
@Param("query") OutboundNotificationReportData query,
@Param("userName") String userName,
@Param("offset") int offset,
@Param("limit") int limit);
/**
* 查询拣货出库任务报表数据总数
* @param query 查询条件
* @param userName 用户名
* @return 总数
*/
int countOutboundNotificationReport(
@Param("query") OutboundNotificationReportData query,
@Param("userName") String userName);
/**
* 获取用户可访问的site列表
* @param userName 用户名
* @return site列表
*/
List<String> getAccessSiteList(@Param("userName") String userName);
}

84
src/main/java/com/gaotao/modules/report/entity/InboundNotificationReportData.java

@ -0,0 +1,84 @@
package com.gaotao.modules.report.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 收货入库任务报表数据实体
* @author system
* @date 2026/01/09
*/
@Data
public class InboundNotificationReportData {
// 分页参数
private Integer page;
private Integer limit;
// 查询条件
private String site;
private String orderNo;
private String orderType;
private String orderStatus;
private String completionRate; // 完成率
private String supplierId;
private String supplierName;
private String partNo;
private String partDesc;
private String queryRelatedOrderNo; // 查询条件关联单号
private String queryRelatedOrderLineNo; // 查询条件关联单行号
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date startDate;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date endDate;
// 主表字段
private String buNo;
private String buDesc;
private String relatedOrderNo;
private String relatedOrderLineNo;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date requiredInboundDate;
private String remarks;
private String erpOrderNo;
private String erpOrderLineNo;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date erpOrderDate;
private String createdBy;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createdDate;
private String updatedBy;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updatedDate;
private String assignedBy;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date assignedDate;
private String closedBy;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date closedDate;
private String closeFlag;
private String inWarehouse;
private String inWarehouseName;
// 明细表字段
private String detailPartNo;
private String detailPartDesc;
private String unit;
private String umName;
private Double requiredQty;
private Double orderQty;
private Double actualInQty;
private String detailInWarehouse;
private String detailInWarehouseName;
private String inBatchNo;
private String detailRelatedOrderNo;
private String detailRelatedOrderLineNo;
private String rollNo;
}

87
src/main/java/com/gaotao/modules/report/entity/OutboundNotificationReportData.java

@ -0,0 +1,87 @@
package com.gaotao.modules.report.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 拣货出库任务报表数据实体
* @author system
* @date 2026/01/09
*/
@Data
public class OutboundNotificationReportData {
// 分页参数
private Integer page;
private Integer limit;
// 查询条件
private String site;
private String orderNo;
private String orderType;
private String orderStatus;
private String completionRate; // 完成率
private String customerId;
private String customerName;
private String partNo;
private String partDesc;
private String queryRelatedOrderNo; // 查询条件关联单号
private String queryRelatedOrderLineNo; // 查询条件关联单行号
private String queryOutBatchNo; // 查询条件合约号码
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date startDate;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date endDate;
// 主表字段
private String buNo;
private String buDesc;
private String customerAbb;
private String relatedOrderNo;
private String relatedOrderLineNo;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date requiredOutboundDate;
private String remarks;
private String erpOrderNo;
private String erpOrderLineNo;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date erpOrderDate;
private String createdBy;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createdDate;
private String updatedBy;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updatedDate;
private String assignedBy;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date assignedDate;
private String closedBy;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date closedDate;
private String closeFlag;
private String outWarehouse;
private String outWarehouseName;
private String customerOrderNo;
// 明细表字段
private String detailPartNo;
private String detailPartDesc;
private String unit;
private String umName;
private Double requiredQty;
private Double orderQty;
private Double actualOutQty;
private String detailOutWarehouse;
private String detailOutWarehouseName;
private String outBatchNo;
private String detailRelatedOrderNo;
private String detailRelatedOrderLineNo;
private String inspectionFlag;
}

29
src/main/java/com/gaotao/modules/report/service/InboundNotificationReportService.java

@ -0,0 +1,29 @@
package com.gaotao.modules.report.service;
import com.gaotao.common.utils.PageUtils;
import com.gaotao.modules.report.entity.InboundNotificationReportData;
import java.util.List;
/**
* 收货入库任务报表服务接口
* @author system
* @date 2026/01/09
*/
public interface InboundNotificationReportService {
/**
* 查询收货入库任务报表数据分页
* @param query 查询条件
* @param userName 用户名
* @return 分页数据
*/
PageUtils searchInboundNotificationReport(InboundNotificationReportData query, String userName);
/**
* 获取用户可访问的site列表
* @param userName 用户名
* @return site列表
*/
List<String> getAccessSiteList(String userName);
}

29
src/main/java/com/gaotao/modules/report/service/OutboundNotificationReportService.java

@ -0,0 +1,29 @@
package com.gaotao.modules.report.service;
import com.gaotao.common.utils.PageUtils;
import com.gaotao.modules.report.entity.OutboundNotificationReportData;
import java.util.List;
/**
* 拣货出库任务报表服务接口
* @author system
* @date 2026/01/09
*/
public interface OutboundNotificationReportService {
/**
* 查询拣货出库任务报表数据分页
* @param query 查询条件
* @param userName 用户名
* @return 分页数据
*/
PageUtils searchOutboundNotificationReport(OutboundNotificationReportData query, String userName);
/**
* 获取用户可访问的site列表
* @param userName 用户名
* @return site列表
*/
List<String> getAccessSiteList(String userName);
}

45
src/main/java/com/gaotao/modules/report/service/impl/InboundNotificationReportServiceImpl.java

@ -0,0 +1,45 @@
package com.gaotao.modules.report.service.impl;
import com.gaotao.common.utils.PageUtils;
import com.gaotao.modules.report.dao.InboundNotificationReportMapper;
import com.gaotao.modules.report.entity.InboundNotificationReportData;
import com.gaotao.modules.report.service.InboundNotificationReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 收货入库任务报表服务实现
* @author system
* @date 2026/01/09
*/
@Service
public class InboundNotificationReportServiceImpl implements InboundNotificationReportService {
@Autowired
private InboundNotificationReportMapper inboundNotificationReportMapper;
@Override
public PageUtils searchInboundNotificationReport(InboundNotificationReportData query, String userName) {
// 默认分页参数
int page = query.getPage() != null ? query.getPage() : 1;
int limit = query.getLimit() != null ? query.getLimit() : 50;
int offset = (page - 1) * limit;
// 查询数据
List<InboundNotificationReportData> list = inboundNotificationReportMapper.searchInboundNotificationReport(
query, userName, offset, limit);
// 查询总数
int total = inboundNotificationReportMapper.countInboundNotificationReport(query, userName);
// 构建分页结果
return new PageUtils(list, total, limit, page);
}
@Override
public List<String> getAccessSiteList(String userName) {
return inboundNotificationReportMapper.getAccessSiteList(userName);
}
}

45
src/main/java/com/gaotao/modules/report/service/impl/OutboundNotificationReportServiceImpl.java

@ -0,0 +1,45 @@
package com.gaotao.modules.report.service.impl;
import com.gaotao.common.utils.PageUtils;
import com.gaotao.modules.report.dao.OutboundNotificationReportMapper;
import com.gaotao.modules.report.entity.OutboundNotificationReportData;
import com.gaotao.modules.report.service.OutboundNotificationReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 拣货出库任务报表服务实现
* @author system
* @date 2026/01/09
*/
@Service
public class OutboundNotificationReportServiceImpl implements OutboundNotificationReportService {
@Autowired
private OutboundNotificationReportMapper outboundNotificationReportMapper;
@Override
public PageUtils searchOutboundNotificationReport(OutboundNotificationReportData query, String userName) {
// 默认分页参数
int page = query.getPage() != null ? query.getPage() : 1;
int limit = query.getLimit() != null ? query.getLimit() : 50;
int offset = (page - 1) * limit;
// 查询数据
List<OutboundNotificationReportData> list = outboundNotificationReportMapper.searchOutboundNotificationReport(
query, userName, offset, limit);
// 查询总数
int total = outboundNotificationReportMapper.countOutboundNotificationReport(query, userName);
// 构建分页结果
return new PageUtils(list, total, limit, page);
}
@Override
public List<String> getAccessSiteList(String userName) {
return outboundNotificationReportMapper.getAccessSiteList(userName);
}
}

154
src/main/resources/mapper/report/InboundNotificationReportMapper.xml

@ -0,0 +1,154 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gaotao.modules.report.dao.InboundNotificationReportMapper">
<!-- 查询收货入库任务报表数据(分页) -->
<select id="searchInboundNotificationReport" resultType="com.gaotao.modules.report.entity.InboundNotificationReportData">
SELECT
h.site,
h.bu_no AS buNo,
h.order_no AS orderNo,
h.order_type AS orderType,
h.order_status AS orderStatus,
CASE
WHEN ISNULL(d.required_qty, 0) = 0 THEN '0%'
ELSE CONCAT(CAST(ROUND(ISNULL(d.actual_in_qty, 0) * 100.0 / d.required_qty, 1) AS VARCHAR), '%')
END AS completionRate,
h.supplier_id AS supplierId,
s.SupplierName AS supplierName,
h.related_order_no AS relatedOrderNo,
h.related_order_line_no AS relatedOrderLineNo,
h.required_inbound_date AS requiredInboundDate,
h.remarks,
h.erp_order_no AS erpOrderNo,
h.erp_order_line_no AS erpOrderLineNo,
h.erp_order_date AS erpOrderDate,
h.created_by AS createdBy,
h.created_date AS createdDate,
h.updated_by AS updatedBy,
h.updated_date AS updatedDate,
h.assigned_by AS assignedBy,
h.assigned_date AS assignedDate,
h.closed_by AS closedBy,
h.closed_date AS closedDate,
h.close_flag AS closeFlag,
h.in_warehouse AS inWarehouse,
wh.WareHouseName AS inWarehouseName,
d.part_no AS detailPartNo,
d.part_desc AS detailPartDesc,
d.unit,
um.umName,
d.required_qty AS requiredQty,
d.order_qty AS orderQty,
d.actual_in_qty AS actualInQty,
d.in_warehouse AS detailInWarehouse,
dwh.WareHouseName AS detailInWarehouseName,
d.in_batch_no AS inBatchNo,
d.related_order_no AS detailRelatedOrderNo,
d.related_order_line_no AS detailRelatedOrderLineNo,
d.roll_no AS rollNo
FROM inbound_notification_head h WITH(NOLOCK)
LEFT JOIN Supplier s WITH(NOLOCK) ON h.site = s.site AND h.supplier_id = s.SupplierID
LEFT JOIN WareHouse wh WITH(NOLOCK) ON h.site = wh.site AND h.bu_no = wh.bu_no AND h.in_warehouse = wh.WareHouseID
LEFT JOIN inbound_notification_detail d WITH(NOLOCK) ON h.site = d.site AND h.bu_no = d.bu_no AND h.order_no = d.order_no
LEFT JOIN WareHouse dwh WITH(NOLOCK) ON d.site = dwh.site AND d.bu_no = dwh.bu_no AND d.in_warehouse = dwh.WareHouseID
LEFT JOIN um WITH(NOLOCK) ON d.site = um.site AND d.unit = um.UMID
<where>
h.site IN (SELECT site FROM AccessSite WHERE UPPER(userID) = UPPER(#{userName}))
AND h.bu_no IN (SELECT bu_no FROM AccessBu WHERE UPPER(username) = UPPER(#{userName}))
<if test="query.site != null and query.site != ''">
AND h.site = #{query.site}
</if>
<if test="query.orderNo != null and query.orderNo != ''">
AND h.order_no LIKE '%' + #{query.orderNo} + '%'
</if>
<if test="query.orderType != null and query.orderType != ''">
AND h.order_type = #{query.orderType}
</if>
<if test="query.orderStatus != null and query.orderStatus != ''">
AND h.order_status = #{query.orderStatus}
</if>
<if test="query.supplierId != null and query.supplierId != ''">
AND h.supplier_id LIKE '%' + #{query.supplierId} + '%'
</if>
<if test="query.supplierName != null and query.supplierName != ''">
AND s.SupplierName LIKE '%' + #{query.supplierName} + '%'
</if>
<if test="query.partNo != null and query.partNo != ''">
AND d.part_no LIKE '%' + #{query.partNo} + '%'
</if>
<if test="query.partDesc != null and query.partDesc != ''">
AND d.part_desc LIKE '%' + #{query.partDesc} + '%'
</if>
<if test="query.startDate != null">
AND h.required_inbound_date &gt;= #{query.startDate}
</if>
<if test="query.endDate != null">
AND h.required_inbound_date &lt;= #{query.endDate}
</if>
<if test="query.queryRelatedOrderNo != null and query.queryRelatedOrderNo != ''">
AND d.related_order_no LIKE '%' + #{query.queryRelatedOrderNo} + '%'
</if>
<if test="query.queryRelatedOrderLineNo != null and query.queryRelatedOrderLineNo != ''">
AND d.related_order_line_no LIKE '%' + #{query.queryRelatedOrderLineNo} + '%'
</if>
</where>
ORDER BY h.created_date DESC, h.order_no, d.part_no
OFFSET #{offset} ROWS FETCH NEXT #{limit} ROWS ONLY
</select>
<!-- 查询收货入库任务报表数据总数 -->
<select id="countInboundNotificationReport" resultType="int">
SELECT COUNT(1)
FROM inbound_notification_head h WITH(NOLOCK)
LEFT JOIN Supplier s WITH(NOLOCK) ON h.site = s.site AND h.supplier_id = s.SupplierID
LEFT JOIN inbound_notification_detail d WITH(NOLOCK) ON h.site = d.site AND h.bu_no = d.bu_no AND h.order_no = d.order_no
<where>
h.site IN (SELECT site FROM AccessSite WHERE UPPER(userID) = UPPER(#{userName}))
AND h.bu_no IN (SELECT bu_no FROM AccessBu WHERE UPPER(username) = UPPER(#{userName}))
<if test="query.site != null and query.site != ''">
AND h.site = #{query.site}
</if>
<if test="query.orderNo != null and query.orderNo != ''">
AND h.order_no LIKE '%' + #{query.orderNo} + '%'
</if>
<if test="query.orderType != null and query.orderType != ''">
AND h.order_type = #{query.orderType}
</if>
<if test="query.orderStatus != null and query.orderStatus != ''">
AND h.order_status = #{query.orderStatus}
</if>
<if test="query.supplierId != null and query.supplierId != ''">
AND h.supplier_id LIKE '%' + #{query.supplierId} + '%'
</if>
<if test="query.supplierName != null and query.supplierName != ''">
AND s.SupplierName LIKE '%' + #{query.supplierName} + '%'
</if>
<if test="query.partNo != null and query.partNo != ''">
AND d.part_no LIKE '%' + #{query.partNo} + '%'
</if>
<if test="query.partDesc != null and query.partDesc != ''">
AND d.part_desc LIKE '%' + #{query.partDesc} + '%'
</if>
<if test="query.startDate != null">
AND h.required_inbound_date &gt;= #{query.startDate}
</if>
<if test="query.endDate != null">
AND h.required_inbound_date &lt;= #{query.endDate}
</if>
<if test="query.queryRelatedOrderNo != null and query.queryRelatedOrderNo != ''">
AND d.related_order_no LIKE '%' + #{query.queryRelatedOrderNo} + '%'
</if>
<if test="query.queryRelatedOrderLineNo != null and query.queryRelatedOrderLineNo != ''">
AND d.related_order_line_no LIKE '%' + #{query.queryRelatedOrderLineNo} + '%'
</if>
</where>
</select>
<!-- 获取用户可访问的site列表 -->
<select id="getAccessSiteList" resultType="java.lang.String">
SELECT site FROM AccessSite WHERE UPPER(userID) = UPPER(#{userName}) ORDER BY site
</select>
</mapper>

174
src/main/resources/mapper/report/OutboundNotificationReportMapper.xml

@ -0,0 +1,174 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gaotao.modules.report.dao.OutboundNotificationReportMapper">
<!-- 查询拣货出库任务报表数据(分页) -->
<select id="searchOutboundNotificationReport" resultType="com.gaotao.modules.report.entity.OutboundNotificationReportData">
SELECT
h.site,
h.bu_no AS buNo,
h.order_no AS orderNo,
h.order_type AS orderType,
h.order_status AS orderStatus,
CASE
WHEN ISNULL(d.required_qty, 0) = 0 THEN '0%'
ELSE CONCAT(CAST(ROUND(ISNULL(d.actual_out_qty, 0) * 100.0 / d.required_qty, 1) AS VARCHAR), '%')
END AS completionRate,
COALESCE(NULLIF(LTRIM(RTRIM(h.customer_id)), ''), sup.SupplierID) AS customerId,
COALESCE(
NULLIF(LTRIM(RTRIM(c.customerName)), ''),
NULLIF(LTRIM(RTRIM(sup.SupplierName)), ''),
''
) AS customerName,
COALESCE(c.CustomerAbb, '') AS customerAbb,
h.related_order_no AS relatedOrderNo,
h.related_order_line_no AS relatedOrderLineNo,
h.required_outbound_date AS requiredOutboundDate,
h.remarks,
h.erp_order_no AS erpOrderNo,
h.erp_order_line_no AS erpOrderLineNo,
h.erp_order_date AS erpOrderDate,
h.created_by AS createdBy,
h.created_date AS createdDate,
h.updated_by AS updatedBy,
h.updated_date AS updatedDate,
h.assigned_by AS assignedBy,
h.assigned_date AS assignedDate,
h.closed_by AS closedBy,
h.closed_date AS closedDate,
h.close_flag AS closeFlag,
h.out_warehouse AS outWarehouse,
wh.WareHouseName AS outWarehouseName,
h.customer_order_no AS customerOrderNo,
d.part_no AS detailPartNo,
d.part_desc AS detailPartDesc,
d.unit,
um.umName,
d.required_qty AS requiredQty,
d.order_qty AS orderQty,
d.actual_out_qty AS actualOutQty,
d.out_warehouse AS detailOutWarehouse,
dwh.WareHouseName AS detailOutWarehouseName,
d.out_batch_no AS outBatchNo,
d.related_order_no AS detailRelatedOrderNo,
d.related_order_line_no AS detailRelatedOrderLineNo,
d.inspection_flag AS inspectionFlag
FROM outbound_notification_head h WITH(NOLOCK)
LEFT JOIN Customer c WITH(NOLOCK) ON h.site = c.site AND LTRIM(RTRIM(h.customer_id)) = c.CustomerID
LEFT JOIN Supplier sup WITH(NOLOCK) ON h.site = sup.site AND (NULLIF(LTRIM(RTRIM(h.customer_id)), '') IS NULL OR c.CustomerID IS NULL) AND LTRIM(RTRIM(h.customer_id)) = sup.SupplierID
LEFT JOIN WareHouse wh WITH(NOLOCK) ON h.site = wh.site AND h.bu_no = wh.bu_no AND h.out_warehouse = wh.WareHouseID
LEFT JOIN outbound_notification_detail d WITH(NOLOCK) ON h.site = d.site AND h.bu_no = d.bu_no AND h.order_no = d.order_no
LEFT JOIN WareHouse dwh WITH(NOLOCK) ON d.site = dwh.site AND d.bu_no = dwh.bu_no AND d.out_warehouse = dwh.WareHouseID
LEFT JOIN um WITH(NOLOCK) ON d.site = um.site AND d.unit = um.UMID
<where>
h.site IN (SELECT site FROM AccessSite WHERE UPPER(userID) = UPPER(#{userName}))
AND h.bu_no IN (SELECT bu_no FROM AccessBu WHERE UPPER(username) = UPPER(#{userName}))
<if test="query.site != null and query.site != ''">
AND h.site = #{query.site}
</if>
<if test="query.orderNo != null and query.orderNo != ''">
AND h.order_no LIKE '%' + #{query.orderNo} + '%'
</if>
<if test="query.orderType != null and query.orderType != ''">
AND h.order_type = #{query.orderType}
</if>
<if test="query.orderStatus != null and query.orderStatus != ''">
AND h.order_status = #{query.orderStatus}
</if>
<if test="query.customerId != null and query.customerId != ''">
AND h.customer_id LIKE '%' + #{query.customerId} + '%'
</if>
<if test="query.customerName != null and query.customerName != ''">
AND (
c.customerName LIKE '%' + #{query.customerName} + '%'
OR sup.SupplierName LIKE '%' + #{query.customerName} + '%'
)
</if>
<if test="query.partNo != null and query.partNo != ''">
AND d.part_no LIKE '%' + #{query.partNo} + '%'
</if>
<if test="query.partDesc != null and query.partDesc != ''">
AND d.part_desc LIKE '%' + #{query.partDesc} + '%'
</if>
<if test="query.startDate != null">
AND h.required_outbound_date &gt;= #{query.startDate}
</if>
<if test="query.endDate != null">
AND h.required_outbound_date &lt;= #{query.endDate}
</if>
<if test="query.queryRelatedOrderNo != null and query.queryRelatedOrderNo != ''">
AND d.related_order_no LIKE '%' + #{query.queryRelatedOrderNo} + '%'
</if>
<if test="query.queryRelatedOrderLineNo != null and query.queryRelatedOrderLineNo != ''">
AND d.related_order_line_no LIKE '%' + #{query.queryRelatedOrderLineNo} + '%'
</if>
<if test="query.queryOutBatchNo != null and query.queryOutBatchNo != ''">
AND d.out_batch_no LIKE '%' + #{query.queryOutBatchNo} + '%'
</if>
</where>
ORDER BY h.created_date DESC, h.order_no, d.part_no
OFFSET #{offset} ROWS FETCH NEXT #{limit} ROWS ONLY
</select>
<!-- 查询拣货出库任务报表数据总数 -->
<select id="countOutboundNotificationReport" resultType="int">
SELECT COUNT(1)
FROM outbound_notification_head h WITH(NOLOCK)
LEFT JOIN Customer c WITH(NOLOCK) ON h.site = c.site AND LTRIM(RTRIM(h.customer_id)) = c.CustomerID
LEFT JOIN Supplier sup WITH(NOLOCK) ON h.site = sup.site AND (NULLIF(LTRIM(RTRIM(h.customer_id)), '') IS NULL OR c.CustomerID IS NULL) AND LTRIM(RTRIM(h.customer_id)) = sup.SupplierID
LEFT JOIN outbound_notification_detail d WITH(NOLOCK) ON h.site = d.site AND h.bu_no = d.bu_no AND h.order_no = d.order_no
<where>
h.site IN (SELECT site FROM AccessSite WHERE UPPER(userID) = UPPER(#{userName}))
AND h.bu_no IN (SELECT bu_no FROM AccessBu WHERE UPPER(username) = UPPER(#{userName}))
<if test="query.site != null and query.site != ''">
AND h.site = #{query.site}
</if>
<if test="query.orderNo != null and query.orderNo != ''">
AND h.order_no LIKE '%' + #{query.orderNo} + '%'
</if>
<if test="query.orderType != null and query.orderType != ''">
AND h.order_type = #{query.orderType}
</if>
<if test="query.orderStatus != null and query.orderStatus != ''">
AND h.order_status = #{query.orderStatus}
</if>
<if test="query.customerId != null and query.customerId != ''">
AND h.customer_id LIKE '%' + #{query.customerId} + '%'
</if>
<if test="query.customerName != null and query.customerName != ''">
AND (
c.customerName LIKE '%' + #{query.customerName} + '%'
OR sup.SupplierName LIKE '%' + #{query.customerName} + '%'
)
</if>
<if test="query.partNo != null and query.partNo != ''">
AND d.part_no LIKE '%' + #{query.partNo} + '%'
</if>
<if test="query.partDesc != null and query.partDesc != ''">
AND d.part_desc LIKE '%' + #{query.partDesc} + '%'
</if>
<if test="query.startDate != null">
AND h.required_outbound_date &gt;= #{query.startDate}
</if>
<if test="query.endDate != null">
AND h.required_outbound_date &lt;= #{query.endDate}
</if>
<if test="query.queryRelatedOrderNo != null and query.queryRelatedOrderNo != ''">
AND d.related_order_no LIKE '%' + #{query.queryRelatedOrderNo} + '%'
</if>
<if test="query.queryRelatedOrderLineNo != null and query.queryRelatedOrderLineNo != ''">
AND d.related_order_line_no LIKE '%' + #{query.queryRelatedOrderLineNo} + '%'
</if>
<if test="query.queryOutBatchNo != null and query.queryOutBatchNo != ''">
AND d.out_batch_no LIKE '%' + #{query.queryOutBatchNo} + '%'
</if>
</where>
</select>
<!-- 获取用户可访问的site列表 -->
<select id="getAccessSiteList" resultType="java.lang.String">
SELECT site FROM AccessSite WHERE UPPER(userID) = UPPER(#{userName}) ORDER BY site
</select>
</mapper>
Loading…
Cancel
Save