Browse Source

现场改动99

tags/old_version_1
fyf 1 year ago
parent
commit
788cfa1b2a
8 changed files with 173 additions and 134 deletions
  1. +27
    -47
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  2. +91
    -79
      app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
  3. +1
    -1
      app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_PLCADDRESS.java
  4. +44
    -6
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/fragment_plc_control.java
  5. +10
    -1
      app/src/main/res/layout/item/layout/fragment_item_plc_control.xml
  6. BIN
     
  7. BIN
     
  8. BIN
     

+ 27
- 47
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java View File

@@ -233,7 +233,7 @@ public class ExecuteTheRecipe {
WritePLC("料仓" + num + "需求值", val, new IWriteCallBack() {
@Override
public void onSuccess() {
WritePLC("料仓" + num + "下料", true, null);
BottomClick("料仓" + num + "下料");
}

@Override
@@ -323,7 +323,7 @@ public class ExecuteTheRecipe {
WritePLC(key, writeValue, null);
} else {
//原点位,等待机器移动倒响应位置
WritePLC(value, true, null);
BottomClick(value);

//一直等待机器移动到该位置,否则就一直等待 6s超时
String name = value + "反馈";
@@ -340,9 +340,7 @@ public class ExecuteTheRecipe {
}
Thread.sleep(100);//10 *6
}
WritePLC(value, false, null);
ToastUtils.info("炒锅到达"+value+",继续制作!!!");

}
}
} catch (Exception ex) {
@@ -442,8 +440,7 @@ public class ExecuteTheRecipe {
}

//1.去某一个位置
WritePLC("平移-去"+writeValue,true,null);

BottomClick("平移-去"+writeValue);
//一直等待机器移动到该位置,否则就一直等待 6s超时
String name = "平移轴在"+writeValue;
final boolean[] IsComplete = {false};
@@ -461,7 +458,7 @@ public class ExecuteTheRecipe {
}

//2.给倒菜启动
WritePLC("主料", true, null);
BottomClick("主料");
name = "倒菜完成";
IsComplete[0]=false;
a = System.currentTimeMillis();
@@ -478,7 +475,7 @@ public class ExecuteTheRecipe {
}
//
ToastUtils.info("主料倒入完成,继续制作!");
WritePLC("平移-去1号位",true,null);
BottomClick("平移-去1号位");
}
}
} catch (Exception ex) {
@@ -486,6 +483,27 @@ public class ExecuteTheRecipe {
}
}

/**
* 按下
* @param name
*/
public static void BottomClick(String name)
{
try
{
WritePLC(name,true,null);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
ExecuteTheRecipe.WritePLC(name, false, null);
}
}, 500);
}catch (Exception ex)
{

}
}

