This commit is contained in:
jl
2024-11-23 20:47:14 +08:00
parent 48afa11af7
commit 068fe0a148
11 changed files with 279 additions and 53 deletions

View File

@ -1,4 +1,5 @@
using Epost.Common;
using Epost.BLL;
using Epost.Common;
using Epost.DAL.Cache;
using Epost.Model;
using System;
@ -14,33 +15,50 @@ namespace Epost.DPS.Controllers
[RoutePrefix("api/AgvTaskApi")]
public class AgvTaskApiController : ApiController
{
JobDownCacheDAL JobCache = new JobDownCacheDAL();
InboundOrdersBLL inboundBLL = new InboundOrdersBLL();
[Route("agvCallback")]
[HttpPost]
public AgvResultModel agvCallback([FromBody] agvCallbackModel model)
public AgvResultModel agvCallback([FromBody]agvCallbackModel data)
{
AgvResultModel retModel = new AgvResultModel();
try
{
LogHelper.WriteLogInfo("请求报文" + JsonHelper.SerializeObject(model));
LogHelper.WriteLogInfo("请求报文" + JsonHelper.SerializeObject(data));
string state = string.Empty;
if (data.method == "start")
{
state = "2";//任务开始启动
}
else if (data.method == "outbin") {
state = "3";//走出储位
}
else if (data.method == "end")
{
state = "4";
//更新任务已完成
}
else if (data.method == "cancel") { }
else { }
ResultMessageModel data = new ResultMessageModel();
data.Parameter = model.reqCode;
data.Status = model.method;
data.Address = model.taskCode;
JobCache.UpdateJobDownModelList(new List<ResultMessageModel>() { data }, EdownCommend.Create);
inboundBLL.UpInOrderListByAgvid(data.taskCode,state);
//ResultMessageModel data = new ResultMessageModel();
//data.Parameter = model.reqCode;
//data.Status = model.method;
//data.Address = model.taskCode;
//JobCache.UpdateJobDownModelList(new List<ResultMessageModel>() { data }, EdownCommend.Create);
retModel.message = "成功!";
retModel.code = "0";
retModel.reqCode = model.reqCode;
retModel.reqCode = data.reqCode;
}
catch (Exception ex)
{
LogHelper.WriteLogInfo("agvPutTask异常" + ex.ToString(), LogHelper.Log_Type.ERROR);
retModel.message = "请求接口异常!";
retModel.code = "-1";
retModel.reqCode = model.reqCode;
retModel.reqCode = data.reqCode;
}
return retModel;
}
}

View File

@ -11,7 +11,7 @@
<WebStackScaffolding_IsAsyncSelected>False</WebStackScaffolding_IsAsyncSelected>
<WebStackScaffolding_ViewDialogWidth>600</WebStackScaffolding_ViewDialogWidth>
<NameOfLastUsedPublishProfile>E:\WORK\代码管理\T系列\播种\Epost.TestToolsWeb\Properties\PublishProfiles\Toolsweb.pubxml</NameOfLastUsedPublishProfile>
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<Use64BitIISExpress />
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />

View File

@ -1,7 +1,10 @@
using Epost.Common;
using Epost.BLL;
using Epost.Common;
using Epost.Model;
using Epost.TestToolsWeb.App_Start;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Net;
@ -12,11 +15,13 @@ using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using System.Web.WebSockets;
namespace Epost.TestToolsWeb
{
public class MvcApplication : System.Web.HttpApplication
{
InboundOrdersBLL inboundBLL = new InboundOrdersBLL();
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
@ -25,12 +30,52 @@ namespace Epost.TestToolsWeb
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
Time_TaskHelper.Instance().ExecuteTask += new System.Timers.ElapsedEventHandler(Global_ExecuteTask);
Time_TaskHelper.Instance().Interval = 1000 * 10;//表示间隔
Time_TaskHelper.Instance().Start();
}
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)
{
// 在新会话启动时运行的代码
}
}
}

View File

