diff --git a/src/main/java/com/gaotao/modules/boxManage/controller/BoxForNotificationController.java b/src/main/java/com/gaotao/modules/boxManage/controller/BoxForNotificationController.java index 252f934..631479c 100644 --- a/src/main/java/com/gaotao/modules/boxManage/controller/BoxForNotificationController.java +++ b/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 diff --git a/src/main/java/com/gaotao/modules/boxManage/dao/BoxForNotificationMapper.java b/src/main/java/com/gaotao/modules/boxManage/dao/BoxForNotificationMapper.java index c97a58e..2248b73 100644 --- a/src/main/java/com/gaotao/modules/boxManage/dao/BoxForNotificationMapper.java +++ b/src/main/java/com/gaotao/modules/boxManage/dao/BoxForNotificationMapper.java @@ -61,6 +61,8 @@ public interface BoxForNotificationMapper { // 盒清单相关方法 List searchSoReceiveCasesData(SoReceiveCasesData data); + List searchSoReceiveCasesDataByPage(SoReceiveCasesData data); + int searchSoReceiveCasesDataCount(SoReceiveCasesData data); void deleteSoReceiveCasesData(SoReceiveCasesData data); List validateCaseRoll(@Param("site") String site, @Param("partNo") String partNo, @Param("rollNo") String rollNo, @Param("casesNo") String casesNo); void saveSoReceiveCases(SoReceiveCasesData data); diff --git a/src/main/java/com/gaotao/modules/boxManage/data/SoReceiveCasesData.java b/src/main/java/com/gaotao/modules/boxManage/data/SoReceiveCasesData.java index 9aa4124..e14d226 100644 --- a/src/main/java/com/gaotao/modules/boxManage/data/SoReceiveCasesData.java +++ b/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; } diff --git a/src/main/java/com/gaotao/modules/boxManage/service/BoxForNotificationService.java b/src/main/java/com/gaotao/modules/boxManage/service/BoxForNotificationService.java index 7564c0c..8fb1508 100644 --- a/src/main/java/com/gaotao/modules/boxManage/service/BoxForNotificationService.java +++ b/src/main/java/com/gaotao/modules/boxManage/service/BoxForNotificationService.java @@ -31,6 +31,7 @@ public interface BoxForNotificationService { // 盒清单相关方法 List searchSoReceiveCasesData(SoReceiveCasesData data); + PageUtils searchSoReceiveCasesDataByPage(SoReceiveCasesData data); void deleteSoReceiveCasesData(SoReceiveCasesData data); List validateAndScanCaseRoll(SoReceiveCasesData data); void saveCaseRollList(List dataList); diff --git a/src/main/java/com/gaotao/modules/boxManage/service/impl/BoxForNotificationServiceImpl.java b/src/main/java/com/gaotao/modules/boxManage/service/impl/BoxForNotificationServiceImpl.java index 9abeda7..15c0fb3 100644 --- a/src/main/java/com/gaotao/modules/boxManage/service/impl/BoxForNotificationServiceImpl.java +++ b/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 list = totalCount > 0 + ? boxForNotificationMapper.searchSoReceiveCasesDataByPage(data) + : new ArrayList<>(); + + return new PageUtils(list, totalCount, limit, page); + } + @Override @Transactional public void deleteSoReceiveCasesData(SoReceiveCasesData data) { diff --git a/src/main/resources/mapper/boxManage/BoxForNotificationMapper.xml b/src/main/resources/mapper/boxManage/BoxForNotificationMapper.xml index 571f3c4..f7c9796 100644 --- a/src/main/resources/mapper/boxManage/BoxForNotificationMapper.xml +++ b/src/main/resources/mapper/boxManage/BoxForNotificationMapper.xml @@ -288,6 +288,62 @@ ORDER BY s.create_date DESC + + + + 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 = '在库' + + AND site = #{site} + + 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 + + + d.site = #{site} + + + 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 AND a.site = #{site} @@ -466,16 +548,7 @@ AND #{endDate} >= a.required_outbound_date - 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 @@ -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 = '在库' + + AND site = #{query.site} + + 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 + + + d.site = #{query.site} + + + 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 AND a.site = #{query.site} @@ -576,79 +675,54 @@ AND #{query.endDate} >= a.required_outbound_date - 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