| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Diagnostics; |
| | | using System.Diagnostics.CodeAnalysis; |
| | | using System.Linq; |
| | | using System.Reflection; |
| | |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | foreach (var item in taskDTOs) |
| | | { |
| | | if (BaseDal.QueryFirst(x => x.TaskNum == item.TaskNum || x.PalletCode == item.PalletCode) != null) |
| | | if (BaseDal.QueryFirst(x => x.TaskNum == item.TaskNum) != null) |
| | | { |
| | | flag = true; |
| | | continue; |
| | |
| | | if (taskTypeGroup == TaskTypeGroup.InboundGroup) |
| | | { |
| | | stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == item.SourceAddress || x.StationDeviceCode == item.SourceAddress); |
| | | if (stationManger==null && task.TaskType==TaskTypeEnum.InProduct.ObjToInt()) |
| | | { |
| | | stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneCode==task.SourceAddress); |
| | | //è½¬æ¢æåä»èµ·ç¹ç«å° |
| | | item.SourceAddress = stationManger.StationCode; |
| | | task.CurrentAddress = stationManger.StationCode; |
| | | task.SourceAddress = stationManger.StationCode; |
| | | } |
| | | //if (stationManger==null && task.TaskType==TaskTypeEnum.InProduct.ObjToInt()) |
| | | //{ |
| | | // stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneCode==task.SourceAddress); |
| | | // //è½¬æ¢æåä»èµ·ç¹ç«å° |
| | | // item.SourceAddress = stationManger.StationCode; |
| | | // task.CurrentAddress = stationManger.StationCode; |
| | | // task.SourceAddress = stationManger.StationCode; |
| | | //} |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | if (routers.Count == 1) |
| | | { |
| | | if (taskTypeGroup == TaskTypeGroup.InboundGroup && item.TargetAddress == stationManger.StackerCraneCode) |
| | | if (taskTypeGroup == TaskTypeGroup.InboundGroup) |
| | | { |
| | | task.CurrentAddress = router.StartPosi; |
| | | task.NextAddress = router.NextPosi; |
| | | task.DeviceCode = stationManger.StationDeviceCode; |
| | | task.DeviceCode = router.ChildPosiDeviceCode; |
| | | } |
| | | else if (item.TaskType == TaskTypeEnum.MesMatReturn.ObjToInt() && !router.IsEnd) |
| | | { |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | string address = AppSettings.Get("WMSApiAddress"); |
| | | if (string.IsNullOrEmpty(address)) |
| | | //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() |
| | | { |
| | | 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) |
| | | { |
| | | content = ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); |
| | | } |
| | | } |
| | | Id = 1, |
| | | TaskNum = DateTime.Now.ToString("mmss").ObjToInt(), |
| | | PalletCode="", |
| | | RoadWay="", |
| | | TaskType=TaskTypeEnum.InProduct.ObjToInt(), |
| | | TaskStatus=TaskStatusEnum.New.ObjToInt(), |
| | | SourceAddress= sourceAddress, |
| | | TargetAddress="", |
| | | WarehouseId=1, |
| | | Grade=0, |
| | | }; |
| | | content = ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); |
| | | // } |
| | | //} |
| | | |
| | | } |
| | | catch (Exception ex) |