|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesEquipmentExtService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesEquipmentLogExtService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.spot.IMesSpotCheckOrderService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesEquipmentSpotCheckModel;
|
|
|
|
@ -73,6 +75,12 @@ public class MesSpotCheckOrderService implements IMesSpotCheckOrderService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private ICoreUtilCloud sysOrderNoRuleCloud;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesEquipmentLogExtService mesEquipmentLogExtService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesEquipmentExtService mesEquipmentExtService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ListPager<MesSpotCheckOrder> querySpotCheckOrder(MesSpotCheckOrder spotCheckOrder, Pager pager) {
|
|
|
|
|
|
|
|
|
@ -171,35 +179,36 @@ public class MesSpotCheckOrderService implements IMesSpotCheckOrderService {
|
|
|
|
|
throw new ImppBusiException(String.format("剩余物料号【%s】对应的条码未扫描,请扫描完成后再完成质检", partNoList));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取设定值设备变量ID
|
|
|
|
|
List<Long> setEquipVariableIdList =
|
|
|
|
|
model.getOrderResultList().stream().filter(k -> k.getSpotCheckItemType() == MesExtEnumUtil.SPOT_CHECK_ITEM_TYPE.AUTO.getValue()).map(k -> k.getSetEquipVariableId()).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
//获取实际值设备变量ID
|
|
|
|
|
List<Long> realEquipVariableIdList =
|
|
|
|
|
model.getOrderResultList().stream().filter(k -> k.getSpotCheckItemType() == MesExtEnumUtil.SPOT_CHECK_ITEM_TYPE.AUTO.getValue()).map(k -> k.getSetEquipVariableId()).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
//获取设定值设备数据
|
|
|
|
|
List<MesEquipmentLog> setEquipmentLogList = new ArrayList<>();
|
|
|
|
|
for (List<Long> tmp : ListUtils.partition(setEquipVariableIdList, MesCommonConstant.MAX_PAGER_SIZE)) {
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(org);
|
|
|
|
|
DdlPreparedPack.getInPackList(tmp, "equipVariableId", packBean);
|
|
|
|
|
DdlPreparedPack.getNumEqualPack(model.getSpotCheckOrder().getEquipId().intValue(), "equipId", packBean);
|
|
|
|
|
setEquipmentLogList.addAll(equipmentLogRepository.findByHqlWhere(packBean));
|
|
|
|
|
}
|
|
|
|
|
//设定值地址数据Map
|
|
|
|
|
Map<Long, List<MesEquipmentLog>> setMap = setEquipmentLogList.stream().collect(Collectors.groupingBy(k -> k.getEquipVariableId()));
|
|
|
|
|
//根据设备代码获取EQUIP_ID
|
|
|
|
|
MesEquipment mesEquipment = mesEquipmentExtService.getMesEquipment(org, model.getSpotCheckOrder().getEquipCode());
|
|
|
|
|
Map<Long, List<MesEquipmentLog>> setMap = null;
|
|
|
|
|
//实际值地址数据Map
|
|
|
|
|
Map<Long, List<MesEquipmentLog>> realMap = null;
|
|
|
|
|
//获取实际值值设备数据
|
|
|
|
|
List<MesEquipmentLog> realEquipmentLogList = new ArrayList<>();
|
|
|
|
|
for (List<Long> tmp : ListUtils.partition(realEquipVariableIdList, MesCommonConstant.MAX_PAGER_SIZE)) {
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(org);
|
|
|
|
|
DdlPreparedPack.getInPackList(tmp, "equipVariableId", packBean);
|
|
|
|
|
DdlPreparedPack.getNumEqualPack(model.getSpotCheckOrder().getEquipId().intValue(), "equipId", packBean);
|
|
|
|
|
realEquipmentLogList.addAll(equipmentLogRepository.findByHqlWhere(packBean));
|
|
|
|
|
if(!Objects.isNull(mesEquipment) && StringUtils.isEmpty(mesEquipment.getEquipId())){
|
|
|
|
|
//获取设定值设备变量ID
|
|
|
|
|
List<Long> setEquipVariableIdList =
|
|
|
|
|
model.getOrderResultList().stream().filter(k -> k.getSpotCheckItemType() == MesExtEnumUtil.SPOT_CHECK_ITEM_TYPE.AUTO.getValue()).map(MesSpotCheckOrderResult::getSetEquipVariableId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
//获取实际值设备变量ID
|
|
|
|
|
List<Long> realEquipVariableIdList =
|
|
|
|
|
model.getOrderResultList().stream().filter(k -> k.getSpotCheckItemType() == MesExtEnumUtil.SPOT_CHECK_ITEM_TYPE.AUTO.getValue()).map(MesSpotCheckOrderResult::getSetEquipVariableId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
//获取设定值设备数据
|
|
|
|
|
List<MesEquipmentLog> setEquipmentLogList = new ArrayList<>();
|
|
|
|
|
for (List<Long> tmp : ListUtils.partition(setEquipVariableIdList, MesCommonConstant.MAX_PAGER_SIZE)) {
|
|
|
|
|
setEquipmentLogList.addAll(mesEquipmentLogExtService.getEquipmentLogList(org,mesEquipment.getEquipId(),MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue(),tmp));
|
|
|
|
|
}
|
|
|
|
|
//设定值地址数据Map
|
|
|
|
|
setMap = setEquipmentLogList.stream().collect(Collectors.groupingBy(MesEquipmentLog::getEquipVariableId));
|
|
|
|
|
|
|
|
|
|
for (List<Long> tmp : ListUtils.partition(realEquipVariableIdList, MesCommonConstant.MAX_PAGER_SIZE)) {
|
|
|
|
|
realEquipmentLogList.addAll(mesEquipmentLogExtService.getEquipmentLogList(org,mesEquipment.getEquipId(),MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue(),tmp));
|
|
|
|
|
}
|
|
|
|
|
//实际值地址数据Map
|
|
|
|
|
realMap = realEquipmentLogList.stream().collect(Collectors.groupingBy(MesEquipmentLog::getEquipVariableId));
|
|
|
|
|
}
|
|
|
|
|
//实际值地址数据Map
|
|
|
|
|
Map<Long, List<MesEquipmentLog>> realMap = realEquipmentLogList.stream().collect(Collectors.groupingBy(k -> k.getEquipVariableId()));
|
|
|
|
|
|
|
|
|
|
for (MesSpotCheckOrderResult result : model.getOrderResultList()) {
|
|
|
|
|
|
|
|
|
@ -207,7 +216,7 @@ public class MesSpotCheckOrderService implements IMesSpotCheckOrderService {
|
|
|
|
|
if (result.getSpotCheckItemType() == MesExtEnumUtil.SPOT_CHECK_ITEM_TYPE.AUTO.getValue()) {
|
|
|
|
|
|
|
|
|
|
//获取设定值地址数据
|
|
|
|
|
if (setMap.containsKey(result.getSetEquipVariableId())) {
|
|
|
|
|
if (!Objects.isNull(setMap) && setMap.containsKey(result.getSetEquipVariableId())) {
|
|
|
|
|
String value = setMap.get(result.getSetEquipVariableId()).get(0).getEquipVariableValue();
|
|
|
|
|
result.setSpotCheckSetValue(value);
|
|
|
|
|
result.setSetValueRecordType(MesExtEnumUtil.SPOT_VALUE_RECORD_TYPE.EQUIPMENT_INPUT.getValue());
|
|
|
|
@ -217,7 +226,7 @@ public class MesSpotCheckOrderService implements IMesSpotCheckOrderService {
|
|
|
|
|
// result.setSetValueRecordType(MesExtEnumUtil.SPOT_VALUE_RECORD_TYPE.ARTIFICIAL_INPUT.getValue());
|
|
|
|
|
// }
|
|
|
|
|
//获取实际值地址数据
|
|
|
|
|
if (realMap.containsKey(result.getRealEquipVariableId())) {
|
|
|
|
|
if (!Objects.isNull(realMap) && realMap.containsKey(result.getRealEquipVariableId())) {
|
|
|
|
|
String value = realMap.get(result.getRealEquipVariableId()).get(0).getEquipVariableValue();
|
|
|
|
|
result.setSpotCheckRealValue(value);
|
|
|
|
|
//根据获取的值判断是否是设备自定义参数 或者认为录入参数
|
|
|
|
|