Ver a proveniência

MORKT 修改

样式分支
NXX há 2 anos
ascendente
cometimento
464d0614a8
2 ficheiros alterados com 280 adições e 4 eliminações
  1. +276
    -0
      BPASmartClient.MorkT/Control_MorkT.cs
  2. +4
    -4
      BPASmartClient/App.config

+ 276
- 0
BPASmartClient.MorkT/Control_MorkT.cs Ver ficheiro

@@ -174,6 +174,282 @@ namespace BPASmartClient.MorkT
}


private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS)
{
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType });
}

private void Wait(int value = 101)
{
while (!(morkT.lebai.Ok && morkT.lebai.Value == value))
{
Thread.Sleep(5);
}
}

/// <summary>
/// 是否可以开始制作咖啡
/// </summary>
/// <returns></returns>
private bool CoffeeCanMake()
{
bool canMake = (IsHealth && morkT.morkOrderPushesCoffee.Count > 0 && !morkT.IsCoffeeMake) ? true : false;
return canMake;

}

/// <summary>
/// 制作咖啡流程
/// </summary>
private void MakeCoffeeProcess()
{
if (CoffeeCanMake())
{
if (morkT.morkOrderPushesCoffee.TryDequeue(out OrderLocInfo orderLoc))
{
DeviceProcessLogShow($"开始制作 [咖啡] 订单[{orderLoc.SortNum}]");
GetAndCheeckCoffe(orderLoc);
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_接咖啡后回原点);//把咖啡杯放到咖啡机机的位置后回原点
Wait();
LebaiRobot.GetInstance.SetValue(1);
new DRCoffee_MakeCoffeeEvent() { DrinkCode = (Model.咖啡机.Enum.DrCoffeeDrinksCode)int.Parse(orderLoc.Loc) }.Publish(); //接咖啡控制
DeviceProcessLogShow($"发送咖啡机制作{orderLoc.Loc}!");
morkT.IsCoffeeMake = true; morkT.MakeCoffeeOrder = orderLoc;
}

}


}
/// <summary>
/// 咖啡机制作完咖啡,取走并放到取餐口,最后回原点
/// </summary>
private void MakeCoffeeComplete()
{
if (morkT.IsCoffeeMake && IsHealth)
{
if (morkT.MakeCoffeeOrder != null && morkT.MakeCoffeeOrder.OrderStatus == 1)
{
DeviceProcessLogShow($"将咖啡移动到取餐位 [咖啡] 订单[{morkT.MakeCoffeeOrder.SortNum}]");
DoCoffeeQC(morkT.MakeCoffeeOrder);
morkT.MakeCoffeeOrder = null;
morkT.IsCoffeeMake = false;
}
}
}


/// <summary>
/// 将咖啡杯从咖啡机 取走到 取餐口
/// </summary>
private void DoCoffeeQC(OrderLocInfo order)
{
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_取咖啡出餐);
Wait();
LebaiRobot.GetInstance.SetValue(1);
//订单状态改变:完成
OrderChange(order.SuborderId, ORDER_STATUS.COMPLETED_COOK);
DeviceProcessLogShow($"{order.GoodsName}等待取餐");
//WaitTakeMealOrder.Enqueue(order);

}

/// <summary>
/// 取咖啡杯&&咖啡杯检测 若检测失败机器人回原点
/// </summary>
/// <param name="order"></param>
private void GetAndCheeckCoffe(OrderLocInfo order)
{
LebaiRobot.GetInstance.SetValue(0);
OrderChange(order.SuborderId, ORDER_STATUS.COOKING);
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_取咖啡杯);
Wait();
new SCChip_TakeCupEvent() { Cup = IC_CUP.CUP_COFFEE }.Publish();//落碗控制
Thread.Sleep(500);
DeviceProcessLogShow("尝试取咖啡杯!");
LebaiRobot.GetInstance.SetValue(1);
int count = 2;
p:
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_咖啡杯检测);
Wait();
LebaiRobot.GetInstance.SetValue(1);

if (!LebaiRobot.GetInstance.GetInput())
{
if (count >= 3)
{
//退出循环回到初始位置
DeviceProcessLogShow($"执行{count}次取咖啡杯,仍为成功,订单默认废弃,机器人回到初始位置!");
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_咖啡杯回原点);
Wait();
LebaiRobot.GetInstance.SetValue(1);
return;
}
DeviceProcessLogShow("执行二次取咖啡杯");
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_二次取咖啡杯);
Wait();
new SCChip_TakeCupEvent() { Cup = IC_CUP.CUP_COFFEE }.Publish();//落碗控制
LebaiRobot.GetInstance.SetValue(1);
count++;
goto p;
}
DeviceProcessLogShow("取咖啡杯完成");
}

/// <summary>
/// 冰淇淋是否可以开始制作
/// </summary>
/// <returns></returns>
private bool IceCreamCanMake()
{
bool canMake = (IsHealth && morkT.morkOrderPushesIceCream.Count > 0) ? true : false;
return canMake;
}

/// <summary>
/// 制作冰淇淋流程
/// </summary>
private void MakeIceCreamProcess()
{
if (IceCreamCanMake())
{
if (MorkIStatus.GetInstance().CurrentMode != MORKI_MODE.制冷模式) new GSIceCream_ModeSetEvent() { Mode = MORKI_MODE.制冷模式 }.Publish();
if (MorkIStatus.GetInstance().CXB >= 86 && morkT.morkOrderPushesIceCream.Count > 0)//成型比大于86才可以制作
{
if (LebaiRobot.GetInstance.GetInput(3))
{
if (morkT.IceIsOK) DeviceProcessLogShow("请检查冰淇淋出料口有无遮挡");
morkT.IceIsOK = false;

}
else if (morkT.morkOrderPushesIceCream.TryDequeue(out OrderLocInfo order))
{
morkT.IceIsOK = true;
DeviceProcessLogShow($"开始制作 [冰淇淋] 订单[{order.SortNum}]");
DoIceCream(order);
}
}
}
}


