1.新增余料板关联相关增删改查接口,2.修复机台部分字段类型

This commit is contained in:
yangsb
2024-03-22 16:16:33 +08:00
parent 1d1982e6a9
commit bb178dcfab
9 changed files with 494 additions and 4 deletions
@@ -0,0 +1,95 @@
package com.cf.imes.module.executor.controller.admin.remainplate;
import com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO;
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.cf.imes.framework.common.pojo.PageParam;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.framework.common.util.object.BeanUtils;
import static com.cf.imes.framework.common.pojo.CommonResult.success;
import com.cf.imes.framework.excel.core.util.ExcelUtils;
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.*;
import com.cf.imes.module.executor.controller.admin.remainplate.vo.*;
import com.cf.imes.module.executor.service.remainplate.RemainPlateService;
@Tag(name = "管理后台 - 生产单余料板表 order_remain_plate_{N}")
@RestController
@RequestMapping("/executor/remain-plate")
@Validated
public class RemainPlateController {
@Resource
private RemainPlateService remainPlateService;
@PostMapping("/create")
@Operation(summary = "创建生产单余料板表}")
@PreAuthorize("@ss.hasPermission('executor:remain-plate:create')")
public CommonResult<Long> createRemainPlate(@Valid @RequestBody RemainPlateSaveReqVO createReqVO) {
return success(remainPlateService.createRemainPlate(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新生产单余料板表")
@PreAuthorize("@ss.hasPermission('executor:remain-plate:update')")
public CommonResult<Boolean> updateRemainPlate(@Valid @RequestBody RemainPlateSaveReqVO updateReqVO) {
remainPlateService.updateRemainPlate(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除生产单余料板表")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('executor:remain-plate:delete')")
public CommonResult<Boolean> deleteRemainPlate(@RequestParam("id") Long id) {
remainPlateService.deleteRemainPlate(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得生产单余料板表")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('executor:remain-plate:query')")
public CommonResult<RemainPlateRespVO> getRemainPlate(@RequestParam("id") Long id) {
RemainPlateDO remainPlate = remainPlateService.getRemainPlate(id);
return success(BeanUtils.toBean(remainPlate, RemainPlateRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得生产单余料板表 order_remain_plate分页")
@PreAuthorize("@ss.hasPermission('executor:remain-plate:query')")
public CommonResult<PageResult<RemainPlateRespVO>> getRemainPlatePage(@Valid RemainPlatePageReqVO pageReqVO) {
PageResult<RemainPlateDO> pageResult = remainPlateService.getRemainPlatePage(pageReqVO);
return success(BeanUtils.toBean(pageResult, RemainPlateRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出生产单余料板表 Excel")
@PreAuthorize("@ss.hasPermission('executor:remain-plate:export')")
@OperateLog(type = EXPORT)
public void exportRemainPlateExcel(@Valid RemainPlatePageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<RemainPlateDO> list = remainPlateService.getRemainPlatePage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "生产单余料板表.xls", "数据", RemainPlateRespVO.class,
BeanUtils.toBean(list, RemainPlateRespVO.class));
}
}
@@ -0,0 +1,71 @@
package com.cf.imes.module.executor.controller.admin.remainplate.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.cf.imes.framework.common.pojo.PageParam;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 生产单余料板表 order_remain_plate_{N}分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class RemainPlatePageReqVO extends PageParam {
@Schema(description = "排单 ID", example = "14125")
private Long planId;
@Schema(description = "初始排单 ID", example = "28810")
private Long initPlanId;
@Schema(description = "余料板状态,0未使用,1使用中,2已使用", example = "1")
private Integer status;
@Schema(description = "商品 ID", example = "16139")
private String goodsId;
@Schema(description = "商品名", example = "王五")
private String name;
@Schema(description = "材料")
private String material;
@Schema(description = "颜色")
private String color;
@Schema(description = "宽度")
private BigDecimal width;
@Schema(description = "长度")
private BigDecimal length;
@Schema(description = "厚度")
private BigDecimal thickness;
@Schema(description = "品牌")
private String brand;
@Schema(description = "放置样式,0正面,1正面右转,2正面后转,3正面左转,4反面,5反面右转,6反面后转,7反面左转")
private Integer placeStyle;
@Schema(description = "仓库名")
private String store;
@Schema(description = "数量", example = "5334")
private Integer count;
@Schema(description = "备注", example = "随便")
private String remark;
@Schema(description = "轮廊数据,Json 串")
private String outline;
@Schema(description = "创建日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}
@@ -0,0 +1,89 @@
package com.cf.imes.module.executor.controller.admin.remainplate.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 = "管理后台 - 生产单余料板表 order_remain_plate_{N} Response VO")
@Data
@ExcelIgnoreUnannotated
public class RemainPlateRespVO {
@Schema(description = "余料板 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25869")
@ExcelProperty("余料板 ID")
private Long id;
@Schema(description = "排单 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14125")
@ExcelProperty("排单 ID")
private Long planId;
@Schema(description = "初始排单 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "28810")
@ExcelProperty("初始排单 ID")
private Long initPlanId;
@Schema(description = "余料板状态,0未使用,1使用中,2已使用", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("余料板状态,0未使用,1使用中,2已使用")
private Integer status;
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16139")
@ExcelProperty("商品 ID")
private String goodsId;
@Schema(description = "商品名", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
@ExcelProperty("商品名")
private String name;
@Schema(description = "材料", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("材料")
private String material;
@Schema(description = "颜色", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("颜色")
private String color;
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("宽度")
private BigDecimal width;
@Schema(description = "长度", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("长度")
private BigDecimal length;
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("厚度")
private BigDecimal thickness;
@Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("品牌")
private String brand;
@Schema(description = "放置样式,0正面,1正面右转,2正面后转,3正面左转,4反面,5反面右转,6反面后转,7反面左转", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("放置样式,0正面,1正面右转,2正面后转,3正面左转,4反面,5反面右转,6反面后转,7反面左转")
private Integer placeStyle;
@Schema(description = "仓库名", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("仓库名")
private String store;
@Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "5334")
@ExcelProperty("数量")
private Integer count;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "随便")
@ExcelProperty("备注")
private String remark;
@Schema(description = "轮廊数据,Json 串", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("轮廊数据,Json 串")
private String outline;
@Schema(description = "创建日期", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建日期")
private LocalDateTime createTime;
}
@@ -0,0 +1,80 @@
package com.cf.imes.module.executor.controller.admin.remainplate.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
import java.math.BigDecimal;
@Schema(description = "管理后台 - 生产单余料板表 order_remain_plate_{N}新增/修改 Request VO")
@Data
public class RemainPlateSaveReqVO {
@Schema(description = "余料板 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25869")
private Long id;
@Schema(description = "排单 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14125")
@NotNull(message = "排单 ID不能为空")
private Long planId;
@Schema(description = "初始排单 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "28810")
@NotNull(message = "初始排单 ID不能为空")
private Long initPlanId;
@Schema(description = "余料板状态,0未使用,1使用中,2已使用", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "余料板状态,0未使用,1使用中,2已使用不能为空")
private Integer status;
@Schema(description = "商品 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16139")
@NotEmpty(message = "商品 ID不能为空")
private String goodsId;
@Schema(description = "商品名", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
@NotEmpty(message = "商品名不能为空")
private String name;
@Schema(description = "材料", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "材料不能为空")
private String material;
@Schema(description = "颜色", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "颜色不能为空")
private String color;
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "宽度不能为空")
private BigDecimal width;
@Schema(description = "长度", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "长度不能为空")
private BigDecimal length;
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "厚度不能为空")
private BigDecimal thickness;
@Schema(description = "品牌", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "品牌不能为空")
private String brand;
@Schema(description = "放置样式,0正面,1正面右转,2正面后转,3正面左转,4反面,5反面右转,6反面后转,7反面左转", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "放置样式,0正面,1正面右转,2正面后转,3正面左转,4反面,5反面右转,6反面后转,7反面左转不能为空")
private Integer placeStyle;
@Schema(description = "仓库名", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "仓库名不能为空")
private String store;
@Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "5334")
@NotNull(message = "数量不能为空")
private Integer count;
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "随便")
@NotEmpty(message = "备注不能为空")
private String remark;
@Schema(description = "轮廊数据,Json 串", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "轮廊数据,Json 串不能为空")
private String outline;
}
@@ -1,10 +1,35 @@
package com.cf.imes.module.executor.dal.mysql.remainplaten;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cf.imes.module.executor.controller.admin.remainplate.vo.RemainPlatePageReqVO;
import com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface RemainPlateMapper extends BaseMapperX<RemainPlateDO> {
default PageResult<RemainPlateDO> selectPage(RemainPlatePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<RemainPlateDO>()
.eqIfPresent(RemainPlateDO::getPlanId, reqVO.getPlanId())
.eqIfPresent(RemainPlateDO::getInitPlanId, reqVO.getInitPlanId())
.eqIfPresent(RemainPlateDO::getStatus, reqVO.getStatus())
.eqIfPresent(RemainPlateDO::getGoodsId, reqVO.getGoodsId())
.likeIfPresent(RemainPlateDO::getName, reqVO.getName())
.eqIfPresent(RemainPlateDO::getMaterial, reqVO.getMaterial())
.eqIfPresent(RemainPlateDO::getColor, reqVO.getColor())
.eqIfPresent(RemainPlateDO::getWidth, reqVO.getWidth())
.eqIfPresent(RemainPlateDO::getLength, reqVO.getLength())
.eqIfPresent(RemainPlateDO::getThickness, reqVO.getThickness())
.eqIfPresent(RemainPlateDO::getBrand, reqVO.getBrand())
.eqIfPresent(RemainPlateDO::getPlaceStyle, reqVO.getPlaceStyle())
.eqIfPresent(RemainPlateDO::getStore, reqVO.getStore())
.eqIfPresent(RemainPlateDO::getCount, reqVO.getCount())
.eqIfPresent(RemainPlateDO::getRemark, reqVO.getRemark())
.eqIfPresent(RemainPlateDO::getOutline, reqVO.getOutline())
.betweenIfPresent(RemainPlateDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(RemainPlateDO::getId));
}
}
@@ -0,0 +1,55 @@
package com.cf.imes.module.executor.service.remainplate;
import java.util.*;
import javax.validation.*;
import com.cf.imes.module.executor.controller.admin.remainplate.vo.*;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.pojo.PageParam;
import com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO;
/**
* 生产单余料板表 order_remain_plate_{N} Service 接口
*
* @author 晨丰科技
*/
public interface RemainPlateService {
/**
* 创建生产单余料板表 order_remain_plate_{N}
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createRemainPlate(@Valid RemainPlateSaveReqVO createReqVO);
/**
* 更新生产单余料板表 order_remain_plate_{N}
*
* @param updateReqVO 更新信息
*/
void updateRemainPlate(@Valid RemainPlateSaveReqVO updateReqVO);
/**
* 删除生产单余料板表 order_remain_plate_{N}
*
* @param id 编号
*/
void deleteRemainPlate(Long id);
/**
* 获得生产单余料板表 order_remain_plate_{N}
*
* @param id 编号
* @return 生产单余料板表 order_remain_plate_{N}
*/
RemainPlateDO getRemainPlate(Long id);
/**
* 获得生产单余料板表 order_remain_plate_{N}分页
*
* @param pageReqVO 分页查询
* @return 生产单余料板表 order_remain_plate_{N}分页
*/
PageResult<RemainPlateDO> getRemainPlatePage(RemainPlatePageReqVO pageReqVO);
}
@@ -0,0 +1,75 @@
package com.cf.imes.module.executor.service.remainplate;
import com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO;
import com.cf.imes.module.executor.dal.mysql.remainplaten.RemainPlateMapper;
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.cf.imes.module.executor.controller.admin.remainplate.vo.*;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.pojo.PageParam;
import com.cf.imes.framework.common.util.object.BeanUtils;
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
import static com.cf.imes.module.system.enums.ErrorCodeConstants.REMAIN_PLATE_NOT_EXISTS;
/**
* 生产单余料板表 order_remain_plate_{N} Service 实现类
*
* @author 晨丰科技
*/
@Service
@Validated
public class RemainPlateServiceImpl implements RemainPlateService {
@Resource
private RemainPlateMapper remainPlateMapper;
@Override
public Long createRemainPlate(RemainPlateSaveReqVO createReqVO) {
// 插入
RemainPlateDO remainPlate = BeanUtils.toBean(createReqVO, RemainPlateDO.class);
remainPlateMapper.insert(remainPlate);
// 返回
return remainPlate.getId();
}
@Override
public void updateRemainPlate(RemainPlateSaveReqVO updateReqVO) {
// 校验存在
validateRemainPlateExists(updateReqVO.getId());
// 更新
RemainPlateDO updateObj = BeanUtils.toBean(updateReqVO, RemainPlateDO.class);
remainPlateMapper.updateById(updateObj);
}
@Override
public void deleteRemainPlate(Long id) {
// 校验存在
validateRemainPlateExists(id);
// 删除
remainPlateMapper.deleteById(id);
}
private void validateRemainPlateExists(Long id) {
if (remainPlateMapper.selectById(id) == null) {
throw exception(REMAIN_PLATE_NOT_EXISTS);
}
}
@Override
public RemainPlateDO getRemainPlate(Long id) {
return remainPlateMapper.selectById(id);
}
@Override
public PageResult<RemainPlateDO> getRemainPlatePage(RemainPlatePageReqVO pageReqVO) {
return remainPlateMapper.selectPage(pageReqVO);
}
}
@@ -63,7 +63,7 @@ public class CuttingSettingDO extends ESDocument {
@Schema(description = "钻孔延时条件-孔直径上限")
private Double drillingDelayConditionMaxDiameter;
@Schema(description = "钻孔延时指令")
private Double drillingDelayInstruction;
private String drillingDelayInstruction;
@Schema(description = "默认40,安全高度")
private Integer freeHeight;
@@ -164,7 +164,7 @@ public class CuttingSettingDO extends ESDocument {
@Schema(description = "KnifeList")
private List<KnifeListBean> knifeList;
@Schema(description = "默认{0}_{1}_{2},导出zip文件名")
private String exportOrderPathName;
private List<String> exportOrderPathName;
@Schema(description = "大板NC正(A)面文件名")
private String largePlateNcPositiveFileName;
@Schema(description = "大板NC反(B)面文件名")
@@ -198,7 +198,7 @@ public class CuttingSettingDO extends ESDocument {
@Schema(description = "上料代码插入到NC文件头前")
private Boolean insertLoadingCodeAtFileHeader;
@Schema(description = "上料代码")
private Boolean loadingCode;
private String loadingCode;
@Schema(description = "大板NC正(A)面文件头")
private String largePlateNcPositiveFileHeader;
@Schema(description = "大板NC正(A)面文件尾")
@@ -66,7 +66,7 @@ public class CuttingTemplateMachineDO extends ESDocument {
@Schema(description = "钻孔延时条件-孔直径上限")
private Double drillingDelayConditionMaxDiameter;
@Schema(description = "钻孔延时指令")
private Double drillingDelayInstruction;
private String drillingDelayInstruction;
@Schema(description = "默认40,安全高度")
private Integer freeHeight;