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,95 +1,93 @@
|
||||
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.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.dal.dataobject.checkitem.CheckItemDO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.service.checkitem.CheckItemService;
|
||||
|
||||
@Tag(name = "管理后台 - 检验项目")
|
||||
@RestController
|
||||
@RequestMapping("/biz/check-item")
|
||||
@Validated
|
||||
public class CheckItemController {
|
||||
|
||||
@Resource
|
||||
private CheckItemService checkItemService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建检验项目")
|
||||
@PreAuthorize("@ss.hasPermission('biz:check-item:create')")
|
||||
public CommonResult<Integer> createCheckItem(@Valid @RequestBody CheckItemSaveReqVO createReqVO) {
|
||||
return success(checkItemService.createCheckItem(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新检验项目")
|
||||
@PreAuthorize("@ss.hasPermission('biz:check-item:update')")
|
||||
public CommonResult<Boolean> updateCheckItem(@Valid @RequestBody CheckItemSaveReqVO updateReqVO) {
|
||||
checkItemService.updateCheckItem(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除检验项目")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('biz:check-item:delete')")
|
||||
public CommonResult<Boolean> deleteCheckItem(@RequestParam("id") Integer id) {
|
||||
checkItemService.deleteCheckItem(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得检验项目")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('biz:check-item:query')")
|
||||
public CommonResult<CheckItemRespVO> getCheckItem(@RequestParam("id") Integer id) {
|
||||
CheckItemDO checkItem = checkItemService.getCheckItem(id);
|
||||
return success(BeanUtils.toBean(checkItem, CheckItemRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得检验项目分页")
|
||||
@PreAuthorize("@ss.hasPermission('biz:check-item:query')")
|
||||
public CommonResult<PageResult<CheckItemRespVO>> getCheckItemPage(@Valid CheckItemPageReqVO pageReqVO) {
|
||||
PageResult<CheckItemDO> pageResult = checkItemService.getCheckItemPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, CheckItemRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出检验项目 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('biz:check-item:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportCheckItemExcel(@Valid CheckItemPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<CheckItemDO> list = checkItemService.getCheckItemPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "检验项目.xls", "数据", CheckItemRespVO.class,
|
||||
BeanUtils.toBean(list, CheckItemRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.checkitem;
|
||||
|
||||
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.util.object.BeanUtils;
|
||||
import com.ningxia.yunxi.chemmes.framework.excel.core.util.ExcelUtils;
|
||||
import com.ningxia.yunxi.chemmes.framework.operatelog.core.annotations.OperateLog;
|
||||
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
|
||||
@RequestMapping("/biz/check-item")
|
||||
@Validated
|
||||
public class CheckItemController {
|
||||
|
||||
@Resource
|
||||
private CheckItemService checkItemService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建检验项目")
|
||||
@PreAuthorize("@ss.hasPermission('biz:check-item:create')")
|
||||
public CommonResult<Integer> createCheckItem(@Valid @RequestBody CheckItemSaveReqVO createReqVO) {
|
||||
return success(checkItemService.createCheckItem(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新检验项目")
|
||||
@PreAuthorize("@ss.hasPermission('biz:check-item:update')")
|
||||
public CommonResult<Boolean> updateCheckItem(@Valid @RequestBody CheckItemSaveReqVO updateReqVO) {
|
||||
checkItemService.updateCheckItem(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除检验项目")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('biz:check-item:delete')")
|
||||
public CommonResult<Boolean> deleteCheckItem(@RequestParam("id") Integer id) {
|
||||
checkItemService.deleteCheckItem(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得检验项目")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('biz:check-item:query')")
|
||||
public CommonResult<CheckItemRespVO> getCheckItem(@RequestParam("id") Integer id) {
|
||||
CheckItemDO checkItem = checkItemService.getCheckItem(id);
|
||||
return success(BeanUtils.toBean(checkItem, CheckItemRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得检验项目分页")
|
||||
@PreAuthorize("@ss.hasPermission('biz:check-item:query')")
|
||||
public CommonResult<PageResult<CheckItemRespVO>> getCheckItemPage(@Valid CheckItemPageReqVO pageReqVO) {
|
||||
PageResult<CheckItemDO> pageResult = checkItemService.getCheckItemPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, CheckItemRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出检验项目 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('biz:check-item:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportCheckItemExcel(@Valid CheckItemPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<CheckItemDO> list = checkItemService.getCheckItemPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "检验项目.xls", "数据", CheckItemRespVO.class,
|
||||
BeanUtils.toBean(list, CheckItemRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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
|
||||
@ -51,4 +48,4 @@ public class CheckItemPageReqVO extends PageParam {
|
||||
@Schema(description = "打印是否取平均值")
|
||||
private String printAvgValues;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
@ -78,4 +77,4 @@ public class CheckItemRespVO {
|
||||
@ExcelProperty("打印是否取平均值")
|
||||
private String printAvgValues;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,55 +1,52 @@
|
||||
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
|
||||
public class CheckItemSaveReqVO {
|
||||
|
||||
@Schema(description = "自增字段", requiredMode = Schema.RequiredMode.REQUIRED, example = "27034")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "检验项编号")
|
||||
private String itemNo;
|
||||
|
||||
@Schema(description = "检验项名称", example = "李四")
|
||||
private String itemName;
|
||||
|
||||
@Schema(description = "性质,1 表示定性,2 表示定量")
|
||||
private String nature;
|
||||
|
||||
@Schema(description = "单位", example = "张三")
|
||||
private String unitName;
|
||||
|
||||
@Schema(description = "检验方法")
|
||||
private String checkMethod;
|
||||
|
||||
@Schema(description = "备注", example = "你说的对")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "适用类型,1表示原材料 2表示半成品 3表示成品", example = "1")
|
||||
private String itemType;
|
||||
|
||||
@Schema(description = "检验大类")
|
||||
private String itemClass;
|
||||
|
||||
@Schema(description = "检验值类型( I -数字 T- 文本)", example = "1")
|
||||
private String itemValueType;
|
||||
|
||||
@Schema(description = "绑定输入文本(符合,不符合)")
|
||||
private String itemContent;
|
||||
|
||||
@Schema(description = "检验值数量")
|
||||
private Integer testNum;
|
||||
|
||||
@Schema(description = "小数位数")
|
||||
private Integer floatNum;
|
||||
|
||||
@Schema(description = "打印是否取平均值")
|
||||
private String printAvgValues;
|
||||
|
||||
}
|
||||
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.checkitem.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
@Schema(description = "管理后台 - 检验项目新增/修改 Request VO")
|
||||
@Data
|
||||
public class CheckItemSaveReqVO {
|
||||
|
||||
@Schema(description = "自增字段", requiredMode = Schema.RequiredMode.REQUIRED, example = "27034")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "检验项编号")
|
||||
private String itemNo;
|
||||
|
||||
@Schema(description = "检验项名称", example = "李四")
|
||||
private String itemName;
|
||||
|
||||
@Schema(description = "性质,1 表示定性,2 表示定量")
|
||||
private String nature;
|
||||
|
||||
@Schema(description = "单位", example = "张三")
|
||||
private String unitName;
|
||||
|
||||
@Schema(description = "检验方法")
|
||||
private String checkMethod;
|
||||
|
||||
@Schema(description = "备注", example = "你说的对")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "适用类型,1表示原材料 2表示半成品 3表示成品", example = "1")
|
||||
private String itemType;
|
||||
|
||||
@Schema(description = "检验大类")
|
||||
private String itemClass;
|
||||
|
||||
@Schema(description = "检验值类型( I -数字 T- 文本)", example = "1")
|
||||
private String itemValueType;
|
||||
|
||||
@Schema(description = "绑定输入文本(符合,不符合)")
|
||||
private String itemContent;
|
||||
|
||||
@Schema(description = "检验值数量")
|
||||
private Integer testNum;
|
||||
|
||||
@Schema(description = "小数位数")
|
||||
private Integer floatNum;
|
||||
|
||||
@Schema(description = "打印是否取平均值")
|
||||
private String printAvgValues;
|
||||
|
||||
}
|
||||
|
||||
@ -1,95 +1,93 @@
|
||||
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.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.dal.dataobject.customer.CustomerDO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.service.customer.CustomerService;
|
||||
|
||||
@Tag(name = "管理后台 - 客户主数据")
|
||||
@RestController
|
||||
@RequestMapping("/biz/customer")
|
||||
@Validated
|
||||
public class CustomerController {
|
||||
|
||||
@Resource
|
||||
private CustomerService customerService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建客户主数据")
|
||||
@PreAuthorize("@ss.hasPermission('biz:customer:create')")
|
||||
public CommonResult<Integer> createCustomer(@Valid @RequestBody CustomerSaveReqVO createReqVO) {
|
||||
return success(customerService.createCustomer(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新客户主数据")
|
||||
@PreAuthorize("@ss.hasPermission('biz:customer:update')")
|
||||
public CommonResult<Boolean> updateCustomer(@Valid @RequestBody CustomerSaveReqVO updateReqVO) {
|
||||
customerService.updateCustomer(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除客户主数据")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('biz:customer:delete')")
|
||||
public CommonResult<Boolean> deleteCustomer(@RequestParam("id") Integer id) {
|
||||
customerService.deleteCustomer(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得客户主数据")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('biz:customer:query')")
|
||||
public CommonResult<CustomerRespVO> getCustomer(@RequestParam("id") Integer id) {
|
||||
CustomerDO customer = customerService.getCustomer(id);
|
||||
return success(BeanUtils.toBean(customer, CustomerRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得客户主数据分页")
|
||||
@PreAuthorize("@ss.hasPermission('biz:customer:query')")
|
||||
public CommonResult<PageResult<CustomerRespVO>> getCustomerPage(@Valid CustomerPageReqVO pageReqVO) {
|
||||
PageResult<CustomerDO> pageResult = customerService.getCustomerPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, CustomerRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出客户主数据 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('biz:customer:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportCustomerExcel(@Valid CustomerPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<CustomerDO> list = customerService.getCustomerPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "客户主数据.xls", "数据", CustomerRespVO.class,
|
||||
BeanUtils.toBean(list, CustomerRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.customer;
|
||||
|
||||
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.util.object.BeanUtils;
|
||||
import com.ningxia.yunxi.chemmes.framework.excel.core.util.ExcelUtils;
|
||||
import com.ningxia.yunxi.chemmes.framework.operatelog.core.annotations.OperateLog;
|
||||
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
|
||||
@RequestMapping("/biz/customer")
|
||||
@Validated
|
||||
public class CustomerController {
|
||||
|
||||
@Resource
|
||||
private CustomerService customerService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建客户主数据")
|
||||
@PreAuthorize("@ss.hasPermission('biz:customer:create')")
|
||||
public CommonResult<Integer> createCustomer(@Valid @RequestBody CustomerSaveReqVO createReqVO) {
|
||||
return success(customerService.createCustomer(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新客户主数据")
|
||||
@PreAuthorize("@ss.hasPermission('biz:customer:update')")
|
||||
public CommonResult<Boolean> updateCustomer(@Valid @RequestBody CustomerSaveReqVO updateReqVO) {
|
||||
customerService.updateCustomer(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除客户主数据")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('biz:customer:delete')")
|
||||
public CommonResult<Boolean> deleteCustomer(@RequestParam("id") Integer id) {
|
||||
customerService.deleteCustomer(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得客户主数据")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('biz:customer:query')")
|
||||
public CommonResult<CustomerRespVO> getCustomer(@RequestParam("id") Integer id) {
|
||||
CustomerDO customer = customerService.getCustomer(id);
|
||||
return success(BeanUtils.toBean(customer, CustomerRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得客户主数据分页")
|
||||
@PreAuthorize("@ss.hasPermission('biz:customer:query')")
|
||||
public CommonResult<PageResult<CustomerRespVO>> getCustomerPage(@Valid CustomerPageReqVO pageReqVO) {
|
||||
PageResult<CustomerDO> pageResult = customerService.getCustomerPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, CustomerRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出客户主数据 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('biz:customer:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportCustomerExcel(@Valid CustomerPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<CustomerDO> list = customerService.getCustomerPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "客户主数据.xls", "数据", CustomerRespVO.class,
|
||||
BeanUtils.toBean(list, CustomerRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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
|
||||
@ -27,4 +23,4 @@ public class CustomerPageReqVO extends PageParam {
|
||||
@Schema(description = "启用状态(1:启用2:未启用)", example = "2")
|
||||
private String enabledStatus;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
@ -113,4 +112,4 @@ public class CustomerRespVO {
|
||||
@DictFormat("system_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||
private String enabledStatus;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,95 +1,73 @@
|
||||
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.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.dal.dataobject.machine.MachineDO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.service.machine.MachineService;
|
||||
|
||||
@Tag(name = "管理后台 - 机台主数据")
|
||||
@RestController
|
||||
@RequestMapping("/biz/machine")
|
||||
@Validated
|
||||
public class MachineController {
|
||||
|
||||
@Resource
|
||||
private MachineService machineService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建机台主数据")
|
||||
@PreAuthorize("@ss.hasPermission('biz:machine:create')")
|
||||
public CommonResult<Integer> createMachine(@Valid @RequestBody MachineSaveReqVO createReqVO) {
|
||||
return success(machineService.createMachine(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新机台主数据")
|
||||
@PreAuthorize("@ss.hasPermission('biz:machine:update')")
|
||||
public CommonResult<Boolean> updateMachine(@Valid @RequestBody MachineSaveReqVO updateReqVO) {
|
||||
machineService.updateMachine(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除机台主数据")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('biz:machine:delete')")
|
||||
public CommonResult<Boolean> deleteMachine(@RequestParam("id") Integer id) {
|
||||
machineService.deleteMachine(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得机台主数据")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('biz:machine:query')")
|
||||
public CommonResult<MachineRespVO> getMachine(@RequestParam("id") Integer id) {
|
||||
MachineDO machine = machineService.getMachine(id);
|
||||
return success(BeanUtils.toBean(machine, MachineRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得机台主数据分页")
|
||||
@PreAuthorize("@ss.hasPermission('biz:machine:query')")
|
||||
public CommonResult<PageResult<MachineRespVO>> getMachinePage(@Valid MachinePageReqVO pageReqVO) {
|
||||
PageResult<MachineDO> pageResult = machineService.getMachinePage(pageReqVO);
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.machine;
|
||||
|
||||
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 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
|
||||
@RequestMapping("/biz/machine")
|
||||
@Validated
|
||||
public class MachineController {
|
||||
|
||||
@Resource
|
||||
private MachineService machineService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建机台主数据")
|
||||
@PreAuthorize("@ss.hasPermission('biz:machine:create')")
|
||||
public CommonResult<Integer> createMachine(@Valid @RequestBody MachineSaveReqVO createReqVO) {
|
||||
return success(machineService.createMachine(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新机台主数据")
|
||||
@PreAuthorize("@ss.hasPermission('biz:machine:update')")
|
||||
public CommonResult<Boolean> updateMachine(@Valid @RequestBody MachineSaveReqVO updateReqVO) {
|
||||
machineService.updateMachine(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除机台主数据")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('biz:machine:delete')")
|
||||
public CommonResult<Boolean> deleteMachine(@RequestParam("id") Integer id) {
|
||||
machineService.deleteMachine(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得机台主数据")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('biz:machine:query')")
|
||||
public CommonResult<MachineRespVO> getMachine(@RequestParam("id") Integer id) {
|
||||
MachineDO machine = machineService.getMachine(id);
|
||||
return success(BeanUtils.toBean(machine, MachineRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得机台主数据分页")
|
||||
@PreAuthorize("@ss.hasPermission('biz:machine:query')")
|
||||
public CommonResult<PageResult<MachineRespVO>> getMachinePage(@Valid MachinePageReqVO pageReqVO) {
|
||||
PageResult<MachineDO> pageResult = machineService.getMachinePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, MachineRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,95 +1,82 @@
|
||||
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.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.dal.dataobject.proc.ProcDO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.service.proc.ProcService;
|
||||
|
||||
@Tag(name = "管理后台 - 工序主数据")
|
||||
@RestController
|
||||
@RequestMapping("/biz/proc")
|
||||
@Validated
|
||||
public class ProcController {
|
||||
|
||||
@Resource
|
||||
private ProcService procService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建工序主数据")
|
||||
@PreAuthorize("@ss.hasPermission('biz:proc:create')")
|
||||
public CommonResult<Integer> createProc(@Valid @RequestBody ProcSaveReqVO createReqVO) {
|
||||
return success(procService.createProc(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新工序主数据")
|
||||
@PreAuthorize("@ss.hasPermission('biz:proc:update')")
|
||||
public CommonResult<Boolean> updateProc(@Valid @RequestBody ProcSaveReqVO updateReqVO) {
|
||||
procService.updateProc(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除工序主数据")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('biz:proc:delete')")
|
||||
public CommonResult<Boolean> deleteProc(@RequestParam("id") Integer id) {
|
||||
procService.deleteProc(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得工序主数据")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('biz:proc:query')")
|
||||
public CommonResult<ProcRespVO> getProc(@RequestParam("id") Integer id) {
|
||||
ProcDO proc = procService.getProc(id);
|
||||
return success(BeanUtils.toBean(proc, ProcRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得工序主数据分页")
|
||||
@PreAuthorize("@ss.hasPermission('biz:proc:query')")
|
||||
public CommonResult<PageResult<ProcRespVO>> getProcPage(@Valid ProcPageReqVO pageReqVO) {
|
||||
PageResult<ProcDO> pageResult = procService.getProcPage(pageReqVO);
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.proc;
|
||||
|
||||
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 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
|
||||
@RequestMapping("/biz/proc")
|
||||
@Validated
|
||||
public class ProcController {
|
||||
|
||||
@Resource
|
||||
private ProcService procService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建工序主数据")
|
||||
@PreAuthorize("@ss.hasPermission('biz:proc:create')")
|
||||
public CommonResult<Integer> createProc(@Valid @RequestBody ProcSaveReqVO createReqVO) {
|
||||
return success(procService.createProc(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新工序主数据")
|
||||
@PreAuthorize("@ss.hasPermission('biz:proc:update')")
|
||||
public CommonResult<Boolean> updateProc(@Valid @RequestBody ProcSaveReqVO updateReqVO) {
|
||||
procService.updateProc(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除工序主数据")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('biz:proc:delete')")
|
||||
public CommonResult<Boolean> deleteProc(@RequestParam("id") Integer id) {
|
||||
procService.deleteProc(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得工序主数据")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('biz:proc:query')")
|
||||
public CommonResult<ProcRespVO> getProc(@RequestParam("id") Integer id) {
|
||||
ProcDO proc = procService.getProc(id);
|
||||
return success(BeanUtils.toBean(proc, ProcRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得工序主数据分页")
|
||||
@PreAuthorize("@ss.hasPermission('biz:proc:query')")
|
||||
public CommonResult<PageResult<ProcRespVO>> getProcPage(@Valid ProcPageReqVO pageReqVO) {
|
||||
PageResult<ProcDO> pageResult = procService.getProcPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, 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,11 +32,11 @@ 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 = "你猜")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,95 +1,81 @@
|
||||
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.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.dal.dataobject.proline.ProLineDO;
|
||||
import com.ningxia.yunxi.chemmes.module.biz.service.proline.ProLineService;
|
||||
|
||||
@Tag(name = "管理后台 - 产线主数据")
|
||||
@RestController
|
||||
@RequestMapping("/biz/pro-line")
|
||||
@Validated
|
||||
public class ProLineController {
|
||||
|
||||
@Resource
|
||||
private ProLineService proLineService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建产线主数据")
|
||||
@PreAuthorize("@ss.hasPermission('biz:pro-line:create')")
|
||||
public CommonResult<Integer> createProLine(@Valid @RequestBody ProLineSaveReqVO createReqVO) {
|
||||
return success(proLineService.createProLine(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新产线主数据")
|
||||
@PreAuthorize("@ss.hasPermission('biz:pro-line:update')")
|
||||
public CommonResult<Boolean> updateProLine(@Valid @RequestBody ProLineSaveReqVO updateReqVO) {
|
||||
proLineService.updateProLine(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除产线主数据")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('biz:pro-line:delete')")
|
||||
public CommonResult<Boolean> deleteProLine(@RequestParam("id") Integer id) {
|
||||
proLineService.deleteProLine(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得产线主数据")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('biz:pro-line:query')")
|
||||
public CommonResult<ProLineRespVO> getProLine(@RequestParam("id") Integer id) {
|
||||
ProLineDO proLine = proLineService.getProLine(id);
|
||||
return success(BeanUtils.toBean(proLine, ProLineRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得产线主数据分页")
|
||||
@PreAuthorize("@ss.hasPermission('biz:pro-line:query')")
|
||||
public CommonResult<PageResult<ProLineRespVO>> getProLinePage(@Valid ProLinePageReqVO pageReqVO) {
|
||||
PageResult<ProLineDO> pageResult = proLineService.getProLinePage(pageReqVO);
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
package com.ningxia.yunxi.chemmes.module.biz.controller.admin.proline;
|
||||
|
||||
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 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
|
||||
@RequestMapping("/biz/pro-line")
|
||||
@Validated
|
||||
public class ProLineController {
|
||||
|
||||
@Resource
|
||||
private ProLineService proLineService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建产线主数据")
|
||||
@PreAuthorize("@ss.hasPermission('biz:pro-line:create')")
|
||||
public CommonResult<Integer> createProLine(@Valid @RequestBody ProLineSaveReqVO createReqVO) {
|
||||
return success(proLineService.createProLine(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新产线主数据")
|
||||
@PreAuthorize("@ss.hasPermission('biz:pro-line:update')")
|
||||
public CommonResult<Boolean> updateProLine(@Valid @RequestBody ProLineSaveReqVO updateReqVO) {
|
||||
proLineService.updateProLine(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除产线主数据")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('biz:pro-line:delete')")
|
||||
public CommonResult<Boolean> deleteProLine(@RequestParam("id") Integer id) {
|
||||
proLineService.deleteProLine(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得产线主数据")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('biz:pro-line:query')")
|
||||
public CommonResult<ProLineRespVO> getProLine(@RequestParam("id") Integer id) {
|
||||
ProLineDO proLine = proLineService.getProLine(id);
|
||||
return success(BeanUtils.toBean(proLine, ProLineRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得产线主数据分页")
|
||||
@PreAuthorize("@ss.hasPermission('biz:pro-line:query')")
|
||||
public CommonResult<PageResult<ProLineRespVO>> getProLinePage(@Valid ProLinePageReqVO pageReqVO) {
|
||||
PageResult<ProLineDO> pageResult = proLineService.getProLinePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, 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,55 +1,59 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 工序主数据 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface ProcService {
|
||||
|
||||
/**
|
||||
* 创建工序主数据
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Integer createProc(@Valid ProcSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新工序主数据
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateProc(@Valid ProcSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除工序主数据
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteProc(Integer id);
|
||||
|
||||
/**
|
||||
* 获得工序主数据
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 工序主数据
|
||||
*/
|
||||
ProcDO getProc(Integer id);
|
||||
|
||||
/**
|
||||
* 获得工序主数据分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 工序主数据分页
|
||||
*/
|
||||
PageResult<ProcDO> getProcPage(ProcPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
package com.ningxia.yunxi.chemmes.module.biz.service.proc;
|
||||
|
||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||
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 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface ProcService {
|
||||
|
||||
/**
|
||||
* 创建工序主数据
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Integer createProc(@Valid ProcSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新工序主数据
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateProc(@Valid ProcSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除工序主数据
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteProc(Integer id);
|
||||
|
||||
/**
|
||||
* 获得工序主数据
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 工序主数据
|
||||
*/
|
||||
ProcDO getProc(Integer id);
|
||||
|
||||
/**
|
||||
* 获得工序主数据分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 工序主数据分页
|
||||
*/
|
||||
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,55 +1,57 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 产线主数据 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface ProLineService {
|
||||
|
||||
/**
|
||||
* 创建产线主数据
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Integer createProLine(@Valid ProLineSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新产线主数据
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateProLine(@Valid ProLineSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除产线主数据
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteProLine(Integer id);
|
||||
|
||||
/**
|
||||
* 获得产线主数据
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 产线主数据
|
||||
*/
|
||||
ProLineDO getProLine(Integer id);
|
||||
|
||||
/**
|
||||
* 获得产线主数据分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 产线主数据分页
|
||||
*/
|
||||
PageResult<ProLineDO> getProLinePage(ProLinePageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
package com.ningxia.yunxi.chemmes.module.biz.service.proline;
|
||||
|
||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||
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 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface ProLineService {
|
||||
|
||||
/**
|
||||
* 创建产线主数据
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Integer createProLine(@Valid ProLineSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新产线主数据
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateProLine(@Valid ProLineSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除产线主数据
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteProLine(Integer id);
|
||||
|
||||
/**
|
||||
* 获得产线主数据
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 产线主数据
|
||||
*/
|
||||
ProLineDO getProLine(Integer id);
|
||||
|
||||
/**
|
||||
* 获得产线主数据分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 产线主数据分页
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,4 +36,9 @@ export const deleteProc = async (id: number) => {
|
||||
// 导出工序主数据 Excel
|
||||
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 })
|
||||
}
|
||||
@ -36,4 +36,9 @@ export const deleteProLine = async (id: number) => {
|
||||
// 导出产线主数据 Excel
|
||||
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,24 +41,32 @@
|
||||
<!-- 列表 -->
|
||||
<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
|
||||
<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"
|
||||
prop="createTime"
|
||||
: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"
|
||||
@ -7,22 +7,21 @@
|
||||
label-width="100px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="工序编码" prop="procCd">
|
||||
<el-input v-model="formData.procCd" placeholder="请输入工序编码" />
|
||||
<el-form-item label="工序编码" prop="procCd" >
|
||||
<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,22 +41,23 @@
|
||||
<!-- 列表 -->
|
||||
<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
|
||||
<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"
|
||||
prop="createTime"
|
||||
: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,22 +41,23 @@
|
||||
<!-- 列表 -->
|
||||
<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
|
||||
<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"
|
||||
prop="createTime"
|
||||
: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