物料需求计划 接口及页面生成

物料需求计划 接口及页面生成
pull/4/head
siontion 8 months ago
parent 8df36cb0a3
commit e5db1db169

@ -60,4 +60,7 @@ public interface ErrorCodeConstants {
/************生产计划管理***********/ /************生产计划管理***********/
ErrorCode PLAN_NOT_EXISTS = new ErrorCode(1_007_001, "生产计划不存在"); ErrorCode PLAN_NOT_EXISTS = new ErrorCode(1_007_001, "生产计划不存在");
ErrorCode PLAN_SUB_NOT_EXISTS = new ErrorCode(1_007_002, "生产计划子项目不存在"); ErrorCode PLAN_SUB_NOT_EXISTS = new ErrorCode(1_007_002, "生产计划子项目不存在");
/************采购管理***********/
ErrorCode MATERIAL_PLAN_NOT_EXISTS = new ErrorCode(1_008_001, "物料需求计划不存在");
ErrorCode MATERIAL_PLAN_DETAIL_NOT_EXISTS = new ErrorCode(1_008_002, "物料需求计划物料详情不存在");
} }

@ -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,54 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.materialplan.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 MaterialPlanPageReqVO extends PageParam {
@Schema(description = "自增字段,唯一")
private Long id;
@Schema(description = "物料计划单号")
private String projectMaterialPlanNo;
@Schema(description = "订单id")
private Long projectId;
@Schema(description = "生产计划id")
private Long projectPlanId;
@Schema(description = "送审人")
private Long submitUserId;
@Schema(description = "送审时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] submitTime;
@Schema(description = "审核人")
private Long auditor;
@Schema(description = "审核时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] auditTime;
@Schema(description = "状态,1已保存2已送审3已审核4已打回 默认是1")
private Integer status;
@Schema(description = "备注")
private String description;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

@ -0,0 +1,63 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.materialplan.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
import com.chanko.yunxi.mes.framework.excel.core.annotations.DictFormat;
import com.chanko.yunxi.mes.framework.excel.core.convert.DictConvert;
@Schema(description = "管理后台 - 物料需求计划 Response VO")
@Data
@ExcelIgnoreUnannotated
public class MaterialPlanRespVO {
@Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("自增字段,唯一")
private Long id;
@Schema(description = "物料计划单号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("物料计划单号")
private String projectMaterialPlanNo;
@Schema(description = "订单id")
@ExcelProperty("订单id")
private Long projectId;
@Schema(description = "生产计划id")
@ExcelProperty("生产计划id")
private Long projectPlanId;
@Schema(description = "送审人")
@ExcelProperty("送审人")
private Long submitUserId;
@Schema(description = "送审时间")
@ExcelProperty("送审时间")
private LocalDateTime submitTime;
@Schema(description = "审核人")
@ExcelProperty("审核人")
private Long auditor;
@Schema(description = "审核时间")
@ExcelProperty("审核时间")
private LocalDateTime auditTime;
@Schema(description = "状态,1已保存2已送审3已审核4已打回 默认是1")
@ExcelProperty(value = "状态,1已保存2已送审3已审核4已打回 默认是1", converter = DictConvert.class)
@DictFormat("heli_project_material_plan_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
private Integer status;
@Schema(description = "备注")
@ExcelProperty("备注")
private String description;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

@ -0,0 +1,46 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.materialplan.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 MaterialPlanSaveReqVO {
@Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED)
private Long id;
@Schema(description = "物料计划单号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "物料计划单号不能为空")
private String projectMaterialPlanNo;
@Schema(description = "订单id")
private Long projectId;
@Schema(description = "生产计划id")
private Long projectPlanId;
@Schema(description = "送审人")
private Long submitUserId;
@Schema(description = "送审时间")
private LocalDateTime submitTime;
@Schema(description = "审核人")
private Long auditor;
@Schema(description = "审核时间")
private LocalDateTime auditTime;
@Schema(description = "状态,1已保存2已送审3已审核4已打回 默认是1")
private Integer status;
@Schema(description = "备注")
private String description;
}

@ -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,71 @@
package com.chanko.yunxi.mes.module.heli.dal.dataobject.materialplan;
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.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO;
/**
* DO
*
* @author
*/
@TableName("project_material_plan")
@KeySequence("project_material_plan_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class MaterialPlanDO extends BaseDO {
/**
*
*/
@TableId
private Long id;
/**
*
*/
private String projectMaterialPlanNo;
/**
* id
*/
private Long projectId;
/**
* id
*/
private Long projectPlanId;
/**
*
*/
private Long submitUserId;
/**
*
*/
private LocalDateTime submitTime;
/**
*
*/
private Long auditor;
/**
*
*/
private LocalDateTime auditTime;
/**
* ,1234 1
*
* {@link TODO heli_project_material_plan_status }
*/
private Integer status;
/**
*
*/
private String description;
}

@ -0,0 +1,56 @@
package com.chanko.yunxi.mes.module.heli.dal.dataobject.materialplandetail;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO;
/**
* DO
*
* @author
*/
@TableName("project_material_plan_detail")
@KeySequence("project_material_plan_detail_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class MaterialPlanDetailDO extends BaseDO {
/**
*
*/
@TableId
private Long id;
/**
* id
*/
private Long projectMaterialPlanId;
/**
* id
*/
private Long materialId;
/**
*
*/
private Long projectSubId;
/**
*
*/
private Long requireAmount;
/**
*
*/
private LocalDateTime requireArriveTime;
/**
*
*/
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,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.chanko.yunxi.mes.module.heli.dal.mysql.materialplan.MaterialPlanMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

@ -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.chanko.yunxi.mes.module.heli.dal.mysql.materialplandetail.MaterialPlanDetailMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

@ -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 })
}

@ -0,0 +1,148 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
>
<el-form-item label="物料计划单号" prop="projectMaterialPlanNo">
<el-input v-model="formData.projectMaterialPlanNo" placeholder="请输入物料计划单号" />
</el-form-item>
<el-form-item label="订单id" prop="projectId">
<el-input v-model="formData.projectId" placeholder="请输入订单id" />
</el-form-item>
<el-form-item label="生产计划id" prop="projectPlanId">
<el-input v-model="formData.projectPlanId" placeholder="请输入生产计划id" />
</el-form-item>
<el-form-item label="送审人" prop="submitUserId">
<el-input v-model="formData.submitUserId" placeholder="请输入送审人" />
</el-form-item>
<el-form-item label="送审时间" prop="submitTime">
<el-date-picker
v-model="formData.submitTime"
type="date"
value-format="x"
placeholder="选择送审时间"
/>
</el-form-item>
<el-form-item label="审核人" prop="auditor">
<el-input v-model="formData.auditor" placeholder="请输入审核人" />
</el-form-item>
<el-form-item label="审核时间" prop="auditTime">
<el-date-picker
v-model="formData.auditTime"
type="date"
value-format="x"
placeholder="选择审核时间"
/>
</el-form-item>
<el-form-item label="状态,1已保存2已送审3已审核4已打回 默认是1" prop="status">
<el-radio-group v-model="formData.status">
<el-radio
v-for="dict in getIntDictOptions(DICT_TYPE.HELI_PROJECT_MATERIAL_PLAN_STATUS)"
:key="dict.value"
:label="dict.value"
>
{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="description">
<el-input v-model="formData.description" type="textarea" placeholder="请输入备注" />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script setup lang="ts">
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import * as MaterialPlanApi from '@/api/heli/materialplan'
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formData = ref({
id: undefined,
projectMaterialPlanNo: undefined,
projectId: undefined,
projectPlanId: undefined,
submitUserId: undefined,
submitTime: undefined,
auditor: undefined,
auditTime: undefined,
status: undefined,
description: undefined,
})
const formRules = reactive({
projectMaterialPlanNo: [{ required: true, message: '物料计划单号不能为空', trigger: 'blur' }],
})
const formRef = ref() // Ref
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
//
if (id) {
formLoading.value = true
try {
formData.value = await MaterialPlanApi.getMaterialPlan(id)
} finally {
formLoading.value = false
}
}
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
await formRef.value.validate()
//
formLoading.value = true
try {
const data = formData.value as unknown as MaterialPlanApi.MaterialPlanVO
if (formType.value === 'create') {
await MaterialPlanApi.createMaterialPlan(data)
message.success(t('common.createSuccess'))
} else {
await MaterialPlanApi.updateMaterialPlan(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
projectMaterialPlanNo: undefined,
projectId: undefined,
projectPlanId: undefined,
submitUserId: undefined,
submitTime: undefined,
auditor: undefined,
auditTime: undefined,
status: undefined,
description: undefined,
}
formRef.value?.resetFields()
}
</script>

@ -0,0 +1,302 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="68px"
>
<el-form-item label="自增字段,唯一" prop="id">
<el-input
v-model="queryParams.id"
placeholder="请输入自增字段,唯一"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="物料计划单号" prop="projectMaterialPlanNo">
<el-input
v-model="queryParams.projectMaterialPlanNo"
placeholder="请输入物料计划单号"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="订单id" prop="projectId">
<el-input
v-model="queryParams.projectId"
placeholder="请输入订单id"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="生产计划id" prop="projectPlanId">
<el-input
v-model="queryParams.projectPlanId"
placeholder="请输入生产计划id"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="送审人" prop="submitUserId">
<el-input
v-model="queryParams.submitUserId"
placeholder="请输入送审人"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="送审时间" prop="submitTime">
<el-date-picker
v-model="queryParams.submitTime"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="审核人" prop="auditor">
<el-input
v-model="queryParams.auditor"
placeholder="请输入审核人"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="审核时间" prop="auditTime">
<el-date-picker
v-model="queryParams.auditTime"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="状态,1已保存2已送审3已审核4已打回 默认是1" prop="status">
<el-select
v-model="queryParams.status"
placeholder="请选择状态,1已保存2已送审3已审核4已打回 默认是1"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.HELI_PROJECT_MATERIAL_PLAN_STATUS)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker
v-model="queryParams.createTime"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/>
</el-form-item>
<el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
<el-button
type="primary"
plain
@click="openForm('create')"
v-hasPermi="['heli:material-plan:create']"
>
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<el-button
type="success"
plain
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['heli:material-plan:export']"
>
<Icon icon="ep:download" class="mr-5px" /> 导出
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="自增字段,唯一" align="center" prop="id" />
<el-table-column label="物料计划单号" align="center" prop="projectMaterialPlanNo" />
<el-table-column label="订单id" align="center" prop="projectId" />
<el-table-column label="生产计划id" align="center" prop="projectPlanId" />
<el-table-column label="送审人" align="center" prop="submitUserId" />
<el-table-column
label="送审时间"
align="center"
prop="submitTime"
:formatter="dateFormatter"
width="180px"
/>
<el-table-column label="审核人" align="center" prop="auditor" />
<el-table-column
label="审核时间"
align="center"
prop="auditTime"
:formatter="dateFormatter"
width="180px"
/>
<el-table-column label="状态,1已保存2已送审3已审核4已打回 默认是1" align="center" prop="status">
<template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_PROJECT_MATERIAL_PLAN_STATUS" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="description" />
<el-table-column
label="创建时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
width="180px"
/>
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button
link
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['heli:material-plan:update']"
>
编辑
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['heli:material-plan:delete']"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<MaterialPlanForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import * as MaterialPlanApi from '@/api/heli/materialplan'
import MaterialPlanForm from './MaterialPlanForm.vue'
defineOptions({ name: 'MaterialPlan' })
const message = useMessage() //
const { t } = useI18n() //
const loading = ref(true) //
const list = ref([]) //
const total = ref(0) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
id: undefined,
projectMaterialPlanNo: undefined,
projectId: undefined,
projectPlanId: undefined,
submitUserId: undefined,
submitTime: [],
auditor: undefined,
auditTime: [],
status: undefined,
description: undefined,
createTime: [],
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await MaterialPlanApi.getMaterialPlanPage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
handleQuery()
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await MaterialPlanApi.deleteMaterialPlan(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await MaterialPlanApi.exportMaterialPlan(queryParams)
download.excel(data, '物料需求计划.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 **/
onMounted(() => {
getList()
})
</script>
Loading…
Cancel
Save