feat(biz): 新增机台工艺参数配置功能
This commit is contained in:
parent
4f0cb9ec28
commit
2ab3545bc0
@ -56,8 +56,8 @@ public class ServiceExceptionUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ServiceException exception(String message) {
|
public static ServiceException exception(String message) {
|
||||||
String messagePattern = MESSAGES.getOrDefault(400, message);
|
String messagePattern = MESSAGES.getOrDefault(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(), message);
|
||||||
return exception0(400, messagePattern);
|
return exception0(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(), messagePattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,13 +1,10 @@
|
|||||||
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.machineparam.vo;
|
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.machineparam.vo;
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageParam;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageParam;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import java.time.LocalDateTime;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import static com.ningxia.yunxi.chemmes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
import lombok.ToString;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 机台工艺参数配置分页 Request VO")
|
@Schema(description = "管理后台 - 机台工艺参数配置分页 Request VO")
|
||||||
@Data
|
@Data
|
||||||
@ -24,4 +21,6 @@ public class MachineParamPageReqVO extends PageParam {
|
|||||||
@Schema(description = "机台名称", example = "李四")
|
@Schema(description = "机台名称", example = "李四")
|
||||||
private String machineName;
|
private String machineName;
|
||||||
|
|
||||||
|
private String spec;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -73,6 +73,8 @@ public class MachineParamRespVO {
|
|||||||
@ExcelProperty("机台id")
|
@ExcelProperty("机台id")
|
||||||
private Integer machineId;
|
private Integer machineId;
|
||||||
|
|
||||||
|
private String collectCycle;
|
||||||
|
|
||||||
@Schema(description = "工艺参数明细列表")
|
@Schema(description = "工艺参数明细列表")
|
||||||
private List<MachineParamDetailRespVO> details;
|
private List<MachineParamDetailRespVO> details;
|
||||||
|
|
||||||
|
|||||||
@ -49,6 +49,9 @@ public class MachineParamSaveReqVO {
|
|||||||
@Schema(description = "机台id", example = "10661")
|
@Schema(description = "机台id", example = "10661")
|
||||||
private Integer machineId;
|
private Integer machineId;
|
||||||
|
|
||||||
|
@Schema(description = "采集周期", example = "10")
|
||||||
|
private Integer collectCycle;
|
||||||
|
|
||||||
private List<MachineParamDetailSaveReqVO> details;
|
private List<MachineParamDetailSaveReqVO> details;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -89,12 +89,23 @@ public class MaterialController {
|
|||||||
ExcelUtils.write(response, "物料主数据.xls", "数据", MaterialRespVO.class,
|
ExcelUtils.write(response, "物料主数据.xls", "数据", MaterialRespVO.class,
|
||||||
BeanUtils.toBean(list, MaterialRespVO.class));
|
BeanUtils.toBean(list, MaterialRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 物料下拉框
|
// 物料下拉框
|
||||||
@GetMapping("/dropdown")
|
@GetMapping("/dropdown")
|
||||||
@Operation(summary = "获得物料主数据下拉框")
|
@Operation(summary = "获得物料主数据下拉框")
|
||||||
@PreAuthorize("@ss.hasPermission('biz:material:query')")
|
@PreAuthorize("@ss.hasPermission('biz:material:query')")
|
||||||
public CommonResult<List<MaterialRespVO>> getMaterialDropdown(@RequestParam(value = "keyWord", required = false, defaultValue = "") String keyWord) {
|
public CommonResult<List<MaterialRespVO>> getMaterialDropdown(@RequestParam(value = "keyWord", required = false, defaultValue = "") String keyWord,
|
||||||
return success(BeanUtils.toBean(materialService.getMaterialDropdown(keyWord), MaterialRespVO.class));
|
@RequestParam(value = "matType", required = false, defaultValue = "") String type) {
|
||||||
|
return success(BeanUtils.toBean(materialService.getMaterialDropdown(keyWord, type), MaterialRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 规格型号下拉框
|
||||||
|
@GetMapping("/spec/dropdown")
|
||||||
|
@Operation(summary = "获得规格型号下拉框")
|
||||||
|
@PreAuthorize("@ss.hasPermission('biz:material:query')")
|
||||||
|
public CommonResult<List<MaterialRespVO>> getMaterialSpecificationDropdown(@RequestParam(value = "keyWord", required = false, defaultValue = "") String keyWord,
|
||||||
|
@RequestParam(value = "matType", required = false, defaultValue = "") String type) {
|
||||||
|
return success(BeanUtils.toBean(materialService.getMaterialSpecDropdown(keyWord, type), MaterialRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
package com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.machineparam;
|
package com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.machineparam;
|
||||||
|
|
||||||
import lombok.*;
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
import java.util.*;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import java.time.LocalDateTime;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.ningxia.yunxi.chemmes.framework.mybatis.core.dataobject.BaseDO;
|
import com.ningxia.yunxi.chemmes.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机台工艺参数配置 DO
|
* 机台工艺参数配置 DO
|
||||||
@ -34,7 +33,7 @@ public class MachineParamDO extends BaseDO {
|
|||||||
/**
|
/**
|
||||||
* 状态(1启用 2 未启用)
|
* 状态(1启用 2 未启用)
|
||||||
*
|
*
|
||||||
* 枚举 {@link TODO system_status 对应的类}
|
* 枚举
|
||||||
*/
|
*/
|
||||||
private Integer enabledStatus;
|
private Integer enabledStatus;
|
||||||
/**
|
/**
|
||||||
@ -78,4 +77,6 @@ public class MachineParamDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private Integer machineId;
|
private Integer machineId;
|
||||||
|
|
||||||
|
private Integer collectCycle;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,13 +1,11 @@
|
|||||||
package com.ningxia.yunxi.chemmes.module.biz.dal.mysql.machineparam;
|
package com.ningxia.yunxi.chemmes.module.biz.dal.mysql.machineparam;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||||
import com.ningxia.yunxi.chemmes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|
||||||
import com.ningxia.yunxi.chemmes.framework.mybatis.core.mapper.BaseMapperX;
|
import com.ningxia.yunxi.chemmes.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import com.ningxia.yunxi.chemmes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.machineparam.vo.MachineParamPageReqVO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.machineparam.MachineParamDO;
|
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.machineparam.MachineParamDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.machineparam.vo.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机台工艺参数配置 Mapper
|
* 机台工艺参数配置 Mapper
|
||||||
@ -22,7 +20,13 @@ public interface MachineParamMapper extends BaseMapperX<MachineParamDO> {
|
|||||||
.eqIfPresent(MachineParamDO::getEnabledStatus, reqVO.getEnabledStatus())
|
.eqIfPresent(MachineParamDO::getEnabledStatus, reqVO.getEnabledStatus())
|
||||||
.likeIfPresent(MachineParamDO::getMatName, reqVO.getMatName())
|
.likeIfPresent(MachineParamDO::getMatName, reqVO.getMatName())
|
||||||
.likeIfPresent(MachineParamDO::getMachineName, reqVO.getMachineName())
|
.likeIfPresent(MachineParamDO::getMachineName, reqVO.getMachineName())
|
||||||
|
.likeIfPresent(MachineParamDO::getSpec, reqVO.getSpec())
|
||||||
.orderByDesc(MachineParamDO::getId));
|
.orderByDesc(MachineParamDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default Long selectByMachineNameAndMatName(String machineName, String matName) {
|
||||||
|
return selectCount(new LambdaQueryWrapperX<MachineParamDO>()
|
||||||
|
.eq(MachineParamDO::getMachineName, machineName)
|
||||||
|
.eq(MachineParamDO::getMatName, matName));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -26,9 +26,10 @@ public interface MaterialMapper extends BaseMapperX<MaterialDO> {
|
|||||||
.orderByDesc(MaterialDO::getId));
|
.orderByDesc(MaterialDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
default List<MaterialDO> selectMaterialDropdown(String keyWord) {
|
default List<MaterialDO> selectMaterialDropdown(String keyWord, String matType) {
|
||||||
return selectList(new LambdaQueryWrapperX<MaterialDO>()
|
return selectList(new LambdaQueryWrapperX<MaterialDO>()
|
||||||
.eq(MaterialDO::getEnabledStatus, 0)
|
.eq(MaterialDO::getEnabledStatus, 0)
|
||||||
|
.eqIfPresent(MaterialDO::getMatType, matType)
|
||||||
.and(
|
.and(
|
||||||
wrapper -> wrapper
|
wrapper -> wrapper
|
||||||
.like(MaterialDO::getMatCode, keyWord)
|
.like(MaterialDO::getMatCode, keyWord)
|
||||||
@ -37,4 +38,12 @@ public interface MaterialMapper extends BaseMapperX<MaterialDO> {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default List<MaterialDO> selectMaterialSpecDropdown(String keyWord, String type) {
|
||||||
|
return selectList(new LambdaQueryWrapperX<MaterialDO>()
|
||||||
|
.eq(MaterialDO::getEnabledStatus, 0)
|
||||||
|
.eqIfPresent(MaterialDO::getMatType, type)
|
||||||
|
.like(MaterialDO::getSpec, keyWord)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,7 +19,7 @@ public interface UserMachineMapper extends BaseMapperX<UserMachineDO> {
|
|||||||
default PageResult<UserMachineDO> selectPage(UserMachinePageReqVO reqVO) {
|
default PageResult<UserMachineDO> selectPage(UserMachinePageReqVO reqVO) {
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<UserMachineDO>()
|
return selectPage(reqVO, new LambdaQueryWrapperX<UserMachineDO>()
|
||||||
.eqIfPresent(UserMachineDO::getEnabledStatus, reqVO.getEnabledStatus())
|
.eqIfPresent(UserMachineDO::getEnabledStatus, reqVO.getEnabledStatus())
|
||||||
.eqIfPresent(UserMachineDO::getUserNo, reqVO.getUserNo())
|
.likeIfPresent(UserMachineDO::getUserNo, reqVO.getUserNo())
|
||||||
.eqIfPresent(UserMachineDO::getClassGroup, reqVO.getClassGroup())
|
.eqIfPresent(UserMachineDO::getClassGroup, reqVO.getClassGroup())
|
||||||
.orderByDesc(UserMachineDO::getId));
|
.orderByDesc(UserMachineDO::getId));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,8 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import static com.ningxia.yunxi.chemmes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机台工艺参数配置 Service 实现类
|
* 机台工艺参数配置 Service 实现类
|
||||||
*
|
*
|
||||||
@ -31,6 +33,8 @@ public class MachineParamServiceImpl implements MachineParamService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Integer createMachineParam(MachineParamSaveReqVO createReqVO) {
|
public Integer createMachineParam(MachineParamSaveReqVO createReqVO) {
|
||||||
|
// 机台(具体机台)+ 产品名称(具体产品名称)工艺参数已配置,请确认!
|
||||||
|
validateMachineParamUnique(createReqVO);
|
||||||
// 插入
|
// 插入
|
||||||
MachineParamDO machineParam = BeanUtils.toBean(createReqVO, MachineParamDO.class);
|
MachineParamDO machineParam = BeanUtils.toBean(createReqVO, MachineParamDO.class);
|
||||||
machineParamMapper.insert(machineParam);
|
machineParamMapper.insert(machineParam);
|
||||||
@ -40,10 +44,21 @@ public class MachineParamServiceImpl implements MachineParamService {
|
|||||||
return machineParam.getId();
|
return machineParam.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void validateMachineParamUnique(MachineParamSaveReqVO createReqVO) {
|
||||||
|
Long count = machineParamMapper.selectByMachineNameAndMatName(createReqVO.getMachineName(), createReqVO.getMatName());
|
||||||
|
if (count > 0 && createReqVO.getId() == null) {
|
||||||
|
throw exception("机台(" + createReqVO.getMachineName() + ") + 产品名称(" + createReqVO.getMatName() + ") 工艺参数已配置,请确认!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateMachineParam(MachineParamSaveReqVO updateReqVO) {
|
public void updateMachineParam(MachineParamSaveReqVO updateReqVO) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
validateMachineParamExists(updateReqVO.getId());
|
if (machineParamMapper.selectById(updateReqVO.getId()) == null) {
|
||||||
|
throw exception("机台(" + updateReqVO.getMachineName() + ") + 产品名称(" + updateReqVO.getMatName() + ") 工艺参数配置不存在,请刷新界面!");
|
||||||
|
}
|
||||||
|
validateMachineParamUnique(updateReqVO);
|
||||||
|
|
||||||
// 更新
|
// 更新
|
||||||
MachineParamDO updateObj = BeanUtils.toBean(updateReqVO, MachineParamDO.class);
|
MachineParamDO updateObj = BeanUtils.toBean(updateReqVO, MachineParamDO.class);
|
||||||
machineParamMapper.updateById(updateObj);
|
machineParamMapper.updateById(updateObj);
|
||||||
@ -62,13 +77,17 @@ public class MachineParamServiceImpl implements MachineParamService {
|
|||||||
|
|
||||||
private void validateMachineParamExists(Integer id) {
|
private void validateMachineParamExists(Integer id) {
|
||||||
if (machineParamMapper.selectById(id) == null) {
|
if (machineParamMapper.selectById(id) == null) {
|
||||||
// throw exception(MACHINE_PARAM_NOT_EXISTS);
|
throw exception("该机台工艺参数配置不存在");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MachineParamDO getMachineParam(Integer id) {
|
public MachineParamDO getMachineParam(Integer id) {
|
||||||
return machineParamMapper.selectById(id);
|
MachineParamDO machineParamDO = machineParamMapper.selectById(id);
|
||||||
|
if (machineParamDO == null) {
|
||||||
|
throw exception("该机台工艺参数配置不存在,请确认!");
|
||||||
|
}
|
||||||
|
return machineParamDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -53,5 +53,7 @@ public interface MaterialService {
|
|||||||
*/
|
*/
|
||||||
PageResult<MaterialDO> getMaterialPage(MaterialPageReqVO pageReqVO);
|
PageResult<MaterialDO> getMaterialPage(MaterialPageReqVO pageReqVO);
|
||||||
|
|
||||||
List<MaterialDO> getMaterialDropdown(String keyWord);
|
List<MaterialDO> getMaterialDropdown(String keyWord, String matType);
|
||||||
|
|
||||||
|
List<MaterialDO> getMaterialSpecDropdown(String keyWord, String type);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,6 @@ package com.ningxia.yunxi.chemmes.module.biz.service.material;
|
|||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.util.object.BeanUtils;
|
import com.ningxia.yunxi.chemmes.framework.common.util.object.BeanUtils;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.material.vo.MaterialPageReqVO;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.material.vo.MaterialPageReqVO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.material.vo.MaterialRespVO;
|
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.material.vo.MaterialSaveReqVO;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.material.vo.MaterialSaveReqVO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.material.MaterialDO;
|
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.material.MaterialDO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.dal.mysql.material.MaterialMapper;
|
import com.ningxia.yunxi.chemmes.module.biz.dal.mysql.material.MaterialMapper;
|
||||||
@ -13,6 +12,8 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.ningxia.yunxi.chemmes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物料主数据 Service 实现类
|
* 物料主数据 Service 实现类
|
||||||
*
|
*
|
||||||
@ -53,7 +54,7 @@ public class MaterialServiceImpl implements MaterialService {
|
|||||||
|
|
||||||
private void validateMaterialExists(Integer id) {
|
private void validateMaterialExists(Integer id) {
|
||||||
if (materialMapper.selectById(id) == null) {
|
if (materialMapper.selectById(id) == null) {
|
||||||
// throw exception(MATERIAL_NOT_EXISTS);
|
throw exception("数据不存在");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +69,11 @@ public class MaterialServiceImpl implements MaterialService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MaterialDO> getMaterialDropdown(String keyWord) {
|
public List<MaterialDO> getMaterialDropdown(String keyWord, String matType) {
|
||||||
return materialMapper.selectMaterialDropdown(keyWord);
|
return materialMapper.selectMaterialDropdown(keyWord, matType);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<MaterialDO> getMaterialSpecDropdown(String keyWord, String type) {
|
||||||
|
return materialMapper.selectMaterialSpecDropdown(keyWord, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,3 +49,8 @@ export const exportMaterial = async (params) => {
|
|||||||
export const getMaterialDropdown = async (params) => {
|
export const getMaterialDropdown = async (params) => {
|
||||||
return await request.get({ url: `/biz/material/dropdown`, params })
|
return await request.get({ url: `/biz/material/dropdown`, params })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取规格型号下拉列表
|
||||||
|
export const getSpecDropdown = async (params) => {
|
||||||
|
return await request.get({ url: `/biz/material/spec/dropdown`, params })
|
||||||
|
}
|
||||||
|
|||||||
@ -167,7 +167,8 @@ service.interceptors.response.use(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else if (code === 500) {
|
} else if (code === 500) {
|
||||||
ElMessage.error(t('后端请求错误,原因:'+msg))
|
// ElMessage.error(t('后端请求错误,原因:'+msg))
|
||||||
|
ElMessage.error(t(msg))
|
||||||
return Promise.reject(new Error(msg))
|
return Promise.reject(new Error(msg))
|
||||||
} else if (code === 901) {
|
} else if (code === 901) {
|
||||||
ElMessage.error({
|
ElMessage.error({
|
||||||
|
|||||||
@ -0,0 +1,199 @@
|
|||||||
|
<template>
|
||||||
|
<Dialog :title="dialogTitle" v-model="dialogVisible" width="1200px">
|
||||||
|
<div v-loading="formLoading">
|
||||||
|
<!-- 基本信息区域 -->
|
||||||
|
<el-row :gutter="24">
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="工序">
|
||||||
|
<el-input :value="formData.procName" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="机台">
|
||||||
|
<el-input :value="formData.machineName" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="启用状态">
|
||||||
|
<el-input :value="enabledStatusLabel" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row :gutter="24">
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="产品名称">
|
||||||
|
<el-input :value="formData.matName" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="规格型号">
|
||||||
|
<el-input :value="formData.spec" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="采集周期(分)">
|
||||||
|
<el-input :value="formData.collectCycle" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row :gutter="24">
|
||||||
|
<el-col :span="16">
|
||||||
|
<el-form-item label="备注">
|
||||||
|
<el-input :value="formData.remark" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 工艺参数信息区域 -->
|
||||||
|
<div class="param-info-section">
|
||||||
|
<div class="section-header">
|
||||||
|
<span class="section-title">工艺参数信息</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-table
|
||||||
|
:data="paramDetailList"
|
||||||
|
border
|
||||||
|
size="small"
|
||||||
|
max-height="250"
|
||||||
|
>
|
||||||
|
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||||
|
<el-table-column prop="procParamName" label="工艺参数名称" width="140" align="center" />
|
||||||
|
<el-table-column prop="standardValue" label="标准值" align="center" />
|
||||||
|
<el-table-column prop="lowerLimit" label="下限值" align="center" />
|
||||||
|
<el-table-column prop="upperLimit" label="上限值" align="center" />
|
||||||
|
<el-table-column prop="dev" label="偏差" width="90" align="center" />
|
||||||
|
<el-table-column prop="procParamUnit" label="单位" width="80" align="center" />
|
||||||
|
<el-table-column prop="isAlert" label="是否预警" width="110" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ scope.row.isAlert === '0' ? '是' : '否' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="remark" label="备注" align="center" />
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="dialogVisible = false">关闭</el-button>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, reactive, computed, onMounted } from 'vue'
|
||||||
|
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||||
|
import * as MachineParamApi from '@/api/biz/machineparam'
|
||||||
|
|
||||||
|
// 表单类型定义
|
||||||
|
interface ParamDetail {
|
||||||
|
id?: number
|
||||||
|
procParamName: string
|
||||||
|
procParamUnit: string
|
||||||
|
procParamId?: number
|
||||||
|
standardValue: string | number
|
||||||
|
upperLimit: string | number
|
||||||
|
lowerLimit: string | number
|
||||||
|
dev: string
|
||||||
|
isAlert: string
|
||||||
|
remark: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
|
||||||
|
// 弹窗状态
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const dialogTitle = ref('')
|
||||||
|
const formLoading = ref(false)
|
||||||
|
|
||||||
|
// 主表单数据
|
||||||
|
const formData = reactive({
|
||||||
|
id: undefined as number | undefined,
|
||||||
|
procId: undefined as number | undefined,
|
||||||
|
procCd: '',
|
||||||
|
procName: '',
|
||||||
|
machineId: undefined as number | undefined,
|
||||||
|
machineCd: '',
|
||||||
|
machineName: '',
|
||||||
|
mateId: undefined as number | undefined,
|
||||||
|
matCode: '',
|
||||||
|
matName: '',
|
||||||
|
spec: '',
|
||||||
|
collectCycle: undefined as number | undefined,
|
||||||
|
enabledStatus: 0,
|
||||||
|
remark: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
// 工艺参数详情列表
|
||||||
|
const paramDetailList = ref<ParamDetail[]>([])
|
||||||
|
|
||||||
|
// 启用状态标签
|
||||||
|
const enabledStatusLabel = computed(() => {
|
||||||
|
const options = getIntDictOptions(DICT_TYPE.SYSTEM_STATUS)
|
||||||
|
const option = options.find(o => o.value === formData.enabledStatus)
|
||||||
|
return option ? option.label : ''
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 打开弹窗 */
|
||||||
|
const open = async (id: number) => {
|
||||||
|
dialogVisible.value = true
|
||||||
|
dialogTitle.value = t('action.detail')
|
||||||
|
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
const data = await MachineParamApi.getMachineParam(id)
|
||||||
|
Object.assign(formData, data)
|
||||||
|
|
||||||
|
// 回显工艺参数详情列表
|
||||||
|
if (data.details && Array.isArray(data.details)) {
|
||||||
|
paramDetailList.value = data.details.map(item => ({
|
||||||
|
id: item.id,
|
||||||
|
procParamId: item.procParamId,
|
||||||
|
procParamName: item.procParamName,
|
||||||
|
procParamUnit: item.procParamUnit,
|
||||||
|
standardValue: item.standardValue,
|
||||||
|
upperLimit: item.upperLimit,
|
||||||
|
lowerLimit: item.lowerLimit,
|
||||||
|
dev: item.dev,
|
||||||
|
isAlert: item.isAlert,
|
||||||
|
remark: item.remark
|
||||||
|
}))
|
||||||
|
} else {
|
||||||
|
paramDetailList.value = []
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取机台工艺参数详情失败:', error)
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defineExpose({ open })
|
||||||
|
|
||||||
|
/** 组件挂载时初始化 */
|
||||||
|
onMounted(() => {
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.param-info-section {
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 14px;
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table {
|
||||||
|
--el-table-row-hover-bg-color: #fafafa;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -4,7 +4,7 @@
|
|||||||
ref="formRef"
|
ref="formRef"
|
||||||
:model="formData"
|
:model="formData"
|
||||||
:rules="formRules"
|
:rules="formRules"
|
||||||
label-width="100px"
|
label-width="110px"
|
||||||
v-loading="formLoading"
|
v-loading="formLoading"
|
||||||
>
|
>
|
||||||
<!-- 基本信息区域 -->
|
<!-- 基本信息区域 -->
|
||||||
@ -65,7 +65,11 @@
|
|||||||
<el-input v-model="formData.spec" placeholder="请输入规格型号" :disabled="formType === 'update'"/>
|
<el-input v-model="formData.spec" placeholder="请输入规格型号" :disabled="formType === 'update'"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8" />
|
<el-col :span="8">
|
||||||
|
<el-form-item label="采集周期(分)" prop="collectCycle" >
|
||||||
|
<el-input v-model.number="formData.collectCycle" placeholder="请输入采集周期" type="number" min="1"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row :gutter="24">
|
<el-row :gutter="24">
|
||||||
<el-col :span="16">
|
<el-col :span="16">
|
||||||
@ -118,7 +122,7 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="lowerLimit" label="下限(*)" align="center">
|
<el-table-column prop="lowerLimit" label="下限值(*)" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="scope.row.lowerLimit"
|
v-model="scope.row.lowerLimit"
|
||||||
@ -127,7 +131,7 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="upperLimit" label="上限(*)" align="center">
|
<el-table-column prop="upperLimit" label="上限值(*)" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="scope.row.upperLimit"
|
v-model="scope.row.upperLimit"
|
||||||
@ -146,7 +150,7 @@
|
|||||||
<el-input v-model="scope.row.procParamUnit" size="small" />
|
<el-input v-model="scope.row.procParamUnit" size="small" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="isAlert" label="预警(*)" width="80" align="center">
|
<el-table-column prop="isAlert" label="是否预警(*)" width="110" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-select v-model="scope.row.isAlert" placeholder="选择" size="small">
|
<el-select v-model="scope.row.isAlert" placeholder="选择" size="small">
|
||||||
<el-option label="是" value="0" />
|
<el-option label="是" value="0" />
|
||||||
@ -232,6 +236,7 @@ const formData = reactive({
|
|||||||
matCode: '',
|
matCode: '',
|
||||||
matName: '',
|
matName: '',
|
||||||
spec: '',
|
spec: '',
|
||||||
|
collectCycle: undefined as number | undefined,
|
||||||
enabledStatus: 0,
|
enabledStatus: 0,
|
||||||
remark: ''
|
remark: ''
|
||||||
})
|
})
|
||||||
@ -255,8 +260,8 @@ const initOptions = async () => {
|
|||||||
procOptions.value = await ProcApi.getProcDropdown({})
|
procOptions.value = await ProcApi.getProcDropdown({})
|
||||||
// 机台下拉选项根据工序动态加载,初始化为空
|
// 机台下拉选项根据工序动态加载,初始化为空
|
||||||
machineOptions.value = []
|
machineOptions.value = []
|
||||||
// 使用物料下拉接口查询
|
// 使用物料下拉接口查询 mat_type =‘3’的物料
|
||||||
materialOptions.value = await MaterialApi.getMaterialDropdown({})
|
materialOptions.value = await MaterialApi.getMaterialDropdown({ matType: '3' })
|
||||||
// 工艺参数根据工序动态加载,初始化为空
|
// 工艺参数根据工序动态加载,初始化为空
|
||||||
procParamOptions.value = []
|
procParamOptions.value = []
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -535,6 +540,7 @@ const resetForm = () => {
|
|||||||
formData.matCode = ''
|
formData.matCode = ''
|
||||||
formData.matName = ''
|
formData.matName = ''
|
||||||
formData.spec = ''
|
formData.spec = ''
|
||||||
|
formData.collectCycle = undefined
|
||||||
formData.enabledStatus = 0
|
formData.enabledStatus = 0
|
||||||
formData.remark = ''
|
formData.remark = ''
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,23 @@
|
|||||||
class="!w-240px"
|
class="!w-240px"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="状态" prop="enabledStatus">
|
<el-form-item label="规格型号" prop="spec">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.spec"
|
||||||
|
placeholder="请选择规格型号"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
class="!w-240px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in specOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="启用状态" prop="enabledStatus">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="queryParams.enabledStatus"
|
v-model="queryParams.enabledStatus"
|
||||||
placeholder="请选择状态"
|
placeholder="请选择状态"
|
||||||
@ -64,6 +80,7 @@
|
|||||||
<el-table-column label="产品名称" align="center" prop="matName" />
|
<el-table-column label="产品名称" align="center" prop="matName" />
|
||||||
<el-table-column label="规格型号" align="center" prop="spec" />
|
<el-table-column label="规格型号" align="center" prop="spec" />
|
||||||
<el-table-column label="所属工序" align="center" prop="procName" />
|
<el-table-column label="所属工序" align="center" prop="procName" />
|
||||||
|
<el-table-column label="采集周期(分)" align="center" prop="collectCycle" />
|
||||||
<el-table-column label="状态" align="center" prop="enabledStatus">
|
<el-table-column label="状态" align="center" prop="enabledStatus">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :type="DICT_TYPE.SYSTEM_STATUS" :value="scope.row.enabledStatus" />
|
<dict-tag :type="DICT_TYPE.SYSTEM_STATUS" :value="scope.row.enabledStatus" />
|
||||||
@ -80,6 +97,7 @@
|
|||||||
/>
|
/>
|
||||||
<el-table-column label="操作" align="center">
|
<el-table-column label="操作" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
|
||||||
<el-button
|
<el-button
|
||||||
link
|
link
|
||||||
type="primary"
|
type="primary"
|
||||||
@ -87,6 +105,14 @@
|
|||||||
v-hasPermi="['biz:machine-param:update']"
|
v-hasPermi="['biz:machine-param:update']"
|
||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="openDetail(scope.row.id)"
|
||||||
|
v-hasPermi="['biz:machine-param:detail']"
|
||||||
|
>
|
||||||
|
详情
|
||||||
</el-button>
|
</el-button>
|
||||||
<!-- <el-button
|
<!-- <el-button
|
||||||
link
|
link
|
||||||
@ -110,6 +136,8 @@
|
|||||||
|
|
||||||
<!-- 表单弹窗:添加/修改 -->
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
<MachineParamForm ref="formRef" @success="getList" @close="handleQuery"/>
|
<MachineParamForm ref="formRef" @success="getList" @close="handleQuery"/>
|
||||||
|
<!-- 详情弹窗 -->
|
||||||
|
<MachineParamDetail ref="detailRef" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@ -117,14 +145,16 @@ import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
|||||||
import { dateFormatter2 } from '@/utils/formatTime'
|
import { dateFormatter2 } from '@/utils/formatTime'
|
||||||
import download from '@/utils/download'
|
import download from '@/utils/download'
|
||||||
import * as MachineParamApi from '@/api/biz/machineparam'
|
import * as MachineParamApi from '@/api/biz/machineparam'
|
||||||
|
import * as MaterialApi from '@/api/biz/material'
|
||||||
import MachineParamForm from './MachineParamForm.vue'
|
import MachineParamForm from './MachineParamForm.vue'
|
||||||
|
import MachineParamDetail from './MachineParamDetail.vue'
|
||||||
|
|
||||||
defineOptions({ name: 'MachineParam' })
|
defineOptions({ name: 'MachineParam' })
|
||||||
|
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
|
|
||||||
const loading = ref(true) // 列表的加载中
|
const loading = ref(false) // 列表的加载中
|
||||||
const list = ref([]) // 列表的数据
|
const list = ref([]) // 列表的数据
|
||||||
const total = ref(0) // 列表的总页数
|
const total = ref(0) // 列表的总页数
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
@ -133,10 +163,27 @@ const queryParams = reactive({
|
|||||||
enabledStatus: undefined,
|
enabledStatus: undefined,
|
||||||
matName: undefined,
|
matName: undefined,
|
||||||
machineName: undefined,
|
machineName: undefined,
|
||||||
|
spec: undefined,
|
||||||
})
|
})
|
||||||
const queryFormRef = ref() // 搜索的表单
|
const queryFormRef = ref() // 搜索的表单
|
||||||
const exportLoading = ref(false) // 导出的加载中
|
const exportLoading = ref(false) // 导出的加载中
|
||||||
|
|
||||||
|
// 规格型号下拉选项
|
||||||
|
const specOptions = ref<{ label: string; value: string }[]>([])
|
||||||
|
|
||||||
|
/** 加载规格型号下拉选项 */
|
||||||
|
const loadSpecOptions = async () => {
|
||||||
|
try {
|
||||||
|
const data = await MaterialApi.getSpecDropdown({})
|
||||||
|
specOptions.value = data.map(item => ({
|
||||||
|
label: item.spec,
|
||||||
|
value: item.spec
|
||||||
|
}))
|
||||||
|
} catch (error) {
|
||||||
|
console.error('加载规格型号下拉选项失败:', error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
@ -167,6 +214,12 @@ const openForm = (type: string, id?: number) => {
|
|||||||
formRef.value.open(type, id)
|
formRef.value.open(type, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 查看详情操作 */
|
||||||
|
const detailRef = ref()
|
||||||
|
const openDetail = (id: number) => {
|
||||||
|
detailRef.value.open(id)
|
||||||
|
}
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
const handleDelete = async (id: number) => {
|
const handleDelete = async (id: number) => {
|
||||||
try {
|
try {
|
||||||
@ -180,23 +233,9 @@ const handleDelete = async (id: number) => {
|
|||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 导出按钮操作 */
|
|
||||||
const handleExport = async () => {
|
|
||||||
try {
|
|
||||||
// 导出的二次确认
|
|
||||||
await message.exportConfirm()
|
|
||||||
// 发起导出
|
|
||||||
exportLoading.value = true
|
|
||||||
const data = await MachineParamApi.exportMachineParam(queryParams)
|
|
||||||
download.excel(data, '机台工艺参数配置.xls')
|
|
||||||
} catch {
|
|
||||||
} finally {
|
|
||||||
exportLoading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 初始化 **/
|
/** 初始化 **/
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList()
|
// 加载规格型号下拉选项,不自动查询列表
|
||||||
|
loadSpecOptions()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user