@ -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 < MesSpotCheckOrder > 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 < MesSpotCheckOrder > resultList = spotCheckOrderRepository . findByHqlWherePage ( packBean , pager ) ;
if ( CollectionUtils . isEmpty ( resultList ) ) {
return new ListPager < > ( resultList , pager ) ;
@ -230,13 +231,19 @@ public class MesSpotCheckOrderService implements IMesSpotCheckOrderService {
//获取设定值设备数据
List < MesEquipVariableCollectContext > setEquipmentLogList = new ArrayList < > ( ) ;
for ( List < Long > 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 < MesEquipVariableCollectContext > 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 < Long > 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 < MesEquipVariableCollectContext > 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 < Integer > 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 ;
}