Просмотр исходного кода

温度控制

tags/old_version_1
fyf 1 год назад
Родитель
Сommit
9f314b7ddb
8 измененных файлов: 155 добавлений и 6 удалений
  1. +2
    -1
      app/src/main/java/com/bonait/bnframework/business/ConfigData.java
  2. +6
    -1
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  3. +14
    -0
      app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
  4. +45
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home1Fragment.java
  5. +2
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyMemoryActivity.java
  6. +12
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSystemsetFragment.java
  7. +55
    -4
      app/src/main/res/layout/fragment_home1.xml
  8. +19
    -0
      app/src/main/res/layout/fragment_system_systemset.xml

+ 2
- 1
app/src/main/java/com/bonait/bnframework/business/ConfigData.java Просмотреть файл

@@ -241,7 +241,7 @@ public class ConfigData {
ConfigName.getInstance().IsUserDownOrder = ConfigUtil.read(ConfigName.getInstance().dishesCon, "IsUserDownOrder", ConfigName.getInstance().IsUserDownOrder);
ConfigName.getInstance().Version = ConfigUtil.read(ConfigName.getInstance().dishesCon, "Version", ConfigName.getInstance().Version);
ConfigName.getInstance().HuoLi = ConfigUtil.read(ConfigName.getInstance().dishesCon, "HuoLi", ConfigName.getInstance().HuoLi);
ConfigName.getInstance().MaxTemp = ConfigUtil.read(ConfigName.getInstance().dishesCon, "MaxTemp", ConfigName.getInstance().MaxTemp);
}

/**
@@ -257,6 +257,7 @@ public class ConfigData {
ConfigUtil.write(ConfigName.getInstance().dishesCon, "IsUserDownOrder", ConfigName.getInstance().IsUserDownOrder);
ConfigUtil.write(ConfigName.getInstance().dishesCon, "Version", ConfigName.getInstance().Version);
ConfigUtil.write(ConfigName.getInstance().dishesCon, "HuoLi", ConfigName.getInstance().HuoLi);
ConfigUtil.write(ConfigName.getInstance().dishesCon, "MaxTemp", ConfigName.getInstance().MaxTemp);
}

/**


+ 6
- 1
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java Просмотреть файл

@@ -628,8 +628,10 @@ public class ExecuteTheRecipe {
@Override
public void onSuccess() {
if (writeValue == 0) {
ConfigName.getInstance().IsOpenHuoLi= false;
WritePLC("加热", false, null);
} else {
ConfigName.getInstance().IsOpenHuoLi= true;
WritePLC("加热", true, null);
}
}
@@ -784,12 +786,13 @@ public class ExecuteTheRecipe {
@Override
public void onSuccess() {
if (data == 0) {
ConfigName.getInstance().IsOpenHuoLi= false;
WritePLC("加热", false, null);
} else {
ConfigName.getInstance().IsOpenHuoLi= true;
WritePLC("加热", true, null);
}
}

@Override
public void onFailure(String ErrorMsg) {
}
@@ -820,6 +823,8 @@ public class ExecuteTheRecipe {
WritePLC("初始化",true,null);
Thread.sleep(500);
WritePLC("初始化",false,null);

ExecuteTheRecipe.WritePLC("温控开关", false, null);//开关闭合
} catch (InterruptedException e) {
ToastUtils.info("异常信息:" + e.getMessage());
}


+ 14
- 0
app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java Просмотреть файл

@@ -251,6 +251,7 @@ public class ConfigName {
//加热模型
add(new Res_PLCADDRESS("加热", "M10.6", 0, 1));
add(new Res_PLCADDRESS("加热功率", "VW100", 1, 1));
add(new Res_PLCADDRESS("温控开关", "M17.6", 1, 1));

//主料
add(new Res_PLCADDRESS("主料", "M17.4", 0, 1));
@@ -400,6 +401,7 @@ public class ConfigName {
//加热模型
add(new Res_PLCADDRESS("加热", "M10.6", 0, 1));
add(new Res_PLCADDRESS("加热功率", "VW100", 1, 1));
add(new Res_PLCADDRESS("温控开关", "M17.6", 1, 1));

//主料
add(new Res_PLCADDRESS("主料", "M17.4", 0, 1));
@@ -608,6 +610,7 @@ public class ConfigName {
//加热模型
add(new Res_PLCADDRESS("加热", "M10.6", 0, 1));
add(new Res_PLCADDRESS("加热功率", "VW100", 1, 1));
add(new Res_PLCADDRESS("温控开关", "M17.6", 1, 1));

//主料
add(new Res_PLCADDRESS("主料", "M17.4", 0, 1));
@@ -856,7 +859,18 @@ public class ConfigName {


//region 火力最大级别
/**
* 最大火力级别
*/
public String HuoLi="八档";
/**
* 最大温度:默认温度
*/
public int MaxTemp=200;
/**
* 是否打开火力
*/
public boolean IsOpenHuoLi=false;
//endregion
/**
* 炒锅状态上报信息


+ 45
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home1Fragment.java Просмотреть файл

@@ -73,6 +73,7 @@ import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;

import butterknife.BindView;
import butterknife.ButterKnife;
@@ -123,6 +124,10 @@ public class Home1Fragment extends BaseFragment {
@BindView(R.id.btn_zhuandong_control_Rift)
Button btn_zhuandong_control_Rift;//


@BindView(R.id.wk_zhuangtai)
QMUILinkTextView wk_zhuangtai;//

/**
* 商品是否开始制作
*/
@@ -522,6 +527,7 @@ public class Home1Fragment extends BaseFragment {

ExecuteTheRecipe.WritePLC("搅拌", false, null);
ExecuteTheRecipe.WritePLC("加热", false, null);
ConfigName.getInstance().IsOpenHuoLi= false;
ExecuteTheRecipe.BottomClick("平移-去1号位");
gongxuIndex = 10000;
MakeCipe = null;
@@ -667,6 +673,10 @@ public class Home1Fragment extends BaseFragment {
}).start();
}

