领料出库 试产质检录入
parent
43ae36a62f
commit
d2ace5a57e
@ -0,0 +1,106 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.zjproductrecord;
|
||||
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.zjproduct.ZjProductDO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.mes.controller.admin.zjproductrecord.vo.*;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.zjproductrecord.ZjProductRecordDO;
|
||||
import cn.iocoder.yudao.module.mes.service.zjproductrecord.ZjProductRecordService;
|
||||
|
||||
@Tag(name = "管理后台 - 试产质检记录")
|
||||
@RestController
|
||||
@RequestMapping("/mes/zj-product-record")
|
||||
@Validated
|
||||
public class ZjProductRecordController {
|
||||
|
||||
@Resource
|
||||
private ZjProductRecordService zjProductRecordService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建试产质检记录")
|
||||
// @PreAuthorize("@ss.hasPermission('mes:zj-product-record:create')")
|
||||
public CommonResult<Long> createZjProductRecord(@Valid @RequestBody ZjProductRecordSaveReqVO createReqVO) {
|
||||
return success(zjProductRecordService.createZjProductRecord(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新试产质检记录")
|
||||
// @PreAuthorize("@ss.hasPermission('mes:zj-product-record:update')")
|
||||
public CommonResult<Boolean> updateZjProductRecord(@Valid @RequestBody ZjProductRecordSaveReqVO updateReqVO) {
|
||||
zjProductRecordService.updateZjProductRecord(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/updateBatch")
|
||||
@Operation(summary = "批量更新试产质检记录")
|
||||
@PreAuthorize("@ss.hasPermission('erp:product:update')")
|
||||
public CommonResult<Boolean> updateZjProductRecordBatch(@Valid @RequestBody List<ZjProductRecordSaveReqVO> updateReqVOList) {
|
||||
for (ZjProductRecordSaveReqVO source : updateReqVOList) {
|
||||
zjProductRecordService.updateZjProductRecord(source);
|
||||
}
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除试产质检记录")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
// @PreAuthorize("@ss.hasPermission('mes:zj-product-record:delete')")
|
||||
public CommonResult<Boolean> deleteZjProductRecord(@RequestParam("id") Long id) {
|
||||
zjProductRecordService.deleteZjProductRecord(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得试产质检记录")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('erp:product:query')")
|
||||
public CommonResult<ZjProductRecordRespVO> getZjProductRecord(@RequestParam("id") Long id) {
|
||||
ZjProductRecordDO zjProductRecord = zjProductRecordService.getZjProductRecord(id);
|
||||
return success(BeanUtils.toBean(zjProductRecord, ZjProductRecordRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得试产质检记录分页")
|
||||
@PreAuthorize("@ss.hasPermission('erp:product:query')")
|
||||
public CommonResult<PageResult<ZjProductRecordRespVO>> getZjProductRecordPage(@Valid ZjProductRecordPageReqVO pageReqVO) {
|
||||
PageResult<ZjProductRecordDO> pageResult = zjProductRecordService.getZjProductRecordPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, ZjProductRecordRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出试产质检记录 Excel")
|
||||
// @PreAuthorize("@ss.hasPermission('mes:zj-product-record:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportZjProductRecordExcel(@Valid ZjProductRecordPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<ZjProductRecordDO> list = zjProductRecordService.getZjProductRecordPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "试产质检记录.xls", "数据", ZjProductRecordRespVO.class,
|
||||
BeanUtils.toBean(list, ZjProductRecordRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.zjproductrecord.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 试产质检记录分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ZjProductRecordPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "工序", example = "2")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "名称", example = "赵六")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "单位")
|
||||
private String unit;
|
||||
|
||||
@Schema(description = "上限值")
|
||||
private Double upperVal;
|
||||
|
||||
@Schema(description = "下限值")
|
||||
private Double lowerVal;
|
||||
|
||||
@Schema(description = "关联产品id", example = "6649")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "关联计划id", example = "13611")
|
||||
private Long planId;
|
||||
|
||||
@Schema(description = "实际值", example = "你猜")
|
||||
private String realVal;
|
||||
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.zjproductrecord.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
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 ZjProductRecordRespVO {
|
||||
|
||||
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "5254")
|
||||
@ExcelProperty("ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "工序", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("工序")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
@ExcelProperty("名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "单位")
|
||||
@ExcelProperty("单位")
|
||||
private String unit;
|
||||
|
||||
@Schema(description = "上限值")
|
||||
@ExcelProperty("上限值")
|
||||
private Double upperVal;
|
||||
|
||||
@Schema(description = "下限值")
|
||||
@ExcelProperty("下限值")
|
||||
private Double lowerVal;
|
||||
|
||||
@Schema(description = "关联产品id", requiredMode = Schema.RequiredMode.REQUIRED, example = "6649")
|
||||
@ExcelProperty("关联产品id")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "关联计划id", example = "13611")
|
||||
@ExcelProperty("关联计划id")
|
||||
private Long planId;
|
||||
|
||||
@Schema(description = "实际值", example = "你猜")
|
||||
@ExcelProperty("实际值")
|
||||
private String realVal;
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
package cn.iocoder.yudao.module.mes.controller.admin.zjproductrecord.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 试产质检记录新增/修改 Request VO")
|
||||
@Data
|
||||
public class ZjProductRecordSaveReqVO {
|
||||
|
||||
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "5254")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "工序", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotEmpty(message = "工序不能为空")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
@NotEmpty(message = "名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "单位")
|
||||
private String unit;
|
||||
|
||||
@Schema(description = "上限值")
|
||||
private Double upperVal;
|
||||
|
||||
@Schema(description = "下限值")
|
||||
private Double lowerVal;
|
||||
|
||||
@Schema(description = "关联产品id", requiredMode = Schema.RequiredMode.REQUIRED, example = "6649")
|
||||
@NotNull(message = "关联产品id不能为空")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "实际值", example = "你猜")
|
||||
private String realVal;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "关联计划id", example = "13611")
|
||||
private Long planId;
|
||||
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package cn.iocoder.yudao.module.mes.dal.dataobject.zjproductrecord;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 试产质检记录 DO
|
||||
*
|
||||
* @author 内蒙必硕
|
||||
*/
|
||||
@TableName("mes_zj_product_record")
|
||||
@KeySequence("mes_zj_product_record_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ZjProductRecordDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 工序
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
/**
|
||||
* 上限值
|
||||
*/
|
||||
private Double upperVal;
|
||||
/**
|
||||
* 下限值
|
||||
*/
|
||||
private Double lowerVal;
|
||||
/**
|
||||
* 关联产品id
|
||||
*/
|
||||
private Long productId;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 关联计划id
|
||||
*/
|
||||
private Long planId;
|
||||
|
||||
/**
|
||||
* 实际值
|
||||
*/
|
||||
private String realVal;
|
||||
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.mes.dal.mysql.zjproductrecord;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.zjproductrecord.ZjProductRecordDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.mes.controller.admin.zjproductrecord.vo.*;
|
||||
|
||||
/**
|
||||
* 试产质检记录 Mapper
|
||||
*
|
||||
* @author 内蒙必硕
|
||||
*/
|
||||
@Mapper
|
||||
public interface ZjProductRecordMapper extends BaseMapperX<ZjProductRecordDO> {
|
||||
|
||||
default PageResult<ZjProductRecordDO> selectPage(ZjProductRecordPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ZjProductRecordDO>()
|
||||
.eqIfPresent(ZjProductRecordDO::getType, reqVO.getType())
|
||||
.likeIfPresent(ZjProductRecordDO::getName, reqVO.getName())
|
||||
.eqIfPresent(ZjProductRecordDO::getUnit, reqVO.getUnit())
|
||||
.eqIfPresent(ZjProductRecordDO::getUpperVal, reqVO.getUpperVal())
|
||||
.eqIfPresent(ZjProductRecordDO::getLowerVal, reqVO.getLowerVal())
|
||||
.eqIfPresent(ZjProductRecordDO::getProductId, reqVO.getProductId())
|
||||
.eqIfPresent(ZjProductRecordDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(ZjProductRecordDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(ZjProductRecordDO::getPlanId, reqVO.getPlanId())
|
||||
.orderByDesc(ZjProductRecordDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.mes.service.zjproductrecord;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.mes.controller.admin.zjproductrecord.vo.*;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.zjproductrecord.ZjProductRecordDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 试产质检记录 Service 接口
|
||||
*
|
||||
* @author 内蒙必硕
|
||||
*/
|
||||
public interface ZjProductRecordService {
|
||||
|
||||
/**
|
||||
* 创建试产质检记录
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createZjProductRecord(@Valid ZjProductRecordSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新试产质检记录
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateZjProductRecord(@Valid ZjProductRecordSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除试产质检记录
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteZjProductRecord(Long id);
|
||||
|
||||
/**
|
||||
* 获得试产质检记录
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 试产质检记录
|
||||
*/
|
||||
ZjProductRecordDO getZjProductRecord(Long id);
|
||||
|
||||
/**
|
||||
* 获得试产质检记录分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 试产质检记录分页
|
||||
*/
|
||||
PageResult<ZjProductRecordDO> getZjProductRecordPage(ZjProductRecordPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
package cn.iocoder.yudao.module.mes.service.zjproductrecord;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.mes.controller.admin.zjproductrecord.vo.*;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.zjproductrecord.ZjProductRecordDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.mes.dal.mysql.zjproductrecord.ZjProductRecordMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 试产质检记录 Service 实现类
|
||||
*
|
||||
* @author 内蒙必硕
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ZjProductRecordServiceImpl implements ZjProductRecordService {
|
||||
|
||||
@Resource
|
||||
private ZjProductRecordMapper zjProductRecordMapper;
|
||||
|
||||
@Override
|
||||
public Long createZjProductRecord(ZjProductRecordSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
ZjProductRecordDO zjProductRecord = BeanUtils.toBean(createReqVO, ZjProductRecordDO.class);
|
||||
zjProductRecordMapper.insert(zjProductRecord);
|
||||
// 返回
|
||||
return zjProductRecord.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateZjProductRecord(ZjProductRecordSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateZjProductRecordExists(updateReqVO.getId());
|
||||
// 更新
|
||||
ZjProductRecordDO updateObj = BeanUtils.toBean(updateReqVO, ZjProductRecordDO.class);
|
||||
zjProductRecordMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteZjProductRecord(Long id) {
|
||||
// 校验存在
|
||||
validateZjProductRecordExists(id);
|
||||
// 删除
|
||||
zjProductRecordMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateZjProductRecordExists(Long id) {
|
||||
if (zjProductRecordMapper.selectById(id) == null) {
|
||||
throw exception(ZJ_PRODUCT_RECORD_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ZjProductRecordDO getZjProductRecord(Long id) {
|
||||
return zjProductRecordMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ZjProductRecordDO> getZjProductRecordPage(ZjProductRecordPageReqVO pageReqVO) {
|
||||
return zjProductRecordMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue