Ver código fonte

34444

味魔方Android
fyf 10 meses atrás
pai
commit
6580ccdd9e
19 arquivos alterados com 328 adições e 1797 exclusões
  1. +38
    -69
      app/src/main/java/com/bonait/bnframework/common/constant/DataBus.java
  2. +93
    -4
      app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java
  3. +30
    -3
      app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_SILOS.java
  4. +33
    -13
      app/src/main/java/com/bonait/bnframework/common/db/res/lcMode.java
  5. +0
    -255
      app/src/main/java/com/bonait/bnframework/modules/home/adapter/clsfbc_adapter.java
  6. +0
    -291
      app/src/main/java/com/bonait/bnframework/modules/home/adapter/lsjy_adapter.java
  7. +7
    -9
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/JiaoYanFragment.java
  8. +1
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SilosNewActivity.java
  9. +1
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/ZdqxActivity.java
  10. +0
    -127
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_clsfbc_fragment.java
  11. +0
    -498
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_lsjy_fragment.java
  12. +107
    -47
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/Silos_item_jiaoyan_fragment.java
  13. +0
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_manguan_control.java
  14. +0
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_silos_ck.java
  15. +6
    -7
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/silos_jiaoyan.java
  16. +0
    -0
      app/src/main/res/layout/activity_zdqx.xml
  17. +0
    -28
      app/src/main/res/layout/fragment_jiaoyan_clsfbc.xml
  18. +0
    -432
      app/src/main/res/layout/fragment_jiaoyan_lsjy.xml
  19. +12
    -10
      app/src/main/res/layout/item/layout/fragment_silos_item_jiaoyan.xml

+ 38
- 69
app/src/main/java/com/bonait/bnframework/common/constant/DataBus.java Ver arquivo

@@ -30,7 +30,6 @@ import com.bonait.bnframework.common.helper.MessageLog;
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.adapter.zdqxchid_adapter;
@@ -78,11 +77,47 @@ public class DataBus {
if (bpa_silos.size() > 0) {
for (BPA_SILOS silo : bpa_silos) {
List<BPA_MATERIAL> m = QueryDB.GetMaterialBySilosID(silo.id);
lcMode lcMode=new lcMode();
lcMode.id= silo.id;
lcMode.exp= silo.exp;
lcMode.num= silo.num;
lcMode.name= silo.name;
lcMode.warningValue= silo.warningValue;
lcMode.thrsoleValue= silo.thrsoleValue;
lcMode.plcValue= silo.plcValue;
lcMode.bValue= silo.bValue;
lcMode.jValue= silo.jValue;
lcMode.status= silo.status;
lcMode.Sort= silo.Sort;
lcMode.silosmargin= silo.silosmargin;
lcMode.siloszl= silo.siloszl;


lcMode.jTime= silo.jTime;
lcMode.fTime= silo.fTime;
lcMode.isenablebcsf= silo.isenablebcsf;
lcMode.minweight= silo.minweight;
lcMode.maxweight= silo.maxweight;
lcMode.jfrequency= silo.jfrequency;
lcMode.bcsfValue= silo.bcsfValue;


lcMode.isOpenbcsf= silo.isOpenbcsf;
lcMode.Gxs= silo.Gxs;
lcMode.Lxs= silo.Lxs;
lcMode.tdclsj= silo.tdclsj;


if (m.size() > 0) {
lc.add(new lcMode(silo.id, silo.num, m.get(0).name, silo.silosmargin, silo.siloszl, m.get(0).id,m.get(0).type, silo.warningValue, silo.thrsoleValue,silo.name.isEmpty()?"":silo.name,silo.status,silo.bValue));
lcMode.materialName= m.get(0).name;
lcMode.materialId= m.get(0).id;
lcMode.materiallx= m.get(0).type;
} else {
lc.add(new lcMode(silo.id, silo.num, "未设置", silo.silosmargin, silo.siloszl, "",0, silo.warningValue, silo.thrsoleValue,silo.name.isEmpty()?"":silo.name,silo.status,silo.bValue));
lcMode.materialName= "未设置";
lcMode.materialId= "";
lcMode.materiallx= 0;
}
lc.add(lcMode);
}
}
} catch (Exception e) {
@@ -303,72 +338,6 @@ public class DataBus {
}
//endregion

//region 流速校验
public ArrayList<SilosLsjyMode> SilosLsjy = new ArrayList<SilosLsjyMode>();
public lsjy_adapter lsjyAdapter=null;
/**
* 获取流速料仓数据
*/
public void GetSilosLsjy()
{
try {
SilosLsjy=new ArrayList<>();
//获取料仓数据
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=jzkg[silo.num-1];
// Object _val=jzz[silo.num-1];
// short val=_val==null?0:(short)_val;
// String s = String.valueOf(val);
mode.jzkg= false;//kg==null?false:(boolean) kg;
mode.Value="0.0";// //String.format("%.1f", (Double.parseDouble(s) / 10));
mode.mgtime=silo.bValue;
mode.id=silo.id;
SilosLsjy.add(mode);
}
}

if (DataBus.getInstance().lsjyAdapter!=null)
{
DataBus.getInstance().lsjyAdapter.refresh();
}
} catch (Exception e) {
e.printStackTrace();
}
}

public void GetSilosLsjyValue()
{
Object[] jzkg= ExecuteTheRecipe.ReadPLC("通道1校准开关",20);
Object[] jzz= ExecuteTheRecipe.ReadPLC("校准值1",20);
for (SilosLsjyMode mode:SilosLsjy)
{
Object kg=jzkg[mode.num-1];
Object _val=jzz[mode.num-1];
short val=_val==null?0:(short)_val;
String s = String.valueOf(val);
mode.jzkg= kg==null?false:(boolean) kg;
mode.Value= String.format("%.1f", (Double.parseDouble(s) / 10));
}
if (DataBus.getInstance().lsjyAdapter!=null)
{
DataBus.getInstance().lsjyAdapter.refresh();
}
}
//endregion

//region 温度设置
public ArrayList<wdszMode> wdszModes = new ArrayList<wdszMode>();
public wdsz_adapter wdszAdapter=null;


+ 93
- 4
app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java Ver arquivo

