Browse Source

工作日历排产计划

master_hella_20240701
陈宜阳 6 months ago
parent
commit
45a7d2bd02
  1. 139
      win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/controller/mesproductionplan/MesProductionPlanController.java
  2. 71
      win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/controller/mesproductionplan/vo/MesProductionPlanBaseVO.java
  3. 14
      win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/controller/mesproductionplan/vo/MesProductionPlanCreateReqVO.java
  4. 72
      win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/controller/mesproductionplan/vo/MesProductionPlanExcelVO.java
  5. 67
      win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/controller/mesproductionplan/vo/MesProductionPlanExportReqVO.java
  6. 69
      win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/controller/mesproductionplan/vo/MesProductionPlanPageReqVO.java
  7. 19
      win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/controller/mesproductionplan/vo/MesProductionPlanRespVO.java
  8. 18
      win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/controller/mesproductionplan/vo/MesProductionPlanUpdateReqVO.java
  9. 34
      win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/convert/mesproductionplan/MesProductionPlanConvert.java
  10. 100
      win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/dal/dataobject/mesproductionplan/MesProductionPlanDO.java
  11. 63
      win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/dal/mysql/mesproductionplan/MesProductionPlanMapper.java
  12. 2
      win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/enums/ErrorCodeConstants.java
  13. 79
      win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/service/mesproductionplan/MesProductionPlanService.java
  14. 107
      win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/service/mesproductionplan/MesProductionPlanServiceImpl.java
  15. 12
      win-module-mes/win-module-mes-biz/src/main/resources/mapper/mesproductionplan/MesProductionPlanMapper.xml

139
win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/controller/mesproductionplan/MesProductionPlanController.java

