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"; + }