Browse Source

Merge remote-tracking branch 'origin/燃气自翻炒锅' into 燃气自翻炒锅

燃气自翻炒锅
pry 11 months ago
parent
commit
4a3f5d1f4e
2 changed files with 226 additions and 31 deletions
  1. +204
    -22
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/MakeGoodFragment.java
  2. +22
    -9
      app/src/main/res/layout/fragment_make_good.xml

+ 204
- 22
app/src/main/java/com/bonait/bnframework/modules/home/fragment/MakeGoodFragment.java View File

@@ -47,6 +47,7 @@ import com.bonait.bnframework.modules.home.adapter.devicestatus_adapter;
import com.bonait.bnframework.modules.home.adapter.liaochang_adapter;
import com.bonait.bnframework.modules.home.fragment.from.CpxzActivity;
import com.capton.colorfulprogressbar.ColorfulProgressbar;
import com.litao.slider.NiftySlider;
import com.qmuiteam.qmui.widget.QMUITopBarLayout;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;
@@ -100,6 +101,12 @@ public class MakeGoodFragment extends BaseFragment {
@BindView(R.id.gongxumiaoshu)
TextView gongxumiaoshu;//工序描述

@BindView(R.id.main_weight)
TextView main_weight;

@BindView(R.id.main_temp)
TextView main_temp;

/**
* 当前制作商品信息
*/
@@ -314,25 +321,38 @@ public class MakeGoodFragment extends BaseFragment {
ExecuteTheRecipe.WritePLC("点火启动开关", isChecked);
break;

case R.id.switch_小火:
ExecuteTheRecipe.WritePLC("小火开关(一圈)", isChecked);
break;
case R.id.switch_中火:
ExecuteTheRecipe.WritePLC("中火开关(二圈)", isChecked);
break;
case R.id.switch_大火:
ExecuteTheRecipe.WritePLC("大火开关(三圈)", isChecked);
break;
case R.id.switch_强火:
ExecuteTheRecipe.WritePLC("强火开关(四圈)", isChecked);
break;

}
}
};

public View.OnTouchListener touchListener=new View.OnTouchListener() {
public View.OnTouchListener touchListener = new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
boolean IsChick=false;
boolean IsChick = false;
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
Log.e("鼠标", "按下: ");
IsChick=true;
IsChick = true;
} else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
Log.e("鼠标", "松开: ");
IsChick=false;
IsChick = false;
}

switch (view.getId()) {
case R.id.button_搅拌点动:
ExecuteTheRecipe.WritePLC("搅拌点动开关",IsChick);
ExecuteTheRecipe.WritePLC("搅拌点动开关", IsChick);
break;
}
return false;
@@ -547,6 +567,24 @@ public class MakeGoodFragment extends BaseFragment {
}
});
}

/**
* 设置显示变量
*
* @param image
* @param val
*/
public void SetImageViewUrl(ImageView image, Object val, int index) {
if (val == null) {
image.setImageResource(R.mipmap.status_y);
} else {
if (index == 1) {
image.setImageResource((boolean) val ? R.mipmap.status_z : R.mipmap.status_y);
} else {
image.setImageResource((!(boolean) val) ? R.mipmap.status_z : R.mipmap.status_y);
}
}
}
//endregion

//region 设备监控状态
@@ -698,7 +736,6 @@ public class MakeGoodFragment extends BaseFragment {
}
}).start();


