快检实验标准新增
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package org.jeecg.modules.xslmes.common;
|
||||
|
||||
/**
|
||||
* MES xslmes 业务常量
|
||||
*/
|
||||
public final class XslMesBizConstants {
|
||||
|
||||
/** 密炼PS类型:原材料检验标准(字典 xslmes_ps_belong) */
|
||||
public static final String PS_TYPE_RAW_INSPECT_STD = "raw_inspect_std";
|
||||
|
||||
/** 胶料快检实验标准审核状态:已批准 */
|
||||
public static final String RUBBER_QUICK_TEST_STD_AUDIT_APPROVED = "1";
|
||||
|
||||
/** 胶料快检实验标准审核状态:草稿 */
|
||||
public static final String RUBBER_QUICK_TEST_STD_AUDIT_DRAFT = "0";
|
||||
|
||||
private XslMesBizConstants() {}
|
||||
}
|
||||
@@ -0,0 +1,322 @@
|
||||
package org.jeecg.modules.xslmes.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.mes.material.entity.MesMaterial;
|
||||
import org.jeecg.modules.mes.material.service.IMesMaterialService;
|
||||
import org.jeecg.modules.system.entity.SysDepart;
|
||||
import org.jeecg.modules.system.service.ISysDepartService;
|
||||
import org.jeecg.modules.xslmes.common.XslMesBizConstants;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMixerPsCompile;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethodLine;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestStd;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestStdLine;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslMixerPsCompileService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestMethodService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestStdService;
|
||||
import org.jeecg.modules.xslmes.vo.MesXslRubberQuickTestStdPage;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* MES 胶料快检实验标准(主子表)
|
||||
*/
|
||||
@Tag(name = "MES胶料快检实验标准")
|
||||
@RestController
|
||||
@RequestMapping("/xslmes/mesXslRubberQuickTestStd")
|
||||
@Slf4j
|
||||
public class MesXslRubberQuickTestStdController
|
||||
extends JeecgController<MesXslRubberQuickTestStd, IMesXslRubberQuickTestStdService> {
|
||||
|
||||
private static final String ENABLE_IN_USE = "1";
|
||||
private static final String ENABLE_STOPPED = "0";
|
||||
|
||||
@Autowired
|
||||
private IMesXslRubberQuickTestStdService mesXslRubberQuickTestStdService;
|
||||
|
||||
@Autowired
|
||||
private IMesXslRubberQuickTestMethodService mesXslRubberQuickTestMethodService;
|
||||
|
||||
@Autowired
|
||||
private IMesMaterialService mesMaterialService;
|
||||
|
||||
@Autowired
|
||||
private IMesXslMixerPsCompileService mesXslMixerPsCompileService;
|
||||
|
||||
@Autowired
|
||||
private ISysDepartService sysDepartService;
|
||||
|
||||
@Operation(summary = "MES胶料快检实验标准-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<MesXslRubberQuickTestStd>> queryPageList(
|
||||
MesXslRubberQuickTestStd model,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<MesXslRubberQuickTestStd> queryWrapper =
|
||||
QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
Page<MesXslRubberQuickTestStd> page = new Page<>(pageNo, pageSize);
|
||||
IPage<MesXslRubberQuickTestStd> pageList = mesXslRubberQuickTestStdService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料快检实验标准-添加")
|
||||
@Operation(summary = "MES胶料快检实验标准-添加")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_std:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody MesXslRubberQuickTestStdPage page) {
|
||||
MesXslRubberQuickTestStd main = new MesXslRubberQuickTestStd();
|
||||
BeanUtils.copyProperties(page, main);
|
||||
//update-begin---author:jiangxh ---date:20260525 for:【MES】胶料快检实验标准保存校验与明细从实验方法带出-----------
|
||||
String err = validateForSave(main, page.getLineList(), null);
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260525 for:【MES】胶料快检实验标准保存校验与明细从实验方法带出-----------
|
||||
try {
|
||||
mesXslRubberQuickTestStdService.saveMain(main, page.getLineList());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料快检实验标准-编辑")
|
||||
@Operation(summary = "MES胶料快检实验标准-编辑")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_std:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody MesXslRubberQuickTestStdPage page) {
|
||||
MesXslRubberQuickTestStd main = new MesXslRubberQuickTestStd();
|
||||
BeanUtils.copyProperties(page, main);
|
||||
//update-begin---author:jiangxh ---date:20260525 for:【MES】胶料快检实验标准保存校验与明细从实验方法带出-----------
|
||||
String err = validateForSave(main, page.getLineList(), main.getId());
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260525 for:【MES】胶料快检实验标准保存校验与明细从实验方法带出-----------
|
||||
try {
|
||||
mesXslRubberQuickTestStdService.updateMain(main, page.getLineList());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料快检实验标准-删除")
|
||||
@Operation(summary = "MES胶料快检实验标准-通过id删除")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_std:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
mesXslRubberQuickTestStdService.delMain(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料快检实验标准-批量删除")
|
||||
@Operation(summary = "MES胶料快检实验标准-批量删除")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_std:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
mesXslRubberQuickTestStdService.delBatchMain(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@Operation(summary = "MES胶料快检实验标准-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<MesXslRubberQuickTestStd> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
MesXslRubberQuickTestStd entity = mesXslRubberQuickTestStdService.getById(id);
|
||||
if (entity == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(entity);
|
||||
}
|
||||
|
||||
@Operation(summary = "MES胶料快检实验标准-查询明细")
|
||||
@GetMapping(value = "/queryLineListByStdId")
|
||||
public Result<List<MesXslRubberQuickTestStdLine>> queryLineListByStdId(
|
||||
@RequestParam(name = "id", required = true) String id) {
|
||||
return Result.OK(mesXslRubberQuickTestStdService.selectLinesByStdId(id));
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料快检实验标准-启用/停用")
|
||||
@Operation(summary = "MES胶料快检实验标准-启用/停用(字典 xslmes_rubber_quick_test_std_enable_status:1使用中 0已停用)")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_std:updateStatus")
|
||||
@PostMapping(value = "/updateStatus")
|
||||
public Result<String> updateStatus(
|
||||
@RequestParam(name = "id", required = true) String id,
|
||||
@RequestParam(name = "enableStatus", required = true) String enableStatus) {
|
||||
if (enableStatus != null) {
|
||||
enableStatus = enableStatus.trim();
|
||||
}
|
||||
if (!ENABLE_IN_USE.equals(enableStatus) && !ENABLE_STOPPED.equals(enableStatus)) {
|
||||
return Result.error("启用状态参数非法");
|
||||
}
|
||||
boolean updated = mesXslRubberQuickTestStdService.lambdaUpdate()
|
||||
.eq(MesXslRubberQuickTestStd::getId, id)
|
||||
.set(MesXslRubberQuickTestStd::getEnableStatus, enableStatus)
|
||||
.update();
|
||||
if (updated) {
|
||||
return Result.OK("操作成功");
|
||||
}
|
||||
MesXslRubberQuickTestStd cur = mesXslRubberQuickTestStdService.getById(id);
|
||||
if (cur != null && java.util.Objects.equals(enableStatus, cur.getEnableStatus())) {
|
||||
return Result.OK("操作成功");
|
||||
}
|
||||
return Result.error("操作失败,请确认记录存在");
|
||||
}
|
||||
|
||||
@Operation(summary = "MES胶料快检实验标准-校验名称唯一")
|
||||
@GetMapping(value = "/checkStdName")
|
||||
public Result<?> checkStdName(
|
||||
@RequestParam(name = "stdName") String stdName,
|
||||
@RequestParam(name = "dataId", required = false) String dataId) {
|
||||
if (oConvertUtils.isEmpty(stdName) || stdName.trim().isEmpty()) {
|
||||
return Result.OK();
|
||||
}
|
||||
MesXslRubberQuickTestStd ctx = new MesXslRubberQuickTestStd();
|
||||
if (mesXslRubberQuickTestStdService.isStdNameDuplicated(stdName.trim(), dataId, ctx)) {
|
||||
return Result.error("实验标准名称已存在");
|
||||
}
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_std:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslRubberQuickTestStd model) {
|
||||
return super.exportXls(request, model, MesXslRubberQuickTestStd.class, "MES胶料快检实验标准");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_std:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, MesXslRubberQuickTestStd.class);
|
||||
}
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260525 for:【MES】胶料快检实验标准保存校验与明细从实验方法带出-----------
|
||||
private String validateForSave(
|
||||
MesXslRubberQuickTestStd main, List<MesXslRubberQuickTestStdLine> lineList, String excludeId) {
|
||||
if (main == null) {
|
||||
return "参数不能为空";
|
||||
}
|
||||
if (oConvertUtils.isEmpty(main.getStdName())) {
|
||||
return "实验标准名称不能为空";
|
||||
}
|
||||
main.setStdName(main.getStdName().trim());
|
||||
if (mesXslRubberQuickTestStdService.isStdNameDuplicated(main.getStdName(), excludeId, main)) {
|
||||
return "实验标准名称已存在";
|
||||
}
|
||||
if (oConvertUtils.isEmpty(main.getTestMethodId())) {
|
||||
return "请选择实验方法";
|
||||
}
|
||||
MesXslRubberQuickTestMethod method = mesXslRubberQuickTestMethodService.getById(main.getTestMethodId());
|
||||
if (method == null || isDeleted(method.getDelFlag())) {
|
||||
return "实验方法不存在或已删除";
|
||||
}
|
||||
main.setTestMethodName(method.getMethodName());
|
||||
|
||||
if (oConvertUtils.isNotEmpty(main.getRubberMaterialId())) {
|
||||
MesMaterial material = mesMaterialService.getById(main.getRubberMaterialId());
|
||||
if (material == null) {
|
||||
return "所选胶料不存在";
|
||||
}
|
||||
main.setRubberMaterialName(material.getMaterialName());
|
||||
}
|
||||
|
||||
if (oConvertUtils.isNotEmpty(main.getPsCompileId())) {
|
||||
MesXslMixerPsCompile ps = mesXslMixerPsCompileService.getById(main.getPsCompileId());
|
||||
if (ps == null) {
|
||||
return "所选密炼PS不存在";
|
||||
}
|
||||
if (!XslMesBizConstants.PS_TYPE_RAW_INSPECT_STD.equals(ps.getPsType())) {
|
||||
return "发行编号须选择类型为原材料检验标准的密炼PS";
|
||||
}
|
||||
main.setIssueNumber(ps.getPsCode());
|
||||
if (main.getIssueDate() == null && ps.getIssueDate() != null) {
|
||||
main.setIssueDate(ps.getIssueDate());
|
||||
}
|
||||
}
|
||||
|
||||
if (oConvertUtils.isNotEmpty(main.getIssueDeptId())) {
|
||||
SysDepart depart = sysDepartService.getById(main.getIssueDeptId());
|
||||
if (depart != null) {
|
||||
main.setIssueDeptName(depart.getDepartName());
|
||||
}
|
||||
}
|
||||
|
||||
List<MesXslRubberQuickTestMethodLine> methodLines =
|
||||
mesXslRubberQuickTestMethodService.selectLinesByMethodId(main.getTestMethodId());
|
||||
if (methodLines == null || methodLines.isEmpty()) {
|
||||
return "所选实验方法未维护数据点明细,请先在实验方法中配置数据点";
|
||||
}
|
||||
|
||||
if (lineList == null || lineList.isEmpty()) {
|
||||
return "请保存与实验方法一致的数据点明细";
|
||||
}
|
||||
|
||||
Map<String, MesXslRubberQuickTestMethodLine> methodLineByPointId = new HashMap<>();
|
||||
for (MesXslRubberQuickTestMethodLine ml : methodLines) {
|
||||
if (ml != null && oConvertUtils.isNotEmpty(ml.getDataPointId())) {
|
||||
methodLineByPointId.put(ml.getDataPointId().trim(), ml);
|
||||
}
|
||||
}
|
||||
|
||||
Set<String> submittedPointIds = new HashSet<>();
|
||||
int sort = 0;
|
||||
for (int i = 0; i < lineList.size(); i++) {
|
||||
MesXslRubberQuickTestStdLine line = lineList.get(i);
|
||||
if (line == null) {
|
||||
continue;
|
||||
}
|
||||
int rowNo = i + 1;
|
||||
if (oConvertUtils.isEmpty(line.getDataPointId())) {
|
||||
return "第 " + rowNo + " 行未关联数据点";
|
||||
}
|
||||
String pointId = line.getDataPointId().trim();
|
||||
if (!submittedPointIds.add(pointId)) {
|
||||
return "第 " + rowNo + " 行数据点重复";
|
||||
}
|
||||
MesXslRubberQuickTestMethodLine methodLine = methodLineByPointId.get(pointId);
|
||||
if (methodLine == null) {
|
||||
return "第 " + rowNo + " 行数据点不属于所选实验方法,请重新选择实验方法后保存";
|
||||
}
|
||||
line.setDataPointId(pointId);
|
||||
line.setPointName(methodLine.getPointName());
|
||||
line.setSortNo(sort++);
|
||||
}
|
||||
|
||||
if (submittedPointIds.size() != methodLineByPointId.size()) {
|
||||
return "明细须包含实验方法中的全部数据点,且不可新增或删除数据点";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static boolean isDeleted(Integer delFlag) {
|
||||
return delFlag != null && delFlag.equals(CommonConstant.DEL_FLAG_1);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260525 for:【MES】胶料快检实验标准保存校验与明细从实验方法带出-----------
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
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 java.util.List;
|
||||
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;
|
||||
|
||||
/**
|
||||
* MES 胶料快检实验标准主表
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_rubber_quick_test_std")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "MES胶料快检实验标准")
|
||||
public class MesXslRubberQuickTestStd implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Excel(name = "实验标准名称", width = 24)
|
||||
@Schema(description = "实验标准名称(同租户未删除唯一)")
|
||||
private String stdName;
|
||||
|
||||
@Schema(description = "实验方法ID mes_xsl_rubber_quick_test_method.id")
|
||||
private String testMethodId;
|
||||
|
||||
@Excel(name = "实验方法", width = 20)
|
||||
@Schema(description = "实验方法名称冗余")
|
||||
private String testMethodName;
|
||||
|
||||
@Excel(name = "密炼机类型", width = 14, dicCode = "xslmes_rubber_quick_test_mixer_type")
|
||||
@Dict(dicCode = "xslmes_rubber_quick_test_mixer_type")
|
||||
@Schema(description = "密炼机类型(字典xslmes_rubber_quick_test_mixer_type)")
|
||||
private String mixerType;
|
||||
|
||||
@Schema(description = "胶料ID mes_material.id")
|
||||
private String rubberMaterialId;
|
||||
|
||||
@Excel(name = "胶料名称", width = 20)
|
||||
@Schema(description = "胶料名称冗余")
|
||||
private String rubberMaterialName;
|
||||
|
||||
@Schema(description = "密炼PS编制ID mes_xsl_mixer_ps_compile.id")
|
||||
private String psCompileId;
|
||||
|
||||
@Excel(name = "发行编号", width = 16)
|
||||
@Schema(description = "发行编号(密炼PS编码冗余)")
|
||||
private String issueNumber;
|
||||
|
||||
@Excel(name = "发行日期", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@Schema(description = "发行日期")
|
||||
private Date issueDate;
|
||||
|
||||
@Schema(description = "发行部门ID")
|
||||
private String issueDeptId;
|
||||
|
||||
@Excel(name = "发行部门", width = 18)
|
||||
@Schema(description = "发行部门名称冗余")
|
||||
private String issueDeptName;
|
||||
|
||||
@Excel(name = "启用状态", width = 10, dicCode = "xslmes_rubber_quick_test_std_enable_status")
|
||||
@Dict(dicCode = "xslmes_rubber_quick_test_std_enable_status")
|
||||
@Schema(description = "启用状态(字典:1使用中0已停用)")
|
||||
private String enableStatus;
|
||||
|
||||
@Excel(name = "审核状态", width = 10, dicCode = "xslmes_rubber_quick_test_std_audit_status")
|
||||
@Dict(dicCode = "xslmes_rubber_quick_test_std_audit_status")
|
||||
@Schema(description = "审核状态(字典:0草稿1已批准)")
|
||||
private String auditStatus;
|
||||
|
||||
private Integer tenantId;
|
||||
private String sysOrgCode;
|
||||
private String createBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
@TableLogic
|
||||
@Schema(description = "删除状态(0正常 1已删除)")
|
||||
private Integer delFlag;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(description = "标准明细")
|
||||
private List<MesXslRubberQuickTestStdLine> lineList;
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
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.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* MES 胶料快检实验标准明细
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_rubber_quick_test_std_line")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "MES胶料快检实验标准明细")
|
||||
public class MesXslRubberQuickTestStdLine implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Schema(description = "主表主键 mes_xsl_rubber_quick_test_std.id")
|
||||
private String stdId;
|
||||
|
||||
@Schema(description = "数据点主键 mes_xsl_rubber_quick_test_data_point.id")
|
||||
private String dataPointId;
|
||||
|
||||
@Excel(name = "数据点", width = 18)
|
||||
@Schema(description = "数据点名称冗余(只读带出)")
|
||||
private String pointName;
|
||||
|
||||
@Excel(name = "下限值", width = 12, type = 10)
|
||||
@Schema(description = "下限值")
|
||||
private BigDecimal lowerLimit;
|
||||
|
||||
@Excel(name = "下警告值", width = 12, type = 10)
|
||||
@Schema(description = "下警告值")
|
||||
private BigDecimal lowerWarn;
|
||||
|
||||
@Excel(name = "目标值", width = 12, type = 10)
|
||||
@Schema(description = "目标值")
|
||||
private BigDecimal targetValue;
|
||||
|
||||
@Excel(name = "上警告值", width = 12, type = 10)
|
||||
@Schema(description = "上警告值")
|
||||
private BigDecimal upperWarn;
|
||||
|
||||
@Excel(name = "上限值", width = 12, type = 10)
|
||||
@Schema(description = "上限值")
|
||||
private BigDecimal upperLimit;
|
||||
|
||||
private Integer sortNo;
|
||||
private String createBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestStdLine;
|
||||
|
||||
/**
|
||||
* MES 胶料快检实验标准明细 Mapper
|
||||
*/
|
||||
public interface MesXslRubberQuickTestStdLineMapper extends BaseMapper<MesXslRubberQuickTestStdLine> {}
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestStd;
|
||||
|
||||
/**
|
||||
* MES 胶料快检实验标准 Mapper
|
||||
*/
|
||||
public interface MesXslRubberQuickTestStdMapper extends BaseMapper<MesXslRubberQuickTestStd> {}
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestStd;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestStdLine;
|
||||
|
||||
public interface IMesXslRubberQuickTestStdService extends IService<MesXslRubberQuickTestStd> {
|
||||
|
||||
boolean isStdNameDuplicated(String stdName, String excludeId, MesXslRubberQuickTestStd context);
|
||||
|
||||
void saveMain(MesXslRubberQuickTestStd main, List<MesXslRubberQuickTestStdLine> lineList);
|
||||
|
||||
void updateMain(MesXslRubberQuickTestStd main, List<MesXslRubberQuickTestStdLine> lineList);
|
||||
|
||||
void delMain(String id);
|
||||
|
||||
void delBatchMain(Collection<? extends Serializable> idList);
|
||||
|
||||
List<MesXslRubberQuickTestStdLine> selectLinesByStdId(String stdId);
|
||||
|
||||
/**
|
||||
* 密炼PS(原材料检验标准)批准后,将关联实验标准审核状态置为已批准(仅写入,不随PS反审核回退)
|
||||
*/
|
||||
void markAuditApprovedByPsCompileIds(Collection<String> psCompileIds);
|
||||
}
|
||||
@@ -1,13 +1,17 @@
|
||||
package org.jeecg.modules.xslmes.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.common.XslMesBizConstants;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslMixerPsCompile;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslMixerPsCompileMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslMixerPsCompileService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestStdService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -18,6 +22,9 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
public class MesXslMixerPsCompileServiceImpl extends ServiceImpl<MesXslMixerPsCompileMapper, MesXslMixerPsCompile>
|
||||
implements IMesXslMixerPsCompileService {
|
||||
|
||||
@Autowired
|
||||
private IMesXslRubberQuickTestStdService mesXslRubberQuickTestStdService;
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260520 for:【密炼PS编制】批量流转状态-----------
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -28,6 +35,9 @@ public class MesXslMixerPsCompileServiceImpl extends ServiceImpl<MesXslMixerPsCo
|
||||
}
|
||||
List<String> idList = Arrays.asList(ids.split(","));
|
||||
Date now = new Date();
|
||||
//update-begin---author:jiangxh ---date:20260525 for:【MES】原材料检验标准PS批准后关联实验标准置已批准-----------
|
||||
List<String> rawInspectStdApprovedPsIds = new ArrayList<>();
|
||||
//update-end---author:jiangxh ---date:20260525 for:【MES】原材料检验标准PS批准后关联实验标准置已批准-----------
|
||||
for (String id : idList) {
|
||||
if (oConvertUtils.isEmpty(id)) {
|
||||
continue;
|
||||
@@ -44,7 +54,18 @@ public class MesXslMixerPsCompileServiceImpl extends ServiceImpl<MesXslMixerPsCo
|
||||
entity.setStatus(targetStatus);
|
||||
fillWorkflowInfo(entity, targetStatus, operatorName, now);
|
||||
updateById(entity);
|
||||
//update-begin---author:jiangxh ---date:20260525 for:【MES】原材料检验标准PS批准后关联实验标准置已批准-----------
|
||||
if ("approve".equals(targetStatus)
|
||||
&& XslMesBizConstants.PS_TYPE_RAW_INSPECT_STD.equals(entity.getPsType())) {
|
||||
rawInspectStdApprovedPsIds.add(entity.getId());
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260525 for:【MES】原材料检验标准PS批准后关联实验标准置已批准-----------
|
||||
}
|
||||
//update-begin---author:jiangxh ---date:20260525 for:【MES】原材料检验标准PS批准后关联实验标准置已批准-----------
|
||||
if (!rawInspectStdApprovedPsIds.isEmpty()) {
|
||||
mesXslRubberQuickTestStdService.markAuditApprovedByPsCompileIds(rawInspectStdApprovedPsIds);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260525 for:【MES】原材料检验标准PS批准后关联实验标准置已批准-----------
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
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.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.common.util.TokenUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.common.XslMesBizConstants;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestStd;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestStdLine;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestStdLineMapper;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestStdMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestStdService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
@Service
|
||||
public class MesXslRubberQuickTestStdServiceImpl
|
||||
extends ServiceImpl<MesXslRubberQuickTestStdMapper, MesXslRubberQuickTestStd>
|
||||
implements IMesXslRubberQuickTestStdService {
|
||||
|
||||
@Autowired
|
||||
private MesXslRubberQuickTestStdLineMapper mesXslRubberQuickTestStdLineMapper;
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260525 for:【MES】胶料快检实验标准名称同租户唯一、主子保存-----------
|
||||
@Override
|
||||
public boolean isStdNameDuplicated(String stdName, String excludeId, MesXslRubberQuickTestStd context) {
|
||||
if (oConvertUtils.isEmpty(stdName)) {
|
||||
return false;
|
||||
}
|
||||
Integer tenantId = resolveTenantId(context);
|
||||
LambdaQueryWrapper<MesXslRubberQuickTestStd> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslRubberQuickTestStd::getStdName, stdName.trim());
|
||||
w.and(q -> q.eq(MesXslRubberQuickTestStd::getDelFlag, CommonConstant.DEL_FLAG_0).or().isNull(MesXslRubberQuickTestStd::getDelFlag));
|
||||
if (oConvertUtils.isNotEmpty(excludeId)) {
|
||||
w.ne(MesXslRubberQuickTestStd::getId, excludeId);
|
||||
}
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslRubberQuickTestStd::getTenantId, tenantId);
|
||||
}
|
||||
return this.count(w) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveMain(MesXslRubberQuickTestStd main, List<MesXslRubberQuickTestStdLine> lineList) {
|
||||
assertStdNameUniqueForSave(main, null);
|
||||
applyDefaultStatus(main, true);
|
||||
this.save(main);
|
||||
insertLines(main.getId(), lineList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateMain(MesXslRubberQuickTestStd main, List<MesXslRubberQuickTestStdLine> lineList) {
|
||||
if (oConvertUtils.isEmpty(main.getId())) {
|
||||
throw new JeecgBootException("缺少主键");
|
||||
}
|
||||
MesXslRubberQuickTestStd old = this.getById(main.getId());
|
||||
if (old == null) {
|
||||
throw new JeecgBootException("实验标准不存在");
|
||||
}
|
||||
main.setEnableStatus(old.getEnableStatus());
|
||||
main.setAuditStatus(old.getAuditStatus());
|
||||
assertStdNameUniqueForSave(main, main.getId());
|
||||
this.updateById(main);
|
||||
mesXslRubberQuickTestStdLineMapper.delete(
|
||||
new LambdaQueryWrapper<MesXslRubberQuickTestStdLine>()
|
||||
.eq(MesXslRubberQuickTestStdLine::getStdId, main.getId()));
|
||||
insertLines(main.getId(), lineList);
|
||||
}
|
||||
|
||||
private void applyDefaultStatus(MesXslRubberQuickTestStd main, boolean isNew) {
|
||||
if (!isNew) {
|
||||
return;
|
||||
}
|
||||
if (oConvertUtils.isEmpty(main.getEnableStatus())) {
|
||||
main.setEnableStatus("1");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(main.getAuditStatus())) {
|
||||
main.setAuditStatus("0");
|
||||
}
|
||||
}
|
||||
|
||||
private void insertLines(String stdId, List<MesXslRubberQuickTestStdLine> lineList) {
|
||||
if (CollectionUtils.isEmpty(lineList)) {
|
||||
return;
|
||||
}
|
||||
int sort = 0;
|
||||
for (MesXslRubberQuickTestStdLine line : lineList) {
|
||||
line.setId(null);
|
||||
line.setStdId(stdId);
|
||||
line.setSortNo(sort++);
|
||||
mesXslRubberQuickTestStdLineMapper.insert(line);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delMain(String id) {
|
||||
mesXslRubberQuickTestStdLineMapper.delete(
|
||||
new LambdaQueryWrapper<MesXslRubberQuickTestStdLine>().eq(MesXslRubberQuickTestStdLine::getStdId, id));
|
||||
this.removeById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delBatchMain(Collection<? extends Serializable> idList) {
|
||||
for (Serializable id : idList) {
|
||||
delMain(id.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MesXslRubberQuickTestStdLine> selectLinesByStdId(String stdId) {
|
||||
return mesXslRubberQuickTestStdLineMapper.selectList(
|
||||
new LambdaQueryWrapper<MesXslRubberQuickTestStdLine>()
|
||||
.eq(MesXslRubberQuickTestStdLine::getStdId, stdId)
|
||||
.orderByAsc(MesXslRubberQuickTestStdLine::getSortNo));
|
||||
}
|
||||
|
||||
private void assertStdNameUniqueForSave(MesXslRubberQuickTestStd entity, String excludeId) {
|
||||
if (entity == null || oConvertUtils.isEmpty(entity.getStdName())) {
|
||||
throw new JeecgBootException("实验标准名称不能为空");
|
||||
}
|
||||
String name = entity.getStdName().trim();
|
||||
entity.setStdName(name);
|
||||
if (isStdNameDuplicated(name, excludeId, entity)) {
|
||||
throw new JeecgBootException("实验标准名称已存在");
|
||||
}
|
||||
}
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260525 for:【MES】原材料检验标准密炼PS批准时关联实验标准置已批准-----------
|
||||
@Override
|
||||
public void markAuditApprovedByPsCompileIds(Collection<String> psCompileIds) {
|
||||
if (CollectionUtils.isEmpty(psCompileIds)) {
|
||||
return;
|
||||
}
|
||||
List<String> ids =
|
||||
psCompileIds.stream().filter(id -> oConvertUtils.isNotEmpty(id)).map(String::trim).distinct().collect(Collectors.toList());
|
||||
if (ids.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
this.lambdaUpdate()
|
||||
.in(MesXslRubberQuickTestStd::getPsCompileId, ids)
|
||||
.and(w -> w.eq(MesXslRubberQuickTestStd::getDelFlag, CommonConstant.DEL_FLAG_0).or().isNull(MesXslRubberQuickTestStd::getDelFlag))
|
||||
.set(MesXslRubberQuickTestStd::getAuditStatus, XslMesBizConstants.RUBBER_QUICK_TEST_STD_AUDIT_APPROVED)
|
||||
.update();
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260525 for:【MES】原材料检验标准密炼PS批准时关联实验标准置已批准-----------
|
||||
|
||||
private static Integer resolveTenantId(MesXslRubberQuickTestStd context) {
|
||||
if (context != null && context.getTenantId() != null) {
|
||||
return context.getTenantId();
|
||||
}
|
||||
String ts = TenantContext.getTenant();
|
||||
if (oConvertUtils.isEmpty(ts)) {
|
||||
try {
|
||||
ts = TokenUtils.getTenantIdByRequest(SpringContextUtils.getHttpServletRequest());
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
if (oConvertUtils.isEmpty(ts)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return Integer.parseInt(ts.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260525 for:【MES】胶料快检实验标准名称同租户唯一、主子保存-----------
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.jeecg.modules.xslmes.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestStd;
|
||||
|
||||
/**
|
||||
* 胶料快检实验标准主子保存页 VO
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MesXslRubberQuickTestStdPage extends MesXslRubberQuickTestStd {}
|
||||
Reference in New Issue
Block a user