| | |
| | | import com.hdl.photovoltaic.databinding.FragmentHouseListBinding; |
| | | import com.hdl.photovoltaic.base.CustomBaseFragment; |
| | | import com.hdl.photovoltaic.enums.DebugStatus; |
| | | import com.hdl.photovoltaic.enums.DebugType; |
| | | import com.hdl.photovoltaic.enums.HomepageTitleTabSwitch; |
| | | import com.hdl.photovoltaic.enums.LowerTagType; |
| | | import com.hdl.photovoltaic.enums.PowerStationStatus; |
| | |
| | | viewBinding.addIv.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | AddPowerStationDialog addPowerStationDialog = new AddPowerStationDialog(_mActivity); |
| | | addPowerStationDialog.show(); |
| | | addPowerStationDialog.setCanceledOnTouchOutside(true); |
| | | addPowerStationDialog.setItemOnclickListener(new PowerStationDialogAdapter.OnclickListener() { |
| | | @Override |
| | | public void onClick(int position, String str) { |
| | | addPowerStationDialog.dismiss(); |
| | | UserConfigManage.getInstance().setUniBottomSafeDistanceBackgroundColor(1); |
| | | if (_mActivity.getString(R.string.simple_debugging).equals(str)) { |
| | | HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION_SIMPLE, null); |
| | | } else { |
| | | HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION, null); |
| | | } |
| | | // requestPermissions(new OnCallBeak() { |
| | | // @Override |
| | | // public void onClickCallBeak() { |
| | | UserConfigManage.getInstance().setUniBottomSafeDistanceBackgroundColor(1); |
| | | HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION, null); |
| | | // AddPowerStationDialog addPowerStationDialog = new AddPowerStationDialog(_mActivity); |
| | | // addPowerStationDialog.show(); |
| | | // addPowerStationDialog.setCanceledOnTouchOutside(true); |
| | | // addPowerStationDialog.setItemOnclickListener(new PowerStationDialogAdapter.OnclickListener() { |
| | | // @Override |
| | | // public void onClick(int position, String str) { |
| | | // addPowerStationDialog.dismiss(); |
| | | // |
| | | //// UserConfigManage.getInstance().setUniBottomSafeDistanceBackgroundColor(1); |
| | | //// HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION, null); |
| | | // } |
| | | // }); |
| | | } |
| | | }); |
| | | //// if (_mActivity.getString(R.string.simple_debugging).equals(str)) { |
| | | //// HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION_SIMPLE, null); |
| | | //// } else { |
| | | //// HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION, null); |
| | | //// } |
| | | //// requestPermissions(new OnCallBeak() { |
| | | //// @Override |
| | | //// public void onClickCallBeak() { |
| | | ////// UserConfigManage.getInstance().setUniBottomSafeDistanceBackgroundColor(1); |
| | | ////// HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION, null); |
| | | //// } |
| | | //// }); |
| | | // } |
| | | // }); |
| | | |
| | | } |
| | | }); |
| | | viewBinding.addIv.setOnLongClickListener(new View.OnLongClickListener() { |
| | | @Override |
| | | public boolean onLongClick(View v) { |
| | | UserConfigManage.getInstance().setUniBottomSafeDistanceBackgroundColor(1); |
| | | HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION_SIMPLE, null); |
| | | return true; |
| | | } |
| | | }); |
| | | //电站搜索 |
| | |
| | | delayedConfirmationCancelDialog.dismiss(); |
| | | if (isWaitDelivered) { |
| | | showLoading(); |
| | | HdlResidenceLogic.getInstance().setUpdateProjectDebugStatus(houseIdBean.getHomeId(), houseIdBean.getCommunityId(), houseIdBean.getFlowRecordContent(), ProjectOperation.DEBUGGING_AGAIN.toString(), new CloudCallBeak<Boolean>() { |
| | | String flowRecordContent = UserConfigManage.getInstance().isZh() ? "新特锐能app发起电站重新调试" : "The Xenterra app initiates the re-commissioning of the power station"; |
| | | HdlResidenceLogic.getInstance().setUpdateProjectDebugStatus(houseIdBean.getHomeId(), houseIdBean.getCommunityId(), flowRecordContent, ProjectOperation.DEBUGGING_AGAIN.toString(), new CloudCallBeak<Boolean>() { |
| | | @Override |
| | | public void onSuccess(Boolean list) { |
| | | hideLoading(); |
| | |
| | | houseIdBean.setDebugStatus(DebugStatus.Debugging); |
| | | HdlResidenceLogic.getInstance().updateHouseIdBean(houseIdBean); |
| | | initData(); |
| | | if (houseInfoAdapter != null) { |
| | | houseInfoAdapter.setList(houseListBeanIDList, powerStationStatusValue);//重新刷新列表 |
| | | } |
| | | //更新UI |
| | | houseInfoAdapter.notifyItemChanged(position); |
| | | // houseInfoAdapter.notifyItemChanged(position); |
| | | } |
| | | } |
| | | |
| | |
| | | }); |
| | | } else { |
| | | showLoading(getString(R.string.deleting_please_wait)); |
| | | HdlDeviceLogic.getInstance().getCurrentHomeLocalAndCloudGatewayList(houseIdBean.getHomeId(), new CloudCallBeak<List<GatewayBean>>() { |
| | | @Override |
| | | public void onSuccess(List<GatewayBean> list) { |
| | | //发起删除电站指令 |
| | | deleteResidence(houseIdBean.getHomeId(), list, position); |
| | | if (houseIdBean.getDebugType().equals(DebugType.NORMAL)) { |
| | | //【常规方式】发起删除电站指令 |
| | | HdlDeviceLogic.getInstance().getCurrentHomeLocalAndCloudGatewayList(houseIdBean.getHomeId(), new CloudCallBeak<List<GatewayBean>>() { |
| | | @Override |
| | | public void onSuccess(List<GatewayBean> list) { |
| | | //发起删除电站指令 |
| | | deleteResidence(position, houseIdBean, list); |
| | | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | //发起删除电站指令 |
| | | deleteResidence(houseIdBean.getHomeId(), null, position); |
| | | } |
| | | }); |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | //发起删除电站指令 |
| | | deleteResidence(position, houseIdBean, null); |
| | | } |
| | | }); |
| | | } else { |
| | | //【简易方式】发起删除电站指令 |
| | | deleteResidence(position, houseIdBean, null); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | |
| | | deviceInfoAdapter.setOnclickListener(new DeviceInfoAdapter.OnClickListener() { |
| | | @Override |
| | | public void onClick(int position, CloudInverterDeviceBean deviceBean) { |
| | | deviceBean.setActivate(true);//默认激活 |
| | | // //杨涛说这个列表不返回未激活的设备,所以去掉判断 |
| | | // if (!deviceBean.isActivate()) { |
| | | // HdlThreadLogic.toast(_mActivity, getString(R.string.device_not_activated)); |
| | | // return; |
| | | // } |
| | | // GatewayBean gatewayBean = new GatewayBean(); |
| | | // gatewayBean.setCategorySecondName(deviceBean.getCategorySecondName()); |
| | | // gatewayBean.setDevice_mac(deviceBean.getOsn()); |
| | |
| | | if (isRefreshing) { |
| | | showLoading(getString(R.string.device_loading)); |
| | | } |
| | | //获取住宅(电站)ID列表 |
| | | //获取设备列表 |
| | | HdlDeviceLogic.getInstance().getPowerStationDeviceList("", pageNo, pageSize, new CloudCallBeak<PageNumberObject<CloudInverterDeviceBean>>() { |
| | | @Override |
| | | public void onSuccess(PageNumberObject<CloudInverterDeviceBean> pageNumberObject) { |
| | |
| | | /** |
| | | * 删除电站 |
| | | * |
| | | * @param homeId 电站id |
| | | * @param list 逆变器列表 |
| | | * @param position 位置 |
| | | * @param position 位置 |
| | | * @param houseIdBean 电站id对象 |
| | | * @param list 逆变器列表 |
| | | */ |
| | | private void deleteResidence(String homeId, List<GatewayBean> list, int position) { |
| | | private void deleteResidence(int position, HouseIdBean houseIdBean, List<GatewayBean> list) { |
| | | |
| | | //删除住宅 |
| | | HdlResidenceLogic.getInstance().delResidence(homeId, new CloudCallBeak<Boolean>() { |
| | | HdlResidenceLogic.getInstance().delResidence(houseIdBean.getHomeId(), new CloudCallBeak<Boolean>() { |
| | | @Override |
| | | public void onSuccess(Boolean obj) { |
| | | hideLoading(); |
| | | initializeInverter(list); //发起初始化指令给逆变器;(注意:前面已先解绑云端逆变器,mqtt通道已断开,初始化只能是本地发送(先搜索局域网逆变器列表,建立本地通讯通道)) |
| | | HdlResidenceLogic.getInstance().delHouseId(homeId);//删除电站缓存 |
| | | if (houseIdBean.getDebugType().equals(DebugType.NORMAL)) { |
| | | initializeInverter(list); //发起初始化指令给逆变器;(注意:前面已先解绑云端逆变器,mqtt通道已断开,初始化只能是本地发送(先搜索局域网逆变器列表,建立本地通讯通道)) |
| | | } |
| | | HdlResidenceLogic.getInstance().delHouseId(houseIdBean.getHomeId());//删除电站缓存 |
| | | initData();//初始化缓存数据 |
| | | if (houseInfoAdapter != null) { |
| | | // houseInfoAdapter.setList(houseListBeanIDList, powerStationStatusValue);//重新刷新列表 |
| | | houseInfoAdapter.notifyItemRemoved(position);//只刷新当前的位置 |
| | | houseInfoAdapter.setList(houseListBeanIDList, powerStationStatusValue);//重新刷新列表 |
| | | // houseInfoAdapter.notifyItemRemoved(position);//只刷新当前的位置 |
| | | } |
| | | getStatusOverview();//删除成功后刷新电站状态概览 |
| | | nullDataUpdateUi();//检测数据是否为空 |