pry 2 years ago
parent
commit
ae6fb0c91b
11 changed files with 174 additions and 42 deletions
  1. +0
    -4
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  2. +1
    -0
      BPASmartClient.DRCoffee/CoffeeMachine.cs
  3. +1
    -6
      BPASmartClient.GSIceCream/IceCreamMachine.cs
  4. +49
    -4
      BPASmartClient.IoT/DataVClient.cs
  5. +3
    -0
      BPASmartClient.IoT/Model/DataVReport.cs
  6. +4
    -4
      BPASmartClient.IoT/Model/IOT/IOTDevModel.cs
  7. +43
    -0
      BPASmartClient.IoT/Model/MaintainTable.cs
  8. +1
    -0
      BPASmartClient.Lebai/LebaiRobot.cs
  9. +11
    -22
      BPASmartClient.MorkT/Control_MorkT.cs
  10. +59
    -0
      BPASmartClient.MorkT/GLV_MorkT.cs
  11. +2
    -2
      BPASmartClient/App.config

+ 0
- 4
BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj View File

@@ -171,10 +171,6 @@
<None Remove="Image\黑菠萝科技.png" />
</ItemGroup>

<ItemGroup>
<Page Remove="Properties\App.xaml" />
</ItemGroup>

<ItemGroup>
<Resource Include="Image\btn_close.png" />
<Resource Include="Image\ComboBoxPopSelect.png" />


+ 1
- 0
BPASmartClient.DRCoffee/CoffeeMachine.cs View File

@@ -148,6 +148,7 @@ namespace BPASmartClient.DRCoffee
lastRefreshTime = DateTime.Now;
IsConnected = OnLine;
status["CoffeConnected"] = OnLine;
new DRCoffee_CoffeEndCookEvent() { DeviceId = DeviceId }.Publish();
}
else status["Status"] = package.Status;


+ 1
- 6
BPASmartClient.GSIceCream/IceCreamMachine.cs View File

@@ -88,12 +88,6 @@ namespace BPASmartClient.GSIceCream

ThreadManage.GetInstance().StartLong(new Action(() =>
{
status["test"] = 0;
for (int i = 0; i < 1000; i++)
{
status["test"] = (int)status["test"] + 1;
Thread.Sleep(1000);
}
ResolveMsg();
}), "冰淇淋解析线程");
}
@@ -183,6 +177,7 @@ namespace BPASmartClient.GSIceCream
private void ProcessHeart(ICMSG_Heart_UP heartUpMsg)
{
IsConnected = OnLine;
status["IceCreamIsConnected"] = OnLine;
status["CurrentMode"] = heartUpMsg.MS;
status["YLWD"] = BitConverter.ToInt16(new byte[] { heartUpMsg.YLWD_L,heartUpMsg.YLWD_H },0);
status["HQWD"] = BitConverter.ToInt16(new byte[] { heartUpMsg.HQWD_L,heartUpMsg.HQWD_H },0);


+ 49
- 4
BPASmartClient.IoT/DataVClient.cs View File

@@ -35,14 +35,24 @@ namespace BPASmartClient.IoT
public DataVClient()
{
DataVApiAddress = InternetInfo.DataVApiAddress;
//DataVApiAddress = System.Configuration.ConfigurationManager.AppSettings["DataVServiceUri"].ToString();
ClientId = System.Configuration.ConfigurationManager.AppSettings["ClientId"].ToString();
DeviceName = System.Configuration.ConfigurationManager.AppSettings["DeviceName"].ToString();
ProductKey = System.Configuration.ConfigurationManager.AppSettings["ProductKey"].ToString();
DeviceSecret = System.Configuration.ConfigurationManager.AppSettings["DeviceSecret"].ToString();
StartupMode = System.Configuration.ConfigurationManager.AppSettings["StartupMode"].ToString();
BroadcastPubTopic = InternetInfo.BroadcastPubTopic;
//BroadcastPubTopic = System.Configuration.ConfigurationManager.AppSettings["BroadcastPubTopic"].ToString();
//MaintainTable maintainTable = new MaintainTable();
//maintainTable.Id = Guid.NewGuid().ToString();
//maintainTable.MaintainTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
//maintainTable.MaintainType = "一般";
//maintainTable.MaintainVla = "MorkS";
//maintainTable.MaintainMessage = "xxxxx故障需要维修";
//maintainTable.DeviceId = "";
//maintainTable.ClientId = ClientId;
//maintainTable.devicename = DeviceDataV.deviceTable.devicename;
//maintainTables.Add(maintainTable);
}
#endregion

@@ -72,6 +82,10 @@ namespace BPASmartClient.IoT
/// key值
/// </summary>
public Dictionary<string, string> keyValues = new Dictionary<string, string>();
/// <summary>
/// 维保通知
/// </summary>
public List<MaintainTable> maintainTables = new List<MaintainTable>();
#endregion

#region API调用
@@ -97,6 +111,34 @@ namespace BPASmartClient.IoT
}
return alarmTable.KeyID;
}
/// <summary>
/// 增加维保信息
/// </summary>
/// <param name="maintainTable"></param>
/// <returns></returns>
public string HttpAddMaintain(MaintainTable maintainTable)
{
try
{
if (DeviceDataV != null && DeviceDataV.GetIsConnected() && DeviceDataV.deviceTable != null)
{
maintainTable.Id=Guid.NewGuid().ToString();
//maintainTable.MaintainTime = DateTime.Now.ToString();
//maintainTable.MaintainType = "一般";
//maintainTable.MaintainVla = "MorkS";
//maintainTable.MaintainMessage = "xxxxx故障需要维修";
//maintainTable.DeviceId = "";
maintainTable.ClientId = ClientId;
maintainTable.devicename = DeviceDataV.deviceTable.devicename;
maintainTables.Add(maintainTable);
}
}
catch (Exception ex)
{
MessageLog.GetInstance.Show(ex.Message);
}
return maintainTable.KeyID;
}

