| | |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); |
| | | if (task != null) |
| | | { |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User == null ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | task.TaskState = TaskStatusEnum.Finish.ObjToInt(); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User?.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | } |
| | | string? url = apiInfos.FirstOrDefault(x => x.ApiCode == APIEnum.FeedBackWMSTaskCompleted.ToString())?.ApiAddress; |
| | | if (string.IsNullOrEmpty(url)) |
| | |
| | | |
| | | List<Dt_WarehouseDevice> wades = warehouseDevices.Where(x => x.WarehouseId == item.WarehouseId).ToList(); |
| | | |
| | | Dt_Router? router = new Dt_Router(); |
| | | Dt_Router? router; |
| | | |
| | | TaskTypeGroup taskTypeGroup = item.TaskType.GetTaskTypeGroup(); |
| | | if (string.IsNullOrEmpty(item.AGVArea)) |
| | | { |
| | | //task.AgvTaskNum = "AGV-" + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum; |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == item.SourceAddress || x.StackerCraneCode == item.RoadWay); |
| | | Dt_StationManger stationManger; |
| | | if (taskTypeGroup == TaskTypeGroup.InboundGroup) |
| | | { |
| | | stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == item.SourceAddress || x.StationDeviceCode == item.SourceAddress); |
| | | } |
| | | else |
| | | { |
| | | stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneCode == item.RoadWay); |
| | | } |
| | | if (stationManger == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ç«å°é
置信æ¯"); |
| | | } |
| | | |
| | | List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && (stationManger.StationCode == x.StartPosi || stationManger.StackerCraneCode == x.StartPosi)); |
| | | if (routers.FirstOrDefault() == null) |
| | | List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && (item.SourceAddress == x.StartPosi || item.RoadWay == x.StartPosi || item.RoadWay == x.ChildPosiDeviceCode || item.RoadWay == x.ChildPosi)); |
| | | router = routers.FirstOrDefault(); |
| | | if (router == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°è·¯ç±é
置信æ¯"); |
| | | } |
| | | router = routers.FirstOrDefault(); |
| | | |
| | | if (routers.Count == 1) |
| | | { |
| | | task.NextAddress = router?.NextPosi ?? ""; |
| | | task.DeviceCode = stationManger.StationDeviceCode; |
| | | if (taskTypeGroup == TaskTypeGroup.InboundGroup && item.TargetAddress == stationManger.StackerCraneCode) |
| | | { |
| | | task.NextAddress = router.NextPosi; |
| | | task.DeviceCode = stationManger.StationDeviceCode; |
| | | } |
| | | else if(item.TaskType == TaskTypeEnum.MesOutbound.ObjToInt()) |
| | | { |
| | | task.NextAddress = router.NextPosi; |
| | | task.DeviceCode = stationManger.StackerCraneCode; |
| | | } |
| | | else |
| | | { |
| | | task.NextAddress = item.TargetAddress; |
| | | if (item.RoadWay.Contains("AGV")) |
| | | { |
| | | task.DeviceCode = item.RoadWay; |
| | | task.AgvTaskNum = task.DeviceCode + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum; |
| | | } |
| | | else |
| | | { |
| | | task.DeviceCode = stationManger.StationDeviceCode; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | if (item.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | if (taskTypeGroup == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | task.AgvTaskNum = "AGV-" + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum; |
| | | task.AgvTaskNum = item.AGVArea + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum; |
| | | List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && item.AGVArea == x.NextPosi); |
| | | if (routers.FirstOrDefault() == null) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | task.AgvTaskNum = "AGV-" + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum; |
| | | task.AgvTaskNum = item.AGVArea + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum; |
| | | List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && item.AGVArea == x.StartPosi); |
| | | if (routers.FirstOrDefault() == null) |
| | | { |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationDeviceCode == sourceAddress); |
| | | 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 = 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) |
| | | { |
| | | content = ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); |
| | | } |
| | | } |
| | | |
| | | HttpHelper.Post($"RequestInboundTask?palletCode={palletCode}&stationCode={sourceAddress}"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | WMSTaskDTO taskDTO = new WMSTaskDTO(); |
| | | public WebResponseContent RequestWMSAssignRoadway(int taskNum, List<string> roadwayNos) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | string address = AppSettings.Get("WMSApiAddress"); |
| | | if (string.IsNullOrEmpty(address)) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°WMSApiå°å"); |
| | | } |
| | | string responseStr = HttpHelper.Post($"{address}/api/Task/AssignRoadway?taskNum={taskNum}",roadwayNos.Serialize()); |
| | | WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr); |
| | | if (responseContent != null && responseContent.Status && responseContent.Data != null) |
| | | { |
| | | return responseContent; |
| | | } |
| | | |
| | | content = ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); |
| | | } |
| | | catch (Exception ex) |
| | | { |