add report to plan
parent
4d8682e6dd
commit
32a17f4303
@ -0,0 +1,95 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.changerecord;
|
||||||
|
|
||||||
|
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 cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.changerecord.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.changerecord.ProduceReportChangeRecordDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.service.changerecord.ProduceReportChangeRecordService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 报工变更记录")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mes/produce-report-change-record")
|
||||||
|
@Validated
|
||||||
|
public class ProduceReportChangeRecordController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ProduceReportChangeRecordService produceReportChangeRecordService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建报工变更记录")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:produce-report-change-record:create')")
|
||||||
|
public CommonResult<Long> createProduceReportChangeRecord(@Valid @RequestBody ProduceReportChangeRecordSaveReqVO createReqVO) {
|
||||||
|
return success(produceReportChangeRecordService.createProduceReportChangeRecord(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新报工变更记录")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:produce-report-change-record:update')")
|
||||||
|
public CommonResult<Boolean> updateProduceReportChangeRecord(@Valid @RequestBody ProduceReportChangeRecordSaveReqVO updateReqVO) {
|
||||||
|
produceReportChangeRecordService.updateProduceReportChangeRecord(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除报工变更记录")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:produce-report-change-record:delete')")
|
||||||
|
public CommonResult<Boolean> deleteProduceReportChangeRecord(@RequestParam("id") Long id) {
|
||||||
|
produceReportChangeRecordService.deleteProduceReportChangeRecord(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得报工变更记录")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:produce-report-change-record:query')")
|
||||||
|
public CommonResult<ProduceReportChangeRecordRespVO> getProduceReportChangeRecord(@RequestParam("id") Long id) {
|
||||||
|
ProduceReportChangeRecordDO produceReportChangeRecord = produceReportChangeRecordService.getProduceReportChangeRecord(id);
|
||||||
|
return success(BeanUtils.toBean(produceReportChangeRecord, ProduceReportChangeRecordRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得报工变更记录分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:produce-report-change-record:query')")
|
||||||
|
public CommonResult<PageResult<ProduceReportChangeRecordRespVO>> getProduceReportChangeRecordPage(@Valid ProduceReportChangeRecordPageReqVO pageReqVO) {
|
||||||
|
PageResult<ProduceReportChangeRecordDO> pageResult = produceReportChangeRecordService.getProduceReportChangeRecordPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, ProduceReportChangeRecordRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出报工变更记录 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:produce-report-change-record:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportProduceReportChangeRecordExcel(@Valid ProduceReportChangeRecordPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<ProduceReportChangeRecordDO> list = produceReportChangeRecordService.getProduceReportChangeRecordPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "报工变更记录.xls", "数据", ProduceReportChangeRecordRespVO.class,
|
||||||
|
BeanUtils.toBean(list, ProduceReportChangeRecordRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.changerecord.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 报工变更记录分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class ProduceReportChangeRecordPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "报工单id", example = "23446")
|
||||||
|
private Long reportId;
|
||||||
|
|
||||||
|
@Schema(description = "变更类型", example = "2")
|
||||||
|
private String changeType;
|
||||||
|
|
||||||
|
@Schema(description = "变更前数据")
|
||||||
|
private String beforeChange;
|
||||||
|
|
||||||
|
@Schema(description = "变更后数据")
|
||||||
|
private String afterChange;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.changerecord.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.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 报工变更记录 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class ProduceReportChangeRecordRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "28832")
|
||||||
|
@ExcelProperty("id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "报工单id", example = "23446")
|
||||||
|
@ExcelProperty("报工单id")
|
||||||
|
private Long reportId;
|
||||||
|
|
||||||
|
@Schema(description = "变更类型", example = "2")
|
||||||
|
@ExcelProperty("变更类型")
|
||||||
|
private String changeType;
|
||||||
|
|
||||||
|
@Schema(description = "变更前数据")
|
||||||
|
@ExcelProperty("变更前数据")
|
||||||
|
private String beforeChange;
|
||||||
|
|
||||||
|
@Schema(description = "变更后数据")
|
||||||
|
@ExcelProperty("变更后数据")
|
||||||
|
private String afterChange;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.changerecord.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 报工变更记录新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class ProduceReportChangeRecordSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "28832")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "报工单id", example = "23446")
|
||||||
|
private Long reportId;
|
||||||
|
|
||||||
|
@Schema(description = "变更类型", example = "2")
|
||||||
|
private String changeType;
|
||||||
|
|
||||||
|
@Schema(description = "变更前数据")
|
||||||
|
private String beforeChange;
|
||||||
|
|
||||||
|
@Schema(description = "变更后数据")
|
||||||
|
private String afterChange;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,93 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.producereportplan;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.producereportplan.vo.WorkReportPlanPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.producereportplan.vo.WorkReportPlanRespVO;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.producereportplan.vo.WorkReportPlanSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.workreportplan.WorkReportPlanDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.service.workreportplan.WorkReportPlanService;
|
||||||
|
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 cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 报工分配计划")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mes/work-report-plan-view")
|
||||||
|
@Validated
|
||||||
|
public class ReportPlanViewController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WorkReportPlanService workReportPlanService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建报工分配计划")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:work-report-plan:create')")
|
||||||
|
public CommonResult<Long> createWorkReportPlan(@Valid @RequestBody WorkReportPlanSaveReqVO createReqVO) {
|
||||||
|
return success(workReportPlanService.createWorkReportPlan(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新报工分配计划")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:work-report-plan:update')")
|
||||||
|
public CommonResult<Boolean> updateWorkReportPlan(@Valid @RequestBody WorkReportPlanSaveReqVO updateReqVO) {
|
||||||
|
workReportPlanService.updateWorkReportPlan(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除报工分配计划")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:work-report-plan:delete')")
|
||||||
|
public CommonResult<Boolean> deleteWorkReportPlan(@RequestParam("id") Long id) {
|
||||||
|
workReportPlanService.deleteWorkReportPlan(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得报工分配计划")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:work-report-plan:query')")
|
||||||
|
public CommonResult<WorkReportPlanRespVO> getWorkReportPlan(@RequestParam("id") Long id) {
|
||||||
|
WorkReportPlanDO workReportPlan = workReportPlanService.getWorkReportPlan(id);
|
||||||
|
return success(BeanUtils.toBean(workReportPlan, WorkReportPlanRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得报工分配计划分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:work-report-plan:query')")
|
||||||
|
public CommonResult<PageResult<WorkReportPlanRespVO>> getWorkReportPlanPage(@Valid WorkReportPlanPageReqVO pageReqVO) {
|
||||||
|
PageResult<WorkReportPlanDO> pageResult = workReportPlanService.getWorkReportPlanPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, WorkReportPlanRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出报工分配计划 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:work-report-plan:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportWorkReportPlanExcel(@Valid WorkReportPlanPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<WorkReportPlanDO> list = workReportPlanService.getWorkReportPlanPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "报工分配计划.xls", "数据", WorkReportPlanRespVO.class,
|
||||||
|
BeanUtils.toBean(list, WorkReportPlanRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,93 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.producereportplan;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.producereportplan.vo.WorkReportPlanPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.producereportplan.vo.WorkReportPlanRespVO;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.producereportplan.vo.WorkReportPlanSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.workreportplan.WorkReportPlanDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.service.workreportplan.WorkReportPlanService;
|
||||||
|
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 cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 报工分配计划")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mes/work-report-plan")
|
||||||
|
@Validated
|
||||||
|
public class WorkReportPlanController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WorkReportPlanService workReportPlanService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建报工分配计划")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:work-report-plan:create')")
|
||||||
|
public CommonResult<Long> createWorkReportPlan(@Valid @RequestBody WorkReportPlanSaveReqVO createReqVO) {
|
||||||
|
return success(workReportPlanService.createWorkReportPlan(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新报工分配计划")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:work-report-plan:update')")
|
||||||
|
public CommonResult<Boolean> updateWorkReportPlan(@Valid @RequestBody WorkReportPlanSaveReqVO updateReqVO) {
|
||||||
|
workReportPlanService.updateWorkReportPlan(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除报工分配计划")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:work-report-plan:delete')")
|
||||||
|
public CommonResult<Boolean> deleteWorkReportPlan(@RequestParam("id") Long id) {
|
||||||
|
workReportPlanService.deleteWorkReportPlan(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得报工分配计划")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:work-report-plan:query')")
|
||||||
|
public CommonResult<WorkReportPlanRespVO> getWorkReportPlan(@RequestParam("id") Long id) {
|
||||||
|
WorkReportPlanDO workReportPlan = workReportPlanService.getWorkReportPlan(id);
|
||||||
|
return success(BeanUtils.toBean(workReportPlan, WorkReportPlanRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得报工分配计划分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:work-report-plan:query')")
|
||||||
|
public CommonResult<PageResult<WorkReportPlanRespVO>> getWorkReportPlanPage(@Valid WorkReportPlanPageReqVO pageReqVO) {
|
||||||
|
PageResult<WorkReportPlanDO> pageResult = workReportPlanService.getWorkReportPlanPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, WorkReportPlanRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出报工分配计划 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('mes:work-report-plan:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportWorkReportPlanExcel(@Valid WorkReportPlanPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<WorkReportPlanDO> list = workReportPlanService.getWorkReportPlanPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "报工分配计划.xls", "数据", WorkReportPlanRespVO.class,
|
||||||
|
BeanUtils.toBean(list, WorkReportPlanRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,83 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.producereportplan.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 报工分配计划分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class ReportPlanViewReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "报工单id", example = "27172")
|
||||||
|
private Long reportId;
|
||||||
|
|
||||||
|
@Schema(description = "计划id", example = "30035")
|
||||||
|
private Long planId;
|
||||||
|
|
||||||
|
@Schema(description = "产品ID", example = "9987")
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
@Schema(description = "成品数量")
|
||||||
|
private BigDecimal qualityNumberPlan;
|
||||||
|
|
||||||
|
@Schema(description = "废品数量")
|
||||||
|
private BigDecimal wasteNumberPlan;
|
||||||
|
|
||||||
|
@Schema(description = "计件时间")
|
||||||
|
private String reportTimePlan;
|
||||||
|
|
||||||
|
@Schema(description = "总时长")
|
||||||
|
private BigDecimal totalTimePlan;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
@Schema(description = "用户ID", example = "23386")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "组织ID", example = "1329")
|
||||||
|
private Long orgId;
|
||||||
|
|
||||||
|
@Schema(description = "总时长")
|
||||||
|
private BigDecimal totalTime;
|
||||||
|
|
||||||
|
@Schema(description = "成品数量")
|
||||||
|
private BigDecimal qualityNumber;
|
||||||
|
|
||||||
|
@Schema(description = "废品数量")
|
||||||
|
private BigDecimal wasteNumber;
|
||||||
|
|
||||||
|
@Schema(description = "总数量")
|
||||||
|
private BigDecimal totalNumber;
|
||||||
|
|
||||||
|
@Schema(description = "报工日期")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] reportDate;
|
||||||
|
|
||||||
|
@Schema(description = "报工状态", example = "1")
|
||||||
|
private Integer reportStatus;
|
||||||
|
@Schema(description = "计件时间", example = "10:10-12:00,14:10-16:10")
|
||||||
|
private String reportTime;
|
||||||
|
|
||||||
|
@Schema(description = "工序类型")
|
||||||
|
private String orgType;
|
||||||
|
/**
|
||||||
|
* 报工类型
|
||||||
|
*/
|
||||||
|
@Schema(description = "报工类型")
|
||||||
|
private String reportType;
|
||||||
|
|
||||||
|
@Schema(description = "班别", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
private Integer groupType;
|
||||||
|
}
|
||||||
@ -0,0 +1,116 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.producereportplan.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 报工分配计划 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class ReportPlanViewRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "32743")
|
||||||
|
@ExcelProperty("id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "报工单id", example = "27172")
|
||||||
|
@ExcelProperty("报工单id")
|
||||||
|
private Long reportId;
|
||||||
|
|
||||||
|
@Schema(description = "计划id", example = "30035")
|
||||||
|
@ExcelProperty("计划id")
|
||||||
|
private Long planId;
|
||||||
|
|
||||||
|
@Schema(description = "产品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14517")
|
||||||
|
private Long productId;
|
||||||
|
@Schema(description = "产品", requiredMode = Schema.RequiredMode.REQUIRED, example = "14517")
|
||||||
|
@ExcelProperty("产品")
|
||||||
|
private String productName;
|
||||||
|
|
||||||
|
@Schema(description = "成品数量")
|
||||||
|
@ExcelProperty("成品数量")
|
||||||
|
private BigDecimal qualityNumberPlan;
|
||||||
|
|
||||||
|
@Schema(description = "废品数量")
|
||||||
|
@ExcelProperty("废品数量")
|
||||||
|
private BigDecimal wasteNumberPlan;
|
||||||
|
|
||||||
|
@Schema(description = "计件时间")
|
||||||
|
@ExcelProperty("计件时间")
|
||||||
|
private String reportTimePlan;
|
||||||
|
|
||||||
|
@Schema(description = "总时长")
|
||||||
|
@ExcelProperty("总时长")
|
||||||
|
private BigDecimal totalTimePlan;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "用户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "23386")
|
||||||
|
private Long userId;
|
||||||
|
@Schema(description = "用户", requiredMode = Schema.RequiredMode.REQUIRED, example = "23386")
|
||||||
|
@ExcelProperty("用户")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
@Schema(description = "组织ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1329")
|
||||||
|
private Long orgId;
|
||||||
|
@Schema(description = "工位", requiredMode = Schema.RequiredMode.REQUIRED, example = "1329")
|
||||||
|
@ExcelProperty("工位")
|
||||||
|
private String orgName;
|
||||||
|
|
||||||
|
@Schema(description = "总时长")
|
||||||
|
@ExcelProperty("总时长")
|
||||||
|
private BigDecimal totalTime;
|
||||||
|
|
||||||
|
@Schema(description = "成品数量")
|
||||||
|
@ExcelProperty("成品数量")
|
||||||
|
private BigDecimal qualityNumber;
|
||||||
|
|
||||||
|
@Schema(description = "废品数量")
|
||||||
|
@ExcelProperty("废品数量")
|
||||||
|
private BigDecimal wasteNumber;
|
||||||
|
|
||||||
|
@Schema(description = "总数量")
|
||||||
|
@ExcelProperty("总数量")
|
||||||
|
private BigDecimal totalNumber;
|
||||||
|
|
||||||
|
@Schema(description = "报工日期")
|
||||||
|
@ExcelProperty("报工日期")
|
||||||
|
private LocalDateTime reportDate;
|
||||||
|
|
||||||
|
@Schema(description = "计件时间")
|
||||||
|
@ExcelProperty("计件时间")
|
||||||
|
private String reportTime;
|
||||||
|
|
||||||
|
@Schema(description = "报工状态", example = "1")
|
||||||
|
@ExcelProperty(value = "报工状态", converter = DictConvert.class)
|
||||||
|
@DictFormat("mes_record_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||||
|
private Integer reportStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工序类型
|
||||||
|
*/
|
||||||
|
@Schema(description = "工序类型")
|
||||||
|
@ExcelProperty("工序类型")
|
||||||
|
private String orgType;
|
||||||
|
/**
|
||||||
|
* 报工类型
|
||||||
|
*/
|
||||||
|
@Schema(description = "报工类型")
|
||||||
|
@ExcelProperty("报工类型")
|
||||||
|
private String reportType;
|
||||||
|
|
||||||
|
@Schema(description = "班别", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
@ExcelProperty(value = "班别", converter = DictConvert.class)
|
||||||
|
@DictFormat("mes_group_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
|
||||||
|
private Integer groupType;
|
||||||
|
}
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.producereportplan.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 报工分配计划分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class WorkReportPlanPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "报工单id", example = "27172")
|
||||||
|
private Long reportId;
|
||||||
|
|
||||||
|
@Schema(description = "计划id", example = "30035")
|
||||||
|
private Long planId;
|
||||||
|
|
||||||
|
@Schema(description = "产品ID", example = "9987")
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
@Schema(description = "成品数量")
|
||||||
|
private BigDecimal qualityNumberPlan;
|
||||||
|
|
||||||
|
@Schema(description = "废品数量")
|
||||||
|
private BigDecimal wasteNumberPlan;
|
||||||
|
|
||||||
|
@Schema(description = "计件时间")
|
||||||
|
private String reportTimePlan;
|
||||||
|
|
||||||
|
@Schema(description = "总时长")
|
||||||
|
private BigDecimal totalTimePlan;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.producereportplan.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 报工分配计划 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class WorkReportPlanRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "32743")
|
||||||
|
@ExcelProperty("id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "报工单id", example = "27172")
|
||||||
|
@ExcelProperty("报工单id")
|
||||||
|
private Long reportId;
|
||||||
|
|
||||||
|
@Schema(description = "计划id", example = "30035")
|
||||||
|
@ExcelProperty("计划id")
|
||||||
|
private Long planId;
|
||||||
|
|
||||||
|
@Schema(description = "产品ID", example = "9987")
|
||||||
|
@ExcelProperty("产品ID")
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
@Schema(description = "成品数量")
|
||||||
|
@ExcelProperty("成品数量")
|
||||||
|
private BigDecimal qualityNumberPlan;
|
||||||
|
|
||||||
|
@Schema(description = "废品数量")
|
||||||
|
@ExcelProperty("废品数量")
|
||||||
|
private BigDecimal wasteNumberPlan;
|
||||||
|
|
||||||
|
@Schema(description = "计件时间")
|
||||||
|
@ExcelProperty("计件时间")
|
||||||
|
private String reportTimePlan;
|
||||||
|
|
||||||
|
@Schema(description = "总时长")
|
||||||
|
@ExcelProperty("总时长")
|
||||||
|
private BigDecimal totalTimePlan;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.controller.admin.producereportplan.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 报工分配计划新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class WorkReportPlanSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "32743")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "报工单id", example = "27172")
|
||||||
|
private Long reportId;
|
||||||
|
|
||||||
|
@Schema(description = "计划id", example = "30035")
|
||||||
|
private Long planId;
|
||||||
|
|
||||||
|
@Schema(description = "产品ID", example = "9987")
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
@Schema(description = "成品数量")
|
||||||
|
private BigDecimal qualityNumberPlan;
|
||||||
|
|
||||||
|
@Schema(description = "废品数量")
|
||||||
|
private BigDecimal wasteNumberPlan;
|
||||||
|
|
||||||
|
@Schema(description = "计件时间")
|
||||||
|
private String reportTimePlan;
|
||||||
|
|
||||||
|
@Schema(description = "总时长")
|
||||||
|
private BigDecimal totalTimePlan;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.dal.dataobject.changerecord;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报工变更记录 DO
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@TableName("mes_produce_report_change_record")
|
||||||
|
@KeySequence("mes_produce_report_change_record_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ProduceReportChangeRecordDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 报工单id
|
||||||
|
*/
|
||||||
|
private Long reportId;
|
||||||
|
/**
|
||||||
|
* 变更类型
|
||||||
|
*/
|
||||||
|
private String changeType;
|
||||||
|
/**
|
||||||
|
* 变更前数据
|
||||||
|
*/
|
||||||
|
private String beforeChange;
|
||||||
|
/**
|
||||||
|
* 变更后数据
|
||||||
|
*/
|
||||||
|
private String afterChange;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,117 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.dal.dataobject.workreportplan;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报工分配计划 DO
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@TableName("mes_view_report_plan_detail")
|
||||||
|
@KeySequence("mes_view_report_plan_detail_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ReportPlanViewDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 报工单id
|
||||||
|
*/
|
||||||
|
private Long reportId;
|
||||||
|
/**
|
||||||
|
* 计划id
|
||||||
|
*/
|
||||||
|
private Long planId;
|
||||||
|
/**
|
||||||
|
* 产品ID
|
||||||
|
*/
|
||||||
|
private Long productId;
|
||||||
|
/**
|
||||||
|
* 成品数量
|
||||||
|
*/
|
||||||
|
private BigDecimal qualityNumberPlan;
|
||||||
|
/**
|
||||||
|
* 废品数量
|
||||||
|
*/
|
||||||
|
private BigDecimal wasteNumberPlan;
|
||||||
|
/**
|
||||||
|
* 计件时间
|
||||||
|
*/
|
||||||
|
private String reportTimePlan;
|
||||||
|
/**
|
||||||
|
* 总时长
|
||||||
|
*/
|
||||||
|
private BigDecimal totalTimePlan;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 组织ID
|
||||||
|
*/
|
||||||
|
private Long orgId;
|
||||||
|
/**
|
||||||
|
* 工序类型
|
||||||
|
*/
|
||||||
|
private String orgType;
|
||||||
|
/**
|
||||||
|
* 报工类型
|
||||||
|
*/
|
||||||
|
private String reportType;
|
||||||
|
/**
|
||||||
|
* 成品率
|
||||||
|
*/
|
||||||
|
private BigDecimal qualityRate;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String wasteReason;
|
||||||
|
/**
|
||||||
|
* 总时长
|
||||||
|
*/
|
||||||
|
private BigDecimal totalTime;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成品数量
|
||||||
|
*/
|
||||||
|
private BigDecimal qualityNumber;
|
||||||
|
/**
|
||||||
|
* 废品数量
|
||||||
|
*/
|
||||||
|
private BigDecimal wasteNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报工日期
|
||||||
|
*/
|
||||||
|
private LocalDateTime reportDate;
|
||||||
|
/**
|
||||||
|
* 计件时间
|
||||||
|
*/
|
||||||
|
private String reportTime;
|
||||||
|
/**
|
||||||
|
* 报工状态
|
||||||
|
* <p>
|
||||||
|
* 枚举 {@link TODO mes_record_status 对应的类}
|
||||||
|
*/
|
||||||
|
private Integer reportStatus;
|
||||||
|
|
||||||
|
@Schema(description = "班别", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
private Integer groupType;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,62 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.dal.dataobject.workreportplan;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报工分配计划 DO
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@TableName("mes_work_report_plan")
|
||||||
|
@KeySequence("mes_work_report_plan_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class WorkReportPlanDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 报工单id
|
||||||
|
*/
|
||||||
|
private Long reportId;
|
||||||
|
/**
|
||||||
|
* 计划id
|
||||||
|
*/
|
||||||
|
private Long planId;
|
||||||
|
/**
|
||||||
|
* 产品ID
|
||||||
|
*/
|
||||||
|
private Long productId;
|
||||||
|
/**
|
||||||
|
* 成品数量
|
||||||
|
*/
|
||||||
|
private BigDecimal qualityNumberPlan;
|
||||||
|
/**
|
||||||
|
* 废品数量
|
||||||
|
*/
|
||||||
|
private BigDecimal wasteNumberPlan;
|
||||||
|
/**
|
||||||
|
* 计件时间
|
||||||
|
*/
|
||||||
|
private String reportTimePlan;
|
||||||
|
/**
|
||||||
|
* 总时长
|
||||||
|
*/
|
||||||
|
private BigDecimal totalTimePlan;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.dal.mysql.changerecord;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.changerecord.ProduceReportChangeRecordDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.changerecord.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报工变更记录 Mapper
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ProduceReportChangeRecordMapper extends BaseMapperX<ProduceReportChangeRecordDO> {
|
||||||
|
|
||||||
|
default PageResult<ProduceReportChangeRecordDO> selectPage(ProduceReportChangeRecordPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<ProduceReportChangeRecordDO>()
|
||||||
|
.eqIfPresent(ProduceReportChangeRecordDO::getReportId, reqVO.getReportId())
|
||||||
|
.eqIfPresent(ProduceReportChangeRecordDO::getChangeType, reqVO.getChangeType())
|
||||||
|
.eqIfPresent(ProduceReportChangeRecordDO::getBeforeChange, reqVO.getBeforeChange())
|
||||||
|
.eqIfPresent(ProduceReportChangeRecordDO::getAfterChange, reqVO.getAfterChange())
|
||||||
|
.betweenIfPresent(ProduceReportChangeRecordDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(ProduceReportChangeRecordDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.dal.mysql.workreportplan;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.producereportplan.vo.WorkReportPlanPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.workreportplan.ReportPlanViewDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报工分配计划 Mapper
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ReportPlanViewMapper extends BaseMapperX<ReportPlanViewDO> {
|
||||||
|
|
||||||
|
default PageResult<ReportPlanViewDO> selectPage(WorkReportPlanPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<ReportPlanViewDO>()
|
||||||
|
.eqIfPresent(ReportPlanViewDO::getReportId, reqVO.getReportId())
|
||||||
|
.eqIfPresent(ReportPlanViewDO::getPlanId, reqVO.getPlanId())
|
||||||
|
.eqIfPresent(ReportPlanViewDO::getProductId, reqVO.getProductId())
|
||||||
|
.eqIfPresent(ReportPlanViewDO::getQualityNumberPlan, reqVO.getQualityNumberPlan())
|
||||||
|
.eqIfPresent(ReportPlanViewDO::getWasteNumberPlan, reqVO.getWasteNumberPlan())
|
||||||
|
.eqIfPresent(ReportPlanViewDO::getReportTimePlan, reqVO.getReportTimePlan())
|
||||||
|
.eqIfPresent(ReportPlanViewDO::getTotalTimePlan, reqVO.getTotalTimePlan())
|
||||||
|
.betweenIfPresent(ReportPlanViewDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(ReportPlanViewDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.dal.mysql.workreportplan;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.workreportplan.WorkReportPlanDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.producereportplan.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报工分配计划 Mapper
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface WorkReportPlanMapper extends BaseMapperX<WorkReportPlanDO> {
|
||||||
|
|
||||||
|
default PageResult<WorkReportPlanDO> selectPage(WorkReportPlanPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<WorkReportPlanDO>()
|
||||||
|
.eqIfPresent(WorkReportPlanDO::getReportId, reqVO.getReportId())
|
||||||
|
.eqIfPresent(WorkReportPlanDO::getPlanId, reqVO.getPlanId())
|
||||||
|
.eqIfPresent(WorkReportPlanDO::getProductId, reqVO.getProductId())
|
||||||
|
.eqIfPresent(WorkReportPlanDO::getQualityNumberPlan, reqVO.getQualityNumberPlan())
|
||||||
|
.eqIfPresent(WorkReportPlanDO::getWasteNumberPlan, reqVO.getWasteNumberPlan())
|
||||||
|
.eqIfPresent(WorkReportPlanDO::getReportTimePlan, reqVO.getReportTimePlan())
|
||||||
|
.eqIfPresent(WorkReportPlanDO::getTotalTimePlan, reqVO.getTotalTimePlan())
|
||||||
|
.betweenIfPresent(WorkReportPlanDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(WorkReportPlanDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,55 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.service.changerecord;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.changerecord.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.changerecord.ProduceReportChangeRecordDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报工变更记录 Service 接口
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
public interface ProduceReportChangeRecordService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建报工变更记录
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createProduceReportChangeRecord(@Valid ProduceReportChangeRecordSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新报工变更记录
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateProduceReportChangeRecord(@Valid ProduceReportChangeRecordSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除报工变更记录
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteProduceReportChangeRecord(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得报工变更记录
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 报工变更记录
|
||||||
|
*/
|
||||||
|
ProduceReportChangeRecordDO getProduceReportChangeRecord(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得报工变更记录分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 报工变更记录分页
|
||||||
|
*/
|
||||||
|
PageResult<ProduceReportChangeRecordDO> getProduceReportChangeRecordPage(ProduceReportChangeRecordPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,74 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.service.changerecord;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.changerecord.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.changerecord.ProduceReportChangeRecordDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.mysql.changerecord.ProduceReportChangeRecordMapper;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报工变更记录 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class ProduceReportChangeRecordServiceImpl implements ProduceReportChangeRecordService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ProduceReportChangeRecordMapper produceReportChangeRecordMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createProduceReportChangeRecord(ProduceReportChangeRecordSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
ProduceReportChangeRecordDO produceReportChangeRecord = BeanUtils.toBean(createReqVO, ProduceReportChangeRecordDO.class);
|
||||||
|
produceReportChangeRecordMapper.insert(produceReportChangeRecord);
|
||||||
|
// 返回
|
||||||
|
return produceReportChangeRecord.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateProduceReportChangeRecord(ProduceReportChangeRecordSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateProduceReportChangeRecordExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
ProduceReportChangeRecordDO updateObj = BeanUtils.toBean(updateReqVO, ProduceReportChangeRecordDO.class);
|
||||||
|
produceReportChangeRecordMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteProduceReportChangeRecord(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateProduceReportChangeRecordExists(id);
|
||||||
|
// 删除
|
||||||
|
produceReportChangeRecordMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateProduceReportChangeRecordExists(Long id) {
|
||||||
|
if (produceReportChangeRecordMapper.selectById(id) == null) {
|
||||||
|
throw exception(PRODUCE_REPORT_CHANGE_RECORD_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ProduceReportChangeRecordDO getProduceReportChangeRecord(Long id) {
|
||||||
|
return produceReportChangeRecordMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<ProduceReportChangeRecordDO> getProduceReportChangeRecordPage(ProduceReportChangeRecordPageReqVO pageReqVO) {
|
||||||
|
return produceReportChangeRecordMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.service.workreportplan;
|
||||||
|
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.producereportplan.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.workreportplan.WorkReportPlanDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报工分配计划 Service 接口
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
public interface WorkReportPlanService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建报工分配计划
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createWorkReportPlan(@Valid WorkReportPlanSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新报工分配计划
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateWorkReportPlan(@Valid WorkReportPlanSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除报工分配计划
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteWorkReportPlan(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得报工分配计划
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 报工分配计划
|
||||||
|
*/
|
||||||
|
WorkReportPlanDO getWorkReportPlan(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得报工分配计划分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 报工分配计划分页
|
||||||
|
*/
|
||||||
|
PageResult<WorkReportPlanDO> getWorkReportPlanPage(WorkReportPlanPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,71 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.service.workreportplan;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.producereportplan.vo.WorkReportPlanPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.producereportplan.vo.WorkReportPlanSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.workreportplan.WorkReportPlanDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.mysql.workreportplan.WorkReportPlanMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.WORK_REPORT_PLAN_NOT_EXISTS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报工分配计划 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class WorkReportPlanServiceImpl implements WorkReportPlanService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WorkReportPlanMapper workReportPlanMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createWorkReportPlan(WorkReportPlanSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
WorkReportPlanDO workReportPlan = BeanUtils.toBean(createReqVO, WorkReportPlanDO.class);
|
||||||
|
workReportPlanMapper.insert(workReportPlan);
|
||||||
|
// 返回
|
||||||
|
return workReportPlan.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateWorkReportPlan(WorkReportPlanSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateWorkReportPlanExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
WorkReportPlanDO updateObj = BeanUtils.toBean(updateReqVO, WorkReportPlanDO.class);
|
||||||
|
workReportPlanMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteWorkReportPlan(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateWorkReportPlanExists(id);
|
||||||
|
// 删除
|
||||||
|
workReportPlanMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateWorkReportPlanExists(Long id) {
|
||||||
|
if (workReportPlanMapper.selectById(id) == null) {
|
||||||
|
throw exception(WORK_REPORT_PLAN_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WorkReportPlanDO getWorkReportPlan(Long id) {
|
||||||
|
return workReportPlanMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<WorkReportPlanDO> getWorkReportPlanPage(WorkReportPlanPageReqVO pageReqVO) {
|
||||||
|
return workReportPlanMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,146 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.service.changerecord;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Disabled;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.changerecord.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.changerecord.ProduceReportChangeRecordDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.mysql.changerecord.ProduceReportChangeRecordMapper;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.hutool.core.util.RandomUtil.*;
|
||||||
|
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
import static org.mockito.Mockito.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link ProduceReportChangeRecordServiceImpl} 的单元测试类
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@Import(ProduceReportChangeRecordServiceImpl.class)
|
||||||
|
public class ProduceReportChangeRecordServiceImplTest extends BaseDbUnitTest {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ProduceReportChangeRecordServiceImpl produceReportChangeRecordService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ProduceReportChangeRecordMapper produceReportChangeRecordMapper;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateProduceReportChangeRecord_success() {
|
||||||
|
// 准备参数
|
||||||
|
ProduceReportChangeRecordSaveReqVO createReqVO = randomPojo(ProduceReportChangeRecordSaveReqVO.class).setId(null);
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
Long produceReportChangeRecordId = produceReportChangeRecordService.createProduceReportChangeRecord(createReqVO);
|
||||||
|
// 断言
|
||||||
|
assertNotNull(produceReportChangeRecordId);
|
||||||
|
// 校验记录的属性是否正确
|
||||||
|
ProduceReportChangeRecordDO produceReportChangeRecord = produceReportChangeRecordMapper.selectById(produceReportChangeRecordId);
|
||||||
|
assertPojoEquals(createReqVO, produceReportChangeRecord, "id");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateProduceReportChangeRecord_success() {
|
||||||
|
// mock 数据
|
||||||
|
ProduceReportChangeRecordDO dbProduceReportChangeRecord = randomPojo(ProduceReportChangeRecordDO.class);
|
||||||
|
produceReportChangeRecordMapper.insert(dbProduceReportChangeRecord);// @Sql: 先插入出一条存在的数据
|
||||||
|
// 准备参数
|
||||||
|
ProduceReportChangeRecordSaveReqVO updateReqVO = randomPojo(ProduceReportChangeRecordSaveReqVO.class, o -> {
|
||||||
|
o.setId(dbProduceReportChangeRecord.getId()); // 设置更新的 ID
|
||||||
|
});
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
produceReportChangeRecordService.updateProduceReportChangeRecord(updateReqVO);
|
||||||
|
// 校验是否更新正确
|
||||||
|
ProduceReportChangeRecordDO produceReportChangeRecord = produceReportChangeRecordMapper.selectById(updateReqVO.getId()); // 获取最新的
|
||||||
|
assertPojoEquals(updateReqVO, produceReportChangeRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateProduceReportChangeRecord_notExists() {
|
||||||
|
// 准备参数
|
||||||
|
ProduceReportChangeRecordSaveReqVO updateReqVO = randomPojo(ProduceReportChangeRecordSaveReqVO.class);
|
||||||
|
|
||||||
|
// 调用, 并断言异常
|
||||||
|
assertServiceException(() -> produceReportChangeRecordService.updateProduceReportChangeRecord(updateReqVO), PRODUCE_REPORT_CHANGE_RECORD_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteProduceReportChangeRecord_success() {
|
||||||
|
// mock 数据
|
||||||
|
ProduceReportChangeRecordDO dbProduceReportChangeRecord = randomPojo(ProduceReportChangeRecordDO.class);
|
||||||
|
produceReportChangeRecordMapper.insert(dbProduceReportChangeRecord);// @Sql: 先插入出一条存在的数据
|
||||||
|
// 准备参数
|
||||||
|
Long id = dbProduceReportChangeRecord.getId();
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
produceReportChangeRecordService.deleteProduceReportChangeRecord(id);
|
||||||
|
// 校验数据不存在了
|
||||||
|
assertNull(produceReportChangeRecordMapper.selectById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteProduceReportChangeRecord_notExists() {
|
||||||
|
// 准备参数
|
||||||
|
Long id = randomLongId();
|
||||||
|
|
||||||
|
// 调用, 并断言异常
|
||||||
|
assertServiceException(() -> produceReportChangeRecordService.deleteProduceReportChangeRecord(id), PRODUCE_REPORT_CHANGE_RECORD_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||||
|
public void testGetProduceReportChangeRecordPage() {
|
||||||
|
// mock 数据
|
||||||
|
ProduceReportChangeRecordDO dbProduceReportChangeRecord = randomPojo(ProduceReportChangeRecordDO.class, o -> { // 等会查询到
|
||||||
|
o.setReportId(null);
|
||||||
|
o.setChangeType(null);
|
||||||
|
o.setBeforeChange(null);
|
||||||
|
o.setAfterChange(null);
|
||||||
|
o.setCreateTime(null);
|
||||||
|
});
|
||||||
|
produceReportChangeRecordMapper.insert(dbProduceReportChangeRecord);
|
||||||
|
// 测试 reportId 不匹配
|
||||||
|
produceReportChangeRecordMapper.insert(cloneIgnoreId(dbProduceReportChangeRecord, o -> o.setReportId(null)));
|
||||||
|
// 测试 changeType 不匹配
|
||||||
|
produceReportChangeRecordMapper.insert(cloneIgnoreId(dbProduceReportChangeRecord, o -> o.setChangeType(null)));
|
||||||
|
// 测试 beforeChange 不匹配
|
||||||
|
produceReportChangeRecordMapper.insert(cloneIgnoreId(dbProduceReportChangeRecord, o -> o.setBeforeChange(null)));
|
||||||
|
// 测试 afterChange 不匹配
|
||||||
|
produceReportChangeRecordMapper.insert(cloneIgnoreId(dbProduceReportChangeRecord, o -> o.setAfterChange(null)));
|
||||||
|
// 测试 createTime 不匹配
|
||||||
|
produceReportChangeRecordMapper.insert(cloneIgnoreId(dbProduceReportChangeRecord, o -> o.setCreateTime(null)));
|
||||||
|
// 准备参数
|
||||||
|
ProduceReportChangeRecordPageReqVO reqVO = new ProduceReportChangeRecordPageReqVO();
|
||||||
|
reqVO.setReportId(null);
|
||||||
|
reqVO.setChangeType(null);
|
||||||
|
reqVO.setBeforeChange(null);
|
||||||
|
reqVO.setAfterChange(null);
|
||||||
|
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
PageResult<ProduceReportChangeRecordDO> pageResult = produceReportChangeRecordService.getProduceReportChangeRecordPage(reqVO);
|
||||||
|
// 断言
|
||||||
|
assertEquals(1, pageResult.getTotal());
|
||||||
|
assertEquals(1, pageResult.getList().size());
|
||||||
|
assertPojoEquals(dbProduceReportChangeRecord, pageResult.getList().get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,150 @@
|
|||||||
|
package cn.iocoder.yudao.module.mes.service.workreportplan;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Disabled;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.mes.controller.admin.producereportplan.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.dataobject.workreportplan.WorkReportPlanDO;
|
||||||
|
import cn.iocoder.yudao.module.mes.dal.mysql.workreportplan.WorkReportPlanMapper;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link WorkReportPlanServiceImpl} 的单元测试类
|
||||||
|
*
|
||||||
|
* @author 内蒙必硕
|
||||||
|
*/
|
||||||
|
@Import(WorkReportPlanServiceImpl.class)
|
||||||
|
public class WorkReportPlanServiceImplTest extends BaseDbUnitTest {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WorkReportPlanServiceImpl workReportPlanService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WorkReportPlanMapper workReportPlanMapper;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateWorkReportPlan_success() {
|
||||||
|
// 准备参数
|
||||||
|
WorkReportPlanSaveReqVO createReqVO = randomPojo(WorkReportPlanSaveReqVO.class).setId(null);
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
Long workReportPlanId = workReportPlanService.createWorkReportPlan(createReqVO);
|
||||||
|
// 断言
|
||||||
|
assertNotNull(workReportPlanId);
|
||||||
|
// 校验记录的属性是否正确
|
||||||
|
WorkReportPlanDO workReportPlan = workReportPlanMapper.selectById(workReportPlanId);
|
||||||
|
assertPojoEquals(createReqVO, workReportPlan, "id");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateWorkReportPlan_success() {
|
||||||
|
// mock 数据
|
||||||
|
WorkReportPlanDO dbWorkReportPlan = randomPojo(WorkReportPlanDO.class);
|
||||||
|
workReportPlanMapper.insert(dbWorkReportPlan);// @Sql: 先插入出一条存在的数据
|
||||||
|
// 准备参数
|
||||||
|
WorkReportPlanSaveReqVO updateReqVO = randomPojo(WorkReportPlanSaveReqVO.class, o -> {
|
||||||
|
o.setId(dbWorkReportPlan.getId()); // 设置更新的 ID
|
||||||
|
});
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
workReportPlanService.updateWorkReportPlan(updateReqVO);
|
||||||
|
// 校验是否更新正确
|
||||||
|
WorkReportPlanDO workReportPlan = workReportPlanMapper.selectById(updateReqVO.getId()); // 获取最新的
|
||||||
|
assertPojoEquals(updateReqVO, workReportPlan);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateWorkReportPlan_notExists() {
|
||||||
|
// 准备参数
|
||||||
|
WorkReportPlanSaveReqVO updateReqVO = randomPojo(WorkReportPlanSaveReqVO.class);
|
||||||
|
|
||||||
|
// 调用, 并断言异常
|
||||||
|
assertServiceException(() -> workReportPlanService.updateWorkReportPlan(updateReqVO), WORK_REPORT_PLAN_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteWorkReportPlan_success() {
|
||||||
|
// mock 数据
|
||||||
|
WorkReportPlanDO dbWorkReportPlan = randomPojo(WorkReportPlanDO.class);
|
||||||
|
workReportPlanMapper.insert(dbWorkReportPlan);// @Sql: 先插入出一条存在的数据
|
||||||
|
// 准备参数
|
||||||
|
Long id = dbWorkReportPlan.getId();
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
workReportPlanService.deleteWorkReportPlan(id);
|
||||||
|
// 校验数据不存在了
|
||||||
|
assertNull(workReportPlanMapper.selectById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteWorkReportPlan_notExists() {
|
||||||
|
// 准备参数
|
||||||
|
Long id = randomLongId();
|
||||||
|
|
||||||
|
// 调用, 并断言异常
|
||||||
|
assertServiceException(() -> workReportPlanService.deleteWorkReportPlan(id), WORK_REPORT_PLAN_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||||
|
public void testGetWorkReportPlanPage() {
|
||||||
|
// mock 数据
|
||||||
|
WorkReportPlanDO dbWorkReportPlan = randomPojo(WorkReportPlanDO.class, o -> { // 等会查询到
|
||||||
|
o.setReportId(null);
|
||||||
|
o.setPlanId(null);
|
||||||
|
o.setProductId(null);
|
||||||
|
o.setQualityNumberPlan(null);
|
||||||
|
o.setWasteNumberPlan(null);
|
||||||
|
o.setReportTimePlan(null);
|
||||||
|
o.setTotalTimePlan(null);
|
||||||
|
o.setCreateTime(null);
|
||||||
|
});
|
||||||
|
workReportPlanMapper.insert(dbWorkReportPlan);
|
||||||
|
// 测试 reportId 不匹配
|
||||||
|
workReportPlanMapper.insert(cloneIgnoreId(dbWorkReportPlan, o -> o.setReportId(null)));
|
||||||
|
// 测试 planId 不匹配
|
||||||
|
workReportPlanMapper.insert(cloneIgnoreId(dbWorkReportPlan, o -> o.setPlanId(null)));
|
||||||
|
// 测试 productId 不匹配
|
||||||
|
workReportPlanMapper.insert(cloneIgnoreId(dbWorkReportPlan, o -> o.setProductId(null)));
|
||||||
|
// 测试 qualityNumberPlan 不匹配
|
||||||
|
workReportPlanMapper.insert(cloneIgnoreId(dbWorkReportPlan, o -> o.setQualityNumberPlan(null)));
|
||||||
|
// 测试 wasteNumberPlan 不匹配
|
||||||
|
workReportPlanMapper.insert(cloneIgnoreId(dbWorkReportPlan, o -> o.setWasteNumberPlan(null)));
|
||||||
|
// 测试 reportTimePlan 不匹配
|
||||||
|
workReportPlanMapper.insert(cloneIgnoreId(dbWorkReportPlan, o -> o.setReportTimePlan(null)));
|
||||||
|
// 测试 totalTimePlan 不匹配
|
||||||
|
workReportPlanMapper.insert(cloneIgnoreId(dbWorkReportPlan, o -> o.setTotalTimePlan(null)));
|
||||||
|
// 测试 createTime 不匹配
|
||||||
|
workReportPlanMapper.insert(cloneIgnoreId(dbWorkReportPlan, o -> o.setCreateTime(null)));
|
||||||
|
// 准备参数
|
||||||
|
WorkReportPlanPageReqVO reqVO = new WorkReportPlanPageReqVO();
|
||||||
|
reqVO.setReportId(null);
|
||||||
|
reqVO.setPlanId(null);
|
||||||
|
reqVO.setProductId(null);
|
||||||
|
reqVO.setQualityNumberPlan(null);
|
||||||
|
reqVO.setWasteNumberPlan(null);
|
||||||
|
reqVO.setReportTimePlan(null);
|
||||||
|
reqVO.setTotalTimePlan(null);
|
||||||
|
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
PageResult<WorkReportPlanDO> pageResult = workReportPlanService.getWorkReportPlanPage(reqVO);
|
||||||
|
// 断言
|
||||||
|
assertEquals(1, pageResult.getTotal());
|
||||||
|
assertEquals(1, pageResult.getList().size());
|
||||||
|
assertPojoEquals(dbWorkReportPlan, pageResult.getList().get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue