diff --git a/app/src/main/java/com/bonait/bnframework/business/ConfigData.java b/app/src/main/java/com/bonait/bnframework/business/ConfigData.java index 974eda83..b994d75e 100644 --- a/app/src/main/java/com/bonait/bnframework/business/ConfigData.java +++ b/app/src/main/java/com/bonait/bnframework/business/ConfigData.java @@ -1023,6 +1023,8 @@ public class ConfigData { public void PLC_Init() { //PLC连接成功,启动数据监听 ExecuteTheRecipe.Listening(); + + ExecuteTheRecipe.WritePLC("手自切换",true,null); } //endregion } diff --git a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java index bce01e09..e6a62b99 100644 --- a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java +++ b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java @@ -235,27 +235,12 @@ public class ExecuteTheRecipe { } ReadPLCStatus(); - } catch (Exception ex) { - ToastUtils.error("异常信息:" + ex.getMessage()); - } - Thread.sleep(100); - } - - @Override - public void RunComplete() throws InterruptedException { - - } - }); - ThreadManager.Get().StartLong("PLC设备数据监听-扫码信息", true, new IThread() { - @Override - public void Run() throws InterruptedException { - try { - ReadCode(); + AutoJR(); } catch (Exception ex) { ToastUtils.error("异常信息:" + ex.getMessage()); } - Thread.sleep(100); + Thread.sleep(500); } @Override @@ -268,27 +253,14 @@ public class ExecuteTheRecipe { @Override public void Run() throws InterruptedException { try { - ChargeSignal(); - } catch (Exception ex) { - ToastUtils.error("异常信息:" + ex.getMessage()); - } - Thread.sleep(100); - } - @Override - public void RunComplete() throws InterruptedException { - } - }); + ReadCode(); - ThreadManager.Get().StartLong("PLC设备数据监听-自动加热", true, new IThread() { - @Override - public void Run() throws InterruptedException { - try { - AutoJR(); + ChargeSignal(); } catch (Exception ex) { ToastUtils.error("异常信息:" + ex.getMessage()); } - Thread.sleep(1000); + Thread.sleep(50); } @Override public void RunComplete() throws InterruptedException { @@ -303,7 +275,8 @@ public class ExecuteTheRecipe { if(IsMakeGood && GoodMake!=null) { ArrayList recipes= GoodMake.recipes; - + //复位完成信号 + WritePLC("手自切换", true,null); //region 根据物料配方排序Sort步骤分组 LinkedHashMap> rgrs = new LinkedHashMap<>(); for (int i = 0; i < recipes.size(); i++) { @@ -316,8 +289,7 @@ public class ExecuteTheRecipe { int count = 0; for (LinkedHashMap.Entry> entry : rgrs.entrySet()) { - //复位完成信号 - WritePLC("手自切换", true,null); + WritePLC("配料完成", false,null); Thread.sleep(10); @@ -414,7 +386,7 @@ public class ExecuteTheRecipe { ToastUtils.error("异常信息:" + ex.getMessage()); IsMakeGood=false; } - Thread.sleep(100); + Thread.sleep(500); } @Override public void RunComplete() throws InterruptedException { @@ -615,7 +587,9 @@ public class ExecuteTheRecipe { public static float getCalibrationValueXS(int ch) { if (!ListeningValue.containsKey("出料系数"+ch)) return 1.0F; - float k=Float.parseFloat(ListeningValue.get(ch).toString()); + + Object obj= ListeningValue.get("出料系数"+ch); + float k=Float.parseFloat(obj==null?"0":String.valueOf(obj)); return k==0?1.0F:k; } @@ -689,16 +663,7 @@ public class ExecuteTheRecipe { CompleteListen( "校准完成", OnChargeMixtureComNotPar); //清洗完成标志 - Object obj= ExecuteTheRecipe.ReadPLC("自动清洗完成"); - if (obj!=null) { - if((boolean) obj) - { - if(CleaningComplete!=null) - { - CleaningComplete.Run(); - } - } - } + CompleteListen( "自动清洗完成", CleaningComplete); } catch (Exception ex) { ToastUtils.error("异常信息:" + ex.getMessage()); } finally { @@ -730,8 +695,8 @@ public class ExecuteTheRecipe { if(isopen) { - Object sc= getListingValue(item); - Object scsz= getListingValue(item+"设置"); + Object sc= ReadPLC(item); + Object scsz= ReadPLC(item+"设置"); int sx_temp=sc==null?0:(int)sc;//水箱温度 int sx_temp_sz=scsz==null?0:(int)scsz;//水箱温度设置值 @@ -802,7 +767,7 @@ public class ExecuteTheRecipe { } }); - WritePLC("打开写保护", true, new IWriteCallBack() { + WritePLC("关闭写保护", true, new IWriteCallBack() { @Override public void onSuccess() { issucess2[0] =true; @@ -847,7 +812,7 @@ public class ExecuteTheRecipe { } }); - WritePLC("打开写保护", false, new IWriteCallBack() { + WritePLC("打开写保护", true, new IWriteCallBack() { @Override public void onSuccess() { issucess2[0] =true; diff --git a/app/src/main/java/com/bonait/bnframework/business/MainInit.java b/app/src/main/java/com/bonait/bnframework/business/MainInit.java index fc81f41b..e5a79392 100644 --- a/app/src/main/java/com/bonait/bnframework/business/MainInit.java +++ b/app/src/main/java/com/bonait/bnframework/business/MainInit.java @@ -99,7 +99,7 @@ public class MainInit { //初始化DB数据 InitDBdata(); - ConfigData.getInstance().LoadingCloud();//加载云端数据 + //ConfigData.getInstance().LoadingCloud();//加载云端数据 DataBus.getInstance().GetTodayNoMake(); //设置连接到有线网络 diff --git a/app/src/main/java/com/bonait/bnframework/common/base/BaseFragment.java b/app/src/main/java/com/bonait/bnframework/common/base/BaseFragment.java index ba946247..01c91a80 100644 --- a/app/src/main/java/com/bonait/bnframework/common/base/BaseFragment.java +++ b/app/src/main/java/com/bonait/bnframework/common/base/BaseFragment.java @@ -7,8 +7,12 @@ import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentTransaction; import com.bonait.bnframework.MainApplication; +import com.bonait.bnframework.R; import com.bonait.bnframework.common.constant.Constants; import com.bonait.bnframework.common.filepicker.PickerManager; import com.bonait.bnframework.common.filepicker.adapter.FilePickerShowAdapter; @@ -69,6 +73,31 @@ public abstract class BaseFragment extends QMUIFragment implements EasyPermissio startActivity(intent); } + FragmentManager fragmentManager; + FragmentTransaction fragmentTransaction; + + /** + * 显示流 + * @param fragment + */ + public void ShowFragment(Fragment fragment) + { + // TODO Auto-generated method stub + /*在activity对应java类中通过getFragmentManager() + *获得FragmentManager,用于管理ViewGrop中的fragment + * */ + fragmentManager=getFragmentManager(); + /*FragmentManager要管理fragment(添加,替换以及其他的执行动作) + *的一系列的事务变化,需要通过fragmentTransaction来操作执行 + */ + fragmentTransaction = fragmentManager.beginTransaction(); + //实例化要管理的fragment + //通过添加(事务处理的方式)将fragment加到对应的布局中 + fragmentTransaction.replace(R.id.viewpager_jiaoyan, fragment); + //事务处理完需要提交 + fragmentTransaction.commit(); + } + @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); diff --git a/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java b/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java index b0e7b686..4582c116 100644 --- a/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java +++ b/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java @@ -298,26 +298,26 @@ public class ConfigName { add(new Res_PLCADDRESS("通道校准", "M0.0", 0, 1)); add(new Res_PLCADDRESS("校准完成", "M0.7", 1, 0)); - add(new Res_PLCADDRESS("出料系数1", "VR400", 1, 1)); - add(new Res_PLCADDRESS("出料系数2", "VR404", 1, 1)); - add(new Res_PLCADDRESS("出料系数3", "VR408", 1, 1)); - add(new Res_PLCADDRESS("出料系数4", "VR412", 1, 1)); - add(new Res_PLCADDRESS("出料系数5", "VR416", 1, 1)); - add(new Res_PLCADDRESS("出料系数6", "VR420", 1, 1)); - add(new Res_PLCADDRESS("出料系数7", "VR424", 1, 1)); - add(new Res_PLCADDRESS("出料系数8", "VR428", 1, 1)); - add(new Res_PLCADDRESS("出料系数9", "VR432", 1, 1)); - add(new Res_PLCADDRESS("出料系数10", "VR436", 1, 1)); - add(new Res_PLCADDRESS("出料系数11", "VR440", 1, 1)); - add(new Res_PLCADDRESS("出料系数12", "VR444", 1, 1)); - add(new Res_PLCADDRESS("出料系数13", "VR448", 1, 1)); - add(new Res_PLCADDRESS("出料系数14", "VR452", 1, 1)); - add(new Res_PLCADDRESS("出料系数15", "VR456", 1, 1)); - add(new Res_PLCADDRESS("出料系数16", "VR460", 1, 1)); - add(new Res_PLCADDRESS("出料系数17", "VR464", 1, 1)); - add(new Res_PLCADDRESS("出料系数18", "VR468", 1, 1)); - add(new Res_PLCADDRESS("出料系数19", "VR472", 1, 1)); - add(new Res_PLCADDRESS("出料系数20", "VR476", 1, 1)); +// add(new Res_PLCADDRESS("出料系数1", "VR400", 1, 1)); +// add(new Res_PLCADDRESS("出料系数2", "VR404", 1, 1)); +// add(new Res_PLCADDRESS("出料系数3", "VR408", 1, 1)); +// add(new Res_PLCADDRESS("出料系数4", "VR412", 1, 1)); +// add(new Res_PLCADDRESS("出料系数5", "VR416", 1, 1)); +// add(new Res_PLCADDRESS("出料系数6", "VR420", 1, 1)); +// add(new Res_PLCADDRESS("出料系数7", "VR424", 1, 1)); +// add(new Res_PLCADDRESS("出料系数8", "VR428", 1, 1)); +// add(new Res_PLCADDRESS("出料系数9", "VR432", 1, 1)); +// add(new Res_PLCADDRESS("出料系数10", "VR436", 1, 1)); +// add(new Res_PLCADDRESS("出料系数11", "VR440", 1, 1)); +// add(new Res_PLCADDRESS("出料系数12", "VR444", 1, 1)); +// add(new Res_PLCADDRESS("出料系数13", "VR448", 1, 1)); +// add(new Res_PLCADDRESS("出料系数14", "VR452", 1, 1)); +// add(new Res_PLCADDRESS("出料系数15", "VR456", 1, 1)); +// add(new Res_PLCADDRESS("出料系数16", "VR460", 1, 1)); +// add(new Res_PLCADDRESS("出料系数17", "VR464", 1, 1)); +// add(new Res_PLCADDRESS("出料系数18", "VR468", 1, 1)); +// add(new Res_PLCADDRESS("出料系数19", "VR472", 1, 1)); +// add(new Res_PLCADDRESS("出料系数20", "VR476", 1, 1)); //模拟出料 add(new Res_PLCADDRESS("模拟出料", "-------------", 0, 0)); @@ -391,29 +391,27 @@ public class ConfigName { //温度监控 add(new Res_PLCADDRESS("温度控制", "-------------", 0, 0)); - add(new Res_PLCADDRESS("水池温度", "VD354", 1, 0)); - add(new Res_PLCADDRESS("水池温度设置", "VD378", 1, 1)); - add(new Res_PLCADDRESS("水池温度加热", "M104.1", 1, 0)); - - add(new Res_PLCADDRESS("果糖左温度", "VD358", 1, 0)); - add(new Res_PLCADDRESS("果糖左温度设置", "VD382", 1, 1)); + add(new Res_PLCADDRESS("果糖左温度", "VD354", 1, 0)); + add(new Res_PLCADDRESS("果糖左温度设置", "VD378", 1, 1)); add(new Res_PLCADDRESS("果糖左温度加热", "M103.7", 1, 0)); - add(new Res_PLCADDRESS("果糖右温度", "VD362", 1, 0)); - add(new Res_PLCADDRESS("果糖右温度设置", "VD386", 1, 1)); + add(new Res_PLCADDRESS("果糖右温度", "VD358", 1, 0)); + add(new Res_PLCADDRESS("果糖右温度设置", "VD382", 1, 1)); add(new Res_PLCADDRESS("果糖右温度加热", "M104.0", 1, 0)); + add(new Res_PLCADDRESS("水池温度", "VD362", 1, 0)); + add(new Res_PLCADDRESS("水池温度设置", "VD386", 1, 1)); + add(new Res_PLCADDRESS("水池温度加热", "M104.1", 1, 0)); + // add(new Res_PLCADDRESS("水池温度", "VD352", 1, 0)); // add(new Res_PLCADDRESS("水池温度设置", "VD360", 1, 1)); // add(new Res_PLCADDRESS("水池温度加热", "M104.0", 1, 0)); //自动清洗 add(new Res_PLCADDRESS("自动清洗", "-------------", 0, 0)); - add(new Res_PLCADDRESS("排水阀排水时间", "VW140", 1, 1)); - add(new Res_PLCADDRESS("排水阀进水时间", "VW142", 1, 1)); - add(new Res_PLCADDRESS("清洗预加热时间", "VW144", 1, 1)); - add(new Res_PLCADDRESS("加清洗剂时间", "VW146", 1, 1)); - add(new Res_PLCADDRESS("循环清洗时间", "VW148", 1, 1)); + add(new Res_PLCADDRESS("排水阀排水时间", "VW244", 1, 1)); + add(new Res_PLCADDRESS("循环清洗时间", "VW246", 1, 1)); + add(new Res_PLCADDRESS("清洗模式", "M0.4", 1, 1)); add(new Res_PLCADDRESS("自动清洗开始", "M0.5", 1, 1)); add(new Res_PLCADDRESS("自动清洗完成", "M0.6", 1, 1)); @@ -476,6 +474,9 @@ public class ConfigName { add(new Res_PLCADDRESS("实时状态读取", "-------------", 0, 0)); add(new Res_PLCADDRESS("实时状态", "VW500", 1, 0)); + + add(new Res_PLCADDRESS("水池液位检测", "M5.2", 1, 0)); + add(new Res_PLCADDRESS("出料口检测", "M5.3", 1, 0)); }}; /** * 奶茶机工序模型 @@ -598,26 +599,26 @@ public class ConfigName { add(new Res_PLCADDRESS("通道校准", "M0.0", 0, 1)); add(new Res_PLCADDRESS("校准完成", "M0.7", 1, 0)); - add(new Res_PLCADDRESS("出料系数1", "VR400", 1, 1)); - add(new Res_PLCADDRESS("出料系数2", "VR404", 1, 1)); - add(new Res_PLCADDRESS("出料系数3", "VR408", 1, 1)); - add(new Res_PLCADDRESS("出料系数4", "VR412", 1, 1)); - add(new Res_PLCADDRESS("出料系数5", "VR416", 1, 1)); - add(new Res_PLCADDRESS("出料系数6", "VR420", 1, 1)); - add(new Res_PLCADDRESS("出料系数7", "VR424", 1, 1)); - add(new Res_PLCADDRESS("出料系数8", "VR428", 1, 1)); - add(new Res_PLCADDRESS("出料系数9", "VR432", 1, 1)); - add(new Res_PLCADDRESS("出料系数10", "VR436", 1, 1)); - add(new Res_PLCADDRESS("出料系数11", "VR440", 1, 1)); - add(new Res_PLCADDRESS("出料系数12", "VR444", 1, 1)); - add(new Res_PLCADDRESS("出料系数13", "VR448", 1, 1)); - add(new Res_PLCADDRESS("出料系数14", "VR452", 1, 1)); - add(new Res_PLCADDRESS("出料系数15", "VR456", 1, 1)); - add(new Res_PLCADDRESS("出料系数16", "VR460", 1, 1)); - add(new Res_PLCADDRESS("出料系数17", "VR464", 1, 1)); - add(new Res_PLCADDRESS("出料系数18", "VR468", 1, 1)); - add(new Res_PLCADDRESS("出料系数19", "VR472", 1, 1)); - add(new Res_PLCADDRESS("出料系数20", "VR476", 1, 1)); +// add(new Res_PLCADDRESS("出料系数1", "VR400", 1, 1)); +// add(new Res_PLCADDRESS("出料系数2", "VR404", 1, 1)); +// add(new Res_PLCADDRESS("出料系数3", "VR408", 1, 1)); +// add(new Res_PLCADDRESS("出料系数4", "VR412", 1, 1)); +// add(new Res_PLCADDRESS("出料系数5", "VR416", 1, 1)); +// add(new Res_PLCADDRESS("出料系数6", "VR420", 1, 1)); +// add(new Res_PLCADDRESS("出料系数7", "VR424", 1, 1)); +// add(new Res_PLCADDRESS("出料系数8", "VR428", 1, 1)); +// add(new Res_PLCADDRESS("出料系数9", "VR432", 1, 1)); +// add(new Res_PLCADDRESS("出料系数10", "VR436", 1, 1)); +// add(new Res_PLCADDRESS("出料系数11", "VR440", 1, 1)); +// add(new Res_PLCADDRESS("出料系数12", "VR444", 1, 1)); +// add(new Res_PLCADDRESS("出料系数13", "VR448", 1, 1)); +// add(new Res_PLCADDRESS("出料系数14", "VR452", 1, 1)); +// add(new Res_PLCADDRESS("出料系数15", "VR456", 1, 1)); +// add(new Res_PLCADDRESS("出料系数16", "VR460", 1, 1)); +// add(new Res_PLCADDRESS("出料系数17", "VR464", 1, 1)); +// add(new Res_PLCADDRESS("出料系数18", "VR468", 1, 1)); +// add(new Res_PLCADDRESS("出料系数19", "VR472", 1, 1)); +// add(new Res_PLCADDRESS("出料系数20", "VR476", 1, 1)); //模拟出料 add(new Res_PLCADDRESS("模拟出料", "-------------", 0, 0)); @@ -710,11 +711,8 @@ public class ConfigName { //自动清洗 add(new Res_PLCADDRESS("自动清洗", "-------------", 0, 0)); - add(new Res_PLCADDRESS("排水阀排水时间", "VW140", 1, 1)); - add(new Res_PLCADDRESS("排水阀进水时间", "VW142", 1, 1)); - add(new Res_PLCADDRESS("清洗预加热时间", "VW144", 1, 1)); - add(new Res_PLCADDRESS("加清洗剂时间", "VW146", 1, 1)); - add(new Res_PLCADDRESS("循环清洗时间", "VW148", 1, 1)); + add(new Res_PLCADDRESS("排水阀排水时间", "VW244", 1, 1)); + add(new Res_PLCADDRESS("循环清洗时间", "VW246", 1, 1)); add(new Res_PLCADDRESS("清洗模式", "M0.4", 1, 1)); add(new Res_PLCADDRESS("自动清洗开始", "M0.5", 1, 1)); add(new Res_PLCADDRESS("自动清洗完成", "M0.6", 1, 1)); @@ -757,6 +755,8 @@ public class ConfigName { add(new Res_PLCADDRESS("实时状态读取", "-------------", 0, 0)); add(new Res_PLCADDRESS("实时状态", "VW500", 1, 0)); + add(new Res_PLCADDRESS("水池液位检测", "M5.2", 1, 0)); + add(new Res_PLCADDRESS("出料口检测", "M5.3", 1, 0)); }}; /** diff --git a/app/src/main/java/com/bonait/bnframework/common/constant/DataBus.java b/app/src/main/java/com/bonait/bnframework/common/constant/DataBus.java index 089e2173..d3df98c6 100644 --- a/app/src/main/java/com/bonait/bnframework/common/constant/DataBus.java +++ b/app/src/main/java/com/bonait/bnframework/common/constant/DataBus.java @@ -8,12 +8,14 @@ import com.bonait.bnframework.R; import com.bonait.bnframework.business.ExecuteTheRecipe; import com.bonait.bnframework.common.db.QueryDB; import com.bonait.bnframework.common.db.mode.BPA_ALERTLOG; +import com.bonait.bnframework.common.db.mode.BPA_GOODPROPERTY; import com.bonait.bnframework.common.db.mode.BPA_GOODS; import com.bonait.bnframework.common.db.mode.BPA_LOG; import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; import com.bonait.bnframework.common.db.mode.BPA_SILOS; import com.bonait.bnframework.common.db.mode.BPA_SUBORDER; import com.bonait.bnframework.common.db.res.MakeStatus; +import com.bonait.bnframework.common.db.res.ResGoodProperty; import com.bonait.bnframework.common.db.res.ResGoodsMake; import com.bonait.bnframework.common.db.res.ResGoodsRecipe; import com.bonait.bnframework.common.db.res.Res_PLCADDRESS1; @@ -28,6 +30,7 @@ import com.bonait.bnframework.common.helper.mode.OrderA; import com.bonait.bnframework.common.helper.mode.ResultA; import com.bonait.bnframework.modules.home.adapter.loadinggood_adapter; import com.bonait.bnframework.modules.home.adapter.lsjy_adapter; +import com.bonait.bnframework.modules.home.adapter.pfsx_adapter; import com.bonait.bnframework.modules.home.adapter.wdsz_adapter; import com.bonait.bnframework.modules.home.fragment.mode.sdkz_control; import com.bonait.bnframework.modules.home.fragment.mode.tab_control; @@ -215,6 +218,50 @@ public class DataBus { * 详细配方 */ public ArrayList Recipe=new ArrayList<>(); + /** + * 属性数据 + */ + public ArrayList bpa_goodproperties = new ArrayList<>(); + public pfsx_adapter sxadapter=null; + /** + * 加载商品配方 + */ + public void GetMainGoodProperty() + { + bpa_goodproperties.clear(); + ArrayList da = QueryDB.GetGoodsPropertyALL("0"); + for (BPA_GOODPROPERTY item : da) { + ResGoodProperty re = new ResGoodProperty(); + re.id = item.id; + re.name = item.name; + + ArrayList zsx = QueryDB.GetGoodsPropertyALL(item.id); + re.child = new ArrayList<>(); + + + ArrayList _chid = new ArrayList<>(); + for (BPA_GOODPROPERTY k : zsx) { + ResGoodProperty m = new ResGoodProperty(); + m.id = k.id; + m.name = k.name; + m.isSelect = false; + _chid.add(m); + } + re.child = _chid; + + bpa_goodproperties.add(re); + } + + for (ResGoodProperty item : bpa_goodproperties) { + int i = 0; + for (ResGoodProperty c : item.child) { + if (i == 0) { + c.isSelect = true; + } + i++; + } + } + } //endregion //region 流速校验 @@ -238,9 +285,9 @@ public class DataBus { mode.num= silo.num; mode.name= silo.name; mode.materialName=m.size() > 0?m.get(0).name:"未设置"; - mode.xs= ExecuteTheRecipe.getCalibrationValueXS(silo.num)+""; - Object kg=ExecuteTheRecipe.getListingValue("通道"+silo.num+"校准开关"); - Object _val=ExecuteTheRecipe.getListingValue("校准值"+silo.num); + //mode.xs= ExecuteTheRecipe.getCalibrationValueXS(silo.num)+""; + Object kg=ExecuteTheRecipe.ReadPLC("通道"+silo.num+"校准开关"); + Object _val=ExecuteTheRecipe.ReadPLC("校准值"+silo.num); short val=_val==null?0:(short)_val; String s = String.valueOf(val); mode.jzkg= kg==null?false:(boolean) kg; diff --git a/app/src/main/java/com/bonait/bnframework/common/tabbar/MainNavigateTabBar.java b/app/src/main/java/com/bonait/bnframework/common/tabbar/MainNavigateTabBar.java index 8d1e87e7..6fa66ea4 100644 --- a/app/src/main/java/com/bonait/bnframework/common/tabbar/MainNavigateTabBar.java +++ b/app/src/main/java/com/bonait/bnframework/common/tabbar/MainNavigateTabBar.java @@ -19,6 +19,7 @@ import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentTransaction; import com.bonait.bnframework.R; +import com.bonait.bnframework.business.ExecuteTheRecipe; import com.bonait.bnframework.common.constant.DataBus; import com.bonait.bnframework.common.constant.MessageName; import com.bonait.bnframework.common.message.MessageManager; @@ -359,15 +360,23 @@ public class MainNavigateTabBar extends LinearLayout implements View.OnClickList if(index==1)//校验 { //刷新料仓 - DataBus.getInstance().GetSilosLsjy(); + //DataBus.getInstance().GetSilosLsjy(); //刷新温度控制 - DataBus.getInstance().GetWdsz(); + //DataBus.getInstance().GetWdsz(); //刷新手动控制 }else if (index==3) { //刷新商品 MessageManager.getInstance().sendMessage(MessageName.MakeMainGoodResh, "Good"); + + DataBus.getInstance().GetMainGoodProperty(); + + //设置清洗模式 + ExecuteTheRecipe.WritePLC("清洗模式",false,null); + ExecuteTheRecipe.WritePLC("砝码校准模式",false,null); + ExecuteTheRecipe.WritePLC("手自切换", true, null); + } } diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationMainActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationMainActivity.java index 74400a1f..38d9942e 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationMainActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationMainActivity.java @@ -62,7 +62,7 @@ public class BottomNavigationMainActivity extends BaseActivity { mNavigateTabBar.addTab(null, new MainNavigateTabBar.TabParam(R.mipmap.comui_tab_person, R.mipmap.comui_tab_person_selected, "我的")); mNavigateTabBar.setTabSelectListener(mOnNavigationItemSelectedListener); initFragment(); - + Init(); } @Override diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/adapter/clsfbc_adapter.java b/app/src/main/java/com/bonait/bnframework/modules/home/adapter/clsfbc_adapter.java index b20f85b4..df7f70a4 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/adapter/clsfbc_adapter.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/adapter/clsfbc_adapter.java @@ -78,7 +78,9 @@ public class clsfbc_adapter extends RecyclerView.Adapter String name= "通道"+goodsMake.num+"(" +goodsMake.name+")"; myViewHolder.name.setText(name+""); myViewHolder.wlname.setText(goodsMake.materialName+""); - myViewHolder.edittext_xs.setText(goodsMake.xs+""); + // myViewHolder.edittext_xs.setText(goodsMake.xs+""); myViewHolder.control_switch.setChecked(goodsMake.jzkg); myViewHolder.edittext_tdzl.setText(goodsMake.Value+""); @@ -79,16 +79,16 @@ public class lsjy_adapter extends RecyclerView.Adapter @Override public void onClick(View view) { String value = myViewHolder.edittext_tdzl.getText().toString(); - String value1=myViewHolder.edittext_xs.getText().toString(); + //String value1=myViewHolder.edittext_xs.getText().toString(); Short val = 0; - float xs= 1.0F; + //float xs= 1.0F; try { val = (short) Math.round((Double.parseDouble(value) * 10)); - xs=Float.parseFloat(value1); + //xs=Float.parseFloat(value1); } catch (Exception e) { } - ExecuteTheRecipe.WritePLC("出料系数"+goodsMake.num,xs,null); + //ExecuteTheRecipe.WritePLC("出料系数"+goodsMake.num,xs,null); ExecuteTheRecipe.WritePLC("校准值" + goodsMake.num, val, new IWriteCallBack() { @Override public void onSuccess() { @@ -129,8 +129,6 @@ public class lsjy_adapter extends RecyclerView.Adapter @Override public void run() { try { - mainGoods.clear(); - mainGoods = DataBus.getInstance().SilosLsjy; notifyDataSetChanged(); } catch (Exception e) { @@ -157,7 +155,7 @@ public class lsjy_adapter extends RecyclerView.Adapter /** * 系数 */ - EditText edittext_xs; + //EditText edittext_xs; /** * 校准开关 */ @@ -174,7 +172,7 @@ public class lsjy_adapter extends RecyclerView.Adapter super(view); name = (TextView) view.findViewById(R.id.name); wlname = (TextView) view.findViewById(R.id.wlname); - edittext_xs=(EditText) view.findViewById(R.id.edittext_xs); + // edittext_xs=(EditText) view.findViewById(R.id.edittext_xs); control_switch = (SwitchButton)view.findViewById(R.id.control_switch); edittext_tdzl=(EditText) view.findViewById(R.id.edittext_tdzl); save_value=(Button) view.findViewById(R.id.save_value); diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/adapter/pfsx_adapter.java b/app/src/main/java/com/bonait/bnframework/modules/home/adapter/pfsx_adapter.java index 8546af39..edcae8ee 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/adapter/pfsx_adapter.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/adapter/pfsx_adapter.java @@ -13,6 +13,7 @@ import androidx.annotation.Nullable; import androidx.recyclerview.widget.RecyclerView; import com.bonait.bnframework.R; +import com.bonait.bnframework.common.constant.DataBus; import com.bonait.bnframework.common.db.QueryDB; import com.bonait.bnframework.common.db.mode.BPA_GOODPROPERTY; import com.bonait.bnframework.common.db.res.ResGoodProperty; @@ -27,12 +28,11 @@ public class pfsx_adapter extends ArrayAdapter { * 内部点击事件 */ private MyClickListener mListener; - private List datas; + private List datas= DataBus.getInstance().bpa_goodproperties; int resource1; public Context contextA; - public pfsx_adapter(@NonNull Context context, int resource, @NonNull List objects, MyClickListener listener) { + public pfsx_adapter(@NonNull Context context, int resource, @NonNull List objects) { super(context, resource, objects); - mListener = listener; contextA=context; datas=objects; this.resource1=resource; @@ -49,7 +49,6 @@ public class pfsx_adapter extends ArrayAdapter { RecyclerView recyclerView=view.findViewById(R.id.recycler_view); - MyLayoutManager layout = new MyLayoutManager(); layout.setAutoMeasureEnabled(true); recyclerView.setLayoutManager(layout); diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/adapter/wdsz_adapter.java b/app/src/main/java/com/bonait/bnframework/modules/home/adapter/wdsz_adapter.java index 113d7986..928305f9 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/adapter/wdsz_adapter.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/adapter/wdsz_adapter.java @@ -3,6 +3,8 @@ package com.bonait.bnframework.modules.home.adapter; import android.app.Activity; import android.content.Context; import android.content.ContextWrapper; +import android.os.Handler; +import android.os.Message; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -60,9 +62,47 @@ public class wdsz_adapter extends RecyclerView.Adapter myViewHolder.temp.setText(goodsMake.temp+""); myViewHolder.control_switch.setChecked(goodsMake.autoheat); + final String[] temp = {"0"}; + Handler mHandler = new Handler() { + public void handleMessage(Message msg) { + switch (msg.what) { + case 0: + myViewHolder.temp.setText(temp[0]); + break; + case 1: + + break; + case 2: + + break; + } + + } + }; + new Thread(new Runnable() { + @Override + public void run() { + while (ConfigName.getInstance().PlcIsConnect) { + try { + Object obj= ExecuteTheRecipe.ReadPLC(goodsMake.name); + if(obj!=null) + { + temp[0] =String.valueOf(obj); + mHandler.sendEmptyMessage(0); + } + Thread.sleep(100); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } + } + }).start(); + myViewHolder.control_switch.setOnCheckedChangeListener(new SwitchButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(SwitchButton view, boolean isChecked) { + //设置 + goodsMake.autoheat=isChecked; if(goodsMake.name.equals("水池温度")) { ConfigName.getInstance().AutomaticHeating=goodsMake.autoheat; @@ -85,7 +125,7 @@ public class wdsz_adapter extends RecyclerView.Adapter public void onClick(View view) { int up = Integer.parseInt((myViewHolder.edittext_sx.getText().toString().isEmpty() ? "0" : myViewHolder.edittext_sx.getText().toString())); if (up <= 0) { - ToastUtils.error("温度上限不能小于0!请调整后重试."); + ToastUtils.error("温度不能小于0!请调整后重试."); return; } ExecuteTheRecipe.WritePLC(goodsMake.name + "设置", up, new IWriteCallBack() { @@ -101,6 +141,8 @@ public class wdsz_adapter extends RecyclerView.Adapter }); } }); + + } } catch (Exception e) { e.printStackTrace(); diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/DingDanfragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/DingDanfragment.java index 8837a145..fcd6180a 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/DingDanfragment.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/DingDanfragment.java @@ -61,10 +61,11 @@ public class DingDanfragment extends BaseFragment { public void onViewClicked(View view) { switch (view.getId()) { case R.id.ddgl:// - ConfigName.getInstance().fragmentAdapter.replaceFragment(2,new OrderListActivity()); + skipToActivity(OrderListActivity.class); + //ConfigName.getInstance().fragmentAdapter.replaceFragment(2,new OrderListActivity()); break; case R.id.xltj:// - ConfigName.getInstance().fragmentAdapter.replaceFragment(2,new SalesStatisticsActivity()); + skipToActivity(SalesStatisticsActivity.class); break; } } diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/GongnengFragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/GongnengFragment.java index f7248967..43fbb6a1 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/GongnengFragment.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/GongnengFragment.java @@ -62,13 +62,16 @@ public class GongnengFragment extends BaseFragment { public void onViewClicked(View view) { switch (view.getId()) { case R.id.jcsjgl:// - ConfigName.getInstance().fragmentAdapter.replaceFragment(0,new JcsjglActivity()); + skipToActivity(JcsjglActivity.class); + //ConfigName.getInstance().fragmentAdapter.replaceFragment(0,new JcsjglActivity()); break; case R.id.lcgl:// - ConfigName.getInstance().fragmentAdapter.replaceFragment(0,new SilosActivity()); + skipToActivity(SilosActivity.class); + //ConfigName.getInstance().fragmentAdapter.replaceFragment(0,new SilosActivity()); break; case R.id.yfpf:// - ConfigName.getInstance().fragmentAdapter.replaceFragment(0,new GoodPeiFangActivity()); + skipToActivity(GoodPeiFangActivity.class); + //ConfigName.getInstance().fragmentAdapter.replaceFragment(0,new GoodPeiFangActivity()); break; } } diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/GuanLifragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/GuanLifragment.java index a8738242..d8c1ea94 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/GuanLifragment.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/GuanLifragment.java @@ -58,13 +58,18 @@ public class GuanLifragment extends BaseFragment { public void onViewClicked(View view) { switch (view.getId()) { case R.id.plckz:// - ConfigName.getInstance().fragmentAdapter.replaceFragment(4,new PlcControlActivity()); + skipToActivity(PlcControlActivity.class); + //ConfigName.getInstance().fragmentAdapter.replaceFragment(4,new PlcControlActivity()); break; case R.id.rzgl:// - ConfigName.getInstance().fragmentAdapter.replaceFragment(4,new LogActivity()); + skipToActivity(LogActivity.class); + + //ConfigName.getInstance().fragmentAdapter.replaceFragment(4,new LogActivity()); break; case R.id.ssjk:// - ConfigName.getInstance().fragmentAdapter.replaceFragment(4,new RealTimeActivity()); + skipToActivity(RealTimeActivity.class); + + //ConfigName.getInstance().fragmentAdapter.replaceFragment(4,new RealTimeActivity()); break; } } diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/JiaoYanFragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/JiaoYanFragment.java index 3478ca43..497f29a7 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/JiaoYanFragment.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/JiaoYanFragment.java @@ -54,7 +54,7 @@ public class JiaoYanFragment extends BaseFragment { ListView rv_left;//左侧菜单 @BindView(R.id.viewpager_jiaoyan) - QMUIViewPager viewpager_jiaoyan;//右侧控件 + FrameLayout viewpager_jiaoyan;//右侧控件 private Context context; public static int mPosition; @@ -112,11 +112,12 @@ public class JiaoYanFragment extends BaseFragment { { fragmentList.add(item.fragment); } - FragmentAdapter fragmentAdapter=new FragmentAdapter(getChildFragmentManager(),fragmentList); - viewpager_jiaoyan.setAdapter(fragmentAdapter); - viewpager_jiaoyan.setOffscreenPageLimit(5); - viewpager_jiaoyan.setCurrentItem(0); - viewpager_jiaoyan.addOnPageChangeListener(pageChangeListener); + //FragmentAdapter fragmentAdapter=new FragmentAdapter(getChildFragmentManager(),fragmentList); + ShowFragment(menuModes.get(0).fragment); +// viewpager_jiaoyan.setAdapter(fragmentAdapter); +// viewpager_jiaoyan.setOffscreenPageLimit(5); +// viewpager_jiaoyan.setCurrentItem(0); +// viewpager_jiaoyan.addOnPageChangeListener(pageChangeListener); adapter=new jiaoyan_adapter(getContext(),menuModes); rv_left.setAdapter(adapter); rv_left.setOnItemClickListener(new AdapterView.OnItemClickListener() { @@ -153,7 +154,8 @@ public class JiaoYanFragment extends BaseFragment { //即使刷新adapter mPosition=position; adapter.notifyDataSetChanged(); - viewpager_jiaoyan.setCurrentItem(position); + ShowFragment(menuModes.get(position).fragment); + //viewpager_jiaoyan.setCurrentItem(position); } @Override diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/MakeGoodFragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/MakeGoodFragment.java index 9b264bdb..7a201be8 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/MakeGoodFragment.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/MakeGoodFragment.java @@ -21,8 +21,10 @@ import com.bonait.bnframework.common.base.BaseFragment; import com.bonait.bnframework.common.constant.DataBus; import com.bonait.bnframework.common.constant.MessageName; import com.bonait.bnframework.common.db.QueryDB; +import com.bonait.bnframework.common.db.mode.BPA_GOODPROPERTY; import com.bonait.bnframework.common.db.mode.BPA_GOODS; import com.bonait.bnframework.common.db.mode.BPA_GOODSTYPE; +import com.bonait.bnframework.common.db.res.ResGoodProperty; import com.bonait.bnframework.common.db.res.ResGoodsMake; import com.bonait.bnframework.common.helper.I.MyClickListener; import com.bonait.bnframework.common.linktab.LinkMode; @@ -179,6 +181,7 @@ public class MakeGoodFragment extends BaseFragment { datatab_paiduishangping.setAdapter(DataBus.getInstance().loadinggoodAdapter); } + /** * 点击商品 开始制作 */ diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/SheZhifragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/SheZhifragment.java index cf17eaca..f970153a 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/SheZhifragment.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/SheZhifragment.java @@ -60,13 +60,13 @@ public class SheZhifragment extends BaseFragment { public void onViewClicked(View view) { switch (view.getId()) { case R.id.xtcs:// - ConfigName.getInstance().fragmentAdapter.replaceFragment(5,new SystemParameterActivity()); + skipToActivity(SystemParameterActivity.class); break; case R.id.imagegl:// - ConfigName.getInstance().fragmentAdapter.replaceFragment(5,new ImageSourceActivity()); + skipToActivity(ImageSourceActivity.class); break; case R.id.shebeixinxi:// - ConfigName.getInstance().fragmentAdapter.replaceFragment(5,new DeviceInformationActivity()); + skipToActivity(DeviceInformationActivity.class); break; } } diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DeviceInformationActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DeviceInformationActivity.java index 490f8e2e..59e455f8 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DeviceInformationActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DeviceInformationActivity.java @@ -1,5 +1,7 @@ package com.bonait.bnframework.modules.home.fragment.from; +import static com.bonait.bnframework.MainApplication.getContext; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; @@ -11,6 +13,7 @@ import android.view.View; import android.widget.EditText; import com.bonait.bnframework.R; +import com.bonait.bnframework.common.base.BaseActivity; import com.bonait.bnframework.common.base.BaseFragment; import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.modules.home.fragment.SheZhifragment; @@ -19,7 +22,7 @@ import com.qmuiteam.qmui.widget.QMUITopBarLayout; import butterknife.BindView; import butterknife.ButterKnife; -public class DeviceInformationActivity extends BaseFragment { +public class DeviceInformationActivity extends BaseActivity { @BindView(R.id.topbar) QMUITopBarLayout mTopBar; @@ -39,30 +42,23 @@ public class DeviceInformationActivity extends BaseFragment { EditText edittext6; @BindView(R.id.edittext7) EditText edittext7; - - @Override - protected View onCreateView() { - View root = LayoutInflater.from(getActivity()).inflate(R.layout.activity_deviceinformation, null); - ButterKnife.bind(this, root); - return root; - } - @Override - public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - context = getContext(); + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_deviceinformation); + ButterKnife.bind(this); + context=getContext(); initTopBar(); initFragment(); initdata(); } private void initTopBar() { - mTopBar.setTitle("系统参数"); + mTopBar.setTitle("设备信息"); mTopBar.addLeftImageButton(R.mipmap.fanhui,R.id.topbar).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - ConfigName.getInstance().fragmentAdapter.replaceFragment(5,new SheZhifragment()); - } + finish(); } }); } 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 7668cb00..6f0f8d0a 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 @@ -8,6 +8,7 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; @@ -79,7 +80,7 @@ import butterknife.OnClick; import okhttp3.MediaType; import okhttp3.RequestBody; -public class GoodPeiFangActivity extends BaseFragment { +public class GoodPeiFangActivity extends BaseActivity { /** * 顶部标题 @@ -133,44 +134,44 @@ public class GoodPeiFangActivity extends BaseFragment { ArrayList goodstypes=new ArrayList<>(); private Context context; - @Override - protected View onCreateView() { - View root = LayoutInflater.from(getActivity()).inflate(R.layout.activity_goodpeifang, null); - ButterKnife.bind(this, root); - return root; - } + + private Activity activity; @Override - public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_goodpeifang); + + ButterKnife.bind(this); + activity=this; context = getContext(); initTopBar(); Initdata(); } + private void initTopBar() { mTopBar.setTitle("商品配方管理"); mTopBar.addLeftImageButton(R.mipmap.fanhui,R.id.topbar).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - onDestroy(); - ConfigName.getInstance().fragmentAdapter.replaceFragment(0,new GongnengFragment()); + finish(); } }); - MessageManager.getInstance().registerMessageReceiver(getActivity(), MessageName.UpdateGood, new MessageLooper.OnMessageListener() { + MessageManager.getInstance().registerMessageReceiver(this, MessageName.UpdateGood, new MessageLooper.OnMessageListener() { @Override public void onMessage(Object msg) { if (msg != null) { BPA_GOODS xx=(BPA_GOODS) msg; - add_good.setData("编辑",xx,goodstypes,getActivity()); + add_good.setData("编辑",xx,goodstypes,activity); add_good.setVisibility(View.VISIBLE); } } }); - MessageManager.getInstance().registerMessageReceiver(getActivity(), MessageName.DeleteGood1, new MessageLooper.OnMessageListener() { + MessageManager.getInstance().registerMessageReceiver(this, MessageName.DeleteGood1, new MessageLooper.OnMessageListener() { @Override public void onMessage(Object msg) { if (msg != null) { @@ -183,7 +184,7 @@ public class GoodPeiFangActivity extends BaseFragment { }); //打开 - MessageManager.getInstance().registerMessageReceiver(getActivity(), MessageName.ClickGoodNew, new MessageLooper.OnMessageListener() { + MessageManager.getInstance().registerMessageReceiver(this, MessageName.ClickGoodNew, new MessageLooper.OnMessageListener() { @Override public void onMessage(Object msg) { if (msg != null) { @@ -325,7 +326,7 @@ public class GoodPeiFangActivity extends BaseFragment { switch (view.getId()) { case R.id.add_fl://增加分类 //1.弹窗 增加分类 - final QMUIDialog.EditTextDialogBuilder builder_add = new QMUIDialog.EditTextDialogBuilder(context); + final QMUIDialog.EditTextDialogBuilder builder_add = new QMUIDialog.EditTextDialogBuilder(this); builder_add.setTitle("新建分类") .setPlaceholder("请输入") .setInputType(InputType.TYPE_CLASS_TEXT) @@ -361,7 +362,7 @@ public class GoodPeiFangActivity extends BaseFragment { .show(); break; case R.id.add_sp://增加商品 - add_good.setData("新建",null,goodstypes,this.getActivity()); + add_good.setData("新建",null,goodstypes,activity); add_good.setVisibility(View.VISIBLE); break; } 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 354b74a2..999e56e2 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 @@ -1,5 +1,7 @@ package com.bonait.bnframework.modules.home.fragment.from; +import static com.bonait.bnframework.MainApplication.getContext; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; @@ -17,6 +19,7 @@ import android.view.View; import android.widget.Button; import com.bonait.bnframework.R; +import com.bonait.bnframework.common.base.BaseActivity; import com.bonait.bnframework.common.base.BaseFragment; import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.constant.Constants; @@ -38,7 +41,7 @@ import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; -public class ImageSourceActivity extends BaseFragment { +public class ImageSourceActivity extends BaseActivity { @BindView(R.id.topbar) QMUITopBarLayout mTopBar; @@ -50,30 +53,23 @@ public class ImageSourceActivity extends BaseFragment { RecyclerView rl_yx_file; @BindView(R.id.baocunbendi) Button baocunbendi; - - @Override - protected View onCreateView() { - View root = LayoutInflater.from(getActivity()).inflate(R.layout.activity_imagesource, null); - ButterKnife.bind(this, root); - return root; - } - @Override - public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - context = getContext(); + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_imagesource); + ButterKnife.bind(this); + context=getContext(); initTopBar(); initFragment(); FlushedImage(); } private void initTopBar() { - mTopBar.setTitle("系统参数"); + mTopBar.setTitle("图片资源管理"); mTopBar.addLeftImageButton(R.mipmap.fanhui,R.id.topbar).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - ConfigName.getInstance().fragmentAdapter.replaceFragment(5,new SheZhifragment()); - } + finish(); } }); } /** 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 a28b1d62..d041b49d 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 @@ -22,8 +22,10 @@ import android.view.ViewGroup; import android.widget.FrameLayout; import com.bonait.bnframework.R; +import com.bonait.bnframework.common.base.BaseActivity; import com.bonait.bnframework.common.base.BaseFragment; import com.bonait.bnframework.common.constant.ConfigName; +import com.bonait.bnframework.common.tabbar.MainNavigateTabBar; import com.bonait.bnframework.modules.home.fragment.GongnengFragment; import com.bonait.bnframework.modules.home.fragment.from.fragment.Jcsjgl_sxgl_fragment; import com.bonait.bnframework.modules.home.fragment.from.fragment.Jcsjgl_wl_fragment; @@ -39,7 +41,7 @@ import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; -public class JcsjglActivity extends BaseFragment { +public class JcsjglActivity extends BaseActivity { @BindView(R.id.topbar) QMUITopBarLayout mTopBar; @@ -47,28 +49,25 @@ public class JcsjglActivity extends BaseFragment { QMUITabSegment tabs; @BindView(R.id.viewpager_wl) QMUIViewPager viewpager_wl; - private Context context; - @Override - protected View onCreateView() { - View root = LayoutInflater.from(getActivity()).inflate(R.layout.activity_jcsjgl, null); - ButterKnife.bind(this, root); - return root; - } @Override - public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - context = getContext(); + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_jcsjgl); + + ButterKnife.bind(this); + initTopBar(); initFragment(); } + private void initTopBar() { mTopBar.setTitle("基础数据管理"); mTopBar.addLeftImageButton(R.mipmap.fanhui,R.id.topbar).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - ConfigName.getInstance().fragmentAdapter.replaceFragment(0,new GongnengFragment()); + finish(); } }); } @@ -76,7 +75,7 @@ public class JcsjglActivity extends BaseFragment { * viewPager里添加fragment */ private void initFragment() { - QMUIFragmentPagerAdapter adapter=new QMUIFragmentPagerAdapter(getChildFragmentManager()) { + QMUIFragmentPagerAdapter adapter=new QMUIFragmentPagerAdapter(getSupportFragmentManager()) { @Override public int getCount() { return 2; 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 15bafd13..cf7712b7 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 @@ -1,5 +1,7 @@ package com.bonait.bnframework.modules.home.fragment.from; +import static com.bonait.bnframework.MainApplication.getContext; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; @@ -9,6 +11,7 @@ import android.graphics.Color; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; +import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; @@ -18,6 +21,7 @@ import android.widget.TextView; import com.bigkoo.pickerview.TimePickerView; import com.bonait.bnframework.R; +import com.bonait.bnframework.common.base.BaseActivity; import com.bonait.bnframework.common.base.BaseFragment; import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.db.QueryDB; @@ -45,7 +49,7 @@ import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; -public class LogActivity extends BaseFragment { +public class LogActivity extends BaseActivity { @BindView(R.id.topbar) QMUITopBarLayout mTopBar; @@ -93,18 +97,14 @@ public class LogActivity extends BaseFragment { Map lx_map = new LinkedHashMap<>(); //endregion private Context context; - + private ViewGroup view; @Override - protected View onCreateView() { - View root = LayoutInflater.from(getActivity()).inflate(R.layout.activity_log, null); - ButterKnife.bind(this, root); - return root; - } - - @Override - public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - context = getContext(); + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_log); + ButterKnife.bind(this); + context=getContext(); + view=(ViewGroup)getWindow().getDecorView(); initTopBar(); initFragment(); Init(); @@ -115,7 +115,7 @@ public class LogActivity extends BaseFragment { mTopBar.addLeftImageButton(R.mipmap.fanhui,R.id.topbar).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - ConfigName.getInstance().fragmentAdapter.replaceFragment(4,new GuanLifragment()); + finish(); } }); } @@ -189,8 +189,10 @@ public class LogActivity extends BaseFragment { .setContentSize(16)//字号 .setDate(selectedDate) .setRangDate(startDate, endDate) - .setDecorView(null) + .setDecorView(view) .build(); + + } 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 342668b2..bd25440d 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 @@ -1,5 +1,7 @@ package com.bonait.bnframework.modules.home.fragment.from; +import static com.bonait.bnframework.MainApplication.getContext; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; @@ -9,6 +11,7 @@ import android.graphics.Color; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; +import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; @@ -18,6 +21,7 @@ import android.widget.TextView; import com.bigkoo.pickerview.TimePickerView; import com.bonait.bnframework.R; +import com.bonait.bnframework.common.base.BaseActivity; import com.bonait.bnframework.common.base.BaseFragment; import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.db.QueryDB; @@ -40,7 +44,7 @@ import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; -public class OrderListActivity extends BaseFragment { +public class OrderListActivity extends BaseActivity { @BindView(R.id.topbar) @@ -91,18 +95,15 @@ public class OrderListActivity extends BaseFragment { Spinner rzlx; Map lx_map = new LinkedHashMap<>(); //endregion - private Context context; - + private Context context;private ViewGroup view; @Override - protected View onCreateView() { - View root = LayoutInflater.from(getActivity()).inflate(R.layout.activity_orderlist, null); - ButterKnife.bind(this, root); - return root; - } + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_orderlist); + + ButterKnife.bind(this); + view=(ViewGroup)getWindow().getDecorView(); - @Override - public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); context = getContext(); initTopBar(); initFragment(); @@ -114,7 +115,7 @@ public class OrderListActivity extends BaseFragment { mTopBar.addLeftImageButton(R.mipmap.fanhui,R.id.topbar).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - ConfigName.getInstance().fragmentAdapter.replaceFragment(2,new DingDanfragment()); + finish(); } }); } @@ -183,7 +184,7 @@ public class OrderListActivity extends BaseFragment { .setContentSize(16)//字号 .setDate(selectedDate) .setRangDate(startDate, endDate) - .setDecorView(null) + .setDecorView(view) .build(); } 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 0c5f0142..d6e25259 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 @@ -1,5 +1,7 @@ package com.bonait.bnframework.modules.home.fragment.from; +import static com.bonait.bnframework.MainApplication.getContext; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; @@ -10,6 +12,7 @@ import android.view.LayoutInflater; import android.view.View; import com.bonait.bnframework.R; +import com.bonait.bnframework.common.base.BaseActivity; import com.bonait.bnframework.common.base.BaseFragment; import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.modules.home.fragment.GongnengFragment; @@ -27,7 +30,7 @@ import com.qmuiteam.qmui.widget.tab.QMUITabSegment; import butterknife.BindView; import butterknife.ButterKnife; -public class PlcControlActivity extends BaseFragment { +public class PlcControlActivity extends BaseActivity { @BindView(R.id.topbar) QMUITopBarLayout mTopBar; @@ -36,18 +39,12 @@ public class PlcControlActivity extends BaseFragment { @BindView(R.id.viewpager_wl) QMUIViewPager viewpager_wl; private Context context; - - @Override - protected View onCreateView() { - View root = LayoutInflater.from(getActivity()).inflate(R.layout.activity_plccontrol, null); - ButterKnife.bind(this, root); - return root; - } - @Override - public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - context = getContext(); + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_plccontrol); + ButterKnife.bind(this); + context=getContext(); initTopBar(); initFragment(); } @@ -57,7 +54,7 @@ public class PlcControlActivity extends BaseFragment { mTopBar.addLeftImageButton(R.mipmap.fanhui,R.id.topbar).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - ConfigName.getInstance().fragmentAdapter.replaceFragment(4,new GuanLifragment()); + finish(); } }); } @@ -65,7 +62,7 @@ public class PlcControlActivity extends BaseFragment { * viewPager里添加fragment */ private void initFragment() { - QMUIFragmentPagerAdapter adapter=new QMUIFragmentPagerAdapter(getChildFragmentManager()) { + QMUIFragmentPagerAdapter adapter=new QMUIFragmentPagerAdapter(getSupportFragmentManager()) { @Override public int getCount() { return 2; 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 cffc67e0..a869039e 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 @@ -1,5 +1,7 @@ package com.bonait.bnframework.modules.home.fragment.from; +import static com.bonait.bnframework.MainApplication.getContext; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; @@ -11,6 +13,7 @@ import android.view.LayoutInflater; import android.view.View; import com.bonait.bnframework.R; +import com.bonait.bnframework.common.base.BaseActivity; import com.bonait.bnframework.common.base.BaseFragment; import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.modules.home.fragment.GuanLifragment; @@ -25,25 +28,19 @@ import com.qmuiteam.qmui.widget.tab.QMUITabSegment; import butterknife.BindView; import butterknife.ButterKnife; -public class RealTimeActivity extends BaseFragment { +public class RealTimeActivity extends BaseActivity { @BindView(R.id.topbar) QMUITopBarLayout mTopBar; @BindView(R.id.recycler_view) RecyclerView recycler_view; private Context context; - - @Override - protected View onCreateView() { - View root = LayoutInflater.from(getActivity()).inflate(R.layout.activity_realtime, null); - ButterKnife.bind(this, root); - return root; - } - @Override - public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - context = getContext(); + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_realtime); + ButterKnife.bind(this); + context=getContext(); initTopBar(); initFragment(); } @@ -53,7 +50,7 @@ public class RealTimeActivity extends BaseFragment { mTopBar.addLeftImageButton(R.mipmap.fanhui,R.id.topbar).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - ConfigName.getInstance().fragmentAdapter.replaceFragment(4,new GuanLifragment()); + finish(); } }); } 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 09d11183..1460c639 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 @@ -1,5 +1,7 @@ package com.bonait.bnframework.modules.home.fragment.from; +import static com.bonait.bnframework.MainApplication.getContext; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; @@ -10,6 +12,7 @@ import android.view.LayoutInflater; import android.view.View; import com.bonait.bnframework.R; +import com.bonait.bnframework.common.base.BaseActivity; import com.bonait.bnframework.common.base.BaseFragment; import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.modules.home.fragment.DingDanfragment; @@ -19,22 +22,17 @@ import com.qmuiteam.qmui.widget.QMUITopBarLayout; import butterknife.BindView; import butterknife.ButterKnife; -public class SalesStatisticsActivity extends BaseFragment { +public class SalesStatisticsActivity extends BaseActivity { @BindView(R.id.topbar) QMUITopBarLayout mTopBar; private Context context; @Override - protected View onCreateView() { - View root = LayoutInflater.from(getActivity()).inflate(R.layout.activity_salesstatistics, null); - ButterKnife.bind(this, root); - return root; - } - - @Override - public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_salesstatistics); + ButterKnife.bind(this); context = getContext(); initTopBar(); initFragment(); @@ -45,7 +43,7 @@ public class SalesStatisticsActivity extends BaseFragment { mTopBar.addLeftImageButton(R.mipmap.fanhui,R.id.topbar).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - ConfigName.getInstance().fragmentAdapter.replaceFragment(2,new DingDanfragment()); + finish(); } }); } diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SilosActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SilosActivity.java index 21fa7f56..14628929 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SilosActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SilosActivity.java @@ -1,5 +1,7 @@ package com.bonait.bnframework.modules.home.fragment.from; +import static com.bonait.bnframework.MainApplication.getContext; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; @@ -46,7 +48,7 @@ import java.util.stream.Collectors; import butterknife.BindView; import butterknife.ButterKnife; -public class SilosActivity extends BaseFragment { +public class SilosActivity extends BaseActivity { @BindView(R.id.topbar) QMUITopBarLayout mTopBar; @@ -56,29 +58,26 @@ public class SilosActivity extends BaseFragment { RecyclerView rv_right; private Context context; ArrayList lcModes = new ArrayList<>(); - @Override - protected View onCreateView() { - View root = LayoutInflater.from(getActivity()).inflate(R.layout.activity_silos, null); - ButterKnife.bind(this, root); - return root; - } + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_silos); - @Override - public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - context = getContext(); + ButterKnife.bind(this); + context=getContext(); initTopBar(); InitData(); + + } + private void initTopBar() { mTopBar.setTitle("料仓管理"); mTopBar.addLeftImageButton(R.mipmap.fanhui, R.id.topbar).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - onDestroy(); - ConfigName.getInstance().fragmentAdapter.replaceFragment(0, new GongnengFragment()); + finish(); } }); } 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 c5cebc77..6f629363 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 @@ -1,5 +1,7 @@ package com.bonait.bnframework.modules.home.fragment.from; +import static com.bonait.bnframework.MainApplication.getContext; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; @@ -15,6 +17,7 @@ import android.widget.Spinner; import com.bonait.bnframework.R; import com.bonait.bnframework.business.ConfigData; +import com.bonait.bnframework.common.base.BaseActivity; import com.bonait.bnframework.common.base.BaseFragment; import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.db.QueryDB; @@ -34,7 +37,7 @@ import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; -public class SystemParameterActivity extends BaseFragment { +public class SystemParameterActivity extends BaseActivity { @BindView(R.id.topbar) QMUITopBarLayout mTopBar; @@ -64,18 +67,12 @@ public class SystemParameterActivity extends BaseFragment { * 系统设置参数 */ ArrayList bpa_systemsets = new ArrayList<>(); - - @Override - protected View onCreateView() { - View root = LayoutInflater.from(getActivity()).inflate(R.layout.activity_systemparameter, null); - ButterKnife.bind(this, root); - return root; - } - @Override - public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - context = getContext(); + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_systemparameter); + ButterKnife.bind(this); + context=getContext(); initTopBar(); initFragment(); initData(); @@ -87,8 +84,7 @@ public class SystemParameterActivity extends BaseFragment { mTopBar.addLeftImageButton(R.mipmap.fanhui,R.id.topbar).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - ConfigName.getInstance().fragmentAdapter.replaceFragment(5,new SheZhifragment()); - } + finish(); } }); } /** diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_dzcjy_fragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_dzcjy_fragment.java index 76358414..584b227b 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_dzcjy_fragment.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_dzcjy_fragment.java @@ -134,6 +134,7 @@ public class JiaoYan_dzcjy_fragment extends BaseFragment { public void onDestroy() { super.onDestroy(); Logger.d("我的fragment销毁"); + ExecuteTheRecipe.StopJiaoYanMode(); } /** diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_lsjy_fragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_lsjy_fragment.java index fb1c1642..2d953567 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_lsjy_fragment.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_lsjy_fragment.java @@ -9,12 +9,14 @@ import androidx.recyclerview.widget.RecyclerView; import android.content.Context; import android.os.Bundle; import android.os.Handler; +import android.os.Message; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.WindowManager; import android.widget.Button; import android.widget.EditText; +import android.widget.LinearLayout; import android.widget.TextView; import com.bonait.bnframework.R; @@ -50,6 +52,11 @@ public class JiaoYan_lsjy_fragment extends BaseFragment { @BindView(R.id.edittext_cl) EditText edittext_cl;//出料重量 + + @BindView(R.id.linelayout_fanzhuantime) + LinearLayout linelayout_fanzhuantime;//出料重量 + + private Context context; @Override protected View onCreateView() { @@ -70,8 +77,10 @@ public class JiaoYan_lsjy_fragment extends BaseFragment { */ public void InitView() { Initdata(); + Run(); } + public int selectIndexSilos=-99; @OnClick({R.id.save_jzsj,R.id.save_fzsj @@ -261,15 +270,38 @@ public class JiaoYan_lsjy_fragment extends BaseFragment { //校准时间 edittext_jzsj.setText(String.format("%.1f", (Double.parseDouble(time) / 10))); - Object obj1= ExecuteTheRecipe.ReadPLC("反转时间"); - String fztime = obj1==null?"0":obj1.toString(); - edittext_fzsj.setText(String.format("%.1f", (Double.parseDouble(fztime) / 10))); + + if (ConfigName.getInstance().versionSelectionEnum.equals("配料吧台")) + { + Object obj1= ExecuteTheRecipe.ReadPLC("反转时间"); + String fztime = obj1==null?"0":obj1.toString(); + edittext_fzsj.setText(String.format("%.1f", (Double.parseDouble(fztime) / 10))); + }else + { + linelayout_fanzhuantime.setVisibility(View.GONE); + } } catch (Exception e) { } } + private Handler mHandler = new Handler() { + public void handleMessage(Message msg) { + switch (msg.what) { + case 0: + zhongliang.setText(zhongliangxianshi); + break; + case 1: + break; + case 2: + + break; + } + + } + }; + String zhongliangxianshi="0g"; /** * 实时显示线程 */ @@ -279,18 +311,13 @@ public class JiaoYan_lsjy_fragment extends BaseFragment { public void run() { while (ConfigName.getInstance().PlcIsConnect) { try { - getActivity().runOnUiThread(new Runnable() { - @Override - public void run() { - try { - Object obj= ExecuteTheRecipe.ReadPLC("称当前重量"); - zhongliang.setText(String.valueOf((int)obj / 10.0) + " g"); - } catch (Exception e) { - ToastUtils.error("重量解析显示异常!" + e.getMessage()); - } - } - }); - Thread.sleep(50); + Object obj= ExecuteTheRecipe.ReadPLC("称当前重量"); + if(obj!=null) + { + zhongliangxianshi=String.valueOf((int)obj / 10.0) + " g"; + mHandler.sendEmptyMessage(0); + } + Thread.sleep(100); } catch (InterruptedException e) { throw new RuntimeException(e); } @@ -313,24 +340,27 @@ public class JiaoYan_lsjy_fragment extends BaseFragment { @Override public void run() { Object obj= ExecuteTheRecipe.ReadPLC("称当前重量"); - int val = (int)obj; - val=val<=0?0:val; + if(obj!=null) + { + int val = (int)obj; + val=val<=0?0:val; - ExecuteTheRecipe.WritePLC("校准值"+kkk,(short) val,null); + ExecuteTheRecipe.WritePLC("校准值"+kkk,(short) val,null); - String s = String.valueOf(val); - for (SilosLsjyMode item:DataBus.getInstance().SilosLsjy) - { - if(selectIndexSilos==item.num) + String s = String.valueOf(val); + for (SilosLsjyMode item:DataBus.getInstance().SilosLsjy) { - item.Value=String.format("%.1f", (Double.parseDouble(s) / 10)); + if(kkk==item.num) + { + item.Value=String.format("%.1f", (Double.parseDouble(s) / 10)); + ToastUtils.error("重量!" +item.Value); + } + } + if (DataBus.getInstance().lsjyAdapter!=null) + { + DataBus.getInstance().lsjyAdapter.refresh(); } } - if (DataBus.getInstance().lsjyAdapter!=null) - { - DataBus.getInstance().lsjyAdapter.refresh(); - } - } }, 3000); } catch (Exception e) { @@ -352,6 +382,7 @@ public class JiaoYan_lsjy_fragment extends BaseFragment { public void onDestroy() { super.onDestroy(); Logger.d("我的fragment销毁"); + ExecuteTheRecipe.WritePLC("手自切换", true, null); } /** diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_zdqx_fragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_zdqx_fragment.java index 24520d07..386b7e49 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_zdqx_fragment.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_zdqx_fragment.java @@ -8,6 +8,8 @@ import androidx.viewpager.widget.ViewPager; import android.content.Context; import android.os.Bundle; +import android.os.Handler; +import android.os.Message; import android.view.LayoutInflater; import android.view.View; import android.widget.Button; @@ -29,15 +31,12 @@ public class JiaoYan_zdqx_fragment extends BaseFragment { @BindView(R.id.edittext_pssj) EditText edittext_pssj;//排水阀排水时间 - @BindView(R.id.edittext_jssj) - EditText edittext_jssj;//排水阀进水时间 - @BindView(R.id.edittext_jrsj) - EditText edittext_jrsj;//清洗预加热时间 - @BindView(R.id.edittext_qxjsj) - EditText edittext_qxjsj;//加清洗剂时间 @BindView(R.id.edittext_xhsj) EditText edittext_xhsj;//循环清洗时间 + @BindView(R.id.edittext_qxwd) + EditText edittext_qxwd;//清洗温度 + @BindView(R.id.bt_start) Button bt_start;//开始时间 private Context context; @@ -65,14 +64,8 @@ public class JiaoYan_zdqx_fragment extends BaseFragment { boolean IsStart = false; @OnClick({R.id.save_time,R.id.bt_start}) public void onViewClicked(View view) { - double js = Double.parseDouble(edittext_jssj.getText().toString()); - double qxj = Double.parseDouble(edittext_qxjsj.getText().toString()); switch (view.getId()) { case R.id.save_time://保存时间 - if (qxj >= js ) { - ToastUtils.warning("加清洗剂时间不能大于进水时间!"); - return; - } new Thread(new Runnable() { @Override public void run() { @@ -82,21 +75,6 @@ public class JiaoYan_zdqx_fragment extends BaseFragment { ExecuteTheRecipe.WritePLC("排水阀排水时间",(short)k,null); Thread.sleep(200); } - if (!edittext_jssj.getText().toString().equals("")) { - int k= (int)Math.round((Double.parseDouble(edittext_jssj.getText().toString()) * 10)); - ExecuteTheRecipe.WritePLC("排水阀进水时间",(short)k,null); - Thread.sleep(200); - } - if (!edittext_jrsj.getText().toString().equals("")) { - int k= (int)Math.round((Double.parseDouble(edittext_jrsj.getText().toString()) * 10)); - ExecuteTheRecipe.WritePLC("清洗预加热时间",(short)k,null); - Thread.sleep(200); - } - if (!edittext_qxjsj.getText().toString().equals("")) { - int k= (int)Math.round((Double.parseDouble(edittext_qxjsj.getText().toString()) * 10)); - ExecuteTheRecipe.WritePLC("加清洗剂时间",(short)k,null); - Thread.sleep(200); - } if (!edittext_xhsj.getText().toString().equals("")) { int k= (int)Math.round((Double.parseDouble(edittext_xhsj.getText().toString()) * 10)); @@ -104,6 +82,12 @@ public class JiaoYan_zdqx_fragment extends BaseFragment { Thread.sleep(200); } + if (!edittext_qxwd.getText().toString().equals("")) { + int k= Integer.parseInt(edittext_qxwd.getText().toString()); + ExecuteTheRecipe.WritePLC("水池温度设置",k,null); + Thread.sleep(200); + } + } catch (InterruptedException e) { } catch (Exception e) { @@ -115,10 +99,6 @@ public class JiaoYan_zdqx_fragment extends BaseFragment { ToastUtils.info("保存成功!"); break; case R.id.bt_start://开始清洗 - if (qxj >= js /*|| qxj >= ps*/) { - ToastUtils.warning("加清洗剂时间不能大于进水时间!"); - return; - } if (IsStart) { ToastUtils.warning("正在清洗中,请勿重复点击!"); @@ -161,6 +141,22 @@ public class JiaoYan_zdqx_fragment extends BaseFragment { //region 数据加载 + private Handler mHandler = new Handler() { + public void handleMessage(Message msg) { + switch (msg.what) { + case 0: + bt_start.setText("开始清洗"); + break; + case 1: + + break; + case 2: + + break; + } + + } + }; /** * 初始化数据加载 */ @@ -170,30 +166,25 @@ public class JiaoYan_zdqx_fragment extends BaseFragment { Object t1= ExecuteTheRecipe.ReadPLC("排水阀排水时间"); edittext_pssj.setText(t1==null?"0.0":(String.format ("%.1f", (Double.parseDouble(t1.toString())/10)))); - Object t2= ExecuteTheRecipe.ReadPLC("排水阀进水时间"); - edittext_jssj.setText(t2==null?"0.0":(String.format ("%.1f", (Double.parseDouble(t2.toString())/10)))); - - Object t3= ExecuteTheRecipe.ReadPLC("清洗预加热时间"); - edittext_jrsj.setText(t3==null?"0.0":(String.format ("%.1f", (Double.parseDouble(t3.toString())/10)))); - - Object t4= ExecuteTheRecipe.ReadPLC("加清洗剂时间"); - edittext_qxjsj.setText(t4==null?"0.0":(String.format ("%.1f", (Double.parseDouble(t4.toString())/10)))); - Object t5= ExecuteTheRecipe.ReadPLC("循环清洗时间"); edittext_xhsj.setText(t5==null?"0.0":(String.format ("%.1f", (Double.parseDouble(t5.toString())/10)))); - + Object t7= ExecuteTheRecipe.ReadPLC("水池温度设置"); + edittext_qxwd.setText((t7==null?0:(int)t7) +""); ExecuteTheRecipe.CleaningComplete=new IRun() { @Override public void Run() { if (IsStart) { IsStart = false; - bt_start.setText("开始清洗"); + mHandler.sendEmptyMessage(0); ExecuteTheRecipe.WritePLC("清洗模式",false,null); ToastUtils.info("清洗完成"); } } }; + + ExecuteTheRecipe.WritePLC("手自切换",true,null); + } catch (Exception e) { } @@ -204,6 +195,7 @@ public class JiaoYan_zdqx_fragment extends BaseFragment { public void onDestroy() { super.onDestroy(); Logger.d("我的fragment销毁"); + ExecuteTheRecipe.WritePLC("清洗模式",false,null); } /** diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_makegood_control.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_makegood_control.java index f72f5f1d..f297e2af 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_makegood_control.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_makegood_control.java @@ -38,7 +38,7 @@ import java.util.ArrayList; import butterknife.BindView; import butterknife.ButterKnife; -public class add_makegood_control extends LinearLayout implements MyClickListener { +public class add_makegood_control extends LinearLayout{ @BindView(R.id.quzhizuo) @@ -54,18 +54,17 @@ public class add_makegood_control extends LinearLayout implements MyClickListene @BindView(R.id.makegoodtitle) TextView makegoodtitle;//配方名称 - /** - * 属性数据 - */ - ArrayList bpa_goodproperties = new ArrayList<>(); /** * 点击事件 */ public MyClickListener mListener = null; private View root; + private Context contextMian; + public add_makegood_control(Context context, @Nullable AttributeSet attrs) { super(context, attrs); + contextMian=context; root = LayoutInflater.from(context).inflate(R.layout.dialog_add_makegood, this); ButterKnife.bind(this, root); Init(); @@ -80,43 +79,11 @@ public class add_makegood_control extends LinearLayout implements MyClickListene private void initData() { //2.填充规则数据,查询所有属性大类 - bpa_goodproperties.clear(); - ArrayList da = QueryDB.GetGoodsPropertyALL("0"); - for (BPA_GOODPROPERTY item : da) { - ResGoodProperty re = new ResGoodProperty(); - re.id = item.id; - re.name = item.name; - - ArrayList zsx = QueryDB.GetGoodsPropertyALL(item.id); - re.child = new ArrayList<>(); - - - ArrayList _chid = new ArrayList<>(); - for (BPA_GOODPROPERTY k : zsx) { - ResGoodProperty m = new ResGoodProperty(); - m.id = k.id; - m.name = k.name; - m.isSelect = false; - _chid.add(m); - } - re.child = _chid; - - bpa_goodproperties.add(re); - } - - for (ResGoodProperty item : bpa_goodproperties) { - int i = 0; - for (ResGoodProperty c : item.child) { - if (i == 0) { - c.isSelect = true; - } - i++; - } + if(DataBus.getInstance().sxadapter==null) + { + DataBus.getInstance().sxadapter = new pfsx_adapter(contextMian, R.layout.pfsx_item, DataBus.getInstance().bpa_goodproperties); } - - - pfsx_adapter sxadapter = new pfsx_adapter(getContext(), R.layout.pfsx_item, bpa_goodproperties, this); - datatab_makesx.setAdapter(sxadapter); + datatab_makesx.setAdapter(DataBus.getInstance().sxadapter); } /** @@ -189,7 +156,6 @@ public class add_makegood_control extends LinearLayout implements MyClickListene } BPA_GOODSRECIPENAME goodsrecipename = null; - String pfname = "";//配方名称集合 String ggids = "";//规格id集合 String names=""; /** @@ -198,7 +164,7 @@ public class add_makegood_control extends LinearLayout implements MyClickListene public boolean DataValidation() { //1.数据名称不能为空 ggids = "";names=""; - for (ResGoodProperty item : bpa_goodproperties) { + for (ResGoodProperty item : DataBus.getInstance().bpa_goodproperties) { for (ResGoodProperty k : item.child) { if (k.isSelect) { ggids += k.id + ","; @@ -218,28 +184,4 @@ public class add_makegood_control extends LinearLayout implements MyClickListene } return true; } - - - /** - * 点击事件 - * - * @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; - } - } - - @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_pf_control.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_pf_control.java index 11387063..8bcbe1fd 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 @@ -177,7 +177,7 @@ public class add_pf_control extends LinearLayout implements MyClickListener { } - pfsx_adapter sxadapter = new pfsx_adapter(getContext(), R.layout.pfsx_item, bpa_goodproperties, this); + pfsx_adapter sxadapter = new pfsx_adapter(getContext(), R.layout.pfsx_item, bpa_goodproperties); datatab_sx.setAdapter(sxadapter); InitTab(); diff --git a/app/src/main/res/layout/activity_log.xml b/app/src/main/res/layout/activity_log.xml index 4f2607ff..02218580 100644 --- a/app/src/main/res/layout/activity_log.xml +++ b/app/src/main/res/layout/activity_log.xml @@ -13,7 +13,6 @@ android:layout_marginTop="54dp" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/main_background" > + android:textSize="12dp" /> + android:textSize="12dp" /> + android:textSize="12dp" /> + android:textSize="12dp" /> + android:textSize="12dp" /> diff --git a/app/src/main/res/layout/datatab/layout/yjrz_item.xml b/app/src/main/res/layout/datatab/layout/yjrz_item.xml index 6d0394b6..af1e95f6 100644 --- a/app/src/main/res/layout/datatab/layout/yjrz_item.xml +++ b/app/src/main/res/layout/datatab/layout/yjrz_item.xml @@ -41,7 +41,7 @@ android:layout_alignParentLeft="true" android:text="日志类型" android:textColor="@color/foreground" - android:textSize="@dimen/textSize" /> + android:textSize="12dp" /> + android:textSize="12dp" /> + android:textSize="12dp" /> diff --git a/app/src/main/res/layout/fragment_jiaoyan.xml b/app/src/main/res/layout/fragment_jiaoyan.xml index 3bc2c8de..94843fdc 100644 --- a/app/src/main/res/layout/fragment_jiaoyan.xml +++ b/app/src/main/res/layout/fragment_jiaoyan.xml @@ -30,10 +30,15 @@ - + android:layout_height="match_parent"> + + + + + + android:textSize="12dp" + android:text="0"/> - - - - - - + + + + +