机床设备管理-机床信息模块

This commit is contained in:
xusd 2024-08-29 17:10:46 +08:00
parent 2a7db2bc89
commit 0978e17108
25 changed files with 1059 additions and 2 deletions

View File

@ -165,5 +165,6 @@ public interface ErrorCodeConstants {
// ========== 基础信息模块 ==========
ErrorCode MODEL_INFO_NOT_EXISTS = new ErrorCode(1_002_028_000, "未获取到机床型号信息");
ErrorCode CUSTOMER_INFO_NOT_EXISTS = new ErrorCode(1_002_028_000, "未获取到机床客户信息");
ErrorCode EQUIP_INFO_NOT_EXISTS = new ErrorCode(1_002_028_000, "未获取到机床信息");
}

View File

@ -6,6 +6,7 @@ import com.inspur.framework.ip.core.utils.AreaUtils;
import com.inspur.module.system.controller.baseData.vo.CustomerInfoPageReqVO;
import com.inspur.module.system.controller.baseData.vo.CustomerInfoRespVO;
import com.inspur.module.system.controller.baseData.vo.CustomerInfoSaveReqVO;
import com.inspur.module.system.controller.baseData.vo.CustomerInfoSelectionVO;
import com.inspur.module.system.dal.dataobject.baseData.CustomerInfoDO;
import com.inspur.module.system.service.baseData.CustomerInfoService;
import org.springframework.web.bind.annotation.*;
@ -125,4 +126,11 @@ public class CustomerInfoController {
ExcelUtils.write(response, "机床客户信息.xls", "数据", CustomerInfoRespVO.class, bean);
}
@Operation(summary = "机床客户信息下拉")
@PreAuthorize("@ss.hasPermission('imt:customer-info:query')")
@GetMapping("/selection")
public List<CustomerInfoSelectionVO> selection() {
return customerInfoService.selection(false);
}
}

View File

@ -3,6 +3,7 @@ package com.inspur.module.system.controller.baseData;
import com.inspur.module.system.controller.baseData.vo.ModelInfoPageReqVO;
import com.inspur.module.system.controller.baseData.vo.ModelInfoRespVO;
import com.inspur.module.system.controller.baseData.vo.ModelInfoSaveReqVO;
import com.inspur.module.system.controller.baseData.vo.ModelInfoSelectionVO;
import com.inspur.module.system.dal.dataobject.baseData.ModelInfoDO;
import com.inspur.module.system.service.baseData.ModelInfoService;
import org.springframework.web.bind.annotation.*;
@ -95,4 +96,11 @@ public class ModelInfoController {
ExcelUtils.write(response, "机床型号信息.xls", "数据", ModelInfoRespVO.class, BeanUtils.toBean(list, ModelInfoRespVO.class));
}
@Operation(summary = "机床型号下拉")
@GetMapping("/selection")
@PreAuthorize("@ss.hasPermission('imt:model-info:query')")
public List<ModelInfoSelectionVO> selection(){
return modelInfoService.selection(false);
}
}

View File

@ -0,0 +1,18 @@
package com.inspur.module.system.controller.baseData.vo;
import lombok.Data;
/**
* 客户信息下拉
*
* @Author xusd
* @Date 2024/8/28 17:33
**/
@Data
public class CustomerInfoSelectionVO {
private String customerId;
private String customerName;
}

View File

@ -0,0 +1,21 @@
package com.inspur.module.system.controller.baseData.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* 机床型号下拉
*
* @Author xusd
* @Date 2024/8/28 17:21
**/
@Data
public class ModelInfoSelectionVO {
@Schema(description = "机床型号id", requiredMode = Schema.RequiredMode.REQUIRED)
private String modelId;
@Schema(description = "机床型号名称", requiredMode = Schema.RequiredMode.REQUIRED)
private String modelName;
}

View File

