1
huangxiaoqiang
8 小时以前 a1f7a7a68d23f7b9de7c4237bf167fa4808fb20d
项目代码/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
@@ -60,6 +60,7 @@
    private readonly ISys_ConfigService _configService;
    private readonly IDt_OrderOutDetailsRepository _orderOutDetailsRepository;
    private readonly IDt_WareAreaInfoRepository _wareAreaInfoRepository;
    private readonly IDt_InventoryRecordRepository _inventoryRecordRepository;
    public Dt_TaskService(IDt_TaskRepository BaseDal,
                                IUnitOfWorkManage unitOfWorkManage,
@@ -75,7 +76,8 @@
                                IDt_StationManagerRepository stationManagerRepository,
                                ISys_ConfigService configService,
                                IDt_OrderOutDetailsRepository orderOutDetailsRepository,
                                IDt_WareAreaInfoRepository wareAreaInfoRepository) : base(BaseDal)
                                IDt_WareAreaInfoRepository wareAreaInfoRepository,
                                IDt_InventoryRecordRepository inventoryRecordRepository) : base(BaseDal)
    {
        _unitOfWorkManage = unitOfWorkManage;
        _stockInfoRepository = stockInfoRepository;
@@ -91,6 +93,7 @@
        _configService = configService;
        _orderOutDetailsRepository = orderOutDetailsRepository;
        _wareAreaInfoRepository = wareAreaInfoRepository;
        _inventoryRecordRepository = inventoryRecordRepository;
    }
    #region 澶栭儴鎺ュ彛鏂规硶
@@ -745,13 +748,27 @@
            }
            Dt_Task taskNew = await RequestOutboundTaskAsync(new RequestTaskDto { PalletCode = palletCode, AreaId = 2, Position = stcok.LocationCode, TaskType = (int)TaskOutboundTypeEnum.Outbound });            
            List<Dt_InventoryRecord> records = new List<Dt_InventoryRecord>();
            stcok.StockInfoDetails.ForEach(x =>
            {
                records.Add(new Dt_InventoryRecord()
                {
                    PalletCode = stcok.PalletCode,
                    MaterielCode = x.MaterielCode,
                    MaterielName = x.MaterielName,
                    Quantity = x.Quantity,
                    Status = (int)InventoryStatus.Normal,
                    Remark = remark,
                });
            });
            var taskDto = CreateListTaskDTO(taskNew);
            var result = GetlcoationState(taskNew, (int)StatusChangeTypeEnum.AutomaticOutbound);
            await _unitOfWorkManage.UseTranAsync(async () =>
            {
                BaseDal.AddData(taskNew);
                _stockInfoRepository.UpdateData(stcok);
                await BaseDal.AddDataAsync(taskNew);
                await _inventoryRecordRepository.AddDataAsync(records);
                await _stockInfoRepository.UpdateDataAsync(stcok);
                await _locationStatusChangeRecordRepository.AddDataAsync(result.Item1);
                await _locationRepository.UpdateDataAsync(result.Item2);
            });