@@ -425,7 +425,7 @@ public class QueryDB {
* @param id
* @param data
*/
public static void UpdateJYZ(String id, int data) {
public static void UpdateJYZ(String id, String data) {
BPA_SILOS silos = GetSilosID(id);
if (silos != null) {
silos.jValue = data;
@@ -491,12 +491,86 @@ public class QueryDB {
/**
* 料仓校准时间
* @param id
* @param
*/
public static void UpdateSilosJZTime(String id, String jdata, String fdata) {
BPA_SILOS silos = GetSilosID(id);
if (silos != null) {
silos.jTime = jdata;
silos.fTime = fdata;
Update(BPA_SILOS.class, silos);
}
}

/**
* 是否启用补偿算法
* @param id
* @param data
*/
public static void UpdateSilosIsEnableBCSF(String id, boolean data) {
BPA_SILOS silos = GetSilosID(id);
if (silos != null) {
silos.isenablebcsf = data?1:0;
Update(BPA_SILOS.class, silos);
}
}
/**
* 补偿算法校准变量
* @param id
* @param
*/
public static void UpdateSilosBcsfValue(String id, String _minweight, String _maxweight, String _jfrequency) {
BPA_SILOS silos = GetSilosID(id);
if (silos != null) {
silos.minweight = _minweight;
silos.maxweight = _maxweight;
silos.jfrequency = _jfrequency;
Update(BPA_SILOS.class, silos);
}
}
/**
* 补偿算法校准值
* @param id
* @param data
*/
public static void UpdateSilosJZTime(String id, String data) {
public static void UpdateSilosBcsfValue(String id, String data) {
BPA_SILOS silos = GetSilosID(id);
if (silos != null) {
silos.plcValue = data;
silos.bcsfValue = data;
Update(BPA_SILOS.class, silos);
}
}







/**
* 是否启用补偿算法
* @param id
* @param data
*/
public static void UpdateSilosisOpenbcsf(String id, boolean data) {
BPA_SILOS silos = GetSilosID(id);
if (silos != null) {
silos.isOpenbcsf = data?1:0;
Update(BPA_SILOS.class, silos);
}
}

/**
* 补偿算法 参数
* @param id
* @param
*/
public static void UpdateSilosisOpenbcsf(String id, String G,String L,String time) {
BPA_SILOS silos = GetSilosID(id);
if (silos != null) {
silos.Gxs = G;
silos.Lxs = L;
silos.tdclsj = time;
Update(BPA_SILOS.class, silos);
}
}
@@ -3235,11 +3309,26 @@ public class QueryDB {
((BPA_SILOS) data).thrsoleValue = cursor.getInt((int) cursor.getColumnIndex("thrsoleValue"));
((BPA_SILOS) data).plcValue = cursor.getString((int) cursor.getColumnIndex("plcValue"));
((BPA_SILOS) data).bValue = cursor.getInt((int) cursor.getColumnIndex("bValue"));
((BPA_SILOS) data).jValue = cursor.getInt((int) cursor.getColumnIndex("jValue"));
((BPA_SILOS) data).jValue = cursor.getString((int) cursor.getColumnIndex("jValue"));
((BPA_SILOS) data).status = cursor.getInt((int) cursor.getColumnIndex("status"));
((BPA_SILOS) data).Sort = cursor.getInt((int) cursor.getColumnIndex("Sort"));
((BPA_SILOS) data).silosmargin = cursor.getInt((int) cursor.getColumnIndex("silosmargin"));
((BPA_SILOS) data).siloszl = cursor.getInt((int) cursor.getColumnIndex("siloszl"));

//测试
((BPA_SILOS) data).jTime = cursor.getString((int) cursor.getColumnIndex("jTime"));
((BPA_SILOS) data).fTime = cursor.getString((int) cursor.getColumnIndex("fTime"));
((BPA_SILOS) data).isenablebcsf = cursor.getInt((int) cursor.getColumnIndex("isenablebcsf"));
((BPA_SILOS) data).minweight = cursor.getString((int) cursor.getColumnIndex("minweight"));
((BPA_SILOS) data).maxweight = cursor.getString((int) cursor.getColumnIndex("maxweight"));
((BPA_SILOS) data).jfrequency = cursor.getString((int) cursor.getColumnIndex("jfrequency"));
((BPA_SILOS) data).bcsfValue = cursor.getString((int) cursor.getColumnIndex("bcsfValue"));

//通道出料
((BPA_SILOS) data).isOpenbcsf = cursor.getInt((int) cursor.getColumnIndex("isOpenbcsf"));
((BPA_SILOS) data).Gxs = cursor.getString((int) cursor.getColumnIndex("Gxs"));
((BPA_SILOS) data).Lxs = cursor.getString((int) cursor.getColumnIndex("Lxs"));
((BPA_SILOS) data).tdclsj = cursor.getString((int) cursor.getColumnIndex("tdclsj"));
break;
case "BPA_SILOSANDMATERIAL":
data = new BPA_SILOSANDMATERIAL();


+ 30
- 3
app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_SILOS.java Ver arquivo

@@ -15,10 +15,10 @@ public class BPA_SILOS extends ModeBase {
public int thrsoleValue;
//PLC控制信号量
public String plcValue;// 20s
//标准值 标准 1s出多少g(出场标准) 更改为 满管 需要时间
//满管 需要时间 例如 10s
public int bValue;
//校准值 实际校准1s出多少g
public int jValue; //100 g
//校准值 实际校准
public String jValue; //100 g
//状态 状态:0 启用 1 禁用
public int status;
//优先级 优先出料顺序
@@ -27,4 +27,31 @@ public class BPA_SILOS extends ModeBase {
public int silosmargin;
//料仓总量
public int siloszl;


//校准时间 jValue/jTime = (1s 出多少g)
public String jTime;
//反转时间
public String fTime;
//是否启用算法补偿 0 不启用 1 启用
public int isenablebcsf;
//最小重量
public String minweight;
//最大重量
public String maxweight;
//校准频率 2s
public String jfrequency;
//算法校准变量: 2.3,32.5|3.0,45.6|3.5,45.9
public String bcsfValue;


//临时补偿校准使用 奶茶机
//奶茶机 0 不启用 1 启用
public int isOpenbcsf;

public String Gxs;

public String Lxs;

public String tdclsj;
}

+ 33
- 13
app/src/main/java/com/bonait/bnframework/common/db/res/lcMode.java Ver arquivo

@@ -10,18 +10,38 @@ public class lcMode extends BPA_SILOS {
public String materialId;
//物料类型
public int materiallx;
public lcMode(String id, int num,String materialName, int silosmargin,int siloszl,String materialId,int materiallx,int warningValue,int thrsoleValue,String _name,int _sta,int _bvalue) {
this.materialName = materialName;
this.silosmargin = silosmargin;
this.num = num;
this.id = id;
this.materialId = materialId;
this.materiallx=materiallx;
this.warningValue=warningValue;
this.thrsoleValue=thrsoleValue;
this.siloszl=siloszl;
this.name=_name;
this.status=_sta;
this.bValue=_bvalue;
public lcMode()
{

}

// public lcMode(String id, int num,String materialName, int silosmargin,int siloszl,String materialId,int materiallx,int warningValue,int thrsoleValue,String _name,int _sta,int _bvalue
// ,String jTime,String fTime,int isenablebcsf,String minweight,String maxweight,String jfrequency,String bcsfValue
// ,int isOpenbcsf,String Gxs,String Lxs,String tdclsj) {
// this.materialName = materialName;
// this.silosmargin = silosmargin;
// this.num = num;
// this.id = id;
// this.materialId = materialId;
// this.materiallx=materiallx;
// this.warningValue=warningValue;
// this.thrsoleValue=thrsoleValue;
// this.siloszl=siloszl;
// this.name=_name;
// this.status=_sta;
// this.bValue=_bvalue;
//
// this.jTime=jTime;
// this.fTime=fTime;
// this.isenablebcsf=isenablebcsf;
// this.minweight=minweight;
// this.maxweight=maxweight;
// this.jfrequency=jfrequency;
// this.bcsfValue=bcsfValue;
// this.isOpenbcsf=isOpenbcsf;
// this.Gxs=Gxs;
// this.Lxs=Lxs;
// this.tdclsj=tdclsj;
//
// }
}

+ 0
- 255
app/src/main/java/com/bonait/bnframework/modules/home/adapter/clsfbc_adapter.java Ver arquivo

@@ -1,255 +0,0 @@
package com.bonait.bnframework.modules.home.adapter;

import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Switch;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.db.res.Res_PLCADDRESS1;
import com.bonait.bnframework.common.db.res.Res_ZDSF;
import com.bonait.bnframework.common.helper.I.IWriteCallBack;
import com.bonait.bnframework.common.helper.I.MyClickListener;
import com.bonait.bnframework.common.image.MyBitmapUtils;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.modules.home.fragment.mode.image_sp;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;
import com.suke.widget.SwitchButton;

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

public class clsfbc_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

private final LayoutInflater mLayoutInflater;

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,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
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View inflate = mLayoutInflater.inflate(R.layout.item_clsfbc, parent, false);
return new MyLCViewHolder1(inflate);

}

@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
try {
if (holder instanceof MyLCViewHolder1) {
MyLCViewHolder1 myViewHolder = (MyLCViewHolder1) holder;
Res_ZDSF sf= goods.get(position);
myViewHolder.td_text.setText(sf.name);
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 time=main_bcsj[position];
int timel=time==null?0:(Integer.parseInt(time.toString()));

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

myViewHolder.save_botton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

Short H=0;
Short L=0;
Short time=0;
try {
H=Short.parseShort(myViewHolder.bc_text1.getText().toString()) ;
L=Short.parseShort(myViewHolder.bc_text2.getText().toString()) ;
//time=(Short)Math.round();
int ftime = (int)Math.round((Double.parseDouble(myViewHolder.bc_text3.getText().toString()) * 10));
time=(short) ftime;
}
catch (Exception ex)
{

}

ExecuteTheRecipe.WritePLC("高系数"+index,H,null);
ExecuteTheRecipe.WritePLC("低系数"+index,L,null);
ExecuteTheRecipe.WritePLC("补偿" + index + "时间", time, new IWriteCallBack() {
@Override
public void onSuccess() {
ToastUtils.info(sf.name.toString()+",保存变量成功!");
}

@Override
public void onFailure(String ErrorMsg) {
ToastUtils.warning( sf.name.toString()+",保存变量失败!");
}
});
}
});

myViewHolder.switch1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
boolean isopen= myViewHolder.switch1.isChecked();
if (ConfigName.getInstance().PlcIsConnect)
{
ExecuteTheRecipe.WritePLC("通道"+index+"补偿开关",isopen,null);
ToastUtils.info( sf.name.toString()+(isopen?"打开":"关闭")+"成功!");

}else
{
ToastUtils.warning( sf.name.toString()+(isopen?"打开":"关闭")+"失败!PLC未连接!!");
}
}
});


/**
* 模拟出料
*/
myViewHolder.cl_botton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String zltext = myViewHolder.bc_text4.getText().toString();
if (zltext.equals("")) {
ToastUtils.warning("出料重量不能为空!");
return;
}
double zl = 0;
try {
zl = Double.parseDouble(zltext);
} catch (Exception e) {
ToastUtils.warning("出料重量获取异常!" + e.getMessage());
return;
}

if(zl<=0)
{
ToastUtils.warning("出料重量至少大于0g!");
return;
}

short kkk=(short) ((int) (zl * 10));
new Thread(new Runnable() {
@Override
public void run() {
try {
ExecuteTheRecipe.WritePLC("配料完成",false,null);

ExecuteTheRecipe.WritePLC("手自切换", true,null);
ExecuteTheRecipe.WritePLC("需求值" + index,kkk,new IWriteCallBack() {
@Override
public void onSuccess() {
ExecuteTheRecipe.WritePLC("配料启动", true, null);
}
@Override
public void onFailure(String ErrorMsg) {
}
});
} catch (Exception e) {

}
}
}).start();
ToastUtils.warning("需求值下发成功!开始配料......");
}
});
}
} catch (Exception e) {
e.printStackTrace();
}
}

