From c375fbf7af6b4690df04887edfc9e13817fb2cd6 Mon Sep 17 00:00:00 2001 From: liup <1454939542@qq.com> Date: Tue, 21 May 2024 09:55:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=85=E5=AD=98=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/deploymentTargetSelector.xml | 8 + app/build.gradle | 2 +- .../bonait/bnframework/HBL/API/APIHelper.java | 36 ++ .../bnframework/HttpModel/APIService.java | 15 +- .../bonait/bnframework/MainApplication.java | 15 + .../bonait/bnframework/common/db/QueryDB.java | 8 +- .../bnframework/common/db/mode/BPA_GOODS.java | 16 + .../adapter/FilePickerShowAdapter.java | 4 +- .../common/linktab/good/GoodLeftAdapter.java | 11 +- .../home/adapter/loadinggood_adapter.java | 9 + .../home/adapter/newmakegood_adapter.java | 13 +- .../home/fragment/MakeGoodFragment.java | 295 ++++++++------- .../fragment/from/GoodPeiFangActivity.java | 23 +- .../fragment/from/ImageSourceActivity.java | 4 + .../home/fragment/from/JcsjglActivity.java | 1 + .../home/fragment/from/LogActivity.java | 13 + .../home/fragment/from/OrderListActivity.java | 14 +- .../fragment/from/PlcControlActivity.java | 1 + .../home/fragment/from/RealTimeActivity.java | 10 +- .../from/SalesStatisticsActivity.java | 10 + .../home/fragment/from/SilosNewActivity.java | 10 +- .../from/SystemParameterActivity.java | 11 + .../from/fragment/Jcsjgl_sxgl_fragment.java | 355 ++++++++++-------- .../from/fragment/Jcsjgl_wl_fragment.java | 135 ++++--- .../home/fragment/mode/add_good_control.java | 14 + .../home/fragment/mode/add_pf_control.java | 71 +++- .../fragment/mode/add_pf_home_control.java | 85 +++-- .../mode/add_yijian_controlextends.java | 12 + .../home/fragment/mode/silos_jiaoyan.java | 17 +- .../welcome/activity/WelcomeActivity.java | 3 + .../main/res/layout/activity_silos_new.xml | 2 + .../res/layout/item/layout/newmakegood.xml | 2 +- 32 files changed, 785 insertions(+), 440 deletions(-) diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml index b268ef36..2e0aa93f 100644 --- a/.idea/deploymentTargetSelector.xml +++ b/.idea/deploymentTargetSelector.xml @@ -4,6 +4,14 @@ diff --git a/app/build.gradle b/app/build.gradle index a232d07f..b1926780 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -133,7 +133,7 @@ dependencies { //leak 内存泄漏检测 - debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-alpha-3' +// debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-alpha-3' //Modbus implementation 'com.github.licheedev:Modbus4Android:2.0.2' diff --git a/app/src/main/java/com/bonait/bnframework/HBL/API/APIHelper.java b/app/src/main/java/com/bonait/bnframework/HBL/API/APIHelper.java index 4ba0180c..7af51227 100644 --- a/app/src/main/java/com/bonait/bnframework/HBL/API/APIHelper.java +++ b/app/src/main/java/com/bonait/bnframework/HBL/API/APIHelper.java @@ -588,6 +588,42 @@ public class APIHelper { }).start(); } + public static OperateResultT GetT(String path, Map params, TypeReference> defaultValue) { + try { + String ResponseAdd = BuildUrlWithParams(path,params);//请求地址和参数 + URL url = new URL(ResponseAdd); + HttpURLConnection Connection = (HttpURLConnection) url.openConnection(); + Connection.setRequestMethod("GET"); + Connection.setConnectTimeout(3000); + Connection.setReadTimeout(3000); + int responseCode = Connection.getResponseCode(); + if (responseCode == Connection.HTTP_OK) { + InputStream inputStream = Connection.getInputStream(); + ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream(); + byte[] bytes = new byte[1024]; + int length = 0; + while ((length = inputStream.read(bytes)) != -1) { + arrayOutputStream.write(bytes, 0, length); + arrayOutputStream.flush();//强制释放缓冲区 + } + String s = arrayOutputStream.toString(); + APIResultT res = JSON.parseObject(s,defaultValue); + if(res!=null && res.succeeded.toUpperCase().equals("TRUE")){ + return OperateResultT.CreateSuccess(res.data); + }else { + return OperateResultT.CreateFailed("内容解析失败"); + } + } else { + MessageLog.ShowError("get 请求失败"); + return OperateResultT.CreateFailed("get 请求失败"); + } + } catch (Exception e) { + MessageLog.ShowError(e); + return OperateResultT.CreateFailed("POST 请求异常"); + } + } + + /** * 请求参数拼接 * @param Url 请求地址 diff --git a/app/src/main/java/com/bonait/bnframework/HttpModel/APIService.java b/app/src/main/java/com/bonait/bnframework/HttpModel/APIService.java index 1c2ff3e5..ed5fa8d5 100644 --- a/app/src/main/java/com/bonait/bnframework/HttpModel/APIService.java +++ b/app/src/main/java/com/bonait/bnframework/HttpModel/APIService.java @@ -12,7 +12,10 @@ import com.bonait.bnframework.common.db.mode.BPA_GOODSTYPE; import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicReference; @@ -33,16 +36,20 @@ public class APIService { } private static void GetGoodsInfo(){ - String url = "http://192.168.1.50:5007/api/goods/Getdevicegoods?deviceId=1a2a1d72-752f-44cf-87f8-ec9fe4ea15b8"; - APIHelper.PostT(url,null,null,new TypeReference>>(){}).OnSource(s->{ + String url = "https://cfv.black-pa.com/api/goods/getbyidgoods?deviceId=03192d70-bd37-40b2-8c03-2721c236e8f2"; +// String url = "http://192.168.1.50:5007/api/goods/Getdevicegoods?deviceId=1a2a1d72-752f-44cf-87f8-ec9fe4ea15b8"; + + APIHelper.GetT(url,null,new TypeReference>>(){}).OnSource(s->{ deviceGoodInfo=s.Content; UpdateLocalGoodsInfo(); }); } private static void GetMaterialInfo(){ - String url = "http://192.168.1.50:5006/api/ExternalPlatform/Material/GetMaterialPageList"; - String key ="962a5892-0f7f-47b4-a1ec-925bd7914a6d"; + String url = "https://cfv.black-pa.com/api/ExternalPlatform/Material/GetMaterialPageList"; +// String url = "http://192.168.1.50:5006/api/ExternalPlatform/Material/GetMaterialPageList"; + String key ="2c39bc05-25c2-46c4-b5c6-dba349058492"; +// String key ="962a5892-0f7f-47b4-a1ec-925bd7914a6d"; APIHelper.PostT(url,new MaterialRequestPar(1,100),key,new TypeReference>(){}).OnSource(s->{ materialModels=s.Content; UpdateLocalMaterial(); diff --git a/app/src/main/java/com/bonait/bnframework/MainApplication.java b/app/src/main/java/com/bonait/bnframework/MainApplication.java index a362081a..96385354 100644 --- a/app/src/main/java/com/bonait/bnframework/MainApplication.java +++ b/app/src/main/java/com/bonait/bnframework/MainApplication.java @@ -12,6 +12,7 @@ import android.util.Log; import androidx.core.content.ContextCompat; +import com.apkfuns.logutils.LogUtils; import com.bonait.bnframework.business.ConfigData; import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.constant.DataBus; @@ -29,6 +30,7 @@ import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL; import com.bonait.bnframework.common.db.mode.BPA_USER; import com.bonait.bnframework.common.db.res.AlertLogEnum; import com.bonait.bnframework.common.db.res.UserLogEnum; +import com.bonait.bnframework.common.glide.GlideApp; import com.bonait.bnframework.common.helper.CrashHandler; import com.bonait.bnframework.common.helper.I.IMessageLogNotify; import com.bonait.bnframework.common.helper.MessageLog; @@ -92,6 +94,13 @@ public class MainApplication extends Application { } } + @Override + public void onLowMemory() { + LogUtils.d("MainApplication onLowMemory"); + super.onLowMemory(); + GlideApp.get(this).clearMemory(); + } + /** * 腾讯bugly 异常检测上班 */ @@ -136,4 +145,10 @@ public class MainApplication extends Application { } return null; } + + @Override + protected void attachBaseContext(Context base) { + super.attachBaseContext(base); +// MultiDex.install(this); + } } diff --git a/app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java b/app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java index 472d8d72..a1d22970 100644 --- a/app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java +++ b/app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java @@ -3583,10 +3583,10 @@ public class QueryDB { data = new BPA_SILOS_CALIBRATE(); //私有 ((BPA_SILOS_CALIBRATE) data).name = cursor.getString((int) cursor.getColumnIndex("name")); - ((BPA_SILOS_CALIBRATE) data).inputWightMin = cursor.getInt((int) cursor.getColumnIndex("inputWightMin")); - ((BPA_SILOS_CALIBRATE) data).inputWightMax = cursor.getInt((int) cursor.getColumnIndex("inputWightMax")); - ((BPA_SILOS_CALIBRATE) data).outputTimeMin = cursor.getInt((int) cursor.getColumnIndex("outputTimeMin")); - ((BPA_SILOS_CALIBRATE) data).outputTimeMax = cursor.getInt((int) cursor.getColumnIndex("outputTimeMax")); + ((BPA_SILOS_CALIBRATE) data).inputWightMin = cursor.getFloat((int) cursor.getColumnIndex("inputWightMin")); + ((BPA_SILOS_CALIBRATE) data).inputWightMax = cursor.getFloat((int) cursor.getColumnIndex("inputWightMax")); + ((BPA_SILOS_CALIBRATE) data).outputTimeMin = cursor.getFloat((int) cursor.getColumnIndex("outputTimeMin")); + ((BPA_SILOS_CALIBRATE) data).outputTimeMax = cursor.getFloat((int) cursor.getColumnIndex("outputTimeMax")); ((BPA_SILOS_CALIBRATE) data).num = cursor.getInt((int) cursor.getColumnIndex("num")); break; } diff --git a/app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_GOODS.java b/app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_GOODS.java index 5958de95..1a3ae230 100644 --- a/app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_GOODS.java +++ b/app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_GOODS.java @@ -25,4 +25,20 @@ public class BPA_GOODS extends ModeBase { public String materialids; //外键集合 public String foreignKeyRe;//商品外键id + + @Override + public String toString() { + return "BPA_GOODS{" + + "name='" + name + '\'' + + ", url='" + url + '\'' + + ", sort=" + sort + + ", status=" + status + + ", maketime=" + maketime + + ", issc=" + issc + + ", gyid='" + gyid + '\'' + + ", goodtype='" + goodtype + '\'' + + ", materialids='" + materialids + '\'' + + ", foreignKeyRe='" + foreignKeyRe + '\'' + + '}'; + } } diff --git a/app/src/main/java/com/bonait/bnframework/common/filepicker/adapter/FilePickerShowAdapter.java b/app/src/main/java/com/bonait/bnframework/common/filepicker/adapter/FilePickerShowAdapter.java index 80c83626..b26edb47 100644 --- a/app/src/main/java/com/bonait/bnframework/common/filepicker/adapter/FilePickerShowAdapter.java +++ b/app/src/main/java/com/bonait/bnframework/common/filepicker/adapter/FilePickerShowAdapter.java @@ -32,7 +32,6 @@ import java.util.ArrayList; public class FilePickerShowAdapter extends RecyclerView.Adapter { private final LayoutInflater mLayoutInflater; - private Context mContext; private ArrayList mDataList; private OnDeleteListener mOnDeleteListener; private OnFileItemClickListener mOnItemClickListener; @@ -46,7 +45,6 @@ public class FilePickerShowAdapter extends RecyclerView.Adapter dataList) { - mContext = context; mLayoutInflater = LayoutInflater.from(context); mDataList = dataList; } @@ -67,7 +65,7 @@ public class FilePickerShowAdapter extends RecyclerView.Adapter public List Fdata; public Resources resources; public LinearLayoutManager Manager; + private CallBack callBack; - public GoodLeftAdapter(@LayoutRes int layoutResId, @Nullable List data, Resources _resources, LinearLayoutManager _manager) { + public GoodLeftAdapter(@LayoutRes int layoutResId, @Nullable List data, Resources _resources, LinearLayoutManager _manager,CallBack callBack) { super(layoutResId, data); resources = _resources; Fdata = data; Manager = _manager; + this.callBack =callBack; } @Override @@ -117,6 +119,9 @@ public class GoodLeftAdapter extends BaseQuickAdapter public void onClick(QMUIDialog dialog, int index) { Detele(index_d); dialog.dismiss(); + if(callBack!=null){ + callBack.delete(); + } } }); } @@ -146,4 +151,8 @@ public class GoodLeftAdapter extends BaseQuickAdapter Fdata.get(position).isChoose = true; notifyDataSetChanged(); } + + public interface CallBack{ + void delete(); + } } diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/adapter/loadinggood_adapter.java b/app/src/main/java/com/bonait/bnframework/modules/home/adapter/loadinggood_adapter.java index 6bc8b18e..5eacdb8b 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/adapter/loadinggood_adapter.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/adapter/loadinggood_adapter.java @@ -56,6 +56,15 @@ public class loadinggood_adapter extends RecyclerView.Adapter=60) //12秒执行一次 - { - ArrayList lcModes = DataBus.getInstance().ResGetLc(); - String title=""; - for (lcMode item:lcModes) + while (true && !destroy) { + if(mHandler!=null){ + try { + mHandler.sendEmptyMessage(0); + if(time>=60) //12秒执行一次 { - //lcMode.warningValue >= lcMode.silosmargin - //总量大于0 绑定了物料 告警值设置了 告警大于余量 告警 - if(item.siloszl>0 && !item.materialId.isEmpty() && item.warningValue>0 && item.warningValue >= item.silosmargin) + ArrayList lcModes = DataBus.getInstance().ResGetLc(); + String title=""; + for (lcMode item:lcModes) { - title+="料仓"+item.num+"-"+item.materialName+"|"; + //lcMode.warningValue >= lcMode.silosmargin + //总量大于0 绑定了物料 告警值设置了 告警大于余量 告警 + if(item.siloszl>0 && !item.materialId.isEmpty() && item.warningValue>0 && item.warningValue >= item.silosmargin) + { + title+="料仓"+item.num+"-"+item.materialName+"|"; + } } - } - if(!title.isEmpty()) - { - String finalTitle = title; - activity.runOnUiThread(new Runnable() { - @Override - public void run() { - //0.6 --- 0.9 - CookieHelper.Show(activity, finalTitle +"-余量提示","料仓余量不足,请及时补料!若程序预警错误,请及时手动补充原料后,在料仓界面点击《补充原料》"); - } - }); - } + if(!title.isEmpty()) + { + String finalTitle = title; + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + //0.6 --- 0.9 + CookieHelper.Show(activity, finalTitle +"-余量提示","料仓余量不足,请及时补料!若程序预警错误,请及时手动补充原料后,在料仓界面点击《补充原料》"); + } + }); + } - time=0; + time=0; + } + Thread.sleep(200); + time++; + } catch (Exception ex) { + ToastUtils.error("异常信息:" + ex.getMessage()); } - Thread.sleep(200); - time++; - } catch (Exception ex) { - ToastUtils.error("异常信息:" + ex.getMessage()); } } } @@ -676,106 +695,106 @@ public class MakeGoodFragment extends BaseFragment { ExecuteTheRecipe.OnScanTheCodeInformationT = new IRunT() { @Override public void Run(String msg2) { - - activity.runOnUiThread(new Runnable() { - @Override - public void run() { - String msg = msg2; + if(activity!=null){ + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + String msg = msg2; // if(ConfigName.TEST){ // msg = " |03cb1364-8b85-446a-b00b-d3657de1a19f| | "; // } - if ((msg != null) && (((String) msg).length() > 2) && ((String) msg).contains("|")) { - //拿到扫码数据 - //例如 ORD001|P0003|A001,M002,T001|2 - // OR001|A001|2,22|1 - - String[] res = ((String) msg).split("[|]"); - if (res.length >= 4) { - String orderid = res[0];//ORD001 - String goodid = res[1];//P0003 商品id - String ggid = res[2];//A001,M002,T001 配方ids - - String ggids = "";//规格id集合 - String names = ""; - - if (QueryDB.GetOrderthirdPartyIDIs(orderid)) { - message = "已有订单,重复扫码!"; - mHandler.sendEmptyMessage(1); - return; - } - int num = 1; - try { - num = Integer.parseInt(res[3]); - for (String item : ggid.split("[,]")) { - for (ResGoodProperty k : DataBus.getInstance().bpa_goodproperties) { - if (k.child != null && k.child.size() > 0) { - for (ResGoodProperty chd : k.child) { - if (chd.foreignKeyRe != null && !chd.foreignKeyRe.isEmpty() && chd.foreignKeyRe.equals(item)) { - ggids += chd.id + ","; - names += "/" + chd.name; + if ((msg != null) && (((String) msg).length() > 2) && ((String) msg).contains("|")) { + //拿到扫码数据 + //例如 ORD001|P0003|A001,M002,T001|2 + // OR001|A001|2,22|1 + + String[] res = ((String) msg).split("[|]"); + if (res.length >= 4) { + String orderid = res[0];//ORD001 + String goodid = res[1];//P0003 商品id + String ggid = res[2];//A001,M002,T001 配方ids + + String ggids = "";//规格id集合 + String names = ""; + + if (QueryDB.GetOrderthirdPartyIDIs(orderid)) { + message = "已有订单,重复扫码!"; + mHandler.sendEmptyMessage(1); + return; + } + int num = 1; + try { + num = Integer.parseInt(res[3]); + for (String item : ggid.split("[,]")) { + for (ResGoodProperty k : DataBus.getInstance().bpa_goodproperties) { + if (k.child != null && k.child.size() > 0) { + for (ResGoodProperty chd : k.child) { + if (chd.foreignKeyRe != null && !chd.foreignKeyRe.isEmpty() && chd.foreignKeyRe.equals(item)) { + ggids += chd.id + ","; + names += "/" + chd.name; + } } } - } + } } - } - if (!ggids.isEmpty()) { - ggids = ggids.substring(0, ggids.length() - 1); + if (!ggids.isEmpty()) { + ggids = ggids.substring(0, ggids.length() - 1); + } + } catch (Exception ex) { } - } catch (Exception ex) { - } - BPA_GOODS good = QueryDB.GetGoodsforeignKeyId(goodid); - ConfigName.getInstance(); + BPA_GOODS good = QueryDB.GetGoodsforeignKeyId(goodid); + ConfigName.getInstance(); // if(ConfigName.TEST){ // good = QueryDB.GetGoodsId(goodid); // } - if (good == null) { - message = "没有查询到该商品!"; - mHandler.sendEmptyMessage(1); - } else { - BPA_GOODSRECIPENAME goodsrecipename = QueryDB.GetGoodsRecipeNameDesignId(ggids, good.id); - if (goodsrecipename != null) { - BPA_ORDER order = new BPA_ORDER(); - order.thirdPartyID = orderid; - order.status = 0; - order.deviceID = ConfigName.getInstance().DeviceId; - order.userID = ConfigName.getInstance().user.userID; - QueryDB.AddOrder(order); - - for (int mm = 0; mm < num; mm++) { - BPA_SUBORDER suborder = new BPA_SUBORDER(); - suborder.deviceID = ConfigName.getInstance().DeviceId; - suborder.userID = ConfigName.getInstance().user.userID; - suborder.orderID = order.id; - suborder.goodsID = good.id; - suborder.recipeID = goodsrecipename.id; - suborder.number = 1; - suborder.status = 0; - suborder.exp = names; - QueryDB.AddSubOrder(suborder); - DataBus.getInstance().AddGoodsMake(suborder); - } - message = "加入订单队列成功!"; - mHandler.sendEmptyMessage(2); - } else { - message = "没有查询到该商品配方信息!"; + if (good == null) { + message = "没有查询到该商品!"; mHandler.sendEmptyMessage(1); + } else { + BPA_GOODSRECIPENAME goodsrecipename = QueryDB.GetGoodsRecipeNameDesignId(ggids, good.id); + if (goodsrecipename != null) { + BPA_ORDER order = new BPA_ORDER(); + order.thirdPartyID = orderid; + order.status = 0; + order.deviceID = ConfigName.getInstance().DeviceId; + order.userID = ConfigName.getInstance().user.userID; + QueryDB.AddOrder(order); + + for (int mm = 0; mm < num; mm++) { + BPA_SUBORDER suborder = new BPA_SUBORDER(); + suborder.deviceID = ConfigName.getInstance().DeviceId; + suborder.userID = ConfigName.getInstance().user.userID; + suborder.orderID = order.id; + suborder.goodsID = good.id; + suborder.recipeID = goodsrecipename.id; + suborder.number = 1; + suborder.status = 0; + suborder.exp = names; + QueryDB.AddSubOrder(suborder); + DataBus.getInstance().AddGoodsMake(suborder); + } + message = "加入订单队列成功!"; + mHandler.sendEmptyMessage(2); + } else { + message = "没有查询到该商品配方信息!"; + mHandler.sendEmptyMessage(1); + } } - } + } else { + message = "没有查询到该商品!"; + mHandler.sendEmptyMessage(1); + } } else { - message = "没有查询到该商品!"; + message = "服务器异常,请稍后重试!"; mHandler.sendEmptyMessage(1); } - } else { - message = "服务器异常,请稍后重试!"; - mHandler.sendEmptyMessage(1); } - } - }); - + }); + } } }; @@ -830,10 +849,24 @@ public class MakeGoodFragment extends BaseFragment { public void onDestroy() { super.onDestroy(); Logger.d("第一页销毁"); - + destroy = true; + isResume = false; + myClickListener = null; + Fdata.clear(); + Fdata = null; + datatab_paiduishangping.setAdapter(null); rv_right.setAdapter(null); + if(DataBus.getInstance().loadinggoodAdapter!=null){ + DataBus.getInstance().loadinggoodAdapter.destroy(); + } Glide.get(getContext()).clearMemory(); + ExecuteTheRecipe.OnScanTheCodeInformationT = null; MessageManager.getInstance().unRegisterMessageReceiver(getActivity()); + if(mHandler!=null){ + mHandler.removeCallbacksAndMessages(null); + mHandler = null; + } + activity = null; } /** diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/GoodPeiFangActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/GoodPeiFangActivity.java index 93138ce9..1aa04a23 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/GoodPeiFangActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/GoodPeiFangActivity.java @@ -293,6 +293,8 @@ public class GoodPeiFangActivity extends BaseActivity { */ ArrayList bpa_goodproperties = new ArrayList<>(); public List Fdata = new ArrayList<>(); + private GoodLeftAdapter leftAdapter; + private GoodRightAdapter rightAdapter; /** * 初始化数据 @@ -338,8 +340,15 @@ public class GoodPeiFangActivity extends BaseActivity { } LinearLayoutManager manager = (LinearLayoutManager) rv_right.getLayoutManager(); - GoodLeftAdapter leftAdapter = new GoodLeftAdapter(R.layout.item_left_good, Fdata, getResources(), manager); - GoodRightAdapter rightAdapter = new GoodRightAdapter(R.layout.item_right_lc, Fdata, getResources()); + leftAdapter = new GoodLeftAdapter(R.layout.item_left_good, Fdata, getResources(), manager, new GoodLeftAdapter.CallBack() { + @Override + public void delete() { + if(rightAdapter!=null){ + rightAdapter.notifyDataSetChanged(); + } + } + }); + rightAdapter = new GoodRightAdapter(R.layout.item_right_lc, Fdata, getResources()); rv_left.setAdapter(leftAdapter); rv_right.setAdapter(rightAdapter); @@ -422,10 +431,20 @@ public class GoodPeiFangActivity extends BaseActivity { public void onDestroy() { add_pf.destroy(); add_good.destroy(); + add_pf_home.destroy(); super.onDestroy(); + add_good.mListener = null; + add_pf_home.mListener = null; + add_pf.mListener = null; + goodstypes.clear(); + goodstypes = null; + rv_right.setAdapter(null); + rv_left.setAdapter(null); Glide.get(this).clearMemory(); MessageManager.getInstance().unRegisterMessageReceiver(this); + context = null; + activity = null; } @Override diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/ImageSourceActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/ImageSourceActivity.java index 6c7ad47a..31c0cac2 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/ImageSourceActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/ImageSourceActivity.java @@ -181,6 +181,10 @@ public class ImageSourceActivity extends BaseActivity { @Override public void onDestroy() { super.onDestroy(); + yx_files.clear(); + yx_files = null; + mRecyclerView.setAdapter(null); + rl_yx_file.setAdapter(null); } @Override diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/JcsjglActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/JcsjglActivity.java index d041b49d..de4c2e54 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/JcsjglActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/JcsjglActivity.java @@ -109,6 +109,7 @@ public class JcsjglActivity extends BaseActivity { @Override public void onDestroy() { super.onDestroy(); + viewpager_wl.setAdapter(null); } @Override diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/LogActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/LogActivity.java index a0ac3662..fe4386d5 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/LogActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/LogActivity.java @@ -238,6 +238,19 @@ public class LogActivity extends BaseActivity { @Override public void onDestroy() { super.onDestroy(); + bpa_logs.clear(); + bpa_logs = null; + if(adapter!=null){ + adapter.clear(); + adapter = null; + } + + datatab.setAdapter(null); + rzlx.setAdapter(null); + datatab = null; + lx_map.clear(); + lx_map = null; + context = null; } @Override diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/OrderListActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/OrderListActivity.java index bd25440d..56467545 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/OrderListActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/OrderListActivity.java @@ -95,7 +95,8 @@ public class OrderListActivity extends BaseActivity { Spinner rzlx; Map lx_map = new LinkedHashMap<>(); //endregion - private Context context;private ViewGroup view; + private Context context; + private ViewGroup view; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -234,6 +235,17 @@ public class OrderListActivity extends BaseActivity { @Override public void onDestroy() { super.onDestroy(); + if(adapter!=null){ + adapter.clear(); + adapter = null; + } + + subOrders.clear(); + subOrders = null; + lx_map.clear(); + lx_map = null; + context = null; + } @Override diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/PlcControlActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/PlcControlActivity.java index d6e25259..98d363f2 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/PlcControlActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/PlcControlActivity.java @@ -96,6 +96,7 @@ public class PlcControlActivity extends BaseActivity { @Override public void onDestroy() { super.onDestroy(); + viewpager_wl.setAdapter(null); } @Override diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/RealTimeActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/RealTimeActivity.java index 7394d397..800f231e 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/RealTimeActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/RealTimeActivity.java @@ -42,14 +42,12 @@ public class RealTimeActivity extends BaseActivity { QMUITopBarLayout mTopBar; @BindView(R.id.recycler_view) RecyclerView recycler_view; - private Context context; Activity activity=null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_realtime); ButterKnife.bind(this); - context=getContext(); activity=this; initTopBar(); initFragment(); @@ -250,6 +248,14 @@ public class RealTimeActivity extends BaseActivity { @Override public void onDestroy() { super.onDestroy(); + if(adapter != null){ + adapter.statusModes.clear(); + adapter.statusModes = null; + adapter.activity = null; + adapter = null; + } + recycler_view.setAdapter(null); + activity = null; } @Override diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SalesStatisticsActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SalesStatisticsActivity.java index 1671123d..7f561b18 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SalesStatisticsActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SalesStatisticsActivity.java @@ -236,6 +236,16 @@ public class SalesStatisticsActivity extends BaseActivity { @Override public void onDestroy() { super.onDestroy(); + subOrders.clear(); + subOrders = null; + subOrdersStatic.clear(); + subOrdersStatic = null; + if(adapter!=null){ + adapter.clear(); + adapter = null; + } + + context = null; } @Override diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SilosNewActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SilosNewActivity.java index e9045b4b..333c3abc 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SilosNewActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SilosNewActivity.java @@ -162,7 +162,7 @@ public class SilosNewActivity extends BaseActivity { @Override public void clickListenerNew(View v, int k, Object data) { if (k == 0) { - silos_jz.close(); + silos_jz.destroy(); } } }; @@ -228,8 +228,14 @@ public class SilosNewActivity extends BaseActivity { @Override public void onDestroy() { super.onDestroy(); - silos_jz.close(); MessageManager.getInstance().unRegisterMessageReceiver(this); + silos_jz.destroy(); + add_yijian.destroy(); + add_yijian.mListener = null; + add_silos.mListener = null; + silos_jz.mListener = null; + activity = null; + context = null; } @Override diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SystemParameterActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SystemParameterActivity.java index 6f629363..05eb0731 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SystemParameterActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SystemParameterActivity.java @@ -213,6 +213,17 @@ public class SystemParameterActivity extends BaseActivity { @Override public void onDestroy() { super.onDestroy(); + environment.setAdapter(null); + versionselection.setAdapter(null); + editTextLists.clear(); + editTextLists = null; + material_map.clear(); + material_map = null; + material_map_vis.clear(); + material_map_vis = null; + bpa_systemsets.clear(); + bpa_systemsets = null; + context= null; } @Override diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/Jcsjgl_sxgl_fragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/Jcsjgl_sxgl_fragment.java index a942f3a6..97be49d1 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/Jcsjgl_sxgl_fragment.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/Jcsjgl_sxgl_fragment.java @@ -36,7 +36,7 @@ import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; -public class Jcsjgl_sxgl_fragment extends BaseFragment implements MyClickListener { +public class Jcsjgl_sxgl_fragment extends BaseFragment {// implements MyClickListener @BindView(R.id.datatab_sx) ListView datatab_sx; @@ -126,194 +126,206 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment implements MyClickListene } } - /** - * 点击事件 - * - * @param v - * @param data - */ - @Override - public void clickListener(View v, Object data) { - switch (v.getId()) { - case R.id.name://修改属性名称按钮 - final QMUIDialog.EditTextDialogBuilder builder = new QMUIDialog.EditTextDialogBuilder(context); - builder.setTitle("属性名称") - .setPlaceholder("在此输入属性名称") - .setDefaultText(((BPA_GOODPROPERTY) data).name) - .setInputType(InputType.TYPE_CLASS_TEXT) - .addAction("取消", new QMUIDialogAction.ActionListener() { - @Override - public void onClick(QMUIDialog dialog, int index) { - dialog.dismiss(); - } - }) - .addAction("确定", new QMUIDialogAction.ActionListener() { - @Override - public void onClick(QMUIDialog dialog, int index) { - CharSequence text = builder.getEditText().getText(); - if (text != null && text.length() > 0) { - if (QueryDB.GetGoodsPropertyIs(text.toString())) { - ToastUtils.info("属性名称重复,请重新输入后重试!"); - return; - } - QueryDB.UpdateGoodsPropertyName(((BPA_GOODPROPERTY) data).id, text.toString()); - Initdata_sx(); + private MyClickListener listener = new MyClickListener() { + @Override + public void clickListener(View v, Object data) { + switch (v.getId()) { + case R.id.name://修改属性名称按钮 + final QMUIDialog.EditTextDialogBuilder builder = new QMUIDialog.EditTextDialogBuilder(context); + builder.setTitle("属性名称") + .setPlaceholder("在此输入属性名称") + .setDefaultText(((BPA_GOODPROPERTY) data).name) + .setInputType(InputType.TYPE_CLASS_TEXT) + .addAction("取消", new QMUIDialogAction.ActionListener() { + @Override + public void onClick(QMUIDialog dialog, int index) { dialog.dismiss(); - } else { - //请填入昵称 - ToastUtils.info("属性名称不能为空!"); } - } - }) - .show(); - break; - case R.id.sort: - final QMUIDialog.EditTextDialogBuilder builder1 = new QMUIDialog.EditTextDialogBuilder(context); - builder1.setTitle("排序") - .setPlaceholder("在此输入排序") - .setDefaultText(((BPA_GOODPROPERTY) data).sort+"") - .setInputType(InputType.TYPE_CLASS_NUMBER) - .addAction("取消", new QMUIDialogAction.ActionListener() { - @Override - public void onClick(QMUIDialog dialog, int index) { - dialog.dismiss(); - } - }) - .addAction("确定", new QMUIDialogAction.ActionListener() { - @Override - public void onClick(QMUIDialog dialog, int index) { - CharSequence text = builder1.getEditText().getText(); - if (text != null && text.length() > 0) { - QueryDB.UpdateGoodsPropertySort(((BPA_GOODPROPERTY) data).id, Integer.parseInt(text.toString())); - Initdata_sx(); + }) + .addAction("确定", new QMUIDialogAction.ActionListener() { + @Override + public void onClick(QMUIDialog dialog, int index) { + CharSequence text = builder.getEditText().getText(); + if (text != null && text.length() > 0) { + if (QueryDB.GetGoodsPropertyIs(text.toString())) { + ToastUtils.info("属性名称重复,请重新输入后重试!"); + return; + } + QueryDB.UpdateGoodsPropertyName(((BPA_GOODPROPERTY) data).id, text.toString()); + Initdata_sx(); + dialog.dismiss(); + } else { + //请填入昵称 + ToastUtils.info("属性名称不能为空!"); + } + } + }) + .show(); + break; + case R.id.sort: + final QMUIDialog.EditTextDialogBuilder builder1 = new QMUIDialog.EditTextDialogBuilder(context); + builder1.setTitle("排序") + .setPlaceholder("在此输入排序") + .setDefaultText(((BPA_GOODPROPERTY) data).sort+"") + .setInputType(InputType.TYPE_CLASS_NUMBER) + .addAction("取消", new QMUIDialogAction.ActionListener() { + @Override + public void onClick(QMUIDialog dialog, int index) { dialog.dismiss(); - } else { - //请填入昵称 - ToastUtils.info("排序不能为空!"); } - } - }) - .show(); - break; - case R.id.typeS: - ArrayList keys=new ArrayList(); - String[] items = itemstypes.keySet().toArray(new String[itemstypes.keySet().size()]); + }) + .addAction("确定", new QMUIDialogAction.ActionListener() { + @Override + public void onClick(QMUIDialog dialog, int index) { + CharSequence text = builder1.getEditText().getText(); + if (text != null && text.length() > 0) { + QueryDB.UpdateGoodsPropertySort(((BPA_GOODPROPERTY) data).id, Integer.parseInt(text.toString())); + Initdata_sx(); + dialog.dismiss(); + } else { + //请填入昵称 + ToastUtils.info("排序不能为空!"); + } + } + }) + .show(); + break; + case R.id.typeS: + ArrayList keys=new ArrayList(); + String[] items = itemstypes.keySet().toArray(new String[itemstypes.keySet().size()]); - if(((BPA_GOODPROPERTY) data).GoodsTypeId!=null && !((BPA_GOODPROPERTY) data).GoodsTypeId.isEmpty()) - { - for (int i=0;i ddd=QueryDB.GetGoodsPropertyALL(((BPA_GOODPROPERTY) data).id); - for (BPA_GOODPROPERTY item:ddd) - { - QueryDB.DeleteGoodsProperty(item); + dialog.dismiss(); } - QueryDB.DeleteGoodsProperty((BPA_GOODPROPERTY) data); - Initdata_sx(); - ToastUtils.info("删除成功"); - dialog.dismiss(); - } - }); + }); + builder3.show(); + break; + case R.id.button_item://删除按钮 + String title = "温馨提示!"; + String message = "客官确定要删除属性【"+((BPA_GOODPROPERTY) data).name+"】吗?"; + AlertDialogUtils.showDialog(context, title, message, new QMUIDialogAction.ActionListener() { + @Override + public void onClick(QMUIDialog dialog, int index) { + ArrayList ddd=QueryDB.GetGoodsPropertyALL(((BPA_GOODPROPERTY) data).id); + for (BPA_GOODPROPERTY item:ddd) + { + QueryDB.DeleteGoodsProperty(item); + } + QueryDB.DeleteGoodsProperty((BPA_GOODPROPERTY) data); + Initdata_sx(); + ToastUtils.info("删除成功"); + dialog.dismiss(); + } + }); - break; - case R.id.button_add://增加子属性 - BPA_GOODPROPERTY sx=(BPA_GOODPROPERTY) data; - BPA_GOODPROPERTY bpa_goodproperty = new BPA_GOODPROPERTY(); - bpa_goodproperty.name = "子属性示例"; - bpa_goodproperty.foreignKeyRe = ""; - bpa_goodproperty.parentid = sx.id; - bpa_goodproperty.sort=0; - bpa_goodproperty.deviceID = ConfigName.getInstance().DeviceId; - bpa_goodproperty.userID = ConfigName.getInstance().user.userID; - QueryDB.AddGoodsProperty(bpa_goodproperty); - ToastUtils.info("新增成功"); - Initdata_sx(); - break; + break; + case R.id.button_add://增加子属性 + BPA_GOODPROPERTY sx=(BPA_GOODPROPERTY) data; + BPA_GOODPROPERTY bpa_goodproperty = new BPA_GOODPROPERTY(); + bpa_goodproperty.name = "子属性示例"; + bpa_goodproperty.foreignKeyRe = ""; + bpa_goodproperty.parentid = sx.id; + bpa_goodproperty.sort=0; + bpa_goodproperty.deviceID = ConfigName.getInstance().DeviceId; + bpa_goodproperty.userID = ConfigName.getInstance().user.userID; + QueryDB.AddGoodsProperty(bpa_goodproperty); + ToastUtils.info("新增成功"); + Initdata_sx(); + break; - case R.id.save_text://保存属性 - QueryDB.UpdateGoodsProperty((BPA_GOODPROPERTY) data); - ToastUtils.info("保存成功"); - Initdata_sx(); - break; - case R.id.delete_text://删除 - String title1 = "温馨提示!"; - String message1 = "客官确定要删除属性【"+((BPA_GOODPROPERTY) data).name+"】吗?"; - AlertDialogUtils.showDialog(context, title1, message1, new QMUIDialogAction.ActionListener() { - @Override - public void onClick(QMUIDialog dialog, int index) { - QueryDB.DeleteGoodsProperty((BPA_GOODPROPERTY) data); - Initdata_sx(); - ToastUtils.info("删除成功"); - dialog.dismiss(); - } - }); - break; + case R.id.save_text://保存属性 + QueryDB.UpdateGoodsProperty((BPA_GOODPROPERTY) data); + ToastUtils.info("保存成功"); + Initdata_sx(); + break; + case R.id.delete_text://删除 + String title1 = "温馨提示!"; + String message1 = "客官确定要删除属性【"+((BPA_GOODPROPERTY) data).name+"】吗?"; + AlertDialogUtils.showDialog(context, title1, message1, new QMUIDialogAction.ActionListener() { + @Override + public void onClick(QMUIDialog dialog, int index) { + QueryDB.DeleteGoodsProperty((BPA_GOODPROPERTY) data); + Initdata_sx(); + ToastUtils.info("删除成功"); + dialog.dismiss(); + } + }); + break; + } } - } - @Override - public void clickListenerNew(View v, int k, Object data) { + @Override + public void clickListenerNew(View v, int k, Object data) { - } + } + }; + +// /** +// * 点击事件 +// * +// * @param v +// * @param data +// */ +// @Override +// public void clickListener(View v, Object data) { +// +// } +// +// @Override +// public void clickListenerNew(View v, int k, Object data) { +// +// } //region 数据加载 /** * 初始化数据加载 @@ -322,7 +334,7 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment implements MyClickListene try { bpa_goodproperties = QueryDB.GetGoodsPropertyALL("0"); - sx_adapter adapter = new sx_adapter(context, R.layout.sx_item, bpa_goodproperties, bpa_goodstypes,this); + sx_adapter adapter = new sx_adapter(context, R.layout.sx_item, bpa_goodproperties, bpa_goodstypes,listener); datatab_sx.setAdapter(adapter); } catch (Exception e) { @@ -334,6 +346,15 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment implements MyClickListene public void onDestroy() { super.onDestroy(); Logger.d("我的fragment销毁"); + bpa_goodproperties.clear(); + bpa_goodproperties = null; + bpa_goodstypes.clear(); + bpa_goodstypes = null; + itemstypes.clear(); + itemstypes = null; + listener = null; + datatab_sx.setAdapter(null); + context = null; } /** diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/Jcsjgl_wl_fragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/Jcsjgl_wl_fragment.java index 7289709d..7d162ec6 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/Jcsjgl_wl_fragment.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/Jcsjgl_wl_fragment.java @@ -30,6 +30,7 @@ import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL; import com.bonait.bnframework.common.db.res.lcMode; import com.bonait.bnframework.common.helper.I.MyClickListener; +import com.bonait.bnframework.common.helper.MY; import com.bonait.bnframework.common.utils.AlertDialogUtils; import com.bonait.bnframework.common.utils.NetworkUtils; import com.bonait.bnframework.common.utils.ToastUtils; @@ -47,7 +48,7 @@ import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; -public class Jcsjgl_wl_fragment extends BaseFragment implements MyClickListener { +public class Jcsjgl_wl_fragment extends BaseFragment {// implements MyClickListener @BindView(R.id.add_wl) Button add_wl; @BindView(R.id.datatab_wl) @@ -175,7 +176,7 @@ public class Jcsjgl_wl_fragment extends BaseFragment implements MyClickListener public void Initdata_wl() { try { bpa_materials = QueryDB.GetMaterialALL(); - wl_adapter adapter = new wl_adapter(context, R.layout.wl_item, bpa_materials, this); + wl_adapter adapter = new wl_adapter(context, R.layout.wl_item, bpa_materials, listener); datatab_wl.setAdapter(adapter); } catch (Exception e) { @@ -190,6 +191,9 @@ public class Jcsjgl_wl_fragment extends BaseFragment implements MyClickListener // DataBus.getInstance().mListener.clickListenerNew(this.getView(), 0, ""); // } Logger.d("我的fragment销毁"); + listener = null; + datatab_wl.setAdapter(null); + context = null; } /** @@ -206,68 +210,79 @@ public class Jcsjgl_wl_fragment extends BaseFragment implements MyClickListener return false; } - /** - * 点击事件 - * - * @param v - * @param data - */ - @Override - public void clickListener(View v, Object data) { - switch (v.getId()) { - case R.id.name://修改物料名称按钮 - case R.id.button_update://修改物料名称按钮 - final QMUIDialog.EditTextDialogBuilder builder = new QMUIDialog.EditTextDialogBuilder(context); - builder.setTitle("物料名称") - .setPlaceholder("在此输入物料名称") - .setDefaultText(((BPA_MATERIAL) data).name) - .setInputType(InputType.TYPE_CLASS_TEXT) - .addAction("取消", new QMUIDialogAction.ActionListener() { - @Override - public void onClick(QMUIDialog dialog, int index) { - dialog.dismiss(); - } - }) - .addAction("确定", new QMUIDialogAction.ActionListener() { - @Override - public void onClick(QMUIDialog dialog, int index) { - CharSequence text = builder.getEditText().getText(); - if (text != null && text.length() > 0) { - if (QueryDB.GetMaterialIs(text.toString())) { - ToastUtils.info("物料名称重复,请重新输入后重试!"); - return; - } - QueryDB.UpdateMaterialName(((BPA_MATERIAL) data).id, text.toString()); - Initdata_wl(); - ToastUtils.info("修改成功"); + private MyClickListener listener = new MyClickListener() { + @Override + public void clickListener(View v, Object data) { + switch (v.getId()) { + case R.id.name://修改物料名称按钮 + case R.id.button_update://修改物料名称按钮 + final QMUIDialog.EditTextDialogBuilder builder = new QMUIDialog.EditTextDialogBuilder(context); + builder.setTitle("物料名称") + .setPlaceholder("在此输入物料名称") + .setDefaultText(((BPA_MATERIAL) data).name) + .setInputType(InputType.TYPE_CLASS_TEXT) + .addAction("取消", new QMUIDialogAction.ActionListener() { + @Override + public void onClick(QMUIDialog dialog, int index) { dialog.dismiss(); - } else { - //请填入昵称 - ToastUtils.info("物料名称不能为空!"); } - } - }) - .show(); - break; - case R.id.button_item://删除按钮 - String title = "温馨提示!"; - String message = "客官确定要删除物料【"+((BPA_MATERIAL) data).name+"】吗?"; - AlertDialogUtils.showDialog(context, title, message, new QMUIDialogAction.ActionListener() { - @Override - public void onClick(QMUIDialog dialog, int index) { - QueryDB.DeleteMaterial((BPA_MATERIAL) data); - Initdata_wl(); - ToastUtils.info("删除成功"); - dialog.dismiss(); - } - }); - break; + }) + .addAction("确定", new QMUIDialogAction.ActionListener() { + @Override + public void onClick(QMUIDialog dialog, int index) { + CharSequence text = builder.getEditText().getText(); + if (text != null && text.length() > 0) { + if (QueryDB.GetMaterialIs(text.toString())) { + ToastUtils.info("物料名称重复,请重新输入后重试!"); + return; + } + QueryDB.UpdateMaterialName(((BPA_MATERIAL) data).id, text.toString()); + Initdata_wl(); + ToastUtils.info("修改成功"); + dialog.dismiss(); + } else { + //请填入昵称 + ToastUtils.info("物料名称不能为空!"); + } + } + }) + .show(); + break; + case R.id.button_item://删除按钮 + String title = "温馨提示!"; + String message = "客官确定要删除物料【"+((BPA_MATERIAL) data).name+"】吗?"; + AlertDialogUtils.showDialog(context, title, message, new QMUIDialogAction.ActionListener() { + @Override + public void onClick(QMUIDialog dialog, int index) { + QueryDB.DeleteMaterial((BPA_MATERIAL) data); + Initdata_wl(); + ToastUtils.info("删除成功"); + dialog.dismiss(); + } + }); + break; + } } - } - @Override - public void clickListenerNew(View v, int k, Object data) { + @Override + public void clickListenerNew(View v, int k, Object data) { - } + } + }; +// /** +// * 点击事件 +// * +// * @param v +// * @param data +// */ +// @Override +// public void clickListener(View v, Object data) { +// +// } +// +// @Override +// public void clickListenerNew(View v, int k, Object data) { +// +// } } \ No newline at end of file diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_good_control.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_good_control.java index 391f1fe9..1cbaeda1 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_good_control.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_good_control.java @@ -231,6 +231,20 @@ public class add_good_control extends LinearLayout { public void destroy(){ MessageManager.getInstance().unRegisterMessageReceiver(activity_ma); + Data = null; + mListener = null; + Types.clear(); + Types = null; + resMaterilas.clear(); + resMaterilas = null; + map_fl.clear(); + map_fl = null; + yesStr = null; + url = null; + if(recycler_view_wl!=null){ + recycler_view_wl.setAdapter(null); + } + activity_ma = null; } public String ids=""; diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_pf_control.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_pf_control.java index dd9a92bb..60605f3d 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_pf_control.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_pf_control.java @@ -47,7 +47,7 @@ import java.util.ArrayList; import butterknife.BindView; import butterknife.ButterKnife; -public class add_pf_control extends LinearLayout implements MyClickListener { +public class add_pf_control extends LinearLayout {// implements MyClickListener @BindView(R.id.peifang_queren) @@ -202,7 +202,7 @@ public class add_pf_control extends LinearLayout implements MyClickListener { { DataBus.getInstance().Recipe=new ArrayList<>(); } - adapter4= new xxpf_adapter(getContext(), R.layout.xxpf_item, DataBus.getInstance().Recipe,this); + adapter4= new xxpf_adapter(getContext(), R.layout.xxpf_item, DataBus.getInstance().Recipe,listener); datatab_pf.setAdapter(adapter4); } @@ -322,6 +322,25 @@ public class add_pf_control extends LinearLayout implements MyClickListener { if (activity != null) { MessageManager.getInstance().unRegisterMessageReceiver(activity); } + listener = null; + resMaterilas.clear(); + bpa_goodproperties.clear(); + resMaterilas = null; + bpa_goodproperties = null; + if(adapter4!=null){ + adapter4.clear(); + adapter4 = null; + } + + mListener = null; + if(datatab_sx!=null){ + datatab_sx.setAdapter(null); + datatab_pf.setAdapter(null); + } + + acontext = null; + pfname = null; + ggids = null; } /** @@ -453,27 +472,39 @@ public class add_pf_control extends LinearLayout implements MyClickListener { return true; } + private MyClickListener listener = new MyClickListener() { + @Override + public void clickListener(View v, Object data) { + switch (v.getId()) { + case R.id.name://点击 修改 - /** - * 点击事件 - * - * @param v - * @param data - */ - @Override - public void clickListener(View v, Object data) { - switch (v.getId()) { - case R.id.name://点击 修改 - - break; - case R.id.button_item://删除按钮 + break; + case R.id.button_item://删除按钮 - break; + break; + } } - } - @Override - public void clickListenerNew(View v, int k, Object data) { + @Override + public void clickListenerNew(View v, int k, Object data) { - } + } + }; + + +// /** +// * 点击事件 +// * +// * @param v +// * @param data +// */ +// @Override +// public void clickListener(View v, Object data) { +// +// } +// +// @Override +// public void clickListenerNew(View v, int k, Object data) { +// +// } } diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_pf_home_control.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_pf_home_control.java index 7142875f..572c3dca 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_pf_home_control.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_pf_home_control.java @@ -32,7 +32,7 @@ import java.util.ArrayList; import butterknife.BindView; import butterknife.ButterKnife; -public class add_pf_home_control extends LinearLayout implements MyClickListener { +public class add_pf_home_control extends LinearLayout {//implements MyClickListener @BindView(R.id.title) TextView title; @@ -120,46 +120,65 @@ public class add_pf_home_control extends LinearLayout implements MyClickListene { //根据商品查询配方 ArrayList goodsrecipenames=QueryDB.GetGoodsRecipeNameGoodId(good.id); - goodpf_apapter adapter = new goodpf_apapter(getContext(), R.layout.wl_item, goodsrecipenames, this); + goodpf_apapter adapter = new goodpf_apapter(getContext(), R.layout.wl_item, goodsrecipenames, listener); datatab_pf.setAdapter(adapter); } } + private MyClickListener listener = new MyClickListener() { + @Override + public void clickListener(View v, Object data) { + switch (v.getId()) { + case R.id.button_update://点击 修改 + SelectData =(BPA_GOODSRECIPENAME)data; + if (mListener != null) { + mListener.clickListenerNew(v,2,good); + } + break; + case R.id.button_item://删除按钮 + + ArrayList re= QueryDB.GetGoodsSreciperecipeList(((BPA_GOODSRECIPENAME) data).id); + for(ResGoodsRecipe item:re) + { + QueryDB.DeleteGoodsSrecipe(item); + } + QueryDB.DeleteGoodsRecipeName((BPA_GOODSRECIPENAME) data); + Initdata_pf(); + ToastUtils.info("删除成功"); + break; + } + } + @Override + public void clickListenerNew(View v, int k, Object data) { - public BPA_GOODSRECIPENAME SelectData; - /** - * 点击事件 - * - * @param v - * @param data - */ - @Override - public void clickListener(View v, Object data) { - switch (v.getId()) { - case R.id.button_update://点击 修改 - SelectData =(BPA_GOODSRECIPENAME)data; - if (mListener != null) { - mListener.clickListenerNew(v,2,good); - } - break; - case R.id.button_item://删除按钮 - - ArrayList re= QueryDB.GetGoodsSreciperecipeList(((BPA_GOODSRECIPENAME) data).id); - for(ResGoodsRecipe item:re) - { - QueryDB.DeleteGoodsSrecipe(item); - } - QueryDB.DeleteGoodsRecipeName((BPA_GOODSRECIPENAME) data); - Initdata_pf(); - ToastUtils.info("删除成功"); - break; } - } - - @Override - public void clickListenerNew(View v, int k, Object data) { + }; + public BPA_GOODSRECIPENAME SelectData; +// /** +// * 点击事件 +// * +// * @param v +// * @param data +// */ +// @Override +// public void clickListener(View v, Object data) { +// +// } +// +// @Override +// public void clickListenerNew(View v, int k, Object data) { +// +// } + + public void destroy(){ + datatab_pf.setAdapter(null); + datatab_pf = null; + good = null; + SelectData = null; + mListener = null; + listener = null; } } diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_yijian_controlextends.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_yijian_controlextends.java index 565c05de..8cd19922 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_yijian_controlextends.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_yijian_controlextends.java @@ -393,4 +393,16 @@ public class add_yijian_controlextends extends LinearLayout { } //endregion + public void destroy(){ + if(mHandler!=null){ + mHandler.removeCallbacksAndMessages(null); + mHandler = null; + } + siloslist.clear(); + siloslist = null; + mListener = null; + map_fl.clear(); + map_fl = null; + editsp_fl = null; + } } \ No newline at end of file diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/silos_jiaoyan.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/silos_jiaoyan.java index 7885cb2c..ba396bf2 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/silos_jiaoyan.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/silos_jiaoyan.java @@ -16,6 +16,7 @@ import android.widget.TextView; import androidx.annotation.Nullable; import androidx.fragment.app.FragmentManager; +import com.apkfuns.logutils.LogUtils; import com.bonait.bnframework.HBL.Dialog.AlertDialogButton; import com.bonait.bnframework.HBL.Dialog.DialogManager; import com.bonait.bnframework.HBL.Dialog.WaitDialog; @@ -141,8 +142,9 @@ public class silos_jiaoyan extends LinearLayout { BPA_SILOS_CALIBRATE res = QueryDB.GetSilosCalibrateByNum(lcMode.num); if(res!=null){ - min_time.setText(String.valueOf(res.outputTimeMin)); - max_time.setText(String.valueOf(res.outputTimeMax)); + LogUtils.d(" BPA_SILOS_CALIBRATE res.outputTimeMin="+res.toString()); + min_time.setText(res.outputTimeMin+""); + max_time.setText(res.outputTimeMax+""); min_weight.setText(res.inputWightMin+""); max_weight.setText(res.inputWightMax+""); }else{ @@ -241,7 +243,14 @@ public class silos_jiaoyan extends LinearLayout { private TimerTask timerTask; public void show(){ - close(); + if(timer!=null){ + timer.cancel(); + timer = null; + } + if(timerTask!=null){ + timerTask.cancel(); + timerTask = null; + } setVisibility(VISIBLE); timer = new Timer(); timerTask = new TimerTask() { @@ -256,7 +265,7 @@ public class silos_jiaoyan extends LinearLayout { timer.schedule(timerTask,500,500); } - public void close(){ + public void destroy(){ setVisibility(GONE); if(mHandler!=null){ mHandler.removeCallbacksAndMessages(null); diff --git a/app/src/main/java/com/bonait/bnframework/modules/welcome/activity/WelcomeActivity.java b/app/src/main/java/com/bonait/bnframework/modules/welcome/activity/WelcomeActivity.java index 943e23f3..249a3162 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/welcome/activity/WelcomeActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/welcome/activity/WelcomeActivity.java @@ -16,6 +16,7 @@ import com.bonait.bnframework.business.MainInit; import com.bonait.bnframework.common.base.BaseActivity; import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.constant.Constants; +import com.bonait.bnframework.common.utils.DisplayManager; import com.bonait.bnframework.common.utils.ScreenUtils; import com.bonait.bnframework.manager.ActivityLifecycleManager; import com.lzy.okgo.OkGo; @@ -40,6 +41,8 @@ public class WelcomeActivity extends BaseActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_welcome); initWelcome(); + DisplayManager.setReferenceMaxWidthHeight(800, 1208); + DisplayManager.updateDisplayInfo(this); } private void initWelcome() { diff --git a/app/src/main/res/layout/activity_silos_new.xml b/app/src/main/res/layout/activity_silos_new.xml index 06645ea6..b6e7746a 100644 --- a/app/src/main/res/layout/activity_silos_new.xml +++ b/app/src/main/res/layout/activity_silos_new.xml @@ -118,6 +118,7 @@ android:layout_height="100dp" app:imagesrc="@mipmap/silos1" android:tag="一键满管" + android:visibility="gone" />