混炼示方优化

This commit is contained in:
geht
2026-06-12 19:38:33 +08:00
parent 75bc744fc8
commit ece8e590e4
22 changed files with 1425 additions and 23 deletions

View File

@@ -16,6 +16,10 @@ import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.modules.xslmes.entity.MesXslFormulaSpec;
import org.jeecg.modules.xslmes.entity.MesXslFormulaSpecLine;
import org.jeecg.modules.xslmes.entity.MesXslMixingSpecDownStep;
import org.jeecg.modules.xslmes.entity.MesXslMixingSpecMaterial;
import org.jeecg.modules.xslmes.entity.MesXslMixingSpecStep;
import org.jeecg.modules.xslmes.entity.MesXslMixingSpecTcu;
import org.jeecg.modules.xslmes.vo.MesXslFormulaSpecEditChangeItemVO;
import org.jeecg.modules.xslmes.vo.MesXslMixingSpecPage;
@@ -82,6 +86,35 @@ public final class MesXslFormulaSpecEditLogDiffUtil {
return toJson(snapshot);
}
//update-begin---author:cursor ---date:20260612 for【XSLMES-20260612-A03】混炼示方历史快照反序列化-----------
public static MesXslMixingSpecPage parseMixingSnapshotJson(String snapshotJson) {
if (StringUtils.isBlank(snapshotJson)) {
return null;
}
JSONObject root = parseObject(snapshotJson);
if (root == null) {
return null;
}
JSONObject mainObj = root.getJSONObject(SECTION_MAIN);
if (mainObj == null) {
return null;
}
MesXslMixingSpecPage page = mainObj.toJavaObject(MesXslMixingSpecPage.class);
page.setMaterialList(parseSnapshotList(root.getJSONArray(SECTION_MATERIAL), MesXslMixingSpecMaterial.class));
page.setStepList(parseSnapshotList(root.getJSONArray(SECTION_STEP), MesXslMixingSpecStep.class));
page.setDownStepList(parseSnapshotList(root.getJSONArray(SECTION_DOWN_STEP), MesXslMixingSpecDownStep.class));
page.setTcuList(parseSnapshotList(root.getJSONArray(SECTION_TCU), MesXslMixingSpecTcu.class));
return page;
}
private static <T> List<T> parseSnapshotList(JSONArray array, Class<T> clazz) {
if (array == null || array.isEmpty()) {
return new ArrayList<>();
}
return array.toJavaList(clazz);
}
//update-end---author:cursor ---date:20260612 for【XSLMES-20260612-A03】混炼示方历史快照反序列化-----------
public static List<MesXslFormulaSpecEditChangeItemVO> compare(
String specType, String beforeSnapshot, String afterSnapshot) {
List<MesXslFormulaSpecEditChangeItemVO> items = new ArrayList<>();

View File

@@ -20,6 +20,7 @@ import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslMixingSpec;
import org.jeecg.modules.xslmes.service.IMesXslMixingSpecService;
import org.jeecg.modules.xslmes.vo.MesXslMixingSpecPage;
import org.jeecg.modules.xslmes.vo.MesXslMixingSpecSmallWeighRangeVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -175,6 +176,17 @@ public class MesXslMixingSpecController extends JeecgController<MesXslMixingSpec
return Result.OK(mesXslMixingSpecService.queryPurposeOptions(keyword));
}
//update-begin---author:cursor ---date:20260612 for【XSLMES-20260612-A02】混炼示方小料称重范围设置-----------
@AutoLog(value = "MES混炼示方-小料称重范围设置")
@Operation(summary = "MES混炼示方-小料称重范围设置")
@RequiresPermissions("xslmes:mes_xsl_mixing_spec:edit")
@PostMapping(value = "/updateSmallWeighRange")
public Result<String> updateSmallWeighRange(@RequestBody MesXslMixingSpecSmallWeighRangeVO vo) {
mesXslMixingSpecService.updateSmallWeighRange(vo);
return Result.OK("保存成功");
}
//update-end---author:cursor ---date:20260612 for【XSLMES-20260612-A02】混炼示方小料称重范围设置-----------
@RequiresPermissions("xslmes:mes_xsl_mixing_spec:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, MesXslMixingSpec model) {

View File

@@ -0,0 +1,49 @@
package org.jeecg.modules.xslmes.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.xslmes.entity.MesXslMixingSpecHistory;
import org.jeecg.modules.xslmes.service.IMesXslMixingSpecHistoryService;
import org.jeecg.modules.xslmes.vo.MesXslMixingSpecPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* 混炼示方历史记录
*/
@Tag(name = "MES混炼示方历史记录")
@RestController
@RequestMapping("/xslmes/mesXslMixingSpecHistory")
@Slf4j
public class MesXslMixingSpecHistoryController {
@Autowired
private IMesXslMixingSpecHistoryService mesXslMixingSpecHistoryService;
@Operation(summary = "混炼示方历史记录-按示方ID查询")
@GetMapping(value = "/listByMixingSpecId")
public Result<List<MesXslMixingSpecHistory>> listByMixingSpecId(
@RequestParam(name = "mixingSpecId", required = true) String mixingSpecId) {
if (StringUtils.isBlank(mixingSpecId)) {
return Result.error("mixingSpecId不能为空");
}
return Result.OK(mesXslMixingSpecHistoryService.listByMixingSpecId(mixingSpecId));
}
@Operation(summary = "混炼示方历史记录-查询快照详情")
@GetMapping(value = "/queryById")
public Result<MesXslMixingSpecPage> queryById(@RequestParam(name = "id", required = true) String id) {
MesXslMixingSpecPage page = mesXslMixingSpecHistoryService.queryPageByHistoryId(id);
if (page == null) {
return Result.error("未找到对应历史记录");
}
return Result.OK(page);
}
}

View File

@@ -89,6 +89,20 @@ public class MesXslMixingSpec implements Serializable {
@Schema(description = "自动小料打印设定")
private String autoSmallPrintSetting;
//update-begin---author:cursor ---date:20260612 for【XSLMES-20260612-A02】混炼示方小料称重上下限容差-----------
@Schema(description = "人工小料计量下限容差(KG)")
private BigDecimal manualSmallWeighLowerTol;
@Schema(description = "人工小料计量上限容差(KG)")
private BigDecimal manualSmallWeighUpperTol;
@Schema(description = "自动小料计量下限容差(KG)")
private BigDecimal autoSmallWeighLowerTol;
@Schema(description = "自动小料计量上限容差(KG)")
private BigDecimal autoSmallWeighUpperTol;
//update-end---author:cursor ---date:20260612 for【XSLMES-20260612-A02】混炼示方小料称重上下限容差-----------
@Schema(description = "设定车数")
private Integer setTrainCount;

View File

@@ -0,0 +1,71 @@
package org.jeecg.modules.xslmes.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
/**
* 混炼示方历史记录
*/
@Data
@TableName("mes_xsl_mixing_spec_history")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description = "混炼示方历史记录")
public class MesXslMixingSpecHistory implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private String id;
@Schema(description = "混炼示方主表ID")
private String mixingSpecId;
@Excel(name = "规格名", width = 20)
@Schema(description = "规格名")
private String specName;
@Excel(name = "发行编号", width = 16)
@Schema(description = "发行编号")
private String issueNumber;
@Excel(name = "版本号", width = 10)
@Schema(description = "版本号")
private String versionNo;
@Excel(name = "操作类型", width = 10, dicCode = "xslmes_formula_spec_edit_log_action")
@Dict(dicCode = "xslmes_formula_spec_edit_log_action")
@Schema(description = "操作类型 create=新增 update=修改")
private String actionType;
@Schema(description = "完整快照JSON")
private String snapshotJson;
@Excel(name = "操作时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "操作时间")
private Date operateTime;
@Schema(description = "操作人账号")
private String operateBy;
@Excel(name = "操作人", width = 14)
@Schema(description = "操作人姓名")
private String operateByName;
@Schema(description = "租户ID")
private Integer tenantId;
}

View File

@@ -0,0 +1,9 @@
package org.jeecg.modules.xslmes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.xslmes.entity.MesXslMixingSpecHistory;
/**
* 混炼示方历史记录
*/
public interface MesXslMixingSpecHistoryMapper extends BaseMapper<MesXslMixingSpecHistory> {}

View File

@@ -0,0 +1,30 @@
package org.jeecg.modules.xslmes.service;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import org.jeecg.modules.xslmes.entity.MesXslMixingSpecHistory;
import org.jeecg.modules.xslmes.vo.MesXslMixingSpecPage;
/**
* 混炼示方历史记录
*/
public interface IMesXslMixingSpecHistoryService extends IService<MesXslMixingSpecHistory> {
String ACTION_CREATE = "create";
String ACTION_UPDATE = "update";
/**
* 保存一条历史快照
*/
void recordHistory(MesXslMixingSpecPage page, String actionType);
/**
* 按示方主表ID查询历史列表版本倒序
*/
List<MesXslMixingSpecHistory> listByMixingSpecId(String mixingSpecId);
/**
* 解析历史快照为混炼示方页面对象
*/
MesXslMixingSpecPage queryPageByHistoryId(String historyId);
}

View File

@@ -12,6 +12,7 @@ import org.jeecg.modules.xslmes.entity.MesXslMixingSpecStep;
import org.jeecg.modules.xslmes.entity.MesXslMixingSpecTcu;
import org.jeecg.modules.xslmes.entity.MesXslMixerPsCompile;
import org.jeecg.modules.xslmes.vo.MesXslMixingSpecPage;
import org.jeecg.modules.xslmes.vo.MesXslMixingSpecSmallWeighRangeVO;
public interface IMesXslMixingSpecService extends IService<MesXslMixingSpec> {
void saveMain(
@@ -57,4 +58,9 @@ public interface IMesXslMixingSpecService extends IService<MesXslMixingSpec> {
void revertFromMixerPsWorkflow(MesXslMixerPsCompile ps, String mixerPsTargetStatus);
//update-end---author:GHT ---date:2026-05-29 for【QH-MES审批流设计】密炼PS拒绝/撤回联动回退混炼示方-----------
//update-end---author:cursor ---date:20260526 for【XSLMES-20260526-A61】混炼示方密炼PS审批联动同步审批人-----------
//update-begin---author:cursor ---date:20260612 for【XSLMES-20260612-A02】混炼示方小料称重范围设置-----------
/** 更新人工/自动小料称重上下限容差 */
void updateSmallWeighRange(MesXslMixingSpecSmallWeighRangeVO vo);
//update-end---author:cursor ---date:20260612 for【XSLMES-20260612-A02】混炼示方小料称重范围设置-----------
}

View File

@@ -0,0 +1,93 @@
package org.jeecg.modules.xslmes.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.Date;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.xslmes.common.MesXslFormulaSpecEditLogDiffUtil;
import org.jeecg.modules.xslmes.entity.MesXslMixingSpecHistory;
import org.jeecg.modules.xslmes.mapper.MesXslMixingSpecHistoryMapper;
import org.jeecg.modules.xslmes.service.IMesXslMixingSpecHistoryService;
import org.jeecg.modules.xslmes.vo.MesXslMixingSpecPage;
import org.springframework.stereotype.Service;
/**
* 混炼示方历史记录
*/
@Service
@Slf4j
public class MesXslMixingSpecHistoryServiceImpl
extends ServiceImpl<MesXslMixingSpecHistoryMapper, MesXslMixingSpecHistory>
implements IMesXslMixingSpecHistoryService {
@Override
public void recordHistory(MesXslMixingSpecPage page, String actionType) {
if (page == null || StringUtils.isBlank(page.getId())) {
return;
}
long existCount = count(new LambdaQueryWrapper<MesXslMixingSpecHistory>()
.eq(MesXslMixingSpecHistory::getMixingSpecId, page.getId()));
String versionNo = "v1." + existCount;
LoginUser loginUser = resolveLoginUser();
MesXslMixingSpecHistory row = new MesXslMixingSpecHistory();
row.setMixingSpecId(page.getId());
row.setSpecName(page.getSpecName());
row.setIssueNumber(page.getIssueNumber());
row.setVersionNo(versionNo);
row.setActionType(StringUtils.defaultIfBlank(actionType, ACTION_UPDATE));
row.setSnapshotJson(MesXslFormulaSpecEditLogDiffUtil.buildMixingSnapshotJson(page));
row.setOperateTime(new Date());
if (loginUser != null) {
row.setOperateBy(loginUser.getUsername());
row.setOperateByName(StringUtils.defaultIfBlank(loginUser.getRealname(), loginUser.getUsername()));
} else {
row.setOperateByName("未知");
}
row.setTenantId(page.getTenantId());
save(row);
}
@Override
public List<MesXslMixingSpecHistory> listByMixingSpecId(String mixingSpecId) {
if (StringUtils.isBlank(mixingSpecId)) {
return List.of();
}
return list(new LambdaQueryWrapper<MesXslMixingSpecHistory>()
.eq(MesXslMixingSpecHistory::getMixingSpecId, mixingSpecId)
.orderByDesc(MesXslMixingSpecHistory::getOperateTime)
.orderByDesc(MesXslMixingSpecHistory::getVersionNo));
}
@Override
public MesXslMixingSpecPage queryPageByHistoryId(String historyId) {
if (StringUtils.isBlank(historyId)) {
return null;
}
MesXslMixingSpecHistory row = getById(historyId);
if (row == null) {
return null;
}
MesXslMixingSpecPage page = MesXslFormulaSpecEditLogDiffUtil.parseMixingSnapshotJson(row.getSnapshotJson());
if (page != null) {
page.setId(row.getMixingSpecId());
}
return page;
}
private static LoginUser resolveLoginUser() {
try {
Object principal = SecurityUtils.getSubject().getPrincipal();
if (principal instanceof LoginUser loginUser) {
return loginUser;
}
} catch (Exception ex) {
log.debug("解析登录用户失败: {}", ex.getMessage());
}
return null;
}
}

View File

@@ -21,6 +21,7 @@ import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.mes.material.entity.MesMaterial;
import org.jeecg.modules.mes.material.service.IMesMaterialService;
@@ -38,8 +39,10 @@ import org.jeecg.modules.xslmes.mapper.MesXslMixingSpecMaterialMapper;
import org.jeecg.modules.xslmes.mapper.MesXslMixingSpecStepMapper;
import org.jeecg.modules.xslmes.mapper.MesXslMixingSpecTcuMapper;
import org.jeecg.modules.xslmes.service.IMesXslFormulaSpecEditLogService;
import org.jeecg.modules.xslmes.service.IMesXslMixingSpecHistoryService;
import org.jeecg.modules.xslmes.service.IMesXslMixingSpecService;
import org.jeecg.modules.xslmes.vo.MesXslMixingSpecPage;
import org.jeecg.modules.xslmes.vo.MesXslMixingSpecSmallWeighRangeVO;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -75,6 +78,9 @@ public class MesXslMixingSpecServiceImpl extends ServiceImpl<MesXslMixingSpecMap
@Resource
private IMesXslFormulaSpecEditLogService mesXslFormulaSpecEditLogService;
@Resource
private IMesXslMixingSpecHistoryService mesXslMixingSpecHistoryService;
@Resource
private ISysUserService sysUserService;
@@ -99,9 +105,12 @@ public class MesXslMixingSpecServiceImpl extends ServiceImpl<MesXslMixingSpecMap
trace.finish();
//update-begin---author:cursor ---date:20260526 for【配方日志查询】混炼示方新增落库修改日志-----------
// 直接用已落库的入参构建快照,避免二次全量 queryPageById() 查询
mesXslFormulaSpecEditLogService.recordMixingCreate(
buildPageFromInput(main, materialList, stepList, downStepList, tcuList));
MesXslMixingSpecPage savedPage = buildPageFromInput(main, materialList, stepList, downStepList, tcuList);
mesXslFormulaSpecEditLogService.recordMixingCreate(savedPage);
//update-end---author:cursor ---date:20260526 for【配方日志查询】混炼示方新增落库修改日志-----------
//update-begin---author:cursor ---date:20260612 for【XSLMES-20260612-A03】混炼示方新增写入历史记录-----------
mesXslMixingSpecHistoryService.recordHistory(savedPage, IMesXslMixingSpecHistoryService.ACTION_CREATE);
//update-end---author:cursor ---date:20260612 for【XSLMES-20260612-A03】混炼示方新增写入历史记录-----------
//update-end---author:cursor ---date:20260522 for【XSLMES-20260522-A17】混炼示方主子表新增保存-----------
}
@@ -130,9 +139,12 @@ public class MesXslMixingSpecServiceImpl extends ServiceImpl<MesXslMixingSpecMap
trace.finish();
//update-begin---author:cursor ---date:20260526 for【配方日志查询】混炼示方编辑落库修改日志-----------
// 直接用已落库的入参构建 after 快照,避免二次全量 queryPageById() 查询(节省 5 次 SELECT
mesXslFormulaSpecEditLogService.recordMixingUpdate(before,
buildPageFromInput(main, materialList, stepList, downStepList, tcuList));
MesXslMixingSpecPage savedPage = buildPageFromInput(main, materialList, stepList, downStepList, tcuList);
mesXslFormulaSpecEditLogService.recordMixingUpdate(before, savedPage);
//update-end---author:cursor ---date:20260526 for【配方日志查询】混炼示方编辑落库修改日志-----------
//update-begin---author:cursor ---date:20260612 for【XSLMES-20260612-A03】混炼示方编辑写入历史记录-----------
mesXslMixingSpecHistoryService.recordHistory(savedPage, IMesXslMixingSpecHistoryService.ACTION_UPDATE);
//update-end---author:cursor ---date:20260612 for【XSLMES-20260612-A03】混炼示方编辑写入历史记录-----------
//update-end---author:cursor ---date:20260522 for【XSLMES-20260522-A17】混炼示方主子表编辑保存-----------
}
@@ -214,6 +226,12 @@ public class MesXslMixingSpecServiceImpl extends ServiceImpl<MesXslMixingSpecMap
page.setPureMixSec(main.getPureMixSec());
page.setRecycleCarbonKg(main.getRecycleCarbonKg());
page.setAutoSmallPrintSetting(main.getAutoSmallPrintSetting());
//update-begin---author:cursor ---date:20260612 for【XSLMES-20260612-A02】queryById补充小料称重容差字段-----------
page.setManualSmallWeighLowerTol(main.getManualSmallWeighLowerTol());
page.setManualSmallWeighUpperTol(main.getManualSmallWeighUpperTol());
page.setAutoSmallWeighLowerTol(main.getAutoSmallWeighLowerTol());
page.setAutoSmallWeighUpperTol(main.getAutoSmallWeighUpperTol());
//update-end---author:cursor ---date:20260612 for【XSLMES-20260612-A02】queryById补充小料称重容差字段-----------
page.setSetTrainCount(main.getSetTrainCount());
page.setSideWallWaterTemp(main.getSideWallWaterTemp());
page.setOvertimeDischargeSec(main.getOvertimeDischargeSec());
@@ -908,4 +926,41 @@ public class MesXslMixingSpecServiceImpl extends ServiceImpl<MesXslMixingSpecMap
return page;
}
//update-end---author:cursor ---date:20260527 for【配方日志查询】从入参直接构建快照避免二次查库-----------
//update-begin---author:cursor ---date:20260612 for【XSLMES-20260612-A02】混炼示方小料称重范围设置-----------
private static final BigDecimal DEFAULT_SMALL_WEIGH_TOL = new BigDecimal("0.01");
@Override
public void updateSmallWeighRange(MesXslMixingSpecSmallWeighRangeVO vo) {
if (vo == null || oConvertUtils.isEmpty(vo.getId())) {
throw new JeecgBootException("混炼示方ID不能为空");
}
MesXslMixingSpec exists = getById(vo.getId());
if (exists == null) {
throw new JeecgBootException("未找到混炼示方数据");
}
BigDecimal manualLower = normalizeSmallWeighTol(vo.getManualSmallWeighLowerTol());
BigDecimal manualUpper = normalizeSmallWeighTol(vo.getManualSmallWeighUpperTol());
BigDecimal autoLower = normalizeSmallWeighTol(vo.getAutoSmallWeighLowerTol());
BigDecimal autoUpper = normalizeSmallWeighTol(vo.getAutoSmallWeighUpperTol());
LambdaUpdateWrapper<MesXslMixingSpec> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(MesXslMixingSpec::getId, vo.getId())
.set(MesXslMixingSpec::getManualSmallWeighLowerTol, manualLower)
.set(MesXslMixingSpec::getManualSmallWeighUpperTol, manualUpper)
.set(MesXslMixingSpec::getAutoSmallWeighLowerTol, autoLower)
.set(MesXslMixingSpec::getAutoSmallWeighUpperTol, autoUpper)
.set(MesXslMixingSpec::getUpdateTime, new Date());
update(wrapper);
}
private BigDecimal normalizeSmallWeighTol(BigDecimal value) {
if (value == null) {
return DEFAULT_SMALL_WEIGH_TOL;
}
if (value.compareTo(BigDecimal.ZERO) < 0) {
throw new JeecgBootException("小料称重容差不能为负数");
}
return value.setScale(6, java.math.RoundingMode.HALF_UP);
}
//update-end---author:cursor ---date:20260612 for【XSLMES-20260612-A02】混炼示方小料称重范围设置-----------
}

