| | |
| | | { |
| | | try |
| | | { |
| | | Dt_StockInfo stockInfo ; |
| | | Dt_StockInfo stockInfo; |
| | | if (string.IsNullOrEmpty(palletCode)) |
| | | { |
| | | stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletType == PalletTypeEnum.Empty.ObjToInt() && !string.IsNullOrWhiteSpace(x.LocationCode)).First(); |
| | | stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletType == PalletTypeEnum.Empty.ObjToInt() && x.StockStatus == StockStatusEmun.å
¥åºå®æ.ObjToInt() && !string.IsNullOrWhiteSpace(x.LocationCode)).First(); |
| | | } |
| | | else |
| | | { |
| | | stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode) .First(); |
| | | stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletType == PalletTypeEnum.Empty.ObjToInt() && x.PalletCode == palletCode && x.StockStatus == StockStatusEmun.å
¥åºå®æ.ObjToInt()).First(); |
| | | } |
| | | |
| | | if (stockInfo == null) |
| | |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | }; |
| | | var result = await _eSSApiService.CreateTaskAsync(esstask); |
| | | |
| | | _logger.LogInformation("å建任å¡PalletOutboundTask è¿å: " + result); |
| | | if (result) |
| | | { |
| | | return WebResponseContent.Instance.OK(); |
| | | return WebResponseContent.Instance.OK(200); |
| | | } |
| | | else |
| | | { |
| | |
| | | /// <param name="stockSelectViews"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception"></exception> |
| | | public (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) OutboundTaskDataHandle(int[] keys) |
| | | public (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) OutboundTaskDataHandle(int[] keys, string outStation) |
| | | { |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | List<Dt_OutboundOrderDetail> outboundOrderDetails = _outboundOrderDetailService.Repository.QueryData(x => keys.Contains(x.Id)); |
| | |
| | | (int)OutOrderTypeEnum.Issue => TaskTypeEnum.Outbound, |
| | | (int)OutOrderTypeEnum.Allocate => TaskTypeEnum.OutAllocate, |
| | | (int)OutOrderTypeEnum.Quality => TaskTypeEnum.OutQuality, |
| | | _ => new TaskTypeEnum() |
| | | _ => TaskTypeEnum.Outbound |
| | | }; |
| | | tasks = GetTasks(result.Item1, typeEnum); |
| | | tasks = GetTasks(result.Item1, typeEnum, outStation); |
| | | tasks.ForEach(x => |
| | | { |
| | | x.OrderNo = outboundOrder.UpperOrderNo; |
| | | x.OrderNo = outboundOrder.OrderNo; |
| | | }); |
| | | result.Item2.ForEach(x => |
| | | { |
| | |
| | | /// <param name="outStockLockInfos"></param> |
| | | /// <param name="locationInfos"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent GenerateOutboundTaskDataUpdate(List<Dt_Task> tasks, List<Dt_StockInfo>? stockInfos = null, List<Dt_OutboundOrderDetail>? outboundOrderDetails = null, List<Dt_OutStockLockInfo>? outStockLockInfos = null, List<Dt_LocationInfo>? locationInfos = null) |
| | | public async Task<WebResponseContent> GenerateOutboundTaskDataUpdateAsync(List<Dt_Task> tasks, List<Dt_StockInfo>? stockInfos = null, List<Dt_OutboundOrderDetail>? outboundOrderDetails = null, List<Dt_OutStockLockInfo>? outStockLockInfos = null, List<Dt_LocationInfo>? locationInfos = null) |
| | | { |
| | | try |
| | | { |
| | |
| | | _outboundOrderDetailService.Repository.UpdateData(outboundOrderDetails); |
| | | } |
| | | _unitOfWorkManage.CommitTran(); |
| | | // |
| | | return WebResponseContent.Instance.OK(); |
| | | TaskModel esstask = new TaskModel() |
| | | { |
| | | taskType = "carry", |
| | | taskGroupCode = "", |
| | | groupPriority = 0, |
| | | tasks = new List<TasksType>() |
| | | }; |
| | | |
| | | foreach (var task in tasks) |
| | | { |
| | | esstask. |
| | | tasks.Add(new TasksType |
| | | { |
| | | taskCode = task.TaskNum.ToString(), |
| | | taskPriority = 0, |
| | | taskDescribe = new TaskDescribeType |
| | | { |
| | | containerCode = task.PalletCode, |
| | | containerType = "CT_KUBOT_STANDARD", |
| | | fromLocationCode = task.SourceAddress ?? "", |
| | | toStationCode = "", |
| | | toLocationCode = task.TargetAddress, |
| | | deadline = 0, |
| | | storageTag = "" |
| | | } |
| | | } |
| | | ); |
| | | } |
| | | var result = await _eSSApiService.CreateTaskAsync(esstask); |
| | | |
| | | _logger.LogInformation("å建任å¡PalletOutboundTask è¿å: " + result); |
| | | if (result) |
| | | { |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | else |
| | | { |
| | | return WebResponseContent.Instance.Error("ä¸åæºå¨äººä»»å¡å¤±è´¥ï¼"); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="stockInfos"></param> |
| | | /// <returns></returns> |
| | | public List<Dt_Task> GetTasks(List<Dt_StockInfo> stockInfos, TaskTypeEnum taskType) |
| | | public List<Dt_Task> GetTasks(List<Dt_StockInfo> stockInfos, TaskTypeEnum taskType, string outStation) |
| | | { |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | List<Dt_LocationInfo> locationInfos = _locationInfoService.Repository.QueryData(x => stockInfos.Select(x => x.LocationCode).Contains(x.LocationCode)); |
| | |
| | | NextAddress = "", |
| | | Roadway = locationInfo.RoadwayNo, |
| | | SourceAddress = stockInfo.LocationCode, |
| | | TargetAddress = "", |
| | | TargetAddress = outStation, |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | TaskType = taskType.ObjToInt(), |
| | | // TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | // TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | PalletType = stockInfo.PalletType, |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | |
| | | |
| | | }; |
| | | //if (taskType != TaskTypeEnum.OutEmpty) |
| | | //{ |
| | |
| | | // task.Quantity = (float)stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).Sum(x => x.StockQuantity); |
| | | // task.BatchNo = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.BatchNo; |
| | | //} |
| | | |
| | | |
| | | tasks.Add(task); |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | /// <param name="keys">åºåºåæç»ä¸»é®</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent GenerateOutboundTasks(int[] keys) |
| | | public async Task<WebResponseContent> GenerateOutboundTasksAsync(int[] keys,string outStation) |
| | | { |
| | | try |
| | | { |
| | |
| | | List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>(); |
| | | List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); |
| | | |
| | | (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutboundTaskDataHandle(keys); |
| | | (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutboundTaskDataHandle(keys,outStation); |
| | | if (result.Item2 != null && result.Item2.Count > 0) |
| | | { |
| | | stockInfos.AddRange(result.Item2); |
| | |
| | | tasks.AddRange(result.Item1); |
| | | } |
| | | |
| | | WebResponseContent content = GenerateOutboundTaskDataUpdate(tasks, stockInfos, outboundOrderDetails, outStockLockInfos, locationInfos); |
| | | WebResponseContent content = await GenerateOutboundTaskDataUpdateAsync(tasks, stockInfos, outboundOrderDetails, outStockLockInfos, locationInfos); |
| | | return content; |
| | | } |
| | | catch (Exception ex) |