|
|
|
@ -141,24 +141,37 @@ public class MesSpotCheckOrderService implements IMesSpotCheckOrderService {
|
|
|
|
|
|
|
|
|
|
//校验点检单
|
|
|
|
|
checkSpotCheckOrder(model.getSpotCheckOrder());
|
|
|
|
|
//检查条码
|
|
|
|
|
MesProduceSn produceSn = checkProduceSn(model.getProduceSn(), org);
|
|
|
|
|
|
|
|
|
|
boolean flg = false;
|
|
|
|
|
for (MesSpotCheckOrderPart spotCheckOrderPart : model.getOrderPartList()) {
|
|
|
|
|
if (MesExtEnumUtil.SPOT_CHECK_ORDER_TYPE.PROCESS_PARAMETER_INSPECTION.getValue() == model.getSpotCheckOrder().getSpotCheckOrderType() ||
|
|
|
|
|
MesExtEnumUtil.SPOT_CHECK_ORDER_TYPE.EQUIPMENT_INSPECTION.getValue() == model.getSpotCheckOrder().getSpotCheckOrderType()) {
|
|
|
|
|
MesEquipment mesEquipment = mesEquipmentExtService.getMesEquipment(org, model.getSpotCheckOrder().getEquipCode());
|
|
|
|
|
if (Objects.isNull(mesEquipment)) {
|
|
|
|
|
throw new ImppBusiException(String.format("点检单对应的设备【%s】信息不存在", model.getSpotCheckOrder().getEquipCode()));
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isEmpty(mesEquipment.getEquipId()) || !model.getProduceSn().equals(mesEquipment.getEquipId() + "")) {
|
|
|
|
|
throw new ImppBusiException(String.format("点检单对应的设备编号【%s】和扫描的设备编号【%s】不匹配,请检查数据", mesEquipment.getEquipId(), model.getProduceSn()));
|
|
|
|
|
}
|
|
|
|
|
return model;
|
|
|
|
|
} else {
|
|
|
|
|
//检查条码
|
|
|
|
|
MesProduceSn produceSn = checkProduceSn(model.getProduceSn(), org);
|
|
|
|
|
|
|
|
|
|
boolean flg = false;
|
|
|
|
|
for (MesSpotCheckOrderPart spotCheckOrderPart : model.getOrderPartList()) {
|
|
|
|
|
|
|
|
|
|
if (spotCheckOrderPart.getPartNo().equals(produceSn.getPartNo()) && StringUtils.isEmpty(spotCheckOrderPart.getSn())) {
|
|
|
|
|
flg = true;
|
|
|
|
|
spotCheckOrderPart.setSn(model.getProduceSn());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (spotCheckOrderPart.getPartNo().equals(produceSn.getPartNo()) && StringUtils.isEmpty(spotCheckOrderPart.getSn())) {
|
|
|
|
|
flg = true;
|
|
|
|
|
spotCheckOrderPart.setSn(model.getProduceSn());
|
|
|
|
|
break;
|
|
|
|
|
if (!flg) {
|
|
|
|
|
throw new ImppBusiException(String.format("扫描的条码【%s】对应的物料号【%s】在点检单中不存在", produceSn.getProductSn(), produceSn.getPartNo()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!flg) {
|
|
|
|
|
throw new ImppBusiException(String.format("扫描的条码【%s】对应的物料号【%s】在点检单中不存在", produceSn.getProductSn(), produceSn.getPartNo()));
|
|
|
|
|
return model;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return model;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|