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

散料出库扫描 站台码
This commit is contained in:
zgf 2023-11-22 03:24:57 +08:00
parent 2cae99cb34
commit b833415dbf
5 changed files with 88 additions and 93 deletions

View File

@ -204,7 +204,9 @@ namespace HHWMS.Web
.Include(x => x.TaskDetails).FirstOrDefault();
if (plrTask != null)
{
var details = plrTask.TaskDetails.Where(x => !string.IsNullOrEmpty(x.ContainerCode) && x.ContainerCode.Equals(task.ContainerCode));
var details = plrTask.TaskDetails.Where(x => !string.IsNullOrEmpty(x.ContainerCode)
&& x.ContainerCode.Equals(task.ContainerCode)
&& !string.IsNullOrEmpty(x.ToLocation));
foreach (var detail in details)
{
detail.Status = TaskStatusEnum.待下发;

View File

@ -41,33 +41,22 @@ public class ShipOutController : BaseController
Location box = new Location();
if (code.Contains("C"))
{
box = _unitWork.FindSingle<Location>(x => x.ContainerCode.Equals(code) && x.Type == LocationTypeEnum.散料库站台);
box = _unitWork.FindSingle<Location>(x => x.Code.Equals(code) && x.Type == LocationTypeEnum.散料库站台);
}
else if (code.Contains("L"))
{
box = _unitWork.FindSingle<Location>(x => x.Code.Equals(code));
box = _unitWork.FindSingle<Location>(x => x.Code.Equals(code) && x.Type == LocationTypeEnum.料塔);
}
// 判断箱号是否合理
if (box != null)
{
if (box.Type == LocationTypeEnum.散料库站台 || box.Type == LocationTypeEnum.料塔)
{
var inv = _unitWork.Find<Inventory>(x => x.LocationCode.Equals(code));
if (code.Contains("C"))
{
inv = _unitWork.Find<Inventory>(x => x.ContainerCode.Equals(code));
}
return JsonMore(inv);
}
else
{
return JsonMore(null, 500, $"{code}不在站台!");
}
var inv = _unitWork.Find<Inventory>(x => x.LocationCode.Equals(code));
return JsonMore(inv);
}
else
{
return JsonMore(null, 500, $"{code}不正确!");
return JsonMore(null, 500, $"站台信息 {code} 不正确,请检查后重新扫描!");
}
}

View File

@ -92,7 +92,7 @@
},
type: "",
taskType: [
{ label: "散料箱", value: "slbox" },
{ label: "散料站台", value: "slbox" },
{ label: "料塔周转箱", value: "lt" },
{ label: "唯一码", value: "uniqueCode" },
],

View File

@ -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)))
{
containerTask.TaskDetails.Add(new TaskDetail
{
UniqueCode = inventory.UniqueCode,
FromLocation = inventory.Lot,
Status = TaskStatusEnum.新建,
ContainerCode = inventory.ContainerCode,
CreateTime = DateTime.Now
});
}
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
{
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);

View File

@ -27,21 +27,21 @@
// "Value": "Server=127.0.0.1;Port=3306;Database=8357wms;Uid=root;Password=abc123*;Character Set=utf8mb4;",
// "DBType": "mysql"
//}
//{
// "Key": "default",
// "Value": "Data Source=.;Initial Catalog=8357wms;User=sa;Password=abc123*;Persist Security Info=True",
// "DbContext": "DataContext",
// "DBType": "sqlserver" //DataBase, you can choose mysql,sqlserver,pgsql,sqlite,oracle
//}
{
"Key": "default",
"Value": "Data Source=10.18.106.4;Initial Catalog=8357wms;User=wms;Password=abc123*;Persist Security Info=True",
"Value": "Data Source=.;Initial Catalog=8357wms;User=sa;Password=abc123*;Persist Security Info=True",
"DbContext": "DataContext",
"DBType": "sqlserver" //DataBase, you can choose mysql,sqlserver,pgsql,sqlite,oracle
}
//{
// "Key": "default",
// "Value": "Data Source=10.18.106.4;Initial Catalog=8357wms;User=wms;Password=abc123*;Persist Security Info=True",
// "DbContext": "DataContext",
// "DBType": "sqlserver" //DataBase, you can choose mysql,sqlserver,pgsql,sqlite,oracle
//}
],
"CookiePre": "HHWMS", //cookie前缀
"IsQuickDebug": false, //是否启用debug模式
"IsQuickDebug": true, //是否启用debug模式
"EnableTenant": false, //是否启动多租户
"SyncDb": true, //是否自动同步数据库
"EncryptKey": "", //加密密钥