Browse Source

2026-05-25

优化
master
fengyuan_yang 3 weeks ago
parent
commit
569be63802
  1. 12
      src/main/java/com/gaotao/modules/boxManage/controller/BoxForNotificationController.java
  2. 2
      src/main/java/com/gaotao/modules/boxManage/dao/BoxForNotificationMapper.java
  3. 17
      src/main/java/com/gaotao/modules/boxManage/data/SoReceiveCasesData.java
  4. 1
      src/main/java/com/gaotao/modules/boxManage/service/BoxForNotificationService.java
  5. 16
      src/main/java/com/gaotao/modules/boxManage/service/impl/BoxForNotificationServiceImpl.java
  6. 256
      src/main/resources/mapper/boxManage/BoxForNotificationMapper.xml

12
src/main/java/com/gaotao/modules/boxManage/controller/BoxForNotificationController.java

@ -125,6 +125,18 @@ public class BoxForNotificationController {
return R.ok().put("rows", rows);
}
/**
* 分页查询盒清单
* @param data
* @return R
*/
@PostMapping(value="/searchSoReceiveCasesDataByPage")
@ResponseBody
public R searchSoReceiveCasesDataByPage(@RequestBody SoReceiveCasesData data) {
PageUtils page = srmSupplierService.searchSoReceiveCasesDataByPage(data);
return R.ok().put("page", page);
}
/**
* 删除盒清单记录
* @param data

2
src/main/java/com/gaotao/modules/boxManage/dao/BoxForNotificationMapper.java

@ -61,6 +61,8 @@ public interface BoxForNotificationMapper {
// 盒清单相关方法
List<SoReceiveCasesData> searchSoReceiveCasesData(SoReceiveCasesData data);
List<SoReceiveCasesData> searchSoReceiveCasesDataByPage(SoReceiveCasesData data);
int searchSoReceiveCasesDataCount(SoReceiveCasesData data);
void deleteSoReceiveCasesData(SoReceiveCasesData data);
List<SoReceiveCasesData> validateCaseRoll(@Param("site") String site, @Param("partNo") String partNo, @Param("rollNo") String rollNo, @Param("casesNo") String casesNo);
void saveSoReceiveCases(SoReceiveCasesData data);

17
src/main/java/com/gaotao/modules/boxManage/data/SoReceiveCasesData.java

@ -2,12 +2,14 @@ package com.gaotao.modules.boxManage.data;
import com.gaotao.modules.boxManage.entity.SoReceiveCases;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.ibatis.type.Alias;
/**
* 盒清单数据对象
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Alias("SoReceiveCasesData")
public class SoReceiveCasesData extends SoReceiveCases {
/**
@ -28,6 +30,21 @@ public class SoReceiveCasesData extends SoReceiveCases {
private Integer boxCountCases;
private Integer boxCountRolls;
private Integer totalQty;
/**
* 当前页码
*/
private Integer page;
/**
* 每页条数
*/
private Integer limit;
/**
* 分页偏移量
*/
private Integer offset;
}

1
src/main/java/com/gaotao/modules/boxManage/service/BoxForNotificationService.java

