wanshenmean
2024-09-11 28f1259ec675a191d2a852f74566400e6cc40b50
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
@@ -250,6 +250,7 @@
            if (task != null)
            {
                // 更新现有任务
                content = await UpdateExistingTask(input, areaInfo.AreaID, task);
            }
@@ -665,6 +666,7 @@
        int taskState;
        string original = task.CurrentAddress;
        DtLocationInfo location = new DtLocationInfo();
        int beforeStatus = 0;
        if (input.Type == (int)TaskTypeEnum.Outbound)
        {
@@ -678,6 +680,7 @@
            location = await GetLocationDistributeAsync(areaId, task.Roadway);
            toAddress = location.LocationCode;
            taskState = (int)InTaskStatusEnum.Line_InFinish;
            beforeStatus = location.LocationStatus;
            // 更新货位信息
            location.LocationStatus = (int)LocationEnum.Lock;
@@ -693,24 +696,25 @@
        _unitOfWorkManage.BeginTran();
        bool isUpdateLo = true;
        bool isUpdateChange = true;
        // 尝试更新任务
        bool isResult = await BaseDal.UpdateDataAsync(task);
        bool isTaskDetail = await _taskExecuteDetailRepository.AddDetailAsync(task, true, TaskDescription.GetTaskUpdateDescription(task.PalletCode, original, input.Position, InTaskStatusEnum.Line_InFinish.GetIntegralRuleTypeEnumDesc()));
        bool isTaskDetail = await _taskExecuteDetailRepository.AddDetailAsync(task, false, TaskDescription.GetTaskUpdateDescription(task.PalletCode, original, input.Position, InTaskStatusEnum.Line_InFinish.GetIntegralRuleTypeEnumDesc()));
        if (input.Type != (int)TaskTypeEnum.Outbound)
        {
            DtLocationStatusChangeRecord dtLocationStatusChangeRecord = new DtLocationStatusChangeRecord()
            LocationChangeRecordDto changeRecordDto = new LocationChangeRecordDto()
            {
                ChangeType = task.TaskType,
                LocationCode = location.LocationCode,
                LocationId = location.Id,
                Creater = "System",
                TaskNum = task.TaskNum,
                AfterStatus = location.LocationStatus,
                BeforeStatus = (int)LocationEnum.Free,
                BeforeStatus = beforeStatus,
                TaskNum = task.TaskNum.Value,
                LocationId = location.Id,
                LocationCode = location.LocationCode,
                ChangeType = (int)StatusChangeTypeEnum.AutomaticStorage,
            };
            isUpdateChange = await _locationStatusChangeRecordRepository.AddDataAsync(dtLocationStatusChangeRecord) > 0;
            isUpdateChange = _locationStatusChangeRecordRepository.AddStatusChangeRecord(changeRecordDto);
            isUpdateLo = await _locationRepository.UpdateDataAsync(location);
        }
        if (isResult && isUpdateLo && isTaskDetail)
        {
            _unitOfWorkManage.CommitTran();
@@ -752,7 +756,7 @@
            SourceAddress = input.Position,
            TaskState = (int)InTaskStatusEnum.InNew,
            TaskType = (int)TaskTypeEnum.Inbound,
            TaskNum = await BaseDal.GetTaskNo(),
            TaskNum = await BaseDal.GetTaskNo(),
            Creater = "Systeam"
        };
        // 尝试添加新任务