辅助属性和一些优化

This commit is contained in:
磷叶 2025-03-11 15:50:35 +08:00
parent 0222b8573f
commit 431a718d2e
14 changed files with 111 additions and 35 deletions

View File

@ -15,7 +15,8 @@ public class K3ProdField {
public static final String F_IS_REWORK = "FIsRework"; // 是否返工
public static final String F_MATERIAL_ID = "FMaterialId"; // 物料ID
public static final String FMTONO = "FMTONO"; // 计划跟踪号
public static final String FAUXPROPID = "FAuxPropId"; // 辅助属性
public static final String FAUXPROPID = "FAuxPropId"; // 辅助属性ID
public static final String FAUXPROP = "FAuxPropId.FF100002.FNumber"; // 辅助属性
public static final String F_ROW_ID = "FRowId"; // 明细.行标识
public static final String F_MEMO_ITEM = "FMemoItem"; // 明细.备注
public static final String F_CONVEY_DATE = "FConveyDate"; // 明细.下达日期

View File

@ -305,6 +305,9 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
}
public static LocalDate toLocalDate(Date date) {
if (date == null) {
return null;
}
return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
}

View File

@ -254,6 +254,7 @@ public class ExcelUtil<T>
}
catch (Exception e)
{
e.printStackTrace();
log.error("导入Excel异常{}", e.getMessage());
throw new UtilException(e.getMessage());
}

View File

@ -557,7 +557,7 @@ public class SysUserServiceImpl implements ISysUserService
ServiceUtil.assertion(operator == null, "操作人不存在");
// 新增一个日志
LogImportVO importLog = logImportService.addDefaultLog(LogImportType.IMPORT, LogImportBizType.PRICE, operator);
LogImportVO importLog = logImportService.addDefaultLog(LogImportType.IMPORT, LogImportBizType.USER, operator);
ServiceUtil.assertion(importLog == null, "创建导入日志失败");
// 获取Security上下文

View File

@ -0,0 +1,39 @@
package com.ruoyi.system.user.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.constant.DictType;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.yh.logImportDetail.domain.interfaces.ImportContent;
import lombok.Data;
import org.apache.poi.ss.usermodel.IndexedColors;
/**
* @author wjh
* 2025/3/11
*/
@Data
public class UserImportContentVO extends SysUser implements ImportContent {
@Excel(
name = "导入结果",
dictType = DictType.LOG_IMPORT_DETAIL_TYPE,
comboReadDict = true,
backgroundColor = IndexedColors.YELLOW,
headerBackgroundColor = IndexedColors.YELLOW,
color = IndexedColors.RED,
headerColor = IndexedColors.RED,
sort = 0
)
private String importResult;
@Excel(
name = "导入信息",
width = 30,
backgroundColor = IndexedColors.YELLOW,
headerBackgroundColor = IndexedColors.YELLOW,
color = IndexedColors.RED,
headerColor = IndexedColors.RED,
sort = 1
)
private String importMessage;
}

View File

