Browse Source

Morks 数据上报修改

样式分支
pry 2 years ago
parent
commit
250aaf6a51
3 changed files with 59 additions and 4 deletions
  1. +1
    -1
      BPASmartClient.MorkS/BPASmartClient.MorkS.csproj
  2. +53
    -0
      BPASmartClient.MorkS/Control_Morks.cs
  3. +5
    -3
      BPASmartClient.MorkS/DataServer.cs

+ 1
- 1
BPASmartClient.MorkS/BPASmartClient.MorkS.csproj View File

@@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.72" />
<PackageReference Include="BPA.Message" Version="1.0.77" />
<PackageReference Include="BPA.Models" Version="1.0.34" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
<PackageReference Include="System.Speech" Version="6.0.0" />


+ 53
- 0
BPASmartClient.MorkS/Control_Morks.cs View File

@@ -136,7 +136,43 @@ namespace BPASmartClient.MorkS
goodName = res.MorkOrder.GoodsName;
SortNum = res.MorkOrder.SortNum.ToString();
}

EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { SortNum = SortNum, GoodName = goodName, Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType });

var index = DataServer.GetInstance.morkS.MakeOrder.FindIndex(p => p.SortNum == SortNum);
if (index >= 0 && index < DataServer.GetInstance.morkS.MakeOrder.Count)
{
if (oRDER_STATUS == ORDER_STATUS.COMPLETED_COOK)
{
DataServer.GetInstance.morkS.MakeOrder.RemoveAt(index);
DataServer.GetInstance.morkS.MakeOrderOver.Add(new OrderMakeModel()
{
Status = oRDER_STATUS,
GoodName = goodName,
SortNum = SortNum,
StopTime = DateTime.Now.ToString("HH:mm:ss")
});
}
else if (oRDER_STATUS == ORDER_STATUS.COMPLETED_TAKE)
{
var temp = DataServer.GetInstance.morkS.MakeOrderOver.FirstOrDefault(p => p.SortNum == SortNum);
if (temp != null) DataServer.GetInstance.morkS.MakeOrderOver.Remove(temp);
}
else
{
DataServer.GetInstance.morkS.MakeOrder.ElementAt(index).Status = oRDER_STATUS;
}
}
else
{
DataServer.GetInstance.morkS.MakeOrder.Add(new OrderMakeModel()
{
Status = oRDER_STATUS,
GoodName = goodName,
SortNum = SortNum,
StartTime = DateTime.Now.ToString("HH:mm:ss")
});
}
}

private void GetStatus(string key, Action<object> action)
@@ -152,6 +188,16 @@ namespace BPASmartClient.MorkS

public override void ReadData()
{
DataServer.GetInstance.morkS.Alarm.Clear();
alarms.ForEach(item =>
{
DataServer.GetInstance.morkS.Alarm.Add(new AlarmModel()
{
AlarmTime = $"{item.Date} {item.Time}",
AlarmMs = item.Info
});
});

GetStatus("M230.0", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 24)
@@ -213,6 +259,11 @@ namespace BPASmartClient.MorkS
mORKS.TurntableUpLimit = bools[13];
mORKS.FeedComplete = bools[14];
mORKS.TurntableMoveInPlace = bools[15];
DataServer.GetInstance.morkS.MorkS_Temp = mORKS.TemperatureReached;
DataServer.GetInstance.morkS.Morks_SiloMeasUp = mORKS.TurntableUpLimit;
DataServer.GetInstance.morkS.Morks_SiloMeasDown = mORKS.TurntableLowerLimit;
DataServer.GetInstance.morkS.MorkS_NoBowMeas1 = mORKS.MissingBowl;
DataServer.GetInstance.morkS.MorkS_NoBowMeas2 = mORKS.MissingBowlSignal2;
}

}));
@@ -245,6 +296,7 @@ namespace BPASmartClient.MorkS
for (int i = 0; i < 6; i++)
{
mORKS.CookNoodlesComplete[i] = bools[i];
DataServer.GetInstance.morkS.Morks_NoodleUpOrDown[i] = bools[i];
}
}

@@ -254,6 +306,7 @@ namespace BPASmartClient.MorkS
{
if (obj is ushort[] UshortValue && UshortValue.Length > 0 && UshortValue.Length <= 1)
mORKS.TurntableFeedbackloc = UshortValue[0];
DataServer.GetInstance.morkS.MorkS_BinLocation = mORKS.TurntableFeedbackloc;
}));
}



+ 5
- 3
BPASmartClient.MorkS/DataServer.cs View File

@@ -20,23 +20,25 @@ namespace BPASmartClient.MorkS

public ScreenModelMorkS morkS { get; set; } = new ScreenModelMorkS();

MQTTProxy mQTTProxy = new MQTTProxy();
public void Init()
{
MQTTProxy mQTTProxy = new MQTTProxy();
mQTTProxy.Connected = new Action(() =>
{
mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机));
ThreadManage.GetInstance().StartLong(new Action(() =>
{
morkS.MorkS_OrderCount = Json<OrderStatistics>.Data.Count;
mQTTProxy.Publish(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机), morkS.ToJSON());
SendScreenDataModel sendScreenDataModel = new SendScreenDataModel();
sendScreenDataModel.Name = ScreenDeviceType.煮面机;
sendScreenDataModel.Value = morkS.ToJSON();
mQTTProxy.Publish(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机), sendScreenDataModel.ToJSON());
Thread.Sleep(100);
}), "海科食堂大屏监听");
});
mQTTProxy.Connect("UserName", "Password", "Host", 1883, $"MORKS 设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}


//订单信息(正在制作,等待制作,制作完成)
//煮面炉上下状态(6个煮面炉上或下)
//温度状态(煮面炉温度是否到达)


Loading…
Cancel
Save