| | |
| | | //tracklog_content = JsonConvert.SerializeObject(entity), |
| | | tracklog_content = entity is string strEntity ? strEntity : JsonConvert.SerializeObject(entity),//妿entityæ¯å符串类åï¼åç´æ¥ä½¿ç¨ï¼å¦ååºåå为JSONå符串 |
| | | tracklog_createtime = DateTime.Now, |
| | | Creater = "system", |
| | | tracklog_type = content.Status ? "æå" : "失败", |
| | | tracklog_code = content.Status ? logCode : ("4" + logCode), |
| | | tracklog_des = description, |
| | |
| | | { |
| | | public string groupId { get; set; } |
| | | public string msgTime { get; set; } |
| | | public List<GALAXISTask> tasks { get; set; } |
| | | public List<GALAXISTask> tasks { get; set; }=new List<GALAXISTask>(); |
| | | } |
| | | |
| | | public class GALAXISTask |
| | |
| | | { |
| | | "urls": "http://*:9291", //webæå¡ç«¯å£ï¼å¦æç¨IISé¨ç½²ï¼æè¿ä¸ªå»æ |
| | | "Logging": { |
| | | "LogLevel": { |
| | | "Default": "Information", |
| | | "Microsoft.AspNetCore": "Warning" |
| | | } |
| | | }, |
| | | "dics": "deviceType,devicePlcType,jobAssembly,jobClassName,deviceStatus,taskType,taskState,inOutType", |
| | | "AllowedHosts": "*", |
| | | "ConnectionStringsEncryption": false, |
| | | "MainDB": "DB_WIDESEA", //å½å项ç®ç主åºï¼æå¯¹åºçè¿æ¥å符串çEnabledå¿
须为true |
| | | //1.MySql |
| | | //2.SqlServer |
| | | //3.Sqlite |
| | | //4.Oracle |
| | | //5.PostgreSQL |
| | | "DBType": "SqlServer", |
| | | //è¿æ¥å符串 |
| | | "ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWCS_GP;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | //è·¨å |
| | | "Cors": { |
| | | "PolicyName": "CorsIpAccess", //çç¥åç§° |
| | | "EnableAllIPs": true, //å½ä¸ºtrueæ¶ï¼å¼æ¾ææIPåå¯è®¿é®ã |
| | | // æ¯æå¤ä¸ªåå端å£ï¼æ³¨æç«¯å£å·åä¸è¦å¸¦/ææï¼æ¯å¦localhost:8000/ï¼æ¯éç |
| | | // 注æï¼http://127.0.0.1:1818 å http://localhost:1818 æ¯ä¸ä¸æ ·ç |
| | | "IPs": "http://127.0.0.1:8080,http://localhost:8080" |
| | | }, |
| | | "ApiLogIgnore": "", //è®°å½æ¥å¿æ¶ï¼å¿½ç¥çAPIåç§°ï¼å¤ä¸ªç¨éå·åéï¼é
ç½®çä¸è®°å½å°æ°æ®åºä¸ |
| | | "ApiName": "WIDESEAWCS", |
| | | "ExpMinutes": 120, |
| | | "QuartzJobAutoStart": true, |
| | | "DBSeedEnable": false, |
| | | "QuartzDBSeedEnable": false, |
| | | "LogDeubgEnable": true, //æ¯å¦è®°å½è°è¯æ¥å¿ |
| | | "PrintSql": false, //æå°SQLè¯å¥ |
| | | "LogAOPEnable": true, //æ¯å¦è®°å½AOPæ¥å¿ |
| | | "WebSocketEnable": true, //æ¯å¦å¼å¯WebSocketæå¡ |
| | | "WebSocketPort": 9296 //WebSocketæå¡ç«¯å£ |
| | | "urls": "http://*:9291", //webæå¡ç«¯å£ï¼å¦æç¨IISé¨ç½²ï¼æè¿ä¸ªå»æ |
| | | "Logging": { |
| | | "LogLevel": { |
| | | "Default": "Information", |
| | | "Microsoft.AspNetCore": "Warning" |
| | | } |
| | | }, |
| | | "dics": "deviceType,devicePlcType,jobAssembly,jobClassName,deviceStatus,taskType,taskState,inOutType,TaskStatusEnum,TaskTypeEnum", |
| | | "AllowedHosts": "*", |
| | | "ConnectionStringsEncryption": false, |
| | | "MainDB": "DB_WIDESEA", //å½å项ç®ç主åºï¼æå¯¹åºçè¿æ¥å符串çEnabledå¿
须为true |
| | | //1.MySql |
| | | //2.SqlServer |
| | | //3.Sqlite |
| | | //4.Oracle |
| | | //5.PostgreSQL |
| | | "DBType": "SqlServer", |
| | | //è¿æ¥å符串 |
| | | "ConnectionString": "Data Source=172.16.161.20;Initial Catalog=WIDESEAWCS_GP;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | //è·¨å |
| | | "Cors": { |
| | | "PolicyName": "CorsIpAccess", //çç¥åç§° |
| | | "EnableAllIPs": true, //å½ä¸ºtrueæ¶ï¼å¼æ¾ææIPåå¯è®¿é®ã |
| | | // æ¯æå¤ä¸ªåå端å£ï¼æ³¨æç«¯å£å·åä¸è¦å¸¦/ææï¼æ¯å¦localhost:8000/ï¼æ¯éç |
| | | // 注æï¼http://127.0.0.1:1818 å http://localhost:1818 æ¯ä¸ä¸æ ·ç |
| | | "IPs": "http://127.0.0.1:8080,http://localhost:8080" |
| | | }, |
| | | "ApiLogIgnore": "", //è®°å½æ¥å¿æ¶ï¼å¿½ç¥çAPIåç§°ï¼å¤ä¸ªç¨éå·åéï¼é
ç½®çä¸è®°å½å°æ°æ®åºä¸ |
| | | "ApiName": "WIDESEAWCS", |
| | | "ExpMinutes": 120, |
| | | "QuartzJobAutoStart": true, |
| | | "DBSeedEnable": false, |
| | | "QuartzDBSeedEnable": false, |
| | | "LogDeubgEnable": true, //æ¯å¦è®°å½è°è¯æ¥å¿ |
| | | "PrintSql": false, //æå°SQLè¯å¥ |
| | | "LogAOPEnable": true, //æ¯å¦è®°å½AOPæ¥å¿ |
| | | "WebSocketEnable": true, //æ¯å¦å¼å¯WebSocketæå¡ |
| | | "WebSocketPort": 9296 //WebSocketæå¡ç«¯å£ |
| | | } |
| | |
| | | using WIDESEAWCS_Common.LocationEnum; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_DTO; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Core.Helper; |
| | | |
| | | namespace WIDESEAWCS_TaskInfoService |
| | | { |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | int containerType = taskDTO.containerCode.Contains("LLM") ? LocationTypeEnum.LargePallet.ObjToInt() : LocationTypeEnum.SmallPallet.ObjToInt(); |
| | | int containerType = taskDTO.containerCode.Contains("LLM") ? (int)LocationTypeEnum.LargePallet : (int)LocationTypeEnum.SmallPallet; |
| | | #region ç¹å°ç¹ |
| | | if (!string.IsNullOrEmpty(taskDTO.toLocationCode)) |
| | | { |
| | | var LocationInfo = _kLSLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.toLocationCode) ?? throw new Exception($"æªæ¾å°ç»ç¹è´§ä½ã{taskDTO.toLocationCode}ã"); |
| | | if (LocationInfo.LocationStatus != LocationStatusEnum.Free.ObjToInt()) throw new Exception($"ç»ç¹è´§ä½ã{taskDTO.toLocationCode}ãè´§ä½ç¶æä¸ä¸ºç©ºè´§ä½"); |
| | | if (LocationInfo.LocationStatus != (int)LocationStatusEnum.Free) throw new Exception($"ç»ç¹è´§ä½ã{taskDTO.toLocationCode}ãè´§ä½ç¶æä¸ä¸ºç©ºè´§ä½"); |
| | | } |
| | | #endregion |
| | | //è·åè´§ä½ä¿¡æ¯ |
| | |
| | | Grade = taskDTO.taskPriority, |
| | | PalletCode = taskDTO.containerCode, |
| | | Roadway = kLSLocationInfo.RoadwayNo, |
| | | TaskState = TaskStatusEnum.New.ObjToInt(), |
| | | TaskState = (int)TaskStatusEnum.New, |
| | | TaskType = taskType, |
| | | SourceAddress = taskDTO.fromLocationCode, |
| | | CurrentAddress = taskDTO.fromLocationCode, |
| | |
| | | TargetAddress = kLSLocationInfo.LocationCode, |
| | | Creater = "WMS", |
| | | }; |
| | | kLSLocationInfo.LocationStatus = LocationStatusEnum.InLock.ObjToInt(); |
| | | kLSLocationInfo.LocationStatus = (int)LocationStatusEnum.InLock; |
| | | #region ä¸åå¯ä¹å£«ä»»å¡ |
| | | content = SendKLSTask(dt_Task); |
| | | if (!content.Status) throw new Exception(content.Message); |
| | | dt_Task.TaskState = (int)TaskStatusEnum.Execut; |
| | | #endregion |
| | | try |
| | | { |
| | | Db.Ado.BeginTran(); |
| | |
| | | try |
| | | { |
| | | Dt_KLSLocationInfo? kLSLocationInfo = _kLSLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.fromLocationCode) ?? throw new Exception($"æªæ¾å°èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãï¼"); |
| | | if (kLSLocationInfo.LocationStatus != LocationStatusEnum.InStock.ObjToInt()) throw new Exception($"èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãå½ååºä½ç¶æä¸å¯åºåºï¼"); |
| | | if (kLSLocationInfo.LocationStatus != (int)LocationStatusEnum.InStock) throw new Exception($"èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãå½ååºä½ç¶æä¸å¯åºåºï¼"); |
| | | Dt_Task dt_Task = new() |
| | | { |
| | | TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | |
| | | Grade = taskDTO.taskPriority, |
| | | PalletCode = taskDTO.containerCode, |
| | | Roadway = kLSLocationInfo.RoadwayNo, |
| | | TaskState = TaskStatusEnum.New.ObjToInt(), |
| | | TaskState = (int)TaskStatusEnum.New, |
| | | TaskType = taskType, |
| | | SourceAddress = taskDTO.fromLocationCode, |
| | | CurrentAddress = taskDTO.fromLocationCode, |
| | |
| | | TargetAddress = taskDTO.toLocationCode, |
| | | Creater = "WMS", |
| | | }; |
| | | kLSLocationInfo.LocationStatus = LocationStatusEnum.OutLock.ObjToInt(); |
| | | kLSLocationInfo.LocationStatus = (int)LocationStatusEnum.OutLock; |
| | | #region ä¸åå¯ä¹å£«ä»»å¡ |
| | | content = SendKLSTask(dt_Task); |
| | | if (!content.Status) throw new Exception(content.Message); |
| | | dt_Task.TaskState = (int)TaskStatusEnum.Execut; |
| | | #endregion |
| | | try |
| | | { |
| | | Db.Ado.BeginTran(); |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region ä¸åå¯ä¹å£«ä»»å¡ |
| | | public WebResponseContent SendKLSTask(Dt_Task task) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | GALAXISTaskInfo gALAXISTaskInfo = new(); |
| | | GALAXISReturn agvContent = new(); |
| | | try |
| | | { |
| | | gALAXISTaskInfo.groupId = DateTime.Now.ToString("yyMMddHHmmss") + task.TaskNum; |
| | | gALAXISTaskInfo.msgTime = DateTime.Now.ToString(); |
| | | GALAXISTask gALAXISTask = new GALAXISTask() |
| | | { |
| | | taskId = task.WMSTaskNum, |
| | | taskType = task.TaskType == (int)TaskTypeEnum.MLInbound ? 0 : 1, |
| | | barCode = task.PalletCode, |
| | | endNode = task.TargetAddress, |
| | | startNode = task.SourceAddress, |
| | | priorityCode = task.Grade |
| | | }; |
| | | gALAXISTaskInfo.tasks.Add(gALAXISTask); |
| | | Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(GALAXISTaskInfo)) ?? throw new Exception("æªæ¾å°å¯ä¹å£«AGVä»»å¡ä¸åæ¥å£é
置信æ¯ï¼è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, gALAXISTaskInfo.Serialize()); |
| | | agvContent = response.DeserializeObject<GALAXISReturn>(); |
| | | content.OK(data: agvContent); |
| | | if (agvContent.success) |
| | | { |
| | | if (agvContent.data.returnStatus != 0) throw new Exception(agvContent.data.returnInfo); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | finally |
| | | { |
| | | _trackloginfoService.AddTrackLog(gALAXISTaskInfo, content, "ä¸åå¯ä¹å£«AGVä»»å¡", "", agvContent.data.returnInfo); |
| | | } |
| | | return content; |
| | | } |
| | | #endregion |
| | | |
| | | #region 5 跨楼å±è¿è¾ä»»å¡å建 |
| | | public WebResponseContent CarryTask(TaskDTO taskDTO, int taskType) |
| | | { |
| | |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); // å建ååºå¯¹è±¡ |
| | | GALAXISTaskInfo gALAXISTaskInfo = new(); |
| | | GALAXISReturn agvContent = new(); |
| | | try |
| | | { |
| | | gALAXISTaskInfo.groupId = DateTime.Now.ToString("yyMMddHHmmss"); |
| | |
| | | } |
| | | Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(GALAXISTaskInfo)) ?? throw new Exception("æªæ¾å°å¯ä¹å£«AGVä»»å¡ä¸åæ¥å£é
置信æ¯ï¼è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, gALAXISTaskInfo.Serialize()); |
| | | GALAXISReturn agvContent = response.DeserializeObject<GALAXISReturn>(); |
| | | agvContent = response.DeserializeObject<GALAXISReturn>(); |
| | | content.OK(data: agvContent); |
| | | if (agvContent.success) |
| | | { |
| | |
| | | } |
| | | finally |
| | | { |
| | | _trackloginfoService.AddTrackLog(gALAXISTaskInfo, content, "ä¸åå¯ä¹å£«AGVä»»å¡","",""); |
| | | _trackloginfoService.AddTrackLog(gALAXISTaskInfo, content, "ä¸åå¯ä¹å£«AGVä»»å¡", "", agvContent.data.returnInfo); |
| | | //dt_trackloginfoService.Instance.AddTrackLog(outTaskInfo, content, "æ¥æ¶å®èªWMSåºåºä»»å¡ä¸å", "", $"{msg},åæ´ç»æ:{content.Status}"); |
| | | } |
| | | } |
| | |
| | | if (newTasks.Count > 0) |
| | | { |
| | | #region æ¥æ¾å¯ä¹å£«ä»»å¡ |
| | | var Tasks = newTasks.Where(x => x.TaskType == (int)TaskTypeEnum.MLInbound || x.TaskType == (int)TaskTypeEnum.MLOutbound).OrderByDescending(x => x.Grade).ToList(); |
| | | if (Tasks.Count > 0) SendGALAXISTask(Tasks); |
| | | //var Tasks = newTasks.Where(x => x.TaskType == (int)TaskTypeEnum.MLInbound || x.TaskType == (int)TaskTypeEnum.MLOutbound).OrderByDescending(x => x.Grade).ToList(); |
| | | //if (Tasks.Count > 0) SendGALAXISTask(Tasks); |
| | | #endregion |
| | | |
| | | #region æ¥æ¾RGVä»»å¡ |
| | | Tasks = newTasks.Where(x => x.TaskType == (int)TaskTypeEnum.CPInbound).OrderByDescending(x => x.Grade).ToList(); |
| | | var Tasks = newTasks.Where(x => x.TaskType == (int)TaskTypeEnum.CPInbound).OrderByDescending(x => x.Grade).ToList(); |
| | | if (Tasks.Count > 0) SendRGVNewInTask(Tasks); |
| | | Tasks = newTasks.Where(x => x.TaskType == (int)TaskTypeEnum.CPOutbound).OrderByDescending(x => x.Grade).ToList(); |
| | | if (Tasks.Count > 0) IsMoveTask(Tasks); |