@@ -1102,6 +1102,52 @@ public class ConfigData { | |||
} | |||
/** | |||
* 恢复plc地址 | |||
*/ | |||
public void RevertPLC() { | |||
try { | |||
List<Res_PLCADDRESS> plcaddresses = ConfigName.getInstance().PlcAddress_大炒; | |||
List<ProcessT> processTS = ConfigName.getInstance().Process_大炒; | |||
if (ConfigName.getInstance().versionSelectionEnum.equals("大炒版本")) { | |||
plcaddresses = ConfigName.getInstance().PlcAddress_大炒; | |||
processTS = ConfigName.getInstance().Process_大炒; | |||
} else if (ConfigName.getInstance().versionSelectionEnum.equals("大炒自动投料版本")) { | |||
plcaddresses = ConfigName.getInstance().PlcAddress_大炒自动投料; | |||
processTS = ConfigName.getInstance().Process_大炒自动投料; | |||
} else if (ConfigName.getInstance().versionSelectionEnum.equals("小炒版本")) { | |||
plcaddresses = ConfigName.getInstance().PlcAddress_小炒; | |||
processTS = ConfigName.getInstance().Process_小炒; | |||
} else if (ConfigName.getInstance().versionSelectionEnum.equals("一拖四大炒")) { | |||
plcaddresses = ConfigName.getInstance().PlcAddress_一拖四; | |||
processTS = ConfigName.getInstance().Process_一拖四; | |||
} else if (ConfigName.getInstance().versionSelectionEnum.equals("一拖二大炒")) { | |||
plcaddresses = ConfigName.getInstance().PlcAddress_大炒自动投料; | |||
processTS = ConfigName.getInstance().Process_一拖四; | |||
} | |||
//region 恢复PLC | |||
ArrayList<BPA_PLCADDRESS> arrayList = QueryDB.GetPlcaddressALL(); | |||
for (BPA_PLCADDRESS item : arrayList) { | |||
QueryDB.DeletePlcaddress(item); | |||
} | |||
int k = 1; | |||
for (Res_PLCADDRESS item : plcaddresses) { | |||
BPA_PLCADDRESS plc = new BPA_PLCADDRESS(); | |||
plc.name = item.name; | |||
plc.address = item.address; | |||
plc.isread = item.isread; | |||
plc.iswrite = item.iswrite; | |||
plc.sort = k; | |||
k++; | |||
QueryDB.AddPlcaddress(plc); | |||
} | |||
//endregion | |||
} catch (Exception ex) { | |||
} | |||
} | |||
/** | |||
* 恢复出厂设置 PLC与工序 | |||
*/ | |||
@@ -6,7 +6,6 @@ import android.content.ContextWrapper; | |||
import android.os.Handler; | |||
import android.os.Looper; | |||
import android.util.Log; | |||
import android.view.View; | |||
import androidx.annotation.NonNull; | |||
@@ -16,7 +15,6 @@ import com.bonait.bnframework.common.constant.MessageName; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOS; | |||
import com.bonait.bnframework.common.helper.ByteHelper; | |||
@@ -24,29 +22,21 @@ import com.bonait.bnframework.common.helper.I.IRun; | |||
import com.bonait.bnframework.common.helper.I.IRunT; | |||
import com.bonait.bnframework.common.helper.I.IThread; | |||
import com.bonait.bnframework.common.helper.I.IWriteCallBack; | |||
import com.bonait.bnframework.common.helper.LogcatHelper; | |||
import com.bonait.bnframework.common.helper.ThreadManager; | |||
import com.bonait.bnframework.common.message.MessageManager; | |||
import com.bonait.bnframework.common.modbus.ModbusTcpMainServer; | |||
import com.bonait.bnframework.common.modbus.ModbusTcpServer; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.modules.home.fragment.mode.LocationStatus; | |||
import com.bonait.bnframework.modules.home.fragment.mode.MyStatus; | |||
import com.qmuiteam.qmui.widget.dialog.QMUIDialog; | |||
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction; | |||
import java.text.DecimalFormat; | |||
import java.text.SimpleDateFormat; | |||
import java.util.ArrayList; | |||
import java.util.Date; | |||
import java.util.HashMap; | |||
import java.util.IdentityHashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.concurrent.ConcurrentHashMap; | |||
import kotlin.UShort; | |||
import java.util.concurrent.atomic.AtomicBoolean; | |||
/** | |||
* 执行配方 | |||
@@ -118,6 +108,11 @@ public class ExecuteTheRecipe { | |||
* 通知手动暂停 | |||
*/ | |||
public static IRunT NoticeHandSuspension = null; | |||
/** | |||
* 当前工序预计剩余时间 | |||
*/ | |||
public static IRunT NoticeAtPresentTime=null; | |||
//endregion | |||
//region 强制结束 | |||
@@ -165,7 +160,51 @@ public class ExecuteTheRecipe { | |||
return false; | |||
} | |||
//判断是否加热异常 | |||
boolean isJre = false; | |||
Object K = ReadPLC("加热"); | |||
isJre = K == null ? false : (boolean) K; | |||
if(isJre)//判断是否加热异常 | |||
{ | |||
Object gz = ReadPLC("异常加热故障信息"); | |||
if(gz!=null && (boolean) gz) | |||
{ | |||
ExecuteTheRecipe.showlog("客官,检测到硬件加热异常,已主动停止炒制,请联系海科人员!!!"); | |||
IsForcedEnd=true; | |||
final boolean[] IsComplete = {false}; | |||
String title = "加热异常-温馨提示!"; | |||
String message = "客官硬件加热异常,请联系海科人员,已强制停止炒制!"; | |||
Activity activity = findActivity(context); | |||
if (activity != null) { | |||
activity.runOnUiThread(new Runnable() { | |||
@Override | |||
public void run() { | |||
try { | |||
//.setCanceledOnTouchOutside(false) // 禁用点击其他地方关闭对话框 | |||
new QMUIDialog.MessageDialogBuilder(context).setCancelable(false).setCanceledOnTouchOutside(false).setTitle(title).setMessage(message).addAction("确定", new QMUIDialogAction.ActionListener() { | |||
@Override | |||
public void onClick(QMUIDialog dialog, int index) { | |||
IsComplete[0] = true; | |||
dialog.dismiss(); | |||
} | |||
}).create(com.qmuiteam.qmui.R.style.QMUI_Dialog).show(); | |||
} catch (Exception e) { | |||
} | |||
} | |||
}); | |||
} | |||
while (!IsComplete[0]) { | |||
Thread.sleep(100);//10 *6 | |||
} | |||
return false; | |||
} | |||
} | |||
ExecuteTheRecipe.showlog("开始执行:" + recipe.sort + "、" + recipe.processms); | |||
if (NoticeAtPresentTime!=null){NoticeAtPresentTime.Run(0);} | |||
if (recipe.materialType == 0)//正常物料 | |||
{ | |||
@@ -210,6 +249,10 @@ public class ExecuteTheRecipe { | |||
public static void ExecuteMaterialIssuance(String text) { | |||
try { | |||
if (!text.isEmpty()) { | |||
long startTime = System.currentTimeMillis(); //起始时间 | |||
if(NoticeHandSuspension!=null){NoticeHandSuspension.Run(true);} | |||
//仓号 值 | |||
HashMap<BPA_SILOS, Integer> formulation = new HashMap<>(); | |||
//region 获取仓号和值 | |||
@@ -258,6 +301,11 @@ public class ExecuteTheRecipe { | |||
BPA_SILOS silos = entry.getKey(); | |||
ThreadWhile("料仓" + silos.num + "下料完成"); | |||
} | |||
long endTime = System.currentTimeMillis(); //结束时间 | |||
int time = (int) ((endTime - startTime) / 1000); | |||
HandTime=HandTime+time; | |||
if(NoticeHandSuspension!=null){NoticeHandSuspension.Run(false);} | |||
} | |||
} catch (Exception ex) { | |||
ToastUtils.error("异常信息:" + ex.getMessage()); | |||
@@ -560,7 +608,8 @@ public class ExecuteTheRecipe { | |||
public void run() { | |||
try { | |||
new QMUIDialog.MessageDialogBuilder(context).setCancelable(false).setTitle(title).setMessage(message).addAction("确定", new QMUIDialogAction.ActionListener() { | |||
//.setCanceledOnTouchOutside(false) // 禁用点击其他地方关闭对话框 | |||
new QMUIDialog.MessageDialogBuilder(context).setCancelable(false).setCanceledOnTouchOutside(false).setTitle(title).setMessage(message).addAction("确定", new QMUIDialogAction.ActionListener() { | |||
@Override | |||
public void onClick(QMUIDialog dialog, int index) { | |||
IsComplete[0] = true; | |||
@@ -979,7 +1028,7 @@ public class ExecuteTheRecipe { | |||
@Override | |||
public void run() { | |||
try { | |||
new QMUIDialog.MessageDialogBuilder(context).setCancelable(false).setTitle(title).setMessage(message).addAction("确定", new QMUIDialogAction.ActionListener() { | |||
new QMUIDialog.MessageDialogBuilder(context).setCancelable(false).setCanceledOnTouchOutside(false).setTitle(title).setMessage(message).addAction("确定", new QMUIDialogAction.ActionListener() { | |||
@Override | |||
public void onClick(QMUIDialog dialog, int index) { | |||
IsComplete[0] = true; | |||
@@ -1122,7 +1171,7 @@ public class ExecuteTheRecipe { | |||
public void run() { | |||
try { | |||
new QMUIDialog.MessageDialogBuilder(context).setCancelable(false).setTitle(title).setMessage(message).addAction("确定", new QMUIDialogAction.ActionListener() { | |||
new QMUIDialog.MessageDialogBuilder(context).setCancelable(false).setCanceledOnTouchOutside(false).setTitle(title).setMessage(message).addAction("确定", new QMUIDialogAction.ActionListener() { | |||
@Override | |||
public void onClick(QMUIDialog dialog, int index) { | |||
IsComplete[0] = true; | |||
@@ -2004,16 +2053,23 @@ public class ExecuteTheRecipe { | |||
*/ | |||
public static void ThreadDelay(int delay) { | |||
ExecuteTheRecipe.showlog("工序线程等待-------时长:" + delay + "秒,请耐心等待,开始计时!"); | |||
long startTime = System.currentTimeMillis(); | |||
while ((System.currentTimeMillis() - startTime) <= (delay * 1000) && !IsForcedEnd && ConfigName.getInstance().PlcIsConnect) | |||
int AtPresentTime=delay; | |||
if (NoticeAtPresentTime!=null){NoticeAtPresentTime.Run(AtPresentTime);} | |||
long startTime = System.currentTimeMillis();// && ConfigName.getInstance().PlcIsConnect | |||
while ((System.currentTimeMillis() - startTime) <= (delay * 1000) && !IsForcedEnd) | |||
{ | |||
try { | |||
Thread.sleep(100); | |||
int mmmm=delay- (int) ((System.currentTimeMillis() - startTime)/1000); | |||
if (AtPresentTime!=mmmm) | |||
{ | |||
if (NoticeAtPresentTime!=null){NoticeAtPresentTime.Run(mmmm);} | |||
} | |||
} catch (InterruptedException ex) { | |||
} | |||
} | |||
AtPresentTime=0; | |||
if (NoticeAtPresentTime!=null){NoticeAtPresentTime.Run(AtPresentTime);} | |||
long endTime = System.currentTimeMillis(); //结束时间 | |||
int time = (int) ((endTime - startTime) / 1000); | |||
ExecuteTheRecipe.showlog("工序线程等待结束-------总耗时:" + time); | |||
@@ -141,7 +141,6 @@ public class ConfigName { | |||
public String Version = "1.0"; | |||
//endregion | |||
//region 是否手动下单 | |||
/** | |||
* 是否手动下单 | |||
@@ -275,7 +274,7 @@ public class ConfigName { | |||
//搅拌模型 | |||
add(new Res_PLCADDRESS("模型控制", "-------------", 0, 0)); | |||
add(new Res_PLCADDRESS("搅拌", "M10.3", 0, 1)); | |||
add(new Res_PLCADDRESS("搅拌", "M10.3", 1, 1)); | |||
add(new Res_PLCADDRESS("搅拌速度", "VW102", 1, 1)); | |||
//翻转正转模型 | |||
@@ -361,6 +360,22 @@ 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("温度模拟量上限", "VW1050", 1, 1)); | |||
add(new Res_PLCADDRESS("温度模拟量下限", "VW1052", 1, 1)); | |||
add(new Res_PLCADDRESS("温度模拟量", "VW1054", 1, 1)); | |||
add(new Res_PLCADDRESS("温度量程上限", "VD1060", 1, 1)); | |||
add(new Res_PLCADDRESS("温度量程下限", "VD1056", 1, 1)); | |||
add(new Res_PLCADDRESS("电流模拟输入量", "-------------", 0, 0)); | |||
add(new Res_PLCADDRESS("电流模拟量上限", "VW1070", 1, 1)); | |||
add(new Res_PLCADDRESS("电流模拟量下限", "VW1072", 1, 1)); | |||
add(new Res_PLCADDRESS("电流模拟量", "VW1074", 1, 1)); | |||
add(new Res_PLCADDRESS("电流量程上限", "VD1080", 1, 1)); | |||
add(new Res_PLCADDRESS("电流量程下限", "VD1076", 1, 1)); | |||
add(new Res_PLCADDRESS("电流报警设置", "VW1092", 1, 1)); | |||
add(new Res_PLCADDRESS("异常加热故障信息", "M42.1", 1, 1)); | |||
//反馈信号 | |||
add(new Res_PLCADDRESS("反馈信号", "-------------", 0, 0)); | |||
add(new Res_PLCADDRESS("初始化完成", "M40.0", 1, 0)); | |||
@@ -435,7 +450,7 @@ public class ConfigName { | |||
//搅拌模型 | |||
add(new Res_PLCADDRESS("模型控制", "-------------", 0, 0)); | |||
add(new Res_PLCADDRESS("搅拌", "M10.3", 0, 1)); | |||
add(new Res_PLCADDRESS("搅拌", "M10.3", 1, 1)); | |||
add(new Res_PLCADDRESS("搅拌速度", "VW102", 1, 1)); | |||
//翻转正转模型 | |||
@@ -602,6 +617,21 @@ public class ConfigName { | |||
add(new Res_PLCADDRESS("倒菜完成", "M44.4", 1, 0)); | |||
add(new Res_PLCADDRESS("心跳位", "VW1000", 0, 1)); | |||
add(new Res_PLCADDRESS("温度模拟输入量", "-------------", 0, 0)); | |||
add(new Res_PLCADDRESS("温度模拟量上限", "VW1050", 1, 1)); | |||
add(new Res_PLCADDRESS("温度模拟量下限", "VW1052", 1, 1)); | |||
add(new Res_PLCADDRESS("温度模拟量", "VW1054", 1, 1)); | |||
add(new Res_PLCADDRESS("温度量程上限", "VD1060", 1, 1)); | |||
add(new Res_PLCADDRESS("温度量程下限", "VD1056", 1, 1)); | |||
add(new Res_PLCADDRESS("电流模拟输入量", "-------------", 0, 0)); | |||
add(new Res_PLCADDRESS("电流模拟量上限", "VW1070", 1, 1)); | |||
add(new Res_PLCADDRESS("电流模拟量下限", "VW1072", 1, 1)); | |||
add(new Res_PLCADDRESS("电流模拟量", "VW1074", 1, 1)); | |||
add(new Res_PLCADDRESS("电流量程上限", "VD1080", 1, 1)); | |||
add(new Res_PLCADDRESS("电流量程下限", "VD1076", 1, 1)); | |||
add(new Res_PLCADDRESS("电流报警设置", "VW1092", 1, 1)); | |||
add(new Res_PLCADDRESS("异常加热故障信息", "M42.1", 1, 1)); | |||
//检测信号 | |||
add(new Res_PLCADDRESS("监测信号", "-------------", 0, 0)); | |||
@@ -626,7 +656,6 @@ public class ConfigName { | |||
add(new Res_PLCADDRESS("搅拌电机", "VW350", 1, 0)); | |||
add(new Res_PLCADDRESS("翻转电机", "VW352", 1, 0)); | |||
add(new Res_PLCADDRESS("炒锅", "VW354", 1, 0)); | |||
}}; | |||
/** | |||
* 大炒自动投料工序模型 | |||
@@ -656,7 +685,7 @@ public class ConfigName { | |||
//搅拌模型 | |||
add(new Res_PLCADDRESS("模型控制", "-------------", 0, 0)); | |||
add(new Res_PLCADDRESS("搅拌", "M10.3", 0, 1)); | |||
add(new Res_PLCADDRESS("搅拌", "M10.3", 1, 1)); | |||
add(new Res_PLCADDRESS("搅拌速度", "VW102", 1, 1)); | |||
//翻转正转模型 | |||
@@ -793,6 +822,22 @@ public class ConfigName { | |||
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("温度模拟量上限", "VW1050", 1, 1)); | |||
add(new Res_PLCADDRESS("温度模拟量下限", "VW1052", 1, 1)); | |||
add(new Res_PLCADDRESS("温度模拟量", "VW1054", 1, 1)); | |||
add(new Res_PLCADDRESS("温度量程上限", "VD1060", 1, 1)); | |||
add(new Res_PLCADDRESS("温度量程下限", "VD1056", 1, 1)); | |||
add(new Res_PLCADDRESS("电流模拟输入量", "-------------", 0, 0)); | |||
add(new Res_PLCADDRESS("电流模拟量上限", "VW1070", 1, 1)); | |||
add(new Res_PLCADDRESS("电流模拟量下限", "VW1072", 1, 1)); | |||
add(new Res_PLCADDRESS("电流模拟量", "VW1074", 1, 1)); | |||
add(new Res_PLCADDRESS("电流量程上限", "VD1080", 1, 1)); | |||
add(new Res_PLCADDRESS("电流量程下限", "VD1076", 1, 1)); | |||
add(new Res_PLCADDRESS("电流报警设置", "VW1092", 1, 1)); | |||
add(new Res_PLCADDRESS("异常加热故障信息", "M42.1", 1, 1)); | |||
//反馈信号 | |||
add(new Res_PLCADDRESS("反馈信号", "-------------", 0, 0)); | |||
add(new Res_PLCADDRESS("初始化完成", "M40.0", 1, 0)); | |||
@@ -877,7 +922,7 @@ public class ConfigName { | |||
//搅拌模型 | |||
add(new Res_PLCADDRESS("模型控制", "-------------", 0, 0)); | |||
add(new Res_PLCADDRESS("搅拌", "M10.3", 0, 1)); | |||
add(new Res_PLCADDRESS("搅拌", "M10.3", 1, 1)); | |||
add(new Res_PLCADDRESS("搅拌速度", "VW102", 1, 1)); | |||
//翻转正转模型 | |||
@@ -1038,6 +1083,23 @@ public class ConfigName { | |||
add(new Res_PLCADDRESS("翻转2-4#位置设定", "M19.3", 0, 1)); | |||
add(new Res_PLCADDRESS("倒菜启动2", "M19.4", 0, 1)); | |||
add(new Res_PLCADDRESS("温度模拟输入量", "-------------", 0, 0)); | |||
add(new Res_PLCADDRESS("温度模拟量上限", "VW1050", 1, 1)); | |||
add(new Res_PLCADDRESS("温度模拟量下限", "VW1052", 1, 1)); | |||
add(new Res_PLCADDRESS("温度模拟量", "VW1054", 1, 1)); | |||
add(new Res_PLCADDRESS("温度量程上限", "VD1060", 1, 1)); | |||
add(new Res_PLCADDRESS("温度量程下限", "VD1056", 1, 1)); | |||
add(new Res_PLCADDRESS("电流模拟输入量", "-------------", 0, 0)); | |||
add(new Res_PLCADDRESS("电流模拟量上限", "VW1070", 1, 1)); | |||
add(new Res_PLCADDRESS("电流模拟量下限", "VW1072", 1, 1)); | |||
add(new Res_PLCADDRESS("电流模拟量", "VW1074", 1, 1)); | |||
add(new Res_PLCADDRESS("电流量程上限", "VD1080", 1, 1)); | |||
add(new Res_PLCADDRESS("电流量程下限", "VD1076", 1, 1)); | |||
add(new Res_PLCADDRESS("电流报警设置", "VW1092", 1, 1)); | |||
add(new Res_PLCADDRESS("异常加热故障信息", "M42.1", 1, 1)); | |||
//反馈信号 | |||
add(new Res_PLCADDRESS("反馈信号", "-------------", 0, 0)); | |||
add(new Res_PLCADDRESS("初始化完成", "M40.0", 1, 0)); | |||
@@ -1230,7 +1292,6 @@ public class ConfigName { | |||
* 炒锅状态上报信息 | |||
*/ | |||
public List<StatusMode> statusModes = new ArrayList<StatusMode>() {{ | |||
//硬件设备 初始化 | |||
add(new StatusMode("急停", false, R.mipmap.jiting, R.mipmap.jiting, 0)); | |||
add(new StatusMode("炒锅正限位报警", false, R.mipmap.cg_sxw, R.mipmap.cg_sxw, 2)); | |||
@@ -1238,6 +1299,7 @@ public class ConfigName { | |||
add(new StatusMode("编码器通讯异常", false, R.mipmap.bmq, R.mipmap.bmq, 4)); | |||
add(new StatusMode("搅拌电机变频器通讯异常", false, R.mipmap.bpq, R.mipmap.bpq, 6)); | |||
add(new StatusMode("翻转电机变频器通讯异常", false, R.mipmap.bpq, R.mipmap.bpq, 7)); | |||
add(new StatusMode("炒锅加热异常", false, R.mipmap.hr, R.mipmap.hr, 8)); | |||
}}; | |||
/** | |||
* 电机状态上报信息 | |||
@@ -1374,7 +1436,7 @@ public class ConfigName { | |||
//endregion | |||
//region | |||
//region 手动投料是否关闭 | |||
/** | |||
* 手动投料是否关闭火力 | |||
*/ | |||
@@ -414,7 +414,8 @@ public class BottomNavigationNewActivity extends BaseActivity { | |||
if (!ExecuteTheRecipe.IsForcedEnd) { | |||
int ztime=time-ExecuteTheRecipe.HandTime; | |||
QueryDB.UpdateGoodsMakeTime(goods.id, ztime>0?ztime:time); | |||
goods.maketime=ztime>0?ztime:time; | |||
QueryDB.UpdateGoodsMakeTime(goods.id, goods.maketime); | |||
} | |||
ExecuteTheRecipe.HandTime=0;//默认将手动操作时间复位 | |||
@@ -427,7 +428,7 @@ public class BottomNavigationNewActivity extends BaseActivity { | |||
{ | |||
ToastUtils.info("客官,当前菜品已强制结束!!!"); | |||
//初始化 | |||
ExecuteTheRecipe.BottomClick("初始化"); | |||
//ExecuteTheRecipe.BottomClick("初始化"); | |||
ExecuteTheRecipe.showlog("菜谱【"+goods.name+"】已强制结束..."); | |||
if (ConfigName.getInstance().versionSelectionEnum.contains("一拖"))//通知任务结束 | |||
@@ -559,16 +560,40 @@ public class BottomNavigationNewActivity extends BaseActivity { | |||
public void Run(Object o) { | |||
if(IsRunThread) | |||
{ | |||
if((boolean) o) | |||
{ | |||
onRecordPause(); | |||
}else | |||
{ | |||
onRecordPauseStart(); | |||
} | |||
runOnUiThread(new Runnable() { | |||
@Override | |||
public void run() { | |||
if((boolean) o) | |||
{ | |||
onRecordPause(); | |||
}else | |||
{ | |||
onRecordPauseStart(); | |||
} | |||
} | |||
}); | |||
} | |||
} | |||
}; | |||
ExecuteTheRecipe.NoticeAtPresentTime=new IRunT() { | |||
@Override | |||
public void Run(Object o) { | |||
if(IsRunThread) | |||
{ | |||
int k=(int) o; | |||
runOnUiThread(new Runnable() { | |||
@Override | |||
public void run() { | |||
cooking.SetMiaoShuTime(k); | |||
} | |||
}); | |||
} | |||
} | |||
}; | |||
} | |||
/** | |||
@@ -55,13 +55,13 @@ public class monitor_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolde | |||
if(statusMode.Status) | |||
{ | |||
myViewHolder.image.setImageResource(statusMode.Url_open); | |||
myViewHolder.text.setText("打开"); | |||
myViewHolder.text.setTextColor(context.getResources().getColor(R.color.black)); | |||
myViewHolder.text.setText("异常"); | |||
myViewHolder.text.setTextColor(context.getResources().getColor(R.color.red_primary)); | |||
}else | |||
{ | |||
myViewHolder.image.setImageResource(statusMode.Url_close); | |||
myViewHolder.text.setText("关闭"); | |||
myViewHolder.text.setTextColor(context.getResources().getColor(R.color.red_primary)); | |||
myViewHolder.text.setText("正常"); | |||
myViewHolder.text.setTextColor(context.getResources().getColor(R.color.green_primary)); | |||
} | |||
} | |||
} catch (Exception e) { | |||
@@ -27,6 +27,7 @@ import android.widget.ImageView; | |||
import android.widget.LinearLayout; | |||
import android.widget.RelativeLayout; | |||
import android.widget.SeekBar; | |||
import android.widget.TextView; | |||
import com.aliyun.alink.linksdk.tmp.devicemodel.Event; | |||
import com.aliyun.alink.linksdk.tmp.devicemodel.Property; | |||
@@ -134,6 +135,14 @@ public class Home1Fragment extends BaseFragment { | |||
@BindView(R.id.wk_zhuangtai) | |||
QMUILinkTextView wk_zhuangtai;// | |||
@BindView(R.id.gongxumiaoshu) | |||
TextView gongxumiaoshu;//工序描述 | |||
@BindView(R.id.gongxutime) | |||
TextView gongxutime;//预计等待 | |||
/** | |||
* 当前制作商品信息 | |||
*/ | |||
@@ -241,6 +250,7 @@ public class Home1Fragment extends BaseFragment { | |||
if (!IsMake(true)) { | |||
return; | |||
} | |||
gongxumiaoshu.setText("等待开始"); | |||
good = (BPA_GOODS) data; | |||
SetBottonStatus(false); | |||
caipumingcheng.setText(good.name); | |||
@@ -588,6 +598,12 @@ public class Home1Fragment extends BaseFragment { | |||
for (BPA_GOODSRECIPE item : goodsrecipes) { | |||
MakeCipe = item; | |||
gongxuIndex++; | |||
getActivity().runOnUiThread(new Runnable() { | |||
@Override | |||
public void run() { | |||
gongxumiaoshu.setText("正在执行:" + item.processms); | |||
} | |||
}); | |||
boolean status = ExecuteTheRecipe.Execute(item, goodsrecipes, m); | |||
m++; | |||
} | |||
@@ -612,7 +628,8 @@ public class Home1Fragment extends BaseFragment { | |||
if (!ExecuteTheRecipe.IsForcedEnd) { | |||
int ztime=time-ExecuteTheRecipe.HandTime; | |||
QueryDB.UpdateGoodsMakeTime(good.id, ztime>0?ztime:time); | |||
good.maketime=ztime>0?ztime:time; | |||
QueryDB.UpdateGoodsMakeTime(good.id, good.maketime); | |||
} | |||
ExecuteTheRecipe.HandTime=0;//默认将手动操作时间复位 | |||
@@ -628,7 +645,7 @@ public class Home1Fragment extends BaseFragment { | |||
{ | |||
ToastUtils.info("客官,当前菜品已强制结束!!!"); | |||
//初始化 | |||
ExecuteTheRecipe.BottomClick("初始化"); | |||
// ExecuteTheRecipe.BottomClick("初始化"); | |||
ExecuteTheRecipe.showlog("菜谱【"+good.name+"】已强制结束..."); | |||
if (ConfigName.getInstance().versionSelectionEnum.contains("一拖"))//通知任务结束 | |||
{ | |||
@@ -641,7 +658,6 @@ public class Home1Fragment extends BaseFragment { | |||
} | |||
ExecuteTheRecipe.showlog("--------------------------------------"); | |||
ModbusTcpServer.get().WriteBool("M52.0", (boolean) false, null); | |||
} | |||
} | |||
Thread.sleep(1000); | |||
@@ -775,13 +791,33 @@ public class Home1Fragment extends BaseFragment { | |||
public void Run(Object o) { | |||
if(IsRunThread) | |||
{ | |||
if((boolean) o) | |||
{ | |||
onRecordPause(); | |||
}else | |||
{ | |||
onRecordPauseStart(); | |||
} | |||
getActivity().runOnUiThread(new Runnable() { | |||
@Override | |||
public void run() { | |||
if((boolean) o) | |||
{ | |||
onRecordPause(); | |||
}else | |||
{ | |||
onRecordPauseStart(); | |||
} | |||
} | |||
}); | |||
} | |||
} | |||
}; | |||
ExecuteTheRecipe.NoticeAtPresentTime=new IRunT() { | |||
@Override | |||
public void Run(Object o) { | |||
if(IsRunThread) | |||
{ | |||
getActivity().runOnUiThread(new Runnable() { | |||
@Override | |||
public void run() { | |||
gongxutime.setText("预计等待:"+(int) o+"s"); | |||
} | |||
}); | |||
} | |||
} | |||
}; | |||
@@ -896,9 +932,11 @@ public class Home1Fragment extends BaseFragment { | |||
if (status) { | |||
startbutton.setImageResource(R.mipmap.tzzz); | |||
TimerCount(good.maketime, true);//开始计时器,记录进度条 | |||
gongxumiaoshu.setText("等待开始"); | |||
} else { | |||
startbutton.setImageResource(R.mipmap.qdzz); | |||
TimerCount(0, false);//停止计时器 | |||
gongxumiaoshu.setText("等待开始"); | |||
} | |||
if (good != null) { | |||
SetProcesssUI(good.maketime, 0); | |||
@@ -73,6 +73,9 @@ public class CookingActivity extends LinearLayout { | |||
@BindView(R.id.gongxumiaoshu) | |||
TextView gongxumiaoshu;//工序描述 | |||
@BindView(R.id.gongxutime) | |||
TextView gongxutime;//预计等待 | |||
@BindView(R.id.start_goodmake) | |||
imagebuttom start_goodmake;//开始 | |||
@@ -204,6 +207,15 @@ public class CookingActivity extends LinearLayout { | |||
gongxumiaoshu.setText(text + ""); | |||
} | |||
/** | |||
* 设置描述时间 | |||
* | |||
* @param | |||
*/ | |||
public void SetMiaoShuTime(int time) { | |||
gongxutime.setText("预计等待:"+time+"s"); | |||
} | |||
/** | |||
* 设置进度条 | |||
* | |||
@@ -401,6 +401,23 @@ public class DiyActivity extends BaseActivity { | |||
case R.id.add_hrgx://添加工序 | |||
BPA_GOODSRECIPE goodsrecipe = GetSelectItemFromValue(); | |||
if (goodsrecipe != null) { | |||
if(goodsrecipe.processname.equals("加热")) | |||
{ | |||
boolean isfa=false; | |||
for (BPA_GOODSRECIPE item:bpa_goodsrecipes) | |||
{ | |||
if(item.processname.equals("搅拌")) | |||
{ | |||
isfa=true; | |||
} | |||
} | |||
if(isfa==false) | |||
{ | |||
ToastUtils.warning("加热工序之前,必须先添加搅拌工序!"); | |||
return; | |||
} | |||
} | |||
bpa_goodsrecipes.add(GetSelectItemFromValue()); | |||
gxbz_adapter.notifyDataSetChanged(); | |||
} | |||
@@ -386,6 +386,22 @@ public class DiyUpdate1Activity extends BaseActivity { | |||
case R.id.add_hrgx://添加工序 | |||
BPA_GOODSRECIPE goodsrecipe = GetSelectItemFromValue(); | |||
if (goodsrecipe != null) { | |||
if(goodsrecipe.processname.equals("加热")) | |||
{ | |||
boolean isfa=false; | |||
for (BPA_GOODSRECIPE item:bpa_goodsrecipes) | |||
{ | |||
if(item.processname.equals("搅拌")) | |||
{ | |||
isfa=true; | |||
} | |||
} | |||
if(isfa==false) | |||
{ | |||
ToastUtils.warning("加热工序之前,必须先添加搅拌工序!"); | |||
return; | |||
} | |||
} | |||
bpa_goodsrecipes.add(GetSelectItemFromValue()); | |||
gxbz_adapter.notifyDataSetChanged(); | |||
} | |||
@@ -443,6 +443,22 @@ public class DiyUpdateActivity extends BaseActivity { | |||
BPA_GOODSRECIPE goodsrecipe= GetSelectItemFromValue(); | |||
if(goodsrecipe!=null) | |||
{ | |||
if(goodsrecipe.processname.equals("加热")) | |||
{ | |||
boolean isfa=false; | |||
for (BPA_GOODSRECIPE item:bpa_goodsrecipes) | |||
{ | |||
if(item.processname.equals("搅拌")) | |||
{ | |||
isfa=true; | |||
} | |||
} | |||
if(isfa==false) | |||
{ | |||
ToastUtils.warning("加热工序之前,必须先添加搅拌工序!"); | |||
return; | |||
} | |||
} | |||
bpa_goodsrecipes.add(GetSelectItemFromValue()); | |||
gxbz_adapter.notifyDataSetChanged(); | |||
} | |||
@@ -95,7 +95,14 @@ public class SystemCsMonitorFragment extends BaseFragment { | |||
try { | |||
for (StatusMode item:ConfigName.getInstance().statusModes) | |||
{ | |||
item.Status= ExecuteTheRecipe.getConcurrentHash(item.sort); | |||
if(item.Name.contains("炒锅加热异常") ) | |||
{ | |||
Object K= ExecuteTheRecipe.ReadPLC("异常加热故障信息"); | |||
item.Status= K == null ? false : (boolean) K; | |||
}else | |||
{ | |||
item.Status= ExecuteTheRecipe.getConcurrentHash(item.sort); | |||
} | |||
} | |||
jiaobandianji.setText( ConfigName.getInstance().statusModes_电机.get(ExecuteTheRecipe.getConcurrentHash_dj("搅拌电机"))); | |||
@@ -121,7 +121,7 @@ public class SystemCsPLCFragment extends BaseFragment { | |||
@Override | |||
public void onClick(QMUIDialog dialog, int index) { | |||
load_view.setVisibility(View.VISIBLE); | |||
ConfigData.getInstance().RevertPLCProcess(); | |||
ConfigData.getInstance().RevertPLC(); | |||
Init(); | |||
ToastUtils.info("初始化成功!"); | |||
dialog.dismiss(); | |||
@@ -123,6 +123,14 @@ public class fragment_plc_control extends LinearLayout { | |||
edittext_plc.setText(str.toCharArray(), 0, str.length()); | |||
} | |||
} | |||
if(model.address.startsWith("VR")) | |||
{ | |||
edittext_plc.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_CLASS_NUMBER); | |||
}else | |||
{ | |||
edittext_plc.setInputType(InputType.TYPE_CLASS_NUMBER); | |||
} | |||
} | |||
}else //只读 | |||
{ | |||
@@ -150,13 +158,7 @@ public class fragment_plc_control extends LinearLayout { | |||
} | |||
}else //文本 | |||
{ | |||
int val_k=0; | |||
String dw=""; | |||
if(val!=null) | |||
{ | |||
val_k=Integer.parseInt(String.valueOf(val)); | |||
} | |||
if(model.name.contains("温度")) | |||
{ | |||
dw=" °C"; | |||
@@ -179,7 +181,7 @@ public class fragment_plc_control extends LinearLayout { | |||
{ | |||
dw=" 挡"; | |||
} | |||
text_wb.setText(val_k+dw); | |||
text_wb.setText(val+dw); | |||
} | |||
} | |||
} | |||
@@ -231,6 +233,19 @@ public class fragment_plc_control extends LinearLayout { | |||
{ | |||
int val=Integer.parseInt(text); | |||
ExecuteTheRecipe.WritePLC(model.name,val,null); | |||
} | |||
else if(model.address.startsWith("VR")) | |||
{ | |||
float val=0; | |||
try { | |||
val=Float.parseFloat(text); | |||
} | |||
catch (Exception ex) | |||
{ | |||
ToastUtils.warning("输入数据不合法!"); | |||
return; | |||
} | |||
ExecuteTheRecipe.WritePLC(model.name,val,null); | |||
}else | |||
{ | |||
Short val=Short.parseShort(text); | |||
@@ -9,8 +9,10 @@ import android.widget.ImageView; | |||
import android.widget.LinearLayout; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.business.ExecuteTheRecipe; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
@@ -90,6 +92,14 @@ public class huoli_control extends LinearLayout { | |||
@OnClick({R.id.colse, | |||
R.id.hl1,R.id.hl2,R.id.hl3,R.id.hl4,R.id.hl5,R.id.hl6,R.id.hl7,R.id.hl8}) | |||
public void onViewClicked(View view) { | |||
if (view.getId()!=R.id.colse) | |||
{ | |||
Object OBJ = ExecuteTheRecipe.getListingValue("搅拌"); | |||
if (!(OBJ != null && (boolean) OBJ)) { | |||
ToastUtils.warning("请先打开搅拌!"); | |||
return; | |||
} | |||
} | |||
switch (view.getId()) { | |||
case R.id.colse://选择菜谱按钮点击 | |||
if(Status) | |||
@@ -10,8 +10,10 @@ import android.widget.LinearLayout; | |||
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.helper.I.MyClickListener; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
@@ -109,6 +111,14 @@ public class newhuoli_control extends LinearLayout { | |||
// { | |||
// return; | |||
// } | |||
if (view.getId()!=R.id.colse) | |||
{ | |||
Object OBJ = ExecuteTheRecipe.getListingValue("搅拌"); | |||
if (!(OBJ != null && (boolean) OBJ)) { | |||
ToastUtils.warning("请先打开搅拌!"); | |||
return; | |||
} | |||
} | |||
switch (view.getId()) { | |||
case R.id.colse://选择菜谱按钮点击 | |||
if(Status) | |||
@@ -91,14 +91,28 @@ | |||
android:layout_height="45dp" /> | |||
</RelativeLayout> | |||
<TextView | |||
android:id="@+id/gongxumiaoshu" | |||
<LinearLayout | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_marginTop="5dp" | |||
android:text="步骤1 加油50g" | |||
android:textColor="#797373" | |||
android:textSize="14dp" /> | |||
android:layout_height="wrap_content"> | |||
<TextView | |||
android:id="@+id/gongxumiaoshu" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_marginTop="5dp" | |||
android:text="步骤1 加油50g" | |||
android:textColor="#797373" | |||
android:textSize="14dp" /> | |||
<TextView | |||
android:id="@+id/gongxutime" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:layout_marginTop="5dp" | |||
android:text="预计等待:0" | |||
android:textColor="#797373" | |||
android:textSize="14dp" /> | |||
</LinearLayout> | |||
</LinearLayout> | |||
<com.bonait.bnframework.modules.home.fragment.mode.imagebuttom | |||
@@ -64,7 +64,7 @@ | |||
<!-- 开始启动 --> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="60dp" | |||
android:layout_height="80dp" | |||
android:layout_marginTop="2dp" | |||
android:background="@color/qmui_config_color_white" | |||
android:padding="5dp"> | |||
@@ -101,6 +101,29 @@ | |||
android:textColor="@color/app_color_blue" | |||
android:textSize="18dp" /> | |||
<LinearLayout | |||
android:layout_marginTop="20dp" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content"> | |||
<TextView | |||
android:id="@+id/gongxumiaoshu" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_marginTop="5dp" | |||
android:text="等待开始.." | |||
android:textColor="#797373" | |||
android:textSize="14dp" /> | |||
<TextView | |||
android:id="@+id/gongxutime" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:layout_marginTop="5dp" | |||
android:text="预计等待:0" | |||
android:textColor="#797373" | |||
android:textSize="14dp" /> | |||
</LinearLayout> | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:id="@+id/shengyushijian" | |||
android:layout_width="wrap_content" | |||
@@ -45,7 +45,7 @@ | |||
android:layout_marginLeft="5dp" | |||
android:background="@drawable/input_bj" | |||
android:hint="请输入变量" | |||
android:inputType="number" | |||
android:inputType="number|numberDecimal" | |||
android:layout_centerVertical="true" | |||
android:maxLines="1" | |||
android:padding="3dp" | |||