wangxinhui
2025-03-07 7d173d42cba04b4243f13c6ce013b04e1be4dc95
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs
@@ -29,6 +29,7 @@
using WIDESEA_DTO.Task;
using WIDESEA_DTO.Stock;
using SqlSugar;
using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;
namespace WIDESEA_TaskInfoService
{
@@ -979,7 +980,12 @@
                {
                    return content.Error("未找到仓库信息");
                }
                //判断是否MES内包信息是否重复
                Dt_LocationInfo locationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.WarehouseId == warehouse.WarehouseId);
                if (locationInfo==null)
                {
                    return content.Error($"未找到{warehouse.WarehouseCode}货位信息");
                }
                //内包信息组盘
                List<Dt_MesProInOrderDetail> mesProInOrderDetails = new List<Dt_MesProInOrderDetail>();
                foreach (var item in bagInfoModel.BagDetails)
                {
@@ -1024,13 +1030,31 @@
                    PalletCode = bagInfoModel.BatchNo,
                    PalletType = 1,
                    WarehouseId = warehouse.WarehouseId,
                    StockStatus = StockStatusEmun.组盘暂存.ObjToInt(),
                    StockStatus = StockStatusEmun.入库确认.ObjToInt(),
                    proStockInfoDetails = proStockInfoDetails
                };
                Dt_Task newTask = new Dt_Task()
                {
                    CurrentAddress = bagInfoModel.WorkCenter,
                    Grade = 0,
                    NextAddress = "",
                    PalletCode = proStockInfo.PalletCode,
                    Roadway = locationInfo.RoadwayNo,
                    SourceAddress = bagInfoModel.WorkCenter,
                    TargetAddress = "",
                    TaskType = TaskTypeEnum.InProduct.ObjToInt(),
                    TaskStatus = TaskStatusEnum.New.ObjToInt(),
                    WarehouseId = warehouse.WarehouseId,
                    PalletType = proStockInfo.PalletType
                };
                _unitOfWorkManage.BeginTran();
                int taskId = BaseDal.AddData(newTask);
                newTask.TaskId = taskId;
                Db.InsertNav(mesProInOrder).Include(x => x.Details).ExecuteCommand();
                Db.InsertNav(proStockInfo).Include(x => x.proStockInfoDetails).ExecuteCommand();
                _unitOfWorkManage.CommitTran();
                //推送任务
                PushTasksToWCS(new List<Dt_Task> { newTask });
                return content.OK("接收成功");
            }
            catch (Exception ex)
@@ -1634,9 +1658,5 @@
                return WebResponseContent.Instance.Error(ex.Message);
            }
        }
    }
}