| | |
| | | using System.Reflection.Metadata; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; |
| | | using SkiaSharp; |
| | | using System.Collections; |
| | | |
| | | namespace WIDESEA_TaskInfoService |
| | | { |
| | |
| | | _unitOfWorkManage.BeginTran(); |
| | | //鍒ゆ柇绉诲簱 |
| | | (List<Dt_Task>?, List<Dt_Task>?) result=RelocationTasks(tasks.OrderBy(x=>x.Depth).ToList()); |
| | | |
| | | if(result.Item1 != null) |
| | | if (result.Item1 != null && result.Item1.Count >0) |
| | | { |
| | | |
| | | AddData(result.Item1); |
| | | var response = HttpHelper.Post<WebResponseContent>(url + "ReceiveTask/", result.Item1, "鍏ュ簱浠诲姟涓嬪彂"); |
| | | if (!response.Status) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return content = WebResponseContent.Instance.Error($"{response.Message}"); |
| | | } |
| | | } |
| | | for (int i = 0; i < result.Item2.Count; i++) |
| | | if(result.Item2 != null&&result.Item2.Count>0) |
| | | { |
| | | |
| | | for (int i = 0; i < result.Item2.Count; i++) |
| | | { |
| | | Dt_LocationInfo location = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == result.Item2[i].SourceAddress && x.RoadwayNo == result.Item2[i].Roadway); |
| | | _basicService.LocationInfoService.UpdateLocationLock(location, result.Item2[i].TaskNum, StockChangeType.Outbound.ObjToInt(), false); |
| | | |
| | | } |
| | | AddData(result.Item2); |
| | | var response = HttpHelper.Post<WebResponseContent>(url + "ReceiveTask/", result.Item2, "鍏ュ簱浠诲姟涓嬪彂"); |
| | | if (!response.Status) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return content = WebResponseContent.Instance.Error($"{response.Message}"); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | int befoStatus=location.LocationStatus.ObjToInt(); |
| | | if (location != null) |
| | | { |
| | | Dt_LocationInfo result = isDepth(location); |
| | | if (result != null && result.LocationStatus == LocationStatusEnum.Lock.ObjToInt() && result.LocationStatus != LocationStatusEnum.PalletLock.ObjToInt() && result.LocationStatus != LocationStatusEnum.Free.ObjToInt()) |
| | | Dt_LocationInfo result = _basicService.LocationInfoService.isDepth(location); |
| | | if (result != null && result.LocationStatus != LocationStatusEnum.Lock.ObjToInt() && result.LocationStatus != LocationStatusEnum.PalletLock.ObjToInt() && result.LocationStatus != LocationStatusEnum.Free.ObjToInt()) |
| | | { |
| | | int sum = 0; |
| | | for (int j = 0; j < task.Count; j++) |
| | |
| | | { |
| | | Dt_Task relocariontask = RelocationTask(result); |
| | | task[i].Grade=1; |
| | | tasks.Add(task[i]); |
| | | relocationList.Add(relocariontask); |
| | | relocationList.Add(task[i]); |
| | | } |
| | | else |
| | | { |
| | |
| | | break; |
| | | } |
| | | } |
| | | return (tasks, relocationList); |
| | | return (relocationList,tasks); |
| | | } |
| | | else |
| | | { |
| | |
| | | TargetAddress = locationInfos.LocationCode, |
| | | TaskStatus = InTaskStatusEnum.RelocationNew.ObjToInt(), |
| | | TaskType = TaskTypeEnum.Relocation.ObjToInt(), |
| | | Depth= location.Depth, |
| | | TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)) |
| | | }; |
| | | _basicService.LocationInfoService.RelocationLock(location, locationInfos, tasks.TaskNum); |
| | | stockInfo.StockStatus= StockStatusEmun.绉诲簱閿佸畾.ObjToInt(); |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | | return tasks; |
| | | } |
| | | else |
| | |
| | | TaskType = TaskTypeEnum.PalletOutbound.ObjToInt(), |
| | | Depth = locationInfo.Depth, |
| | | TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)) |
| | | |
| | | }; |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | _unitOfWorkManage.BeginTran(); |
| | | stockInfo.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt(); |
| | | locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | BaseDal.AddData(task); |
| | | List<Dt_Task> tasks=new List<Dt_Task>(); |
| | | tasks.Add(task); |
| | | (List<Dt_Task>?, List<Dt_Task>?) result = RelocationTasks(tasks.OrderBy(x => x.Depth).ToList()); |
| | | if (result.Item1 != null && result.Item1.Count > 0) |
| | | { |
| | | AddData(result.Item1); |
| | | var response = HttpHelper.Post<WebResponseContent>(url + "ReceiveTask/", result.Item1, "鍏ュ簱浠诲姟涓嬪彂"); |
| | | if (!response.Status) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error($"{response.Message}"); |
| | | } |
| | | } |
| | | if (result.Item2 != null && result.Item2.Count > 0) |
| | | { |
| | | for (int i = 0; i < result.Item2.Count; i++) |
| | | { |
| | | Dt_LocationInfo location = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == result.Item2[i].SourceAddress && x.RoadwayNo == result.Item2[i].Roadway); |
| | | _basicService.LocationInfoService.UpdateLocationLock(location, result.Item2[i].TaskNum, StockChangeType.Outbound.ObjToInt(), false); |
| | | |
| | | } |
| | | AddData(result.Item2); |
| | | var response = HttpHelper.Post<WebResponseContent>(url + "ReceiveTask/", result.Item2, "鍏ュ簱浠诲姟涓嬪彂"); |
| | | if (!response.Status) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error($"{response.Message}"); |
| | | } |
| | | } |
| | | _stockService.StockInfoService.UpdateData(stockInfo); |
| | | |
| | | _basicService.LocationInfoService.UpdateData(locationInfo); |
| | | |
| | | _basicService.LocationInfoService.UpdateLocationLock(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), "", task.TaskNum); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public Dt_LocationInfo isDepth(Dt_LocationInfo locationInfo) |
| | | { |
| | | if (locationInfo.Depth == 2) |
| | | { |
| | | if (locationInfo.Row == 1 || locationInfo.Row == 5) |
| | | { |
| | | Dt_LocationInfo dt_LocationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.Row == locationInfo.Row + 1 && x.Layer == locationInfo.Layer && x.Column == locationInfo.Column && x.RoadwayNo == locationInfo.RoadwayNo); |
| | | |
| | | if (dt_LocationInfo != null) |
| | | { |
| | | return dt_LocationInfo; |
| | | } |
| | | |
| | | } |
| | | else if (locationInfo.Row == 4 || locationInfo.Row == 8) |
| | | { |
| | | Dt_LocationInfo dt_LocationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.Row == locationInfo.Row + 1 && x.Layer == locationInfo.Layer && x.Column == locationInfo.Column && x.RoadwayNo == locationInfo.RoadwayNo); |
| | | |
| | | if (dt_LocationInfo != null && dt_LocationInfo.LocationStatus == LocationStatusEnum.InStock.ObjToInt()) |
| | | { |
| | | return dt_LocationInfo; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | } |