Browse Source

1.记录时长减去手动等待时间

2.手动等待时,暂停倒计时
3.臭鼬时间增加
master
fyf 11 months ago
parent
commit
a23f0c27a9
7 changed files with 226 additions and 2 deletions
  1. +7
    -0
      app/src/main/java/com/bonait/bnframework/business/ConfigData.java
  2. +84
    -2
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  3. +11
    -0
      app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
  4. +37
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyActivity.java
  5. +42
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyUpdate1Activity.java
  6. +43
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyUpdateActivity.java
  7. +2
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemCsMonitorFragment.java

+ 7
- 0
app/src/main/java/com/bonait/bnframework/business/ConfigData.java View File

@@ -305,6 +305,9 @@ public class ConfigData {
ConfigName.getInstance().jiarewendingCount = ConfigUtil.read(ConfigName.getInstance().dishesCon, "jiarewendingCount", ConfigName.getInstance().jiarewendingCount );
ConfigName.getInstance().RunCount = ConfigUtil.read(ConfigName.getInstance().dishesCon, "RunCount", ConfigName.getInstance().RunCount );

ConfigName.getInstance().AutoCCTime = ConfigUtil.read(ConfigName.getInstance().dishesCon, "AutoCCTime", ConfigName.getInstance().AutoCCTime );
ConfigName.getInstance().AutoQXTime = ConfigUtil.read(ConfigName.getInstance().dishesCon, "AutoQXTime", ConfigName.getInstance().AutoQXTime );

}

