This commit is contained in:
@ -1,6 +1,7 @@
|
||||
using Epost.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -9,18 +10,19 @@ namespace Epost.Common
|
||||
{
|
||||
public class AgvHelper
|
||||
{
|
||||
string agvUrl = ConfigurationManager.AppSettings["agvUrl"];
|
||||
HttpHelper http = new HttpHelper();
|
||||
#region 生成任务单
|
||||
public AgvResultModel genAgvSchedulingTask(AgvReqModel model)
|
||||
public AgvResultModel genAgvSchedulingTask(AgvSchedulingTaskModel model)
|
||||
{
|
||||
string url = string.Empty;
|
||||
|
||||
AgvResultModel resmodel = new AgvResultModel();
|
||||
try
|
||||
{
|
||||
{
|
||||
|
||||
string postData = JsonHelper.SerializeObject(model);
|
||||
LogHelper.WriteLogInfo("调用AGV生成任务单接口请求参数" + postData, LogHelper.Log_Type.INFO);
|
||||
string res = http.HttpPost_Old(url, postData);
|
||||
string res = http.HttpPost_Old(agvUrl, postData);
|
||||
LogHelper.WriteLogInfo("调用AGV生成任务单接口返回" + res, LogHelper.Log_Type.INFO);
|
||||
if (!string.IsNullOrEmpty(res))
|
||||
{
|
||||
|
@ -123,6 +123,7 @@
|
||||
<Compile Include="ModelConvertHelper.cs" />
|
||||
<Compile Include="PingHelper.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Time_TaskHelper.cs" />
|
||||
<Compile Include="XmlHelper.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
72
Common/Time_TaskHelper.cs
Normal file
72
Common/Time_TaskHelper.cs
Normal file
@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Epost.Common
|
||||
{
|
||||
public class Time_TaskHelper
|
||||
{
|
||||
public event System.Timers.ElapsedEventHandler ExecuteTask;
|
||||
|
||||
private static readonly Time_TaskHelper _task = null;
|
||||
private System.Timers.Timer _timer = null;
|
||||
//定义时间
|
||||
private int _interval = 1000;
|
||||
public int Interval
|
||||
{
|
||||
set
|
||||
{
|
||||
_interval = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
return _interval;
|
||||
}
|
||||
}
|
||||
|
||||
static Time_TaskHelper()
|
||||
{
|
||||
_task = new Time_TaskHelper();
|
||||
}
|
||||
|
||||
public static Time_TaskHelper Instance()
|
||||
{
|
||||
return _task;
|
||||
}
|
||||
|
||||
//开始
|
||||
public void Start()
|
||||
{
|
||||
if (_timer == null)
|
||||
{
|
||||
_timer = new System.Timers.Timer(_interval);
|
||||
_timer.Elapsed += new System.Timers.ElapsedEventHandler(_timer_Elapsed);
|
||||
_timer.Enabled = true;
|
||||
_timer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
protected void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
if (null != ExecuteTask)
|
||||
{
|
||||
ExecuteTask(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
//停止
|
||||
public void Stop()
|
||||
{
|
||||
if (_timer != null)
|
||||
{
|
||||
_timer.Stop();
|
||||
_timer.Dispose();
|
||||
_timer = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user