|
|
|
@ -40,6 +40,7 @@ import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description :
|
|
|
|
@ -87,6 +88,9 @@ public class MesSpotCheckOrderService implements IMesSpotCheckOrderService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesEquipmentRepository mesEquipmentRepository;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesEquipmentSpotCheckTagRepository mesEquipmentSpotCheckTagRepository;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ListPager<MesSpotCheckOrder> querySpotCheckOrder(MesSpotCheckOrder spotCheckOrder, Pager pager) {
|
|
|
|
|
|
|
|
|
@ -214,6 +218,10 @@ public class MesSpotCheckOrderService implements IMesSpotCheckOrderService {
|
|
|
|
|
}
|
|
|
|
|
//根据设备代码获取EQUIP_ID
|
|
|
|
|
MesEquipment mesEquipment = mesEquipmentExtService.getMesEquipment(org, model.getSpotCheckOrder().getEquipCode());
|
|
|
|
|
|
|
|
|
|
//是否允许开始点检
|
|
|
|
|
allowSpotCheckOrder(model.getSpotCheckOrder(), org, mesEquipment.getEquipId());
|
|
|
|
|
|
|
|
|
|
Map<Long, List<MesEquipVariableCollectContext>> setMap = null;
|
|
|
|
|
//实际值地址数据Map
|
|
|
|
|
Map<Long, List<MesEquipVariableCollectContext>> realMap = null;
|
|
|
|
@ -686,5 +694,24 @@ public class MesSpotCheckOrderService implements IMesSpotCheckOrderService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void allowSpotCheckOrder(MesSpotCheckOrder spotCheckOrder, String org, Integer equipId) {
|
|
|
|
|
if(Objects.isNull(spotCheckOrder) || StringUtils.isEmpty(spotCheckOrder.getSpotCheckCode()) || StringUtils.isEmpty(org)){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(org);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(spotCheckOrder.getSpotCheckCode(),"spotCheckCode",packBean);
|
|
|
|
|
MesEquipmentSpotCheckTag equipmentSpotCheckTag = mesEquipmentSpotCheckTagRepository.getByProperty(packBean);
|
|
|
|
|
if(Objects.isNull(equipmentSpotCheckTag)){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
List<MesEquipVariableCollectContext> equipmentLogCollectList = mesEquipmentLogExtService.getEquipmentLogCollectList(org, equipId, MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue(), MesExtEnumUtil.EQUIP_VARIABLE_TYPE.PROCESS_FINISH.getValue(), Stream.of(equipmentSpotCheckTag.getEquipVariableId()).collect(Collectors.toList()));
|
|
|
|
|
if(CollectionUtils.isEmpty(equipmentLogCollectList)){
|
|
|
|
|
throw new ImppBusiException(String.format("点检项目代码【%s】设备地址【%s】未查询到设备返回值,请检查数据!", spotCheckOrder.getSpotCheckCode(),equipmentSpotCheckTag.getTagName()));
|
|
|
|
|
}
|
|
|
|
|
if (!equipmentLogCollectList.iterator().next().getEquipVariableValue().equals(equipmentSpotCheckTag.getSuccessValue())) {
|
|
|
|
|
throw new ImppBusiException(String.format("点检项目代码【%s】设备地址【%s】设备返回值【%s】与理论成功值【%s】不匹配,请检查数据!", spotCheckOrder.getSpotCheckCode(),equipmentSpotCheckTag.getTagName(),equipmentLogCollectList.iterator().next().getEquipVariableValue(),equipmentSpotCheckTag.getSuccessValue()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|