Commit 0fb458b4 顾剑亮

upload

1 个父辈 18df6852
正在显示 42 个修改的文件 包含 123 行增加70 行删除
...@@ -12,5 +12,6 @@ ...@@ -12,5 +12,6 @@
<add key="ElevatorIOIP" value="10.85.199.148"/> <add key="ElevatorIOIP" value="10.85.199.148"/>
<add key="FirstFloorCount" value="2"/> <add key="FirstFloorCount" value="2"/>
<add key="AutoCharge" value="true"/> <add key="AutoCharge" value="true"/>
<add key="Board" value="http://10.85.199.25/myproject/rest/api/qisda/device/updateDeviceAlarmMsg"/>
</appSettings> </appSettings>
</configuration> </configuration>
\ No newline at end of file \ No newline at end of file
...@@ -166,15 +166,13 @@ namespace AGVControl_Elevator ...@@ -166,15 +166,13 @@ namespace AGVControl_Elevator
private void Elevator_DI_Changed(bool[] sta) private void Elevator_DI_Changed(bool[] sta)
{ {
string s = "DI ";
for (int i = 0; i < elevatorDI.Length; i++) for (int i = 0; i < elevatorDI.Length; i++)
{ {
s += sta[i].ToString() + " "; //s += sta[i].ToString() + " ";
elevatorDI[i].BackColor = sta[i] ? BACK_TRUE : BACK_FALSE; elevatorDI[i].BackColor = sta[i] ? BACK_TRUE : BACK_FALSE;
} }
Common.log.Info(s);
} }
private void Elevator_Connect_Event(bool con) private void Elevator_Connect_Event(bool con)
......
...@@ -33,6 +33,7 @@ namespace AGVControl_Elevator ...@@ -33,6 +33,7 @@ namespace AGVControl_Elevator
{ {
Common.appConfig = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None); Common.appConfig = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None);
Common.FleetSend = Convert.ToBoolean(Common.appConfig.AppSettings.Settings["FleetSend"].Value); Common.FleetSend = Convert.ToBoolean(Common.appConfig.AppSettings.Settings["FleetSend"].Value);
Common.BoardURL = Common.appConfig.AppSettings.Settings["Board"].Value;
Common.BatteryMax = Convert.ToInt32(Common.appConfig.AppSettings.Settings["BatteryMax"].Value); Common.BatteryMax = Convert.ToInt32(Common.appConfig.AppSettings.Settings["BatteryMax"].Value);
Common.BatteryMin = Convert.ToInt32(Common.appConfig.AppSettings.Settings["BatteryMin"].Value); Common.BatteryMin = Convert.ToInt32(Common.appConfig.AppSettings.Settings["BatteryMin"].Value);
Common.BatteryIdle = Convert.ToInt32(Common.appConfig.AppSettings.Settings["BatteryIdle"].Value); Common.BatteryIdle = Convert.ToInt32(Common.appConfig.AppSettings.Settings["BatteryIdle"].Value);
......
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<configuration> <configuration>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup> </startup>
<appSettings> <appSettings>
<add key="FLEET_IP" value="10.85.199.3" /> <add key="FLEET_IP" value="10.85.199.3"/>
<add key="FleetSend" value="true" /> <add key="FleetSend" value="true"/>
<add key="BatteryMax" value="100" /> <add key="BatteryMax" value="100"/>
<add key="BatteryMin" value="20" /> <add key="BatteryMin" value="20"/>
<add key="BatteryIdle" value="80" /> <add key="BatteryIdle" value="80"/>
<add key="ElevatorIOIP" value="10.85.199.148" /> <add key="ElevatorIOIP" value="10.85.199.148"/>
<add key="FirstFloorCount" value="2" /> <add key="FirstFloorCount" value="2"/>
<add key="AutoCharge" value="true" /> <add key="AutoCharge" value="true"/>
<add key="12号车" value="false" /> <add key="Board" value="http://10.85.199.25/myproject/rest/api/qisda/device/updateDeviceAlarmMsg"/>
</appSettings> </appSettings>
</configuration> </configuration>
\ No newline at end of file \ No newline at end of file
此文件的差异太大,无法显示。
...@@ -50,9 +50,19 @@ namespace BLL ...@@ -50,9 +50,19 @@ namespace BLL
try try
{ {
string name = "12号车";
info.IsCall = true; info.IsCall = true;
CheckAgvOnline(info); CheckAgvOnline(info);
if (!info.IsOnline) continue; //脱机 if (!info.IsOnline && info.IsAuto) //脱机
{
DisplayBoard.Add(name, "lineAgv." + name + ".Msg", "离线", 0);
continue;
}
if (!info.IsOnline && info.IsAuto) //脱机
{
DisplayBoard.Add(name, "lineAgv." + name + ".Msg", "停用", 0);
continue;
}
GetAgvState(info); GetAgvState(info);
if (!info.IsAuto) continue; //手动 if (!info.IsAuto) continue; //手动
...@@ -79,7 +89,7 @@ namespace BLL ...@@ -79,7 +89,7 @@ namespace BLL
info.IsCall = false; info.IsCall = false;
} }
} }
UpdateBoard(); DisplayBoard.UpdateAlarmMsg();
} }
private void GetAgvState(AgvInfo info) private void GetAgvState(AgvInfo info)
...@@ -125,57 +135,6 @@ namespace BLL ...@@ -125,57 +135,6 @@ namespace BLL
} }
} }
private void UpdateBoard()
{
//for (int i = 0; i < Common.agvInfos.Count; i++)
//{
// if (Common.agvInfos[i].CurrentJob == null)
// {
// timeout[i] = DateTime.Now;
// continue;
// }
// string name = "";
// if (Common.agvInfos[i].Name.IndexOf("11") >= 0)
// name = "11号车";
// else if (Common.agvInfos[i].Name.IndexOf("13") >= 0)
// name = "13号车";
// if (Math.Abs(Common.agvInfos[i].Position.X - position[i].X) < 2 && Math.Abs(Common.agvInfos[i].Position.Y - position[i].Y) < 2)
// {
// TimeSpan span = DateTime.Now - timeout[i];
// if (span.TotalMinutes >= Common.BoardTimeout)
// {
// if (Common.agvInfos[i].CurrentJob is ChargeJob)
// {
// DisplayBoard.Add(name, "lineAgv." + name + ".Place", "AutoCharge", 1);
// }
// else if (Common.agvInfos[i].CurrentJob is StandbyJob)
// {
// DisplayBoard.Add(name, "lineAgv." + name + ".Place", "Standby", 1);
// }
// else
// {
// string value = string.Format("在{0}停留超时{1:F}分钟", Common.agvInfos[i].Place, span.TotalMinutes);
// DisplayBoard.Add(name, "lineAgv." + name + ".StandTimeOut", value, 0);
// }
// }
// else
// {
// DisplayBoard.Add(name, "lineAgv." + name + ".Msg", Common.agvInfos[i].CurrentJob.Msg, 1);
// }
// }
// else
// {
// DisplayBoard.Add(name, "lineAgv." + name + ".Msg", Common.agvInfos[i].CurrentJob.Msg, 1);
// timeout[i] = DateTime.Now;
// position[i] = new PointF(Common.agvInfos[i].Position.X, Common.agvInfos[i].Position.Y);
// }
//}
//DisplayBoard.UpdateAlarmMsg();
}
private enum StateID : int private enum StateID : int
{ {
None, None,
......
...@@ -10,7 +10,7 @@ namespace BLL ...@@ -10,7 +10,7 @@ namespace BLL
private string mission; private string mission;
private DateTime getTime; private DateTime getTime;
private string key; private string key;
//private bool recycleFirst; private DateTime dtUseAsk;
private JobStep<FullShelfStep> fullShelfStep; private JobStep<FullShelfStep> fullShelfStep;
public FullShelfJob() public FullShelfJob()
...@@ -43,6 +43,7 @@ namespace BLL ...@@ -43,6 +43,7 @@ namespace BLL
else if (fullShelfStep.Equals(FullShelfStep.SendUseAsk)) else if (fullShelfStep.Equals(FullShelfStep.SendUseAsk))
{ {
ManageWork.SendElevatorUseAsk(); ManageWork.SendElevatorUseAsk();
dtUseAsk = DateTime.Now;
fullShelfStep.NextStep(FullShelfStep.UseAnswer); fullShelfStep.NextStep(FullShelfStep.UseAnswer);
fullShelfStep.Msg = string.Format("{0} 发送电梯使用请求", _info.Name); fullShelfStep.Msg = string.Format("{0} 发送电梯使用请求", _info.Name);
} }
...@@ -66,6 +67,12 @@ namespace BLL ...@@ -66,6 +67,12 @@ namespace BLL
} }
else else
{ {
TimeSpan ts = DateTime.Now - dtUseAsk;
if (ts.TotalMinutes > 3)
{
string value = string.Format("在电梯等待区等待电梯应答超时{0}分钟", Convert.ToInt32(ts.TotalMinutes));
DisplayBoard.Add("12号车", "lineAgv.12号车.StandTimeOut", value, 0);
}
Common.log.Debug(string.Format("{0} 电梯还未应答使用请求", _info.Name)); Common.log.Debug(string.Format("{0} 电梯还未应答使用请求", _info.Name));
} }
} }
......
...@@ -20,6 +20,7 @@ namespace Model ...@@ -20,6 +20,7 @@ namespace Model
//public static System.Windows.Forms.ListBox lstStorage; //public static System.Windows.Forms.ListBox lstStorage;
//public static System.Windows.Forms.Label lblStorageIO; //public static System.Windows.Forms.Label lblStorageIO;
public static string BoardURL;
public static string ElevatorIOIP; public static string ElevatorIOIP;
public static bool FleetSend; public static bool FleetSend;
public static int BatteryMax; public static int BatteryMax;
......
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.Script.Serialization;
using RestSharp;
namespace Model
{
public static class DisplayBoard
{
private static List<AlarmMsg> msgList = new List<AlarmMsg>();
public static void Add(string name, string key, string value, int type = 0)
{
msgList.Add(new AlarmMsg(name, key, value, type));
Common.log.Debug(string.Format("{0}添加监控面板,{1}", name, value));
}
public static void UpdateAlarmMsg()
{
if (msgList.Count == 0) return;
UpdateDeviceAlarmMsg();
msgList.Clear();
}
private static void UpdateDeviceAlarmMsg()
{
try
{
Dictionary<string, string> paramMap = new Dictionary<string, string>();
JavaScriptSerializer serializer = new JavaScriptSerializer();
string json = serializer.Serialize(msgList);
paramMap.Add("deviceAlarmList", json);
string server = GetUrl(paramMap);
RestClient client = new RestClient(server) { Timeout = 2000 };
RestRequest request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json;charset=UTF-8");
IRestResponse response = client.Execute(request);
json = response.Content;
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null)
Common.log.Info("updateDeviceAlarmMsg 没有收到服务器反馈");
else
Common.log.Debug("updateDeviceAlarmMsg OK");
}
catch (Exception ex)
{
Common.log.Error("UpdateDeviceAlarmMsg", ex);
}
}
private static string GetUrl(Dictionary<string, string> paramsMap)
{
string path = Common.BoardURL;
List<string> value = new List<string>();
foreach (string key in paramsMap.Keys)
{
string par = System.Web.HttpUtility.UrlEncode(paramsMap[key], Encoding.UTF8);
value.Add(key + "=" + par);
}
path += "?" + string.Join("&", value);
return path;
}
}
internal class AlarmMsg
{
public string name = "";
public string msgKey = "";
public string msgValue = "";
public int type;
public AlarmMsg(string name, string key, string value, int type = 0)
{
this.name = name;
msgKey = key;
msgValue = value;
this.type = type;
}
}
}
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
<ItemGroup> <ItemGroup>
<Compile Include="AgvInfo.cs" /> <Compile Include="AgvInfo.cs" />
<Compile Include="Common.cs" /> <Compile Include="Common.cs" />
<Compile Include="DisplayBoard.cs" />
<Compile Include="IJob.cs" /> <Compile Include="IJob.cs" />
<Compile Include="JobStep.cs" /> <Compile Include="JobStep.cs" />
<Compile Include="IOInfo.cs" /> <Compile Include="IOInfo.cs" />
......
d562012ef7fc9969a7720b4ebce7fdbed55da14e 7736e39faee57961782a4b52f6242c8cb2884700
...@@ -16,8 +16,8 @@ C:\Neotel\Program\AGVControl_Elevator\Model\bin\Debug\log4net.dll ...@@ -16,8 +16,8 @@ C:\Neotel\Program\AGVControl_Elevator\Model\bin\Debug\log4net.dll
C:\Neotel\Program\AGVControl_Elevator\Model\bin\Debug\RestSharp.dll C:\Neotel\Program\AGVControl_Elevator\Model\bin\Debug\RestSharp.dll
C:\Neotel\Program\AGVControl_Elevator\Model\bin\Debug\log4net.xml C:\Neotel\Program\AGVControl_Elevator\Model\bin\Debug\log4net.xml
C:\Neotel\Program\AGVControl_Elevator\Model\bin\Debug\RestSharp.xml C:\Neotel\Program\AGVControl_Elevator\Model\bin\Debug\RestSharp.xml
C:\Neotel\Program\AGVControl_Elevator\Model\obj\Debug\Model.csprojAssemblyReference.cache
C:\Neotel\Program\AGVControl_Elevator\Model\obj\Debug\Model.csproj.CoreCompileInputs.cache C:\Neotel\Program\AGVControl_Elevator\Model\obj\Debug\Model.csproj.CoreCompileInputs.cache
C:\Neotel\Program\AGVControl_Elevator\Model\obj\Debug\Model.csproj.CopyComplete C:\Neotel\Program\AGVControl_Elevator\Model\obj\Debug\Model.csproj.CopyComplete
C:\Neotel\Program\AGVControl_Elevator\Model\obj\Debug\Model.dll C:\Neotel\Program\AGVControl_Elevator\Model\obj\Debug\Model.dll
C:\Neotel\Program\AGVControl_Elevator\Model\obj\Debug\Model.pdb C:\Neotel\Program\AGVControl_Elevator\Model\obj\Debug\Model.pdb
C:\Neotel\Program\AGVControl_Elevator\Model\obj\Debug\Model.csprojAssemblyReference.cache
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!