|
|
@@ -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);; //复位炒菜完成,出餐请求 |
|
|
|