/// <summary>
/// 增加日志信息
@@ -159,6 +201,7 @@ namespace BPASmartClient.IoT
if (DeviceDataV.InitializeNo(ProductKey, DeviceName, DeviceSecret, ref message))
{
MessageLog.GetInstance.Show($"客户端:【{ClientId}】,设备名称{DeviceName}阿里云连接成功");
DeviceDataV.DataVMessageAction += DevIOTActionHandler;
UpDataFile();
}
else
@@ -207,6 +250,10 @@ namespace BPASmartClient.IoT
});
if (dataVNode.Count > 0)
{
if (maintainTables.Count > 0)
{
iOTDevSXModel.Maintain = Tools.JsonConvertTools(maintainTables);
}
iOTDevSXModel.NodeStatus = Tools.JsonConvertTools(new { data = dataVNode });
DeviceDataV.IOT_Publish(DeviceDataV.PubTopic, iOTDevSXModel.Tojson());
}
@@ -253,7 +300,6 @@ namespace BPASmartClient.IoT
});
keyValues[GetPropertyValue(obj, "Time").ToString() + GetPropertyValue(obj, "Type").ToString() + GetPropertyValue(obj, "Text").ToString()] = id;
//MessageLog.GetInstance.AddDeviceAlarmLogShow(GetPropertyValue(obj, "Time").ToString() + GetPropertyValue(obj, "Type").ToString() + GetPropertyValue(obj, "Text").ToString(),id);

}

/// <summary>
@@ -276,7 +322,6 @@ namespace BPASmartClient.IoT
State = "n"
});
//MessageLog.GetInstance.DeleteDeviceAlarmLogShow(message, keyValues[message]);

}
}



+ 3
- 0
BPASmartClient.IoT/Model/DataVReport.cs View File

@@ -75,6 +75,9 @@ namespace BPASmartDatavDeviceClient.IoT
return false;
}
IOT_Subscribe(BroadcastTopic);//订阅广播主题
IOT_Subscribe(FileUpLoadReplyTopic);
IOT_Subscribe(FileUpLoadSendReplyTopic);
IOT_Subscribe(CancelFileUpLoadSendTopic);
if (!DatavDeviceClient.IsConnected) message += $"客户端:【】,设备名称{deviceTable.devicename}阿里云连接失败.不能上报业务信息";
return DatavDeviceClient.IsConnected;
}