/**
* 温控开关 true 断开 false 闭合
*/
public boolean TempBool=false;
/**
* 刷新UI界面
*/
@@ -681,9 +691,44 @@ public class Home1Fragment extends BaseFragment {
// Object val_jbpl = ExecuteTheRecipe.getListingValue("搅拌频率");
// Object val_fzpv = ExecuteTheRecipe.getListingValue("翻转频率");

//Object val_wd =new Random().nextInt(250);
if (val_wd != null) {
int dq_wd= (int)val_wd;//当前锅底温度
if(dq_wd>=(ConfigName.getInstance().MaxTemp-5)) //如果当前温度大于最大温度限制 断开
{
TempBool=true;//设置断开
}else if(dq_wd<=(ConfigName.getInstance().MaxTemp-20))//需要闭合
{
TempBool=false;//闭合
}

if(ConfigName.getInstance().PlcIsConnect)
{
Object tempkg= ExecuteTheRecipe.ReadPLC("温控开关");
if(tempkg!=null)
{
boolean kg=(boolean) tempkg;
if(TempBool) //设置断开
{
if(kg==false)
{
ExecuteTheRecipe.WritePLC("温控开关", true, null);//断开
}
}else //设置闭合
{
if(kg)
{
ExecuteTheRecipe.WritePLC("温控开关", false, null);//闭合
}
}
}
}
wk_zhuangtai.setText(TempBool?"断开":"闭合");
wk_zhuangtai.setTextColor(TempBool?Color.parseColor("#F44336"):Color.parseColor("#01675B"));
chaoguo_wendu.setText(val_wd + "");
} else {
wk_zhuangtai.setText("闭合");
wk_zhuangtai.setTextColor(Color.parseColor("#01675B"));
chaoguo_wendu.setText("未知");
}



+ 2
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyMemoryActivity.java Просмотреть файл

@@ -19,6 +19,7 @@ import android.widget.LinearLayout;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.common.base.BaseActivity;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.constant.MessageName;
import com.bonait.bnframework.common.db.QueryDB;
@@ -651,6 +652,7 @@ public class DiyMemoryActivity extends BaseActivity {

ExecuteTheRecipe.WritePLC("搅拌", false, null);
ExecuteTheRecipe.WritePLC("加热", false, null);
ConfigName.getInstance().IsOpenHuoLi= false;
ExecuteTheRecipe.BottomClick("平移-去1号位");
}
});


+ 12
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSystemsetFragment.java Просмотреть файл

@@ -52,6 +52,8 @@ public class SystemSystemsetFragment extends BaseFragment {
@BindView(R.id.HuoLi)
Spinner HuoLi;

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

ArrayList<EditText> editTextLists = new ArrayList<>();
Map<String, Integer> material_map = new LinkedHashMap<>();
@@ -158,6 +160,8 @@ public class SystemSystemsetFragment extends BaseFragment {

}
}