//刷新UI监控
new Thread(new Runnable() {
@Override
@@ -724,8 +761,21 @@ public class MakeGoodFragment extends BaseFragment {
Object zl = ExecuteTheRecipe.ReadPLC("炒锅当前重量");
if (zl != null) {
PanWeight.setText(zl + "");
main_weight.setText(zl + "");
}

//读取温度
Object temp = ExecuteTheRecipe.ReadPLC("炒锅当前温度");
if (temp != null) {
main_temp.setText(temp + "");
}

SetImageViewUrl(image_搅拌上升, ExecuteTheRecipe.ReadPLC("监控_搅拌上限"), 1);
SetImageViewUrl(image_搅拌下降, ExecuteTheRecipe.ReadPLC("监控_搅拌下限"), 1);

SetImageViewUrl(image_锅后仰, ExecuteTheRecipe.ReadPLC("监控_锅后限位"), 1);
SetImageViewUrl(image_锅前倾, ExecuteTheRecipe.ReadPLC("监控_锅后限位"), 0);

getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
@@ -742,20 +792,27 @@ public class MakeGoodFragment extends BaseFragment {
}
}).start();

//初始化读取PLC数据


//接收暂停计时器
ExecuteTheRecipe.NoticeHandSuspension = new IRunT() {
@Override
public void Run(Object o) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if ((boolean) o) {
onRecordPause();
} else {
onRecordPauseStart();

Activity ac = getActivity();
if (ac != null) {
ac.runOnUiThread(new Runnable() {
@Override
public void run() {
if ((boolean) o) {
onRecordPause();
} else {
onRecordPauseStart();
}
}
}
});
});
}
}
};
}
@@ -801,12 +858,14 @@ public class MakeGoodFragment extends BaseFragment {

@BindView(R.id.image_锅后仰)
ImageView image_锅后仰;

/**
* 初始化弹窗
*/
public void Init_弹窗() {
Init_弹窗_事件();
Init_弹窗_物料();
Init_火力();
}

/**
@@ -821,18 +880,23 @@ public class MakeGoodFragment extends BaseFragment {
switch_备用气缸.setOnCheckedChangeListener(checkedChangeListener);

switch_点火控制.setOnCheckedChangeListener(checkedChangeListener);

switch_小火.setOnCheckedChangeListener(checkedChangeListener);
switch_中火.setOnCheckedChangeListener(checkedChangeListener);
switch_大火.setOnCheckedChangeListener(checkedChangeListener);
switch_强火.setOnCheckedChangeListener(checkedChangeListener);

editsp_点火模式.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
String name =editsp_点火模式.getSelectedItem().toString();
if(name.equals("手动"))
{
ExecuteTheRecipe.WritePLC("点火手自动切换开关",true);
}else
{
ExecuteTheRecipe.WritePLC("点火手自动切换开关",false);
String name = editsp_点火模式.getSelectedItem().toString();
if (name.equals("手动")) {
ExecuteTheRecipe.WritePLC("点火手自动切换开关", true);
} else {
ExecuteTheRecipe.WritePLC("点火手自动切换开关", false);
}
}

@Override
public void onNothingSelected(AdapterView<?> adapterView) {

@@ -873,5 +937,123 @@ public class MakeGoodFragment extends BaseFragment {
ms.add("自动");
SetAdapter(editsp_点火模式, ms);
}


@BindView(R.id.edit_温度修正)
EditText edit_温度修正;//edit_温度修正

@BindView(R.id.edit_温度上限)
EditText edit_温度上限;//edit_温度上限

@BindView(R.id.slider_小火)
NiftySlider slider_小火;

@BindView(R.id.slider_中火)
NiftySlider slider_中火;

@BindView(R.id.slider_大火)
NiftySlider slider_大火;

@BindView(R.id.slider_强火)
NiftySlider slider_强火;

@BindView(R.id.switch_小火)
SwitchButton switch_小火;

@BindView(R.id.switch_中火)
SwitchButton switch_中火;

@BindView(R.id.switch_大火)
SwitchButton switch_大火;

@BindView(R.id.switch_强火)
SwitchButton switch_强火;

/**
* 初始化火力
*/
public void Init_火力() {
slider_小火.setOnValueChangeListener(new NiftySlider.OnValueChangeListener() {
@Override
public void onValueChange(@NonNull NiftySlider niftySlider, float v, boolean b) {
slider_小火.setThumbText((int) v + "");
}
});
slider_中火.setOnValueChangeListener(new NiftySlider.OnValueChangeListener() {
@Override
public void onValueChange(@NonNull NiftySlider niftySlider, float v, boolean b) {
slider_中火.setThumbText((int) v + "");
}
});
slider_大火.setOnValueChangeListener(new NiftySlider.OnValueChangeListener() {
@Override
public void onValueChange(@NonNull NiftySlider niftySlider, float v, boolean b) {
slider_大火.setThumbText((int) v + "");
}
});
slider_强火.setOnValueChangeListener(new NiftySlider.OnValueChangeListener() {
@Override
public void onValueChange(@NonNull NiftySlider niftySlider, float v, boolean b) {
slider_强火.setThumbText((int) v + "");
}
});


slider_小火.setOnSliderTouchListener(new NiftySlider.OnSliderTouchListener() {
@Override
public void onStartTrackingTouch(@NonNull NiftySlider niftySlider) {

}

@Override
public void onStopTrackingTouch(@NonNull NiftySlider niftySlider) {
int temp = (int) slider_小火.getValue();
ExecuteTheRecipe.WritePLC("小火比例阀开度", temp);
ToastUtils.info("小火比例阀开度:" + temp);
}
});

slider_中火.setOnSliderTouchListener(new NiftySlider.OnSliderTouchListener() {
@Override
public void onStartTrackingTouch(@NonNull NiftySlider niftySlider) {

}

@Override
public void onStopTrackingTouch(@NonNull NiftySlider niftySlider) {
int temp = (int) slider_中火.getValue();
ExecuteTheRecipe.WritePLC("中火比例阀开度", temp);
ToastUtils.info("中火比例阀开度:" + temp);
}
});

slider_大火.setOnSliderTouchListener(new NiftySlider.OnSliderTouchListener() {
@Override
public void onStartTrackingTouch(@NonNull NiftySlider niftySlider) {

}

@Override
public void onStopTrackingTouch(@NonNull NiftySlider niftySlider) {
int temp = (int) slider_大火.getValue();
ExecuteTheRecipe.WritePLC("大火比例阀开度", temp);
ToastUtils.info("大火比例阀开度:" + temp);
}
});

slider_强火.setOnSliderTouchListener(new NiftySlider.OnSliderTouchListener() {
@Override
public void onStartTrackingTouch(@NonNull NiftySlider niftySlider) {

}

@Override
public void onStopTrackingTouch(@NonNull NiftySlider niftySlider) {
int temp = (int) slider_强火.getValue();
ExecuteTheRecipe.WritePLC("强火比例阀开度", temp);
ToastUtils.info("强火比例阀开度:" + temp);
}
});
}
//endregion
}