private Activity findActivity(@NonNull Context context) {
if (context instanceof Activity) {
return (Activity) context;
} else if (context instanceof ContextWrapper) {
return findActivity(((ContextWrapper) context).getBaseContext());
} else {
return null;
}
}

/**
* 刷新
*
* @param
*/
public void refresh() {
Activity activity = findActivity(context);
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
try {
notifyDataSetChanged();
} catch (Exception e) {

}
}
});
}
}

@Override
public int getItemCount() {
return goods.size();
}

public static class MyLCViewHolder1 extends RecyclerView.ViewHolder {
TextView td_text;//标题
SwitchButton switch1;
EditText bc_text1,bc_text2,bc_text3,bc_text4;

Button save_botton,cl_botton;

public MyLCViewHolder1(View view) {
super(view);
td_text=view.findViewById(R.id.td_text);
switch1=view.findViewById(R.id.switch1);
bc_text1=view.findViewById(R.id.bc_text1);
bc_text2=view.findViewById(R.id.bc_text2);
bc_text3=view.findViewById(R.id.bc_text3);
bc_text4=view.findViewById(R.id.bc_text4);
cl_botton=view.findViewById(R.id.cl_botton);
save_botton=view.findViewById(R.id.save_botton);
}
}
}

+ 0
- 291
app/src/main/java/com/bonait/bnframework/modules/home/adapter/lsjy_adapter.java Ver arquivo

@@ -1,291 +0,0 @@
package com.bonait.bnframework.modules.home.adapter;

import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.os.SystemClock;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Chronometer;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.db.QueryDB;
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.utils.ToastUtils;
import com.suke.widget.SwitchButton;

import java.sql.Struct;
import java.util.List;

/**
* 流速校验
*/
public class lsjy_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

private final LayoutInflater mLayoutInflater;

private Context context;

public List<SilosLsjyMode> mainGoods = DataBus.getInstance().SilosLsjy;

public lsjy_adapter(Context context) {
this.context = context;
mLayoutInflater = LayoutInflater.from(context);
}

@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View inflate = mLayoutInflater.inflate(R.layout.lsjy_item, parent, false);
return new MyGoodLCViewHolder(inflate);

}

@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
try {
if (holder instanceof MyGoodLCViewHolder) {

MyGoodLCViewHolder myViewHolder = (MyGoodLCViewHolder) holder;
SilosLsjyMode goodsMake= mainGoods.get(position);
String name= "通道"+goodsMake.num+"(" +goodsMake.name+")";
myViewHolder.num=goodsMake.num;
myViewHolder.name.setText(name+"");
myViewHolder.wlname.setText(goodsMake.materialName+"");
myViewHolder.control_switch.setChecked(goodsMake.jzkg);
myViewHolder.edittext_tdzl.setText(goodsMake.Value+"");

myViewHolder.edittext_mgsj.setText(goodsMake.mgtime+"");

myViewHolder.control_switch.setOnCheckedChangeListener(new SwitchButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(SwitchButton view, boolean isChecked) {
DataBus.getInstance().SilosLsjy.get(position).jzkg=isChecked;
ExecuteTheRecipe.WritePLC("通道" + goodsMake.num+"校准开关", isChecked, null);
}
});

myViewHolder.save_value.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String value = myViewHolder.edittext_tdzl.getText().toString();
Short val = 0;
try {
val = (short) Math.round((Double.parseDouble(value) * 10));
} catch (Exception e) {
}
ExecuteTheRecipe.WritePLC("校准值" + goodsMake.num, val, new IWriteCallBack() {
@Override
public void onSuccess() {
ToastUtils.info(name+"保存成功!");
}

@Override
public void onFailure(String ErrorMsg) {
ToastUtils.error(name+"保存失败!");
}
});

String value1 = myViewHolder.edittext_mgsj.getText().toString();
int val1 = 0;
try {
val1 =(value1==null|| value1.isEmpty())?0:Integer.parseInt(value1);
QueryDB.UpdateMGTime(DataBus.getInstance().SilosLsjy.get(position).id,val1);
} catch (Exception e) {
}

}
});
final int[] time = {0};
final int[] zl = {0};
//开始计算满管时间
myViewHolder.save_mg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
zl[0] =ExecuteTheRecipe.OutletWeigh;
StartTime(myViewHolder);
}
});

//为Chronomter绑定事件监听器,超过一小时自动日内告知
myViewHolder.runtime.setOnChronometerTickListener(new Chronometer.OnChronometerTickListener() {
@Override
public void onChronometerTick(Chronometer chronometer) {
//如果计时到现在超过了一小时秒 10s
if (SystemClock.elapsedRealtime() - myViewHolder.runtime.getBase() > 10 * 1000) {
time[0] =StopTime(myViewHolder);
DataBus.getInstance().SilosLsjy.get(position).mgtime=time[0];
QueryDB.UpdateMGTime(DataBus.getInstance().SilosLsjy.get(position).id,time[0]);
}
}
});

ExecuteTheRecipe.WeighComplete=new IRun() {
@Override
public void Run() {
if(ExecuteTheRecipe.OutletWeigh >=(zl[0]+2))
{
time[0] =StopTime(myViewHolder);
DataBus.getInstance().SilosLsjy.get(position).mgtime=time[0];
QueryDB.UpdateMGTime(DataBus.getInstance().SilosLsjy.get(position).id,time[0]);
}
}
};


}
} catch (Exception e) {
e.printStackTrace();
}
}