@ -0,0 +1,134 @@
package com.inspur.module.system.controller.equip;
import cn.hutool.core.collection.CollUtil;
import com.inspur.module.system.controller.baseData.vo.CustomerInfoSelectionVO;
import com.inspur.module.system.controller.baseData.vo.ModelInfoSelectionVO;
import com.inspur.module.system.controller.equip.vo.EquipInfoPageReqVO;
import com.inspur.module.system.controller.equip.vo.EquipInfoRespVO;
import com.inspur.module.system.controller.equip.vo.EquipInfoSaveReqVO;
import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO;
import com.inspur.module.system.service.baseData.CustomerInfoService;
import com.inspur.module.system.service.baseData.ModelInfoService;
import com.inspur.module.system.service.equip.EquipInfoService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import java.util.stream.Collectors;
import com.inspur.framework.common.pojo.PageParam;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.framework.common.pojo.CommonResult;
import com.inspur.framework.common.util.object.BeanUtils;
import static com.inspur.framework.common.pojo.CommonResult.success;
import com.inspur.framework.excel.core.util.ExcelUtils;
import com.inspur.framework.apilog.core.annotation.ApiAccessLog;
import static com.inspur.framework.apilog.core.enums.OperateTypeEnum.*;
@Tag(name = "管理后台 - 机床信息")
@RestController
@RequestMapping("/admin-api/equip/equipInfo")
@Validated
public class EquipInfoController {
@Resource
private EquipInfoService equipInfoService;
@Resource
private ModelInfoService modelInfoService;
@Resource
private CustomerInfoService customerInfoService;
@PostMapping("/create")
@Operation(summary = "创建机床信息")
@PreAuthorize("@ss.hasPermission('imt:equip-info:create')")
public CommonResult<String> createEquipInfo(@Valid @RequestBody EquipInfoSaveReqVO createReqVO) {
return success(equipInfoService.createEquipInfo(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新机床信息")
@PreAuthorize("@ss.hasPermission('imt:equip-info:update')")
public CommonResult<Boolean> updateEquipInfo(@Valid @RequestBody EquipInfoSaveReqVO updateReqVO) {
equipInfoService.updateEquipInfo(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除机床信息")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('imt:equip-info:delete')")
public CommonResult<Boolean> deleteEquipInfo(@RequestParam("id") String id) {
equipInfoService.deleteEquipInfo(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得机床信息")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('imt:equip-info:query')")
public CommonResult<EquipInfoRespVO> getEquipInfo(@RequestParam("id") String id) {
EquipInfoDO equipInfo = equipInfoService.getEquipInfo(id);
return success(BeanUtils.toBean(equipInfo, EquipInfoRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得机床信息分页")
@PreAuthorize("@ss.hasPermission('imt:equip-info:query')")
public CommonResult<PageResult<EquipInfoRespVO>> getEquipInfoPage(@Valid EquipInfoPageReqVO pageReqVO) {
PageResult<EquipInfoDO> pageResult = equipInfoService.getEquipInfoPage(pageReqVO);
PageResult<EquipInfoRespVO> result = BeanUtils.toBean(pageResult, EquipInfoRespVO.class);
List<EquipInfoRespVO> list = result.getList();
if (CollUtil.isNotEmpty(list)) {
List<ModelInfoSelectionVO> modelList = modelInfoService.selection(true);
Map<String, String> modelMap = modelList.stream().collect(Collectors.toMap(ModelInfoSelectionVO::getModelId, ModelInfoSelectionVO::getModelName));
List<CustomerInfoSelectionVO> customerList = customerInfoService.selection(true);
Map<String, String> customerMap = customerList.stream().collect(Collectors.toMap(CustomerInfoSelectionVO::getCustomerId, CustomerInfoSelectionVO::getCustomerName));
list.forEach(item -> {
item.setModelName(modelMap.get(item.getModelId()));
item.setCustomerName(customerMap.get(item.getCustomerId()));
});
}
return success(result);
}
@GetMapping("/export-excel")
@Operation(summary = "导出机床信息 Excel")
@PreAuthorize("@ss.hasPermission('imt:equip-info:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportEquipInfoExcel(@Valid EquipInfoPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<EquipInfoDO> list = equipInfoService.getEquipInfoPage(pageReqVO).getList();
List<EquipInfoRespVO> voList = BeanUtils.toBean(list, EquipInfoRespVO.class);
if (CollUtil.isNotEmpty(voList)) {
List<ModelInfoSelectionVO> modelList = modelInfoService.selection(true);
Map<String, String> modelMap = modelList.stream().collect(Collectors.toMap(ModelInfoSelectionVO::getModelId, ModelInfoSelectionVO::getModelName));
List<CustomerInfoSelectionVO> customerList = customerInfoService.selection(true);
Map<String, String> customerMap = customerList.stream().collect(Collectors.toMap(CustomerInfoSelectionVO::getCustomerId, CustomerInfoSelectionVO::getCustomerName));
voList.forEach(item -> {
item.setModelName(modelMap.get(item.getModelId()));
item.setCustomerName(customerMap.get(item.getCustomerId()));
});
}
// 导出 Excel
ExcelUtils.write(response, "机床信息.xls", "数据", EquipInfoRespVO.class, voList);
}
}

View File

@ -0,0 +1,25 @@
package com.inspur.module.system.controller.equip.vo;
import lombok.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.inspur.framework.common.pojo.PageParam;
@Schema(description = "管理后台 - 机床信息分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class EquipInfoPageReqVO extends PageParam {
@Schema(description = "机床型号id")
private String modelId;
@Schema(description = "客户信息id")
private String customerId;
@Schema(description = "机床设备编号")
private String equipNo;
@Schema(description = "机床状态")
private Integer status;
}

View File

@ -0,0 +1,70 @@
package com.inspur.module.system.controller.equip.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
import com.inspur.framework.excel.core.annotations.DictFormat;
import com.inspur.framework.excel.core.convert.DictConvert;
import static com.inspur.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
import static com.inspur.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT;
@Schema(description = "管理后台 - 机床信息 Response VO")
@Data
@ExcelIgnoreUnannotated
public class EquipInfoRespVO {
@Schema(description = "机床信息id", requiredMode = Schema.RequiredMode.REQUIRED)
private String equipId;
@Schema(description = "机床型号id", requiredMode = Schema.RequiredMode.REQUIRED)
private String modelId;
@ExcelProperty("机床型号")
private String modelName;
@Schema(description = "客户信息id", requiredMode = Schema.RequiredMode.REQUIRED)
private String customerId;
@ExcelProperty("客户信息名称")
private String customerName;
@Schema(description = "机床设备编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("机床设备编号")
private String equipNo;
@Schema(description = "生产日期")
@ExcelProperty("生产日期")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
private Date productDate;
@Schema(description = "出厂日期/购买日期")
@ExcelProperty("出厂日期/购买日期")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
private Date purchaseDate;
@Schema(description = "保修到期日期")
@ExcelProperty("保修到期日期")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
private Date expireDate;
@Schema(description = "机床状态")
@ExcelProperty(value = "机床状态", converter = DictConvert.class)
@DictFormat("equip_status") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中
private Integer status;
@Schema(description = "二维码图片路径")
private String qrcodePicPath;
@Schema(description = "备注")
@ExcelProperty("备注")
private String remark;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
}

View File

@ -0,0 +1,56 @@
package com.inspur.module.system.controller.equip.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.inspur.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
import static com.inspur.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT;
@Schema(description = "管理后台 - 机床信息新增/修改 Request VO")
@Data
public class EquipInfoSaveReqVO {
@Schema(description = "机床信息id", requiredMode = Schema.RequiredMode.REQUIRED)
private String equipId;
@Schema(description = "机床型号id", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "机床型号id不能为空")
private String modelId;
@Schema(description = "客户信息id", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "客户信息id不能为空")
private String customerId;
@Schema(description = "机床设备编号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "机床设备编号不能为空")
@Size(message = "机床设备编号最大不允许超过30个字符", max = 30)
private String equipNo;
@Schema(description = "生产日期")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
private Date productDate;
@Schema(description = "出厂日期/购买日期")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
private Date purchaseDate;
@Schema(description = "保修到期日期")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
private Date expireDate;
@Schema(description = "机床状态")
private Integer status;
@Schema(description = "二维码图片路径")
private String qrcodePicPath;
@Schema(description = "备注")
@Size(message = "备注最大不允许超过500个字符", max = 500)
private String remark;
}

View File

@ -0,0 +1,71 @@
package com.inspur.module.system.dal.dataobject.equip;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.inspur.framework.mybatis.core.dataobject.BaseDO;
/**
* 机床信息 DO
*
* @author 芋道源码
*/
@TableName("imt_equip_info")
@KeySequence("imt_equip_info_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class EquipInfoDO extends BaseDO {
/**
* 机床信息id
*/
@TableId(type = IdType.ASSIGN_UUID)
private String equipId;
/**
* 机床型号id
*/
private String modelId;
/**
* 客户信息id
*/
private String customerId;
/**
* 机床设备编号
*/
private String equipNo;
/**
* 生产日期
*/
private Date productDate;
/**
* 出厂日期/购买日期
*/
private Date purchaseDate;
/**
* 保修到期日期
*/
private Date expireDate;
/**
* 机床状态
*
*/
private Integer status;
/**
* 二维码图片路径
*/
private String qrcodePicPath;
/**
* 备注
*/
private String remark;
}

View File

@ -1,12 +1,17 @@
package com.inspur.module.system.dal.mysql.baseData;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.framework.common.util.object.BeanUtils;
import com.inspur.framework.mybatis.core.mapper.BaseMapperX;
import com.inspur.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.inspur.module.system.controller.baseData.vo.CustomerInfoPageReqVO;
import com.inspur.module.system.controller.baseData.vo.CustomerInfoSelectionVO;
import com.inspur.module.system.dal.dataobject.baseData.CustomerInfoDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 机床客户信息 Mapper
*
@ -19,7 +24,15 @@ public interface CustomerInfoMapper extends BaseMapperX<CustomerInfoDO> {
return selectPage(reqVO, new LambdaQueryWrapperX<CustomerInfoDO>()
.likeIfPresent(CustomerInfoDO::getCustomerName, reqVO.getCustomerName())
.eqIfPresent(CustomerInfoDO::getIndustryType, reqVO.getIndustryType())
.orderByDesc(CustomerInfoDO::getCustomerId));
.orderByDesc(CustomerInfoDO::getCreateTime));
}
default List<CustomerInfoSelectionVO> selection(boolean showAllData){
LambdaQueryWrapper<CustomerInfoDO> queryWrapper = new LambdaQueryWrapper<>();
if (!showAllData){
queryWrapper.eq(CustomerInfoDO::getStatus,"0");
}
List<CustomerInfoDO> modelInfoList = selectList(queryWrapper);
return BeanUtils.toBean(modelInfoList, CustomerInfoSelectionVO.class);
}
}

View File

@ -1,12 +1,17 @@
package com.inspur.module.system.dal.mysql.baseData;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.framework.common.util.object.BeanUtils;
import com.inspur.framework.mybatis.core.mapper.BaseMapperX;
import com.inspur.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.inspur.module.system.controller.baseData.vo.ModelInfoPageReqVO;
import com.inspur.module.system.controller.baseData.vo.ModelInfoSelectionVO;
import com.inspur.module.system.dal.dataobject.baseData.ModelInfoDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 机床型号信息 Mapper
*
@ -19,7 +24,15 @@ public interface ModelInfoMapper extends BaseMapperX<ModelInfoDO> {
return selectPage(reqVO, new LambdaQueryWrapperX<ModelInfoDO>()
.likeIfPresent(ModelInfoDO::getModelName, reqVO.getModelName())
.eqIfPresent(ModelInfoDO::getMachineType, reqVO.getMachineType())
.orderByDesc(ModelInfoDO::getModelId));
.orderByDesc(ModelInfoDO::getCreateTime));
}
default List<ModelInfoSelectionVO> selection(boolean showAllData){
LambdaQueryWrapper<ModelInfoDO> queryWrapper = new LambdaQueryWrapper<>();
if (!showAllData){
queryWrapper.eq(ModelInfoDO::getStatus,"0");
}
List<ModelInfoDO> modelInfoList = selectList(queryWrapper);
return BeanUtils.toBean(modelInfoList,ModelInfoSelectionVO.class);
}
}

View File

@ -0,0 +1,27 @@
package com.inspur.module.system.dal.mysql.equip;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.framework.mybatis.core.mapper.BaseMapperX;
import com.inspur.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.inspur.module.system.controller.equip.vo.EquipInfoPageReqVO;
import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 机床信息 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface EquipInfoMapper extends BaseMapperX<EquipInfoDO> {
default PageResult<EquipInfoDO> selectPage(EquipInfoPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<EquipInfoDO>()
.eqIfPresent(EquipInfoDO::getModelId, reqVO.getModelId())
.eqIfPresent(EquipInfoDO::getCustomerId, reqVO.getCustomerId())
.likeIfPresent(EquipInfoDO::getEquipNo, reqVO.getEquipNo())
.eqIfPresent(EquipInfoDO::getStatus, reqVO.getStatus())
.orderByDesc(EquipInfoDO::getCreateTime));
}
}

View File

@ -3,9 +3,11 @@ package com.inspur.module.system.service.baseData;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.module.system.controller.baseData.vo.CustomerInfoPageReqVO;
import com.inspur.module.system.controller.baseData.vo.CustomerInfoSaveReqVO;
import com.inspur.module.system.controller.baseData.vo.CustomerInfoSelectionVO;
import com.inspur.module.system.dal.dataobject.baseData.CustomerInfoDO;
import javax.validation.*;
import java.util.List;
/**
* 机床客户信息 Service 接口
@ -52,4 +54,13 @@ public interface CustomerInfoService {
*/
PageResult<CustomerInfoDO> getCustomerInfoPage(CustomerInfoPageReqVO pageReqVO);
/**
* 机床客户信息下拉
*
* @Author xusd
* @Date 16:32 2024/8/29
* @param showAllData 是否显示所有数据true显示false不显示停用
* @return java.util.List<com.inspur.module.system.controller.baseData.vo.CustomerInfoSelectionVO>
*/
List<CustomerInfoSelectionVO> selection(boolean showAllData);
}

View File

@ -3,6 +3,7 @@ package com.inspur.module.system.service.baseData;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.module.system.controller.baseData.vo.CustomerInfoPageReqVO;
import com.inspur.module.system.controller.baseData.vo.CustomerInfoSaveReqVO;
import com.inspur.module.system.controller.baseData.vo.CustomerInfoSelectionVO;
import com.inspur.module.system.dal.dataobject.baseData.CustomerInfoDO;
import com.inspur.module.system.dal.mysql.baseData.CustomerInfoMapper;
import org.springframework.stereotype.Service;
@ -10,6 +11,9 @@ import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import com.inspur.framework.common.util.object.BeanUtils;
import java.util.Collections;
import java.util.List;
import static com.inspur.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.inspur.module.system.enums.ErrorCodeConstants.CUSTOMER_INFO_NOT_EXISTS;
@ -67,4 +71,8 @@ public class CustomerInfoServiceImpl implements CustomerInfoService {
return customerInfoMapper.selectPage(pageReqVO);
}
@Override
public List<CustomerInfoSelectionVO> selection(boolean showAllData) {
return customerInfoMapper.selection(showAllData);
}
}

View File

@ -3,9 +3,11 @@ package com.inspur.module.system.service.baseData;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.module.system.controller.baseData.vo.ModelInfoPageReqVO;
import com.inspur.module.system.controller.baseData.vo.ModelInfoSaveReqVO;
import com.inspur.module.system.controller.baseData.vo.ModelInfoSelectionVO;
import com.inspur.module.system.dal.dataobject.baseData.ModelInfoDO;
import javax.validation.*;
import java.util.List;
/**
* 机床型号信息 Service 接口
@ -52,4 +54,13 @@ public interface ModelInfoService {
*/
PageResult<ModelInfoDO> getModelInfoPage(ModelInfoPageReqVO pageReqVO);
/**
* 机床型号下拉
*
* @Author xusd
* @Date 16:30 2024/8/29
* @param showAllData 是否显示所有数据true显示false不显示停用
* @return java.util.List<com.inspur.module.system.controller.baseData.vo.ModelInfoSelectionVO>
*/
List<ModelInfoSelectionVO> selection(boolean showAllData);
}

View File

@ -3,6 +3,7 @@ package com.inspur.module.system.service.baseData;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.module.system.controller.baseData.vo.ModelInfoPageReqVO;
import com.inspur.module.system.controller.baseData.vo.ModelInfoSaveReqVO;
import com.inspur.module.system.controller.baseData.vo.ModelInfoSelectionVO;
import com.inspur.module.system.dal.dataobject.baseData.ModelInfoDO;
import com.inspur.module.system.dal.mysql.baseData.ModelInfoMapper;
import com.inspur.module.system.enums.ErrorCodeConstants;
@ -11,6 +12,9 @@ import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import com.inspur.framework.common.util.object.BeanUtils;
import java.util.Collections;
import java.util.List;
import static com.inspur.framework.common.exception.util.ServiceExceptionUtil.exception;
/**
@ -67,4 +71,8 @@ public class ModelInfoServiceImpl implements ModelInfoService {
return modelInfoMapper.selectPage(pageReqVO);
}
@Override
public List<ModelInfoSelectionVO> selection(boolean showAllData) {
return modelInfoMapper.selection(showAllData);
}
}

View File

@ -0,0 +1,55 @@
package com.inspur.module.system.service.equip;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.module.system.controller.equip.vo.EquipInfoPageReqVO;
import com.inspur.module.system.controller.equip.vo.EquipInfoSaveReqVO;
import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO;
import javax.validation.*;
/**
* 机床信息 Service 接口
*
* @author 芋道源码
*/
public interface EquipInfoService {
/**
* 创建机床信息
*
* @param createReqVO 创建信息
* @return 编号
*/
String createEquipInfo(@Valid EquipInfoSaveReqVO createReqVO);
/**
* 更新机床信息
*
* @param updateReqVO 更新信息
*/
void updateEquipInfo(@Valid EquipInfoSaveReqVO updateReqVO);
/**
* 删除机床信息
*
* @param id 编号
*/
void deleteEquipInfo(String id);
/**
* 获得机床信息
*
* @param id 编号
* @return 机床信息
*/
EquipInfoDO getEquipInfo(String id);
/**
* 获得机床信息分页
*
* @param pageReqVO 分页查询
* @return 机床信息分页
*/
PageResult<EquipInfoDO> getEquipInfoPage(EquipInfoPageReqVO pageReqVO);
}

View File

@ -0,0 +1,70 @@
package com.inspur.module.system.service.equip;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.module.system.controller.equip.vo.EquipInfoPageReqVO;
import com.inspur.module.system.controller.equip.vo.EquipInfoSaveReqVO;
import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO;
import com.inspur.module.system.dal.mysql.equip.EquipInfoMapper;
import com.inspur.module.system.enums.ErrorCodeConstants;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import com.inspur.framework.common.util.object.BeanUtils;
import static com.inspur.framework.common.exception.util.ServiceExceptionUtil.exception;
/**
* 机床信息 Service 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class EquipInfoServiceImpl implements EquipInfoService {
@Resource
private EquipInfoMapper equipInfoMapper;
@Override
public String createEquipInfo(EquipInfoSaveReqVO createReqVO) {
// 插入
EquipInfoDO equipInfo = BeanUtils.toBean(createReqVO, EquipInfoDO.class);
equipInfoMapper.insert(equipInfo);
// 返回
return equipInfo.getEquipId();
}
@Override
public void updateEquipInfo(EquipInfoSaveReqVO updateReqVO) {
// 校验存在
validateEquipInfoExists(updateReqVO.getEquipId());
// 更新
EquipInfoDO updateObj = BeanUtils.toBean(updateReqVO, EquipInfoDO.class);
equipInfoMapper.updateById(updateObj);
}
@Override
public void deleteEquipInfo(String id) {
// 校验存在
validateEquipInfoExists(id);
// 删除
equipInfoMapper.deleteById(id);
}
private void validateEquipInfoExists(String id) {
if (equipInfoMapper.selectById(id) == null) {
throw exception(ErrorCodeConstants.EQUIP_INFO_NOT_EXISTS);
}
}
@Override
public EquipInfoDO getEquipInfo(String id) {
return equipInfoMapper.selectById(id);
}
@Override
public PageResult<EquipInfoDO> getEquipInfoPage(EquipInfoPageReqVO pageReqVO) {
return equipInfoMapper.selectPage(pageReqVO);
}
}

View File

@ -51,3 +51,11 @@ export function exportCustomerInfoExcel(params) {
responseType: 'blob'
})
}
// 获得机床客户下拉
export function getCustomerSelection() {
return request({
url: '/baseData/customerInfo/selection',
method: 'get'
})
}

View File

@ -51,3 +51,11 @@ export function exportModelInfoExcel(params) {
responseType: 'blob'
})
}
// 获得机床型号下拉
export function getModelSelection() {
return request({
url: '/baseData/modelInfo/selection',
method: 'get'
})
}

View File

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 创建机床信息
export function createEquipInfo(data) {
return request({
url: '/equip/equipInfo/create',
method: 'post',
data: data
})
}
// 更新机床信息
export function updateEquipInfo(data) {
return request({
url: '/equip/equipInfo/update',
method: 'put',
data: data
})
}
// 删除机床信息
export function deleteEquipInfo(id) {
return request({
url: '/equip/equipInfo/delete?id=' + id,
method: 'delete'
})
}
// 获得机床信息
export function getEquipInfo(id) {
return request({
url: '/equip/equipInfo/get?id=' + id,
method: 'get'
})
}
// 获得机床信息分页
export function getEquipInfoPage(params) {
return request({
url: '/equip/equipInfo/page',
method: 'get',
params
})
}
// 导出机床信息 Excel
export function exportEquipInfoExcel(params) {
return request({
url: '/equip/equipInfo/export-excel',
method: 'get',
params,
responseType: 'blob'
})
}

View File

@ -13,6 +13,7 @@ export const DICT_TYPE = {
//========== imt 模块 ==========
MACHINE_TYPE: 'machine_type',
INDUSTRY_TYPE: 'industry_type',
EQUIP_STATUS: 'equip_status',
// ========== SYSTEM 模块 ==========
SYSTEM_USER_SEX: 'system_user_sex',

View File

@ -0,0 +1,164 @@
<template>
<div class="app-container">
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="45%" v-dialogDrag append-to-body>
<el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="150px">
<el-form-item label="机床型号" prop="modelId">
<el-select v-model="formData.modelId" placeholder="请选择机床型号">
<el-option v-for="item in modelSelection"
:key="item.modelId" :label="item.modelName" :value="item.modelId"/>
</el-select>
</el-form-item>
<el-form-item label="客户信息" prop="customerId">
<el-select v-model="formData.customerId" placeholder="请选择客户信息">
<el-option v-for="item in customerSelection"
:key="item.customerId" :label="item.customerName" :value="item.customerId"/>
</el-select>
</el-form-item>
<el-form-item label="机床设备编号" prop="equipNo">
<el-input v-model="formData.equipNo" placeholder="请输入机床设备编号"/>
</el-form-item>
<el-form-item label="生产日期" prop="productDate">
<el-date-picker clearable v-model="formData.productDate" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择生产日期"/>
</el-form-item>
<el-form-item label="出厂日期/购买日期" prop="purchaseDate">
<el-date-picker clearable v-model="formData.purchaseDate" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择出厂日期/购买日期"/>
</el-form-item>
<el-form-item label="保修到期日期" prop="expireDate">
<el-date-picker clearable v-model="formData.expireDate" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择保修到期日期"/>
</el-form-item>
<el-form-item label="机床状态" prop="status">
<el-select v-model="formData.status" placeholder="请选择机床状态">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.EQUIP_STATUS)"
:key="dict.value" :label="dict.label" :value="parseInt(dict.value)"/>
</el-select>
</el-form-item>
<el-form-item label="二维码图片路径">
<ImageUpload v-model="formData.qrcodePicPath"/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark" type="textarea" placeholder="请输入内容"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import * as EquipInfoApi from '@/api/system/equip/equipInfo';
import ImageUpload from '@/components/ImageUpload';
import {getCustomerSelection} from '@/api/system/baseData/customerInfo';
import {getModelSelection} from '@/api/system/baseData/modelinfo';
export default {
name: "EquipInfoForm",
components: {
ImageUpload,
},
data() {
return {
customerSelection:[],
modelSelection:[],
//
dialogTitle: "",
//
dialogVisible: false,
// 12
formLoading: false,
//
formData: {
equipId: undefined,
modelId: undefined,
customerId: undefined,
equipNo: undefined,
productDate: undefined,
purchaseDate: undefined,
expireDate: undefined,
status: undefined,
qrcodePicPath: undefined,
remark: undefined,
},
//
formRules: {
modelId: [{required: true, message: '机床型号不能为空', trigger: 'change'}],
customerId: [{required: true, message: '客户信息不能为空', trigger: 'change'}],
equipNo: [{required: true, message: '机床设备编号不能为空', trigger: 'blur'}],
},
};
},
created() {
getCustomerSelection().then(res=>{
this.customerSelection = res;
})
getModelSelection().then(res=>{
this.modelSelection = res;
})
},
methods: {
/** 打开弹窗 */
async open(id) {
this.dialogVisible = true;
this.reset();
//
if (id) {
this.formLoading = true;
try {
const res = await EquipInfoApi.getEquipInfo(id);
this.formData = res.data;
this.dialogTitle = "修改机床信息";
} finally {
this.formLoading = false;
}
}
this.dialogTitle = "新增机床信息";
},
/** 提交按钮 */
async submitForm() {
//
await this.$refs["formRef"].validate();
this.formLoading = true;
try {
const data = this.formData;
//
if (data.equipId) {
await EquipInfoApi.updateEquipInfo(data);
this.$modal.msgSuccess("修改成功");
this.dialogVisible = false;
this.$emit('success');
return;
}
//
await EquipInfoApi.createEquipInfo(data);
this.$modal.msgSuccess("新增成功");
this.dialogVisible = false;
this.$emit('success');
} finally {
this.formLoading = false;
}
},
/** 表单重置 */
reset() {
this.formData = {
equipId: undefined,
modelId: undefined,
customerId: undefined,
equipNo: undefined,
productDate: undefined,
purchaseDate: undefined,
expireDate: undefined,
status: undefined,
qrcodePicPath: undefined,
remark: undefined,
};
this.resetForm("formRef");
}
}
};
</script>

