ÏîÄ¿´úÂë/WCSClient/src/views/basicinfo/locationInfo.vue
@@ -49,7 +49,7 @@ { title: "è´§ä½ç¼å·", field: "locationCode", type: "like"}, { title: "æç®±ç¼å·", field: "palletCode", type: "like"}, { title: "ç¦ç¨ç¶æ", field: "enableStatus" ,type: "select",dataKey: "",data: [{key: "0",value: "å¯ç¨"},{key: "3",value: "ç¦ç¨"}]}, { title: "è´§ä½ç¶æ", field: "locationStatus" ,type: "selectList",dataKey: "locationStatusEnum",data: []}, { title: "è´§ä½ç¶æ", field: "locationStatus" ,type: "selectList",dataKey: "",data: [{key: "0",value: "空é²"},{key: "1",value: "éå®"},{key: "100",value: "æè´§"}]}, ], [ { title: "è¡", field: "row" ,type: "int"}, ÏîÄ¿´úÂë/WCSClient/src/views/taskinfo/task.vue
@@ -24,7 +24,7 @@ cnName: "ä»»å¡ä¿¡æ¯", name: "task", url: "/Task/", sortName: "CreateDate", sortName: "taskNum", }); const editFormFields = ref({}); const editFormOptions = ref([]); ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_BasicInfoService/LocationInfoService.cs
@@ -1,4 +1,8 @@ using HslCommunication.WebSocket; using Magicodes.ExporterAndImporter.Core; using Magicodes.ExporterAndImporter.Excel; using MathNet.Numerics.Statistics.Mcmc; using NPOI.Util.Collections; using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; using SqlSugar; @@ -188,5 +192,56 @@ return WebResponseContent.Instance.Error(ex.Message); } } public override WebResponseContent Export(PageDataOptions options) { 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 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) { } } byte[] data = exporter.ExportAsByteArray(sugarQueryable.ToList()).Result; string fileName = "åºä½ä¿¡æ¯.xlsx"; FileHelper.WriteFile(savePath, fileName, data); content = WebResponseContent.Instance.OK(data: savePath + "\\" + fileName); } catch (Exception ex) { content = WebResponseContent.Instance.Error(ex.Message); } return content; } } } ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_Common/APIEnum/APIEnum.cs
@@ -20,14 +20,29 @@ [Description("AGV任塿¾è¡æ¥å£")] AgvTaskFlow, /// <summary> /// WMSå ¥åºåé¦å®æ /// WMSåºå ¥åºåé¦å®æ /// </summary> [Description("WMSå ¥åºåé¦å®æ")] WMSInBoundBack, [Description("WMSåºå ¥åºåé¦å®æ")] WMSInOutBoundBack, /// <summary> /// WMSæç®±å°è¾¾æ£éä½ä¸æ¥ /// </summary> [Description("WMSæç®±å°è¾¾æ£éä½ä¸æ¥")] WMSPickArrivedUp, /// <summary> /// äºææç§å¢åå§å /// </summary> [Description("äºææç§å¢åå§å")] INITIALIZATION, /// <summary> /// äºææç§å¢ç»æä½ä¸ /// </summary> [Description("äºææç§å¢ç»æä½ä¸")] ENDWORK, /// <summary> /// äºææç§å¢ä¸å /// </summary> [Description("äºææç§å¢ä¸å")] PickOrderInfoRequest, } } ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_DTO/EPLightBackDTO.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,32 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WIDESEAWCS_DTO { public class EPLightBackDTO { /// <summary> /// 订åå· /// </summary> public string DOCNO { get; set; } /// <summary> /// ä»»å¡å· /// </summary> public string TASKNO { get; set; } /// <summary> /// è´§ä½å· /// </summary> public string LOCATION { get; set; } /// <summary> /// å®é æç¯æ°é /// </summary> public int QUANTITY { get; set; } /// <summary> /// æç¯æ¶é´ /// </summary> public string RETURNTIME { get; set; } } } ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_DTO/EPLightContent.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,39 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using WIDESEAWCS_Core; namespace WIDESEAWCS_DTO { public class EPLightContent { /// <summary> /// è¿åç»æ 0:æå;-1:失败 /// </summary> public string Result { get; set; } /// <summary> /// è¿åä¿¡æ¯ /// </summary> public string Msg { get; set; } public EPLightContent() { } public EPLightContent OK(string message = "") { Result = "0"; Msg = message; return this; } public EPLightContent Error(string message = "") { Result = "-1"; Msg = message; return this; } } } ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_DTO/EPLightSendDTO.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,41 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WIDESEAWCS_DTO { public class EPLightSendDTO { /// <summary> /// 订åå· /// </summary> public string DOCNO { get; set; } /// <summary> /// ä»»å¡å· /// </summary> public string TASKNO { get; set; } /// <summary> /// è´§ä½å· /// </summary> public string LOCATION { get; set; } /// <summary> /// äº®ç¯æ°é /// </summary> public int QUANTITY { get; set; } /// <summary> /// 亮ç¯é¢è² /// </summary> public string LIGHTCOLOR { get; set; } /// <summary> /// 亮ç¯ç¶æï¼1ï¼äº®ï¼2ç /// </summary> public string ORDERTYPE { get; set; } /// <summary> /// ä¸å¡ç±»å 1ï¼å ¥åºäº®ç¯ 2ï¼åºåºäº®ç¯ /// </summary> public string LIGHTTYPE { get; set; } } } ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_DTO/TaskInfo/ContainerDTO.cs
@@ -41,7 +41,7 @@ public string Direction { get; set; } } /// <summary> /// æç®±å ¥åºå®æä¸æ¥ /// æç®±åºå ¥åºå®æä¸æ¥ /// </summary> public class ContainerInFinishDTO { @@ -54,12 +54,16 @@ /// </summary> public string ContainerCode { get; set; } /// <summary> /// èµ·å§ç«å° /// ç«å° /// </summary> public string FromStationCode { get; set; } public string StationCode { get; set; } /// <summary> /// ç®æ è´§ä½ /// è´§ä½ /// </summary> public string ToLocationCode { get; set; } public string LocationCode { get; set; } /// <summary> /// 1åºåºå®æï¼2å ¥åºå®æ /// </summary> public int CompleteType { get; set; } } } ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_DTO/TaskInfo/WMSTaskDTO.cs
@@ -15,10 +15,23 @@ /// ä»»å¡å· /// </summary> public string TaskCode { get; set; } /// <summary> /// ä»»å¡ä¼å 级 /// </summary> public int TaskPriority { get; set; } /// <summary> /// ä»»å¡ä¿¡æ¯ /// </summary> public TaskDescribe TaskDescribe { get; set; } } /// <summary> /// ä»»å¡ä¿¡æ¯ /// </summary> public class TaskDescribe { /// <summary> /// æç®±å· /// </summary> @@ -44,7 +57,9 @@ /// </summary> public string ToLocationCode { get; set; } } /// <summary> /// æ¥æ¶ä»»å¡ /// </summary> public class WMSTaskDTO { /// <summary> @@ -64,4 +79,18 @@ /// </summary> public List<TasksItem> Tasks { get; set; } } /// <summary> /// åæ¶ä»»å¡ /// </summary> public class TaskCancel { /// <summary> /// ä»»å¡å· /// </summary> public string TaskCode { get; set; } /// <summary> /// æç®±ç¼å· /// </summary> public string ContainerCode { get; set; } } } ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_ITaskInfoService/ITaskService.cs
@@ -136,5 +136,21 @@ /// </summary> /// <returns></returns> WebResponseContent TaskCompleted(int taskNum); /// <summary> /// äºææç§å¢ä¸å /// </summary> /// <param name="lightSendDTOs"></param> /// <returns></returns> EPLightContent PickOrderInfoRequest(List<EPLightSendDTO> lightSendDTOs); /// <summary> /// äºææç§å¢åå§å /// </summary> /// <returns></returns> EPLightContent INITIALIZATION(); /// <summary> /// äºææç§å¢ç»æå·¦å³ /// </summary> /// <returns></returns> EPLightContent ENDWORK(); } } ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_Model/Models/BasicInfo/Dt_LocationInfo.cs
@@ -1,4 +1,5 @@ using SqlSugar; using Magicodes.ExporterAndImporter.Core; using SqlSugar; using System; using System.Collections.Generic; using System.Linq; @@ -17,78 +18,104 @@ /// <summary> /// ä¸»é® /// </summary> [ImporterHeader(Name = "主é®")] [ExporterHeader(DisplayName = "主é®")] [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] public int Id { get; set; } /// <summary> /// åºåºç¼å· /// </summary> [ImporterHeader(IsIgnore = true)] [ExporterHeader(IsIgnore = true)] [SugarColumn(IsNullable = false, ColumnDescription = "åºåºç¼å·")] public int WarehouseId { get; set; } /// <summary> /// æç®±ç¼å· /// </summary> [ImporterHeader(Name = "æç®±ç¼å·")] [ExporterHeader(DisplayName = "æç®±ç¼å·")] [SugarColumn(IsNullable = false, ColumnDescription = "æç®±ç¼å·")] public string PalletCode { get; set; } /// <summary> /// è´§ä½ç¼å· /// </summary> [ImporterHeader(Name = "è´§ä½ç¼å·")] [ExporterHeader(DisplayName = "è´§ä½ç¼å·")] [SugarColumn(IsNullable = true, Length = 30, ColumnDescription = "è´§ä½ç¼å·")] public string LocationCode { get; set; } /// <summary> /// è´§ä½åç§° /// </summary> [ImporterHeader(Name = "è´§ä½åç§°")] [ExporterHeader(DisplayName = "è´§ä½åç§°")] [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "è´§ä½åç§°")] public string LocationName { get; set; } /// <summary> /// å··éç¼å· /// </summary> [ImporterHeader(Name = "å··éç¼å·")] [ExporterHeader(DisplayName = "å··éç¼å·")] [SugarColumn(IsNullable = true, Length = 20, ColumnDescription = "å··éç¼å·")] public string RoadwayNo { get; set; } /// <summary> /// è´§ä½è¡ /// </summary> [ImporterHeader(Name = "è´§ä½è¡")] [ExporterHeader(DisplayName = "è´§ä½è¡")] [SugarColumn(IsNullable = true, ColumnDescription = "è´§ä½è¡")] public int Row { get; set; } /// <summary> /// è´§ä½å /// </summary> [ImporterHeader(Name = "è´§ä½å")] [ExporterHeader(DisplayName = "è´§ä½å")] [SugarColumn(IsNullable = true, ColumnDescription = "è´§ä½å")] public int Columns { get; set; } /// <summary> /// è´§ä½å± /// </summary> [ImporterHeader(Name = "è´§ä½å±")] [ExporterHeader(DisplayName = "è´§ä½å±")] [SugarColumn(IsNullable = true, ColumnDescription = "è´§ä½å±")] public int Layer { get; set; } /// <summary> /// AGVåè´§ç¹ /// </summary> [ImporterHeader(Name = "AGVåè´§ç¹")] [ExporterHeader(DisplayName = "AGVåè´§ç¹")] [SugarColumn(IsNullable = true, ColumnDescription = "AGVåè´§ç¹")] public string AgvPoint { get; set; } /// <summary> /// è´§ä½ç¶æ /// </summary> [ImporterHeader(Name = "è´§ä½ç¶æ")] [ExporterHeader(DisplayName = "è´§ä½ç¶æ")] [SugarColumn(IsNullable = true, DefaultValue = "0", ColumnDescription = "è´§ä½ç¶æ")] public int LocationStatus { get; set; } /// <summary> /// ç¦ç¨ç¶æ /// </summary> [ImporterHeader(Name = "ç¦ç¨ç¶æ")] [ExporterHeader(DisplayName = "ç¦ç¨ç¶æ")] [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; } } ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs
@@ -66,12 +66,16 @@ /// <summary> /// æçç±»å /// </summary> [ImporterHeader(Name = "æçç±»å")] [ExporterHeader(IsIgnore =true)] [SugarColumn(IsNullable = false, ColumnDescription = "æçç±»å")] public int PalletType { get; set; } /// <summary> /// 设å¤ç¼å· /// </summary> [ImporterHeader(Name = "设å¤ç¼å·")] [ExporterHeader(IsIgnore = true)] [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "设å¤ç¼å·")] public string DeviceCode { get; set; } ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task_Hty.cs
@@ -1,4 +1,7 @@ using System; using Magicodes.ExporterAndImporter.Core; using Org.BouncyCastle.Crypto; using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -9,10 +12,14 @@ { public class Dt_Task_Hty : Dt_Task, IBaseHistoryEntity { [ImporterHeader(Name = "æ¥æºID")] [ExporterHeader(DisplayName = "æ¥æºID")] public int SourceId { get; set; } [ImporterHeader(Name = "æä½ç±»å")] [ExporterHeader(DisplayName = "æä½ç±»å")] public string OperateType { get; set; } [ImporterHeader(Name = "å å ¥æ¶é´")] [ExporterHeader(DisplayName = "å å ¥æ¶é´")] public DateTime InsertTime { get; set; } } } ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_Server/Controllers/Task/TaskController.cs
@@ -107,10 +107,21 @@ /// </summary> /// <param name="taskNum"></param> /// <returns></returns> [HttpPost, HttpGet, Route("RecWMSTaskCompleted"), AllowAnonymous] public WebResponseContent RecWMSTaskCompleted(int taskNum) [HttpPost, HttpGet, Route("RecTaskCompleted"), AllowAnonymous] public WebResponseContent RecTaskCompleted(int taskNum) { return Service.TaskCompleted(taskNum); } /// <summary> /// WMSä»»å¡åæ¶åæ¥ /// </summary> /// <param name="taskNum"></param> /// <returns></returns> [HttpPost, HttpGet, Route("CancelTask"), AllowAnonymous] public WebResponseContent CancelTask(List<TaskCancel> taskCancels) { return WebResponseContent.Instance.Error(); } } } ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_Server/Controllers/WebAPIController.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,129 @@ using Autofac.Core; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using System.Text; using System.Text.RegularExpressions; using WIDESEA_DTO.Agv; using WIDESEA_External.Model; using WIDESEAWCS_Common; using WIDESEAWCS_Common.APIEnum; using WIDESEAWCS_Common.TaskEnum; using WIDESEAWCS_Core; using WIDESEAWCS_Core.Enums; using WIDESEAWCS_Core.Helper; using WIDESEAWCS_Core.LogHelper; using WIDESEAWCS_DTO; using WIDESEAWCS_DTO.Agv; using WIDESEAWCS_IBasicInfoRepository; using WIDESEAWCS_ITaskInfoRepository; using WIDESEAWCS_ITaskInfoService; using WIDESEAWCS_Model.Models; using WIDESEAWCS_QuartzJob; using WIDESEAWCS_QuartzJob.DTO; using WIDESEAWCS_QuartzJob.Models; using WIDESEAWCS_QuartzJob.Repository; using WIDESEAWCS_Tasks; using WIDESEAWCS_Tasks.DBNames; using static Dm.net.buffer.ByteArrayBuffer; namespace WIDESEAWCS_Server.Controllers { [Route("api/[controller]")] [ApiController] public class WebAPIController : ControllerBase { private readonly IStationMangerRepository _stationMangerRepository; private readonly ITaskService _taskService; private readonly ITaskRepository _taskRepository; private readonly IRouterRepository _routerRepository; public WebAPIController(IStationMangerRepository stationMangerRepository, ITaskService taskService, ITaskRepository taskRepository, IRouterRepository routerRepository) { _stationMangerRepository = stationMangerRepository; _taskService = taskService; _taskRepository = taskRepository; _routerRepository = routerRepository; } /// <summary> /// åè°ä¸ä¼ /// </summary> /// <returns></returns> [HttpPost, HttpGet, Route("PickOrderCallBack"), AllowAnonymous] public EPLightContent? PickOrderCallBack([FromBody] List<EPLightBackDTO> lightBackDTOs) { EPLightContent content = new EPLightContent(); try { if (lightBackDTOs==null) { return content.Error("ä¼ å ¥ä¸è½ä¸ºç©º"); } content.OK("æ¥æ¶æå"); } catch (Exception ex) { content.Error(ex.Message); } return content; } /// <summary> /// æç§å¢ä¸å(äºæ) /// </summary> /// <returns></returns> [HttpPost, HttpGet, Route("PickOrderInfoRequest"), AllowAnonymous] public EPLightContent PickOrderInfoRequest([FromBody] List<EPLightSendDTO> lightSendDTOs) { EPLightContent content = new EPLightContent(); try { if (lightSendDTOs == null) { return content.Error("ä¼ å ¥ä¸è½ä¸ºç©º"); } content = _taskService.PickOrderInfoRequest(lightSendDTOs); } catch (Exception ex) { content.Error(ex.Message); } return content; } /// <summary> /// æç§å¢åå§å(äºæ) /// </summary> /// <returns></returns> [HttpPost, HttpGet, Route("INITIALIZATION"), AllowAnonymous] public EPLightContent INITIALIZATION() { EPLightContent content = new EPLightContent(); try { content = _taskService.INITIALIZATION(); } catch (Exception ex) { content.Error(ex.Message); } return content; } /// <summary> /// æç§å¢ç»æä½ä¸(äºæ) /// </summary> /// <returns></returns> [HttpPost, HttpGet, Route("ENDWORK"), AllowAnonymous] public EPLightContent ENDWORK() { EPLightContent content = new EPLightContent(); try { content = _taskService.ENDWORK(); } catch (Exception ex) { content.Error(ex.Message); } return content; } } } ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_Server/Filter/CustomProfile.cs
@@ -21,7 +21,7 @@ { CreateMap<Sys_Menu, MenuDTO>(); CreateMap<Dt_DeviceInfo,DeviceInfoDTO>(); CreateMap<TasksItem, Dt_Task>().ForMember(a => a.WMSId, b => b.MapFrom(b => b.TaskCode)).ForMember(a => a.PalletCode, b => b.MapFrom(b => b.ContainerCode)).ForMember(a => a.Grade, b => b.MapFrom(b => b.TaskPriority)); CreateMap<TasksItem, Dt_Task>().ForMember(a => a.WMSId, b => b.MapFrom(b => b.TaskCode)).ForMember(a => a.PalletCode, b => b.MapFrom(b => b.TaskDescribe.ContainerCode)).ForMember(a => a.Grade, b => b.MapFrom(b => b.TaskPriority)); } } } ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -21,6 +21,7 @@ using SqlSugar; using System.Diagnostics.CodeAnalysis; using System.DirectoryServices.Protocols; using System.Linq; using System.Net.Http.Headers; using System.Security.Policy; using WIDESEA_DTO.Agv; @@ -102,27 +103,38 @@ public WebResponseContent ReceiveWMSTask([NotNull] WMSTaskDTO taskDTO) { WebResponseContent content = new WebResponseContent(); string errorMsg = ""; try { lock (lock_taskReceive) { List<Dt_Task> tasks = new List<Dt_Task>(); List<Dt_LocationInfo> locationInfos = _locationInfoRepository.GetCanOut(taskDTO.Tasks.Select(x=>x.ContainerCode).ToList()); TasksItem? tasksItem = taskDTO.Tasks.FirstOrDefault(x => !locationInfos.Select(t => t.PalletCode).Contains(x.ContainerCode)); if (tasksItem != null) throw new Exception($"ä»»å¡{tasksItem.TaskCode}æç®±å·{tasksItem.ContainerCode}ä¸åå¨"); Dt_Task taskOld = BaseDal.QueryFirst(x=> taskDTO.Tasks.Select(x => x.TaskDescribe.ContainerCode).Contains(x.PalletCode)); if (taskOld != null) throw new Exception($"æç®±{taskOld.PalletCode}"+(taskOld.TaskType == TaskTypeEnum.Inbound.ObjToInt() ? "å ¥åºä»»å¡å·²åå¨" : "åºåºä»»å¡å·²åå¨")); List<Dt_LocationInfo> locationInfos = _locationInfoRepository.GetCanOut(taskDTO.Tasks.Select(x=>x.TaskDescribe.ContainerCode).ToList()); Dt_LocationInfo? noOutLocation = locationInfos.FirstOrDefault(x=>x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() || x.EnableStatus != EnableStatusEnum.Normal.ObjToInt()); if (noOutLocation != null) throw new Exception($"æç®±{noOutLocation.PalletCode}è´§ä½{noOutLocation.LocationCode}ç¶æä¸å¯åºåº"); List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(); //ä¸åä»»å¡ç» string taskGroup= taskDTO.TaskGroupCode.IsNullOrEmpty() ? Guid.NewGuid().ToString().Replace("-","") : taskDTO.TaskGroupCode; foreach (var item in taskDTO.Tasks.OrderBy(x=>x.ToStationCode)) foreach (var item in taskDTO.Tasks.OrderBy(x=>x.TaskDescribe.ToStationCode)) { if (item.ToStationCode.IsNullOrEmpty()) throw new Exception($"ä»»å¡{item.TaskCode}åºåºç®æ æä½å°ä¸è½ä¸ºç©º"); if (item.TaskDescribe.ToStationCode.IsNullOrEmpty()) throw new Exception($"ä»»å¡{item.TaskCode}åºåºç®æ æä½å°ä¸è½ä¸ºç©º"); //è·åæä½å° Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.PickStationCode == item.ToStationCode); if (stationManger == null) throw new Exception($"ä»»å¡{item.TaskCode}åºåºç®æ æä½å°{item.ToStationCode}ä¸åå¨"); Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.PickStationCode == item.TaskDescribe.ToStationCode); if (stationManger == null) throw new Exception($"ä»»å¡{item.TaskCode}åºåºç®æ æä½å°{item.TaskDescribe.ToStationCode}ä¸åå¨"); Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.PalletCode == item.TaskDescribe.ContainerCode); if (locationInfo == null) { errorMsg += $"æç®±{item.TaskDescribe.ContainerCode}ä¸åå¨;"; continue; }; Dt_Task task = _mapper.Map<Dt_Task>(item); Dt_LocationInfo locationInfo = locationInfos.FirstOrDefault(x=>x.PalletCode==item.ContainerCode); task.SourceAddress = locationInfo.LocationCode; task.CurrentAddress = locationInfo.LocationCode; task.NextAddress = stationManger.PickStationCode; @@ -147,7 +159,7 @@ _taskExecuteDetailService.AddTaskExecuteDetail(tasks.Select(x => x.TaskNum).ToList(), "æ¥æ¶WMSä»»å¡"); content = tasks.Count > 0 ? content.OK("æå") : content.Error("失败"); content = tasks.Count > 0 ? content.OK("æå!"+(errorMsg.IsNullOrEmpty()? "": errorMsg)) : content.Error("失败"); } } catch (Exception ex) @@ -170,12 +182,12 @@ { List<Dt_LocationInfo> locationInfos = _locationInfoRepository.QueryData(); Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x=>x.PalletCode== containerFlowDTO.ContainerCode); if (locationInfo != null) throw new Exception($"æç®±å·{containerFlowDTO.ContainerCode}å·²åå¨"); if (locationInfo != null) throw new Exception($"åºä½æç®±å·{containerFlowDTO.ContainerCode}å·²åå¨"); if (BaseDal.QueryFirst(x=>x.PalletCode==containerFlowDTO.ContainerCode)!=null) throw new Exception($"æç®±å·{containerFlowDTO.ContainerCode}ä»»å¡å·²åå¨"); Dt_LocationInfo? noInLocation = locationInfos.FirstOrDefault(x => x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()); if (noInLocation == null) throw new Exception($"å¯ç¨è´§ä½ä¸è¶³!"); Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt() && x.StationDeviceCode == deviceCode); //ä¸åä»»å¡ç» //åå»ºä»»å¡ Dt_Task task = new Dt_Task(); task.PalletCode = containerFlowDTO.ContainerCode; task.SourceAddress = containerFlowDTO.SlotCode; @@ -245,23 +257,11 @@ DateTime beginDate = DateTime.Now; try { using (HttpContent httpContent = new StringContent(requestJson)) using (HttpContent httpContent = new StringContent(string.Empty)) { httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); using HttpClient httpClient = new HttpClient(); httpClient.Timeout = new TimeSpan(0, 0, 30); string LoginToken = AppSettings.Get("MESLoginToken"); headers = new Dictionary<string, string> { //æ£å¼ { "LoginToken", LoginToken } }; if (headers != null) { foreach (var header in headers) httpClient.DefaultRequestHeaders.Add(header.Key, header.Value); } HttpResponseMessage responseMessage = httpClient.PostAsync(serviceAddress, httpContent).Result; result = responseMessage.Content.ReadAsStringAsync().Result; } @@ -478,7 +478,7 @@ try { Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)//åºåºä»»å¡é»è¾ if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)//åºåºä»»å¡å®æé»è¾ { Dt_LocationInfo locationInfo = _locationInfoRepository.QueryFirst(x=>x.PalletCode==task.PalletCode); if (locationInfo.LocationStatus != LocationStatusEnum.Lock.ObjToInt()) @@ -488,32 +488,54 @@ task.TaskState = TaskStatusEnum.Finish.ObjToInt(); locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); locationInfo.PalletCode = ""; //æç®±åºåºå®æä¸æ¥ç»WMS string? url = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.WMSInOutBoundBack.ToString())?.ApiAddress; if (string.IsNullOrEmpty(url)) { _taskExecuteDetailService.AddTaskExecuteDetail(task, $"æªæ¾å°WMSåºåºä¸æ¥æ¥å£,è¯·æ£æ¥æ¥å£é ç½®"); UpdateTaskExceptionMessage(taskNum, $"æªæ¾å°WMSåºåºä¸æ¥æ¥å£,è¯·æ£æ¥æ¥å£é ç½®"); return content.Error($"{taskNum},æªæ¾å°WMSåºåºä¸æ¥æ¥å£,è¯·æ£æ¥æ¥å£é ç½®"); } ContainerInFinishDTO containerInFinishDTO = new ContainerInFinishDTO() { TaskCode = task.TaskNum.ToString(), ContainerCode = task.PalletCode, StationCode = task.TargetAddress, LocationCode = task.SourceAddress, CompleteType = 1 }; string request = JsonConvert.SerializeObject(containerInFinishDTO, settings); //è°ç¨æ¥å£ string response = HttpHelper.Post(url, request); WMSResponseContent wMSResponse = JsonConvert.DeserializeObject<WMSResponseContent>(response) ?? throw new Exception($"{taskNum},æªæ¥æ¶å°WMSåºåºä¸æ¥è¿åå¼"); if (wMSResponse.Code != "0") throw new Exception($"åºåºä»»å¡{task.TaskNum}WMSåºåºä¸æ¥é误,ä¿¡æ¯:{wMSResponse.Msg}"); _unitOfWorkManage.BeginTran(); _locationInfoRepository.UpdateData(locationInfo); BaseDal.DeleteAndMoveIntoHty(task, App.User?.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); _unitOfWorkManage.CommitTran(); } else if(task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//å ¥åºä»»å¡é»è¾ else if(task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//å ¥åºä»»å¡å®æé»è¾ { //string? url = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.WMSInBoundBack.ToString())?.ApiAddress; //if (string.IsNullOrEmpty(url)) //{ // _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"æªæ¾å°WMSå ¥åºä¸æ¥æ¥å£,è¯·æ£æ¥æ¥å£é ç½®"); // UpdateTaskExceptionMessage(taskNum, $"æªæ¾å°WMSå ¥åºä¸æ¥æ¥å£,è¯·æ£æ¥æ¥å£é ç½®"); // return content.Error($"{taskNum},æªæ¾å°WMSå ¥åºä¸æ¥æ¥å£,è¯·æ£æ¥æ¥å£é ç½®"); //} //ContainerInFinishDTO containerInFinishDTO = new ContainerInFinishDTO() //{ // TaskCode= task.TaskNum.ToString(), // ContainerCode = task.PalletCode, // FromStationCode = task.SourceAddress, // ToLocationCode = task.TargetAddress //}; //string request = JsonConvert.SerializeObject(containerInFinishDTO, settings); ////è°ç¨æ¥å£ //string response = HttpHelper.Post(url, request); //WMSResponseContent wMSResponse = JsonConvert.DeserializeObject<WMSResponseContent>(response) ??throw new Exception($"{taskNum},æªæ¥æ¶å°WMSå ¥åºä¸æ¥è¿åå¼"); //if (wMSResponse.Code!="0") throw new Exception($"å ¥åºä»»å¡{task.TaskNum}WMSå ¥åºä¸æ¥é误,ä¿¡æ¯:{wMSResponse.Msg}"); string? url = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.WMSInOutBoundBack.ToString())?.ApiAddress; if (string.IsNullOrEmpty(url)) { _taskExecuteDetailService.AddTaskExecuteDetail(task, $"æªæ¾å°WMSå ¥åºä¸æ¥æ¥å£,è¯·æ£æ¥æ¥å£é ç½®"); UpdateTaskExceptionMessage(taskNum, $"æªæ¾å°WMSå ¥åºä¸æ¥æ¥å£,è¯·æ£æ¥æ¥å£é ç½®"); return content.Error($"{taskNum},æªæ¾å°WMSå ¥åºä¸æ¥æ¥å£,è¯·æ£æ¥æ¥å£é ç½®"); } ContainerInFinishDTO containerInFinishDTO = new ContainerInFinishDTO() { TaskCode = task.TaskNum.ToString(), ContainerCode = task.PalletCode, StationCode = task.SourceAddress, LocationCode = task.TargetAddress, CompleteType = 2 }; string request = JsonConvert.SerializeObject(containerInFinishDTO, settings); //è°ç¨æ¥å£ string response = HttpHelper.Post(url, request); WMSResponseContent wMSResponse = JsonConvert.DeserializeObject<WMSResponseContent>(response) ?? throw new Exception($"{taskNum},æªæ¥æ¶å°WMSå ¥åºä¸æ¥è¿åå¼"); if (wMSResponse.Code != "0") throw new Exception($"å ¥åºä»»å¡{task.TaskNum}WMSå ¥åºä¸æ¥é误,ä¿¡æ¯:{wMSResponse.Msg}"); Dt_LocationInfo locationInfo = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.TargetAddress); if (locationInfo.LocationStatus != LocationStatusEnum.Lock.ObjToInt()) { @@ -536,5 +558,88 @@ } return content; } /// <summary> /// äºææç§å¢ä¸å /// </summary> /// <param name="taskNum"></param> /// <returns></returns> public EPLightContent PickOrderInfoRequest(List<EPLightSendDTO> lightSendDTOs) { EPLightContent content = new EPLightContent(); try { string? url = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.PickOrderInfoRequest.ToString())?.ApiAddress; if (string.IsNullOrEmpty(url)) { return content.Error($"æªæ¾å°æç§å¢ä¸åæ¥å£,è¯·æ£æ¥æ¥å£é ç½®"); } string request = JsonConvert.SerializeObject(lightSendDTOs, settings); //è°ç¨æ¥å£ string response = HttpHelper.Post(url, request); EPLightContent lightContent = JsonConvert.DeserializeObject<EPLightContent>(response) ?? throw new Exception($"æªæ¥æ¶å°æç§å¢ä¸å䏿¥è¿åå¼"); if (lightContent.Result != "0") throw new Exception($"æç§å¢ä¸åé误,ä¿¡æ¯:{lightContent.Msg}"); content.OK("æå"); } catch (Exception ex) { content.Error(ex.Message); } return content; } /// <summary> /// äºææç§å¢åå§å /// </summary> /// <param name="taskNum"></param> /// <returns></returns> public EPLightContent INITIALIZATION() { EPLightContent content = new EPLightContent(); try { string? url = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.INITIALIZATION.ToString())?.ApiAddress; if (string.IsNullOrEmpty(url)) { return content.Error($"æªæ¾å°æç§å¢åå§åæ¥å£,è¯·æ£æ¥æ¥å£é ç½®"); } //è°ç¨æ¥å£ string response = Post(url); EPLightContent lightContent = JsonConvert.DeserializeObject<EPLightContent>(response) ?? throw new Exception($"æªæ¥æ¶å°æç§å¢åå§å䏿¥è¿åå¼"); if (lightContent.Result != "0") throw new Exception($"æç§å¢åå§åé误,ä¿¡æ¯:{lightContent.Msg}"); content.OK("æå"); } catch (Exception ex) { content.Error(ex.Message); } return content; } /// <summary> /// äºææç§å¢ç»æä½ä¸ /// </summary> /// <param name="taskNum"></param> /// <returns></returns> public EPLightContent ENDWORK() { EPLightContent content = new EPLightContent(); try { string? url = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.ENDWORK.ToString())?.ApiAddress; if (string.IsNullOrEmpty(url)) { return content.Error($"æªæ¾å°æç§å¢ç»æä½ä¸æ¥å£,è¯·æ£æ¥æ¥å£é ç½®"); } //è°ç¨æ¥å£ string response = Post(url); EPLightContent lightContent = JsonConvert.DeserializeObject<EPLightContent>(response) ?? throw new Exception($"æªæ¥æ¶å°æç§å¢ç»æä½ä¸ä¸æ¥è¿åå¼"); if (lightContent.Result != "0") throw new Exception($"æç§å¢ç»æä½ä¸é误,ä¿¡æ¯:{lightContent.Msg}"); content.OK("æå"); } catch (Exception ex) { content.Error(ex.Message); } return content; } } } ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_Tasks/AGV/AGVExtend.cs
@@ -22,8 +22,8 @@ { try { 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.CreateDate).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.CreateDate).ToList(); 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(); #region åºåºä»»å¡ä¸å if (newTasksOut.Count>0) { ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_Tasks/Ò»ÆÚÏßÌå/ConveyorLineJob1.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,85 @@ using Autofac.Core; using Microsoft.AspNetCore.Components.Routing; using Newtonsoft.Json; using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; using Quartz; using System; using System.Collections.Generic; using System.IdentityModel.Tokens.Jwt; using System.Linq; using System.Reflection.Metadata; using System.Text; using System.Threading.Tasks; using WIDESEAWCS_Common; using WIDESEAWCS_Common.Helper; using WIDESEAWCS_Common.TaskEnum; using WIDESEAWCS_Communicator; using WIDESEAWCS_Core; using WIDESEAWCS_Core.Helper; using WIDESEAWCS_IBasicInfoRepository; using WIDESEAWCS_ITaskInfoRepository; using WIDESEAWCS_ITaskInfoService; using WIDESEAWCS_Model.Models; using WIDESEAWCS_QuartzJob; using WIDESEAWCS_QuartzJob.ConveyorLine.Enum; using WIDESEAWCS_QuartzJob.DTO; using WIDESEAWCS_QuartzJob.Models; using WIDESEAWCS_QuartzJob.Repository; using WIDESEAWCS_QuartzJob.Service; using WIDESEAWCS_Tasks.DBNames; using ICacheService = WIDESEAWCS_Core.Caches.ICacheService; namespace WIDESEAWCS_Tasks { [DisallowConcurrentExecution] public class ConveyorLineJob1 : JobBase, IJob { private readonly ICacheService _cacheService; private readonly ITaskService _taskService; private readonly ITaskExecuteDetailService _taskExecuteDetailService; private readonly ITaskRepository _taskRepository; private readonly IStationMangerRepository _stationMangerRepository; private readonly IRouterRepository _routerRepository; private readonly IRouterService _routerService; private readonly IRouterExtension _routerExtension; public ConveyorLineJob1(ICacheService cacheService, ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IRouterService routerService, IRouterExtension routerExtension) { _cacheService = cacheService; _taskService = taskService; _taskExecuteDetailService = taskExecuteDetailService; _taskRepository = taskRepository; _stationMangerRepository = stationMangerRepository; _routerRepository = routerRepository; _routerService = routerService; _routerExtension = routerExtension; } public Task Execute(IJobExecutionContext context) { try { bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value); if (flag && value != null) { OtherDevice device = (OtherDevice)value; List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode); foreach (var item in stationMangers) { byte[] bytesPut = device.Communicator.Read("22", 1); ; device.Communicator.Write("22", new byte[] { 2, 0 }); byte[] bytesPuted = device.Communicator.Read("22",1); device.Communicator.Write("22", new byte[] { 0, 0 }); } } } catch (Exception ex) { WriteError(nameof(ConveyorLineJob1), ex.Message); } return Task.CompletedTask; } } } ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_Tasks/¶þÆÚÏßÌå/ConveyorLineJob2.cs
@@ -60,21 +60,22 @@ //䏿¥WMSæç®±å°è¾¾ if (PickBarCode.IsNotEmptyOrNull()) { //WebResponseContent content = _taskService.WMSPickUp(station.PickStationCode, PickBarCode); WebResponseContent content = WebResponseContent.Instance.OK(); WebResponseContent content = _taskService.WMSPickUp(station.PickStationCode, PickBarCode); //WebResponseContent content = WebResponseContent.Instance.OK(); if (content.Status) { //åå ¥æ£é确认 conveyorLine.SetValue(ConveyorLineDBName.W_PickToHode, (short)300, station.StationCode); WriteInfo(conveyorLine.DeviceCode, $"{station.PickStationCode}æ£éç³è¯·ä¸æ¥æå{PickBarCode}"); } else { WriteError(nameof(conveyorLine.DeviceCode), $"{station.PickStationCode}æ£éç³è¯·ä¸æ¥WMSé误ï¼ä¿¡æ¯{content.Message}"); WriteError(conveyorLine.DeviceCode, $"{station.PickStationCode}æ£éç³è¯·ä¸æ¥WMSé误{PickBarCode}ï¼ä¿¡æ¯{content.Message}"); } } else { WriteError(nameof(conveyorLine.DeviceCode), $"{station.PickStationCode}æ£éç³è¯·ä¸º{PickRequest}æ¡ç 为空å¼"); WriteError(conveyorLine.DeviceCode, $"{station.PickStationCode}æ£éç³è¯·ä¸º{PickRequest}æ¡ç 为空å¼"); } } @@ -97,15 +98,16 @@ { //åå ¥å ¥åºç¡®è®¤ conveyorLine.SetValue(ConveyorLineDBName.W_InResponse, true, station.StationCode); WriteInfo(conveyorLine.DeviceCode, $"ç«å°{station.StationCode}æç®±{InBarCode}ç³è¯·å ¥åºæå"); } else { WriteError(nameof(conveyorLine.DeviceCode), $"ç«å°{station.StationCode}æç®±{InBarCode}ç³è¯·å ¥åºä»»å¡é误ï¼ä¿¡æ¯{content.Message}"); WriteError(conveyorLine.DeviceCode, $"ç«å°{station.StationCode}æç®±{InBarCode}ç³è¯·å ¥åºä»»å¡é误ï¼ä¿¡æ¯{content.Message}"); } } else { WriteError(nameof(conveyorLine.DeviceCode), $"ç«å°{station.StationCode}å ¥åºç³è¯·ä¸º{InRequest}æ¡ç 为空å¼"); WriteError(conveyorLine.DeviceCode, $"ç«å°{station.StationCode}å ¥åºç³è¯·ä¸º{InRequest}æ¡ç 为空å¼"); } } } ÏîÄ¿×ÊÁÏ/Ò»ÆÚ¶Ô½ÓÏà¹Ø×ÊÁÏ/¹þ¶û±õÒ»ÆÚÊäËÍÏß¶Ô½ÓÐÒémodbusTcpÐÒéV1.1.xlsxBinary files differ
ÏîÄ¿×ÊÁÏ/Ò»ÆÚ¶Ô½ÓÏà¹Ø×ÊÁÏ/²¥ÖÖǽ±¨ÎÄ.docxBinary files differ
ÏîÄ¿×ÊÁÏ/½Ó¿Ú»ã×ÜÎļþ/EPLight Web API ½Ó¿ÚÎĵµ1.1.docxBinary files differ
ÏîÄ¿×ÊÁÏ/½Ó¿Ú»ã×ÜÎļþ/WMS½Ó¿Ú.docxBinary files differ
ÏîÄ¿×ÊÁÏ/½Ó¿Ú»ã×ÜÎļþ/WMS½Ó¿Ú¶Ô½ÓÎĵµ20251202_V1.1.3.docxBinary files differ