/**
* 启动定时器
*/
public void StartTime(MyGoodLCViewHolder myGoodLCViewHolder) {
myGoodLCViewHolder.jishiqi.setVisibility(View.VISIBLE);
myGoodLCViewHolder.main_laout.setVisibility(View.GONE);

myGoodLCViewHolder.runtime.setBase(SystemClock.elapsedRealtime());
myGoodLCViewHolder.runtime.start();

new Thread(new Runnable() {
@Override
public void run() {
try {
//自动模式
ExecuteTheRecipe.WritePLC("手自切换", false, null);
//开启
ExecuteTheRecipe.WritePLC("手动控制"+myGoodLCViewHolder.num,true,null);
} catch (Exception e) {

}
}
}).start();
}

/**
* 停止定时器
*/
public int StopTime(MyGoodLCViewHolder myGoodLCViewHolder) {
myGoodLCViewHolder.jishiqi.setVisibility(View.GONE);
myGoodLCViewHolder.main_laout.setVisibility(View.VISIBLE);
long elapsedMillis = SystemClock.elapsedRealtime() - myGoodLCViewHolder.runtime.getBase();
myGoodLCViewHolder.runtime.stop();

int time=(int) (elapsedMillis / 1000);
myGoodLCViewHolder.edittext_mgsj.setText(time+"");

new Thread(new Runnable() {
@Override
public void run() {
try {
ExecuteTheRecipe.WritePLC("手动控制"+myGoodLCViewHolder.num,false,null);
} catch (Exception e) {

}
}
}).start();
return time;//当前点击多少秒
}

private Activity findActivity(@NonNull Context context) {
if (context instanceof Activity) {
return (Activity) context;
} else if (context instanceof ContextWrapper) {
return findActivity(((ContextWrapper) context).getBaseContext());
} else {
return null;
}
}
/**
* 刷新
* @param
*/
public void refresh(){
Activity activity= findActivity(context);
if(activity!=null)
{
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
try {
notifyDataSetChanged();
} catch (Exception e) {

}
}
});
}
}

@Override
public int getItemCount() {
return mainGoods.size();
}

public static class MyGoodLCViewHolder extends RecyclerView.ViewHolder {
/**
* 通道名称
*/
TextView name;
/**
* 物料名称
*/
TextView wlname;
/**
* 校准开关
*/
SwitchButton control_switch;
/**
* 通道重量
*/
EditText edittext_tdzl;
/**
* 保存值
*/
Button save_value;


EditText edittext_mgsj;
Button save_mg;

RelativeLayout jishiqi;
LinearLayout main_laout;
Chronometer runtime;

int num=0;
public MyGoodLCViewHolder(View view) {
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);
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);


edittext_mgsj=(EditText) view.findViewById(R.id.edittext_mgsj);
save_mg=(Button) view.findViewById(R.id.save_mg);

jishiqi=view.findViewById(R.id.jishiqi);
main_laout=view.findViewById(R.id.main_laout);
runtime=view.findViewById(R.id.runtime);
}
}
}

+ 7
- 9
app/src/main/java/com/bonait/bnframework/modules/home/fragment/JiaoYanFragment.java Ver arquivo

@@ -24,8 +24,6 @@ import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.model.mode.ResMenuLeft;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.modules.home.adapter.jiaoyan_adapter;
import com.bonait.bnframework.modules.home.fragment.from.fragment.JiaoYan_clsfbc_fragment;
import com.bonait.bnframework.modules.home.fragment.from.fragment.JiaoYan_lsjy_fragment;
import com.orhanobut.logger.Logger;
import com.qmuiteam.qmui.widget.QMUITopBarLayout;

@@ -119,13 +117,13 @@ public class JiaoYanFragment extends BaseFragment {
//JiaoYan_sdkz_fragment 删除控制
//ZdqxActivity

if (ConfigName.getInstance().versionSelectionEnum.equals("配料吧台")) {
menuModes.add(new ResMenuLeft(new JiaoYan_lsjy_fragment(),"流速校验", R.mipmap.lsjy, R.mipmap.lsjy_select,false));
menuModes.add(new ResMenuLeft(new JiaoYan_clsfbc_fragment(),"出料算法补偿", R.mipmap.clsfbc, R.mipmap.clsfbc_selectd,false));
}else
{
menuModes.add(new ResMenuLeft(new JiaoYan_lsjy_fragment(),"流速校验", R.mipmap.lsjy, R.mipmap.lsjy_select,false));
}
// if (ConfigName.getInstance().versionSelectionEnum.equals("配料吧台")) {
// menuModes.add(new ResMenuLeft(new JiaoYan_lsjy_fragment(),"流速校验", R.mipmap.lsjy, R.mipmap.lsjy_select,false));
// menuModes.add(new ResMenuLeft(new JiaoYan_clsfbc_fragment(),"出料算法补偿", R.mipmap.clsfbc, R.mipmap.clsfbc_selectd,false));
// }else
// {
// menuModes.add(new ResMenuLeft(new JiaoYan_lsjy_fragment(),"流速校验", R.mipmap.lsjy, R.mipmap.lsjy_select,false));
// }

for(ResMenuLeft item:menuModes)
{


+ 1
- 1
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SilosNewActivity.java Ver arquivo

@@ -126,7 +126,7 @@ public class SilosNewActivity extends BaseActivity {
//设置
} else if (k == 4) {
//校准
silos_jz.SetData((lcMode) data,getSupportFragmentManager());
silos_jz.SetData((lcMode) data, getSupportFragmentManager());
silos_jz.setVisibility(View.VISIBLE);
} else if (k == 5) {
//


+ 1
- 1
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/ZdqxActivity.java Ver arquivo

@@ -49,7 +49,7 @@ public class ZdqxActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_jiaoyan_zdqx);
setContentView(R.layout.activity_zdqx);
ButterKnife.bind(this);
context = getContext();
activity = this;


+ 0
- 127
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_clsfbc_fragment.java Ver arquivo

@@ -1,127 +0,0 @@
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;
import android.os.Bundle;
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.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;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class JiaoYan_clsfbc_fragment extends BaseFragment {


@BindView(R.id.recycler_clsfbc)
RecyclerView recycler_clsfbc;//出料算法补偿
private Context context;
@Override
protected View onCreateView() {
View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_jiaoyan_clsfbc, null);
ButterKnife.bind(this, root);
return root;
}

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
Logger.d("我的fragment创建");
context = getContext();
InitView();
}
/**
* 初始化界面
*/
public void InitView() {
Initdata();
}

// boolean IsStart = false;
// @OnClick({R.id.save_time,R.id.bt_start})
// public void onViewClicked(View view) {
//
// }


//region 数据加载
/**
* 初始化数据加载
*/
public void Initdata() {
try {
MyLayoutManager layout = new MyLayoutManager();
layout.setAutoMeasureEnabled(true);
recycler_clsfbc.setLayoutManager(layout);
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) {

}
}
//endregion

@Override
public void onDestroy() {
super.onDestroy();
Logger.d("我的fragment销毁");
}

/**
* 当在activity设置viewPager + BottomNavigation + fragment时,
* 为防止viewPager左滑动切换界面,与fragment左滑返回上一界面冲突引起闪退问题,
* 必须加上此方法,禁止fragment左滑返回上一界面。
* <p>
* 切记!切记!切记!否则会闪退!
* <p>
* 当在fragment设置viewPager + BottomNavigation + fragment时,则不会出现这个问题。
*/
@Override
protected boolean canDragBack() {
return false;
}
}

+ 0
- 498
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_lsjy_fragment.java Ver arquivo

@@ -1,498 +0,0 @@
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;
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;
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.MediaPlayerHelper;
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;

