|
|
|
@ -17,6 +17,7 @@ using static Npgsql.Replication.PgOutput.Messages.RelationMessage;
|
|
|
|
|
using Aucma.Core.PLc;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Consul;
|
|
|
|
|
using NetTaste;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* 成品分舵入库首页信息
|
|
|
|
@ -209,7 +210,7 @@ namespace Aucma.Core.ProductOffLine.ViewModels
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="code"></param>
|
|
|
|
|
/// <param name="direction">扫码器方向,1左边分A库,2右边分B库</param>
|
|
|
|
|
private void ReceiveCode(string code,int direction)
|
|
|
|
|
private void ReceiveCode(string code, int scannerNo)
|
|
|
|
|
{
|
|
|
|
|
//1.扫描的SN条码去条码系统查询GET_BARCODE_DATA
|
|
|
|
|
|
|
|
|
@ -237,19 +238,19 @@ namespace Aucma.Core.ProductOffLine.ViewModels
|
|
|
|
|
//5.分垛A,B库逻辑(先左边读到的条码分A库,右边读到的B库==>预留分库逻辑)
|
|
|
|
|
|
|
|
|
|
//6.下发plc信号
|
|
|
|
|
SendPlcPass(direction);
|
|
|
|
|
SendPlcPass(scannerNo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region plc交互
|
|
|
|
|
|
|
|
|
|
private SemaphoreSlim semaphore = new SemaphoreSlim(0);
|
|
|
|
|
// private SemaphoreSlim semaphore = new SemaphoreSlim(0);
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 下发plc放行信号
|
|
|
|
|
/// 下发plc放行信号,根据接收到的scannerNo不同,两条道的plc信号地址也不同
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="materialType"></param>
|
|
|
|
|
private bool SendPlcPass(int direction)
|
|
|
|
|
private bool SendPlcPass(int scannerNo)
|
|
|
|
|
{
|
|
|
|
|
bool result = false;
|
|
|
|
|
try
|
|
|
|
@ -259,13 +260,13 @@ namespace Aucma.Core.ProductOffLine.ViewModels
|
|
|
|
|
{
|
|
|
|
|
if (obj.plc.IsConnected)
|
|
|
|
|
{
|
|
|
|
|
// 写入入库方向
|
|
|
|
|
obj.plc.WriteInt32("D100", direction);
|
|
|
|
|
// 写入入库方向,两条道plc地址不同
|
|
|
|
|
obj.plc.WriteInt32("D100", scannerNo);
|
|
|
|
|
// 往plc写入放行信号
|
|
|
|
|
obj.plc.WriteInt32("D102", 1);
|
|
|
|
|
// 等待plc反馈信号
|
|
|
|
|
waitPlcSignal();
|
|
|
|
|
semaphore.Wait();
|
|
|
|
|
// semaphore.Wait();
|
|
|
|
|
result = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -316,7 +317,7 @@ namespace Aucma.Core.ProductOffLine.ViewModels
|
|
|
|
|
Thread.Sleep(1000);
|
|
|
|
|
} while (isFlag);
|
|
|
|
|
// 释放信号量
|
|
|
|
|
semaphore.Release();
|
|
|
|
|
// semaphore.Release();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|