Browse Source

新分支推送

鸿鹄中学一拖二
pry 4 months ago
parent
commit
366a9e2f7e
3 changed files with 317 additions and 134 deletions
  1. +1
    -1
      .idea/deploymentTargetDropDown.xml
  2. +312
    -133
      app/src/main/java/com/bonait/bnframework/device_control.java
  3. +4
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/imagebuttom3.java

+ 1
- 1
.idea/deploymentTargetDropDown.xml View File

@@ -15,7 +15,7 @@
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2024-06-21T08:06:51.826118Z" />
<timeTargetWasSelectedWithDropDown value="2024-06-26T02:47:16.567878600Z" />
</State>
</entry>
</value>


+ 312
- 133
app/src/main/java/com/bonait/bnframework/device_control.java View File

@@ -213,44 +213,44 @@ public class device_control extends Dialog {
}
return true;
}
//
// private View.OnTouchListener Tounch=new View.OnTouchListener() {
// @Override
// public boolean onTouch(View view, MotionEvent motionEvent) {
// if(motionEvent.getAction() == MotionEvent.ACTION_DOWN){
// if(!FryingpanModbusHelper.getInstance().isConnect(DeviceNum)){
// DialogHelper.showError(activity,DeviceNum+"号炒锅设备未连接!", AlertDialogButton.OK,null);
// return false;
// }
// switch (view.getId()){
// case R.id.xiguoshui:
// if(!FryingpanModbusHelper.getInstance().getClearLocFeedback(DeviceNum)){
// DialogHelper.showWarn(activity,DeviceNum+"号炒锅锅口不在清洗位,不允许清洗!", AlertDialogButton.OK,null);
// return false;
// }
// break;
// case R.id.chushui:
// case R.id.yeliao1:
// case R.id.yeliao2:
// case R.id.yeliao3:
// if(!FryingpanModbusHelper.getInstance().getMaterialLocFeedback(DeviceNum)){
// DialogHelper.showWarn(activity,DeviceNum+"号炒锅锅口不在抽料位,不允许抽料!", AlertDialogButton.OK,null);
// return false;
// }
// break;
// }
// }
// if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
// InchingControl(view,true);
// } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
// InchingControl(view,false);
// }
// return false;
// }
// };

private View.OnTouchListener Tounch=new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if(motionEvent.getAction() == MotionEvent.ACTION_DOWN){
if(!FryingpanModbusHelper.getInstance().isConnect(DeviceNum)){
DialogHelper.showError(activity,DeviceNum+"号炒锅设备未连接!", AlertDialogButton.OK,null);
return false;
}
switch (view.getId()){
case R.id.xiguoshui:
if(!FryingpanModbusHelper.getInstance().getClearLocFeedback(DeviceNum)){
DialogHelper.showWarn(activity,DeviceNum+"号炒锅锅口不在清洗位,不允许清洗!", AlertDialogButton.OK,null);
return false;
}
break;
case R.id.chushui:
case R.id.yeliao1:
case R.id.yeliao2:
case R.id.yeliao3:
if(!FryingpanModbusHelper.getInstance().getMaterialLocFeedback(DeviceNum)){
DialogHelper.showWarn(activity,DeviceNum+"号炒锅锅口不在抽料位,不允许抽料!", AlertDialogButton.OK,null);
return false;
}
break;
}
}
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
InchingControl(view,true);
} else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
InchingControl(view,false);
}
return false;
}
};