public class JiaoYan_lsjy_fragment extends BaseFragment {

@BindView(R.id.Recy_Lsjy)
RecyclerView Recy_Lsjy;//流速校验

@BindView(R.id.zhongliang)
TextView zhongliang;//实时重量

@BindView(R.id.edittext_jzsj)
EditText edittext_jzsj;//校准时间

@BindView(R.id.edittext_fzsj)
EditText edittext_fzsj;//反转时间

@BindView(R.id.edittext_cl)
EditText edittext_cl;//出料重量

@BindView(R.id.linelayout_fanzhuantime)
LinearLayout linelayout_fanzhuantime;//出料重量


private Context context;
@Override
protected View onCreateView() {
View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_jiaoyan_lsjy, null);
ButterKnife.bind(this, root);
return root;
}

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
Logger.d("我的fragment创建");
context = getContext();
InitView();
}
/**
* 初始化界面
*/
public void InitView() {
Initdata();
Run();
}


public int selectIndexSilos=-99;

@OnClick({R.id.save_jzsj,R.id.save_fzsj
,R.id.czql,R.id.save_czql,R.id.ksjz
,R.id.kscl
})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.save_jzsj://保存校准时间
try {
String stime = edittext_jzsj.getText().toString();
if (stime.equals("")) {
ToastUtils.info("校准基准时间不能为空!");
return;
}
int ftime = 0;
try {
ftime = (int) Math.round((Double.parseDouble(stime) * 10));
} catch (Exception e) {
ToastUtils.error("校准基准时间异常!" + e.getMessage());
return;
}
ExecuteTheRecipe.WritePLC("基准时间", (short) ftime, new IWriteCallBack() {
@Override
public void onSuccess() {
ToastUtils.info("校准基准时间保存成功!");
}
@Override
public void onFailure(String ErrorMsg) {
ToastUtils.error("校准基准时间保存失败!");
}
});
} catch (WindowManager.BadTokenException e) {
ToastUtils.error("校准基准时间保存配置异常!" + e.getMessage());
}
break;
case R.id.save_fzsj://保存反转时间
try {
String stime = edittext_fzsj.getText().toString();
if (stime.equals("")) {
ToastUtils.info("反转时间不能为空!");
return;
}
int ftime = 0;
try {
ftime = (int) Math.round((Double.parseDouble(stime) * 10));
} catch (Exception e) {
ToastUtils.error("反转时间异常!" + e.getMessage());
return;
}
ExecuteTheRecipe.WritePLC("反转时间", (short) ftime, new IWriteCallBack() {
@Override
public void onSuccess() {
ToastUtils.info("反转时间保存成功!");
}
@Override
public void onFailure(String ErrorMsg) {
ToastUtils.error("反转时间保存失败!");
}
});
} catch (WindowManager.BadTokenException e) {
ToastUtils.error("反转时间保存配置异常!" + e.getMessage());
}
break;
case R.id.czql://称重清零
case R.id.save_czql:
ExecuteTheRecipe.WritePLC("重量清零", true, new IWriteCallBack() {
@Override
public void onSuccess() {
ToastUtils.info("清零成功!");
}
@Override
public void onFailure(String ErrorMsg) {
ToastUtils.error("清零失败!");
}
});
break;
case R.id.ksjz://开始校准
//切换手动


//region 判断是否只勾选了一个料仓
SelectSilos();
//endregion

//判断是否为果糖
if (!ConfigName.getInstance().versionSelectionEnum.equals("配料吧台"))
{
if(selectIndexSilos==11)
{
Object sx=ExecuteTheRecipe.ReadPLC("果糖左温度设置");
int wdsz=sx==null?0:(int)sx;

if(ExecuteTheRecipe.SugarTempLeft<wdsz)
{
ToastUtils.warning("果糖左仓温度未达到设置值,不允许校准...");
return;
}
}else if(selectIndexSilos==12)
{
Object sx=ExecuteTheRecipe.ReadPLC("果糖右温度设置");
int wdsz=sx==null?0:(int)sx;
if(ExecuteTheRecipe.SugarTempRight<wdsz)
{
ToastUtils.warning("果糖右仓温度未达到设置值,不允许校准...");
return;
}
}
}

new Thread(new Runnable() {
@Override
public void run() {
try {
ExecuteTheRecipe.WritePLC("校准完成",false,null);

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

}
}
}).start();
break;
case R.id.kscl://开始出料
String zltext = edittext_cl.getText().toString();
if (zltext.equals("")) {
ToastUtils.warning("出料重量不能为空!");
return;
}
double zl = 0;
try {
zl = Double.parseDouble(zltext);
} catch (Exception e) {
ToastUtils.warning("出料重量获取异常!" + e.getMessage());
return;
}

if(zl<=0)
{
ToastUtils.warning("出料重量至少大于0g!");
return;
}

if (!ExecuteTheRecipe.IsCup)
{
ToastUtils.warning("出料口没有检测到器皿!");
return;
}

//region 判断是否只勾选了一个料仓
SelectSilos();
//endregion



if (selectIndexSilos==-88)
{
ToastUtils.warning("只能打开一个通道开关!");
return;
}

if (selectIndexSilos<=0)
{
ToastUtils.warning("请打开通道开关!");
return;
}

short kkk=(short) ((int) (zl * 10));
new Thread(new Runnable() {
@Override
public void run() {
try {
ExecuteTheRecipe.WritePLC("配料完成",false,null);

ExecuteTheRecipe.WritePLC("手自切换", true,null);
ExecuteTheRecipe.WritePLC("需求值" + selectIndexSilos,kkk,new IWriteCallBack() {
@Override
public void onSuccess() {
ExecuteTheRecipe.WritePLC("配料启动", true, null);
}
@Override
public void onFailure(String ErrorMsg) {
}
});
} catch (Exception e) {

}
}
}).start();
ToastUtils.warning("需求值下发成功!开始配料......");
break;
}
}

/**
* 判断是否只勾选了一个料仓
*/
public void SelectSilos()
{
//region 判断是否只勾选了一个料仓
selectIndexSilos=-99;
for (SilosLsjyMode item:DataBus.getInstance().SilosLsjy)
{
if(item.jzkg)
{
if(selectIndexSilos==-99)
{
selectIndexSilos=item.num;
}else
{
selectIndexSilos=-88;
}
}
}
//endregion
}
//region 数据加载
/**
* 初始化数据加载
*/
public void Initdata() {
try {
//顶部料仓信息
new Thread(new Runnable() {
@Override
public void run() {
try {
DataBus.getInstance().GetSilosLsjy();
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {

if(isAdded())
{
Recy_Lsjy.setLayoutManager(new WrapContentLinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL,false));
DataBus.getInstance().lsjyAdapter = new lsjy_adapter(getContext());
Recy_Lsjy.setAdapter(DataBus.getInstance().lsjyAdapter);
}
}
});
DataBus.getInstance().GetSilosLsjyValue();
} catch (Exception e) {

}
}
}).start();

