| | |
| | | using AutoMapper; |
| | | using SixLabors.ImageSharp.ColorSpaces; |
| | | using SqlSugar; |
| | | using System.Collections.Generic; |
| | | using System.Diagnostics.CodeAnalysis; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_BasicInfoService; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.LocationEnum; |
| | |
| | | using WIDESEAWCS_IBasicInfoService; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | List<object> objects = new List<object>(); |
| | | foreach (var item in taskDTOs) |
| | | { |
| | | { |
| | | foreach (var task in item.tasks) |
| | | { |
| | | #region 夿 |
| | | content = TaskHelpMethods.isOkTaskInfo(task, true, true); |
| | | if (!content.Status) throw new Exception(content.Message); |
| | | if (BaseDal.QueryFirst(x => x.WMSTaskNum == task.taskCode) != null) |
| | | throw new Exception($"ä»»å¡å·ã{task.taskCode}ãå·²åå¨ä»»å¡"); |
| | | if (BaseDal.QueryFirst(x => x.PalletCode == task.containerCode) != null) |
| | | throw new Exception($"æçå·ã{task.containerCode}ãå·²åå¨ä»»å¡"); |
| | | if (BaseDal.QueryFirst(x => x.SourceAddress == task.fromLocationCode) != null) |
| | | throw new Exception($"èµ·ç¹ä½ç½®ã{task.containerCode}ãå·²åå¨ä»»å¡"); |
| | | if (!content.Status) |
| | | { |
| | | objects.Add(new |
| | | { |
| | | taskCode = task.taskCode, |
| | | Message = $"ä»»å¡å·ã{task.taskCode}ã{content.Message}" |
| | | }); |
| | | continue; |
| | | //throw new Exception(content.Message); |
| | | } |
| | | if (BaseDal.QueryFirst(x => x.WMSTaskNum == task.taskCode && x.TaskType == item.taskType) != null) |
| | | { |
| | | objects.Add(new |
| | | { |
| | | taskCode = task.taskCode, |
| | | Message = $"ä»»å¡å·ã{task.taskCode}ãå·²åå¨ä»»å¡" |
| | | }); |
| | | continue; |
| | | //throw new Exception($"ä»»å¡å·ã{task.taskCode}ãå·²åå¨ä»»å¡"); |
| | | } |
| | | if (BaseDal.QueryFirst(x => x.PalletCode == task.containerCode && x.TaskType == item.taskType) != null) |
| | | { |
| | | objects.Add(new |
| | | { |
| | | taskCode = task.taskCode, |
| | | Message = $"æçå·ã{task.containerCode}ãå·²åå¨ä»»å¡" |
| | | }); |
| | | continue; |
| | | //throw new Exception($"æçå·ã{task.containerCode}ãå·²åå¨ä»»å¡"); |
| | | } |
| | | if (BaseDal.QueryFirst(x => x.SourceAddress == task.fromLocationCode && x.TaskType == item.taskType) != null) |
| | | { |
| | | objects.Add(new |
| | | { |
| | | taskCode = task.taskCode, |
| | | Message = $"èµ·ç¹ä½ç½®ã{task.fromLocationCode}ãå·²åå¨ä»»å¡" |
| | | }); |
| | | continue; |
| | | //throw new Exception($"èµ·ç¹ä½ç½®ã{task.containerCode}ãå·²åå¨ä»»å¡"); |
| | | } |
| | | #endregion |
| | | switch (item.taskType) |
| | | { |
| | | case (int)TaskTypeEnum.MLInbound: |
| | | CreateKLSNewInTask(task, item.taskType); |
| | | content = CreateKLSNewInTask(task, item.taskType); |
| | | objects.Add(content.Data); |
| | | break; |
| | | case (int)TaskTypeEnum.MLOutbound: |
| | | CreateKLSNewOutTask(task, item.taskType); |
| | | content = CreateKLSNewOutTask(task, item.taskType); |
| | | objects.Add(content.Data); |
| | | break; |
| | | case (int)TaskTypeEnum.CPInbound: |
| | | CreateRGVNewInTask(task, item.taskType); |
| | | content = CreateRGVNewInTask(task, item.taskType); |
| | | objects.Add(content.Data); |
| | | break; |
| | | case (int)TaskTypeEnum.CPOutbound: |
| | | CreateRGVNewOutTask(task, item.taskType); |
| | | content = CreateRGVNewOutTask(task, item.taskType); |
| | | objects.Add(content.Data); |
| | | break; |
| | | case (int)TaskTypeEnum.CJInbound: |
| | | CreateHKNewInTask(task, item.taskType); |
| | | content = CreateHKNewInTask(task, item.taskType); |
| | | objects.Add(content.Data); |
| | | break; |
| | | case (int)TaskTypeEnum.CJOutbound: |
| | | CreateHKNewOutTask(task, item.taskType); |
| | | content = CreateHKNewOutTask(task, item.taskType); |
| | | objects.Add(content.Data); |
| | | break; |
| | | case (int)TaskTypeEnum.Carry: |
| | | CarryTask(task, item.taskType); |
| | | content = CarryTask(task, item.taskType); |
| | | objects.Add(content.Data); |
| | | break; |
| | | case (int)TaskTypeEnum.CJCarry: |
| | | CJCarryTaske(task, item.taskType); |
| | | content = CJCarryTaske(task, item.taskType); |
| | | objects.Add(content.Data); |
| | | break; |
| | | default: |
| | | objects.Add(new |
| | | { |
| | | taskCode = task.taskCode, |
| | | Message = $"æªå®ä¹çä»»å¡ç±»å" |
| | | }); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | content.Data = objects; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | finally |
| | | { |
| | | _trackloginfoService.AddTrackLog(taskDTOs, content, $"WMSä¸åä»»å¡,", "", ""); |
| | | } |
| | | return content; |
| | | } |
| | |
| | | if (apiInfo == null) throw new Exception("æªæ¾å°å¯ä¹å£«AGVä»»å¡ä¸åæ¥å£é
置信æ¯ï¼è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, KLS.Serialize()); |
| | | GALAXISReturn agvContent = response.DeserializeObject<GALAXISReturn>(); |
| | | content.OK(data: agvContent); |
| | | if (agvContent.success == true && agvContent.code == 0) |
| | | { |
| | | //ç´æ¥ç§»å
¥åå² |
| | |
| | | if (apiInfo == null) throw new Exception("æªæ¾å°åå车AGVä»»å¡ä¸åæ¥å£é
置信æ¯ï¼è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, cancelSXCTake.Serialize()); |
| | | FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>(); |
| | | content.OK(data: fOURBOTReturn); |
| | | if (fOURBOTReturn.returnCode == 0 && fOURBOTReturn.returnUserMsg == "æå") |
| | | { |
| | | //ç´æ¥ç§»å
¥åå² |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 海康 |
| | | if (isHK) |
| | | { |
| | |
| | | if (apiInfo == null) throw new Exception("æªæ¾å°åå车AGVä»»å¡ä¸åæ¥å£é
置信æ¯ï¼è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, cancelHIKROBOTTask.Serialize()); |
| | | HIKROBOTReturn hIKROBOTReturn = response.DeserializeObject<HIKROBOTReturn>(); |
| | | content.OK(data: hIKROBOTReturn); |
| | | if (hIKROBOTReturn.code == "SUCCESS" && hIKROBOTReturn.message == "æå") |
| | | { |
| | | //ç´æ¥ç§»å
¥åå² |
| | |
| | | if (apiInfo == null) throw new Exception("æªæ¾å°å¯ä¹å£«AGVä»»å¡ä¸åæ¥å£é
置信æ¯ï¼è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, updateGALAXISTaskGrade.Serialize()); |
| | | GALAXISReturn agvContent = response.DeserializeObject<GALAXISReturn>(); |
| | | content.OK(data: agvContent); |
| | | if (agvContent.success == true && agvContent.code == 0) |
| | | { |
| | | |
| | |
| | | if (apiInfo == null) throw new Exception("æªæ¾å°æ´æ°åå车任å¡ä¼å
级æ¥å£é
置信æ¯ï¼è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, request.Serialize()); |
| | | FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>(); |
| | | content.OK(data: fOURBOTReturn); |
| | | if (fOURBOTReturn.returnCode == 0 && fOURBOTReturn.returnUserMsg == "æå") |
| | | { |
| | | BaseDal.UpdateData(dt_Task); |
| | |
| | | if (apiInfo == null) throw new Exception("æªæ¾å°åå车AGVä»»å¡ä¸åæ¥å£é
置信æ¯ï¼è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, Hkrequest.Serialize()); |
| | | HIKROBOTReturn hIKROBOTReturn = response.DeserializeObject<HIKROBOTReturn>(); |
| | | content.OK(data: hIKROBOTReturn); |
| | | if (hIKROBOTReturn.code == "SUCCESS0" && hIKROBOTReturn.message == "æå") |
| | | { |
| | | BaseDal.UpdateData(dt_Task); |
| | |
| | | /// <param name="AreaCode"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="NotImplementedException">åºåå·</exception> |
| | | public WebResponseContent LocationInquiry(string AreaCode) |
| | | public WebResponseContent LocationInquiry(WMSGetLocationInfo getLocationInfo) |
| | | { |
| | | if (AreaCode == null) |
| | | WebResponseContent content = new WebResponseContent(); |
| | | List<object> list = new List<object>(); |
| | | try |
| | | { |
| | | //æ¥è¯¢è¾é线空æç¼åä¿¡æ¯æ¶è¿åç©ºä½æ°é |
| | | } |
| | | return WebResponseContent.Instance.OK(); |
| | | if (getLocationInfo == null) throw new Exception("请æ±åæ°ä¸è½ä¸ºç©ºï¼"); |
| | | //if (getLocationInfo.AreaCode == null) throw new Exception("åºåºç¼å·ä¸è½ä¸ºç©ºï¼"); |
| | | if (getLocationInfo.WarehouseId == 0) throw new Exception("ä»åºIDä¸è½ä¸ºç©ºï¼"); |
| | | if (getLocationInfo.WarehouseId == 1) |
| | | { |
| | | List<Dt_RGVLocationInfo> rGVLocationInfos = new List<Dt_RGVLocationInfo>(); |
| | | if (!string.IsNullOrEmpty(getLocationInfo.AreaCode)) |
| | | rGVLocationInfos = _rGVLocationInfoService.Repository.QueryData(x => x.WarehouseId == getLocationInfo.AreaCode.ObjToInt()); |
| | | else |
| | | rGVLocationInfos = _rGVLocationInfoService.Repository.QueryData(); |
| | | foreach (var item in rGVLocationInfos) |
| | | { |
| | | list.Add(new |
| | | { |
| | | LoctionCode = item.LocationCode, |
| | | LocationStatus = item.LocationStatus, |
| | | EnableStatus = item.EnableStatus |
| | | }); |
| | | } |
| | | content.OK(data: list); |
| | | } |
| | | else if (getLocationInfo.WarehouseId == 2) |
| | | { |
| | | List<Dt_KLSLocationInfo> rGVLocationInfos = new List<Dt_KLSLocationInfo>(); |
| | | if (!string.IsNullOrEmpty(getLocationInfo.AreaCode)) |
| | | rGVLocationInfos = _kLSLocationInfoService.Repository.QueryData(x => x.WarehouseId == getLocationInfo.AreaCode.ObjToInt()); |
| | | else |
| | | rGVLocationInfos = _kLSLocationInfoService.Repository.QueryData(); |
| | | foreach (var item in rGVLocationInfos) |
| | | { |
| | | list.Add(new |
| | | { |
| | | LoctionCode = item.LocationCode, |
| | | LocationStatus = item.LocationStatus, |
| | | EnableStatus = item.EnableStatus |
| | | }); |
| | | } |
| | | content.OK(data: list); |
| | | } |
| | | else if (getLocationInfo.WarehouseId == 3) |
| | | { |
| | | |
| | | } |
| | | else if (getLocationInfo.WarehouseId == 4) |
| | | { |
| | | |
| | | } |
| | | else if (getLocationInfo.WarehouseId == 5) |
| | | { |
| | | //读åå
çµä¿¡å· |
| | | var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "F1") as OtherDevice; |
| | | if (device == null) throw new Exception("æªæ¾å°1楼质æ£é¨è®¾å¤ä¿¡æ¯") ; |
| | | if (!device.IsConnected) throw new Exception("PLC1楼质æ£é¨è®¾å¤è¿æ¥å¤±è´¥"); |
| | | var sta = _stationMangerService.Repository.QueryData(x => x.Remark == "æååº"); |
| | | foreach (var item in sta) |
| | | { |
| | | bool value = device.GetValue<QualityInspectionCommandEnum,bool>(QualityInspectionCommandEnum.R_StockAvailableSymbol, item.StationCode); |
| | | list.Add(new |
| | | { |
| | | LoctionCode = item.StationCode, |
| | | LocationStatus = value?100:0, |
| | | EnableStatus = 0, |
| | | }); |
| | | } |
| | | content.OK(data: list); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | |
| | |
| | | }; |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, fOURBOToccupyStation.Serialize()); |
| | | FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>(); |
| | | content.OK(data: fOURBOTReturn); |
| | | if (fOURBOTReturn.returnCode != 0 /*&& fOURBOTReturn.returnUserMsg != $"ç«ç¹å·²è¢«å ç¨,(podID={iQC.ContainerCode})"*/) |
| | | throw new Exception(fOURBOTReturn.returnUserMsg); |
| | | #endregion |