huangxiaoqiang
6 天以前 6db89a97e81e6c26bb2d2ccb3db79ed8858462a2
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
@@ -184,28 +184,33 @@
            if (!result.Success)
            {
                //var taskNG = new Dt_Task
                //{
                //    CurrentAddress = input.Position,
                //    Grade = 1,
                //    Roadway = input.Roadways,
                //    TargetAddress = stationManager.stationNGLocation,
                //    Dispatchertime = DateTime.Now,
                //    MaterialNo = "",
                //    NextAddress = stationManager.stationNGChildCode,
                //    OrderNo = null,
                //    PalletCode = input.PalletCode,
                //    SourceAddress = stationManager.stationLocation,
                //    TaskState = (int)TaskInStatusEnum.Line_InFinish,
                //    TaskType = (int)TaskOutboundTypeEnum.InToOut,
                //    TaskNum = await BaseDal.GetTaskNo(),
                //    Creater = "System",
                //    ProductionLine = result.ProductionLine,
                //    ProcessCode = result.ProcessCode,
                //};
                //return taskNG;
                List<string> strings = new List<string>() { "2036","2038","2084","2086"};
                if (input.Position.Contains(strings))
                {
                Console.WriteLine($"{result.MOMMessage}");
                return null;
                }
                var taskNG = new Dt_Task
                {
                    CurrentAddress = input.Position,
                    Grade = 1,
                    Roadway = input.Roadways,
                    TargetAddress = stationManager.stationNGLocation,
                    Dispatchertime = DateTime.Now,
                    MaterialNo = "",
                    NextAddress = stationManager.stationNGChildCode,
                    OrderNo = null,
                    PalletCode = input.PalletCode,
                    SourceAddress = stationManager.stationLocation,
                    TaskState = (int)TaskInStatusEnum.Line_InFinish,
                    TaskType = (int)TaskOutboundTypeEnum.InToOut,
                    TaskNum = await BaseDal.GetTaskNo(),
                    Creater = "System",
                    ProductionLine = result.ProductionLine,
                    ProcessCode = result.ProcessCode,
                };
                return taskNG;
            }
            if (result.SerialNos.Count <= 0)
@@ -606,11 +611,17 @@
            taskHty.Creater = App.User.UserName != null ? App.User.UserName : "System";
            var location = _locationRepository.QueryFirst(x => x.LocationCode == task.SourceAddress && x.RoadwayNo == task.Roadway);
            if(location != null)
            {
            int lastStatus = location.LocationStatus;
            location.LocationStatus = (int)LocationEnum.Free;
                _locationStatusChangeRecordRepository.AddLocationStatusChangeRecord(location, lastStatus, (int)StatusChangeTypeEnum.AutomaticDelivery, task.TaskNum);
            }
            task.TaskState = (int)TaskOutStatusEnum.OutFinish;
            _locationStatusChangeRecordRepository.AddLocationStatusChangeRecord(location, lastStatus, (int)StatusChangeTypeEnum.AutomaticDelivery, task.TaskNum);
            // 事务处理
            await _unitOfWorkManage.UseTranAsync(async () =>
            {
@@ -620,8 +631,10 @@
                    await DeleteStockInfoDetailsAsync(stock.StockInfoDetails);
                    await AddStockInfoHtyAsync(stockInfo_Hty);
                }
                if (location != null)
                {
                await UpdateLocationAsync(location);
                }
                await DeleteTaskAsync(task.TaskId);
                await AddTaskHtyAsync(taskHty);
            });