@ -0,0 +1,139 @@
package com.win.module.mes.controller.mesproductionplan;
import io.swagger.v3.oas.annotations.Parameters;
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.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.*;
import java.io.IOException;
import com.win.framework.common.pojo.PageResult;
import com.win.framework.common.pojo.CommonResult;
import static com.win.framework.common.pojo.CommonResult.success;
import com.win.framework.excel.core.util.ExcelUtils;
import com.win.framework.operatelog.core.annotations.OperateLog;
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.*;
import com.win.module.mes.controller.mesproductionplan.vo.*;
import com.win.module.mes.dal.dataobject.mesproductionplan.MesProductionPlanDO;
import com.win.module.mes.convert.mesproductionplan.MesProductionPlanConvert;
import com.win.module.mes.service.mesproductionplan.MesProductionPlanService;
import org.springframework.web.multipart.MultipartFile;
@Tag(name = "管理后台 - 生产排产计划")
@RestController
@RequestMapping("/mes/productionPlan")
@Validated
public class MesProductionPlanController {
@Resource
private MesProductionPlanService productionPlanService;
@PostMapping("/create")
@Operation(summary = "创建生产排产计划")
@PreAuthorize("@ss.hasPermission('mes:productionPlan:create')")
public CommonResult<Long> createProductionPlan(@Valid @RequestBody MesProductionPlanCreateReqVO createReqVO) {
return success(productionPlanService.createProductionPlan(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新生产排产计划")
@PreAuthorize("@ss.hasPermission('mes:productionPlan:update')")
public CommonResult<Boolean> updateProductionPlan(@Valid @RequestBody MesProductionPlanUpdateReqVO updateReqVO) {
int result = productionPlanService.updateProductionPlan(updateReqVO);
return success(result > 0);
}
@DeleteMapping("/delete")
@Operation(summary = "删除生产排产计划")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('mes:productionPlan:delete')")
public CommonResult<Boolean> deleteProductionPlan(@RequestParam("id") Long id) {
int result = productionPlanService.deleteProductionPlan(id);
return success(result > 0);
}
@GetMapping("/get")
@Operation(summary = "获得生产排产计划")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('mes:productionPlan:query')")
public CommonResult<MesProductionPlanRespVO> getProductionPlan(@RequestParam("id") Long id) {
MesProductionPlanDO productionPlan = productionPlanService.getProductionPlan(id);
return success(MesProductionPlanConvert.INSTANCE.convert(productionPlan));
}
@GetMapping("/list")
@Operation(summary = "获得生产排产计划列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('mes:productionPlan:query')")
public CommonResult<List<MesProductionPlanRespVO>> getProductionPlanList(@RequestParam("ids") Collection<Long> ids) {
List<MesProductionPlanDO> list = productionPlanService.getProductionPlanList(ids);
return success(MesProductionPlanConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@Operation(summary = "获得生产排产计划分页")
@PreAuthorize("@ss.hasPermission('mes:productionPlan:query')")
public CommonResult<PageResult<MesProductionPlanRespVO>> getProductionPlanPage(@Valid MesProductionPlanPageReqVO pageVO) {
PageResult<MesProductionPlanDO> pageResult = productionPlanService.getProductionPlanPage(pageVO);
return success(MesProductionPlanConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出生产排产计划 Excel")
@PreAuthorize("@ss.hasPermission('mes:productionPlan:export')")
@OperateLog(type = EXPORT)
public void exportProductionPlanExcel(@Valid MesProductionPlanExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
List<MesProductionPlanDO> list = productionPlanService.getProductionPlanList(exportReqVO);
// 导出 Excel
List<MesProductionPlanExcelVO> datas = MesProductionPlanConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "生产排产计划.xls", "数据", MesProductionPlanExcelVO.class, datas);
}
@GetMapping("/get-import-template")
@Operation(summary = "获得导入生产排产计划模板")
public void importTemplate(HttpServletResponse response) throws IOException {
List<MesProductionPlanExcelVO> list = Arrays.asList();
// 输出
ExcelUtils.write(response, "生产排产计划基本信息导入模板.xls", "生产排产计划基本信息列表", MesProductionPlanExcelVO.class, list);
}
@PostMapping("/import")
@Operation(summary = "导入生产排产计划基本信息")
@Parameters({
@Parameter(name = "file", description = "Excel 文件", required = true),
@Parameter(name = "mode", description = "导入模式1更新2追加3覆盖", example = "1"),
@Parameter(name = "updatePart", description = "部分更新,默认为 true", example = "true")
})
@PreAuthorize("@ss.hasPermission('mes:productionPlan:import')")
public CommonResult<Map<String, Object>> importExcel(HttpServletResponse response,
@RequestParam("file") MultipartFile file,
@RequestParam(value = "mode") Integer mode,
@RequestParam(value = "updatePart", required = false, defaultValue = "false") Boolean updatePart) throws Exception {
List<MesProductionPlanExcelVO> list = ExcelUtils.read(file, MesProductionPlanExcelVO.class);
List<MesProductionPlanExcelVO> errorList = productionPlanService.importMesProductionPlanList(list, mode, updatePart);
Map<String, Object> returnMap = new HashMap<>();
returnMap.put("errorCount", errorList.size());
if(!errorList.isEmpty()) {
String url = ExcelUtils.writeLocalFile("生产排产计划基本信息导入错误数据" + LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")) + ".xlsx", "错误列表", errorList);
returnMap.put("errorFile", url);
}
return success(returnMap);
}
}

71
win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/controller/mesproductionplan/vo/MesProductionPlanBaseVO.java

@ -0,0 +1,71 @@
package com.win.module.mes.controller.mesproductionplan.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* 生产排产计划 Base VO提供给添加修改详细的子 VO 使用
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/
@Data
public class MesProductionPlanBaseVO {
@Schema(description = "计划编号")
private String planCode;
@Schema(description = "计划名称", example = "王五")
private String planName;
@Schema(description = "班组类型", example = "1")
private String teamType;
@Schema(description = "结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "结束时间不能为空")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime endTime;
@Schema(description = "轮班方式")
private String shiftMode;
@Schema(description = "单据状态")
private Integer billState;
@Schema(description = "删除时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime deleteTime;
@Schema(description = "状态", example = "2")
private String status;
@Schema(description = "并发乐观锁", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "并发乐观锁不能为空")
private Integer concurrencyStamp;
@Schema(description = "备注", example = "你说的对")
private String remark;
@Schema(description = "删除用户名")
private String deleter;
@Schema(description = "位置ID", example = "7818")
private Integer siteId;
@Schema(description = "备用字段一")
private String textOne;
@Schema(description = "备用字段二")
private String textTwo;
@Schema(description = "备用字段三")
private String textThree;
}

14
win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/controller/mesproductionplan/vo/MesProductionPlanCreateReqVO.java

@ -0,0 +1,14 @@
package com.win.module.mes.controller.mesproductionplan.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 生产排产计划创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MesProductionPlanCreateReqVO extends MesProductionPlanBaseVO {
}

72
win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/controller/mesproductionplan/vo/MesProductionPlanExcelVO.java

@ -0,0 +1,72 @@
package com.win.module.mes.controller.mesproductionplan.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.ExcelProperty;
/**
* 生产排产计划 Excel VO
*
* @author 超级管理员
*/
@Data
public class MesProductionPlanExcelVO {
@ExcelProperty("id")
private Long id;
@ExcelProperty("计划编号")
private String planCode;
@ExcelProperty("计划名称")
private String planName;
@ExcelProperty("班组类型")
private String teamType;
@ExcelProperty("结束时间")
private LocalDateTime endTime;
@ExcelProperty("轮班方式")
private String shiftMode;
@ExcelProperty("单据状态")
private Integer billState;
@ExcelProperty("删除时间")
private LocalDateTime deleteTime;
@ExcelProperty("状态")
private String status;
@ExcelProperty("并发乐观锁")
private Integer concurrencyStamp;
@ExcelProperty("备注")
private String remark;
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@ExcelProperty("删除用户名")
private String deleter;
@ExcelProperty("位置ID")
private Integer siteId;
@ExcelProperty("备用字段一")
private String textOne;
@ExcelProperty("备用字段二")
private String textTwo;
@ExcelProperty("备用字段三")
private String textThree;
}

67
win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/controller/mesproductionplan/vo/MesProductionPlanExportReqVO.java

@ -0,0 +1,67 @@
package com.win.module.mes.controller.mesproductionplan.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.win.framework.common.pojo.PageParam;
import java.time.LocalDateTime;
import org.springframework.format.annotation.DateTimeFormat;
import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 生产排产计划 Excel 导出 Request VO,参数和 MesProductionPlanPageReqVO 是一致的")
@Data
public class MesProductionPlanExportReqVO {
@Schema(description = "计划编号")
private String planCode;
@Schema(description = "计划名称", example = "王五")
private String planName;
@Schema(description = "班组类型", example = "1")
private String teamType;
@Schema(description = "结束时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] endTime;
@Schema(description = "轮班方式")
private String shiftMode;
@Schema(description = "单据状态")
private Integer billState;
@Schema(description = "删除时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] deleteTime;
@Schema(description = "状态", example = "2")
private String status;
@Schema(description = "并发乐观锁")
private Integer concurrencyStamp;
@Schema(description = "备注", example = "你说的对")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "删除用户名")
private String deleter;
@Schema(description = "位置ID", example = "7818")
private Integer siteId;
@Schema(description = "备用字段一")
private String textOne;
@Schema(description = "备用字段二")
private String textTwo;
@Schema(description = "备用字段三")
private String textThree;
}

69
win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/controller/mesproductionplan/vo/MesProductionPlanPageReqVO.java

@ -0,0 +1,69 @@
package com.win.module.mes.controller.mesproductionplan.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.win.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.win.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 MesProductionPlanPageReqVO extends PageParam {
@Schema(description = "计划编号")
private String planCode;
@Schema(description = "计划名称", example = "王五")
private String planName;
@Schema(description = "班组类型", example = "1")
private String teamType;
@Schema(description = "结束时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] endTime;
@Schema(description = "轮班方式")
private String shiftMode;
@Schema(description = "单据状态")
private Integer billState;
@Schema(description = "删除时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] deleteTime;
@Schema(description = "状态", example = "2")
private String status;
@Schema(description = "并发乐观锁")
private Integer concurrencyStamp;
@Schema(description = "备注", example = "你说的对")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "删除用户名")
private String deleter;
@Schema(description = "位置ID", example = "7818")
private Integer siteId;
@Schema(description = "备用字段一")
private String textOne;
@Schema(description = "备用字段二")
private String textTwo;
@Schema(description = "备用字段三")
private String textThree;
}

19
win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/controller/mesproductionplan/vo/MesProductionPlanRespVO.java

@ -0,0 +1,19 @@
package com.win.module.mes.controller.mesproductionplan.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 生产排产计划 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MesProductionPlanRespVO extends MesProductionPlanBaseVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "16739")
private Long id;
@Schema(description = "创建时间")
private LocalDateTime createTime;
}

18
win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/controller/mesproductionplan/vo/MesProductionPlanUpdateReqVO.java

@ -0,0 +1,18 @@
package com.win.module.mes.controller.mesproductionplan.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 生产排产计划更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MesProductionPlanUpdateReqVO extends MesProductionPlanBaseVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "16739")
@NotNull(message = "id不能为空")
private Long id;
}

34
win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/convert/mesproductionplan/MesProductionPlanConvert.java

@ -0,0 +1,34 @@
package com.win.module.mes.convert.mesproductionplan;
import java.util.*;
import com.win.framework.common.pojo.PageResult;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import com.win.module.mes.controller.mesproductionplan.vo.*;
import com.win.module.mes.dal.dataobject.mesproductionplan.MesProductionPlanDO;
/**
* 生产排产计划 Convert
*
* @author 超级管理员
*/
@Mapper
public interface MesProductionPlanConvert {
MesProductionPlanConvert INSTANCE = Mappers.getMapper(MesProductionPlanConvert.class);
MesProductionPlanDO convert(MesProductionPlanCreateReqVO bean);
MesProductionPlanDO convert(MesProductionPlanUpdateReqVO bean);
MesProductionPlanRespVO convert(MesProductionPlanDO bean);
List<MesProductionPlanRespVO> convertList(List<MesProductionPlanDO> list);
PageResult<MesProductionPlanRespVO> convertPage(PageResult<MesProductionPlanDO> page);
List<MesProductionPlanExcelVO> convertList02(List<MesProductionPlanDO> list);
}

100
win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/dal/dataobject/mesproductionplan/MesProductionPlanDO.java

@ -0,0 +1,100 @@
package com.win.module.mes.dal.dataobject.mesproductionplan;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.win.framework.mybatis.core.dataobject.BaseDO;
/**
* 生产排产计划 DO
*
* @author 超级管理员
*/
@TableName("job_mes_production_plan")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class MesProductionPlanDO extends BaseDO {
/**
* id
*/
@TableId
private Long id;
/**
* 计划编号
*/
private String planCode;
/**
* 计划名称
*/
private String planName;
/**
* 班组类型
*/
private String teamType;
/**
* 结束时间
*/
private LocalDateTime endTime;
/**
* 轮班方式
*/
private String shiftMode;
/**
* 单据状态
*/
private Integer billState;
/**
* 删除时间
*/
private LocalDateTime deleteTime;
/**
* 状态
*/
private String status;
/**
* 并发乐观锁
*/
private Integer concurrencyStamp;
/**
* 备注
*/
private String remark;
/**
* 删除用户名
*/
private String deleter;
/**
* 位置ID
*/
private Integer siteId;
/**
* 备用字段一
*/
private String textOne;
/**
* 备用字段二
*/
private String textTwo;
/**
* 备用字段三
*/
private String textThree;
/**
* 备用字段四
*/
private String textFour;
/**
* 备用字段五
*/
private String textFive;
}

63
win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/dal/mysql/mesproductionplan/MesProductionPlanMapper.java

@ -0,0 +1,63 @@
package com.win.module.mes.dal.mysql.mesproductionplan;
import java.util.*;
import com.win.framework.common.pojo.PageResult;
import com.win.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.win.framework.mybatis.core.mapper.BaseMapperX;
import com.win.module.mes.controller.mesproductionplan.vo.MesProductionPlanExportReqVO;
import com.win.module.mes.controller.mesproductionplan.vo.MesProductionPlanPageReqVO;
import com.win.module.mes.dal.dataobject.mesproductionplan.MesProductionPlanDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 生产排产计划 Mapper
*
* @author 超级管理员
*/
@Mapper
public interface MesProductionPlanMapper extends BaseMapperX<MesProductionPlanDO> {
default PageResult<MesProductionPlanDO> selectPage(MesProductionPlanPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<MesProductionPlanDO>()
.eqIfPresent(MesProductionPlanDO::getPlanCode, reqVO.getPlanCode())
.eqIfPresent(MesProductionPlanDO::getPlanName, reqVO.getPlanName())
.eqIfPresent(MesProductionPlanDO::getTeamType, reqVO.getTeamType())
.betweenIfPresent(MesProductionPlanDO::getEndTime, reqVO.getEndTime())
.eqIfPresent(MesProductionPlanDO::getShiftMode, reqVO.getShiftMode())
.eqIfPresent(MesProductionPlanDO::getBillState, reqVO.getBillState())
.betweenIfPresent(MesProductionPlanDO::getDeleteTime, reqVO.getDeleteTime())
.eqIfPresent(MesProductionPlanDO::getStatus, reqVO.getStatus())
.eqIfPresent(MesProductionPlanDO::getConcurrencyStamp, reqVO.getConcurrencyStamp())
.eqIfPresent(MesProductionPlanDO::getRemark, reqVO.getRemark())
.betweenIfPresent(MesProductionPlanDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(MesProductionPlanDO::getDeleter, reqVO.getDeleter())
.eqIfPresent(MesProductionPlanDO::getSiteId, reqVO.getSiteId())
.eqIfPresent(MesProductionPlanDO::getTextOne, reqVO.getTextOne())
.eqIfPresent(MesProductionPlanDO::getTextTwo, reqVO.getTextTwo())
.eqIfPresent(MesProductionPlanDO::getTextThree, reqVO.getTextThree())
.orderByDesc(MesProductionPlanDO::getId));
}
default List<MesProductionPlanDO> selectList(MesProductionPlanExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<MesProductionPlanDO>()
.eqIfPresent(MesProductionPlanDO::getPlanCode, reqVO.getPlanCode())
.eqIfPresent(MesProductionPlanDO::getPlanName, reqVO.getPlanName())
.eqIfPresent(MesProductionPlanDO::getTeamType, reqVO.getTeamType())
.betweenIfPresent(MesProductionPlanDO::getEndTime, reqVO.getEndTime())
.eqIfPresent(MesProductionPlanDO::getShiftMode, reqVO.getShiftMode())
.eqIfPresent(MesProductionPlanDO::getBillState, reqVO.getBillState())
.betweenIfPresent(MesProductionPlanDO::getDeleteTime, reqVO.getDeleteTime())
.eqIfPresent(MesProductionPlanDO::getStatus, reqVO.getStatus())
.eqIfPresent(MesProductionPlanDO::getConcurrencyStamp, reqVO.getConcurrencyStamp())
.eqIfPresent(MesProductionPlanDO::getRemark, reqVO.getRemark())
.betweenIfPresent(MesProductionPlanDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(MesProductionPlanDO::getDeleter, reqVO.getDeleter())
.eqIfPresent(MesProductionPlanDO::getSiteId, reqVO.getSiteId())
.eqIfPresent(MesProductionPlanDO::getTextOne, reqVO.getTextOne())
.eqIfPresent(MesProductionPlanDO::getTextTwo, reqVO.getTextTwo())
.eqIfPresent(MesProductionPlanDO::getTextThree, reqVO.getTextThree())
.orderByDesc(MesProductionPlanDO::getId));
}
}

2
win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/enums/ErrorCodeConstants.java

@ -26,6 +26,8 @@ public interface ErrorCodeConstants {
ErrorCode PROCESSROUTE_IMPORT_LIST_IS_EMPTY = new ErrorCode(2_001_000_014, "工艺路线导入数据内容为空!");
ErrorCode TEAM_NOT_EXISTS = new ErrorCode(2_001_000_013, "工组不存在!");
ErrorCode TEAM_IMPORT_LIST_IS_EMPTY = new ErrorCode(2_001_000_014, "工组导入数据内容为空!");
ErrorCode PRODUCTION_PLAN_NOT_EXISTS = new ErrorCode(2_001_000_013, "排产计划不存在!");
ErrorCode PRODUCTION_PLAN_IMPORT_LIST_IS_EMPTY = new ErrorCode(2_001_000_014, "排产计划导入数据内容为空!");

79
win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/service/mesproductionplan/MesProductionPlanService.java

@ -0,0 +1,79 @@
package com.win.module.mes.service.mesproductionplan;
import java.util.*;
import javax.validation.*;
import com.win.module.mes.controller.mesproductionplan.vo.*;
import com.win.module.mes.dal.dataobject.mesproductionplan.MesProductionPlanDO;
import com.win.framework.common.pojo.PageResult;
/**
* 生产排产计划 Service 接口
*
* @author 超级管理员
*/
public interface MesProductionPlanService {
/**
* 创建生产排产计划
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createProductionPlan(@Valid MesProductionPlanCreateReqVO createReqVO);
/**
* 更新生产排产计划
*
* @param updateReqVO 更新信息
*/
Integer updateProductionPlan(@Valid MesProductionPlanUpdateReqVO updateReqVO);
/**
* 删除生产排产计划
*
* @param id 编号
*/
Integer deleteProductionPlan(Long id);
/**
* 获得生产排产计划
*
* @param id 编号
* @return 生产排产计划
*/
MesProductionPlanDO getProductionPlan(Long id);
/**
* 获得生产排产计划列表
*
* @param ids 编号
* @return 生产排产计划列表
*/
List<MesProductionPlanDO> getProductionPlanList(Collection<Long> ids);
/**
* 获得生产排产计划分页
*
* @param pageReqVO 分页查询
* @return 生产排产计划分页
*/
PageResult<MesProductionPlanDO> getProductionPlanPage(MesProductionPlanPageReqVO pageReqVO);
/**
* 获得生产排产计划列表, 用于 Excel 导出
*
* @param exportReqVO 查询条件
* @return 生产排产计划列表
*/
List<MesProductionPlanDO> getProductionPlanList(MesProductionPlanExportReqVO exportReqVO);
/**
* 导入生产排产计划主信息
*
* @param datas 导入生产排产计划主信息列表
* @param mode 导入模式1更新2追加3覆盖
* @param updatePart 是否支持更新
* @return 导入结果
*/
public List<MesProductionPlanExcelVO> importMesProductionPlanList(List<MesProductionPlanExcelVO> datas, Integer mode, boolean updatePart);
}

107
win-module-mes/win-module-mes-biz/src/main/java/com/win/module/mes/service/mesproductionplan/MesProductionPlanServiceImpl.java

@ -0,0 +1,107 @@
package com.win.module.mes.service.mesproductionplan;
import cn.hutool.core.collection.CollUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import com.win.module.mes.controller.mesproductionplan.vo.*;
import com.win.module.mes.dal.dataobject.mesproductionplan.MesProductionPlanDO;
import com.win.framework.common.pojo.PageResult;
import com.win.module.mes.convert.mesproductionplan.MesProductionPlanConvert;
import com.win.module.mes.dal.mysql.mesproductionplan.MesProductionPlanMapper;
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.win.module.mes.enums.ErrorCodeConstants.*;
/**
* 生产排产计划 Service 实现类
*
* @author 超级管理员
*/
@Service
@Validated
public class MesProductionPlanServiceImpl implements MesProductionPlanService {
@Resource
private MesProductionPlanMapper productionPlanMapper;
@Override
public Long createProductionPlan(MesProductionPlanCreateReqVO createReqVO) {
// 插入
MesProductionPlanDO productionPlan = MesProductionPlanConvert.INSTANCE.convert(createReqVO);
productionPlanMapper.insert(productionPlan);
// 返回
return productionPlan.getId();
}
@Override
public Integer updateProductionPlan(MesProductionPlanUpdateReqVO updateReqVO) {
// 校验存在
validateProductionPlanExists(updateReqVO.getId());
// 更新
MesProductionPlanDO updateObj = MesProductionPlanConvert.INSTANCE.convert(updateReqVO);
return productionPlanMapper.updateById(updateObj);
}
@Override
public Integer deleteProductionPlan(Long id) {
// 校验存在
validateProductionPlanExists(id);
// 删除
return productionPlanMapper.deleteById(id);
}
private void validateProductionPlanExists(Long id) {
if (productionPlanMapper.selectById(id) == null) {
throw exception(PRODUCTION_PLAN_NOT_EXISTS);
}
}
@Override
public MesProductionPlanDO getProductionPlan(Long id) {
return productionPlanMapper.selectById(id);
}
@Override
public List<MesProductionPlanDO> getProductionPlanList(Collection<Long> ids) {
return productionPlanMapper.selectBatchIds(ids);
}
@Override
public PageResult<MesProductionPlanDO> getProductionPlanPage(MesProductionPlanPageReqVO pageReqVO) {
return productionPlanMapper.selectPage(pageReqVO);
}
@Override
public List<MesProductionPlanDO> getProductionPlanList(MesProductionPlanExportReqVO exportReqVO) {
return productionPlanMapper.selectList(exportReqVO);
}
@Override
public List<MesProductionPlanExcelVO> importMesProductionPlanList(List<MesProductionPlanExcelVO> datas, Integer mode, boolean updatePart) {
if (CollUtil.isEmpty(datas)) {
throw exception(PRODUCTION_PLAN_IMPORT_LIST_IS_EMPTY);
}
List<MesProductionPlanExcelVO> errorList = new ArrayList<>();
// datas.forEach(item -> {
// if(errorList == null){
// // 判断如果不存在,在进行插入
// MesProductionPlanDO obj = productionPlanMapper.selectByCode(item.getCode());
// if (obj == null&& mode != 3) {
// productionPlanMapper.insert(MesProductionPlanConvert.INSTANCE.convert(item));
// }
// else if (obj != null && mode != 2) {// 如果存在,判断是否允许更新
// MesProductionPlanDO productionPlanDO = MesProductionPlanConvert.INSTANCE.convert(item);
// productionPlanDO.setId(obj.getId());
// productionPlanMapper.updateById(obj);
// }
// }
// });
return errorList;
}
}

12
win-module-mes/win-module-mes-biz/src/main/resources/mapper/mesproductionplan/MesProductionPlanMapper.xml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.win.module.mes.dal.mysql.mesproductionplan.MesProductionPlanMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>
Loading…
Cancel
Save