/**
@@ -334,6 +337,10 @@ public class ConfigData {
ConfigUtil.write(ConfigName.getInstance().dishesCon, "jiarewendingCount", ConfigName.getInstance().jiarewendingCount );
ConfigUtil.write(ConfigName.getInstance().dishesCon, "RunCount", ConfigName.getInstance().RunCount );


ConfigUtil.write(ConfigName.getInstance().dishesCon, "AutoCCTime", ConfigName.getInstance().AutoCCTime );
ConfigUtil.write(ConfigName.getInstance().dishesCon, "AutoQXTime", ConfigName.getInstance().AutoQXTime );

}

/**


+ 84
- 2
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java View File

@@ -9,6 +9,7 @@ import android.util.Log;

import androidx.annotation.NonNull;

import com.aliyun.alink.linksdk.channel.core.base.INet;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.constant.MessageName;
@@ -255,6 +256,7 @@ public class ExecuteTheRecipe {

//仓号 值
HashMap<BPA_SILOS, Integer> formulation = new HashMap<>();
int MaxValue=0;
//region 获取仓号和值
List<String> data = new ArrayList<>();
if (text.contains("|")) {
@@ -279,9 +281,18 @@ public class ExecuteTheRecipe {
if(val>=32767)
{
val=32767;
ThreadWhile("料仓" + silos.num + "出量克数溢出,已按照最大出量出料!!!");
ExecuteTheRecipe.showlog("料仓" + silos.num + "出量克数溢出,已按照最大出量出料!!!");
}
formulation.put(silos, val);

Object jz_z=ReadPLC("料仓"+silos.num+"校准值");
if(jz_z!=null)
{
int jzzz= Integer.parseInt(String.valueOf(jz_z));
int jzzz_1=jzzz==0?500:jzzz;
int ztime= (int)(val/ (jzzz_1/5.0));
MaxValue=ztime>MaxValue?ztime:MaxValue;
}
}
}
}
@@ -299,7 +310,7 @@ public class ExecuteTheRecipe {
//一直等待下料完成 否则就一直等待 40s超时
for (Map.Entry<BPA_SILOS, Integer> entry : formulation.entrySet()) {
BPA_SILOS silos = entry.getKey();
ThreadWhile("料仓" + silos.num + "下料完成");
ThreadWhile_WL("料仓" + silos.num + "下料完成",MaxValue);
}

long endTime = System.currentTimeMillis(); //结束时间
@@ -2063,6 +2074,7 @@ public class ExecuteTheRecipe {
int mmmm=delay- (int) ((System.currentTimeMillis() - startTime)/1000);
if (AtPresentTime!=mmmm)
{
AtPresentTime=mmmm;
if (NoticeAtPresentTime!=null){NoticeAtPresentTime.Run(mmmm);}
}
} catch (InterruptedException ex) {
@@ -2074,7 +2086,49 @@ public class ExecuteTheRecipe {
int time = (int) ((endTime - startTime) / 1000);
ExecuteTheRecipe.showlog("工序线程等待结束-------总耗时:" + time);
}
/**
* 线程等待
*
* @param name
*/
public static void ThreadWhile_WL(String name,int time) {
//"炒菜位1反馈";
int AtPresentTime=time;
if (NoticeAtPresentTime!=null){NoticeAtPresentTime.Run(AtPresentTime);}
final boolean[] IsComplete = {false};
long a = System.currentTimeMillis();
ExecuteTheRecipe.showlog(name + ",等待中");
while (!IsComplete[0] && !IsForcedEnd && ConfigName.getInstance().PlcIsConnect) {
if ((System.currentTimeMillis() - a) > 1000 * whileTime) {
ExecuteTheRecipe.showlog(name + ",异常超时退出!");
break;
} else {
Object sb = ReadPLC(name);
if (sb != null) {
IsComplete[0] = (boolean) (sb);
if(IsComplete[0])
{
ExecuteTheRecipe.showlog(name + ",接收到信号!");
}
}
}
try {
int mmmm=time- (int) ((System.currentTimeMillis() - a)/1000);
if (AtPresentTime!=mmmm)
{
AtPresentTime=mmmm;
if (NoticeAtPresentTime!=null){NoticeAtPresentTime.Run(mmmm);}
}

Thread.sleep(100);//10 *6
} catch (InterruptedException e) {
IsComplete[0] = true;
ExecuteTheRecipe.showlog(name + ",异常退出!" + e.getMessage());
}
}
if (NoticeAtPresentTime!=null){NoticeAtPresentTime.Run(0);}
ExecuteTheRecipe.showlog(name + ",等待结束!");
}
/**
* 线程等待
*
@@ -2116,6 +2170,10 @@ public class ExecuteTheRecipe {
*/
public static void ThreadWhile3(String name, int k) {
//"炒菜位1反馈";
int time=name.contains("清洗")?ConfigName.getInstance().AutoQXTime:ConfigName.getInstance().AutoCCTime;
int AtPresentTime=time;
if (NoticeAtPresentTime!=null){NoticeAtPresentTime.Run(AtPresentTime);}

final boolean[] IsComplete = {false};
long a = System.currentTimeMillis();
ExecuteTheRecipe.showlog(name + ",等待中");
@@ -2134,12 +2192,36 @@ public class ExecuteTheRecipe {
}
}
try {
int mmmm=time- (int) ((System.currentTimeMillis() - a)/1000);
if (AtPresentTime!=mmmm)
{
AtPresentTime=mmmm;
if (NoticeAtPresentTime!=null){NoticeAtPresentTime.Run(mmmm);}
}
Thread.sleep(100);//10 *6
} catch (InterruptedException e) {
IsComplete[0] = true;
ExecuteTheRecipe.showlog(name + ",异常退出!" + e.getMessage());
}
}
int xhtime= (int) ((System.currentTimeMillis() - a)/1000);
if(name.contains("清洗"))
{
ConfigName.getInstance().AutoQXTime=xhtime;
}else
{
ConfigName.getInstance().AutoCCTime=xhtime;
}

Activity activity = findActivity(context);
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
ConfigData.getInstance().SavePZ();
}
});

if (NoticeAtPresentTime!=null){NoticeAtPresentTime.Run(0);}
ExecuteTheRecipe.showlog(name + ",等待结束!");
}
//endregion


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

@@ -1482,4 +1482,15 @@ public class ConfigName {
*/
public int RunCount = 0;
//endregion

//region 出餐和清洗时间
/**
* 出餐时间
*/
public int AutoCCTime=10;
/**
* 清洗时间
*/
public int AutoQXTime=10;
//endregion
}

+ 37
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyActivity.java View File

@@ -501,6 +501,13 @@ public class DiyActivity extends BaseActivity {
ToastUtils.info("菜谱名称已存在!");
return;
}

if(!IsHotJ())
{
ToastUtils.warning("加热工序之前,必须先添加搅拌工序!");
return;
}