/// <summary>
/// 做冰淇淋
/// </summary>
private void DoIceCream(OrderLocInfo order)
{
GetIceCreamCup();
CheckICeCreaCup();
GetIceCream(order);
PutIceCream(order);
}

/// <summary>
/// 取冰淇淋杯
/// </summary>
private void GetIceCreamCup()
{
LebaiRobot.GetInstance.SetValue(0);
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_取冰淇淋杯);
Wait();
new SCChip_TakeCupEvent() { Cup = IC_CUP.CUP_ICECREAM }.Publish();//落碗控制
Thread.Sleep(500);
DeviceProcessLogShow("尝试取冰淇淋杯!");

}

/// <summary>
/// 冰淇淋杯检测,失败后机器人回到原点
/// </summary>
private void CheckICeCreaCup()
{
int count = 2;
LebaiRobot.GetInstance.SetValue(1);
p:
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_冰淇淋杯检测);
Wait();
LebaiRobot.GetInstance.SetValue(1);
if (!LebaiRobot.GetInstance.GetInput())
{
if (count >= 3)
{
//退出循环回到初始位置
DeviceProcessLogShow($"执行{count}次取冰淇淋杯,仍未成功,订单默认废弃,机器人回到初始位置!");
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_冰淇淋杯回原点);
Wait();
LebaiRobot.GetInstance.SetValue(1);
return;
}
DeviceProcessLogShow($"执行{count}次取冰淇淋杯!");
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_二次取冰淇淋杯);
new SCChip_TakeCupEvent() { Cup = IC_CUP.CUP_ICECREAM }.Publish();//落碗控制
Wait();
LebaiRobot.GetInstance.SetValue(1);
count++;
goto p;
}
DeviceProcessLogShow("冰淇淋杯检测完成");
}

/// <summary>
/// 机器人取接冰淇淋
/// </summary>
/// <param name="order"></param>
private void GetIceCream(OrderLocInfo order)
{
//制冷模式
new GSIceCream_ModeSetEvent() { Mode = MORKI_MODE.制冷模式 }.Publish();
LebaiRobot.GetInstance.SetValue(0);
OrderChange(order.SuborderId, ORDER_STATUS.COOKING);
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_接1号冰淇淋);
Wait();
bool doItResult = true;
//出料
new GSIceCream_DischargeEvent().Publish(delegate (object[] args)
{
doItResult = (bool)args[0];
});
if (doItResult)
{
IceCreamCookCheck();
}
else
{
int count_1 = 0;
while (MorkIStatus.GetInstance().CXB <= 86)
{
Thread.Sleep(5);
count_1++;
if (count_1 >= 2000)
break;
}
IceCreamCookCheck();
}
LebaiRobot.GetInstance.SetValue(1);
}

/// <summary>
/// 把冰淇淋放到取餐位后回原点
/// </summary>
/// <param name="order"></param>
private void PutIceCream(OrderLocInfo order)
{
while (LebaiRobot.GetInstance.GetInput())
{
Thread.Sleep(500);
}
LebaiRobot.GetInstance.Scene(LebaiRobot.SENCE_放冰淇淋位置);
Wait();
LebaiRobot.GetInstance.SetValue(1);
//订单状态改变:完成
OrderChange(order.SuborderId, ORDER_STATUS.COMPLETED_COOK);
DeviceProcessLogShow($"{order.GoodsName}等待取餐");
//WaitTakeMealOrder.Enqueue(order);

}

/// <summary>
/// 冰淇淋机器制作冰淇淋
/// </summary>


+ 4
- 4
BPASmartClient/App.config Ver ficheiro

@@ -12,7 +12,7 @@
<!--<add key="ClientId" value="2"/>-->

<!--开发环境-->
<!--<add key="apollouri" value="http://10.2.1.21:28080"/>
<add key="apollouri" value="http://10.2.1.21:28080"/>
<add key="orderserviceuri" value="https://bpa.black-pa.com:21527/order/"/>
<add key="stockserviceuri" value="https://bpa.black-pa.com:21527/stock/"/>
<add key="datavserviceuri" value="https://bpa.black-pa.com:21527/datav"/>
@@ -20,7 +20,7 @@
<add key="broadcastpubtopic" value="/broadcast/grgpechsl7q/transit_test_setdevice"/>
<add key="AppId" value="dev1_common"/>
<add key ="Namespaces" value="DEV.Config"/>
<add key="IsEnableTest" value="true"/>-->
<add key="IsEnableTest" value="False"/>



@@ -36,7 +36,7 @@
<add key="AppId" value="dev1_common"/>
<add key ="Namespaces" value="DEV.test1.Config"/>-->

<!--正式环境-->
<!--正式环境--><!--
<add key="ApolloUri" value="http://47.108.65.220:28080"/>
<add key="OrderServiceUri" value="https://witt.black-pa.com/order/"/>
<add key="StockServiceUri" value="https://witt.black-pa.com/stock/"/>
@@ -45,7 +45,7 @@
<add key="BroadcastPubTopic" value="/broadcast/grgpECHSL7q/Transit_SetDevice"/>
<add key="AppId" value="order"/>
<add key ="Namespaces" value="TEST1.Config"/>
<add key="IsEnableTest" value="False"/>
<add key="IsEnableTest" value="False"/>-->

<!--阿里云上报启动方式:API 或者 LOCAL-->
<!--API :通过客户端ID,调用接口查询“设备连接信息”-->


Carregando…
Cancelar
Guardar