ソースを参照

现场调整3388

茶饮新(现场)
fyf 1年前
コミット
4bd831045a
14個のファイルの変更425行の追加200行の削除
  1. +61
    -11
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  2. +8
    -10
      app/src/main/java/com/bonait/bnframework/common/constant/DataBus.java
  3. +17
    -10
      app/src/main/java/com/bonait/bnframework/modules/home/adapter/clsfbc_adapter.java
  4. +1
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/adapter/wdsz_adapter.java
  5. +53
    -42
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/MakeGoodFragment.java
  6. +27
    -2
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_clsfbc_fragment.java
  7. +13
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_dzcjy_fragment.java
  8. +91
    -54
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_lsjy_fragment.java
  9. +75
    -45
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_sdkz_fragment.java
  10. +27
    -4
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_wdsz_fragment.java
  11. +29
    -8
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_zdqx_fragment.java
  12. +2
    -2
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/sdkz_control.java
  13. +1
    -1
      app/src/main/res/layout/fragment_jiaoyan_zdqx.xml
  14. +20
    -9
      app/src/main/res/layout/fragment_make_good.xml

+ 61
- 11
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java ファイルの表示

@@ -20,6 +20,7 @@ import com.bonait.bnframework.common.db.res.ResGoodsMake;
import com.bonait.bnframework.common.db.res.ResGoodsRecipe;
import com.bonait.bnframework.common.db.res.UserLogEnum;
import com.bonait.bnframework.common.helper.ByteHelper;
import com.bonait.bnframework.common.helper.DataFormat;
import com.bonait.bnframework.common.helper.I.IReadCallBack;
import com.bonait.bnframework.common.helper.I.IRun;
import com.bonait.bnframework.common.helper.I.IRunT;
@@ -225,17 +226,18 @@ public class ExecuteTheRecipe {
@Override
public void Run() throws InterruptedException {
try {
for (String item : ConfigName.getInstance().PLC_Address.keySet()) {
String key = item;
BPA_PLCADDRESS plcaddress = ConfigName.getInstance().PLC_Address.get(item);
if (plcaddress.isread == 1) {
Object val = ReadPLC(key);
ListeningValue.put(key, val);
}
}
// for (String item : ConfigName.getInstance().PLC_Address.keySet()) {
// String key = item;
// BPA_PLCADDRESS plcaddress = ConfigName.getInstance().PLC_Address.get(item);
// if (plcaddress.isread == 1) {
// Object val = ReadPLC(key);
// ListeningValue.put(key, val);
// }
// }

ReadPLCStatus();
ReadCode();

//ReadPLCStatus();
AutoJR();
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
@@ -254,8 +256,6 @@ public class ExecuteTheRecipe {
public void Run() throws InterruptedException {
try {

ReadCode();

ChargeSignal();
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
@@ -496,6 +496,56 @@ public class ExecuteTheRecipe {
}
}

/**
* 读PLC数据
*
* @param name
* @return
*/
public static Object[] ReadPLC(String name,int length) {
final Object[] ReturnsVariable = new Object[length];
try {
if (ConfigName.getInstance().PLC_Address.containsKey(name)) {
BPA_PLCADDRESS plcaddress = ConfigName.getInstance().PLC_Address.get(name);
if (!plcaddress.address.isEmpty() && ConfigName.getInstance().PlcIsConnect) {
if (plcaddress.address.toUpperCase().startsWith("VD"))//int
{
ModbusTcpServer.get().ReadInt(plcaddress.address, length, val -> {
for (int i = 0; i < length; i++) {
ReturnsVariable[i] = val[i];
}
});
} else if (plcaddress.address.toUpperCase().startsWith("M"))//bool
{
ModbusTcpServer.get().ReadBool(plcaddress.address, length, val -> {
for (int i = 0; i < length; i++) {
ReturnsVariable[i] = val[i];
}
});
} else if (plcaddress.address.toUpperCase().startsWith("VW"))//short
{
ModbusTcpServer.get().ReadShort(plcaddress.address, length, val -> {
for (int i = 0; i < length; i++) {
ReturnsVariable[i] = val[i];
}
});
} else if (plcaddress.address.toUpperCase().startsWith("VR"))//float
{
ModbusTcpServer.get().ReadFloat(plcaddress.address, length, val -> {
for (int i = 0; i < length; i++) {
ReturnsVariable[i] = val[i];
}
});
}
}
}
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
} finally {
return ReturnsVariable;
}
}


/**
* 读PLC数据


+ 8
- 10
app/src/main/java/com/bonait/bnframework/common/constant/DataBus.java ファイルの表示

@@ -266,7 +266,6 @@ public class DataBus {

//region 流速校验
public ArrayList<SilosLsjyMode> SilosLsjy = new ArrayList<SilosLsjyMode>();
public lsjy_adapter lsjyAdapter=null;
/**
* 获取流速料仓数据
*/
@@ -278,16 +277,19 @@ public class DataBus {
ArrayList<BPA_SILOS> bpa_silos = QueryDB.GetSilosALL();
//加载materials数据
if (bpa_silos.size() > 0) {

Object[] jzkg= ExecuteTheRecipe.ReadPLC("通道1校准开关",20);
Object[] jzz= ExecuteTheRecipe.ReadPLC("校准值1",20);

for (BPA_SILOS silo : bpa_silos) {
List<BPA_MATERIAL> m = QueryDB.GetMaterialBySilosID(silo.id);

SilosLsjyMode mode=new SilosLsjyMode();
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.ReadPLC("通道"+silo.num+"校准开关");
Object _val=ExecuteTheRecipe.ReadPLC("校准值"+silo.num);
Object kg=jzkg[silo.num-1];
Object _val=jzz[silo.num-1];
short val=_val==null?0:(short)_val;
String s = String.valueOf(val);
mode.jzkg= kg==null?false:(boolean) kg;
@@ -295,10 +297,6 @@ public class DataBus {
SilosLsjy.add(mode);
}
}
if (lsjyAdapter!=null)
{
lsjyAdapter.refresh();
}
} catch (Exception e) {
e.printStackTrace();
}
@@ -327,9 +325,9 @@ public class DataBus {
wdszMode mode=new wdszMode();
mode.name=item;
mode.temp=0;
Object sx=ExecuteTheRecipe.getListingValue(item+"设置");
Object sx=ExecuteTheRecipe.ReadPLC(item+"设置");
mode.tempup=sx==null?0:(int)sx;
mode.autoheat=false;
if(item.equals("水池温度"))
{
mode.autoheat=ConfigName.getInstance().AutomaticHeating;


+ 17
- 10
app/src/main/java/com/bonait/bnframework/modules/home/adapter/clsfbc_adapter.java ファイルの表示

@@ -40,16 +40,24 @@ public class clsfbc_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
private Context context;

List<Res_ZDSF> goods = new ArrayList<>();

Object[] main_kg =new Object[6];
Object[] main_gxs =new Object[6];
Object[] main_dxs =new Object[6];
Object[] main_bcsj =new Object[6];
/**
* 点击事件
*/
public MyClickListener mListener=null;

public clsfbc_adapter(Context context,List<Res_ZDSF> data) {
public clsfbc_adapter(Context context,List<Res_ZDSF> data,Object[] _kg,Object[] _gxs,Object[] _dxs,Object[] _bcsj) {
this.context = context;
mLayoutInflater = LayoutInflater.from(context);
goods=data;
main_kg=_kg;
main_gxs =_gxs ;
main_dxs =_dxs ;
main_bcsj=_bcsj;

}

@NonNull
@@ -67,17 +75,16 @@ public class clsfbc_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
MyLCViewHolder1 myViewHolder = (MyLCViewHolder1) holder;
Res_ZDSF sf= goods.get(position);
myViewHolder.td_text.setText(sf.name);
int index=position+1;
Object kg=ExecuteTheRecipe.ReadPLC("通道"+index+"补偿开关");
Object kg=main_kg[position];
myViewHolder.switch1.setChecked(kg==null?false:((boolean) kg));

int index=position+1;
Object gxs=main_gxs[position];
myViewHolder.bc_text1.setText(gxs==null?"0":(gxs+""));
Object dxs=main_dxs[position];
myViewHolder.bc_text2.setText(dxs==null?"0":(dxs+""));

Object dxs=ExecuteTheRecipe.ReadPLC("高系数"+index);
myViewHolder.bc_text1.setText(dxs==null?"0":(dxs+""));
Object gxs=ExecuteTheRecipe.ReadPLC("低系数"+index);
myViewHolder.bc_text2.setText(gxs==null?"0":(gxs+""));

Object time=ExecuteTheRecipe.ReadPLC("补偿"+index+"时间");
Object time=main_bcsj[position];
int timel=time==null?0:(Integer.parseInt(time.toString()));

myViewHolder.bc_text3.setText(String.format ("%.1f", timel/10.0)+"");


+ 1
- 1
app/src/main/java/com/bonait/bnframework/modules/home/adapter/wdsz_adapter.java ファイルの表示

@@ -67,7 +67,7 @@ public class wdsz_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
public void handleMessage(Message msg) {
switch (msg.what) {
case 0:
myViewHolder.temp.setText(temp[0]);
myViewHolder.temp.setText(temp[0]+"");
break;
case 1:



+ 53
- 42
app/src/main/java/com/bonait/bnframework/modules/home/fragment/MakeGoodFragment.java ファイルの表示

@@ -9,6 +9,7 @@ import androidx.recyclerview.widget.RecyclerView;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
@@ -34,6 +35,7 @@ import com.bonait.bnframework.common.db.res.ResGoodProperty;
import com.bonait.bnframework.common.db.res.ResGoodsMake;
import com.bonait.bnframework.common.db.res.SilosLsjyMode;
import com.bonait.bnframework.common.helper.I.IRun;
import com.bonait.bnframework.common.helper.I.IWriteCallBack;
import com.bonait.bnframework.common.helper.I.MyClickListener;
import com.bonait.bnframework.common.linktab.LinkMode;
import com.bonait.bnframework.common.linktab.TopItemDecoration;
@@ -101,14 +103,17 @@ public class MakeGoodFragment extends BaseFragment {
@BindView(R.id.good_gengxin)
Button good_gengxin;

@BindView(R.id.cheng_clear)
Button cheng_clear;


/**
* 当前温度
*/
@BindView(R.id.wendu1)
TextView wendu1;
@BindView(R.id.pf_ms)
TextView pf_ms;
// @BindView(R.id.pf_ms)
// TextView pf_ms;
@BindView(R.id.plc_status)
TextView plc_status;
@BindView(R.id.dianzichen)
@@ -131,6 +136,7 @@ public class MakeGoodFragment extends BaseFragment {
context = getContext();
initTopBar();
Initdata();
Run();
}
public List<LinkMode> Fdata = new ArrayList<>();
/**
@@ -301,12 +307,24 @@ public class MakeGoodFragment extends BaseFragment {
}
};
}
@OnClick({R.id.good_gengxin})
@OnClick({R.id.good_gengxin,R.id.cheng_clear})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.good_gengxin://刷新
Initdata();
break;
case R.id.cheng_clear://称重清零
ExecuteTheRecipe.WritePLC("重量清零", true, new IWriteCallBack() {
@Override
public void onSuccess() {
ToastUtils.info("清零成功!");
}
@Override
public void onFailure(String ErrorMsg) {
ToastUtils.error("清零失败!");
}
});
break;
}
}

@@ -315,7 +333,10 @@ public class MakeGoodFragment extends BaseFragment {
public void handleMessage(Message msg) {
switch (msg.what) {
case 0:
//zhongliang.setText(zhongliangxianshi);
plc_status.setText(ConfigName.getInstance().PlcIsConnect?"正常":"异常");
plc_status.setTextColor(ConfigName.getInstance().PlcIsConnect? Color.parseColor("#4CAF50"):Color.parseColor("#D32F2F"));
wendu1.setText(tempwd);
dianzichen.setText(zhongliangxianshi);
break;
case 1:

@@ -329,50 +350,40 @@ public class MakeGoodFragment extends BaseFragment {
};

String zhongliangxianshi="0g";
String tempwd="0°C";

/**
* 实时显示线程
*/
public void Run() {

// new Thread(new Runnable() {
// @Override
// public void run() {
// while (true) {
// try {
//
// getActivity().runOnUiThread(new Runnable() {
// @Override
// public void run() {
// wendu1.setText(String.valueOf(DeviceData.Get().getBWX_FructoseTemperature()) + "°C");
// plc_status.setText(DataBus.getInstance().PlcIsConnect?"正常":"异常");
//
// Object obj= ExecuteTheRecipe.ReadPLC("称当前重量");
// if(obj!=null)
// {
// String zhongliangxianshi=String.valueOf((int)obj / 10.0) + " g";
// mHandler.sendEmptyMessage(0);
// }
// dianzichen.setText(String.valueOf(DeviceData.Get().getCallCurrentWeight(1) / 10.0) + " g");
// // plc_status.setTextColor(DataBus.getInstance().PlcIsConnect?getResources().getColor(R.color.foreground):getResources().getColor(R.color.warm_red));
// }
// });
// Thread.sleep(100);
//
// 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);
// }
// }
// }
// }).start();
new Thread(new Runnable() {
@Override
public void run() {
while (true) {
try {
if(ConfigName.getInstance().PlcIsConnect)
{
Object obj= ExecuteTheRecipe.ReadPLC("称当前重量");
if(obj!=null)
{
zhongliangxianshi=String.valueOf((int)obj / 10.0) + " g";
}

Object obj1= ExecuteTheRecipe.ReadPLC("水池温度");
if(obj1!=null)
{
tempwd=String.valueOf(obj1) + "°C";
}
}
mHandler.sendEmptyMessage(0);
Thread.sleep(100);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
}).start();


}


+ 27
- 2
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_clsfbc_fragment.java ファイルの表示

@@ -3,6 +3,7 @@ package com.bonait.bnframework.modules.home.fragment.from.fragment;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.content.Context;
@@ -14,12 +15,15 @@ import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.common.base.BaseFragment;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.helper.I.IRun;
import com.bonait.bnframework.common.helper.I.IWriteCallBack;
import com.bonait.bnframework.common.helper.WrapContentLinearLayoutManager;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.common.view.MyLayoutManager;
import com.bonait.bnframework.modules.home.adapter.clsfbc_adapter;
import com.bonait.bnframework.modules.home.adapter.image_sp_adapter;
import com.bonait.bnframework.modules.home.adapter.lsjy_adapter;
import com.orhanobut.logger.Logger;
import com.qmuiteam.qmui.widget.QMUITopBarLayout;

@@ -70,8 +74,29 @@ public class JiaoYan_clsfbc_fragment extends BaseFragment {
MyLayoutManager layout = new MyLayoutManager();
layout.setAutoMeasureEnabled(true);
recycler_clsfbc.setLayoutManager(layout);
clsfbc_adapter spadapter = new clsfbc_adapter(context, ConfigName.getInstance().zdsfs_出料算法);
recycler_clsfbc.setAdapter(spadapter);
new Thread(new Runnable() {
@Override
public void run() {
try {
Object[] kg =ExecuteTheRecipe.ReadPLC("通道1补偿开关",6);
Object[] gxs =ExecuteTheRecipe.ReadPLC("高系数1",6);
Object[] dxs =ExecuteTheRecipe.ReadPLC("低系数1",6);
Object[] bcsj =ExecuteTheRecipe.ReadPLC("补偿1时间",6);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
clsfbc_adapter spadapter = new clsfbc_adapter(context
, ConfigName.getInstance().zdsfs_出料算法
,kg,gxs,dxs,bcsj);
recycler_clsfbc.setAdapter(spadapter);
}
});

} catch (Exception e) {

}
}
}).start();


} catch (Exception e) {


+ 13
- 1
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_dzcjy_fragment.java ファイルの表示

@@ -3,6 +3,7 @@ package com.bonait.bnframework.modules.home.fragment.from.fragment;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;

import android.annotation.SuppressLint;
import android.content.Context;
@@ -25,8 +26,10 @@ import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL;
import com.bonait.bnframework.common.helper.I.IWriteCallBack;
import com.bonait.bnframework.common.helper.I.MyClickListener;
import com.bonait.bnframework.common.helper.WrapContentLinearLayoutManager;
import com.bonait.bnframework.common.utils.NetworkUtils;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.modules.home.adapter.lsjy_adapter;
import com.bonait.bnframework.modules.home.adapter.wl_adapter;
import com.orhanobut.logger.Logger;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
@@ -134,7 +137,16 @@ public class JiaoYan_dzcjy_fragment extends BaseFragment {
public void onDestroy() {
super.onDestroy();
Logger.d("我的fragment销毁");
ExecuteTheRecipe.StopJiaoYanMode();
new Thread(new Runnable() {
@Override
public void run() {
try {
ExecuteTheRecipe.StopJiaoYanMode();
} catch (Exception e) {

}
}
}).start();
}

/**


+ 91
- 54
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_lsjy_fragment.java ファイルの表示

@@ -24,14 +24,25 @@ import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.common.base.BaseFragment;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.db.QueryDB;
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.SilosLsjyMode;
import com.bonait.bnframework.common.helper.I.IRun;
import com.bonait.bnframework.common.helper.I.IWriteCallBack;
import com.bonait.bnframework.common.helper.WrapContentLinearLayoutManager;
import com.bonait.bnframework.common.linktab.LinkMode;
import com.bonait.bnframework.common.linktab.TopItemDecoration;
import com.bonait.bnframework.common.linktab.makegood.MakeGoodLeftAdapter;
import com.bonait.bnframework.common.linktab.makegood.MakeGoodRightAdapter;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.modules.home.adapter.lsjy_adapter;
import com.orhanobut.logger.Logger;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
@@ -163,18 +174,28 @@ public class JiaoYan_lsjy_fragment extends BaseFragment {
//region 判断是否只勾选了一个料仓
SelectSilos();
//endregion
ExecuteTheRecipe.WritePLC("校准完成",false,null);

ExecuteTheRecipe.WritePLC("手自切换", false, null);
ExecuteTheRecipe.WritePLC("通道校准", true, new IWriteCallBack() {
ExecuteTheRecipe.WritePLC("手自切换", false, new IWriteCallBack() {
@Override
public void onSuccess() {
ToastUtils.info("启动通道校准成功!");
ExecuteTheRecipe.WritePLC("通道校准", true, new IWriteCallBack() {
@Override
public void onSuccess() {
ToastUtils.info("启动通道校准成功!");
}
@Override
public void onFailure(String ErrorMsg) {
ToastUtils.error("启动通道校准失败!");
}
});
}
@Override
public void onFailure(String ErrorMsg) {
ToastUtils.error("启动通道校准失败!");
}
});

break;
case R.id.kscl://开始出料
String zltext = edittext_cl.getText().toString();
@@ -213,8 +234,9 @@ public class JiaoYan_lsjy_fragment extends BaseFragment {
ToastUtils.warning("请打开通道开关!");
return;
}
ExecuteTheRecipe.WritePLC("配料完成",false,null);

ExecuteTheRecipe.WritePLC("手自切换", true, null);
ExecuteTheRecipe.WritePLC("手自切换", true,null);
ExecuteTheRecipe.WritePLC("需求值" + selectIndexSilos, (short) ((int) (zl * 10)), new IWriteCallBack() {
@Override
public void onSuccess() {
@@ -253,33 +275,52 @@ public class JiaoYan_lsjy_fragment extends BaseFragment {
//endregion
}
//region 数据加载
public lsjy_adapter lsjyAdapter=null;
/**
* 初始化数据加载
*/
public void Initdata() {
try {
//顶部料仓信息
DataBus.getInstance().GetSilosLsjy();
Recy_Lsjy.setLayoutManager(new WrapContentLinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL,false));
DataBus.getInstance().lsjyAdapter = new lsjy_adapter(getContext());
Recy_Lsjy.setAdapter(DataBus.getInstance().lsjyAdapter);
new Thread(new Runnable() {
@Override
public void run() {
try {
DataBus.getInstance().GetSilosLsjy();
//底部按钮信息
Object obj= ExecuteTheRecipe.ReadPLC("基准时间");
String time = obj==null?"0":obj.toString();
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {

//底部按钮信息
Object obj= ExecuteTheRecipe.ReadPLC("基准时间");
String time = obj==null?"0":obj.toString();
//校准时间
edittext_jzsj.setText(String.format("%.1f", (Double.parseDouble(time) / 10)));
if(isAdded())
{
Recy_Lsjy.setLayoutManager(new WrapContentLinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL,false));
lsjyAdapter = new lsjy_adapter(getContext());
Recy_Lsjy.setAdapter(lsjyAdapter);
}

//校准时间
edittext_jzsj.setText(String.format("%.1f", (Double.parseDouble(time) / 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) {

}
}
}).start();

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) {

}
@@ -289,7 +330,7 @@ public class JiaoYan_lsjy_fragment extends BaseFragment {
public void handleMessage(Message msg) {
switch (msg.what) {
case 0:
zhongliang.setText(zhongliangxianshi);
zhongliang.setText(String.valueOf((int)zhongliangxianshi / 10.0) + " g");
break;
case 1:

@@ -301,7 +342,7 @@ public class JiaoYan_lsjy_fragment extends BaseFragment {

}
};
String zhongliangxianshi="0g";
int zhongliangxianshi=0;
/**
* 实时显示线程
*/
@@ -314,10 +355,10 @@ public class JiaoYan_lsjy_fragment extends BaseFragment {
Object obj= ExecuteTheRecipe.ReadPLC("称当前重量");
if(obj!=null)
{
zhongliangxianshi=String.valueOf((int)obj / 10.0) + " g";
zhongliangxianshi=(int)obj;//
mHandler.sendEmptyMessage(0);
}
Thread.sleep(100);
Thread.sleep(200);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
@@ -328,46 +369,42 @@ public class JiaoYan_lsjy_fragment extends BaseFragment {
ExecuteTheRecipe.OnChargeMixtureComNotPar = new IRun() {
@Override
public void Run() {
ToastUtils.warning("通道校准完成!");
if (selectIndexSilos > 0) {
final int kkk = selectIndexSilos;
try {
getActivity().runOnUiThread(new Runnable() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
try {
// 在2秒后执行按钮操作
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Object obj= ExecuteTheRecipe.ReadPLC("称当前重量");
if(obj!=null)
{
int val = (int)obj;
val=val<=0?0:val;

ExecuteTheRecipe.WritePLC("校准值"+kkk,(short) val,null);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
try {
// 在2秒后执行按钮操作
ExecuteTheRecipe.WritePLC("校准值"+kkk,(short) zhongliangxianshi,null);

String s = String.valueOf(val);
for (SilosLsjyMode item:DataBus.getInstance().SilosLsjy)
{
if(kkk==item.num)
{
item.Value=String.format("%.1f", (Double.parseDouble(s) / 10));
ToastUtils.error("重量!" +item.Value);
}
}
if (DataBus.getInstance().lsjyAdapter!=null)
String s = String.valueOf(zhongliangxianshi);
for (SilosLsjyMode item:DataBus.getInstance().SilosLsjy)
{
if(kkk==item.num)
{
DataBus.getInstance().lsjyAdapter.refresh();
item.Value=String.format("%.1f", (Double.parseDouble(s) / 10));
ToastUtils.warning("重量!" +item.Value);
}
}
if (lsjyAdapter!=null)
{
lsjyAdapter.refresh();
}
} catch (Exception e) {
ToastUtils.error("重量解析显示异常!" + e.getMessage());
}
}, 3000);
} catch (Exception e) {
ToastUtils.error("重量解析显示异常!" + e.getMessage());
}
}
});
}
});
}, 1000);

} catch (Exception ex) {
Log.d("dsds", "Run: " + ex.getMessage());
}


+ 75
- 45
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_sdkz_fragment.java ファイルの表示

@@ -3,6 +3,7 @@ package com.bonait.bnframework.modules.home.fragment.from.fragment;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;

import android.app.Activity;
import android.content.Context;
@@ -13,10 +14,13 @@ import android.widget.EditText;
import android.widget.LinearLayout;

import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.common.base.BaseFragment;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.db.res.Res_PLCADDRESS1;
import com.bonait.bnframework.common.helper.WrapContentLinearLayoutManager;
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;
import com.orhanobut.logger.Logger;
@@ -72,53 +76,69 @@ public class JiaoYan_sdkz_fragment extends BaseFragment {
public void Initdata() {
try {
Activity activity=getActivity();
List<Res_PLCADDRESS1> plcaddresses=new ArrayList<>();
if (ConfigName.getInstance().versionSelectionEnum.equals("配料吧台")) {
for (Res_PLCADDRESS1 item : ConfigName.getInstance().PlcAddress_配料吧台_手动) {
if(item.address.equals("-------------"))//这是标题
{
if(plcaddresses.size()>0)
{
sdkz_control sdkz = new sdkz_control(sdkz_linrarlaout.getContext(), null, plcaddresses,activity,true);
sdkz_linrarlaout.addView(sdkz);
}
plcaddresses=new ArrayList<>();
tab_control tab = new tab_control(sdkz_linrarlaout.getContext(), null, item.name);
sdkz_linrarlaout.addView(tab);
}else
{
plcaddresses.add(item);
}
}
if(plcaddresses.size()>0)
{
sdkz_control sdkz = new sdkz_control(sdkz_linrarlaout.getContext(), null, plcaddresses,activity,true);
sdkz_linrarlaout.addView(sdkz);
}
}else
{
for (Res_PLCADDRESS1 item : ConfigName.getInstance().PlcAddress_奶茶机_手动) {
if(item.address.equals("-------------"))//这是标题
{
if(plcaddresses.size()>0)
{
sdkz_control sdkz = new sdkz_control(sdkz_linrarlaout.getContext(), null, plcaddresses,activity,true);
sdkz_linrarlaout.addView(sdkz);
}
plcaddresses=new ArrayList<>();
tab_control tab = new tab_control(sdkz_linrarlaout.getContext(), null, item.name);
sdkz_linrarlaout.addView(tab);
}else
{
plcaddresses.add(item);
new Thread(new Runnable() {
@Override
public void run() {
try {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
List<Res_PLCADDRESS1> plcaddresses=new ArrayList<>();
if (ConfigName.getInstance().versionSelectionEnum.equals("配料吧台")) {
for (Res_PLCADDRESS1 item : ConfigName.getInstance().PlcAddress_配料吧台_手动) {
if(item.address.equals("-------------"))//这是标题
{
if(plcaddresses.size()>0)
{
sdkz_control sdkz = new sdkz_control(sdkz_linrarlaout.getContext(), null, plcaddresses,activity,true);
sdkz_linrarlaout.addView(sdkz);
}
plcaddresses=new ArrayList<>();
tab_control tab = new tab_control(sdkz_linrarlaout.getContext(), null, item.name);
sdkz_linrarlaout.addView(tab);
}else
{
plcaddresses.add(item);
}
}
if(plcaddresses.size()>0)
{
sdkz_control sdkz = new sdkz_control(sdkz_linrarlaout.getContext(), null, plcaddresses,activity,true);
sdkz_linrarlaout.addView(sdkz);
}
}else
{
for (Res_PLCADDRESS1 item : ConfigName.getInstance().PlcAddress_奶茶机_手动) {
if(item.address.equals("-------------"))//这是标题
{
if(plcaddresses.size()>0)
{
sdkz_control sdkz = new sdkz_control(sdkz_linrarlaout.getContext(), null, plcaddresses,activity,true);
sdkz_linrarlaout.addView(sdkz);
}
plcaddresses=new ArrayList<>();
tab_control tab = new tab_control(sdkz_linrarlaout.getContext(), null, item.name);
sdkz_linrarlaout.addView(tab);
}else
{
plcaddresses.add(item);
}
}
if(plcaddresses.size()>0)
{
sdkz_control sdkz = new sdkz_control(sdkz_linrarlaout.getContext(), null, plcaddresses,activity,true);
sdkz_linrarlaout.addView(sdkz);
}
}
}
});

} catch (Exception e) {

}
}
if(plcaddresses.size()>0)
{
sdkz_control sdkz = new sdkz_control(sdkz_linrarlaout.getContext(), null, plcaddresses,activity,true);
sdkz_linrarlaout.addView(sdkz);
}
}
}).start();

} catch (Exception e) {

}
@@ -129,6 +149,16 @@ public class JiaoYan_sdkz_fragment extends BaseFragment {
public void onDestroy() {
super.onDestroy();
Logger.d("我的fragment销毁");
new Thread(new Runnable() {
@Override
public void run() {
try {
ExecuteTheRecipe.WritePLC("手自切换", true, null);
} catch (Exception e) {

}
}
}).start();
}

/**


+ 27
- 4
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_wdsz_fragment.java ファイルの表示

@@ -12,9 +12,12 @@ import android.view.LayoutInflater;
import android.view.View;

import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.common.base.BaseFragment;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.helper.WrapContentLinearLayoutManager;
import com.bonait.bnframework.modules.home.adapter.clsfbc_adapter;
import com.bonait.bnframework.modules.home.adapter.lsjy_adapter;
import com.bonait.bnframework.modules.home.adapter.wdsz_adapter;
import com.orhanobut.logger.Logger;
@@ -66,10 +69,30 @@ public class JiaoYan_wdsz_fragment extends BaseFragment {
*/
public void Initdata() {
try {
DataBus.getInstance().GetWdsz();
Recy_wdsz.setLayoutManager(new WrapContentLinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL,false));
DataBus.getInstance().wdszAdapter = new wdsz_adapter(getContext());
Recy_wdsz.setAdapter(DataBus.getInstance().wdszAdapter);
new Thread(new Runnable() {
@Override
public void run() {
try {
DataBus.getInstance().GetWdsz();
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if(isAdded())
{
Recy_wdsz.setLayoutManager(new WrapContentLinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL,false));
DataBus.getInstance().wdszAdapter = new wdsz_adapter(getContext());
Recy_wdsz.setAdapter(DataBus.getInstance().wdszAdapter);
}
}
});

} catch (Exception e) {

}
}
}).start();



} catch (Exception e) {



+ 29
- 8
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_zdqx_fragment.java ファイルの表示

@@ -4,6 +4,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.viewpager.widget.ViewPager;

import android.content.Context;
@@ -18,9 +19,12 @@ import android.widget.EditText;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.common.base.BaseFragment;
import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.helper.I.IRun;
import com.bonait.bnframework.common.helper.I.IWriteCallBack;
import com.bonait.bnframework.common.helper.WrapContentLinearLayoutManager;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.modules.home.adapter.wdsz_adapter;
import com.orhanobut.logger.Logger;

import butterknife.BindView;
@@ -119,6 +123,7 @@ public class JiaoYan_zdqx_fragment extends BaseFragment {
public void run() {
IsStart=true;
bt_start.setText("正在清洗");
bt_start.setBackgroundResource(R.drawable.cp_bj);
}
});
}
@@ -146,6 +151,7 @@ public class JiaoYan_zdqx_fragment extends BaseFragment {
switch (msg.what) {
case 0:
bt_start.setText("开始清洗");
bt_start.setBackgroundResource(R.drawable.sz_bj);
break;
case 1:

@@ -162,15 +168,30 @@ public class JiaoYan_zdqx_fragment extends BaseFragment {
*/
public void Initdata() {
try {
//填充数据
Object t1= ExecuteTheRecipe.ReadPLC("排水阀排水时间");
edittext_pssj.setText(t1==null?"0.0":(String.format ("%.1f", (Double.parseDouble(t1.toString())/10))));
new Thread(new Runnable() {
@Override
public void run() {
try {
//填充数据
Object t1= ExecuteTheRecipe.ReadPLC("排水阀排水时间");
Object t5= ExecuteTheRecipe.ReadPLC("循环清洗时间");
Object t7= ExecuteTheRecipe.ReadPLC("水池温度设置");
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
edittext_pssj.setText(t1==null?"0.0":(String.format ("%.1f", (Double.parseDouble(t1.toString())/10))));
edittext_xhsj.setText(t5==null?"0.0":(String.format ("%.1f", (Double.parseDouble(t5.toString())/10))));
edittext_qxwd.setText((t7==null?0:(int)t7) +"");
}
});
ExecuteTheRecipe.WritePLC("手自切换",true,null);
} catch (Exception e) {

}
}
}).start();

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() {
@@ -183,7 +204,7 @@ public class JiaoYan_zdqx_fragment extends BaseFragment {
}
};

ExecuteTheRecipe.WritePLC("手自切换",true,null);

} catch (Exception e) {



+ 2
- 2
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/sdkz_control.java ファイルの表示

@@ -56,11 +56,11 @@ public class sdkz_control extends LinearLayout {
if(Issd)
{
aSwitch.setTag(item.address);
aSwitch.setChecked(ExecuteTheRecipe.ReadPLCSD(item.address));
// aSwitch.setChecked(ExecuteTheRecipe.ReadPLCSD(item.address));
}else
{
aSwitch.setTag(item.zd_address);
aSwitch.setChecked(ExecuteTheRecipe.ReadPLCSD(item.address));
// aSwitch.setChecked(ExecuteTheRecipe.ReadPLCSD(item.address));
}
aSwitch.setHeight(55);
aSwitch.setBackground(ConfigName.getInstance().dishesCon.getResources().getDrawable(R.drawable.button2));


+ 1
- 1
app/src/main/res/layout/fragment_jiaoyan_zdqx.xml ファイルの表示

@@ -146,7 +146,7 @@
android:layout_height="80dp"
android:layout_centerInParent="true"
android:layout_marginTop="40dp"
android:background="@drawable/button1"
android:background="@drawable/sz_bj"
android:text="开始清洗"
android:textColor="@color/black_light"
android:textSize="20dp"/>


+ 20
- 9
app/src/main/res/layout/fragment_make_good.xml ファイルの表示

@@ -138,23 +138,34 @@
android:text="称:"
android:textSize="@dimen/TitleSize"
android:layout_margin="5dp"/>

<TextView
android:id="@+id/dianzichen"
android:layout_width="wrap_content"
android:layout_width="70dp"
android:layout_height="wrap_content"
android:textColor="@color/green_primary"
android:textSize="@dimen/TitleSize"
android:text="11.9g"
android:layout_margin="5dp"/>

<TextView
android:id="@+id/pf_ms"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:textColor="#730080"
android:text="信息配方:正在制作过程中..."
android:layout_margin="5dp"/>
<Button
android:id="@+id/cheng_clear"
android:layout_marginTop="5dp"
android:layout_width="40dp"
android:layout_height="30dp"
android:layout_centerInParent="true"
android:background="@drawable/bg_btn_login_selected"
android:text="清零"
android:textColor="@color/white"
android:textSize="14dp" />
<!-- <TextView-->
<!-- android:id="@+id/pf_ms"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:paddingLeft="10dp"-->
<!-- android:textColor="#730080"-->
<!-- android:text="信息配方:正在制作过程中..."-->
<!-- android:layout_margin="5dp"/>-->

</LinearLayout>
</RelativeLayout>


読み込み中…
キャンセル
保存