已删除8个文件
已修改28个文件
已添加8个文件
已重命名1个文件
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEAWCS_Common |
| | | { |
| | | public enum StationTypeEnum |
| | | { |
| | | StationType_OnlyInbound = 1, |
| | | StationType_OnlyOutbound = 2, |
| | | StationType_InboundAndOutbound = 3 |
| | | } |
| | | } |
| | |
| | | |
| | | public static TaskTypeGroup GetTaskTypeGroup(this int taskType) |
| | | { |
| | | if (!int.TryParse(Enum.Parse<TaskOutboundTypeEnum>(taskType.ToString()).ToString(), out int result)) |
| | | if (taskType >= 500 && taskType < 900) |
| | | { |
| | | return TaskTypeGroup.OutbondGroup; |
| | | } |
| | | else if (!int.TryParse(Enum.Parse<TaskInStatusEnum>(taskType.ToString()).ToString(), out result)) |
| | | else if (taskType >= 100 && taskType < 500) |
| | | { |
| | | return TaskTypeGroup.InboundGroup; |
| | | } |
| | | else if (!int.TryParse(Enum.Parse<TaskRelocationTypeEnum>(taskType.ToString()).ToString(), out result)) |
| | | else if (taskType >= 900 && taskType < 1000) |
| | | { |
| | | return TaskTypeGroup.RelocationGroup; |
| | | } |
| | | else if (!int.TryParse(Enum.Parse<TaskOtherTypeEnum>(taskType.ToString()).ToString(), out result)) |
| | | else |
| | | { |
| | | return TaskTypeGroup.OtherGroup; |
| | | } |
| | | else |
| | | { |
| | | throw new NotImplementedException(); |
| | | } |
| | | } |
| | | |
| | | public static int GetNextNotCompletedStatus<T>(this int currentStatus) where T : Enum |
| | | { |
| | | Type type = typeof(T); |
| | | if (type is null) throw new ArgumentNullException(); |
| | | if (!type.IsEnum) return 0; |
| | | if (type == typeof(TaskInStatusEnum)) |
| | | { |
| | | List<int> taskInboundTypes = type.GetEnumIndexList(); |
| | | return taskInboundTypes.Where(x => x > currentStatus && x < (int)TaskInStatusEnum.InFinish).OrderBy(x => x).FirstOrDefault(); |
| | | } |
| | | else if (type == typeof(TaskOutStatusEnum)) |
| | | { |
| | | return type.GetEnumIndexList().Where(x => x > currentStatus && x < (int)TaskOutStatusEnum.OutFinish).OrderBy(x => x).FirstOrDefault(); |
| | | } |
| | | else |
| | | { |
| | | throw new NotImplementedException(); |
| | | } |
| | | } |
| | | } |
| | |
| | | /// <summary> |
| | | /// å
¥åºä»»å¡ç¶æ |
| | | /// </summary> |
| | | public enum TaskInStatusEnum |
| | | { |
| | | /// <summary> |
| | | /// æ°å»ºå
¥åºä»»å¡ |
| | | /// </summary> |
| | | [Description("æ°å»º")] |
| | | InNew = 200, |
| | | |
| | | /// <summary> |
| | | /// å åæºå
¥åºå¾
æ§è¡ |
| | | /// </summary> |
| | | [Description("å åæºå
¥åºå¾
æ§è¡")] |
| | | SC_InExecute = 225, |
| | | |
| | | /// <summary> |
| | | /// å åæºå
¥åºæ§è¡ä¸ |
| | | /// </summary> |
| | | [Description("å åæºå
¥åºæ§è¡ä¸")] |
| | | SC_InExecuting = 230, |
| | | |
| | | /// <summary> |
| | | /// å åæºå
¥åºå®æ |
| | | /// </summary> |
| | | [Description("å åæºå
¥åºå®æ")] |
| | | SC_InFinish = 235, |
| | | |
| | | /// <summary> |
| | | /// å
¥åºä»»å¡å®æ |
| | | /// </summary> |
| | | [Description("å
¥åºä»»å¡å®æ")] |
| | | InFinish = 290, |
| | | |
| | | /// <summary> |
| | | /// å
¥åºä»»å¡æèµ· |
| | | /// </summary> |
| | | [Description("å
¥åºä»»å¡æèµ·")] |
| | | InPending = 297, |
| | | |
| | | /// <summary> |
| | | /// å
¥åºä»»å¡åæ¶ |
| | | /// </summary> |
| | | [Description("å
¥åºä»»å¡åæ¶")] |
| | | InCancel = 298, |
| | | |
| | | /// <summary> |
| | | /// å
¥åºä»»å¡å¼å¸¸ |
| | | /// </summary> |
| | | [Description("å
¥åºä»»å¡å¼å¸¸")] |
| | | InException = 299, |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åºåºä»»å¡ç¶æ |
| | | /// </summary> |
| | | public enum TaskOutStatusEnum |
| | | public enum TaskStatusEnum |
| | | { |
| | | /// <summary> |
| | | /// æ°å»ºä»»å¡ |
| | | /// </summary> |
| | | [Description("æ°å»º")] |
| | | OutNew = 100, |
| | | New = 100, |
| | | |
| | | /// <summary> |
| | | /// å åæºåºåºå¾
æ§è¡ |
| | | /// å åæºå¾
æ§è¡ |
| | | /// </summary> |
| | | [Description("å åæºåºåºå¾
æ§è¡")] |
| | | SC_OutExecute = 125, |
| | | [Description("å åæºå¾
æ§è¡")] |
| | | SC_Execute = 200, |
| | | |
| | | /// <summary> |
| | | /// å åæºåºåºæ§è¡ä¸ |
| | | /// å åæºæ§è¡ä¸ |
| | | /// </summary> |
| | | [Description("å åæºåºåºæ§è¡ä¸")] |
| | | SC_OutExecuting = 130, |
| | | [Description("å åæºæ§è¡ä¸")] |
| | | SC_Executing = 210, |
| | | |
| | | /// <summary> |
| | | /// å åæºåºåºå®æ |
| | | /// å åæºå®æ |
| | | /// </summary> |
| | | [Description("å åæºåºåºå®æ")] |
| | | SC_OutFinish = 135, |
| | | [Description("å åæºå®æ")] |
| | | SC_Finish = 220, |
| | | |
| | | /// <summary> |
| | | /// åºåºä»»å¡å®æ |
| | | /// AGVå¾
æ§è¡ |
| | | /// </summary> |
| | | [Description("åºåºä»»å¡å®æ")] |
| | | OutFinish = 190, |
| | | [Description("AGVå¾
æ§è¡")] |
| | | AGV_Execute = 300, |
| | | |
| | | /// <summary> |
| | | /// åºåºä»»å¡æèµ· |
| | | /// AGVæ§è¡ä¸ |
| | | /// </summary> |
| | | [Description("åºåºä»»å¡æèµ·")] |
| | | OutPending = 197, |
| | | [Description("AGVæ§è¡ä¸")] |
| | | AGV_Executing = 310, |
| | | |
| | | /// <summary> |
| | | /// åºåºä»»å¡åæ¶ |
| | | /// AGV宿 |
| | | /// </summary> |
| | | [Description("åºåºä»»å¡åæ¶")] |
| | | OutCancel = 198, |
| | | [Description("AGV宿")] |
| | | AGV_Finish = 320, |
| | | |
| | | /// <summary> |
| | | /// åºåºä»»å¡å¼å¸¸ |
| | | /// ä»»å¡å®æ |
| | | /// </summary> |
| | | [Description("åºåºä»»å¡å¼å¸¸")] |
| | | OutException = 199, |
| | | [Description("ä»»å¡å®æ")] |
| | | Finish = 900, |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡æèµ· |
| | | /// </summary> |
| | | [Description("ä»»å¡æèµ·")] |
| | | Pending = 970, |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡åæ¶ |
| | | /// </summary> |
| | | [Description("ä»»å¡åæ¶")] |
| | | Cancel = 980, |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å¼å¸¸ |
| | | /// </summary> |
| | | [Description("ä»»å¡å¼å¸¸")] |
| | | Exception = 990, |
| | | } |
| | | } |
| | |
| | | |
| | | namespace WIDESEAWCS_Common.TaskEnum |
| | | { |
| | | public enum TaskInboundTypeEnum |
| | | public enum TaskTypeEnum |
| | | { |
| | | /// <summary> |
| | | /// å
¥åº |
| | | /// 颿åºåº |
| | | /// </summary> |
| | | [Description("å
¥åº")] |
| | | Inbound = 200, |
| | | /// <summary> |
| | | /// çç¹å
¥åº |
| | | /// </summary> |
| | | [Description("çç¹å
¥åº")] |
| | | InInventory = 201, |
| | | /// <summary> |
| | | /// 忣å
¥åº |
| | | /// </summary> |
| | | [Description("忣å
¥åº")] |
| | | InPick = 202, |
| | | /// <summary> |
| | | /// è´¨æ£å
¥åº |
| | | /// </summary> |
| | | [Description("è´¨æ£å
¥åº")] |
| | | InQuality = 203 |
| | | } |
| | | |
| | | public enum TaskOutboundTypeEnum |
| | | { |
| | | /// <summary> |
| | | /// åºåº |
| | | /// </summary> |
| | | [Description("åºåº")] |
| | | [Description("颿åºåº")] |
| | | Outbound = 100, |
| | | /// <summary> |
| | | /// çç¹åºåº |
| | | /// </summary> |
| | | [Description("çç¹åºåº")] |
| | | OutInventory = 101, |
| | | OutInventory = 110, |
| | | /// <summary> |
| | | /// 忣åºåº |
| | | /// </summary> |
| | | [Description("忣åºåº")] |
| | | OutPick = 102, |
| | | OutPick = 120, |
| | | /// <summary> |
| | | /// è´¨æ£åºåº |
| | | /// </summary> |
| | | [Description("è´¨æ£åºåº")] |
| | | OutQuality = 103, |
| | | } |
| | | OutQuality = 130, |
| | | |
| | | public enum TaskRelocationTypeEnum |
| | | { |
| | | /// <summary> |
| | | /// åºå
ç§»åº |
| | | /// éè´å
¥åº |
| | | /// </summary> |
| | | [Description("åºå
ç§»åº")] |
| | | Relocation = 300, |
| | | [Description("éè´å
¥åº")] |
| | | Inbound = 510, |
| | | /// <summary> |
| | | /// åºå¤ç§»åº |
| | | /// çç¹å
¥åº |
| | | /// </summary> |
| | | [Description("åºå¤ç§»åº")] |
| | | RelocationIn = 301 |
| | | [Description("çç¹å
¥åº")] |
| | | InInventory = 520, |
| | | /// <summary> |
| | | /// 忣å
¥åº |
| | | /// </summary> |
| | | [Description("忣å
¥åº")] |
| | | InPick = 530, |
| | | /// <summary> |
| | | /// è´¨æ£å
¥åº |
| | | /// </summary> |
| | | [Description("è´¨æ£å
¥åº")] |
| | | InQuality = 540, |
| | | |
| | | /// <summary> |
| | | /// å··éå
ç§»åº |
| | | /// </summary> |
| | | [Description("å··éå
ç§»åº")] |
| | | Relocation = 900 |
| | | } |
| | | |
| | | public enum TaskOtherTypeEnum |
| | | { |
| | | |
| | | } |
| | | } |
| | |
| | | /// <returns></returns> |
| | | WebResponseContent RequestWMSTask(string palletCode, string sourceAddress); |
| | | |
| | | /// <summary> |
| | | /// åWMSç³è¯·åé
è´§ä½ |
| | | /// </summary> |
| | | /// <param name="taskNum">ä»»å¡å·</param> |
| | | /// <param name="roadwayNo">å··éå·</param> |
| | | /// <returns></returns> |
| | | string? RequestAssignLocation(int taskNum, string roadwayNo); |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¥å£ç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "æ¥å£ç¼å·")] |
| | | public string ApiCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¥å£åç§° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "æ¥å£åç§°")] |
| | | public string ApiName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¥å£å°å |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "æ¥å£å°å")] |
| | | [SugarColumn(IsNullable = false, Length = 200, ColumnDescription = "æ¥å£å°å")] |
| | | public string ApiAddress { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | |
| | | |
| | | <ItemGroup> |
| | | <PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" /> |
| | | <PackageReference Include="WIDESEAWCS_Core" Version="1.0.9" /> |
| | | <PackageReference Include="WIDESEAWCS_Core" Version="1.0.10" /> |
| | | </ItemGroup> |
| | | |
| | | <ItemGroup> |
| | |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_Tasks.é»çä»; |
| | | using WIDESEAWCS_Tasks; |
| | | |
| | | namespace WIDESEAWCS_Server.Controllers |
| | | { |
| | |
| | | { |
| | | List<object> data = new List<object>(); |
| | | |
| | | #region TaskInboundTypeEnum |
| | | #region TaskTypeEnum |
| | | { |
| | | Type type = typeof(TaskInboundTypeEnum); |
| | | List<int> enums = Enum.GetValues(typeof(TaskInboundTypeEnum)).Cast<int>().ToList(); |
| | | Type type = typeof(TaskTypeEnum); |
| | | List<int> enums = Enum.GetValues(typeof(TaskTypeEnum)).Cast<int>().ToList(); |
| | | int index = 0; |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(TaskInboundTypeEnum).GetField(((TaskInboundTypeEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | if (description != null) |
| | | { |
| | | data.Add(new { key = item.ToString(), value = description.Description }); |
| | | } |
| | | else |
| | | { |
| | | data.Add(new { key = item.ToString(), value = item.ToString() }); |
| | | } |
| | | index++; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region TaskOutboundTypeEnum |
| | | { |
| | | Type type = typeof(TaskOutboundTypeEnum); |
| | | List<int> enums = Enum.GetValues(typeof(TaskOutboundTypeEnum)).Cast<int>().ToList(); |
| | | int index = 0; |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(TaskOutboundTypeEnum).GetField(((TaskOutboundTypeEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | if (description != null) |
| | | { |
| | | data.Add(new { key = item.ToString(), value = description.Description }); |
| | | } |
| | | else |
| | | { |
| | | data.Add(new { key = item.ToString(), value = item.ToString() }); |
| | | } |
| | | index++; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region TaskRelocationTypeEnum |
| | | { |
| | | Type type = typeof(TaskRelocationTypeEnum); |
| | | List<int> enums = Enum.GetValues(typeof(TaskRelocationTypeEnum)).Cast<int>().ToList(); |
| | | int index = 0; |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(TaskRelocationTypeEnum).GetField(((TaskRelocationTypeEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | if (description != null) |
| | | { |
| | | data.Add(new { key = item.ToString(), value = description.Description }); |
| | | } |
| | | else |
| | | { |
| | | data.Add(new { key = item.ToString(), value = item.ToString() }); |
| | | } |
| | | index++; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region TaskOtherTypeEnum |
| | | { |
| | | Type type = typeof(TaskOtherTypeEnum); |
| | | List<int> enums = Enum.GetValues(typeof(TaskOtherTypeEnum)).Cast<int>().ToList(); |
| | | int index = 0; |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(TaskOtherTypeEnum).GetField(((TaskOtherTypeEnum)item).ToString()); |
| | | FieldInfo? fieldInfo = typeof(TaskTypeEnum).GetField(((TaskTypeEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | if (description != null) |
| | | { |
| | |
| | | |
| | | #region TaskInStatusEnum |
| | | { |
| | | Type type = typeof(TaskInStatusEnum); |
| | | List<int> enums = Enum.GetValues(typeof(TaskInStatusEnum)).Cast<int>().ToList(); |
| | | Type type = typeof(TaskStatusEnum); |
| | | List<int> enums = Enum.GetValues(typeof(TaskStatusEnum)).Cast<int>().ToList(); |
| | | int index = 0; |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(TaskInStatusEnum).GetField(((TaskInStatusEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | if (description != null) |
| | | { |
| | | data.Add(new { key = item.ToString(), value = description.Description }); |
| | | } |
| | | else |
| | | { |
| | | data.Add(new { key = item.ToString(), value = item.ToString() }); |
| | | } |
| | | index++; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region TaskOutStatusEnum |
| | | { |
| | | Type type = typeof(TaskOutStatusEnum); |
| | | List<int> enums = Enum.GetValues(typeof(TaskOutStatusEnum)).Cast<int>().ToList(); |
| | | int index = 0; |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(TaskOutStatusEnum).GetField(((TaskOutStatusEnum)item).ToString()); |
| | | FieldInfo? fieldInfo = typeof(TaskStatusEnum).GetField(((TaskStatusEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | if (description != null) |
| | | { |
| | |
| | | int taskNum = task.TaskNum; |
| | | int taskState = task.TaskState; |
| | | |
| | | if (!int.TryParse(Enum.Parse<TaskOutStatusEnum>(taskState.ToString()).ToString(), out int result)) |
| | | if(taskState > (int)TaskStatusEnum.Finish) |
| | | { |
| | | if ((int)(TaskOutStatusEnum)result > (int)TaskOutStatusEnum.OutFinish) |
| | | isNormal = false; |
| | | } |
| | | else if (!int.TryParse(Enum.Parse<TaskInStatusEnum>(taskState.ToString()).ToString(), out result)) |
| | | { |
| | | if ((int)(TaskInStatusEnum)result > (int)TaskInStatusEnum.InFinish) |
| | | isNormal = false; |
| | | } |
| | | Dt_TaskExecuteDetail taskExecuteDetail = new() |
| | |
| | | int taskNum = task.TaskNum; |
| | | int taskState = task.TaskState; |
| | | |
| | | if (!int.TryParse(Enum.Parse<TaskOutStatusEnum>(taskState.ToString()).ToString(), out int result)) |
| | | if (taskState > (int)TaskStatusEnum.Finish) |
| | | { |
| | | if ((int)(TaskOutStatusEnum)result > (int)TaskOutStatusEnum.OutFinish) |
| | | isNormal = false; |
| | | } |
| | | else if (!int.TryParse(Enum.Parse<TaskInStatusEnum>(taskState.ToString()).ToString(), out result)) |
| | | { |
| | | if ((int)(TaskInStatusEnum)result > (int)TaskInStatusEnum.InFinish) |
| | | isNormal = false; |
| | | } |
| | | Dt_TaskExecuteDetail taskExecuteDetail = new() |
| | |
| | | if (task != null) |
| | | { |
| | | |
| | | if (!int.TryParse(Enum.Parse<TaskOutboundTypeEnum>(task.TaskType.ToString()).ToString(), out int result)) |
| | | { |
| | | steps = Enum.GetValues(typeof(TaskOutStatusEnum)).Cast<int>().Where(x => x <= (int)TaskOutStatusEnum.OutFinish).ToList(); |
| | | //if (!int.TryParse(Enum.Parse<TaskOutboundTypeEnum>(task.TaskType.ToString()).ToString(), out int result)) |
| | | //{ |
| | | // steps = Enum.GetValues(typeof(TaskOutStatusEnum)).Cast<int>().Where(x => x <= (int)TaskOutStatusEnum.OutFinish).ToList(); |
| | | |
| | | foreach (var item in steps) |
| | | { |
| | | object obj; |
| | | FieldInfo? fieldInfo = typeof(TaskOutStatusEnum).GetField(((TaskOutStatusEnum)item).ToString()); |
| | | DescriptionAttribute? descriptionAttribute = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | if (descriptionAttribute != null) |
| | | { |
| | | obj = new { title = item, description = descriptionAttribute.Description }; |
| | | } |
| | | else |
| | | { |
| | | obj = new { title = item, description = ((TaskOutStatusEnum)item).ToString() }; |
| | | } |
| | | list.Add(obj); |
| | | } |
| | | } |
| | | else if (!int.TryParse(Enum.Parse<TaskInboundTypeEnum>(task.TaskType.ToString()).ToString(), out result)) |
| | | { |
| | | steps = Enum.GetValues(typeof(TaskInStatusEnum)).Cast<int>().Where(x => x <= (int)TaskInStatusEnum.InFinish).ToList(); |
| | | foreach (var item in steps) |
| | | { |
| | | object obj; |
| | | FieldInfo? fieldInfo = typeof(TaskInStatusEnum).GetField(((TaskInStatusEnum)item).ToString()); |
| | | DescriptionAttribute? descriptionAttribute = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | if (descriptionAttribute != null) |
| | | { |
| | | obj = new { title = item, description = descriptionAttribute.Description }; |
| | | } |
| | | else |
| | | { |
| | | obj = new { title = item, description = ((TaskInStatusEnum)item).ToString() }; |
| | | } |
| | | list.Add(obj); |
| | | } |
| | | } |
| | | else if (!int.TryParse(Enum.Parse<TaskRelocationTypeEnum>(task.TaskType.ToString()).ToString(), out result)) |
| | | { |
| | | //todo è°ç¨WMSç§»åºå®æ |
| | | } |
| | | else if (!int.TryParse(Enum.Parse<TaskOtherTypeEnum>(task.TaskType.ToString()).ToString(), out result)) |
| | | { |
| | | // foreach (var item in steps) |
| | | // { |
| | | // object obj; |
| | | // FieldInfo? fieldInfo = typeof(TaskOutStatusEnum).GetField(((TaskOutStatusEnum)item).ToString()); |
| | | // DescriptionAttribute? descriptionAttribute = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | // if (descriptionAttribute != null) |
| | | // { |
| | | // obj = new { title = item, description = descriptionAttribute.Description }; |
| | | // } |
| | | // else |
| | | // { |
| | | // obj = new { title = item, description = ((TaskOutStatusEnum)item).ToString() }; |
| | | // } |
| | | // list.Add(obj); |
| | | // } |
| | | //} |
| | | //else if (!int.TryParse(Enum.Parse<TaskTypeEnum>(task.TaskType.ToString()).ToString(), out result)) |
| | | //{ |
| | | // steps = Enum.GetValues(typeof(TaskInStatusEnum)).Cast<int>().Where(x => x <= (int)TaskInStatusEnum.InFinish).ToList(); |
| | | // foreach (var item in steps) |
| | | // { |
| | | // object obj; |
| | | // FieldInfo? fieldInfo = typeof(TaskInStatusEnum).GetField(((TaskInStatusEnum)item).ToString()); |
| | | // DescriptionAttribute? descriptionAttribute = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | // if (descriptionAttribute != null) |
| | | // { |
| | | // obj = new { title = item, description = descriptionAttribute.Description }; |
| | | // } |
| | | // else |
| | | // { |
| | | // obj = new { title = item, description = ((TaskInStatusEnum)item).ToString() }; |
| | | // } |
| | | // list.Add(obj); |
| | | // } |
| | | //} |
| | | //else if (!int.TryParse(Enum.Parse<TaskRelocationTypeEnum>(task.TaskType.ToString()).ToString(), out result)) |
| | | //{ |
| | | // //todo è°ç¨WMSç§»åºå®æ |
| | | //} |
| | | //else if (!int.TryParse(Enum.Parse<TaskOtherTypeEnum>(task.TaskType.ToString()).ToString(), out result)) |
| | | //{ |
| | | |
| | | } |
| | | else |
| | | { |
| | | throw new Exception($"ä»»å¡ç±»åé误,æªæ¾å°è¯¥ä»»å¡ç±»å,ä»»å¡å·:ã{taskNum}ã,ä»»å¡ç±»å:ã{task.TaskType}ã"); |
| | | } |
| | | //} |
| | | //else |
| | | //{ |
| | | // throw new Exception($"ä»»å¡ç±»åé误,æªæ¾å°è¯¥ä»»å¡ç±»å,ä»»å¡å·:ã{taskNum}ã,ä»»å¡ç±»å:ã{task.TaskType}ã"); |
| | | //} |
| | | active = steps.IndexOf(task.TaskState) + 1; |
| | | |
| | | } |
| | |
| | | using WIDESEAWCS_Core.Enums; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_DTO.TaskInfo; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | | private readonly ITaskExecuteDetailRepository _taskExecuteDetailRepository; |
| | | private readonly IMapper _mapper; |
| | | private readonly IStationMangerRepository _stationMangerRepository; |
| | | |
| | | private Dictionary<string, OrderByType> _taskOrderBy = new() |
| | | { |
| | |
| | | |
| | | public Dictionary<string, OrderByType> TaskOrderBy { get { return _taskOrderBy; } set { _taskOrderBy = value; } } |
| | | |
| | | public List<int> TaskInboundTypes => typeof(TaskInboundTypeEnum).GetEnumIndexList(); |
| | | public List<int> TaskInboundTypes => typeof(TaskTypeEnum).GetEnumIndexList().Where(x => x >= 100 && x < 500).ToList(); |
| | | |
| | | public List<int> TaskOutboundTypes => typeof(TaskOutboundTypeEnum).GetEnumIndexList(); |
| | | public List<int> TaskOutboundTypes => typeof(TaskTypeEnum).GetEnumIndexList().Where(x => x >= 500 && x < 900).ToList(); |
| | | |
| | | public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper) : base(BaseDal) |
| | | public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper, IStationMangerRepository stationMangerRepository) : base(BaseDal) |
| | | { |
| | | _routerService = routerService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | | _taskExecuteDetailRepository = taskExecuteDetailRepository; |
| | | _mapper = mapper; |
| | | _stationMangerRepository = stationMangerRepository; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | foreach (var item in taskDTOs) |
| | | { |
| | | |
| | | if (BaseDal.QueryFirst(x => x.TaskNum == item.TaskNum || x.PalletCode == item.PalletCode) != null) |
| | | { |
| | | continue; |
| | | } |
| | | Dt_Task task = _mapper.Map<Dt_Task>(item); |
| | | task.Creater = "WMS"; |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | task.TaskState = (int)TaskOutStatusEnum.OutNew; |
| | | task.TaskState = (int)TaskStatusEnum.New; |
| | | task.CurrentAddress = item.SourceAddress; |
| | | task.NextAddress = item.TargetAddress; |
| | | |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | | task.TaskState = (int)TaskInStatusEnum.InNew; task.CurrentAddress = item.SourceAddress; |
| | | task.NextAddress = item.TargetAddress; |
| | | } |
| | | tasks.Add(task); |
| | | } |
| | | BaseDal.AddData(tasks); |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | WMSTaskDTO taskDTO = new WMSTaskDTO() |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationDeviceCode == sourceAddress); |
| | | if (stationManger == null) |
| | | { |
| | | TaskNum = Convert.ToInt32(DateTime.Now.ToString("HHmmss")), |
| | | Grade = 1, |
| | | PalletCode = palletCode, |
| | | RoadWay = "SC01", |
| | | SourceAddress = sourceAddress, |
| | | TargetAddress = "SC01", |
| | | TaskStatus = (int)TaskInStatusEnum.InNew, |
| | | Id = 0, |
| | | TaskType = (int)TaskInboundTypeEnum.Inbound |
| | | }; |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ç«å°ä¿¡æ¯"); |
| | | } |
| | | |
| | | HttpHelper.Post($"RequestInboundTask?palletCode={palletCode}&stationCode={sourceAddress}"); |
| | | |
| | | WMSTaskDTO taskDTO = new WMSTaskDTO(); |
| | | |
| | | content = ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); |
| | | } |
| | |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åWMSç³è¯·åé
è´§ä½ |
| | | /// </summary> |
| | | /// <param name="taskNum">ä»»å¡å·</param> |
| | | /// <param name="roadwayNo">å··éå·</param> |
| | | /// <returns></returns> |
| | | public string? RequestAssignLocation(int taskNum, string roadwayNo) |
| | | { |
| | | string responseStr = HttpHelper.Get($"http://127.0.0.1:9293/api/Task/AssignInboundTaskLocation?taskNum={taskNum}&roadwayNo={roadwayNo}"); |
| | |
| | | public Dt_Task? QuertStackerCraneTask(string deviceNo, TaskTypeGroup? taskTypeGroup = null) |
| | | { |
| | | if (taskTypeGroup == null) |
| | | return BaseDal.QueryFirst(x => x.Roadway == deviceNo && (TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.SC_InExecute || TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.OutNew), TaskOrderBy); |
| | | return BaseDal.QueryFirst(x => x.DeviceCode == deviceNo && x.TaskState == (int)TaskStatusEnum.New, TaskOrderBy); |
| | | if (taskTypeGroup.Value == TaskTypeGroup.InboundGroup) |
| | | return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.SC_InExecute, TaskOrderBy); |
| | | return BaseDal.QueryFirst(x => x.DeviceCode == deviceNo && TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskStatusEnum.SC_Execute, TaskOrderBy); |
| | | if (taskTypeGroup.Value == TaskTypeGroup.OutbondGroup) |
| | | return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.SC_OutExecute, TaskOrderBy); |
| | | return BaseDal.QueryFirst(x => x.DeviceCode == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskStatusEnum.SC_Execute, TaskOrderBy); |
| | | return null; |
| | | } |
| | | |
| | |
| | | public Dt_Task QueryStackerCraneTask(string deviceNo, string currentAddress = "") |
| | | { |
| | | if (string.IsNullOrEmpty(currentAddress)) |
| | | return BaseDal.QueryFirst(x => x.Roadway == deviceNo && (TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.SC_InExecute || TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.OutNew), TaskOrderBy); |
| | | return BaseDal.QueryFirst(x => x.DeviceCode == deviceNo && x.TaskState == (int)TaskStatusEnum.New, TaskOrderBy); |
| | | else |
| | | return BaseDal.QueryFirst(x => x.Roadway == deviceNo && x.CurrentAddress == currentAddress && (TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.SC_InExecute || TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.SC_OutExecute), TaskOrderBy); |
| | | return BaseDal.QueryFirst(x => x.DeviceCode == deviceNo && x.CurrentAddress == currentAddress && x.TaskState == (int)TaskStatusEnum.SC_Execute, TaskOrderBy); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | public Dt_Task QueryStackerCraneInTask(string deviceNo, string currentAddress = "") |
| | | { |
| | | if (string.IsNullOrEmpty(currentAddress)) |
| | | return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.SC_InExecute, TaskOrderBy); |
| | | return BaseDal.QueryFirst(x => x.DeviceCode == deviceNo && TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskStatusEnum.SC_Execute, TaskOrderBy); |
| | | else |
| | | return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.SC_InExecute && x.CurrentAddress == currentAddress, TaskOrderBy); |
| | | return BaseDal.QueryFirst(x => x.DeviceCode == deviceNo && TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskStatusEnum.SC_Execute && x.CurrentAddress == currentAddress, TaskOrderBy); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | public Dt_Task QueryStackerCraneOutTask(string deviceNo, string currentAddress = "") |
| | | { |
| | | if (string.IsNullOrEmpty(currentAddress)) |
| | | return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.SC_OutExecute, TaskOrderBy); |
| | | return BaseDal.QueryFirst(x => x.DeviceCode == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskStatusEnum.SC_Execute, TaskOrderBy); |
| | | else |
| | | return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.SC_OutExecute && x.CurrentAddress == currentAddress, TaskOrderBy); |
| | | return BaseDal.QueryFirst(x => x.DeviceCode == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskStatusEnum.SC_Execute && x.CurrentAddress == currentAddress, TaskOrderBy); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns>è¿åä»»å¡å®ä½å¯¹è±¡éåï¼å¯è½ä¸ºnull</returns> |
| | | public List<Dt_Task> QueryStackerCraneOutTasks(string deviceNo, List<string> outStationCodes) |
| | | { |
| | | return BaseDal.QueryData(x => x.Roadway == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.SC_OutExecute && outStationCodes.Contains(x.CurrentAddress), TaskOrderBy); |
| | | return BaseDal.QueryData(x => x.DeviceCode == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskStatusEnum.SC_Execute && outStationCodes.Contains(x.CurrentAddress), TaskOrderBy); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°ä»»å¡å¼å¸¸ä¿¡æ¯æ¾ç¤º |
| | | /// </summary> |
| | | /// <param name="taskNum">ä»»å¡å·</param> |
| | | /// <param name="message">å¼å¸¸ä¿¡æ¯</param> |
| | | public WebResponseContent UpdateTaskExceptionMessage(int taskNum, string message) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | |
| | | { |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); |
| | | if (task == null) return WebResponseContent.Instance.Error($"æªæ¾å°è¯¥ä»»å¡ä¿¡æ¯,ä»»å¡å·:ã{taskNum}ã"); |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | task.TaskState = (int)TaskOutStatusEnum.OutPending; |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | | task.TaskState = (int)TaskInStatusEnum.InPending; |
| | | } |
| | | task.TaskState = (int)TaskStatusEnum.Pending; |
| | | task.ExceptionMessage = message; |
| | | task.ModifyDate = DateTime.Now; |
| | | BaseDal.UpdateData(task); |
| | |
| | | { |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); |
| | | if (task == null) return WebResponseContent.Instance.Error($"æªæ¾å°è¯¥ä»»å¡ä¿¡æ¯,ä»»å¡å·:ã{taskNum}ã"); |
| | | if (task.TaskState != (int)TaskInStatusEnum.InPending && task.TaskState != (int)TaskOutStatusEnum.OutPending) |
| | | if (task.TaskState != (int)TaskStatusEnum.Pending) |
| | | { |
| | | return content = WebResponseContent.Instance.Error($"该任å¡ç¶æä¸å¯æ¢å¤,ä»»å¡å·:ã{taskNum}ã,ä»»å¡ç¶æ:ã{task.TaskState}ã"); |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | task.TaskState = (int)TaskOutStatusEnum.OutNew; |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | | task.TaskState = (int)TaskInStatusEnum.InNew; |
| | | } |
| | | //todo |
| | | task.TaskState = (int)TaskStatusEnum.New; |
| | | } |
| | | |
| | | task.ExceptionMessage = string.Empty; |
ÎļþÃû´Ó ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/×躸²Ö/GroundStationDBName.cs ÐÞ¸Ä |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEAWCS_Tasks.é»çä» |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | public enum GroundStationDBName |
| | | { |
| | |
| | | /// <returns>妿æªè¢«å ç¨ï¼è¿åä¼ å
¥çä»»å¡ä¿¡æ¯ï¼å¦åï¼è¿ånull</returns> |
| | | private Dt_Task? OutTaskStationIsOccupied([NotNull] Dt_Task task) |
| | | { |
| | | Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.TargetAddress && x.StackerCraneCode == task.Roadway); |
| | | Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.TargetAddress && x.StackerCraneCode == task.DeviceCode); |
| | | if (stationManger != null) |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | |
| | | /// <returns>妿æªè¢«å ç¨ï¼è¿åä¼ å
¥çä»»å¡ä¿¡æ¯ï¼å¦åï¼è¿ånull</returns> |
| | | private Dt_Task? OutTaskStationIsOccupied([NotNull] Dt_Task task) |
| | | { |
| | | Dt_Router? router = _routerService.QueryNextRoutes(task.Roadway, task.NextAddress).FirstOrDefault(); |
| | | Dt_Router? router = _routerService.QueryNextRoutes(task.DeviceCode, task.NextAddress).FirstOrDefault(); |
| | | if (router != null) |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == router.ChildPosiDeviceCode); |
| | | if (device != null) |
| | | { |
| | | if (device.DeviceCode == "YMCTSJ" || task.Roadway == "CSJCSC01") return task; |
| | | if (device.DeviceCode == "YMCTSJ" || task.DeviceCode == "CSJCSC01") return task; |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)device; |
| | | if (conveyorLine.IsOccupied(router.ChildPosi))//åºåºç«å°æªè¢«å ç¨ |
| | | { |
| | |
| | | using WIDESEAWCS_QuartzJob.StackerCrane.Enum; |
| | | using WIDESEAWCS_Tasks.HoisterJob; |
| | | using WIDESEAWCS_Tasks.StackerCraneJob; |
| | | using WIDESEAWCS_Tasks.é»çä»; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | |
| | | /// <returns>妿æªè¢«å ç¨ï¼è¿åä¼ å
¥çä»»å¡ä¿¡æ¯ï¼å¦åï¼è¿ånull</returns> |
| | | private Dt_Task? OutTaskStationIsOccupied([NotNull] Dt_Task task) |
| | | { |
| | | Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.TargetAddress && x.StackerCraneCode == task.Roadway); |
| | | Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.TargetAddress && x.StackerCraneCode == task.DeviceCode); |
| | | if (stationManger != null) |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | |
| | | /// <returns>妿æªè¢«å ç¨ï¼è¿åä¼ å
¥çä»»å¡ä¿¡æ¯ï¼å¦åï¼è¿ånull</returns> |
| | | private Dt_Task? OutTaskStationIsOccupied([NotNull] Dt_Task task) |
| | | { |
| | | Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.TargetAddress && x.StackerCraneCode == task.Roadway); |
| | | Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.TargetAddress && x.StackerCraneCode == task.DeviceCode); |
| | | if (stationManger != null) |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | |
| | | |
| | | if (leisure && tray && !requestIn && !inbounding && !requestOut && !outbounding) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskState == TaskInStatusEnum.InNew.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && x.SourceAddress == deviceChildCode); |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && x.SourceAddress == deviceChildCode && _taskService.TaskInboundTypes.Contains(x.TaskType)); |
| | | if (task != null) |
| | | { |
| | | bool isWrite = hoister.SetValue(HoisterDBName.RequestIn, true, deviceChildCode); |
| | |
| | | } |
| | | else if (!leisure && tray && requestIn && inbounding && !requestOut && !outbounding) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskState == TaskInStatusEnum.InNew.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && x.SourceAddress == deviceChildCode); |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && x.SourceAddress == deviceChildCode && _taskService.TaskInboundTypes.Contains(x.TaskType)); |
| | | if (task != null) |
| | | { |
| | | Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationDeviceCode == deviceChildCode); |
| | |
| | | |
| | | task.TargetAddress = locationCode; |
| | | task.NextAddress = locationCode; |
| | | task.Roadway = stationManger.StackerCraneCode; |
| | | task.TaskState = TaskInStatusEnum.SC_InExecute.ObjToInt(); |
| | | task.DeviceCode = stationManger.StackerCraneCode; |
| | | task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); |
| | | _taskRepository.UpdateData(task); |
| | | |
| | | bool isWrite = hoister.SetValue(HoisterDBName.RequestIn, false, deviceChildCode); |
| | |
| | | } |
| | | else if (leisure && !tray && !requestIn && !inbounding && !requestOut && !outbounding) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskState == TaskOutStatusEnum.OutNew.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress)); |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && _taskService.TaskOutboundTypes.Contains(x.TaskType)); |
| | | if (task != null) |
| | | { |
| | | bool isWrite = hoister.SetValue(HoisterDBName.RequestOut, true, deviceChildCode); |
| | |
| | | } |
| | | else if (!leisure && !tray && !requestIn && !inbounding && requestOut && outbounding) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskState == TaskInStatusEnum.InNew.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && x.SourceAddress == deviceChildCode); |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && _taskService.TaskOutboundTypes.Contains(x.TaskType)); |
| | | if (task != null) |
| | | { |
| | | Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationDeviceCode == deviceChildCode); |
| | |
| | | |
| | | task.TargetAddress = deviceChildCode; |
| | | task.NextAddress = deviceChildCode; |
| | | task.Roadway = stationManger.StackerCraneCode; |
| | | task.TaskState = TaskInStatusEnum.SC_InExecute.ObjToInt(); |
| | | task.DeviceCode = stationManger.StackerCraneCode; |
| | | task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); |
| | | _taskRepository.UpdateData(task); |
| | | |
| | | bool isWrite = hoister.SetValue(HoisterDBName.RequestIn, false, deviceChildCode); |
| | |
| | | WriteInfo(hoister.DeviceName, $"æªæ¾å°å¯¹åºç«å°ä¿¡æ¯,{deviceChildCode}"); |
| | | } |
| | | } |
| | | |
| | | |
| | | //if (tray && leisure) |
| | | //{ |
| | | //#region æ¥è¯¢ç»çä¿¡æ¯ |
| | | //åWMSç³è¯·æ¥è¯¢å½åæåæºå£çç»çä¿¡æ¯ï¼åå¨ç»çä¿¡æ¯è¿åå
¥åºä»»å¡å¹¶ååºå
¥åºç³è¯· |
| | | //var task = _taskService.QueryExecutingConveyorLineTask(1, deviceChildCode); |
| | | //if (Leisure && task != null) |
| | | // Hoister.SetValue(HoisterDBName.RequestIn, true, deviceChildCode); |
| | | |
| | | //#endregion |
| | | //var Inbounding = Hoister.GetValue<HoisterDBName, bool>(HoisterDBName.Inbounding, deviceChildCode); |
| | | //if (Inbounding && task != null) |
| | | //{ |
| | | // task.TaskState = (int)TaskInStatusEnum.SC_InExecute; |
| | | // task.NextAddress = "001-003-001"; |
| | | // _taskService.UpdateData(task); |
| | | // //æ´æ°ä»»å¡ç¶æå¹¶åæ¶å
¥åºç³è¯· |
| | | // Hoister.SetValue(HoisterDBName.RequestIn, false, deviceChildCode); |
| | | //} |
| | | //} |
| | | //else |
| | | //{ |
| | | |
| | | |
| | | //æ¥è¯¢åºåºä»»å¡,åå¨åºåºä»»å¡ååºåºåºç³è¯· |
| | | //var task = _taskService.QueryExecutingConveyorLineTask(2, deviceChildCode); |
| | | //if (task != null && Leisure) |
| | | // Hoister.SetValue(HoisterDBName.RequestOut, true, deviceChildCode); |
| | | //var Outbounding = Hoister.GetValue<HoisterDBName, bool>(HoisterDBName.Outbounding, deviceChildCode); |
| | | //if (Outbounding && task != null) |
| | | //{ |
| | | // task.NextAddress = deviceChildCode; |
| | | // task.TargetAddress = deviceChildCode; |
| | | // task.TaskState = (int)TaskOutStatusEnum.OutNew; |
| | | // _taskService.UpdateData(task); |
| | | // //æ´æ°ä»»å¡ç¶æå¹¶åæ¶åºåºç³è¯· |
| | | // Hoister.SetValue(HoisterDBName.RequestOut, false, deviceChildCode); |
| | | //} |
| | | //} |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | using WIDESEAWCS_QuartzJob.StackerCrane.Enum; |
| | | using WIDESEAWCS_Tasks.HoisterJob; |
| | | using WIDESEAWCS_Tasks.StackerCraneJob; |
| | | using WIDESEAWCS_Tasks.é»çä»; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | | { |
| | | CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | try |
| | | { |
| | | CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | if (commonStackerCrane != null) |
| | | { |
| | | if (!commonStackerCrane.IsEventSubscribed) |
| | | { |
| | | commonStackerCrane.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//订é
ä»»å¡å®æäºä»¶ |
| | | } |
| | | |
| | | if (commonStackerCrane.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && commonStackerCrane.StackerCraneStatusValue == StackerCraneStatus.Normal) |
| | | { |
| | | commonStackerCrane.CheckStackerCraneTaskCompleted();//鲿¢ä»»å¡å®æäºä»¶çæµè¶
æ¶ï¼åæå¨è§¦å䏿¬¡ |
| | | |
| | | if (commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby) |
| | | if (commonStackerCrane.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && commonStackerCrane.StackerCraneStatusValue == StackerCraneStatus.Normal && commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby) |
| | | { |
| | | Dt_Task? task = GetTask(commonStackerCrane); |
| | | if (task != null) |
| | |
| | | { |
| | | commonStackerCrane.LastTaskType = task.TaskType; |
| | | int oldState = task.TaskState; |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | | task.TaskState = TaskInStatusEnum.SC_InExecuting.ObjToInt(); |
| | | } |
| | | else |
| | | { |
| | | task.TaskState = TaskOutStatusEnum.SC_OutExecuting.ObjToInt(); |
| | | } |
| | | task.TaskState = TaskStatusEnum.SC_Executing.ObjToInt(); |
| | | _taskRepository.UpdateData(task); |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"ç³»ç»èªå¨æµç¨ï¼ä»»å¡ç¶æä»ã{oldState}ã转å°ã{task.TaskState}ã"); |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteError(nameof(CommonStackerCraneJob), ex.Message, ex); |
| | | WriteError(commonStackerCrane.DeviceName, ex.Message, ex); |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
| | |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == e.TaskNum); |
| | | if (task != null) |
| | | { |
| | | |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(e.TaskNum, $"ç³»ç»èªå¨æµç¨,ä»»å¡å®æ"); |
| | | _taskRepository.DeleteAndMoveIntoHty(task, OperateTypeEnum.èªå¨å®æ); |
| | | HttpHelper.Post("", "");//todo è°ç¨WMSä»»å¡å®ææ¹æ³ |
| | | } |
| | | else |
| | | { |
| | |
| | | /// <returns>妿æªè¢«å ç¨ï¼è¿åä¼ å
¥çä»»å¡ä¿¡æ¯ï¼å¦åï¼è¿ånull</returns> |
| | | private Dt_Task? OutTaskStationIsOccupied([NotNull] Dt_Task task) |
| | | { |
| | | Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.TargetAddress && x.StackerCraneCode == task.Roadway); |
| | | Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.TargetAddress && x.StackerCraneCode == task.DeviceCode); |
| | | if (stationManger != null) |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | |
| | | stackerCraneTaskCommand.TrayType = 1; |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//夿æ¯å¦æ¯å
¥åºä»»å¡ |
| | | { |
| | | //List<Dt_Router> routers = _routerService.QueryNextRoutes(task.CurrentAddress, task.Roadway); |
| | | //if (routers.Count > 0) |
| | | //{ |
| | | string[] startCodes = task.CurrentAddress.Split("-"); |
| | | |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(startCodes[0]); |
| | |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"å
¥åºä»»å¡ç»ç¹é误ï¼èµ·ç¹ï¼ã{task.NextAddress}ã"); |
| | | return null; |
| | | } |
| | | //} |
| | | //else |
| | | //{ |
| | | // _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°ç«å°ã{task.NextAddress}ãä¿¡æ¯ï¼æ æ³è·å对åºçå åæºåè´§ç«å°ä¿¡æ¯"); |
| | | // return null; |
| | | //} |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | //List<Dt_Router> routers = _routerService.QueryNextRoutes(task.Roadway, task.TargetAddress); |
| | | //if (routers.Count > 0) |
| | | { |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | |
| | |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"åºåºä»»å¡èµ·ç¹é误ï¼èµ·ç¹ï¼ã{task.CurrentAddress}ã"); |
| | | return null; |
| | | } |
| | | } |
| | | //else |
| | | //{ |
| | | // _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°ç«å°ã{task.NextAddress}ãä¿¡æ¯ï¼æ æ³è·å对åºçå åæºæ¾è´§ç«å°ä¿¡æ¯"); |
| | | // return null; |
| | | //} |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) |
| | | { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Quartz; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | /// <summary> |
| | | /// æµè¯æ¶ä»å°é¢ç« |
| | | /// </summary> |
| | | [DisallowConcurrentExecution] |
| | | public class GroundStationJob_CSJ : JobBase, IJob |
| | | { |
| | | private readonly ITaskService _taskService; |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | | private readonly ITaskRepository _taskRepository; |
| | | private readonly IStationMangerRepository _stationMangerRepository; |
| | | |
| | | public GroundStationJob_CSJ(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository) |
| | | { |
| | | _taskService = taskService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | | _taskRepository = taskRepository; |
| | | _stationMangerRepository = stationMangerRepository; |
| | | } |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | | { |
| | | OtherDevice device = (OtherDevice)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | try |
| | | { |
| | | if (device == null) |
| | | { |
| | | WriteInfo(nameof(GroundStationJob_CSJ), "è°åº¦é误,设å¤å¯¹è±¡ä¼ å¼ä¸ºnull"); |
| | | return Task.CompletedTask; |
| | | } |
| | | |
| | | List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode); |
| | | foreach (var item in stationMangers) |
| | | { |
| | | bool isCanPut = device.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanPut, item.StationCode); |
| | | bool isCanTake = device.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanTake, item.StationCode); |
| | | bool putRequest = device.GetValue<GroundStationDBName, bool>(GroundStationDBName.W_PutRequest, item.StationCode); |
| | | bool putFinish = device.GetValue<GroundStationDBName, bool>(GroundStationDBName.W_PutFinish, item.StationCode); |
| | | bool takeRequest = device.GetValue<GroundStationDBName, bool>(GroundStationDBName.W_TakeRequest, item.StationCode); |
| | | bool takeFinish = device.GetValue<GroundStationDBName, bool>(GroundStationDBName.W_TakeFinish, item.StationCode); |
| | | |
| | | if (item.StationType == StationTypeEnum.StationType_OnlyOutbound.ObjToInt()) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.DeviceCode == item.StackerCraneCode && x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.NextAddress)); |
| | | if (task != null && isCanPut && !isCanTake && !putRequest && !putFinish && !takeRequest && !takeFinish) |
| | | { |
| | | string oldAddress = task.NextAddress; |
| | | int oldStatus = task.TaskState; |
| | | task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); |
| | | task.NextAddress = item.StationCode; |
| | | _taskRepository.UpdateData(task); |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"ç³»ç»èªå¨æµç¨,ç®æ å°åç±{oldAddress}åæ´ä¸º{task.NextAddress},ä»»å¡ç¶æç±{oldStatus}åæ´ä¸º{task.TaskState}"); |
| | | } |
| | | } |
| | | else if (item.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt()) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TargetAddress == item.StackerCraneCode && x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.NextAddress)); |
| | | if (task != null && isCanPut && !isCanTake && !putRequest && !putFinish && !takeRequest && !takeFinish) |
| | | { |
| | | string oldAddress = task.NextAddress; |
| | | int oldStatus = task.TaskState; |
| | | task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); |
| | | task.NextAddress = item.StationCode; |
| | | _taskRepository.UpdateData(task); |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"ç³»ç»èªå¨æµç¨,ç®æ å°åç±{oldAddress}åæ´ä¸º{task.NextAddress},ä»»å¡ç¶æç±{oldStatus}åæ´ä¸º{task.TaskState}"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteError(device.DeviceName, "", ex); |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
| | | } |
| | | } |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Enums; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | |
| | | using WIDESEAWCS_QuartzJob.StackerCrane.Enum; |
| | | using WIDESEAWCS_Tasks.HoisterJob; |
| | | using WIDESEAWCS_Tasks.StackerCraneJob; |
| | | using WIDESEAWCS_Tasks.é»çä»; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | |
| | | if (sendFlag) |
| | | { |
| | | commonStackerCrane.LastTaskType = task.TaskType; |
| | | // _taskService.UpdateTaskStatusToNext(task.TaskNum); |
| | | int oldState = task.TaskState; |
| | | task.TaskState = TaskStatusEnum.SC_Executing.ObjToInt(); |
| | | _taskRepository.UpdateData(task); |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"ç³»ç»èªå¨æµç¨ï¼ä»»å¡ç¶æä»ã{oldState}ã转å°ã{task.TaskState}ã"); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5) |
| | | { |
| | | Console.Out.WriteLine("TaskCompleted" + e.TaskNum); |
| | | // _taskService.StackCraneTaskCompleted(e.TaskNum); |
| | | StackerCraneTaskCompleted(e.TaskNum, commonStackerCrane.DeviceName); |
| | | commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent StackerCraneTaskCompleted(int taskNum, string deviceName) |
| | | { |
| | | try |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == taskNum); |
| | | if (task != null) |
| | | { |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | int oldStatus = task.TaskState; |
| | | task.DeviceCode = "AGV"; |
| | | task.TaskState = TaskStatusEnum.AGV_Execute.ObjToInt(); |
| | | task.CurrentAddress = task.NextAddress; |
| | | task.NextAddress = task.TargetAddress; |
| | | _taskRepository.UpdateData(task); |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"ç³»ç»èªå¨æµç¨,ï¼ä»»å¡ç¶æä»ã{oldStatus}ã转å°ã{task.TaskState}ã"); |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() != TaskTypeGroup.InboundGroup) |
| | | { |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"ç³»ç»èªå¨æµç¨,ï¼ä»»å¡å®æ"); |
| | | _taskRepository.DeleteAndMoveIntoHty(task, OperateTypeEnum.èªå¨å®æ); |
| | | HttpHelper.Post("", "");//todo è°ç¨WMSä»»å¡å®ææ¹æ³ |
| | | } |
| | | } |
| | | else |
| | | { |
| | | WriteInfo(deviceName, $"æªæ¾å°ä»»å¡ä¿¡æ¯,ä»»å¡å·:{taskNum}"); |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ä»»å¡ä¿¡æ¯,ä»»å¡å·:{taskNum}"); |
| | | } |
| | | |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteError(deviceName, $"ä»»å¡å®æé误", ex); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | if(task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) |
| | | { |
| | | HttpHelper.Post("", ""); |
| | | } |
| | | |
| | | return task; |
| | | } |
| | | |
| | |
| | | /// <returns>妿æªè¢«å ç¨ï¼è¿åä¼ å
¥çä»»å¡ä¿¡æ¯ï¼å¦åï¼è¿ånull</returns> |
| | | private Dt_Task? OutTaskStationIsOccupied([NotNull] Dt_Task task) |
| | | { |
| | | Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.TargetAddress && x.StackerCraneCode == task.Roadway); |
| | | Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.NextAddress && x.StackerCraneCode == task.DeviceCode); |
| | | if (stationManger != null) |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | |
| | | { |
| | | task.TargetAddress = stationManger.StackerCraneStationCode; |
| | | _taskRepository.UpdateData(task); |
| | | client.SetValue(GroundStationDBName.R_IsCanPut, true, stationManger.StationCode); |
| | | return task; |
| | | } |
| | | } |
| | |
| | | /// <returns>妿æªè¢«å ç¨ï¼è¿åä¼ å
¥çä»»å¡ä¿¡æ¯ï¼å¦åï¼è¿ånull</returns> |
| | | private Dt_Task? OutTaskStationIsOccupied([NotNull] Dt_Task task) |
| | | { |
| | | Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.TargetAddress && x.StackerCraneCode == task.Roadway); |
| | | Dt_StationManger? stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.TargetAddress && x.StackerCraneCode == task.DeviceCode); |
| | | if (stationManger != null) |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | |
| | | let enableBtn = this.buttons.find(x => x.value == 'Enable'); |
| | | if (enableBtn) { |
| | | enableBtn.onClick = function () { |
| | | this.$message.success('èªå®ä¹æé®ç¹å»äºä»¶'); |
| | | //this.$message.success('èªå®ä¹æé®ç¹å»äºä»¶'); |
| | | var printSection = document.querySelector('.vol-table'); |
| | | var printWindow = window.open('', ''); |
| | | printWindow.document.write(printSection.innerHTML); |
| | | printWindow.document.close(); |
| | | printWindow.focus(); |
| | | printWindow.print(); |
| | | printWindow.close(); |
| | | |
| | | } |
| | | } |
| | | let disableBtn = this.buttons.find(x => x.value == 'Disable'); |
| | |
| | | return null; |
| | | } |
| | | |
| | | private bool LittleDepthLocationIsEmpty_CSJ(Dt_LocationInfo locationInfo, PalletTypeEnum palletType) |
| | | { |
| | | List<Dt_LocationInfo> locations = GetGroupLocations(locationInfo); |
| | | |
| | | switch (palletType) |
| | | { |
| | | case PalletTypeEnum.LargestPallet: |
| | | case PalletTypeEnum.LargePallet: |
| | | { |
| | | List<Dt_LocationInfo> littleDepth = locations.Where(x => x.Depth <= locationInfo.Depth).ToList(); |
| | | return littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.OnlyIn.ObjToInt() && x.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) == null; //æ¥è¯¢å°äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºç©ºï¼ä¸ç¦ç¨ç¶æä¸ä¸ºç¦ç¨ä»¥ååªå
¥çè´§ä½ï¼å¦ææ¯trueï¼å表示æµ
è´§ä½è¢«ä½¿ç¨æè
被ç¦ç¨çæ
åµ |
| | | } |
| | | case PalletTypeEnum.MediumPallet: |
| | | case PalletTypeEnum.SmallPallet: |
| | | { |
| | | List<Dt_LocationInfo> littleDepth = locations.Where(x => x.Depth <= locationInfo.Depth).ToList(); |
| | | return littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.OnlyIn.ObjToInt() && x.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) == null; //æ¥è¯¢å°äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºç©ºï¼ä¸ç¦ç¨ç¶æä¸ä¸ºç¦ç¨ä»¥ååªå
¥çè´§ä½ï¼å¦ææ¯trueï¼å表示æµ
è´§ä½è¢«ä½¿ç¨æè
被ç¦ç¨çæ
åµ |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 夿ä¸å深度çåç»è´§ä½ç¶ææ¯å¦ä¸ºç©ºé²ç©ºä½(æµè¯æ¶ä») |
| | | /// </summary> |
| | |
| | | }; |
| | | } |
| | | |
| | | public bool LittleDepthLocationIsEmpty(Dt_LocationInfo locationInfo, PalletTypeEnum palletType) |
| | | { |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == locationInfo.WarehouseId); |
| | | if (warehouse == null) |
| | | { |
| | | throw new Exception($"æªæ¾å°ä»åºä¿¡æ¯"); |
| | | } |
| | | |
| | | return warehouse.WarehouseName switch |
| | | { |
| | | "æ¿æä»" => false, |
| | | "PPä»" => false, |
| | | "å¹²èä»" => false, |
| | | "æµè¯æ¶ä»" => LittleDepthLocationIsEmpty_CSJ(locationInfo, palletType), |
| | | "é»çä»" => false, |
| | | "油墨ä»" => true, |
| | | "æåä»" => true, |
| | | "è¾
æä»" => true, |
| | | _ => throw new Exception($"æªæ¾å°ä»åºè´§ä½åé
æ¹æ³") |
| | | }; |
| | | } |
| | | |
| | | private readonly static object _locker = new object(); |
| | | private static List<LocationCache> locationCaches = new List<LocationCache>(); |
| | | /// <summary> |
| | |
| | | /// <param name="locationInfos"></param> |
| | | /// <param name="location"></param> |
| | | /// <returns></returns> |
| | | private List<Dt_LocationInfo> GetGroupLocations(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo location) |
| | | public List<Dt_LocationInfo> GetGroupLocations(List<Dt_LocationInfo> locationInfos, Dt_LocationInfo location) |
| | | { |
| | | List<Dt_LocationInfo> groupLocations = new List<Dt_LocationInfo>() { location }; |
| | | int maxDepth = locationInfos.Max(x => x.Depth); |
| | |
| | | } |
| | | return groupLocations; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åä¸å深度çåç»è´§ä½ä¿¡æ¯ |
| | | /// </summary> |
| | | /// <param name="location"></param> |
| | | /// <returns></returns> |
| | | public List<Dt_LocationInfo> GetGroupLocations(Dt_LocationInfo location) |
| | | { |
| | | List<Dt_LocationInfo> locationInfos = Repository.QueryData(x => x.RoadwayNo == location.RoadwayNo && x.WarehouseId == location.WarehouseId); |
| | | |
| | | List<Dt_LocationInfo> groupLocations = new List<Dt_LocationInfo>() { location }; |
| | | int maxDepth = locationInfos.Max(x => x.Depth); |
| | | for (int j = location.Depth + 1; j <= maxDepth; j++) |
| | | { |
| | | Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer); |
| | | if (locationInfo != null) |
| | | { |
| | | groupLocations.Add(locationInfo); |
| | | } |
| | | } |
| | | |
| | | for (int j = location.Depth - 1; j >= 1; j--) |
| | | { |
| | | Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer); |
| | | if (locationInfo != null) |
| | | { |
| | | groupLocations.Add(locationInfo); |
| | | } |
| | | } |
| | | return groupLocations; |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | { |
| | | object? obj2 = Activator.CreateInstance(htyType); |
| | | PropertyInfo keyPro = typeof(TEntity).GetKeyProperty(); |
| | | PropertyInfo? operateTypePro = htyType.GetProperty(nameof(OperateTypeEnum)); |
| | | PropertyInfo? sourceIdPro = htyType.GetProperty("SourceId"); |
| | | PropertyInfo? operateTypePro = htyType.GetProperty(nameof(IBaseHistoryEntity.OperateType)); |
| | | PropertyInfo? sourceIdPro = htyType.GetProperty(nameof(IBaseHistoryEntity.SourceId)); |
| | | if (obj2 != null && keyPro != null && operateTypePro != null && sourceIdPro != null) |
| | | { |
| | | List<PropertyInfo> propertyInfos = htyType.GetProperties().Where(x => x.Name != operateTypePro.Name && x.Name != sourceIdPro.Name && x.Name != keyPro.Name).ToList(); |
| | |
| | | /// ä¼å
级 |
| | | /// </summary> |
| | | public int Grade { get; set; } |
| | | |
| | | } |
| | | } |
| | |
| | | /// <param name="palletType">æçç±»å</param> |
| | | /// <param name="locationStatus">è´§ä½ç¶æ</param> |
| | | void UpdateLocationStatus(Dt_LocationInfo location, PalletTypeEnum palletType, LocationStatusEnum locationStatus, int warehousId); |
| | | |
| | | /// <summary> |
| | | /// è·åä¸å深度çåç»è´§ä½ä¿¡æ¯ |
| | | /// </summary> |
| | | /// <param name="location"></param> |
| | | /// <returns></returns> |
| | | List<Dt_LocationInfo> GetGroupLocations(Dt_LocationInfo location); |
| | | |
| | | /// <summary> |
| | | /// 夿æµ
è´§ä½æ¯å¦è¢«å ç¨ |
| | | /// </summary> |
| | | /// <param name="locationInfo">è´§ä½ä¿¡æ¯</param> |
| | | /// <param name="palletType">æçç±»å</param> |
| | | /// <returns></returns> |
| | | bool LittleDepthLocationIsEmpty(Dt_LocationInfo locationInfo, PalletTypeEnum palletType); |
| | | } |
| | | } |
| | |
| | | /// <param name="taskNum">ä»»å¡å·</param> |
| | | /// <returns></returns> |
| | | WebResponseContent OutboundTaskCompleted(int taskNum); |
| | | <<<<<<< Updated upstream |
| | | /// <summary> |
| | | /// æµè¯æ¶éåº |
| | | /// </summary> |
| | | /// <param name="backModel"></param> |
| | | /// <returns></returns> |
| | | MesResponseContent TestReturnStock(TestToolBackModel backModel); |
| | | ======= |
| | | |
| | | /// <summary> |
| | | /// 夿æ¯å¦éè¦ç§»åº |
| | | /// </summary> |
| | | /// <param name="taskNum">ä»»å¡å·</param> |
| | | /// <param name="locationCode">å
¥åºæåºåºçè´§ä½å·</param> |
| | | /// <returns></returns> |
| | | WebResponseContent IsRelocation(int taskNum, string locationCode); |
| | | >>>>>>> Stashed changes |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Common.OtherEnum; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Common.TaskEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO.Task; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_TaskInfoService |
| | | { |
| | | public partial class TaskService |
| | | { |
| | | public WebResponseContent IsRelocation(int taskNum, string locationCode) |
| | | { |
| | | try |
| | | { |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == locationCode); |
| | | if (locationInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°å¯¹åºçè´§ä½ä¿¡æ¯"); |
| | | } |
| | | Dt_Task task = Repository.QueryFirst(x => x.TaskNum == taskNum); |
| | | if (task == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ä»»å¡ä¿¡æ¯"); |
| | | } |
| | | |
| | | if (!_basicService.LocationInfoService.LittleDepthLocationIsEmpty(locationInfo, (PalletTypeEnum)task.PalletType)) |
| | | { |
| | | return WebResponseContent.Instance.OK(data: _mapper.Map<WMSTaskDTO>(task)); |
| | | } |
| | | else |
| | | { |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.QueryFirst(x => x.LocationCode == locationCode); |
| | | if (stockInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°å¯¹åºè´§ä½çåºåä¿¡æ¯"); |
| | | } |
| | | |
| | | Dt_LocationInfo? newLocation = _basicService.LocationInfoService.AssignLocation(task.Roadway, (PalletTypeEnum)task.PalletType, task.WarehouseId); |
| | | if (newLocation != null) |
| | | { |
| | | Dt_Task newTask = new Dt_Task() |
| | | { |
| | | Roadway = task.Roadway, |
| | | WarehouseId = task.WarehouseId, |
| | | CurrentAddress = locationCode, |
| | | Grade = 99, |
| | | NextAddress = newLocation.LocationCode, |
| | | OrderNo = "", |
| | | PalletCode = stockInfo.PalletCode, |
| | | PalletType = stockInfo.PalletType, |
| | | SourceAddress = locationCode, |
| | | TargetAddress = newLocation.LocationCode, |
| | | TaskNum = Repository.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | TaskStatus = 0, |
| | | TaskType = 0 |
| | | }; |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | Repository.AddData(newTask); |
| | | { |
| | | LocationStatusEnum lastStatus = (LocationStatusEnum)newLocation.LocationStatus; |
| | | newLocation.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(newLocation, (PalletTypeEnum)task.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationChangeType.RelocationAssignLocation, taskNum: newTask.TaskNum); |
| | | } |
| | | { |
| | | LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; |
| | | locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, (PalletTypeEnum)task.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationChangeType.RelocationAssignLocation, taskNum: newTask.TaskNum); |
| | | } |
| | | stockInfo.StockStatus = StockStatusEmun.ç§»åºéå®.ObjToInt(); |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfo); |
| | | |
| | | _unitOfWorkManage.RollbackTran(); |
| | | |
| | | return WebResponseContent.Instance.OK(data: _mapper.Map<WMSTaskDTO>(newTask)); |
| | | } |
| | | else |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°å¯åé
è´§ä½,请æ¥ç该巷éã{task.Roadway}ãæ¯å¦è¿æç©ºé²å¯ä½¿ç¨è´§ä½"); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | return Service.OutboundTaskCompleted(taskNum); |
| | | } |
| | | |
| | | [HttpPost, HttpGet, Route("IsRelocation"), AllowAnonymous] |
| | | public WebResponseContent IsRelocation(int taskNum, string locationCode) |
| | | { |
| | | return Service.IsRelocation(taskNum, locationCode); |
| | | } |
| | | } |
| | | } |