Commit 0f1ba7f9 张东亮

上传运行版本

1 个父辈 ba44aa47
正在显示 136 个修改的文件 包含 1995 行增加262 行删除
此文件类型无法预览
......@@ -9,6 +9,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AgvClient", "AgvClient\AgvC
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AgvClientTest", "AgvClientTest\AgvClientTest.csproj", "{E1C0827A-FA12-49A9-AC71-6D3E6518754A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LineWebService", "WebService\LineWebService.csproj", "{074D4597-8955-4EEE-840A-8FAA9B174603}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebServiceHost", "WebServiceTest\WebServiceHost.csproj", "{A89F6EC4-457A-4998-ACDC-F1ADC22C8BF8}"
ProjectSection(ProjectDependencies) = postProject
{074D4597-8955-4EEE-840A-8FAA9B174603} = {074D4597-8955-4EEE-840A-8FAA9B174603}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -27,6 +34,14 @@ Global
{E1C0827A-FA12-49A9-AC71-6D3E6518754A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E1C0827A-FA12-49A9-AC71-6D3E6518754A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E1C0827A-FA12-49A9-AC71-6D3E6518754A}.Release|Any CPU.Build.0 = Release|Any CPU
{074D4597-8955-4EEE-840A-8FAA9B174603}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{074D4597-8955-4EEE-840A-8FAA9B174603}.Debug|Any CPU.Build.0 = Debug|Any CPU
{074D4597-8955-4EEE-840A-8FAA9B174603}.Release|Any CPU.ActiveCfg = Release|Any CPU
{074D4597-8955-4EEE-840A-8FAA9B174603}.Release|Any CPU.Build.0 = Release|Any CPU
{A89F6EC4-457A-4998-ACDC-F1ADC22C8BF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A89F6EC4-457A-4998-ACDC-F1ADC22C8BF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A89F6EC4-457A-4998-ACDC-F1ADC22C8BF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A89F6EC4-457A-4998-ACDC-F1ADC22C8BF8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -36,6 +36,9 @@
<ApplicationIcon>line.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="AsaPL.AgvClient">
<HintPath>dll\AsaPL.AgvClient.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\DLL\log4net.dll</HintPath>
......@@ -77,6 +80,7 @@
<Compile Include="BLL\MyWebClient.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="BLL\WebService.cs" />
<Compile Include="FrmMain.cs">
<SubType>Form</SubType>
</Compile>
......@@ -86,7 +90,6 @@
<Compile Include="BLL\MiR_API.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="BLL\WebService.cs" />
<EmbeddedResource Include="FrmMain.resx">
<DependentUpon>FrmMain.cs</DependentUpon>
</EmbeddedResource>
......
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<log4net>
<appender name="AgvServer" type="log4net.Appender.RollingFileAppender">
<file value="logs/AgvServer.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<root>
<level value="Debug"/>
<appender-ref ref="AgvServer"/>
</root>
</log4net>
<appSettings>
<add key="ITS" value="http://10.85.17.233/ESMTCommonInterface/CommonService.asmx/VMIGetBoxDestInfo?boxRFID=" />
<add key="WebService" value="http://10.85.199.1/Webservice/AGVService/"/>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<log4net>
<appender name="AgvServer" type="log4net.Appender.RollingFileAppender">
<file value="logs/AgvServer.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<appender name="LineWebService" type="log4net.Appender.RollingFileAppender">
<file value="logs/LineWebService.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<logger>
<level value="Debug"/>
<appender-ref ref="LineWebService"/>
</logger>
<root>
<level value="Debug"/>
<appender-ref ref="AgvServer"/>
</root>
</log4net>
<appSettings>
<add key="ITS" value="http://10.85.17.233/ESMTCommonInterface/CommonService.asmx/VMIGetBoxDestInfo?boxRFID=" />
<add key="WebService" value="http://127.0.0.1/BenQMIR/Webservice/AGVService.asmx/" />
<add key="http.server" value="http://10.85.199.25/myproject/" />
<add key="FLEET" value="10.85.199.3"/>
<!--<add key="LocalIP" value="192.168.103.12"/>
<add key="AutoCharge" value="false"/>
<add key="ChargeWait" value="1"/>
<add key="ChargeThreshold" value="20,70"/>-->
<add key="MiR_R1763" value="false"/>
<add key="MiR_R1764" value="false"/>
<add key="MiR_R1767" value="false"/>
<add key="MiR_R1768" value="false"/>
<add key="A5" value="false"/>
<add key="A6" value="false"/>
<add key="E1" value="false"/>
<add key="E2" value="false"/>
<add key="E3" value="false"/>
<add key="E4" value="false"/>
<add key="E5" value="false"/>
<add key="E6" value="false"/>
<add key="E7" value="false"/>
<add key="E8" value="false"/>
<add key="E9" value="false"/>
<add key="E10" value="false"/>
<add key="E11" value="false"/>
<add key="E12" value="false"/>
<add key="E13" value="false"/>
<add key="E14" value="false"/>
<add key="E15" value="false"/>
<add key="E16" value="false"/>
<add key="E21" value="false"/>
<add key="E22" value="false"/>
<add key="G1" value="false"/>
<add key="G2" value="false"/>
<add key="G3" value="false"/>
<add key="G4" value="false"/>
<add key="G5" value="false"/>
<add key="G6" value="false"/>
<add key="G7" value="false"/>
<add key="G8" value="false"/>
<add key="G9" value="false"/>
<add key="G10" value="false"/>
<add key="G11" value="false"/>
<add key="G12" value="false"/>
<add key="G13" value="false"/>
<add key="G14" value="false"/>
<add key="G15" value="false"/>
<add key="G16" value="false"/>
<add key="G21" value="false"/>
<add key="G22" value="false"/>
</appSettings>
<add key="FLEET" value="10.85.199.3" />
<add key="AutoCharge" value="True" />
<add key="ChargeWait" value="1" />
<add key="ChargeThreshold" value="20,70" />
<add key="MiR_R1763" value="True" />
<add key="MiR_R1764" value="False" />
<add key="MiR_R1767" value="False" />
<add key="MiR_R1768" value="False" />
<add key="A5" value="True" />
<add key="A6" value="True" />
<add key="E1" value="True" />
<add key="E2" value="True" />
<add key="E3" value="True" />
<add key="E4" value="True" />
<add key="E5" value="True" />
<add key="E6" value="True" />
<add key="E7" value="false" />
<add key="E8" value="True" />
<add key="E9" value="True" />
<add key="E10" value="True" />
<add key="E11" value="True" />
<add key="E12" value="True" />
<add key="E13" value="false" />
<add key="E14" value="True" />
<add key="E15" value="True" />
<add key="E16" value="True" />
<add key="E21" value="True" />
<add key="E22" value="True" />
<add key="G1" value="false" />
<add key="G2" value="false" />
<add key="G3" value="false" />
<add key="G4" value="false" />
<add key="G5" value="false" />
<add key="G6" value="false" />
<add key="G7" value="false" />
<add key="G8" value="false" />
<add key="G9" value="false" />
<add key="G10" value="false" />
<add key="G11" value="false" />
<add key="G12" value="false" />
<add key="G13" value="false" />
<add key="G14" value="false" />
<add key="G15" value="false" />
<add key="G16" value="false" />
<add key="G21" value="false" />
<add key="G22" value="false" />
</appSettings>
<system.serviceModel>
<services>
<!--添加服务-->
<service name="LineWebService.ClsWebService" behaviorConfiguration="CalculatorServiceBehavior">
<!--name 必须与代码中的host实例初始化的服务一样
behaviorConfiguration 行为配置 -->
<host>
<baseAddresses>
<!--添加调用服务地址-->
<add baseAddress="http://10.85.199.1/BenQMIR/Webservice/AGVService.asmx/"/>
</baseAddresses>
</host>
<!--添加契约接口 contract="WcfDemo.IService1" WcfDemo.IService1为契约接口 binding="wsHttpBinding" wsHttpBinding为通过Http调用-->
<endpoint address="" binding="wsHttpBinding" contract="LineWebService.IWebService"></endpoint>
</service>
</services>
<!--定义CalculatorServiceBehavior的行为-->
<behaviors>
<serviceBehaviors>
<behavior name="CalculatorServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
\ No newline at end of file
......@@ -110,7 +110,7 @@ namespace BLL
// }
// return false;
//}
private static string Addr_updateDeviceAlarmMsg = "/updateDeviceAlarmMsg";
private static string Addr_updateDeviceAlarmMsg = "/rest/api/qisda/device/updateDeviceAlarmMsg";
/// <summary>
/// 异常看板
/// </summary>
......@@ -127,7 +127,7 @@ namespace BLL
string server = GetAddr(Addr_updateDeviceAlarmMsg, paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "");
Common.LogInfo("updateDeviceAlarmMsg " + " 【" + server + "】【" + resultStr + "】");
Common.log.Debug("【" + server + "】【" + resultStr + "】");
RfidData data = JsonHelper.DeserializeJsonToObject<RfidData>(resultStr);
......@@ -137,7 +137,7 @@ namespace BLL
}
else if (data.code.Equals(0).Equals(false))
{
return msg = " updateDeviceAlarmMsg 【" + server + "】【" + resultStr + "】" + data.msg;
return msg = "【" + server + "】【" + resultStr + "】" + data.msg;
}
return "";
}
......@@ -163,6 +163,41 @@ namespace BLL
path = path.Substring(0, path.Length - 1);
return path;
}
public static string Add_emptyMsg = "http://10.85.199.1/BenQMIR/Webservice/AGVService.asmx/CreateEmptyRecycleTask";//"http://localhost:11111/BenQMIR/Webservice/AGVService.asmx/CreateEmptyRecycleTask";//
public static string CreateEmptyTask()
{
try
{
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("emptyStation", "D1");
string path = Add_emptyMsg + "?";
foreach (string paramName in paramMap.Keys)
{
string par = System.Web.HttpUtility.UrlEncode(paramMap[paramName], System.Text.Encoding.UTF8);
path += paramName + "=" + par + "&";
}
path = path.Substring(0, path.Length - 1);
string resultStr = HttpHelper.Post(path, "");
Common.log.Debug("【" + path + "】【" + resultStr + "】");
Result data = JsonHelper.DeserializeJsonToObject<Result>(resultStr);
if (data == null)
{
return " updateDeviceAlarmMsg 没有收到服务器反馈";
}
else
{
return data.Succeed.ToString();
}
}
catch(Exception e)
{
return e.ToString();
}
}
}
public class ShelfLockInfo
{
......@@ -271,4 +306,26 @@ namespace BLL
public Dictionary<string, string> data { get; set; }
}
/// <summary>
/// Mir位置
/// </summary>
public class MirPosition
{
/// <summary>
/// 位置名称
/// </summary>
public string name { get; set; }
/// <summary>
/// X轴方位
/// </summary>
public double orientation { set; get; }
/// <summary>
/// x轴
/// </summary>
public double pos_x { get; set; }
public double pos_y { get; set; }
}
}
......@@ -140,7 +140,7 @@ namespace BLL
wc.Encoding = encoding;
result = wc.UploadString(url, "POST", paramData);
//LogUtil.info(result);
//Common.LogInfo(result);
}
catch (Exception e)
{
......@@ -154,7 +154,6 @@ namespace BLL
+ "发送:" + paramData + "\r\n"
+ "接收:" + result + "\r\n"
;
Common.LogInfo(LastServerMsg);
return result;
}
......
......@@ -59,42 +59,42 @@ namespace BLL
/// <param name="input"></param>
/// <param name="output"></param>
/// <returns></returns>
//public bool Get_IO_Status(Agv_Info info, out bool[] input, out bool[] output)
//{
// try
// {
// input = null;
// output = null;
// string url = "http://" + info.IP + "/api/v2.0.0/io_modules/" + info.IOID + "/status";
public bool Get_IO_Status(Agv_Info info, out bool[] input, out bool[] output)
{
try
{
input = null;
output = null;
string url = "http://" + info.IP + "/api/v2.0.0/io_modules/" + info.IOID + "/status";
// string json = HttpGet(url, info.IP, info.Authorization);
// //LogInfo("URL: " + url + "\n" + "Return: " + json);
// if (string.IsNullOrWhiteSpace(json)) return false;
string json = HttpGet(url, info.IP, info.Authorization);
Common.log.Debug("URL: " + url + "\n" + "Return: " + json);
if (string.IsNullOrWhiteSpace(json)) return false;
// JavaScriptSerializer serializer = new JavaScriptSerializer();
// Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
// if (dic == null) return false;
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null) return false;
// object[] objInput = (object[])dic["input_state"];
// input = new bool[objInput.Length];
// for (int i = 0; i < input.Length; i++)
// input[i] = Convert.ToBoolean(objInput[i]);
object[] objInput = (object[])dic["input_state"];
input = new bool[objInput.Length];
for (int i = 0; i < input.Length; i++)
input[i] = Convert.ToBoolean(objInput[i]);
// object[] objOutput = (object[])dic["output_state"];
// output = new bool[objOutput.Length];
// for (int i = 0; i < output.Length; i++)
// output[i] = Convert.ToBoolean(objOutput[i]);
object[] objOutput = (object[])dic["output_state"];
output = new bool[objOutput.Length];
for (int i = 0; i < output.Length; i++)
output[i] = Convert.ToBoolean(objOutput[i]);
// return true;
// }
// catch (Exception ex)
// {
// input = null;
// output = null;
// //Common.log.Error("", ex);
// return false;
// }
//}
return true;
}
catch (Exception ex)
{
input = null;
output = null;
//Common.log.Error("", ex);
return false;
}
}
/// <summary>
/// 获取PLC寄存器的内容
......@@ -341,16 +341,16 @@ namespace BLL
/// <param name="battery"></param>
/// <param name="mission_text"></param>
/// <returns></returns>
public bool Get_State(Agv_Info info, out int stateID, out string stateText, out int battery, out string mission_text)
public bool Get_State(Agv_Info info, out int stateID, out string stateText, out int battery, out string mission_text, out Agv_Info.clsPosition position)
{
stateID = -1;
stateText = "";
battery = 0;
mission_text = "";
position = new Agv_Info.clsPosition();
try
{
string url = "http://" + info.IP + "/api/v2.0.0/status?whitelist=state_id,state_text,battery_percentage,mission_text";
string url = "http://" + info.IP + "/api/v2.0.0/status?whitelist=state_id,state_text,battery_percentage,mission_text,position";
string json = HttpGet(url, info.IP, info.Authorization);
if (string.IsNullOrWhiteSpace(json)) return false;
......@@ -364,6 +364,11 @@ namespace BLL
string s = dic["battery_percentage"].ToString();
float f = Convert.ToSingle(s);
battery = Convert.ToInt32(f);
Dictionary<string, object> posDic = (Dictionary<string, object>)dic["position"];
if (posDic == null) return false;
position.orientation = Convert.ToDouble(posDic["orientation"].ToString());
position.x = Convert.ToDouble(posDic["x"]);
position.y = Convert.ToDouble(posDic["y"]);
return true;
}
catch (Exception ex)
......@@ -374,6 +379,44 @@ namespace BLL
}
/// <summary>
/// 获取节点位置
/// </summary>
public bool Get_Node_Pos(Agv_Info agv, ClientNode clientNode, out MirPosition mirPosition)
{
try
{
if (clientNode.Pos_guid.Equals(""))
{
mirPosition = null;
return false;
}
string url = "http://" + agv.IP + "/api/v2.0.0/positions/" + clientNode.Pos_guid;
string json = HttpGet(url, agv.IP, agv.Authorization);
if (string.IsNullOrWhiteSpace(json))
{
mirPosition = null;
return false;
}
mirPosition = JsonHelper.DeserializeJsonToObject<MirPosition>(json);
if (mirPosition == null)
{
mirPosition = null;
return false;
}
return true;
}
catch (Exception ex)
{
Common.log.Error("Get_Node_Pos", ex);
mirPosition = null;
return false;
}
}
/// <summary>
/// 小车状态改为Ready
/// </summary>
/// <param name="info"></param>
......@@ -482,7 +525,7 @@ namespace BLL
ping.Dispose();
if (result.Status != System.Net.NetworkInformation.IPStatus.Success)
{
Common.LogInfo("Ping " + ip + " 请求没有响应",false);
Common.LogInfo("Ping " + ip + " 请求没有响应", false);
return false;
}
return true;
......
......@@ -4,23 +4,30 @@ using System.Runtime.Serialization;
using System.ServiceModel.Activation;
using System;
using AGVControl;
using System.IO;
using System.Xml;
using System.Text;
namespace BLL
{
[ServiceContract(Name = "Services")]
internal interface IWebService
{
[OperationContract]
[WebInvoke(UriTemplate = "CreateEmptyRecycleTask", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Xml)]
string CreateEmptyRecycleTask(Stream stream);//string line
//?emptyStation={line}
[OperationContract]
[WebGet(UriTemplate = "CreateEmptyRecycleTask?emptyStation={line}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result CreateEmptyRecycleTask(string line);
[WebInvoke(UriTemplate = "CreateEmptyRecycleTask?emptyStation={line}", Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Xml)]
string CreateEmptyRecycleTaskGET(string line);
}
[DataContract]
internal class Result
{
[DataMember]
public string Succeed { get; set; }
public bool Succeed { get; set; }
[DataMember]
public string ResultData { get; set; }
......@@ -38,14 +45,68 @@ namespace BLL
{
}
public Result CreateEmptyRecycleTask(string line)
public string CreateEmptyRecycleTask(Stream stream)
{
AGVControl.Common.LogInfo("WebService Request emptyStation=" + line);
Result res;
StreamReader sr = new StreamReader(stream);
string s = sr.ReadToEnd();
System.Collections.Specialized.NameValueCollection nvc = System.Web.HttpUtility.ParseQueryString(s);
string emptyStation = nvc["emptyStation"];
if(emptyStation ==null)
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "emptyStation =null "};
else
{
if(emptyStation.Equals("Feeder"))
{
emptyStation = "FeederOut";
}
AGVControl.Common.LogInfo("WebService Request emptyStation=" + emptyStation,false);
}
if (AGVControl.Common.agvProductionLine.TryGetValue(emptyStation, out string value))
{
res = new Result() { Succeed = true, ResultData = null, ErrorMessage = "" };
AGVControl.Common.LogInfo("WebService Response OK");
//加到任务
//int idx = AGVControl.Common.nodeInfo.FindIndex(s => s.Name == value);
//if (idx > -1)
// AGVControl.Common.linePlace.Add(value);
//else
// AGVControl.Common.log.Error("CreateEmptyRecycleTask " + value + "不存在");
if (!Common.AddLinePlace(value))
Common.log.Error("CreateEmptyRecycleTask 节点【" + value + "】不存在");
else
{
Common.LogInfo("任务:" + value + " 出空料架 【" + emptyStation + "】");
}
//System.IO.File.WriteAllLines(Common.CONFIG_PATH + "LinePlace.txt", Common.linePlace);
}
else
{
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "Not find " + emptyStation };
AGVControl.Common.LogInfo("WebService Response false "+ "Not find " + emptyStation);
}
return JsonHelper.SerializeObject(res);
}
public string CreateEmptyRecycleTaskGET(string line)
{
Result res;
// StreamReader sr = new StreamReader(stream);
//string s = sr.ReadToEnd();
//System.Collections.Specialized.NameValueCollection nvc = System.Web.HttpUtility.ParseQueryString(s);
//string emptyStation = nvc["emptyStation"];
if (line.Equals("Feeder"))
{
line = "FeederOut";
}
AGVControl.Common.LogInfo("WebService Request emptyStation=" + line,false);
//if (line == null)
// res = new Result() { Succeed = "false", ResultData = null, ErrorMessage = "line =null " };
if (AGVControl.Common.agvProductionLine.TryGetValue(line, out string value))
{
res = new Result() { Succeed = "true", ResultData = "", ErrorMessage = "" };
res = new Result() { Succeed = true, ResultData = null, ErrorMessage = "" };
AGVControl.Common.LogInfo("WebService Response OK");
//加到任务
......@@ -54,21 +115,21 @@ namespace BLL
// AGVControl.Common.linePlace.Add(value);
//else
// AGVControl.Common.log.Error("CreateEmptyRecycleTask " + value + "不存在");
if(!Common.AddLinePlace(value))
AGVControl.Common.log.Error("CreateEmptyRecycleTask 节点【" + value + "】不存在");
if (!Common.AddLinePlace(value))
Common.log.Error("CreateEmptyRecycleTask 节点【" + value + "】不存在");
else
{
AGVControl.Common.LogInfo("CreateEmptyRecycleTask 节点【" + value + "】收到出空料架任务");
Common.LogInfo("任务:" + value + " 出空料架 【" + line + "】");
}
//System.IO.File.WriteAllLines(Common.CONFIG_PATH + "LinePlace.txt", Common.linePlace);
}
else
{
res = new Result() { Succeed = "false", ResultData = "", ErrorMessage = "Not find " + line };
AGVControl.Common.LogInfo("WebService Response false");
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "Not find " + line };
AGVControl.Common.LogInfo("WebService Response false " + "Not find " + line);
}
return res;
return JsonHelper.SerializeObject(res);
}
}
......@@ -81,7 +142,7 @@ namespace BLL
try
{
ClsWebService service = new ClsWebService();
_serviceHost = new WebServiceHost(service, new Uri(url));
_serviceHost = new WebServiceHost(service, new Uri(url));//service, new Uri(url)
_serviceHost.Open();
AGVControl.Common.LogInfo("Web服务已开启");
}
......@@ -95,7 +156,11 @@ namespace BLL
{
try
{
_serviceHost.Close();
if (_serviceHost.State != CommunicationState.Closed)//判断服务是否关闭
{
_serviceHost.Close();//关闭服务
}
//_serviceHost.Close();
AGVControl.Common.LogInfo("Web服务已关闭");
}
catch (Exception ex)
......@@ -104,6 +169,32 @@ namespace BLL
}
}
//public void RecycleTask(string lineName)
//{
// if (AGVControl.Common.agvProductionLine.TryGetValue(lineName, out string value))
// {
// AGVControl.Common.LogInfo("WebService Response OK");
// //加到任务
// //int idx = AGVControl.Common.nodeInfo.FindIndex(s => s.Name == value);
// //if (idx > -1)
// // AGVControl.Common.linePlace.Add(value);
// //else
// // AGVControl.Common.log.Error("CreateEmptyRecycleTask " + value + "不存在");
// if (!Common.AddLinePlace(value))
// Common.log.Error("CreateEmptyRecycleTask 节点【" + value + "】不存在");
// else
// {
// Common.LogInfo("任务:" + value + " 出空料架 【" + lineName + "】");
// }
// //System.IO.File.WriteAllLines(Common.CONFIG_PATH + "LinePlace.txt", Common.linePlace);
// }
// else
// {
// AGVControl.Common.LogInfo("WebService Response false");
// }
//}
}
......
......@@ -126,15 +126,24 @@
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column21.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column14.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column18.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column20.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column23.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column13.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
......@@ -153,6 +162,9 @@
<metadata name="Column12.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column22.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column7.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
......@@ -171,6 +183,9 @@
<metadata name="Column15.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column24.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column8.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
......
......@@ -39,6 +39,7 @@ namespace AGVControl
}
}
Common.logTextBox = new TextBox();
Common.missionView = new DataGridView();
Common.log = log4net.LogManager.GetLogger("AgvServer");
Common.LogInfo("=====程序开始=====");
ReadConfig();
......@@ -46,8 +47,10 @@ namespace AGVControl
Common.mir = new MiR_API();
Common.control = new BLL.Control();
//软件开启时检查小车当前的任务状态
//软件开启时检查小车当前的任务状态,并获取各节点的坐标位置
Common.CheckAGVMissionState();
//获取节点位置
Common.GetNodesPosition();
Common.control.Start();
Common.server = new AgvServer();
Common.server.Start();
......@@ -74,12 +77,12 @@ namespace AGVControl
Common.agvInfo = new List<Agv_Info>();
path = Common.CONFIG_PATH + "AgvName.csv";
line = System.IO.File.ReadAllLines(path);
for (int i = 0; i < line.Length; i++)
for (int i = 1; i < line.Length; i++)
{
temp = line[i].Split(',');
if (temp.Length != 4) continue;
if (temp.Length != 5) continue;
isuse = Convert.ToBoolean(Common.appConfig.AppSettings.Settings[temp[1]].Value);
Common.agvInfo.Add(new Agv_Info(temp[0], temp[1], temp[2], temp[3], isuse));
Common.agvInfo.Add(new Agv_Info(temp[0], temp[1], temp[2], temp[3], temp[4], isuse));
}
Common.agvMission = new Dictionary<string, string>();
......@@ -93,16 +96,17 @@ namespace AGVControl
}
Common.nodeInfo = new List<ClientNode>();
Common.chargeStatus = new ChargeStatus();
Common.agvProductionLine = new Dictionary<string, string>();
path = Common.CONFIG_PATH + "AgvProductionLine.csv";
line = System.IO.File.ReadAllLines(path);
for (int i = 0; i < line.Length; i++)
for (int i = 1; i < line.Length; i++)
{
temp = line[i].Split(',');
if (temp.Length != 3) continue;
if (temp.Length != 5) continue;
Common.agvProductionLine.Add(temp[0], temp[1]);
bool isUse = Convert.ToBoolean(Common.appConfig.AppSettings.Settings[temp[1]].Value);
Common.nodeInfo.Add(new ClientNode(temp[1], temp[2], isUse));
Common.nodeInfo.Add(new ClientNode(temp[1], temp[2], isUse,temp[3],temp[4]));
}
......
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<log4net>
<appender name="AgvServer" type="log4net.Appender.RollingFileAppender">
<file value="logs/AgvServer.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<root>
<level value="Debug"/>
<appender-ref ref="AgvServer"/>
</root>
</log4net>
<appSettings>
<add key="ITS" value="http://10.85.17.233/ESMTCommonInterface/CommonService.asmx/VMIGetBoxDestInfo?boxRFID=" />
<add key="WebService" value="http://10.85.199.1/Webservice/AGVService/"/>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<log4net>
<appender name="AgvServer" type="log4net.Appender.RollingFileAppender">
<file value="logs/AgvServer.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<appender name="LineWebService" type="log4net.Appender.RollingFileAppender">
<file value="logs/LineWebService.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<logger>
<level value="Debug"/>
<appender-ref ref="LineWebService"/>
</logger>
<root>
<level value="Debug"/>
<appender-ref ref="AgvServer"/>
</root>
</log4net>
<appSettings>
<add key="ITS" value="http://10.85.17.233/ESMTCommonInterface/CommonService.asmx/VMIGetBoxDestInfo?boxRFID=" />
<add key="WebService" value="http://127.0.0.1/BenQMIR/Webservice/AGVService.asmx/" />
<add key="http.server" value="http://10.85.199.25/myproject/" />
<add key="FLEET" value="10.85.199.3"/>
<!--<add key="LocalIP" value="192.168.103.12"/>
<add key="AutoCharge" value="false"/>
<add key="ChargeWait" value="1"/>
<add key="ChargeThreshold" value="20,70"/>-->
<add key="MiR_R1763" value="false"/>
<add key="MiR_R1764" value="false"/>
<add key="MiR_R1767" value="false"/>
<add key="MiR_R1768" value="false"/>
<add key="A5" value="false"/>
<add key="A6" value="false"/>
<add key="E1" value="false"/>
<add key="E2" value="false"/>
<add key="E3" value="false"/>
<add key="E4" value="false"/>
<add key="E5" value="false"/>
<add key="E6" value="false"/>
<add key="E7" value="false"/>
<add key="E8" value="false"/>
<add key="E9" value="false"/>
<add key="E10" value="false"/>
<add key="E11" value="false"/>
<add key="E12" value="false"/>
<add key="E13" value="false"/>
<add key="E14" value="false"/>
<add key="E15" value="false"/>
<add key="E16" value="false"/>
<add key="E21" value="false"/>
<add key="E22" value="false"/>
<add key="G1" value="false"/>
<add key="G2" value="false"/>
<add key="G3" value="false"/>
<add key="G4" value="false"/>
<add key="G5" value="false"/>
<add key="G6" value="false"/>
<add key="G7" value="false"/>
<add key="G8" value="false"/>
<add key="G9" value="false"/>
<add key="G10" value="false"/>
<add key="G11" value="false"/>
<add key="G12" value="false"/>
<add key="G13" value="false"/>
<add key="G14" value="false"/>
<add key="G15" value="false"/>
<add key="G16" value="false"/>
<add key="G21" value="false"/>
<add key="G22" value="false"/>
</appSettings>
<add key="FLEET" value="10.85.199.3" />
<add key="AutoCharge" value="True" />
<add key="ChargeWait" value="1" />
<add key="ChargeThreshold" value="20,70" />
<add key="MiR_R1763" value="True" />
<add key="MiR_R1764" value="False" />
<add key="MiR_R1767" value="False" />
<add key="MiR_R1768" value="False" />
<add key="A5" value="True" />
<add key="A6" value="True" />
<add key="E1" value="True" />
<add key="E2" value="True" />
<add key="E3" value="True" />
<add key="E4" value="True" />
<add key="E5" value="True" />
<add key="E6" value="True" />
<add key="E7" value="false" />
<add key="E8" value="True" />
<add key="E9" value="True" />
<add key="E10" value="True" />
<add key="E11" value="True" />
<add key="E12" value="True" />
<add key="E13" value="false" />
<add key="E14" value="True" />
<add key="E15" value="True" />
<add key="E16" value="True" />
<add key="E21" value="True" />
<add key="E22" value="True" />
<add key="G1" value="false" />
<add key="G2" value="false" />
<add key="G3" value="false" />
<add key="G4" value="false" />
<add key="G5" value="false" />
<add key="G6" value="false" />
<add key="G7" value="false" />
<add key="G8" value="false" />
<add key="G9" value="false" />
<add key="G10" value="false" />
<add key="G11" value="false" />
<add key="G12" value="false" />
<add key="G13" value="false" />
<add key="G14" value="false" />
<add key="G15" value="false" />
<add key="G16" value="false" />
<add key="G21" value="false" />
<add key="G22" value="false" />
</appSettings>
<system.serviceModel>
<services>
<!--添加服务-->
<service name="LineWebService.ClsWebService" behaviorConfiguration="CalculatorServiceBehavior">
<!--name 必须与代码中的host实例初始化的服务一样
behaviorConfiguration 行为配置 -->
<host>
<baseAddresses>
<!--添加调用服务地址-->
<add baseAddress="http://10.85.199.1/BenQMIR/Webservice/AGVService.asmx/"/>
</baseAddresses>
</host>
<!--添加契约接口 contract="WcfDemo.IService1" WcfDemo.IService1为契约接口 binding="wsHttpBinding" wsHttpBinding为通过Http调用-->
<endpoint address="" binding="wsHttpBinding" contract="LineWebService.IWebService"></endpoint>
</service>
</services>
<!--定义CalculatorServiceBehavior的行为-->
<behaviors>
<serviceBehaviors>
<behavior name="CalculatorServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
\ No newline at end of file
......@@ -19,3 +19,10 @@ MoveE16,5ec0f64a-b51a-11ea-b6ad-00012998f5a0
MoveE21,37401585-b51b-11ea-b6ad-00012998f5a0
MoveE22,a4846723-b51b-11ea-b6ad-00012998f5a0
Init,adcb7a04-b525-11ea-b6ad-00012998f5a0
Enter,51233d8c-c044-11ea-9a66-94c691a7387d
Leave,2e433130-c045-11ea-9a66-94c691a7387d
MoveStandby,ae6e4f12-c050-11ea-9a66-94c691a7387d
AutoCharge3,b7371c5f-c045-11ea-9a66-94c691a7387d
AutoCharge4,1296084c-c046-11ea-9a66-94c691a7387d
AutoCharge5,40c8f44e-c046-11ea-9a66-94c691a7387d
AutoCharge6,56cca0a3-c046-11ea-9a66-94c691a7387d
7,MiR_R1763,10.85.199.71,Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==
8,MiR_R1764,10.85.199.72,Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==
9,MiR_R1767,10.85.199.73,Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==
10,MiR_R1768,10.85.199.74,Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==
\ No newline at end of file
Fleet ID,agv,IP,Ȩ,IOID
7,MiR_R1763,10.85.199.71,Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==,007615a5-2220-11ea-99f2-94c691a73b53
8,MiR_R1764,10.85.199.72,Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==,007615a5-2220-11ea-99f2-94c691a73b53
9,MiR_R1767,10.85.199.73,Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==,007615a5-2220-11ea-99f2-94c691a73b53
10,MiR_R1768,10.85.199.74,Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==,007615a5-2220-11ea-99f2-94c691a73b53
A5,A5,
A6,A6,
D1,E1,10.85.199.42
D2,E2,10.85.199.90
D3,E3,10.85.199.91
D4,E4,10.85.199.92
D5,E5,10.85.199.93
D6,E6,10.85.199.94
D8,E8,10.85.199.95
D9,E9,10.85.199.180
D10,E10,10.85.199.181
D11,E11,10.85.199.182
D12,E12,10.85.199.183
D14,E14,10.85.199.184
D15,E15,10.85.199.185
D16,E16,10.85.199.96
FeederIn,E21,
FeederOut,E22,
C1,G1,
C2,G2,
C3,G3,
C4,G4,
C5,G5,
C6,G6,
C7,G7,
C8,G8,
C9,G9,
C10,G10,
C11,G11,
C12,G12,
C13,G13,
C14,G14,
C15,G15,
C16,G16,
\ No newline at end of file
²úÏßÃû,½ÚµãÃû,IP,λÖÃÃû³Æ,λÖÃguid
A5,A5,,PA5,7ed952c3-b520-11ea-b6ad-00012998f5a0
A6,A6,,PA6,929eb1c2-b520-11ea-b6ad-00012998f5a0
D1,E1,10.85.199.42,DL1,3b823fe4-b368-11ea-a1a5-00012999830e
D2,E2,10.85.199.90,DL2,ede15fcb-b367-11ea-a1a5-00012999830e
D3,E3,10.85.199.91,DL3,43855a9b-b365-11ea-a1a5-00012999830e
D4,E4,10.85.199.92,DL4,73c8b98c-b368-11ea-a1a5-00012999830e
D5,E5,10.85.199.93,DL5,5436efd7-b432-11ea-a1a5-00012999830e
D6,E6,10.85.199.94,DL6,6b7710c1-b432-11ea-a1a5-00012999830e
D8,E8,10.85.199.95,DL8,8f039d2e-b432-11ea-a1a5-00012999830e
D9,E9,10.85.199.180,DL9,9e0b64ab-b432-11ea-a1a5-00012999830e
D10,E10,10.85.199.181,DL10,aec7da80-b432-11ea-a1a5-00012999830e
D11,E11,10.85.199.182,DL11,c10984c9-b432-11ea-a1a5-00012999830e
D12,E12,10.85.199.183,DL12,d6e0b92a-b432-11ea-a1a5-00012999830e
D14,E14,10.85.199.184,DL14,efb04c55-b432-11ea-a1a5-00012999830e
D15,E15,10.85.199.185,DL15,fd6b1f95-b432-11ea-a1a5-00012999830e
D16,E16,10.85.199.96,line_16,ac6c413e-895e-11ea-9374-000129922ca6
FeederIn,E21,,PA21,
FeederOut,E22,,PA22,
C1,G1,,PA23,
C2,G2,,PA24,
C3,G3,,PA25,
C4,G4,,PA26,
C5,G5,,PA27,
C6,G6,,PA28,
C7,G7,,PA29,
C8,G8,,PA30,
C9,G9,,PA31,
C10,G10,,PA32,
C11,G11,,PA33,
C12,G12,,PA34,
C13,G13,,PA35,
C14,G14,,PA36,
C15,G15,,PA37,
C16,G16,,PA38,
G6
2020-07-15 21:20:59,E22
2020-07-15 21:21:01,E22
2020-07-15 21:21:02,E22
2020-07-15 21:21:03,E22
2020-07-15 21:21:03,E22
2020-07-15 21:21:07,E22
2020-07-15 21:21:17,E22
2020-07-15 21:21:17,E22
2020-07-15 21:21:19,E22
2020-07-15 21:21:19,E22
[2020-07-04 09:46:07,069][1]INFO =====程序开始=====
[2020-07-04 09:46:12,391][1]DEBUG HttpGet URL: http://10.85.199.71/api/v2.0.0/registers/20?whitelist=value Return:
[2020-07-04 09:46:12,391][1]ERROR CheckAGVMissionState 获取PLC20失败
[2020-07-04 09:46:17,460][1]DEBUG HttpGet URL: http://10.85.199.72/api/v2.0.0/registers/20?whitelist=value Return:
[2020-07-04 09:46:17,460][1]ERROR CheckAGVMissionState 获取PLC20失败
[2020-07-04 09:46:22,528][1]DEBUG HttpGet URL: http://10.85.199.73/api/v2.0.0/registers/20?whitelist=value Return:
[2020-07-04 09:46:22,528][1]ERROR CheckAGVMissionState 获取PLC20失败
[2020-07-04 09:46:27,596][1]DEBUG HttpGet URL: http://10.85.199.74/api/v2.0.0/registers/20?whitelist=value Return:
[2020-07-04 09:46:27,596][1]ERROR CheckAGVMissionState 获取PLC20失败
[2020-07-04 09:46:27,600][1]INFO Server Start
[2020-07-04 09:46:28,171][1]ERROR Open
System.ServiceModel.AddressAccessDeniedException: HTTP 无法注册 URL http://+:80/Webservice/AGVService/。进程不具有此命名空间的访问权限(有关详细信息,请参见 http://go.microsoft.com/fwlink/?LinkId=70353)。 ---> System.Net.HttpListenerException: 拒绝访问。
在 System.Net.HttpListener.AddAllPrefixes()
在 System.Net.HttpListener.Start()
在 System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen()
--- 内部异常堆栈跟踪的结尾 ---
在 System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen()
在 System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener)
在 System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback)
在 System.ServiceModel.Channels.TransportChannelListener.OnOpen(TimeSpan timeout)
在 System.ServiceModel.Channels.HttpChannelListener`1.OnOpen(TimeSpan timeout)
在 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
在 System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout)
在 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
在 System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
在 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
在 System.ServiceModel.Channels.CommunicationObject.Open()
在 BLL.WebService.Open(String url) 位置 C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\BLL\WebService.cs:行号 85
[2020-07-04 09:46:30,293][1]INFO Ping 10.85.199.71 请求没有响应
[2020-07-04 09:46:32,292][1]INFO Ping 10.85.199.72 请求没有响应
[2020-07-04 09:46:32,292][1]INFO E1 Ping 10.85.199.42 请求没有响应
[2020-07-04 09:46:34,292][1]INFO Ping 10.85.199.73 请求没有响应
[2020-07-04 09:46:34,293][1]INFO E2 Ping 10.85.199.90 请求没有响应
[2020-07-04 09:46:36,292][1]INFO Ping 10.85.199.74 请求没有响应
[2020-07-04 09:46:36,292][1]INFO E3 Ping 10.85.199.91 请求没有响应
[2020-07-04 09:46:38,293][1]INFO E4 Ping 10.85.199.92 请求没有响应
[2020-07-04 09:46:39,292][1]INFO Ping 10.85.199.71 请求没有响应
[2020-07-04 09:46:40,292][1]INFO E5 Ping 10.85.199.93 请求没有响应
[2020-07-04 09:46:41,292][1]INFO Ping 10.85.199.72 请求没有响应
[2020-07-04 09:46:42,292][1]INFO E6 Ping 10.85.199.94 请求没有响应
[2020-07-04 09:46:43,292][1]INFO Ping 10.85.199.73 请求没有响应
[2020-07-04 09:46:44,291][1]INFO E8 Ping 10.85.199.95 请求没有响应
[2020-07-04 09:46:45,292][1]INFO Ping 10.85.199.74 请求没有响应
[2020-07-04 09:46:46,293][1]INFO E9 Ping 10.85.199.180 请求没有响应
[2020-07-04 09:46:48,292][1]INFO Ping 10.85.199.71 请求没有响应
[2020-07-04 09:46:48,292][1]INFO E10 Ping 10.85.199.181 请求没有响应
[2020-07-04 09:46:50,292][1]INFO Ping 10.85.199.72 请求没有响应
[2020-07-04 09:46:50,293][1]INFO E11 Ping 10.85.199.182 请求没有响应
[2020-07-04 09:46:52,292][1]INFO Ping 10.85.199.73 请求没有响应
[2020-07-04 09:46:52,292][1]INFO E12 Ping 10.85.199.183 请求没有响应
[2020-07-04 09:46:54,291][1]INFO Ping 10.85.199.74 请求没有响应
[2020-07-04 09:46:54,291][1]INFO E14 Ping 10.85.199.184 请求没有响应
[2020-07-04 09:46:56,292][1]INFO E15 Ping 10.85.199.185 请求没有响应
[2020-07-04 09:46:57,292][1]INFO Ping 10.85.199.71 请求没有响应
[2020-07-04 09:46:58,292][1]INFO E16 Ping 10.85.199.96 请求没有响应
[2020-07-04 09:46:59,292][1]INFO Ping 10.85.199.72 请求没有响应
[2020-07-04 09:47:01,292][1]INFO Ping 10.85.199.73 请求没有响应
[2020-07-04 09:47:03,292][1]INFO Ping 10.85.199.74 请求没有响应
[2020-07-04 09:47:03,292][1]INFO E1 Ping 10.85.199.42 请求没有响应
[2020-07-04 09:47:05,293][1]INFO E2 Ping 10.85.199.90 请求没有响应
[2020-07-04 09:47:06,292][1]INFO Ping 10.85.199.71 请求没有响应
[2020-07-04 09:47:07,294][1]INFO E3 Ping 10.85.199.91 请求没有响应
[2020-07-04 13:59:40,139][1]INFO =====程序开始=====
[2020-07-04 13:59:45,446][1]DEBUG HttpGet URL: http://10.85.199.71/api/v2.0.0/registers/20?whitelist=value Return:
[2020-07-04 13:59:45,446][1]ERROR CheckAGVMissionState 获取PLC20失败
[2020-07-04 13:59:50,513][1]DEBUG HttpGet URL: http://10.85.199.72/api/v2.0.0/registers/20?whitelist=value Return:
[2020-07-04 13:59:50,513][1]ERROR CheckAGVMissionState 获取PLC20失败
[2020-07-04 13:59:55,582][1]DEBUG HttpGet URL: http://10.85.199.73/api/v2.0.0/registers/20?whitelist=value Return:
[2020-07-04 13:59:55,582][1]ERROR CheckAGVMissionState 获取PLC20失败
[2020-07-04 14:00:00,650][1]DEBUG HttpGet URL: http://10.85.199.74/api/v2.0.0/registers/20?whitelist=value Return:
[2020-07-04 14:00:00,650][1]ERROR CheckAGVMissionState 获取PLC20失败
[2020-07-04 14:00:00,655][1]INFO Server Start
[2020-07-04 14:00:01,172][1]ERROR Open
System.ServiceModel.AddressAccessDeniedException: HTTP 无法注册 URL http://+:80/Webservice/AGVService/。进程不具有此命名空间的访问权限(有关详细信息,请参见 http://go.microsoft.com/fwlink/?LinkId=70353)。 ---> System.Net.HttpListenerException: 拒绝访问。
在 System.Net.HttpListener.AddAllPrefixes()
在 System.Net.HttpListener.Start()
在 System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen()
--- 内部异常堆栈跟踪的结尾 ---
在 System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen()
在 System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener)
在 System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback)
在 System.ServiceModel.Channels.TransportChannelListener.OnOpen(TimeSpan timeout)
在 System.ServiceModel.Channels.HttpChannelListener`1.OnOpen(TimeSpan timeout)
在 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
在 System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout)
在 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
在 System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
在 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
在 System.ServiceModel.Channels.CommunicationObject.Open()
在 BLL.WebService.Open(String url) 位置 C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\BLL\WebService.cs:行号 85
[2020-07-04 14:00:03,272][1]INFO Ping 10.85.199.71 请求没有响应
[2020-07-04 14:00:05,271][1]INFO Ping 10.85.199.72 请求没有响应
[2020-07-04 14:00:05,271][1]INFO E1 Ping 10.85.199.42 请求没有响应
[2020-07-04 14:00:06,288][1]INFO Ping 10.85.199.73 请求没有响应
[2020-07-04 14:00:06,288][1]INFO E2 Ping 10.85.199.90 请求没有响应
[2020-07-04 14:00:08,270][1]INFO Ping 10.85.199.74 请求没有响应
[2020-07-04 14:00:08,270][1]INFO E3 Ping 10.85.199.91 请求没有响应
[2020-07-04 14:00:09,290][1]INFO E4 Ping 10.85.199.92 请求没有响应
[2020-07-04 14:00:11,270][1]INFO Ping 10.85.199.71 请求没有响应
[2020-07-04 14:00:11,271][1]INFO E5 Ping 10.85.199.93 请求没有响应
[2020-07-04 14:00:12,287][1]INFO Ping 10.85.199.72 请求没有响应
[2020-07-04 14:00:12,288][1]INFO E6 Ping 10.85.199.94 请求没有响应
[2020-07-04 14:00:14,272][1]INFO Ping 10.85.199.73 请求没有响应
[2020-07-04 14:00:14,272][1]INFO E8 Ping 10.85.199.95 请求没有响应
[2020-07-04 14:00:15,321][1]INFO Ping 10.85.199.74 请求没有响应
[2020-07-04 14:00:15,321][1]INFO E9 Ping 10.85.199.180 请求没有响应
[2020-07-04 14:00:17,271][1]INFO E10 Ping 10.85.199.181 请求没有响应
[2020-07-04 14:00:18,270][1]INFO Ping 10.85.199.71 请求没有响应
[2020-07-04 14:00:18,328][1]INFO E11 Ping 10.85.199.182 请求没有响应
[2020-07-04 14:00:18,330][1]INFO Ping 10.85.199.72 请求没有响应
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.6.1", FrameworkDisplayName = ".NET Framework 4.6.1")]
bdf0a9ce03cae62dbc2f07d60fde59a6099eae99
2938b01b9d0da9b4db34a54b73f7f95a0ffd690c
......@@ -32,3 +32,4 @@ C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.exe
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.pdb
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\bin\Debug\Newtonsoft.Json.dll
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.csproj.CoreCompileInputs.cache
......@@ -22,7 +22,7 @@ namespace AsaPL
private readonly log4net.ILog LOG;
private readonly string IP; //远程IP地址
private const int PORT = 9500; //端口
private const int PORT = 9501; //端口
private const int SEND_INTERVAL = 2000; //客户端发送所有节点后的间隔
/// <summary>
......
......@@ -18,3 +18,4 @@ C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClient\bin\Debug\AsaPL.AgvClient
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClient\obj\Debug\AgvClient.csproj.CopyComplete
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClient\obj\Debug\AsaPL.AgvClient.dll
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClient\obj\Debug\AsaPL.AgvClient.pdb
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClient\obj\Debug\AgvClient.csprojAssemblyReference.cache
......@@ -33,6 +33,10 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="AsaPL.AgvClient, Version=1.0.0.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\AgvClient\bin\Debug\AsaPL.AgvClient.dll</HintPath>
</Reference>
<Reference Include="log4net">
<HintPath>..\..\..\DLL\log4net.dll</HintPath>
</Reference>
......@@ -82,11 +86,5 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AgvClient\AgvClient.csproj">
<Project>{d9154766-67b0-4082-af8b-dcc7c4cfb5a2}</Project>
<Name>AgvClient</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
......@@ -18,7 +18,7 @@
</layout>
</appender>
<root>
<level value="Debug"/>
<level value="Info"/>
<appender-ref ref="AgvClient"/>
</root>
</log4net>
......
......@@ -25,11 +25,61 @@ namespace AgvClientTest
comboBox1.Items.Add((AsaPL.ClientAction)i);
comboBox1.SelectedIndex = 0;
comboBox2.SelectedIndex = 0;
comboBox3.Items.Add(AsaPL.ClientAction.MayEnter);
comboBox3.Items.Add(AsaPL.ClientAction.MayLeave);
comboBox3.SelectedIndex = 0;
client = new AsaPL.AgvClient("10.85.199.1");
client.SetStatus("E1", "C6", AsaPL.ClientAction.None);
client.ReadyEnter += AGV_ReadyEnter;
client.ReadyLeave += AGV_ReadyLeave;
client.SetStatus("E1", "", AsaPL.ClientAction.None);
client.SetStatus("E2", "", AsaPL.ClientAction.None);
client.SetStatus("E3", "", AsaPL.ClientAction.None);
client.SetStatus("E4", "", AsaPL.ClientAction.None);
client.SetStatus("E5", "", AsaPL.ClientAction.None);
client.SetStatus("E6", "", AsaPL.ClientAction.None);
client.SetStatus("E8", "", AsaPL.ClientAction.None);
client.SetStatus("E9", "", AsaPL.ClientAction.None);
client.SetStatus("E10", "", AsaPL.ClientAction.None);
client.SetStatus("E11", "", AsaPL.ClientAction.None);
client.SetStatus("E12", "", AsaPL.ClientAction.None);
client.SetStatus("E14", "", AsaPL.ClientAction.None);
client.SetStatus("E15", "", AsaPL.ClientAction.None);
client.SetStatus("E16", "", AsaPL.ClientAction.None);
client.SetStatus("E21", "", AsaPL.ClientAction.None);
client.SetStatus("E22", "", AsaPL.ClientAction.None);
client.Connect();
}
private void AGV_ReadyEnter(string nodeName)
{
if (checkBox1.Checked)
{
if (nodeName.StartsWith("A") || nodeName.EndsWith("A"))
return;
label4.Text = "收到" + nodeName + "ReadyEnter,节点状态变为MayEnter";
client.SetStatus(nodeName, "", AsaPL.ClientAction.MayEnter);
System.Threading.Thread.Sleep(10000);
client.SetStatus(nodeName, "", AsaPL.ClientAction.None);
label4.Text = "设置" + nodeName + " None";
}
}
private void AGV_ReadyLeave(string nodeName)
{
if (checkBox1.Checked)
{
if (nodeName.StartsWith("A") || nodeName.EndsWith("A"))
return;
label4.Text = "收到" + nodeName + "ReadyLeave,节点状态变为MayLeave";
client.SetStatus(nodeName, "", AsaPL.ClientAction.MayLeave);
System.Threading.Thread.Sleep(10000);
client.SetStatus(nodeName, "", AsaPL.ClientAction.None);
label4.Text = "设置" + nodeName + " None";
}
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
client.Close();
......@@ -37,7 +87,31 @@ namespace AgvClientTest
private void button1_Click(object sender, EventArgs e)
{
client.SetStatus(comboBox2.SelectedItem.ToString(), textBox1.Text, (AsaPL.ClientAction)comboBox1.SelectedIndex);
Task task = new Task(new Action(() => {
client.SetStatus(comboBox2.SelectedItem.ToString(), textBox1.Text, (AsaPL.ClientAction)comboBox1.SelectedIndex);
System.Threading.Thread.Sleep(10000);
client.SetStatus(comboBox2.SelectedItem.ToString(), "", AsaPL.ClientAction.None);
label4.Text = "设置" + comboBox2.SelectedItem.ToString() + " None";
}));
task.Start();
}
private void SetLineState(object sender, EventArgs e)
{
Task task = new Task(new Action(()=>{
if (comboBox3.SelectedItem == null)
return;
string name = ((Button)sender).Text;
client.SetStatus(name, "", (AsaPL.ClientAction)Enum.Parse(typeof(AsaPL.ClientAction), comboBox3.SelectedItem.ToString()));
label5.Text = name + " " + comboBox3.SelectedItem.ToString();
System.Threading.Thread.Sleep(10000);
client.SetStatus(name, "", AsaPL.ClientAction.None);
label5.Text = "设置" + name + " None";
}));
task.Start();
}
}
}
......@@ -18,7 +18,7 @@
</layout>
</appender>
<root>
<level value="Debug"/>
<level value="Info"/>
<appender-ref ref="AgvClient"/>
</root>
</log4net>
......
此文件的差异太大,无法显示。
此文件的差异太大,无法显示。
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.6.1", FrameworkDisplayName = ".NET Framework 4.6.1")]
cd533fd09db9d85c047943019fec2d488dbf0b20
bdcb49d390ac20e7bf0fe235fb5519caf9b8a06d
......@@ -17,10 +17,10 @@ C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\bin\Debug\AgvClientTe
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\bin\Debug\AgvClientTest.pdb
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\bin\Debug\AsaPL.AgvClient.dll
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\bin\Debug\AsaPL.AgvClient.pdb
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\obj\Debug\AgvClientTest.csprojAssemblyReference.cache
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\obj\Debug\AgvClientTest.Form1.resources
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\obj\Debug\AgvClientTest.Properties.Resources.resources
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\obj\Debug\AgvClientTest.csproj.GenerateResource.cache
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\obj\Debug\AgvClientTest.csproj.CopyComplete
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\obj\Debug\AgvClientTest.exe
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\obj\Debug\AgvClientTest.pdb
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\obj\Debug\AgvClientTest.csproj.CoreCompileInputs.cache
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
</appSettings>
<system.web>
<compilation debug="true"/>
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<protocolMapping>
<add scheme="https" binding="basicHttpsBinding" />
</protocolMapping>
<bindings>
<webHttpBinding>
<binding name="webBinding" maxReceivedMessageSize="2147483647" crossDomainScriptAccessEnabled="true" >
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="LineWebService.ClsWebService" behaviorConfiguration="RESTBehavior">
<host>
<baseAddresses>
<add baseAddress = "http://localhost:11111/BenQMIR/Webservice/AGVService.asmx" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address =""
binding="webHttpBinding"
contract="LineWebService.IWebService"
behaviorConfiguration="ESEndPointBehavior">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="RESTBehavior">
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="True"/>
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="ESEndPointBehavior">
<webHttp helpEnabled="true" />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
</configuration>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
namespace LineWebService
{
// 注意: 使用“重构”菜单上的“重命名”命令,可以同时更改代码和配置文件中的类名“Service1”。
//[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Reentrant)]
///[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)]
public class ClsWebService : IWebService
{
//private readonly log4net.ILog LOG = log4net.LogManager.GetLogger("ClsWebService");
public ClsWebService()
{
}
public Result CreateEmptyRecycleTask(string line)
{
//LOG.Info("CreateEmptyRecycleTask emptyStation=" + line);
Result res;
if (!line.Equals(""))
{
res = new Result() { Succeed = "true", ResultData = "", ErrorMessage = "" };
//IWebService_Callback callback = OperationContext.Current.GetCallbackChannel<IWebService_Callback>();
//callback.GetEmptyRecycleTask(line);
}
else
{
res = new Result() { Succeed = "false", ResultData = "", ErrorMessage = "Not find " + line };
}
//if (AGVControl.Common.agvProductionLine.TryGetValue(line, out string value))
//{
// res = new Result() { Succeed = "true", ResultData = "", ErrorMessage = "" };
//LOG.Info("WebService Response OK");
// //加到任务
// //int idx = AGVControl.Common.nodeInfo.FindIndex(s => s.Name == value);
// //if (idx > -1)
// // AGVControl.Common.linePlace.Add(value);
// //else
// // AGVControl.Common.log.Error("CreateEmptyRecycleTask " + value + "不存在");
// if (!Common.AddLinePlace(value))
// Common.log.Error("CreateEmptyRecycleTask 节点【" + value + "】不存在");
// else
// {
// Common.LogInfo("任务:" + value + " 出空料架 【" + line + "】");
// }
// //System.IO.File.WriteAllLines(Common.CONFIG_PATH + "LinePlace.txt", Common.linePlace);
//}
//else
//{
// res = new Result() { Succeed = "false", ResultData = "", ErrorMessage = "Not find " + line };
//LOG.Info("WebService Response false");
//}
return res;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
namespace LineWebService
{
// 注意: 使用“重构”菜单上的“重命名”命令,可以同时更改代码和配置文件中的接口名“IService1”。
[ServiceContract]//(CallbackContract = typeof(IWebService_Callback))
public interface IWebService
{
[OperationContract]
[WebInvoke(UriTemplate = "CreateEmptyRecycleTask?emptyStation={line}", Method = "Get",
BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result CreateEmptyRecycleTask(string line);
//log4net.Config.XmlConfigurator.Configure();
// TODO: 在此添加您的服务操作
}
//[ServiceContract]
//public interface IWebService_Callback
//{
// [OperationContract(IsOneWay = true)]
// void GetEmptyRecycleTask(string lineName);
//}
// 使用下面示例中说明的数据约定将复合类型添加到服务操作。
[DataContract]
public class Result
{
[DataMember]
public string Succeed { get; set; }
[DataMember]
public string ResultData { get; set; }
[DataMember]
public string ErrorMessage { get; set; }
}
}
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{074D4597-8955-4EEE-840A-8FAA9B174603}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WebService</RootNamespace>
<AssemblyName>WebService</AssemblyName>
<ProjectTypeGuids>{3D9AD99F-2412-4246-B90B-4EAA41C64699};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<StartArguments>/client:"WcfTestClient.exe"</StartArguments>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<WcfConfigValidationEnabled>True</WcfConfigValidationEnabled>
<XsdCodeGenEnabled>True</XsdCodeGenEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.ServiceModel.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="IWebService.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ClsWebService.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<VSToolsPath Condition="'$(VSToolsPath)' == '' and '$(VisualStudioVersion)' != '' and '$(VisualStudioVersion)' != '11.0'">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio</VSToolsPath>
<WcfServiceModelTargetPath>$(VSToolsPath)\WCF</WcfServiceModelTargetPath>
</PropertyGroup>
<Import Project="$(WcfServiceModelTargetPath)\Microsoft.VisualStudio.ServiceModel.targets" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{3D9AD99F-2412-4246-B90B-4EAA41C64699}">
<WcfProjectProperties>
<AutoStart>True</AutoStart>
</WcfProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{3D9AD99F-2412-4246-B90B-4EAA41C64699}">
<WcfProjectProperties>
<PublishCopyOption>RunFiles</PublishCopyOption>
<PublishTargetLocation>
</PublishTargetLocation>
<PublishDeleteAllFiles>False</PublishDeleteAllFiles>
</WcfProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>
\ No newline at end of file
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("WebService")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebService")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//将 ComVisible 设置为 false 将使此程序集中的类型
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("074d4597-8955-4eee-840a-8faa9b174603")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]
此文件类型无法预览
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
</appSettings>
<system.web>
<compilation debug="true"/>
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<protocolMapping>
<add scheme="https" binding="basicHttpsBinding" />
</protocolMapping>
<bindings>
<webHttpBinding>
<binding name="webBinding" maxReceivedMessageSize="2147483647" crossDomainScriptAccessEnabled="true" >
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="LineWebService.ClsWebService" behaviorConfiguration="RESTBehavior">
<host>
<baseAddresses>
<add baseAddress = "http://localhost:11111/BenQMIR/Webservice/AGVService.asmx" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address =""
binding="webHttpBinding"
contract="LineWebService.IWebService"
behaviorConfiguration="ESEndPointBehavior">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="RESTBehavior">
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="True"/>
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="ESEndPointBehavior">
<webHttp helpEnabled="true" />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
</configuration>
此文件类型无法预览
此文件类型无法预览
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.6.1", FrameworkDisplayName = ".NET Framework 4.6.1")]
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\WebService\bin\Debug\WebService.dll.config
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\WebService\bin\Debug\WebService.dll
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\WebService\bin\Debug\WebService.pdb
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\WebService\obj\Debug\LineWebService.csproj.CoreCompileInputs.cache
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\WebService\obj\Debug\LineWebService.csproj.CopyComplete
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\WebService\obj\Debug\WebService.dll
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\WebService\obj\Debug\WebService.pdb
<ValidationRecord xmlns="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.ServiceModel.Validation" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><TimeStamps xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"><a:dateTime>2020-07-13T08:16:06.3485648Z</a:dateTime><a:dateTime>2020-07-13T10:34:24.1092534Z</a:dateTime><a:dateTime>2020-07-11T07:25:50.8678866Z</a:dateTime></TimeStamps></ValidationRecord>
\ No newline at end of file
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
using BLL.BLL;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
namespace BLL
{
public class AGVManager
{
//public static string Add_emptyMsg = "http://10.85.199.1/BenQMIR/Webservice/AGVService.asmx/CreateEmptyRecycleTask";//"http://localhost:11111/BenQMIR/Webservice/AGVService.asmx/CreateEmptyRecycleTask";//
public static string CreateEmptyTask(string Add_emptyMsg, string line)
{
try
{
//Dictionary<string, string> paramMap = new Dictionary<string, string>();
//paramMap.Add("emptyStation", "D1");
string path = Add_emptyMsg;
//foreach (string paramName in paramMap.Keys)
//{
// string par = System.Web.HttpUtility.UrlEncode(paramMap[paramName], System.Text.Encoding.UTF8);
// path += paramName + "=" + par + "&";
//}
//path = path.Substring(0, path.Length - 1);
string resultStr = HttpUtil.Post(path, "emptyStation=" + line);//HttpHelper.Post(path, "");
//Common.log.Debug("【" + path + "】【" + resultStr + "】");
//Result data = JsonHelper.DeserializeJsonToObject<Result>(resultStr);
return resultStr;
//if (data == null)
//{
// return " updateDeviceAlarmMsg 没有收到服务器反馈";
//}
//else
//{
// return data.Succeed;
//}
}
catch (Exception e)
{
return e.ToString();
}
}
public static Result GetWebservice(string Add_emptyMsg,string id)
{
Result rb = new Result();
try
{
//http://10.85.36.156/BenQMIR/Webservice/AGVService.asmx
string strURL = Add_emptyMsg + "?emptyStation=" + id;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(strURL);
//request.Method="get";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream s = response.GetResponseStream();
XmlTextReader Reader = new XmlTextReader(s);
Reader.MoveToContent();
string strValue = Reader.ReadInnerXml();
strValue = strValue.Replace("&lt;", "<");
strValue = strValue.Replace("&gt;", ">");
//{"Succeed":false,"ResultData":null,"ErrorMessage":"无法通过[Feederaaaa]lineCode找到小车停靠点"}
rb = JsonConvert.DeserializeObject<Result>(strValue);
Reader.Close();
}
catch (Exception e)
{
System.Windows.Forms.MessageBox.Show(e.Message);
}
return rb;
}
}
public class Result
{
public string Succeed { get; set; }
public string ResultData { get; set; }
public string ErrorMessage { get; set; }
}
}
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
</appSettings>
<system.web>
<compilation debug="true"/>
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<protocolMapping>
<add scheme="https" binding="basicHttpsBinding" />
</protocolMapping>
<bindings>
<webHttpBinding>
<binding name="webBinding" maxReceivedMessageSize="2147483647" crossDomainScriptAccessEnabled="true" >
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="LineWebService.ClsWebService" behaviorConfiguration="RESTBehavior">
<host>
<baseAddresses>
<add baseAddress = "http://localhost:22222/BenQMIR/Webservice/AGVService.asmx/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address =""
binding="webHttpBinding"
contract="LineWebService.IWebService"
behaviorConfiguration="ESEndPointBehavior">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="RESTBehavior">
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="True"/>
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="ESEndPointBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
</configuration>
namespace WebServiceTest
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.button3 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.button4 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(12, 12);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(132, 54);
this.button1.TabIndex = 0;
this.button1.Text = "监听";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(12, 90);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(132, 54);
this.button2.TabIndex = 1;
this.button2.Text = "关闭";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(26, 187);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(55, 15);
this.label1.TabIndex = 2;
this.label1.Text = "label1";
//
// button3
//
this.button3.Location = new System.Drawing.Point(273, 90);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(132, 54);
this.button3.TabIndex = 3;
this.button3.Text = "访问";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(150, 12);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(497, 72);
this.textBox1.TabIndex = 4;
this.textBox1.Text = "http://127.0.0.1/BenQMIR/Webservice/AGVService.asmx/CreateEmptyRecycleTask";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(160, 119);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(79, 25);
this.textBox2.TabIndex = 5;
this.textBox2.Text = "D1";
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(150, 176);
this.textBox3.Multiline = true;
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(497, 160);
this.textBox3.TabIndex = 6;
//
// button4
//
this.button4.Location = new System.Drawing.Point(443, 90);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(132, 54);
this.button4.TabIndex = 7;
this.button4.Text = "feeder区访问";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(678, 368);
this.Controls.Add(this.button4);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button3);
this.Controls.Add(this.label1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "客户端创建产线任务";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Button button4;
}
}
using LineWebService;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.ServiceModel.Web;
using System.ServiceModel;
using System.Linq.Expressions;
using BLL;
namespace WebServiceTest
{
public partial class Form1 : Form//, IWebService_Callback
{
public Form1()
{
InitializeComponent();
}
private WebServiceHost _serviceHost;
public void HostOpen()
{
try
{
ClsWebService service = new ClsWebService();
_serviceHost = new WebServiceHost(typeof(ClsWebService));//service, new Uri(url)
if (_serviceHost.State != CommunicationState.Opened)//判断服务是否关闭
{
_serviceHost.Open();
}
label1.Text="Web服务已开启";
}
catch (Exception ex)
{
//AGVControl.Common.log.Error("Open", ex);
MessageBox.Show(ex.ToString());
}
}
public void HostClose()
{
try
{
if (_serviceHost.State != CommunicationState.Closed)//判断服务是否关闭
{
_serviceHost.Close();//关闭服务
}
//_serviceHost.Close();
label1.Text="Web服务已关闭";
}
catch (Exception ex)
{
//AGVControl.Common.log.Error("Close", ex);
MessageBox.Show(ex.ToString());
}
}
//public void GetEmptyRecycleTask(string lineName)
//{
// label1.Text = lineName;
// MessageBox.Show(lineName);
//}
public void RecycleTask(string lineName)
{
label1.Text = lineName;
MessageBox.Show(lineName);
//if (AGVControl.Common.agvProductionLine.TryGetValue(lineName, out string value))
//{
// AGVControl.Common.LogInfo("WebService Response OK");
// //加到任务
// //int idx = AGVControl.Common.nodeInfo.FindIndex(s => s.Name == value);
// //if (idx > -1)
// // AGVControl.Common.linePlace.Add(value);
// //else
// // AGVControl.Common.log.Error("CreateEmptyRecycleTask " + value + "不存在");
// if (!Common.AddLinePlace(value))
// Common.log.Error("CreateEmptyRecycleTask 节点【" + value + "】不存在");
// else
// {
// Common.LogInfo("任务:" + value + " 出空料架 【" + lineName + "】");
// }
// //System.IO.File.WriteAllLines(Common.CONFIG_PATH + "LinePlace.txt", Common.linePlace);
//}
//else
//{
// AGVControl.Common.LogInfo("WebService Response false");
//}
}
private void button1_Click(object sender, EventArgs e)
{
HostOpen();
}
private void button2_Click(object sender, EventArgs e)
{
HostClose();
}
private void button3_Click(object sender, EventArgs e)
{
textBox3.Text=AGVManager.CreateEmptyTask(textBox1.Text,textBox2.Text);
}
private void button4_Click(object sender, EventArgs e)
{
AGVManager.GetWebservice(textBox1.Text, textBox2.Text);
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Collections;
using System.Net;
using System.Net.Security;
using System.Security;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Reflection;
using System.Net.NetworkInformation;
using BLL;
namespace BLL
{
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Collections;
using System.Net;
using System.Net.Security;
using System.Security;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Reflection;
using log4net;
using Newtonsoft.Json;
using System.Windows.Forms;
namespace BLL
{
public class HttpUtil
{
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static string Post(string url, string paramData)
{
return Post(url, paramData, Encoding.UTF8);
}
public static T ObjPost<T>(string url, object o) where T : class
{
try
{
string json = JsonUtil.SerializeObject(o);
string result = Post(url, json);
if (!string.IsNullOrEmpty(result))
{
return JsonUtil.DeserializeJsonToObject<T>(result);
}
}
catch (Exception ex)
{
LOGGER.Error("Http post 出错" + ex);
}
return default(T);
}
public static List<T> ListPost<T>(string url, object o) where T : class
{
try
{
string json = JsonUtil.SerializeObject(o);
string result = Post(url, json);
if (!string.IsNullOrEmpty(result))
{
return JsonUtil.DeserializeJsonToList<T>(result);
}
}
catch (Exception ex)
{
LOGGER.Error("Http post 出错" + ex);
}
return new List<T>();
}
public static string Post(string url, string paramData, Encoding encoding)
{
string result = "";
if (url.ToLower().IndexOf("https", System.StringComparison.Ordinal) > -1)
{
ServicePointManager.ServerCertificateValidationCallback =
new RemoteCertificateValidationCallback((sender, certificate, chain, errors) => { return true; });
}
try
{
var wc = new TimeoutWebClient(5000);
if (string.IsNullOrEmpty(wc.Headers["Content-Type"]))
//wc.Headers.Add("Content-Type", "application/json;charset=UTF-8");
//如果需要将body中的参数以key/value格式发送到服务器,使用下面的Header
wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
wc.Encoding = encoding;
//paramData = Uri.EscapeDataString(paramData);
result = wc.UploadString(url, "POST", paramData);
//LogUtil.info(result);
}
catch (Exception e)
{
MessageBox.Show(e.Message);
LOGGER.Error("POST【" + paramData + "】 ERROR:", e);
}
//LOGGER.Info("post receive <<" + result );
return result;
}
public static string Get(string url)
{
return Get(url, Encoding.UTF8);
}
public static string Get(string url, Encoding encoding)
{
try
{
LOGGER.Info("HTTP GET FROM: " + url);
var wc = new WebClient { Encoding = encoding };
var readStream = wc.OpenRead(url);
using (var sr = new StreamReader(readStream, encoding))
{
var result = sr.ReadToEnd();
LOGGER.Info("get receive << " + result);
return result;
}
}
catch (Exception e)
{
LOGGER.Error("HTTP GET ERROR:", e);
}
return "";
}
}
/// <summary>
/// Json帮助类
/// </summary>
public class JsonUtil
{
/// <summary>
/// 将对象序列化为JSON格式
/// </summary>
/// <param name="o">对象</param>
/// <returns>json字符串</returns>
public static string SerializeObject(object o)
{
string json = JsonConvert.SerializeObject(o);
return json;
}
/// <summary>
/// 解析JSON字符串生成对象实体
/// </summary>
/// <typeparam name="T">对象类型</typeparam>
/// <param name="json">json字符串(eg.{"ID":"112","Name":"石子儿"})</param>
/// <returns>对象实体</returns>
public static T DeserializeJsonToObject<T>(string json) where T : class
{
JsonSerializer serializer = new JsonSerializer();
StringReader sr = new StringReader(json);
object o = serializer.Deserialize(new JsonTextReader(sr), typeof(T));
T t = o as T;
return t;
}
/// <summary>
/// 解析JSON数组生成对象实体集合
/// </summary>
/// <typeparam name="T">对象类型</typeparam>
/// <param name="json">json数组字符串(eg.[{"ID":"112","Name":"石子儿"}])</param>
/// <returns>对象实体集合</returns>
public static List<T> DeserializeJsonToList<T>(string json) where T : class
{
JsonSerializer serializer = new JsonSerializer();
StringReader sr = new StringReader(json);
object o = serializer.Deserialize(new JsonTextReader(sr), typeof(List<T>));
List<T> list = o as List<T>;
return list;
}
/// <summary>
/// 反序列化JSON到给定的匿名对象.
/// </summary>
/// <typeparam name="T">匿名对象类型</typeparam>
/// <param name="json">json字符串</param>
/// <param name="anonymousTypeObject">匿名对象</param>
/// <returns>匿名对象</returns>
public static T DeserializeAnonymousType<T>(string json, T anonymousTypeObject)
{
T t = JsonConvert.DeserializeAnonymousType(json, anonymousTypeObject);
return t;
}
}
public class TimeoutWebClient : WebClient
{
private int _timeout;
/// <summary>
/// 超时时间(毫秒)
/// </summary>
public int Timeout
{
get
{
return _timeout;
}
set
{
_timeout = value;
}
}
public TimeoutWebClient()
{
this._timeout = 60000;
}
public TimeoutWebClient(int timeout)
{
this._timeout = timeout;
}
protected override WebRequest GetWebRequest(Uri address)
{
var result = base.GetWebRequest(address);
result.Timeout = this._timeout;
return result;
}
}
}
}
\ No newline at end of file
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!