|
|
|
@ -19,6 +19,8 @@ using Admin.Core.Model.Model_New;
|
|
|
|
|
using static ICSharpCode.SharpZipLib.Zip.ExtendedUnixData;
|
|
|
|
|
using Microsoft.IdentityModel.Logging;
|
|
|
|
|
using Admin.Core.Socket;
|
|
|
|
|
using Admin.Core.Service;
|
|
|
|
|
using TouchSocket.Core;
|
|
|
|
|
|
|
|
|
|
namespace Aucma.Core.BoxFoam.Business
|
|
|
|
|
{
|
|
|
|
@ -218,6 +220,7 @@ namespace Aucma.Core.BoxFoam.Business
|
|
|
|
|
{
|
|
|
|
|
flag = false;
|
|
|
|
|
var obj = PlcHelper.siemensList.FirstOrDefault(d => d.EquipName.Equals("PqPlc"));
|
|
|
|
|
var foamLine1 = PlcHelper.siemensList.FirstOrDefault(d => d.EquipName.Equals("foamLine1Plc"));//发泡线1
|
|
|
|
|
if (obj != null)
|
|
|
|
|
{
|
|
|
|
|
if (obj.plc.IsConnected)
|
|
|
|
@ -230,26 +233,119 @@ namespace Aucma.Core.BoxFoam.Business
|
|
|
|
|
case "PB01_001":
|
|
|
|
|
item.SpaceStock= obj.plc.ReadInt16("DB200.440");
|
|
|
|
|
item.OnRouteAmount = item.SpaceStock-obj.plc.ReadInt16("DB200.88");
|
|
|
|
|
if (foamLine1 != null)
|
|
|
|
|
{
|
|
|
|
|
if (foamLine1.plc.IsConnected)
|
|
|
|
|
{
|
|
|
|
|
item.MaterialType = obj.plc.ReadString("DB400.16.0");
|
|
|
|
|
if (!string.IsNullOrEmpty(item.MaterialType))
|
|
|
|
|
{
|
|
|
|
|
var printBarCode001 = _printBarCodeServices.FirstAsync(d => d.MaterialCode == item.MaterialType).Result;
|
|
|
|
|
if (printBarCode001 != null)
|
|
|
|
|
{
|
|
|
|
|
item.typeNameA = printBarCode001.MaterialName;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case "PB01_002":
|
|
|
|
|
item.SpaceStock = obj.plc.ReadInt16("DB200.442");
|
|
|
|
|
item.OnRouteAmount = item.SpaceStock - obj.plc.ReadInt16("DB200.90");
|
|
|
|
|
|
|
|
|
|
if (foamLine1 != null)
|
|
|
|
|
{
|
|
|
|
|
if (foamLine1.plc.IsConnected)
|
|
|
|
|
{
|
|
|
|
|
item.MaterialType = obj.plc.ReadString("DB400.28.0");
|
|
|
|
|
if (!string.IsNullOrEmpty(item.MaterialType))
|
|
|
|
|
{
|
|
|
|
|
var printBarCode002 = _printBarCodeServices.FirstAsync(d => d.MaterialCode == item.MaterialType).Result;
|
|
|
|
|
if (printBarCode002 != null)
|
|
|
|
|
{
|
|
|
|
|
item.typeNameA = printBarCode002.MaterialName;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case "PB01_003":
|
|
|
|
|
item.SpaceStock = obj.plc.ReadInt16("DB200.444");
|
|
|
|
|
item.OnRouteAmount = item.SpaceStock - obj.plc.ReadInt16("DB200.92");
|
|
|
|
|
|
|
|
|
|
if (foamLine1 != null)
|
|
|
|
|
{
|
|
|
|
|
if (foamLine1.plc.IsConnected)
|
|
|
|
|
{
|
|
|
|
|
item.MaterialType = obj.plc.ReadString("DB400.40.0");
|
|
|
|
|
if (!string.IsNullOrEmpty(item.MaterialType))
|
|
|
|
|
{
|
|
|
|
|
var printBarCode003 = _printBarCodeServices.FirstAsync(d => d.MaterialCode == item.MaterialType).Result;
|
|
|
|
|
if (printBarCode003 != null)
|
|
|
|
|
{
|
|
|
|
|
item.typeNameA = printBarCode003.MaterialName;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case "PB01_004":
|
|
|
|
|
item.SpaceStock = obj.plc.ReadInt16("DB200.446");
|
|
|
|
|
item.OnRouteAmount = item.SpaceStock - obj.plc.ReadInt16("DB200.94");
|
|
|
|
|
if (foamLine1 != null)
|
|
|
|
|
{
|
|
|
|
|
if (foamLine1.plc.IsConnected)
|
|
|
|
|
{
|
|
|
|
|
item.MaterialType = obj.plc.ReadString("DB400.28.0");
|
|
|
|
|
if (!string.IsNullOrEmpty(item.MaterialType))
|
|
|
|
|
{
|
|
|
|
|
var printBarCode004 = _printBarCodeServices.FirstAsync(d => d.MaterialCode == item.MaterialType).Result;
|
|
|
|
|
if (printBarCode004 != null)
|
|
|
|
|
{
|
|
|
|
|
item.typeNameA = printBarCode004.MaterialName;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case "PB01_005":
|
|
|
|
|
item.SpaceStock = obj.plc.ReadInt16("DB200.448");
|
|
|
|
|
item.OnRouteAmount = item.SpaceStock - obj.plc.ReadInt16("DB200.96");
|
|
|
|
|
if (foamLine1 != null)
|
|
|
|
|
{
|
|
|
|
|
if (foamLine1.plc.IsConnected)
|
|
|
|
|
{
|
|
|
|
|
item.MaterialType = obj.plc.ReadString("DB400.52.0");
|
|
|
|
|
if (!string.IsNullOrEmpty(item.MaterialType))
|
|
|
|
|
{
|
|
|
|
|
var printBarCode005 = _printBarCodeServices.FirstAsync(d => d.MaterialCode == item.MaterialType).Result;
|
|
|
|
|
if (printBarCode005 != null)
|
|
|
|
|
{
|
|
|
|
|
item.typeNameA = printBarCode005.MaterialName;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case "PB01_006":
|
|
|
|
|
item.SpaceStock = obj.plc.ReadInt16("DB200.450");
|
|
|
|
|
item.OnRouteAmount = item.SpaceStock - obj.plc.ReadInt16("DB200.98");
|
|
|
|
|
item.MaterialType = obj.plc.ReadString("DB400.64.0");
|
|
|
|
|
if (foamLine1 != null)
|
|
|
|
|
{
|
|
|
|
|
if (foamLine1.plc.IsConnected)
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(item.MaterialType))
|
|
|
|
|
{
|
|
|
|
|
var printBarCode006 = _printBarCodeServices.FirstAsync(d => d.MaterialCode == item.MaterialType).Result;
|
|
|
|
|
if (printBarCode006 != null)
|
|
|
|
|
{
|
|
|
|
|
item.typeNameA = printBarCode006.MaterialName;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
@ -264,11 +360,11 @@ namespace Aucma.Core.BoxFoam.Business
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Thread.Sleep(1000);
|
|
|
|
|
Thread.Sleep(3000);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine($"异常:{ex.Message}");
|
|
|
|
|
Console.WriteLine($"更新泡前库库库存,类型异常:{ex.Message}");
|
|
|
|
|
}
|
|
|
|
|
finally { flag = true; }
|
|
|
|
|
}
|
|
|
|
|