1.新增获取机台与标签详情rpc接口,2.定义获取生产单源数据接口

This commit is contained in:
yangsb
2024-04-09 17:08:10 +08:00
parent 0903907e65
commit 8661826538
6 changed files with 121 additions and 1 deletions
@@ -2,8 +2,10 @@ package com.cf.imes.module.executor.controller.admin.plan;
import com.cf.imes.framework.common.pojo.CommonResult; import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.framework.operatelog.core.annotations.OperateLog; import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
import com.cf.imes.module.executor.controller.admin.plan.bo.OrderSource;
import com.cf.imes.module.executor.controller.admin.plan.vo.*; import com.cf.imes.module.executor.controller.admin.plan.vo.*;
import com.cf.imes.module.executor.service.optimizeplan.OptimizePlanService; import com.cf.imes.module.executor.service.optimizeplan.OptimizePlanService;
import com.cf.imes.module.executor.util.RandomUtils;
import com.cf.imes.module.system.api.dataSource.DataSourceApi; import com.cf.imes.module.system.api.dataSource.DataSourceApi;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
@@ -88,6 +90,13 @@ public class OptimizePlanController {
return CommonResult.success(optimizePlanParam); return CommonResult.success(optimizePlanParam);
} }
@GetMapping("/getOrderSource")
@Operation(summary = "获取生产单源数据 - mock")
@PreAuthorize("@ss.hasPermission('executor:optimize-plate:create')")
public CommonResult<OrderSource> getOrderSource(@RequestParam(required = false) Long orderId, @RequestParam(required = false) Long plateId) {
return CommonResult.success(RandomUtils.randomPojo(OrderSource.class));
}
@GetMapping("/getLabelDataSourceValue") @GetMapping("/getLabelDataSourceValue")
@Operation(summary = "获取标签数据源value") @Operation(summary = "获取标签数据源value")
@@ -0,0 +1,46 @@
package com.cf.imes.module.executor.controller.admin.plan.bo;
import com.cf.imes.module.executor.controller.admin.plan.vo.OptimizeParamRespVO;
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateDetailVO;
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
import com.cf.imes.module.executor.dal.dataobject.plan.PlanDO;
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
import com.cf.imes.module.system.api.machine.dto.MachineDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author Beal
* 生产单源数据对象
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class OrderSource {
@Schema(description = "机台数据")
private MachineDTO machineDTO;
@Schema(description = "排单数据")
private OptimizeParamRespVO planDO;
@Schema(description = "生产单列表")
private List<OrderDO> orders;
@Schema(description = "商品板材列表")
private List<GoodsDO> goods;
@Schema(description = "小板列表")
private List<PlateDO> plates;
@Schema(description = "小板详情列表")
private List<PlateDetailVO> plateDetails;
}
@@ -31,7 +31,7 @@ public class PlateDetailVO {
private Boolean newVersion; private Boolean newVersion;
@Schema(description = "原始点详情列表") @Schema(description = "原始点详情列表")
private List<OldPointDetail> olgPointDetailList; private List<OldPointDetail> oldPointDetailList;
@Schema(description = "开料尺寸") @Schema(description = "开料尺寸")
private KaiLiaoSize kaiLiaoSize; private KaiLiaoSize kaiLiaoSize;
@@ -2,6 +2,7 @@ package com.cf.imes.module.system.api.machine;
import com.cf.imes.framework.common.pojo.CommonResult; import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.module.system.api.machine.dto.CuttingRespDTO; import com.cf.imes.module.system.api.machine.dto.CuttingRespDTO;
import com.cf.imes.module.system.api.machine.dto.MachineDTO;
import com.cf.imes.module.system.enums.ApiConstants; import com.cf.imes.module.system.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
@@ -36,4 +37,9 @@ public interface MachineApi {
@Parameter(name = "ids", description = "机台id", example = "1024", required = true) @Parameter(name = "ids", description = "机台id", example = "1024", required = true)
CommonResult<List<CuttingRespDTO>> list(@RequestParam("ids") Collection<Long> ids); CommonResult<List<CuttingRespDTO>> list(@RequestParam("ids") Collection<Long> ids);
@GetMapping(PREFIX + "/get-machine-detail")
@Operation(summary = "获得机台详情")
@Parameter(name = "id", description = "机台id", example = "1024", required = true)
CommonResult<MachineDTO> getMachineDetail(@RequestParam("id") Long id);
} }
@@ -0,0 +1,38 @@
package com.cf.imes.module.system.api.machine.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
/**
* @author Beal
*
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class MachineDTO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "14092")
private Long id;
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
private String name;
@Schema(description = "1机台设备 2CNC设备", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
private Integer machineType;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
@Schema(description = "机台配置")
private String setting;
@Schema(description = "标签配置")
private String label;
}
@@ -1,9 +1,13 @@
package com.cf.imes.module.system.api.machine; package com.cf.imes.module.system.api.machine;
import com.cf.imes.framework.common.pojo.CommonResult; import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.framework.common.util.json.JsonUtils;
import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.framework.common.util.object.BeanUtils;
import com.cf.imes.module.system.api.machine.dto.CuttingRespDTO; import com.cf.imes.module.system.api.machine.dto.CuttingRespDTO;
import com.cf.imes.module.system.api.machine.dto.MachineDTO;
import com.cf.imes.module.system.controller.admin.label.vo.LabelRespVO;
import com.cf.imes.module.system.controller.admin.machine.vo.CuttingRespVO; import com.cf.imes.module.system.controller.admin.machine.vo.CuttingRespVO;
import com.cf.imes.module.system.service.lable.LabelService;
import com.cf.imes.module.system.service.machine.MachineService; import com.cf.imes.module.system.service.machine.MachineService;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@@ -22,6 +26,9 @@ public class MachineApiImpl implements MachineApi {
@Resource @Resource
private MachineService machineService; private MachineService machineService;
@Resource
private LabelService labelService;
@Override @Override
public CommonResult<CuttingRespDTO> getCutting(Long id) { public CommonResult<CuttingRespDTO> getCutting(Long id) {
return success(BeanUtils.toBean(machineService.getCutting(id), CuttingRespDTO.class)); return success(BeanUtils.toBean(machineService.getCutting(id), CuttingRespDTO.class));
@@ -36,4 +43,18 @@ public class MachineApiImpl implements MachineApi {
public CommonResult<List<CuttingRespDTO>> list(Collection<Long> ids) { public CommonResult<List<CuttingRespDTO>> list(Collection<Long> ids) {
return success(BeanUtils.toBean(machineService.list(ids), CuttingRespDTO.class)); return success(BeanUtils.toBean(machineService.list(ids), CuttingRespDTO.class));
} }
@Override
public CommonResult<MachineDTO> getMachineDetail(Long id) {
CuttingRespVO cutting = machineService.getCutting(id);
LabelRespVO label = labelService.getLabel(cutting.getLabelId());
MachineDTO machineDTO = MachineDTO.builder()
.id(cutting.getId())
.machineType(cutting.getMachineType())
.name(cutting.getName())
.setting(cutting.getMachineSettingDO().toJSONString())
.label(JsonUtils.toJsonString(label))
.build();
return success(machineDTO);
}
} }