| | |
| | | using System.Reflection; |
| | | using System.Reflection.Metadata; |
| | | using System.Security.Policy; |
| | | using System.Text; |
| | | using System.Text.RegularExpressions; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Cache; |
| | |
| | | _wareAreaInfoRepository = wareAreaInfoRepository; |
| | | _inventoryRecordRepository = inventoryRecordRepository; |
| | | } |
| | | #region åå§åæåæº |
| | | public async Task<WebResponseContent> InitializationElevator() |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var address = GetWCSIPAddress("WCSIPAddress","InitializationElevator"); |
| | | if (address != null) |
| | | { |
| | | await HttpHelper.PostAsync(address, ""); |
| | | return content.OK("æå"); |
| | | } |
| | | return content.Error("失败"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region å¤é¨æ¥å£æ¹æ³ |
| | | |
| | |
| | | case 4: |
| | | case 5: |
| | | case 6: |
| | | case 7: |
| | | taskNew = InboundAGVCacheArea(taskDto, StartAddress, area); |
| | | break; |
| | | default: |
| | |
| | | |
| | | await _unitOfWorkManage.UseTranAsync(async () => |
| | | { |
| | | if (taskDto.AreaId == 3 || taskDto.AreaId == 7) |
| | | { |
| | | var result2 = UpdateLocationStatus(taskNew.TargetAddress, LocationEnum.Lock, taskNew.TaskNum.Value, (int)StatusChangeTypeEnum.AutomaticInbound); |
| | | await _locationStatusChangeRecordRepository.AddDataAsync(result2.Item1); |
| | | await _locationRepository.UpdateDataAsync(result2.Item2); |
| | | } |
| | | await _locationStatusChangeRecordRepository.AddDataAsync(result.Item1); |
| | | await _locationRepository.UpdateDataAsync(result.Item2); |
| | | BaseDal.AddData(taskNew); |
| | |
| | | }); |
| | | |
| | | var taskDto = CreateListTaskDTO(taskNew); |
| | | var result = GetlcoationState(taskNew, StatusChangeTypeEnum.AutomaticOutbound); |
| | | var result = GetlcoationState(taskNew, StatusChangeTypeEnum.AutomaticOutbound, location); |
| | | await _unitOfWorkManage.UseTranAsync(async () => |
| | | { |
| | | await BaseDal.AddDataAsync(taskNew); |
| | |
| | | stock.StockInfoDetails = details; |
| | | |
| | | var taskDto = CreateListTaskDTO(taskNew); |
| | | var result = GetlcoationState(taskNew, StatusChangeTypeEnum.AutomaticOutbound); |
| | | var result = GetlcoationState(taskNew, StatusChangeTypeEnum.AutomaticOutbound, stock.LocationInfo); |
| | | await _unitOfWorkManage.UseTranAsync(async () => |
| | | { |
| | | await BaseDal.AddDataAsync(taskNew); |
| | |
| | | stock.StockInfoDetails = details; |
| | | |
| | | var taskDto = CreateListTaskDTO(taskNew); |
| | | var result = GetlcoationState(taskNew, StatusChangeTypeEnum.AutomaticOutbound); |
| | | var result = GetlcoationState(taskNew, StatusChangeTypeEnum.AutomaticOutbound, stock.LocationInfo); |
| | | await _unitOfWorkManage.UseTranAsync(async () => |
| | | { |
| | | await BaseDal.AddDataAsync(taskNew); |
| | |
| | | } |
| | | } |
| | | |
| | | public (List<DtLocationStatusChangeRecord>,List<DtLocationInfo>) GetlcoationState(Dt_Task task, StatusChangeTypeEnum StatusChangeTypeEnum) |
| | | public (List<DtLocationStatusChangeRecord>,List<DtLocationInfo>) GetlcoationState(Dt_Task task, StatusChangeTypeEnum StatusChangeTypeEnum, DtLocationInfo location) |
| | | { |
| | | List<DtLocationStatusChangeRecord> locationStatusChangeRecords = new List<DtLocationStatusChangeRecord>(); |
| | | List<DtLocationInfo> locations = new List<DtLocationInfo>(); |
| | | var result = UpdateLocationStatus(task.SourceAddress, LocationEnum.InStockDisable, task.TaskNum.Value, (int)StatusChangeTypeEnum); |
| | | locationStatusChangeRecords.AddRange(result.Item1); |
| | | locations.AddRange(result.Item2); |
| | | |
| | | if(location.AreaId ==3|| location.AreaId == 7) |
| | | { |
| | | var result2 = UpdateLocationStatus(task.TargetAddress, LocationEnum.Lock, task.TaskNum.Value, (int)StatusChangeTypeEnum); |
| | | locationStatusChangeRecords.AddRange(result2.Item1); |
| | | locations.AddRange(result2.Item2); |
| | | } |
| | | |
| | | return (locationStatusChangeRecords,locations); |
| | | } |
| | |
| | | case 4: |
| | | case 5: |
| | | case 6: |
| | | case 7: |
| | | return OutboundAGVCacheArea(taskDto, StartAddress, area); |
| | | default: |
| | | throw new Exception("è¯·éæ©æ£ç¡®çåºåä¿¡æ¯"); |
| | |
| | | switch (location.AreaId) |
| | | { |
| | | case 2: |
| | | case 7: |
| | | locationInfos = _locationRepository.QueryData(x => x.Row == location.Row && x.Column > location.Column && x.Remark == location.Remark && x.AreaId == location.AreaId); |
| | | break; |
| | | case 5: |
| | |
| | | case 4: |
| | | case 5: |
| | | case 6: |
| | | case 7: |
| | | locationInfo = await GetAGVEmptyCacheLocation(areaInfo.AreaID, location); |
| | | break; |
| | | default: |
| | |
| | | return (changeRecordDto, locations); |
| | | } |
| | | |
| | | public (DtLocationStatusChangeRecord, DtLocationInfo) UpdateEndLocationStatus(string locationCode, LocationEnum locationStatus, int taskNum, StatusChangeTypeEnum StatusChangeType) |
| | | { |
| | | var location = _locationRepository.QueryFirst(x => x.LocationCode == locationCode); |
| | | |
| | | if (location != null && (location.AreaId == 3 || location.AreaId == 7)) |
| | | { |
| | | int Beforelocation = location.LocationStatus; |
| | | |
| | | location.LocationStatus = (int)locationStatus; |
| | | |
| | | DtLocationStatusChangeRecord dtLocationStatusChangeRecord = new DtLocationStatusChangeRecord() |
| | | { |
| | | ChangeType = (int)StatusChangeType, |
| | | LocationCode = locationCode, |
| | | LocationId = location.Id, |
| | | Creater = "System", |
| | | TaskNum = taskNum, |
| | | AfterStatus = location.LocationStatus, |
| | | BeforeStatus = Beforelocation, |
| | | }; |
| | | |
| | | return (dtLocationStatusChangeRecord, location); |
| | | } |
| | | return (null, null); |
| | | } |
| | | |
| | | public (DtLocationStatusChangeRecord, DtLocationInfo) UpdateLocationStatus(string locationCode, LocationEnum locationStatus, int taskNum, StatusChangeTypeEnum StatusChangeType) |
| | | { |
| | | var location = _locationRepository.QueryFirst(x => x.LocationCode == locationCode); |
| | |
| | | } |
| | | } |
| | | } |
| | | else if (location.AreaId == 2) |
| | | else if (location.AreaId == 2 || location.AreaId == 7) |
| | | { |
| | | var locationLateral = _locationRepository.QueryData(x => x.Row == location.Row && x.Column > location.Column && x.Remark == location.Remark); |
| | | if (locationLateral.Count > 0) |
| | |
| | | switch (AreaId) |
| | | { |
| | | case 2: |
| | | case 7: |
| | | return await FromShallowToDeep(AreaId, loc); |
| | | case 3: |
| | | return await AGVLIKU(AreaId); |
| | |
| | | } |
| | | } |
| | | |
| | | else if (location.AreaId == 2) |
| | | else if (location.AreaId == 2 || location.AreaId == 7) |
| | | { |
| | | var locationLateral = _locationRepository.QueryData(x => x.Row == location.Row && x.Column > location.Column && x.Remark == location.Remark); |
| | | |