@ -1,5 +1,6 @@
package com.ruoyi.yh.logImport.domain.enums;
import com.ruoyi.system.user.domain.UserImportContentVO;
import com.ruoyi.yh.logImportDetail.domain.interfaces.ImportContent;
import com.ruoyi.yh.material.domain.vo.MaterialImportContentVO;
import com.ruoyi.yh.price.domain.vo.PriceImportContentVO;
@ -20,7 +21,9 @@ public enum LogImportBizType {
PRICE("1", "单价", PriceImportContentVO.class),
PROD_ORDER("2", "生产订单", ProdOrderImportContentVO.class),
MATERIAL("3", "物料", MaterialImportContentVO.class),
UNIT("4", "单位", UnitImportContentVO.class);
UNIT("4", "单位", UnitImportContentVO.class),
USER("5", "用户", UserImportContentVO.class);
private final String type;
private final String msg;

View File

@ -1,16 +1,17 @@
package com.ruoyi.yh.prodOrder.domain;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.constant.DictType;
import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
/**
* 生产订单对象 bst_prod_order
*
@ -147,6 +148,9 @@ public class ProdOrder extends BaseEntity
@ApiModelProperty("计划跟踪号")
private String erpMtoNo;
@ApiModelProperty("ERP辅助属性")
@ApiModelProperty("ERP辅助属性ID")
private String fauxPropId;
@ApiModelProperty("ERP辅助属性")
private String fauxProp;
}

View File

@ -47,6 +47,7 @@
bpo.base_unit_name,
bpo.erp_mto_no,
bpo.faux_prop_id,
bpo.faux_prop,
sd.dept_name as work_shop_name
from bst_prod_order bpo
left join sys_dept sd on sd.dept_id = bpo.dept_id
@ -71,7 +72,8 @@
<if test="query.erpMaterialId != null and query.erpMaterialId != ''"> and bpo.erp_material_id = #{query.erpMaterialId}</if>
<if test="query.erpBaseUnitId != null and query.erpBaseUnitId != ''"> and bpo.erp_base_unit_id = #{query.erpBaseUnitId}</if>
<if test="query.erpMtoNo != null and query.erpMtoNo != ''"> and bpo.erp_mto_no = #{query.erpMtoNo}</if>
<if test="query.fauxPropId != null and query.fauxPropId != ''"> and bpo.faux_prop_id like concat('%', #{query.fauxPropId}, '%')</if>
<if test="query.fauxPropId != null and query.fauxPropId != ''"> and bpo.faux_prop_id = #{query.fauxPropId}</if>
<if test="query.fauxProp != null and query.fauxProp != ''"> and bpo.faux_prop like concat('%', #{query.fauxProp}, '%')</if>
<if test="query.materialNumber != null and query.materialNumber != ''">
and bpo.material_number like concat('%',#{query.materialNumber},'%')
</if>
@ -194,6 +196,7 @@
<if test="baseUnitName != null">base_unit_name,</if>
<if test="erpMtoNo != null">erp_mto_no,</if>
<if test="fauxPropId != null">faux_prop_id,</if>
<if test="fauxProp != null">faux_prop,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="erpId != null and erpId != ''">#{erpId},</if>
@ -232,6 +235,7 @@
<if test="baseUnitName != null">#{baseUnitName},</if>
<if test="erpMtoNo != null">#{erpMtoNo},</if>
<if test="fauxPropId != null">#{fauxPropId},</if>
<if test="fauxProp != null">#{fauxProp},</if>
</trim>
</insert>
@ -286,6 +290,7 @@
<if test="data.baseUnitName != null">base_unit_name = #{data.baseUnitName},</if>
<if test="data.erpMtoNo != null">erp_mto_no = #{data.erpMtoNo},</if>
<if test="data.fauxPropId != null">faux_prop_id = #{data.fauxPropId},</if>
<if test="data.fauxProp != null">faux_prop = #{data.fauxProp},</if>
</sql>
<delete id="deleteProdOrderById" parameterType="Long">

View File

@ -144,6 +144,9 @@ public class ProdOrderConverterImpl implements ProdOrderConverter {
case K3ProdField.FAUXPROPID:
po.setFauxPropId(row.getString(i));
break;
case K3ProdField.FAUXPROP:
po.setFauxProp(row.getString(i));
break;
default: break;
}
}

View File

@ -185,7 +185,8 @@ public class ProdOrderServiceImpl implements ProdOrderService
K3ProdField.F_NO_STOCK_IN_QTY,
K3ProdField.F_BASE_NO_STOCK_IN_QTY,
K3ProdField.FMTONO,
K3ProdField.FAUXPROPID
K3ProdField.FAUXPROPID,
K3ProdField.FAUXPROP
);
int startRow = 0;
int limit = 10000;

View File

@ -1,13 +1,14 @@
package com.ruoyi.yh.reportOrderProd.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.constant.DictType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDate;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.constant.DictType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author wjh
* 2024/11/19
@ -57,6 +58,9 @@ public class ReportOrderProdVO extends ReportOrderProd {
@ApiModelProperty("订单基础单位名称")
private String baseUnitName;
@ApiModelProperty("订单辅助属性")
private String orderFauxProp;
@ApiModelProperty("订单基础未入库数量")
private BigDecimal orderErpBaseNoStockInQty;

View File

@ -32,6 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bpo.erp_status as order_erp_status,
bpo.material_number as order_material_number,
bpo.erp_mto_no as order_erp_mto_no,
bpo.faux_prop as order_faux_prop,
bu.erp_name as unit_name,
bu_b.erp_name as base_unit_name,
br.report_date as report_date,

View File

@ -1,5 +1,21 @@
package com.ruoyi.web.yh;
import java.util.Collections;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.LogTitle;
import com.ruoyi.common.core.controller.BaseController;
@ -12,13 +28,6 @@ import com.ruoyi.yh.logImport.domain.LogImportQuery;
import com.ruoyi.yh.logImport.domain.LogImportVO;
import com.ruoyi.yh.logImport.service.LogImportAssembler;
import com.ruoyi.yh.logImport.service.LogImportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.Collections;
import java.util.List;
/**
* 导入日志Controller
@ -48,7 +57,6 @@ public class LogImportController extends BaseController
startPage();
startOrderBy();
List<LogImportVO> list = logImportService.selectLogImportList(query);
logImportAssembler.assembleStatistics(list);
return getDataTable(list);
}

View File

@ -7,6 +7,7 @@ import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson2.JSON;
import com.ruoyi.common.constant.LogTitle;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.yh.logImport.domain.enums.LogImportBizType;
import com.ruoyi.yh.logImportDetail.domain.interfaces.ImportContent;
@ -70,21 +71,23 @@ public class LogImportDetailController extends BaseController
List<LogImportDetailVO> list = logImportDetailService.selectLogImportDetailList(query);
List<ImportContent> contentList = new ArrayList<>();
if (CollectionUtils.isNotEmptyElement(list)) {
// 默认以第一个查到的业务类型作为导出模板
String bizType = list.stream().map(LogImportDetailVO::getLogBizType).filter(Objects::nonNull).findFirst().orElse(null);
LogImportBizType logImportBizType = LogImportBizType.parse(bizType);
if (logImportBizType != null && logImportBizType.getContentClazz() != null) {
for (LogImportDetailVO vo : list) {
ImportContent content = JSON.parseObject(vo.getContent(), logImportBizType.getContentClazz());
content.setImportMessage(vo.getMessage());
content.setImportResult(vo.getType());
contentList.add(content);
}
if (CollectionUtils.isEmptyElement(list)) {
throw new ServiceException("暂无可导出的数据");
}
// 默认以第一个查到的业务类型作为导出模板
String bizType = list.stream().map(LogImportDetailVO::getLogBizType).filter(Objects::nonNull).findFirst().orElse(null);
LogImportBizType logImportBizType = LogImportBizType.parse(bizType);
if (logImportBizType != null && logImportBizType.getContentClazz() != null) {
for (LogImportDetailVO vo : list) {
ImportContent content = JSON.parseObject(vo.getContent(), logImportBizType.getContentClazz());
content.setImportMessage(vo.getMessage());
content.setImportResult(vo.getType());
contentList.add(content);
}
}
ExcelUtil util = new ExcelUtil<>(PriceImportContentVO.class);
ExcelUtil util = new ExcelUtil<>(logImportBizType.getContentClazz());
util.exportExcel(response, contentList, "导入日志明细数据");
}