View File

@@ -0,0 +1,28 @@
package org.jeecg.modules.xslmes.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import java.math.BigDecimal;
import lombok.Data;
/**
* 混炼示方小料称重范围设置
*/
@Data
@Schema(description = "混炼示方小料称重范围")
public class MesXslMixingSpecSmallWeighRangeVO {
@Schema(description = "混炼示方主表ID")
private String id;
@Schema(description = "人工小料计量下限容差(KG)")
private BigDecimal manualSmallWeighLowerTol;
@Schema(description = "人工小料计量上限容差(KG)")
private BigDecimal manualSmallWeighUpperTol;
@Schema(description = "自动小料计量下限容差(KG)")
private BigDecimal autoSmallWeighLowerTol;
@Schema(description = "自动小料计量上限容差(KG)")
private BigDecimal autoSmallWeighUpperTol;
}

View File

@@ -0,0 +1,11 @@
-- 混炼示方人工/自动小料称重上下限容差
-- author: cursor date: 2026-06-12 forXSLMES-20260612-A02混炼示方小料称重范围
SET @db = DATABASE();
SET @sql = IF((SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=@db AND TABLE_NAME='mes_xsl_mixing_spec' AND COLUMN_NAME='manual_small_weigh_lower_tol')=0,
'ALTER TABLE `mes_xsl_mixing_spec`
ADD COLUMN `manual_small_weigh_lower_tol` decimal(18,6) DEFAULT 0.010000 COMMENT ''人工小料计量下限容差(KG)'' AFTER `auto_small_print_setting`,
ADD COLUMN `manual_small_weigh_upper_tol` decimal(18,6) DEFAULT 0.010000 COMMENT ''人工小料计量上限容差(KG)'' AFTER `manual_small_weigh_lower_tol`,
ADD COLUMN `auto_small_weigh_lower_tol` decimal(18,6) DEFAULT 0.010000 COMMENT ''自动小料计量下限容差(KG)'' AFTER `manual_small_weigh_upper_tol`,
ADD COLUMN `auto_small_weigh_upper_tol` decimal(18,6) DEFAULT 0.010000 COMMENT ''自动小料计量上限容差(KG)'' AFTER `auto_small_weigh_lower_tol`','SELECT 1');
PREPARE s FROM @sql; EXECUTE s; DEALLOCATE PREPARE s;

View File

@@ -0,0 +1,21 @@
-- 混炼示方历史记录表完整快照备份
SET NAMES utf8mb4;
CREATE TABLE IF NOT EXISTS `mes_xsl_mixing_spec_history` (
`id` varchar(32) NOT NULL COMMENT '主键',
`mixing_spec_id` varchar(32) NOT NULL COMMENT '混炼示方主表ID',
`spec_name` varchar(200) DEFAULT NULL COMMENT '规格名',
`issue_number` varchar(64) DEFAULT NULL COMMENT '发行编号',
`version_no` varchar(20) NOT NULL COMMENT '版本号如v1.0',
`action_type` varchar(20) NOT NULL COMMENT '操作类型 create=新增 update=修改',
`snapshot_json` longtext COMMENT '完整快照JSON',
`operate_time` datetime DEFAULT NULL COMMENT '操作时间',
`operate_by` varchar(64) DEFAULT NULL COMMENT '操作人账号',
`operate_by_name` varchar(100) DEFAULT NULL COMMENT '操作人姓名',
`tenant_id` int DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (`id`),
KEY `idx_msh_mixing_spec_id` (`mixing_spec_id`),
KEY `idx_msh_version_no` (`version_no`),
KEY `idx_msh_operate_time` (`operate_time`),
KEY `idx_msh_tenant` (`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES混炼示方历史记录';