|
|
|
@ -7,6 +7,7 @@ using SlnMesnac.Model.dto.webapi;
|
|
|
|
using SlnMesnac.Plc;
|
|
|
|
using SlnMesnac.Plc;
|
|
|
|
using SlnMesnac.Serilog;
|
|
|
|
using SlnMesnac.Serilog;
|
|
|
|
using SlnMesnac.WCS.Global;
|
|
|
|
using SlnMesnac.WCS.Global;
|
|
|
|
|
|
|
|
using SlnMesnac.WCS.Library;
|
|
|
|
using SqlSugar;
|
|
|
|
using SqlSugar;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
@ -609,6 +610,10 @@ namespace SlnMesnac.WCS.WCS
|
|
|
|
workShop2Plc.writeBoolByAddress(StaticData.GetPlcAddress("2#缓存空进AGV任务反馈"), false);
|
|
|
|
workShop2Plc.writeBoolByAddress(StaticData.GetPlcAddress("2#缓存空进AGV任务反馈"), false);
|
|
|
|
workShop2Plc.writeBoolByAddress(StaticData.GetPlcAddress("2#出接驳位信号"), false);
|
|
|
|
workShop2Plc.writeBoolByAddress(StaticData.GetPlcAddress("2#出接驳位信号"), false);
|
|
|
|
workShop2Plc.writeBoolByAddress(StaticData.GetPlcAddress("2#出一个空托盘信号"), false);
|
|
|
|
workShop2Plc.writeBoolByAddress(StaticData.GetPlcAddress("2#出一个空托盘信号"), false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//判断二次生成补空箱任务
|
|
|
|
|
|
|
|
Thread.Sleep(500);
|
|
|
|
|
|
|
|
CreateSecondSuppleSmallPallet();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -1232,6 +1237,57 @@ namespace SlnMesnac.WCS.WCS
|
|
|
|
|
|
|
|
|
|
|
|
#endregion 任务状态流转处理逻辑
|
|
|
|
#endregion 任务状态流转处理逻辑
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 在从2#接驳位补托盘退出1s以后,判断如果3#库存为0,并且补小托盘任务数只有1个,总的agv任务书小于3个,并且2#线体空闲并且库存大于0,
|
|
|
|
|
|
|
|
/// 那么再次生成从2#接驳位补充空托盘任务,同时锁住2#线体
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
private void CreateSecondSuppleSmallPallet()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (workShop3Plc == null || !workShop3Plc.IsConnected || workShop2Plc == null || !workShop2Plc.IsConnected)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int work3EmptyAmount = workShop3Plc.readInt16ByAddress(StaticData.GetPlcAddress("3#缓存皮带线库存数"));
|
|
|
|
|
|
|
|
int suppleTaskCount = sqlSugarClient.Queryable<WcsTask>().Where(x => x.TaskType == StaticTaskType.SupplySmallPalletFromTonerTask || x.TaskType == StaticTaskType.SupplySmallPalletTask).Count();
|
|
|
|
|
|
|
|
int totalTaskCount = sqlSugarClient.Queryable<WcsTask>().Count();
|
|
|
|
|
|
|
|
int work2EmptyAmount = workShop2Plc.readInt16ByAddress(StaticData.GetPlcAddress("2#缓存链条线库存数"));
|
|
|
|
|
|
|
|
int work2BusyFlag = workShop2Plc.readInt16ByAddress(StaticData.GetPlcAddress("2#线体忙碌状态"));
|
|
|
|
|
|
|
|
if (work3EmptyAmount == 0 && totalTaskCount < 3 && suppleTaskCount == 1 && work2BusyFlag == 0 && work2EmptyAmount > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
WcsTask task = new WcsTask();
|
|
|
|
|
|
|
|
task.TaskType = StaticTaskType.SupplySmallPalletTask;
|
|
|
|
|
|
|
|
task.CurrPointNo = "2DeliverMetrologyRoomPoint";
|
|
|
|
|
|
|
|
task.EndPointNo = "3DeliverSmallGoodsPoint";
|
|
|
|
|
|
|
|
task.TaskStatus = 0;
|
|
|
|
|
|
|
|
task.CreatedTime = DateTime.Now;
|
|
|
|
|
|
|
|
task.CreatedBy = "wcs";
|
|
|
|
|
|
|
|
task.TaskName = " 3#车间从2#接驳位补充小托盘任务";
|
|
|
|
|
|
|
|
sqlSugarClient.AsTenant().BeginTran();
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int id = sqlSugarClient.Insertable(task).ExecuteReturnIdentity();
|
|
|
|
|
|
|
|
WcsTaskLog wcsTaskLog = CoreMapper.Map<WcsTaskLog>(task);
|
|
|
|
|
|
|
|
wcsTaskLog.Id = id;
|
|
|
|
|
|
|
|
sqlSugarClient.Insertable(wcsTaskLog).ExecuteCommand();
|
|
|
|
|
|
|
|
sqlSugarClient.AsTenant().CommitTran();
|
|
|
|
|
|
|
|
workShop2Plc.writeInt16ByAddress(StaticData.GetPlcAddress("2#线体忙碌状态"), 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
sqlSugarClient.AsTenant().RollbackTran();
|
|
|
|
|
|
|
|
_logger.Error($"3#车间从2#接驳位补充小托盘任务生成提交事务异常{ex.Message}");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
_logger.Agv($"生成{task.TaskName},起点:{task.CurrPointNo},终点:{task.EndPointNo}");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.Error($"CreateSecondSuppleSmallPallet:{ex.Message}");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region 弃用逻辑
|
|
|
|
#region 弃用逻辑
|
|
|
|
|
|
|
|
|
|
|
|
///// <summary>
|
|
|
|
///// <summary>
|
|
|
|
|