| | |
| | | response = HttpHelper.Post(apiInfo.ApiAddress, requestParameters); |
| | | requestHash = ComputeHash(requestParameters); |
| | | responseHash = ComputeHash(response); |
| | | if (apiInfo.Remark.Contains("åå车")) |
| | | if (apiInfo.Remark.Contains("ååç©¿æ¢è½¦")) |
| | | { |
| | | FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>(); |
| | | if (fOURBOTReturn == null) throw new Exception($"{apiInfo.Remark}ååºå
容转æ¢å®ä½å¤±è´¥ï¼"); |
| | |
| | | }; |
| | | public IRepository<Dt_HKLocationInfo> Repository => BaseDal; |
| | | |
| | | public Dt_HKLocationInfo? GetFreeLocationInfo(string toAreaCode) |
| | | public Dt_HKLocationInfo? GetFreeLocationInfo(string toAreaCode, int containerType) |
| | | { |
| | | Dt_HKLocationInfo hKLocationInfo = BaseDal.QueryFirst(x => x.WarehouseId.ToString() == toAreaCode && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.LocationStatus == LocationStatusEnum.Free.ObjToInt(), _emptyAssignOrderBy); |
| | | Dt_HKLocationInfo hKLocationInfo = BaseDal.QueryFirst(x => x.WarehouseId.ToString() == toAreaCode && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.LocationType == containerType, _emptyAssignOrderBy); |
| | | return hKLocationInfo; |
| | | } |
| | | |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEAWCS_DTO.WMS |
| | | { |
| | | public class PLCAlarmDTO |
| | | { |
| | | /// <summary> |
| | | /// æ¥è¦ä¿¡æ¯ |
| | | /// </summary> |
| | | public string errorMsg { get; set; } |
| | | } |
| | | } |
| | |
| | | { |
| | | public IRepository<Dt_HKLocationInfo> Repository { get; } |
| | | |
| | | Dt_HKLocationInfo? GetFreeLocationInfo(string toAreaCode); |
| | | Dt_HKLocationInfo? GetFreeLocationInfo(string toAreaCode, int containerType); |
| | | } |
| | | } |
| | |
| | | /// <returns></returns> |
| | | WebResponseContent HKDeviceAlarm(HKDeviceAalarmDTO hKDeviceAalarmDTO); |
| | | |
| | | |
| | | WebResponseContent PLCAlarmtoWMS(string ErrorMsg); |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_DTO; |
| | | using WIDESEAWCS_DTO.AGV.HIKROBOT; |
| | | using WIDESEAWCS_DTO.RGV.FOURBOT; |
| | | using WIDESEAWCS_DTO.WMS; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | |
| | | namespace WIDESEAWCS_Server.Controllers.AGV |
| | |
| | | |
| | | return returnHK; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// æµ·åº·è®¾å¤æ¥è¦æ¥å£ |
| | | /// </summary> |
| | | /// <param name="taskDTOs"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("HKDeviceAlarm"), AllowAnonymous] |
| | | public HIKROBOTReturn HKDeviceAlarm([FromBody]HKDeviceAalarmDTO hKDeviceAalarmDTO) |
| | | { |
| | | HIKROBOTReturn returnHK = new HIKROBOTReturn(); |
| | | var take = _taskService.HKDeviceAlarm(hKDeviceAalarmDTO); |
| | | if (take.Status) |
| | | { |
| | | returnHK.code = "SUCCESS"; |
| | | returnHK.message = "succ"; |
| | | } |
| | | else |
| | | { |
| | | returnHK.code = "404"; |
| | | returnHK.message = take.Message; |
| | | } |
| | | |
| | | return returnHK; |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | try |
| | | { |
| | | Dt_HKLocationInfo? hKLocationInfo = null; |
| | | int containerType = taskDTO.containerCode.Contains("LXM") ? (int)LocationTypeEnum.LargePallet : (int)LocationTypeEnum.SmallPallet; |
| | | if (taskType == (int)TaskTypeEnum.STURR) |
| | | { |
| | | var reslut = _stationInfo.Repository.QueryFirst(x => x.StationCode == taskDTO.fromLocationCode) ?? throw new Exception($"æªæ¾å°èµ·ç¹è´§ä½ã{taskDTO.fromLocationCode}ã"); |
| | |
| | | #endregion |
| | | //è·åè´§ä½ä¿¡æ¯ |
| | | else |
| | | hKLocationInfo = _hKLocationInfoService.GetFreeLocationInfo(taskDTO.toAreaCode) ?? throw new Exception($"æªæ¾å°ç»ç¹åºåºã{taskDTO.toAreaCode}ãå¯ç¨ç©ºè´§ä½ï¼"); |
| | | hKLocationInfo = _hKLocationInfoService.GetFreeLocationInfo(taskDTO.toAreaCode, containerType) ?? throw new Exception($"æªæ¾å°ç»ç¹åºåºã{taskDTO.toAreaCode}ãå¯ç¨ç©ºè´§ä½ï¼"); |
| | | if (taskType == (int)TaskTypeEnum.Q1TSJ4) |
| | | { |
| | | var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "TSJ") as OtherDevice; |
| | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// æµ·åº·è®¾å¤æ¥è¦ |
| | | /// </summary> |
| | | /// <param name="hKDeviceAalarmDTO"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent HKDeviceAlarm(HKDeviceAalarmDTO hKDeviceAalarmDTO) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | |
| | | //å
¥æåæº |
| | | if (task.TaskType == TaskTypeEnum.RK3F.ObjToInt() && task.TaskState == (int)TaskStatusEnum.CheckPalletCodeFinish) |
| | | { |
| | | if (task.CurrentAddress==task.TargetAddress) |
| | | { |
| | | var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "TSJ") as OtherDevice; |
| | | if (device == null) task.ExceptionMessage = "æªæ¾å°æåæºä¿¡æ¯"; |
| | | else |
| | |
| | | while (!Work && i <= 3) |
| | | { |
| | | i++; |
| | | Work = device.SetValue(HoistEnum.Inboundboxon, 1, task.TargetAddress); |
| | | Work = device.SetValue(HoistEnum.Inboundboxon, 1, task.CurrentAddress); |
| | | Thread.Sleep(500); |
| | | } |
| | | } |
| | | if (!Work) |
| | | { |
| | | task.ExceptionMessage = $"ã{task.TargetAddress}ãåå
¥3楼å
¥åºç®±æ¾å°ä½å¤±è´¥"; |
| | | task.Remark = $"{device.DeviceCode}_Inboundboxon_{1}_{task.TargetAddress}"; |
| | | task.ExceptionMessage = $"ã{task.CurrentAddress}ãåå
¥3楼å
¥åºç®±æ¾å°ä½å¤±è´¥"; |
| | | task.Remark = $"{device.DeviceCode}_Inboundboxon_{1}_{task.CurrentAddress}"; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | task.ExceptionMessage = $"ã{task.TargetAddress}ãåå
¥3楼å
¥åºç®±æ¾å°ä½å¤±è´¥ï¼{ex.Message}"; |
| | | task.Remark = $"{device.DeviceCode}_Inboundboxon_{1}_{task.TargetAddress}"; |
| | | task.ExceptionMessage = $"ã{task.CurrentAddress}ãåå
¥3楼å
¥åºç®±æ¾å°ä½å¤±è´¥ï¼{ex.Message}"; |
| | | task.Remark = $"{device.DeviceCode}_Inboundboxon_{1}_{task.CurrentAddress}"; |
| | | } |
| | | } |
| | | BaseDal.UpdateData(task); |
| | | } |
| | | } |
| | | |
| | | //3 åºæåæº ä¹åæ¯AGV_ToExecute |
| | | else if (task.TaskType == TaskTypeEnum.CK3F.ObjToInt() && task.TaskState == (int)TaskStatusEnum.TakeFinish) |
| | |
| | | { |
| | | throw new NotImplementedException(); |
| | | } |
| | | |
| | | public WebResponseContent InboundElevatorExit(string LocationCode, string containerCode) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | |
| | | return content.Error($"æ´æ°ç«å°ç¶æå¤±è´¥ï¼{ex.Message}"); |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// PLCæ¥è¦ä¿¡æ¯ |
| | | /// </summary> |
| | | /// <param name="ErrorMsg"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent PLCAlarmtoWMS(string ErrorMsg) |
| | | { |
| | | PLCAlarmDTO PLCAlarmDTO = new PLCAlarmDTO(); |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(PLCAlarmDTO)) ?? throw new Exception("æªæ¾å°PLCæ¥è¦ä¿¡æ¯æ¥å£é
置信æ¯ï¼è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | PLCAlarmDTO.errorMsg = ErrorMsg; |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, PLCAlarmDTO.Serialize()); |
| | | content.OK(data: response); |
| | | WMSReturn wMSReturn = response.DeserializeObject<WMSReturn>(); |
| | | if (wMSReturn == null) throw new Exception("WMSè¿åç»æè½¬æ¢å¤±è´¥ï¼"); |
| | | if (!wMSReturn.success) throw new Exception(wMSReturn.message); |
| | | return content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | finally |
| | | { |
| | | _trackloginfoService.AddTrackLog(PLCAlarmDTO, content, "PLCæ¥è¦ä¿¡æ¯ä¸æ¥WMS", "", ""); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | RK3FTask.TargetAddress = Location.StationCode; |
| | | _taskService.UpdateData(RK3FTask); |
| | | } |
| | | else //æå |
| | | { |
| | | RK3FTask.CurrentAddress = RK3FTask.TargetAddress; |
| | | _taskService.UpdateData(RK3FTask); |
| | | } |
| | | //è°ç¨æµ·åº·è¿è¡æ§è¡å®ææ¥å£ |
| | | var result = _taskService.Hikvisiontaskscontinue(RK3FTask.WMSTaskNum, RK3FTask.NextAddress); |
| | | if (result.Status) |
| | |
| | | PalletNumConfirmation(device); |
| | | |
| | | PalletReportingToWMS(device); |
| | | |
| | | TSJAlarm(device); |
| | | } |
| | | else |
| | | { |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core.Enums; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_DTO; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.DTO; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | /// <summary> |
| | | /// å¤çåå
¥è®¾å¤ä¿¡å·å¼å¸¸ä»»å¡ |
| | | /// </summary> |
| | | public void HandleTasks() |
| | | { |
| | | #region |
| | | var tasks = _taskService.Repository.QueryData(x => x.TaskState == TaskStatusEnum.Finish.ObjToInt() && !string.IsNullOrEmpty(x.Remark)); |
| | | if (tasks.Count > 0) |
| | | { |
| | | List<Dt_Task> list = new List<Dt_Task>(); |
| | | foreach (var item in tasks) |
| | | { |
| | | var infos = item.Remark.Split("_"); |
| | | var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == infos[0]) as OtherDevice; |
| | | if (device != null && device.IsConnected) |
| | | { |
| | | DeviceProDTO? devicePro = device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == infos[1] && x.DeviceChildCode == infos[3]); |
| | | if (devicePro != null) |
| | | { |
| | | var W = device.Communicator.WriteObj(devicePro.DeviceProAddress, devicePro.DeviceDataType, infos[2]); |
| | | if (W) list.Add(item); |
| | | } |
| | | } |
| | | } |
| | | _taskService.Repository.DeleteAndMoveIntoHty(list, OperateTypeEnum.èªå¨å é¤); |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| | | } |
| | |
| | | using System.ComponentModel; |
| | | using System.Linq; |
| | | using System.Reflection; |
| | | using System.Reflection.Metadata; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_BasicInfoService; |
| | |
| | | |
| | | SendWaitToTask(); |
| | | |
| | | #region å¤çåå
¥è®¾å¤ä¿¡å·å¼å¸¸ä»»å¡ |
| | | var tasks = _taskService.Repository.QueryData(x => x.TaskState == TaskStatusEnum.Finish.ObjToInt() && !string.IsNullOrEmpty(x.Remark)); |
| | | if (tasks.Count > 0) |
| | | { |
| | | List<Dt_Task> list = new List<Dt_Task>(); |
| | | foreach (var item in tasks) |
| | | { |
| | | var infos = item.Remark.Split("_"); |
| | | var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == infos[0]) as OtherDevice; |
| | | if (device != null && device.IsConnected) |
| | | { |
| | | DeviceProDTO? devicePro = device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == infos[1] && x.DeviceChildCode == infos[3]); |
| | | if (devicePro != null) |
| | | { |
| | | var W = device.Communicator.WriteObj(devicePro.DeviceProAddress, devicePro.DeviceDataType, infos[2]); |
| | | if (W) list.Add(item); |
| | | } |
| | | } |
| | | } |
| | | _taskService.Repository.DeleteAndMoveIntoHty(list, OperateTypeEnum.èªå¨å é¤); |
| | | } |
| | | #endregion |
| | | HandleTasks(); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |