Merge remote-tracking branch 'origin/dev_temp_xw_202505150000_46824' into mes-dev

# Conflicts:
#	modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesBoxingErrorProofingService.java
mes-dev
jason 4 months ago
commit 1b6728d26f

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

@ -859,7 +859,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()) {
//报废
@ -879,6 +882,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());
//自制件更新条码状态 条码状态可用
@ -890,6 +894,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;
@ -85,6 +82,9 @@ public class MesBoxingErrorProofingService implements IMesBoxingErrorProofingSer
private MesCustPartInvoicedRepository partInvoicedRao;
@Autowired
private IMesInputDefectRecordService defectRecordService;
@Override
public ListPager<MesPackageDetail> queryMesPackageDetailByPager(MesPackage mesPackage, Pager pager) {
@ -172,6 +172,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()) {

@ -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.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);
@ -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,67 @@ 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.getStringEqualPack(workCellCode, "workCellCode", packBean);
MesWorkCell workCell = workCellRDao.getByProperty(packBean);
MesExtEnumUtil.MES_PART_INSPECTION_TYPE type = null;
if (workCell != null) {
if (workCell.getType() == null) {
MesPcnException.throwFlowException(String.format("工位【%s】未维护工位类型请检查数据", workCellCode));
}
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;
} else {
MesPcnException.throwFlowException(String.format("工位【%s】维护了不支持的工位类型请检查数据", workCellCode));
}
}
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