@ -31,6 +31,7 @@ public interface BoxForNotificationService {
// 盒清单相关方法
List<SoReceiveCasesData> searchSoReceiveCasesData(SoReceiveCasesData data);
PageUtils searchSoReceiveCasesDataByPage(SoReceiveCasesData data);
void deleteSoReceiveCasesData(SoReceiveCasesData data);
List<SoReceiveCasesData> validateAndScanCaseRoll(SoReceiveCasesData data);
void saveCaseRollList(List<SoReceiveCasesData> dataList);

16
src/main/java/com/gaotao/modules/boxManage/service/impl/BoxForNotificationServiceImpl.java

@ -328,6 +328,22 @@ public class BoxForNotificationServiceImpl implements BoxForNotificationService
return boxForNotificationMapper.searchSoReceiveCasesData(data);
}
@Override
public PageUtils searchSoReceiveCasesDataByPage(SoReceiveCasesData data) {
int page = data.getPage() != null && data.getPage() > 0 ? data.getPage() : 1;
int limit = data.getLimit() != null && data.getLimit() > 0 ? data.getLimit() : 50;
int offset = (page - 1) * limit;
data.setOffset(offset);
data.setLimit(limit);
int totalCount = boxForNotificationMapper.searchSoReceiveCasesDataCount(data);
List<SoReceiveCasesData> list = totalCount > 0
? boxForNotificationMapper.searchSoReceiveCasesDataByPage(data)
: new ArrayList<>();
return new PageUtils(list, totalCount, limit, page);
}
@Override
@Transactional
public void deleteSoReceiveCasesData(SoReceiveCasesData data) {

256
src/main/resources/mapper/boxManage/BoxForNotificationMapper.xml

@ -288,6 +288,62 @@
ORDER BY s.create_date DESC
</select>
<select id="searchSoReceiveCasesDataByPage" resultType="SoReceiveCasesData">
SELECT
s.Id as id,
s.NotifyNo as notifyNo,
s.cases_no as casesNo,
s.roll_no as rollNo,
s.roll_qty as rollQty,
s.part_no as partNo,
s.part_desc as partDesc,
s.create_date as createDate,
s.create_by as createBy,
s.Remark as remark,
s.site,
s.bu_no as buNo,
agg.box_count_cases as boxCountCases,
agg.box_count_rolls as boxCountRolls,
agg.total_qty as totalQty
FROM so_receive_cases s WITH(NOLOCK)
LEFT JOIN (
SELECT
site,
NotifyNo,
COUNT(DISTINCT cases_no) AS box_count_cases, --盒标签张数
COUNT(DISTINCT roll_no) AS box_count_rolls, --卷标签张数
SUM(roll_qty) AS total_qty --物料总数
FROM so_receive_cases WITH(NOLOCK)
WHERE site = #{site} and NotifyNo = #{notifyNo}
GROUP BY site, NotifyNo
) as agg ON s.site = agg.site AND s.NotifyNo = agg.NotifyNo
<where>
s.site = #{site} AND s.bu_no = #{buNo}
<if test="notifyNo != null and notifyNo != ''">
AND s.NotifyNo = #{notifyNo}
</if>
<if test="casesNo != null and casesNo != ''">
AND s.cases_no = #{casesNo}
</if>
</where>
ORDER BY s.create_date DESC
OFFSET #{offset} ROWS FETCH NEXT #{limit} ROWS ONLY
</select>
<select id="searchSoReceiveCasesDataCount" resultType="int">
SELECT COUNT(1)
FROM so_receive_cases s WITH(NOLOCK)
<where>
s.site = #{site} AND s.bu_no = #{buNo}
<if test="notifyNo != null and notifyNo != ''">
AND s.NotifyNo = #{notifyNo}
</if>
<if test="casesNo != null and casesNo != ''">
AND s.cases_no = #{casesNo}
</if>
</where>
</select>
<delete id="deleteSoReceiveCasesData">
DELETE FROM so_receive_cases
WHERE Id = #{id}
@ -414,20 +470,46 @@
b.related_order_no as relatedOrderNo,
b.related_order_line_no as relatedOrderLineNo,
<!-- 已扫描数量和未扫描数量 -->
ISNULL(SUM(e.roll_qty), 0) as rollQty,
CASE WHEN b.required_qty - ISNULL(SUM(e.roll_qty), 0) > 0
THEN ROUND(b.required_qty - ISNULL(SUM(e.roll_qty), 0), 3)
ISNULL(e_agg.roll_qty, 0) as rollQty,
CASE WHEN b.required_qty - ISNULL(e_agg.roll_qty, 0) > 0
THEN ROUND(b.required_qty - ISNULL(e_agg.roll_qty, 0), 3)
ELSE 0
END as unScanQty ,
ISNULL(SUM(i.qty_on_hand), 0) as availableStock,
ISNULL(inv_agg.qty_on_hand, 0) as availableStock,
b.std_packing_qty,
ISNULL(b.inspection_flag,'N') as inspectionFlag
FROM outbound_notification_head a
LEFT JOIN Customer c ON a.site = c.site AND a.customer_id = c.CustomerID
LEFT JOIN outbound_notification_detail b ON a.site = b.site AND a.bu_no = b.bu_no AND a.order_no = b.order_no
LEFT JOIN inventory_stock I ON B.site = I.site AND B.part_no = I.part_no AND I.status = '在库' and i.batch_no = b.out_batch_no
LEFT JOIN so_receive_boxes d ON b.site = d.site AND b.bu_no = d.bu_no AND b.order_no = d.order_no
LEFT JOIN so_receive_box_rolls e ON b.site = e.site AND b.bu_no = e.bu_no AND d.box_no = e.box_no AND b.part_no = e.part_no
LEFT JOIN (
SELECT
site,
part_no,
batch_no,
SUM(qty_on_hand) as qty_on_hand
FROM inventory_stock
WHERE status = '在库'
<if test="site != null and site != ''">
AND site = #{site}
</if>
GROUP BY site, part_no, batch_no
) AS inv_agg ON b.site = inv_agg.site AND b.part_no = inv_agg.part_no AND b.out_batch_no = inv_agg.batch_no
LEFT JOIN (
SELECT
d.site,
d.bu_no,
d.order_no,
e.part_no,
SUM(e.roll_qty) as roll_qty
FROM so_receive_boxes d
INNER JOIN so_receive_box_rolls e ON d.site = e.site AND d.bu_no = e.bu_no AND d.box_no = e.box_no
<where>
<if test="site != null and site != ''">
d.site = #{site}
</if>
</where>
GROUP BY d.site, d.bu_no, d.order_no, e.part_no
) AS e_agg ON b.site = e_agg.site AND b.bu_no = e_agg.bu_no AND b.order_no = e_agg.order_no AND b.part_no = e_agg.part_no
<where>
<if test="site != null and site != ''">
AND a.site = #{site}
@ -466,16 +548,7 @@
AND #{endDate} >= a.required_outbound_date
</if>
</where>
GROUP BY
a.site, a.bu_no, a.order_no, a.order_type, a.order_status, a.customer_id, c.customerName,
a.related_order_no, a.related_order_line_no, a.required_outbound_date, a.remarks,
a.erp_order_no, a.erp_order_line_no, a.erp_order_date, a.created_by, a.created_date,
a.updated_by, a.updated_date, a.assigned_by, a.assigned_date, a.closed_by, a.closed_date,
a.archived_by, a.archived_date, a.orderref1, a.orderref2, a.orderref3, a.orderref4, a.orderref5,
a.order_date, a.close_flag, a.out_warehouse, a.customer_order_no, a.show_in_query_flag,
b.part_no, b.part_desc, b.unit, b.required_qty, b.out_warehouse, b.out_batch_no, b.order_qty,
b.related_order_no, b.related_order_line_no, b.std_packing_qty, b.inspection_flag, c.CustomerAbb
ORDER BY a.created_date DESC, b.part_no
ORDER BY a.required_outbound_date DESC, b.part_no
</select>
<!-- 分页查询出库通知单主记录(关联明细) -->
@ -524,20 +597,46 @@
b.order_qty as orderQty,
b.related_order_no as relatedOrderNo,
b.related_order_line_no as relatedOrderLineNo,
ISNULL(SUM(e.roll_qty), 0) as rollQty,
CASE WHEN b.required_qty - ISNULL(SUM(e.roll_qty), 0) > 0
THEN ROUND(b.required_qty - ISNULL(SUM(e.roll_qty), 0), 3)
ISNULL(e_agg.roll_qty, 0) as rollQty,
CASE WHEN b.required_qty - ISNULL(e_agg.roll_qty, 0) > 0
THEN ROUND(b.required_qty - ISNULL(e_agg.roll_qty, 0), 3)
ELSE 0
END as unScanQty,
ISNULL(SUM(i.qty_on_hand), 0) as availableStock,
ISNULL(inv_agg.qty_on_hand, 0) as availableStock,
b.std_packing_qty,
ISNULL(b.inspection_flag,'N') as inspectionFlag
FROM outbound_notification_head a
LEFT JOIN Customer c ON a.site = c.site AND a.customer_id = c.CustomerID
LEFT JOIN outbound_notification_detail b ON a.site = b.site AND a.bu_no = b.bu_no AND a.order_no = b.order_no
LEFT JOIN inventory_stock I ON B.site = I.site AND B.part_no = I.part_no AND I.status = '在库' and i.batch_no = b.out_batch_no
LEFT JOIN so_receive_boxes d ON b.site = d.site AND b.bu_no = d.bu_no AND b.order_no = d.order_no
LEFT JOIN so_receive_box_rolls e ON b.site = e.site AND b.bu_no = e.bu_no AND d.box_no = e.box_no AND b.part_no = e.part_no
LEFT JOIN (
SELECT
site,
part_no,
batch_no,
SUM(qty_on_hand) as qty_on_hand
FROM inventory_stock
WHERE status = '在库'
<if test="query.site != null and query.site != ''">
AND site = #{query.site}
</if>
GROUP BY site, part_no, batch_no
) AS inv_agg ON b.site = inv_agg.site AND b.part_no = inv_agg.part_no AND b.out_batch_no = inv_agg.batch_no
LEFT JOIN (
SELECT
d.site,
d.bu_no,
d.order_no,
e.part_no,
SUM(e.roll_qty) as roll_qty
FROM so_receive_boxes d
INNER JOIN so_receive_box_rolls e ON d.site = e.site AND d.bu_no = e.bu_no AND d.box_no = e.box_no
<where>
<if test="query.site != null and query.site != ''">
d.site = #{query.site}
</if>
</where>
GROUP BY d.site, d.bu_no, d.order_no, e.part_no
) AS e_agg ON b.site = e_agg.site AND b.bu_no = e_agg.bu_no AND b.order_no = e_agg.order_no AND b.part_no = e_agg.part_no
<where>
<if test="query.site != null and query.site != ''">
AND a.site = #{query.site}
@ -576,79 +675,54 @@
AND #{query.endDate} >= a.required_outbound_date
</if>
</where>
GROUP BY
a.site, a.bu_no, a.order_no, a.order_type, a.order_status, a.customer_id, c.customerName,
a.related_order_no, a.related_order_line_no, a.required_outbound_date, a.remarks,
a.erp_order_no, a.erp_order_line_no, a.erp_order_date, a.created_by, a.created_date,
a.updated_by, a.updated_date, a.assigned_by, a.assigned_date, a.closed_by, a.closed_date,
a.archived_by, a.archived_date, a.orderref1, a.orderref2, a.orderref3, a.orderref4, a.orderref5,
a.order_date, a.close_flag, a.out_warehouse, a.customer_order_no, a.show_in_query_flag,
b.part_no, b.part_desc, b.unit, b.required_qty, b.out_warehouse, b.out_batch_no, b.order_qty,
b.related_order_no, b.related_order_line_no, b.std_packing_qty, b.inspection_flag, c.CustomerAbb
ORDER BY a.required_outbound_date DESC, b.part_no
OFFSET #{query.offset} ROWS FETCH NEXT #{query.limit} ROWS ONLY
</select>
<!-- 分页查询出库通知单主记录(关联明细)- 总数查询 -->
<select id="searchOutboundNotificationWithDetailCount" resultType="int">
SELECT COUNT(1) FROM (
SELECT
a.order_no,
b.part_no
FROM outbound_notification_head a
LEFT JOIN Customer c ON a.site = c.site AND a.customer_id = c.CustomerID
LEFT JOIN outbound_notification_detail b ON a.site = b.site AND a.bu_no = b.bu_no AND a.order_no = b.order_no
LEFT JOIN inventory_stock I ON B.site = I.site AND B.part_no = I.part_no AND I.status = '在库' and i.batch_no = b.out_batch_no
LEFT JOIN so_receive_boxes d ON b.site = d.site AND b.bu_no = d.bu_no AND b.order_no = d.order_no
LEFT JOIN so_receive_box_rolls e ON b.site = e.site AND b.bu_no = e.bu_no AND d.box_no = e.box_no AND b.part_no = e.part_no
<where>
<if test="query.site != null and query.site != ''">
AND a.site = #{query.site}
</if>
<if test="query.buNo != null and query.buNo != ''">
AND a.bu_no = #{query.buNo}
</if>
<if test="query.orderNo != null and query.orderNo != ''">
AND a.order_no LIKE '%' + #{query.orderNo} + '%'
</if>
<if test="query.orderType != null and query.orderType != ''">
AND a.order_type = #{query.orderType}
</if>
<if test="query.orderStatus != null and query.orderStatus != ''">
AND a.order_status in
<foreach collection="query.statusArr" close=")" open="(" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="query.orderStatus == null or query.orderStatus == ''">
AND a.order_status not in ('待出库', '草稿')
</if>
<if test="query.customerId != null and query.customerId != ''">
AND a.customer_id LIKE '%' + #{query.customerId} + '%'
</if>
<if test="query.customerName != null and query.customerName != ''">
AND c.customerName LIKE '%' + #{query.customerName} + '%'
</if>
<if test="query.inspectionFlag != null and query.inspectionFlag != ''">
AND ISNULL(b.inspection_flag,'N') = #{query.inspectionFlag}
</if>
<if test="query.startDate != null">
AND a.required_outbound_date >= #{query.startDate}
</if>
<if test="query.endDate != null">
AND #{query.endDate} >= a.required_outbound_date
</if>
</where>
GROUP BY
a.site, a.bu_no, a.order_no, a.order_type, a.order_status, a.customer_id, c.customerName,
a.related_order_no, a.related_order_line_no, a.required_outbound_date, a.remarks,
a.erp_order_no, a.erp_order_line_no, a.erp_order_date, a.created_by, a.created_date,
a.updated_by, a.updated_date, a.assigned_by, a.assigned_date, a.closed_by, a.closed_date,
a.archived_by, a.archived_date, a.orderref1, a.orderref2, a.orderref3, a.orderref4, a.orderref5,
a.order_date, a.close_flag, a.out_warehouse, a.customer_order_no, a.show_in_query_flag,
b.part_no, b.part_desc, b.unit, b.required_qty, b.out_warehouse, b.out_batch_no, b.order_qty,
b.related_order_no, b.related_order_line_no, b.std_packing_qty, b.inspection_flag, c.CustomerAbb
) T
SELECT COUNT(1)
FROM outbound_notification_head a
LEFT JOIN Customer c ON a.site = c.site AND a.customer_id = c.CustomerID
LEFT JOIN outbound_notification_detail b ON a.site = b.site AND a.bu_no = b.bu_no AND a.order_no = b.order_no
<where>
<if test="query.site != null and query.site != ''">
AND a.site = #{query.site}
</if>
<if test="query.buNo != null and query.buNo != ''">
AND a.bu_no = #{query.buNo}
</if>
<if test="query.orderNo != null and query.orderNo != ''">
AND a.order_no LIKE '%' + #{query.orderNo} + '%'
</if>
<if test="query.orderType != null and query.orderType != ''">
AND a.order_type = #{query.orderType}
</if>
<if test="query.orderStatus != null and query.orderStatus != ''">
AND a.order_status in
<foreach collection="query.statusArr" close=")" open="(" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="query.orderStatus == null or query.orderStatus == ''">
AND a.order_status not in ('待出库', '草稿')
</if>
<if test="query.customerId != null and query.customerId != ''">
AND a.customer_id LIKE '%' + #{query.customerId} + '%'
</if>
<if test="query.customerName != null and query.customerName != ''">
AND c.customerName LIKE '%' + #{query.customerName} + '%'
</if>
<if test="query.inspectionFlag != null and query.inspectionFlag != ''">
AND ISNULL(b.inspection_flag,'N') = #{query.inspectionFlag}
</if>
<if test="query.startDate != null">
AND a.required_outbound_date >= #{query.startDate}
</if>
<if test="query.endDate != null">
AND #{query.endDate} >= a.required_outbound_date
</if>
</where>
</select>
<!-- 更新出库通知单状态 -->

Loading…
Cancel
Save