【物料+材质】基础代码框架提交

master
zengchenxi 10 months ago
parent 8c5bbfd398
commit 5963701d23

@ -0,0 +1,95 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.composition;
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.composition.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.composition.CompositionDO;
import com.chanko.yunxi.mes.module.heli.service.composition.CompositionService;
@Tag(name = "管理后台 - 材质")
@RestController
@RequestMapping("/heli/composition")
@Validated
public class CompositionController {
@Resource
private CompositionService compositionService;
@PostMapping("/create")
@Operation(summary = "创建材质")
@PreAuthorize("@ss.hasPermission('heli:composition:create')")
public CommonResult<Long> createComposition(@Valid @RequestBody CompositionSaveReqVO createReqVO) {
return success(compositionService.createComposition(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新材质")
@PreAuthorize("@ss.hasPermission('heli:composition:update')")
public CommonResult<Boolean> updateComposition(@Valid @RequestBody CompositionSaveReqVO updateReqVO) {
compositionService.updateComposition(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除材质")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('heli:composition:delete')")
public CommonResult<Boolean> deleteComposition(@RequestParam("id") Long id) {
compositionService.deleteComposition(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得材质")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('heli:composition:query')")
public CommonResult<CompositionRespVO> getComposition(@RequestParam("id") Long id) {
CompositionDO composition = compositionService.getComposition(id);
return success(BeanUtils.toBean(composition, CompositionRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得材质分页")
@PreAuthorize("@ss.hasPermission('heli:composition:query')")
public CommonResult<PageResult<CompositionRespVO>> getCompositionPage(@Valid CompositionPageReqVO pageReqVO) {
PageResult<CompositionDO> pageResult = compositionService.getCompositionPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, CompositionRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出材质 Excel")
@PreAuthorize("@ss.hasPermission('heli:composition:export')")
@OperateLog(type = EXPORT)
public void exportCompositionExcel(@Valid CompositionPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<CompositionDO> list = compositionService.getCompositionPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "材质.xls", "数据", CompositionRespVO.class,
BeanUtils.toBean(list, CompositionRespVO.class));
}
}

@ -0,0 +1,44 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.composition.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
import java.math.BigDecimal;
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 CompositionPageReqVO extends PageParam {
@Schema(description = "材质名", example = "王五")
private String name;
@Schema(description = "材质代号")
private String code;
@Schema(description = "类型", example = "2")
private String type;
@Schema(description = "密度")
private BigDecimal density;
@Schema(description = "密度单位")
private String densityUnit;
@Schema(description = "描述", example = "随便")
private String description;
@Schema(description = "状态,1表示正常2表示禁用", example = "2")
private Integer status;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

@ -0,0 +1,53 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.composition.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.util.*;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 材质 Response VO")
@Data
@ExcelIgnoreUnannotated
public class CompositionRespVO {
@Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED, example = "457")
@ExcelProperty("自增字段,唯一")
private Long id;
@Schema(description = "材质名", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
@ExcelProperty("材质名")
private String name;
@Schema(description = "材质代号")
@ExcelProperty("材质代号")
private String code;
@Schema(description = "类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty("类型")
private String type;
@Schema(description = "密度")
@ExcelProperty("密度")
private BigDecimal density;
@Schema(description = "密度单位")
@ExcelProperty("密度单位")
private String densityUnit;
@Schema(description = "描述", example = "随便")
@ExcelProperty("描述")
private String description;
@Schema(description = "状态,1表示正常2表示禁用", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty("状态,1表示正常2表示禁用")
private Integer status;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

@ -0,0 +1,41 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.composition.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
import java.util.*;
import java.math.BigDecimal;
@Schema(description = "管理后台 - 材质新增/修改 Request VO")
@Data
public class CompositionSaveReqVO {
@Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED, example = "457")
private Long id;
@Schema(description = "材质名", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
@NotEmpty(message = "材质名不能为空")
private String name;
@Schema(description = "材质代号")
private String code;
@Schema(description = "类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotEmpty(message = "类型不能为空")
private String type;
@Schema(description = "密度")
private BigDecimal density;
@Schema(description = "密度单位")
private String densityUnit;
@Schema(description = "描述", example = "随便")
private String description;
@Schema(description = "状态,1表示正常2表示禁用", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "状态,1表示正常2表示禁用不能为空")
private Integer status;
}

@ -0,0 +1,95 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.material;
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.material.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.material.MaterialDO;
import com.chanko.yunxi.mes.module.heli.service.material.MaterialService;
@Tag(name = "管理后台 - 物料")
@RestController
@RequestMapping("/heli/material")
@Validated
public class MaterialController {
@Resource
private MaterialService materialService;
@PostMapping("/create")
@Operation(summary = "创建物料")
@PreAuthorize("@ss.hasPermission('heli:material:create')")
public CommonResult<Long> createMaterial(@Valid @RequestBody MaterialSaveReqVO createReqVO) {
return success(materialService.createMaterial(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新物料")
@PreAuthorize("@ss.hasPermission('heli:material:update')")
public CommonResult<Boolean> updateMaterial(@Valid @RequestBody MaterialSaveReqVO updateReqVO) {
materialService.updateMaterial(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除物料")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('heli:material:delete')")
public CommonResult<Boolean> deleteMaterial(@RequestParam("id") Long id) {
materialService.deleteMaterial(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得物料")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('heli:material:query')")
public CommonResult<MaterialRespVO> getMaterial(@RequestParam("id") Long id) {
MaterialDO material = materialService.getMaterial(id);
return success(BeanUtils.toBean(material, MaterialRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得物料分页")
@PreAuthorize("@ss.hasPermission('heli:material:query')")
public CommonResult<PageResult<MaterialRespVO>> getMaterialPage(@Valid MaterialPageReqVO pageReqVO) {
PageResult<MaterialDO> pageResult = materialService.getMaterialPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, MaterialRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出物料 Excel")
@PreAuthorize("@ss.hasPermission('heli:material:export')")
@OperateLog(type = EXPORT)
public void exportMaterialExcel(@Valid MaterialPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<MaterialDO> list = materialService.getMaterialPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "物料.xls", "数据", MaterialRespVO.class,
BeanUtils.toBean(list, MaterialRespVO.class));
}
}

@ -0,0 +1,82 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.material.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 MaterialPageReqVO extends PageParam {
@Schema(description = "物料编码")
private String code;
@Schema(description = "物料名称", example = "李四")
private String name;
@Schema(description = "品牌")
private String brand;
@Schema(description = "规格")
private String spec;
@Schema(description = "物料分类 零件|半成品|模具 1 2 3", example = "2")
private String materialType;
@Schema(description = "主要单位")
private String unit;
@Schema(description = "尺寸信息")
private String sizeInfo;
@Schema(description = "材质id", example = "17489")
private Long compositionId;
@Schema(description = "库存预警上限")
private Long invUpperLimit;
@Schema(description = "库存预警下限")
private Long invLowerLimit;
@Schema(description = "管控方式,只有两种值分别是1和2,1表示单个管理2表示批次管理", example = "2")
private Integer traceType;
@Schema(description = "虚拟物料标识只能填写Y和NY表示虚拟物料N表示反之")
private String virsualPart;
@Schema(description = "物料主要来源,只有三种值分别是123,其中1表示自制2表示外购3表示委外加工")
private Integer mainFrom;
@Schema(description = "默认保存的仓库对应仓库表中的Id")
private Long dftStoreWh;
@Schema(description = "默认保存的库区对应库区表中的Id")
private Long dftStoreRg;
@Schema(description = "默认保存的库位对应库位表中的Id")
private Long dftStorePn;
@Schema(description = "默认工艺路线对应工艺路线表中的Id")
private Long dftRoute;
@Schema(description = "默认包装方式对应包装方式表中的Id")
private Long dftPack;
@Schema(description = "物料描述", example = "你说的对")
private String description;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "状态,1表示正常2表示禁用", example = "1")
private Integer status;
}

@ -0,0 +1,104 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.material.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 MaterialRespVO {
@Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED, example = "11225")
@ExcelProperty("自增字段,唯一")
private Long id;
@Schema(description = "物料编码", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("物料编码")
private String code;
@Schema(description = "物料名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@ExcelProperty("物料名称")
private String name;
@Schema(description = "品牌")
@ExcelProperty("品牌")
private String brand;
@Schema(description = "规格")
@ExcelProperty("规格")
private String spec;
@Schema(description = "物料分类 零件|半成品|模具 1 2 3", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty("物料分类 零件|半成品|模具 1 2 3")
private String materialType;
@Schema(description = "主要单位")
@ExcelProperty("主要单位")
private String unit;
@Schema(description = "尺寸信息")
@ExcelProperty("尺寸信息")
private String sizeInfo;
@Schema(description = "材质id", requiredMode = Schema.RequiredMode.REQUIRED, example = "17489")
@ExcelProperty("材质id")
private Long compositionId;
@Schema(description = "库存预警上限")
@ExcelProperty("库存预警上限")
private Long invUpperLimit;
@Schema(description = "库存预警下限")
@ExcelProperty("库存预警下限")
private Long invLowerLimit;
@Schema(description = "管控方式,只有两种值分别是1和2,1表示单个管理2表示批次管理", example = "2")
@ExcelProperty("管控方式,只有两种值分别是1和2,1表示单个管理2表示批次管理")
private Integer traceType;
@Schema(description = "虚拟物料标识只能填写Y和NY表示虚拟物料N表示反之")
@ExcelProperty("虚拟物料标识只能填写Y和NY表示虚拟物料N表示反之")
private String virsualPart;
@Schema(description = "物料主要来源,只有三种值分别是123,其中1表示自制2表示外购3表示委外加工")
@ExcelProperty("物料主要来源,只有三种值分别是123,其中1表示自制2表示外购3表示委外加工")
private Integer mainFrom;
@Schema(description = "默认保存的仓库对应仓库表中的Id")
@ExcelProperty("默认保存的仓库对应仓库表中的Id")
private Long dftStoreWh;
@Schema(description = "默认保存的库区对应库区表中的Id")
@ExcelProperty("默认保存的库区对应库区表中的Id")
private Long dftStoreRg;
@Schema(description = "默认保存的库位对应库位表中的Id")
@ExcelProperty("默认保存的库位对应库位表中的Id")
private Long dftStorePn;
@Schema(description = "默认工艺路线对应工艺路线表中的Id")
@ExcelProperty("默认工艺路线对应工艺路线表中的Id")
private Long dftRoute;
@Schema(description = "默认包装方式对应包装方式表中的Id")
@ExcelProperty("默认包装方式对应包装方式表中的Id")
private Long dftPack;
@Schema(description = "物料描述", example = "你说的对")
@ExcelProperty("物料描述")
private String description;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "状态,1表示正常2表示禁用", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("状态,1表示正常2表示禁用")
private Integer status;
}

@ -0,0 +1,81 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.material.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
import java.util.*;
@Schema(description = "管理后台 - 物料新增/修改 Request VO")
@Data
public class MaterialSaveReqVO {
@Schema(description = "自增字段,唯一", requiredMode = Schema.RequiredMode.REQUIRED, example = "11225")
private Long id;
@Schema(description = "物料编码", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "物料编码不能为空")
private String code;
@Schema(description = "物料名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@NotEmpty(message = "物料名称不能为空")
private String name;
@Schema(description = "品牌")
private String brand;
@Schema(description = "规格")
private String spec;
@Schema(description = "物料分类 零件|半成品|模具 1 2 3", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotEmpty(message = "物料分类 零件|半成品|模具 1 2 3不能为空")
private String materialType;
@Schema(description = "主要单位")
private String unit;
@Schema(description = "尺寸信息")
private String sizeInfo;
@Schema(description = "材质id", requiredMode = Schema.RequiredMode.REQUIRED, example = "17489")
@NotNull(message = "材质id不能为空")
private Long compositionId;
@Schema(description = "库存预警上限")
private Long invUpperLimit;
@Schema(description = "库存预警下限")
private Long invLowerLimit;
@Schema(description = "管控方式,只有两种值分别是1和2,1表示单个管理2表示批次管理", example = "2")
private Integer traceType;
@Schema(description = "虚拟物料标识只能填写Y和NY表示虚拟物料N表示反之")
private String virsualPart;
@Schema(description = "物料主要来源,只有三种值分别是123,其中1表示自制2表示外购3表示委外加工")
private Integer mainFrom;
@Schema(description = "默认保存的仓库对应仓库表中的Id")
private Long dftStoreWh;
@Schema(description = "默认保存的库区对应库区表中的Id")
private Long dftStoreRg;
@Schema(description = "默认保存的库位对应库位表中的Id")
private Long dftStorePn;
@Schema(description = "默认工艺路线对应工艺路线表中的Id")
private Long dftRoute;
@Schema(description = "默认包装方式对应包装方式表中的Id")
private Long dftPack;
@Schema(description = "物料描述", example = "你说的对")
private String description;
@Schema(description = "状态,1表示正常2表示禁用", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "状态,1表示正常2表示禁用不能为空")
private Integer status;
}

@ -0,0 +1,60 @@
package com.chanko.yunxi.mes.module.heli.dal.dataobject.composition;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
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("base_composition")
@KeySequence("base_composition_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CompositionDO extends BaseDO {
/**
*
*/
@TableId
private Long id;
/**
*
*/
private String name;
/**
*
*/
private String code;
/**
*
*/
private String type;
/**
*
*/
private BigDecimal density;
/**
*
*/
private String densityUnit;
/**
*
*/
private String description;
/**
* ,12
*/
private Integer status;
}

@ -0,0 +1,111 @@
package com.chanko.yunxi.mes.module.heli.dal.dataobject.material;
import lombok.*;
import java.util.*;
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("base_material")
@KeySequence("base_material_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class MaterialDO extends BaseDO {
/**
*
*/
@TableId
private Long id;
/**
*
*/
private String code;
/**
*
*/
private String name;
/**
*
*/
private String brand;
/**
*
*/
private String spec;
/**
* || 1 2 3
*/
private String materialType;
/**
*
*/
private String unit;
/**
*
*/
private String sizeInfo;
/**
* id
*/
private Long compositionId;
/**
*
*/
private Long invUpperLimit;
/**
*
*/
private Long invLowerLimit;
/**
* ,12,12
*/
private Integer traceType;
/**
* YNYN
*/
private String virsualPart;
/**
* ,123,123
*/
private Integer mainFrom;
/**
* Id
*/
private Long dftStoreWh;
/**
* Id
*/
private Long dftStoreRg;
/**
* Id
*/
private Long dftStorePn;
/**
* 线线Id
*/
private Long dftRoute;
/**
* Id
*/
private Long dftPack;
/**
*
*/
private String description;
/**
* ,12
*/
private Integer status;
}

@ -0,0 +1,33 @@
package com.chanko.yunxi.mes.module.heli.dal.mysql.composition;
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.composition.CompositionDO;
import org.apache.ibatis.annotations.Mapper;
import com.chanko.yunxi.mes.module.heli.controller.admin.composition.vo.*;
/**
* Mapper
*
* @author
*/
@Mapper
public interface CompositionMapper extends BaseMapperX<CompositionDO> {
default PageResult<CompositionDO> selectPage(CompositionPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<CompositionDO>()
.likeIfPresent(CompositionDO::getName, reqVO.getName())
.eqIfPresent(CompositionDO::getCode, reqVO.getCode())
.eqIfPresent(CompositionDO::getType, reqVO.getType())
.eqIfPresent(CompositionDO::getDensity, reqVO.getDensity())
.eqIfPresent(CompositionDO::getDensityUnit, reqVO.getDensityUnit())
.eqIfPresent(CompositionDO::getDescription, reqVO.getDescription())
.eqIfPresent(CompositionDO::getStatus, reqVO.getStatus())
.betweenIfPresent(CompositionDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(CompositionDO::getId));
}
}

@ -0,0 +1,46 @@
package com.chanko.yunxi.mes.module.heli.dal.mysql.material;
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.material.MaterialDO;
import org.apache.ibatis.annotations.Mapper;
import com.chanko.yunxi.mes.module.heli.controller.admin.material.vo.*;
/**
* Mapper
*
* @author
*/
@Mapper
public interface MaterialMapper extends BaseMapperX<MaterialDO> {
default PageResult<MaterialDO> selectPage(MaterialPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<MaterialDO>()
.eqIfPresent(MaterialDO::getCode, reqVO.getCode())
.likeIfPresent(MaterialDO::getName, reqVO.getName())
.eqIfPresent(MaterialDO::getBrand, reqVO.getBrand())
.eqIfPresent(MaterialDO::getSpec, reqVO.getSpec())
.eqIfPresent(MaterialDO::getMaterialType, reqVO.getMaterialType())
.eqIfPresent(MaterialDO::getUnit, reqVO.getUnit())
.eqIfPresent(MaterialDO::getSizeInfo, reqVO.getSizeInfo())
.eqIfPresent(MaterialDO::getCompositionId, reqVO.getCompositionId())
.eqIfPresent(MaterialDO::getInvUpperLimit, reqVO.getInvUpperLimit())
.eqIfPresent(MaterialDO::getInvLowerLimit, reqVO.getInvLowerLimit())
.eqIfPresent(MaterialDO::getTraceType, reqVO.getTraceType())
.eqIfPresent(MaterialDO::getVirsualPart, reqVO.getVirsualPart())
.eqIfPresent(MaterialDO::getMainFrom, reqVO.getMainFrom())
.eqIfPresent(MaterialDO::getDftStoreWh, reqVO.getDftStoreWh())
.eqIfPresent(MaterialDO::getDftStoreRg, reqVO.getDftStoreRg())
.eqIfPresent(MaterialDO::getDftStorePn, reqVO.getDftStorePn())
.eqIfPresent(MaterialDO::getDftRoute, reqVO.getDftRoute())
.eqIfPresent(MaterialDO::getDftPack, reqVO.getDftPack())
.eqIfPresent(MaterialDO::getDescription, reqVO.getDescription())
.betweenIfPresent(MaterialDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(MaterialDO::getStatus, reqVO.getStatus())
.orderByDesc(MaterialDO::getId));
}
}

@ -0,0 +1,55 @@
package com.chanko.yunxi.mes.module.heli.service.composition;
import java.util.*;
import javax.validation.*;
import com.chanko.yunxi.mes.module.heli.controller.admin.composition.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.composition.CompositionDO;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
/**
* Service
*
* @author
*/
public interface CompositionService {
/**
*
*
* @param createReqVO
* @return
*/
Long createComposition(@Valid CompositionSaveReqVO createReqVO);
/**
*
*
* @param updateReqVO
*/
void updateComposition(@Valid CompositionSaveReqVO updateReqVO);
/**
*
*
* @param id
*/
void deleteComposition(Long id);
/**
*
*
* @param id
* @return
*/
CompositionDO getComposition(Long id);
/**
*
*
* @param pageReqVO
* @return
*/
PageResult<CompositionDO> getCompositionPage(CompositionPageReqVO pageReqVO);
}

@ -0,0 +1,74 @@
package com.chanko.yunxi.mes.module.heli.service.composition;
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.composition.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.composition.CompositionDO;
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.composition.CompositionMapper;
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 CompositionServiceImpl implements CompositionService {
@Resource
private CompositionMapper compositionMapper;
@Override
public Long createComposition(CompositionSaveReqVO createReqVO) {
// 插入
CompositionDO composition = BeanUtils.toBean(createReqVO, CompositionDO.class);
compositionMapper.insert(composition);
// 返回
return composition.getId();
}
@Override
public void updateComposition(CompositionSaveReqVO updateReqVO) {
// 校验存在
validateCompositionExists(updateReqVO.getId());
// 更新
CompositionDO updateObj = BeanUtils.toBean(updateReqVO, CompositionDO.class);
compositionMapper.updateById(updateObj);
}
@Override
public void deleteComposition(Long id) {
// 校验存在
validateCompositionExists(id);
// 删除
compositionMapper.deleteById(id);
}
private void validateCompositionExists(Long id) {
if (compositionMapper.selectById(id) == null) {
throw exception(COMPOSITION_NOT_EXISTS);
}
}
@Override
public CompositionDO getComposition(Long id) {
return compositionMapper.selectById(id);
}
@Override
public PageResult<CompositionDO> getCompositionPage(CompositionPageReqVO pageReqVO) {
return compositionMapper.selectPage(pageReqVO);
}
}

@ -0,0 +1,55 @@
package com.chanko.yunxi.mes.module.heli.service.material;
import java.util.*;
import javax.validation.*;
import com.chanko.yunxi.mes.module.heli.controller.admin.material.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.material.MaterialDO;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
/**
* Service
*
* @author
*/
public interface MaterialService {
/**
*
*
* @param createReqVO
* @return
*/
Long createMaterial(@Valid MaterialSaveReqVO createReqVO);
/**
*
*
* @param updateReqVO
*/
void updateMaterial(@Valid MaterialSaveReqVO updateReqVO);
/**
*
*
* @param id
*/
void deleteMaterial(Long id);
/**
*
*
* @param id
* @return
*/
MaterialDO getMaterial(Long id);
/**
*
*
* @param pageReqVO
* @return
*/
PageResult<MaterialDO> getMaterialPage(MaterialPageReqVO pageReqVO);
}

@ -0,0 +1,74 @@
package com.chanko.yunxi.mes.module.heli.service.material;
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.material.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.material.MaterialDO;
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.material.MaterialMapper;
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 MaterialServiceImpl implements MaterialService {
@Resource
private MaterialMapper materialMapper;
@Override
public Long createMaterial(MaterialSaveReqVO createReqVO) {
// 插入
MaterialDO material = BeanUtils.toBean(createReqVO, MaterialDO.class);
materialMapper.insert(material);
// 返回
return material.getId();
}
@Override
public void updateMaterial(MaterialSaveReqVO updateReqVO) {
// 校验存在
validateMaterialExists(updateReqVO.getId());
// 更新
MaterialDO updateObj = BeanUtils.toBean(updateReqVO, MaterialDO.class);
materialMapper.updateById(updateObj);
}
@Override
public void deleteMaterial(Long id) {
// 校验存在
validateMaterialExists(id);
// 删除
materialMapper.deleteById(id);
}
private void validateMaterialExists(Long id) {
if (materialMapper.selectById(id) == null) {
throw exception(MATERIAL_NOT_EXISTS);
}
}
@Override
public MaterialDO getMaterial(Long id) {
return materialMapper.selectById(id);
}
@Override
public PageResult<MaterialDO> getMaterialPage(MaterialPageReqVO pageReqVO) {
return materialMapper.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.composition.CompositionMapper">
<!--
一般情况下,尽可能使用 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.material.MaterialMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

@ -0,0 +1,42 @@
import request from '@/config/axios'
export interface CompositionVO {
id: number
name: string
code: string
type: string
density: number
densityUnit: string
description: string
status: number
}
// 查询材质分页
export const getCompositionPage = async (params) => {
return await request.get({ url: `/heli/composition/page`, params })
}
// 查询材质详情
export const getComposition = async (id: number) => {
return await request.get({ url: `/heli/composition/get?id=` + id })
}
// 新增材质
export const createComposition = async (data: CompositionVO) => {
return await request.post({ url: `/heli/composition/create`, data })
}
// 修改材质
export const updateComposition = async (data: CompositionVO) => {
return await request.put({ url: `/heli/composition/update`, data })
}
// 删除材质
export const deleteComposition = async (id: number) => {
return await request.delete({ url: `/heli/composition/delete?id=` + id })
}
// 导出材质 Excel
export const exportComposition = async (params) => {
return await request.download({ url: `/heli/composition/export-excel`, params })
}

@ -0,0 +1,55 @@
import request from '@/config/axios'
export interface MaterialVO {
id: number
code: string
name: string
brand: string
spec: string
materialType: string
unit: string
sizeInfo: string
compositionId: number
invUpperLimit: number
invLowerLimit: number
traceType: number
virsualPart: string
mainFrom: number
dftStoreWh: number
dftStoreRg: number
dftStorePn: number
dftRoute: number
dftPack: number
description: string
status: number
}
// 查询物料分页
export const getMaterialPage = async (params) => {
return await request.get({ url: `/heli/material/page`, params })
}
// 查询物料详情
export const getMaterial = async (id: number) => {
return await request.get({ url: `/heli/material/get?id=` + id })
}
// 新增物料
export const createMaterial = async (data: MaterialVO) => {
return await request.post({ url: `/heli/material/create`, data })
}
// 修改物料
export const updateMaterial = async (data: MaterialVO) => {
return await request.put({ url: `/heli/material/update`, data })
}
// 删除物料
export const deleteMaterial = async (id: number) => {
return await request.delete({ url: `/heli/material/delete?id=` + id })
}
// 导出物料 Excel
export const exportMaterial = async (params) => {
return await request.download({ url: `/heli/material/export-excel`, params })
}

@ -0,0 +1,125 @@
<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="name">
<el-input v-model="formData.name" placeholder="请输入材质名" />
</el-form-item>
<el-form-item label="材质代号" prop="code">
<el-input v-model="formData.code" placeholder="请输入材质代号" />
</el-form-item>
<el-form-item label="类型" prop="type">
<el-select v-model="formData.type" placeholder="请选择类型">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="密度" prop="density">
<el-input v-model="formData.density" placeholder="请输入密度" />
</el-form-item>
<el-form-item label="密度单位" prop="densityUnit">
<el-input v-model="formData.densityUnit" placeholder="请输入密度单位" />
</el-form-item>
<el-form-item label="描述" prop="description">
<Editor v-model="formData.description" height="150px" />
</el-form-item>
<el-form-item label="状态,1表示正常2表示禁用" prop="status">
<el-radio-group v-model="formData.status">
<el-radio label="1">请选择字典生成</el-radio>
</el-radio-group>
</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 * as CompositionApi from '@/api/heli/composition'
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,
name: undefined,
code: undefined,
type: undefined,
density: undefined,
densityUnit: undefined,
description: undefined,
status: undefined,
})
const formRules = reactive({
name: [{ required: true, message: '材质名不能为空', trigger: 'blur' }],
type: [{ required: true, message: '类型不能为空', trigger: 'change' }],
status: [{ required: true, message: '状态,1表示正常2表示禁用不能为空', 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 CompositionApi.getComposition(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 CompositionApi.CompositionVO
if (formType.value === 'create') {
await CompositionApi.createComposition(data)
message.success(t('common.createSuccess'))
} else {
await CompositionApi.updateComposition(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
name: undefined,
code: undefined,
type: undefined,
density: undefined,
densityUnit: undefined,
description: undefined,
status: undefined,
}
formRef.value?.resetFields()
}
</script>

@ -0,0 +1,245 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="68px"
>
<el-form-item label="材质名" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入材质名"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="材质代号" prop="code">
<el-input
v-model="queryParams.code"
placeholder="请输入材质代号"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="类型" prop="type">
<el-select
v-model="queryParams.type"
placeholder="请选择类型"
clearable
class="!w-240px"
>
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="密度" prop="density">
<el-input
v-model="queryParams.density"
placeholder="请输入密度"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="密度单位" prop="densityUnit">
<el-input
v-model="queryParams.densityUnit"
placeholder="请输入密度单位"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="状态,1表示正常2表示禁用" prop="status">
<el-select
v-model="queryParams.status"
placeholder="请选择状态,1表示正常2表示禁用"
clearable
class="!w-240px"
>
<el-option label="请选择字典生成" 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:composition:create']"
>
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<el-button
type="success"
plain
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['heli:composition: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="name" />
<el-table-column label="材质代号" align="center" prop="code" />
<el-table-column label="类型" align="center" prop="type" />
<el-table-column label="密度" align="center" prop="density" />
<el-table-column label="密度单位" align="center" prop="densityUnit" />
<el-table-column label="描述" align="center" prop="description" />
<el-table-column label="状态,1表示正常2表示禁用" align="center" prop="status" />
<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:composition:update']"
>
编辑
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['heli:composition: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>
<!-- 表单弹窗添加/修改 -->
<CompositionForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import * as CompositionApi from '@/api/heli/composition'
import CompositionForm from './CompositionForm.vue'
defineOptions({ name: 'Composition' })
const message = useMessage() //
const { t } = useI18n() //
const loading = ref(true) //
const list = ref([]) //
const total = ref(0) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
name: undefined,
code: undefined,
type: undefined,
density: undefined,
densityUnit: undefined,
description: undefined,
status: undefined,
createTime: [],
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await CompositionApi.getCompositionPage(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 CompositionApi.deleteComposition(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await CompositionApi.exportComposition(queryParams)
download.excel(data, '材质.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 **/
onMounted(() => {
getList()
})
</script>

@ -0,0 +1,194 @@
<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="code">
<el-input v-model="formData.code" placeholder="请输入物料编码" />
</el-form-item>
<el-form-item label="物料名称" prop="name">
<el-input v-model="formData.name" placeholder="请输入物料名称" />
</el-form-item>
<el-form-item label="品牌" prop="brand">
<el-input v-model="formData.brand" placeholder="请输入品牌" />
</el-form-item>
<el-form-item label="规格" prop="spec">
<el-input v-model="formData.spec" placeholder="请输入规格" />
</el-form-item>
<el-form-item label="物料分类 零件|半成品|模具 1 2 3" prop="materialType">
<el-select v-model="formData.materialType" placeholder="请选择物料分类 零件|半成品|模具 1 2 3">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="主要单位" prop="unit">
<el-input v-model="formData.unit" placeholder="请输入主要单位" />
</el-form-item>
<el-form-item label="尺寸信息" prop="sizeInfo">
<el-input v-model="formData.sizeInfo" placeholder="请输入尺寸信息" />
</el-form-item>
<el-form-item label="材质id" prop="compositionId">
<el-input v-model="formData.compositionId" placeholder="请输入材质id" />
</el-form-item>
<el-form-item label="库存预警上限" prop="invUpperLimit">
<el-input v-model="formData.invUpperLimit" placeholder="请输入库存预警上限" />
</el-form-item>
<el-form-item label="库存预警下限" prop="invLowerLimit">
<el-input v-model="formData.invLowerLimit" placeholder="请输入库存预警下限" />
</el-form-item>
<el-form-item label="管控方式,只有两种值分别是1和2,1表示单个管理2表示批次管理" prop="traceType">
<el-select v-model="formData.traceType" placeholder="请选择管控方式,只有两种值分别是1和2,1表示单个管理2表示批次管理">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="虚拟物料标识只能填写Y和NY表示虚拟物料N表示反之" prop="virsualPart">
<el-input v-model="formData.virsualPart" placeholder="请输入虚拟物料标识只能填写Y和NY表示虚拟物料N表示反之" />
</el-form-item>
<el-form-item label="物料主要来源,只有三种值分别是123,其中1表示自制2表示外购3表示委外加工" prop="mainFrom">
<el-input v-model="formData.mainFrom" placeholder="请输入物料主要来源,只有三种值分别是123,其中1表示自制2表示外购3表示委外加工" />
</el-form-item>
<el-form-item label="默认保存的仓库对应仓库表中的Id" prop="dftStoreWh">
<el-input v-model="formData.dftStoreWh" placeholder="请输入默认保存的仓库对应仓库表中的Id" />
</el-form-item>
<el-form-item label="默认保存的库区对应库区表中的Id" prop="dftStoreRg">
<el-input v-model="formData.dftStoreRg" placeholder="请输入默认保存的库区对应库区表中的Id" />
</el-form-item>
<el-form-item label="默认保存的库位对应库位表中的Id" prop="dftStorePn">
<el-input v-model="formData.dftStorePn" placeholder="请输入默认保存的库位对应库位表中的Id" />
</el-form-item>
<el-form-item label="默认工艺路线对应工艺路线表中的Id" prop="dftRoute">
<el-input v-model="formData.dftRoute" placeholder="请输入默认工艺路线对应工艺路线表中的Id" />
</el-form-item>
<el-form-item label="默认包装方式对应包装方式表中的Id" prop="dftPack">
<el-input v-model="formData.dftPack" placeholder="请输入默认包装方式对应包装方式表中的Id" />
</el-form-item>
<el-form-item label="物料描述" prop="description">
<Editor v-model="formData.description" height="150px" />
</el-form-item>
<el-form-item label="状态,1表示正常2表示禁用" prop="status">
<el-radio-group v-model="formData.status">
<el-radio label="1">请选择字典生成</el-radio>
</el-radio-group>
</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 * as MaterialApi from '@/api/heli/material'
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,
code: undefined,
name: undefined,
brand: undefined,
spec: undefined,
materialType: undefined,
unit: undefined,
sizeInfo: undefined,
compositionId: undefined,
invUpperLimit: undefined,
invLowerLimit: undefined,
traceType: undefined,
virsualPart: undefined,
mainFrom: undefined,
dftStoreWh: undefined,
dftStoreRg: undefined,
dftStorePn: undefined,
dftRoute: undefined,
dftPack: undefined,
description: undefined,
status: undefined,
})
const formRules = reactive({
code: [{ required: true, message: '物料编码不能为空', trigger: 'blur' }],
name: [{ required: true, message: '物料名称不能为空', trigger: 'blur' }],
materialType: [{ required: true, message: '物料分类 零件|半成品|模具 1 2 3不能为空', trigger: 'change' }],
compositionId: [{ required: true, message: '材质id不能为空', trigger: 'blur' }],
status: [{ required: true, message: '状态,1表示正常2表示禁用不能为空', 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 MaterialApi.getMaterial(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 MaterialApi.MaterialVO
if (formType.value === 'create') {
await MaterialApi.createMaterial(data)
message.success(t('common.createSuccess'))
} else {
await MaterialApi.updateMaterial(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
code: undefined,
name: undefined,
brand: undefined,
spec: undefined,
materialType: undefined,
unit: undefined,
sizeInfo: undefined,
compositionId: undefined,
invUpperLimit: undefined,
invLowerLimit: undefined,
traceType: undefined,
virsualPart: undefined,
mainFrom: undefined,
dftStoreWh: undefined,
dftStoreRg: undefined,
dftStorePn: undefined,
dftRoute: undefined,
dftPack: undefined,
description: undefined,
status: undefined,
}
formRef.value?.resetFields()
}
</script>

@ -0,0 +1,389 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="68px"
>
<el-form-item label="物料编码" prop="code">
<el-input
v-model="queryParams.code"
placeholder="请输入物料编码"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="物料名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入物料名称"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="品牌" prop="brand">
<el-input
v-model="queryParams.brand"
placeholder="请输入品牌"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="规格" prop="spec">
<el-input
v-model="queryParams.spec"
placeholder="请输入规格"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="物料分类 零件|半成品|模具 1 2 3" prop="materialType">
<el-select
v-model="queryParams.materialType"
placeholder="请选择物料分类 零件|半成品|模具 1 2 3"
clearable
class="!w-240px"
>
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="主要单位" prop="unit">
<el-input
v-model="queryParams.unit"
placeholder="请输入主要单位"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="尺寸信息" prop="sizeInfo">
<el-input
v-model="queryParams.sizeInfo"
placeholder="请输入尺寸信息"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="材质id" prop="compositionId">
<el-input
v-model="queryParams.compositionId"
placeholder="请输入材质id"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="库存预警上限" prop="invUpperLimit">
<el-input
v-model="queryParams.invUpperLimit"
placeholder="请输入库存预警上限"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="库存预警下限" prop="invLowerLimit">
<el-input
v-model="queryParams.invLowerLimit"
placeholder="请输入库存预警下限"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="管控方式,只有两种值分别是1和2,1表示单个管理2表示批次管理" prop="traceType">
<el-select
v-model="queryParams.traceType"
placeholder="请选择管控方式,只有两种值分别是1和2,1表示单个管理2表示批次管理"
clearable
class="!w-240px"
>
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="虚拟物料标识只能填写Y和NY表示虚拟物料N表示反之" prop="virsualPart">
<el-input
v-model="queryParams.virsualPart"
placeholder="请输入虚拟物料标识只能填写Y和NY表示虚拟物料N表示反之"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="物料主要来源,只有三种值分别是123,其中1表示自制2表示外购3表示委外加工" prop="mainFrom">
<el-input
v-model="queryParams.mainFrom"
placeholder="请输入物料主要来源,只有三种值分别是123,其中1表示自制2表示外购3表示委外加工"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="默认保存的仓库对应仓库表中的Id" prop="dftStoreWh">
<el-input
v-model="queryParams.dftStoreWh"
placeholder="请输入默认保存的仓库对应仓库表中的Id"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="默认保存的库区对应库区表中的Id" prop="dftStoreRg">
<el-input
v-model="queryParams.dftStoreRg"
placeholder="请输入默认保存的库区对应库区表中的Id"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="默认保存的库位对应库位表中的Id" prop="dftStorePn">
<el-input
v-model="queryParams.dftStorePn"
placeholder="请输入默认保存的库位对应库位表中的Id"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="默认工艺路线对应工艺路线表中的Id" prop="dftRoute">
<el-input
v-model="queryParams.dftRoute"
placeholder="请输入默认工艺路线对应工艺路线表中的Id"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="默认包装方式对应包装方式表中的Id" prop="dftPack">
<el-input
v-model="queryParams.dftPack"
placeholder="请输入默认包装方式对应包装方式表中的Id"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</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 label="状态,1表示正常2表示禁用" prop="status">
<el-select
v-model="queryParams.status"
placeholder="请选择状态,1表示正常2表示禁用"
clearable
class="!w-240px"
>
<el-option label="请选择字典生成" value="" />
</el-select>
</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:create']"
>
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<el-button
type="success"
plain
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['heli:material: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="code" />
<el-table-column label="物料名称" align="center" prop="name" />
<el-table-column label="品牌" align="center" prop="brand" />
<el-table-column label="规格" align="center" prop="spec" />
<el-table-column label="物料分类 零件|半成品|模具 1 2 3" align="center" prop="materialType" />
<el-table-column label="主要单位" align="center" prop="unit" />
<el-table-column label="尺寸信息" align="center" prop="sizeInfo" />
<el-table-column label="材质id" align="center" prop="compositionId" />
<el-table-column label="库存预警上限" align="center" prop="invUpperLimit" />
<el-table-column label="库存预警下限" align="center" prop="invLowerLimit" />
<el-table-column label="管控方式,只有两种值分别是1和2,1表示单个管理2表示批次管理" align="center" prop="traceType" />
<el-table-column label="虚拟物料标识只能填写Y和NY表示虚拟物料N表示反之" align="center" prop="virsualPart" />
<el-table-column label="物料主要来源,只有三种值分别是123,其中1表示自制2表示外购3表示委外加工" align="center" prop="mainFrom" />
<el-table-column label="默认保存的仓库对应仓库表中的Id" align="center" prop="dftStoreWh" />
<el-table-column label="默认保存的库区对应库区表中的Id" align="center" prop="dftStoreRg" />
<el-table-column label="默认保存的库位对应库位表中的Id" align="center" prop="dftStorePn" />
<el-table-column label="默认工艺路线对应工艺路线表中的Id" align="center" prop="dftRoute" />
<el-table-column label="默认包装方式对应包装方式表中的Id" align="center" prop="dftPack" />
<el-table-column label="物料描述" align="center" prop="description" />
<el-table-column
label="创建时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
width="180px"
/>
<el-table-column label="状态,1表示正常2表示禁用" align="center" prop="status" />
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button
link
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['heli:material:update']"
>
编辑
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['heli:material: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>
<!-- 表单弹窗添加/修改 -->
<MaterialForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import * as MaterialApi from '@/api/heli/material'
import MaterialForm from './MaterialForm.vue'
defineOptions({ name: 'Material' })
const message = useMessage() //
const { t } = useI18n() //
const loading = ref(true) //
const list = ref([]) //
const total = ref(0) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
code: undefined,
name: undefined,
brand: undefined,
spec: undefined,
materialType: undefined,
unit: undefined,
sizeInfo: undefined,
compositionId: undefined,
invUpperLimit: undefined,
invLowerLimit: undefined,
traceType: undefined,
virsualPart: undefined,
mainFrom: undefined,
dftStoreWh: undefined,
dftStoreRg: undefined,
dftStorePn: undefined,
dftRoute: undefined,
dftPack: undefined,
description: undefined,
createTime: [],
status: undefined,
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await MaterialApi.getMaterialPage(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 MaterialApi.deleteMaterial(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await MaterialApi.exportMaterial(queryParams)
download.excel(data, '物料.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 **/
onMounted(() => {
getList()
})
</script>
Loading…
Cancel
Save