Merge branch 'dev_temp_xw_202505150000_46824' into dev_temp_xw_20250624_ncdev

# Conflicts:
#	modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesBoxingErrorProofingService.java
dev_temp_xw_20250624_ncdev
xiangwei.zhang 4 weeks ago
commit e2d9af5960

@ -36,4 +36,7 @@ public interface IMesInputDefectRecordService {
@ApiOperation(value = "可疑品录入")
void saveSusPartInspection(MesPartInspectionInputModel model, String org);
@ApiOperation(value = "电子化检验检测次数卡控")
void checkProductSnInspection(String organizeCode, String partNo, String sn);
}

@ -1,6 +1,7 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.controller.busi;
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesReworkTaskService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionRecordService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesReworkTaskModel;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesReworkTaskRequestModel;
@ -33,6 +34,9 @@ public class MesReworkTaskController {
@Autowired
private IMesReworkTaskService mesReworkTaskService;
@Autowired
private IMesProductionRecordService mesProductionRecordService;
@GetMapping("/query-pager")
@ApiOperation(value = "查询所有返工单")
public ResultBean queryReworkTaskByPager(MesReworkTask reworkTask, Pager pager) {
@ -192,4 +196,19 @@ public class MesReworkTaskController {
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
@GetMapping("/queryProductionRecord")
@ApiOperation(value = "查询加工记录")
public ResultBean queryProductionRecord(MesReworkTaskRequestModel requestModel) {
// 数据校验
ValidatorBean.checkNotNull(requestModel.getSn(), "条码不能为空");
ValidatorBean.checkNotNull(requestModel.getOrganizeCode(), "工厂代码不能为空");
try {
return ResultBean.success("查询成功").setResultObject(mesProductionRecordService.findProductionRecordList(requestModel.getOrganizeCode(),requestModel.getSn()));
} catch (ImppBusiException imppException) {
return ResultBean.fail(imppException);
} catch (Exception e) {
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
}

@ -868,7 +868,10 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService {
}
public void doRecursionCheck(List<MesProductionAssemblyModel> assemblyModelList,String organizeCode,String userName,String destLocate,String responsibleParty){
Set<Long> recordIds = new HashSet<>();
Set<Long> notScrapRecordIds = new HashSet<>();
for (MesProductionAssemblyModel assemblyModel : assemblyModelList) {
recordIds.add(assemblyModel.getProductionRecordId());
//勾选
if (assemblyModel.getFlag() == CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) {
//报废
@ -888,6 +891,7 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService {
doRecursionCheck(assemblyModel.getChildren(),organizeCode,userName,destLocate,responsibleParty);
}
} else if (assemblyModel.getFlag() == CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()) {
notScrapRecordIds.add(assemblyModel.getProductionRecordId());
//装配解绑
saveProductionAssembly(organizeCode, userName, assemblyModel.getId());
//自制件更新条码状态 条码状态可用
@ -899,6 +903,14 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService {
}
}
}
// 加工记录下的所有装配件都做了报废之后需要将加工记录软删掉。
for (Long recordId : recordIds) {
if (notScrapRecordIds.contains(recordId)) {
continue;
}
productionRecordRepository.deleteWeaklyById(recordId, userName);
}
}
private void updateProductSn(MesReworkTaskRequestModel requestModel, MesProductionAssembly assembly, MesProductionAssemblyContext context) {

@ -1,9 +1,6 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesBoxingErrorProofingService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesConfigService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProduceSnExtService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionRecordService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.*;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException;
import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
@ -79,6 +76,9 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer
private IMesProductionRecordService mesProductionRecordService;
@Autowired
private IMesInputDefectRecordService defectRecordService;
@Autowired
private MesCustomerPartRepository mesCustomerPartRDao;
@Autowired
@ -175,6 +175,9 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer
}
//校验条码规则
MesPart mesPart = getMesPartNew(mesPackageDetail, mesPackage, packingDefine);
if (Objects.equals(packingDefine.getIsCheckInspectionRecord(), CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue())) {
defectRecordService.checkProductSnInspection(mesPackageDetail.getOrganizeCode(), mesPart.getPartNo(), mesPackageDetail.getSerialNumber());
}
//包装规格明细
MesPackageDetail saveMesPackageDetail = getPackageDetail(mesPackageDetail, mesPart, packingDefine);
if (mesPackageDetail.getIsMemoryBoolean()) {

@ -16,6 +16,7 @@ import cn.estsh.i3plus.mes.pcn.api.iservice.busi.ISyncFuncService;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
import cn.estsh.i3plus.platform.common.tool.TimeTool;
import cn.estsh.i3plus.platform.common.util.MesConstWords;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
@ -129,6 +130,12 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
@Autowired
private MesPartProdGroupRepository mesPartProdGroupRao;
@Autowired
private MesWorkCellRepository workCellRDao;
@Autowired
private MesWorkCenterRepository mesWorkCenterRDao;
@Override
public MesPartInspectionViewModel queryPartInspection(MesPartInspectionInputModel model) {
@ -142,6 +149,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
ValidatorBean.checkNotNull(model.getFrontBack(), "正反面不能为空");
//检查条码
MesProduceSn produceSn = checkProduceSn(model.getSn(), model.getOrganizeCode());
checkOtherWorkCell(produceSn, model, model.getOrganizeCode());
//获取NC-零件检测-单据
partInspection = getPartInspection(produceSn, model, model.getOrganizeCode());
@ -249,7 +257,6 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
if (!StringUtil.isEmpty(produceSn)){
model.setCustSn(produceSn.getCustSn());
model.setSn(produceSn.getProductSn());
model.setWorkCenterCode(produceSn.getWorkCenterCode());
//排序产线 更新工单的 qcStatus
MesWorkCenter centerDb = prodOrgExtService.getWorkCenterDb(model.getOrganizeCode(), produceSn.getWorkCenterCode());
if (!StringUtil.isEmpty(centerDb)){
@ -306,7 +313,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
}
}
final Integer workCellType = getPartInspectionType(model.getOrganizeCode(), model.getWorkCenterCode(), model.getWorkCellCode());
//零件检测详情为空,则代表本次校验为合格。
if (CollectionUtils.isEmpty(model.getPartInspectionDetailList())) {
MesPartInspection partInspection = null;
@ -321,6 +328,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
if (model.getOptType() != null && model.getOptType() == 2) {
partInspection.setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
}
partInspection.setInspectionType(workCellType);
partInspection = partInspectionRepository.save(partInspection);
if (model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) {
@ -371,6 +379,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
if (model.getOptType() != null && model.getOptType() == 2) {
model.getPartInspection().setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
}
model.getPartInspection().setInspectionType(workCellType);
partInspectionRepository.save(model.getPartInspection());
//查询当前单据明细
@ -484,7 +493,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
if (model.getOptType() != null && model.getOptType() == 2) {
partInspection.setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
}
partInspection.setInspectionType(workCellType);
model.setPartInspection(partInspectionRepository.save(partInspection));
List<String> defectTypeNoExitList = new ArrayList<>();
@ -622,6 +631,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
if (model.getOptType() != null && model.getOptType() == 2) {
model.getPartInspection().setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
}
model.getPartInspection().setInspectionType(workCellType);
partInspectionRepository.save(model.getPartInspection());
//查询当前单据明细
List<MesPartInspectionDetail> resultDetailList = queryResultDetailList(model, model.getOrganizeCode());
@ -776,6 +786,10 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
//根据条码找最近一条单据
DdlPackBean packBean = DdlPackBean.getDdlPackBean(org);
DdlPreparedPack.getStringEqualPack(produceSn.getProductSn(), "sn", packBean);
if (!StringUtils.isEmpty(inputModel.getWorkCellCode())) {
DdlPreparedPack.getStringEqualPack(inputModel.getWorkCenterCode(), "workCenterCode", packBean);
DdlPreparedPack.getStringEqualPack(inputModel.getWorkCellCode(), "workCellCode", packBean);
}
DdlPreparedPack.getNumEqualPack(refundFlag, "refundFlag", packBean);
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, packBean);
MesPartInspection partInspection = partInspectionRepository.getByProperty(packBean);
@ -787,6 +801,43 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
}
/**
*
* @param produceSn
* @param inputModel
* @param org
*/
private void checkOtherWorkCell(MesProduceSn produceSn,MesPartInspectionInputModel inputModel, String org) {
if (StringUtils.isEmpty(inputModel.getWorkCellCode())) {
return;
}
//根据条码找最近一条单据
DdlPackBean packBean = DdlPackBean.getDdlPackBean(org);
DdlPreparedPack.getStringEqualPack(produceSn.getProductSn(), "sn", packBean);
DdlPreparedPack.getStringNoEqualPack(inputModel.getWorkCellCode(), "workCellCode", packBean);
DdlPreparedPack.getStringNotBlanklPack("workCellCode", packBean);
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.CREATE.getValue(), "ncStatus", packBean);
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue(), "inspectionStatus", packBean);
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, packBean);
MesPartInspection partInspection = partInspectionRepository.getByProperty(packBean);
if (partInspection != null) {
MesWorkCenter mesWorkCenter = null;
if (!StringUtils.isEmpty(partInspection.getWorkCenterCode())) {
mesWorkCenter = mesWorkCenterRDao.getByProperty(
new String[]{MesConstWords.ORGANIZE_CODE, MesConstWords.IS_DELETED, MesConstWords.IS_VALID, "workCenterCode"},
new Object[]{org, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), partInspection.getWorkCenterCode()});
}
final String workCenterName = mesWorkCenter != null ? mesWorkCenter.getWorkCenterName() : partInspection.getWorkCenterCode();
MesWorkCell mesWorkCell = workCellRDao.getByProperty(new String[]{MesConstWords.ORGANIZE_CODE, MesConstWords.IS_DELETED, MesConstWords.IS_VALID, "workCellCode"},
new Object[]{org, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), partInspection.getWorkCellCode()});
final String workCellName = mesWorkCell != null ? mesWorkCell.getWorkCellName() : partInspection.getWorkCellCode();
throw ImppExceptionBuilder.newInstance().setErrorCode(ImppExceptionEnum.BUSINESS_EXCEPTION_DATA_ERROR.getCode())
.setErrorDetail(String.format("【%s】条码在产线【%s】工位【%s】判为不良,请检查数据", partInspection.getSn(), workCenterName, workCellName))
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
.build();
}
}
/**
* NC--
*
* @param inputModel
@ -972,6 +1023,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
partInspection.setLotNo(model.getLotNo());
partInspection.setQty(model.getQty());
partInspection.setWorkCenterCode(model.getWorkCenterCode());
partInspection.setWorkCellCode(model.getWorkCellCode());
partInspection.setShiftCode(model.getShiftCode());
partInspection.setSourceType(model.getSourceType());
//42984 初检创建时修改人和修改时间不能赋值
@ -1404,4 +1456,65 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
detail.setSystemSyncStatus(CommonEnumUtil.FALSE);
detail.setSystemSyncDatetime(MesPcnExtConstWords.EMPTY);
}
private Integer getPartInspectionType(String organizeCode, String workCenterCode, String workCellCode) {
if (StringUtils.isEmpty(workCenterCode) || StringUtils.isEmpty(workCellCode)) {
return null;
}
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getStringEqualPack(workCenterCode, "workCenterCode", packBean);
DdlPreparedPack.getStringEqualPack(workCellCode, "workCellCode", packBean);
MesWorkCell workCell = workCellRDao.getByProperty(packBean);
MesExtEnumUtil.MES_PART_INSPECTION_TYPE type = null;
if (workCell != null && workCell.getType() != null) {
if (workCell.getType() == MesExtEnumUtil.MES_WORK_CELL_CHECK_TYPE.PRODUCT_CELL.getValue()) {
type = MesExtEnumUtil.MES_PART_INSPECTION_TYPE.ONLINE_CHECK;
} else if (workCell.getType() == MesExtEnumUtil.MES_WORK_CELL_CHECK_TYPE.GP12_CELL.getValue()) {
type = MesExtEnumUtil.MES_PART_INSPECTION_TYPE.GP12_CHECK;
}
}
return type != null ? type.getValue() : null;
}
@Override
public void checkProductSnInspection(String organizeCode, String partNo, String sn) {
if (StringUtils.isEmpty(partNo)) {
return;
}
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getStringEqualPack(partNo, "partNo", packBean);
MesPart mesPart = partRepository.getByProperty(packBean);
if (mesPart == null) {
return;
}
DdlPackBean inspectionPackBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getStringEqualPack(sn, "sn", inspectionPackBean);
DdlPreparedPack.getIsNotNull("inspectionType", inspectionPackBean);
List<MesPartInspection> inspectionList = partInspectionRepository.findByHqlWhere(inspectionPackBean);
Map<Integer, List<MesPartInspection>> typeMapInspection = inspectionList.stream().collect(Collectors.groupingBy(MesPartInspection::getInspectionType));
if (mesPart.getSlcGateQty() != null) {
List<MesPartInspection> inspections = typeMapInspection.get(MesExtEnumUtil.MES_PART_INSPECTION_TYPE.GP12_CHECK.getValue());
final int checkCount = inspections == null ? 0 : inspections.size();
if (mesPart.getSlcGateQty() == 1) {
if (checkCount == 0) {
MesPcnException.throwFlowException(String.format("物料【%s】的SLC GATE 数量为1至少需要一次GP12检验", partNo));
}
} else if (mesPart.getSlcGateQty() == 2) {
Set<String> opUser = inspections != null ? inspections.stream().map(MesPartInspection::getCreateUser).collect(Collectors.toSet()) : new HashSet<>();
if (opUser.size() != 2) {
MesPcnException.throwFlowException(String.format("物料【%s】的SLC GATE 数量为2需要2次不同创建人的GP12检验", partNo));
}
}
}
if (mesPart.getOlGateQty() != null) {
List<MesPartInspection> inspections = typeMapInspection.get(MesExtEnumUtil.MES_PART_INSPECTION_TYPE.ONLINE_CHECK.getValue());
final int checkCount = inspections == null ? 0 : inspections.size();
if (mesPart.getSlcGateQty() == 1 && checkCount == 0) {
MesPcnException.throwFlowException(String.format("物料【%s】的SLC GATE 数量为1至少需要一次在线检验", partNo));
}
}
}
}

@ -70,6 +70,9 @@ public class MesShippingScanOrderStrategyServiceImpl implements IMesShippingScan
@Autowired
private IMesWorkOrderService mesWorkOrderService;
@Autowired
private IMesInputDefectRecordService defectRecordService;
@Override
public MesSortShippingCheckModel doScan(MesSortShippingCheckModel model, MesShippingOrderManagement orderManagement, MesPartShippingGroup shippingGroup) {
//校验条码
@ -90,6 +93,9 @@ public class MesShippingScanOrderStrategyServiceImpl implements IMesShippingScan
if (detail.getPartNo().equals(produceSn.getPartNo()) && StringUtils.isEmpty(detail.getBarcode()) && !Objects.equals(detail.getIsScanFlg(), MesCommonConstant.TRUE_INTEGER)) {
//校验发运明细
checkShippingDetails(model, orderManagement, shippingGroup, produceSn, detail);
if (shippingGroup != null && Objects.equals(shippingGroup.getIsCheckInspectionRecords(), CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue())) {
defectRecordService.checkProductSnInspection(model.getOrganizeCode(), produceSn.getPartNo(), model.getSn());
}
scanFlg = true;
//明细更新
updateOrderManagementDetails(produceSn, orderManagement, detail, workOrder, model.getUserInfo());

@ -71,6 +71,9 @@ public class MesShippingScanSnStrategyServiceImpl implements IMesShippingScanStr
@Autowired
private IMesShippingSnUniqueService mesShippingSnUniqueService;
@Autowired
private IMesInputDefectRecordService defectRecordService;
@Override
public MesSortShippingCheckModel doScan(MesSortShippingCheckModel model, MesShippingOrderManagement orderManagement, MesPartShippingGroup shippingGroup) {
//校验条码
@ -86,6 +89,9 @@ public class MesShippingScanSnStrategyServiceImpl implements IMesShippingScanStr
if (detail.getPartNo().equals(produceSn.getPartNo()) && notScan) {
//校验发运明细
checkShippingDetails(model, orderManagement, shippingGroup, produceSn, detail);
if (shippingGroup != null && Objects.equals(shippingGroup.getIsCheckInspectionRecords(), CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue())) {
defectRecordService.checkProductSnInspection(model.getOrganizeCode(), produceSn.getPartNo(), model.getSn());
}
scanFlg = true;
//明细更新
if (StringUtils.isEmpty(orderManagement.getCheckSeqCode())) {

@ -36,6 +36,9 @@ public class MesPartInspectionInputModel {
@ApiParam("产线代码")
private String workCenterCode;
@ApiParam("工位代码")
private String workCellCode;
@ApiParam("班次代码")
private String shiftCode;

Loading…
Cancel
Save