647556386
2 天以前 696edbff3c8812e4b820f624d66a02ae6ddb1a06
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs
@@ -5,6 +5,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_BasicService;
using WIDESEA_Common.CommonEnum;
using WIDESEA_Common.LocationEnum;
using WIDESEA_Common.OrderEnum;
@@ -53,7 +54,7 @@
                    return WebResponseContent.Instance.Error($"未找到组盘信息");
                }
                if (stockInfo.StockStatus != StockStatusEmun.组盘暂存.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.手动组盘暂存.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.拣选完成.ObjToInt())
                if (stockInfo.StockStatus != StockStatusEmun.组盘暂存.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.手动组盘暂存.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.拣选完成.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.智仓入智仓组盘暂存.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.送检库存完成.ObjToInt())
                {
                    return WebResponseContent.Instance.Error($"该托盘状态不正确,不可申请入库");
                }
@@ -68,28 +69,35 @@
                    return WebResponseContent.Instance.Error($"货位分配失败,未找到可分配货位");
                }
                var newTask = new Dt_Task()
                {                    
                    CurrentAddress = stationCode,
                    CurrentAddress = stations.GetValueOrDefault(stationCode) ?? "",
                    Grade = 0,
                    NextAddress = stations.GetValueOrDefault(stationCode) ?? "",
                    NextAddress = locationInfo.LocationCode,
                    PalletCode = palletCode,
                    Roadway = locationInfo.RoadwayNo,
                    SourceAddress = stationCode,
                    SourceAddress = stations.GetValueOrDefault(stationCode) ?? "",
                    TargetAddress = locationInfo.LocationCode,
                    TaskType = TaskTypeEnum.Inbound.ObjToInt(),
                    TaskStatus = TaskStatusEnum.New.ObjToInt(),
                    WarehouseId = stockInfo.WarehouseId,
                    PalletType = stockInfo.PalletType,
                    OrderNo= stockInfo.Details.FirstOrDefault()?.OrderNo
                    OrderNo= stockInfo.Details.FirstOrDefault()?.OrderNo,
                };
                //空箱
                if (stockInfo.PalletType == PalletTypeEnum.Empty.ObjToInt())
                if (stockInfo.PalletType == PalletTypeEnum.Empty.ObjToInt()|| stockInfo.StockStatus == StockStatusEmun.智仓入智仓组盘暂存.ObjToInt() || stockInfo.StockStatus == StockStatusEmun.送检库存完成.ObjToInt())
                {
                    _unitOfWorkManage.BeginTran();
                    newTask.TaskType = TaskTypeEnum.InEmpty.ObjToInt();
                    if (stockInfo.StockStatus == StockStatusEmun.智仓入智仓组盘暂存.ObjToInt())
                    {
                        newTask.TaskType = TaskTypeEnum.AllocateInWarehouse.ObjToInt();
                    }
                    if (stockInfo.StockStatus == StockStatusEmun.送检库存完成.ObjToInt())
                    {
                        newTask.TaskType = TaskTypeEnum.InQuality.ObjToInt();
                    }
                    int taskId = BaseDal.AddData(newTask);
                    newTask.TaskId = taskId;
@@ -110,8 +118,6 @@
                        inboundOrder = _inboundOrderService.Repository.QueryFirst(x => x.InboundOrderNo == orderNo && x.OrderStatus < InOrderStatusEnum.入库完成.ObjToInt());
                    
                    }
                    stockInfo.StockStatus = StockStatusEmun.入库确认.ObjToInt();
                    LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus;
@@ -127,52 +133,14 @@
                    _stockRepository.UpdateData(stockInfo);
                    _unitOfWorkManage.CommitTran();
                }
                //TaskModel esstask = new TaskModel()
                //{
                //    taskType = "putaway",
                //    taskGroupCode = "",
                //    groupPriority = 0,
                //    tasks = new List<TasksType>
                //    {
                //            new()
                //            {
                //                taskCode=newTask.TaskNum.ToString(),
                //                taskPriority=0,
                //                taskDescribe=new TaskDescribeType{
                //                containerCode=palletCode,
                //                containerType= "CT_KUBOT_STANDARD",
                //                fromLocationCode=stations.GetValueOrDefault(stationCode)??"",
                //                toStationCode="",
                //                toLocationCode=locationInfo.LocationCode,
                //                deadline=0,storageTag=""
                //                }
                //            }
                //    }
                //};
                //var result = await _eSSApiService.CreateTaskAsync(esstask);
                //_logger.LogInformation("创建任务返回:  " + result);
                //if (result)
                await _eSSApiService.MoveContainerAsync(new WIDESEA_DTO.Basic.MoveContainerRequest
                {
                    try
                    {
                        await _eSSApiService.MoveContainerAsync(new WIDESEA_DTO.Basic.MoveContainerRequest
                        {
                            slotCode = stationCode,
                            containerCode = palletCode
                        });
                    }
                    catch (Exception ex) {
                    slotCode = stationCode,
                    containerCode = palletCode
                });
                    }
                    return WebResponseContent.Instance.OK();
                }
                //else
                //{
                //    return WebResponseContent.Instance.Error("下发机器人任务失败!");
                //}
            return WebResponseContent.Instance.OK();
            }
            catch (Exception ex)
            {