From ef0dba8548e2813beee2af8c8c3db72c3cb56da0 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期三, 30 七月 2025 18:53:07 +0800 Subject: [PATCH] 2025年07月30日18:53:03 --- app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java | 88 +++++++++++++++++++++++++------------------ 1 files changed, 51 insertions(+), 37 deletions(-) diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java b/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java index de58c0a..703bf16 100644 --- a/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java +++ b/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java @@ -32,6 +32,7 @@ import com.hdl.photovoltaic.enums.HomepageTitleTabSwitch; import com.hdl.photovoltaic.enums.LowerTagType; import com.hdl.photovoltaic.enums.PowerStationStatus; +import com.hdl.photovoltaic.enums.ProjectOperation; import com.hdl.photovoltaic.enums.ShowErrorMode; import com.hdl.photovoltaic.enums.SortType; import com.hdl.photovoltaic.enums.SortValue; @@ -317,49 +318,59 @@ @Override public void onDelClick(int position, HouseIdBean houseIdBean) { - + final boolean isWaitDelivered = houseIdBean.getDebugStatus().equals(DebugStatus.WAIT_DELIVERED); DelayedConfirmationCancelDialog delayedConfirmationCancelDialog = new DelayedConfirmationCancelDialog(_mActivity); delayedConfirmationCancelDialog.show(); delayedConfirmationCancelDialog.isHideTitle(true); String homeName = "\"" + houseIdBean.getHomeName() + "\""; - delayedConfirmationCancelDialog.setContent(getString(R.string.delete_power_station).replace("%s", homeName)); - - delayedConfirmationCancelDialog.startCountdown(4); + if (isWaitDelivered) { + //"鏄惁灏嗙數绔欑殑璋冭瘯鐘舵�佸洖閫�鍒拌皟璇曚腑" + delayedConfirmationCancelDialog.setContent(getString(R.string.debug_status_rollback).replace("%s", homeName)); + } else { + delayedConfirmationCancelDialog.startCountdown(4); + delayedConfirmationCancelDialog.setContent(getString(R.string.delete_power_station).replace("%s", homeName)); + } delayedConfirmationCancelDialog.setYesOnclickListener(new DelayedConfirmationCancelDialog.onYesOnclickListener() { @Override public void Confirm() { delayedConfirmationCancelDialog.dismiss(); - 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); + if (isWaitDelivered) { + showLoading(); + HdlResidenceLogic.getInstance().setUpdateProjectDebugStatus(houseIdBean.getHomeId(), houseIdBean.getCommunityId(), houseIdBean.getFlowRecordContent(), ProjectOperation.DEBUGGING_AGAIN.toString(), new CloudCallBeak<Boolean>() { + @Override + public void onSuccess(Boolean list) { + hideLoading(); + if (houseInfoAdapter != null) { + houseIdBean.setDebugStatus(DebugStatus.Debugging); + HdlResidenceLogic.getInstance().updateHouseIdBean(houseIdBean); + initData(); + //鏇存柊UI + houseInfoAdapter.notifyItemChanged(position); + } + } - } + @Override + public void onFailure(HDLException e) { + hideLoading(); + } + }); + } 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); - @Override - public void onFailure(HDLException e) { - //鍙戣捣鍒犻櫎鐢电珯鎸囦护 - deleteResidence(houseIdBean.getHomeId(), null); - } - }); + } -// //鍒犻櫎浣忓畢 -// HdlResidenceLogic.getInstance().delResidence(houseIdBean.getHomeId(), new CloudCallBeak<Boolean>() { -// @Override -// public void onSuccess(Boolean obj) { -// HdlResidenceLogic.getInstance().delHouseId(houseIdBean.getHomeId()); -// initData();//鍒濆鍖栫紦瀛樻暟鎹� -// houseInfoAdapter.setList(houseListBeanIDList);//閲嶆柊鍒锋柊鍒楄〃 -// nullDataUpdateUi(houseListBeanIDList);//妫�娴嬫暟鎹槸鍚︿负绌� -// } -// -// @Override -// public void onFailure(HDLException e) { -// HdlThreadLogic.toast(_mActivity, e); -// } -// }); + @Override + public void onFailure(HDLException e) { + //鍙戣捣鍒犻櫎鐢电珯鎸囦护 + deleteResidence(houseIdBean.getHomeId(), null, position); + } + }); + } } }); delayedConfirmationCancelDialog.setNoOnclickListener(new DelayedConfirmationCancelDialog.onNoOnclickListener() { @@ -538,7 +549,6 @@ viewBinding.fragmentHouseSrlListRc.setLayoutManager(new LinearLayoutManager(_mActivity)); viewBinding.fragmentHouseSrlListRc.setAdapter(houseInfoAdapter); houseInfoAdapter.setList(this.houseListBeanIDList, powerStationStatusValue); - //璁惧鏍囩 deviceInfoAdapter = new DeviceInfoAdapter(_mActivity); viewBinding.fragmentDeviceSrlListRc.setLayoutManager(new LinearLayoutManager(_mActivity)); @@ -975,10 +985,11 @@ /** * 鍒犻櫎鐢电珯 * - * @param homeId 鐢电珯id - * @param list 閫嗗彉鍣ㄥ垪琛� + * @param homeId 鐢电珯id + * @param list 閫嗗彉鍣ㄥ垪琛� + * @param position 浣嶇疆 */ - private void deleteResidence(String homeId, List<GatewayBean> list) { + private void deleteResidence(String homeId, List<GatewayBean> list, int position) { //鍒犻櫎浣忓畢 HdlResidenceLogic.getInstance().delResidence(homeId, new CloudCallBeak<Boolean>() { @@ -988,7 +999,10 @@ initializeInverter(list); //鍙戣捣鍒濆鍖栨寚浠ょ粰閫嗗彉鍣�;锛堟敞鎰�:鍓嶉潰宸插厛瑙g粦浜戠閫嗗彉鍣紝mqtt閫氶亾宸叉柇寮�锛屽垵濮嬪寲鍙兘鏄湰鍦板彂閫�(鍏堟悳绱㈠眬鍩熺綉閫嗗彉鍣ㄥ垪琛紝寤虹珛鏈湴閫氳閫氶亾)锛� HdlResidenceLogic.getInstance().delHouseId(homeId);//鍒犻櫎鐢电珯缂撳瓨 initData();//鍒濆鍖栫紦瀛樻暟鎹� - houseInfoAdapter.setList(houseListBeanIDList, powerStationStatusValue);//閲嶆柊鍒锋柊鍒楄〃 + if (houseInfoAdapter != null) { +// houseInfoAdapter.setList(houseListBeanIDList, powerStationStatusValue);//閲嶆柊鍒锋柊鍒楄〃 + houseInfoAdapter.notifyItemRemoved(position);//鍙埛鏂板綋鍓嶇殑浣嶇疆 + } getStatusOverview();//鍒犻櫎鎴愬姛鍚庡埛鏂扮數绔欑姸鎬佹瑙� nullDataUpdateUi();//妫�娴嬫暟鎹槸鍚︿负绌� } -- Gitblit v1.8.0