+ 22
- 9
app/src/main/res/layout/fragment_make_good.xml View File

@@ -29,6 +29,7 @@
android:src="@mipmap/cgtp" />

<TextView
android:id="@+id/main_weight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="80dp"
@@ -39,6 +40,7 @@
android:textStyle="bold" />

<TextView
android:id="@+id/main_temp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
@@ -413,7 +415,6 @@
android:background="#BD25323F"
android:focusable="true"
android:clickable="true"
android:visibility="gone"
>
<RelativeLayout
android:layout_centerInParent="true"
@@ -463,7 +464,7 @@
android:id="@+id/editsp_点火模式"
style="@style/commonSpinnerStyle"
android:layout_width="80dp"
android:layout_height="24dp"
android:layout_height="34dp"
android:layout_centerVertical="true" />
</LinearLayout>

@@ -503,6 +504,7 @@
</RelativeLayout>

<com.litao.slider.NiftySlider
android:id="@+id/slider_小火"
android:layout_width="340dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
@@ -511,7 +513,7 @@
android:stepSize="1"
android:value="0"
android:valueFrom="0"
android:valueTo="60"
android:valueTo="100"
app:enableDrawHalo="false"
app:thumbColor="@color/we_read_thumb_color"
app:thumbRadius="11dp"
@@ -533,6 +535,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<com.suke.widget.SwitchButton
android:id="@+id/switch_小火"
android:layout_marginLeft="20dp"
app:sb_uncheck_color="@color/app_color_blue"
app:sb_uncheckcircle_color="@color/app_color_blue"
@@ -559,11 +562,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="火控制:"
android:text="火控制:"
android:textSize="19dp"/>
</RelativeLayout>

<com.litao.slider.NiftySlider
android:id="@+id/slider_中火"

android:layout_width="340dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
@@ -572,7 +577,7 @@
android:stepSize="1"
android:value="0"
android:valueFrom="0"
android:valueTo="60"
android:valueTo="100"
app:enableDrawHalo="false"
app:thumbColor="@color/we_read_thumb_color"
app:thumbRadius="11dp"
@@ -594,6 +599,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<com.suke.widget.SwitchButton
android:id="@+id/switch_中火"

android:layout_marginLeft="20dp"
app:sb_uncheck_color="@color/app_color_blue"
app:sb_uncheckcircle_color="@color/app_color_blue"
@@ -620,11 +627,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="火控制:"
android:text="火控制:"
android:textSize="19dp"/>
</RelativeLayout>

<com.litao.slider.NiftySlider
android:id="@+id/slider_大火"

android:layout_width="340dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
@@ -633,7 +642,7 @@
android:stepSize="1"
android:value="0"
android:valueFrom="0"
android:valueTo="60"
android:valueTo="100"
app:enableDrawHalo="false"
app:thumbColor="@color/we_read_thumb_color"
app:thumbRadius="11dp"
@@ -655,6 +664,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<com.suke.widget.SwitchButton
android:id="@+id/switch_大火"

android:layout_marginLeft="20dp"
app:sb_uncheck_color="@color/app_color_blue"
app:sb_uncheckcircle_color="@color/app_color_blue"
@@ -681,11 +692,12 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="火控制:"
android:text="火控制:"
android:textSize="19dp"/>
</RelativeLayout>

<com.litao.slider.NiftySlider
android:id="@+id/slider_强火"
android:layout_width="340dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
@@ -694,7 +706,7 @@
android:stepSize="1"
android:value="0"
android:valueFrom="0"
android:valueTo="60"
android:valueTo="100"
app:enableDrawHalo="false"
app:thumbColor="@color/we_read_thumb_color"
app:thumbRadius="11dp"
@@ -716,6 +728,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<com.suke.widget.SwitchButton
android:id="@+id/switch_强火"
android:layout_marginLeft="20dp"
app:sb_uncheck_color="@color/app_color_blue"
app:sb_uncheckcircle_color="@color/app_color_blue"


Loading…
Cancel
Save