new Thread(new Runnable() {
@Override
public void run() {
try {
//底部按钮信息
Object obj= ExecuteTheRecipe.ReadPLC("基准时间");
String time = obj==null?"0":obj.toString();
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
//校准时间
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();

} catch (Exception e) {

}
}

private Handler mHandler = new Handler() {
public void handleMessage(Message msg) {
switch (msg.what) {
case 0:
zhongliang.setText(String.valueOf((int)ExecuteTheRecipe.OutletWeigh / 10.0) + " g");
break;
case 1:

break;
case 2:

break;
}

}
};

/**
* 实时显示线程
*/
public void Run() {
ExecuteTheRecipe.WeighComplete=new IRun() {
@Override
public void Run() {
mHandler.sendEmptyMessage(0);
}
};

ExecuteTheRecipe.OnChargeMixtureComNotPar = new IRun() {
@Override
public void Run() {
if (selectIndexSilos > 0) {
final int kkk = selectIndexSilos;
try {

getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
try {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
ToastUtils.warning("通道校准完成!");

// 在2秒后执行按钮操作
int zhongliangxianshi=ExecuteTheRecipe.OutletWeigh;
ExecuteTheRecipe.WritePLC("校准值"+kkk,(short) zhongliangxianshi,null);

String s = String.valueOf(zhongliangxianshi);
for (SilosLsjyMode item:DataBus.getInstance().SilosLsjy)
{
if(kkk==item.num)
{
item.Value=String.format("%.1f", (Double.parseDouble(s) / 10));
ToastUtils.warning("重量!" +item.Value);
}
}
if (DataBus.getInstance().lsjyAdapter!=null)
{
DataBus.getInstance().lsjyAdapter.refresh();
}
}
}, 2000);

} catch (Exception e) {
ToastUtils.error("重量解析显示异常!" + e.getMessage());
}
}
});


} catch (Exception ex) {
Log.d("dsds", "Run: " + ex.getMessage());
}
selectIndexSilos = -99;
}
}
};
}
//endregion

@Override
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();
}

/**
* 当在activity设置viewPager + BottomNavigation + fragment时,
* 为防止viewPager左滑动切换界面,与fragment左滑返回上一界面冲突引起闪退问题,
* 必须加上此方法,禁止fragment左滑返回上一界面。
* <p>
* 切记!切记!切记!否则会闪退!
* <p>
* 当在fragment设置viewPager + BottomNavigation + fragment时,则不会出现这个问题。
*/
@Override
protected boolean canDragBack() {
return false;
}
}

+ 107
- 47
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/Silos_item_jiaoyan_fragment.java Ver arquivo

@@ -27,11 +27,11 @@ import com.bonait.bnframework.common.db.res.lcMode;
import com.bonait.bnframework.common.helper.I.IRun;
import com.bonait.bnframework.common.helper.I.IWriteCallBack;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.modules.home.adapter.lsjy_adapter;
import com.bonait.bnframework.modules.home.fragment.from.LogActivity;
import com.bonait.bnframework.modules.home.fragment.from.PlcControlActivity;
import com.bonait.bnframework.modules.home.fragment.from.RealTimeActivity;
import com.orhanobut.logger.Logger;
import com.suke.widget.SwitchButton;

import java.util.List;

