| | |
| | | var locationInfo = await _locationInfoService.GetLocationInfo(task.Roadway); |
| | | if (locationInfo == null) return WebResponseContent.Instance.Error("未找到对应的货位"); |
| | | |
| | | return await ExecuteWithinTransactionAsync(async () => |
| | | { |
| | | locationInfo.LocationStatus = LocationStatusEnum.FreeLock.GetHashCode(); |
| | | task.CurrentAddress = task.SourceAddress; |
| | | task.NextAddress = locationInfo.LocationCode; |
| | | task.TargetAddress = locationInfo.LocationCode; |
| | | task.TaskStatus = TaskInStatusEnum.Line_InFinish.GetHashCode(); |
| | | |
| | | var updateResult = await BaseDal.UpdateDataAsync(task); |
| | | var locationResult = await _locationInfoService.UpdateLocationInfoAsync(locationInfo); |
| | | var updateTaskResult = await BaseDal.UpdateDataAsync(task); |
| | | var updateLocationResult = await _locationInfoService.UpdateLocationInfoAsync(locationInfo); |
| | | if (!updateTaskResult || !updateLocationResult) |
| | | { |
| | | return WebResponseContent.Instance.Error("任务更新失败"); |
| | | } |
| | | |
| | | return WebResponseContent.Instance.OK( |
| | | updateResult && locationResult ? "任务更新成功" : "任务更新失败", |
| | | locationInfo.LocationCode); |
| | | return WebResponseContent.Instance.OK("任务更新成功", locationInfo.LocationCode); |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | if (location == null) return WebResponseContent.Instance.Error("未找到对应的货位"); |
| | | |
| | | var stockInfo = await _stockInfoService.GetStockInfoAsync(taskDto.PalletCode); |
| | | if (stockInfo == null) return WebResponseContent.Instance.Error("未找到对应库存信息"); |
| | | |
| | | return await ExecuteWithinTransactionAsync(async () => |
| | | { |
| | | stockInfo.LocationCode = location.LocationCode; |
| | | stockInfo.LocationId = location.Id; |
| | | stockInfo.OutboundDate = task.Roadway switch |
| | |
| | | if (!updateLocationResult || !updateStockResult) |
| | | return WebResponseContent.Instance.Error("任务完成失败"); |
| | | return await CompleteTaskAsync(task); |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | if (location == null) return WebResponseContent.Instance.Error("未找到对应的货位"); |
| | | |
| | | var stockInfo = await _stockInfoService.GetStockInfoAsync(taskDto.PalletCode); |
| | | if (stockInfo == null) return WebResponseContent.Instance.Error("未找到对应库存信息"); |
| | | |
| | | return await ExecuteWithinTransactionAsync(async () => |
| | | { |
| | | stockInfo.LocationId = 0; |
| | | stockInfo.LocationCode = null; |
| | | stockInfo.OutboundDate = DateTime.Now; |
| | |
| | | if (!updateLocationResult || !updateStockResult) |
| | | return WebResponseContent.Instance.Error("任务完成失败"); |
| | | return await CompleteTaskAsync(task); |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | var stockInfo = await _stockInfoService.GetStockInfoAsync(taskDto.PalletCode); |
| | | if (stockInfo == null) return WebResponseContent.Instance.Error("未找到对应库存信息"); |
| | | |
| | | return await ExecuteWithinTransactionAsync(async () => |
| | | { |
| | | stockInfo.LocationCode = targetLocation.LocationCode; |
| | | stockInfo.LocationId = targetLocation.Id; |
| | | stockInfo.StockStatus = StockStatusEmun.入库完成.GetHashCode(); |
| | |
| | | return WebResponseContent.Instance.Error("移库任务完成失败"); |
| | | |
| | | return await CompleteTaskAsync(task); |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | taskList.Add(task); |
| | | } |
| | | |
| | | var transactionResult = await ExecuteWithinTransactionAsync(async () => |
| | | { |
| | | var addResult = await BaseDal.AddDataAsync(taskList) > 0; |
| | | if (!addResult) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | return WebResponseContent.Instance.OK(); |
| | | }); |
| | | if (!transactionResult.Status) |
| | | { |
| | | return transactionResult; |
| | | } |
| | | |
| | | // 6. 通知 WCS(异步,不影响主流程) |
| | | _ = Task.Run(() => |
| | | { |