已添加8个文件
已重命名2个文件
已删除1个文件
已修改34个文件
| | |
| | | { |
| | | return QueryData(x => x.LocationCode, x => x.WarehouseId == warehouseId && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt() && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()).Distinct().ToList(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åæç®±å¯¹åºåºåºè´§ä½ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public List<Dt_LocationInfo> GetCanOut(List<string> strings) |
| | | { |
| | | return QueryData(x => strings.Contains(x.PalletCode)).ToList(); |
| | | } |
| | | } |
| | | } |
| | |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_DTO.Basic; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.WareHouseEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.BaseRepository; |
| | | using WIDESEAWCS_Core.BaseServices; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_Core.Utilities; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_IBasicInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | |
| | | namespace WIDESEAWCS_BasicInfoService |
| | | { |
| | | public class LocationCache |
| | | { |
| | | public string LocationCode { get; set; } |
| | | |
| | | public DateTime DateTime { get; set; } |
| | | } |
| | | public partial class LocationInfoService : ServiceBase<Dt_LocationInfo, ILocationInfoRepository>, ILocationInfoService |
| | | { |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | |
| | | { |
| | | return LocationDisableStatus(new int[] { key }); |
| | | } |
| | | |
| | | private readonly static object _locker = new object(); |
| | | private static List<LocationCache> locationCaches = new List<LocationCache>(); |
| | | /// <summary> |
| | | /// åé
è´§ä½ |
| | | /// </summary> |
| | | public Dt_LocationInfo? AssignLocation(string roadwayNo, int palletType, int warehouseId) |
| | | public Dt_LocationInfo? AssignLocation() |
| | | { |
| | | return new Dt_LocationInfo(); |
| | | lock (_locker) |
| | | { |
| | | List<LocationCache> removeItems = locationCaches.Where(x => (DateTime.Now - x.DateTime).TotalMinutes > 5).ToList();//æ¥è¯¢æ·»å éæåéè¶
è¿5åéçè´§ä½ |
| | | int count = removeItems.Count; |
| | | for (int i = 0; i < count; i++) |
| | | { |
| | | locationCaches.Remove(removeItems[i]);//ç§»é¤æ¥è¯¢æ·»å éæåéè¶
è¿5åéçè´§ä½ |
| | | } |
| | | |
| | | List<string> lockLocations = locationCaches.Select(x => x.LocationCode).ToList(); |
| | | |
| | | Dictionary<string, OrderByType> orderBy = new Dictionary<string, OrderByType>() |
| | | { |
| | | { nameof(Dt_LocationInfo.Row),OrderByType.Asc }, |
| | | { nameof(Dt_LocationInfo.Layer),OrderByType.Asc }, |
| | | { nameof(Dt_LocationInfo.Columns),OrderByType.Desc }, |
| | | }; |
| | | |
| | | Dt_LocationInfo locationInfo = BaseDal.QueryFirst(x => x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.EnableStatus != EnableStatusEnum.Disable.ObjToInt() && !lockLocations.Contains(x.LocationCode), orderBy);//æ¥è¯¢ç©ºè´§ä½ä¿¡æ¯å¹¶æé¤5åéå
åé
çè´§ä½,æ ¹æ®å±ãåãæ·±åº¦ãè¡æåº |
| | | if (locationInfo!=null) |
| | | { |
| | | LocationCache locationCache = new LocationCache() |
| | | { |
| | | LocationCode = locationInfo.LocationCode, |
| | | DateTime = DateTime.Now, |
| | | }; |
| | | locationCaches.Add(locationCache); |
| | | } |
| | | return locationInfo; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åå§åè´§ä½ |
| | | /// </summary> |
| | | /// <param name="initializationLocationDTO"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent InitializationLocation(InitializationLocationDTO initializationLocationDTO) |
| | | { |
| | | try |
| | | { |
| | | List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); |
| | | for (int i = 0; i < initializationLocationDTO.MaxRow; i++) |
| | | { |
| | | for (int j = 0; j < initializationLocationDTO.MaxColumn; j++) |
| | | { |
| | | for (int k = 0; k < initializationLocationDTO.MaxLayer; k++) |
| | | { |
| | | Dt_LocationInfo locationInfo = new Dt_LocationInfo() |
| | | { |
| | | WarehouseId = 0, |
| | | Columns = j + 1, |
| | | EnableStatus = EnableStatusEnum.Normal.ObjToInt(), |
| | | Layer = k + 1, |
| | | LocationStatus = LocationStatusEnum.Free.ObjToInt(), |
| | | RoadwayNo = $"{initializationLocationDTO.Roadway}", |
| | | Row = i + 1, |
| | | }; |
| | | locationInfo.LocationCode = $"{locationInfo.RoadwayNo}-{locationInfo.Row.ToString().PadLeft(3, '0')}-{locationInfo.Columns.ToString().PadLeft(3, '0')}-{locationInfo.Layer.ToString().PadLeft(3, '0')}"; |
| | | locationInfo.LocationName = $"{locationInfo.RoadwayNo}å··é{locationInfo.Row.ToString().PadLeft(3, '0')}è¡{locationInfo.Columns.ToString().PadLeft(3, '0')}å{locationInfo.Layer.ToString().PadLeft(3, '0')}å±"; |
| | | int point = 0; |
| | | if (locationInfo.Row%2==0) |
| | | { |
| | | point = locationInfo.Row / 2; |
| | | } |
| | | else |
| | | { |
| | | if (locationInfo.Row==1) |
| | | { |
| | | point = 1; |
| | | } |
| | | else |
| | | { |
| | | point = (locationInfo.Row / 2)+1; |
| | | } |
| | | } |
| | | locationInfo.AgvPoint = $"{point.ToString().PadLeft(2, '0')}-{locationInfo.Columns.ToString().PadLeft(2, '0')}"; |
| | | locationInfos.Add(locationInfo); |
| | | } |
| | | } |
| | | } |
| | | BaseDal.AddData(locationInfos); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | [Description("AGVåé任塿¥å£")] |
| | | AgvSendTask, |
| | | /// <summary> |
| | | /// AGV任塿¾è¡æ¥å£ |
| | | /// </summary> |
| | | [Description("AGV任塿¾è¡æ¥å£")] |
| | | AgvTaskFlow, |
| | | /// <summary> |
| | | /// WMSå
¥åºåé¦å®æ |
| | | /// </summary> |
| | | [Description("WMSå
¥åºåé¦å®æ")] |
| | | WMSInBoundBack, |
| | | /// <summary> |
| | | /// WMSæç®±å°è¾¾æ£éä½ä¸æ¥ |
| | | /// </summary> |
| | | [Description("WMSæç®±å°è¾¾æ£éä½ä¸æ¥")] |
| | | WMSPickArrivedUp, |
| | | } |
| | | } |
| | |
| | | { |
| | | public enum StationOccupiedEnum |
| | | { |
| | | |
| | | None, |
| | | Sure |
| | | } |
| | |
| | | /// åºå
¥åºç«å° |
| | | /// </summary> |
| | | StationType_InboundAndOutbound = 3, |
| | | |
| | | /// <summary> |
| | | /// åºå
¥åºå£ |
| | | /// </summary> |
| | | StationType_InStartAndOutEnd = 33, |
| | | |
| | | /// <summary> |
| | | /// å ç嫿ç«å° |
| | | /// </summary> |
| | | StationType_StackingPlates = 91, |
| | | } |
| | | } |
| ÎļþÃû´Ó ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_DTO/StackerCarneTaskDTO.cs ÐÞ¸Ä |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEAWCS_DTO |
| | | namespace WIDESEAWCS_Common.TaskEnum |
| | | { |
| | | public class StackerCarneTaskDTO |
| | | public enum SequenceEnum |
| | | { |
| | | |
| | | SeqTaskNum |
| | | } |
| | | } |
| | |
| | | New = 100, |
| | | |
| | | /// <summary> |
| | | /// è¾é线æ§è¡ä¸ |
| | | /// </summary> |
| | | [Description("è¾é线æ§è¡ä¸")] |
| | | CL_Executing = 210, |
| | | |
| | | /// <summary> |
| | | /// AGVå¾
æ§è¡ |
| | | /// </summary> |
| | | [Description("AGVå¾
æ§è¡")] |
| | |
| | | /// </summary> |
| | | [Description("AGVåè´§å®æ")] |
| | | AGV_TakeFinish = 320, |
| | | |
| | | /// <summary> |
| | | /// AGV宿 |
| | | /// </summary> |
| | | [Description("AGV宿")] |
| | | AGV_Finish = 330, |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å®æ |
| | |
| | | /// </summary> |
| | | [Description("ä»»å¡å¼å¸¸")] |
| | | Exception = 990, |
| | | |
| | | } |
| | | /// <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("å¼å§ç§»å¨")] |
| | | MOVE_BEGIN, |
| | | /// <summary> |
| | | /// æ ç®± å æ å® æ |
| | | /// </summary> |
| | | [Description("æ ç®± å æ å® æ")] |
| | | PICKER_RECEIVE, |
| | | /// <summary> |
| | | /// æ ç®± ä¸ æ å® æ |
| | | /// </summary> |
| | | [Description("æ ç®± ä¸ æ å® æ")] |
| | | PICKER_SEND, |
| | | /// <summary> |
| | | /// ä»»å¡å®æ |
| | | /// </summary> |
| | | [Description("ä»»å¡å®æ")] |
| | | COMPLETED, |
| | | /// <summary> |
| | | /// ä»»å¡åæ¶å®æ |
| | | /// </summary> |
| | | [Description("ä»»å¡åæ¶å®æ")] |
| | | CANCELED, |
| | | /// <summary> |
| | | /// åè¦ |
| | | /// </summary> |
| | | [Description("åè¦")] |
| | | WARNING, |
| | | } |
| | | } |
| | |
| | | public enum TaskTypeEnum |
| | | { |
| | | /// <summary> |
| | | /// 颿åºåº |
| | | /// åºåº |
| | | /// </summary> |
| | | [Description("颿åºåº")] |
| | | [Description("åºåº")] |
| | | Outbound = 100, |
| | | |
| | | /// <summary> |
| | | /// çç¹åºåº |
| | | /// å
¥åº |
| | | /// </summary> |
| | | [Description("çç¹åºåº")] |
| | | OutInventory = 110, |
| | | [Description("å
¥åº")] |
| | | Inbound = 500, |
| | | |
| | | /// <summary> |
| | | /// 忣åºåº |
| | | /// </summary> |
| | | [Description("忣åºåº")] |
| | | OutPick = 120, |
| | | |
| | | /// <summary> |
| | | /// æå空æåºåº |
| | | /// </summary> |
| | | [Description("æå空æåºåº")] |
| | | OutEmpty = 130, |
| | | |
| | | /// <summary> |
| | | /// æååºåº |
| | | /// </summary> |
| | | [Description("æååºåº")] |
| | | OutProduct = 230, |
| | | |
| | | /// <summary> |
| | | /// åæèååºåº |
| | | /// </summary> |
| | | [Description("åæèååºåº")] |
| | | OldYLOutbound = 300, |
| | | |
| | | /// <summary> |
| | | /// åæå°å·åºåº |
| | | /// </summary> |
| | | [Description("åæå°å·åºåº")] |
| | | PrintYLOutbound = 310, |
| | | |
| | | /// <summary> |
| | | /// åæçº¸è¢å¶è¢ä¾æ |
| | | /// </summary> |
| | | [Description("åæçº¸è¢å¶è¢ä¾æ")] |
| | | PaperYLOutZDGL = 330, |
| | | |
| | | /// <summary> |
| | | /// è¾
ææ çººå¸åºåº |
| | | /// </summary> |
| | | [Description("è¾
ææ çººå¸åºåº")] |
| | | OutWFB = 350, |
| | | |
| | | /// <summary> |
| | | /// äºæ¥¼çº¸ç®±ä¾æ |
| | | /// </summary> |
| | | [Description("äºæ¥¼çº¸ç®±ä¾æ")] |
| | | OutCarton = 360, |
| | | |
| | | /// <summary> |
| | | /// æ çººå¸æ·èåºåº |
| | | /// </summary> |
| | | [Description("æ çººå¸æ·èåºåº")] |
| | | OutWFBLM = 370, |
| | | |
| | | /// <summary> |
| | | /// çº¸å¼ æ·èåºåº |
| | | /// </summary> |
| | | [Description("çº¸å¼ æ·èåºåº")] |
| | | OutPaperLM = 380, |
| | | |
| | | /// <summary> |
| | | /// å²ååºåºåº |
| | | /// </summary> |
| | | [Description("å²ååºåºåº")] |
| | | OutChongQie = 390, |
| | | |
| | | /// <summary> |
| | | /// 模ååºåºåº |
| | | /// </summary> |
| | | [Description("模ååºåºåº")] |
| | | OutMoQie = 400, |
| | | |
| | | /// <summary> |
| | | /// åååºåºåº |
| | | /// </summary> |
| | | [Description("åååºåºåº")] |
| | | OutFenQie = 410, |
| | | |
| | | /// <summary> |
| | | /// æ 纺å¸å¶è¢ä¾æ |
| | | /// </summary> |
| | | [Description("æ 纺è¢å¶è¢ä¾æ")] |
| | | OutWFBGL = 420, |
| | | |
| | | /// <summary> |
| | | /// éè´å
¥åº |
| | | /// </summary> |
| | | [Description("éè´å
¥åº")] |
| | | Inbound = 510, |
| | | |
| | | /// <summary> |
| | | /// çç¹å
¥åº |
| | | /// </summary> |
| | | [Description("çç¹å
¥åº")] |
| | | InInventory = 520, |
| | | |
| | | /// <summary> |
| | | /// 忣å
¥åº |
| | | /// </summary> |
| | | [Description("忣å
¥åº")] |
| | | InPick = 530, |
| | | |
| | | /// <summary> |
| | | /// æåå
¥åº |
| | | /// </summary> |
| | | [Description("æåå
¥åº")] |
| | | InProduct = 610, |
| | | |
| | | /// <summary> |
| | | /// æå空æååº |
| | | /// </summary> |
| | | [Description("æå空æååº")] |
| | | EmptyProductBack = 630, |
| | | |
| | | /// <summary> |
| | | /// åæå°å·åæåå
¥åº |
| | | /// </summary> |
| | | [Description("åæå°å·åæåå
¥åº")] |
| | | PrintYLInbound = 710, |
| | | |
| | | /// <summary> |
| | | /// åæå°å·ä½æéåº |
| | | /// </summary> |
| | | [Description("åæå°å·ä½æéåº")] |
| | | PrintYLBackInbound = 720, |
| | | |
| | | /// <summary> |
| | | /// åæå°å·ä½æéåº |
| | | /// </summary> |
| | | [Description("åæçº¸è¢ä½æéåº")] |
| | | PaperYLBackInbound = 730, |
| | | |
| | | /// <summary> |
| | | /// åæèåéåº |
| | | /// </summary> |
| | | [Description("åæèåéåº")] |
| | | PaperOldYLBackInbound = 740, |
| | | |
| | | /// <summary> |
| | | /// å··éå
ç§»åº |
| | | /// </summary> |
| | | [Description("å··éå
ç§»åº")] |
| | | Relocation = 900 |
| | | |
| | | ///// <summary> |
| | | ///// å··éå
ç§»åº |
| | | ///// </summary> |
| | | //[Description("å··éå
ç§»åº")] |
| | | //Relocation = 900 |
| | | } |
| | | |
| | | } |
| | |
| | | { |
| | | /// <summary> |
| | | /// ä»åº |
| | | /// HA57 = æ·®å®äºå - æ¿æä»<br/> |
| | | /// HA58 = æ·®å®äºå - PPä»<br/> |
| | | /// HA60 = æ·®å®äºå - è¾
æä»<br/> |
| | | /// HA64 = æ·®å®äºå - æµè¯æ¶ä»<br/> |
| | | /// HA71 = æ·®å®äºå - æåä»<br/> |
| | | /// HA72 = æ·®å®äºå - å°¾æ°ä»<br/> |
| | | /// HA73 = æ·®å®äºå - ç åä»<br/> |
| | | /// HA101 = æ·®å®äºå - æåä»å¹³åº<br/> |
| | | /// HA152 = æ·®å®äºå - å¹²èä»<br/> |
| | | /// HA153 = æ·®å®äºå - 油墨ä»<br/> |
| | | /// </summary> |
| | | public enum WarehouseEnum |
| | | { |
| | | /// <summary> |
| | | /// æ¿æä» |
| | | /// </summary> |
| | | [Description("æ¿æä»")] |
| | | HA57, |
| | | /// <summary> |
| | | /// PPä» |
| | | /// </summary> |
| | | [Description("PPä»")] |
| | | HA58, |
| | | /// <summary> |
| | | /// è¾
æä» |
| | | /// </summary> |
| | | [Description("è¾
æä»")] |
| | | HA60, |
| | | /// <summary> |
| | | /// æµè¯æ¶ä» |
| | | /// </summary> |
| | | [Description("æµè¯æ¶ä»")] |
| | | HA64, |
| | | /// <summary> |
| | | /// æåä» |
| | | /// </summary> |
| | | [Description("æåä»")] |
| | | HA71, |
| | | /// <summary> |
| | | /// å°¾æ°ä» |
| | | /// </summary> |
| | | [Description("å°¾æ°ä»")] |
| | | HA72, |
| | | /// <summary> |
| | | /// ç åä» |
| | | /// </summary> |
| | | [Description("ç åä»")] |
| | | HA73, |
| | | /// <summary> |
| | | /// æåä»å¹³åº |
| | | /// </summary> |
| | | [Description("æåä»å¹³åº")] |
| | | HA101, |
| | | /// <summary> |
| | | /// å¹²èä» |
| | | /// </summary> |
| | | [Description("å¹²èä»")] |
| | | HA152, |
| | | /// <summary> |
| | | /// æ²¹å¢¨ä» |
| | | /// </summary> |
| | | [Description("油墨ä»")] |
| | | HA153 |
| | | } |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_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 string ReqCode { get; set; } |
| | | /// <summary> |
| | | /// èªå®ä¹è¿åï¼è¿åä»»å¡åå·ï¼ |
| | | /// </summary> |
| | | public string Data { get; set; } |
| | | 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 AgvTaskFlowDTO |
| | | { |
| | | /// <summary> |
| | | /// 请æ±ID |
| | | /// </summary> |
| | | public string RequestId { get; set; } |
| | | /// <summary> |
| | | /// æ§è¡ä»»å¡çæç®±å· |
| | | /// </summary> |
| | | public string ContainerCode { get; set; } |
| | | /// <summary> |
| | | /// å½åæ§è¡ä»»å¡å· |
| | | /// </summary> |
| | | public string MissionCode { get; set; } |
| | | /// <summary> |
| | | /// å½åæ§è¡ä½ä¸çèç¹ |
| | | /// </summary> |
| | | public string Position { get; set; } |
| | | } |
| | | } |
| | |
| | | |
| | | 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 SysToken { get; set; } |
| | | public string OrgId { get; set; } = "HF"; |
| | | /// <summary> |
| | | /// 任塿¨¡ç |
| | | /// è¯·æ± id |
| | | /// </summary> |
| | | public string TaskCode { get; set; } = "DUIGAO1"; |
| | | public string RequestId { get; set; } |
| | | /// <summary> |
| | | /// æ¥æ¶ä»»å¡ |
| | | /// ä»»å¡ç¼ç |
| | | /// </summary> |
| | | public string ReceiveTaskID { get; set; } |
| | | public string MissionCode { get; set; } |
| | | /// <summary> |
| | | /// â»è¾ç¼ç |
| | | /// ä»»å¡ç±»åï¼PICKER_MOVE |
| | | /// </summary> |
| | | public string AgvCode { get; set; } |
| | | public string MissionType { get; set; } = "PICKER_MOVE"; |
| | | /// <summary> |
| | | /// å°å¾ç¼ç |
| | | /// ä»»å¡çæ¿å±ç¤ºä»»å¡ç±»å |
| | | /// </summary> |
| | | public string MapCode { get; set; } = "01"; |
| | | public string ViewBoardType { get; set; } |
| | | /// <summary> |
| | | /// 车è¾é群 |
| | | /// æºå¨äººå
·ä½åå· |
| | | /// </summary> |
| | | public string AgvGroupCode { get; set; } |
| | | 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 List<PointDetail> Variables { get; set; } |
| | | } |
| | | public class PointDetail |
| | | { |
| | | public string Code { get; set; } |
| | | public string? Value { get; set; } |
| | | 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; } |
| | | } |
| | | } |
| | |
| | | namespace WIDESEA_DTO.Agv |
| | | { |
| | | public class AgvUpdateDTO |
| | | { |
| | | { |
| | | /// <summary> |
| | | /// ä»»å¡åå· |
| | | /// ä»»å¡ç¼å· |
| | | /// </summary> |
| | | public string ReceiveTaskID { get; set; } |
| | | public string MissionCode { get; set; } |
| | | /// <summary> |
| | | /// è°åº¦ç³»ç»åå· |
| | | /// ä½ä¸ç±»å |
| | | /// </summary> |
| | | public string MakeTaskID { get; set; } |
| | | public string ViewBoardType { get; set; } |
| | | /// <summary> |
| | | /// ä»»å¡ç¶æ |
| | | /// å½åæå¨æ§½ä½ |
| | | /// </summary> |
| | | public string TaskState { get; set; } |
| | | public string SlotCode { get; set; } |
| | | /// <summary> |
| | | /// åæ¾è´§å®æç¶æ<br/> |
| | | /// 1åè´§å®æ<br/> |
| | | /// 2æ¾è´§å®æ<br/> |
| | | /// æ§è¡å½åä»»å¡çæºå¨äºº id |
| | | /// </summary> |
| | | public string GoodsState { get; set; } |
| | | 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 WIDESEA_DTO.Basic |
| | | { |
| | | public class InitializationLocationDTO |
| | | { |
| | | /// <summary> |
| | | /// å··éå· |
| | | /// </summary> |
| | | public string Roadway { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è¡ |
| | | /// </summary> |
| | | public int MaxRow { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å |
| | | /// </summary> |
| | | public int MaxColumn { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å± |
| | | /// </summary> |
| | | public int MaxLayer { get; set; } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEAWCS_DTO.TaskInfo |
| | | { |
| | | /// <summary> |
| | | /// æç®±å°è¾¾ |
| | | /// </summary> |
| | | public class ContainerArriveDTO |
| | | { |
| | | /// <summary> |
| | | /// æ£éå·¥ä½ç¼å· |
| | | /// </summary> |
| | | public string SlotCode { get; set; } |
| | | /// <summary> |
| | | /// æç®±å· |
| | | /// </summary> |
| | | public string ContainerCode { get; set; } |
| | | } |
| | | /// <summary> |
| | | /// æç®±æµå¨ |
| | | /// </summary> |
| | | public class ContainerFlowDTO |
| | | { |
| | | /// <summary> |
| | | /// æ£éå·¥ä½ç¼å· |
| | | /// </summary> |
| | | public string SlotCode { get; set; } |
| | | /// <summary> |
| | | /// æç®±å· |
| | | /// </summary> |
| | | public string ContainerCode { get; set; } |
| | | /// <summary> |
| | | /// æµå¨å»å<br/> |
| | | /// 100åºå
<br/> |
| | | /// 200ååº<br/> |
| | | /// </summary> |
| | | public string Direction { get; set; } |
| | | } |
| | | /// <summary> |
| | | /// æç®±å
¥åºå®æä¸æ¥ |
| | | /// </summary> |
| | | public class ContainerInFinishDTO |
| | | { |
| | | /// <summary> |
| | | /// ä»»å¡å· |
| | | /// </summary> |
| | | public string TaskCode { get; set; } |
| | | /// <summary> |
| | | /// æç®±å· |
| | | /// </summary> |
| | | public string ContainerCode { get; set; } |
| | | /// <summary> |
| | | /// èµ·å§ç«å° |
| | | /// </summary> |
| | | public string FromStationCode { get; set; } |
| | | /// <summary> |
| | | /// ç®æ è´§ä½ |
| | | /// </summary> |
| | | public string ToLocationCode { get; set; } |
| | | } |
| | | } |
| | |
| | | |
| | | namespace WIDESEAWCS_DTO.TaskInfo |
| | | { |
| | | public class WMSTaskDTO |
| | | /// <summary> |
| | | /// ä»»å¡æç» |
| | | /// </summary> |
| | | public class TasksItem |
| | | { |
| | | /// <summary> |
| | | /// WMSä»»å¡ä¸»é® |
| | | /// </summary> |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å· |
| | | /// </summary> |
| | | public int TaskNum { get; set; } |
| | | |
| | | public string TaskCode { get; set; } |
| | | /// <summary> |
| | | /// æçå· |
| | | /// ä»»å¡ä¼å
级 |
| | | /// </summary> |
| | | public string PalletCode { get; set; } |
| | | |
| | | public int TaskPriority { get; set; } |
| | | /// <summary> |
| | | /// Rfidä¿¡æ¯ |
| | | /// æç®±å· |
| | | /// </summary> |
| | | public string RfidCode { get; set; } |
| | | |
| | | public string ContainerCode { get; set; } |
| | | /// <summary> |
| | | /// å··éå· |
| | | /// æç®±ç±»å |
| | | /// </summary> |
| | | public string RoadWay { get; set; } |
| | | public string ContainerType { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string StorageTag { get; set; } |
| | | /// <summary> |
| | | /// èµ·å§åºä½ |
| | | /// </summary> |
| | | public string FromLocationCode { get; set; } |
| | | /// <summary> |
| | | /// åºåºçç®æ æä½å°ç¼å· |
| | | /// </summary> |
| | | public string ToStationCode { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string ToLocationCode { get; set; } |
| | | } |
| | | |
| | | public class WMSTaskDTO |
| | | { |
| | | /// <summary> |
| | | /// ä»»å¡ç±»å |
| | | /// </summary> |
| | | public int TaskType { get; set; } |
| | | |
| | | public string TaskType { get; set; } |
| | | /// <summary> |
| | | /// ä»»å¡ç¶æ |
| | | /// ä»»å¡åç» |
| | | /// </summary> |
| | | public int TaskStatus { get; set; } |
| | | |
| | | public string TaskGroupCode { get; set; } |
| | | /// <summary> |
| | | /// èµ·ç¹ |
| | | /// |
| | | /// </summary> |
| | | public string SourceAddress { get; set; } |
| | | |
| | | public string GroupPriority { get; set; } |
| | | /// <summary> |
| | | /// ç»ç¹ |
| | | /// ä»»å¡æç» |
| | | /// </summary> |
| | | public string TargetAddress { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¼å
级 |
| | | /// </summary> |
| | | public int Grade { get; set; } |
| | | |
| | | public int WarehouseId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡ç» |
| | | /// </summary> |
| | | public string GroupId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡ç©æé¿åº¦ |
| | | /// </summary> |
| | | public int TaskLength { get; set; } |
| | | |
| | | public string AGVArea { get; set; } |
| | | |
| | | public int PalletType { get; set; } |
| | | /// <summary> |
| | | /// MES计åId |
| | | /// </summary> |
| | | public int DispatchPlanId { get; set; } |
| | | /// <summary> |
| | | /// å å·¥ä¸å¿ |
| | | /// </summary> |
| | | public string WorkCentreCode { get; set; } |
| | | public List<TasksItem> Tasks { get; set; } |
| | | } |
| | | } |
| | |
| | | <ProjectReference Include="..\WIDESEAWCS_Model\WIDESEAWCS_Model.csproj" /> |
| | | </ItemGroup> |
| | | |
| | | <ItemGroup> |
| | | <Folder Include="BasicInfo\" /> |
| | | </ItemGroup> |
| | | |
| | | </Project> |
| ÎļþÃû´Ó ÏîÄ¿´úÂë/WCSServices/WIDESEAWCS_DTO/MESResponse.cs ÐÞ¸Ä |
| | |
| | | namespace WIDESEA_External.Model |
| | | { |
| | | /// <summary> |
| | | /// MESè¿å |
| | | /// WMSè¿å |
| | | /// </summary> |
| | | public class MESResponse |
| | | public class WMSResponseContent |
| | | { |
| | | /// <summary> |
| | | /// æåç»æ |
| | | /// </summary> |
| | | public bool Result { get; set; } |
| | | public string Code { get; set; } |
| | | /// <summary> |
| | | /// è¿åä¿¡æ¯ |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// è¿å对象 |
| | | /// </summary> |
| | | public bool Obj { get; set; } |
| | | public object Data { get; set; } |
| | | } |
| | | } |
| | |
| | | /// <param name="warehouseId"></param> |
| | | /// <returns></returns> |
| | | List<string> GetCanOutLocationCodes(int warehouseId); |
| | | /// <summary> |
| | | /// è·åæç®±å¯¹åºåºåºè´§ä½ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | List<Dt_LocationInfo> GetCanOut(List<string> strings); |
| | | } |
| | | } |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_DTO.Basic; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.BaseServices; |
| | |
| | | /// <param name="roadwayNo">å··éå·</param> |
| | | /// <param name="palletType">æçç±»å</param> |
| | | /// <returns></returns> |
| | | Dt_LocationInfo? AssignLocation(string roadwayNo, int palletType, int warehouseId); |
| | | Dt_LocationInfo? AssignLocation(); |
| | | |
| | | /// <summary> |
| | | /// åå§åè´§ä½ |
| | | /// </summary> |
| | | /// <param name="initializationLocationDTO"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent InitializationLocation(InitializationLocationDTO initializationLocationDTO); |
| | | } |
| | | } |
| | |
| | | { |
| | | public interface ITaskRepository : IRepository<Dt_Task> |
| | | { |
| | | |
| | | int GetTaskNum(string sequenceName); |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | /// <param name="taskDTOs">WMSä»»å¡å¯¹è±¡éå</param> |
| | | /// <returns>è¿åå¤çç»æ</returns> |
| | | WebResponseContent ReceiveWMSTask([NotNull] List<WMSTaskDTO> taskDTOs); |
| | | |
| | | /// <summary> |
| | | /// æ ¹æ®æçå·ãèµ·å§å°ååWMS请æ±ä»»å¡ |
| | | /// </summary> |
| | | /// <param name="palletCode">æçå·</param> |
| | | /// <param name="sourceAddress">èµ·å§å°å</param> |
| | | /// <returns></returns> |
| | | WebResponseContent RequestWMSTask(string palletCode, string sourceAddress, string materielBoxCode = ""); |
| | | /// <summary> |
| | | /// 请æ±åæå
¥åº |
| | | /// </summary> |
| | | /// <param name="palletCode">æç</param> |
| | | /// <param name="sourceAddress">èµ·ç¹</param> |
| | | /// <returns></returns> |
| | | WebResponseContent RequestYLWMSTaskSimple(string palletCode, string sourceAddress, int taskNum = 0); |
| | | /// <summary> |
| | | /// 请æ±å
¥åºå··é |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | WebResponseContent AssignCPRoadwayNo(); |
| | | |
| | | // <summary> |
| | | /// 请æ±åæå
¥åºå··é |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | WebResponseContent AssignYLRoadwayNo(string palletCode); |
| | | /// <summary> |
| | | /// 请æ±å
¥åºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="palletCode">æçå·</param> |
| | | /// <param name="sourceAddress">èµ·å§å°å</param> |
| | | /// /// <param name="roadWay">å··é</param> |
| | | /// <returns></returns> |
| | | WebResponseContent RequestWMSTaskSimple(string palletCode, string sourceAddress, string roadWay="", int taskType = 630,int taskNum=0,string targetAddress=""); |
| | | |
| | | /// <summary> |
| | | /// åWMSç³è¯·åé
è´§ä½ |
| | | /// </summary> |
| | | /// <param name="taskNum">ä»»å¡å·</param> |
| | | /// <param name="roadwayNo">å··éå·</param> |
| | | /// <returns></returns> |
| | | string? RequestAssignLocation(int taskNum, string roadwayNo); |
| | | |
| | | /// <summary> |
| | | /// åWMSç³è¯·åºåºAGVç»ç¹ |
| | | /// </summary> |
| | | /// <param name="taskNum">ä»»å¡å·</param> |
| | | /// <returns></returns> |
| | | string? RequestTargetAddress(int taskNum); |
| | | |
| | | WebResponseContent ReceiveWMSTask([NotNull] WMSTaskDTO taskDTO); |
| | | |
| | | /// <summary> |
| | | /// æ´æ°ä»»å¡å¼å¸¸ä¿¡æ¯æ¾ç¤º |
| | | /// </summary> |
| | |
| | | /// <param name="targetAddress">ä¿®æ¹åçç®æ å°å</param> |
| | | /// <param name="currentAddress">ä¿®æ¹åçå½åå°å</param> |
| | | /// <param name="nextAddress">ä¿®æ¹åçä¸ä¸å°å</param> |
| | | void UpdateTask(Dt_Task task, TaskStatusEnum taskStatus, string deviceCode = "", string sourceAddress = "", string targetAddress = "", string currentAddress = "", string nextAddress = "", string roadwayNo = "", int heightType = 0); |
| | | void UpdateTask(Dt_Task task, TaskStatusEnum taskStatus, string deviceCode = "", string sourceAddress = "", string targetAddress = "", string currentAddress = "", string nextAddress = "", string roadwayNo = ""); |
| | | |
| | | /// <summary> |
| | | /// æ¥åWMSæå¨å®æä»»å¡ |
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent RecWMSTaskCompleted(int taskNum); |
| | | |
| | | WebResponseContent RecWMSTaskCompleted(int taskNum); |
| | | /// <summary> |
| | | /// æ ¹æ®æçå·ãå½åå°åæ¥è¯¢AGV宿çä»»å¡ |
| | | /// WMSæç®±å°è¾¾æ£éä½ä¸æ¥ |
| | | /// </summary> |
| | | /// <param name="Barcode">æçå·</param> |
| | | /// <param name="currentAddress">å½åå°å</param> |
| | | /// <returns></returns> |
| | | Dt_Task QueryBarCodeAGVFinishTask(int TaskNum, string currentAddress); |
| | | WebResponseContent WMSPickUp(string stationCode, string pickCode); |
| | | /// <summary> |
| | | /// AGV任塿¾è¡ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | WebResponseContent AgvTaskFlow(string code); |
| | | /// <summary> |
| | | /// ä»»å¡å®æ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | WebResponseContent TaskCompleted(int taskNum); |
| | | } |
| | | } |
| | |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»åºç¼å· |
| | | /// åºåºç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ä»åºç¼å·")] |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åºåºç¼å·")] |
| | | public int WarehouseId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æç®±ç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "æç®±ç¼å·")] |
| | | public string PalletCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è´§ä½ç¼å· |
| | |
| | | public int Layer { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è´§ä½ç±»å |
| | | /// AGVåè´§ç¹ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "è´§ä½ç±»å")] |
| | | public int LocationType { get; set; } |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "AGVåè´§ç¹")] |
| | | public string AgvPoint { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è´§ä½ç¶æ |
| | |
| | | /// ç«å°ç±»å <br/> |
| | | /// 1ï¼åªå
¥ <br/> |
| | | /// 2ï¼åªåº <br/> |
| | | /// 3ï¼å¯å
¥å¯åº |
| | | /// 3ï¼å¯å
¥å¯åº<br/> |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ç«å°ç±»å")] |
| | | public int StationType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 对åºå åæºæ-å-å± |
| | | /// åæ¾ä½ç½® |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "对åºå åæºæ-å-å±")] |
| | | public string StackerCraneStationCode { get; set; } |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "åæ¾ä½ç½®")] |
| | | public string CraneStationCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å
³èæ£éå·¥ä½ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "å
³èæ£éå·¥ä½")] |
| | | public string PickStationCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç«å°è®¾å¤ç¼å· |
| | |
| | | public string StationDeviceCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å åæºç¼å· |
| | | /// å
³èè®¾å¤ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "å åæºç¼å·")] |
| | | public string StackerCraneCode { get; set; } |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "å
³è设å¤")] |
| | | public string CraneCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// AGVç«å°ç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "AGVç«å°ç¼å·")] |
| | | public string? AGVStationCode { get; set; } |
| | | /// <summary> |
| | | /// AGVç«å°åæ¾é«åº¦ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "AGVç«å°åæ¾é«åº¦")] |
| | | public decimal AGVStationHeight { get; set; } |
| | | /// <summary> |
| | | /// AGVåç½®ç¹ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "AGVåç½®ç¹")] |
| | | public string? AGVFrontCode { get; set; } |
| | | /// <summary> |
| | | /// ç«å°æ¯å¦å¯ç¨ <br/> |
| | | /// 0ï¼å¯ç¨ <br/> |
| | | /// 1ï¼å ç¨ <br/> |
| | | /// 1ï¼ç¦ç¨ <br/> |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ç«å°æ¯å¦å¯ç¨")] |
| | | public int IsOccupied { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç«å°æ¯å¦å¯ç¨ <br/> |
| | | /// 0ï¼å¯ç¨ <br/> |
| | | /// 1ï¼å ç¨ <br/> |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "ç«å°æ¯å¦å¯ç¨")] |
| | | public int IsManual { get; set; } |
| | | public int Enable { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | |
| | | namespace WIDESEAWCS_Model.Models |
| | | { |
| | | /// <summary> |
| | | /// ä»åºä¿¡æ¯ |
| | | /// åºåºä¿¡æ¯ |
| | | /// </summary> |
| | | [SugarTable(nameof(Dt_Warehouse), "ä»åºä¿¡æ¯")] |
| | | [SugarTable(nameof(Dt_Warehouse), "åºåºä¿¡æ¯")] |
| | | public class Dt_Warehouse : BaseEntity |
| | | { |
| | | /// <summary> |
| | |
| | | public int WarehouseId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»åºç¼å· |
| | | /// åºåºç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "ä»åºç¼å·")] |
| | | public string WarehouseCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»åºåç§° |
| | | /// åºåºåç§° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "ä»åºåç§°")] |
| | | public string WarehouseName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»åºç±»å |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "ä»åºç±»å")] |
| | | public string WarehouseType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»åºç¶æ |
| | | /// åºåºç¶æ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, DefaultValue = "0", ColumnDescription = "ä»åºç¶æ")] |
| | | public int WarehouseStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»åºæè¿° |
| | | /// åºåºæè¿° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "ä»åºæè¿°")] |
| | | public string WarehouseDes { get; set; } |
| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core.Attributes; |
| | | using WIDESEAWCS_Core.DB.Models; |
| | | |
| | |
| | | /// </summary> |
| | | [ImporterHeader(Name = "ä»»å¡å·")] |
| | | [ExporterHeader(DisplayName = "ä»»å¡å·")] |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ä»»å¡å·")] |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ä»»å¡å·"), Sequence(nameof(SequenceEnum.SeqTaskNum), 100000000)] |
| | | public int TaskNum { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»åºä¸»é® |
| | | /// åºåºä¸»é® |
| | | /// </summary> |
| | | [ImporterHeader(Name = "ä»åºä¸»é®")] |
| | | [ExporterHeader(DisplayName = "ä»åºä¸»é®")] |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ä»åºä¸»é®")] |
| | | [ImporterHeader(Name = "åºåºä¸»é®")] |
| | | [ExporterHeader(DisplayName = "åºåºä¸»é®")] |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åºåºä¸»é®")] |
| | | public int WarehouseId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// AGVä»»å¡å· |
| | | /// æç®±ç¼å· |
| | | /// </summary> |
| | | [ImporterHeader(Name = "AGVä»»å¡å·")] |
| | | [ExporterHeader(DisplayName = "AGVä»»å¡å·")] |
| | | [SugarColumn(IsNullable = true,Length =50, ColumnDescription = "AGVä»»å¡å·")] |
| | | public string AgvTaskNum { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æçç¼å· |
| | | /// </summary> |
| | | [ImporterHeader(Name = "æçç¼å·")] |
| | | [ExporterHeader(DisplayName = "æçç¼å·")] |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "æçç¼å·")] |
| | | [ImporterHeader(Name = "æç®±ç¼å·")] |
| | | [ExporterHeader(DisplayName = "æç®±ç¼å·")] |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "æç®±ç¼å·")] |
| | | public string PalletCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// RFIDä¿¡æ¯ |
| | | /// </summary> |
| | | [ImporterHeader(Name = "RFIDä¿¡æ¯")] |
| | | [ExporterHeader(DisplayName = "RFIDä¿¡æ¯")] |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "RFIDä¿¡æ¯")] |
| | | public string RfidCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æçç±»å |
| | |
| | | [ExporterHeader(DisplayName = "å··éå·")] |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "å··éå·")] |
| | | public string Roadway { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡ç±»å |
| | | /// </summary> |
| | |
| | | [ExporterHeader(DisplayName = "ä»»å¡ç±»å")] |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ä»»å¡ç±»å")] |
| | | public int TaskType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡ç¶æ |
| | | /// </summary> |
| | |
| | | [ExporterHeader(DisplayName = "ä»»å¡ç¶æ")] |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ä»»å¡ç¶æ")] |
| | | public int TaskState { get; set; } |
| | | |
| | | /// <summary> |
| | | /// èµ·å§å°å |
| | | /// </summary> |
| | |
| | | [ExporterHeader(DisplayName = "èµ·å§å°å")] |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "èµ·å§å°å")] |
| | | public string SourceAddress { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç®æ å°å |
| | | /// </summary> |
| | |
| | | [ExporterHeader(DisplayName = "ç®æ å°å")] |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "ç®æ å°å")] |
| | | public string TargetAddress { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å½åä½ç½® |
| | | /// </summary> |
| | |
| | | [ExporterHeader(DisplayName = "å½åä½ç½®")] |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "å½åä½ç½®")] |
| | | public string CurrentAddress { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¸ä¸å°å |
| | | /// </summary> |
| | |
| | | [ExporterHeader(DisplayName = "ä¸ä¸å°å")] |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "ä¸ä¸å°å")] |
| | | public string NextAddress { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å¼å¸¸ä¿¡æ¯ |
| | | /// </summary> |
| | |
| | | [ExporterHeader(DisplayName = "å¼å¸¸ä¿¡æ¯")] |
| | | [SugarColumn(IsNullable = true, Length = 500, ColumnDescription = "å¼å¸¸ä¿¡æ¯")] |
| | | public string? ExceptionMessage { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¼å
级 |
| | | /// </summary> |
| | |
| | | public int Grade { get; set; } |
| | | |
| | | /// <summary> |
| | | /// WMSä»»å¡ä¸»é® |
| | | /// WMSä»»å¡ |
| | | /// </summary> |
| | | [ImporterHeader(Name = "WMSä»»å¡ä¸»é®")] |
| | | [ExporterHeader(DisplayName = "WMSä»»å¡ä¸»é®")] |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "WMSä»»å¡ä¸»é®")] |
| | | public int WMSId { get; set; } |
| | | /// <summary> |
| | | /// é«åº¦ç±»å |
| | | /// </summary> |
| | | [ImporterHeader(Name = "é«åº¦ç±»å")] |
| | | [ExporterHeader(DisplayName = "é«åº¦ç±»å")] |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "é«åº¦ç±»å")] |
| | | public int HeightType { get; set; } |
| | | [ImporterHeader(Name = "WMSä»»å¡å·")] |
| | | [ExporterHeader(DisplayName = "WMSä»»å¡å·")] |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "WMSä»»å¡å·")] |
| | | public string WMSId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡ä¸åæ¶é´ |
| | | /// </summary> |
| | |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "ä»»å¡ç»")] |
| | | public string GroupId { get; set; } |
| | | /// <summary> |
| | | /// ä»»å¡ç©æé¿åº¦ |
| | | /// </summary> |
| | | [ImporterHeader(Name = "ä»»å¡ç©æé¿åº¦")] |
| | | [ExporterHeader(DisplayName = "ä»»å¡ç©æé¿åº¦")] |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "ä»»å¡ç©æé¿åº¦")] |
| | | public int TaskLength { get; set; } |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | [ImporterHeader(Name = "夿³¨")] |
| | | [ExporterHeader(DisplayName = "夿³¨")] |
| | | [SugarColumn(IsNullable = true, Length = 255, ColumnDescription = "夿³¨")] |
| | | public string Remark { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å å·¥ä¸å¿ç¼ç |
| | | /// </summary> |
| | | [ImporterHeader(Name = "å å·¥ä¸å¿ç¼ç ")] |
| | | [ExporterHeader(DisplayName = "å å·¥ä¸å¿ç¼ç ")] |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "å å·¥ä¸å¿ç¼ç ")] |
| | | public string WorkCentreCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æç¼å· |
| | | /// </summary> |
| | | [ImporterHeader(Name = "MES计åId")] |
| | | [ExporterHeader(DisplayName = "MES计åId")] |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "MES计åId")] |
| | | public int DispatchPlanId { get; set; } |
| | | } |
| | | } |
| | |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Autofac.Core; |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using System.Text; |
| | |
| | | _taskRepository = taskRepository; |
| | | _routerRepository = routerRepository; |
| | | } |
| | | /// <summary> |
| | | /// AGV任塿´æ° |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("Callback"), AllowAnonymous] |
| | | public WebResponseContent? Callback([FromBody]AgvUpdateDTO agvUpdateDTO) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var task = _taskRepository.QueryFirst(x => agvUpdateDTO.ContainerCode==x.PalletCode) ?? throw new Exception($"æªæ¾å°æç®±ã{agvUpdateDTO.ContainerCode}ãä»»å¡"); |
| | | switch (agvUpdateDTO.MissionStatus) |
| | | { |
| | | case nameof(AGVStatusEnum.PICKER_RECEIVE): |
| | | _taskService.UpdateTask(task, TaskStatusEnum.AGV_TakeFinish); |
| | | break; |
| | | case nameof(AGVStatusEnum.PICKER_SEND): |
| | | //WebResponseContent responseContent = _taskService.AgvTaskFlow(task.PalletCode); |
| | | //if (!responseContent.Status) throw new Exception($"{responseContent.Message}"); |
| | | _taskService.TaskCompleted(task.TaskNum); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using HslCommunication.WebSocket; |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using System.Collections.Generic; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_DTO.Basic; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.BaseController; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_IBasicInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | |
| | | namespace WIDESEA_WMSServer.Controllers.Basic |
| | | { |
| | | /// <summary> |
| | | /// è´§ä½ |
| | | /// </summary> |
| | | [Route("api/LocationInfo")] |
| | | [ApiController] |
| | | public class LocationInfoController : ApiBaseController<ILocationInfoService, Dt_LocationInfo> |
| | | { |
| | | private readonly ILocationInfoRepository _repository; |
| | | public LocationInfoController(ILocationInfoService service, ILocationInfoRepository repository) : base(service) |
| | | { |
| | | _repository = repository; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è´§ä½åé
|
| | | /// </summary> |
| | | /// <param name="roadwayNo"></param> |
| | | /// <param name="palletType"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("AssignLocation"), AllowAnonymous] |
| | | public Dt_LocationInfo? AssignLocation() |
| | | { |
| | | return Service.AssignLocation(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åå§åè´§ä½ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("InitializationLocation"), AllowAnonymous] |
| | | public WebResponseContent InitializationLocation([FromBody] InitializationLocationDTO initializationLocationDTO) |
| | | { |
| | | return Service.InitializationLocation(initializationLocationDTO); |
| | | } |
| | | /// <summary> |
| | | /// å¯ç¨è´§ä½ |
| | | /// </summary> |
| | | /// <param name="keys"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("LocationEnableStatus")] |
| | | public WebResponseContent LocationEnableStatus([FromBody] int[] keys) |
| | | { |
| | | return Service.LocationEnableStatus(keys); ; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ç¦ç¨è´§ä½ |
| | | /// </summary> |
| | | /// <param name="keys"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("LocationDisableStatus")] |
| | | public WebResponseContent LocationDisableStatus([FromBody] int[] keys) |
| | | { |
| | | return Service.LocationDisableStatus(keys); ; |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | { |
| | | private readonly IHttpContextAccessor _httpContextAccessor; |
| | | private readonly IRouterExtension _routerExtension; |
| | | //private readonly WebSocketServer _webSocketServer; |
| | | private readonly IStationMangerRepository _stationMangerRepository; |
| | | |
| | | public TaskController(ITaskService service, IHttpContextAccessor httpContextAccessor, IRouterExtension routerExtension/*, WebSocketServer webSocketServer*/, IStationMangerRepository stationMangerRepository) : base(service) |
| | | public TaskController(ITaskService service, IHttpContextAccessor httpContextAccessor, IRouterExtension routerExtension, IStationMangerRepository stationMangerRepository) : base(service) |
| | | { |
| | | _httpContextAccessor = httpContextAccessor; |
| | | _routerExtension = routerExtension; |
| | | _stationMangerRepository=stationMangerRepository; |
| | | //_webSocketServer = webSocketServer; |
| | | } |
| | | |
| | | [HttpPost, Route("ReceiveTask"), AllowAnonymous] |
| | | public WebResponseContent ReceiveWMSTask([FromBody] List<WMSTaskDTO> taskDTOs) |
| | | public WebResponseContent ReceiveWMSTask([FromBody] WMSTaskDTO taskDTO) |
| | | { |
| | | return Service.ReceiveWMSTask(taskDTOs); |
| | | return Service.ReceiveWMSTask(taskDTO); |
| | | } |
| | | |
| | | [HttpPost, HttpGet, Route("RequestAssignLocation"), AllowAnonymous] |
| | | public string? RequestAssignLocation(int taskNum, string roadwayNo) |
| | | { |
| | | return Service.RequestAssignLocation(taskNum, roadwayNo); |
| | | } |
| | | |
| | | [HttpPost, HttpGet, Route("UpdateTaskExceptionMessage")] |
| | | public WebResponseContent UpdateTaskExceptionMessage(int taskNum, string message) |
| | |
| | | { |
| | | return Service.RollbackTaskStatusToLast(taskNum); |
| | | } |
| | | /// <summary> |
| | | /// 容卿µå¨æ¥å£ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("ContainerFlow"), AllowAnonymous] |
| | | public WebResponseContent ContainerFlow([FromBody] ContainerFlowDTO containerFlowDTO) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x=>x.PickStationCode==containerFlowDTO.SlotCode) ?? throw new Exception($"{containerFlowDTO.SlotCode}æ£éä½ç½®ä¸åå¨"); |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | | if (device == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°å¯¹åºè®¾å¤{stationManger.StationDeviceCode}"); |
| | | } |
| | | CommonConveyorLine commonConveyorLine = (CommonConveyorLine)device; |
| | | string PickBarCode = commonConveyorLine.GetValue<ConveyorLineDBName, string>(ConveyorLineDBName.R_PickBarCode, stationManger.StationCode).Replace("\0", ""); |
| | | if (containerFlowDTO.ContainerCode!= PickBarCode) throw new Exception($"ä¼ å
¥æç®±ç {containerFlowDTO.ContainerCode}ï¼è¾éæç®±ç {PickBarCode}æ°æ®é误"); |
| | | commonConveyorLine.SetValue(ConveyorLineDBName.W_PickToHode,(short)containerFlowDTO.Direction.ObjToInt(), stationManger.StationCode); |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | [HttpPost, HttpGet, Route("GetRouteEndPoint"), AllowAnonymous] |
| | | public WebResponseContent GetRouteEndPoint(string startPoint, int routeType) |
| | | { |
| | | return WebResponseContent.Instance.OK(data: _routerExtension.GetEndPoint(startPoint, routeType)); |
| | | } |
| | | [HttpPost, HttpGet, Route("AssignCPRoadwayNo"), AllowAnonymous] |
| | | public WebResponseContent AssignCPRoadwayNo() |
| | | { |
| | | return Service.AssignCPRoadwayNo(); |
| | | } |
| | | /// <summary> |
| | | /// WMSä»»å¡å®æåæ¥ |
| | |
| | | { |
| | | CreateMap<Sys_Menu, MenuDTO>(); |
| | | CreateMap<Dt_DeviceInfo,DeviceInfoDTO>(); |
| | | CreateMap<WMSTaskDTO, Dt_Task>().ForMember(a => a.WMSId, b => b.MapFrom(b => b.Id)); |
| | | CreateMap<TasksItem, Dt_Task>().ForMember(a => a.WMSId, b => b.MapFrom(b => b.TaskCode)).ForMember(a => a.PalletCode, b => b.MapFrom(b => b.ContainerCode)).ForMember(a => a.Grade, b => b.MapFrom(b => b.TaskPriority)); |
| | | } |
| | | } |
| | | } |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Core.BaseRepository; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_Model.Models; |
| | | |
| | |
| | | public TaskRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage) |
| | | { |
| | | } |
| | | static object lock_taskNum = new object(); |
| | | public int GetTaskNum(string sequenceName) |
| | | { |
| | | lock (lock_taskNum) |
| | | { |
| | | return Db.Ado.GetScalar($"SELECT NEXT VALUE FOR {sequenceName}").ObjToInt(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | using Autofac.Core; |
| | | using Newtonsoft.Json.Serialization; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | |
| | | { |
| | | public partial class TaskService |
| | | { |
| | | // å建ä¸ä¸ªä½¿ç¨å°é©¼å³°å½åæ³çåºåå设置 |
| | | JsonSerializerSettings settings = new JsonSerializerSettings |
| | | { |
| | | ContractResolver = new CamelCasePropertyNamesContractResolver() |
| | | }; |
| | | public WebResponseContent AgvSendTask(AgvTaskSendDTO taskModel, APIEnum SendTask = APIEnum.AgvSendTask) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | string? apiAddress = apiInfos.FirstOrDefault(x => x.ApiCode == SendTask.ToString())?.ApiAddress; |
| | | if (string.IsNullOrEmpty(apiAddress)) |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°åéAGV任塿¥å£,è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | string response = HttpHelper.Post(apiAddress, taskModel.Serialize()); |
| | | AgvResponseContent agvContent = response.DeserializeObject<AgvResponseContent>(); |
| | | if (agvContent.Code == "0") |
| | | 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(data: agvContent.Data); |
| | | content.OK(); |
| | | } |
| | | else |
| | | { |
| | |
| | | #endregion << ç æ¬ 注 é >> |
| | | using AutoMapper; |
| | | using Newtonsoft.Json; |
| | | using NPOI.SS.Formula.Functions; |
| | | using SqlSugar; |
| | | using System.Diagnostics.CodeAnalysis; |
| | | using System.DirectoryServices.Protocols; |
| | | using System.Net.Http.Headers; |
| | | using System.Security.Policy; |
| | | using WIDESEA_DTO.Agv; |
| | | using WIDESEA_External.Model; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.APIEnum; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.BaseRepository; |
| | | using WIDESEAWCS_Core.BaseServices; |
| | | 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; |
| | |
| | | public partial class TaskService : ServiceBase<Dt_Task, ITaskRepository>, ITaskService |
| | | { |
| | | private readonly IMapper _mapper; |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | private readonly ICacheService _cacheService; |
| | | private readonly IRouterService _routerService; |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | |
| | | private readonly IStationMangerRepository _stationMangerRepository; |
| | | private readonly IRouterRepository _routerRepository; |
| | | private readonly IApiInfoRepository _apiInfoRepository; |
| | | private List<Dt_ApiInfo> apiInfos; |
| | | private readonly ILocationInfoRepository _locationInfoRepository; |
| | | |
| | | private Dictionary<string, OrderByType> _taskOrderBy = new() |
| | | { |
| | |
| | | {nameof(Dt_Task.CreateDate),OrderByType.Asc}, |
| | | }; |
| | | |
| | | private List<Dt_Warehouse>? Warehouses = new List<Dt_Warehouse>(); |
| | | |
| | | public Dictionary<string, OrderByType> TaskOrderBy { get { return _taskOrderBy; } set { _taskOrderBy = value; } } |
| | | |
| | |
| | | |
| | | public List<int> TaskRelocationTypes => typeof(TaskTypeEnum).GetEnumIndexList().Where(x => x >= 900 && x < 1000).ToList(); |
| | | |
| | | public TaskService(ITaskRepository BaseDal, IMapper mapper, ICacheService cacheService, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IApiInfoRepository apiInfoRepository) : base(BaseDal) |
| | | public TaskService(ITaskRepository BaseDal, IMapper mapper, ICacheService cacheService, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IApiInfoRepository apiInfoRepository,ILocationInfoRepository locationInfoRepository,IUnitOfWorkManage unitOfWorkManage) : base(BaseDal) |
| | | { |
| | | _mapper = mapper; |
| | | _cacheService = cacheService; |
| | |
| | | _stationMangerRepository = stationMangerRepository; |
| | | _routerRepository = routerRepository; |
| | | _apiInfoRepository = apiInfoRepository; |
| | | |
| | | string? cacheStr = _cacheService.Get(nameof(Dt_Warehouse)); |
| | | if (!string.IsNullOrEmpty(cacheStr)) |
| | | { |
| | | Warehouses = JsonConvert.DeserializeObject<List<Dt_Warehouse>>(cacheStr); |
| | | } |
| | | |
| | | |
| | | string? apiInfoStr = _cacheService.Get("apiInfos"); |
| | | if (!string.IsNullOrEmpty(apiInfoStr)) |
| | | { |
| | | List<Dt_ApiInfo>? infos = JsonConvert.DeserializeObject<List<Dt_ApiInfo>>(apiInfoStr); |
| | | if (infos == null || infos.Count == 0) |
| | | { |
| | | apiInfos = new List<Dt_ApiInfo>(); |
| | | } |
| | | else |
| | | { |
| | | apiInfos = infos; |
| | | } |
| | | } |
| | | _locationInfoRepository = locationInfoRepository; |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | } |
| | | static object lock_taskReceive = new object(); |
| | | /// <summary> |
| | | /// æ¥æ¶WMSä»»å¡ä¿¡æ¯ |
| | | /// </summary> |
| | | /// <param name="taskDTOs">WMSä»»å¡å¯¹è±¡éå</param> |
| | | /// <returns>è¿åå¤çç»æ</returns> |
| | | public WebResponseContent ReceiveWMSTask([NotNull] List<WMSTaskDTO> taskDTOs) |
| | | public WebResponseContent ReceiveWMSTask([NotNull] WMSTaskDTO taskDTO) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | bool flag = false; |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | foreach (var item in taskDTOs) |
| | | lock (lock_taskReceive) |
| | | { |
| | | if (BaseDal.QueryFirst(x => x.TaskNum == item.TaskNum) != null) |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | List<Dt_LocationInfo> locationInfos = _locationInfoRepository.GetCanOut(taskDTO.Tasks.Select(x=>x.ContainerCode).ToList()); |
| | | TasksItem? tasksItem = taskDTO.Tasks.FirstOrDefault(x => !locationInfos.Select(t => t.PalletCode).Contains(x.ContainerCode)); |
| | | if (tasksItem != null) throw new Exception($"ä»»å¡{tasksItem.TaskCode}æç®±å·{tasksItem.ContainerCode}ä¸åå¨"); |
| | | Dt_LocationInfo? noOutLocation = locationInfos.FirstOrDefault(x=>x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() || x.EnableStatus != EnableStatusEnum.Normal.ObjToInt()); |
| | | if (noOutLocation != null) throw new Exception($"æç®±{noOutLocation.PalletCode}è´§ä½{noOutLocation.LocationCode}ç¶æä¸å¯åºåº"); |
| | | List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(); |
| | | //ä¸åä»»å¡ç» |
| | | string taskGroup= taskDTO.TaskGroupCode.IsNullOrEmpty() ? Guid.NewGuid().ToString().Replace("-","") : taskDTO.TaskGroupCode; |
| | | foreach (var item in taskDTO.Tasks) |
| | | { |
| | | flag = true; |
| | | continue; |
| | | if (item.ToStationCode.IsNullOrEmpty()) throw new Exception($"ä»»å¡{item.TaskCode}åºåºç®æ æä½å°ä¸è½ä¸ºç©º"); |
| | | //è·åæä½å° |
| | | Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.PickStationCode == item.ToStationCode); |
| | | if (stationManger == null) throw new Exception($"ä»»å¡{item.TaskCode}åºåºç®æ æä½å°{item.ToStationCode}ä¸åå¨"); |
| | | Dt_Task task = _mapper.Map<Dt_Task>(item); |
| | | Dt_LocationInfo locationInfo = locationInfos.FirstOrDefault(x=>x.PalletCode==item.ContainerCode); |
| | | task.SourceAddress = locationInfo.LocationCode; |
| | | task.CurrentAddress = locationInfo.LocationCode; |
| | | task.NextAddress = stationManger.PickStationCode; |
| | | task.TargetAddress = stationManger.PickStationCode; |
| | | task.GroupId = taskGroup; |
| | | task.TaskType = TaskTypeEnum.Outbound.ObjToInt(); |
| | | task.Roadway = locationInfo.RoadwayNo; |
| | | task.DeviceCode = "AGV"; |
| | | task.TaskState = TaskStatusEnum.AGV_Execute.ObjToInt(); |
| | | tasks.Add(task); |
| | | } |
| | | Dt_Task task = _mapper.Map<Dt_Task>(item); |
| | | task.Creater = "WMS"; |
| | | task.TaskState = (int)TaskStatusEnum.New; |
| | | task.CurrentAddress = item.SourceAddress; |
| | | |
| | | Dt_Router? router; |
| | | |
| | | } |
| | | BaseDal.AddData(tasks); |
| | | |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(tasks.Select(x => x.TaskNum).ToList(), "æ¥æ¶WMSä»»å¡"); |
| | | |
| | | content = (flag || tasks.Count > 0) ? WebResponseContent.Instance.OK("æå") : WebResponseContent.Instance.Error("失败"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error($"任塿¥æ¶é误,é误信æ¯:{ex.Message}"); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ ¹æ®æçå·ãèµ·å§å°ååWMS请æ±ä»»å¡ |
| | | /// </summary> |
| | | /// <param name="palletCode">æçå·</param> |
| | | /// <param name="sourceAddress">èµ·å§å°å</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent RequestWMSTask(string palletCode, string sourceAddress, string materielBoxCode = "") |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == sourceAddress); |
| | | if (stationManger == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ç«å°ä¿¡æ¯"); |
| | | } |
| | | string address = AppSettings.Get("WMSApiAddress"); |
| | | if (string.IsNullOrEmpty(address)) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°WMSApiå°å"); |
| | | } |
| | | string responseStr = ""; |
| | | if (!string.IsNullOrEmpty(materielBoxCode)) |
| | | { |
| | | responseStr = HttpHelper.Get($"{address}/api/Task/DeviceRequestInboundTask?stationCode={sourceAddress}&roadwayNo={stationManger.StackerCraneCode}&palletCode={palletCode}&materielBoxCode={materielBoxCode}"); |
| | | } |
| | | else |
| | | { |
| | | responseStr = HttpHelper.Get($"{address}/api/Task/DeviceRequestInboundTask?stationCode={sourceAddress}&roadwayNo={stationManger.StackerCraneCode}&palletCode={palletCode}"); |
| | | } |
| | | WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr); |
| | | if (responseContent != null && responseContent.Status && responseContent.Data != null) |
| | | { |
| | | WMSTaskDTO? taskDTO = JsonConvert.DeserializeObject<WMSTaskDTO>(responseContent.Data.ToString()); |
| | | if (taskDTO != null) |
| | | locationInfos.ForEach(x => |
| | | { |
| | | content = ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); |
| | | } |
| | | } |
| | | x.LocationStatus=LocationStatusEnum.Lock.ObjToInt(); |
| | | }); |
| | | //æ·»å 任塿´æ°è´§ä½æ°æ® |
| | | _unitOfWorkManage.BeginTran(); |
| | | BaseDal.AddData(tasks); |
| | | _locationInfoRepository.UpdateData(locationInfos); |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(tasks.Select(x => x.TaskNum).ToList(), "æ¥æ¶WMSä»»å¡"); |
| | | |
| | | content = tasks.Count > 0 ? content.OK("æå") : content.Error("失败"); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error(ex.Message); |
| | | content.Error($"任塿¥æ¶é误,é误信æ¯:{ex.Message}"); |
| | | } |
| | | return content; |
| | | } |
| | | // <summary> |
| | | /// 请æ±å
¥åºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="palletCode">æçå·</param> |
| | | /// <param name="sourceAddress">èµ·å§å°å</param> |
| | | /// /// <param name="roadWay">å··é</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent RequestYLWMSTaskSimple(string palletCode, string sourceAddress,int taskNum=0) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | string address = AppSettings.Get("WMSApiAddress"); |
| | | if (string.IsNullOrEmpty(address)) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°WMSApiå°å"); |
| | | } |
| | | string responseStr = HttpHelper.Get($"{address}/api/Task/RequestYLWMSTaskSimple?stationCode={sourceAddress}&palletCode={palletCode}&taskNum{taskNum}"); |
| | | WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr); |
| | | if (responseContent != null && responseContent.Status && responseContent.Data != null) |
| | | { |
| | | WMSTaskDTO? taskDTO = JsonConvert.DeserializeObject<WMSTaskDTO>(responseContent.Data.ToString()); |
| | | if (taskDTO != null) |
| | | { |
| | | content = ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | content = responseContent ?? content.Error("ç»æé误"); |
| | | } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | // <summary> |
| | | /// 请æ±å
¥åºå··é |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public WebResponseContent AssignCPRoadwayNo() |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | string address = AppSettings.Get("WMSApiAddress"); |
| | | if (string.IsNullOrEmpty(address)) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°WMSApiå°å"); |
| | | } |
| | | string responseStr = HttpHelper.Get($"{address}/api/Task/AssignCPRoadwayNo"); |
| | | |
| | | if (!responseStr.IsNullOrEmpty()) |
| | | { |
| | | content.OK("æå", responseStr); |
| | | } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | // <summary> |
| | | /// 请æ±åæå
¥åºå··é |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public WebResponseContent AssignYLRoadwayNo(string palletCode) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | string address = AppSettings.Get("WMSApiAddress"); |
| | | if (string.IsNullOrEmpty(address)) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°WMSApiå°å"); |
| | | } |
| | | string responseStr = HttpHelper.Get($"{address}/api/Task/AssignYLRoadwayNo?palletCode={palletCode}"); |
| | | WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr); |
| | | if (responseContent != null && responseContent.Status && responseContent.Data != null) |
| | | { |
| | | content = responseContent; |
| | | } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | // <summary> |
| | | /// 请æ±å
¥åºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="palletCode">æçå·</param> |
| | | /// <param name="sourceAddress">èµ·å§å°å</param> |
| | | /// /// <param name="roadWay">å··é</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent RequestWMSTaskSimple(string palletCode, string sourceAddress,string roadWay="", int taskType=630, int taskNum = 0, string targetAddress = "") |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | //string address = AppSettings.Get("WMSApiAddress"); |
| | | //if (string.IsNullOrEmpty(address)) |
| | | //{ |
| | | // return WebResponseContent.Instance.Error($"æªæ¾å°WMSApiå°å"); |
| | | //} |
| | | //string responseStr = HttpHelper.Get($"{address}/api/Task/DeviceRequestInboundTaskSimple?stationCode={sourceAddress}&palletCode={palletCode}"); |
| | | //WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr); |
| | | //if (responseContent != null && responseContent.Status && responseContent.Data != null) |
| | | //{ |
| | | // WMSTaskDTO? taskDTO = JsonConvert.DeserializeObject<WMSTaskDTO>(responseContent.Data.ToString()); |
| | | // if (taskDTO != null) |
| | | // { |
| | | WMSTaskDTO? taskDTO = new WMSTaskDTO() |
| | | { |
| | | TaskNum = taskNum ==0 ? DateTime.Now.ToString("mmss").ObjToInt(): taskNum, |
| | | PalletCode= palletCode, |
| | | RoadWay= roadWay, |
| | | TaskType= taskType, |
| | | PalletType=1, |
| | | TaskStatus= TaskStatusEnum.New.ObjToInt(), |
| | | SourceAddress= sourceAddress, |
| | | TargetAddress= targetAddress, |
| | | WarehouseId=2, |
| | | Grade=0, |
| | | }; |
| | | content = ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); |
| | | // } |
| | | //} |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | public WebResponseContent MESBoxCodeNotice(string boxCode) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | string address = AppSettings.Get("WMSApiAddress"); |
| | | if (string.IsNullOrEmpty(address)) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°WMSApiå°å"); |
| | | } |
| | | string responseStr = HttpHelper.Get($"{address}/api/Mes/MESBoxCodeNotice?boxCode={boxCode}"); |
| | | return content.OK(responseStr); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | public static string Post(string serviceAddress, string requestJson = "", string contentType = "application/json", Dictionary<string, string>? headers = null) |
| | | { |
| | | string result = string.Empty; |
| | |
| | | { |
| | | Logger.Add(serviceAddress, requestJson == null ? "" : requestJson, result, beginDate); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åWMSç³è¯·åé
è´§ä½ |
| | | /// </summary> |
| | | /// <param name="taskNum">ä»»å¡å·</param> |
| | | /// <param name="roadwayNo">å··éå·</param> |
| | | /// <returns></returns> |
| | | public string? RequestAssignLocation(int taskNum, string roadwayNo) |
| | | { |
| | | string address = AppSettings.Get("WMSApiAddress"); |
| | | if (string.IsNullOrEmpty(address)) throw new Exception("æªæ¾å°WMSApiå°å"); |
| | | string responseStr = HttpHelper.Get($"{address}/api/Task/AssignInboundTaskLocation?taskNum={taskNum}&roadwayNo={roadwayNo}"); |
| | | |
| | | WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr); |
| | | if (responseContent != null && responseContent.Status && responseContent.Data != null) |
| | | { |
| | | return responseContent.Data.ToString(); |
| | | } |
| | | |
| | | return ""; |
| | | } |
| | | /// <summary> |
| | | /// åWMSç³è¯·åºåºAGVç»ç¹ |
| | | /// </summary> |
| | | /// <param name="taskNum">ä»»å¡å·</param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception"></exception> |
| | | public string? RequestTargetAddress(int taskNum) |
| | | { |
| | | string address = AppSettings.Get("WMSApiAddress"); |
| | | if (string.IsNullOrEmpty(address)) throw new Exception("æªæ¾å°WMSApiå°å"); |
| | | string responseStr = HttpHelper.Get($"{address}/api/Task/AssignOutTargetAddress?taskNum={taskNum}"); |
| | | |
| | | WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr); |
| | | if (responseContent != null && responseContent.Status && responseContent.Data != null) |
| | | { |
| | | return responseContent.Data.ToString(); |
| | | } |
| | | |
| | | return ""; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public Dt_Task QueryBarCodeAGVFinishTask(int TaskNum, string currentAddress) |
| | | /// <summary> |
| | | /// AGV任塿¾è¡ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public WebResponseContent AgvTaskFlow(string code) |
| | | { |
| | | return BaseDal.QueryFirst(x => TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskStatusEnum.AGV_Finish && x.CurrentAddress == currentAddress && x.TaskNum == TaskNum, TaskOrderBy); |
| | | WebResponseContent content=new WebResponseContent(); |
| | | try |
| | | { |
| | | string? url = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.AgvTaskFlow.ToString())?.ApiAddress; |
| | | if (string.IsNullOrEmpty(url)) throw new Exception($"{code},æªæ¾å°AGV任塿¾è¡æ¥å£,è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | AgvTaskFlowDTO agvTaskFlowDTO = new AgvTaskFlowDTO() |
| | | { |
| | | RequestId = Guid.NewGuid().ToString().Replace("-", ""), |
| | | ContainerCode = code |
| | | }; |
| | | string request = JsonConvert.SerializeObject(agvTaskFlowDTO, settings); |
| | | string response = HttpHelper.Post(url, request); |
| | | AgvResponseContent agvResponse = JsonConvert.DeserializeObject<AgvResponseContent>(response) ?? throw new Exception($"{code},æªæ¥æ¶å°AGV任塿¾è¡è¿åå¼"); |
| | | if (!agvResponse.Success) throw new Exception($"æç®±{code},AGV任塿¾è¡é误,ä¿¡æ¯:{agvResponse.Message}"); |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// WMSæç®±å°è¾¾æ£éä½ä¸æ¥ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public WebResponseContent WMSPickUp(string stationCode,string pickCode) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | string? url = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.WMSPickArrivedUp.ToString())?.ApiAddress; |
| | | if (string.IsNullOrEmpty(url)) throw new Exception($"æªæ¾å°WMSæç®±å°è¾¾æ£éä½ä¸æ¥æ¥å£,è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | ContainerArriveDTO containerArriveDTO = new ContainerArriveDTO() |
| | | { |
| | | SlotCode = stationCode, |
| | | ContainerCode = pickCode |
| | | }; |
| | | string request = JsonConvert.SerializeObject(containerArriveDTO, settings); |
| | | string response = HttpHelper.Post(url, request); |
| | | WMSResponseContent wMSResponse = JsonConvert.DeserializeObject<WMSResponseContent>(response) ?? throw new Exception($"{pickCode},æªæ¥æ¶å°WMSæç®±å°è¾¾æ£éä½ä¸æ¥è¿åå¼"); |
| | | if (wMSResponse.Code != "0") throw new Exception($"æç®±{pickCode}WMSæç®±å°è¾¾æ£éä½ä¸æ¥é误,ä¿¡æ¯:{wMSResponse.Msg}"); |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// ä»»å¡å®æ |
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent TaskCompleted(int taskNum) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); |
| | | if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)//åºåºä»»å¡é»è¾ |
| | | { |
| | | Dt_LocationInfo locationInfo = _locationInfoRepository.QueryFirst(x=>x.PalletCode==task.PalletCode); |
| | | if (locationInfo.LocationStatus != LocationStatusEnum.Lock.ObjToInt()) |
| | | { |
| | | return content.Error($"{locationInfo.LocationCode}è´§ä½ç¶æä¸æ£ç¡®"); |
| | | } |
| | | task.TaskState = TaskStatusEnum.Finish.ObjToInt(); |
| | | locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | locationInfo.PalletCode = ""; |
| | | _unitOfWorkManage.BeginTran(); |
| | | _locationInfoRepository.UpdateData(locationInfo); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User?.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | _unitOfWorkManage.CommitTran(); |
| | | } |
| | | else if(task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//å
¥åºä»»å¡é»è¾ |
| | | { |
| | | string? url = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.WMSInBoundBack.ToString())?.ApiAddress; |
| | | if (string.IsNullOrEmpty(url)) |
| | | { |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"æªæ¾å°WMSå
¥åºä¸æ¥æ¥å£,è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | UpdateTaskExceptionMessage(taskNum, $"æªæ¾å°WMSå
¥åºä¸æ¥æ¥å£,è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | return content.Error($"{taskNum},æªæ¾å°WMSå
¥åºä¸æ¥æ¥å£,è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | } |
| | | ContainerInFinishDTO containerInFinishDTO = new ContainerInFinishDTO() |
| | | { |
| | | TaskCode= task.TaskNum.ToString(), |
| | | ContainerCode = task.PalletCode, |
| | | FromStationCode = task.SourceAddress, |
| | | ToLocationCode = task.TargetAddress |
| | | }; |
| | | string request = JsonConvert.SerializeObject(containerInFinishDTO, settings); |
| | | //è°ç¨æ¥å£ |
| | | string response = HttpHelper.Post(url, request); |
| | | WMSResponseContent wMSResponse = JsonConvert.DeserializeObject<WMSResponseContent>(response) ??throw new Exception($"{taskNum},æªæ¥æ¶å°WMSå
¥åºä¸æ¥è¿åå¼"); |
| | | if (wMSResponse.Code!="0") throw new Exception($"å
¥åºä»»å¡{task.TaskNum}WMSå
¥åºä¸æ¥é误,ä¿¡æ¯:{wMSResponse.Msg}"); |
| | | } |
| | | content.OK("ä»»å¡å®æ"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | } |
| | | } |
| | |
| | | /// <param name="targetAddress">ä¿®æ¹åçç®æ å°å</param> |
| | | /// <param name="currentAddress">ä¿®æ¹åçå½åå°å</param> |
| | | /// <param name="nextAddress">ä¿®æ¹åçä¸ä¸å°å</param> |
| | | public void UpdateTask(Dt_Task task, TaskStatusEnum taskStatus, string deviceCode = "", string sourceAddress = "", string targetAddress = "", string currentAddress = "", string nextAddress = "", string roadwayNo = "", int heightType = 0) |
| | | public void UpdateTask(Dt_Task task, TaskStatusEnum taskStatus, string deviceCode = "", string sourceAddress = "", string targetAddress = "", string currentAddress = "", string nextAddress = "", string roadwayNo = "") |
| | | { |
| | | StringBuilder stringBuilder = new StringBuilder(App.User?.UserId == 0 ? $"ç³»ç»èªå¨æµç¨" : "人工æå¨æµç¨"); |
| | | if (task.DeviceCode != deviceCode && !string.IsNullOrEmpty(deviceCode)) |
| | |
| | | { |
| | | stringBuilder.Append($",å··éå·ç±{task.Roadway}åæ´ä¸º{roadwayNo}"); |
| | | task.Roadway = roadwayNo; |
| | | } |
| | | if (heightType!=0) |
| | | { |
| | | task.HeightType= heightType; |
| | | } |
| | | if (task.TaskState != taskStatus.ObjToInt()) |
| | | { |
| | |
| | | |
| | | task.TaskState = taskStatus.ObjToInt(); |
| | | } |
| | | |
| | | BaseDal.UpdateData(task); |
| | | //忥å°WMS |
| | | string address = AppSettings.Get("WMSApiAddress"); |
| | | if (!string.IsNullOrEmpty(address)) |
| | | { |
| | | HttpHelper.Post($"{address}/api/Task/UpdateTaskInfo", task.Serialize()); |
| | | } |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, stringBuilder.ToString()); |
| | | } |
| | | } |
| | |
| | | { |
| | | try |
| | | { |
| | | var newTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => (x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()|| x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.DeviceCode=="AGV").ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); |
| | | |
| | | if (newTasks.Count>0) |
| | | var newTasksOut = _taskService.Db.Queryable<Dt_Task>().Where(x => (x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()) && x.TaskType==TaskTypeEnum.Outbound.ObjToInt() && x.DeviceCode == "AGV").ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); |
| | | var newTasksIn = _taskService.Db.Queryable<Dt_Task>().Where(x => (x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()) && x.TaskType == TaskTypeEnum.Inbound.ObjToInt() && x.DeviceCode == "AGV").ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); |
| | | #region åºåºä»»å¡ä¸å |
| | | if (newTasksOut.Count>0) |
| | | { |
| | | foreach (var task in newTasks) |
| | | List<string> GroupIds = newTasksOut.GroupBy(x => x.GroupId).Select(x => x.Key).ToList(); |
| | | foreach (var GroupId in GroupIds) |
| | | { |
| | | var tasks = newTasksOut.Where(x => x.GroupId == GroupId).ToList(); |
| | | try |
| | | { |
| | | Guid guid = Guid.NewGuid(); |
| | | AgvTaskSendDTO agvTaskSend = new AgvTaskSendDTO() |
| | | { |
| | | SysToken=guid.ToString().Replace("-",""), |
| | | ReceiveTaskID=task.TaskNum.ToString(), |
| | | MapCode="01", |
| | | Variables=new List<PointDetail>() |
| | | MissionData = new List<MissionDataItem>() |
| | | }; |
| | | if (task.NextAddress== "䏿¥¼æå°ç 头") |
| | | foreach (var task in tasks) |
| | | { |
| | | string? address =_taskService.RequestTargetAddress(task.TaskNum); |
| | | if (address.IsNullOrEmpty()) |
| | | //è·åç®æ ç¹è´§ä½ |
| | | Dt_LocationInfo locationInfoStart = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.CurrentAddress); |
| | | //è·åæ£éåºåºç«å° |
| | | Dt_StationManger stationMangerEnd = _stationMangerRepository.QueryFirst(x => x.PickStationCode == task.NextAddress); |
| | | |
| | | if (locationInfoStart == null || stationMangerEnd == null) throw new Exception($"æªæ¾å°ä»»å¡å·${task.TaskNum}èµ·å§ç¹{task.CurrentAddress}æç®æ ç¹{task.NextAddress}ä½ç½®ä¿¡æ¯"); |
| | | agvTaskSend.RequestId = GroupId; |
| | | agvTaskSend.MissionCode = GroupId; |
| | | if (task.Grade == 0) |
| | | { |
| | | task.ExceptionMessage = "æªæ¾å°AGVç«ç¹"; |
| | | continue; |
| | | } |
| | | task.NextAddress = address; |
| | | } |
| | | Dt_StationManger stationMangerStart = _stationMangerRepository.QueryFirst(x=>x.StationCode==task.CurrentAddress); |
| | | Dt_StationManger stationMangerEnd = _stationMangerRepository.QueryFirst(x => x.StationCode == task.NextAddress); |
| | | //æ·»å ä»»å¡è·¯å¾åé«åº¦ |
| | | if (stationMangerStart !=null && stationMangerEnd != null) |
| | | { |
| | | PointDetail pointDetail1 = new PointDetail() |
| | | { |
| | | Code= "GoodPoint", |
| | | Value=stationMangerStart.AGVStationCode |
| | | }; |
| | | //夿æ¯å¦æåç½®ç¹ |
| | | if (!string.IsNullOrEmpty(stationMangerStart.AGVFrontCode)) |
| | | { |
| | | PointDetail pointDetail2 = new PointDetail() |
| | | { |
| | | Code = "CostPoint", |
| | | Value = stationMangerStart.AGVFrontCode |
| | | }; |
| | | agvTaskSend.Variables.Add(pointDetail2); |
| | | } |
| | | PointDetail pointDetail3 = new PointDetail() |
| | | { |
| | | Code = "PointB", |
| | | Value = stationMangerEnd.AGVStationCode |
| | | }; |
| | | //夿æ¯å¦æåç½®ç¹ |
| | | if (!string.IsNullOrEmpty(stationMangerEnd.AGVFrontCode)) |
| | | { |
| | | PointDetail pointDetail4 = new PointDetail() |
| | | { |
| | | Code = "PointA", |
| | | Value = stationMangerEnd.AGVFrontCode |
| | | }; |
| | | agvTaskSend.Variables.Add(pointDetail4); |
| | | } |
| | | PointDetail pointDetail5 = new PointDetail() |
| | | { |
| | | Code = "QUQTH", |
| | | Value = stationMangerStart.AGVStationHeight.ToString() |
| | | }; |
| | | PointDetail pointDetail6 = new PointDetail() |
| | | { |
| | | Code = "FHMH", |
| | | Value = stationMangerEnd.AGVStationHeight.ToString() |
| | | }; |
| | | agvTaskSend.Variables.Add(pointDetail1); |
| | | agvTaskSend.Variables.Add(pointDetail3); |
| | | agvTaskSend.Variables.Add(pointDetail5); |
| | | agvTaskSend.Variables.Add(pointDetail6); |
| | | } |
| | | else |
| | | { |
| | | throw new Exception("æªæ¾å°AGVç«ç¹"); |
| | | } |
| | | //忾任塿¨¡ç |
| | | if (stationMangerStart.StationCode.Contains("PNT") && !stationMangerEnd.StationCode.Contains("PNT") && stationMangerEnd.IsManual==0)//è¯·æ±æ¾ |
| | | { |
| | | agvTaskSend.TaskCode = "DUIGAO1"; |
| | | if (stationMangerStart.StationType == 998 || stationMangerEnd.StationType == 998)//æ½ä¼é¡¶å车 |
| | | { |
| | | agvTaskSend.TaskCode = "DUOLUN1"; |
| | | } |
| | | } |
| | | else if (!stationMangerStart.StationCode.Contains("PNT") && stationMangerEnd.StationCode.Contains("PNT") && stationMangerStart.IsManual == 0)//请æ±å |
| | | { |
| | | agvTaskSend.TaskCode = "DUIGAO2"; |
| | | if (stationMangerStart.StationType==998 || stationMangerEnd.StationType == 998)//æ½ä¼é¡¶å车 |
| | | { |
| | | agvTaskSend.TaskCode = "DUOLUN2"; |
| | | } |
| | | } |
| | | else if (!stationMangerStart.StationCode.Contains("PNT") && !stationMangerEnd.StationCode.Contains("PNT") && stationMangerStart.IsManual == 0 && stationMangerStart.IsManual == 0)//请æ±åæ¾ |
| | | { |
| | | agvTaskSend.TaskCode = "DUIGAO3"; |
| | | if (stationMangerStart.StationType == 998 || stationMangerEnd.StationType == 998)//æ½ä¼é¡¶å车 |
| | | { |
| | | agvTaskSend.TaskCode = "DUOLUN3"; |
| | | } |
| | | } |
| | | else//æ è¯·æ± |
| | | { |
| | | agvTaskSend.TaskCode = "DUIGAO4"; |
| | | if (stationMangerStart.StationType == 998 || stationMangerEnd.StationType == 998)//æ½ä¼é¡¶å车 |
| | | { |
| | | agvTaskSend.TaskCode = "DUOLUN4"; |
| | | } |
| | | } |
| | | if (stationMangerStart.StationType == 998 || stationMangerEnd.StationType == 998)//æ½ä¼é¡¶å车 |
| | | { |
| | | agvTaskSend.Variables.FirstOrDefault(x => x.Code == "FHMH").Value = "0"; |
| | | agvTaskSend.Variables.FirstOrDefault(x => x.Code == "GoodPoint").Value = ""; |
| | | //å¤æäººå·¥æå¨ |
| | | PointDetail complete = new(); |
| | | if (stationMangerStart.IsManual==1 && stationMangerEnd.IsManual==0) |
| | | { |
| | | complete = new() |
| | | { |
| | | Code = "Complete", |
| | | Value = "1" |
| | | }; |
| | | } |
| | | else if (stationMangerStart.IsManual == 0 && stationMangerEnd.IsManual == 1) |
| | | { |
| | | complete = new() |
| | | { |
| | | Code = "Complete", |
| | | Value = "2" |
| | | }; |
| | | } |
| | | else if (stationMangerStart.IsManual == 1 && stationMangerEnd.IsManual == 1) |
| | | { |
| | | complete = new() |
| | | { |
| | | Code = "Complete", |
| | | Value = "3" |
| | | }; |
| | | agvTaskSend.Priority = 99; |
| | | } |
| | | else |
| | | { |
| | | complete = new() |
| | | { |
| | | Code = "Complete", |
| | | Value = "0" |
| | | }; |
| | | agvTaskSend.Priority = 99 - task.Grade; |
| | | } |
| | | //ä¸åä»»å¡AGVä»»å¡é群 |
| | | agvTaskSend.AgvGroupCode = "QianF"; |
| | | PointDetail pointDetail2 = new PointDetail() |
| | | //æç®±åæ¬è¿ä»»å¡ |
| | | MissionDataItem missionDataItem = new MissionDataItem() |
| | | { |
| | | Code = "CostPoint", |
| | | Value = stationMangerStart.AGVStationCode |
| | | Sequence = task.TaskNum, |
| | | BinCode = task.PalletCode, |
| | | StartPosition = locationInfoStart.AgvPoint, |
| | | StartSlotCode = locationInfoStart.LocationCode, |
| | | EndPosition = stationMangerEnd.StationCode, |
| | | EndSlotCode = stationMangerEnd.CraneStationCode, |
| | | TakeActionConfirm = false, |
| | | TakeActionInform = false, |
| | | PutActionConfirm = true, |
| | | PutActionInform = true, |
| | | }; |
| | | agvTaskSend.Variables.Add(pointDetail2); |
| | | agvTaskSend.Variables.Add(complete); |
| | | } |
| | | if (task.TaskType==TaskTypeEnum.OutCarton.ObjToInt()) |
| | | { |
| | | agvTaskSend.AgvGroupCode = "GAOc"; |
| | | agvTaskSend.MissionData.Add(missionDataItem); |
| | | } |
| | | //åéAGVä»»å¡ |
| | | WebResponseContent content = _taskService.AgvSendTask(agvTaskSend, APIEnum.AgvSendTask); |
| | | if (!content.Status) |
| | | throw new Exception(content.Message); |
| | | task.Dispatchertime = DateTime.Now; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing); |
| | | tasks.ForEach(x => |
| | | { |
| | | x.Dispatchertime = DateTime.Now; |
| | | x.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt(); |
| | | }); |
| | | _taskService.UpdateData(tasks); |
| | | Thread.Sleep(500); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | tasks.ForEach(x => |
| | | { |
| | | x.TaskState = TaskStatusEnum.Exception.ObjToInt(); |
| | | x.ExceptionMessage = ex.Message; |
| | | }); |
| | | _taskService.UpdateData(tasks); |
| | | } |
| | | } |
| | | } |
| | | #endregion |
| | | #region å
¥åºä»»å¡ä¸å |
| | | if (newTasksIn.Count > 0) |
| | | { |
| | | foreach (var task in newTasksIn) |
| | | { |
| | | try |
| | | { |
| | | AgvTaskSendDTO agvTaskSend = new AgvTaskSendDTO() |
| | | { |
| | | MissionData = new List<MissionDataItem>() |
| | | }; |
| | | //è·åç®æ ç¹è´§ä½ |
| | | Dt_LocationInfo locationInfoEnd = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.NextAddress); |
| | | //è·å线ä½å
¥åºç«å° |
| | | Dt_StationManger stationMangerStart = _stationMangerRepository.QueryFirst(x => x.PickStationCode == task.CurrentAddress); |
| | | if (locationInfoEnd == null || stationMangerStart == null) throw new Exception($"æªæ¾å°ä»»å¡å·${task.TaskNum}èµ·å§ç¹{task.CurrentAddress}æç®æ ç¹{task.NextAddress}ä½ç½®ä¿¡æ¯"); |
| | | agvTaskSend.RequestId = Guid.NewGuid().ToString().Replace("-", ""); |
| | | agvTaskSend.MissionCode = task.TaskNum.ToString(); |
| | | if (task.Grade == 0) |
| | | { |
| | | agvTaskSend.Priority = 99; |
| | | } |
| | | else |
| | | { |
| | | agvTaskSend.Priority = 99 - task.Grade; |
| | | } |
| | | //æç®±åæ¬è¿ä»»å¡ |
| | | MissionDataItem missionDataItem = new MissionDataItem() |
| | | { |
| | | Sequence = task.TaskNum, |
| | | BinCode = task.PalletCode, |
| | | StartPosition = stationMangerStart.StationCode, |
| | | StartSlotCode = stationMangerStart.CraneStationCode, |
| | | EndPosition = locationInfoEnd.AgvPoint, |
| | | EndSlotCode = locationInfoEnd.LocationCode, |
| | | TakeActionConfirm = false, |
| | | TakeActionInform = false, |
| | | PutActionConfirm = true, |
| | | PutActionInform = true, |
| | | }; |
| | | agvTaskSend.MissionData.Add(missionDataItem); |
| | | //åéAGVä»»å¡ |
| | | WebResponseContent content = _taskService.AgvSendTask(agvTaskSend, APIEnum.AgvSendTask); |
| | | if (!content.Status) |
| | | throw new Exception(content.Message); |
| | | task.Dispatchertime = DateTime.Now; task.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt(); |
| | | _taskService.UpdateData(task); |
| | | Thread.Sleep(500); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | task.TaskState = TaskStatusEnum.Exception.ObjToInt(); |
| | | task.ExceptionMessage = ex.Message; |
| | | _taskService.UpdateData(task); |
| | | } |
| | | } |
| | | //æ´æ°ä»»å¡ |
| | | if (newTasks.Count > 0) |
| | | { |
| | | _taskService.UpdateData(newTasks); |
| | | } |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | | private readonly IRouterService _routerService; |
| | | private readonly IStationMangerRepository _stationMangerRepository; |
| | | private readonly ILocationInfoRepository _locationInfoRepository; |
| | | private readonly IMapper _mapper; |
| | | |
| | | public AGVJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IStationMangerRepository stationMangerRepository, IMapper mapper) |
| | | public AGVJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IStationMangerRepository stationMangerRepository, ILocationInfoRepository locationInfoRepository, IMapper mapper) |
| | | { |
| | | _taskService = taskService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | | _routerService = routerService; |
| | | _stationMangerRepository = stationMangerRepository; |
| | | _locationInfoRepository = locationInfoRepository; |
| | | _mapper = mapper; |
| | | } |
| | | public Task Execute(IJobExecutionContext context) |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | public enum ConveyorLineDBName |
| | | { |
| | | /// <summary> |
| | | /// å
¥åºç³è¯·(读) |
| | | /// </summary> |
| | | R_InRequest, |
| | | /// <summary> |
| | | /// å
¥åºç¡®è®¤(å) |
| | | /// </summary> |
| | | W_InResponse, |
| | | /// <summary> |
| | | /// å
¥åºéé(读) |
| | | /// </summary> |
| | | R_InWeight, |
| | | /// <summary> |
| | | /// å
¥åºæ¡ç (读) |
| | | /// </summary> |
| | | R_InBarCode, |
| | | /// <summary> |
| | | /// æ£éç³è¯·(读) |
| | | /// </summary> |
| | | R_PickRequest, |
| | | /// <summary> |
| | | /// æ£éæ¡ç (读) |
| | | /// </summary> |
| | | R_PickBarCode, |
| | | /// <summary> |
| | | /// æ£éå»å(å) |
| | | /// </summary> |
| | | W_PickToHode, |
| | | /// <summary> |
| | | /// æ£é确认(å) |
| | | /// </summary> |
| | | W_PickResponse, |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using Autofac.Core; |
| | | using AutoMapper; |
| | | using Quartz; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Reflection; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.DTO; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | [DisallowConcurrentExecution] |
| | | public partial class ConveyorLineJob2 : JobBase, IJob |
| | | { |
| | | public readonly ITaskService _taskService; |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | | private readonly IRouterService _routerService; |
| | | private readonly IStationMangerRepository _stationMangerRepository; |
| | | private readonly ILocationInfoRepository _locationInfoRepository; |
| | | private readonly IMapper _mapper; |
| | | |
| | | public ConveyorLineJob2(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IStationMangerRepository stationMangerRepository, ILocationInfoRepository locationInfoRepository, IMapper mapper) |
| | | { |
| | | _taskService = taskService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | | _routerService = routerService; |
| | | _stationMangerRepository = stationMangerRepository; |
| | | _locationInfoRepository = locationInfoRepository; |
| | | _mapper = mapper; |
| | | } |
| | | public Task Execute(IJobExecutionContext context) |
| | | { |
| | | try |
| | | { |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | if (conveyorLine != null) |
| | | { |
| | | #region ç«å°æ¹å¼ |
| | | |
| | | List<Dt_StationManger> stationManagers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == conveyorLine.DeviceCode); |
| | | |
| | | foreach (var station in stationManagers) |
| | | { |
| | | if (station.StationType==StationTypeEnum.StationType_OnlyOutbound.ObjToInt()) //æ£éç³è¯· |
| | | { |
| | | bool PickRequest = conveyorLine.GetValue<ConveyorLineDBName, bool>(ConveyorLineDBName.R_PickRequest, station.StationCode); |
| | | if (PickRequest) |
| | | { |
| | | string PickBarCode = conveyorLine.GetValue<ConveyorLineDBName, string>(ConveyorLineDBName.R_PickBarCode, station.StationCode).Replace("\0", ""); |
| | | //䏿¥WMSæç®±å°è¾¾ |
| | | if (PickBarCode.IsNotEmptyOrNull()) |
| | | { |
| | | WebResponseContent content = _taskService.WMSPickUp(station.PickStationCode, PickBarCode); |
| | | if (content.Status) |
| | | { |
| | | //åå
¥æ£é确认 |
| | | } |
| | | } |
| | | else |
| | | { |
| | | WriteError(nameof(conveyorLine.DeviceCode), $"{station.StationCode}æ£éç³è¯·ä¸º{PickRequest}æ¡ç 为空å¼"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | |
| | | } |
| | | |
| | | } |
| | | #endregion ç«å°æ¹å¼ |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteError(nameof(ConveyorLineJob2), ex.Message); |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
| | | } |
| | | } |
| | |
| | | if (flag && value != null) |
| | | { |
| | | OtherDevice device = (OtherDevice)value; |
| | | List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StackerCraneCode == device.DeviceCode && x.StationType == StationTypeEnum.StationType_InStartAndOutEnd.ObjToInt() && x.IsOccupied == 0); |
| | | List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.CraneCode == device.DeviceCode); |
| | | foreach (var item in stationMangers) |
| | | { |
| | | //è·ååè®® |
| | | DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StackerCraneCode && x.DeviceProParamType == nameof(R_MDDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); |
| | | DeviceProDTO? deviceProWrite = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StackerCraneCode && x.DeviceProParamType == nameof(W_MDDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); |
| | | DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.CraneCode && x.DeviceProParamType == nameof(R_MDDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); |
| | | DeviceProDTO? deviceProWrite = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.CraneCode && x.DeviceProParamType == nameof(W_MDDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); |
| | | if (deviceProRead != null && deviceProWrite != null) |
| | | { |
| | | short Allow = device.GetValue<R_MDDB, short>(R_MDDB.R_MDAllow, item.StackerCraneCode); |
| | | short Allow = device.GetValue<R_MDDB, short>(R_MDDB.R_MDAllow, item.CraneCode); |
| | | |
| | | #region 读åå·¥ä½ç¶æ |
| | | short R_MDStatus1 = device.GetValue<R_MDDB, short>(R_MDDB.R_MDStatus1, item.StackerCraneCode); |
| | | short R_MDStatus2 = device.GetValue<R_MDDB, short>(R_MDDB.R_MDStatus2, item.StackerCraneCode); |
| | | short R_MDStatus3 = device.GetValue<R_MDDB, short>(R_MDDB.R_MDStatus3, item.StackerCraneCode); |
| | | short R_MDStatus4 = device.GetValue<R_MDDB, short>(R_MDDB.R_MDStatus4, item.StackerCraneCode); |
| | | short R_MDStatus1 = device.GetValue<R_MDDB, short>(R_MDDB.R_MDStatus1, item.CraneCode); |
| | | short R_MDStatus2 = device.GetValue<R_MDDB, short>(R_MDDB.R_MDStatus2, item.CraneCode); |
| | | short R_MDStatus3 = device.GetValue<R_MDDB, short>(R_MDDB.R_MDStatus3, item.CraneCode); |
| | | short R_MDStatus4 = device.GetValue<R_MDDB, short>(R_MDDB.R_MDStatus4, item.CraneCode); |
| | | |
| | | short ReceiveDoneState = device.GetValue<W_MDDB, short>(W_MDDB.W_MDReceiveDone, item.StackerCraneCode); |
| | | short ReceiveDoneState = device.GetValue<W_MDDB, short>(W_MDDB.W_MDReceiveDone, item.CraneCode); |
| | | #endregion |
| | | //ç åç¶æ |
| | | short PackState = device.GetValue<R_MDDB, short>(GetPackStateEnum(item.StackerCraneStationCode), item.StackerCraneCode); |
| | | short PackState = device.GetValue<R_MDDB, short>(GetPackStateEnum(item.CraneStationCode), item.CraneCode); |
| | | //ç åæ°é |
| | | short PackNum = device.GetValue<R_MDDB, short>(GetPackNumEnum(item.StackerCraneStationCode), item.StackerCraneCode); |
| | | short PackNum = device.GetValue<R_MDDB, short>(GetPackNumEnum(item.CraneStationCode), item.CraneCode); |
| | | if (R_MDStatus1 == 1 || R_MDStatus2 == 1 || R_MDStatus3 == 1 || R_MDStatus4 == 1) |
| | | { |
| | | Thread.Sleep(200); |
| | | if (ReceiveDoneState != 0) |
| | | { |
| | | device.Communicator.Write<short>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDReceiveDone.ToString()).DeviceProDataBlock, 0); |
| | | WriteInfo(item.StackerCraneCode, $"{item.StackerCraneCode}æ¸
é¤ä¸åæ è¯ä¿¡å·"); |
| | | WriteInfo(item.CraneCode, $"{item.CraneCode}æ¸
é¤ä¸åæ è¯ä¿¡å·"); |
| | | } |
| | | continue; |
| | | } |
| | | if (PackState == 2) |
| | | { |
| | | Thread.Sleep(200); |
| | | device.Communicator.Write<float>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == GetPackSendEnum(item.StackerCraneStationCode).ToString()).DeviceProDataBlock, 0); |
| | | device.Communicator.Write<float>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == GetPackSendEnum(item.CraneStationCode).ToString()).DeviceProDataBlock, 0); |
| | | WriteInfo(item.StationName, $"{item.StationName}æ¸
é¤å·¥ä½ç»æä¿¡å·"); |
| | | continue; |
| | | } |
| | | device.Communicator.Write<short>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == GetPackSendEnum(item.StackerCraneStationCode).ToString()).DeviceProDataBlock, 2); |
| | | device.Communicator.Write<short>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == GetPackSendEnum(item.CraneStationCode).ToString()).DeviceProDataBlock, 2); |
| | | WriteInfo(item.StationName, $"{item.StationName}åå
¥å·¥ä½ç»æä¿¡å·"); |
| | | //è·åå½åä»»å¡ |
| | | Dt_Task task = _taskRepository.QueryData(x => x.NextAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.DeviceCode == device.DeviceCode).OrderBy(x => x.TaskNum).FirstOrDefault(); |
| | |
| | | if (task != null) |
| | | { |
| | | //åå
¥å·¥ä½å· |
| | | device.Communicator.Write<short>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDSendID.ToString()).DeviceProDataBlock, Convert.ToInt16(item.StackerCraneStationCode)); |
| | | device.Communicator.Write<short>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == W_MDDB.W_MDSendID.ToString()).DeviceProDataBlock, Convert.ToInt16(item.CraneStationCode)); |
| | | //åå
¥å·¥ä½å
许ç å |
| | | device.Communicator.Write<short>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == GetPackSendEnum(item.StackerCraneStationCode).ToString()).DeviceProDataBlock, 1); |
| | | device.Communicator.Write<short>(device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == GetPackSendEnum(item.CraneStationCode).ToString()).DeviceProDataBlock, 1); |
| | | |
| | | #region è·ååå
¥ç åXãYãZåæ |
| | | |