Files
T-DAS/Epost.TestToolsWeb/Global.asax.cs

82 lines
3.0 KiB
C#
Raw Normal View History

2024-11-23 20:47:14 +08:00
using Epost.BLL;
using Epost.Common;
using Epost.Model;
2023-01-13 15:30:20 +08:00
using Epost.TestToolsWeb.App_Start;
using System;
using System.Collections.Generic;
2024-11-23 20:47:14 +08:00
using System.Data;
2023-01-13 15:30:20 +08:00
using System.IO;
using System.Linq;
using System.Net;
using System.Threading;
using System.Timers;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
2024-11-23 20:47:14 +08:00
using System.Web.WebSockets;
2023-01-13 15:30:20 +08:00
namespace Epost.TestToolsWeb
{
public class MvcApplication : System.Web.HttpApplication
{
2024-11-23 20:47:14 +08:00
InboundOrdersBLL inboundBLL = new InboundOrdersBLL();
2023-01-13 15:30:20 +08:00
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
GlobalConfiguration.Configure(WebApiConfig.Register);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
2024-11-23 20:47:14 +08:00
Time_TaskHelper.Instance().ExecuteTask += new System.Timers.ElapsedEventHandler(Global_ExecuteTask);
Time_TaskHelper.Instance().Interval = 1000 * 10;//表示间隔
Time_TaskHelper.Instance().Start();
2023-01-13 15:30:20 +08:00
}
2024-11-23 20:47:14 +08:00
void Global_ExecuteTask(object sender, System.Timers.ElapsedEventArgs e)
{
//在这里编写需要定时执行的逻辑代码
LogHelper.WriteLogInfo("任务执行中");
DataTable dt = inboundBLL.GetInOrderList(" and state =0");
if (dt != null && dt.Rows.Count > 0)
{
foreach (DataRow row in dt.Rows) {
AgvHelper agv = new AgvHelper();
AgvSchedulingTaskModel reqmodel = new AgvSchedulingTaskModel();
reqmodel.reqCode =DateTime.Now.Month+DateTime.Now.Day+ row["id"].ToString();;
List<Positioncodepath> positionList = new List<Positioncodepath>();
Positioncodepath pathModel = new Positioncodepath();
pathModel.positionCode = row["spositionCode"].ToString();
pathModel.type = "05";//agv提供
positionList.Add(pathModel);
Positioncodepath pathModel2 = new Positioncodepath();
pathModel2.positionCode = row["dpositionCode"].ToString();
pathModel2.type = "05";
positionList.Add(pathModel2);
reqmodel.positionCodePath = positionList;
reqmodel.taskTyp = "ZY01";//agv提供
reqmodel.ctnrTyp = "1";
AgvResultModel res= agv.genAgvSchedulingTask(reqmodel);
if (res.code == "0")
{
//调用agv成功 更新订单状态
inboundBLL.UpInOrderList(row["id"].ToString(),"1",res.data);
}
}
}
}
protected void Session_Start(object sender, EventArgs e)
{
2023-01-13 15:30:20 +08:00
2024-11-23 20:47:14 +08:00
// 在新会话启动时运行的代码
2023-01-13 15:30:20 +08:00
2024-11-23 20:47:14 +08:00
}
2023-01-13 15:30:20 +08:00
}
}