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
@@ -1,9 +1,13 @@
package com.cf.imes.module.system.api.machine;
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.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.service.lable.LabelService;
import com.cf.imes.module.system.service.machine.MachineService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
@@ -22,6 +26,9 @@ public class MachineApiImpl implements MachineApi {
@Resource
private MachineService machineService;
@Resource
private LabelService labelService;
@Override
public CommonResult<CuttingRespDTO> getCutting(Long id) {
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) {
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);
}
}