wangxinhui
2025-03-06 2f8a8a7b31c7e311d1824c76e2a67e2a128bc65b
´úÂë¹ÜÀí/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
{
@@ -76,7 +77,7 @@
                      (x.EnableStatus == (int)EnableStatusEnum.Normal || x.EnableStatus == (int)EnableStatusEnum.OnlyOut));
                    if (locationInfo == null)
                    {
                        return responseContent.Error($"测试架货位:{stockInfo.LocationCode}出库条件不满足");
                        return responseContent.Error($"测试架货位。。。。。。。。。:{stockInfo.LocationCode}出库条件不满足");
                    }
                    //生成测试架出库任务 é”å®šåº“å­˜ æ›´æ”¹è´§ä½çŠ¶æ€
                    Dt_Task taskOut = new()
@@ -975,7 +976,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)
                {
@@ -1020,13 +1026,36 @@
                    PalletCode = bagInfoModel.BatchNo,
                    PalletType = 1,
                    WarehouseId = warehouse.WarehouseId,
                    StockStatus = StockStatusEmun.组盘暂存.ObjToInt(),
                    StockStatus = StockStatusEmun.入库确认.ObjToInt(),
                    proStockInfoDetails = proStockInfoDetails
                };
                //分配货位
                locationInfo = _basicService.LocationInfoService.AssignLocation(locationInfo.RoadwayNo, ((PalletTypeEnum)proStockInfo.PalletType).ObjToInt(), proStockInfo.WarehouseId);
                Dt_Task newTask = new Dt_Task()
                {
                    CurrentAddress = bagInfoModel.WorkCenter,
                    Grade = 0,
                    NextAddress = locationInfo.LocationCode,
                    PalletCode = proStockInfo.PalletCode,
                    Roadway = locationInfo.RoadwayNo,
                    SourceAddress = bagInfoModel.WorkCenter,
                    TargetAddress = locationInfo.LocationCode,
                    TaskType = TaskTypeEnum.InProduct.ObjToInt(),
                    TaskStatus = TaskStatusEnum.New.ObjToInt(),
                    WarehouseId = warehouse.WarehouseId,
                    PalletType = proStockInfo.PalletType
                };
                locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
                _unitOfWorkManage.BeginTran();
                int taskId = BaseDal.AddData(newTask);
                newTask.TaskId = taskId;
                _basicRepository.LocationInfoRepository.UpdateData(locationInfo);
                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)
@@ -1618,9 +1647,5 @@
                return WebResponseContent.Instance.Error(ex.Message);
            }
        }
    }
}