| | |
| | | try |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | //å¤æç§»åº |
| | | /*List<Dt_Task> RelocationTasks = */ |
| | | RelocationTask(tasks); |
| | | //BaseDal.AddData(RelocationTasks); |
| | | |
| | | BaseDal.AddData(tasks); |
| | | if (stockInfos != null && outboundOrderDetails != null && outStockLockInfos != null && locationInfos != null) |
| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// ç§»åºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="task"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent RelocationTask(List<Dt_Task> task) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | for (int i = 0; i < task.Count; i++) |
| | | { |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task[i].SourceAddress && x.RoadwayNo == task[i].Roadway); |
| | | if (locationInfo != null) |
| | | { |
| | | Dt_LocationInfo location = _basicService.LocationInfoService.isDepth(locationInfo); |
| | | if (location != null) |
| | | { |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.QueryFirst(x => x.LocationCode == location.LocationCode); |
| | | if (stockInfo != null && location.LocationStatus == LocationStatusEnum.InStock.ObjToInt()) |
| | | { |
| | | Dt_LocationInfo? locationInfos = _basicService.LocationInfoService.AssignLocation(location.RoadwayNo); |
| | | if(locationInfos != null) |
| | | { |
| | | Dt_Task tasks = new() |
| | | { |
| | | CurrentAddress = location.LocationCode, |
| | | Grade = 0, |
| | | PalletCode = stockInfo.PalletCode, |
| | | NextAddress = locationInfos.LocationCode, |
| | | Roadway = location.RoadwayNo, |
| | | SourceAddress = location.LocationCode, |
| | | TargetAddress = locationInfos.LocationCode, |
| | | TaskStatus = InTaskStatusEnum.RelocationNew.ObjToInt(), |
| | | TaskType = TaskTypeEnum.Relocation.ObjToInt(), |
| | | TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)) |
| | | }; |
| | | BaseDal.AddData(tasks); |
| | | stockInfo.StockStatus = StockStatusEmun.ç§»åºéå®.ObjToInt(); |
| | | _stockService.StockInfoService.UpdateData(stockInfo); |
| | | _basicService.LocationInfoService.RelocationLock(location, locationInfos,tasks.TaskNum); |
| | | } |
| | | else |
| | | { |
| | | return content = WebResponseContent.Instance.Error("æªæ¾å°å¯åé
è´§ä½"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return content = WebResponseContent.Instance.Error("æªæ¾å°åºåä¿¡æ¯"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return content = WebResponseContent.Instance.Error("ä»»å¡ä¿¡æ¯å¼å¸¸"); |
| | | } |
| | | |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | TaskStatus = OutTaskStatusEnum.OutNew.ObjToInt(), |
| | | TaskType = TaskTypeEnum.PalletOutbound.ObjToInt(), |
| | | }; |
| | | |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | _unitOfWorkManage.BeginTran(); |
| | | stockInfo.StockStatus = StockStatusEmun.åºåºéå®.ObjToInt(); |
| | | locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | BaseDal.AddData(task); |
| | | _stockService.StockInfoService.UpdateData(stockInfo); |
| | | |
| | | _basicService.LocationInfoService.UpdateLocationLock(locationInfo, task.TaskNum); |
| | | |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Relocation.ObjToInt(), "", task.TaskNum); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |