|
|
|
|
@ -512,6 +512,7 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
|
using var scope = _host.Services.CreateScope();
|
|
|
|
|
using var dbContext = scope.ServiceProvider.GetRequiredService<DefaultDbContext>();
|
|
|
|
|
List<int> Outtpyes = new();//有问题的楼层任务
|
|
|
|
|
string warningMsg = "任务无法下发";
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
|
|
|
|
using var transaction = dbContext.Database.BeginTransaction();
|
|
|
|
|
@ -546,12 +547,14 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
|
.Where(t => t.palletInfoCode == wcsTask.containerNo).FirstOrDefault();
|
|
|
|
|
if (mesBasePalletInfo == null || string.IsNullOrEmpty(mesBasePalletInfo.materialBarcode))
|
|
|
|
|
{
|
|
|
|
|
warningMsg = "2楼周转位废料到3楼,托盘未绑定条码,请先绑定";
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
var mesBaseBarcodeInfo = dbContext.MesBaseBarcodeInfo
|
|
|
|
|
.Where(t => t.palletInfoCode == wcsTask.containerNo && t.barcodeInfo == mesBasePalletInfo.materialBarcode).FirstOrDefault();
|
|
|
|
|
if (mesBaseBarcodeInfo == null)
|
|
|
|
|
{
|
|
|
|
|
warningMsg = "2楼周转位废料到3楼,未找到条码信息,请确认";
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -590,6 +593,7 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
|
wcsTask.serialNo ??= SystemData.GetSerialNo(dbContext);
|
|
|
|
|
if (wcsTasks.Where(t => t.taskStatus > 0).Where(t => t.objid != wcsTask.objid).Any())
|
|
|
|
|
{
|
|
|
|
|
warningMsg = "提升机线程:有其他任务正在执行,跳过当前任务";
|
|
|
|
|
_logger.Info("提升机线程:有其他任务正在执行,跳过当前任务");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
@ -601,7 +605,8 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
|
|
|
|
|
|
if (lineEquip.equipStatus == 1 && InTask == null)
|
|
|
|
|
{
|
|
|
|
|
_logger.Info("提升机线程:" + wcsTask.floorNo + "楼接驳位有AGV任务,跳过当前任务");
|
|
|
|
|
warningMsg = $"提升机{wcsTask.floorNo}楼接驳位有物体或任务正在执行,跳过当前任务";
|
|
|
|
|
_logger.Info($"提升机{wcsTask.floorNo}楼接驳位有物体或任务正在执行,跳过当前任务");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
BasePlcpoint floorPoint = StaticData.BasePlcpointList.First(t => t.plcpointNo == "RFID00" + wcsTask.fromFloorNo);
|
|
|
|
|
@ -727,12 +732,14 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
|
var clearValue = StaticData.PlcDic[0].Read(clearPoint.plcpointAddress);
|
|
|
|
|
if (clearPoint != null && Convert.ToBoolean(clearValue) == false)
|
|
|
|
|
{
|
|
|
|
|
warningMsg = $"{wcsTask.floorNo}接驳位外侧有东西,货物无法继续出提升机";
|
|
|
|
|
StaticData.PlcDic[0].WriteToPoint(clearPoint.plcpointAddress, true, clearPoint.plcpointLength.ToString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
warningMsg = $"一楼托盘库有任务正在执行,等待任务执行完成";
|
|
|
|
|
Console.WriteLine(DateTime.Now + ":一楼托盘库有任务正在执行,等待任务执行完成");
|
|
|
|
|
_logger.Info("一楼托盘库有任务正在执行,等待任务执行完成");
|
|
|
|
|
}
|
|
|
|
|
@ -758,6 +765,7 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
warningMsg = $"{wcsTask.floorNo}楼接驳位外侧有东西{linesignal}";
|
|
|
|
|
BasePlcpoint basePlcpoint = StaticData.BasePlcpointList.First(t => t.plcpointNo == $"clear0{wcsTask.floorNo}");
|
|
|
|
|
StaticData.PlcDic[0].WriteToPoint(basePlcpoint.plcpointAddress, "1", basePlcpoint.plcpointLength.ToString());
|
|
|
|
|
}
|
|
|
|
|
@ -802,13 +810,14 @@ namespace Khd.Core.Wcs.Wcs
|
|
|
|
|
{
|
|
|
|
|
if (currentfloor06Value != null && targetfloor06Value != null)
|
|
|
|
|
{
|
|
|
|
|
warningMsg = "MES屏蔽已打开,无法下发任务";
|
|
|
|
|
StaticData.PlcDic[0].WriteToPoint(this.targetfloor06.plcpointAddress, Convert.ToString(currentfloor06Value), this.targetfloor06.plcpointLength.ToString());
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (Outtpyes.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
SystemData.InsertWaringLog(dbContext, WaringType.提升机任务下发异常, Outtpyes.ToJsonString());
|
|
|
|
|
SystemData.InsertWaringLog(dbContext, WaringType.提升机任务下发异常, warningMsg);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|