//按钮点击
String title = "生成菜谱操作提示!";
String message = "请问客官确定要生成[" + name + "]菜谱吗?";
@@ -538,6 +545,36 @@ public class DiyActivity extends BaseActivity {
}
}

/**
* 判断数据是否合法
*/
public boolean IsHotJ()
{
int index=0;
int k=0;int j=0;
for(BPA_GOODSRECIPE item:bpa_goodsrecipes)
{
if(item.processname.contains("搅拌") && k==0)
{
k=index;
}

if(item.processname.contains("加热") && j==0)
{
j=index;
}
index++;
}

if(j<=k)
{
return false;
}else
{
return true;
}
}

public void SetSelectPos(int index) {
//移动光标
gxbz_adapter.setSelectedPosition(index);


+ 42
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyUpdate1Activity.java View File

@@ -483,6 +483,13 @@ public class DiyUpdate1Activity extends BaseActivity {
ToastUtils.info("菜谱名称已存在!");
return;
}

if(!IsHotJ())
{
ToastUtils.warning("加热工序之前,必须先添加搅拌工序!");
return;
}

//按钮点击
String title = "生成菜谱操作提示!";
String message = "请问客官确定要生成[" + name1 + "]菜谱吗?";
@@ -530,6 +537,11 @@ public class DiyUpdate1Activity extends BaseActivity {
ToastUtils.info("菜谱名称已存在!");
return;
}
if(!IsHotJ())
{
ToastUtils.warning("加热工序之前,必须先添加搅拌工序!");
return;
}
//按钮点击
String title = "保存菜谱操作提示!";
String message = "请问客官确定要保存[" + name + "]菜谱吗?";
@@ -566,6 +578,36 @@ public class DiyUpdate1Activity extends BaseActivity {
}
}

/**
* 判断数据是否合法
*/
public boolean IsHotJ()
{
int index=0;
int k=0;int j=0;
for(BPA_GOODSRECIPE item:bpa_goodsrecipes)
{
if(item.processname.contains("搅拌") && k==0)
{
k=index;
}

if(item.processname.contains("加热") && j==0)
{
j=index;
}
index++;
}

if(j<=k)
{
return false;
}else
{
return true;
}
}

public void SetSelectPos(int index) {
//移动光标
gxbz_adapter.setSelectedPosition(index);


+ 43
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyUpdateActivity.java View File

@@ -552,6 +552,13 @@ public class DiyUpdateActivity extends BaseActivity {
ToastUtils.info("菜谱名称已存在!");
return;
}

if(!IsHotJ())
{
ToastUtils.warning("加热工序之前,必须先添加搅拌工序!");
return;
}

//按钮点击
String title = "生成菜谱操作提示!";
String message = "请问客官确定要生成["+name1+"]菜谱吗?";
@@ -604,6 +611,12 @@ public class DiyUpdateActivity extends BaseActivity {
ToastUtils.info("菜谱名称已存在!");
return;
}

if(!IsHotJ())
{
ToastUtils.warning("加热工序之前,必须先添加搅拌工序!");
return;
}
//按钮点击
String title = "保存菜谱操作提示!";
String message = "请问客官确定要保存["+name+"]菜谱吗?";
@@ -643,6 +656,36 @@ public class DiyUpdateActivity extends BaseActivity {
}
}

/**
* 判断数据是否合法
*/
public boolean IsHotJ()
{
int index=0;
int k=0;int j=0;
for(BPA_GOODSRECIPE item:bpa_goodsrecipes)
{
if(item.processname.contains("搅拌") && k==0)
{
k=index;
}

if(item.processname.contains("加热") && j==0)
{
j=index;
}
index++;
}

if(j<=k)
{
return false;
}else
{
return true;
}
}

public void SetSelectPos(int index)
{
//移动光标


+ 2
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemCsMonitorFragment.java View File

@@ -24,6 +24,8 @@ import com.bonait.bnframework.modules.home.adapter.lc_adapter;
import com.bonait.bnframework.modules.home.adapter.monitor_adapter;
import com.orhanobut.logger.Logger;

import java.util.Random;

import butterknife.BindView;
import butterknife.ButterKnife;



Loading…
Cancel
Save