|
|
@ -99,17 +99,17 @@ namespace Aucma.Scada.Business
|
|
|
|
grabImage.RefreshLogMessageEvent += PrintLogInfoMessage;
|
|
|
|
grabImage.RefreshLogMessageEvent += PrintLogInfoMessage;
|
|
|
|
StartPassDown();
|
|
|
|
StartPassDown();
|
|
|
|
|
|
|
|
|
|
|
|
//Task.Run(() =>
|
|
|
|
Task.Run(() =>
|
|
|
|
//{
|
|
|
|
{
|
|
|
|
// Thread.Sleep(6000);
|
|
|
|
Thread.Sleep(6000);
|
|
|
|
// for (int i = 1; i < 2; i++)
|
|
|
|
for (int i = 1; i < 12; i++)
|
|
|
|
// {
|
|
|
|
{
|
|
|
|
// //InStore(appConfig.shellStoreCode, "B2360000078110300" + i.ToString().PadLeft(2, '0'));
|
|
|
|
//InStore(appConfig.shellStoreCode, "B2360000078110600" + i.ToString().PadLeft(2, '0'));
|
|
|
|
// //Thread.Sleep(1000);
|
|
|
|
//Thread.Sleep(1000*60*1);
|
|
|
|
// //InStore(appConfig.linerStoreCode, "L2360000078810240" + i.ToString().PadLeft(2, '0'));
|
|
|
|
//InStore(appConfig.linerStoreCode, "L2360000078110600" + i.ToString().PadLeft(2, '0'));
|
|
|
|
// //Thread.Sleep(1000);
|
|
|
|
//Thread.Sleep(1000 * 60 * 1);
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
//});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -131,6 +131,7 @@ namespace Aucma.Scada.Business
|
|
|
|
if (spaceInfo != null)
|
|
|
|
if (spaceInfo != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PrintLogInfoMessage($"匹配货道:{spaceInfo.spaceName}");
|
|
|
|
PrintLogInfoMessage($"匹配货道:{spaceInfo.spaceName}");
|
|
|
|
|
|
|
|
spaceInfo.materialType = materialType;
|
|
|
|
RefreshScanMateriaCodeEvent?.Invoke(materialCode, GetMaterialName(materialType), spaceInfo.spaceName, storeCode); //刷新界面扫码信息
|
|
|
|
RefreshScanMateriaCodeEvent?.Invoke(materialCode, GetMaterialName(materialType), spaceInfo.spaceName, storeCode); //刷新界面扫码信息
|
|
|
|
var result = CreateInStoreTask(spaceInfo, materialCode); //创建入库任务
|
|
|
|
var result = CreateInStoreTask(spaceInfo, materialCode); //创建入库任务
|
|
|
|
if (result)
|
|
|
|
if (result)
|
|
|
@ -241,15 +242,7 @@ namespace Aucma.Scada.Business
|
|
|
|
|
|
|
|
|
|
|
|
RefreshInStoreTaskEvent?.Invoke(taskInfo);
|
|
|
|
RefreshInStoreTaskEvent?.Invoke(taskInfo);
|
|
|
|
|
|
|
|
|
|
|
|
//if (shellSemaphore.Wait(TimeSpan.FromSeconds(20)))
|
|
|
|
taskHandle.WritePlc(taskInfo.storeCode, taskInfo.spaceCode, false);
|
|
|
|
//{
|
|
|
|
|
|
|
|
// // 收到反馈
|
|
|
|
|
|
|
|
// PrintLogInfoMessage("收到反馈,继续执行");
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
//else
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// PrintLogInfoMessage("超时未反馈");
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
shellSemaphore.Wait(); //一直堵塞直到信号量释放
|
|
|
|
shellSemaphore.Wait(); //一直堵塞直到信号量释放
|
|
|
|
|
|
|
|
|
|
|
@ -289,15 +282,7 @@ namespace Aucma.Scada.Business
|
|
|
|
|
|
|
|
|
|
|
|
RefreshInStoreTaskEvent?.Invoke(taskInfo);
|
|
|
|
RefreshInStoreTaskEvent?.Invoke(taskInfo);
|
|
|
|
|
|
|
|
|
|
|
|
//if (shellSemaphore.Wait(TimeSpan.FromSeconds(20)))
|
|
|
|
taskHandle.WritePlc(taskInfo.storeCode, taskInfo.spaceCode, false);
|
|
|
|
//{
|
|
|
|
|
|
|
|
// // 收到反馈
|
|
|
|
|
|
|
|
// PrintLogInfoMessage("收到反馈,继续执行");
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
//else
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// PrintLogInfoMessage("超时未反馈");
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
linerSemaphore.Wait(); //一直堵塞直到信号量释放
|
|
|
|
linerSemaphore.Wait(); //一直堵塞直到信号量释放
|
|
|
|
|
|
|
|
|
|
|
@ -340,6 +325,11 @@ namespace Aucma.Scada.Business
|
|
|
|
return taskInfo;
|
|
|
|
return taskInfo;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 任务反馈(入库完成)
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="storeCode"></param>
|
|
|
|
|
|
|
|
/// <param name="taskCode"></param>
|
|
|
|
private void TaskFeedback(string storeCode,string taskCode)
|
|
|
|
private void TaskFeedback(string storeCode,string taskCode)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(storeCode == appConfig.shellStoreCode)
|
|
|
|
if(storeCode == appConfig.shellStoreCode)
|
|
|
@ -397,9 +387,8 @@ namespace Aucma.Scada.Business
|
|
|
|
|
|
|
|
|
|
|
|
if (spaceInfo != null)
|
|
|
|
if (spaceInfo != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
taskHandle.WritePlc(spaceInfo.storeCode, spaceInfo.spaceCode, true);
|
|
|
|
|
|
|
|
//spaceInfo.materialType = taskInfo.materialType;
|
|
|
|
spaceInfo.materialType = taskInfo.materialType;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
spaceInfo.spaceStock = spaceInfo.spaceStock + 1;
|
|
|
|
spaceInfo.spaceStock = spaceInfo.spaceStock + 1;
|
|
|
|
spaceInfo.onRouteAmount -= 1;
|
|
|
|
spaceInfo.onRouteAmount -= 1;
|
|
|
@ -425,7 +414,7 @@ namespace Aucma.Scada.Business
|
|
|
|
_baseSpaceDetailService.InsertSpaceDetail(spaceDetail);
|
|
|
|
_baseSpaceDetailService.InsertSpaceDetail(spaceDetail);
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 添加入库任务
|
|
|
|
#region 添加入库记录
|
|
|
|
RecordInstore recordInstore = new RecordInstore();
|
|
|
|
RecordInstore recordInstore = new RecordInstore();
|
|
|
|
recordInstore.storeCode = taskInfo.storeCode;
|
|
|
|
recordInstore.storeCode = taskInfo.storeCode;
|
|
|
|
recordInstore.spaceCode = taskInfo.spaceCode;
|
|
|
|
recordInstore.spaceCode = taskInfo.spaceCode;
|
|
|
@ -536,15 +525,14 @@ namespace Aucma.Scada.Business
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (info.Count > 0)
|
|
|
|
if (info.Count > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
foreach (BaseSpaceInfo item in info)
|
|
|
|
result = GetSpaceInfosByPlc(info);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(result == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var spaceInfo = taskHandle.ReadSpaceInfoByPlc(item);
|
|
|
|
var list = _spaceInfoService.GetEmptySpaceInfo(storeCode);
|
|
|
|
item.spaceStock = spaceInfo.spaceStock;
|
|
|
|
|
|
|
|
item.onRouteAmount = spaceInfo.onRouteAmount;
|
|
|
|
|
|
|
|
item.spaceStatus = spaceInfo.spaceStatus;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result = info.Where(x=>x.spaceStatus == 1 && x.spaceStock > 0 ? x.spaceCapacity > (x.spaceStock + x.onRouteAmount) : 1 == 1).OrderByDescending(x => x.spaceStock).OrderBy(x=>x.spaceCode).First();
|
|
|
|
result = GetSpaceInfosByPlc(list);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -555,5 +543,40 @@ namespace Aucma.Scada.Business
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 读取PLC货道信息
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="info"></param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
private BaseSpaceInfo GetSpaceInfosByPlc(List<BaseSpaceInfo> info)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
BaseSpaceInfo result = null;
|
|
|
|
|
|
|
|
if (info != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (info.Count > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
foreach (BaseSpaceInfo item in info)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var spaceInfo = taskHandle.ReadSpaceInfoByPlc(item);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
item.spaceStock = spaceInfo.spaceStock;
|
|
|
|
|
|
|
|
item.onRouteAmount = spaceInfo.onRouteAmount;
|
|
|
|
|
|
|
|
item.spaceStatus = spaceInfo.spaceStatus;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PrintLogInfoMessage($"通过PLC读取货道信息,货道:{spaceInfo.spaceName};在库数量:{item.spaceStock};在途数量:{item.onRouteAmount};货道状态:{item.spaceStatus}");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var list = info.Where(x => x.spaceStock > 0 ? x.spaceCapacity > (x.spaceStock + x.onRouteAmount) : 1 == 1 && x.spaceStatus == 1).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(list.Count > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
result = list.OrderByDescending(x => x.spaceStock).OrderBy(x => x.spaceCode).First();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|