From 78b193a52a8988076c0fe3ab712a2b7214806a44 Mon Sep 17 00:00:00 2001 From: jl Date: Wed, 25 Dec 2024 10:15:41 +0800 Subject: [PATCH] --- Epost.BLL/AgvLogInfoBLL.cs | 18 +++++ Epost.BLL/Epost.BLL.csproj | 1 + Epost.DAL/AgvLogInfoDAL.cs | 24 ++++++ Epost.DAL/Epost.DAL.csproj | 1 + .../Controllers/AgvTaskApiController.cs | 79 +++++++++---------- Epost.TestToolsWeb/Epost.DPS.csproj.user | 2 +- .../PublishProfiles/Toolsweb.pubxml.user | 30 +++---- 7 files changed, 98 insertions(+), 57 deletions(-) create mode 100644 Epost.BLL/AgvLogInfoBLL.cs create mode 100644 Epost.DAL/AgvLogInfoDAL.cs diff --git a/Epost.BLL/AgvLogInfoBLL.cs b/Epost.BLL/AgvLogInfoBLL.cs new file mode 100644 index 0000000..c9c113a --- /dev/null +++ b/Epost.BLL/AgvLogInfoBLL.cs @@ -0,0 +1,18 @@ +using Epost.DAL; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Epost.BLL +{ + public class AgvLogInfoBLL + { + AgvLogInfoDAL dal = new AgvLogInfoDAL(); + public bool insertAgvLogInfo(string reqCode, string reqTime, string robotCode, string beginDate, string warnContent, string taskCode) + { + return dal.insertAgvLogInfo(reqCode,reqTime,robotCode,beginDate,warnContent,taskCode); + } + } +} diff --git a/Epost.BLL/Epost.BLL.csproj b/Epost.BLL/Epost.BLL.csproj index ad34333..eaffbf3 100644 --- a/Epost.BLL/Epost.BLL.csproj +++ b/Epost.BLL/Epost.BLL.csproj @@ -92,6 +92,7 @@ + diff --git a/Epost.DAL/AgvLogInfoDAL.cs b/Epost.DAL/AgvLogInfoDAL.cs new file mode 100644 index 0000000..7976f35 --- /dev/null +++ b/Epost.DAL/AgvLogInfoDAL.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Epost.DAL +{ + + public class AgvLogInfoDAL + { + DataBaseOpration.OprationSqlDAL db = DB_DLL.GetInstance(); + public bool insertAgvLogInfo(string reqCode, string reqTime, string robotCode, string beginDate, string warnContent, string taskCode) + { + string sql = string.Format("insert into agvLogInfo(reqCode ,reqTime,robotCode,beginDate,warnContent,taskCode,addtime) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}')", + reqCode,reqTime,robotCode,beginDate,warnContent, + taskCode,DateTime.Now.ToString()); + long x =db.InsertSql(sql); + if (x > 0) + return true; + return false; + } + } +} diff --git a/Epost.DAL/Epost.DAL.csproj b/Epost.DAL/Epost.DAL.csproj index 36760c2..1bc5786 100644 --- a/Epost.DAL/Epost.DAL.csproj +++ b/Epost.DAL/Epost.DAL.csproj @@ -99,6 +99,7 @@ + diff --git a/Epost.TestToolsWeb/Controllers/AgvTaskApiController.cs b/Epost.TestToolsWeb/Controllers/AgvTaskApiController.cs index c6e259f..d1904db 100644 --- a/Epost.TestToolsWeb/Controllers/AgvTaskApiController.cs +++ b/Epost.TestToolsWeb/Controllers/AgvTaskApiController.cs @@ -22,9 +22,9 @@ namespace Epost.DPS.Controllers InboundOrdersBLL inboundBLL = new InboundOrdersBLL(); string agvCallbackUrl = ConfigurationManager.AppSettings["agvCallbackUrl"]; string agvexTaskUrl = ConfigurationManager.AppSettings["agvexTaskUrl"]; - HttpHelper http = new HttpHelper(); AgvHelper agv = new AgvHelper(); + AgvLogInfoBLL logbll = new AgvLogInfoBLL(); [Route("agvCallback")] [HttpPost] public AgvResultModel agvCallback([FromBody] agvCallbackModel data) @@ -47,47 +47,13 @@ namespace Epost.DPS.Controllers { state = "4"; //更新任务已完成 - DataTable dt = inboundBLL.GetInOrderList(" and agvid ='" + data.taskCode + "'"); - if (dt != null && dt.Rows.Count > 0) - { - wmsCallbackModel backModel = new wmsCallbackModel(); - List list = new List(); - callbackHeader headModel = new callbackHeader(); - headModel.warehouseId = dt.Rows[0]["warehouseId"].ToString(); - headModel.groupTaskId = dt.Rows[0]["groupTaskId"].ToString(); - headModel.wmsDocNo = dt.Rows[0]["wmsDocNo"].ToString(); - headModel.currentPositionCode = data.currentPositionCode; - headModel.robotCode = data.robotCode; - headModel.taskCode = data.taskCode; - headModel.method = data.method; - headModel.reqCode = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString(); - headModel.reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - callback back = new callback(); - list.Add(headModel); - back.header = list; - backModel.data = back; - string reqstr = JsonHelper.SerializeObject(backModel); - LogHelper.WriteLogInfo("WCS->WMS任务执行通知请求:" + reqstr + "===" + agvCallbackUrl); - string resultStr = http.HttpPost_Old(agvCallbackUrl, reqstr); - LogHelper.WriteLogInfo("WCS->WMS任务执行通知返回:" + resultStr); - - logBLL.InsertLog("WCS->WMS任务执行通知", "agvCallback", agvCallbackUrl, reqstr, resultStr, 0, "", DateTime.Now); - //if (!string.IsNullOrEmpty(resultStr)) - //{ - // RetMesModel resModel = JsonHelper.DeserializeObject(resultStr); - // if (resModel.Response.returnnode.returnCode == "0000") - // { - // LogHelper.WriteLogInfo("WCS->WMS任务执行通知成功"); - // } - // else { - // LogHelper.WriteLogInfo("WCS->WMS任务执行通知失败"); - // } - //} - } + wms_callback(data); } else if (data.method == "cancel") { state = "88"; + wms_callback(data); + } else { } @@ -109,6 +75,35 @@ namespace Epost.DPS.Controllers return retModel; } + public void wms_callback(agvCallbackModel data) + { + DataTable dt = inboundBLL.GetInOrderList(" and agvid ='" + data.taskCode + "'"); + if (dt != null && dt.Rows.Count > 0) + { + wmsCallbackModel backModel = new wmsCallbackModel(); + List list = new List(); + callbackHeader headModel = new callbackHeader(); + headModel.warehouseId = dt.Rows[0]["warehouseId"].ToString(); + headModel.groupTaskId = dt.Rows[0]["groupTaskId"].ToString(); + headModel.wmsDocNo = dt.Rows[0]["wmsDocNo"].ToString(); + headModel.currentPositionCode = data.currentPositionCode; + headModel.robotCode = data.robotCode; + headModel.taskCode = data.taskCode; + headModel.method = data.method; + headModel.reqCode = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString(); + headModel.reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + callback back = new callback(); + list.Add(headModel); + back.header = list; + backModel.data = back; + string reqstr = JsonHelper.SerializeObject(backModel); + LogHelper.WriteLogInfo("WCS->WMS任务执行通知请求:" + reqstr + "===" + agvCallbackUrl); + string resultStr = http.HttpPost_Old(agvCallbackUrl, reqstr); + LogHelper.WriteLogInfo("WCS->WMS任务执行通知返回:" + resultStr); + + logBLL.InsertLog("WCS->WMS任务执行通知", "agvCallback", agvCallbackUrl, reqstr, resultStr, 0, "", DateTime.Now); + } + } [Route("warnCallback")] [HttpPost] public AgvResultModel warnCallback([FromBody]warnCallbackReq data) @@ -127,7 +122,8 @@ namespace Epost.DPS.Controllers List taskList = new List(); agvexTaskHeader agvexHeader = new agvexTaskHeader(); List headerlist = new List(); - List datalist = data.data; + List datalist = data.data; + string reqcode = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString(); if (datalist.Any()) { foreach (warnCallbackData item in datalist) @@ -138,16 +134,17 @@ namespace Epost.DPS.Controllers agvextmodel.beginDate = item.beginDate; agvextmodel.warnContent = item.warnContent; taskList.Add(agvextmodel); + logbll.insertAgvLogInfo(reqcode, item.beginDate, item.robotCode, item.beginDate, item.warnContent, item.taskCode); } } agvexHeader.list = taskList; agvexHeader.clientCode = data.clientCode; - agvexHeader.reqCode = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString(); + agvexHeader.reqCode = reqcode; agvexHeader.reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); headerlist.Add(agvexHeader); taskdata.header = headerlist; backModel.data = taskdata; - + string reqstr = JsonHelper.SerializeObject(backModel); LogHelper.WriteLogInfo("WCS->WMS告警通知请求:" + reqstr + "===" + agvexTaskUrl); string resultStr = http.HttpPost_Old(agvexTaskUrl, reqstr); diff --git a/Epost.TestToolsWeb/Epost.DPS.csproj.user b/Epost.TestToolsWeb/Epost.DPS.csproj.user index 4d10158..2eaafac 100644 --- a/Epost.TestToolsWeb/Epost.DPS.csproj.user +++ b/Epost.TestToolsWeb/Epost.DPS.csproj.user @@ -11,7 +11,7 @@ False 600 E:\WORK\代码管理\T系列\播种\Epost.TestToolsWeb\Properties\PublishProfiles\Toolsweb.pubxml - Release|Any CPU + Debug|Any CPU diff --git a/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml.user b/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml.user index bf56fec..44da464 100644 --- a/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml.user +++ b/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml.user @@ -7,7 +7,7 @@ <_PublishTargetUrl>D:\驿传\zhuyou_wcs - True|2024-12-12T02:38:02.5914170Z;True|2024-12-05T11:08:47.6560918+08:00;True|2024-12-04T09:59:41.1980682+08:00;True|2024-11-29T15:21:54.3789957+08:00;True|2024-11-29T14:43:30.2764537+08:00;True|2024-11-29T14:05:34.1608373+08:00;True|2024-11-29T13:24:48.7549546+08:00;True|2024-11-29T11:33:32.4546950+08:00;True|2024-11-26T10:08:16.7734518+08:00;True|2024-11-22T14:00:39.7806019+08:00;False|2024-11-04T17:48:25.2781696+08:00;True|2024-11-01T16:04:56.3535724+08:00;True|2024-09-01T10:13:37.1598955+08:00;True|2024-08-31T17:27:57.5375469+08:00;True|2022-07-15T16:41:13.9750291+08:00;True|2022-07-14T14:02:20.7983427+08:00;True|2022-07-13T17:40:22.7531000+08:00;True|2022-07-13T17:34:22.9908701+08:00;True|2022-07-13T17:30:06.3588502+08:00;True|2022-07-11T10:32:06.9053981+08:00;True|2021-04-26T10:07:37.4889549+08:00;True|2021-04-09T10:32:51.9130162+08:00;True|2021-04-09T10:31:50.4974012+08:00; + True|2024-12-24T06:23:59.6498280Z;True|2024-12-12T10:38:02.5914170+08:00;True|2024-12-05T11:08:47.6560918+08:00;True|2024-12-04T09:59:41.1980682+08:00;True|2024-11-29T15:21:54.3789957+08:00;True|2024-11-29T14:43:30.2764537+08:00;True|2024-11-29T14:05:34.1608373+08:00;True|2024-11-29T13:24:48.7549546+08:00;True|2024-11-29T11:33:32.4546950+08:00;True|2024-11-26T10:08:16.7734518+08:00;True|2024-11-22T14:00:39.7806019+08:00;False|2024-11-04T17:48:25.2781696+08:00;True|2024-11-01T16:04:56.3535724+08:00;True|2024-09-01T10:13:37.1598955+08:00;True|2024-08-31T17:27:57.5375469+08:00;True|2022-07-15T16:41:13.9750291+08:00;True|2022-07-14T14:02:20.7983427+08:00;True|2022-07-13T17:40:22.7531000+08:00;True|2022-07-13T17:34:22.9908701+08:00;True|2022-07-13T17:30:06.3588502+08:00;True|2022-07-11T10:32:06.9053981+08:00;True|2021-04-26T10:07:37.4889549+08:00;True|2021-04-09T10:32:51.9130162+08:00;True|2021-04-09T10:31:50.4974012+08:00; @@ -33,19 +33,19 @@ 04/04/2018 15:45:12 - 12/12/2024 10:37:58 + 12/24/2024 16:28:51 - 12/12/2024 10:37:58 + 12/24/2024 16:28:51 02/24/2020 15:29:24 - 12/12/2024 10:37:39 + 12/24/2024 14:23:36 - 12/12/2024 10:37:39 + 12/24/2024 14:23:36 04/29/2020 16:50:14 @@ -63,31 +63,31 @@ 10/23/2017 13:15:20 - 12/12/2024 10:37:40 + 12/24/2024 14:23:37 - 12/12/2024 10:37:40 + 12/24/2024 14:23:37 08/26/2020 18:09:48 - 12/12/2024 10:37:39 + 12/24/2024 14:23:37 - 12/12/2024 10:37:39 + 12/24/2024 14:23:37 - 12/12/2024 10:37:43 + 12/24/2024 16:28:43 - 12/12/2024 10:37:43 + 12/24/2024 16:28:43 - 12/12/2024 10:37:38 + 12/24/2024 14:23:36 - 12/12/2024 10:37:38 + 12/24/2024 14:23:36 09/06/2018 11:57:11 @@ -5652,7 +5652,7 @@ 05/30/2022 16:58:47 - 12/12/2024 10:37:45 + 12/24/2024 16:28:44 04/04/2018 15:45:12 @@ -7572,7 +7572,7 @@ 07/04/2022 14:22:38 - 12/12/2024 10:37:44 + 12/24/2024 14:23:41 \ No newline at end of file