From 760a771670adeea9a01df3aafe9c7b5c5f9e5934 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Tue, 19 Nov 2024 16:38:29 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=20=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=89=8D=E7=AB=AF=E9=A1=B5=E9=9D=A2=E6=96=B0=E5=A2=9E=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E6=8C=89=E9=92=AE=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E5=85=A8=E9=83=A8=E5=92=8C=E5=AF=BC=E5=87=BA=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E7=9A=84=E5=89=8D=E7=AB=AF=E6=96=B9=E6=B3=95=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E4=BB=A5=E4=BE=9B=E5=BA=94=E5=95=86?= =?UTF-8?q?=E5=92=8C=E7=89=A9=E6=96=99=E4=B8=BA=E4=B8=BB=E8=A6=81=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=B1=95=E7=A4=BA=E5=AF=BC=E5=87=BA=E7=9A=84=E9=87=87?= =?UTF-8?q?=E8=B4=AD=E8=AE=A2=E5=8D=95Vo=E7=94=A8=E4=BA=8E=E9=87=87?= =?UTF-8?q?=E8=B4=AD=E8=AE=A2=E5=8D=95=E7=9A=84=E5=AF=BC=E5=87=BA=20?= =?UTF-8?q?=E9=87=87=E8=B4=ADController=E5=B1=82=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95=E5=AD=90?= =?UTF-8?q?=E8=A1=A8=E5=88=97=E8=A1=A8=E5=92=8C=E5=AF=BC=E5=87=BA=E5=85=A8?= =?UTF-8?q?=E9=83=A8=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95=E5=AD=90=E8=A1=A8?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3=20?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=89=80=E6=9C=89=E5=8F=AF=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95=E6=95=B0=E6=8D=AE=E5=90=8E?= =?UTF-8?q?=E7=AB=AF=E6=96=B9=E6=B3=95=EF=BC=9B=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95=E5=8F=B7?= =?UTF-8?q?=E6=95=B0=E7=BB=84=E6=9F=A5=E8=AF=A2=E9=87=87=E8=B4=AD=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E9=9B=86=E5=90=88=E5=90=8E=E7=AB=AF=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=9B=E6=96=B0=E5=A2=9E=E5=A4=84=E7=90=86=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E7=9A=84=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=90=8E=E7=AB=AF=E6=96=B9=E6=B3=95=EF=BC=8C?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E9=80=9A=E8=BF=87=E4=BD=BF=E7=94=A8map?= =?UTF-8?q?=EF=BC=8C=E5=A4=84=E7=90=86=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=8F=B7=EF=BC=8C=E7=BB=91=E5=AE=9A=E9=87=87=E8=B4=AD=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=92=8C=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95=E5=AD=90?= =?UTF-8?q?=E8=A1=A8=E7=9A=84=E5=85=B3=E7=B3=BB=EF=BC=8C=E7=84=B6=E5=90=8E?= =?UTF-8?q?=E5=A1=AB=E5=85=85=E7=94=9F=E6=88=90=20ExportPurchaseOrderVo=20?= =?UTF-8?q?=E5=88=97=E8=A1=A8=20=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=AD=90=E8=A1=A8=E6=96=B0=E5=A2=9E=20=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95=E5=8F=B7=E9=9B=86=E5=90=88?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95=E5=AD=90?= =?UTF-8?q?=E8=A1=A8=E5=88=97=E8=A1=A8=E5=90=8E=E7=AB=AF=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/PurchaseOrderController.java | 36 ++++++++ .../ruoyi/purchase/domain/PurchaseOrder.java | 23 +++-- .../purchase/domain/PurchaseOrderChild.java | 12 +-- .../domain/Vo/ExportPurchaseOrderVo.java | 90 +++++++++++++++++++ .../mapper/PurchaseOrderChildMapper.java | 11 +++ .../purchase/mapper/PurchaseOrderMapper.java | 15 ++++ .../service/IPurchaseOrderService.java | 23 +++++ .../impl/PurchaseOrderServiceImpl.java | 78 ++++++++++++++++ .../purchase/PurchaseOrderChildMapper.xml | 8 ++ .../mapper/purchase/PurchaseOrderMapper.xml | 14 +++ .../purchase/purchaseOrder/purchaseOrder.html | 69 +++++++++++--- 11 files changed, 352 insertions(+), 27 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/Vo/ExportPurchaseOrderVo.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java index 450a4781..4ca7831b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java @@ -11,6 +11,7 @@ import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.process.general.service.IProcessService; import com.ruoyi.purchase.domain.*; import com.ruoyi.purchase.domain.Vo.*; @@ -98,6 +99,41 @@ public class PurchaseOrderController extends BaseController return getDataTable(list); } + + /** + * 导出全部采购订单子表列表 + */ + @RequiresPermissions("purchase:purchaseOrderChild:export") + @Log(title = "采购订单子表", businessType = BusinessType.EXPORT) + @PostMapping("/exportAll") + @ResponseBody + public AjaxResult exportAll(PurchaseOrder purchaseOrder) + { + List list = purchaseOrderService.selectAllPurchaseOrderList(purchaseOrder); + List exportPurchaseOrderVos = purchaseOrderService.getExportPurchaseOrderList(list); + ExcelUtil util = new ExcelUtil(ExportPurchaseOrderVo.class); + return util.exportExcel(exportPurchaseOrderVos, "采购订单数据"); + } + + + /** + * 导出采购订单子表列表 + */ + @RequiresPermissions("purchase:purchaseOrderChild:export") + @Log(title = "采购订单子表", businessType = BusinessType.EXPORT) + @PostMapping("/export") + @ResponseBody + public AjaxResult export(@RequestBody String[] purchaseOrderCodes) + { + List list = purchaseOrderService.selectPurchaseOrderChildListByCodes(purchaseOrderCodes); + + List exportPurchaseOrderVos = purchaseOrderService.getExportPurchaseOrderList(list); + ExcelUtil util = new ExcelUtil(ExportPurchaseOrderVo.class); + return util.exportExcel(exportPurchaseOrderVos, "采购订单数据"); + } + + + /** * * 导出采购订单合同 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrder.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrder.java index 95928245..55ddc6e9 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrder.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrder.java @@ -2,6 +2,8 @@ package com.ruoyi.purchase.domain; import java.math.BigDecimal; import java.util.Date; +import java.util.List; + import com.fasterxml.jackson.annotation.JsonFormat; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -78,39 +80,30 @@ public class PurchaseOrder extends BaseEntity /** 到货时间 */ @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "到货时间", width = 30, dateFormat = "yyyy-MM-dd") private Date arrivedTime; /** 仓库ID */ - @Excel(name = "仓库ID") private String stockNo; /** 仓库名称 */ - @Excel(name = "仓库名称") private String stockName; /** 收货人 */ - @Excel(name = "收货人") private String receivePerson; /** 收货电话 */ - @Excel(name = "收货电话") private String receivePersonPhone; /** 收货地址 */ - @Excel(name = "收货地址") private String receiveAddress; /** 采购员 */ - @Excel(name = "采购员") private String purchaseBuyer; /** 使用状态 (0未使用,1使用,2已作废) */ - @Excel(name = "使用状态",dictType = "useStatus") private String useStatus; /** 审核状态(0待审核、1审核通过、2审核拒绝) */ - @Excel(name = "审核状态",dictType = "auditStatus") private String auditStatus; /** 删除标志 */ @@ -140,6 +133,9 @@ public class PurchaseOrder extends BaseEntity /** 申请时间 */ private Date applyTime; + private List purchaseOrderChildList; + + public void setPurchaseOrderId(Long purchaseOrderId) { this.purchaseOrderId = purchaseOrderId; @@ -438,6 +434,14 @@ public class PurchaseOrder extends BaseEntity return applyTime; } + public List getPurchaseOrderChildList() { + return purchaseOrderChildList; + } + + public void setPurchaseOrderChildList(List purchaseOrderChildList) { + this.purchaseOrderChildList = purchaseOrderChildList; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -478,6 +482,7 @@ public class PurchaseOrder extends BaseEntity .append("applyTitle", getApplyTitle()) .append("applyUser", getApplyUser()) .append("applyTime", getApplyTime()) + .append("purchaseOrderChildList", getPurchaseOrderChildList()) .toString(); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java index af62adee..5a569f99 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java @@ -22,7 +22,6 @@ public class PurchaseOrderChild extends BaseEntity private Long purchaseOrderChildId; /** 采购订单号 */ - @Excel(name = "采购订单号") private String purchaseOrderCode; /** 料号 */ @@ -34,11 +33,9 @@ public class PurchaseOrderChild extends BaseEntity private String materialName; /** 物料类型 */ - @Excel(name = "物料类型") private String materialType; /** 物料图片地址 */ - @Excel(name = "物料图片地址") private String materialPhotourl; /** 物料品牌 */ @@ -46,7 +43,7 @@ public class PurchaseOrderChild extends BaseEntity private String materialBrand; /** 物料单位 */ - @Excel(name = "物料单位") + @Excel(name = "物料单位", dictType = "sys_unit_class") private String materialUnit; /** 物料描述 */ @@ -54,7 +51,7 @@ public class PurchaseOrderChild extends BaseEntity private String materialDescribe; /** 物料加工方式 */ - @Excel(name = "物料加工方式") + @Excel(name = "物料加工方式", dictType = "processMethod") private String materialProcessMethod; /** 物料型号 */ @@ -62,15 +59,14 @@ public class PurchaseOrderChild extends BaseEntity private String materialModel; /** 入库部门(0仓库、1采购) */ - @Excel(name = "入库部门(0仓库、1采购)") private String warehouseDept; /** 物料不含税总价(RMB) */ - @Excel(name = "物料不含税总价(RMB)") + @Excel(name = "物料不含税总价") private BigDecimal materialNormbSum; /** 物料含税总价(RMB) */ - @Excel(name = "物料含税总价(RMB)") + @Excel(name = "物料含税总价") private BigDecimal materialRmbSum; /** 计划采购数 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/Vo/ExportPurchaseOrderVo.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/Vo/ExportPurchaseOrderVo.java new file mode 100644 index 00000000..fb1a86a5 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/Vo/ExportPurchaseOrderVo.java @@ -0,0 +1,90 @@ +package com.ruoyi.purchase.domain.Vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** +* 以供应商和物料为主要数据展示导出的采购订单Vo +* */ +@Data +public class ExportPurchaseOrderVo{ + + /** 采购订购单号 */ + @Excel(name = "采购订购单号") + private String purchaseOrderCode; + + /** 供应商ID */ + @Excel(name = "供应商ID") + private String supplierCode; + + /** 供应商名称 */ + @Excel(name = "供应商名称") + private String supplierName; + + /** 不含税总价(RMB) */ + @Excel(name = "不含税总价(RMB)") + private BigDecimal noRmbSum; + + /** 含税总价(RMB) */ + @Excel(name = "含税总价(RMB)") + private BigDecimal rmbSum; + + /** 料号 */ + @Excel(name = "料号") + private String materialNo; + + /** 物料名称 */ + @Excel(name = "物料名称") + private String materialName; + + /** 物料品牌 */ + @Excel(name = "物料品牌") + private String materialBrand; + + /** 物料单位 */ + @Excel(name = "物料单位", dictType = "sys_unit_class") + private String materialUnit; + + /** 物料描述 */ + @Excel(name = "物料描述") + private String materialDescribe; + + /** 物料加工方式 */ + @Excel(name = "物料加工方式", dictType = "processMethod") + private String materialProcessMethod; + + /** 物料型号 */ + @Excel(name = "物料型号") + private String materialModel; + + + /** 物料不含税总价(RMB) */ + @Excel(name = "物料不含税总价") + private BigDecimal materialNormbSum; + + /** 物料含税总价(RMB) */ + @Excel(name = "物料含税总价") + private BigDecimal materialRmbSum; + + /** 计划采购数 */ + @Excel(name = "计划采购数") + private Integer planPurchaseNum; + + /** 实际采购数 */ + @Excel(name = "实际采购数") + private Integer actualPurchaseNum; + + /** 共享库存占用数 */ + @Excel(name = "共享库存占用数") + private Integer sharedInventoryOccupancyNum; + + /** 计划交付时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "计划交付时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date planDeliveryTime; + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderChildMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderChildMapper.java index 11ebb52a..c7a27278 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderChildMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderChildMapper.java @@ -29,6 +29,15 @@ public interface PurchaseOrderChildMapper */ public List selectPurchaseOrderChildList(PurchaseOrderChild purchaseOrderChild); + /** + * 通过采购订单号集合查询采购订单子表列表 + * + * @param purchaseOrderCodes 采购订单号集合 + * @return 采购订单子表集合 + */ + + List selectPurchaseOrderChildListByCodes(List purchaseOrderCodes); + /** * 新增采购订单子表 * @@ -120,4 +129,6 @@ public interface PurchaseOrderChildMapper * 批量新增采购订单子表数据 * */ int batchInsertPurchaseOrderChild(List purchaseOrderChildren); + + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderMapper.java index c157885e..32c095ba 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderMapper.java @@ -29,6 +29,20 @@ public interface PurchaseOrderMapper */ public List selectPurchaseOrderList(PurchaseOrder purchaseOrder); + + /** + * 查询所有可用的采购订单数据 + * */ + List selectAllPurchaseOrderList(PurchaseOrder purchaseOrder); + + + + /** + * 通过采购订单号数组查询采购订单集合 + * */ + List selectPurchaseOrderChildListByCodes(String[] purchaseOrderCodes); + + /** * 新增采购订单 * @@ -68,4 +82,5 @@ public interface PurchaseOrderMapper PurchaseOrder selectPurchaseOrderByOrderCode(String purchaseOrderCode); //校验采购订单编号是否唯一 public Integer checkPurchaseOrderCodeUnique(String purchaseOrderCode); + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderService.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderService.java index b54006c2..cc56fd33 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderService.java @@ -5,6 +5,7 @@ import com.ruoyi.purchase.domain.PurchaseOrder; import com.ruoyi.purchase.domain.PurchaseOrderVo; import com.ruoyi.purchase.domain.PurchasePlan; import com.ruoyi.purchase.domain.Vo.AddPurchaseOrder; +import com.ruoyi.purchase.domain.Vo.ExportPurchaseOrderVo; import com.ruoyi.warehouse.domain.WarehouseStorageOrder; import org.activiti.engine.runtime.ProcessInstance; import org.springframework.transaction.annotation.Transactional; @@ -37,6 +38,26 @@ public interface IPurchaseOrderService */ public List selectPurchaseOrderList(PurchaseOrder purchaseOrder); + + /** + * 查询所有可用的采购订单数据 + * */ + List selectAllPurchaseOrderList(PurchaseOrder purchaseOrder); + + + /** + * 通过采购订单号数组查询采购订单集合 + * */ + List selectPurchaseOrderChildListByCodes(String[] purchaseOrderCodes); + + + + /** + * 处理需要导出的采购订单数据 + * */ + List getExportPurchaseOrderList(List list); + + /** * 新增采购订单 * @@ -105,4 +126,6 @@ public interface IPurchaseOrderService * 采购计划添加采购订单 * */ int addPurchasePlanToPurchaseOrder(AddPurchaseOrder addPurchaseOrder); + + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java index 4cf9739c..4589d900 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java @@ -228,6 +228,84 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService return returnList; } + + /** + * 查询所有可用的采购订单数据 + * */ + @Override + public List selectAllPurchaseOrderList(PurchaseOrder purchaseOrder) { + List purchaseOrderList = purchaseOrderMapper.selectAllPurchaseOrderList(purchaseOrder); + return purchaseOrderList; + } + + /** + * 通过采购订单号数组查询采购订单集合 + * */ + @Override + public List selectPurchaseOrderChildListByCodes(String[] purchaseOrderCodes) { + List purchaseOrderList = purchaseOrderMapper.selectPurchaseOrderChildListByCodes(purchaseOrderCodes); + return purchaseOrderList; + } + + + /** + * 处理需要导出的采购订单数据 + * */ + @Override + public List getExportPurchaseOrderList(List list) { + + if (!CollectionUtils.isEmpty(list)){ + + List purchaseOrderCodes = list.stream().map(PurchaseOrder::getPurchaseOrderCode).collect(Collectors.toList()); + List purchaseOrderChildList = purchaseOrderChildMapper.selectPurchaseOrderChildListByCodes(purchaseOrderCodes); + + // 创建一个 map 用于快速查找主表数据 + Map purchaseOrderMap = list.stream() + .collect(Collectors.toMap(PurchaseOrder::getPurchaseOrderCode, Function.identity())); + + // 创建一个 map 用于快速查找子表数据 + Map> purchaseOrderChildMap = purchaseOrderChildList.stream() + .collect(Collectors.groupingBy(PurchaseOrderChild::getPurchaseOrderCode)); + + // 生成 ExportPurchaseOrderVo 列表 + List exportPurchaseOrderVoList = new ArrayList<>(); + + for (String purchaseOrderCode : purchaseOrderCodes) { + PurchaseOrder purchaseOrder = purchaseOrderMap.get(purchaseOrderCode); + List children = purchaseOrderChildMap.getOrDefault(purchaseOrderCode, Collections.emptyList()); + + for (PurchaseOrderChild child : children) { + ExportPurchaseOrderVo exportPurchaseOrderVo = new ExportPurchaseOrderVo(); + exportPurchaseOrderVo.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode()); + exportPurchaseOrderVo.setSupplierName(purchaseOrder.getSupplierName()); + exportPurchaseOrderVo.setSupplierCode(purchaseOrder.getSupplierCode()); + exportPurchaseOrderVo.setNoRmbSum(purchaseOrder.getNoRmbSum()); + exportPurchaseOrderVo.setRmbSum(purchaseOrder.getRmbSum()); + // 填充子表数据 + exportPurchaseOrderVo.setMaterialNo(child.getMaterialNo()); + exportPurchaseOrderVo.setMaterialName(child.getMaterialName()); + exportPurchaseOrderVo.setMaterialBrand(child.getMaterialBrand()); + exportPurchaseOrderVo.setMaterialDescribe(child.getMaterialDescribe()); + exportPurchaseOrderVo.setMaterialModel(child.getMaterialModel()); + exportPurchaseOrderVo.setMaterialProcessMethod(child.getMaterialProcessMethod()); + exportPurchaseOrderVo.setMaterialUnit(child.getMaterialUnit()); + exportPurchaseOrderVo.setMaterialNormbSum(child.getMaterialNormbSum()); + exportPurchaseOrderVo.setMaterialRmbSum(child.getMaterialRmbSum()); + exportPurchaseOrderVo.setPlanPurchaseNum(child.getPlanPurchaseNum()); + exportPurchaseOrderVo.setActualPurchaseNum(child.getActualPurchaseNum()); + exportPurchaseOrderVo.setSharedInventoryOccupancyNum(child.getSharedInventoryOccupancyNum()); + exportPurchaseOrderVo.setPlanDeliveryTime(child.getPlanDeliveryTime()); + + exportPurchaseOrderVoList.add(exportPurchaseOrderVo); + } + } + + return exportPurchaseOrderVoList; + } + + return Collections.emptyList(); + } + /** * 新增采购订单 * diff --git a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml index bbfc9939..28160d70 100644 --- a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml @@ -45,6 +45,14 @@ where purchase_order_child_id = #{purchaseOrderChildId} + + insert into purchase_order_child diff --git a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderMapper.xml b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderMapper.xml index b4a81b1a..600cd364 100644 --- a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderMapper.xml @@ -66,6 +66,20 @@ where purchase_order_id = #{purchaseOrderId} + + + + + insert into purchase_order diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/purchaseOrder.html b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/purchaseOrder.html index 74482c48..f15d2baa 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/purchaseOrder.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/purchaseOrder.html @@ -56,16 +56,7 @@ @@ -214,6 +205,64 @@ }; $.table.init(options); }); + + + + // 导出 + function exportExcel(formId) { + // $.table.set(); + var purchaseOrderCodeData = []; + var selections = $("#bootstrap-table").bootstrapTable("getSelections"); + if(selections.length === 0){ + $.modal.confirm("确定导出所有采购订单吗?", function() { + var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId; + var params = $("#bootstrap-table").bootstrapTable('getOptions'); + var dataParam = $("#" + currentId).serializeArray(); + dataParam.push({ "name": "orderByColumn", "value": params.sortName }); + dataParam.push({ "name": "isAsc", "value": params.sortOrder }); + $.modal.loading("正在导出数据,请稍后..."); + $.post(prefix + '/exportAll', dataParam, function(result) { + if (result.code == web_status.SUCCESS) { + window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true; + } else if (result.code == web_status.WARNING) { + $.modal.alertWarning(result.msg) + } else { + $.modal.alertError(result.msg); + } + $.modal.closeLoading(); + }); + }); + }else { + $.modal.confirm("确定导出选中的所有采购订单吗?", function () { + //·拼接单号 + for(let i=0;i \ No newline at end of file