机台删除,工序加工,排单加工时间,排单数据筛选Bug修改

This commit is contained in:
liuzhaotian
2024-07-08 18:25:20 +08:00
parent 03cce64688
commit fbb57ab252
37 changed files with 522 additions and 79 deletions
@@ -1,6 +1,7 @@
package com.cf.imes.module.system.api.process;
import com.cf.imes.module.system.api.process.dto.ProcessDTO;
import com.cf.imes.module.system.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@@ -10,6 +11,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.math.BigDecimal;
import java.util.List;
@FeignClient(name = ApiConstants.NAME) // TODO 晨丰:fallbackFactory =
@Tag(name = "RPC 服务 - 工序")
@@ -21,9 +23,13 @@ public interface ProcessApi {
@GetMapping(PREFIX + "/getProcess")
@Operation(summary = "查看当前工序的信息")
// @Parameter(name = "processId", description = "工序ID", required = true, example = "1024")
BigDecimal getProcess(/*@RequestParam("processId") Long processId*/);
@Parameter(name = "processId", description = "工序ID", required = true, example = "1024")
BigDecimal getProcess(@RequestParam("processId") Long processId);
@GetMapping(PREFIX + "/getUserProcess")
@Operation(summary = "查看当前工序的信息")
@Parameter(name = "userId", description = "用户ID", required = true, example = "1")
List<ProcessDTO> getUserProcess(@RequestParam("userId") Long userId);
}
@@ -0,0 +1,28 @@
package com.cf.imes.module.system.api.process.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;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ProcessDTO {
@Schema(description = "工序ID")
private Long id;
@Schema(description = "工序名称")
private String name;
@Schema(description = "工序类型")
private Integer type;
}
@@ -208,6 +208,7 @@ public interface ErrorCodeConstants {
ErrorCode DEFAULT_TEMPLATE_NOT_DELETED = new ErrorCode(1_002_029_004, "不能删除默认模板");
ErrorCode NOT_TEMPLATE_AUTH = new ErrorCode(1_002_029_005, "该组织无此机台模板权限");
ErrorCode NOT_MACHINE_AUTH = new ErrorCode(1_002_029_005, "该组织无此机台权限");
ErrorCode THE_CURRENT_MACHINE_IS_ALREADY_IN_USE = new ErrorCode(1_002_029_005, "当前机台已使用,禁止删除");
// ========== 标签模板 1-002-300-000 ==========
ErrorCode LABEL_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_300_000, "标签模板不存在");
@@ -2,6 +2,9 @@ package com.cf.imes.module.system.api.process;
import com.cf.imes.framework.common.enums.ProcessProcessingTypeEnum;
import com.cf.imes.framework.common.util.object.BeanUtils;
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
import com.cf.imes.module.system.api.process.dto.ProcessDTO;
import com.cf.imes.module.system.dal.dataobject.process.ProcessDO;
import com.cf.imes.module.system.dal.mysql.process.ProcessMapper;
import org.springframework.validation.annotation.Validated;
@@ -10,6 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
@@ -27,9 +31,9 @@ public class ProcessApiImpl implements ProcessApi {
@Override
public BigDecimal getProcess() {
public BigDecimal getProcess(Long processId) {
ProcessDO processDO = processMapper.selectByType(ProcessProcessingTypeEnum.COMPONENTPROCESSING.getNumber(),getUserOrganId());
ProcessDO processDO = processMapper.selectByType(processId,getUserOrganId());
return processDO == null ? BigDecimal.ZERO : processDO.getPieceRate();
@@ -37,5 +41,16 @@ public class ProcessApiImpl implements ProcessApi {
@Override
public List<ProcessDTO> getUserProcess(Long userId) {
List<ProcessDO> processDOS = processMapper.selectProcessList(getUserOrganId(), userId)
.stream()
.filter(f-> Objects.equals(f.getType(),ProcessProcessingTypeEnum.CUTTINGMATERIALS.getNumber()))
.toList();
return BeanUtils.toBean(processDOS,ProcessDTO.class);
}
}
@@ -69,10 +69,10 @@ public interface ProcessMapper extends BaseMapperX<ProcessDO> {
default ProcessDO selectByType(Integer number,Long organId) {
default ProcessDO selectByType(Long processId,Long organId) {
return selectOne(new MPJLambdaWrapperX<ProcessDO>()
.eq(ProcessDO::getOrganId, organId)
.eqIfPresent(ProcessDO::getType,number));
.eqIfPresent(ProcessDO::getId,processId));
}
@@ -1,12 +1,13 @@
package com.cf.imes.module.system.framework.rpc.config;
import com.cf.imes.module.executor.api.orderProcess.OrderProcessApi;
import com.cf.imes.module.executor.api.plan.OrderPlanApi;
import com.cf.imes.module.infra.api.file.FileApi;
import com.cf.imes.module.infra.api.websocket.WebSocketSenderApi;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Configuration;
@Configuration(proxyBeanMethods = false)
@EnableFeignClients(clients = {FileApi.class, WebSocketSenderApi.class, OrderProcessApi.class})
@EnableFeignClients(clients = {FileApi.class, WebSocketSenderApi.class, OrderProcessApi.class, OrderPlanApi.class})
public class RpcConfiguration {
}
@@ -17,6 +17,7 @@ import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cf.imes.framework.organ.core.aop.OrganIgnore;
import com.cf.imes.framework.security.core.LoginUser;
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
import com.cf.imes.module.executor.api.plan.OrderPlanApi;
import com.cf.imes.module.system.controller.admin.machine.vo.*;
import com.cf.imes.module.system.convert.machine.MachineConvert;
import com.cf.imes.module.system.dal.dataobject.machine.DrillSettingDO;
@@ -77,6 +78,9 @@ public class MachineServiceImpl implements MachineService {
@Resource
private MachineTemplateLimitMapper machineTemplateLimitMapper;
@Resource
private OrderPlanApi orderPlanApi;
@Override
@Transactional(rollbackFor = Exception.class)
public Long createCutting(CuttingSaveReqVO createReqVO) {
@@ -119,6 +123,10 @@ public class MachineServiceImpl implements MachineService {
if (machineDO == null) {
throw exception(MACHINE_NOT_EXISTS);
}
// 校验当前机台是否使用
if(orderPlanApi.getOrderPlan(id).getData()){
throw exception(THE_CURRENT_MACHINE_IS_ALREADY_IN_USE);
}
machineMapper.deleteById(id);
}
@@ -3,6 +3,7 @@ package com.cf.imes.module.system.service.process;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;;
import com.cf.imes.framework.common.enums.ProcessProcessingTypeEnum;
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
import com.cf.imes.module.system.controller.admin.process.vo.process.*;
@@ -233,7 +234,11 @@ public class ProcessServiceImpl implements ProcessService {
// 获取组织id
Long organId = OrganContextHolder.getOrganId();
return processMapper.selectProcessList(organId,userId);
return processMapper.selectProcessList(organId,userId)
.stream()
.filter(f-> (!Objects.equals(f.getType(), ProcessProcessingTypeEnum.CUTTINGMATERIALS.getNumber())))
.toList();
}