@ -33,19 +33,19 @@
<publishTime>04/04/2018 15:45:12</publishTime>
</File>
<File Include="bin/App_global.asax.compiled">
<publishTime>11/22/2024 14:00:36</publishTime>
<publishTime>11/22/2024 17:47:09</publishTime>
</File>
<File Include="bin/App_global.asax.dll">
<publishTime>11/22/2024 14:00:36</publishTime>
<publishTime>11/22/2024 17:47:09</publishTime>
</File>
<File Include="bin/BouncyCastle.Crypto.dll">
<publishTime>02/24/2020 15:29:24</publishTime>
</File>
<File Include="bin/Common.dll">
<publishTime>11/22/2024 14:00:20</publishTime>
<publishTime>11/22/2024 17:46:58</publishTime>
</File>
<File Include="bin/Common.pdb">
<publishTime>11/22/2024 14:00:20</publishTime>
<publishTime>11/22/2024 17:46:58</publishTime>
</File>
<File Include="bin/ComposerSDK.dll">
<publishTime>04/29/2020 16:50:14</publishTime>
@ -63,31 +63,31 @@
<publishTime>10/23/2017 13:15:20</publishTime>
</File>
<File Include="bin/Epost.BLL.dll">
<publishTime>11/22/2024 14:00:21</publishTime>
<publishTime>11/22/2024 17:46:59</publishTime>
</File>
<File Include="bin/Epost.BLL.pdb">
<publishTime>11/22/2024 14:00:21</publishTime>
<publishTime>11/22/2024 17:46:59</publishTime>
</File>
<File Include="bin/Epost.BLL.XmlSerializers.dll">
<publishTime>08/26/2020 18:09:48</publishTime>
</File>
<File Include="bin/Epost.DAL.dll">
<publishTime>11/22/2024 14:00:20</publishTime>
<publishTime>11/22/2024 17:46:59</publishTime>
</File>
<File Include="bin/Epost.DAL.pdb">
<publishTime>11/22/2024 14:00:20</publishTime>
<publishTime>11/22/2024 17:46:59</publishTime>
</File>
<File Include="bin/Epost.DPS.dll">
<publishTime>11/22/2024 14:00:23</publishTime>
<publishTime>11/22/2024 17:47:02</publishTime>
</File>
<File Include="bin/Epost.DPS.pdb">
<publishTime>11/22/2024 14:00:23</publishTime>
<publishTime>11/22/2024 17:47:02</publishTime>
</File>
<File Include="bin/Epost.Model.dll">
<publishTime>11/22/2024 14:00:20</publishTime>
<publishTime>11/22/2024 17:46:58</publishTime>
</File>
<File Include="bin/Epost.Model.pdb">
<publishTime>11/22/2024 14:00:20</publishTime>
<publishTime>11/22/2024 17:46:58</publishTime>
</File>
<File Include="bin/Epost.TestToolsWeb.dll">
<publishTime>09/06/2018 11:57:11</publishTime>
@ -5652,7 +5652,7 @@
<publishTime>05/30/2022 16:58:47</publishTime>
</File>
<File Include="PrecompiledApp.config">
<publishTime>11/22/2024 14:00:24</publishTime>
<publishTime>11/22/2024 17:47:03</publishTime>
</File>
<File Include="Scripts/ai.0.22.9-build00167.js">
<publishTime>04/04/2018 15:45:12</publishTime>
@ -7572,7 +7572,7 @@
<publishTime>07/04/2022 14:22:38</publishTime>
</File>
<File Include="Web.config">
<publishTime>11/01/2024 16:24:56</publishTime>
<publishTime>11/22/2024 16:17:44</publishTime>
</File>
</ItemGroup>
</Project>

View File

@ -11,7 +11,7 @@
</configSections>
<connectionStrings>
<add name="weijie_dpsEntities" connectionString="metadata=res://*/WJDB.csdl|res://*/WJDB.ssdl|res://*/WJDB.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.;initial catalog=weijie_dps;user id=sa;password=123456;min pool size=4;max pool size=4;packet size=3072;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
<add name="SqlLocDPSConnection" connectionString="server=139.196.36.200;user id=EpostTest;password=antion;database=WuXi_DingShi_DAS;min pool size=512;max pool size=512;packet size=3072" providerName="System.Data.SqlClient" />
<add name="SqlLocDPSConnection" connectionString="server=139.196.36.200;user id=EpostTest;password=antion;database=zhuyou_wcs;min pool size=512;max pool size=512;packet size=3072" providerName="System.Data.SqlClient" />
<add name="MysqlLocDPSConnection" connectionString="Server=localhost;Port=3306;Database=world;User=root; Password=antion;SslMode=None;Pooling=true;Allow User Variables=True;" />
<add name="WMSConnection" connectionString="data source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=139.196.36.200)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=EpostDB)));user id=C##Test;password=test" />
@ -33,6 +33,8 @@
<add key="CARID" value="HT01" />
<add key="ServerAPIURL" value="http://192.168.0.20:8045/api/WebAPI" />
<add key="SleepTime" value="1" />
<add key="agvUrl" value="http://192.168.0.20:8045/api/WebAPI/ProcessingResult"/>
</appSettings>
<!--
有关 web.config 更改的说明,请参见 http://go.microsoft.com/fwlink/?LinkId=235367。