edittext_wd.setText(ConfigName.getInstance().MaxTemp+"");
}

/**
@@ -227,6 +231,14 @@ public class SystemSystemsetFragment extends BaseFragment {
if (isgb) {
ConfigData.getInstance().RevertPLCProcess();
}


ConfigName.getInstance().HuoLi=HuoLi.getSelectedItem().toString();
if(!edittext_wd.getText().toString().isEmpty())
{
ConfigName.getInstance().MaxTemp=Integer.parseInt(edittext_wd.getText().toString());
}
ConfigData.getInstance().SavePZ();
ToastUtils.info("保存成功");
break;



+ 55
- 4
app/src/main/res/layout/fragment_home1.xml Просмотреть файл

@@ -6,11 +6,13 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/app_color_theme_4">

<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/qmui_topbar_height"
android:background="@color/activity_background">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
@@ -52,7 +54,7 @@
android:layout_centerInParent="true"
android:clickable="false"
android:text="选择菜谱"
android:textSize="16dp"/>
android:textSize="16dp" />
</RelativeLayout>

</LinearLayout>
@@ -617,6 +619,7 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true">

<Button
android:id="@+id/ydw"
android:layout_width="60dp"
@@ -632,12 +635,14 @@
android:layout_height="match_parent"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp">

<LinearLayout
android:layout_width="1dp"
android:layout_height="30dp"
android:layout_centerInParent="true"
android:background="@color/activity_background" />
</RelativeLayout>

<Button
android:id="@+id/dcw"
android:layout_width="60dp"
@@ -661,6 +666,7 @@
android:layout_centerInParent="true"
android:background="@color/activity_background" />
</RelativeLayout>

<Button
android:id="@+id/clw"
android:layout_width="60dp"
@@ -684,6 +690,7 @@
android:layout_centerInParent="true"
android:background="@color/activity_background" />
</RelativeLayout>

<Button
android:id="@+id/qxw"
android:layout_width="60dp"
@@ -707,6 +714,7 @@
android:layout_centerInParent="true"
android:background="@color/activity_background" />
</RelativeLayout>

<Button
android:id="@+id/ccw1"
android:layout_width="60dp"
@@ -730,6 +738,7 @@
android:layout_centerInParent="true"
android:background="@color/activity_background" />
</RelativeLayout>

<Button
android:id="@+id/ccw2"
android:layout_width="60dp"
@@ -753,6 +762,7 @@
android:layout_centerInParent="true"
android:background="@color/activity_background" />
</RelativeLayout>

<Button
android:id="@+id/ccw3"
android:layout_width="60dp"
@@ -921,7 +931,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="炒锅当前位置"
android:text="炒锅位置"
android:textSize="16dp" />
</RelativeLayout>

@@ -962,7 +972,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="硬件状态"
android:text="硬件"
android:textSize="16dp" />
</RelativeLayout>

@@ -987,6 +997,47 @@
<!-- android:text="未连接"/>-->
</RelativeLayout>

<!--边框分割细线-->
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp">

<LinearLayout
android:layout_width="1dp"
android:layout_height="50dp"
android:layout_centerInParent="true"
android:background="@color/activity_background" />
</RelativeLayout>

<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">

<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="温控开关"
android:textSize="16dp" />
</RelativeLayout>

<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_10">

<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:id="@+id/wk_zhuangtai"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="闭合"
android:textColor="#F44336"
android:textSize="20dp" />
</RelativeLayout>

</LinearLayout>
</LinearLayout>
</RelativeLayout>
@@ -995,6 +1046,6 @@
<com.qmuiteam.qmui.widget.QMUITopBarLayout
android:id="@+id/topbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content" />

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

+ 19
- 0
app/src/main/res/layout/fragment_system_systemset.xml Просмотреть файл

@@ -151,6 +151,25 @@
android:layout_width="80dp"
android:layout_height="24dp"
android:layout_centerVertical="true" />

<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_marginLeft="@dimen/dp_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text="锅低最大温度:" />
<EditText
android:id="@+id/edittext_wd"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:background="@drawable/input_bj"
android:hint="请输入温度"
android:inputType="number"
android:maxLines="1"
android:padding="3dp"
android:textSize="12dp"
android:text="0"/>
</TableRow>
</TableLayout>



Загрузка…
Отмена
Сохранить