46824 客退电子化检验,NC处理拆解需按照pisces功能按工序退回

dev_temp_xw_202505150000_46824
jason 2 months ago
parent 82556d70a1
commit 958edd3435

@ -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);
}

@ -853,7 +853,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()) {
//报废
@ -873,6 +876,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.getAssemblySn());
//自制件更新条码状态 条码状态可用
@ -884,6 +888,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;
@ -78,6 +75,9 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer
@Autowired
private IMesProductionRecordService mesProductionRecordService;
@Autowired
private IMesInputDefectRecordService defectRecordService;
@Override
public ListPager<MesPackageDetail> queryMesPackageDetailByPager(MesPackage mesPackage, Pager pager) {
@ -165,6 +165,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);
if (mesPackageDetail.getIsMemoryBoolean()) {

@ -129,6 +129,9 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
@Autowired
private MesPartProdGroupRepository mesPartProdGroupRao;
@Autowired
private MesWorkCellRepository workCellRDao;
@Override
public MesPartInspectionViewModel queryPartInspection(MesPartInspectionInputModel model) {
@ -306,7 +309,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
}
}
final Integer workCellType = getWorkCellType(model.getOrganizeCode(), model.getWorkCenterCode(), model.getWorkCellCode());
//零件检测详情为空,则代表本次校验为合格。
if (CollectionUtils.isEmpty(model.getPartInspectionDetailList())) {
MesPartInspection partInspection = null;
@ -321,6 +324,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 +375,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 +489,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 +627,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 +782,10 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
//根据条码找最近一条单据
DdlPackBean packBean = DdlPackBean.getDdlPackBean(org);
DdlPreparedPack.getStringEqualPack(produceSn.getProductSn(), "sn", packBean);
if (!StringUtils.isEmpty(inputModel.getWorkCellCode())) {
DdlPreparedPack.getNumEqualPack(inputModel.getWorkCenterCode(), "workCenterCode", packBean);
DdlPreparedPack.getNumEqualPack(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);
@ -972,6 +982,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 +1415,62 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
detail.setSystemSyncStatus(CommonEnumUtil.FALSE);
detail.setSystemSyncDatetime(MesPcnExtConstWords.EMPTY);
}
private Integer getWorkCellType(String organizeCode, String workCenterCode, String workCellCode) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getStringEqualPack(workCenterCode, "workCenterCode", packBean);
DdlPreparedPack.getNumNOEqualPack(workCellCode, "workCellCode", packBean);
MesWorkCell workCell = workCellRDao.getByProperty(packBean);
MesExtEnumUtil.MES_PART_INSPECTION_TYPE type = null;
if (workCell != null) {
if (workCell.getType() == MesExtEnumUtil.MES_WORK_CELL_TYPE.PRODUCT_CELL.getValue()) {
type = MesExtEnumUtil.MES_PART_INSPECTION_TYPE.ONLINE_CHECK;
} else if (workCell.getType() == MesExtEnumUtil.MES_WORK_CELL_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.ONLINE_CHECK.getValue());
final int checkCount = inspections == null ? 0 : inspections.size();
if (mesPart.getSlcGateQty() == 1) {
if (checkCount == 0) {
MesPcnException.throwFlowException("物料【%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("物料【%s】的SLC GATE 数量为2需要2次不同创建人的GP12检验", partNo);
}
}
} else 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("物料【%s】的SLC GATE 数量为1至少需要一次在线检验", partNo);
}
}
}
}

@ -72,6 +72,9 @@ public class MesShippingScanSnStrategyServiceImpl implements IMesShippingScanStr
@Autowired
private IMesShippingSnUniqueService mesShippingSnUniqueService;
@Autowired
private IMesInputDefectRecordService defectRecordService;
@Override
public MesSortShippingCheckModel doScan(MesSortShippingCheckModel model, MesShippingOrderManagement orderManagement, MesPartShippingGroup shippingGroup) {
//校验条码
@ -81,6 +84,9 @@ public class MesShippingScanSnStrategyServiceImpl implements IMesShippingScanStr
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, model.getUserInfo());

@ -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());

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

Loading…
Cancel
Save