From e64f7a50c61d991ab60643d534099e10bd8e1077 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Mon, 28 Oct 2024 16:14:15 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=E5=B7=A5=E7=A8=8B=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E7=89=A9=E6=96=99=E5=89=8D=E7=AB=AF=20=E7=89=A9=E6=96=99?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E9=A1=B5=E9=9D=A2=E4=BF=AE=E6=94=B9=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E6=96=B0=E5=A2=9E=E9=A2=9C=E8=89=B2=E6=A0=87=E8=AF=86?= =?UTF-8?q?=E5=92=8C=E9=BC=A0=E6=A0=87=E7=A7=BB=E5=8A=A8=E7=89=B9=E6=95=88?= =?UTF-8?q?=EF=BC=9B=E6=96=B0=E5=A2=9EonDblClickCell=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E4=BD=BF=E6=94=AF=E6=8C=81=E5=8F=8C=E5=87=BB=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=89=93=E5=BC=80=E7=89=A9=E6=96=99=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E8=AE=B0=E5=BD=95=E9=A1=B5=E9=9D=A2=20=E7=89=A9?= =?UTF-8?q?=E6=96=99=E5=90=8E=E7=AB=AF=20=E7=89=A9=E6=96=99=E5=AE=9E?= =?UTF-8?q?=E4=BD=93=E7=B1=BB=EF=BC=9A=E6=B6=89=E5=8F=8A=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9A=84=E5=AD=97=E6=AE=B5=E5=8A=A0=E4=B8=8A?= =?UTF-8?q?@FieldCompare=E6=B3=A8=E8=A7=A3=EF=BC=8C=E5=AD=97=E5=85=B8?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E7=9A=84=E5=AD=97=E5=85=B8=E5=8A=A0=E4=B8=8A?= =?UTF-8?q?properties=E6=A0=87=E8=AF=86=20=E7=89=A9=E6=96=99iml=E5=B1=82?= =?UTF-8?q?=EF=BC=9A=E7=89=A9=E6=96=99=E6=96=B0=E5=A2=9E=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=8A=A0=E4=B8=8A=E5=AF=B9diffLogService=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E7=9A=84=E5=A4=84=E7=90=86=EF=BC=9B=E7=89=A9=E6=96=99=E7=9A=84?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E5=92=8C=E4=B8=8D=E5=AE=A1=E6=A0=B8=E7=9A=84?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3=E5=8A=A0=E4=B8=8A=E5=AF=B9?= =?UTF-8?q?diffLogService=E6=A8=A1=E5=9D=97=E7=9A=84=E5=A4=84=E7=90=86?= =?UTF-8?q?=EF=BC=8C=E5=B9=B6=E4=B8=94=E5=8A=A0=E4=B8=8A=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E5=A4=84=E7=90=86=E5=AD=97=E6=AE=B5=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=AE=B0=E5=BD=95=E6=97=A5=E5=BF=97=E4=B8=9A?= =?UTF-8?q?=E5=8A=A1=E6=A8=A1=E5=9D=97=E5=B8=B8=E9=87=8F=E5=AE=9E=E4=BD=93?= =?UTF-8?q?=E7=B1=BB=E6=96=B0=E5=A2=9E=E7=89=A9=E6=96=99=E4=BF=A1=E6=81=AF?= =?UTF-8?q?ERP=5FMATERIAL=20=3D=20"4"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/erp/domain/ErpMaterial.java | 10 ++++- .../service/impl/ErpMaterialServiceImpl.java | 38 +++++++++++++++++++ .../templates/erp/material/material.html | 20 +++++++++- .../constant/BusinessKeysConstants.java | 6 ++- 4 files changed, 69 insertions(+), 5 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpMaterial.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpMaterial.java index 95e8884a..857d0e87 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpMaterial.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpMaterial.java @@ -1,6 +1,7 @@ package com.ruoyi.erp.domain; import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.annotation.FieldCompare; import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.system.domain.OutsourceProcess; import com.ruoyi.system.domain.SysTechnicalTeam; @@ -63,24 +64,29 @@ public class ErpMaterial extends BaseEntity @Excel(name = "加工方式",sort = 9,dictType = "processMethod") private String processMethod; - /** 单位 */ + /** 单位(pcs-pcs、kg-kg、g-g、M-M、ML-ML、套-套、卷-卷、双-双、KPCS-KPCS、箱-箱、桶-桶、盒-盒、台-台、只-只) */ + @FieldCompare(chineseName = "单位",properties = "pcs:pcs,kg:kg,g:g,M:M,ML:ML,套:套,卷:卷,双:双,KPCS:KPCS,箱:箱,桶:桶,盒:盒,台:台,只:只") @Excel(name = "单位",sort = 6) private String unit; /** 物料型号 */ + @FieldCompare(chineseName = "型号") @Excel(name = "型号",sort = 7) private String materialModel; /** 品牌 */ + @FieldCompare(chineseName = "品牌") @Excel(name = "品牌",sort = 8) private String brand; /** 描述 */ + @FieldCompare(chineseName = "描述") @Excel(name = "描述",sort = 9) private String describe; - /** 入库部门 */ + /** 入库部门(0仓库、1采购) */ + @FieldCompare(chineseName = "入库部门",properties = "0:仓库,1:采购") @Excel(name = "入库部门",sort = 10,dictType = "warehouseDept") private String warehouseDept; /*工程员*/ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java index a625adde..66aa7b2e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpMaterialServiceImpl.java @@ -1,6 +1,8 @@ package com.ruoyi.erp.service.impl; import com.github.pagehelper.Page; +import com.ruoyi.common.constant.BusinessKeysConstants; +import com.ruoyi.common.core.domain.entity.SysFieldDifferent; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.page.PageDomain; import com.ruoyi.common.core.page.TableSupport; @@ -8,6 +10,7 @@ import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.service.ICommonService; import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.FieldCompareUtil; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.erp.domain.ErpMaterial; @@ -34,6 +37,7 @@ import com.ruoyi.warehouse.domain.WarehouseInventoryInquiry; import com.ruoyi.warehouse.mapper.WarehouseInventoryInquiryMapper; import com.ruoyi.warehouse.mapper.WarehouseStorageOrderDetailMapper; import com.ruoyi.warehouse.mapper.WarehouseStorageOrderMapper; +import lombok.SneakyThrows; import org.activiti.engine.TaskService; import org.activiti.engine.impl.persistence.entity.TaskEntityImpl; import org.activiti.engine.runtime.ProcessInstance; @@ -126,6 +130,9 @@ public class ErpMaterialServiceImpl implements IErpMaterialService @Autowired private BaseEmpRequisiteOrderChildMapper requisiteOrderChildMapper; + @Autowired + private ISysDiffLogService diffLogService; + private final static String RMB = "1"; //RMB @@ -260,6 +267,14 @@ public class ErpMaterialServiceImpl implements IErpMaterialService erpMaterial.setCreateTime(new Date()); int result = erpMaterialMapper.insertErpMaterial(erpMaterial); Long id = erpMaterial.getId(); + //新增修改记录数据 + SysDiffLog sysDiffLog = new SysDiffLog(); + sysDiffLog.setBusinessId(id); + sysDiffLog.setBusinessKey(BusinessKeysConstants.ERP_MATERIAL); + int insertSysDiffLog = diffLogService.insertSysDiffLog(sysDiffLog); + if (insertSysDiffLog <= 0){ + throw new BusinessException("新增物料信息数据修改记录失败"); + } String fileIdStr = erpMaterial.getFileIdStr(); if(StringUtils.isNotBlank(fileIdStr)){ // 保存附件关联 @@ -311,6 +326,7 @@ public class ErpMaterialServiceImpl implements IErpMaterialService * @param erpMaterial 物料信息 * @return 结果 */ + @SneakyThrows @Override public int updateErpMaterial(ErpMaterial erpMaterial) { @@ -338,6 +354,16 @@ public class ErpMaterialServiceImpl implements IErpMaterialService } attachFileService.updateAttachIdByIdList(photoAttachId, fileIdList); } + + ErpMaterial oldErpMaterial = erpMaterialMapper.selectErpMaterialById(id); + //修改数据日记修改记录表 + List compare = FieldCompareUtil.compare(ErpMaterial.class, erpMaterial, oldErpMaterial); + if (!CollectionUtils.isEmpty(compare)){ + int updateSysDiffLog = diffLogService.updateSysDiffLogByBusiness(id, BusinessKeysConstants.ERP_MATERIAL, compare); + if (updateSysDiffLog <= 0){ + throw new BusinessException("修改物料信息数据修改记录失败"); + } + } int updateResult = erpMaterialMapper.updateErpMaterial(erpMaterial); if(erpMaterial.getProcessMethod().equals("2")){ List processes = erpMaterial.getProcessList(); @@ -365,6 +391,7 @@ public class ErpMaterialServiceImpl implements IErpMaterialService * @param erpMaterial 物料信息 * @return 结果 */ + @SneakyThrows @Override public int updateErpMaterialAuditInfo(ErpMaterial erpMaterial) { @@ -392,6 +419,17 @@ public class ErpMaterialServiceImpl implements IErpMaterialService } attachFileService.updateAttachIdByIdList(photoAttachId, fileIdList); } + + ErpMaterial oldErpMaterial = erpMaterialMapper.selectErpMaterialById(id); + //修改数据日记修改记录表 + List compare = FieldCompareUtil.compare(ErpMaterial.class, erpMaterial, oldErpMaterial); + if (!CollectionUtils.isEmpty(compare)){ + int updateSysDiffLog = diffLogService.updateSysDiffLogByBusiness(id, BusinessKeysConstants.ERP_MATERIAL, compare); + if (updateSysDiffLog <= 0){ + throw new BusinessException("修改物料信息数据修改记录失败"); + } + } + int updateResult = erpMaterialMapper.updateErpMaterial(erpMaterial); return updateResult; } diff --git a/ruoyi-admin/src/main/resources/templates/erp/material/material.html b/ruoyi-admin/src/main/resources/templates/erp/material/material.html index 2bb2c0bd..f63e0100 100644 --- a/ruoyi-admin/src/main/resources/templates/erp/material/material.html +++ b/ruoyi-admin/src/main/resources/templates/erp/material/material.html @@ -136,7 +136,15 @@ modalName: "物料信息", fixedColumns: true, // 启用冻结列 fixedRightNumber: 1, // 冻结右列个数 - height: $(window).height() - 100, + onDblClickCell: function(field, value, row, $element) { + var businessId = row.id; + var businessKey = "4"; + if(field == 'updateTime'){ + var url = ctx + "system/diffLog/getDiffDataList/" + businessId + "/" + businessKey; + $.modal.open("数据修改记录", url); + } + + }, //双击单列字段触发事件 columns: [ {checkbox: true}, {title: '主键ID',field: 'id',visible: false}, @@ -212,7 +220,15 @@ }, {title: '申请时间',field: 'applyTime',align: 'center',sortable: true,}, {title: '录入时间',field: 'createTime',align: 'center',sortable: true}, - {title: '上次更新时间',field: 'updateTime',align: 'center'}, + {title: '上次更新时间',field: 'updateTime',align: 'center', + formatter: function(value, row, index) { + if (value) { + return '' + value + ''; + } else { + return value; + } + } + }, {title: '操作',align: 'center', formatter: function(value, row, index) { var actions = []; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/BusinessKeysConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/BusinessKeysConstants.java index 70b19a61..c6cf04fc 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/BusinessKeysConstants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/BusinessKeysConstants.java @@ -11,7 +11,7 @@ public class BusinessKeysConstants { //常量命名规则:记得要大写 - /** 测试产品型号管理 */ + /** 产品型号管理 */ public static final String PRODUCT_MODEL = "1"; /** 仓库信息 */ @@ -19,4 +19,8 @@ public class BusinessKeysConstants { /** 客户基本信息 */ public static final String SYS_CUSTOMER = "3"; + + /** 工程物料信息 */ + public static final String ERP_MATERIAL = "4"; + }