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-12-03 10:55:54 +08:00
|
|
|
|
InboundOrdersBLL inboundBLL = new InboundOrdersBLL();
|
|
|
|
|
AgvHelper agv = new AgvHelper();
|
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) {
|
2024-12-03 10:55:54 +08:00
|
|
|
|
|
2024-11-23 20:47:14 +08:00
|
|
|
|
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();
|
2024-12-02 13:53:56 +08:00
|
|
|
|
pathModel.positionCode = inboundBLL.GetLocation(" and wmsloc ='"+ row["spositionCode"].ToString() + "'");
|
2024-11-23 20:47:14 +08:00
|
|
|
|
pathModel.type = "05";//agv提供
|
|
|
|
|
positionList.Add(pathModel);
|
|
|
|
|
Positioncodepath pathModel2 = new Positioncodepath();
|
2024-12-02 13:53:56 +08:00
|
|
|
|
pathModel2.positionCode = inboundBLL.GetLocation(" and wmsloc = '"+ row["dpositionCode"].ToString() + "'");
|
2024-11-23 20:47:14 +08:00
|
|
|
|
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成功 更新订单状态
|
2024-12-02 13:53:56 +08:00
|
|
|
|
inboundBLL.UpInOrderList(row["id"].ToString(), "1", res.data);
|
|
|
|
|
}
|
|
|
|
|
else if (res.code == "1")
|
|
|
|
|
{
|
|
|
|
|
inboundBLL.UpInOrder(row["id"].ToString(),"AGV告警:"+res.message);
|
2024-11-23 20:47:14 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|