wanshenmean
5 小时以前 e4921e003cc293fea714bdaf74dc6a6b6b750295
Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_GradingMachine.cs
@@ -49,12 +49,19 @@
                if (stockInfo == null)
                {
                    var location = await _locationInfoService.GetLocationInfoAsync(input.LocationCode);
                    locationStatus = location?.LocationStatus ?? 0;
                    locationStatus = location?.LocationStatus == (int)LocationStatusEnum.InStock ? 10 : 0;
                }
                else
                {
                    locationStatus = stockInfo.LocationDetails?.LocationStatus ?? 0;
                    locationStatus = MapLocationStatus(stockInfo.StockStatus);
                }
                int MapLocationStatus(int stockStatus) => stockStatus switch
                {
                    (int)StockStatusEmun.入库完成 => 10,
                    (int)StockStatusEmun.空托盘库存 => 11,
                    _ => 0
                };
                OutputDto outPutDto = new OutputDto()
                {
@@ -91,8 +98,8 @@
                var result = await _locationInfoService.Db.Updateable<Dt_LocationInfo>()
                    .SetColumns(s => new Dt_LocationInfo
                    {
                        LocationStatus = input.LocationStatus
                    }).Where(s => s.LocationCode == input.LocationCode).ExecuteCommandAsync() > 0;
                        EnableStatus = input.LocationStatus == 1 ? 0 : 3,
                    }).Where(s => s.LocationCode == input.LocationCode && s.RoadwayNo == TaskAddressConstants.GRADING_RoadWayNo).ExecuteCommandAsync() > 0;
                if (result)
                {
@@ -127,40 +134,41 @@
                var stock = await _stockInfoService.GetStockInfoAsync(input.PalletCode, input.LocationCode);
                if (stock == null)
                {
                    content.Error("未找到对应的托盘");
                    return content.Error("未找到对应的托盘");
                }
                else
                {
                    var taskList = new Dt_Task
                    {
                        WarehouseId = stock.WarehouseId,
                        PalletCode = stock.PalletCode,
                        PalletType = stock.PalletType,
                        SourceAddress = stock.LocationCode,
                        CurrentAddress = stock.LocationCode,
                        NextAddress = TaskAddressConstants.DEFAULT_ADDRESS,
                        TargetAddress = TaskAddressConstants.GRADING_OUTBOUND_ADDRESS,
                        Roadway = stock.LocationDetails.RoadwayNo,
                        TaskType = TaskTypeEnum.Outbound.GetHashCode(),
                        TaskStatus = TaskStatusEnum.New.GetHashCode(),
                        Grade = 1,
                        TaskNum = await BaseDal.GetTaskNo(),
                        Creater = "system",
                    };
                var taskList = new Dt_Task
                {
                    WarehouseId = stock.WarehouseId,
                    PalletCode = stock.PalletCode,
                    PalletType = stock.PalletType,
                    SourceAddress = stock.LocationCode,
                    CurrentAddress = stock.LocationCode,
                    NextAddress = TaskAddressConstants.DEFAULT_ADDRESS,
                    TargetAddress = TaskAddressConstants.GRADING_OUTBOUND_ADDRESS,
                    Roadway = stock.LocationDetails.RoadwayNo,
                    TaskType = TaskOutboundTypeEnum.Outbound.GetHashCode(),
                    TaskStatus = TaskOutStatusEnum.OutNew.GetHashCode(),
                    Grade = 1,
                    TaskNum = await BaseDal.GetTaskNo(),
                    Creater = "system",
                };
                return await _unitOfWorkManage.BeginTranAsync(async () =>
                {
                    var result = await BaseDal.AddDataAsync(taskList) > 0;
                    var wmstaskDto = result ? _mapper.Map<WMSTaskDTO>(taskList) : null;
                    var httpResponse = _httpClientHelper.Post<WebResponseContent>("http://logistics-service/api/logistics/notifyoutbound", JsonSerializer.Serialize(wmstaskDto)).Data;
                    if (result && httpResponse != null)
                    {
                        content.OK("出库请求成功");
                        return content.OK("出库请求成功");
                    }
                    else
                    {
                        content.Error("出库请求失败");
                        return content.Error("出库请求失败");
                    }
                }
                });
            }
            catch (Exception ex)
            {