refactor(biz): 重构检验项目、客户、机台、工序和产线模块
This commit is contained in:
parent
43910f3e83
commit
301d2d28ef
@ -55,6 +55,11 @@ public class ServiceExceptionUtil {
|
||||
return exception0(errorCode.getCode(), messagePattern, params);
|
||||
}
|
||||
|
||||
public static ServiceException exception(String message) {
|
||||
String messagePattern = MESSAGES.getOrDefault(400, message);
|
||||
return exception0(400, messagePattern);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建指定编号的 ServiceException 的异常
|
||||
*
|
||||
|
||||
@ -64,4 +64,7 @@ public interface ErrorCodeConstants {
|
||||
/********************需求信息*************************/
|
||||
|
||||
ErrorCode REGION_BIND_NOT_EXISTS = new ErrorCode(1_008_0001,"区域绑定信息不存在");
|
||||
|
||||
ErrorCode PROC_CODE_DUPLICATE = new ErrorCode(1_001_023, "工序编码不能重复");
|
||||
ErrorCode PROC_LINE_CODE_DUPLICATE = new ErrorCode(1_001_023, "产线编码不能重复");
|
||||
}
|
||||
|
||||
@ -1,33 +1,31 @@
|
||||
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.checkitem;
|
||||
|
||||
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 com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageParam;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.util.object.BeanUtils;
|
||||
import static com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import com.ningxia.yunxi.chemmes.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import com.ningxia.yunxi.chemmes.framework.operatelog.core.annotations.OperateLog;
|
||||
import static com.ningxia.yunxi.chemmes.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.checkitem.vo.*;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.checkitem.vo.CheckItemPageReqVO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.checkitem.vo.CheckItemRespVO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.checkitem.vo.CheckItemSaveReqVO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.checkitem.CheckItemDO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.service.checkitem.CheckItemService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult.success;
|
||||
import static com.ningxia.yunxi.chemmes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 检验项目")
|
||||
@RestController
|
||||
|
||||
@ -1,13 +1,10 @@
|
||||
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.checkitem.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.ningxia.yunxi.chemmes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Schema(description = "管理后台 - 检验项目分页 Request VO")
|
||||
@Data
|
||||
|
||||
@ -1,14 +1,13 @@
|
||||
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.checkitem.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.ningxia.yunxi.chemmes.framework.excel.core.annotations.DictFormat;
|
||||
import com.ningxia.yunxi.chemmes.framework.excel.core.convert.DictConvert;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 检验项目 Response VO")
|
||||
@Data
|
||||
|
||||
@ -2,9 +2,6 @@ package com.ningxia.yunxi.chemmes.module.biz.controller.admin.checkitem.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.util.*;
|
||||
|
||||
@Schema(description = "管理后台 - 检验项目新增/修改 Request VO")
|
||||
@Data
|
||||
|
||||
@ -1,33 +1,31 @@
|
||||
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.customer;
|
||||
|
||||
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 com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageParam;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.util.object.BeanUtils;
|
||||
import static com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import com.ningxia.yunxi.chemmes.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import com.ningxia.yunxi.chemmes.framework.operatelog.core.annotations.OperateLog;
|
||||
import static com.ningxia.yunxi.chemmes.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.customer.vo.*;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.customer.vo.CustomerPageReqVO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.customer.vo.CustomerRespVO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.customer.vo.CustomerSaveReqVO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.customer.CustomerDO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.service.customer.CustomerService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult.success;
|
||||
import static com.ningxia.yunxi.chemmes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 客户主数据")
|
||||
@RestController
|
||||
|
||||
@ -1,13 +1,9 @@
|
||||
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.customer.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.ningxia.yunxi.chemmes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 客户主数据分页 Request VO")
|
||||
@Data
|
||||
|
||||
@ -1,14 +1,13 @@
|
||||
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.customer.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.ningxia.yunxi.chemmes.framework.excel.core.annotations.DictFormat;
|
||||
import com.ningxia.yunxi.chemmes.framework.excel.core.convert.DictConvert;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 客户主数据 Response VO")
|
||||
@Data
|
||||
|
||||
@ -1,33 +1,24 @@
|
||||
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.machine;
|
||||
|
||||
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 com.ningxia.yunxi.chemmes.framework.common.pojo.PageParam;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.util.object.BeanUtils;
|
||||
import static com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import com.ningxia.yunxi.chemmes.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import com.ningxia.yunxi.chemmes.framework.operatelog.core.annotations.OperateLog;
|
||||
import static com.ningxia.yunxi.chemmes.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.machine.vo.*;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.machine.vo.MachinePageReqVO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.machine.vo.MachineRespVO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.machine.vo.MachineSaveReqVO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.machine.MachineDO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.service.machine.MachineService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 机台主数据")
|
||||
@RestController
|
||||
@ -79,17 +70,4 @@ public class MachineController {
|
||||
return success(BeanUtils.toBean(pageResult, MachineRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出机台主数据 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('biz:machine:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportMachineExcel(@Valid MachinePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<MachineDO> list = machineService.getMachinePage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "机台主数据.xls", "数据", MachineRespVO.class,
|
||||
BeanUtils.toBean(list, MachineRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,33 +1,25 @@
|
||||
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.proc;
|
||||
|
||||
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 com.ningxia.yunxi.chemmes.framework.common.pojo.PageParam;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.util.object.BeanUtils;
|
||||
import static com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import com.ningxia.yunxi.chemmes.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import com.ningxia.yunxi.chemmes.framework.operatelog.core.annotations.OperateLog;
|
||||
import static com.ningxia.yunxi.chemmes.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.proc.vo.*;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.proc.vo.ProcPageReqVO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.proc.vo.ProcRespVO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.proc.vo.ProcSaveReqVO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.proc.ProcDO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.service.proc.ProcService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 工序主数据")
|
||||
@RestController
|
||||
@ -79,17 +71,12 @@ public class ProcController {
|
||||
return success(BeanUtils.toBean(pageResult, ProcRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出工序主数据 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('biz:proc:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportProcExcel(@Valid ProcPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<ProcDO> list = procService.getProcPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "工序主数据.xls", "数据", ProcRespVO.class,
|
||||
BeanUtils.toBean(list, ProcRespVO.class));
|
||||
// 下拉框
|
||||
@GetMapping("/dropdown")
|
||||
@Operation(summary = "获得工序主数据下拉框选项")
|
||||
@PreAuthorize("@ss.hasPermission('biz:proc:query')")
|
||||
public CommonResult<List<ProcRespVO>> getProcDropdown(@RequestParam(value = "keyWord", required = false, defaultValue = "") String keyWord) {
|
||||
return success(procService.getProcDropdown(keyWord));
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,14 +1,13 @@
|
||||
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.proc.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.ningxia.yunxi.chemmes.framework.excel.core.annotations.DictFormat;
|
||||
import com.ningxia.yunxi.chemmes.framework.excel.core.convert.DictConvert;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 工序主数据 Response VO")
|
||||
@Data
|
||||
@ -33,7 +32,7 @@ public class ProcRespVO {
|
||||
|
||||
@Schema(description = "状态(1启用 2 未启用)", example = "2")
|
||||
@ExcelProperty(value = "状态(1启用 2 未启用)", converter = DictConvert.class)
|
||||
@DictFormat("system_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
@DictFormat("system_status")
|
||||
private Integer enabledStatus;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
|
||||
@ -1,33 +1,25 @@
|
||||
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.proline;
|
||||
|
||||
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 com.ningxia.yunxi.chemmes.framework.common.pojo.PageParam;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.util.object.BeanUtils;
|
||||
import static com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import com.ningxia.yunxi.chemmes.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import com.ningxia.yunxi.chemmes.framework.operatelog.core.annotations.OperateLog;
|
||||
import static com.ningxia.yunxi.chemmes.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.proline.vo.*;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.proline.vo.ProLinePageReqVO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.proline.vo.ProLineRespVO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.proline.vo.ProLineSaveReqVO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.proline.ProLineDO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.service.proline.ProLineService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static com.ningxia.yunxi.chemmes.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 产线主数据")
|
||||
@RestController
|
||||
@ -79,17 +71,11 @@ public class ProLineController {
|
||||
return success(BeanUtils.toBean(pageResult, ProLineRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出产线主数据 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('biz:pro-line:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportProLineExcel(@Valid ProLinePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<ProLineDO> list = proLineService.getProLinePage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "产线主数据.xls", "数据", ProLineRespVO.class,
|
||||
BeanUtils.toBean(list, ProLineRespVO.class));
|
||||
@GetMapping("/dropdown")
|
||||
@Operation(summary = "获得产线主数据下拉选择")
|
||||
public CommonResult<List<ProLineRespVO>> getProLineDropdown(@RequestParam(value = "keyWord", required = false, defaultValue = "") String keyWord) {
|
||||
List<ProLineDO> proLineDOS = proLineService.getProLineDropdown(keyWord);
|
||||
return success(BeanUtils.toBean(proLineDOS, ProLineRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,13 +1,11 @@
|
||||
package com.ningxia.yunxi.chemmes.module.biz.dal.mysql.machine;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
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.query.LambdaQueryWrapperX;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.machine.vo.MachinePageReqVO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.machine.MachineDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.machine.vo.*;
|
||||
|
||||
/**
|
||||
* 机台主数据 Mapper
|
||||
@ -23,4 +21,9 @@ public interface MachineMapper extends BaseMapperX<MachineDO> {
|
||||
.orderByDesc(MachineDO::getId));
|
||||
}
|
||||
|
||||
default MachineDO selectByMachineCd(String code) {
|
||||
return selectOne(new LambdaQueryWrapperX<MachineDO>()
|
||||
.eqIfPresent(MachineDO::getMachineCd, code));
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,13 +1,13 @@
|
||||
package com.ningxia.yunxi.chemmes.module.biz.dal.mysql.proc;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
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.query.LambdaQueryWrapperX;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.proc.vo.ProcPageReqVO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.proc.ProcDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.proc.vo.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工序主数据 Mapper
|
||||
@ -23,4 +23,16 @@ public interface ProcMapper extends BaseMapperX<ProcDO> {
|
||||
.orderByDesc(ProcDO::getId));
|
||||
}
|
||||
|
||||
default List<ProcDO> selectList(String keyWord) {
|
||||
return selectList(new LambdaQueryWrapperX<ProcDO>()
|
||||
.eqIfPresent(ProcDO::getEnabledStatus, 0)
|
||||
// keyWord 模糊匹配 根据名称和编码
|
||||
.and(wrapper -> wrapper.like(ProcDO::getProcCd, keyWord)
|
||||
.or()
|
||||
.like(ProcDO::getProcName, keyWord))
|
||||
.orderByDesc(ProcDO::getId));
|
||||
}
|
||||
|
||||
default ProcDO selectByProcCd(String procCd) {
|
||||
return selectOne(ProcDO::getProcCd, procCd);
|
||||
}}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
package com.ningxia.yunxi.chemmes.module.biz.dal.mysql.proline;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
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.query.LambdaQueryWrapperX;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.proline.vo.ProLinePageReqVO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.proline.ProLineDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.proline.vo.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产线主数据 Mapper
|
||||
@ -23,4 +23,16 @@ public interface ProLineMapper extends BaseMapperX<ProLineDO> {
|
||||
.orderByDesc(ProLineDO::getId));
|
||||
}
|
||||
|
||||
default List<ProLineDO> selectList(String keyWork) {
|
||||
return selectList(new LambdaQueryWrapperX<ProLineDO>()
|
||||
.eqIfPresent(ProLineDO::getEnabledStatus, 0)
|
||||
.and(wrapper -> wrapper.like(ProLineDO::getProLineCd, keyWork)
|
||||
.or()
|
||||
.like(ProLineDO::getProLineName, keyWork))
|
||||
.orderByDesc(ProLineDO::getId));
|
||||
}
|
||||
|
||||
default ProLineDO selectByProcLineCd(String procLineCd) {
|
||||
return selectOne(ProLineDO::getProLineCd, procLineCd);
|
||||
}
|
||||
}
|
||||
@ -11,6 +11,8 @@ import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static com.ningxia.yunxi.chemmes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
/**
|
||||
* 机台主数据 Service 实现类
|
||||
*
|
||||
@ -25,6 +27,8 @@ public class MachineServiceImpl implements MachineService {
|
||||
|
||||
@Override
|
||||
public Integer createMachine(MachineSaveReqVO createReqVO) {
|
||||
// 校验存在
|
||||
validateMachineUnique(createReqVO);
|
||||
// 插入
|
||||
MachineDO machine = BeanUtils.toBean(createReqVO, MachineDO.class);
|
||||
machineMapper.insert(machine);
|
||||
@ -34,8 +38,9 @@ public class MachineServiceImpl implements MachineService {
|
||||
|
||||
@Override
|
||||
public void updateMachine(MachineSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateMachineExists(updateReqVO.getId());
|
||||
// 校验
|
||||
validateProcExists(updateReqVO.getId());
|
||||
validateMachineUnique(updateReqVO);
|
||||
// 更新
|
||||
MachineDO updateObj = BeanUtils.toBean(updateReqVO, MachineDO.class);
|
||||
machineMapper.updateById(updateObj);
|
||||
@ -44,14 +49,24 @@ public class MachineServiceImpl implements MachineService {
|
||||
@Override
|
||||
public void deleteMachine(Integer id) {
|
||||
// 校验存在
|
||||
validateMachineExists(id);
|
||||
validateProcExists(id);
|
||||
// 删除
|
||||
machineMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateMachineExists(Integer id) {
|
||||
if (machineMapper.selectById(id) == null) {
|
||||
// throw exception(MACHINE_NOT_EXISTS);
|
||||
|
||||
private void validateProcExists(Integer id) {
|
||||
MachineDO machineDO = machineMapper.selectById(id);
|
||||
if (machineDO == null) {
|
||||
throw exception("数据不存在");
|
||||
}
|
||||
}
|
||||
|
||||
private void validateMachineUnique(MachineSaveReqVO machineSaveReqVO) {
|
||||
// 校验编码是否存在
|
||||
MachineDO machineDO = machineMapper.selectByMachineCd(machineSaveReqVO.getMachineCd());
|
||||
if (machineDO != null && !machineDO.getId().equals(machineSaveReqVO.getId())) {
|
||||
throw exception("机台编码已存在");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
package com.ningxia.yunxi.chemmes.module.biz.service.proc;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.proc.vo.*;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.proc.ProcDO;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageParam;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.proc.vo.ProcPageReqVO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.proc.vo.ProcRespVO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.proc.vo.ProcSaveReqVO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.proc.ProcDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工序主数据 Service 接口
|
||||
@ -52,4 +54,6 @@ public interface ProcService {
|
||||
*/
|
||||
PageResult<ProcDO> getProcPage(ProcPageReqVO pageReqVO);
|
||||
|
||||
List<ProcRespVO> getProcDropdown(String keyWord);
|
||||
|
||||
}
|
||||
@ -3,6 +3,7 @@ package com.ningxia.yunxi.chemmes.module.biz.service.proc;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.util.object.BeanUtils;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.proc.vo.ProcPageReqVO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.proc.vo.ProcRespVO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.proc.vo.ProcSaveReqVO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.proc.ProcDO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.dal.mysql.proc.ProcMapper;
|
||||
@ -10,6 +11,10 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static com.ningxia.yunxi.chemmes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.ningxia.yunxi.chemmes.module.biz.enums.ErrorCodeConstants.PROC_CODE_DUPLICATE;
|
||||
|
||||
/**
|
||||
* 工序主数据 Service 实现类
|
||||
@ -25,6 +30,7 @@ public class ProcServiceImpl implements ProcService {
|
||||
|
||||
@Override
|
||||
public Integer createProc(ProcSaveReqVO createReqVO) {
|
||||
validateProcCodeUnique(null, createReqVO.getProcCd());
|
||||
// 插入
|
||||
ProcDO proc = BeanUtils.toBean(createReqVO, ProcDO.class);
|
||||
procMapper.insert(proc);
|
||||
@ -36,11 +42,26 @@ public class ProcServiceImpl implements ProcService {
|
||||
public void updateProc(ProcSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateProcExists(updateReqVO.getId());
|
||||
validateProcCodeUnique(updateReqVO.getId(), updateReqVO.getProcCd());
|
||||
// 更新
|
||||
ProcDO updateObj = BeanUtils.toBean(updateReqVO, ProcDO.class);
|
||||
procMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
private void validateProcCodeUnique(Integer id, String procCd) {
|
||||
ProcDO proc = procMapper.selectByProcCd(procCd);
|
||||
if (proc == null) {
|
||||
return;
|
||||
}
|
||||
if (id == null) {
|
||||
throw exception(PROC_CODE_DUPLICATE);
|
||||
}
|
||||
if (!proc.getId().equals(id)) {
|
||||
throw exception(PROC_CODE_DUPLICATE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteProc(Integer id) {
|
||||
// 校验存在
|
||||
@ -51,7 +72,7 @@ public class ProcServiceImpl implements ProcService {
|
||||
|
||||
private void validateProcExists(Integer id) {
|
||||
if (procMapper.selectById(id) == null) {
|
||||
// throw exception(PROC_NOT_EXISTS);
|
||||
throw exception("数据不存在");
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,4 +86,10 @@ public class ProcServiceImpl implements ProcService {
|
||||
return procMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProcRespVO> getProcDropdown(String keyWord) {
|
||||
List<ProcDO> procDOS = procMapper.selectList(keyWord);
|
||||
return BeanUtils.toBean(procDOS, ProcRespVO.class);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
package com.ningxia.yunxi.chemmes.module.biz.service.proline;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.proline.vo.*;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.proline.ProLineDO;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageParam;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.proline.vo.ProLinePageReqVO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.proline.vo.ProLineSaveReqVO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.proline.ProLineDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产线主数据 Service 接口
|
||||
@ -52,4 +53,5 @@ public interface ProLineService {
|
||||
*/
|
||||
PageResult<ProLineDO> getProLinePage(ProLinePageReqVO pageReqVO);
|
||||
|
||||
List<ProLineDO> getProLineDropdown(String keyWord);
|
||||
}
|
||||
@ -10,6 +10,10 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static com.ningxia.yunxi.chemmes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.ningxia.yunxi.chemmes.module.biz.enums.ErrorCodeConstants.PROC_LINE_CODE_DUPLICATE;
|
||||
|
||||
/**
|
||||
* 产线主数据 Service 实现类
|
||||
@ -25,6 +29,7 @@ public class ProLineServiceImpl implements ProLineService {
|
||||
|
||||
@Override
|
||||
public Integer createProLine(ProLineSaveReqVO createReqVO) {
|
||||
validateProcCodeUnique(null, createReqVO.getProLineCd());
|
||||
// 插入
|
||||
ProLineDO proLine = BeanUtils.toBean(createReqVO, ProLineDO.class);
|
||||
proLineMapper.insert(proLine);
|
||||
@ -36,11 +41,26 @@ public class ProLineServiceImpl implements ProLineService {
|
||||
public void updateProLine(ProLineSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateProLineExists(updateReqVO.getId());
|
||||
validateProcCodeUnique(updateReqVO.getId(), updateReqVO.getProLineCd());
|
||||
|
||||
// 更新
|
||||
ProLineDO updateObj = BeanUtils.toBean(updateReqVO, ProLineDO.class);
|
||||
proLineMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
private void validateProcCodeUnique(Integer id, String procLineCd) {
|
||||
ProLineDO lineDO = proLineMapper.selectByProcLineCd(procLineCd);
|
||||
if (lineDO == null) {
|
||||
return;
|
||||
}
|
||||
if (id == null) {
|
||||
throw exception(PROC_LINE_CODE_DUPLICATE);
|
||||
}
|
||||
if (!lineDO.getId().equals(id)) {
|
||||
throw exception(PROC_LINE_CODE_DUPLICATE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteProLine(Integer id) {
|
||||
// 校验存在
|
||||
@ -65,4 +85,8 @@ public class ProLineServiceImpl implements ProLineService {
|
||||
return proLineMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProLineDO> getProLineDropdown(String keyWord) {
|
||||
return proLineMapper.selectList(keyWord);
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,3 +37,8 @@ export const deleteProc = async (id: number) => {
|
||||
export const exportProc = async (params) => {
|
||||
return await request.download({ url: `/biz/proc/export-excel`, params })
|
||||
}
|
||||
|
||||
// 获取工序下拉列表
|
||||
export const getProcDropdown = async (params) => {
|
||||
return await request.get({ url: `/biz/proc/dropdown`, params })
|
||||
}
|
||||
@ -37,3 +37,8 @@ export const deleteProLine = async (id: number) => {
|
||||
export const exportProLine = async (params) => {
|
||||
return await request.download({ url: `/biz/pro-line/export-excel`, params })
|
||||
}
|
||||
|
||||
// 获取产线下拉列表
|
||||
export const getProLineDropdown = async (params) => {
|
||||
return await request.get({ url: `/biz/pro-line/dropdown`, params })
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="600px"
|
||||
>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
@ -13,26 +14,40 @@
|
||||
<el-form-item label="机台名称" prop="machineName">
|
||||
<el-input v-model="formData.machineName" placeholder="请输入机台名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态(1启用 2 未启用)" prop="enabledStatus">
|
||||
<el-radio-group v-model="formData.enabledStatus">
|
||||
<el-radio
|
||||
<el-form-item label="所属产线" prop="belgLineId">
|
||||
<el-select v-model="formData.belgLineId" placeholder="请选择所属产线" filterable :remote-method="searchProLine" :loading="proLineLoading">
|
||||
<el-option
|
||||
v-for="item in proLineOptions"
|
||||
:key="item.id"
|
||||
:label="item.proLineName"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属工序" prop="belgProcId">
|
||||
<el-select v-model="formData.belgProcId" placeholder="请选择所属工序" filterable :remote-method="searchProc" :loading="procLoading">
|
||||
<el-option
|
||||
v-for="item in procOptions"
|
||||
:key="item.id"
|
||||
:label="item.procName"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="enabledStatus">
|
||||
<el-select v-model="formData.enabledStatus" placeholder="请选择状态">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.SYSTEM_STATUS)"
|
||||
:key="dict.value"
|
||||
:label="dict.value"
|
||||
>
|
||||
{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="formData.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所属产线id" prop="belgLineId">
|
||||
<el-input v-model="formData.belgLineId" placeholder="请输入所属产线id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所属工序id" prop="belgProcId">
|
||||
<el-input v-model="formData.belgProcId" placeholder="请输入所属工序id" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
@ -43,6 +58,8 @@
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import * as MachineApi from '@/api/biz/machine'
|
||||
import * as ProLineApi from '@/api/biz/proline'
|
||||
import * as ProcApi from '@/api/biz/proc'
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
@ -55,21 +72,54 @@ const formData = ref({
|
||||
id: undefined,
|
||||
machineCd: undefined,
|
||||
machineName: undefined,
|
||||
enabledStatus: undefined,
|
||||
enabledStatus: 0,
|
||||
remark: undefined,
|
||||
belgLineId: undefined,
|
||||
belgProcId: undefined,
|
||||
})
|
||||
const formRules = reactive({
|
||||
machineCd: [{ required: true, message: '请输入机台编码', trigger: 'blur' }],
|
||||
machineName: [{ required: true, message: '请输入机台名称', trigger: 'blur' }],
|
||||
belgLineId: [{ required: true, message: '请选择所属产线', trigger: 'blur' }],
|
||||
belgProcId: [{ required: true, message: '请选择所属工序', trigger: 'blur' }],
|
||||
enabledStatus: [{ required: true, message: '请选择状态', trigger: 'change' }],
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
// 产线下拉列表
|
||||
const proLineOptions = ref([])
|
||||
const proLineLoading = ref(false)
|
||||
const searchProLine = async (keyWord) => {
|
||||
proLineLoading.value = true
|
||||
try {
|
||||
const res = await ProLineApi.getProLineDropdown({ keyWord })
|
||||
proLineOptions.value = res
|
||||
} finally {
|
||||
proLineLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 工序下拉列表
|
||||
const procOptions = ref([])
|
||||
const procLoading = ref(false)
|
||||
const searchProc = async (keyWord) => {
|
||||
procLoading.value = true
|
||||
try {
|
||||
const res = await ProcApi.getProcDropdown({ keyWord })
|
||||
procOptions.value = res
|
||||
} finally {
|
||||
procLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 预加载产线和工序数据
|
||||
await Promise.all([searchProLine(''), searchProc('')])
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
@ -112,7 +162,7 @@ const resetForm = () => {
|
||||
id: undefined,
|
||||
machineCd: undefined,
|
||||
machineName: undefined,
|
||||
enabledStatus: undefined,
|
||||
enabledStatus: 0, // 默认启用
|
||||
remark: undefined,
|
||||
belgLineId: undefined,
|
||||
belgProcId: undefined,
|
||||
|
||||
@ -8,10 +8,10 @@
|
||||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="状态(1启用 2 未启用)" prop="enabledStatus">
|
||||
<el-form-item label="状态" prop="enabledStatus">
|
||||
<el-select
|
||||
v-model="queryParams.enabledStatus"
|
||||
placeholder="请选择状态(1启用 2 未启用)"
|
||||
placeholder="请选择状态"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
@ -34,15 +34,6 @@
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['biz:machine:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
@ -50,7 +41,25 @@
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="自增字段" align="center" prop="id" />
|
||||
<el-table-column label="序号" align="center" type="index" width="60px" />
|
||||
<el-table-column label="机台编码" align="center" prop="machineCd" />
|
||||
<el-table-column label="机台名称" align="center" prop="machineName" />
|
||||
<el-table-column label="所属产线" align="center" prop="belgLineId">
|
||||
<template #default="scope">
|
||||
{{ getProLineName(scope.row.belgLineId) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="所属工序" align="center" prop="belgProcId">
|
||||
<template #default="scope">
|
||||
{{ getProcName(scope.row.belgProcId) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="enabledStatus">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.SYSTEM_STATUS" :value="scope.row.enabledStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
@ -58,16 +67,6 @@
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="机台编码" align="center" prop="machineCd" />
|
||||
<el-table-column label="机台名称" align="center" prop="machineName" />
|
||||
<el-table-column label="状态(1启用 2 未启用)" align="center" prop="enabledStatus">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.SYSTEM_STATUS" :value="scope.row.enabledStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="所属产线id" align="center" prop="belgLineId" />
|
||||
<el-table-column label="所属工序id" align="center" prop="belgProcId" />
|
||||
<el-table-column label="操作" align="center">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
@ -78,14 +77,6 @@
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['biz:machine:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -107,6 +98,8 @@ import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import * as MachineApi from '@/api/biz/machine'
|
||||
import * as ProLineApi from '@/api/biz/proline'
|
||||
import * as ProcApi from '@/api/biz/proc'
|
||||
import MachineForm from './MachineForm.vue'
|
||||
|
||||
defineOptions({ name: 'Machine' })
|
||||
@ -125,6 +118,42 @@ const queryParams = reactive({
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
|
||||
// 产线名称映射
|
||||
const proLineMap = ref({})
|
||||
const loadProLineMap = async () => {
|
||||
try {
|
||||
const data = await ProLineApi.getProLineDropdown({})
|
||||
const map = {}
|
||||
data.forEach(item => {
|
||||
map[item.id] = item.proLineName
|
||||
})
|
||||
proLineMap.value = map
|
||||
} catch {}
|
||||
}
|
||||
|
||||
// 工序名称映射
|
||||
const procMap = ref({})
|
||||
const loadProcMap = async () => {
|
||||
try {
|
||||
const data = await ProcApi.getProcDropdown({})
|
||||
const map = {}
|
||||
data.forEach(item => {
|
||||
map[item.id] = item.procName
|
||||
})
|
||||
procMap.value = map
|
||||
} catch {}
|
||||
}
|
||||
|
||||
// 获取产线名称
|
||||
const getProLineName = (id) => {
|
||||
return proLineMap.value[id] || id || '-'
|
||||
}
|
||||
|
||||
// 获取工序名称
|
||||
const getProcName = (id) => {
|
||||
return procMap.value[id] || id || '-'
|
||||
}
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
@ -185,6 +214,8 @@ const handleExport = async () => {
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
loadProLineMap()
|
||||
loadProcMap()
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="600px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
@ -8,21 +8,20 @@
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="工序编码" prop="procCd" >
|
||||
<el-input v-model="formData.procCd" placeholder="请输入工序编码" />
|
||||
<el-input v-model="formData.procCd" placeholder="请输入工序编码" :disabled="formType === 'update'" />
|
||||
</el-form-item>
|
||||
<el-form-item label="工序名称" prop="procName">
|
||||
<el-input v-model="formData.procName" placeholder="请输入工序名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态(1启用 2 未启用)" prop="enabledStatus">
|
||||
<el-radio-group v-model="formData.enabledStatus">
|
||||
<el-radio
|
||||
<el-form-item label="状态" prop="enabledStatus">
|
||||
<el-select v-model="formData.enabledStatus" placeholder="请选择状态">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.SYSTEM_STATUS)"
|
||||
:key="dict.value"
|
||||
:label="dict.value"
|
||||
>
|
||||
{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="formData.remark" placeholder="请输入备注" />
|
||||
@ -49,10 +48,13 @@ const formData = ref({
|
||||
id: undefined,
|
||||
procCd: undefined,
|
||||
procName: undefined,
|
||||
enabledStatus: undefined,
|
||||
enabledStatus: 0,
|
||||
remark: undefined,
|
||||
})
|
||||
const formRules = reactive({
|
||||
procCd: [{ required: true, message: '请输入工序编码', trigger: 'blur' }],
|
||||
procName: [{ required: true, message: '请输入工序名称', trigger: 'blur' }],
|
||||
enabledStatus: [{ required: true, message: '请选择状态', trigger: 'change' }],
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
@ -104,7 +106,7 @@ const resetForm = () => {
|
||||
id: undefined,
|
||||
procCd: undefined,
|
||||
procName: undefined,
|
||||
enabledStatus: undefined,
|
||||
enabledStatus: 0,
|
||||
remark: undefined,
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
|
||||
@ -8,10 +8,10 @@
|
||||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="状态(1启用 2 未启用)" prop="enabledStatus">
|
||||
<el-form-item label="状态" prop="enabledStatus">
|
||||
<el-select
|
||||
v-model="queryParams.enabledStatus"
|
||||
placeholder="请选择状态(1启用 2 未启用)"
|
||||
placeholder="请选择状态"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
@ -34,15 +34,6 @@
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['biz:proc:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
@ -50,7 +41,16 @@
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="自增字段" align="center" prop="id" />
|
||||
<el-table-column label="序号" align="center" type="index" width="60px" />
|
||||
|
||||
<el-table-column label="工序编码" align="center" prop="procCd" />
|
||||
<el-table-column label="工序名称" align="center" prop="procName" />
|
||||
<el-table-column label="状态" align="center" prop="enabledStatus">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.SYSTEM_STATUS" :value="scope.row.enabledStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
@ -58,14 +58,6 @@
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="工序编码" align="center" prop="procCd" />
|
||||
<el-table-column label="工序名称" align="center" prop="procName" />
|
||||
<el-table-column label="状态(1启用 2 未启用)" align="center" prop="enabledStatus">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.SYSTEM_STATUS" :value="scope.row.enabledStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
@ -76,14 +68,14 @@
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
<!-- <el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['biz:proc:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</el-button> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -103,7 +95,6 @@
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import * as ProcApi from '@/api/biz/proc'
|
||||
import ProcForm from './ProcForm.vue'
|
||||
|
||||
@ -166,21 +157,6 @@ const handleDelete = async (id: number) => {
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await ProcApi.exportProc(queryParams)
|
||||
download.excel(data, '工序主数据.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="600px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
@ -8,21 +8,20 @@
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="产线编码" prop="proLineCd">
|
||||
<el-input v-model="formData.proLineCd" placeholder="请输入产线编码" />
|
||||
<el-input v-model="formData.proLineCd" placeholder="请输入产线编码" :disabled="formType === 'update' " />
|
||||
</el-form-item>
|
||||
<el-form-item label="产线名称" prop="proLineName">
|
||||
<el-input v-model="formData.proLineName" placeholder="请输入产线名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态(1启用 2 未启用)" prop="enabledStatus">
|
||||
<el-radio-group v-model="formData.enabledStatus">
|
||||
<el-radio
|
||||
<el-form-item label="状态" prop="enabledStatus">
|
||||
<el-select v-model="formData.enabledStatus" placeholder="请选择状态">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.SYSTEM_STATUS)"
|
||||
:key="dict.value"
|
||||
:label="dict.value"
|
||||
>
|
||||
{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="formData.remark" placeholder="请输入备注" />
|
||||
@ -49,10 +48,13 @@ const formData = ref({
|
||||
id: undefined,
|
||||
proLineCd: undefined,
|
||||
proLineName: undefined,
|
||||
enabledStatus: undefined,
|
||||
enabledStatus: 0,
|
||||
remark: undefined,
|
||||
})
|
||||
const formRules = reactive({
|
||||
proLineCd: [{ required: true, message: '请输入产线编码', trigger: ['blur'] }],
|
||||
proLineName: [{ required: true, message: '请输入产线名称', trigger: ['blur'] }],
|
||||
enabledStatus: [{ required: true, message: '请选择状态', trigger: ['change'] }],
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
@ -104,7 +106,7 @@ const resetForm = () => {
|
||||
id: undefined,
|
||||
proLineCd: undefined,
|
||||
proLineName: undefined,
|
||||
enabledStatus: undefined,
|
||||
enabledStatus: 0,
|
||||
remark: undefined,
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
|
||||
@ -8,10 +8,10 @@
|
||||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="状态(1启用 2 未启用)" prop="enabledStatus">
|
||||
<el-form-item label="状态" prop="enabledStatus">
|
||||
<el-select
|
||||
v-model="queryParams.enabledStatus"
|
||||
placeholder="请选择状态(1启用 2 未启用)"
|
||||
placeholder="请选择状态"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
@ -34,15 +34,6 @@
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['biz:pro-line:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
@ -50,7 +41,16 @@
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="自增字段" align="center" prop="id" />
|
||||
<el-table-column label="序号" align="center" type="index" width="60px" />
|
||||
|
||||
<el-table-column label="产线编码" align="center" prop="proLineCd" />
|
||||
<el-table-column label="产线名称" align="center" prop="proLineName" />
|
||||
<el-table-column label="状态" align="center" prop="enabledStatus">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.SYSTEM_STATUS" :value="scope.row.enabledStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
@ -58,14 +58,6 @@
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="产线编码" align="center" prop="proLineCd" />
|
||||
<el-table-column label="产线名称" align="center" prop="proLineName" />
|
||||
<el-table-column label="状态(1启用 2 未启用)" align="center" prop="enabledStatus">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.SYSTEM_STATUS" :value="scope.row.enabledStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
@ -76,14 +68,14 @@
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
<!-- <el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['biz:pro-line:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</el-button> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -166,21 +158,6 @@ const handleDelete = async (id: number) => {
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await ProLineApi.exportProLine(queryParams)
|
||||
download.excel(data, '产线主数据.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user