+ 4
- 4
BPASmartClient.IoT/Model/IOT/IOTDevModel.cs View File

@@ -82,10 +82,10 @@ namespace DataVAPI.Tool.IOT
/// 节点状态
/// </summary>
public string NodeStatus { get; set; }
///// <summary>
///// 运行日志
///// </summary>
//public string SZXX { get; set; }
/// <summary>
/// 维修保护
/// </summary>
public string Maintain { get; set; }
///// <summary>
///// 运行告警
///// </summary>


+ 43
- 0
BPASmartClient.IoT/Model/MaintainTable.cs View File

@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.IoT.Model
{
/// <summary>
/// 维保
/// </summary>
public class MaintainTable : BaseEntity
{
/// <summary>
/// 维修时间
/// </summary>
public string MaintainTime { get; set; }
/// <summary>
/// 维修类型:1 轻微 2:一般 3 严重
/// </summary>
public string MaintainType { get; set; }
/// <summary>
/// 维修消息
/// </summary>
public string MaintainMessage { get; set; }
/// <summary>
/// 维修值
/// </summary>
public string MaintainVla { get; set; }
/// <summary>
/// IP 地址
/// </summary>
public string IP { get; set; }
/// <summary>
/// 状态描述
/// </summary>
public string StatusMS { get; set; }
/// <summary>
/// 状态颜色
/// </summary>
public object StatusColor { get; set; }
}
}

+ 1
- 0
BPASmartClient.Lebai/LebaiRobot.cs View File

@@ -45,6 +45,7 @@ namespace BPASmartClient.Lebai
ThreadManage.GetInstance().StartLong(() =>
{
IsConnected = LebaiHelper.GetInstance().IsConnected;
status["RobotIsConnected"] = LebaiHelper.GetInstance().IsConnected;
status["OK"] = LebaiHelper.GetInstance().GetValueAsync().Ok;
status["Value"] = LebaiHelper.GetInstance().GetValueAsync().Value;
if (LebaiHelper.GetInstance().robotData != null) status["RobotMode"] = LebaiHelper.GetInstance().robotData.RobotMode.Mode;


+ 11
- 22
BPASmartClient.MorkT/Control_MorkT.cs View File

@@ -40,11 +40,7 @@ namespace BPASmartClient.MorkT
morkT.MakeCoffeeOrder.OrderStatus = 1;
});
int i = 0;
////ThreadManage.GetInstance().StartLong(new Action(() =>
////{
//// i = (int)Status.status["GSIceCream.IceCreamMachine.test"];
////}),"test");

MessageLog.GetInstance.Show("MORKT 设备初始化完成");

