parent
8df36cb0a3
commit
e5db1db169
@ -0,0 +1,95 @@
|
|||||||
|
package com.chanko.yunxi.mes.module.heli.controller.admin.materialplan;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import javax.servlet.http.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
|
||||||
|
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||||
|
import com.chanko.yunxi.mes.framework.common.pojo.CommonResult;
|
||||||
|
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
|
||||||
|
import static com.chanko.yunxi.mes.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import com.chanko.yunxi.mes.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog;
|
||||||
|
import static com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import com.chanko.yunxi.mes.module.heli.controller.admin.materialplan.vo.*;
|
||||||
|
import com.chanko.yunxi.mes.module.heli.dal.dataobject.materialplan.MaterialPlanDO;
|
||||||
|
import com.chanko.yunxi.mes.module.heli.service.materialplan.MaterialPlanService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 物料需求计划")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/heli/material-plan")
|
||||||
|
@Validated
|
||||||
|
public class MaterialPlanController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MaterialPlanService materialPlanService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建物料需求计划")
|
||||||
|
@PreAuthorize("@ss.hasPermission('heli:material-plan:create')")
|
||||||
|
public CommonResult<Long> createMaterialPlan(@Valid @RequestBody MaterialPlanSaveReqVO createReqVO) {
|
||||||
|
return success(materialPlanService.createMaterialPlan(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新物料需求计划")
|
||||||
|
@PreAuthorize("@ss.hasPermission('heli:material-plan:update')")
|
||||||
|
public CommonResult<Boolean> updateMaterialPlan(@Valid @RequestBody MaterialPlanSaveReqVO updateReqVO) {
|
||||||
|
materialPlanService.updateMaterialPlan(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除物料需求计划")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('heli:material-plan:delete')")
|
||||||
|
public CommonResult<Boolean> deleteMaterialPlan(@RequestParam("id") Long id) {
|
||||||
|
materialPlanService.deleteMaterialPlan(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得物料需求计划")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('heli:material-plan:query')")
|
||||||
|
public CommonResult<MaterialPlanRespVO> getMaterialPlan(@RequestParam("id") Long id) {
|
||||||
|
MaterialPlanDO materialPlan = materialPlanService.getMaterialPlan(id);
|
||||||
|
return success(BeanUtils.toBean(materialPlan, MaterialPlanRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得物料需求计划分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('heli:material-plan:query')")
|
||||||
|
public CommonResult<PageResult<MaterialPlanRespVO>> getMaterialPlanPage(@Valid MaterialPlanPageReqVO pageReqVO) {
|
||||||
|
PageResult<MaterialPlanDO> pageResult = materialPlanService.getMaterialPlanPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, MaterialPlanRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出物料需求计划 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('heli:material-plan:export')")
|
||||||
|
@OperateLog(type = EXPORT)
|
||||||
|
public void exportMaterialPlanExcel(@Valid MaterialPlanPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<MaterialPlanDO> list = materialPlanService.getMaterialPlanPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "物料需求计划.xls", "数据", MaterialPlanRespVO.class,
|
||||||
|
BeanUtils.toBean(list, MaterialPlanRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,95 @@
|
|||||||
|
package com.chanko.yunxi.mes.module.heli.controller.admin.materialplandetail;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import javax.servlet.http.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
|
||||||
|
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||||
|
import com.chanko.yunxi.mes.framework.common.pojo.CommonResult;
|
||||||
|
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
|
||||||
|
import static com.chanko.yunxi.mes.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import com.chanko.yunxi.mes.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog;
|
||||||
|
import static com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import com.chanko.yunxi.mes.module.heli.controller.admin.materialplandetail.vo.*;
|
||||||
|
import com.chanko.yunxi.mes.module.heli.dal.dataobject.materialplandetail.MaterialPlanDetailDO;
|
||||||
|
import com.chanko.yunxi.mes.module.heli.service.materialplandetail.MaterialPlanDetailService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 物料需求计划物料详情")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/heli/material-plan-detail")
|
||||||
|
@Validated
|
||||||
|
public class MaterialPlanDetailController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MaterialPlanDetailService materialPlanDetailService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建物料需求计划物料详情")
|
||||||
|
@PreAuthorize("@ss.hasPermission('heli:material-plan-detail:create')")
|
||||||
|
public CommonResult<Long> createMaterialPlanDetail(@Valid @RequestBody MaterialPlanDetailSaveReqVO createReqVO) {
|
||||||
|
return success(materialPlanDetailService.createMaterialPlanDetail(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新物料需求计划物料详情")
|
||||||
|
@PreAuthorize("@ss.hasPermission('heli:material-plan-detail:update')")
|
||||||
|
public CommonResult<Boolean> updateMaterialPlanDetail(@Valid @RequestBody MaterialPlanDetailSaveReqVO updateReqVO) {
|
||||||
|
materialPlanDetailService.updateMaterialPlanDetail(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除物料需求计划物料详情")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('heli:material-plan-detail:delete')")
|
||||||
|
public CommonResult<Boolean> deleteMaterialPlanDetail(@RequestParam("id") Long id) {
|
||||||
|
materialPlanDetailService.deleteMaterialPlanDetail(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得物料需求计划物料详情")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('heli:material-plan-detail:query')")
|
||||||
|
public CommonResult<MaterialPlanDetailRespVO> getMaterialPlanDetail(@RequestParam("id") Long id) {
|
||||||
|
MaterialPlanDetailDO materialPlanDetail = materialPlanDetailService.getMaterialPlanDetail(id);
|
||||||
|
return success(BeanUtils.toBean(materialPlanDetail, MaterialPlanDetailRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得物料需求计划物料详情分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('heli:material-plan-detail:query')")
|
||||||
|
public CommonResult<PageResult<MaterialPlanDetailRespVO>> getMaterialPlanDetailPage(@Valid MaterialPlanDetailPageReqVO pageReqVO) {
|
||||||
|
PageResult<MaterialPlanDetailDO> pageResult = materialPlanDetailService.getMaterialPlanDetailPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, MaterialPlanDetailRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出物料需求计划物料详情 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('heli:material-plan-detail:export')")
|
||||||
|
@OperateLog(type = EXPORT)
|
||||||
|
public void exportMaterialPlanDetailExcel(@Valid MaterialPlanDetailPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<MaterialPlanDetailDO> list = materialPlanDetailService.getMaterialPlanDetailPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "物料需求计划物料详情.xls", "数据", MaterialPlanDetailRespVO.class,
|
||||||
|
BeanUtils.toBean(list, MaterialPlanDetailRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package com.chanko.yunxi.mes.module.heli.controller.admin.materialplandetail.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static com.chanko.yunxi.mes.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 MaterialPlanDetailPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "自增字段,唯一")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "物料需求采购计划id")
|
||||||
|
private Long projectMaterialPlanId;
|
||||||
|
|
||||||
|
@Schema(description = "物料id")
|
||||||
|
private Long materialId;
|
||||||
|
|
||||||
|
@Schema(description = "子项目编号")
|
||||||
|
private Long projectSubId;
|
||||||
|
|
||||||
|
@Schema(description = "需求数量")
|
||||||
|
private Long requireAmount;
|
||||||
|
|
||||||
|
@Schema(description = "需求到货日期")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] requireArriveTime;
|
||||||
|
|
||||||
|
@Schema(description = "备注")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
package com.chanko.yunxi.mes.module.heli.controller.admin.materialplandetail.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 MaterialPlanDetailRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("自增字段,唯一")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "物料需求采购计划id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("物料需求采购计划id")
|
||||||
|
private Long projectMaterialPlanId;
|
||||||
|
|
||||||
|
@Schema(description = "物料id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("物料id")
|
||||||
|
private Long materialId;
|
||||||
|
|
||||||
|
@Schema(description = "子项目编号")
|
||||||
|
@ExcelProperty("子项目编号")
|
||||||
|
private Long projectSubId;
|
||||||
|
|
||||||
|
@Schema(description = "需求数量")
|
||||||
|
@ExcelProperty("需求数量")
|
||||||
|
private Long requireAmount;
|
||||||
|
|
||||||
|
@Schema(description = "需求到货日期")
|
||||||
|
@ExcelProperty("需求到货日期")
|
||||||
|
private LocalDateTime requireArriveTime;
|
||||||
|
|
||||||
|
@Schema(description = "备注")
|
||||||
|
@ExcelProperty("备注")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.chanko.yunxi.mes.module.heli.controller.admin.materialplandetail.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import java.util.*;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 物料需求计划物料详情新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class MaterialPlanDetailSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "物料需求采购计划id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "物料需求采购计划id不能为空")
|
||||||
|
private Long projectMaterialPlanId;
|
||||||
|
|
||||||
|
@Schema(description = "物料id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "物料id不能为空")
|
||||||
|
private Long materialId;
|
||||||
|
|
||||||
|
@Schema(description = "子项目编号")
|
||||||
|
private Long projectSubId;
|
||||||
|
|
||||||
|
@Schema(description = "需求数量")
|
||||||
|
private Long requireAmount;
|
||||||
|
|
||||||
|
@Schema(description = "需求到货日期")
|
||||||
|
private LocalDateTime requireArriveTime;
|
||||||
|
|
||||||
|
@Schema(description = "备注")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
package com.chanko.yunxi.mes.module.heli.dal.mysql.materialplan;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||||
|
import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import com.chanko.yunxi.mes.module.heli.dal.dataobject.materialplan.MaterialPlanDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import com.chanko.yunxi.mes.module.heli.controller.admin.materialplan.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料需求计划 Mapper
|
||||||
|
*
|
||||||
|
* @author 管理员
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface MaterialPlanMapper extends BaseMapperX<MaterialPlanDO> {
|
||||||
|
|
||||||
|
default PageResult<MaterialPlanDO> selectPage(MaterialPlanPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<MaterialPlanDO>()
|
||||||
|
.eqIfPresent(MaterialPlanDO::getId, reqVO.getId())
|
||||||
|
.likeIfPresent(MaterialPlanDO::getProjectMaterialPlanNo, reqVO.getProjectMaterialPlanNo())
|
||||||
|
.eqIfPresent(MaterialPlanDO::getProjectId, reqVO.getProjectId())
|
||||||
|
.eqIfPresent(MaterialPlanDO::getProjectPlanId, reqVO.getProjectPlanId())
|
||||||
|
.eqIfPresent(MaterialPlanDO::getSubmitUserId, reqVO.getSubmitUserId())
|
||||||
|
.betweenIfPresent(MaterialPlanDO::getSubmitTime, reqVO.getSubmitTime())
|
||||||
|
.eqIfPresent(MaterialPlanDO::getAuditor, reqVO.getAuditor())
|
||||||
|
.betweenIfPresent(MaterialPlanDO::getAuditTime, reqVO.getAuditTime())
|
||||||
|
.eqIfPresent(MaterialPlanDO::getStatus, reqVO.getStatus())
|
||||||
|
.eqIfPresent(MaterialPlanDO::getDescription, reqVO.getDescription())
|
||||||
|
.betweenIfPresent(MaterialPlanDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(MaterialPlanDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.chanko.yunxi.mes.module.heli.dal.mysql.materialplandetail;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||||
|
import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import com.chanko.yunxi.mes.module.heli.dal.dataobject.materialplandetail.MaterialPlanDetailDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import com.chanko.yunxi.mes.module.heli.controller.admin.materialplandetail.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料需求计划物料详情 Mapper
|
||||||
|
*
|
||||||
|
* @author 管理员
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface MaterialPlanDetailMapper extends BaseMapperX<MaterialPlanDetailDO> {
|
||||||
|
|
||||||
|
default PageResult<MaterialPlanDetailDO> selectPage(MaterialPlanDetailPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<MaterialPlanDetailDO>()
|
||||||
|
.eqIfPresent(MaterialPlanDetailDO::getId, reqVO.getId())
|
||||||
|
.eqIfPresent(MaterialPlanDetailDO::getProjectMaterialPlanId, reqVO.getProjectMaterialPlanId())
|
||||||
|
.eqIfPresent(MaterialPlanDetailDO::getMaterialId, reqVO.getMaterialId())
|
||||||
|
.eqIfPresent(MaterialPlanDetailDO::getProjectSubId, reqVO.getProjectSubId())
|
||||||
|
.eqIfPresent(MaterialPlanDetailDO::getRequireAmount, reqVO.getRequireAmount())
|
||||||
|
.betweenIfPresent(MaterialPlanDetailDO::getRequireArriveTime, reqVO.getRequireArriveTime())
|
||||||
|
.eqIfPresent(MaterialPlanDetailDO::getDescription, reqVO.getDescription())
|
||||||
|
.betweenIfPresent(MaterialPlanDetailDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(MaterialPlanDetailDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
package com.chanko.yunxi.mes.module.heli.service.materialplan;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import com.chanko.yunxi.mes.module.heli.controller.admin.materialplan.vo.*;
|
||||||
|
import com.chanko.yunxi.mes.module.heli.dal.dataobject.materialplan.MaterialPlanDO;
|
||||||
|
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||||
|
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料需求计划 Service 接口
|
||||||
|
*
|
||||||
|
* @author 管理员
|
||||||
|
*/
|
||||||
|
public interface MaterialPlanService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建物料需求计划
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createMaterialPlan(@Valid MaterialPlanSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新物料需求计划
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateMaterialPlan(@Valid MaterialPlanSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除物料需求计划
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteMaterialPlan(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得物料需求计划
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 物料需求计划
|
||||||
|
*/
|
||||||
|
MaterialPlanDO getMaterialPlan(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得物料需求计划分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 物料需求计划分页
|
||||||
|
*/
|
||||||
|
PageResult<MaterialPlanDO> getMaterialPlanPage(MaterialPlanPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,74 @@
|
|||||||
|
package com.chanko.yunxi.mes.module.heli.service.materialplan;
|
||||||
|
|
||||||
|
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 com.chanko.yunxi.mes.module.heli.controller.admin.materialplan.vo.*;
|
||||||
|
import com.chanko.yunxi.mes.module.heli.dal.dataobject.materialplan.MaterialPlanDO;
|
||||||
|
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||||
|
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
|
||||||
|
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import com.chanko.yunxi.mes.module.heli.dal.mysql.materialplan.MaterialPlanMapper;
|
||||||
|
|
||||||
|
import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料需求计划 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 管理员
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class MaterialPlanServiceImpl implements MaterialPlanService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MaterialPlanMapper materialPlanMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createMaterialPlan(MaterialPlanSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
MaterialPlanDO materialPlan = BeanUtils.toBean(createReqVO, MaterialPlanDO.class);
|
||||||
|
materialPlanMapper.insert(materialPlan);
|
||||||
|
// 返回
|
||||||
|
return materialPlan.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateMaterialPlan(MaterialPlanSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateMaterialPlanExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
MaterialPlanDO updateObj = BeanUtils.toBean(updateReqVO, MaterialPlanDO.class);
|
||||||
|
materialPlanMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteMaterialPlan(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateMaterialPlanExists(id);
|
||||||
|
// 删除
|
||||||
|
materialPlanMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateMaterialPlanExists(Long id) {
|
||||||
|
if (materialPlanMapper.selectById(id) == null) {
|
||||||
|
throw exception(MATERIAL_PLAN_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MaterialPlanDO getMaterialPlan(Long id) {
|
||||||
|
return materialPlanMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<MaterialPlanDO> getMaterialPlanPage(MaterialPlanPageReqVO pageReqVO) {
|
||||||
|
return materialPlanMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
package com.chanko.yunxi.mes.module.heli.service.materialplandetail;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import com.chanko.yunxi.mes.module.heli.controller.admin.materialplandetail.vo.*;
|
||||||
|
import com.chanko.yunxi.mes.module.heli.dal.dataobject.materialplandetail.MaterialPlanDetailDO;
|
||||||
|
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||||
|
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料需求计划物料详情 Service 接口
|
||||||
|
*
|
||||||
|
* @author 管理员
|
||||||
|
*/
|
||||||
|
public interface MaterialPlanDetailService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建物料需求计划物料详情
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createMaterialPlanDetail(@Valid MaterialPlanDetailSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新物料需求计划物料详情
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateMaterialPlanDetail(@Valid MaterialPlanDetailSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除物料需求计划物料详情
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteMaterialPlanDetail(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得物料需求计划物料详情
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 物料需求计划物料详情
|
||||||
|
*/
|
||||||
|
MaterialPlanDetailDO getMaterialPlanDetail(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得物料需求计划物料详情分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 物料需求计划物料详情分页
|
||||||
|
*/
|
||||||
|
PageResult<MaterialPlanDetailDO> getMaterialPlanDetailPage(MaterialPlanDetailPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,74 @@
|
|||||||
|
package com.chanko.yunxi.mes.module.heli.service.materialplandetail;
|
||||||
|
|
||||||
|
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 com.chanko.yunxi.mes.module.heli.controller.admin.materialplandetail.vo.*;
|
||||||
|
import com.chanko.yunxi.mes.module.heli.dal.dataobject.materialplandetail.MaterialPlanDetailDO;
|
||||||
|
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||||
|
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
|
||||||
|
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import com.chanko.yunxi.mes.module.heli.dal.mysql.materialplandetail.MaterialPlanDetailMapper;
|
||||||
|
|
||||||
|
import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料需求计划物料详情 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 管理员
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class MaterialPlanDetailServiceImpl implements MaterialPlanDetailService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MaterialPlanDetailMapper materialPlanDetailMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createMaterialPlanDetail(MaterialPlanDetailSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
MaterialPlanDetailDO materialPlanDetail = BeanUtils.toBean(createReqVO, MaterialPlanDetailDO.class);
|
||||||
|
materialPlanDetailMapper.insert(materialPlanDetail);
|
||||||
|
// 返回
|
||||||
|
return materialPlanDetail.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateMaterialPlanDetail(MaterialPlanDetailSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateMaterialPlanDetailExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
MaterialPlanDetailDO updateObj = BeanUtils.toBean(updateReqVO, MaterialPlanDetailDO.class);
|
||||||
|
materialPlanDetailMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteMaterialPlanDetail(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateMaterialPlanDetailExists(id);
|
||||||
|
// 删除
|
||||||
|
materialPlanDetailMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateMaterialPlanDetailExists(Long id) {
|
||||||
|
if (materialPlanDetailMapper.selectById(id) == null) {
|
||||||
|
throw exception(MATERIAL_PLAN_DETAIL_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MaterialPlanDetailDO getMaterialPlanDetail(Long id) {
|
||||||
|
return materialPlanDetailMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<MaterialPlanDetailDO> getMaterialPlanDetailPage(MaterialPlanDetailPageReqVO pageReqVO) {
|
||||||
|
return materialPlanDetailMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
export interface MaterialPlanVO {
|
||||||
|
id: number
|
||||||
|
projectMaterialPlanNo: string
|
||||||
|
projectId: number
|
||||||
|
projectPlanId: number
|
||||||
|
submitUserId: number
|
||||||
|
submitTime: Date
|
||||||
|
auditor: number
|
||||||
|
auditTime: Date
|
||||||
|
status: number
|
||||||
|
description: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询物料需求计划分页
|
||||||
|
export const getMaterialPlanPage = async (params) => {
|
||||||
|
return await request.get({ url: `/heli/material-plan/page`, params })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询物料需求计划详情
|
||||||
|
export const getMaterialPlan = async (id: number) => {
|
||||||
|
return await request.get({ url: `/heli/material-plan/get?id=` + id })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增物料需求计划
|
||||||
|
export const createMaterialPlan = async (data: MaterialPlanVO) => {
|
||||||
|
return await request.post({ url: `/heli/material-plan/create`, data })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改物料需求计划
|
||||||
|
export const updateMaterialPlan = async (data: MaterialPlanVO) => {
|
||||||
|
return await request.put({ url: `/heli/material-plan/update`, data })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除物料需求计划
|
||||||
|
export const deleteMaterialPlan = async (id: number) => {
|
||||||
|
return await request.delete({ url: `/heli/material-plan/delete?id=` + id })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出物料需求计划 Excel
|
||||||
|
export const exportMaterialPlan = async (params) => {
|
||||||
|
return await request.download({ url: `/heli/material-plan/export-excel`, params })
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
export interface MaterialPlanDetailVO {
|
||||||
|
id: number
|
||||||
|
projectMaterialPlanId: number
|
||||||
|
materialId: number
|
||||||
|
projectSubId: number
|
||||||
|
requireAmount: number
|
||||||
|
requireArriveTime: Date
|
||||||
|
description: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询物料需求计划物料详情分页
|
||||||
|
export const getMaterialPlanDetailPage = async (params) => {
|
||||||
|
return await request.get({ url: `/heli/material-plan-detail/page`, params })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询物料需求计划物料详情详情
|
||||||
|
export const getMaterialPlanDetail = async (id: number) => {
|
||||||
|
return await request.get({ url: `/heli/material-plan-detail/get?id=` + id })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增物料需求计划物料详情
|
||||||
|
export const createMaterialPlanDetail = async (data: MaterialPlanDetailVO) => {
|
||||||
|
return await request.post({ url: `/heli/material-plan-detail/create`, data })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改物料需求计划物料详情
|
||||||
|
export const updateMaterialPlanDetail = async (data: MaterialPlanDetailVO) => {
|
||||||
|
return await request.put({ url: `/heli/material-plan-detail/update`, data })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除物料需求计划物料详情
|
||||||
|
export const deleteMaterialPlanDetail = async (id: number) => {
|
||||||
|
return await request.delete({ url: `/heli/material-plan-detail/delete?id=` + id })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出物料需求计划物料详情 Excel
|
||||||
|
export const exportMaterialPlanDetail = async (params) => {
|
||||||
|
return await request.download({ url: `/heli/material-plan-detail/export-excel`, params })
|
||||||
|
}
|
Loading…
Reference in new issue