盘料出1个盘料盒对多次料塔

散料出库扫描 站台码
This commit is contained in:
zgf committed 2023-11-22 03:24:57 +08:00
1 parent 2cae99cb34
commit b833415dbf
5 files changed
+87 -92

No files matched your search

@@ -96,9 +96,9 @@ namespace HHWMS.Web
var taskUniques = _unitwork.Find<TaskDetail>(x => x.Status > TaskStatusEnum.新建)
.Select(x => x.UniqueCode).ToList();
var taskInvs = _unitwork.Find<Inventory>(x => taskUniques.Contains(x.UniqueCode)).ToList();
shiInventorys.Except(lockInvs);
shiInventorys.DistinctBy(x => x.UniqueCode);
var inventoryList = shiInventorys.GroupBy(x => x.ContainerCode)
var newList = shiInventorys.Except(taskInvs).ToList();
newList = newList.DistinctBy(x => x.UniqueCode).ToList();
var inventoryList = newList.GroupBy(x => x.ContainerCode)
.ToList();
//散料库
@@ -176,9 +176,11 @@ namespace HHWMS.Web
var gLoc = _unitwork.Find<Location>(x => x.ContainerCode == item.Key
&& x.Row == location.Row
&& x.Type.Equals(LocationTypeEnum.堆垛机工位)).FirstOrDefault();
if (gLoc != null)
var cTask = _unitwork.Find<TaskHeader>(x => x.ContainerCode == item.Key
&& x.TaskType == TaskTypeEnum.盘料盒出库).FirstOrDefault();
if (gLoc != null || cTask != null)
{
//盘料箱已在堆垛机工位,直接生成盘料出库任务
//盘料箱已在堆垛机工位,或者有此料箱的出库任务,直接生成盘料出库任务
}
else
{
@@ -197,6 +199,7 @@ namespace HHWMS.Web
ContainerCode = item.Key,
FromLocation = location.ContainerCode,
ToLocation = gLoc.Code,
Station = "1",
Status = TaskStatusEnum.待下发,
Priority = 0,
CreateTime = DateTime.Now,
@@ -212,79 +215,73 @@ namespace HHWMS.Web
var tLoc = _unitwork.Find<Location>(x => string.IsNullOrEmpty(x.ContainerCode)
&& x.Row == row
&& x.Type.Equals(LocationTypeEnum.料塔))
.FirstOrDefault();
.FirstOrDefault();
//查询料塔是否为空
if (tLoc == null)
//判断是否存在此托盘的出库任务
var containerTask = _unitwork.Find<TaskHeader>(x => x.Status < TaskStatusEnum.已下发
&& x.ContainerCode == item.Key
&& x.TaskType == TaskTypeEnum.盘料出库)
.Include(x => x.TaskDetails)
.FirstOrDefault();
if (containerTask != null)
{
//判断是否存在此托盘的出库任务
var containerTask = _unitwork.Find<TaskHeader>(x => x.Status < TaskStatusEnum.已下发
&& x.ContainerCode == item.Key
&& x.TaskType == TaskTypeEnum.盘料出库)
.Include(x => x.TaskDetails)
.FirstOrDefault();
if (containerTask != null)
tLoc = _unitwork.Find<Location>(x => x.Code == containerTask.ToLocation
&& x.Type.Equals(LocationTypeEnum.料塔))
.FirstOrDefault();
foreach (var inventory in item)
{
tLoc = _unitwork.Find<Location>(x => x.Code == containerTask.ToLocation
&& x.Type.Equals(LocationTypeEnum.料塔))
.FirstOrDefault();
foreach (var inventory in item)
if (tLoc.Height < tLoc.Length)
{
if (tLoc.Height < tLoc.Length)
// 库存不在已建任务明细中,新增任务明细
if (!containerTask.TaskDetails.Any(x => x.UniqueCode.Equals(inventory.UniqueCode)))
{
// 库存不在已建任务明细中,新增任务明细
if (!containerTask.TaskDetails.Any(x => x.UniqueCode.Equals(inventory.UniqueCode)))
containerTask.TaskDetails.Add(new TaskDetail
{
containerTask.TaskDetails.Add(new TaskDetail
{
UniqueCode = inventory.UniqueCode,
Lot = $"{Convert.ToInt32(location.Length)}-{tLoc.Code}",
FromLocation = inventory.Lot,
ToLocation = (Convert.ToInt32(tLoc.Height) + 1).ToString(),
Status = TaskStatusEnum.待下发,
ContainerCode = inventory.ContainerCode,
CreateTime = DateTime.Now
});
tLoc.Height += 1;
}
//存在
else
{
foreach (var i in containerTask.TaskDetails.Where(x => x.Status == TaskStatusEnum.新建))
{
i.Lot = $"{Convert.ToInt32(location.Length)}-{tLoc.Code}";
i.ToLocation = (Convert.ToInt32(tLoc.Height) + 1).ToString();
i.Status = TaskStatusEnum.待下发;
tLoc.Height += 1;
}
}
containerTask.Status = TaskStatusEnum.待下发;
UniqueCode = inventory.UniqueCode,
Lot = $"{Convert.ToInt32(location.Length)}-{tLoc.Code}",
FromLocation = inventory.Lot,
ToLocation = (Convert.ToInt32(tLoc.Height) + 1).ToString(),
Status = TaskStatusEnum.待下发,
ContainerCode = inventory.ContainerCode,
CreateTime = DateTime.Now
});
tLoc.Height += 1;
}
//存在
else
{
// 库存不在已建任务明细中,新增任务明细
if (!containerTask.TaskDetails.Any(x => x.UniqueCode.Equals(inventory.UniqueCode)))
var i = containerTask.TaskDetails.Where(x => x.Status == TaskStatusEnum.新建
&& x.UniqueCode == inventory.UniqueCode)
.FirstOrDefault();
i.Lot = $"{Convert.ToInt32(location.Length)}-{tLoc.Code}";
i.ToLocation = (Convert.ToInt32(tLoc.Height) + 1).ToString();
i.Status = TaskStatusEnum.待下发;
tLoc.Height += 1;
}
}
else
{
// 库存不在已建任务明细中,新增任务明细
if (!containerTask.TaskDetails.Any(x => x.UniqueCode.Equals(inventory.UniqueCode)))
{
containerTask.TaskDetails.Add(new TaskDetail
{
containerTask.TaskDetails.Add(new TaskDetail
{
UniqueCode = inventory.UniqueCode,
FromLocation = inventory.Lot,
Status = TaskStatusEnum.新建,
ContainerCode = inventory.ContainerCode,
CreateTime = DateTime.Now
});
}
UniqueCode = inventory.UniqueCode,
FromLocation = inventory.Lot,
Status = TaskStatusEnum.新建,
ContainerCode = inventory.ContainerCode,
CreateTime = DateTime.Now
});
}
}
_unitwork.Update(tLoc);
_unitwork.Update(containerTask);
}
else
{
continue;
}
containerTask.Status = TaskStatusEnum.待下发;
tLoc.ContainerCode = tLoc.Code;
_unitwork.Update(tLoc);
_unitwork.Update(containerTask);
}
else if (tLoc != null)
else
{
task.ZoneCode = ZoneCodeEnum.盘料库;
task.TaskNo = _unitwork.GetSerialNumber("pout", 4);
@@ -316,7 +313,14 @@ namespace HHWMS.Web
}
else
{
break;
task.TaskDetails.Add(new TaskDetail
{
UniqueCode = inventory.UniqueCode,
FromLocation = inventory.Lot,
Status = TaskStatusEnum.新建,
ContainerCode = inventory.ContainerCode,
CreateTime = DateTime.Now
});
}
}
_unitwork.Add(task);