@@ -71,16 +67,6 @@ namespace BPASmartClient.MorkT
public override void MainTask()
{

GetStatus("RobotMode", new Action<object>((o) =>
{


}));





MakeCoffeeProcess();
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 0 },(o)=>
{
@@ -98,7 +84,10 @@ namespace BPASmartClient.MorkT

public override void ReadData()
{
GetStatus("IsConnected", new Action<object>((o) =>
{
}));
}


@@ -223,7 +212,7 @@ namespace BPASmartClient.MorkT

private void Wait(int value = 101)
{
while (!((bool)Status.status["Lebai.LebaiRobot.OK"] && (int)Status.status["Lebai.LebaiRobot.Value"] == value))
while (!((bool)peripheralStatus["OK"] && (int)peripheralStatus["Value"] == value))
{
Thread.Sleep(5);
}
@@ -364,14 +353,14 @@ namespace BPASmartClient.MorkT
{
if (IceCreamCanMake())
{
if(Status.status.ContainsKey("GSIceCream.IceCreamMachine.CurrentMode"))
if(peripheralStatus.ContainsKey("CurrentMode"))
{
if ((MORKI_MODE)Status.status["GSIceCream.IceCreamMachine.CurrentMode"] != MORKI_MODE.制冷模式) new GSIceCream_ModeSetEvent() { Mode = MORKI_MODE.制冷模式 }.Publish();
if ((MORKI_MODE)peripheralStatus["CurrentMode"] != MORKI_MODE.制冷模式) new GSIceCream_ModeSetEvent() { Mode = MORKI_MODE.制冷模式 }.Publish();
}

if(Status.status.ContainsKey("GSIceCream.IceCreamMachine.CBX"))
if(peripheralStatus.ContainsKey(".CBX"))
{
if ((short)Status.status["GSIceCream.IceCreamMachine.CBX"] >= 86 && morkT.morkOrderPushesIceCream.Count > 0)//成型比大于86才可以制作
if ((short)peripheralStatus["CBX"] >= 86 && morkT.morkOrderPushesIceCream.Count > 0)//成型比大于86才可以制作
{
bool result = true;
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 3 }, (res) =>
@@ -491,7 +480,7 @@ namespace BPASmartClient.MorkT
{
int count_1 = 0;

while ((short)Status.status["GSIceCream.IceCreamMachine.CBX"] <= 86)
while ((short)peripheralStatus["CBX"] <= 86)
{
Thread.Sleep(5);
count_1++;


+ 59
- 0
BPASmartClient.MorkT/GLV_MorkT.cs View File

@@ -1,4 +1,8 @@
using BPASmartClient.Device;
using BPASmartClient.DRCoffee;
using BPASmartClient.GSIceCream;
using BPASmartClient.LebaiRobot;
using BPASmartClient.Model.冰淇淋.Enum;
using Robotc;
using System;
using System.Collections.Concurrent;
@@ -40,5 +44,60 @@ namespace BPASmartClient.MorkT
/// 冰淇淋机器出料口传感器检测
/// </summary>
public bool IceIsOK = true;

#region

[VariableMonitor("机器人连接状态")]
public bool RobotIsConnected;

[VariableMonitor("机器人状态")]
public ELebaiRModel RobotMode;

[VariableMonitor("冰淇淋连接状态")]
public bool IceCreamIsConnected;

[VariableMonitor("冰淇淋机器预冷温度")]
public short YLWD;

[VariableMonitor("冰淇淋机器回气温度")]
public short HQWD;

[VariableMonitor("冰淇淋机器环境温度")]
public short HJWD;

[VariableMonitor("冰淇淋机器电流")]
public short DL;

[VariableMonitor("冰淇淋机器电压")]
public bool DY;

[VariableMonitor("冰淇淋机器成型比")]
public byte CBX;

[VariableMonitor("冰淇淋机器模式")]
public MORKI_MODE IceCreamMode;

[VariableMonitor("冰淇淋机器故障")]
public MORKI_FAULT IceCreamFault;

[VariableMonitor("冰淇淋机器打料是否完成")]
public bool DLCompleted;

[VariableMonitor("咖啡机连接状态")]
public bool CoffeeIsConnected;

[VariableMonitor("咖啡机状态")]
public DrCoffeeStatus DrCoffeeStatus;

[VariableMonitor("咖啡机应用状态")]
public DrCoffeeAppStatus CoffeeAppStatus;

[VariableMonitor("咖啡机告警")]
public DrCoffeeWarning CoffeeWarning;

[VariableMonitor("咖啡机故障")]
public DrCoffeeFault CaffeeFault;

#endregion
}
}

+ 2
- 2
BPASmartClient/App.config View File

@@ -22,8 +22,8 @@
<!--LOCAL:直接使用下方本地“设备连接信息”-->
<add key="StartupMode" value="API"/>
<add key="ProductKey" value="grgpECHSL7q"/>
<add key="DeviceName" value="qsqd"/>
<add key="DeviceSecret" value="3c0f2390943bff4fece523af22655196"/>
<add key="DeviceName" value="qsqdzklb"/>
<add key="DeviceSecret" value="e2b300892c3e21469c8dc6c7c5c4430d"/>
<add key="PasswordBox" value="6WrKhYmTIhLV7g24jIH/lg=="/>




Loading…
Cancel
Save