private void InchingControl(View view,Boolean IsCheck){
switch (view.getId()){
private void InchingControl(int id,Boolean IsCheck){
switch (id){
case R.id.yeliao1:
FryingpanModbusHelper.getInstance().deviceControl(DeviceNum,ControlEnum.料仓1手动开关,IsCheck);
break;
@@ -269,6 +269,176 @@ public class device_control extends Dialog {
}
}

private void OnTouch1(int id,MotionEvent motionEvent){
if(motionEvent.getAction() == MotionEvent.ACTION_DOWN){
if(!FryingpanModbusHelper.getInstance().isConnect(DeviceNum)){
DialogHelper.showError(activity,DeviceNum+"号炒锅设备未连接!", AlertDialogButton.OK,null);
return ;
}
switch (id){
case R.id.xiguoshui:
if(!FryingpanModbusHelper.getInstance().getClearLocFeedback(DeviceNum)){
DialogHelper.showWarn(activity,DeviceNum+"号炒锅锅口不在清洗位,不允许清洗!", AlertDialogButton.OK,null);
return ;
}
break;
case R.id.chushui:
case R.id.yeliao1:
case R.id.yeliao2:
case R.id.yeliao3:
if(!FryingpanModbusHelper.getInstance().getMaterialLocFeedback(DeviceNum)){
DialogHelper.showWarn(activity,DeviceNum+"号炒锅锅口不在抽料位,不允许抽料!", AlertDialogButton.OK,null);
return ;
}
break;
}
}

if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
InchingControl(id,true);
} else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
InchingControl(id,false);
}
}

private void SetOnTounch(){
// chushui.SetOnTounch((View view, MotionEvent motionEvent)->{
// OnTouch1(R.id.chushui,motionEvent);
// return false;
// });
//
// xiguoshui.SetOnTounch((View view, MotionEvent motionEvent)->{
// OnTouch1(R.id.xiguoshui,motionEvent);
// return false;
// });
//
// yeliao1.SetOnTounch((View view, MotionEvent motionEvent)->{
// OnTouch1(R.id.yeliao1,motionEvent);
// return false;
// });
//
// yeliao2.SetOnTounch((View view, MotionEvent motionEvent)->{
// OnTouch1(R.id.yeliao2,motionEvent);
// return false;
// });
//
// yeliao3.SetOnTounch((View view, MotionEvent motionEvent)->{
// OnTouch1(R.id.yeliao3,motionEvent);
// return false;
// });


chushui.SetOnTounch(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if(motionEvent.getAction() == MotionEvent.ACTION_DOWN){
if(!FryingpanModbusHelper.getInstance().isConnect(DeviceNum)){
DialogHelper.showError(activity,DeviceNum+"号炒锅设备未连接!", AlertDialogButton.OK,null);
return false;
}
if(!FryingpanModbusHelper.getInstance().getMaterialLocFeedback(DeviceNum)){
DialogHelper.showWarn(activity,DeviceNum+"号炒锅锅口不在抽料位,不允许抽料!", AlertDialogButton.OK,null);
return false;
}
}

if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
InchingControl(R.id.chushui,true);
} else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
InchingControl(R.id.chushui,false);
}
return false;
}
});
xiguoshui.SetOnTounch(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if(motionEvent.getAction() == MotionEvent.ACTION_DOWN){
if(!FryingpanModbusHelper.getInstance().getClearLocFeedback(DeviceNum)){
DialogHelper.showWarn(activity,DeviceNum+"号炒锅锅口不在清洗位,不允许清洗!", AlertDialogButton.OK,null);
return false;
}
if(!FryingpanModbusHelper.getInstance().getMaterialLocFeedback(DeviceNum)){
DialogHelper.showWarn(activity,DeviceNum+"号炒锅锅口不在抽料位,不允许抽料!", AlertDialogButton.OK,null);
return false;
}
}
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
InchingControl(R.id.xiguoshui,true);
} else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
InchingControl(R.id.xiguoshui,false);
}
return false;
}
});
yeliao1.SetOnTounch(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if(motionEvent.getAction() == MotionEvent.ACTION_DOWN){
if(!FryingpanModbusHelper.getInstance().isConnect(DeviceNum)){
DialogHelper.showError(activity,DeviceNum+"号炒锅设备未连接!", AlertDialogButton.OK,null);
return false;
}
if(!FryingpanModbusHelper.getInstance().getMaterialLocFeedback(DeviceNum)){
DialogHelper.showWarn(activity,DeviceNum+"号炒锅锅口不在抽料位,不允许抽料!", AlertDialogButton.OK,null);
return false;
}
}

if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
InchingControl(R.id.yeliao1,true);
} else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
InchingControl(R.id.yeliao1,false);
}
return false;
}
});
yeliao2.SetOnTounch(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if(motionEvent.getAction() == MotionEvent.ACTION_DOWN){
if(!FryingpanModbusHelper.getInstance().isConnect(DeviceNum)){
DialogHelper.showError(activity,DeviceNum+"号炒锅设备未连接!", AlertDialogButton.OK,null);
return false;
}
if(!FryingpanModbusHelper.getInstance().getMaterialLocFeedback(DeviceNum)){
DialogHelper.showWarn(activity,DeviceNum+"号炒锅锅口不在抽料位,不允许抽料!", AlertDialogButton.OK,null);
return false;
}
}

if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
InchingControl(R.id.yeliao2,true);
} else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
InchingControl(R.id.yeliao2,false);
}
return false;
}
});
yeliao3.SetOnTounch(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if(motionEvent.getAction() == MotionEvent.ACTION_DOWN){
if(!FryingpanModbusHelper.getInstance().isConnect(DeviceNum)){
DialogHelper.showError(activity,DeviceNum+"号炒锅设备未连接!", AlertDialogButton.OK,null);
return false;
}
if(!FryingpanModbusHelper.getInstance().getMaterialLocFeedback(DeviceNum)){
DialogHelper.showWarn(activity,DeviceNum+"号炒锅锅口不在抽料位,不允许抽料!", AlertDialogButton.OK,null);
return false;
}
}

if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
InchingControl(R.id.yeliao3,true);
} else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
InchingControl(R.id.yeliao3,false);
}
return false;
}
});
}

/**
* 初始化TopBar
*/
@@ -290,15 +460,25 @@ public class device_control extends Dialog {
// touliao3.mListener = myClickListener;
// touliao4.mListener = myClickListener;

chushui.SetOnTounch(Tounch);
xiguoshui.SetOnTounch(Tounch);
yeliao1.SetOnTounch(Tounch);
yeliao2.SetOnTounch(Tounch);
yeliao3.SetOnTounch(Tounch);
SetOnTounch();

// chushui.setOnTouchListener();
// chushui.SetOnTounch(Tounch);
// chushui.SetOnTounch(Tounch);
// xiguoshui.SetOnTounch(Tounch);
// yeliao1.SetOnTounch(Tounch);
// yeliao2.SetOnTounch(Tounch);
// yeliao3.SetOnTounch(Tounch);

huoli.mListener = myClickListener;
chuchan.mListener = myClickListener;

yeliao1.setTag("未知");
yeliao1.Init();
yeliao2.setTag("未知");
yeliao2.Init();
yeliao3.setTag("未知");
yeliao3.Init();
MaterialSolicUpdate( FryingpanModbusHelper.getInstance().getMaterialName(DeviceNum));
}

@@ -320,13 +500,6 @@ public class device_control extends Dialog {
*/
private void initData() {
// SetStirFrySpeed(SpeedEnum.停, false);
yeliao1.setTag("未知");
yeliao1.Init();
yeliao2.setTag("未知");
yeliao2.Init();
yeliao3.setTag("未知");
yeliao3.Init();

if (ConfigName.getInstance().versionSelectionEnum.equals("大炒版本") || ConfigName.getInstance().versionSelectionEnum.contains("一拖")) {
touliao_k.setVisibility(View.GONE);
// touliao_m.setVisibility(View.GONE);
@@ -518,38 +691,7 @@ public class device_control extends Dialog {

}
};
//
// /**
// * 设置是否按下
// *
// * @param id
// * @param ismode
// */
// public void SetIDTouch(int id, boolean ismode) {
// switch (id) {
// case R.id.chushui:
// //PumpWater(ismode);
// Pumping(4, ismode);
// Log.e("锅内加水", ismode ? "按下" : "松开");
// break;
// case R.id.xiguoshui:
// PotWashingWater(ismode);
// Log.e("洗锅水枪", ismode ? "按下" : "松开");
// break;
// case R.id.yeliao1:
// Pumping(1, ismode);
// Log.e("液料1号", ismode ? "按下" : "松开");
// break;
// case R.id.yeliao2:
// Pumping(2, ismode);
// Log.e("液料2号", ismode ? "按下" : "松开");
// break;
// case R.id.yeliao3:
// Pumping(3, ismode);
// Log.e("液料3号", ismode ? "按下" : "松开");
// break;
// }
// }


/**
* 设置翻炒速度
@@ -663,6 +805,66 @@ public class device_control extends Dialog {
ToastUtils.warning("当前锅口朝向:" + mouth.name());
}


/**
* 设置火力
*
* @param data
*/
public void SetFire(int data) {
// ExecuteTheRecipe.Write_PLC_HuoLI((int) data);
if(!FryingpanModbusHelper.getInstance().isConnect(DeviceNum)){
DialogHelper.showError(activity,DeviceNum+"号炒锅设备未连接!", AlertDialogButton.OK,null);
return;
}
FryingpanModbusHelper.getInstance().setFire(DeviceNum,(short) data);
ToastUtils.warning("设置火力:" + data + "档");
}

/**
* 出餐
*
* @param
*/
public void GoOutToDinner() {
// ExecuteTheRecipe.BottomClick("出菜");
if(!verification())return;
FryingpanModbusHelper.getInstance().SelfResetControl(DeviceNum,MouthFacingEnum.出菜);
ToastUtils.warning("出餐");
}


// /**
// * 获取主料
// *
// * @param wz
// * @return
// */
// public BPA_GOODSRECIPE Get主料(int wz) {
// BPA_GOODSRECIPE pf = new BPA_GOODSRECIPE();
// pf.materialType = 1;
// pf.processname = "主料";
// pf.processms = "主料(未知," + wz + "号位,0,直接投出,0)";
// pf.processvalue = "主料名称,未知|主料位置," + wz + "号位|主料重量,0|投料动作,直接投出|烹饪(秒),0";
// return pf;
// }

// /**
// * 获取位置
// *
// * @param sd
// * @return
// */
// public BPA_GOODSRECIPE Get位置(String sd, String name) {
// BPA_GOODSRECIPE pf = new BPA_GOODSRECIPE();
// pf.materialType = 1;
// pf.processname = "位置";
// pf.processms = "位置(" + sd + "," + name + ",0)";
// pf.processvalue = "转动速度," + sd + "|位置动作," + name + "|延迟(秒),0";
// return pf;
// }


// /**
// * 抽水
// */
@@ -730,61 +932,38 @@ public class device_control extends Dialog {
// //ToastUtils.warning("料仓:" + num + "," + (isselectd ? "打开" : "关闭"));
// }

/**
* 设置火力
*
* @param data
*/
public void SetFire(int data) {
// ExecuteTheRecipe.Write_PLC_HuoLI((int) data);
if(!FryingpanModbusHelper.getInstance().isConnect(DeviceNum)){
DialogHelper.showError(activity,DeviceNum+"号炒锅设备未连接!", AlertDialogButton.OK,null);
return;
}
FryingpanModbusHelper.getInstance().setFire(DeviceNum,(short) data);
ToastUtils.warning("设置火力:" + data + "档");
}

/**
* 出餐
*
* @param
*/
public void GoOutToDinner() {
// ExecuteTheRecipe.BottomClick("出菜");
if(!verification())return;
FryingpanModbusHelper.getInstance().SelfResetControl(DeviceNum,MouthFacingEnum.出菜);
ToastUtils.warning("出餐");
}


//
// /**
// * 获取主料
// * 设置是否按下
// *
// * @param wz
// * @return
// * @param id
// * @param ismode
// */
// public BPA_GOODSRECIPE Get主料(int wz) {
// BPA_GOODSRECIPE pf = new BPA_GOODSRECIPE();
// pf.materialType = 1;
// pf.processname = "主料";
// pf.processms = "主料(未知," + wz + "号位,0,直接投出,0)";
// pf.processvalue = "主料名称,未知|主料位置," + wz + "号位|主料重量,0|投料动作,直接投出|烹饪(秒),0";
// return pf;
// public void SetIDTouch(int id, boolean ismode) {
// switch (id) {
// case R.id.chushui:
// //PumpWater(ismode);
// Pumping(4, ismode);
// Log.e("锅内加水", ismode ? "按下" : "松开");
// break;
// case R.id.xiguoshui:
// PotWashingWater(ismode);
// Log.e("洗锅水枪", ismode ? "按下" : "松开");
// break;
// case R.id.yeliao1:
// Pumping(1, ismode);
// Log.e("液料1号", ismode ? "按下" : "松开");
// break;
// case R.id.yeliao2:
// Pumping(2, ismode);
// Log.e("液料2号", ismode ? "按下" : "松开");
// break;
// case R.id.yeliao3:
// Pumping(3, ismode);
// Log.e("液料3号", ismode ? "按下" : "松开");
// break;
// }
// }

// /**
// * 获取位置
// *
// * @param sd
// * @return
// */
// public BPA_GOODSRECIPE Get位置(String sd, String name) {
// BPA_GOODSRECIPE pf = new BPA_GOODSRECIPE();
// pf.materialType = 1;
// pf.processname = "位置";
// pf.processms = "位置(" + sd + "," + name + ",0)";
// pf.processvalue = "转动速度," + sd + "|位置动作," + name + "|延迟(秒),0";
// return pf;
// }

}

+ 4
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/imagebuttom3.java View File

@@ -6,6 +6,7 @@ import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
@@ -13,7 +14,10 @@ import android.widget.TextView;

import androidx.annotation.Nullable;

import com.bonait.bnframework.HBL.Dialog.AlertDialogButton;
import com.bonait.bnframework.HBL.Dialog.DialogHelper;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.FryingpanModbusHelper;
import com.bonait.bnframework.common.helper.I.MyClickListener;

import butterknife.BindView;


Loading…
Cancel
Save