diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSpotCheckOrderService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSpotCheckOrderService.java index 995eead..08c16e6 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSpotCheckOrderService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSpotCheckOrderService.java @@ -8,8 +8,10 @@ import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesEquipVariableCollectContext; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesEquipmentSpotCheckModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesSpotCheckOrderModel; +import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.icloud.core.sdk.ICoreUtilCloud; import cn.estsh.i3plus.mes.pcn.api.iservice.busi.ISyncFuncService; +import cn.estsh.i3plus.mes.pcn.util.DateUtil; import cn.estsh.i3plus.platform.common.convert.ConvertBean; import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum; import cn.estsh.i3plus.platform.common.tool.TimeTool; @@ -29,7 +31,6 @@ import cn.estsh.impp.framework.boot.exception.ImppBusiException; import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder; import cn.estsh.impp.framework.boot.util.ValidatorBean; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections.map.HashedMap; import org.apache.commons.collections4.ListUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -90,9 +91,9 @@ public class MesSpotCheckOrderService implements IMesSpotCheckOrderService { public ListPager querySpotCheckOrder(MesSpotCheckOrder spotCheckOrder, Pager pager) { DdlPackBean packBean = getDdlPackBean(spotCheckOrder); - DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, packBean); pager = PagerHelper.getPager(pager, spotCheckOrderRepository.findByHqlWhereCount(packBean)); + DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.ASC.getValue(),CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"status","createDatetime"}, packBean); List resultList = spotCheckOrderRepository.findByHqlWherePage(packBean, pager); if (CollectionUtils.isEmpty(resultList)) { return new ListPager<>(resultList, pager); @@ -230,13 +231,19 @@ public class MesSpotCheckOrderService implements IMesSpotCheckOrderService { //获取设定值设备数据 List setEquipmentLogList = new ArrayList<>(); for (List tmp : ListUtils.partition(setEquipVariableIdList, MesCommonConstant.MAX_PAGER_SIZE)) { - setEquipmentLogList.addAll(mesEquipmentLogExtService.getEquipmentLogCollectList(org, mesEquipment.getEquipId(), MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue(), MesExtEnumUtil.EQUIP_VARIABLE_TYPE.PROCESS_FINISH.getValue(), tmp)); + List equipmentLogCollectList = mesEquipmentLogExtService.getEquipmentLogCollectList(org, mesEquipment.getEquipId(), MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue(), MesExtEnumUtil.EQUIP_VARIABLE_TYPE.PROCESS_FINISH.getValue(), tmp); + if(!CollectionUtils.isEmpty(equipmentLogCollectList)){ + setEquipmentLogList.addAll(equipmentLogCollectList); + } } //设定值地址数据Map setMap = setEquipmentLogList.stream().collect(Collectors.groupingBy(MesEquipVariableCollectContext::getEquipVariableId)); for (List tmp : ListUtils.partition(realEquipVariableIdList, MesCommonConstant.MAX_PAGER_SIZE)) { - realEquipmentLogList.addAll(mesEquipmentLogExtService.getEquipmentLogCollectList(org,mesEquipment.getEquipId(), MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue(), MesExtEnumUtil.EQUIP_VARIABLE_TYPE.PROCESS_FINISH.getValue(), tmp)); + List equipmentLogCollectList = mesEquipmentLogExtService.getEquipmentLogCollectList(org, mesEquipment.getEquipId(), MesExtEnumUtil.EQUIP_VARIABLE_NEED_NEW_VALUE.TRUE.getValue(), MesExtEnumUtil.EQUIP_VARIABLE_TYPE.PROCESS_FINISH.getValue(), tmp); + if(!CollectionUtils.isEmpty(equipmentLogCollectList)){ + realEquipmentLogList.addAll(equipmentLogCollectList); + } } //实际值地址数据Map realMap = realEquipmentLogList.stream().collect(Collectors.groupingBy(MesEquipVariableCollectContext::getEquipVariableId)); @@ -609,15 +616,13 @@ public class MesSpotCheckOrderService implements IMesSpotCheckOrderService { } private DdlPackBean getDdlPackBean(MesSpotCheckOrder spotCheckOrder) { - - List statusList = new ArrayList<>(); - statusList.add(MesExtEnumUtil.SPOT_CHECK_ORDER_STATUS.CREATE.getValue()); - statusList.add(MesExtEnumUtil.SPOT_CHECK_ORDER_STATUS.COMPLETE.getValue()); + String createDateTime = TimeTool.pareDateToString(DateUtil.addDays(new Date(), -(Objects.isNull(spotCheckOrder.getDays()) ? MesPcnExtConstWords.SEVEN : spotCheckOrder.getDays()))); DdlPackBean packBean = DdlPackBean.getDdlPackBean(spotCheckOrder.getOrganizeCode()); DdlPreparedPack.getStringLikerPack(spotCheckOrder.getWorkCenterCode(), "workCenterCode", packBean); DdlPreparedPack.getStringLikerPack(spotCheckOrder.getWorkCellCode(), "workCellCode", packBean); DdlPreparedPack.getStringLikerPack(spotCheckOrder.getSpotCheckOrderNo(), "spotCheckOrderNo", packBean); - DdlPreparedPack.getInPackList(statusList, "status", packBean); + DdlPreparedPack.getStringEqualPack(spotCheckOrder.getEquipCode(), "equipCode", packBean); + packBean.setWhereAppend(packBean.getWhereAppend() + String.format(" and (model.status = %s or (model.status = %s and model.createDatetime >= %s))", MesExtEnumUtil.SPOT_CHECK_ORDER_STATUS.CREATE.getValue(), MesExtEnumUtil.SPOT_CHECK_ORDER_STATUS.COMPLETE.getValue(), createDateTime)); return packBean; } diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java index 9897385..ed99a85 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java @@ -402,6 +402,8 @@ public class MesPcnExtConstWords { public static final Integer THREE = 3; //4 public static final Integer FOUR = 4; + //7 + public static final Integer SEVEN = 7; //14 public static final Integer FOURTEEN = 14; //60