@@ -1586,7 +1586,7 @@ public class ExecuteTheRecipe { | |||||
ModbusTcpServer.get().WriteBool("M52.1", (boolean) false, null); | ModbusTcpServer.get().WriteBool("M52.1", (boolean) false, null); | ||||
//读取版本号 | //读取版本号 | ||||
ModbusTcpServer.get().ReadInt("VD1100", 1, val -> { | ModbusTcpServer.get().ReadInt("VD1100", 1, val -> { | ||||
PlcVersion= String.valueOf(val[0]); | |||||
PlcVersion= String.valueOf(val[0]+""); | |||||
if(NotifyVersionNumUpdates!=null) | if(NotifyVersionNumUpdates!=null) | ||||
{ | { | ||||
NotifyVersionNumUpdates.Run(); | NotifyVersionNumUpdates.Run(); | ||||
@@ -185,9 +185,13 @@ public class ConfigName { | |||||
//region PlC连接参数 | //region PlC连接参数 | ||||
/** | /** | ||||
* Plc是否连接 | |||||
* 老窗体是否显示 | |||||
*/ | */ | ||||
public boolean IsShow = false; | public boolean IsShow = false; | ||||
/** | |||||
* 新窗体是否显示 | |||||
*/ | |||||
public boolean IsShowNew = false; | |||||
/** | /** | ||||
* Plc是否连接 | * Plc是否连接 | ||||
*/ | */ | ||||
@@ -184,6 +184,7 @@ public class BottomNavigation2Activity extends BaseActivity { | |||||
public void ReconnectModbus() { | public void ReconnectModbus() { | ||||
try { | try { | ||||
ConfigName.getInstance().IsShow=true; | ConfigName.getInstance().IsShow=true; | ||||
ConfigName.getInstance().IsShowNew=false; | |||||
ThreadManager.Get().StartLong("PLC断线重连线程", true, new IThread() { | ThreadManager.Get().StartLong("PLC断线重连线程", true, new IThread() { | ||||
@Override | @Override | ||||
public void Run() throws InterruptedException { | public void Run() throws InterruptedException { | ||||
@@ -195,7 +196,7 @@ public class BottomNavigation2Activity extends BaseActivity { | |||||
boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address, 1, 1); | boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address, 1, 1); | ||||
if (!status) //ping 不通 连接 | if (!status) //ping 不通 连接 | ||||
{ | { | ||||
MessageLog.ShowInfo("PLC状态断开,尝试连接..."); | |||||
MessageLog.ShowInfo("老版本:PLC状态断开,尝试连接..."); | |||||
ConfigName.getInstance().PlcIsConnect = false; | ConfigName.getInstance().PlcIsConnect = false; | ||||
} | } | ||||
} else { | } else { | ||||
@@ -204,7 +205,7 @@ public class BottomNavigation2Activity extends BaseActivity { | |||||
MessageLog.ShowInfo("设备 " + ConfigName.getInstance().Address + " PLC通讯正常,准备连接!"); | MessageLog.ShowInfo("设备 " + ConfigName.getInstance().Address + " PLC通讯正常,准备连接!"); | ||||
ModbusTcpServer.ConnectPLC(); | ModbusTcpServer.ConnectPLC(); | ||||
} else { | } else { | ||||
MessageLog.ShowInfo("PLC状态断开,尝试连接..."); | |||||
MessageLog.ShowInfo("老版本:PLC状态断开,尝试连接..."); | |||||
ConfigName.getInstance().PlcIsConnect = false; | ConfigName.getInstance().PlcIsConnect = false; | ||||
} | } | ||||
} | } | ||||
@@ -216,7 +217,7 @@ public class BottomNavigation2Activity extends BaseActivity { | |||||
boolean status = ModbusTcpMainServer.ping2(ConfigName.getInstance().MainAddress, 1, 1); | boolean status = ModbusTcpMainServer.ping2(ConfigName.getInstance().MainAddress, 1, 1); | ||||
if (!status) //ping 不通 连接 | if (!status) //ping 不通 连接 | ||||
{ | { | ||||
MessageLog.ShowInfo("主控PLC状态断开,尝试连接..."); | |||||
MessageLog.ShowInfo("老版本:主控PLC状态断开,尝试连接..."); | |||||
ConfigName.getInstance().PlcMainIsConnect = false; | ConfigName.getInstance().PlcMainIsConnect = false; | ||||
} | } | ||||
} else { | } else { | ||||
@@ -225,7 +226,7 @@ public class BottomNavigation2Activity extends BaseActivity { | |||||
MessageLog.ShowInfo("设备 " + ConfigName.getInstance().MainAddress + " 主控PLC通讯正常,准备连接!"); | MessageLog.ShowInfo("设备 " + ConfigName.getInstance().MainAddress + " 主控PLC通讯正常,准备连接!"); | ||||
ModbusTcpMainServer.ConnectPLC(); | ModbusTcpMainServer.ConnectPLC(); | ||||
} else { | } else { | ||||
MessageLog.ShowInfo("主控PLC状态断开,尝试连接..."); | |||||
MessageLog.ShowInfo("老版本:主控PLC状态断开,尝试连接..."); | |||||
ConfigName.getInstance().PlcMainIsConnect = false; | ConfigName.getInstance().PlcMainIsConnect = false; | ||||
} | } | ||||
} | } | ||||
@@ -106,7 +106,7 @@ public class BottomNavigationNewActivity extends BaseActivity { | |||||
@Override | @Override | ||||
protected void onDestroy() { | protected void onDestroy() { | ||||
ConfigData.getInstance().ColsePLC(); | ConfigData.getInstance().ColsePLC(); | ||||
IsRunThread = false; | |||||
ConfigName.getInstance().IsShowNew = false; | |||||
if (makeThread != null) { | if (makeThread != null) { | ||||
makeThread = null; | makeThread = null; | ||||
} | } | ||||
@@ -282,18 +282,19 @@ public class BottomNavigationNewActivity extends BaseActivity { | |||||
*/ | */ | ||||
public void ReconnectModbus() { | public void ReconnectModbus() { | ||||
try { | try { | ||||
ThreadManager.Get().StartLong("PLC断线重连线程-2", true, new IThread() { | |||||
ConfigName.getInstance().IsShowNew=true; | |||||
ConfigName.getInstance().IsShow=false; | |||||
ThreadManager.Get().StartLong("PLC断线重连线程新界面", true, new IThread() { | |||||
@Override | @Override | ||||
public void Run() throws InterruptedException { | public void Run() throws InterruptedException { | ||||
try { | try { | ||||
if(IsRunThread) | |||||
{ | |||||
if (ConfigName.getInstance().IsShowNew) { | |||||
if (ConfigName.getInstance().PlcIsConnect) { | if (ConfigName.getInstance().PlcIsConnect) { | ||||
//ping 不通 | //ping 不通 | ||||
boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address, 1, 1); | boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address, 1, 1); | ||||
if (!status) //ping 不通 连接 | if (!status) //ping 不通 连接 | ||||
{ | { | ||||
MessageLog.ShowInfo("PLC状态断开,尝试连接..."); | |||||
MessageLog.ShowInfo("新版本:PLC状态断开,尝试连接..."); | |||||
ConfigName.getInstance().PlcIsConnect = false; | ConfigName.getInstance().PlcIsConnect = false; | ||||
} | } | ||||
} else { | } else { | ||||
@@ -302,7 +303,7 @@ public class BottomNavigationNewActivity extends BaseActivity { | |||||
MessageLog.ShowInfo("设备 " + ConfigName.getInstance().Address + " PLC通讯正常,准备连接!"); | MessageLog.ShowInfo("设备 " + ConfigName.getInstance().Address + " PLC通讯正常,准备连接!"); | ||||
ModbusTcpServer.ConnectPLC(); | ModbusTcpServer.ConnectPLC(); | ||||
} else { | } else { | ||||
MessageLog.ShowInfo("PLC状态断开,尝试连接..."); | |||||
MessageLog.ShowInfo("新版本:PLC状态断开,尝试连接..."); | |||||
ConfigName.getInstance().PlcIsConnect = false; | ConfigName.getInstance().PlcIsConnect = false; | ||||
} | } | ||||
} | } | ||||
@@ -313,7 +314,7 @@ public class BottomNavigationNewActivity extends BaseActivity { | |||||
boolean status = ModbusTcpMainServer.ping2(ConfigName.getInstance().MainAddress, 1, 1); | boolean status = ModbusTcpMainServer.ping2(ConfigName.getInstance().MainAddress, 1, 1); | ||||
if (!status) //ping 不通 连接 | if (!status) //ping 不通 连接 | ||||
{ | { | ||||
MessageLog.ShowInfo("主控PLC状态断开,尝试连接..."); | |||||
MessageLog.ShowInfo("新版本:主控PLC状态断开,尝试连接..."); | |||||
ConfigName.getInstance().PlcMainIsConnect = false; | ConfigName.getInstance().PlcMainIsConnect = false; | ||||
} | } | ||||
} else { | } else { | ||||
@@ -322,7 +323,7 @@ public class BottomNavigationNewActivity extends BaseActivity { | |||||
MessageLog.ShowInfo("设备 " + ConfigName.getInstance().MainAddress + " 主控PLC通讯正常,准备连接!"); | MessageLog.ShowInfo("设备 " + ConfigName.getInstance().MainAddress + " 主控PLC通讯正常,准备连接!"); | ||||
ModbusTcpMainServer.ConnectPLC(); | ModbusTcpMainServer.ConnectPLC(); | ||||
} else { | } else { | ||||
MessageLog.ShowInfo("主控PLC状态断开,尝试连接..."); | |||||
MessageLog.ShowInfo("新版本:主控PLC状态断开,尝试连接..."); | |||||
ConfigName.getInstance().PlcMainIsConnect = false; | ConfigName.getInstance().PlcMainIsConnect = false; | ||||
} | } | ||||
} | } | ||||
@@ -354,7 +355,6 @@ public class BottomNavigationNewActivity extends BaseActivity { | |||||
public Thread makeThread = null; | public Thread makeThread = null; | ||||
public Thread makeThreadDC = null; | public Thread makeThreadDC = null; | ||||
public boolean IsRunThread = true; | |||||
/** | /** | ||||
* 商品制作线程 | * 商品制作线程 | ||||
@@ -364,15 +364,15 @@ public class BottomNavigationNewActivity extends BaseActivity { | |||||
makeThread = new Thread(new Runnable() { | makeThread = new Thread(new Runnable() { | ||||
@Override | @Override | ||||
public void run() { | public void run() { | ||||
while (IsRunThread) { | |||||
while (ConfigName.getInstance().IsShowNew) { | |||||
try { | try { | ||||
if (ExecuteTheRecipe.IsStart && goods != null) { | if (ExecuteTheRecipe.IsStart && goods != null) { | ||||
long startTime = System.currentTimeMillis(); //起始时间 | long startTime = System.currentTimeMillis(); //起始时间 | ||||
ExecuteTheRecipe.showlog("--------------------------------------"); | ExecuteTheRecipe.showlog("--------------------------------------"); | ||||
ExecuteTheRecipe.showlog("开始烹饪菜谱【"+goods.name+"】"); | |||||
ExecuteTheRecipe.showlog("开始烹饪菜谱【" + goods.name + "】"); | |||||
ModbusTcpServer.get().WriteBool("M52.0", (boolean) true, null); | ModbusTcpServer.get().WriteBool("M52.0", (boolean) true, null); | ||||
ExecuteTheRecipe.HandTime=0;//默认将手动操作时间复位 | |||||
ExecuteTheRecipe.HandTime = 0;//默认将手动操作时间复位 | |||||
try { | try { | ||||
//获取工艺 | //获取工艺 | ||||
@@ -413,14 +413,14 @@ public class BottomNavigationNewActivity extends BaseActivity { | |||||
long endTime = System.currentTimeMillis(); //结束时间 | long endTime = System.currentTimeMillis(); //结束时间 | ||||
int time = (int) ((endTime - startTime) / 1000); | int time = (int) ((endTime - startTime) / 1000); | ||||
Log.e("运行时长", String.format("方法使用时间 %d s", time)); | Log.e("运行时长", String.format("方法使用时间 %d s", time)); | ||||
ExecuteTheRecipe.showlog("结束烹饪菜谱【"+goods.name+"】,关闭搅拌、关闭加热,"+String.format("方法使用时间 %d s", time)); | |||||
ExecuteTheRecipe.showlog("结束烹饪菜谱【" + goods.name + "】,关闭搅拌、关闭加热," + String.format("方法使用时间 %d s", time)); | |||||
if (!ExecuteTheRecipe.IsForcedEnd) { | if (!ExecuteTheRecipe.IsForcedEnd) { | ||||
int ztime=time-ExecuteTheRecipe.HandTime; | |||||
goods.maketime=ztime>0?ztime:time; | |||||
int ztime = time - ExecuteTheRecipe.HandTime; | |||||
goods.maketime = ztime > 0 ? ztime : time; | |||||
QueryDB.UpdateGoodsMakeTime(goods.id, goods.maketime); | QueryDB.UpdateGoodsMakeTime(goods.id, goods.maketime); | ||||
} | } | ||||
ExecuteTheRecipe.HandTime=0;//默认将手动操作时间复位 | |||||
ExecuteTheRecipe.HandTime = 0;//默认将手动操作时间复位 | |||||
ExecuteTheRecipe.all_list = new ArrayList<>(); | ExecuteTheRecipe.all_list = new ArrayList<>(); | ||||
runOnUiThread(new Runnable() { | runOnUiThread(new Runnable() { | ||||
@@ -432,7 +432,7 @@ public class BottomNavigationNewActivity extends BaseActivity { | |||||
ToastUtils.info("客官,当前菜品已强制结束!!!"); | ToastUtils.info("客官,当前菜品已强制结束!!!"); | ||||
//初始化 | //初始化 | ||||
//ExecuteTheRecipe.BottomClick("初始化"); | //ExecuteTheRecipe.BottomClick("初始化"); | ||||
ExecuteTheRecipe.showlog("菜谱【"+goods.name+"】已强制结束..."); | |||||
ExecuteTheRecipe.showlog("菜谱【" + goods.name + "】已强制结束..."); | |||||
if (ConfigName.getInstance().versionSelectionEnum.contains("一拖"))//通知任务结束 | if (ConfigName.getInstance().versionSelectionEnum.contains("一拖"))//通知任务结束 | ||||
{ | { | ||||
@@ -459,7 +459,7 @@ public class BottomNavigationNewActivity extends BaseActivity { | |||||
makeThreadDC = new Thread(new Runnable() { | makeThreadDC = new Thread(new Runnable() { | ||||
@Override | @Override | ||||
public void run() { | public void run() { | ||||
while (IsRunThread) { | |||||
while (ConfigName.getInstance().IsShowNew) { | |||||
try { | try { | ||||
if (ExecuteTheRecipe.IsStart && goods != null && gongxuIndex != 10000 && goodsrecipesL != null && MakeCipe != null) { | if (ExecuteTheRecipe.IsStart && goods != null && gongxuIndex != 10000 && goodsrecipesL != null && MakeCipe != null) { | ||||
@@ -558,41 +558,39 @@ public class BottomNavigationNewActivity extends BaseActivity { | |||||
}); | }); | ||||
makeThreadDC.start(); | makeThreadDC.start(); | ||||
ExecuteTheRecipe.NoticeHandSuspension=new IRunT() { | |||||
ExecuteTheRecipe.NoticeHandSuspension = new IRunT() { | |||||
@Override | @Override | ||||
public void Run(Object o) { | public void Run(Object o) { | ||||
if(IsRunThread) | |||||
{ | |||||
runOnUiThread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
if((boolean) o) | |||||
{ | |||||
onRecordPause(); | |||||
}else | |||||
{ | |||||
onRecordPauseStart(); | |||||
if (ConfigName.getInstance().IsShowNew) { | |||||
if (!isFinishing()) { | |||||
runOnUiThread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
if ((boolean) o) { | |||||
onRecordPause(); | |||||
} else { | |||||
onRecordPauseStart(); | |||||
} | |||||
} | } | ||||
} | |||||
}); | |||||
}); | |||||
} | |||||
} | } | ||||
} | } | ||||
}; | }; | ||||
ExecuteTheRecipe.NoticeAtPresentTime=new IRunT() { | |||||
ExecuteTheRecipe.NoticeAtPresentTime = new IRunT() { | |||||
@Override | @Override | ||||
public void Run(Object o) { | public void Run(Object o) { | ||||
if(IsRunThread) | |||||
{ | |||||
int k=(int) o; | |||||
runOnUiThread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
cooking.SetMiaoShuTime(k); | |||||
} | |||||
}); | |||||
if (ConfigName.getInstance().IsShowNew) { | |||||
int k = (int) o; | |||||
if (!isFinishing()) { | |||||
runOnUiThread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
cooking.SetMiaoShuTime(k); | |||||
} | |||||
}); | |||||
} | |||||
} | } | ||||
} | } | ||||
}; | }; | ||||
@@ -683,14 +681,18 @@ public class BottomNavigationNewActivity extends BaseActivity { | |||||
* 暂停 | * 暂停 | ||||
*/ | */ | ||||
public void onRecordPause() { | public void onRecordPause() { | ||||
countDownTimer.pause(); | |||||
if (countDownTimer != null) { | |||||
countDownTimer.pause(); | |||||
} | |||||
} | } | ||||
/** | /** | ||||
* 继续 | * 继续 | ||||
*/ | */ | ||||
public void onRecordPauseStart() { | public void onRecordPauseStart() { | ||||
countDownTimer.resume(); | |||||
if (countDownTimer != null) { | |||||
countDownTimer.resume(); | |||||
} | |||||
} | } | ||||
/** | /** | ||||
@@ -482,8 +482,7 @@ public class Home1Fragment extends BaseFragment { | |||||
public boolean onTouch(View view, MotionEvent motionEvent) { | public boolean onTouch(View view, MotionEvent motionEvent) { | ||||
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) { | if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) { | ||||
Log.e("鼠标", "按下: "); | Log.e("鼠标", "按下: "); | ||||
if (!IsMake(false)) | |||||
{ | |||||
if (!IsMake(false)) { | |||||
return false; | return false; | ||||
} | } | ||||
int jd = (int) nifty_slider3.getValue(); | int jd = (int) nifty_slider3.getValue(); | ||||
@@ -515,8 +514,7 @@ public class Home1Fragment extends BaseFragment { | |||||
public boolean onTouch(View view, MotionEvent motionEvent) { | public boolean onTouch(View view, MotionEvent motionEvent) { | ||||
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) { | if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) { | ||||
Log.e("鼠标", "按下: "); | Log.e("鼠标", "按下: "); | ||||
if (!IsMake(false)) | |||||
{ | |||||
if (!IsMake(false)) { | |||||
return false; | return false; | ||||
} | } | ||||
int jd = (int) nifty_slider3.getValue(); | int jd = (int) nifty_slider3.getValue(); | ||||
@@ -565,10 +563,9 @@ public class Home1Fragment extends BaseFragment { | |||||
BPA_GOODSRECIPE MakeCipe = null; | BPA_GOODSRECIPE MakeCipe = null; | ||||
public Thread makeThread=null; | |||||
public Thread makeThreadDC=null; | |||||
public Thread makeThreadUI=null; | |||||
public boolean IsRunThread=true; | |||||
public Thread makeThread = null; | |||||
public Thread makeThreadDC = null; | |||||
public Thread makeThreadUI = null; | |||||
/** | /** | ||||
* 商品制作线程 | * 商品制作线程 | ||||
@@ -576,18 +573,18 @@ public class Home1Fragment extends BaseFragment { | |||||
public void MakeThread() { | public void MakeThread() { | ||||
ExecuteTheRecipe.context = context; | ExecuteTheRecipe.context = context; | ||||
makeThread=new Thread(new Runnable() { | |||||
makeThread = new Thread(new Runnable() { | |||||
@Override | @Override | ||||
public void run() { | public void run() { | ||||
while (IsRunThread) { | |||||
while (ConfigName.getInstance().IsShow) { | |||||
try { | try { | ||||
if ( ExecuteTheRecipe.MakeStatus && good != null) { | |||||
if (ExecuteTheRecipe.MakeStatus && good != null) { | |||||
long startTime = System.currentTimeMillis(); //起始时间 | long startTime = System.currentTimeMillis(); //起始时间 | ||||
ExecuteTheRecipe.showlog("--------------------------------------"); | ExecuteTheRecipe.showlog("--------------------------------------"); | ||||
ExecuteTheRecipe.showlog("开始烹饪菜谱【"+good.name+"】"); | |||||
ExecuteTheRecipe.showlog("开始烹饪菜谱【" + good.name + "】"); | |||||
ModbusTcpServer.get().WriteBool("M52.0", (boolean) true, null); | ModbusTcpServer.get().WriteBool("M52.0", (boolean) true, null); | ||||
ExecuteTheRecipe.HandTime=0;//默认将手动操作时间复位 | |||||
ExecuteTheRecipe.HandTime = 0;//默认将手动操作时间复位 | |||||
try { | try { | ||||
//获取工艺 | //获取工艺 | ||||
@@ -624,14 +621,14 @@ public class Home1Fragment extends BaseFragment { | |||||
long endTime = System.currentTimeMillis(); //结束时间 | long endTime = System.currentTimeMillis(); //结束时间 | ||||
int time = (int) ((endTime - startTime) / 1000); | int time = (int) ((endTime - startTime) / 1000); | ||||
Log.e("运行时长", String.format("方法使用时间 %d s", time)); | Log.e("运行时长", String.format("方法使用时间 %d s", time)); | ||||
ExecuteTheRecipe.showlog("结束烹饪菜谱【"+good.name+"】,关闭搅拌、关闭加热,"+String.format("方法使用时间 %d s", time)); | |||||
ExecuteTheRecipe.showlog("结束烹饪菜谱【" + good.name + "】,关闭搅拌、关闭加热," + String.format("方法使用时间 %d s", time)); | |||||
if (!ExecuteTheRecipe.IsForcedEnd) { | if (!ExecuteTheRecipe.IsForcedEnd) { | ||||
int ztime=time-ExecuteTheRecipe.HandTime; | |||||
good.maketime=ztime>0?ztime:time; | |||||
int ztime = time - ExecuteTheRecipe.HandTime; | |||||
good.maketime = ztime > 0 ? ztime : time; | |||||
QueryDB.UpdateGoodsMakeTime(good.id, good.maketime); | QueryDB.UpdateGoodsMakeTime(good.id, good.maketime); | ||||
} | } | ||||
ExecuteTheRecipe.HandTime=0;//默认将手动操作时间复位 | |||||
ExecuteTheRecipe.HandTime = 0;//默认将手动操作时间复位 | |||||
ExecuteTheRecipe.all_list = new ArrayList<>(); | ExecuteTheRecipe.all_list = new ArrayList<>(); | ||||
@@ -645,8 +642,8 @@ public class Home1Fragment extends BaseFragment { | |||||
{ | { | ||||
ToastUtils.info("客官,当前菜品已强制结束!!!"); | ToastUtils.info("客官,当前菜品已强制结束!!!"); | ||||
//初始化 | //初始化 | ||||
// ExecuteTheRecipe.BottomClick("初始化"); | |||||
ExecuteTheRecipe.showlog("菜谱【"+good.name+"】已强制结束..."); | |||||
// ExecuteTheRecipe.BottomClick("初始化"); | |||||
ExecuteTheRecipe.showlog("菜谱【" + good.name + "】已强制结束..."); | |||||
if (ConfigName.getInstance().versionSelectionEnum.contains("一拖"))//通知任务结束 | if (ConfigName.getInstance().versionSelectionEnum.contains("一拖"))//通知任务结束 | ||||
{ | { | ||||
ExecuteTheRecipe.WriteMainPLC("强制结束任务完成", true, null);//复位 | ExecuteTheRecipe.WriteMainPLC("强制结束任务完成", true, null);//复位 | ||||
@@ -669,13 +666,13 @@ public class Home1Fragment extends BaseFragment { | |||||
}); | }); | ||||
makeThread.start(); | makeThread.start(); | ||||
makeThreadDC=new Thread(new Runnable() { | |||||
makeThreadDC = new Thread(new Runnable() { | |||||
@Override | @Override | ||||
public void run() { | public void run() { | ||||
while (IsRunThread) { | |||||
while (ConfigName.getInstance().IsShow) { | |||||
try { | try { | ||||
if ( ExecuteTheRecipe.MakeStatus && good != null && gongxuIndex != 10000 && goodsrecipesL != null && MakeCipe != null) { | |||||
if (ExecuteTheRecipe.MakeStatus && good != null && gongxuIndex != 10000 && goodsrecipesL != null && MakeCipe != null) { | |||||
try { | try { | ||||
if (ConfigName.getInstance().versionSelectionEnum.equals("大炒自动投料版本") || ConfigName.getInstance().versionSelectionEnum.equals("小炒版本")) { | if (ConfigName.getInstance().versionSelectionEnum.equals("大炒自动投料版本") || ConfigName.getInstance().versionSelectionEnum.equals("小炒版本")) { | ||||
//获取工艺 | //获取工艺 | ||||
@@ -771,10 +768,10 @@ public class Home1Fragment extends BaseFragment { | |||||
}); | }); | ||||
makeThreadDC.start(); | makeThreadDC.start(); | ||||
makeThreadUI=new Thread(new Runnable() { | |||||
makeThreadUI = new Thread(new Runnable() { | |||||
@Override | @Override | ||||
public void run() { | public void run() { | ||||
while (IsRunThread) { | |||||
while (ConfigName.getInstance().IsShow) { | |||||
try { | try { | ||||
SxUI(); | SxUI(); | ||||
Thread.sleep(1000); | Thread.sleep(1000); | ||||
@@ -786,38 +783,40 @@ public class Home1Fragment extends BaseFragment { | |||||
}); | }); | ||||
makeThreadUI.start(); | makeThreadUI.start(); | ||||
ExecuteTheRecipe.NoticeHandSuspension=new IRunT() { | |||||
ExecuteTheRecipe.NoticeHandSuspension = new IRunT() { | |||||
@Override | @Override | ||||
public void Run(Object o) { | public void Run(Object o) { | ||||
if(IsRunThread) | |||||
{ | |||||
getActivity().runOnUiThread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
if((boolean) o) | |||||
{ | |||||
onRecordPause(); | |||||
}else | |||||
{ | |||||
onRecordPauseStart(); | |||||
if (ConfigName.getInstance().IsShow) { | |||||
Activity activity = getActivity(); | |||||
if (activity != null) { | |||||
activity.runOnUiThread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
if ((boolean) o) { | |||||
onRecordPause(); | |||||
} else { | |||||
onRecordPauseStart(); | |||||
} | |||||
} | } | ||||
} | |||||
}); | |||||
}); | |||||
} | |||||
} | } | ||||
} | } | ||||
}; | }; | ||||
ExecuteTheRecipe.NoticeAtPresentTime=new IRunT() { | |||||
ExecuteTheRecipe.NoticeAtPresentTime = new IRunT() { | |||||
@Override | @Override | ||||
public void Run(Object o) { | public void Run(Object o) { | ||||
if(IsRunThread) | |||||
{ | |||||
getActivity().runOnUiThread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
gongxutime.setText("预计等待:"+(int) o+"s"); | |||||
} | |||||
}); | |||||
if (ConfigName.getInstance().IsShow) { | |||||
Activity activity = getActivity(); | |||||
if (activity != null) { | |||||
activity.runOnUiThread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
gongxutime.setText("预计等待:" + (int) o + "s"); | |||||
} | |||||
}); | |||||
} | |||||
} | } | ||||
} | } | ||||
}; | }; | ||||
@@ -928,7 +927,7 @@ public class Home1Fragment extends BaseFragment { | |||||
*/ | */ | ||||
public void SetBottonStatus(boolean status) { | public void SetBottonStatus(boolean status) { | ||||
try { | try { | ||||
ExecuteTheRecipe.MakeStatus = status; | |||||
ExecuteTheRecipe.MakeStatus = status; | |||||
if (status) { | if (status) { | ||||
startbutton.setImageResource(R.mipmap.tzzz); | startbutton.setImageResource(R.mipmap.tzzz); | ||||
TimerCount(good.maketime, true);//开始计时器,记录进度条 | TimerCount(good.maketime, true);//开始计时器,记录进度条 | ||||
@@ -984,14 +983,18 @@ public class Home1Fragment extends BaseFragment { | |||||
* 暂停 | * 暂停 | ||||
*/ | */ | ||||
public void onRecordPause() { | public void onRecordPause() { | ||||
countDownTimer.pause(); | |||||
if (countDownTimer != null) { | |||||
countDownTimer.pause(); | |||||
} | |||||
} | } | ||||
/** | /** | ||||
* 继续 | * 继续 | ||||
*/ | */ | ||||
public void onRecordPauseStart() { | public void onRecordPauseStart() { | ||||
countDownTimer.resume(); | |||||
if (countDownTimer != null) { | |||||
countDownTimer.resume(); | |||||
} | |||||
} | } | ||||
/** | /** | ||||
@@ -1010,7 +1013,7 @@ public class Home1Fragment extends BaseFragment { | |||||
ToastUtils.info("打开菜谱选择界面"); | ToastUtils.info("打开菜谱选择界面"); | ||||
break; | break; | ||||
case R.id.startbutton: | case R.id.startbutton: | ||||
if ( ExecuteTheRecipe.MakeStatus ) { | |||||
if (ExecuteTheRecipe.MakeStatus) { | |||||
// ToastUtils.info("客官菜谱正在制作过程中,请耐心等待一下,马上就好啦!"); | // ToastUtils.info("客官菜谱正在制作过程中,请耐心等待一下,马上就好啦!"); | ||||
// return; | // return; | ||||
//按钮点击 | //按钮点击 | ||||
@@ -1148,7 +1151,7 @@ public class Home1Fragment extends BaseFragment { | |||||
// return false; | // return false; | ||||
// } | // } | ||||
if (ExecuteTheRecipe.MakeStatus && k) { | |||||
if (ExecuteTheRecipe.MakeStatus && k) { | |||||
ToastUtils.warning("客官,商品制作未结束请勿进行其他操作.请耐心等待商品制作结束!!!"); | ToastUtils.warning("客官,商品制作未结束请勿进行其他操作.请耐心等待商品制作结束!!!"); | ||||
return false; | return false; | ||||
} | } | ||||
@@ -1171,10 +1174,16 @@ public class Home1Fragment extends BaseFragment { | |||||
public void onDestroy() { | public void onDestroy() { | ||||
super.onDestroy(); | super.onDestroy(); | ||||
Logger.d("第一页销毁"); | Logger.d("第一页销毁"); | ||||
IsRunThread=false; | |||||
if(makeThread!=null){makeThread=null;} | |||||
if(makeThreadDC!=null){makeThreadDC=null;} | |||||
if(makeThreadUI!=null){makeThreadUI=null;} | |||||
ConfigName.getInstance().IsShow=false; | |||||
if (makeThread != null) { | |||||
makeThread = null; | |||||
} | |||||
if (makeThreadDC != null) { | |||||
makeThreadDC = null; | |||||
} | |||||
if (makeThreadUI != null) { | |||||
makeThreadUI = null; | |||||
} | |||||
} | } | ||||
/** | /** | ||||
@@ -1,6 +1,7 @@ | |||||
package com.bonait.bnframework.modules.mine.fragment; | package com.bonait.bnframework.modules.mine.fragment; | ||||
import android.Manifest; | import android.Manifest; | ||||
import android.app.Activity; | |||||
import android.content.Context; | import android.content.Context; | ||||
import android.content.Intent; | import android.content.Intent; | ||||
import android.net.Uri; | import android.net.Uri; | ||||
@@ -132,12 +133,16 @@ public class MyFragment extends BaseFragment { | |||||
ExecuteTheRecipe.NotifyVersionNumUpdates=new IRun() { | ExecuteTheRecipe.NotifyVersionNumUpdates=new IRun() { | ||||
@Override | @Override | ||||
public void Run() { | public void Run() { | ||||
getActivity().runOnUiThread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
stvUpdate.setRightString(ConfigName.getInstance().Version+"|"+ ExecuteTheRecipe.PlcVersion); | |||||
} | |||||
}); | |||||
Activity activity=getActivity(); | |||||
if(activity!=null) | |||||
{ | |||||
activity.runOnUiThread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
stvUpdate.setRightString(ConfigName.getInstance().Version+"|"+ ExecuteTheRecipe.PlcVersion); | |||||
} | |||||
}); | |||||
} | |||||
} | } | ||||
}; | }; | ||||
/* | /* | ||||