已添加10个文件
已删除4个文件
已修改14个文件
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Core.BaseRepository; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_Model.Models; |
| | | |
| | | namespace WIDESEAWCS_BasicInfoRepository |
| | | { |
| | | public class ApiInfoRepository : RepositoryBase<Dt_ApiInfo>, IApiInfoRepository |
| | | { |
| | | public ApiInfoRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage) |
| | | { |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEAWCS_Common.APIEnum |
| | | { |
| | | public enum APIEnum |
| | | { |
| | | /// <summary> |
| | | /// AGVåé任塿¥å£ |
| | | /// </summary> |
| | | [Description("AGVåé任塿¥å£")] |
| | | AgvSendTask, |
| | | /// <summary> |
| | | /// AGV任塿¾è¡æ¥å£ |
| | | /// </summary> |
| | | [Description("AGV任塿¾è¡æ¥å£")] |
| | | AgvTaskFlow, |
| | | /// <summary> |
| | | /// AGVç¶ææ¥è¯¢æ¥å£ |
| | | /// </summary> |
| | | [Description("AGVç¶ææ¥è¯¢æ¥å£")] |
| | | AgvSearchStatus, |
| | | /// <summary> |
| | | /// AGVä»»å¡åæ¶ |
| | | /// </summary> |
| | | [Description("AGVä»»å¡åæ¶")] |
| | | AgvTaskCancel |
| | | } |
| | | } |
| | |
| | | |
| | | public static TaskTypeGroup GetTaskTypeGroup(this int taskType) |
| | | { |
| | | if (!int.TryParse(Enum.Parse<TaskOutboundTypeEnum>(taskType.ToString()).ToString(), out int result)) |
| | | { |
| | | return TaskTypeGroup.OutbondGroup; |
| | | } |
| | | else if (!int.TryParse(Enum.Parse<TaskInboundTypeEnum>(taskType.ToString()).ToString(), out result)) |
| | | { |
| | | return TaskTypeGroup.InboundGroup; |
| | | } |
| | | else if (!int.TryParse(Enum.Parse<TaskRelocationTypeEnum>(taskType.ToString()).ToString(), out result)) |
| | | { |
| | | return TaskTypeGroup.RelocationGroup; |
| | | } |
| | | else if (!int.TryParse(Enum.Parse<TaskOtherTypeEnum>(taskType.ToString()).ToString(), out result)) |
| | | { |
| | | return TaskTypeGroup.OtherGroup; |
| | | } |
| | | else if (!int.TryParse(Enum.Parse<TaskAGVCarryTypeEnum>(taskType.ToString()).ToString(), out result)) |
| | | if (!int.TryParse(Enum.Parse<TaskAGVCarryTypeEnum>(taskType.ToString()).ToString(), out int result)) |
| | | { |
| | | return TaskTypeGroup.CarryGroup; |
| | | } |
| | | else if (!int.TryParse(Enum.Parse<TaskAcrossFloorTypeEnum>(taskType.ToString()).ToString(), out result)) |
| | | { |
| | | return TaskTypeGroup.AcrossFloorGroup; |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | public static TaskStateGroup GetTaskStateGroup(this int taskState) |
| | | { |
| | | if (!int.TryParse(Enum.Parse<TaskOutStatusEnum>(taskState.ToString()).ToString(), out int result)) |
| | | { |
| | | return TaskStateGroup.OutbondGroup; |
| | | } |
| | | else if (!int.TryParse(Enum.Parse<TaskInStatusEnum>(taskState.ToString()).ToString(), out result)) |
| | | { |
| | | return TaskStateGroup.InboundGroup; |
| | | } |
| | | else if (!int.TryParse(Enum.Parse<TaskRelocationStatusEnum>(taskState.ToString()).ToString(), out result)) |
| | | { |
| | | return TaskStateGroup.RelocationGroup; |
| | | } |
| | | else if (!int.TryParse(Enum.Parse<TaskOtherStateEnum>(taskState.ToString()).ToString(), out result)) |
| | | { |
| | | return TaskStateGroup.OtherGroup; |
| | | } |
| | | else if (!int.TryParse(Enum.Parse<TaskAGVCarryStatusEnum>(taskState.ToString()).ToString(), out result)) |
| | | if (!int.TryParse(Enum.Parse<TaskAGVCarryStatusEnum>(taskState.ToString()).ToString(), out int result)) |
| | | { |
| | | return TaskStateGroup.CarryGroup; |
| | | } |
| | | else if (!int.TryParse(Enum.Parse<TaskAcrossFloorStatusEnum>(taskState.ToString()).ToString(), out result)) |
| | | { |
| | | return TaskStateGroup.AcrossFloorGroup; |
| | | } |
| | | else |
| | | { |
| | |
| | | Type type = typeof(T); |
| | | if (type is null) throw new ArgumentNullException(); |
| | | if (!type.IsEnum) return 0; |
| | | if (type == typeof(TaskInStatusEnum)) |
| | | if (type == typeof(TaskAGVCarryStatusEnum)) |
| | | { |
| | | 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 if (type == typeof(TaskRelocationStatusEnum)) |
| | | { |
| | | return type.GetEnumIndexList().Where(x => x > currentStatus && x < (int)TaskRelocationStatusEnum.RelocationFinish).OrderBy(x => x).FirstOrDefault(); |
| | | } |
| | | else if (type == typeof(TaskAGVCarryStatusEnum)) |
| | | { |
| | | return type.GetEnumIndexList().Where(x => x > currentStatus && x < (int)TaskAGVCarryStatusEnum.CarryFinish).OrderBy(x => x).FirstOrDefault(); |
| | | } |
| | | else if (type == typeof(TaskAcrossFloorStatusEnum)) |
| | | { |
| | | return type.GetEnumIndexList().Where(x => x > currentStatus && x < (int)TaskAcrossFloorStatusEnum.CarryFinish).OrderBy(x => x).FirstOrDefault(); |
| | | return type.GetEnumIndexList().Where(x => x > currentStatus && x < (int)TaskAGVCarryStatusEnum.AGV_CarryFinish).OrderBy(x => x).FirstOrDefault(); |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | namespace WIDESEAWCS_Common.TaskEnum |
| | | { |
| | | public enum TaskInStatusEnum |
| | | { |
| | | /// <summary> |
| | | /// æ°å»ºå
¥åºä»»å¡ |
| | | /// </summary> |
| | | [Description("æ°å»ºå
¥åºä»»å¡")] |
| | | InNew = 200, |
| | | |
| | | /// <summary> |
| | | /// AGVå
¥åºæ§è¡ä¸ |
| | | /// </summary> |
| | | [Description("AGVå
¥åºæ§è¡ä¸")] |
| | | AGV_InExecuting = 210, |
| | | |
| | | /// <summary> |
| | | /// AGVå
¥åºå®æ |
| | | /// </summary> |
| | | [Description("AGVæ¬è¿å®æ")] |
| | | AGV_InFinish = 215, |
| | | |
| | | /// <summary> |
| | | /// è¾é线å
¥åºæ§è¡ä¸ |
| | | /// </summary> |
| | | [Description("è¾é线å
¥åºæ§è¡ä¸")] |
| | | Line_InExecuting = 220, |
| | | |
| | | /// <summary> |
| | | /// è¾é线å
¥åºå®æ |
| | | /// </summary> |
| | | [Description("è¾é线å
¥åºå®æ")] |
| | | Line_InFinish = 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, |
| | | } |
| | | |
| | | public enum TaskOutStatusEnum |
| | | { |
| | | /// <summary> |
| | | /// æ°å»ºåºåºä»»å¡ |
| | | /// </summary> |
| | | [Description("æ°å»ºåºåºä»»å¡")] |
| | | OutNew = 100, |
| | | |
| | | /// <summary> |
| | | /// å åæºåºåºæ§è¡ä¸ |
| | | /// </summary> |
| | | [Description("å åæºåºåºæ§è¡ä¸")] |
| | | SC_OutExecuting = 110, |
| | | |
| | | /// <summary> |
| | | /// å åæºåºåºå®æ |
| | | /// </summary> |
| | | [Description("å åæºåºåºå®æ")] |
| | | SC_OutFinish = 115, |
| | | |
| | | /// <summary> |
| | | /// è¾é线åºåºæ§è¡ä¸ |
| | | /// </summary> |
| | | [Description("è¾é线åºåºæ§è¡ä¸")] |
| | | Line_OutExecuting = 120, |
| | | |
| | | /// <summary> |
| | | /// è¾é线åºåºå®æ |
| | | /// </summary> |
| | | [Description("è¾é线åºåºå®æ")] |
| | | Line_OutFinish = 125, |
| | | |
| | | |
| | | /// <summary> |
| | | /// AGVåºåºæ§è¡ä¸ |
| | | /// </summary> |
| | | [Description("AGVåºåºæ§è¡ä¸")] |
| | | AGV_OutExecuting = 130, |
| | | |
| | | /// <summary> |
| | | /// AGVåºåºå®æ |
| | | /// </summary> |
| | | [Description("AGVæ¬è¿å®æ")] |
| | | AGV_OutFinish = 135, |
| | | |
| | | /// <summary> |
| | | /// åºåºä»»å¡å®æ |
| | | /// </summary> |
| | | [Description("åºåºä»»å¡å®æ")] |
| | | OutFinish = 190, |
| | | |
| | | /// <summary> |
| | | /// åºåºä»»å¡æèµ· |
| | | /// </summary> |
| | | [Description("åºåºä»»å¡æèµ·")] |
| | | OutPending = 197, |
| | | |
| | | /// <summary> |
| | | /// åºåºä»»å¡åæ¶ |
| | | /// </summary> |
| | | [Description("åºåºä»»å¡åæ¶")] |
| | | OutCancel = 198, |
| | | |
| | | /// <summary> |
| | | /// åºåºä»»å¡å¼å¸¸ |
| | | /// </summary> |
| | | [Description("åºåºä»»å¡å¼å¸¸")] |
| | | OutException = 199, |
| | | } |
| | | public enum TaskOtherStateEnum |
| | | { |
| | | |
| | | } |
| | | public enum TaskRelocationStatusEnum |
| | | { |
| | | /// <summary> |
| | | /// æ°å»ºç§»åºä»»å¡ |
| | | /// </summary> |
| | | [Description("æ°å»ºç§»åºä»»å¡")] |
| | | RelocationNew = 300, |
| | | |
| | | /// <summary> |
| | | /// å åæºç§»åºæ§è¡ä¸ |
| | | /// </summary> |
| | | [Description("å åæºç§»åºæ§è¡ä¸")] |
| | | SC_RelocationExecuting = 310, |
| | | |
| | | /// <summary> |
| | | /// å åæºç§»åºå®æ |
| | | /// </summary> |
| | | [Description("å åæºç§»åºå®æ")] |
| | | SC_RelocationFinish = 315, |
| | | |
| | | /// <summary> |
| | | /// æ°å»ºAGVç§»åºä»»å¡ |
| | | /// </summary> |
| | | [Description("æ°å»ºAGVç§»åºä»»å¡")] |
| | | RelocationNewAGV = 320, |
| | | |
| | | /// <summary> |
| | | /// AGVç§»åºæ§è¡ä¸ |
| | | /// </summary> |
| | | [Description("AGVç§»åºæ§è¡ä¸")] |
| | | AGV_RelocationExecuting = 325, |
| | | |
| | | /// <summary> |
| | | /// AGVç§»åºå®æ |
| | | /// </summary> |
| | | [Description("AGVç§»åºå®æ")] |
| | | AGV_RelocationFinish = 330, |
| | | |
| | | /// <summary> |
| | | /// ç§»åºä»»å¡å®æ |
| | | /// </summary> |
| | | [Description("ç§»åºä»»å¡å®æ")] |
| | | RelocationFinish = 390, |
| | | |
| | | /// <summary> |
| | | /// ç§»åºä»»å¡æèµ· |
| | | /// </summary> |
| | | [Description("ç§»åºä»»å¡æèµ·")] |
| | | RelocationPending = 397, |
| | | |
| | | /// <summary> |
| | | /// ç§»åºä»»å¡åæ¶ |
| | | /// </summary> |
| | | [Description("ç§»åºä»»å¡åæ¶")] |
| | | RelocationCancel = 398, |
| | | |
| | | /// <summary> |
| | | /// ç§»åºä»»å¡å¼å¸¸ |
| | | /// </summary> |
| | | [Description("ç§»åºä»»å¡å¼å¸¸")] |
| | | RelocationException = 399, |
| | | } |
| | | |
| | | public enum TaskAGVCarryStatusEnum |
| | | { |
| | | /// <summary> |
| | | /// æ°å»ºAGVæ¬è¿ä»»å¡ |
| | | /// </summary> |
| | | [Description("æ°å»ºAGVæ¬è¿ä»»å¡")] |
| | | CarryNew = 400, |
| | | AGV_CarryNew = 400, |
| | | |
| | | /// <summary> |
| | | /// AGVæ¬è¿æ§è¡ä¸ |
| | | /// </summary> |
| | | [Description("AGVæ¬è¿æ§è¡ä¸")] |
| | | AGV_CarryExecuting = 410, |
| | | AGV_CarryExecuting = 405, |
| | | |
| | | /// <summary> |
| | | /// AGVåè´§å®æ |
| | | /// </summary> |
| | | [Description("AGVæ¬è¿åè´§å®æ")] |
| | | AGV_CarryTakeFinish = 410, |
| | | |
| | | /// <summary> |
| | | /// AGVæ¬è¿å®æ |
| | | /// </summary> |
| | | [Description("AGVæ¬è¿å®æ")] |
| | | AGV_CarryFinish = 415, |
| | | |
| | | [Description("AGVæ¬è¿æ¾è´§å®æ")] |
| | | AGV_CarryReleaseFinish = 415, |
| | | |
| | | /// <summary> |
| | | /// AGVæ¬è¿ä»»å¡å®æ |
| | | /// </summary> |
| | | [Description("AGVæ¬è¿ä»»å¡å®æ")] |
| | | CarryFinish = 490, |
| | | AGV_CarryFinish = 490, |
| | | |
| | | /// <summary> |
| | | /// AGVæ¬è¿ä»»å¡æèµ· |
| | | /// </summary> |
| | | [Description("AGVæ¬è¿ä»»å¡æèµ·")] |
| | | CarryPending = 497, |
| | | AGV_CarryPending = 497, |
| | | |
| | | /// <summary> |
| | | /// AGVæ¬è¿ä»»å¡åæ¶ |
| | | /// </summary> |
| | | [Description("AGVæ¬è¿ä»»å¡åæ¶")] |
| | | CarryCancel = 498, |
| | | AGV_CarryCancel = 498, |
| | | |
| | | /// <summary> |
| | | /// AGVæ¬è¿ä»»å¡å¼å¸¸ |
| | | /// </summary> |
| | | [Description("AGVæ¬è¿ä»»å¡å¼å¸¸")] |
| | | CarryException = 499, |
| | | AGV_CarryException = 499, |
| | | } |
| | | public enum TaskAcrossFloorStatusEnum |
| | | |
| | | /// <summary> |
| | | ///ä½ä¸å½åç¶æ<br/> |
| | | ///å¼å§ç§»å¨ï¼MOVE_BEGIN<br/> |
| | | ///æ ç®± å æ å® æ:PICKER_RECEIVE<br/> |
| | | ///æ ç®± ä¸ æ å® æ:PICKER_SEND<br/> |
| | | ///çå¾
æ¾è¡ï¼WAITFEEDBACK<br/> |
| | | ///ä»»å¡å®æï¼COMPLETED<br/> |
| | | ///ä»»å¡åæ¶å®æï¼CANCELED<br/> |
| | | ///åè¦ï¼WARNING<br/> |
| | | /// </summary> |
| | | public enum AGVStatusEnum |
| | | { |
| | | /// <summary> |
| | | /// æ°å»ºè·¨æ¥¼å±ä»»å¡ |
| | | /// å¼å§ç§»å¨ |
| | | /// </summary> |
| | | [Description("æ°å»ºè·¨æ¥¼å±ä»»å¡")] |
| | | CarryNew = 500, |
| | | |
| | | [Description("å¼å§ç§»å¨")] |
| | | MOVE_BEGIN, |
| | | /// <summary> |
| | | /// è·¨æ¥¼å±æ¬è¿1 |
| | | /// æ ç®± å æ å® æ |
| | | /// </summary> |
| | | [Description("è·¨æ¥¼å±æ¬è¿1")] |
| | | FirstCarry = 510, |
| | | |
| | | [Description("æ ç®± å æ å® æ")] |
| | | PICKER_RECEIVE, |
| | | /// <summary> |
| | | /// 䏿¥¼æ¬è¿å®æ |
| | | /// æ ç®± ä¸ æ å® æ |
| | | /// </summary> |
| | | [Description("è·¨æ¥¼å±æ¬è¿1宿")] |
| | | FirstCarryFinish = 515, |
| | | |
| | | [Description("æ ç®± ä¸ æ å® æ")] |
| | | PICKER_SEND, |
| | | /// <summary> |
| | | /// è·¨æ¥¼å±æ¬è¿2 |
| | | /// ä»»å¡å®æ |
| | | /// </summary> |
| | | [Description("è·¨æ¥¼å±æ¬è¿2")] |
| | | SecondCarry = 520, |
| | | |
| | | [Description("ä»»å¡å®æ")] |
| | | COMPLETED, |
| | | /// <summary> |
| | | /// 跨楼å±ç»ç¹æ§è¡ |
| | | /// çå¾
æ¾è¡ |
| | | /// </summary> |
| | | [Description("跨楼å±ç»ç¹æ§è¡")] |
| | | EndAddressExecuting = 525, |
| | | |
| | | [Description("çå¾
æ¾è¡")] |
| | | WAITFEEDBACK, |
| | | /// <summary> |
| | | /// è·¨æ¥¼å±æ¬è¿2宿 |
| | | /// ä»»å¡åæ¶å®æ |
| | | /// </summary> |
| | | [Description("è·¨æ¥¼å±æ¬è¿2宿")] |
| | | SecondCarryFinish = 530, |
| | | |
| | | [Description("ä»»å¡åæ¶å®æ")] |
| | | CANCELED, |
| | | /// <summary> |
| | | /// 跨楼å±ä»»å¡å®æ |
| | | /// åè¦ |
| | | /// </summary> |
| | | [Description("跨楼å±ä»»å¡å®æ")] |
| | | CarryFinish = 590, |
| | | |
| | | /// <summary> |
| | | /// 跨楼å±ä»»å¡æèµ· |
| | | /// </summary> |
| | | [Description("跨楼å±ä»»å¡æèµ·")] |
| | | CarryPending = 597, |
| | | |
| | | /// <summary> |
| | | /// 跨楼å±ä»»å¡åæ¶ |
| | | /// </summary> |
| | | [Description("跨楼å±ä»»å¡åæ¶")] |
| | | CarryCancel = 598, |
| | | |
| | | /// <summary> |
| | | /// AGVæ¬è¿ä»»å¡å¼å¸¸ |
| | | /// </summary> |
| | | [Description("AGVæ¬è¿ä»»å¡å¼å¸¸")] |
| | | CarryException = 599, |
| | | [Description("åè¦")] |
| | | WARNING, |
| | | } |
| | | } |
| | |
| | | |
| | | namespace WIDESEAWCS_Common.TaskEnum |
| | | { |
| | | public enum TaskInboundTypeEnum |
| | | { |
| | | /// <summary> |
| | | /// å
¥åº |
| | | /// </summary> |
| | | [Description("å
¥åº")] |
| | | Inbound = 200, |
| | | |
| | | /// <summary> |
| | | /// å
¶ä»å
¥åº |
| | | /// </summary> |
| | | [Description("å
¶ä»å
¥åº")] |
| | | InOther = 205, |
| | | } |
| | | |
| | | public enum TaskOutboundTypeEnum |
| | | { |
| | | /// <summary> |
| | | /// åºåº |
| | | /// </summary> |
| | | [Description("åºåº")] |
| | | Outbound = 100, |
| | | |
| | | /// <summary> |
| | | /// è°æ¨åºåº |
| | | /// </summary> |
| | | [Description("è°æ¨åºåº")] |
| | | OutAllocate = 105, |
| | | |
| | | /// <summary> |
| | | /// å
¶ä»åºåº |
| | | /// </summary> |
| | | [Description("å
¶ä»åºåº")] |
| | | OutOther = 110, |
| | | |
| | | /// <summary> |
| | | /// çäº§é¢æåºåº |
| | | /// </summary> |
| | | [Description("çäº§é¢æåºåº")] |
| | | MaterialRequisition = 115, |
| | | |
| | | /// <summary> |
| | | /// åææåºåº |
| | | /// </summary> |
| | | [Description("åææåºåº")] |
| | | RawMaterials = 120, |
| | | } |
| | | |
| | | public enum TaskRelocationTypeEnum |
| | | { |
| | | /// <summary> |
| | | /// åºå
ç§»åº |
| | | /// </summary> |
| | | [Description("åºå
ç§»åº")] |
| | | Relocation = 300, |
| | | |
| | | /// <summary> |
| | | /// åºå¤ç§»åº |
| | | /// </summary> |
| | | [Description("åºå¤ç§»åº")] |
| | | RelocationIn = 301 |
| | | } |
| | | |
| | | public enum TaskOtherTypeEnum |
| | | { |
| | | |
| | | } |
| | | |
| | | public enum TaskAGVCarryTypeEnum |
| | | { |
| | | /// <summary> |
| | | /// AGVæ¬è¿ |
| | | /// AGV䏿æ¬è¿ |
| | | /// </summary> |
| | | [Description("AGVæ¬è¿")] |
| | | [Description("AGV䏿æ¬è¿")] |
| | | Carry = 400, |
| | | |
| | | /// <summary> |
| | | /// AGVç§»åºæ¬è¿ |
| | | /// AGV空载å
·æ¬è¿ |
| | | /// </summary> |
| | | [Description("AGVç§»åºæ¬è¿")] |
| | | CarryReloction = 410 |
| | | } |
| | | public enum TaskAcrossFloorTypeEnum |
| | | { |
| | | /// <summary> |
| | | /// è·¨æ¥¼å±æ¬è¿ |
| | | /// </summary> |
| | | [Description("è·¨æ¥¼å±æ¬è¿")] |
| | | AcrossFloorCarry = 500 |
| | | [Description("AGV空载å
·æ¬è¿")] |
| | | CarryEmpty = 410 |
| | | } |
| | | } |
| | |
| | | </PropertyGroup> |
| | | |
| | | <ItemGroup> |
| | | <PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> |
| | | <Compile Remove="Http\**" /> |
| | | <EmbeddedResource Remove="Http\**" /> |
| | | <None Remove="Http\**" /> |
| | | </ItemGroup> |
| | | |
| | | <ItemGroup> |
| | | <Folder Include="Http\" /> |
| | | <PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> |
| | | </ItemGroup> |
| | | |
| | | </Project> |
| | |
| | | using System.Linq.Expressions; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Core.Enums; |
| | | |
| | | namespace WIDESEAWCS_Core.BaseRepository |
| | | { |
| | |
| | | // Expression<Func<T, T2, T3, TResult>> selectExpression, |
| | | // Expression<Func<T, T2, T3, bool>> whereLambda = null) where T : class, new(); |
| | | //Task<PageModel<TEntity>> QueryPage(PaginationModel pagination); |
| | | |
| | | bool DeleteAndMoveIntoHty(TEntity entity, OperateTypeEnum operateType); |
| | | |
| | | bool DeleteAndMoveIntoHty(List<TEntity> entities, OperateTypeEnum operateType); |
| | | } |
| | | } |
| | |
| | | using WIDESEAWCS_Core.Const; |
| | | using WIDESEAWCS_Core.AOP; |
| | | using OfficeOpenXml.FormulaParsing.ExpressionGraph; |
| | | using WIDESEAWCS_Core.DB.Models; |
| | | using WIDESEAWCS_Core.Utilities; |
| | | using WIDESEAWCS_Core.Enums; |
| | | |
| | | namespace WIDESEAWCS_Core.BaseRepository |
| | | { |
| | |
| | | // Expression<Func<T, T2, T3, TResult>> selectExpression, |
| | | // Expression<Func<T, T2, T3, bool>> whereLambda = null) where T : class, new(){throw new NotImplementedException();} |
| | | //Task<PageModel<TEntity>> QueryPage(PaginationModel pagination){throw new NotImplementedException();} |
| | | |
| | | public bool DeleteAndMoveIntoHty(TEntity entity, OperateTypeEnum operateType) |
| | | { |
| | | Type type = entity.GetType(); |
| | | Assembly assembly = type.Assembly; |
| | | Type? htyType = assembly.GetType(type.FullName + "_Hty"); |
| | | if (htyType != null) |
| | | { |
| | | object? obj = Activator.CreateInstance(htyType); |
| | | PropertyInfo keyPro = typeof(TEntity).GetKeyProperty(); |
| | | PropertyInfo? operateTypePro = htyType.GetProperty(nameof(IBaseHistoryEntity.OperateType)); |
| | | PropertyInfo? sourceIdPro = htyType.GetProperty(nameof(IBaseHistoryEntity.SourceId)); |
| | | if (obj != null && keyPro != null && operateTypePro != null && sourceIdPro != null) |
| | | { |
| | | operateTypePro.SetValue(obj, operateType.ToString()); |
| | | sourceIdPro.SetValue(obj, keyPro.GetValue(entity)); |
| | | |
| | | List<PropertyInfo> propertyInfos = htyType.GetProperties().Where(x => x.Name != operateTypePro.Name && x.Name != sourceIdPro.Name && x.Name != keyPro.Name).ToList(); |
| | | |
| | | for (int i = 0; i < propertyInfos.Count; i++) |
| | | { |
| | | PropertyInfo propertyInfo = propertyInfos[i]; |
| | | PropertyInfo? property = type.GetProperty(propertyInfo.Name); |
| | | |
| | | if (property != null) |
| | | { |
| | | if (propertyInfo.Name == nameof(BaseEntity.Modifier)) |
| | | { |
| | | propertyInfo.SetValue(obj, App.User.UserId > 0 ? App.User.UserName : "System"); |
| | | } |
| | | else if (propertyInfo.Name == nameof(BaseEntity.ModifyDate)) |
| | | { |
| | | propertyInfo.SetValue(obj, DateTime.Now); |
| | | } |
| | | else |
| | | { |
| | | propertyInfo.SetValue(obj, property.GetValue(entity)); |
| | | } |
| | | } |
| | | } |
| | | _db.InsertableByObject(obj).AS(type.Name + "_Hty").ExecuteCommand(); |
| | | } |
| | | } |
| | | return DeleteData(entity); |
| | | } |
| | | |
| | | public bool DeleteAndMoveIntoHty(List<TEntity> entities, OperateTypeEnum operateType) |
| | | { |
| | | Type type = typeof(TEntity); |
| | | Assembly assembly = type.Assembly; |
| | | Type? htyType = assembly.GetType(type.FullName + "_Hty"); |
| | | if (htyType != null) |
| | | { |
| | | object? obj2 = Activator.CreateInstance(htyType); |
| | | PropertyInfo keyPro = typeof(TEntity).GetKeyProperty(); |
| | | 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(); |
| | | List<object> list = new List<object>(); |
| | | foreach (var item in entities) |
| | | { |
| | | object? obj = Activator.CreateInstance(htyType); |
| | | if (obj != null) |
| | | { |
| | | operateTypePro.SetValue(obj, operateType.ToString()); |
| | | sourceIdPro.SetValue(obj, keyPro.GetValue(item)); |
| | | for (int i = 0; i < propertyInfos.Count; i++) |
| | | { |
| | | PropertyInfo propertyInfo = propertyInfos[i]; |
| | | PropertyInfo? property = type.GetProperty(propertyInfo.Name); |
| | | |
| | | if (property != null) |
| | | { |
| | | if (propertyInfo.Name == nameof(BaseEntity.Modifier)) |
| | | { |
| | | propertyInfo.SetValue(obj, App.User.UserId > 0 ? App.User.UserName : "System"); |
| | | } |
| | | else if (propertyInfo.Name == nameof(BaseEntity.ModifyDate)) |
| | | { |
| | | propertyInfo.SetValue(obj, DateTime.Now); |
| | | } |
| | | else |
| | | { |
| | | propertyInfo.SetValue(obj, property.GetValue(item)); |
| | | } |
| | | } |
| | | } |
| | | list.Add(obj); |
| | | } |
| | | } |
| | | _db.InsertableByObject(list).AS(type.Name + "_Hty").ExecuteCommand(); |
| | | |
| | | } |
| | | } |
| | | return DeleteData(entities); |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using Magicodes.ExporterAndImporter.Core; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEAWCS_Core.DB.Models |
| | | { |
| | | public interface IBaseHistoryEntity |
| | | { |
| | | /// <summary> |
| | | /// åè¡¨ä¸»é® |
| | | /// </summary> |
| | | [ImporterHeader(Name = "å表主é®")] |
| | | [ExporterHeader(DisplayName = "å表主é®")] |
| | | [SugarColumn(IsNullable = false, DefaultValue = "0", ColumnDescription = "å表主é®")] |
| | | public int SourceId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æä½ç±»å |
| | | /// </summary> |
| | | [ImporterHeader(Name = "æä½ç±»å")] |
| | | [ExporterHeader(DisplayName = "æä½ç±»å")] |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "æä½ç±»å")] |
| | | public string OperateType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç§»å
¥å岿¶é´ |
| | | /// </summary> |
| | | [ImporterHeader(Name = "ç§»å
¥å岿¶é´")] |
| | | [ExporterHeader(DisplayName = "ç§»å
¥å岿¶é´")] |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ç§»å
¥å岿¶é´")] |
| | | public DateTime InsertTime { get; set; } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEAWCS_Core.Enums |
| | | { |
| | | public enum OperateTypeEnum |
| | | { |
| | | 人工å é¤ = 1, |
| | | èªå¨å é¤ = 2, |
| | | 人工æ¢å¤ = 3, |
| | | èªå¨æ¢å¤ = 4, |
| | | äººå·¥å®æ = 5, |
| | | èªå¨å®æ = 6, |
| | | å
³é = 7, |
| | | å
¶ä» = 99 |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEAWCS_DTO.Agv |
| | | { |
| | | /// <summary> |
| | | /// AGVè¿ååæ° |
| | | /// </summary> |
| | | public class AgvResponseContent |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public object Data { get; set; } |
| | | /// <summary> |
| | | /// è¿å代ç |
| | | /// </summary> |
| | | public string Code { get; set; } |
| | | /// <summary> |
| | | /// è¿åä¿¡æ¯ |
| | | /// </summary> |
| | | public string Message { get; set; } |
| | | /// <summary> |
| | | /// è¿åç»æ |
| | | /// </summary> |
| | | public bool Success { get; set; } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEAWCS_DTO.Agv |
| | | { |
| | | public class AgvStatusUpdateDTO |
| | | { |
| | | /// <summary> |
| | | /// ä»»å¡ç¼å· |
| | | /// </summary> |
| | | public string MissionCode { get; set; } |
| | | /// <summary> |
| | | /// ä½ä¸ç±»å |
| | | /// </summary> |
| | | public string ViewBoardType { get; set; } |
| | | /// <summary> |
| | | /// å½åæå¨æ§½ä½ |
| | | /// </summary> |
| | | public string SlotCode { get; set; } |
| | | /// <summary> |
| | | /// æ§è¡å½åä»»å¡çæºå¨äºº id |
| | | /// </summary> |
| | | public string RobotId { get; set; } |
| | | /// <summary> |
| | | /// 容å¨ç¼å· |
| | | /// </summary> |
| | | public string ContainerCode { get; set; } |
| | | /// <summary> |
| | | /// 容å¨å½åä½ç½® |
| | | /// </summary> |
| | | public string CurrentPosition { get; set; } |
| | | /// <summary> |
| | | ///ä½ä¸å½åç¶æ<br/> |
| | | ///å¼å§ç§»å¨ï¼MOVE_BEGIN<br/> |
| | | ///æ ç®± å æ å® æ:PICKER_RECEIVE<br/> |
| | | ///æ ç®± ä¸ æ å® æ:PICKER_SEND<br/> |
| | | ///çå¾
æ¾è¡ï¼WAITFEEDBACK<br/> |
| | | ///ä»»å¡å®æï¼COMPLETED<br/> |
| | | ///ä»»å¡åæ¶å®æï¼CANCELED<br/> |
| | | ///åè¦ï¼WARNING<br/> |
| | | /// </summary> |
| | | public string MissionStatus { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string Message { get; set; } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEAWCS_DTO.Agv |
| | | { |
| | | public class MissionDataItem |
| | | { |
| | | /// <summary> |
| | | /// æ¬è¿æç®±åºå·ä»1å¼å§ |
| | | /// </summary> |
| | | public int Sequence { get; set; } = 1; |
| | | /// <summary> |
| | | /// æç®±å· |
| | | /// </summary> |
| | | public string BinCode { get; set; } |
| | | /// <summary> |
| | | /// æç®±æå¨çèµ·å§ç¹ä½ |
| | | /// </summary> |
| | | public string StartPosition { get; set; } |
| | | /// <summary> |
| | | /// æç®±æå¨çèµ·å§æ§½ä½ |
| | | /// </summary> |
| | | public string StartSlotCode { get; set; } |
| | | /// <summary> |
| | | /// åæç®±æ¶ä¹åæ¯å¦éè¦ç¡®è®¤ |
| | | /// </summary> |
| | | public bool TakeActionConfirm { get; set; } |
| | | /// <summary> |
| | | /// åæç®±åæ¯å¦éè¦éç¥ |
| | | /// </summary> |
| | | public bool TakeActionInform { get; set; } |
| | | /// <summary> |
| | | /// æç®±æå¨çç®æ ç¹ä½ |
| | | /// </summary> |
| | | public string EndPosition { get; set; } |
| | | /// <summary> |
| | | /// æç®±æå¨çç®æ æ§½ä½ |
| | | /// </summary> |
| | | public string EndSlotCode { get; set; } |
| | | /// <summary> |
| | | /// æ¾æç®±æ¶ä¹åæ¯å¦éè¦ç¡®è®¤ |
| | | /// </summary> |
| | | public bool PutActionConfirm { get; set; } |
| | | /// <summary> |
| | | /// æ¾æç®±åæ¯å¦éè¦éç¥ |
| | | /// </summary> |
| | | public bool PutActionInform { get; set; } |
| | | } |
| | | /// <summary> |
| | | /// AGVä»»å¡åé |
| | | /// </summary> |
| | | public class AgvTaskSendDTO |
| | | { |
| | | /// <summary> |
| | | /// åºåç»ç»ID |
| | | /// </summary> |
| | | public string OrgId { get; set; } = "HF"; |
| | | /// <summary> |
| | | /// è¯·æ± id |
| | | /// </summary> |
| | | public string RequestId { get; set; } |
| | | /// <summary> |
| | | /// ä»»å¡ç¼ç |
| | | /// </summary> |
| | | public string MissionCode { get; set; } |
| | | /// <summary> |
| | | /// ä»»å¡ç±»åï¼PICKER_MOVE |
| | | /// </summary> |
| | | public string MissionType { get; set; } = "PICKER_MOVE"; |
| | | /// <summary> |
| | | /// ä»»å¡çæ¿å±ç¤ºä»»å¡ç±»å |
| | | /// </summary> |
| | | public string ViewBoardType { get; set; } |
| | | /// <summary> |
| | | /// æºå¨äººå
·ä½åå· |
| | | /// </summary> |
| | | public List<string> RobotModels { get; set; } |
| | | /// <summary> |
| | | /// æºå¨äººç¼å· |
| | | /// </summary> |
| | | public List<string> RobotIds { get; set; } |
| | | /// <summary> |
| | | /// æºå¨äººåè½ç±»åPICKER |
| | | /// </summary> |
| | | public string RobotType { get; set; } = "PICKER"; |
| | | /// <summary> |
| | | /// ä½ä¸ä¼å
级 |
| | | /// </summary> |
| | | public int Priority { get; set; } |
| | | /// <summary> |
| | | /// 容卿¨¡åç¼ç |
| | | /// </summary> |
| | | public string ContainerModelCode { get; set; } |
| | | /// <summary> |
| | | /// 容å¨ç¼å· |
| | | /// </summary> |
| | | public string ContainerCode { get; set; } |
| | | /// <summary> |
| | | /// ä½ä¸æµç¨æ¨¡æ¿ç¼å· |
| | | /// </summary> |
| | | public string TemplateCode { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public bool LockRobotAfterFinish { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string UnlockRobotId { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string UnlockMissionCode { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string IdleNode { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public List<MissionDataItem> MissionData { get; set; } |
| | | } |
| | | |
| | | public class AgvTaskCancelDTO |
| | | { |
| | | /// <summary> |
| | | /// 请æ±id |
| | | /// </summary> |
| | | public string RequestId { get; set; } |
| | | /// <summary> |
| | | /// ä»»å¡ç¼å· |
| | | /// </summary> |
| | | public string MissionCode { get; set; } |
| | | /// <summary> |
| | | /// 容å¨ç¼å· |
| | | /// </summary> |
| | | public string ContainerCode { get; set; } |
| | | /// <summary> |
| | | /// èç¹ç¼å· |
| | | /// </summary> |
| | | public string Position { get; set; } |
| | | /// <summary> |
| | | /// åæ¶æ¨¡å¼ |
| | | /// </summary> |
| | | public string CancelMode { get; set; } |
| | | /// <summary> |
| | | /// åæ¶åå |
| | | /// </summary> |
| | | public string Reason { get; set; } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Core.BaseRepository; |
| | | using WIDESEAWCS_Model.Models; |
| | | |
| | | namespace WIDESEAWCS_IBasicInfoRepository |
| | | { |
| | | public interface IApiInfoRepository : IRepository<Dt_ApiInfo> |
| | | { |
| | | } |
| | | } |
| | |
| | | #region << ç æ¬ 注 é >> |
| | | /*---------------------------------------------------------------- |
| | | * å½å空é´ï¼WIDESEAWCS_ITaskInfoRepository |
| | | * å建è
ï¼è¡ç«¥åº |
| | | * å建æ¶é´ï¼2024/8/2 16:13:36 |
| | | * çæ¬ï¼V1.0.0 |
| | | * æè¿°ï¼ |
| | | * |
| | | * ---------------------------------------------------------------- |
| | | * ä¿®æ¹äººï¼ |
| | | * ä¿®æ¹æ¶é´ï¼ |
| | | * çæ¬ï¼V1.0.1 |
| | | * ä¿®æ¹è¯´æï¼ |
| | | * |
| | | *----------------------------------------------------------------*/ |
| | | #endregion << ç æ¬ 注 é >> |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Core.BaseRepository; |
| | | using WIDESEAWCS_Model.Models; |
| | | |
| | |
| | | { |
| | | public interface IDt_StationManagerRepository : IRepository<Dt_StationManager> |
| | | { |
| | | |
| | | } |
| | | } |
| | |
| | | WebResponseContent GetDetailInfo(int taskNum); |
| | | |
| | | WebResponseContent GetDetailDatas(int taskNum); |
| | | |
| | | void AddTaskExecuteDetail(List<int> taskNums, string description = ""); |
| | | } |
| | | } |
| | |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_DTO.MES; |
| | | using WIDESEAWCS_Common.APIEnum; |
| | | using WIDESEAWCS_DTO.Agv; |
| | | |
| | | namespace WIDESEAWCS_ITaskInfoService |
| | | { |
| | |
| | | /// ä»»å¡æåº |
| | | /// </summary> |
| | | public Dictionary<string, OrderByType> TaskOrderBy { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ææå
¥åºä»»å¡ç±»å |
| | | /// </summary> |
| | | public List<int> TaskInboundTypes { get; } |
| | | |
| | | /// <summary> |
| | | /// ææåºåºä»»å¡ç±»å |
| | | /// </summary> |
| | | public List<int> TaskOutboundTypes { get; } |
| | | |
| | | /// <summary> |
| | | /// ææç§»åºä»»å¡ç±»å |
| | | /// </summary> |
| | | public List<int> TaskRelocationboundTypes { get; } |
| | | |
| | | /// <summary> |
| | | /// ææå
¥åºä»»å¡ç¶æ |
| | | /// </summary> |
| | | public List<int> TaskInboundStates { get; } |
| | | |
| | | /// <summary> |
| | | /// ææåºåºä»»å¡ç¶æ |
| | | /// </summary> |
| | | public List<int> TaskOutboundStates { get; } |
| | | |
| | | /// <summary> |
| | | /// ææç§»åºä»»å¡ç¶æ |
| | | /// </summary> |
| | | public List<int> TaskRelocationboundStates { get; } |
| | | |
| | | |
| | | /// <summary> |
| | | /// æ¥æ¶MESä»»å¡ |
| | |
| | | /// <param name="taskNum">ä»»å¡å·</param> |
| | | /// <returns>è¿åå¤çç»æ</returns> |
| | | WebResponseContent RollbackTaskStatusToLast(int taskNum); |
| | | /// <summary> |
| | | /// AGVä»»å¡åé |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | WebResponseContent AgvSendTask(AgvTaskSendDTO taskModel, APIEnum SendTask = APIEnum.AgvSendTask); |
| | | |
| | | /// <summary> |
| | | /// æ´æ°ä»»å¡ä¿¡æ¯åæ·»å 任塿ç»è®°å½ |
| | | /// </summary> |
| | | /// <param name="task">ä»»å¡å对象å®ä¾(æªä¿®æ¹çæ°æ®å¯¹è±¡)</param> |
| | | /// <param name="taskStatus">ä¿®æ¹åçä»»å¡ç¶æ</param> |
| | | /// <param name="deviceCode">ä¿®æ¹åç设å¤ç¼å·</param> |
| | | /// <param name="sourceAddress">ä¿®æ¹åçèµ·å§å°å</param> |
| | | /// <param name="targetAddress">ä¿®æ¹åçç®æ å°å</param> |
| | | /// <param name="currentAddress">ä¿®æ¹åçå½åå°å</param> |
| | | /// <param name="nextAddress">ä¿®æ¹åçä¸ä¸å°å</param> |
| | | void UpdateTask(Dt_Task task, TaskAGVCarryStatusEnum taskStatus, string deviceCode = "", string sourceAddress = "", string targetAddress = "", string currentAddress = "", string nextAddress = "", string roadwayNo = ""); |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å®æé¢ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | WebResponseContent TaskCompleted(int taskNum); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Core.DB.Models; |
| | | |
| | | namespace WIDESEAWCS_Model.Models |
| | | { |
| | | [SugarTable(nameof(Dt_ApiInfo), "æ¥å£ä¿¡æ¯")] |
| | | public class Dt_ApiInfo : BaseEntity |
| | | { |
| | | /// <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 = false, Length = 200, ColumnDescription = "æ¥å£å°å")] |
| | | public string ApiAddress { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¯å¦å¯ç¨ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "æ¯å¦å¯ç¨")] |
| | | public int Enable { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "夿³¨")] |
| | | public string Remark { get; set; } |
| | | } |
| | | } |
| | |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Autofac.Core; |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; |
| | | using System.Reflection; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Information; |
| | | using System.Text; |
| | | using System.Text.RegularExpressions; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.APIEnum; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_DTO.AGV; |
| | | using WIDESEAWCS_Core.Enums; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_Core.LogHelper; |
| | | using WIDESEAWCS_DTO; |
| | | using WIDESEAWCS_DTO.Agv; |
| | | using WIDESEAWCS_DTO.TaskInfo; |
| | | 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_TaskInfoService; |
| | | using WIDESEAWCS_Tasks; |
| | | |
| | | namespace WIDESEAWCS_Server.Controllers.AGV |
| | | namespace WIDESEAWCS_Server.Controllers |
| | | { |
| | | [Route("api/AGV")] |
| | | [Route("api/[controller]")] |
| | | [ApiController] |
| | | public class AGVController : ControllerBase |
| | | { |
| | | private readonly ITaskRepository _taskRepository; |
| | | private readonly IDt_StationManagerRepository _stationMangerRepository; |
| | | private readonly ITaskService _taskService; |
| | | private readonly ITaskRepository _taskRepository; |
| | | private readonly IRouterRepository _routerRepository; |
| | | |
| | | public AGVController(ITaskRepository taskRepository,ITaskService taskService) |
| | | public AGVController(IDt_StationManagerRepository stationMangerRepository, ITaskService taskService, ITaskRepository taskRepository,IRouterRepository routerRepository) |
| | | { |
| | | _taskRepository = taskRepository; |
| | | _stationMangerRepository = stationMangerRepository; |
| | | _taskService = taskService; |
| | | _taskRepository = taskRepository; |
| | | _routerRepository = routerRepository; |
| | | } |
| | | /// <summary> |
| | | /// AGV任塿´æ° |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("Callback"), AllowAnonymous] |
| | | public WebResponseContent? Callback([FromBody]AgvStatusUpdateDTO agvUpdateDTO) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var task = _taskRepository.QueryFirst(x => (agvUpdateDTO.ContainerCode ?? "") == x.PalletCode); |
| | | switch (agvUpdateDTO.MissionStatus) |
| | | { |
| | | case nameof(AGVStatusEnum.PICKER_RECEIVE): |
| | | if (task == null) throw new Exception($"æªæ¾å°æç®±ã{agvUpdateDTO.ContainerCode}ãä»»å¡"); |
| | | _taskService.UpdateTask(task, TaskAGVCarryStatusEnum.AGV_CarryTakeFinish); |
| | | break; |
| | | case nameof(AGVStatusEnum.PICKER_SEND): |
| | | if (task == null) throw new Exception($"æªæ¾å°æç®±ã{agvUpdateDTO.ContainerCode}ãä»»å¡"); |
| | | _taskService.UpdateTask(task, TaskAGVCarryStatusEnum.AGV_CarryReleaseFinish); |
| | | break; |
| | | case nameof(AGVStatusEnum.COMPLETED): |
| | | if (task == null) throw new Exception($"æªæ¾å°æç®±ã{agvUpdateDTO.ContainerCode}ãä»»å¡"); |
| | | _taskService.TaskCompleted(task.TaskNum); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | List<object> data = new List<object>(); |
| | | |
| | | #region TaskInboundTypeEnum |
| | | { |
| | | Type type = typeof(TaskInboundTypeEnum); |
| | | List<int> enums = Enum.GetValues(typeof(TaskInboundTypeEnum)).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()); |
| | | 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 TaskAGVCarryTypeEnum |
| | | { |
| | | Type type = typeof(TaskAGVCarryTypeEnum); |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region TaskAcrossFloorTypeEnum |
| | | { |
| | | Type type = typeof(TaskAcrossFloorTypeEnum); |
| | | List<int> enums = Enum.GetValues(typeof(TaskAcrossFloorTypeEnum)).Cast<int>().ToList(); |
| | | int index = 0; |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(TaskAcrossFloorTypeEnum).GetField(((TaskAcrossFloorTypeEnum)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 |
| | | |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | | break; |
| | | case "taskState": |
| | | { |
| | | List<object> data = new List<object>(); |
| | | |
| | | #region TaskInStatusEnum |
| | | { |
| | | Type type = typeof(TaskInStatusEnum); |
| | | List<int> enums = Enum.GetValues(typeof(TaskInStatusEnum)).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()); |
| | | 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 TaskRelocationStatusEnum |
| | | { |
| | | Type type = typeof(TaskRelocationStatusEnum); |
| | | List<int> enums = Enum.GetValues(typeof(TaskRelocationStatusEnum)).Cast<int>().ToList(); |
| | | int index = 0; |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(TaskRelocationStatusEnum).GetField(((TaskRelocationStatusEnum)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 TaskAGVCarryStatusEnum |
| | | { |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region TaskAcrossFloorStatusEnum |
| | | { |
| | | Type type = typeof(TaskAcrossFloorStatusEnum); |
| | | List<int> enums = Enum.GetValues(typeof(TaskAcrossFloorStatusEnum)).Cast<int>().ToList(); |
| | | int index = 0; |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(TaskAcrossFloorStatusEnum).GetField(((TaskAcrossFloorStatusEnum)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 |
| | | |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using Autofac.Core; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Serialization; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Reflection.Metadata; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.Log; |
| | | using WIDESEAWCS_Common.APIEnum; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_DTO.Agv; |
| | | using WIDESEAWCS_DTO.TaskInfo; |
| | | using WIDESEAWCS_Model.Models; |
| | | |
| | | namespace WIDESEAWCS_TaskInfoService |
| | | { |
| | | public partial class TaskService |
| | | { |
| | | // å建ä¸ä¸ªä½¿ç¨å°é©¼å³°å½åæ³çåºåå设置 |
| | | JsonSerializerSettings settings = new JsonSerializerSettings |
| | | { |
| | | ContractResolver = new CamelCasePropertyNamesContractResolver() |
| | | }; |
| | | /// <summary> |
| | | /// AGVä»»å¡åé |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public WebResponseContent AgvSendTask(AgvTaskSendDTO taskModel, APIEnum SendTask = APIEnum.AgvSendTask) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | |
| | | string? apiAddress = _apiInfoRepository.QueryFirst(x => x.ApiCode == SendTask.ToString())?.ApiAddress; |
| | | if (string.IsNullOrEmpty(apiAddress)) throw new Exception($"æªæ¾å°åéAGV任塿¥å£,è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | string request = JsonConvert.SerializeObject(taskModel, settings); |
| | | string response = HttpHelper.Post(apiAddress, request); |
| | | WriteLog.Write_Log("AGVå
¥åºä»»å¡ä¸å", "åºåºä»»å¡ä¸åæ¥å£", "请æ±ä»»å¡", $"请æ±ï¼{request},åä¼ ï¼{response}"); |
| | | AgvResponseContent agvContent = response.DeserializeObject<AgvResponseContent>() ?? throw new Exception("AGVä»»å¡åéæªè¿åç»æ"); |
| | | if (agvContent.Success) |
| | | { |
| | | content.OK(); |
| | | } |
| | | else |
| | | { |
| | | content.Error(agvContent.Message); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | public WebResponseContent AgvCancelTask(AgvTaskCancelDTO taskModel, APIEnum SendTask = APIEnum.AgvTaskCancel) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | string? apiAddress = _apiInfoRepository.QueryFirst(x => x.ApiCode == SendTask.ToString())?.ApiAddress; |
| | | if (string.IsNullOrEmpty(apiAddress)) throw new Exception($"æªæ¾å°åéAGV任塿¥å£,è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | string request = JsonConvert.SerializeObject(taskModel, settings); |
| | | string response = HttpHelper.Post(apiAddress, request); |
| | | AgvResponseContent agvContent = response.DeserializeObject<AgvResponseContent>() ?? throw new Exception("AGVä»»å¡åéæªè¿åç»æ"); |
| | | if (agvContent.Success) |
| | | { |
| | | content.OK(); |
| | | } |
| | | else |
| | | { |
| | | content.Error(agvContent.Message); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | } |
| | | } |
| | |
| | | int taskNum = task.TaskNum; |
| | | int taskState = task.TaskState; |
| | | |
| | | if (!int.TryParse(Enum.Parse<TaskOutStatusEnum>(taskState.ToString()).ToString(), out int result)) |
| | | if (!int.TryParse(Enum.Parse<TaskAGVCarryStatusEnum>(taskState.ToString()).ToString(), out int result)) |
| | | { |
| | | 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) |
| | | if ((int)(TaskAGVCarryStatusEnum)result > (int)TaskAGVCarryStatusEnum.AGV_CarryFinish) |
| | | isNormal = false; |
| | | } |
| | | |
| | |
| | | int NewtaskNum = task.TaskNum; |
| | | int taskState = task.TaskState; |
| | | |
| | | if (!int.TryParse(Enum.Parse<TaskOutStatusEnum>(taskState.ToString()).ToString(), out int result)) |
| | | if (!int.TryParse(Enum.Parse<TaskAGVCarryStatusEnum>(taskState.ToString()).ToString(), out int result)) |
| | | { |
| | | 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) |
| | | if ((int)(TaskAGVCarryStatusEnum)result > (int)TaskAGVCarryStatusEnum.AGV_CarryFinish) |
| | | isNormal = false; |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | public void AddTaskExecuteDetail(List<int> taskNums, string description = "") |
| | | { |
| | | try |
| | | { |
| | | List<Dt_TaskExecuteDetail> taskExecuteDetails = new List<Dt_TaskExecuteDetail>(); |
| | | foreach (var item in taskNums) |
| | | { |
| | | bool isNormal = true; |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == item); |
| | | if (task == null) return; |
| | | int taskNum = task.TaskNum; |
| | | int taskState = task.TaskState; |
| | | |
| | | if (!int.TryParse(Enum.Parse<TaskOutStatusEnum>(taskState.ToString()).ToString(), out int result)) |
| | | { |
| | | 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() |
| | | { |
| | | IsManual = App.User.UserId > 0, |
| | | IsNormal = isNormal, |
| | | TaskNum = taskNum, |
| | | TaskId = task.TaskId, |
| | | TaskState = taskState, |
| | | Description = description, |
| | | CurrentAddress = task.CurrentAddress, |
| | | NextAddress = task.NextAddress, |
| | | }; |
| | | taskExecuteDetails.Add(taskExecuteDetail); |
| | | } |
| | | |
| | | BaseDal.AddData(taskExecuteDetails); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent GetDetailInfo(int taskNum) |
| | | { |
| | | WebResponseContent content = new(); |
| | |
| | | if (task != null) |
| | | { |
| | | |
| | | if (!int.TryParse(Enum.Parse<TaskOutboundTypeEnum>(task.TaskType.ToString()).ToString(), out int result)) |
| | | if (!int.TryParse(Enum.Parse<TaskAGVCarryTypeEnum>(task.TaskType.ToString()).ToString(), out int result)) |
| | | { |
| | | steps = Enum.GetValues(typeof(TaskOutStatusEnum)).Cast<int>().Where(x => x <= (int)TaskOutStatusEnum.OutFinish).ToList(); |
| | | steps = Enum.GetValues(typeof(TaskAGVCarryStatusEnum)).Cast<int>().Where(x => x <= (int)TaskAGVCarryStatusEnum.AGV_CarryFinish).ToList(); |
| | | |
| | | foreach (var item in steps) |
| | | { |
| | | object obj; |
| | | FieldInfo? fieldInfo = typeof(TaskOutStatusEnum).GetField(((TaskOutStatusEnum)item).ToString()); |
| | | FieldInfo? fieldInfo = typeof(TaskAGVCarryStatusEnum).GetField(((TaskAGVCarryStatusEnum)item).ToString()); |
| | | DescriptionAttribute? descriptionAttribute = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | if (descriptionAttribute != null) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | obj = new { title = item, description = ((TaskOutStatusEnum)item).ToString() }; |
| | | obj = new { title = item, description = ((TaskAGVCarryStatusEnum)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)) |
| | | { |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; |
| | | using SqlSugar; |
| | | using System.ComponentModel; |
| | | using System.Diagnostics.CodeAnalysis; |
| | | using System.Reflection; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.Log; |
| | | using WIDESEAWCS_BasicInfoRepository; |
| | | using WIDESEAWCS_BasicInfoService; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.APIEnum; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.BaseRepository; |
| | | using WIDESEAWCS_Core.BaseServices; |
| | | using WIDESEAWCS_Core.Enums; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_Core.LogHelper; |
| | | using WIDESEAWCS_DTO.MES; |
| | | using WIDESEAWCS_DTO.TaskInfo; |
| | | using WIDESEAWCS_DTO.WMS; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_IBasicInfoService; |
| | | using WIDESEAWCS_ISystemServices; |
| | |
| | | private readonly IDt_StationManagerRepository _stationManagerRepository; |
| | | private readonly IRouterRepository _routerRepository; |
| | | private readonly ITask_HtyRepository _taskHtyRepository; |
| | | private readonly IApiInfoRepository _apiInfoRepository; |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | |
| | | private Dictionary<string, OrderByType> _taskOrderBy = new() |
| | | { |
| | |
| | | |
| | | |
| | | #region è·åææä»»å¡ç±»åãç¶æ |
| | | public List<int> TaskInboundTypes => typeof(TaskInboundTypeEnum).GetEnumIndexList(); |
| | | |
| | | public List<int> TaskOutboundTypes => typeof(TaskOutboundTypeEnum).GetEnumIndexList(); |
| | | public List<int> TaskRelocationboundTypes => typeof(TaskRelocationTypeEnum).GetEnumIndexList(); |
| | | |
| | | public List<int> TaskInboundStates => typeof(TaskInStatusEnum).GetEnumIndexList(); |
| | | |
| | | public List<int> TaskOutboundStates => typeof(TaskOutStatusEnum).GetEnumIndexList(); |
| | | public List<int> TaskRelocationboundStates => typeof(TaskRelocationStatusEnum).GetEnumIndexList(); |
| | | |
| | | #endregion è·åææä»»å¡ç±»åãç¶æ |
| | | |
| | | |
| | | public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper, ISys_ConfigService sys_ConfigService, IDt_StationManagerService stationManagerService, IDt_StationManagerRepository stationManagerRepository, IRouterRepository routerRepository, ITask_HtyRepository htyRepository) : base(BaseDal) |
| | | public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper, ISys_ConfigService sys_ConfigService, IDt_StationManagerService stationManagerService, IDt_StationManagerRepository stationManagerRepository, IRouterRepository routerRepository, ITask_HtyRepository htyRepository, IApiInfoRepository apiInfoRepository,IUnitOfWorkManage unitOfWorkManage) : base(BaseDal) |
| | | { |
| | | _routerService = routerService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | |
| | | _stationManagerRepository = stationManagerRepository; |
| | | _routerRepository = routerRepository; |
| | | _taskHtyRepository = htyRepository; |
| | | _apiInfoRepository = apiInfoRepository; |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | var task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); |
| | | if (task == null) return WebResponseContent.Instance.Error($"æªæ¾å°è¯¥ä»»å¡ä¿¡æ¯,ä»»å¡å·:ã{taskNum}ã"); |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.CarryGroup) |
| | | { |
| | | task.TaskState = (int)TaskOutStatusEnum.OutPending; |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | | task.TaskState = (int)TaskInStatusEnum.InPending; |
| | | task.TaskState = (int)TaskAGVCarryStatusEnum.AGV_CarryException; |
| | | } |
| | | task.ExceptionMessage = message; |
| | | task.ModifyDate = DateTime.Now; |
| | |
| | | int oldState = task.TaskState; |
| | | if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.OutbondGroup) |
| | | { |
| | | int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskOutStatusEnum>(); |
| | | int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskAGVCarryStatusEnum>(); |
| | | |
| | | task.TaskState = nextStatus; |
| | | |
| | | if (task.TaskState == (int)TaskOutStatusEnum.AGV_OutFinish) |
| | | if (task.TaskState == (int)TaskAGVCarryStatusEnum.AGV_CarryFinish) |
| | | { |
| | | |
| | | task.ModifyDate = DateTime.Now; |
| | | task.Modifier = "System"; |
| | | |
| | | Dt_Task_Hty task_Hty = _mapper.Map<Dt_Task_Hty>(task); |
| | | task_Hty.TaskId = 0; |
| | | |
| | | BaseDal.DeleteData(task); |
| | | _taskHtyRepository.AddData(task_Hty); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? OperateTypeEnum.äººå·¥å®æ : OperateTypeEnum.èªå¨å®æ); |
| | | } |
| | | } |
| | | else if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.InboundGroup) |
| | | { |
| | | int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskInStatusEnum>(); |
| | | task.TaskState = nextStatus; |
| | | |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | var 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)TaskAGVCarryStatusEnum.AGV_CarryException && task.TaskState != (int)TaskAGVCarryStatusEnum.AGV_CarryException) |
| | | { |
| | | 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; |
| | | } |
| | | throw new Exception($"æªæ¾å°ä»»å¡å·{taskNum}æ¢å¤ç¶æ"); |
| | | } |
| | | |
| | | task.ExceptionMessage = string.Empty; |
| | |
| | | |
| | | |
| | | #endregion éåæ¹æ³ |
| | | |
| | | /// <summary> |
| | | /// æ´æ°ä»»å¡ä¿¡æ¯åæ·»å 任塿ç»è®°å½ |
| | | /// </summary> |
| | | /// <param name="task">ä»»å¡å对象å®ä¾(æªä¿®æ¹çæ°æ®å¯¹è±¡)</param> |
| | | /// <param name="taskStatus">ä¿®æ¹åçä»»å¡ç¶æ</param> |
| | | /// <param name="deviceCode">ä¿®æ¹åç设å¤ç¼å·</param> |
| | | /// <param name="sourceAddress">ä¿®æ¹åçèµ·å§å°å</param> |
| | | /// <param name="targetAddress">ä¿®æ¹åçç®æ å°å</param> |
| | | /// <param name="currentAddress">ä¿®æ¹åçå½åå°å</param> |
| | | /// <param name="nextAddress">ä¿®æ¹åçä¸ä¸å°å</param> |
| | | public void UpdateTask(Dt_Task task, TaskAGVCarryStatusEnum taskStatus, string deviceCode = "", string sourceAddress = "", string targetAddress = "", string currentAddress = "", string nextAddress = "", string roadwayNo = "") |
| | | { |
| | | StringBuilder stringBuilder = new StringBuilder(App.User?.UserId == 0 ? $"ç³»ç»èªå¨æµç¨" : "人工æå¨æµç¨"); |
| | | if (task.SourceAddress != sourceAddress && !string.IsNullOrEmpty(sourceAddress)) |
| | | { |
| | | stringBuilder.Append($",èµ·å§å°åç±{task.SourceAddress}åæ´ä¸º{sourceAddress}"); |
| | | task.SourceAddress = sourceAddress; |
| | | } |
| | | if (task.TargetAddress != targetAddress && !string.IsNullOrEmpty(targetAddress)) |
| | | { |
| | | stringBuilder.Append($",ç®æ å°åç±{task.TargetAddress}åæ´ä¸º{targetAddress}"); |
| | | task.TargetAddress = targetAddress; |
| | | } |
| | | if (task.CurrentAddress != currentAddress && !string.IsNullOrEmpty(currentAddress)) |
| | | { |
| | | stringBuilder.Append($",å½åä½ç½®ç±{task.CurrentAddress}åæ´ä¸º{currentAddress}"); |
| | | task.CurrentAddress = currentAddress; |
| | | } |
| | | if (task.NextAddress != nextAddress && !string.IsNullOrEmpty(nextAddress)) |
| | | { |
| | | stringBuilder.Append($",ä¸ä¸ä½ç½®ç±{task.NextAddress}åæ´ä¸º{nextAddress}"); |
| | | task.NextAddress = nextAddress; |
| | | } |
| | | if (task.Roadway != roadwayNo && !string.IsNullOrEmpty(roadwayNo)) |
| | | { |
| | | stringBuilder.Append($",å··éå·ç±{task.Roadway}åæ´ä¸º{roadwayNo}"); |
| | | task.Roadway = roadwayNo; |
| | | } |
| | | if (task.TaskState != taskStatus.ObjToInt()) |
| | | { |
| | | string newStatus = $"{taskStatus}"; |
| | | try |
| | | { |
| | | List<int> enums = Enum.GetValues(typeof(TaskAGVCarryStatusEnum)).Cast<int>().ToList(); |
| | | FieldInfo? fieldInfo = typeof(TaskAGVCarryStatusEnum).GetField((taskStatus).ToString()); |
| | | if (fieldInfo != null) |
| | | { |
| | | DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | if (description != null) |
| | | { |
| | | newStatus = $"{description.Description}({taskStatus})"; |
| | | } |
| | | } |
| | | } |
| | | catch { } |
| | | string oldStatus = $"{task.TaskState}"; |
| | | try |
| | | { |
| | | FieldInfo? fieldInfo2 = typeof(RouterInOutType).GetField(((TaskAGVCarryStatusEnum)task.TaskState).ToString()); |
| | | if (fieldInfo2 != null) |
| | | { |
| | | DescriptionAttribute? description2 = fieldInfo2.GetCustomAttribute<DescriptionAttribute>(); |
| | | if (description2 != null) |
| | | { |
| | | oldStatus = $"{description2.Description}({task.TaskState})"; |
| | | } |
| | | } |
| | | } |
| | | catch { } |
| | | stringBuilder.Append($",ä»»å¡ç¶æç±{oldStatus}åæ´ä¸º{newStatus}"); |
| | | |
| | | task.TaskState = taskStatus.ObjToInt(); |
| | | } |
| | | BaseDal.UpdateData(task); |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, stringBuilder.ToString()); |
| | | } |
| | | |
| | | // å¨ç±»ä¸æ·»å éæé对象 |
| | | private static readonly object _taskCompleteLock = new object(); |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å®æ |
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent TaskCompleted(int taskNum) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | |
| | | // 使ç¨éç¡®ä¿åä¸ä»»å¡ä¸ä¼å¹¶åå¤ç |
| | | lock (_taskCompleteLock) |
| | | { |
| | | try |
| | | { |
| | | WriteLog.Write_Log("ä»»å¡å®æ", "ä»»å¡å®ææ¥å£", "ä»»å¡å·", $"ä»»å¡ï¼{taskNum}"); |
| | | |
| | | // 忬¡æ¥è¯¢ä»»å¡ç¶æï¼é²æ¢å¨éçå¾
æé´ä»»å¡ç¶æå·²æ¹å |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); |
| | | if (task == null) |
| | | { |
| | | return content.Error($"ä»»å¡{taskNum}ä¸åå¨"); |
| | | } |
| | | //ä»»å¡å®æé»è¾ |
| | | _unitOfWorkManage.BeginTran(); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | content.OK("ä»»å¡å®æ"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.Log; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.APIEnum; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_DTO.Agv; |
| | | using WIDESEAWCS_DTO.TaskInfo; |
| | | using WIDESEAWCS_DTO.WMS; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_ISystemServices; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | |
| | | private readonly ITaskRepository _taskRepository; |
| | | private readonly ITaskService _taskService; |
| | | private readonly ISys_ConfigService _sys_ConfigService; |
| | | public CommonAGVJob(ITaskRepository taskRepository,ITaskService taskService,ISys_ConfigService configService) |
| | | private readonly IDt_StationManagerRepository _stationManagerRepository; |
| | | public CommonAGVJob(ITaskRepository taskRepository,ITaskService taskService,ISys_ConfigService configService,IDt_StationManagerRepository stationManagerRepository) |
| | | { |
| | | _taskRepository = taskRepository; |
| | | _taskService = taskService; |
| | | _sys_ConfigService = configService; |
| | | _stationManagerRepository = stationManagerRepository; |
| | | } |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | | { |
| | | var newTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => (x.TaskState == TaskAGVCarryStatusEnum.AGV_CarryNew.ObjToInt())).ToList().OrderBy(x => x.Grade).ThenBy(x => x.TaskNum).ToList(); |
| | | #region ä»»å¡ä¸å |
| | | if (newTasks.Count > 0) |
| | | { |
| | | WriteLog.Write_Log("AGVä»»å¡ä¸å", "ä»»å¡ä¸åæ¥å£", "æ·»å ä»»å¡", $"ä»»å¡ï¼{newTasks.ToJson()}"); |
| | | try |
| | | { |
| | | AgvTaskSendDTO agvTaskSend = new AgvTaskSendDTO() |
| | | { |
| | | MissionData = new List<MissionDataItem>() |
| | | }; |
| | | string taskGroupId = Guid.NewGuid().ToString().Replace("-", ""); |
| | | |
| | | foreach (var task in newTasks) |
| | | { |
| | | //è·åç®æ ç¹è´§ä½ |
| | | Dt_StationManager stationManagerStart = _stationManagerRepository.QueryFirst(x => x.stationLocation == task.CurrentAddress); |
| | | //è·åæ£éåºåºç«å° |
| | | Dt_StationManager stationManagerEnd = _stationManagerRepository.QueryFirst(x => x.stationLocation == task.NextAddress); |
| | | |
| | | if (stationManagerStart == null || stationManagerStart == null) throw new Exception($"æªæ¾å°ä»»å¡å·${task.TaskNum}èµ·å§ç¹{task.CurrentAddress}æç®æ ç¹{task.NextAddress}ä½ç½®ä¿¡æ¯"); |
| | | agvTaskSend.RequestId = taskGroupId; |
| | | agvTaskSend.MissionCode = task.TaskNum.ToString(); |
| | | agvTaskSend.ViewBoardType = "W01"; |
| | | //æç®±åæ¬è¿ä»»å¡ |
| | | MissionDataItem missionDataItem = new MissionDataItem() |
| | | { |
| | | Sequence = task.TaskNum, |
| | | BinCode = task.PalletCode, |
| | | StartPosition = stationManagerStart.stationLocation, |
| | | EndPosition = stationManagerEnd.stationLocation, |
| | | TakeActionConfirm = false, |
| | | TakeActionInform = false, |
| | | PutActionConfirm = true, |
| | | PutActionInform = true, |
| | | }; |
| | | agvTaskSend.MissionData.Add(missionDataItem); |
| | | } |
| | | if (newTasks.OrderByDescending(x => x.Grade).FirstOrDefault()?.Grade == 0) |
| | | { |
| | | agvTaskSend.Priority = 99; |
| | | } |
| | | else |
| | | { |
| | | agvTaskSend.Priority = 99 - newTasks.OrderByDescending(x => x.Grade).FirstOrDefault().Grade; |
| | | } |
| | | //åéAGVä»»å¡ |
| | | WebResponseContent content = _taskService.AgvSendTask(agvTaskSend, APIEnum.AgvSendTask); |
| | | if (!content.Status) |
| | | throw new Exception(content.Message); |
| | | newTasks.ForEach(x => |
| | | { |
| | | x.Dispatchertime = DateTime.Now; |
| | | x.TaskState = TaskAGVCarryStatusEnum.AGV_CarryExecuting.ObjToInt(); |
| | | }); |
| | | _taskService.UpdateData(newTasks); |
| | | Thread.Sleep(500); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | newTasks.ForEach(x => |
| | | { |
| | | x.TaskState = TaskAGVCarryStatusEnum.AGV_CarryException.ObjToInt(); |
| | | x.ExceptionMessage = ex.Message; |
| | | }); |
| | | _taskService.UpdateData(newTasks); |
| | | } |
| | | |
| | | } |
| | | #endregion |
| | | return Task.CompletedTask; |
| | | } |
| | | |