@@ -80,21 +80,35 @@ public class Silos_item_jiaoyan_fragment extends BaseFragment {
final int[] zl = {0};
//endregion


//region 物料校准变量
@BindView(R.id.wljz1)
EditText edit_wljz1;
EditText wljz1;

@BindView(R.id.wljz2)
EditText edit_wljz2;
EditText wljz2;

@BindView(R.id.wljz3)
EditText edit_wljz3;
EditText wljz3;

@BindView(R.id.text_wljz)
TextView text_wljz2;
//endregion

//region 通道补偿
@BindView(R.id.control_switch)
SwitchButton control_switch;

@BindView(R.id.bcjz_gxs)
EditText bcjz_gxs;

@BindView(R.id.bcjz_dxs)
EditText bcjz_dxs;

@BindView(R.id.bcjz_clsj)
EditText bcjz_clsj;
//endregion


//region 变量
private Context context;
/**
@@ -222,15 +236,15 @@ public class Silos_item_jiaoyan_fragment extends BaseFragment {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
ToastUtils.warning("通道校准完成!");
// 在2秒后执行按钮操作
int zhongliangxianshi = ExecuteTheRecipe.OutletWeigh;
ExecuteTheRecipe.WritePLC("校准值" + kkk, (short) zhongliangxianshi, null);
String s = String.valueOf(zhongliangxianshi);
String zll=String.format("%.1f", (Double.parseDouble(s) / 10));
edit_wljz3.setText(zll+"");
lcMode.jValue=zhongliangxianshi;
QueryDB.UpdateJYZ(lcMode.id,zhongliangxianshi);
wljz3.setText(zll+"");
lcMode.jValue=zll;
QueryDB.UpdateJYZ(lcMode.id,zll);
ToastUtils.warning("通道校准完成!");
}
}, 2000);
} catch (Exception e) {
@@ -244,36 +258,23 @@ public class Silos_item_jiaoyan_fragment extends BaseFragment {
}
};

new Thread(new Runnable() {
@Override
public void run() {
try {
//底部按钮信息
Object obj = ExecuteTheRecipe.ReadPLC("基准时间");
Object jzz = ExecuteTheRecipe.ReadPLC("校准值" + lcMode.num);
String time = obj == null ? "0" : obj.toString();
short val = jzz == null ? 0 : (short) jzz;
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
//校准时间
edit_wljz1.setText(String.format("%.1f", (Double.parseDouble(time) / 10)));
edit_wljz3.setText(String.format("%.1f", (Double.parseDouble(String.valueOf(val)) / 10)));
if (!ConfigName.getInstance().versionSelectionEnum.equals("奶茶机")) {
Object obj1 = ExecuteTheRecipe.ReadPLC("反转时间");
String fztime = obj1 == null ? "0" : obj1.toString();
edit_wljz2.setText(String.format("%.1f", (Double.parseDouble(fztime) / 10)));
} else {
edit_wljz2.setVisibility(View.GONE);
text_wljz2.setVisibility(View.GONE);
}
}
});
ExecuteTheRecipe.WritePLC("通道" + lcMode.num + "校准开关", true, null);
} catch (Exception e) {
}
}
}).start();

//填充校准时间
String time = lcMode.jTime == null ? "0.0" : lcMode.jTime;
String ftime = lcMode.fTime == null ? "0.0" : lcMode.fTime;
String jvalue = lcMode.jValue == null ? "0.0" : lcMode.jValue;
wljz1.setText(time);
wljz1.setText(ftime);
wljz3.setText(jvalue);

String Gxs = lcMode.Gxs == null ? "0.0" : lcMode.Gxs;
String Lxs = lcMode.Lxs == null ? "0.0" : lcMode.Lxs;
String tdclsj = lcMode.tdclsj == null ? "0.0" : lcMode.tdclsj;

control_switch.setChecked(lcMode.isOpenbcsf==1);
bcjz_gxs.setText(Gxs);
bcjz_gxs.setText(Lxs);
bcjz_gxs.setText(tdclsj);
}
//endregion

@@ -308,7 +309,8 @@ public class Silos_item_jiaoyan_fragment extends BaseFragment {
R.id.qingling1, R.id.qingling2, R.id.qingling3,
R.id.chuliao1, R.id.chuliao2, R.id.chuliao3,
R.id.click_mgjz, R.id.click_mgjz_save,
R.id.click_wljz, R.id.click_wljz_save
R.id.click_wljz, R.id.click_wljz_save,
R.id.control_switch,R.id.click_bcjz_save,
})
public void onViewClicked(View view) {
switch (view.getId()) {
@@ -344,6 +346,22 @@ public class Silos_item_jiaoyan_fragment extends BaseFragment {
case R.id.click_wljz_save://物料校准 保存参数
SaveWLJZ();
break;

case R.id.control_switch://通道开关
boolean isopen= control_switch.isChecked();
if (ConfigName.getInstance().PlcIsConnect)
{
ExecuteTheRecipe.WritePLC("通道"+lcMode.num+"补偿开关",isopen,null);
QueryDB.UpdateSilosisOpenbcsf(lcMode.id,isopen);
ToastUtils.info(lcMode.name.toString()+(isopen?"打开":"关闭")+"成功!");
}else
{
ToastUtils.warning(lcMode.name.toString()+(isopen?"打开":"关闭")+"失败!PLC未连接!!");
}
break;
case R.id.click_bcjz_save://补偿校准 保存参数
SaveBCJZ();
break;
}
}
//endregion
@@ -431,8 +449,8 @@ public class Silos_item_jiaoyan_fragment extends BaseFragment {

//region 保存物料校准参数
public void SaveWLJZ() {
String stime = edit_wljz1.getText().toString();
String ftime = edit_wljz2.getText().toString();
String stime = wljz1.getText().toString();
String ftime = wljz2.getText().toString();
if (stime.equals("")) {
ToastUtils.info("校准基准时间不能为空!");
return;
@@ -470,7 +488,7 @@ public class Silos_item_jiaoyan_fragment extends BaseFragment {
}
});
}
QueryDB.UpdateSilosJZTime(lcMode.id,ftime);
QueryDB.UpdateSilosJZTime(lcMode.id,stime,ftime);
ExecuteTheRecipe.WritePLC("基准时间", (short) stime_1, new IWriteCallBack() {
@Override
public void onSuccess() {
@@ -520,10 +538,56 @@ public class Silos_item_jiaoyan_fragment extends BaseFragment {
}
});
} catch (Exception e) {
}
}
}).start();
}
//endregion

//region 补偿校准
public void SaveBCJZ() {
Short H=0;
Short L=0;
Short time=0;
try {
H=Short.parseShort(bcjz_gxs.getText().toString()) ;
L=Short.parseShort(bcjz_dxs.getText().toString()) ;
int ftime = (int)Math.round((Double.parseDouble(bcjz_clsj.getText().toString()) * 10));
time=(short) ftime;
}
catch (Exception ex)
{
ToastUtils.error( "数据不合法,保存变量失败!"+ex.getMessage());
return;
}
Short finalH = H;
Short finalL = L;
Short finalTime = time;

new Thread(new Runnable() {
@Override
public void run() {
try {
ExecuteTheRecipe.WritePLC("高系数"+lcMode.num, finalH,null);
ExecuteTheRecipe.WritePLC("低系数"+lcMode.num, finalL,null);
ExecuteTheRecipe.WritePLC("补偿" + lcMode.num + "时间", finalTime, new IWriteCallBack() {
@Override
public void onSuccess() {
ToastUtils.info("保存变量成功!");
QueryDB.UpdateSilosisOpenbcsf(lcMode.id,bcjz_gxs.getText().toString(),
bcjz_dxs.getText().toString(),bcjz_clsj.getText().toString());
}
@Override
public void onFailure(String ErrorMsg) {
ToastUtils.warning("保存变量失败!");
}
});
} catch (Exception e) {

}
}
}).start();

}
//endregion

@@ -533,7 +597,6 @@ public class Silos_item_jiaoyan_fragment extends BaseFragment {
}
//endregion


//region 定时器

/**
@@ -561,12 +624,9 @@ public class Silos_item_jiaoyan_fragment extends BaseFragment {
* 停止定时器
*/
public int StopTime() {

long elapsedMillis = SystemClock.elapsedRealtime() - runtime.getBase();
runtime.stop();

int time = (int) (elapsedMillis / 1000);
exit_mgjz.setText(time + "");
new Thread(new Runnable() {
@Override
public void run() {


+ 0
- 1
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_manguan_control.java Ver arquivo

@@ -31,7 +31,6 @@ import com.bonait.bnframework.common.db.mode.BPA_SUBORDER;
import com.bonait.bnframework.common.db.res.ResGoodProperty;
import com.bonait.bnframework.common.helper.I.MyClickListener;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.modules.home.adapter.lsjy_adapter;
import com.bonait.bnframework.modules.home.adapter.pfsx_adapter;

import java.util.ArrayList;


+ 0
- 1
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_silos_ck.java Ver arquivo

@@ -39,7 +39,6 @@ import com.bonait.bnframework.common.helper.I.IWriteCallBack;
import com.bonait.bnframework.common.helper.I.MyClickListener;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.modules.home.adapter.goodpf_apapter;
import com.bonait.bnframework.modules.home.adapter.lsjy_adapter;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
import com.suke.widget.SwitchButton;



+ 6
- 7
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/silos_jiaoyan.java Ver arquivo

@@ -30,7 +30,6 @@ import com.bonait.bnframework.common.helper.I.IWriteCallBack;
import com.bonait.bnframework.common.helper.I.MyClickListener;
import com.bonait.bnframework.common.model.mode.ResMenuLeft;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.modules.home.fragment.from.fragment.JiaoYan_lsjy_fragment;
import com.qmuiteam.qmui.arch.QMUIFragment;
import com.qmuiteam.qmui.arch.QMUIFragmentPagerAdapter;
import com.qmuiteam.qmui.widget.QMUIViewPager;
@@ -97,14 +96,14 @@ public class silos_jiaoyan extends LinearLayout {
froms.clear();
if(lcMode.name.equals("外置仓"))
{
froms.add(new ResMenuLeft(new JiaoYan_lsjy_fragment(),"物料校准",0,0,true));
froms.add(new ResMenuLeft(new JiaoYan_lsjy_fragment(),"满管校准",0,0,false));
froms.add(new ResMenuLeft(new JiaoYan_lsjy_fragment(),"酱料校准",0,0,false));
froms.add(new ResMenuLeft(new JiaoYan_lsjy_fragment(),"补偿校准",0,0,false));
froms.add(new ResMenuLeft(null,"物料校准",0,0,true));
froms.add(new ResMenuLeft(null,"满管校准",0,0,false));
froms.add(new ResMenuLeft(null,"酱料校准",0,0,false));
froms.add(new ResMenuLeft(null,"补偿校准",0,0,false));
}else
{
froms.add(new ResMenuLeft(new JiaoYan_lsjy_fragment(),"物料校准",0,0,true));
froms.add(new ResMenuLeft(new JiaoYan_lsjy_fragment(),"满管校准",0,0,false));
froms.add(new ResMenuLeft(null,"物料校准",0,0,true));
froms.add(new ResMenuLeft(null,"满管校准",0,0,false));
}

QMUIFragmentPagerAdapter adapter = new QMUIFragmentPagerAdapter(fragmentManager) {


app/src/main/res/layout/fragment_jiaoyan_zdqx.xml → app/src/main/res/layout/activity_zdqx.xml Ver arquivo


+ 0
- 28
app/src/main/res/layout/fragment_jiaoyan_clsfbc.xml Ver arquivo

@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".modules.home.fragment.from.fragment.JiaoYan_clsfbc_fragment">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/main_background"
android:orientation="vertical">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_clsfbc"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</ScrollView>

</RelativeLayout>
</RelativeLayout>
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>

+ 0
- 432
app/src/main/res/layout/fragment_jiaoyan_lsjy.xml Ver arquivo

@@ -1,432 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".modules.home.fragment.from.fragment.JiaoYan_lsjy_fragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/main_background"
android:orientation="vertical">

<!-- 顶部通道 -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.1">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/Recy_Lsjy"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="0dp">
</androidx.recyclerview.widget.RecyclerView>
</RelativeLayout>

<!--边框分割细线-->
<LinearLayout
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/color3" />

<!-- 底部流程 -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">

<LinearLayout
android:layout_centerHorizontal="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="重量:"
android:textSize="20dp"/>
<TextView
android:layout_marginLeft="10dp"
android:id="@+id/zhongliang"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0g"
android:textColor="@color/colorAccent"
android:textStyle="bold"
android:textSize="30dp"></TextView>
</LinearLayout>

<LinearLayout
android:layout_marginTop="40dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_marginLeft="@dimen/dp_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="校准:"
android:textSize="16dp"/>
<LinearLayout
android:layout_marginLeft="@dimen/dp_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="①"
android:textAlignment="center" />
<LinearLayout
android:layout_marginTop="@dimen/dp_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="校准时间(s):"
android:textAlignment="center" />
<EditText
android:id="@+id/edittext_jzsj"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:background="@drawable/input_bj"
android:hint="请输入"
android:inputType="number|numberDecimal"
android:digits="0123456789."
android:maxLines="1"
android:padding="3dp"
android:textSize="12dp"
android:text="0.0"/>
<Button
android:id="@+id/save_jzsj"
android:layout_marginLeft="@dimen/dp_10"
android:layout_width="50dp"
android:layout_height="26dp"
android:layout_centerInParent="true"
android:background="@drawable/bg_btn_login_selected"
android:text="保存"
android:textColor="@color/white"
android:textSize="14dp" />
</LinearLayout>

<LinearLayout
android:id="@+id/linelayout_fanzhuantime"
android:layout_marginTop="@dimen/dp_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="反转时间(s):"
android:textAlignment="center" />
<EditText
android:id="@+id/edittext_fzsj"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:background="@drawable/input_bj"
android:hint="请输入"
android:inputType="number|numberDecimal"
android:digits="0123456789."
android:maxLines="1"
android:padding="3dp"
android:textSize="12dp"
android:text="0.0"/>
<Button
android:id="@+id/save_fzsj"
android:layout_marginLeft="@dimen/dp_10"
android:layout_width="50dp"
android:layout_height="26dp"
android:layout_centerInParent="true"
android:background="@drawable/bg_btn_login_selected"
android:text="保存"
android:textColor="@color/white"
android:textSize="14dp" />
</LinearLayout>
</LinearLayout>

<ImageView
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="30dp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@mipmap/jt_y"/>

<LinearLayout
android:layout_marginLeft="@dimen/dp_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="②"
android:textAlignment="center" />
<Button
android:layout_marginTop="@dimen/dp_10"
android:id="@+id/czql"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:background="@drawable/bg_btn_login_selected"
android:text="称重清零"
android:textColor="@color/white"
android:textSize="14dp" />

</LinearLayout>

<ImageView
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="30dp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@mipmap/jt_y"/>

<LinearLayout
android:layout_marginLeft="@dimen/dp_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="③"
android:textAlignment="center" />
<TextView
android:layout_marginTop="30dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="打开校准开关"
android:textAlignment="center" />
</LinearLayout>

<ImageView
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="30dp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@mipmap/jt_y"/>

<LinearLayout
android:layout_marginLeft="@dimen/dp_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="④"
android:textAlignment="center" />
<Button
android:layout_marginTop="@dimen/dp_10"
android:id="@+id/ksjz"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:background="@drawable/bg_btn_login_selected"
android:text="开始校准"
android:textColor="@color/white"
android:textSize="14dp" />
</LinearLayout>

<!-- <ImageView-->
<!-- android:layout_marginLeft="20dp"-->
<!-- android:layout_marginRight="20dp"-->
<!-- android:layout_marginTop="30dp"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="match_parent"-->
<!-- android:src="@mipmap/jt_y"/>-->

<!-- <LinearLayout-->
<!-- android:layout_marginLeft="@dimen/dp_10"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="vertical">-->
<!-- <TextView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="⑤"-->
<!-- android:textAlignment="center" />-->
<!-- <TextView-->
<!-- android:layout_marginTop="30dp"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:text="写入通道重量"-->
<!-- android:textAlignment="center" />-->
<!-- </LinearLayout>-->

<!-- <ImageView-->
<!-- android:layout_marginLeft="20dp"-->
<!-- android:layout_marginRight="20dp"-->
<!-- android:layout_marginTop="30dp"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="match_parent"-->
<!-- android:src="@mipmap/jt_y"/>-->

<!-- <LinearLayout-->
<!-- android:layout_marginLeft="@dimen/dp_10"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="vertical">-->
<!-- <TextView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="⑥"-->
<!-- android:textAlignment="center" />-->
<!-- <Button-->
<!-- android:layout_marginTop="@dimen/dp_10"-->
<!-- android:id="@+id/save_jzz"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_centerInParent="true"-->
<!-- android:background="@drawable/bg_btn_login_selected"-->
<!-- android:text="保存校准值"-->
<!-- android:textColor="@color/white"-->
<!-- android:textSize="14dp" />-->
<!-- </LinearLayout>-->
</LinearLayout>

<LinearLayout
android:layout_marginTop="140dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_marginLeft="@dimen/dp_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="出料:"
android:textSize="16dp"/>

<LinearLayout
android:layout_marginLeft="@dimen/dp_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="①"
android:textAlignment="center" />
<TextView
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="打开校准开关\n(只允许一个通道模拟出料\n请关闭其他通道)"
android:textAlignment="center" />
</LinearLayout>

<ImageView
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="30dp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@mipmap/jt_y"/>

<LinearLayout
android:layout_marginLeft="@dimen/dp_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="②"
android:textAlignment="center" />
<Button
android:layout_marginTop="@dimen/dp_10"
android:id="@+id/save_czql"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:background="@drawable/bg_btn_login_selected"
android:text="称重清零"
android:textColor="@color/white"
android:textSize="14dp" />
</LinearLayout>

<ImageView
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="30dp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@mipmap/jt_y"/>

<LinearLayout
android:layout_marginLeft="@dimen/dp_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="③"
android:textAlignment="center" />
<LinearLayout
android:layout_marginTop="25dp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="出料重量(g):"
android:textAlignment="center" />
<EditText
android:id="@+id/edittext_cl"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:background="@drawable/input_bj"
android:hint="请输入"
android:inputType="number|numberDecimal"
android:digits="0123456789."
android:maxLines="1"
android:padding="3dp"
android:textSize="12dp"
android:text="0.0"/>
</LinearLayout>
</LinearLayout>

<ImageView
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="30dp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@mipmap/jt_y"/>

<LinearLayout
android:layout_marginLeft="@dimen/dp_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="④"
android:textAlignment="center" />
<Button
android:layout_marginTop="@dimen/dp_10"
android:id="@+id/kscl"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:background="@drawable/bg_btn_login_selected"
android:text="出料"
android:textColor="@color/white"
android:textSize="14dp" />
</LinearLayout>
</LinearLayout>

</RelativeLayout>
</LinearLayout>
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>

+ 12
- 10
app/src/main/res/layout/item/layout/fragment_silos_item_jiaoyan.xml Ver arquivo

@@ -10,6 +10,7 @@
android:layout_height="match_parent">
<!-- 物料校准 -->
<LinearLayout
android:visibility="gone"
android:id="@+id/wuliaojiaozhun"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -555,7 +556,6 @@

<!-- 补偿校准 -->
<LinearLayout
android:visibility="gone"
android:id="@+id/buchangjiaozhun"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -601,16 +601,16 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<com.suke.widget.SwitchButton
android:layout_centerInParent="true"
app:sb_uncheck_color="@color/app_color_blue"
app:sb_uncheckcircle_color="@color/app_color_blue"
app:sb_button_color="@color/app_color_blue"
android:id="@+id/control_switch"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:focusable="true"
/>
app:sb_button_color="@color/app_color_blue"
app:sb_uncheck_color="@color/app_color_blue"
app:sb_uncheckcircle_color="@color/app_color_blue" />
</RelativeLayout>

<TextView
@@ -621,6 +621,7 @@
android:textSize="16dp"
/>
<EditText
android:id="@+id/bcjz_gxs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
@@ -634,15 +635,14 @@
android:textSize="12dp"
android:layout_marginBottom="10dp"
/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="低范围系数"
android:textAlignment="center"
android:textSize="16dp"
/>
android:textSize="16dp"/>
<EditText
android:id="@+id/bcjz_dxs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
@@ -664,19 +664,21 @@
android:textSize="16dp"
/>
<EditText
android:id="@+id/bcjz_clsj"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/input_bj"
android:digits="0123456789."
android:hint="请输入"
android:inputType="text"
android:inputType="numberDecimal"
android:maxLines="1"
android:padding="3dp"
android:text="0"
android:textSize="12dp"
/>
<Button
android:id="@+id/click_bcjz_save"
android:layout_marginTop="@dimen/dp_10"
android:layout_width="match_parent"
android:layout_height="40dp"


Carregando…
Cancelar
Salvar