质量管理模块代码提交(PDA接口)
parent
aeb72a2501
commit
cfb55019ae
@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>org.dromara</groupId>
|
||||||
|
<artifactId>ruoyi-api</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>hwmom-api-pda</artifactId>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
hwmom-api-pda PDA接口模块
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- RuoYi Common Core-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.dromara</groupId>
|
||||||
|
<artifactId>ruoyi-common-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.dromara</groupId>
|
||||||
|
<artifactId>ruoyi-common-excel</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,20 @@
|
|||||||
|
package org.dromara.pda.api;
|
||||||
|
|
||||||
|
import org.dromara.common.core.exception.user.UserException;
|
||||||
|
import org.dromara.pda.api.model.BaseMaterial;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface RemotePdaMesApiService {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param materialCode
|
||||||
|
* @param tenantId
|
||||||
|
* @return
|
||||||
|
* @throws UserException
|
||||||
|
*/
|
||||||
|
BaseMaterial remoteQueryByMaterialCode(String materialCode , String tenantId) throws UserException;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package org.dromara.pda.api;
|
||||||
|
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.core.exception.user.UserException;
|
||||||
|
import org.dromara.pda.api.model.vo.RemoteDefectVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public interface RemotePdaQmsApiService {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param defectType 缺陷类型
|
||||||
|
* @param tenantId 租户编号
|
||||||
|
* @return
|
||||||
|
* @throws UserException
|
||||||
|
*/
|
||||||
|
List<RemoteDefectVo> remoteQueryDefectList(String defectType , String tenantId) throws UserException;
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package org.dromara.common.core.exception.pda;
|
||||||
|
|
||||||
|
import org.dromara.common.core.exception.base.BaseException;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
public class PdaServiceException extends BaseException {
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public PdaServiceException(String code, Object... args) {
|
||||||
|
super("materialCode", code, args, null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
package org.dromara.api.controller;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dromara.api.service.IPdaApiService;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.pda.api.model.BaseMaterial;
|
||||||
|
import org.dromara.pda.api.model.vo.RemoteDefectVo;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生产信息
|
||||||
|
* 前端访问路由地址为:/mes/prodPlanDetailApi
|
||||||
|
*
|
||||||
|
* @author Yangwl
|
||||||
|
* @date 2025-01-02
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/pdaApi")
|
||||||
|
public class PdaApiController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private final IPdaApiService iPdaApiService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PDA获取物料信息接口
|
||||||
|
*/
|
||||||
|
@GetMapping(value = {"/getMaterialInfo/{MaterialCode}"})
|
||||||
|
public BaseMaterial getMaterialInfo(@PathVariable(value = "MaterialCode", required = false) String MaterialCode) {
|
||||||
|
return iPdaApiService.getMaterialInfo(MaterialCode);
|
||||||
|
}
|
||||||
|
@GetMapping("/getDefectDetail")
|
||||||
|
public List<RemoteDefectVo> getDefectDetail(@NotBlank(message = "{defect.type.not.blank}") String defectType) {
|
||||||
|
return iPdaApiService.getDefectDetail(defectType);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package org.dromara.api.service;
|
||||||
|
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.pda.api.model.BaseMaterial;
|
||||||
|
import org.dromara.pda.api.model.vo.RemoteDefectVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API物料Service接口
|
||||||
|
*
|
||||||
|
* @author Yinq
|
||||||
|
* @date 2025-01-02
|
||||||
|
*/
|
||||||
|
public interface IPdaApiService {
|
||||||
|
|
||||||
|
BaseMaterial getMaterialInfo(String materialCode);
|
||||||
|
|
||||||
|
List<RemoteDefectVo> getDefectDetail(String defectType);
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package org.dromara.api.service.impl;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
|
import org.dromara.api.service.IPdaApiService;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.pda.api.RemotePdaMesApiService;
|
||||||
|
import org.dromara.pda.api.RemotePdaQmsApiService;
|
||||||
|
import org.dromara.pda.api.model.BaseMaterial;
|
||||||
|
import org.dromara.pda.api.model.vo.RemoteDefectVo;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class IPdaApiServiceImpl implements IPdaApiService {
|
||||||
|
@DubboReference
|
||||||
|
private final RemotePdaMesApiService remotePdaMesApiService;
|
||||||
|
@DubboReference
|
||||||
|
private final RemotePdaQmsApiService remotePdaQmsApiService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseMaterial getMaterialInfo(String materialCode) {
|
||||||
|
return remotePdaMesApiService.remoteQueryByMaterialCode(materialCode,"000000");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RemoteDefectVo> getDefectDetail(String defectType) {
|
||||||
|
return remotePdaQmsApiService.remoteQueryDefectList(defectType,"000000");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package org.dromara.mes.dubbo;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
|
import org.dromara.common.core.exception.user.UserException;
|
||||||
|
import org.dromara.common.tenant.helper.TenantHelper;
|
||||||
|
import org.dromara.mes.mapper.BaseMaterialInfoMapper;
|
||||||
|
import org.dromara.pda.api.RemotePdaMesApiService;
|
||||||
|
import org.dromara.pda.api.model.BaseMaterial;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
@DubboService
|
||||||
|
public class RemoteQmsApiServiceImpl implements RemotePdaMesApiService {
|
||||||
|
|
||||||
|
private final BaseMaterialInfoMapper baseMaterialInfoMapper ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseMaterial remoteQueryByMaterialCode(String materialCode, String tenantId) throws UserException {
|
||||||
|
return TenantHelper.dynamic(tenantId, () -> {
|
||||||
|
|
||||||
|
BaseMaterial baseMaterial=baseMaterialInfoMapper.queryByMaterialCode(materialCode);
|
||||||
|
|
||||||
|
//BaseMaterialInfoVo sysUser = baseMaterialInfoMapper.selectVoOne(new LambdaQueryWrapper<BaseMaterialInfo>().eq(BaseMaterialInfo::getMaterialCode, materialCode));
|
||||||
|
if (ObjectUtil.isNull(baseMaterial)) {
|
||||||
|
throw new UserException("materialCode.not.exit", materialCode);
|
||||||
|
}
|
||||||
|
// if (UserStatus.DISABLE.getCode().equals(sysUser.getStatus())) {
|
||||||
|
// throw new UserException("user.blocked", username);
|
||||||
|
// }
|
||||||
|
|
||||||
|
return baseMaterial;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,62 @@
|
|||||||
|
package org.dromara.qms.dubbo;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.core.exception.user.UserException;
|
||||||
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
|
import org.dromara.common.tenant.helper.TenantHelper;
|
||||||
|
import org.dromara.pda.api.RemotePdaMesApiService;
|
||||||
|
import org.dromara.pda.api.RemotePdaQmsApiService;
|
||||||
|
import org.dromara.pda.api.model.BaseMaterial;
|
||||||
|
import org.dromara.pda.api.model.vo.RemoteDefectVo;
|
||||||
|
import org.dromara.qms.domain.QcDefectDetail;
|
||||||
|
import org.dromara.qms.domain.bo.QcDefectDetailBo;
|
||||||
|
import org.dromara.qms.domain.vo.QcDefectDetailVo;
|
||||||
|
import org.dromara.qms.mapper.QcDefectDetailMapper;
|
||||||
|
import org.dromara.qms.mapper.QcDefectInfoMapper;
|
||||||
|
import org.dromara.qms.service.IQcDefectDetailService;
|
||||||
|
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
@DubboService
|
||||||
|
public class RemoteQmsApiServiceImpl implements RemotePdaQmsApiService {
|
||||||
|
|
||||||
|
private final QcDefectInfoMapper qcDefectInfoMapper;
|
||||||
|
private final QcDefectDetailMapper qcDefectDetailMapper;
|
||||||
|
private final IQcDefectDetailService iQcDefectDetailService;
|
||||||
|
/**
|
||||||
|
* 获取缺陷数据接口
|
||||||
|
* @param defectType 缺陷类型
|
||||||
|
* @param tenantId 租户编号
|
||||||
|
* @return
|
||||||
|
* @throws UserException
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<RemoteDefectVo> remoteQueryDefectList(String defectType, String tenantId) throws UserException {
|
||||||
|
return TenantHelper.dynamic(tenantId, () -> {
|
||||||
|
QcDefectDetailBo bo=new QcDefectDetailBo();
|
||||||
|
bo.setDefectType(defectType);
|
||||||
|
bo.setTenantId("000000");
|
||||||
|
List<QcDefectDetailVo> DefectDetailVos = iQcDefectDetailService.queryList(bo);
|
||||||
|
RemoteDefectVo rem=new RemoteDefectVo();
|
||||||
|
List<RemoteDefectVo> remoteDefectVoList=new ArrayList<>();
|
||||||
|
for(QcDefectDetailVo qcDefectDetailVo:DefectDetailVos){
|
||||||
|
rem.setDefectCode(qcDefectDetailVo.getDefectCode());
|
||||||
|
rem.setDefectDesc(qcDefectDetailVo.getDefectDesc());
|
||||||
|
remoteDefectVoList.add(rem);
|
||||||
|
}
|
||||||
|
return remoteDefectVoList;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue