|
|
@@ -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 |
|
|
|
} |