|
|
@ -16,6 +16,7 @@ import org.springframework.util.CollectionUtils;
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.Comparator;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
@ -44,9 +45,7 @@ public class MesEquipmentExtService implements IMesEquipmentExtService {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<MesCellEquipContext> getCellEquipmentList(String organizeCode, String workCenterCode, String workCellCode) {
|
|
|
|
public List<MesCellEquipContext> getCellEquipmentList(String organizeCode, String workCenterCode, String workCellCode) {
|
|
|
|
if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(workCenterCode) || StringUtils.isEmpty(workCellCode)) return null;
|
|
|
|
if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(workCenterCode) || StringUtils.isEmpty(workCellCode)) return null;
|
|
|
|
List<MesWcEquipment> wcEquipmentDbList = wcEquipmentRepository.findByProperty(
|
|
|
|
List<MesWcEquipment> wcEquipmentDbList = getWcEquipmentList(organizeCode, workCenterCode, workCellCode);
|
|
|
|
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.WORK_CENTER_CODE, MesPcnExtConstWords.WORK_CELL_CODE},
|
|
|
|
|
|
|
|
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterCode, workCellCode});
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(wcEquipmentDbList)) return null;
|
|
|
|
if (CollectionUtils.isEmpty(wcEquipmentDbList)) return null;
|
|
|
|
List<MesCellEquipContext> cellEquipmentContextList = null;
|
|
|
|
List<MesCellEquipContext> cellEquipmentContextList = null;
|
|
|
|
for (MesWcEquipment wcEquipmentDb : wcEquipmentDbList) {
|
|
|
|
for (MesWcEquipment wcEquipmentDb : wcEquipmentDbList) {
|
|
|
@ -65,6 +64,22 @@ public class MesEquipmentExtService implements IMesEquipmentExtService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public List<MesWcEquipment> getWcEquipmentList(String organizeCode, String workCenterCode, String workCellCode) {
|
|
|
|
|
|
|
|
return wcEquipmentRepository.findByProperty(
|
|
|
|
|
|
|
|
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.WORK_CENTER_CODE, MesPcnExtConstWords.WORK_CELL_CODE},
|
|
|
|
|
|
|
|
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterCode, workCellCode});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public MesWcEquipment getWcEquipment(String organizeCode, String workCenterCode, String workCellCode) {
|
|
|
|
|
|
|
|
List<MesWcEquipment> wcEquipmentDbList = getWcEquipmentList(organizeCode, workCenterCode, workCellCode);
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(wcEquipmentDbList)) return null;
|
|
|
|
|
|
|
|
if (wcEquipmentDbList.size() == 1) return wcEquipmentDbList.get(0);
|
|
|
|
|
|
|
|
List<MesWcEquipment> wcEquipmentDbListSort = wcEquipmentDbList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getSeq()))).sorted(Comparator.comparing(MesWcEquipment::getSeq)).collect(Collectors.toList());
|
|
|
|
|
|
|
|
return !CollectionUtils.isEmpty(wcEquipmentDbListSort) ? wcEquipmentDbListSort.get(0) : wcEquipmentDbList.get(0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public List<MesEquipmentVariableCfg> getEquipmentVariableCfgList(String organizeCode, String variableCfgType) {
|
|
|
|
public List<MesEquipmentVariableCfg> getEquipmentVariableCfgList(String organizeCode, String variableCfgType) {
|
|
|
|
if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(variableCfgType)) return null;
|
|
|
|
if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(variableCfgType)) return null;
|
|
|
|
return equipmentVariableCfgRepository.findByProperty(
|
|
|
|
return equipmentVariableCfgRepository.findByProperty(
|
|
|
|