| | |
| | | using System; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Common.MaterielEnum; |
| | | using WIDESEA_Common.OtherEnum; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Common.TaskEnum; |
| | |
| | | Dt_LocationInfo startLocationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.LocationCode == startAddress); |
| | | Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.LocationCode == startAddress); |
| | | Dt_LocationInfo endLocationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.LocationCode == endAddress); |
| | | if (startLocationInfo != null && endLocationInfo != null && stockInfo!=null) |
| | | //夿æ¡ä»¶ |
| | | if (startLocationInfo != null && startLocationInfo.LocationStatus==LocationStatusEnum.InStock.ObjToInt() && endLocationInfo != null && endLocationInfo.LocationStatus==LocationStatusEnum.Free.ObjToInt() && endLocationInfo.EnableStatus==EnableStatusEnum.Normal.ObjToInt() && stockInfo!=null) |
| | | { |
| | | //çæä»»å¡ |
| | | Dt_Task newTask = new Dt_Task() |
| | | { |
| | | Roadway = roadWay, |
| | |
| | | SourceAddress = startLocationInfo.LocationCode, |
| | | TargetAddress = endLocationInfo.LocationCode, |
| | | TaskNum = Repository.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | TaskStatus = 0, |
| | | TaskStatus = TaskStatusEnum.SC_Execute.ObjToInt(), |
| | | TaskType = TaskTypeEnum.Relocation.ObjToInt() |
| | | }; |
| | | stockInfo.StockStatus = StockStatusEmun.ç§»åºéå®.ObjToInt(); |
| | |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// åæå··éé´ç§»åºä»»å¡ todo:ä¸´æ¶ |
| | | /// </summary> |
| | | public WebResponseContent RelocationRoadWay(string roadWay, int Count) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | //è·å对åºåºå |
| | | List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.QueryData(x => x.MaterielWide <2200 && x.StockStatus == StockStatusEmun.å
¥åºå®æ.ObjToInt()).OrderBy(x => x.CreateDate).Take(Count).ToList(); |
| | | |
| | | //è·åè´§ä½ |
| | | List<Dt_LocationInfo> locationInfos = _basicRepository.LocationInfoRepository.QueryData(x => stockInfos.Select(x => x.LocationCode).Contains(x.LocationCode)); |
| | | foreach (var item in stockInfos) |
| | | { |
| | | Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.LocationCode == item.LocationCode); |
| | | if (locationInfo != null && (locationInfo.EnableStatus == EnableStatusEnum.OnlyOut.ObjToInt() || locationInfo.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && locationInfo.LocationStatus == LocationStatusEnum.InStock.ObjToInt()) |
| | | { |
| | | item.StockStatus = StockStatusEmun.åºåºéå®.ObjToInt(); |
| | | } |
| | | else |
| | | { |
| | | return content.Error($"è´§ä½ç¶æä¸æ£ç¡®"); |
| | | } |
| | | } |
| | | |
| | | List<Dt_Task> tasks = GetTasks(stockInfos, TaskTypeEnum.OutPick); |
| | | if (tasks == null || tasks.Count <= 0) |
| | | { |
| | | return content.Error($"çæä»»å¡å¤±è´¥"); |
| | | } |
| | | tasks.ForEach(x => |
| | | { |
| | | x.TargetAddress = roadWay; |
| | | }); |
| | | //夿æ¯å¦æåºåºåä¿¡æ¯ |
| | | _unitOfWorkManage.BeginTran(); |
| | | //æ´æ°åºåç¶æ |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfos); |
| | | //æ´æ°è´§ä½ç¶æ |
| | | _basicRepository.LocationInfoRepository.UpdateLocationStatus(locationInfos, LocationStatusEnum.Lock); |
| | | //å å
¥è´§ä½åå¨è®°å½ |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfos, LocationStatusEnum.Lock, LocationChangeType.OutboundAssignLocation, taskNums: tasks.Select(x => x.TaskNum).ToList()); |
| | | //æ°å»ºä»»å¡ |
| | | BaseDal.AddData(tasks); |
| | | _unitOfWorkManage.CommitTran(); |
| | | PushTasksToWCS(tasks); |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | } |
| | | } |