Browse Source

大炒调整

一拖四炒菜机
pry 1 year ago
parent
commit
269e63d7ec
5 changed files with 58 additions and 48 deletions
  1. +1
    -1
      app/src/main/java/com/bonait/bnframework/business/AddressData.java
  2. +37
    -16
      app/src/main/java/com/bonait/bnframework/business/ControlBase.java
  3. +9
    -2
      app/src/main/java/com/bonait/bnframework/business/DoubleFryingpanControl.java
  4. +1
    -1
      app/src/main/java/com/bonait/bnframework/common/modbus/ModbusMaster.java
  5. +10
    -28
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/DoubleFryingpanFragment.java

+ 1
- 1
app/src/main/java/com/bonait/bnframework/business/AddressData.java View File

@@ -53,7 +53,7 @@ public class AddressData {
public static int AddIngredientsRequest=10;

/**
* 炒锅强制结束信号
* 炒锅强制结束完成信号
*/
public static int FryingpanForceEnd=11;



+ 37
- 16
app/src/main/java/com/bonait/bnframework/business/ControlBase.java View File

@@ -212,6 +212,8 @@ public abstract class ControlBase {
MbSlave.WriteBoolean(GetAddress(num,AddressData.PutMainMaterial),false);//复位放主料完成
MbSlave.WriteBoolean(GetAddress(num,AddressData.PutAccessories),false);//复位放辅料完成
MbSlave.WriteBoolean(GetAddress(num,AddressData.RobotServingSpace),false);//复位机器人到达出餐位
MbSlave.WriteBoolean(GetAddress(num,AddressData.FryingpanForceEnd),false);//复位强制结束信号
MbSlave.WriteBoolean(GetAddress(num,AddressData.ForceEnd),false);//复位强制结束控制
MbSlave.WriteString(id,GetHoldAdd(num,0));//写入商品ID
MbSlave.WriteBoolean(GetAddress(num,AddressData.GoodDown),true);//写入商品下发
MessageLog.ShowUserMessage( UserLogEnum.订单处理日志 ,"写入的商品id"+id);
@@ -224,8 +226,23 @@ public abstract class ControlBase {
*/
protected boolean EndProcess(int num){
if(ForceEnd[num-1]||MbSlave.ReadBoolean(GetAddress(num,AddressData.FryingpanForceEnd))){
MbSlave.WriteBoolean(GetAddress(num,AddressData.ForceEnd),true);//强制结束
MbSlave.WriteBoolean(GetAddress(num,AddressData.FryingpanForceEnd),false);//复位炒锅强制结束信号
if( ForceEnd[num-1]){
MbSlave.WriteBoolean(GetAddress(num,AddressData.ForceEnd),true);//强制结束
}

long startTime=System.currentTimeMillis();
while(!MbSlave.ReadBoolean(GetAddress(num,AddressData.FryingpanForceEnd))&&(System.currentTimeMillis()-startTime)<=4000){
try {
Thread.sleep(100);
}catch (InterruptedException ex){

}
}

if(MbSlave.ReadBoolean(GetAddress(num,AddressData.FryingpanForceEnd))){
MbSlave.WriteBoolean(GetAddress(num,AddressData.FryingpanForceEnd),false);//复位强制结束信号
}

MessageLog.ShowUserMessage( UserLogEnum.订单处理日志 ,num+" 号炒锅取消任务");
if(FryingPan.containsKey(num))
RemoveId.add(num);
@@ -298,14 +315,16 @@ public abstract class ControlBase {
protected void RobotFeedingMainMaterials(short IngredientsLocs,short FryingPanNum){
try
{
MessageLog.ShowUserMessage( UserLogEnum.订单处理日志 ,"机器人从"+IngredientsLocs+"号主料位,放主料到"+FryingPanNum + "号锅");
ModbusMaster.get().WriteShort("GI0",IngredientsLocs,1,null);//写入机器人主任务,指定主料位置
ModbusMaster.get().WriteShort("GI1",FryingPanNum,1,null);//写入机器人子任务,指定炒锅位置
ModbusMaster.get().WriteBool(GetRobotAdd(FryingPanNum,0).toString(),true,1,null);//写入机器人允许放料信号
MessageLog.ShowUserMessage( UserLogEnum.订单处理日志 ,"等待机器人放菜完成");
while(!RobotData.FryingStatus.get(FryingPanNum).PutMaterialComplete&&!ForceEnd[FryingPanNum-1]){Thread.sleep(100); }//等待放主料完成
if(EndProcess(FryingPanNum))return;
MessageLog.ShowUserMessage( UserLogEnum.订单处理日志 ,"机器人放菜完成");
if(IngredientsLocs>0){
MessageLog.ShowUserMessage( UserLogEnum.订单处理日志 ,"机器人从"+IngredientsLocs+"号主料位,放主料到"+FryingPanNum + "号锅");
ModbusMaster.get().WriteShort("GI0",IngredientsLocs,1,null);//写入机器人主任务,指定主料位置
ModbusMaster.get().WriteShort("GI1",FryingPanNum,1,null);//写入机器人子任务,指定炒锅位置
ModbusMaster.get().WriteBool(GetRobotAdd(FryingPanNum,0).toString(),true,1,null);//写入机器人允许放料信号
MessageLog.ShowUserMessage( UserLogEnum.订单处理日志 ,"等待机器人放菜完成");
while(!RobotData.FryingStatus.get((int)FryingPanNum).PutMaterialComplete&&!ForceEnd[FryingPanNum-1]){Thread.sleep(100); }//等待放主料完成
if(EndProcess(FryingPanNum))return;
MessageLog.ShowUserMessage( UserLogEnum.订单处理日志 ,"机器人放菜完成");
}
MbSlave.WriteBoolean(GetAddress(FryingPanNum,AddressData.RobotPutIngredientsComplete),true);//机器人放主料完成
}
catch(InterruptedException ex){
@@ -323,10 +342,12 @@ public abstract class ControlBase {
{
MessageLog.ShowUserMessage( UserLogEnum.订单处理日志 ,"机器人从" +AccessoriesLoc+"号辅料位,放辅料到"+FryingPanNum + "号锅");
MbSlave.WriteBoolean(GetAddress(FryingPanNum,AddressData.FryingPanRequestAccessories),false);//复位投辅料请求信号
ModbusMaster.get().WriteShort("GI0",AccessoriesLoc,1,null);//写入机器人主任务,设置辅料位置
ModbusMaster.get().WriteShort("GI2",FryingPanNum,1,null);//写入机器人子任务,设置炒锅位置
MessageLog.ShowUserMessage( UserLogEnum.订单处理日志 ,"等待机器人倒调料完成");
while(!RobotData.FryingStatus.get(FryingPanNum).FallSeasoningComplete&&!ForceEnd[FryingPanNum-1]){Thread.sleep(100);}//等待机器人倒调料完成
if(AccessoriesLoc-10>0){
ModbusMaster.get().WriteShort("GI0",AccessoriesLoc,1,null);//写入机器人主任务,设置辅料位置
ModbusMaster.get().WriteShort("GI2",FryingPanNum,1,null);//写入机器人子任务,设置炒锅位置
MessageLog.ShowUserMessage( UserLogEnum.订单处理日志 ,"等待机器人倒调料完成");
while(!RobotData.FryingStatus.get((int)FryingPanNum).FallSeasoningComplete&&!ForceEnd[FryingPanNum-1]){Thread.sleep(100);}//等待机器人倒调料完成
}
MbSlave.WriteString(GetHoldAdd(FryingPanNum,0));//复位商品id
if(EndProcess(FryingPanNum))return;
MessageLog.ShowUserMessage( UserLogEnum.订单处理日志 ,"机器人倒调料完成");
@@ -363,7 +384,7 @@ public abstract class ControlBase {
{
MessageLog.ShowUserMessage( UserLogEnum.订单处理日志 ,"等待机器人到"+FryingPanNum+"号炒锅位置");
//等待机器人到达炒锅位置
while(!RobotData.FryingStatus.get(FryingPanNum).RequestDiningOut&&!ForceEnd[FryingPanNum-1]){Thread.sleep(100);}
while(!RobotData.FryingStatus.get((int)FryingPanNum).RequestDiningOut&&!ForceEnd[FryingPanNum-1]){Thread.sleep(100);}
if(EndProcess(FryingPanNum))return;
MessageLog.ShowUserMessage( UserLogEnum.订单处理日志 ,"机器人到"+FryingPanNum+"号炒锅位置");
MbSlave.WriteBoolean(GetAddress(FryingPanNum,AddressData.RobotServingSpace),true);//通知炒锅,机器人到达出餐位
@@ -385,7 +406,7 @@ public abstract class ControlBase {
ModbusMaster.get().WriteBool(GetRobotAdd(FryingPanNum,2).toString(),true,1,null);
MessageLog.ShowUserMessage( UserLogEnum.订单处理日志 ,"等待机器人出餐完成");
//等待机器人出餐完成
while(!RobotData.FryingStatus.get(FryingPanNum).DiningOutComplete&&!ForceEnd[FryingPanNum-1]){Thread.sleep(100);}
while(!RobotData.FryingStatus.get((int)FryingPanNum).DiningOutComplete&&!ForceEnd[FryingPanNum-1]){Thread.sleep(100);}
if(EndProcess(FryingPanNum)) return;
MessageLog.ShowUserMessage( UserLogEnum.订单处理日志 ,"机器人出餐完成");
MbSlave.WriteBoolean(GetAddress(FryingPanNum,AddressData.RequestingMeaDelivery),false);; //复位炒菜完成,出餐请求


+ 9
- 2
app/src/main/java/com/bonait/bnframework/business/DoubleFryingpanControl.java View File

@@ -73,8 +73,15 @@ public class DoubleFryingpanControl extends ControlBase {
RobotData.FryingStatus.get(2).DiningOutComplete=value[3];
});

// RobotData.RobotIdle=RobotData.RobotHome&&RobotData.RobotTaskFeedback==0;//机器人空闲状态
RobotData.RobotIdle=true;//机器人空闲状态
RobotData.RobotIdle=RobotData.RobotHome&&RobotData.RobotTaskFeedback==0;//机器人空闲状态
// RobotData.RobotIdle=true;//机器人空闲状态

// for(int i=1;i<=2;i++){
// if(!ForceEnd[i-1]&& MbSlave.ReadBoolean(GetAddress(i,AddressData.FryingpanForceEnd)) ) {
// SetForceEnd(i);
// MbSlave.WriteBoolean(GetAddress(i,AddressData.FryingpanForceEnd),false);
// }
// }

}



+ 1
- 1
app/src/main/java/com/bonait/bnframework/common/modbus/ModbusMaster.java View File

@@ -115,7 +115,7 @@ public class ModbusMaster implements IRead,IWrite,IModbusMaster {

private void ReConnect(String error){
if(ConnectionType==1){
if(error.contains("Connection refused")){
if(error.contains("Connection refused")||error.contains("SocketException")){
IsConnected=false;
TcpConnect(TempIp,TempPort,null);
}


+ 10
- 28
app/src/main/java/com/bonait/bnframework/modules/home/fragment/DoubleFryingpanFragment.java View File

@@ -156,25 +156,6 @@ public class DoubleFryingpanFragment extends BaseFragment {
if (msg.obj.toString()== "MSG_REFRESH") {
if(ConfigName.getInstance().cloudGoods!=null && ConfigName.getInstance().cloudGoods.size()>0)
{
// getActivity().runOnUiThread(new Runnable() {
// @Override
// public void run(){
// ArrayList<BPA_GOODS> goods= QueryDB.GetGoodsALL();
// ArrayList<BPA_GOODSRECIPE> rec= QueryDB.GetGoodsSrecipeALL();
// for (BPA_GOODS good:goods)
// {
// QueryDB.DeleteGoods(good);
// }
// for (BPA_GOODSRECIPE pf:rec)
// {
// QueryDB.DeleteGoodsSrecipe(pf);
// }
// for (CloudGood item : ConfigName.getInstance().cloudGoods) {
// ConfigData.getInstance().GetGoodProcess(getContext(),item.id,false);
// }
// }
// });

ArrayList<BPA_GOODS> goods= QueryDB.GetGoodsALL();
ArrayList<BPA_GOODSRECIPE> rec= QueryDB.GetGoodsSrecipeALL();
for (BPA_GOODS good:goods)
@@ -334,15 +315,16 @@ public class DoubleFryingpanFragment extends BaseFragment {
if (msg != null) {
BPA_GOODS goods = (BPA_GOODS) msg;
fry.GoodID= goods.id;
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if(!getActivity().isFinishing()){
OpenParSet();
}

}
});
OpenParSet();
// getActivity().runOnUiThread(new Runnable() {
// @Override
// public void run() {
// if(!getActivity().isFinishing()){
//
// }
//
// }
// });

}
}


Loading…
Cancel
Save