From 5cf8be1f30878aeb2af568f471949d0b9190036a Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期五, 19 十二月 2025 16:12:12 +0800
Subject: [PATCH] CTU故障信息接口查询,故障上报至WMS,任务下发优化
---
项目代码/WCSServices/WIDESEAWCS_Tasks/AGV/AGVErrorJob.cs | 47 +++
项目代码/WCSServices/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs | 8
项目代码/WCSServices/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs | 103 +++++++
项目代码/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs | 42 ++
项目代码/WCSServices/WIDESEAWCS_TaskInfoService/Task_HtyService.cs | 30 ++
项目代码/WCSServices/WIDESEAWCS_DTO/Agv/AgvStatusContent.cs | 52 +++
项目资料/接口汇总文件/WMS-KUKA设备状态接口.xlsx | 0
项目代码/WCSServices/WIDESEAWCS_BasicInfoService/LocationInfoService.cs | 65 +---
项目代码/WCSServices/WIDESEAWCS_Server/Controllers/Task/TaskController.cs | 2
项目代码/WCSServices/WIDESEAWCS_Model/Models/BasicInfo/Dt_LocationInfo.cs | 17
项目代码/WCSServices/WIDESEAWCS_Common/Helper/ExportHelper.cs | 105 +++++++
项目代码/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs | 9
项目代码/WCSServices/WIDESEAWCS_DTO/TaskInfo/WMSTaskDTO.cs | 19 +
项目代码/WCSServices/WIDESEAWCS_DTO/Agv/AgvSearchStatusDTO.cs | 31 ++
项目代码/WCSServices/WIDESEAWCS_Server/appsettings.json | 1
项目代码/WCSServices/WIDESEAWCS_Common/Helper/AttributeHelper.cs | 56 ++++
项目代码/WCSServices/WIDESEAWCS_IBasicInfoRepository/IErrorInfoRepository.cs | 14 +
项目代码/WCSServices/WIDESEAWCS_ITaskInfoService/ITaskService.cs | 10
项目代码/WCSServices/WIDESEAWCS_BasicInfoRepository/ErrorInfoRepository.cs | 18 +
项目代码/WCSServices/WIDESEAWCS_Model/Models/BasicInfo/Dt_ErrorInfo.cs | 38 ++
项目代码/WCSServices/WIDESEAWCS_DTO/EPLightSendDTO.cs | 4
项目代码/WCSServices/WIDESEAWCS_Common/APIEnum/APIEnum.cs | 10
项目代码/WCSServices/WIDESEAWCS_Tasks/AGV/AGVExtend.cs | 115 ++++---
23 files changed, 660 insertions(+), 136 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_BasicInfoRepository/ErrorInfoRepository.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_BasicInfoRepository/ErrorInfoRepository.cs"
new file mode 100644
index 0000000..5f2c7a4
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_BasicInfoRepository/ErrorInfoRepository.cs"
@@ -0,0 +1,18 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEAWCS_Core.BaseRepository;
+using WIDESEAWCS_IBasicInfoRepository;
+using WIDESEAWCS_Model.Models;
+
+namespace WIDESEAWCS_BasicInfoRepository
+{
+ public class ErrorInfoRepository : RepositoryBase<Dt_ErrorInfo>, IErrorInfoRepository
+ {
+ public ErrorInfoRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage)
+ {
+ }
+ }
+}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_BasicInfoService/LocationInfoService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_BasicInfoService/LocationInfoService.cs"
index 97ea408..a554c4e 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_BasicInfoService/LocationInfoService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_BasicInfoService/LocationInfoService.cs"
@@ -1,26 +1,17 @@
-锘縰sing HslCommunication.WebSocket;
-using Magicodes.ExporterAndImporter.Core;
+锘縰sing Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
-using MathNet.Numerics.Statistics.Mcmc;
+using NPOI.SS.UserModel;
using NPOI.Util.Collections;
-using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;
-using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
+using NPOI.XSSF.UserModel;
using SqlSugar;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using WIDESEA_Core;
-using WIDESEA_Core.Enums;
+using System.Reflection;
using WIDESEA_DTO.Basic;
using WIDESEAWCS_Common;
-using WIDESEAWCS_Common.WareHouseEnum;
+using WIDESEAWCS_Common.Helper;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.BaseRepository;
using WIDESEAWCS_Core.BaseServices;
using WIDESEAWCS_Core.Helper;
-using WIDESEAWCS_Core.Utilities;
using WIDESEAWCS_IBasicInfoRepository;
using WIDESEAWCS_IBasicInfoService;
using WIDESEAWCS_Model.Models;
@@ -197,45 +188,19 @@
WebResponseContent content = new WebResponseContent();
try
{
- string savePath = AppDomain.CurrentDomain.BaseDirectory + $"ExcelExport";
- IExporter exporter = new ExcelExporter();
- options.Page = 1;
- options.Rows = 30;
- options.Order = "asc";
- options.Sort = "id";
+ string savePath = AppDomain.CurrentDomain.BaseDirectory + "ExcelExport";
- string where = string.Empty;
- ISugarQueryable<Dt_LocationInfo> sugarQueryable = BaseDal.Db.Queryable<Dt_LocationInfo>();
- if (!string.IsNullOrEmpty(options.Wheres))
- {
- try
- {
- List<SearchParameters> searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>();
- if (searchParametersList?.Any() == true)
- {
- foreach (var param in searchParametersList)
- {
- switch (param.Name)
- {
-
- }
- }
- }
- }
- catch (Exception ex)
- {
- }
- }
+ // 纭繚鐩綍瀛樺湪
+ if (!Directory.Exists(savePath))
+ Directory.CreateDirectory(savePath);
-
+ // 鑾峰彇鏁版嵁
+ ISugarQueryable<Dt_LocationInfo> query = BaseDal.Db.Queryable<Dt_LocationInfo>();
+ var dataList = query.ToList();
+ var properties = typeof(Dt_LocationInfo).GetProperties();
- byte[] data = exporter.ExportAsByteArray(sugarQueryable.ToList()).Result;
-
- string fileName = "搴撲綅淇℃伅.xlsx";
-
- FileHelper.WriteFile(savePath, fileName, data);
-
- content = WebResponseContent.Instance.OK(data: savePath + "\\" + fileName);
+ string filePath = TExportHelper.GetExport(savePath, properties, dataList);
+ return WebResponseContent.Instance.OK(data: filePath);
}
catch (Exception ex)
{
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Common/APIEnum/APIEnum.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Common/APIEnum/APIEnum.cs"
index f8152d2..d9aef74 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Common/APIEnum/APIEnum.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Common/APIEnum/APIEnum.cs"
@@ -20,6 +20,11 @@
[Description("AGV浠诲姟鏀捐鎺ュ彛")]
AgvTaskFlow,
/// <summary>
+ /// AGV鐘舵�佹煡璇㈡帴鍙�
+ /// </summary>
+ [Description("AGV鐘舵�佹煡璇㈡帴鍙�")]
+ AgvSearchStatus,
+ /// <summary>
/// WMS鍑哄叆搴撳弽棣堝畬鎴�
/// </summary>
[Description("WMS鍑哄叆搴撳弽棣堝畬鎴�")]
@@ -35,6 +40,11 @@
[Description("WMS鎾澧欎笂鎶�")]
WMSLightBack,
/// <summary>
+ /// WMS鏁呴殰涓婃姤
+ /// </summary>
+ [Description("WMS鏁呴殰涓婃姤")]
+ WMSErrorBack,
+ /// <summary>
/// 浜屾湡鎾澧欏垵濮嬪寲
/// </summary>
[Description("浜屾湡鎾澧欏垵濮嬪寲")]
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Common/Helper/AttributeHelper.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Common/Helper/AttributeHelper.cs"
new file mode 100644
index 0000000..ed718e0
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Common/Helper/AttributeHelper.cs"
@@ -0,0 +1,56 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEAWCS_Common.Helper
+{
+ public static class AttributeHelper
+ {
+ /// <summary>
+ /// 鑾峰彇灞炴�х殑 ExporterHeader 鏄剧ず鍚嶇О
+ /// </summary>
+ public static string GetExporterDisplayName(PropertyInfo property)
+ {
+ try
+ {
+ // 鑾峰彇 ExporterHeaderAttribute 鐗规��
+ var exporterHeaderAttr = property.GetCustomAttributes()
+ .FirstOrDefault(attr => attr.GetType().Name == "ExporterHeaderAttribute");
+
+ if (exporterHeaderAttr != null)
+ {
+ // 浣跨敤鍙嶅皠鑾峰彇 DisplayName 灞炴��
+ var displayNameProp = exporterHeaderAttr.GetType().GetProperty("DisplayName");
+ if (displayNameProp != null)
+ {
+ var displayName = displayNameProp.GetValue(exporterHeaderAttr) as string;
+ if (!string.IsNullOrEmpty(displayName))
+ {
+ return displayName;
+ }
+ }
+
+ // 妫�鏌ユ槸鍚﹁蹇界暐
+ var isIgnoreProp = exporterHeaderAttr.GetType().GetProperty("IsIgnore");
+ if (isIgnoreProp != null)
+ {
+ var isIgnore = (bool)isIgnoreProp.GetValue(exporterHeaderAttr);
+ if (isIgnore)
+ {
+ return null; // 杩斿洖 null 琛ㄧず蹇界暐姝ゅ垪
+ }
+ }
+ }
+ }
+ catch
+ {
+ // 濡傛灉鍑洪敊锛岃繑鍥炲睘鎬у悕
+ }
+
+ return property.Name; // 榛樿杩斿洖灞炴�у悕
+ }
+ }
+}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Common/Helper/ExportHelper.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Common/Helper/ExportHelper.cs"
new file mode 100644
index 0000000..5a3c1e1
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Common/Helper/ExportHelper.cs"
@@ -0,0 +1,105 @@
+锘縰sing NPOI.SS.UserModel;
+using NPOI.Util.Collections;
+using NPOI.XSSF.UserModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEAWCS_Common.Helper
+{
+ public static class TExportHelper
+ {
+ /// <summary>
+ /// 瀵煎嚭
+ /// </summary>
+ public static string GetExport<T>(string savePath, PropertyInfo[] properties, List<T> dataList)
+ {
+ string filePath = "";
+ try
+ {
+ // 鍒涘缓 Excel 宸ヤ綔绨�
+ IWorkbook workbook = new XSSFWorkbook();
+ ISheet sheet = workbook.CreateSheet("x");
+ // 鍒涘缓琛ㄥご琛�
+ IRow headerRow = sheet.CreateRow(0);
+ sheet.DefaultColumnWidth = 15;
+ // 璁剧疆琛ㄥご鏍峰紡
+ ICellStyle headerStyle = workbook.CreateCellStyle();
+ IFont headerFont = workbook.CreateFont();
+ headerFont.Boldweight = (short)FontBoldWeight.Bold;
+ headerFont.FontHeightInPoints = 12;
+ headerStyle.SetFont(headerFont);
+ headerStyle.FillForegroundColor = IndexedColors.LightBlue.Index;
+ headerStyle.FillPattern = FillPattern.SolidForeground;
+ headerStyle.BorderBottom = BorderStyle.Thin;
+ headerStyle.BorderTop = BorderStyle.Thin;
+ headerStyle.BorderLeft = BorderStyle.Medium;
+ headerStyle.BorderRight = BorderStyle.Medium;
+
+ // 璁剧疆鏁版嵁鏍峰紡
+ ICellStyle dataStyle = workbook.CreateCellStyle();
+ dataStyle.BorderBottom = BorderStyle.Thin;
+ dataStyle.BorderTop = BorderStyle.Thin;
+ dataStyle.BorderLeft = BorderStyle.Thin;
+ dataStyle.BorderRight = BorderStyle.Thin;
+
+ // 濉厖琛ㄥご
+ for (int i = 0; i < properties.Length; i++)
+ {
+ var columnName = AttributeHelper.GetExporterDisplayName(properties[i]);
+ var cell = headerRow.CreateCell(i);
+ cell.SetCellValue(columnName);
+ cell.CellStyle = headerStyle;
+ }
+
+ // 濉厖鏁版嵁
+ for (int rowIdx = 0; rowIdx < dataList.Count; rowIdx++)
+ {
+ IRow dataRow = sheet.CreateRow(rowIdx + 1);
+ var item = dataList[rowIdx];
+
+ for (int colIdx = 0; colIdx < properties.Length; colIdx++)
+ {
+ var cell = dataRow.CreateCell(colIdx);
+ var value = properties[colIdx].GetValue(item);
+
+ // 澶勭悊涓嶅悓绫诲瀷鐨勫��
+ if (value == null)
+ {
+ cell.SetCellValue("");
+ }
+ else if (value is DateTime dateTime)
+ {
+ cell.SetCellValue(dateTime.ToString("yyyy-MM-dd HH:mm:ss"));
+ }
+ else if (value is bool boolValue)
+ {
+ cell.SetCellValue(boolValue);
+ }
+ else
+ {
+ cell.SetCellValue(value.ToString());
+ }
+ cell.CellStyle = dataStyle;
+ }
+ }
+ // 淇濆瓨鏂囦欢
+ string fileName = "x.xlsx";
+ filePath = Path.Combine(savePath, fileName);
+ using (var fs = new FileStream(filePath, FileMode.Create, FileAccess.Write))
+ {
+ workbook.Write(fs);
+ }
+ }
+ catch (Exception)
+ {
+
+ throw;
+ }
+ return filePath;
+ }
+ }
+}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_DTO/Agv/AgvSearchStatusDTO.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_DTO/Agv/AgvSearchStatusDTO.cs"
new file mode 100644
index 0000000..8a18bff
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_DTO/Agv/AgvSearchStatusDTO.cs"
@@ -0,0 +1,31 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEAWCS_DTO.Agv
+{
+ /// <summary>
+ /// AGV鐘舵�佹煡璇�
+ /// </summary>
+ public class AgvSearchStatusDTO
+ {
+ /// <summary>
+ /// 鏈哄櫒浜虹紪鐮�
+ /// </summary>
+ public string RobotId { get; set; }
+ /// <summary>
+ /// 鏈哄櫒浜哄瀷鍙�
+ /// </summary>
+ public string RobotType { get; set; }
+ /// <summary>
+ /// 鍦板浘缂栫爜
+ /// </summary>
+ public string MapCode { get; set; }
+ /// <summary>
+ /// 鐗囧尯缂栫爜
+ /// </summary>
+ public string FloorNumber { get; set; }
+ }
+}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_DTO/Agv/AgvStatusContent.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_DTO/Agv/AgvStatusContent.cs"
new file mode 100644
index 0000000..3758bbd
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_DTO/Agv/AgvStatusContent.cs"
@@ -0,0 +1,52 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEAWCS_DTO.Agv
+{
+ public class StatusItem
+ {
+ /// <summary>
+ /// 鏈哄櫒浜虹紪鍙�
+ /// </summary>
+ public string RobotId { get; set; }
+ /// <summary>
+ /// 鏂欑鍙�
+ /// </summary>
+ public string ContainerCode { get; set; }
+ /// <summary>
+ /// 鐘舵��
+ /// </summary>
+ public int Status { get; set; }
+ /// 褰撳墠鐐逛綅
+ /// </summary>
+ public string NodeCode { get; set; }
+ /// 浠诲姟鍙�
+ /// </summary>
+ public string MissionCode { get; set; }
+ }
+ /// <summary>
+ /// 鏈哄櫒浜虹姸鎬佽繑鍥炵粨鏋�
+ /// </summary>
+ public class AgvStatusContent
+ {
+ /// <summary>
+ /// 杩斿洖鏈哄櫒浜虹姸鎬侀泦鍚�
+ /// </summary>
+ public List<StatusItem> Data { get; set; }
+ /// <summary>
+ /// 杩斿洖浠g爜
+ /// </summary>
+ public string Code { get; set; }
+ /// <summary>
+ /// 杩斿洖淇℃伅
+ /// </summary>
+ public string Message { get; set; }
+ /// <summary>
+ /// 杩斿洖缁撴灉
+ /// </summary>
+ public bool Success { get; set; }
+ }
+}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_DTO/EPLightSendDTO.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_DTO/EPLightSendDTO.cs"
index 87e8ed2..3725686 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_DTO/EPLightSendDTO.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_DTO/EPLightSendDTO.cs"
@@ -29,11 +29,11 @@
/// </summary>
public string LIGHTCOLOR { get; set; }
/// <summary>
- /// 浜伅鐘舵�侊細1锛氫寒锛�2鐏�
+ /// 涓氬姟绫诲瀷 1锛氬叆搴撲寒鐏� 2锛氬嚭搴撲寒鐏�
/// </summary>
public string ORDERTYPE { get; set; }
/// <summary>
- /// 涓氬姟绫诲瀷 1锛氬叆搴撲寒鐏� 2锛氬嚭搴撲寒鐏�
+ /// 浜伅鐘舵�侊細1锛氫寒锛�2鐏�
/// </summary>
public string LIGHTTYPE { get; set; }
}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_DTO/TaskInfo/WMSTaskDTO.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_DTO/TaskInfo/WMSTaskDTO.cs"
index 4fe800c..8ecf7b9 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_DTO/TaskInfo/WMSTaskDTO.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_DTO/TaskInfo/WMSTaskDTO.cs"
@@ -141,4 +141,23 @@
/// </summary>
public string TagCode { get; set; }
}
+ public class TaskError
+ {
+ /// <summary>
+ /// 娑堟伅ID
+ /// </summary>
+ public int MsgID { get; set; }
+ /// <summary>
+ /// 宸ヤ綔绔欑紪鍙�(101銆�201銆�301銆�302銆�401銆�402銆�501銆�502)
+ /// </summary>
+ public string StationCode { get; set; }
+ /// <summary>
+ /// 鏁呴殰浠g爜 澶т簬0鏍囪瘑鏁呴殰,0鏍囪瘑鎭㈠
+ /// </summary>
+ public int MsgCode { get; set; }
+ /// <summary>
+ /// 鏁呴殰淇℃伅鎻忚堪
+ /// </summary>
+ public string Msg { get; set; }
+ }
}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_IBasicInfoRepository/IErrorInfoRepository.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_IBasicInfoRepository/IErrorInfoRepository.cs"
new file mode 100644
index 0000000..cb7d3a1
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_IBasicInfoRepository/IErrorInfoRepository.cs"
@@ -0,0 +1,14 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEAWCS_Core.BaseRepository;
+using WIDESEAWCS_Model.Models;
+
+namespace WIDESEAWCS_IBasicInfoRepository
+{
+ public interface IErrorInfoRepository : IRepository<Dt_ErrorInfo>
+ {
+ }
+}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_ITaskInfoService/ITaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_ITaskInfoService/ITaskService.cs"
index 4c6e163..432d678 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_ITaskInfoService/ITaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_ITaskInfoService/ITaskService.cs"
@@ -112,12 +112,6 @@
/// <param name="taskModel"></param>
/// <returns></returns>
WebResponseContent AgvSendTask(AgvTaskSendDTO taskModel, APIEnum SendTask = APIEnum.AgvSendTask);
- /// <summary>
- /// AGV浠诲姟鐘舵�佸埛鏂�
- /// </summary>
- /// <param name="agvUpdateModel"></param>
- /// <returns></returns>
- AgvResponseContent AgvUpdateTask(AgvUpdateDTO agvUpdateModel);
/// <summary>
/// 鏇存柊浠诲姟淇℃伅鍙婃坊鍔犱换鍔℃槑缁嗚褰�
@@ -173,5 +167,9 @@
/// </summary>
/// <returns></returns>
EPLightContent ENDWORK();
+ /// <summary>
+ /// AGV鐘舵�佹煡璇㈣皟鐢ㄥ強WMS鏁呴殰涓婃姤
+ /// </summary>
+ void AgvSearchStatus();
}
}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Model/Models/BasicInfo/Dt_ErrorInfo.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Model/Models/BasicInfo/Dt_ErrorInfo.cs"
new file mode 100644
index 0000000..fba2c9a
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Model/Models/BasicInfo/Dt_ErrorInfo.cs"
@@ -0,0 +1,38 @@
+锘縰sing SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEAWCS_Core.DB.Models;
+
+namespace WIDESEAWCS_Model.Models
+{
+ [SugarTable(nameof(Dt_ErrorInfo), "寮傚父淇℃伅")]
+ public class Dt_ErrorInfo : BaseEntity
+ {
+ /// <summary>
+ /// 涓婚敭
+ /// </summary>
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "涓婚敭")]
+ public int Id { get; set; }
+
+ /// <summary>
+ /// 绔欏彴缂栧彿
+ /// </summary>
+ [SugarColumn(IsNullable = false, Length = 10, ColumnDescription = "绔欏彴缂栧彿")]
+ public string StationCode { get; set; }
+
+ /// <summary>
+ /// CTU缂栧彿
+ /// </summary>
+ [SugarColumn(IsNullable = false, Length = 10, ColumnDescription = "CTU缂栧彿")]
+ public string RobotCode { get; set; }
+
+ /// <summary>
+ /// 閿欒淇℃伅
+ /// </summary>
+ [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "閿欒淇℃伅")]
+ public string Message { get; set; }
+ }
+}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Model/Models/BasicInfo/Dt_LocationInfo.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Model/Models/BasicInfo/Dt_LocationInfo.cs"
index fbf51af..f13d983 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Model/Models/BasicInfo/Dt_LocationInfo.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Model/Models/BasicInfo/Dt_LocationInfo.cs"
@@ -10,15 +10,14 @@
namespace WIDESEAWCS_Model.Models
{
/// <summary>
- /// 璐т綅淇℃伅
+ /// 搴撲綅淇℃伅
/// </summary>
- [SugarTable(nameof(Dt_LocationInfo), "璐т綅淇℃伅")]
+ [SugarTable(nameof(Dt_LocationInfo), "搴撲綅淇℃伅")]
public class Dt_LocationInfo : BaseEntity
{
/// <summary>
/// 涓婚敭
/// </summary>
- [ImporterHeader(Name = "涓婚敭")]
[ExporterHeader(DisplayName = "涓婚敭")]
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "涓婚敭")]
public int Id { get; set; }
@@ -26,8 +25,7 @@
/// <summary>
/// 搴撳尯缂栧彿
/// </summary>
- [ImporterHeader(IsIgnore = true)]
- [ExporterHeader(IsIgnore = true)]
+ [ExporterHeader(DisplayName = "搴撳尯缂栧彿")]
[SugarColumn(IsNullable = false, ColumnDescription = "搴撳尯缂栧彿")]
public int WarehouseId { get; set; }
@@ -98,23 +96,22 @@
/// <summary>
/// 璐т綅鐘舵��
/// </summary>
- [ImporterHeader(Name = "璐т綅鐘舵��")]
- [ExporterHeader(DisplayName = "璐т綅鐘舵��")]
+ [ImporterHeader(Name = "璐т綅鐘舵��(0:绌洪棽;1:閿佸畾;100:鏈夎揣)")]
+ [ExporterHeader(DisplayName = "璐т綅鐘舵��(0:绌洪棽;1:閿佸畾;100:鏈夎揣)")]
[SugarColumn(IsNullable = true, DefaultValue = "0", ColumnDescription = "璐т綅鐘舵��")]
public int LocationStatus { get; set; }
/// <summary>
/// 绂佺敤鐘舵��
/// </summary>
- [ImporterHeader(Name = "绂佺敤鐘舵��")]
- [ExporterHeader(DisplayName = "绂佺敤鐘舵��")]
+ [ImporterHeader(Name = "绂佺敤鐘舵��(0:姝e父;3:绂佺敤)")]
+ [ExporterHeader(DisplayName = "绂佺敤鐘舵��(0:姝e父;3:绂佺敤)")]
[SugarColumn(IsNullable = true, DefaultValue = "0", ColumnDescription = "绂佺敤鐘舵��")]
public int EnableStatus { get; set; }
/// <summary>
/// 澶囨敞
/// </summary>
- [ImporterHeader(Name = "澶囨敞")]
[ExporterHeader(DisplayName = "澶囨敞")]
[SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "澶囨敞")]
public string Remark { get; set; }
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs"
index e1c855b..8aad03a 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs"
@@ -66,16 +66,16 @@
/// <summary>
/// 鎵樼洏绫诲瀷
/// </summary>
- [ImporterHeader(Name = "鎵樼洏绫诲瀷")]
- [ExporterHeader(IsIgnore =true)]
- [SugarColumn(IsNullable = false, ColumnDescription = "鎵樼洏绫诲瀷")]
+ [ImporterHeader(Name = "鏂欑绫诲瀷")]
+ [ExporterHeader(DisplayName = "鏂欑绫诲瀷")]
+ [SugarColumn(IsNullable = false, ColumnDescription = "鏂欑绫诲瀷")]
public int PalletType { get; set; }
/// <summary>
/// 璁惧缂栧彿
/// </summary>
[ImporterHeader(Name = "璁惧缂栧彿")]
- [ExporterHeader(IsIgnore = true)]
+ [ExporterHeader(DisplayName = "璁惧缂栧彿")]
[SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "璁惧缂栧彿")]
public string DeviceCode { get; set; }
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs"
index 98f0bee..ae54415 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs"
@@ -155,5 +155,14 @@
}
return content;
}
+ /// <summary>
+ /// AGV浣滀笟瀹屾垚
+ /// </summary>
+ /// <returns></returns>
+ [HttpPost, HttpGet, Route("AgvSearchStatus"), AllowAnonymous]
+ public void AgvSearchStatus()
+ {
+ _taskService.AgvSearchStatus();
+ }
}
}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Server/Controllers/Task/TaskController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Server/Controllers/Task/TaskController.cs"
index c9c8a7e..6ea7f6e 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Server/Controllers/Task/TaskController.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Server/Controllers/Task/TaskController.cs"
@@ -116,7 +116,7 @@
/// <returns></returns>
[HttpPost, HttpGet, Route("InitLight"), AllowAnonymous]
public WebResponseContent InitLight()
- {
+ {
return Service.InitLight();
}
/// <summary>
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Server/appsettings.json" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Server/appsettings.json"
index cededc3..78737f4 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Server/appsettings.json"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Server/appsettings.json"
@@ -21,6 +21,7 @@
// 娉ㄦ剰锛宧ttp://127.0.0.1:1818 鍜� http://localhost:1818 鏄笉涓�鏍风殑
"IPs": "http://127.0.0.1:8080,http://localhost:8080"
},
+ "ApiLogIgnore": "Export,Get,get",
"WMSApiAddress": "http://127.0.0.1:9293", //"http://127.0.0.1:9283",姝e紡鐜鍦板潃
"LogDeubgEnable": true, //鏄惁璁板綍璋冭瘯鏃ュ織
"PrintSql": false, //鎵撳嵃SQL璇彞
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs"
index e0e1303..47c5b5f 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs"
@@ -12,6 +12,9 @@
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_DTO.Agv;
+using System.Reflection.Metadata;
+using WIDESEAWCS_Model.Models;
+using WIDESEAWCS_DTO.TaskInfo;
namespace WIDESEAWCS_TaskInfoService
{
@@ -48,13 +51,103 @@
return content;
}
/// <summary>
- /// AGV浠诲姟鐘舵�佸埛鏂�/AGV浠诲姟瀹屾垚
+ /// AGV鐘舵�佹煡璇㈣皟鐢ㄥ強WMS鏁呴殰涓婃姤
/// </summary>
- /// <param name="agvUpdateModel"></param>
- /// <returns></returns>
- public AgvResponseContent AgvUpdateTask(AgvUpdateDTO agvUpdateModel)
+ public void AgvSearchStatus()
{
- return new AgvResponseContent();
+ try
+ {
+ AgvSearchStatusDTO agvSearchStatusDTO = new AgvSearchStatusDTO();
+ string? apiAddress = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.AgvSearchStatus.ToString())?.ApiAddress;
+ if (string.IsNullOrEmpty(apiAddress)) throw new Exception($"鏈壘鍒癆GV鐘舵�佹煡璇㈡帴鍙�,璇锋鏌ユ帴鍙i厤缃�");
+ string? apiErrorBack = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.WMSErrorBack.ToString())?.ApiAddress;
+ if (string.IsNullOrEmpty(apiErrorBack)) throw new Exception($"鏈壘鍒癢MS鏁呴殰涓婃姤,璇锋鏌ユ帴鍙i厤缃�");
+ string request = JsonConvert.SerializeObject(agvSearchStatusDTO, settings);
+ string response = HttpHelper.Post(apiAddress, request);
+ AgvStatusContent agvContent = response.DeserializeObject<AgvStatusContent>() ?? throw new Exception("AGV鐘舵�佹煡璇㈡湭杩斿洖缁撴灉");
+
+ //鑾峰彇鎵�鏈夋晠闅滀俊鎭�
+ List <Dt_ErrorInfo> errorInfos = _errorInfoRepository.QueryData();
+ int errorId = errorInfos.Count > 0 ? errorInfos.Max(x => x.Id) : 0;
+ List<Dt_ErrorInfo> delErrorInfos = new List<Dt_ErrorInfo>();
+ List<Dt_ErrorInfo> addErrorInfos = new List<Dt_ErrorInfo>();
+ //鑾峰彇浠诲姟淇℃伅
+ List<Dt_Task> tasks = BaseDal.QueryData();
+ if (agvContent.Success)
+ {
+ foreach (var item in agvContent.Data.Where(x => errorInfos.Select(x => x.RobotCode).Contains(x.RobotId) && x.Status != 7))
+ {
+ //涓婃姤鏁呴殰鎭㈠
+ Dt_ErrorInfo errorInfo = errorInfos.FirstOrDefault(x => x.RobotCode == item.RobotId);
+
+ delErrorInfos.Add(errorInfo);
+ }
+ foreach (var item in agvContent.Data.Where(x => !x.MissionCode.IsNullOrEmpty() && !errorInfos.Select(x => x.RobotCode).Contains(x.RobotId) && x.Status == 7))
+ {
+ Dt_Task? task = tasks.FirstOrDefault(x=>x.TaskNum == item.MissionCode.ObjToInt() || x.GroupId==item.MissionCode);
+ if (task != null)
+ {
+ Dt_ErrorInfo errorInfo = new Dt_ErrorInfo()
+ {
+ RobotCode = item.RobotId,
+ Message = "鏁呴殰"
+ };
+ if (task.TaskType==TaskTypeEnum.Inbound.ObjToInt())
+ {
+ errorInfo.StationCode = task.CurrentAddress;
+ }
+ else
+ {
+ errorInfo.StationCode = task.NextAddress;
+ }
+ addErrorInfos.Add(errorInfo);
+ }
+ }
+ }
+ //鏁版嵁搴撴搷浣�
+ _unitOfWorkManage.BeginTran();
+ _errorInfoRepository.DeleteData(delErrorInfos);
+ _errorInfoRepository.AddData(addErrorInfos);
+ _unitOfWorkManage.CommitTran();
+ List<Dt_ErrorInfo> newErrInfos = _errorInfoRepository.QueryData(x=>x.Id > errorId);
+ if (delErrorInfos.Count>0)
+ {
+ foreach (var item in delErrorInfos)
+ {
+ TaskError taskError = new TaskError()
+ {
+ MsgID = item.Id,
+ StationCode = item.StationCode,
+ MsgCode = 0,
+ Msg = "鎭㈠"
+ };
+ string reqErrorBack = JsonConvert.SerializeObject(taskError, settings);
+ HttpHelper.Post(apiErrorBack, reqErrorBack);
+ }
+ }
+ if (newErrInfos.Count>0)
+ {
+ //涓婁紶鏁呴殰
+ foreach (var item in newErrInfos)
+ {
+ TaskError taskError = new TaskError()
+ {
+ MsgID = item.Id,
+ StationCode = item.StationCode,
+ MsgCode = 1,
+ Msg = item.Message
+ };
+ string reqErrorBack = JsonConvert.SerializeObject(taskError, settings);
+ HttpHelper.Post(apiErrorBack, reqErrorBack);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ _unitOfWorkManage.RollbackTran();
+ throw new Exception(ex.Message);
+ }
+
}
}
}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs"
index 4dc25f7..4010c1c 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -18,6 +18,8 @@
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using NPOI.SS.Formula.Functions;
+using NPOI.SS.UserModel;
+using NPOI.XSSF.UserModel;
using SqlSugar;
using System.Diagnostics.CodeAnalysis;
using System.DirectoryServices.Protocols;
@@ -30,6 +32,7 @@
using WIDESEAWCS_BasicInfoService;
using WIDESEAWCS_Common;
using WIDESEAWCS_Common.APIEnum;
+using WIDESEAWCS_Common.Helper;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.BaseRepository;
@@ -66,6 +69,7 @@
private readonly ILocationInfoRepository _locationInfoRepository;
private readonly ILocationInfoService _locationInfoService;
private readonly ILocationStatusChangeRecordService _locationStatusChangeRecordService;
+ private readonly IErrorInfoRepository _errorInfoRepository;
private Dictionary<string, OrderByType> _taskOrderBy = new()
{
@@ -83,7 +87,7 @@
public List<int> TaskRelocationTypes => typeof(TaskTypeEnum).GetEnumIndexList().Where(x => x >= 900 && x < 1000).ToList();
- public TaskService(ITaskRepository BaseDal, IMapper mapper, ICacheService cacheService, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IApiInfoRepository apiInfoRepository,ILocationInfoRepository locationInfoRepository,IUnitOfWorkManage unitOfWorkManage, ILocationInfoService locationInfoService,ILocationStatusChangeRecordService locationStatusChangeRecordService) : base(BaseDal)
+ public TaskService(ITaskRepository BaseDal, IMapper mapper, ICacheService cacheService, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IApiInfoRepository apiInfoRepository,ILocationInfoRepository locationInfoRepository,IUnitOfWorkManage unitOfWorkManage, ILocationInfoService locationInfoService,ILocationStatusChangeRecordService locationStatusChangeRecordService,IErrorInfoRepository errorInfoRepository) : base(BaseDal)
{
_mapper = mapper;
_cacheService = cacheService;
@@ -97,6 +101,7 @@
_unitOfWorkManage = unitOfWorkManage;
_locationInfoService = locationInfoService;
_locationStatusChangeRecordService=locationStatusChangeRecordService;
+ _errorInfoRepository = errorInfoRepository;
}
static object lock_taskReceive = new object();
/// <summary>
@@ -116,8 +121,8 @@
List<Dt_Task> taskOlds = BaseDal.QueryData(x=> taskDTO.Tasks.Select(x => x.TaskDescribe.ContainerCode).Contains(x.PalletCode));
List<Dt_LocationInfo> locationInfos = _locationInfoRepository.GetCanOut(taskDTO.Tasks.Select(x=>x.TaskDescribe.ContainerCode).ToList());
List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData();
- //涓嬪彂浠诲姟缁�
- string taskGroup= taskDTO.TaskGroupCode.IsNullOrEmpty() ? Guid.NewGuid().ToString().Replace("-","") : taskDTO.TaskGroupCode;
+ ////涓嬪彂浠诲姟缁�
+ //string taskGroup= taskDTO.TaskGroupCode.IsNullOrEmpty() ? Guid.NewGuid().ToString().Replace("-","") : taskDTO.TaskGroupCode;
foreach (var item in taskDTO.Tasks.OrderBy(x=>x.TaskDescribe.ToStationCode))
{
if (item.TaskDescribe.ToStationCode.IsNullOrEmpty()) throw new Exception($"浠诲姟{item.TaskCode}鍑哄簱鐩爣鎿嶄綔鍙颁笉鑳戒负绌�");
@@ -150,7 +155,7 @@
task.CurrentAddress = locationInfo.LocationCode;
task.NextAddress = stationManger.PickStationCode;
task.TargetAddress = stationManger.PickStationCode;
- task.GroupId = taskGroup;
+ //task.GroupId = taskGroup;
task.TaskType = TaskTypeEnum.Outbound.ObjToInt();
task.Roadway = locationInfo.RoadwayNo;
task.DeviceCode = stationManger.CraneCode;
@@ -315,8 +320,8 @@
"Red" => "4",
_ => throw new Exception($"鏈壘鍒伴鑹插畾涔�")
},
- ORDERTYPE=taskSendLight.Mode.ToString(),
- LIGHTTYPE="1",
+ ORDERTYPE="1",
+ LIGHTTYPE=taskSendLight.Mode.ToString(),
}
};
EPLightContent pLightContent = PickOrderInfoRequest(lightSendDTOs);
@@ -793,5 +798,30 @@
}
return content;
}
+ public override WebResponseContent Export(PageDataOptions options)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ string savePath = AppDomain.CurrentDomain.BaseDirectory + "ExcelExport";
+
+ // 纭繚鐩綍瀛樺湪
+ if (!Directory.Exists(savePath))
+ Directory.CreateDirectory(savePath);
+
+ // 鑾峰彇鏁版嵁
+ ISugarQueryable<Dt_Task> query = BaseDal.Db.Queryable<Dt_Task>();
+ var dataList = query.ToList();
+ var properties = typeof(Dt_Task).GetProperties();
+
+ string filePath = TExportHelper.GetExport(savePath, properties, dataList);
+ return WebResponseContent.Instance.OK(data: filePath);
+ }
+ catch (Exception ex)
+ {
+ content = WebResponseContent.Instance.Error(ex.Message);
+ }
+ return content;
+ }
}
}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/Task_HtyService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/Task_HtyService.cs"
index 2baf7d3..1cf9b41 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/Task_HtyService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/Task_HtyService.cs"
@@ -1,8 +1,14 @@
锘�
using AutoMapper;
+using NPOI.SS.UserModel;
+using NPOI.XSSF.UserModel;
+using SqlSugar;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
+using WIDESEAWCS_Common.Helper;
+using WIDESEAWCS_Core;
using WIDESEAWCS_Core.BaseServices;
+using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_ITaskInfo_HtyRepository;
using WIDESEAWCS_ITaskInfo_HtyService;
using WIDESEAWCS_Model.Models;
@@ -14,5 +20,29 @@
public Task_HtyService(ITask_HtyRepository BaseDal) : base(BaseDal)
{
}
+ public override WebResponseContent Export(PageDataOptions options)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ string savePath = AppDomain.CurrentDomain.BaseDirectory + "ExcelExport";
+
+ // 纭繚鐩綍瀛樺湪
+ if (!Directory.Exists(savePath))
+ Directory.CreateDirectory(savePath);
+
+ // 鑾峰彇鏁版嵁
+ ISugarQueryable<Dt_Task_Hty> query = BaseDal.Db.Queryable<Dt_Task_Hty>();
+ var dataList = query.ToList();
+ var properties = typeof(Dt_Task_Hty).GetProperties();
+ string filePath = TExportHelper.GetExport(savePath, properties, dataList);
+ return WebResponseContent.Instance.OK(data: filePath);
+ }
+ catch (Exception ex)
+ {
+ content = WebResponseContent.Instance.Error(ex.Message);
+ }
+ return content;
+ }
}
}
\ No newline at end of file
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Tasks/AGV/AGVErrorJob.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Tasks/AGV/AGVErrorJob.cs"
new file mode 100644
index 0000000..4c63a51
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Tasks/AGV/AGVErrorJob.cs"
@@ -0,0 +1,47 @@
+锘縰sing AutoMapper;
+using Quartz;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEAWCS_IBasicInfoRepository;
+using WIDESEAWCS_ITaskInfoService;
+using WIDESEAWCS_QuartzJob;
+using WIDESEAWCS_QuartzJob.Service;
+
+namespace WIDESEAWCS_Tasks
+{
+ [DisallowConcurrentExecution]
+ public partial class AGVErrorJob : JobBase, IJob
+ {
+ public readonly ITaskService _taskService;
+ private readonly ITaskExecuteDetailService _taskExecuteDetailService;
+ private readonly IRouterService _routerService;
+ private readonly IStationMangerRepository _stationMangerRepository;
+ private readonly ILocationInfoRepository _locationInfoRepository;
+ private readonly IMapper _mapper;
+
+ public AGVErrorJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IStationMangerRepository stationMangerRepository, ILocationInfoRepository locationInfoRepository, IMapper mapper)
+ {
+ _taskService = taskService;
+ _taskExecuteDetailService = taskExecuteDetailService;
+ _routerService = routerService;
+ _stationMangerRepository = stationMangerRepository;
+ _locationInfoRepository = locationInfoRepository;
+ _mapper = mapper;
+ }
+ public Task Execute(IJobExecutionContext context)
+ {
+ try
+ {
+ _taskService.AgvSearchStatus();
+ }
+ catch (Exception ex)
+ {
+ WriteError(nameof(AGVErrorJob),ex.Message);
+ }
+ return Task.CompletedTask;
+ }
+ }
+}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Tasks/AGV/AGVExtend.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Tasks/AGV/AGVExtend.cs"
index 52bcb14..8d9aeaa 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Tasks/AGV/AGVExtend.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Tasks/AGV/AGVExtend.cs"
@@ -6,6 +6,7 @@
using System.Text;
using System.Threading.Tasks;
using WIDESEA_DTO.Agv;
+using WIDESEAWCS_Common;
using WIDESEAWCS_Common.APIEnum;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
@@ -24,74 +25,84 @@
{
var newTasksOut = _taskService.Db.Queryable<Dt_Task>().Where(x => (x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()) && x.TaskType==TaskTypeEnum.Outbound.ObjToInt() && x.DeviceCode == "AGV").ToList().OrderBy(x => x.Grade).ThenBy(x => x.TaskNum).ToList();
var newTasksIn = _taskService.Db.Queryable<Dt_Task>().Where(x => (x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()) && x.TaskType == TaskTypeEnum.Inbound.ObjToInt() && x.DeviceCode == "AGV").ToList().OrderBy(x => x.Grade).ThenBy(x => x.TaskNum).ToList();
+ var taskDownOut = _taskService.Db.Queryable<Dt_Task>().Where(x => (x.TaskState > TaskStatusEnum.AGV_Execute.ObjToInt()) && x.TaskType == TaskTypeEnum.Outbound.ObjToInt() && x.DeviceCode == "AGV").OrderBy(x => x.TaskNum).ToList();
#region 鍑哄簱浠诲姟涓嬪彂
if (newTasksOut.Count>0)
{
- List<string> GroupIds = newTasksOut.GroupBy(x => x.GroupId).Select(x => x.Key).ToList();
- foreach (var GroupId in GroupIds)
+ foreach (var GroupTask in newTasksOut.GroupBy(x=>x.NextAddress))
{
- var tasks = newTasksOut.Where(x => x.GroupId == GroupId).ToList();
- try
+ var tasks = GroupTask.OrderBy(x => x.TaskNum).ToList();
+ TimeSpan span = DateTime.Now - tasks.FirstOrDefault().CreateDate;
+ int taskDownCount = taskDownOut.Where(x => x.NextAddress == GroupTask.Key).Count();
+ if (taskDownCount < (GroupTask.ObjToInt() > 201 ? 4 : 6) && (int)span.TotalSeconds > 20)
{
- AgvTaskSendDTO agvTaskSend = new AgvTaskSendDTO()
+ try
{
- MissionData = new List<MissionDataItem>()
- };
- foreach (var task in tasks)
- {
- //鑾峰彇鐩爣鐐硅揣浣�
- Dt_LocationInfo locationInfoStart = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.CurrentAddress);
- //鑾峰彇鎷i�夊嚭搴撶珯鍙�
- Dt_StationManger stationMangerEnd = _stationMangerRepository.QueryFirst(x => x.PickStationCode == task.NextAddress);
+ AgvTaskSendDTO agvTaskSend = new AgvTaskSendDTO()
+ {
+ MissionData = new List<MissionDataItem>()
+ };
+ string taskGroupId = Guid.NewGuid().ToString().Replace("-", "");
+ foreach (var task in tasks)
+ {
+ //鑾峰彇鐩爣鐐硅揣浣�
+ Dt_LocationInfo locationInfoStart = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.CurrentAddress);
+ //鑾峰彇鎷i�夊嚭搴撶珯鍙�
+ Dt_StationManger stationMangerEnd = _stationMangerRepository.QueryFirst(x => x.PickStationCode == task.NextAddress);
- if (locationInfoStart == null || stationMangerEnd == null) throw new Exception($"鏈壘鍒颁换鍔″彿${task.TaskNum}璧峰鐐箋task.CurrentAddress}鎴栫洰鏍囩偣{task.NextAddress}浣嶇疆淇℃伅");
- agvTaskSend.RequestId = GroupId;
- agvTaskSend.MissionCode = GroupId;
- agvTaskSend.ViewBoardType = "W01";
- if (task.Grade == 0)
+ if (locationInfoStart == null || stationMangerEnd == null) throw new Exception($"鏈壘鍒颁换鍔″彿${task.TaskNum}璧峰鐐箋task.CurrentAddress}鎴栫洰鏍囩偣{task.NextAddress}浣嶇疆淇℃伅");
+ agvTaskSend.RequestId = taskGroupId;
+ agvTaskSend.MissionCode = taskGroupId;
+ agvTaskSend.ViewBoardType = "W01";
+ //鏂欑瀛愭惉杩愪换鍔�
+ MissionDataItem missionDataItem = new MissionDataItem()
+ {
+ Sequence = task.TaskNum,
+ BinCode = task.PalletCode,
+ StartPosition = locationInfoStart.AgvPoint,
+ StartSlotCode = locationInfoStart.LocationCode,
+ EndPosition = stationMangerEnd.StationCode,
+ EndSlotCode = stationMangerEnd.CraneStationCode,
+ TakeActionConfirm = false,
+ TakeActionInform = false,
+ PutActionConfirm = true,
+ PutActionInform = true,
+ };
+ agvTaskSend.MissionData.Add(missionDataItem);
+ }
+ if (tasks.OrderByDescending(x => x.Grade).FirstOrDefault()?.Grade == 0)
{
agvTaskSend.Priority = 99;
}
else
{
- agvTaskSend.Priority = 99 - task.Grade;
+ agvTaskSend.Priority = 99 - tasks.OrderByDescending(x => x.Grade).FirstOrDefault().Grade;
}
- //鏂欑瀛愭惉杩愪换鍔�
- MissionDataItem missionDataItem = new MissionDataItem()
+ tasks.ForEach(x =>
{
- Sequence = task.TaskNum,
- BinCode = task.PalletCode,
- StartPosition = locationInfoStart.AgvPoint,
- StartSlotCode = locationInfoStart.LocationCode,
- EndPosition = stationMangerEnd.StationCode,
- EndSlotCode = stationMangerEnd.CraneStationCode,
- TakeActionConfirm = false,
- TakeActionInform = false,
- PutActionConfirm = true,
- PutActionInform = true,
- };
- agvTaskSend.MissionData.Add(missionDataItem);
+ x.GroupId = taskGroupId;
+ });
+ //鍙戦�丄GV浠诲姟
+ WebResponseContent content = _taskService.AgvSendTask(agvTaskSend, APIEnum.AgvSendTask);
+ if (!content.Status)
+ throw new Exception(content.Message);
+ tasks.ForEach(x =>
+ {
+ x.Dispatchertime = DateTime.Now;
+ x.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt();
+ });
+ _taskService.UpdateData(tasks);
+ Thread.Sleep(500);
}
- //鍙戦�丄GV浠诲姟
- WebResponseContent content = _taskService.AgvSendTask(agvTaskSend, APIEnum.AgvSendTask);
- if (!content.Status)
- throw new Exception(content.Message);
- tasks.ForEach(x =>
+ catch (Exception ex)
{
- x.Dispatchertime = DateTime.Now;
- x.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt();
- });
- _taskService.UpdateData(tasks);
- Thread.Sleep(500);
- }
- catch (Exception ex)
- {
- tasks.ForEach(x =>
- {
- x.TaskState = TaskStatusEnum.Exception.ObjToInt();
- x.ExceptionMessage = ex.Message;
- });
- _taskService.UpdateData(tasks);
+ tasks.ForEach(x =>
+ {
+ x.TaskState = TaskStatusEnum.Exception.ObjToInt();
+ x.ExceptionMessage = ex.Message;
+ });
+ _taskService.UpdateData(tasks);
+ }
}
}
}
diff --git "a/\351\241\271\347\233\256\350\265\204\346\226\231/\346\216\245\345\217\243\346\261\207\346\200\273\346\226\207\344\273\266/WMS-KUKA\350\256\276\345\244\207\347\212\266\346\200\201\346\216\245\345\217\243.xlsx" "b/\351\241\271\347\233\256\350\265\204\346\226\231/\346\216\245\345\217\243\346\261\207\346\200\273\346\226\207\344\273\266/WMS-KUKA\350\256\276\345\244\207\347\212\266\346\200\201\346\216\245\345\217\243.xlsx"
new file mode 100644
index 0000000..506fd05
--- /dev/null
+++ "b/\351\241\271\347\233\256\350\265\204\346\226\231/\346\216\245\345\217\243\346\261\207\346\200\273\346\226\207\344\273\266/WMS-KUKA\350\256\276\345\244\207\347\212\266\346\200\201\346\216\245\345\217\243.xlsx"
Binary files differ
--
Gitblit v1.9.3