From c12ebe9169f1a3e855d1c348d81cce0b34381875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=99=93=E8=BF=AA?= <2596750866@qq.com> Date: Wed, 24 Jul 2024 16:55:44 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E5=B7=A5=E7=A8=8B=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?BOM=E4=BF=A1=E6=81=AF=20=E4=BF=AE=E6=94=B9bom=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=AF=BC=E5=87=BA=E6=8C=89=E9=92=AE=E7=BB=91?= =?UTF-8?q?=E5=AE=9A=E6=96=B9=E6=B3=95=EF=BC=8C=E6=96=B0=E5=A2=9E=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=A4=9A=E9=80=89=E9=80=89=E4=B8=ADbom=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=AF=BC=E5=87=BA=E6=95=B0=E6=8D=AE=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=9B=20=E4=BF=AE=E6=94=B9ErpBom=E5=AE=9E=E4=BD=93=E7=B1=BB?= =?UTF-8?q?=EF=BC=8C=E8=B0=83=E6=95=B4=E5=AF=BC=E5=87=BA=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E5=8C=85=E5=90=AB=E7=9A=84=E5=AD=97=E6=AE=B5=E5=8F=8A=E9=A1=BA?= =?UTF-8?q?=E5=BA=8F=EF=BC=8C=E6=96=B0=E5=A2=9E=E8=AF=B4=E6=98=8E=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=AD=97=E6=AE=B5=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E7=B1=BB=E5=9E=8B=E7=9A=84=E5=AF=BC=E5=87=BA=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=EF=BC=9B=20=E4=BF=AE=E6=94=B9bom=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E7=9A=84=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=9B=20=E4=BF=AE=E6=94=B9mapper=E5=8F=8A=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=8C=E6=96=B0=E5=A2=9E=E6=8C=89bom=E5=8F=B7=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=89=B9=E9=87=8F=E6=9F=A5=E8=AF=A2bom=E5=8F=8A?= =?UTF-8?q?=E9=98=B6=E5=B1=82=E4=BF=A1=E6=81=AF=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../erp/controller/ErpBomController.java | 8 +- .../java/com/ruoyi/erp/domain/ErpBom.java | 31 ++++--- .../com/ruoyi/erp/mapper/ErpBomMapper.java | 8 ++ .../com/ruoyi/erp/service/IErpBomService.java | 2 + .../erp/service/impl/ErpBomServiceImpl.java | 17 ++++ .../resources/mapper/erp/ErpBomMapper.xml | 37 ++++++++ .../main/resources/templates/erp/bom/bom.html | 90 ++++++++++++++----- 7 files changed, 156 insertions(+), 37 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpBomController.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpBomController.java index c73af039..b10d8743 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpBomController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpBomController.java @@ -138,10 +138,12 @@ public class ErpBomController extends BaseController @Log(title = "ErpBom", businessType = BusinessType.EXPORT) @PostMapping("/export") @ResponseBody - public AjaxResult export(ErpBomVo erpBom) + public AjaxResult export(@RequestBody String[] bomNos) { - erpBom.setParentId(0L); - List list = erpBomService.getExportList(erpBom); +// erpBom.setParentId(0L); + +// List list = erpBomService.getExportList(erpBom); + List list = erpBomService.getExportListByNos(bomNos); ExcelUtil util = new ExcelUtil(ErpBom.class); return util.exportExcel(list, "bom数据"); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBom.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBom.java index e7a1e53c..b5b20298 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBom.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBom.java @@ -1,5 +1,6 @@ package com.ruoyi.erp.domain; +import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.BaseEntity; import org.apache.commons.lang3.builder.ToStringBuilder; @@ -26,40 +27,43 @@ public class ErpBom extends BaseEntity private String delFlag; /** bom号 */ + @Excel(name = "bom号",sort = 2) private String bomNo; /** 料号 */ - @Excel(name = "料号",sort = 2) + @Excel(name = "料号",sort = 3) private String materialNo; + + @Excel(name = "图片",sort = 9) private String photoUrl; /** 物料名称 */ - @Excel(name = "品名",sort = 3) + @Excel(name = "物料名称",sort = 4) private String materialName; /** 物料类型 */ - @Excel(name="物料类型") +// @Excel(name="物料类型") private String materialType; /** 加工方式 */ - @Excel(name = "半成品类型",sort = 6,dictType = "processMethod") + @Excel(name = "半成品类型",sort = 7,dictType = "processMethod") private String processMethod; /** 单位 */ - @Excel(name = "单位",sort = 7) + @Excel(name = "单位",sort = 8) private String unit; /** 品牌 */ - @Excel(name = "品牌",sort = 5) + @Excel(name = "品牌",sort = 6) private String brand; /** 描述 */ - @Excel(name = "描述",sort = 4) + @Excel(name = "描述",sort = 5) private String describe; private String warehouseDept; /** 用量 */ - @Excel(name = "用量",sort = 8) +// @Excel(name = "用量",sort = 8) private Long useNum; /** 损耗率 */ @@ -75,7 +79,7 @@ public class ErpBom extends BaseEntity /** 排序 */ private Long sortNo; - @Excel(name = "工程员",sort = 9) +// @Excel(name = "工程员",sort = 9) private String engineer; /** 审核状态 */ @@ -103,9 +107,12 @@ public class ErpBom extends BaseEntity private String applyTitle; /** 申请人 */ + @Excel(name = "申请人",sort = 10) private String applyUser; /** 申请时间 */ + @Excel(name = "申请时间",dateFormat = "yyyy-MM-dd HH:mm:ss",sort = 11) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date applyTime; private Long photoAttachId; @@ -114,10 +121,14 @@ public class ErpBom extends BaseEntity private String removeFileIdStr; + //上次更新时间 + @Excel(name = "上次更新时间",dateFormat = "yyyy-MM-dd HH:mm:ss",sort = 12) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; /** bom信息 */ private List erpBomList; - @Excel(name = "说明文件",sort = 10) + @Excel(name = "说明文件",sort = 13) private String documents; public String getDocuments() { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpBomMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpBomMapper.java index 034f6730..980b6dc7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpBomMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpBomMapper.java @@ -139,4 +139,12 @@ public interface ErpBomMapper List selectSubBomsByParentMaterialNo(Map params); List selectErpBomByParentIds(Map params); + + /** + * 查询bom列表 + * + * @param bomNos bom + * @return bom集合 + */ + public List selectErpBomListByBomNos(String[] bomNos); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpBomService.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpBomService.java index 6a426854..0405206a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpBomService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpBomService.java @@ -112,6 +112,8 @@ public interface IErpBomService List getExportList(ErpBomVo erpBom); + public List getExportListByNos(String[] bomNos); + String importData(List bomImportVos,boolean updateSupport); public ProcessInstance submitApply(ErpBom erpBom); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java index 237a2573..056f4435 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java @@ -459,6 +459,23 @@ private ISysAttachService attachService; return resultList; } + @Override + public List getExportListByNos(String[] bomNos) { + List resultList = new ArrayList<>(); + List zeroLevelList = erpBomMapper.selectErpBomListByBomNos(bomNos); + if(CollectionUtils.isNotEmpty(zeroLevelList)){ + for (ErpBomVo bom:zeroLevelList) { + bom.setParentId(0L); + resultList.add(bom); + ErpBom bom1 = new ErpBom(); + bom1.setParentId(bom.getId()); + List subLevelList = selectErpBomAllLevelList(bom1); + resultList.addAll(subLevelList); + } + } + return resultList; + } + /** * 导入数据 * diff --git a/ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml b/ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml index 8f9431d2..8df110c5 100644 --- a/ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml @@ -521,4 +521,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" on erp_material.id = file.rel_id where erp.parent_id in (#{parentId}) + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/erp/bom/bom.html b/ruoyi-admin/src/main/resources/templates/erp/bom/bom.html index af806cde..acb57174 100644 --- a/ruoyi-admin/src/main/resources/templates/erp/bom/bom.html +++ b/ruoyi-admin/src/main/resources/templates/erp/bom/bom.html @@ -76,7 +76,7 @@ 添加 - + 导出 @@ -126,6 +126,7 @@ sortStable: true, // 设置为 true 将获得稳定的排序 modalName: "bom", detailView: true, + adaptive: true, fixedColumns: true, // 启用冻结列 rightFixedColumns:1, fixedRightNumber: 1, // 冻结右列个数 @@ -144,47 +145,52 @@ columns: [{ checkbox: true }, - { title: '主键ID',field: 'id'}, - { title: '流程实例ID',field: 'instanceId',visible: false}, - { title: '流程提交实例ID',field: 'submitInstanceId',visible: false}, - { title: '流程作废实例ID', field: 'cancelInstanceId',visible: false}, - { title: '流程恢复实例ID',field: 'restoreInstanceId',visible: false}, - { title: '流程实例类型',field: 'instanceTypeName', visible: false}, - { title: '申请人ID',field: 'applyUser',visible: false}, + { title: '主键ID',field: 'id',visible: false}, + { title: 'bom号',field: 'bomNo', sortable: true,}, + { title: '料号',field: 'materialNo', sortable: true,}, + { title: '物料名称',field: 'materialName', sortable: true,}, + {title: '描述',field: 'describe'}, + { title: '品牌',field: 'brand', sortable: true,}, + {title: '半成品类型',field: 'processMethod', + formatter: function(value, row, index) {return $.table.selectDictLabel(processMethodDatas, value);} + }, + { title: '单位',field: 'unit'}, + { title: '流程实例ID',field: 'instanceId',visible: false}, + { title: '流程提交实例ID',field: 'submitInstanceId',visible: false}, + { title: '流程作废实例ID', field: 'cancelInstanceId',visible: false}, + { title: '流程恢复实例ID',field: 'restoreInstanceId',visible: false}, + { title: '流程实例类型',field: 'instanceTypeName', visible: false}, + { title: '图片',field: 'photoUrl',formatter: function(value, row, index) {return $.table.imageView(value);}}, { title: '申请人',field: 'applyUserName', - formatter: function(value, row, index) {return '' + (value ? value : "-") + '';} + formatter: function(value, row, index) {return '' + (value ? value : "-") + '';} }, { title: '申请时间',field: 'applyTime',sortable: true,}, - { title: '当前任务ID',field: 'taskId',visible: false,}, - { title: '待办用户ID',field: 'todoUserId',visible: false,}, - { title: '当前任务名称',field: 'taskName',align: 'center', + {title: '上次更新时间',field: 'updateTime',}, + { title: '当前状态',field: 'taskName',align: 'center', formatter: function(value, row, index) { return '' + value + ''; } }, - { title: '审核状态',field: 'auditStatus',sortable: true, + + { title: '申请人ID',field: 'applyUser',visible: false}, + { title: '当前任务ID',field: 'taskId',visible: false,}, + { title: '待办用户ID',field: 'todoUserId',visible: false,}, + { title: '审核状态',field: 'auditStatus',sortable: true,visible: false, formatter: function(value, row, index) { return $.table.selectDictLabel(auditStatusDatas, value); } }, - { title: '使用状态',field: 'useStatus',sortable: true, + { title: '使用状态',field: 'useStatus',sortable: true,visible: false, formatter: function(value, row, index) { return $.table.selectDictLabel(useStatusDatas, value); } }, - { title: '工程员',field: 'engineer', sortable: true,}, - { title: 'bom号',field: 'bomNo', sortable: true,}, - { title: '关联料号',field: 'materialNo', sortable: true,}, - { title: '图片',field: 'photoUrl',formatter: function(value, row, index) {return $.table.imageView(value);}}, - { title: '物料名称',field: 'materialName', sortable: true,}, - { title: '物料类型',field: 'materialType',sortable: true, + { title: '工程员',field: 'engineer', sortable: true,visible: false}, + { title: '物料类型',field: 'materialType',sortable: true,visible: false, formatter: function(value, row, index) {return $.table.selectCategoryLabel(materialTypeDatas, value);}}, - { title: '加工方式',field: 'processMethod',sortable: true, + { title: '加工方式',field: 'processMethod',sortable: true,visible: false, formatter: function(value, row, index) {return $.table.selectDictLabel(processMethodDatas, value);} }, - { title: '单位',field: 'unit', sortable: true,}, - { title: '品牌',field: 'brand', sortable: true,}, - {title: '描述',field: 'describe', sortable: true,}, { title: '父级id',field: 'parentId',visible:false }, {title: '层级',field: 'level', visible:false, formatter: function(value, row, index) { @@ -740,6 +746,42 @@ } }); } + function exportExcel(formId) { + // $.table.set(); + var bomNoData = []; + var selections = $("#bootstrap-table").bootstrapTable("getSelections"); + if(selections.length === 0){ + $.modal.alertWarning("请至少选择一条bom信息"); + return; + }else { + $.modal.confirm("确定导出选中的所有" + table.options.modalName + "吗?", function () { + //·拼接单号 + for(let i=0;i