From b8cc4c2db540f26cbdfcf7ae4373c1b7f685726b Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Fri, 13 Sep 2024 08:50:38 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E9=94=80=E5=94=AE=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E9=94=80=E5=94=AE=E5=87=BA=E8=B4=A7=E9=80=9A=E7=9F=A5=EF=BC=9A?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A0=B9=E6=8D=AE=E9=94=80=E5=94=AE=E5=87=BA?= =?UTF-8?q?=E8=B4=A7=E9=80=9A=E7=9F=A5=E5=8D=95=E5=8F=B7=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E9=94=80=E5=94=AE=E5=87=BA=E8=B4=A7=E9=80=9A=E7=9F=A5=E5=8D=95?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E5=88=97=E8=A1=A8=E6=96=B9=E6=B3=95=EF=BC=9B?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A0=B9=E6=8D=AE=E9=94=80=E5=94=AE=E5=87=BA?= =?UTF-8?q?=E8=B4=A7=E9=80=9A=E7=9F=A5=E5=8D=95=E5=8F=B7=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=94=80=E5=94=AE=E5=87=BA=E8=B4=A7=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E5=8D=95=E8=AF=A6=E6=83=85=E5=88=97=E8=A1=A8=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=94=80=E5=94=AE=E5=87=BA=E8=B4=A7=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E5=AE=9E=E4=BD=93=E7=B1=BB=E6=89=80=E6=9C=89=E7=9A=84?= =?UTF-8?q?=E6=88=90=E5=91=98=E5=8F=98=E9=87=8F=E7=9A=84@Excel=E6=B3=A8?= =?UTF-8?q?=E8=A7=A3=EF=BC=9A=E6=96=B0=E5=A2=9E=20width=20=3D=2020,=20need?= =?UTF-8?q?Merge=20=3D=20true=E4=B8=A4=E4=B8=AA=E5=B1=9E=E6=80=A7=EF=BC=8C?= =?UTF-8?q?=E5=90=88=E5=B9=B6=E4=B8=BB=E8=A1=A8=E5=AD=97=E6=AE=B5=E7=9A=84?= =?UTF-8?q?excel=E5=8D=95=E5=85=83=E6=A0=BC=20=E9=94=80=E5=94=AE=E5=87=BA?= =?UTF-8?q?=E8=B4=A7=E9=80=9A=E7=9F=A5=E8=AF=A6=E6=83=85=E9=9B=86=E5=90=88?= =?UTF-8?q?List=E6=96=B0=E5=A2=9E@Excel?= =?UTF-8?q?=E6=B3=A8=E8=A7=A3=20=E9=94=80=E5=94=AE=E5=87=BA=E8=B4=A7?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E6=8E=A7=E5=88=B6=E5=B1=82=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=AF=BC=E5=87=BA=E6=89=80=E6=9C=89=E9=94=80=E5=94=AE?= =?UTF-8?q?=E5=87=BA=E8=B4=A7=E9=80=9A=E7=9F=A5=E5=88=97=E8=A1=A8=E5=90=8E?= =?UTF-8?q?=E7=AB=AF=E6=8E=A5=E5=8F=A3=EF=BC=9A=E6=96=B0=E5=A2=9E=E6=89=B9?= =?UTF-8?q?=E9=87=8F=E9=81=8D=E5=8E=86=E6=96=B9=E6=B3=95=EF=BC=8C=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E5=89=8D=E6=8A=8A=E9=94=80=E5=94=AE=E5=87=BA=E8=B4=A7?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E8=AF=A6=E6=83=85=E9=9B=86=E5=90=88List?= =?UTF-8?q?=E6=94=BE=E5=85=A5=E9=94=80=E5=94=AE=E5=87=BA=E8=B4=A7=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E9=87=8C=EF=BC=8C=E4=B8=80=E8=B5=B7=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=EF=BC=9B=E4=BF=AE=E6=94=B9=E5=AF=BC=E5=87=BA=E5=8F=AF=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E7=9A=84=E9=94=80=E5=94=AE=E5=87=BA=E8=B4=A7=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E5=88=97=E8=A1=A8=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E4=B8=8A=E9=9D=A2=E5=90=8C=E6=A0=B7=E7=9A=84?= =?UTF-8?q?=E6=95=88=E6=9E=9C=20=E4=BF=AE=E6=94=B9=E9=94=80=E5=94=AE?= =?UTF-8?q?=E5=87=BA=E8=B4=A7=E9=80=9A=E7=9F=A5=E5=89=8D=E7=AB=AF=E5=88=97?= =?UTF-8?q?=E8=A1=A8=EF=BC=9A=E4=BD=BF=E7=94=A8=E8=8F=9C=E5=8D=95=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E7=9A=84=E5=BD=A2=E5=BC=8F=E9=9A=90=E8=97=8F=E6=89=80?= =?UTF-8?q?=E6=9C=89=E7=9A=84=E6=A8=A1=E6=9D=BF=E5=AF=BC=E5=87=BA=E6=8C=89?= =?UTF-8?q?=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SysSalesShippingInformController.java | 35 +++++++++++- .../system/domain/SysSalesShippingInform.java | 53 +++++++++--------- .../domain/SysSalesShippingInformDetail.java | 12 ++-- .../SysSalesShippingInformDetailMapper.java | 5 ++ .../ISysSalesShippingInformDetailService.java | 12 ++++ ...sSalesShippingInformDetailServiceImpl.java | 26 +++++++++ .../SysSalesShippingInformDetailMapper.xml | 8 +++ .../salesShippingInform.html | 56 ++++++++++--------- 8 files changed, 147 insertions(+), 60 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesShippingInformController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesShippingInformController.java index 944b0c33..ee55307a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesShippingInformController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesShippingInformController.java @@ -1,6 +1,9 @@ package com.ruoyi.system.controller; +import java.util.Collections; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; import com.ruoyi.aftersales.domain.vo.SelectShippingDeviceVO; import com.ruoyi.erp.domain.ErpBom; @@ -8,10 +11,12 @@ import com.ruoyi.erp.domain.ErpBomVo; import com.ruoyi.purchase.domain.PurchaseOrder; import com.ruoyi.system.domain.SysSalesOrder; import com.ruoyi.system.domain.SysSalesShippingInformDetail; +import com.ruoyi.system.service.ISysSalesShippingInformDetailService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; +import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.enums.BusinessType; @@ -39,6 +44,9 @@ public class SysSalesShippingInformController extends BaseController @Autowired private ISysSalesShippingInformService sysSalesShippingInformService; + @Autowired + private ISysSalesShippingInformDetailService shippingInformDetailService; + @RequiresPermissions("system:salesShippingInform:view") @GetMapping() public String salesShippingInform() @@ -69,8 +77,20 @@ public class SysSalesShippingInformController extends BaseController public AjaxResult export(SysSalesShippingInform sysSalesShippingInform) { List list = sysSalesShippingInformService.selectSysSalesShippingInformList(sysSalesShippingInform); + if (!CollectionUtils.isEmpty(list)){ + //批量遍历 + List collectOutOrderCodes = list.stream().map(SysSalesShippingInform::getOutOrderCode).collect(Collectors.toList()); + Map> detailMap = shippingInformDetailService.selectShippingInformDetailListByCodes(collectOutOrderCodes); + + list.forEach(salesShippingInform -> { + salesShippingInform.setShippingInformDetailList( + detailMap.getOrDefault(salesShippingInform.getOutOrderCode(), Collections.emptyList()) + ); + }); + } + ExcelUtil util = new ExcelUtil(SysSalesShippingInform.class); - return util.exportExcel(list, "销售出货通知数据"); + return util.exportExcel(list, "销售出货通知数据","销售出货通知数据"); } /** * 导出销售出货通知列表 @@ -82,8 +102,19 @@ public class SysSalesShippingInformController extends BaseController public AjaxResult export(@RequestBody String[] outOrderCodes) { List list = sysSalesShippingInformService.getExportListByNos(outOrderCodes); + if (!CollectionUtils.isEmpty(list)){ + //批量遍历 + List collectOutOrderCodes = list.stream().map(SysSalesShippingInform::getOutOrderCode).collect(Collectors.toList()); + Map> detailMap = shippingInformDetailService.selectShippingInformDetailListByCodes(collectOutOrderCodes); + + list.forEach(salesShippingInform -> { + salesShippingInform.setShippingInformDetailList( + detailMap.getOrDefault(salesShippingInform.getOutOrderCode(), Collections.emptyList()) + ); + }); + } ExcelUtil util = new ExcelUtil(SysSalesShippingInform.class); - return util.exportExcel(list, "销售出货通知数据"); + return util.exportExcel(list, "销售出货通知数据","销售出货通知数据"); } /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesShippingInform.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesShippingInform.java index 7ec3b15e..9da3a1d3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesShippingInform.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesShippingInform.java @@ -24,117 +24,118 @@ public class SysSalesShippingInform extends BaseEntity private Long shippingInformId; /** 出库单号 */ - @Excel(name = "出库单号") + @Excel(name = "出库单号", width = 20, needMerge = true) private String outOrderCode; /** 出库状态(0待仓库准备物料、1待售后维护设备1、2待业务确认发货、3待售后维护设备2、4待出库、5部分出库、6全部出库、7已出库、8已取消) */ // @Excel(name = "出库状态", readConverterExp = "0=待仓库准备物料、1待售后维护设备1、2待业务确认发货、3待售后维护设备2、4待出库、5部分出库、6全部出库、7已出库、8已取消") - @Excel(name = "出库状态", dictType = "warehouse_out_status") + @Excel(name = "出库状态", dictType = "warehouse_out_status", width = 20, needMerge = true) private String warehouseOutStatus; /** 关联销售订单号 */ - @Excel(name = "关联销售订单号") + @Excel(name = "关联销售订单号", width = 20, needMerge = true) private String salesOrderCode; /** 出库类型(0销售出库、1生产领料、2员工领料、3委外领料、4公司退货、5工程领料) */ // @Excel(name = "出库类型", readConverterExp = "0=销售出库、1生产领料、2员工领料、3委外领料、4公司退货、5工程领料") - @Excel(name = "出库类型", dictType = "warehouse_out_type") + @Excel(name = "出库类型", dictType = "warehouse_out_type", width = 20, needMerge = true) private String warehouseOutType; /** 出库订单类型(0销售订单、1生产订单、2请购订单、3委外订单、4退换货订单、5开发修改单) */ // @Excel(name = "出库订单类型", readConverterExp = "0=销售订单、1生产订单、2请购订单、3委外订单、4退换货订单、5开发修改单") - @Excel(name = "出库订单类型", dictType = "warehouse_order_type") + @Excel(name = "出库订单类型", dictType = "warehouse_order_type", width = 20, needMerge = true) private String warehouseOrderType; /** 客户代码/id */ - @Excel(name = "客户代码/id") + @Excel(name = "客户ID", width = 20, needMerge = true) private String customerId; /** 客户名称 */ - @Excel(name = "客户名称") + @Excel(name = "客户名称", width = 20, needMerge = true) private String customerName; /** 业务员 */ - @Excel(name = "业务员") + @Excel(name = "业务员", width = 20, needMerge = true) private String businessMembers; /** 客户订单号 */ - @Excel(name = "客户订单号") + @Excel(name = "客户订单号", width = 20, needMerge = true) private String salesOrderNumber; /** 物料合计 */ - @Excel(name = "物料合计") + @Excel(name = "物料合计", width = 20, needMerge = true,isStatistics = true) private Integer materialSum; /** 数量合计 */ - @Excel(name = "数量合计") + @Excel(name = "数量合计", width = 20, needMerge = true,isStatistics = true) private Integer enterpriseSum; /** 收货联系人 */ - @Excel(name = "收货联系人(Ship To)") + @Excel(name = "收货联系人(Ship To)", width = 20, needMerge = true) private String customerContact; /** 联系电话 */ - @Excel(name = "收货联系人电话(Ship To)") + @Excel(name = "收货联系人电话(Ship To)", width = 20, needMerge = true) private String contactNumber; /** 收货地址 */ - @Excel(name = "收货地址(Ship To)") + @Excel(name = "收货地址(Ship To)", width = 20, needMerge = true) private String customerContactAddress; /** 收货联系人 */ - @Excel(name = "收货联系人(Bill To)") + @Excel(name = "收货联系人(Bill To)", width = 20, needMerge = true) private String customerContactBillto; /** 联系电话 */ - @Excel(name = "联系电话(Bill To)") + @Excel(name = "联系电话(Bill To)", width = 20, needMerge = true) private String contactNumberBillto; /** 收货地址 */ - @Excel(name = "收货地址(Bill To)") + @Excel(name = "收货地址(Bill To)", width = 20, needMerge = true) private String contactAddressBillto; /** 不含税总价(RMB) */ - @Excel(name = "不含税总价", readConverterExp = "R=MB") + @Excel(name = "不含税总价", width = 20, needMerge = true,isStatistics = true) private BigDecimal allPriceExcludingTaxRmb; /** 不含税总价(美元) */ - @Excel(name = "不含税总价", readConverterExp = "美=元") + @Excel(name = "不含税总价", width = 20, needMerge = true,isStatistics = true) private BigDecimal allPriceExcludingTaxDollar; /** 含税总价(RMB) */ - @Excel(name = "含税总价", readConverterExp = "R=MB") + @Excel(name = "含税总价", width = 20, needMerge = true,isStatistics = true) private BigDecimal allPriceIncludesTax; /** 计划交付时间 */ @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "计划交付时间", width = 30, dateFormat = "yyyy-MM-dd") + @Excel(name = "计划交付时间", width = 30, dateFormat = "yyyy-MM-dd", needMerge = true) private Date plannedDeliveryTime; /** 客户验收时间 */ @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "客户验收时间", width = 30, dateFormat = "yyyy-MM-dd") + @Excel(name = "客户验收时间", width = 30, dateFormat = "yyyy-MM-dd", needMerge = true) private Date acceptanceTime; /** 付款条件 */ - @Excel(name = "付款条件") + @Excel(name = "付款条件", width = 20, needMerge = true) private String paymentCondition; /** 交付条件 */ - @Excel(name = "交付条件") + @Excel(name = "交付条件", width = 20, needMerge = true) private String deliveryCondition; /** 送货日期 */ @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "送货日期", width = 30, dateFormat = "yyyy-MM-dd") + @Excel(name = "送货日期", width = 30, dateFormat = "yyyy-MM-dd", needMerge = true) private Date deliverTime; - /** 销售出库单详情*/ + /** 销售出货通知详情*/ + @Excel(name = "销售出货通知详情") private List shippingInformDetailList; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesShippingInformDetail.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesShippingInformDetail.java index 1263ee00..035e6f1e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesShippingInformDetail.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesShippingInformDetail.java @@ -23,11 +23,9 @@ public class SysSalesShippingInformDetail extends BaseEntity private String outOrderCode; /** 客户代码/id */ - @Excel(name = "客户代码/id") private String customerId; /** 客户名称 */ - @Excel(name = "客户名称") private String customerName; /** 料号 */ @@ -71,23 +69,23 @@ public class SysSalesShippingInformDetail extends BaseEntity private String materialSpecification; /** 订单数 */ - @Excel(name = "订单数") + @Excel(name = "订单数",isStatistics = true) private Integer makeNum; /** 本次出货数 */ - @Excel(name = "本次出货数") + @Excel(name = "本次出货数",isStatistics = true) private Integer thisShippingNum; /** 已出库数 */ - @Excel(name = "已出库数") + @Excel(name = "已出库数",isStatistics = true) private Integer hasOutOrderNum; /** 本次验收数 */ - @Excel(name = "本次验收数") + @Excel(name = "本次验收数",isStatistics = true) private Integer thisCheckNum; /** 已验收数 */ - @Excel(name = "已验收数") + @Excel(name = "已验收数",isStatistics = true) private Integer hasCheckNum; public void setShippingInformDetailId(Long shippingInformDetailId) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesShippingInformDetailMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesShippingInformDetailMapper.java index 1fafefc5..44a569b0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesShippingInformDetailMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSalesShippingInformDetailMapper.java @@ -90,4 +90,9 @@ public interface SysSalesShippingInformDetailMapper * 根据出库单号查询销售出库详情 * */ List selectSysSalesShippingInformDetailByCode(String outOrderCode); + + /* + * 根据出库单号批量查询销售出库详情 + * */ + List selectSalesShippingInformDetailListByCodes(List collectOutOrderCodes); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesShippingInformDetailService.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesShippingInformDetailService.java index cb157419..50979df8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesShippingInformDetailService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSalesShippingInformDetailService.java @@ -1,6 +1,8 @@ package com.ruoyi.system.service; import java.util.List; +import java.util.Map; + import com.ruoyi.system.domain.SysSalesShippingInformDetail; /** @@ -72,4 +74,14 @@ public interface ISysSalesShippingInformDetailService * @return */ int restoreSysSalesShippingInformDetailById(Long shippingInformDetailId); + + /** + * 根据销售出货通知单号查询销售出货通知单详情列表 + * */ + List selectShippingInformDetailListByCode(String outOrderCode); + + /** + * 根据销售出货通知单号批量获取销售出货通知单详情列表 + * */ + Map> selectShippingInformDetailListByCodes(List collectOutOrderCodes); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesShippingInformDetailServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesShippingInformDetailServiceImpl.java index aa8d6c81..ed95174d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesShippingInformDetailServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesShippingInformDetailServiceImpl.java @@ -1,6 +1,9 @@ package com.ruoyi.system.service.impl; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -46,6 +49,29 @@ public class SysSalesShippingInformDetailServiceImpl implements ISysSalesShippin return sysSalesShippingInformDetailMapper.selectSysSalesShippingInformDetailList(sysSalesShippingInformDetail); } + /** + * 根据销售订单编号查询销售出货通知详情列表 + * + * @param outOrderCode 出库单号 + * @return 销售出货通知详情集合 + */ + @Override + public List selectShippingInformDetailListByCode(String outOrderCode) { + return sysSalesShippingInformDetailMapper.selectSysSalesShippingInformDetailByCode(outOrderCode); + + } + + + /** + * 根据销售出货通知单号批量获取销售出货通知单详情列表 + * */ + @Override + public Map> selectShippingInformDetailListByCodes(List collectOutOrderCodes) { + List details = sysSalesShippingInformDetailMapper.selectSalesShippingInformDetailListByCodes(collectOutOrderCodes); + Map> result = details.stream().collect(Collectors.groupingBy(SysSalesShippingInformDetail::getOutOrderCode)); + return result; + } + /** * 新增销售出货通知详情 * diff --git a/ruoyi-admin/src/main/resources/mapper/system/SysSalesShippingInformDetailMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/SysSalesShippingInformDetailMapper.xml index f07c8e75..74b4ab53 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/SysSalesShippingInformDetailMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/SysSalesShippingInformDetailMapper.xml @@ -51,6 +51,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where out_order_code = #{outOrderCode} + + insert into sys_sales_shipping_inform_detail diff --git a/ruoyi-admin/src/main/resources/templates/system/salesShippingInform/salesShippingInform.html b/ruoyi-admin/src/main/resources/templates/system/salesShippingInform/salesShippingInform.html index 81500fbe..6267d49e 100644 --- a/ruoyi-admin/src/main/resources/templates/system/salesShippingInform/salesShippingInform.html +++ b/ruoyi-admin/src/main/resources/templates/system/salesShippingInform/salesShippingInform.html @@ -49,32 +49,38 @@ 导出 - - 导出销售出货单1 - - - 导出销售出货单2 - - - - 导出销售出货箱单1 - - - 导出销售出货箱单2 - - - - 导出销售出货发票1 - - - 导出销售出货发票2 - - - - - 导出销售出货通知单 - + + + +