View File

@ -0,0 +1,195 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="机床型号" prop="modelId">
<el-select v-model="queryParams.modelId" placeholder="请选择机床型号" clearable size="small">
<el-option v-for="item in modelSelection"
:key="item.modelId" :label="item.modelName" :value="item.modelId"/>
</el-select>
</el-form-item>
<el-form-item label="客户信息" prop="customerId">
<el-select v-model="queryParams.customerId" placeholder="请选择客户信息" clearable size="small">
<el-option v-for="item in customerSelection"
:key="item.customerId" :label="item.customerName" :value="item.customerId"/>
</el-select>
</el-form-item>
<el-form-item label="机床设备编号" prop="equipNo">
<el-input v-model="queryParams.equipNo" placeholder="请输入机床设备编号" clearable
@keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="机床状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择机床状态" clearable size="small">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.EQUIP_STATUS)"
:key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm(undefined)"
v-hasPermi="['imt:equip-info:create']">新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
:loading="exportLoading"
v-hasPermi="['imt:equip-info:export']">导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="机床设备编号" align="center" prop="equipNo"/>
<el-table-column label="机床型号" align="center" prop="modelName"/>
<el-table-column label="客户信息" align="center" prop="customerName"/>
<el-table-column label="生产日期" align="center" prop="productDate" width="180"/>
<el-table-column label="出厂日期/购买日期" align="center" prop="purchaseDate" width="180"/>
<el-table-column label="保修到期日期" align="center" prop="expireDate" width="180"/>
<el-table-column label="机床状态" align="center" prop="status">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.EQUIP_STATUS" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="二维码" align="center" prop="qrcodePicPath">
<template v-slot="scope">
<!-- <img-->
<!-- :src="scope.row.qrcodePicPath"-->
<!-- style="display: block; width: 100px; height: 100px; margin: 0 auto"-->
<!-- />-->
<el-image
style="width: 100px; height: 100px"
:src="scope.row.qrcodePicPath"
:preview-src-list="[scope.row.qrcodePicPath]"></el-image>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.equipId)"
v-hasPermi="['imt:equip-info:update']">修改
</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['imt:equip-info:delete']">删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<EquipInfoForm ref="formRef" @success="getList"/>
</div>
</template>
<script>
import * as EquipInfoApi from '@/api/system/equip/equipInfo';
import {getCustomerSelection} from '@/api/system/baseData/customerInfo';
import {getModelSelection} from '@/api/system/baseData/modelinfo';
import EquipInfoForm from './EquipInfoForm.vue';
export default {
name: "EquipInfo",
components: {
EquipInfoForm,
},
data() {
return {
customerSelection:[],
modelSelection:[],
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
isExpandAll: true,
//
refreshTable: true,
//
currentRow: {},
//
queryParams: {
pageNo: 1,
pageSize: 10,
modelId: null,
customerId: null,
equipNo: null,
status: null,
},
};
},
created() {
this.getList();
getCustomerSelection().then(res=>{
this.customerSelection = res;
})
getModelSelection().then(res=>{
this.modelSelection = res;
})
},
methods: {
/** 查询列表 */
async getList() {
try {
this.loading = true;
const res = await EquipInfoApi.getEquipInfoPage(this.queryParams);
this.list = res.data.list;
this.total = res.data.total;
} finally {
this.loading = false;
}
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 添加/修改操作 */
openForm(id) {
this.$refs["formRef"].open(id);
},
/** 删除按钮操作 */
async handleDelete(row) {
const equipId = row.equipId;
await this.$modal.confirm('是否确认删除设备编号编号为"' + row.equipNo + '"的数据项?')
try {
await EquipInfoApi.deleteEquipInfo(equipId);
await this.getList();
this.$modal.msgSuccess("删除成功");
} catch {
}
},
/** 导出按钮操作 */
async handleExport() {
await this.$modal.confirm('是否确认导出所有机床信息数据项?');
try {
this.exportLoading = true;
const data = await EquipInfoApi.exportEquipInfoExcel(this.queryParams);
this.$download.excel(data, '机床信息.xls');
} catch {
} finally {
this.exportLoading = false;
}
},
}
};
</script>