private static Activity findActivity(@NonNull Context context) {
if (context instanceof Activity) {
return (Activity) context;
@@ -570,7 +588,7 @@ public class ExecuteTheRecipe {
Thread.sleep(val * 1000);
}
}
WritePLC("出菜", true, null);
BottomClick("出菜");
WritePLC("搅拌", false, null);
WritePLC("加热", false, null);
//一直等待机器移动到该位置,否则就一直等待 6s超时
@@ -596,44 +614,6 @@ public class ExecuteTheRecipe {
//endregion

//region 主页按钮

/**
* 点击清洗按钮
*
* @param data
*/
public static void Write_PLC_Clean(MyStatus data) {
try {
if (data == MyStatus.Start) {
ToastUtils.info("炒锅开始清洗!");
WritePLC("炒锅清洗", true, null);

} else if (data == MyStatus.Stop) {
ToastUtils.info("炒锅停止清洗!");
WritePLC("炒锅清洗", false, null);
}
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
}
}

/**
* 点击移动位置按钮
*
* @param data
*/
public static void Write_PLC_Location(String data) {
try {
ToastUtils.info("点击按钮:" + data);
//原点位,等待机器移动倒响应位置
WritePLC(data, true, null);
Thread.sleep(500);//10 *6
WritePLC(data, false, null);
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
}
}

/**
* 点击摇欠按钮
*


+ 91
- 79
app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java View File

@@ -418,14 +418,15 @@ public class ConfigName {
add(new Res_PLCADDRESS("料仓2校准值", "VW116", 1, 1));
add(new Res_PLCADDRESS("料仓3校准值", "VW118", 1, 1));
add(new Res_PLCADDRESS("开始校正", "M12.6", 0, 1));
add(new Res_PLCADDRESS("料仓1下料手动", "M12.3", 0, 1));
add(new Res_PLCADDRESS("料仓2下料手动", "M12.4", 0, 1));
add(new Res_PLCADDRESS("料仓3下料手动", "M12.5", 0, 1));
add(new Res_PLCADDRESS("料仓1开关", "M12.3", 0, 1));
add(new Res_PLCADDRESS("料仓2开关", "M12.4", 0, 1));
add(new Res_PLCADDRESS("料仓3开关", "M12.5", 0, 1));

add(new Res_PLCADDRESS("料仓1需求值", "VW106", 1, 1));
add(new Res_PLCADDRESS("料仓2需求值", "VW108", 1, 1));
add(new Res_PLCADDRESS("料仓3需求值", "VW110", 1, 1));
add(new Res_PLCADDRESS("料仓1下料", "M11.1", 0, 1));
add(new Res_PLCADDRESS("料仓2需求值", "VW108", 1, 1));
add(new Res_PLCADDRESS("料仓2下料", "M11.2", 0, 1));
add(new Res_PLCADDRESS("料仓3需求值", "VW110", 1, 1));
add(new Res_PLCADDRESS("料仓3下料", "M11.3", 0, 1));

//上下限
@@ -448,7 +449,12 @@ public class ConfigName {
add(new Res_PLCADDRESS("炒锅工作范围上限", "VD210", 1, 1));

//自动投料-平移轴
add(new Res_PLCADDRESS("转轴控制", "-------------", 0, 0));
add(new Res_PLCADDRESS("平移轴控制", "-------------", 0, 0));
add(new Res_PLCADDRESS("平移-伺服当前值", "VD220", 1, 1));
add(new Res_PLCADDRESS("平移-点动速度", "VD224", 1, 1));
add(new Res_PLCADDRESS("平移-回原点速度", "VD228", 1, 1));
add(new Res_PLCADDRESS("平移-定位运行速度", "VD232", 1, 1));

add(new Res_PLCADDRESS("平移-点动正转", "M14.0", 0, 1));
add(new Res_PLCADDRESS("平移-点动反转", "M14.1", 0, 1));
add(new Res_PLCADDRESS("平移-回原点", "M14.2", 0, 1));
@@ -456,11 +462,25 @@ public class ConfigName {
add(new Res_PLCADDRESS("平移-去2号位", "M14.4", 0, 1));
add(new Res_PLCADDRESS("平移-去3号位", "M14.5", 0, 1));
add(new Res_PLCADDRESS("平移-去4号位", "M14.6", 0, 1));

add(new Res_PLCADDRESS("平移-1号位置值", "VD236", 1, 1));
add(new Res_PLCADDRESS("平移-1#位置设定", "M15.0", 0, 1));
add(new Res_PLCADDRESS("平移-2号位置值", "VD240", 1, 1));
add(new Res_PLCADDRESS("平移-2#位置设定", "M15.1", 0, 1));
add(new Res_PLCADDRESS("平移-3号位置值", "VD244", 1, 1));
add(new Res_PLCADDRESS("平移-3#位置设定", "M15.2", 0, 1));
add(new Res_PLCADDRESS("平移-4号位置值", "VD248", 1, 1));
add(new Res_PLCADDRESS("平移-4#位置设定", "M15.3", 0, 1));



//自动投料-翻转轴
add(new Res_PLCADDRESS("翻转轴控制", "-------------", 0, 0));
add(new Res_PLCADDRESS("翻转-伺服当前值", "VD260", 1, 1));
add(new Res_PLCADDRESS("翻转-点动速度", "VD264", 1, 1));
add(new Res_PLCADDRESS("翻转-回原点速度", "VD268", 1, 1));
add(new Res_PLCADDRESS("翻转-定位运行速度", "VD272", 1, 1));

add(new Res_PLCADDRESS("翻转-点动正转", "M16.0", 0, 1));
add(new Res_PLCADDRESS("翻转-点动反转", "M16.1", 0, 1));
add(new Res_PLCADDRESS("翻转-回原点", "M16.2", 0, 1));
@@ -468,33 +488,18 @@ public class ConfigName {
add(new Res_PLCADDRESS("翻转-去2号位", "M16.4", 0, 1));
add(new Res_PLCADDRESS("翻转-去3号位", "M16.5", 0, 1));
add(new Res_PLCADDRESS("翻转-去4号位", "M16.6", 0, 1));

add(new Res_PLCADDRESS("翻转-1号位置值", "VD276", 1, 1));
add(new Res_PLCADDRESS("翻转-1#位置设定", "M17.0", 0, 1));
add(new Res_PLCADDRESS("翻转-2号位置值", "VD280", 1, 1));
add(new Res_PLCADDRESS("翻转-2#位置设定", "M17.1", 0, 1));
add(new Res_PLCADDRESS("翻转-3号位置值", "VD284", 1, 1));
add(new Res_PLCADDRESS("翻转-3#位置设定", "M17.2", 0, 1));
add(new Res_PLCADDRESS("翻转-4号位置值", "VD288", 1, 1));
add(new Res_PLCADDRESS("翻转-4#位置设定", "M17.3", 0, 1));
add(new Res_PLCADDRESS("倒菜启动", "M17.4", 0, 1));
add(new Res_PLCADDRESS("磁铁吸合", "M17.5", 0, 1));

//自动投料-翻转轴
add(new Res_PLCADDRESS("转轴监控", "-------------", 0, 0));
add(new Res_PLCADDRESS("平移-伺服当前值", "VD220", 1, 1));
add(new Res_PLCADDRESS("平移-点动速度", "VD224", 1, 1));
add(new Res_PLCADDRESS("平移-回原点速度", "VD228", 1, 1));
add(new Res_PLCADDRESS("平移-定位运行速度", "VD232", 1, 1));
add(new Res_PLCADDRESS("平移-1号位置值", "VD236", 1, 1));
add(new Res_PLCADDRESS("平移-2号位置值", "VD240", 1, 1));
add(new Res_PLCADDRESS("平移-3号位置值", "VD244", 1, 1));
add(new Res_PLCADDRESS("平移-4号位置值", "VD248", 1, 1));

add(new Res_PLCADDRESS("翻转-伺服当前值", "VD260", 1, 1));
add(new Res_PLCADDRESS("翻转-点动速度", "VD264", 1, 1));
add(new Res_PLCADDRESS("翻转-回原点速度", "VD268", 1, 1));
add(new Res_PLCADDRESS("翻转-定位运行速度", "VD272", 1, 1));
add(new Res_PLCADDRESS("翻转-1号位置值", "VD276", 1, 1));
add(new Res_PLCADDRESS("翻转-2号位置值", "VD280", 1, 1));
add(new Res_PLCADDRESS("翻转-3号位置值", "VD284", 1, 1));
add(new Res_PLCADDRESS("翻转-4号位置值", "VD288", 1, 1));

//反馈信号
add(new Res_PLCADDRESS("反馈信号", "-------------", 0, 0));
add(new Res_PLCADDRESS("初始化完成", "M40.0", 1, 0));
@@ -617,14 +622,15 @@ public class ConfigName {
add(new Res_PLCADDRESS("料仓2校准值", "VW116", 1, 1));
add(new Res_PLCADDRESS("料仓3校准值", "VW118", 1, 1));
add(new Res_PLCADDRESS("开始校正", "M12.6", 0, 1));
add(new Res_PLCADDRESS("料仓1下料手动", "M12.3", 0, 1));
add(new Res_PLCADDRESS("料仓2下料手动", "M12.4", 0, 1));
add(new Res_PLCADDRESS("料仓3下料手动", "M12.5", 0, 1));
add(new Res_PLCADDRESS("料仓1开关", "M12.3", 0, 1));
add(new Res_PLCADDRESS("料仓2开关", "M12.4", 0, 1));
add(new Res_PLCADDRESS("料仓3开关", "M12.5", 0, 1));

add(new Res_PLCADDRESS("料仓1需求值", "VW106", 1, 1));
add(new Res_PLCADDRESS("料仓2需求值", "VW108", 1, 1));
add(new Res_PLCADDRESS("料仓3需求值", "VW110", 1, 1));
add(new Res_PLCADDRESS("料仓1下料", "M11.1", 0, 1));
add(new Res_PLCADDRESS("料仓2需求值", "VW108", 1, 1));
add(new Res_PLCADDRESS("料仓2下料", "M11.2", 0, 1));
add(new Res_PLCADDRESS("料仓3需求值", "VW110", 1, 1));
add(new Res_PLCADDRESS("料仓3下料", "M11.3", 0, 1));

//上下限
@@ -646,54 +652,6 @@ public class ConfigName {
add(new Res_PLCADDRESS("炒锅工作范围下限", "VD206", 1, 1));
add(new Res_PLCADDRESS("炒锅工作范围上限", "VD210", 1, 1));

//自动投料-平移轴
add(new Res_PLCADDRESS("转轴控制", "-------------", 0, 0));
add(new Res_PLCADDRESS("平移-点动正转", "M14.0", 0, 1));
add(new Res_PLCADDRESS("平移-点动反转", "M14.1", 0, 1));
add(new Res_PLCADDRESS("平移-回原点", "M14.2", 0, 1));
add(new Res_PLCADDRESS("平移-去1号位", "M14.3", 0, 1));
add(new Res_PLCADDRESS("平移-去2号位", "M14.4", 0, 1));
add(new Res_PLCADDRESS("平移-去3号位", "M14.5", 0, 1));
add(new Res_PLCADDRESS("平移-去4号位", "M14.6", 0, 1));
add(new Res_PLCADDRESS("平移-1#位置设定", "M15.0", 0, 1));
add(new Res_PLCADDRESS("平移-2#位置设定", "M15.1", 0, 1));
add(new Res_PLCADDRESS("平移-3#位置设定", "M15.2", 0, 1));
add(new Res_PLCADDRESS("平移-4#位置设定", "M15.3", 0, 1));

add(new Res_PLCADDRESS("翻转-点动正转", "M16.0", 0, 1));
add(new Res_PLCADDRESS("翻转-点动反转", "M16.1", 0, 1));
add(new Res_PLCADDRESS("翻转-回原点", "M16.2", 0, 1));
add(new Res_PLCADDRESS("翻转-去1号位", "M16.3", 0, 1));
add(new Res_PLCADDRESS("翻转-去2号位", "M16.4", 0, 1));
add(new Res_PLCADDRESS("翻转-去3号位", "M16.5", 0, 1));
add(new Res_PLCADDRESS("翻转-去4号位", "M16.6", 0, 1));
add(new Res_PLCADDRESS("翻转-1#位置设定", "M17.0", 0, 1));
add(new Res_PLCADDRESS("翻转-2#位置设定", "M17.1", 0, 1));
add(new Res_PLCADDRESS("翻转-3#位置设定", "M17.2", 0, 1));
add(new Res_PLCADDRESS("翻转-4#位置设定", "M17.3", 0, 1));
add(new Res_PLCADDRESS("倒菜启动", "M17.4", 0, 1));
add(new Res_PLCADDRESS("磁铁吸合", "M17.5", 0, 1));

//自动投料-翻转轴
add(new Res_PLCADDRESS("转轴监控", "-------------", 0, 0));
add(new Res_PLCADDRESS("平移-伺服当前值", "VD220", 1, 1));
add(new Res_PLCADDRESS("平移-点动速度", "VD224", 1, 1));
add(new Res_PLCADDRESS("平移-回原点速度", "VD228", 1, 1));
add(new Res_PLCADDRESS("平移-定位运行速度", "VD232", 1, 1));
add(new Res_PLCADDRESS("平移-1号位置值", "VD236", 1, 1));
add(new Res_PLCADDRESS("平移-2号位置值", "VD240", 1, 1));
add(new Res_PLCADDRESS("平移-3号位置值", "VD244", 1, 1));
add(new Res_PLCADDRESS("平移-4号位置值", "VD248", 1, 1));

add(new Res_PLCADDRESS("翻转-伺服当前值", "VD260", 1, 1));
add(new Res_PLCADDRESS("翻转-点动速度", "VD264", 1, 1));
add(new Res_PLCADDRESS("翻转-回原点速度", "VD268", 1, 1));
add(new Res_PLCADDRESS("翻转-定位运行速度", "VD272", 1, 1));
add(new Res_PLCADDRESS("翻转-1号位置值", "VD276", 1, 1));
add(new Res_PLCADDRESS("翻转-2号位置值", "VD280", 1, 1));
add(new Res_PLCADDRESS("翻转-3号位置值", "VD284", 1, 1));
add(new Res_PLCADDRESS("翻转-4号位置值", "VD288", 1, 1));

//反馈信号
add(new Res_PLCADDRESS("反馈信号", "-------------", 0, 0));
add(new Res_PLCADDRESS("初始化完成", "M40.0", 1, 0));
@@ -858,6 +816,60 @@ public class ConfigName {
put(27, "DC,bus 硬件异常");

}};

/**
* Bottom 按钮
*/
public List<String> BottomList = new ArrayList<String>() {{
add("初始化");
add("停止");
add("复位");


add("主料");
add("出菜");
add("原点位");
add("投料位");
add("倒菜位");
add("抽料位");
add("清洗位");
add("炒菜位1");
add("炒菜位2");
add("炒菜位3");
add("出餐启动");
add("出餐启动");

add("开始校正");
add("料仓1下料");
add("料仓2下料");
add("料仓3下料");


add("平移-回原点");
add("平移-去1号位");
add("平移-去2号位");
add("平移-去3号位");
add("平移-去4号位");

add("平移-1#位置设定");
add("平移-2#位置设定");
add("平移-3#位置设定");
add("平移-4#位置设定");

add("翻转-回原点");
add("翻转-去1号位");
add("翻转-去2号位");
add("翻转-去3号位");
add("翻转-去4号位");

add("翻转-1#位置设定");
add("翻转-2#位置设定");
add("翻转-3#位置设定");
add("翻转-4#位置设定");
add("倒菜启动");
//add("磁铁吸合");
}};

//endregion

//region 云端数据


+ 1
- 1
app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_PLCADDRESS.java View File

@@ -10,5 +10,5 @@ public class BPA_PLCADDRESS extends ModeBase{
public String address;
public int isread;//是否可读
public int iswrite;//是否可写
public int sort;
public int sort; //
}

+ 44
- 6
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/fragment_plc_control.java View File

@@ -1,6 +1,7 @@
package com.bonait.bnframework.modules.home.fragment.mode;

import android.content.Context;
import android.os.Handler;
import android.text.InputType;
import android.util.AttributeSet;
import android.view.LayoutInflater;
@@ -17,6 +18,7 @@ import androidx.annotation.Nullable;

import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
@@ -25,6 +27,8 @@ import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;
import com.suke.widget.SwitchButton;

import java.util.HashMap;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
@@ -52,7 +56,11 @@ public class fragment_plc_control extends LinearLayout {
Button update_plc;//下发按钮

@BindView(R.id.control_switch)
SwitchButton control_switch;//下发按钮
SwitchButton control_switch;//开关按钮

@BindView(R.id.control_botton)
Button control_botton;//控制按钮


@BindView(R.id.text_wb)
TextView text_wb;//分组
@@ -64,6 +72,7 @@ public class fragment_plc_control extends LinearLayout {
model=_model;
Init();
}

public void Init()
{
if (model.address.equals("-------------"))
@@ -80,14 +89,25 @@ public class fragment_plc_control extends LinearLayout {
zhidu.setVisibility(View.GONE);
if(model.address.startsWith("M"))//开关
{
wenben.setVisibility(View.GONE);
wenben.setVisibility(View.GONE);//显示
kaiguan.setVisibility(View.VISIBLE);
if(model.isread==1)
//1. 初始化 停止 复位 搅拌 炒锅抽水 炒锅放水 出菜 原点位
if(ConfigName.getInstance().BottomList.contains(model.name))//Bottom
{
Object val= ExecuteTheRecipe.ListeningValue.get(model.name);
if(val!=null)
control_switch.setVisibility(View.GONE);
control_botton.setVisibility(View.VISIBLE);
}else //开关
{
control_switch.setVisibility(View.VISIBLE);
control_botton.setVisibility(View.GONE);

if(model.isread==1)
{
control_switch.setChecked((boolean)val);
Object val= ExecuteTheRecipe.ListeningValue.get(model.name);
if(val!=null)
{
control_switch.setChecked((boolean)val);
}
}
}
} else //文本
@@ -172,6 +192,24 @@ public class fragment_plc_control extends LinearLayout {
ToastUtils.info("写入地址:"+model.address+"成功!状态:"+(ischick?"打开":"关闭"));
}
});

/**
* Bottom 按钮按下
*/
control_botton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
ExecuteTheRecipe.WritePLC(model.name,true,null);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
ExecuteTheRecipe.WritePLC(model.name, false, null);
}
}, 500);

ToastUtils.info(model.name+"执行成功!");
}
});
}
public BPA_PLCADDRESS model=null;
@OnClick({R.id.update_plc})


+ 10
- 1
app/src/main/res/layout/item/layout/fragment_item_plc_control.xml View File

@@ -82,7 +82,16 @@
android:id="@+id/kaiguan"
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<Button
android:id="@+id/control_botton"
android:layout_width="80dp"
android:layout_height="26dp"
android:layout_marginRight="@dimen/dp_10"
android:background="@drawable/bg_btn_login_selected"
android:layout_centerInParent="true"
android:visibility="gone"
android:text="启动"
android:textSize="14dp" />
<com.suke.widget.SwitchButton
app:sb_uncheck_color="@color/app_color_blue"
app:sb_uncheckcircle_color="@color/app_color_blue"


BIN
View File


BIN
View File


BIN
View File


Loading…
Cancel
Save