change - PLC地址配置

master
wenjy 2 years ago
parent 23eccaaf61
commit 1a3078f68b

@ -95,13 +95,13 @@ namespace MaterialTraceability.Business.Impl
//判断放卷生产轴
if (appConfig.machineId == 3)
{
if (PlcBusiness.readPlc("MW24816") == 1) upPosition = 6;
if (PlcBusiness.readPlc("MW24818") == 1) upPosition = 5;
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) upPosition = 6;
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) upPosition = 5;
}
else
{
if (PlcBusiness.readPlc("MW24816") == 1) upPosition = 5;
if (PlcBusiness.readPlc("MW24818") == 1) upPosition = 6;
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) upPosition = 5;
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) upPosition = 6;
}
LogHelper.Info("当前放卷生产轴为:" + Which(upPosition));
ProShaftInfo shaftInfo = this.GetShaftInfoByPosition(upPosition).Result;
@ -125,17 +125,17 @@ namespace MaterialTraceability.Business.Impl
//判断收卷生产轴
if (appConfig.machineId == 3)
{
if (PlcBusiness.readPlc("MW24676") == 1) positions.Add(3);
if (PlcBusiness.readPlc("MW24678") == 1) positions.Add(1);
if (PlcBusiness.readPlc("MW24680") == 1) positions.Add(4);
if (PlcBusiness.readPlc("MW24682") == 1) positions.Add(2);
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) positions.Add(3);
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) positions.Add(1);
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) positions.Add(4);
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) positions.Add(2);
}
else
{
if (PlcBusiness.readPlc("MW24676") == 1) positions.Add(1);
if (PlcBusiness.readPlc("MW24678") == 1) positions.Add(3);
if (PlcBusiness.readPlc("MW24680") == 1) positions.Add(2);
if (PlcBusiness.readPlc("MW24682") == 1) positions.Add(4);
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) positions.Add(1);
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) positions.Add(3);
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) positions.Add(2);
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) positions.Add(4);
}
if (positions.Count == 0)
@ -155,7 +155,7 @@ namespace MaterialTraceability.Business.Impl
if (info)
{
LogHelper.Info("触发合卷报警下发PLC报警指令写入2");
plcBusiness.writeDoublePlc("MW24624", 2);
plcBusiness.writeDoublePlc(appConfig.mqAddress., 2);
return;
}
@ -529,17 +529,17 @@ namespace MaterialTraceability.Business.Impl
//EA新地址 Add by wenjy 2022-11-10
if (appConfig.machineId == 3)
{
if (position == 3) qty = PlcBusiness.readPlc("MW25928");
if (position == 1) qty = PlcBusiness.readPlc("MW25930");
if (position == 4) qty = PlcBusiness.readPlc("MW25932");
if (position == 2) qty = PlcBusiness.readPlc("MW25934");
if (position == 3) qty = PlcBusiness.readPlc(appConfig.mqAddress.EA);
if (position == 1) qty = PlcBusiness.readPlc(appConfig.mqAddress.EA);
if (position == 4) qty = PlcBusiness.readPlc(appConfig.mqAddress.EA);
if (position == 2) qty = PlcBusiness.readPlc(appConfig.mqAddress.EA);
}
else
{
if (position == 1) qty = PlcBusiness.readPlc("MW25928");
if (position == 3) qty = PlcBusiness.readPlc("MW25930");
if (position == 2) qty = PlcBusiness.readPlc("MW25932");
if (position == 4) qty = PlcBusiness.readPlc("MW25934");
if (position == 1) qty = PlcBusiness.readPlc(appConfig.mqAddress.EA);
if (position == 3) qty = PlcBusiness.readPlc(appConfig.mqAddress.EA);
if (position == 2) qty = PlcBusiness.readPlc(appConfig.mqAddress.EA);
if (position == 4) qty = PlcBusiness.readPlc(appConfig.mqAddress.EA);
}
LogRefreshEvent.Invoke(LogType.PlcLog, String.Format("{0}轴读取设备EA值{1}", logStr, qty));
@ -554,7 +554,7 @@ namespace MaterialTraceability.Business.Impl
LogHelper.Info(logStr + "获取设备EA为" + qty + "绑定信息为:" + shaftInfo.bindEaValue + ",不进行完工处理");
//upLoadBusiness.SaveLogRecord(position, logStr + "获取设备EA为" + qty + "绑定信息为:" + shaftInfo.bindEaValue + ",不进行完工处理");
AllowBlank(position);
plcBusiness.writeDoublePlc("MW24624", 0);//清除合卷报警
plcBusiness.writeDoublePlc(appConfig.mqAddress., 0);//清除合卷报警
//清空卷轴绑定的物料信息
shaftInfo.bindRfid = "";
@ -794,8 +794,7 @@ namespace MaterialTraceability.Business.Impl
});
LogHelper.Info(logStr + "下料成功解除合卷报警限制MW24624写0");
//upLoadBusiness.SaveLogRecord(position, logStr + "下料成功解除合卷报警限制MW24624写0");
plcBusiness.writeDoublePlc("MW24624", 0);
plcBusiness.writeDoublePlc(appConfig.mqAddress., 0);
//更新下料记录
//downRecord.DownMaterialId = shaftInfo.bindRfid;
@ -1628,66 +1627,66 @@ namespace MaterialTraceability.Business.Impl
{
if (position == 1)
{
plcBusiness.writePlc("MW24652", result);
plcBusiness.writePlc("MW24656", alarm);
plcBusiness.writePlc(appConfig.mqAddress., result);
plcBusiness.writePlc(appConfig.mqAddress., alarm);
}
if (position == 2)
{
plcBusiness.writePlc("MW24668", result);
plcBusiness.writePlc("MW24672", alarm);
plcBusiness.writePlc(appConfig.mqAddress., result);
plcBusiness.writePlc(appConfig.mqAddress., alarm);
}
if (position == 3)
{
plcBusiness.writePlc("MW24644", result);
plcBusiness.writePlc("MW24648", alarm);
plcBusiness.writePlc(appConfig.mqAddress., result);
plcBusiness.writePlc(appConfig.mqAddress., alarm);
}
if (position == 4)
{
plcBusiness.writePlc("MW24660", result);
plcBusiness.writePlc("MW24664", alarm);
plcBusiness.writePlc(appConfig.mqAddress., result);
plcBusiness.writePlc(appConfig.mqAddress., alarm);
}
if (position == 5)
{
plcBusiness.writePlc("MW24636", result); //RFID扫描结果
plcBusiness.writePlc("MW24640", alarm); //RFID报警信息
plcBusiness.writePlc(appConfig.mqAddress., result); //RFID扫描结果
plcBusiness.writePlc(appConfig.mqAddress., alarm); //RFID报警信息
}
if (position == 6)
{
plcBusiness.writePlc("MW24628", result);
plcBusiness.writePlc("MW24632", alarm);
plcBusiness.writePlc(appConfig.mqAddress., result);
plcBusiness.writePlc(appConfig.mqAddress., alarm);
}
}
else
{
if (position == 3)
{
plcBusiness.writePlc("MW24652", result);
plcBusiness.writePlc("MW24656", alarm);
plcBusiness.writePlc(appConfig.mqAddress., result);
plcBusiness.writePlc(appConfig.mqAddress., alarm);
}
if (position == 4)
{
plcBusiness.writePlc("MW24668", result);
plcBusiness.writePlc("MW24672", alarm);
plcBusiness.writePlc(appConfig.mqAddress., result);
plcBusiness.writePlc(appConfig.mqAddress., alarm);
}
if (position == 1)
{
plcBusiness.writePlc("MW24644", result);
plcBusiness.writePlc("MW24648", alarm);
plcBusiness.writePlc(appConfig.mqAddress., result);
plcBusiness.writePlc(appConfig.mqAddress., alarm);
}
if (position == 2)
{
plcBusiness.writePlc("MW24660", result);
plcBusiness.writePlc("MW24664", alarm);
plcBusiness.writePlc(appConfig.mqAddress., result);
plcBusiness.writePlc(appConfig.mqAddress., alarm);
}
if (position == 5)
{
plcBusiness.writePlc("MW24628", result);
plcBusiness.writePlc("MW24632", alarm); //RFID报警信息
plcBusiness.writePlc(appConfig.mqAddress., result);
plcBusiness.writePlc(appConfig.mqAddress., alarm); //RFID报警信息
}
if (position == 6)
{
plcBusiness.writePlc("MW24636", result); //RFID扫描结果
plcBusiness.writePlc("MW24640", alarm);
plcBusiness.writePlc(appConfig.mqAddress., result); //RFID扫描结果
plcBusiness.writePlc(appConfig.mqAddress., alarm);
}
}
}
@ -1703,54 +1702,54 @@ namespace MaterialTraceability.Business.Impl
{
if (position == 1)
{
plcBusiness.writePlc("MW24652", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
}
if (position == 2)
{
plcBusiness.writePlc("MW24668", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
}
if (position == 3)
{
plcBusiness.writePlc("MW24644", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
}
if (position == 4)
{
plcBusiness.writePlc("MW24660", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
}
if (position == 5)
{
plcBusiness.writePlc("MW24636", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
}
if (position == 6)
{
plcBusiness.writePlc("MW24628", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
}
}
else
{
if (position == 3)
{
plcBusiness.writePlc("MW24652", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
}
if (position == 4)
{
plcBusiness.writePlc("MW24668", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
}
if (position == 1)
{
plcBusiness.writePlc("MW24644", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
}
if (position == 2)
{
plcBusiness.writePlc("MW24660", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
}
if (position == 5)
{
plcBusiness.writePlc("MW24628", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
}
if (position == 6)
{
plcBusiness.writePlc("MW24636", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
}
}
@ -1765,33 +1764,33 @@ namespace MaterialTraceability.Business.Impl
if (appConfig.machineId==3)
{
if (position == 1)
plcBusiness.writePlc("MW24826", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
if (position == 2)
plcBusiness.writePlc("MW24830", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
if (position == 3)
plcBusiness.writePlc("MW24824", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
if (position == 4)
plcBusiness.writePlc("MW24828", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
if (position == 5)
plcBusiness.writePlc("MW24822", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
if (position == 6)
plcBusiness.writePlc("MW24820", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
}
else
{
if (position == 1)
plcBusiness.writePlc("MW24824", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
if (position == 2)
plcBusiness.writePlc("MW24828", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
if (position == 3)
plcBusiness.writePlc("MW24826", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
if (position == 4)
plcBusiness.writePlc("MW24830", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
if (position == 5)
plcBusiness.writePlc("MW24820", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
if (position == 6)
plcBusiness.writePlc("MW24822", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
}
}
@ -1805,33 +1804,33 @@ namespace MaterialTraceability.Business.Impl
{
if (position == 3)
plcBusiness.writePlc("MW24824", 0);
plcBusiness.writePlc(appConfig.mqAddress., 0);
if (position == 1)
plcBusiness.writePlc("MW24826", 0);
plcBusiness.writePlc(appConfig.mqAddress., 0);
if (position == 4)
plcBusiness.writePlc("MW24828", 0);
plcBusiness.writePlc(appConfig.mqAddress., 0);
if (position == 2)
plcBusiness.writePlc("MW24830", 0);
plcBusiness.writePlc(appConfig.mqAddress., 0);
if (position == 5)
plcBusiness.writePlc("MW24822", 0);
plcBusiness.writePlc(appConfig.mqAddress., 0);
if (position == 6)
plcBusiness.writePlc("MW24820", 0);
plcBusiness.writePlc(appConfig.mqAddress., 0);
}
else
{
if (position == 1)
plcBusiness.writePlc("MW24824", 0);
plcBusiness.writePlc(appConfig.mqAddress., 0);
if (position == 3)
plcBusiness.writePlc("MW24826", 0);
plcBusiness.writePlc(appConfig.mqAddress., 0);
if (position == 2)
plcBusiness.writePlc("MW24828", 0);
plcBusiness.writePlc(appConfig.mqAddress., 0);
if (position == 4)
plcBusiness.writePlc("MW24830", 0);
plcBusiness.writePlc(appConfig.mqAddress., 0);
if (position == 5)
plcBusiness.writePlc("MW24820", 0);
plcBusiness.writePlc(appConfig.mqAddress., 0);
if (position == 6)
plcBusiness.writePlc("MW24822", 0);
plcBusiness.writePlc(appConfig.mqAddress., 0);
}
}
@ -1876,32 +1875,32 @@ namespace MaterialTraceability.Business.Impl
if (appConfig.machineId==3)
{
if (position == 3)
PLCaddress = "MW24848";
PLCaddress = appConfig.mqAddress.SFC;
if (position == 1)
PLCaddress = "MW24850";
PLCaddress = appConfig.mqAddress.SFC;
if (position == 4)
PLCaddress = "MW24852";
PLCaddress = appConfig.mqAddress.SFC;
if (position == 2)
PLCaddress = "MW24854";
PLCaddress = appConfig.mqAddress.SFC;
if (position == 5)
PLCaddress = "MW24846";
PLCaddress = appConfig.mqAddress.SFC;
if (position == 6)
PLCaddress = "MW248544";
PLCaddress = appConfig.mqAddress.SFC;
}
else
{
if (position == 1)
PLCaddress = "MW24848";
PLCaddress = appConfig.mqAddress.SFC;
if (position == 3)
PLCaddress = "MW24850";
PLCaddress = appConfig.mqAddress.SFC;
if (position == 2)
PLCaddress = "MW24852";
PLCaddress = appConfig.mqAddress.SFC;
if (position == 4)
PLCaddress = "MW24854";
PLCaddress = appConfig.mqAddress.SFC;
if (position == 5)
PLCaddress = "MW248544";
PLCaddress = appConfig.mqAddress.SFC;
if (position == 6)
PLCaddress = "MW24846";
PLCaddress = appConfig.mqAddress.SFC;
}
LogHelper.Info(str + "向PLC地址" + PLCaddress + "写入SFC" + sfc);
PlcBusiness.writeStrPlc(PLCaddress, sfc);
@ -1911,17 +1910,17 @@ namespace MaterialTraceability.Business.Impl
{
if (appConfig.machineId==3)
{
if (position == 3) plcBusiness.writePlc("MW24648", alarmType);
if (position == 1) plcBusiness.writePlc("MW24656", alarmType);
if (position == 4) plcBusiness.writePlc("MW24664", alarmType);
if (position == 2) plcBusiness.writePlc("MW24672", alarmType);
if (position == 3) plcBusiness.writePlc(appConfig.mqAddress., alarmType);
if (position == 1) plcBusiness.writePlc(appConfig.mqAddress., alarmType);
if (position == 4) plcBusiness.writePlc(appConfig.mqAddress., alarmType);
if (position == 2) plcBusiness.writePlc(appConfig.mqAddress., alarmType);
}
else
{
if (position == 1) plcBusiness.writePlc("MW24648", alarmType);
if (position == 3) plcBusiness.writePlc("MW24656", alarmType);
if (position == 2) plcBusiness.writePlc("MW24664", alarmType);
if (position == 4) plcBusiness.writePlc("MW24672", alarmType);
if (position == 1) plcBusiness.writePlc(appConfig.mqAddress., alarmType);
if (position == 3) plcBusiness.writePlc(appConfig.mqAddress., alarmType);
if (position == 2) plcBusiness.writePlc(appConfig.mqAddress., alarmType);
if (position == 4) plcBusiness.writePlc(appConfig.mqAddress., alarmType);
}
}
@ -1933,32 +1932,32 @@ namespace MaterialTraceability.Business.Impl
if (appConfig.machineId==3)
{
if (position == 3)
plcBusiness.writePlc("MW24836", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
if (position == 1)
plcBusiness.writePlc("MW24838", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
if (position == 4)
plcBusiness.writePlc("MW24840", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
if (position == 2)
plcBusiness.writePlc("MW24842", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
if (position == 5)
plcBusiness.writePlc("MW24834", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
if (position == 6)
plcBusiness.writePlc("MW24832", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
}
else
{
if (position == 1)
plcBusiness.writePlc("MW24836", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
if (position == 3)
plcBusiness.writePlc("MW24838", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
if (position == 2)
plcBusiness.writePlc("MW24840", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
if (position == 4)
plcBusiness.writePlc("MW24842", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
if (position == 5)
plcBusiness.writePlc("MW24832", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
if (position == 6)
plcBusiness.writePlc("MW24834", 1);
plcBusiness.writePlc(appConfig.mqAddress., 1);
}
}
@ -2108,17 +2107,17 @@ namespace MaterialTraceability.Business.Impl
List<int> positions = new List<int>();
if (appConfig.machineId == 3)
{
if (PlcBusiness.readPlc("MW24676") == 1) positions.Add(3);
if (PlcBusiness.readPlc("MW24678") == 1) positions.Add(1);
if (PlcBusiness.readPlc("MW24680") == 1) positions.Add(4);
if (PlcBusiness.readPlc("MW24682") == 1) positions.Add(2);
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) positions.Add(3);
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) positions.Add(1);
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) positions.Add(4);
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) positions.Add(2);
}
else
{
if (PlcBusiness.readPlc("MW24676") == 1) positions.Add(1);
if (PlcBusiness.readPlc("MW24678") == 1) positions.Add(3);
if (PlcBusiness.readPlc("MW24680") == 1) positions.Add(2);
if (PlcBusiness.readPlc("MW24682") == 1) positions.Add(4);
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) positions.Add(1);
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) positions.Add(3);
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) positions.Add(2);
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) positions.Add(4);
}
foreach (int item in positions)
@ -2510,17 +2509,17 @@ namespace MaterialTraceability.Business.Impl
if (appConfig.machineId==3)
{
if (position == 1) treeTop = PlcBusiness.readStrPlc("MW44400", 60); //上右
if (position == 2) treeTop = PlcBusiness.readStrPlc("MW45200", 60); //下右
if (position == 3) treeTop = PlcBusiness.readStrPlc("MW44000", 60); //上左
if (position == 4) treeTop = PlcBusiness.readStrPlc("MW44800", 60); //下左
if (position == 1) treeTop = PlcBusiness.readStrPlc(appConfig.mqAddress., 60); //上右
if (position == 2) treeTop = PlcBusiness.readStrPlc(appConfig.mqAddress., 60); //下右
if (position == 3) treeTop = PlcBusiness.readStrPlc(appConfig.mqAddress., 60); //上左
if (position == 4) treeTop = PlcBusiness.readStrPlc(appConfig.mqAddress., 60); //下左
}
else
{
if (position == 3) treeTop = PlcBusiness.readStrPlc("MW44000", 60); //上左
if (position == 4) treeTop = PlcBusiness.readStrPlc("MW44800", 60); //下左
if (position == 1) treeTop = PlcBusiness.readStrPlc("MW44400", 60); //上右
if (position == 2) treeTop = PlcBusiness.readStrPlc("MW45200", 60); //下右
if (position == 3) treeTop = PlcBusiness.readStrPlc(appConfig.mqAddress., 60); //上左
if (position == 4) treeTop = PlcBusiness.readStrPlc(appConfig.mqAddress., 60); //下左
if (position == 1) treeTop = PlcBusiness.readStrPlc(appConfig.mqAddress., 60); //上右
if (position == 2) treeTop = PlcBusiness.readStrPlc(appConfig.mqAddress., 60); //下右
}
LogHelper.Info("通过PLC获取CCD打标数" + treeTop);
string[] array = treeTop.Replace("\0","").Trim().Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
@ -2676,17 +2675,17 @@ namespace MaterialTraceability.Business.Impl
int directions = 0;
if (position > 4)
{
directions = Convert.ToInt32(PlcBusiness.readBoolPlc("MW20000.0"));
directions = Convert.ToInt32(PlcBusiness.readBoolPlc(appConfig.mqAddress.));
}
else
{
if (position % 2 != 0) //上轴
{
directions = Convert.ToInt32(PlcBusiness.readBoolPlc("MW20001.0"));
directions = Convert.ToInt32(PlcBusiness.readBoolPlc(appConfig.mqAddress.));
}
else //下轴
{
directions = Convert.ToInt32(PlcBusiness.readBoolPlc("MW20001.1"));
directions = Convert.ToInt32(PlcBusiness.readBoolPlc(appConfig.mqAddress.));
}
}
//绑定信息存储运行方向
@ -2819,17 +2818,17 @@ namespace MaterialTraceability.Business.Impl
List<int> positions = new List<int>();
if (appConfig.machineId == 3)
{
if (PlcBusiness.readPlc("MW24676") == 1) positions.Add(3);
if (PlcBusiness.readPlc("MW24678") == 1) positions.Add(1);
if (PlcBusiness.readPlc("MW24680") == 1) positions.Add(4);
if (PlcBusiness.readPlc("MW24682") == 1) positions.Add(2);
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) positions.Add(3);
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) positions.Add(1);
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) positions.Add(4);
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) positions.Add(2);
}
else
{
if (PlcBusiness.readPlc("MW24676") == 1) positions.Add(1);
if (PlcBusiness.readPlc("MW24678") == 1) positions.Add(3);
if (PlcBusiness.readPlc("MW24680") == 1) positions.Add(2);
if (PlcBusiness.readPlc("MW24682") == 1) positions.Add(4);
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) positions.Add(1);
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) positions.Add(3);
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) positions.Add(2);
if (PlcBusiness.readPlc(appConfig.mqAddress.) == 1) positions.Add(4);
}
int position = positions.Max();

@ -291,7 +291,7 @@ namespace MaterialTraceability.Business
/// </summary>
public void MqSignalInit()
{
plcBusiness.writePlc("MW25678", 0);
plcBusiness.writePlc(appConfig.mqAddress., 0);
LogHelper.Info("模切程序初始化开机启动信号复位MW25678写0");
}

@ -204,17 +204,17 @@ namespace MaterialTraceability.Business
int directions = 0;
if (position > 4)
{
directions = Convert.ToInt32(PlcBusiness.readBoolPlc("MW20000.0"));
directions = Convert.ToInt32(PlcBusiness.readBoolPlc(appConfig.mqAddress.));
}
else
{
if (position % 2 != 0) //上轴
{
directions = Convert.ToInt32(PlcBusiness.readBoolPlc("MW20001.0"));
directions = Convert.ToInt32(PlcBusiness.readBoolPlc(appConfig.mqAddress.));
}
else //下轴
{
directions = Convert.ToInt32(PlcBusiness.readBoolPlc("MW20001.1"));
directions = Convert.ToInt32(PlcBusiness.readBoolPlc(appConfig.mqAddress.));
}
}

@ -393,16 +393,16 @@ namespace MaterialTraceability.Business
{
//开机启动信号 Add By WenJy 2022-10-12
if (plcInstance.readInt32ByAddress("MW25678") == 1)
if (plcInstance.readInt32ByAddress(appConfig.mqAddress.) == 1)
{
plcInstance.writeInt32ByAddress("MW25678", 0);
plcInstance.writeInt32ByAddress(appConfig.mqAddress., 0);
SignalRefreshEvent?.Invoke(8, 0);
}
//左放卷 涨紧信号
if (plcInstance.readInt32ByAddress("MW24800") == 1)
if (plcInstance.readInt32ByAddress(appConfig.mqAddress.) == 1)
{
plcInstance.writeInt32ByAddress("MW24800", 0);
plcInstance.writeInt32ByAddress(appConfig.mqAddress., 0);
if (appConfig.machineId == 3)
{
SignalRefreshEvent?.Invoke(1, 6);
@ -415,9 +415,9 @@ namespace MaterialTraceability.Business
}
//右放卷 涨紧信号
if (plcInstance.readInt32ByAddress("MW24802") == 1)
if (plcInstance.readInt32ByAddress(appConfig.mqAddress.) == 1)
{
plcInstance.writeInt32ByAddress("MW24802", 0);
plcInstance.writeInt32ByAddress(appConfig.mqAddress., 0);
if (appConfig.machineId == 3)
{
SignalRefreshEvent?.Invoke(1, 5);
@ -430,7 +430,7 @@ namespace MaterialTraceability.Business
}
//左放卷 开始信号
if (plcInstance.readBoolByAddress("MW1021.2"))
if (plcInstance.readBoolByAddress(appConfig.mqAddress.))
{
if (isReadFlag(ref lastReadTime_A_Begin))
{
@ -449,7 +449,7 @@ namespace MaterialTraceability.Business
}
//右放卷 开始信号
if (plcInstance.readBoolByAddress("MW1021.6"))
if (plcInstance.readBoolByAddress(appConfig.mqAddress.))
{
if (isReadFlag(ref lastReadTime_A_End))
{
@ -467,9 +467,9 @@ namespace MaterialTraceability.Business
}
//左放卷 结束信号
if (plcInstance.readInt32ByAddress("MW24844") == 1)
if (plcInstance.readInt32ByAddress(appConfig.mqAddress.) == 1)
{
writePlc("MW24844", 0);
writePlc(appConfig.mqAddress., 0);
if (appConfig.machineId == 3)
{
SignalRefreshEvent?.Invoke(2, 6);
@ -483,7 +483,7 @@ namespace MaterialTraceability.Business
}
//右放卷 结束信号
if (plcInstance.readInt32ByAddress("MW24846") == 1)
if (plcInstance.readInt32ByAddress(appConfig.mqAddress.) == 1)
{
if (appConfig.machineId == 3)
{
@ -494,13 +494,13 @@ namespace MaterialTraceability.Business
{
SignalRefreshEvent?.Invoke(2, 6);
}
writePlc("MW24846", 0);
writePlc(appConfig.mqAddress., 0);
}
//上收卷左侧涨紧 信号
if (plcInstance.readInt32ByAddress("MW24804") == 1)
if (plcInstance.readInt32ByAddress(appConfig.mqAddress.) == 1)
{
plcInstance.writeInt32ByAddress("MW24804", 0);
plcInstance.writeInt32ByAddress(appConfig.mqAddress., 0);
if (appConfig.machineId == 3)
{
SignalRefreshEvent?.Invoke(3, 3);
@ -512,9 +512,9 @@ namespace MaterialTraceability.Business
}
//上收卷右侧涨紧 信号
if (plcInstance.readInt32ByAddress("MW24806") == 1)
if (plcInstance.readInt32ByAddress(appConfig.mqAddress.) == 1)
{
plcInstance.writeInt32ByAddress("MW24806", 0);
plcInstance.writeInt32ByAddress(appConfig.mqAddress., 0);
if (appConfig.machineId == 3)
{
SignalRefreshEvent?.Invoke(3, 1);
@ -527,9 +527,9 @@ namespace MaterialTraceability.Business
}
//下收卷左侧涨紧 信号
if (plcInstance.readInt32ByAddress("MW24808") == 1)
if (plcInstance.readInt32ByAddress(appConfig.mqAddress.) == 1)
{
plcInstance.writeInt32ByAddress("MW24808", 0);
plcInstance.writeInt32ByAddress(appConfig.mqAddress., 0);
if (appConfig.machineId == 3)
{
SignalRefreshEvent?.Invoke(3, 4);
@ -542,9 +542,9 @@ namespace MaterialTraceability.Business
}
//下收卷右侧涨紧 信号
if (plcInstance.readInt32ByAddress("MW24810") == 1)
if (plcInstance.readInt32ByAddress(appConfig.mqAddress.) == 1)
{
plcInstance.writeInt32ByAddress("MW24810", 0);
plcInstance.writeInt32ByAddress(appConfig.mqAddress., 0);
if (appConfig.machineId == 3)
{
@ -558,7 +558,7 @@ namespace MaterialTraceability.Business
}
//上收卷左侧开始信号
if (plcInstance.readBoolByAddress("MW1022.2"))
if (plcInstance.readBoolByAddress(appConfig.mqAddress.))
{
if (isReadFlag(ref lastReadTime_B_Begin))
{
@ -574,7 +574,7 @@ namespace MaterialTraceability.Business
}
//上收卷右侧开始信号
if (plcInstance.readBoolByAddress("MW1022.6"))
if (plcInstance.readBoolByAddress(appConfig.mqAddress.))
{
if (isReadFlag(ref lastReadTime_B_End))
{
@ -591,7 +591,7 @@ namespace MaterialTraceability.Business
}
//下收卷左侧开始信号
if (plcInstance.readBoolByAddress("MW1023.2"))
if (plcInstance.readBoolByAddress(appConfig.mqAddress.))
{
if (isReadFlag(ref lastReadTime_Force))
{
@ -608,7 +608,7 @@ namespace MaterialTraceability.Business
}
//下收卷右侧开始信号
if (plcInstance.readBoolByAddress("MW1023.6"))
if (plcInstance.readBoolByAddress(appConfig.mqAddress.))
{
if (isReadFlag(ref lastReadTime_ForceSecond))
{
@ -625,9 +625,9 @@ namespace MaterialTraceability.Business
}
//上左收卷结束信号
if (plcInstance.readInt32ByAddress("MW24848") == 1)
if (plcInstance.readInt32ByAddress(appConfig.mqAddress.) == 1)
{
writePlc("MW24848", 0);
writePlc(appConfig.mqAddress., 0);
if (appConfig.machineId == 3)
{
SignalRefreshEvent?.Invoke(4, 3);
@ -640,9 +640,9 @@ namespace MaterialTraceability.Business
}
//上右收卷结束信号
if (plcInstance.readInt32ByAddress("MW24850") == 1)
if (plcInstance.readInt32ByAddress(appConfig.mqAddress.) == 1)
{
writePlc("MW24850", 0);
writePlc(appConfig.mqAddress., 0);
if (appConfig.machineId == 3)
{
SignalRefreshEvent?.Invoke(4, 1);
@ -655,9 +655,9 @@ namespace MaterialTraceability.Business
}
//下左收卷结束
if (plcInstance.readInt32ByAddress("MW24852") == 1)
if (plcInstance.readInt32ByAddress(appConfig.mqAddress.) == 1)
{
writePlc("MW24852", 0);
writePlc(appConfig.mqAddress., 0);
if (appConfig.machineId == 3)
{
SignalRefreshEvent?.Invoke(4, 4);
@ -670,9 +670,9 @@ namespace MaterialTraceability.Business
}
//下右收卷结束
if (plcInstance.readInt32ByAddress("MW24854") == 1)
if (plcInstance.readInt32ByAddress(appConfig.mqAddress.) == 1)
{
writePlc("MW24854", 0);
writePlc(appConfig.mqAddress., 0);
if (appConfig.machineId == 3)
{
SignalRefreshEvent?.Invoke(4, 2);

@ -9,7 +9,7 @@ namespace MaterialTraceability.Entity.Config
{
public sealed class LyAddress
{
private static INIFile iNIFile = new INIFile(System.Environment.CurrentDirectory + "/PlcConfig/App.InI");
private static INIFile iNIFile = new INIFile(System.Environment.CurrentDirectory + "/App.InI");
private static readonly Lazy<LyAddress> lazy = new Lazy<LyAddress>(() => new LyAddress());

@ -0,0 +1,171 @@
using MaterialTraceability.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MaterialTraceability.Entity.Config
{
public sealed class MqAddress
{
private static INIFile iNIFile = new INIFile(System.Environment.CurrentDirectory + "/App.InI");
private static readonly Lazy<MqAddress> lazy = new Lazy<MqAddress>(() => new MqAddress());
public static MqAddress Instance
{
get
{
return lazy.Value;
}
}
private MqAddress() { }
public string = iNIFile.IniReadValue("MQPLcAddress", "上左收卷涨紧");
public string = iNIFile.IniReadValue("MQPLcAddress", "下左收卷涨紧");
public string = iNIFile.IniReadValue("MQPLcAddress", "上右收卷涨紧");
public string = iNIFile.IniReadValue("MQPLcAddress", "下右收卷涨紧");
public string = iNIFile.IniReadValue("MQPLcAddress", "左放卷涨紧");
public string = iNIFile.IniReadValue("MQPLcAddress", "右放卷涨紧");
//
public string = iNIFile.IniReadValue("MQPLcAddress", "上左收卷开始");
public string = iNIFile.IniReadValue("MQPLcAddress", "下左收卷开始");
public string = iNIFile.IniReadValue("MQPLcAddress", "上右收卷开始");
public string = iNIFile.IniReadValue("MQPLcAddress", "下右收卷开始");
public string = iNIFile.IniReadValue("MQPLcAddress", "左放卷开始");
public string = iNIFile.IniReadValue("MQPLcAddress", "右放卷开始");
//
public string = iNIFile.IniReadValue("MQPLcAddress", "上左收卷结束");
public string = iNIFile.IniReadValue("MQPLcAddress", "下左收卷结束");
public string = iNIFile.IniReadValue("MQPLcAddress", "上右收卷结束");
public string = iNIFile.IniReadValue("MQPLcAddress", "下右收卷结束");
public string = iNIFile.IniReadValue("MQPLcAddress", "左放卷结束");
public string = iNIFile.IniReadValue("MQPLcAddress", "右放卷结束");
//
public string EA = iNIFile.IniReadValue("MQPLcAddress", "上左收卷EA");
public string EA = iNIFile.IniReadValue("MQPLcAddress", "下左收卷EA");
public string EA = iNIFile.IniReadValue("MQPLcAddress", "上右收卷EA");
public string EA = iNIFile.IniReadValue("MQPLcAddress", "下右收卷EA");
//
public string = iNIFile.IniReadValue("MQPLcAddress", "上左收卷读取结果");
public string = iNIFile.IniReadValue("MQPLcAddress", "下左收卷读取结果");
public string = iNIFile.IniReadValue("MQPLcAddress", "上右收卷读取结果");
public string = iNIFile.IniReadValue("MQPLcAddress", "下右收卷读取结果");
public string = iNIFile.IniReadValue("MQPLcAddress", "左放卷读取结果");
public string = iNIFile.IniReadValue("MQPLcAddress", "右放卷读取结果");
//
public string = iNIFile.IniReadValue("MQPLcAddress", "上左收卷报警");
public string = iNIFile.IniReadValue("MQPLcAddress", "下左收卷报警");
public string = iNIFile.IniReadValue("MQPLcAddress", "上右收卷报警");
public string = iNIFile.IniReadValue("MQPLcAddress", "下右收卷报警");
public string = iNIFile.IniReadValue("MQPLcAddress", "左放卷报警");
public string = iNIFile.IniReadValue("MQPLcAddress", "右放卷报警");
//
public string = iNIFile.IniReadValue("MQPLcAddress", "上左收卷写入");
public string = iNIFile.IniReadValue("MQPLcAddress", "下左收卷写入");
public string = iNIFile.IniReadValue("MQPLcAddress", "上右收卷写入");
public string = iNIFile.IniReadValue("MQPLcAddress", "下右收卷写入");
public string = iNIFile.IniReadValue("MQPLcAddress", "左放卷写入");
public string = iNIFile.IniReadValue("MQPLcAddress", "右放卷写入");
//
public string SFC = iNIFile.IniReadValue("MQPLcAddress", "上左收卷SFC");
public string SFC = iNIFile.IniReadValue("MQPLcAddress", "下左收卷SFC");
public string SFC = iNIFile.IniReadValue("MQPLcAddress", "上右收卷SFC");
public string SFC = iNIFile.IniReadValue("MQPLcAddress", "下右收卷SFC");
public string SFC = iNIFile.IniReadValue("MQPLcAddress", "左放卷SFC");
public string SFC = iNIFile.IniReadValue("MQPLcAddress", "右放卷SFC");
//
public string = iNIFile.IniReadValue("MQPLcAddress", "上左收卷下料");
public string = iNIFile.IniReadValue("MQPLcAddress", "下左收卷下料");
public string = iNIFile.IniReadValue("MQPLcAddress", "上右收卷下料");
public string = iNIFile.IniReadValue("MQPLcAddress", "下右收卷下料");
public string = iNIFile.IniReadValue("MQPLcAddress", "左放卷下料");
public string = iNIFile.IniReadValue("MQPLcAddress", "右放卷下料");
//
public string = iNIFile.IniReadValue("MQPLcAddress", "上左收卷状态");
public string = iNIFile.IniReadValue("MQPLcAddress", "下左收卷状态");
public string = iNIFile.IniReadValue("MQPLcAddress", "上右收卷状态");
public string = iNIFile.IniReadValue("MQPLcAddress", "下右收卷状态");
public string = iNIFile.IniReadValue("MQPLcAddress", "左放卷状态");
public string = iNIFile.IniReadValue("MQPLcAddress", "右放卷状态");
//
public string = iNIFile.IniReadValue("MQPLcAddress", "上左打标数");
public string = iNIFile.IniReadValue("MQPLcAddress", "下左打标数");
public string = iNIFile.IniReadValue("MQPLcAddress", "上右打标数");
public string = iNIFile.IniReadValue("MQPLcAddress", "下右打标数");
//
public string = iNIFile.IniReadValue("MQPLcAddress", "开机启动");
public string = iNIFile.IniReadValue("MQPLcAddress", "全局报警");
//
public string = iNIFile.IniReadValue("MQPLcAddress", "放卷方向");
public string = iNIFile.IniReadValue("MQPLcAddress", "上轴方向");
public string = iNIFile.IniReadValue("MQPLcAddress", "下轴方向");
}
}

@ -10,7 +10,7 @@ namespace MaterialTraceability.Entity.Config
{
public sealed class TbAddress
{
private static INIFile iNIFile = new INIFile(System.Environment.CurrentDirectory + "/PlcConfig/App.InI");
private static INIFile iNIFile = new INIFile(System.Environment.CurrentDirectory + "/App.InI");
private static readonly Lazy<TbAddress> lazy = new Lazy<TbAddress>(() => new TbAddress());

@ -51,5 +51,7 @@ namespace MaterialTraceability.Entity.DTO
public TbAddress TbAddress = TbAddress.Instance;
public LyAddress LyAddress = LyAddress.Instance;
public MqAddress mqAddress = MqAddress.Instance;
}
}

@ -45,6 +45,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Config\LyAddress.cs" />
<Compile Include="Config\MqAddress.cs" />
<Compile Include="Config\TbAddress.cs" />
<Compile Include="DAO\ComPay.cs" />
<Compile Include="DAO\ProBindInfo.cs" />

@ -970,7 +970,7 @@ namespace MaterialTraceabilityUI
MessageBox.Show("上左收卷强制下料");
ListBoxItemAdd(this.PlcLog, "上左收卷强制下料触发成功MW24824写入0");
LogHelperBusiness.LogInfo("上左收卷强制下料触发MW24824写入0");
plcBusiness.writePlc("MW24824", 0);
plcBusiness.writePlc(appConfig.mqAddress., 0);
int position = 0;
if(appConfig.machineId == 3)
{
@ -1000,7 +1000,7 @@ namespace MaterialTraceabilityUI
MessageBox.Show("上右收卷强制下料触发");
ListBoxItemAdd(this.PlcLog, "上右收卷强制下料触发成功MW24826写入0");
LogHelperBusiness.LogInfo("上右收卷强制下料触发成功MW24826写入0");
plcBusiness.writePlc("MW24826", 0);
plcBusiness.writePlc(appConfig.mqAddress., 0);
int position = 0;
if (appConfig.machineId == 3)
@ -1031,7 +1031,7 @@ namespace MaterialTraceabilityUI
MessageBox.Show("下左收卷强制下料触发");
ListBoxItemAdd(this.PlcLog, "下左收卷强制下料触发成功MW24828写入0");
LogHelperBusiness.LogInfo("下左收卷强制下料触发成功MW24828写入0");
plcBusiness.writePlc("MW24828", 0);
plcBusiness.writePlc(appConfig.mqAddress., 0);
int position = 0;
if (appConfig.machineId == 3)
@ -1062,7 +1062,7 @@ namespace MaterialTraceabilityUI
MessageBox.Show("下右收卷强制下料触发");
ListBoxItemAdd(this.PlcLog, "下右收卷强制下料触发成功MW24830写入0");
LogHelperBusiness.LogInfo("下右收卷强制下料触发成功MW24830写入0");
plcBusiness.writePlc("MW24830", 0);
plcBusiness.writePlc(appConfig.mqAddress., 0);
int position = 0;
if (appConfig.machineId == 3)
@ -1225,7 +1225,7 @@ namespace MaterialTraceabilityUI
MessageBox.Show("左放卷强制下料");
ListBoxItemAdd(this.PlcLog, "左放卷强制下料触发成功");
LogHelperBusiness.LogInfo("左放卷强制下料触发");
plcBusiness.writePlc("MW24820", 0);
plcBusiness.writePlc(appConfig.mqAddress., 0);
}
}
@ -1245,7 +1245,7 @@ namespace MaterialTraceabilityUI
MessageBox.Show("右放卷强制下料");
ListBoxItemAdd(this.PlcLog, "右放卷强制下料触发成功");
LogHelperBusiness.LogInfo("右放卷强制下料触发");
plcBusiness.writePlc("MW24822", 0);
plcBusiness.writePlc(appConfig.mqAddress., 0);
}
}
@ -1269,7 +1269,7 @@ namespace MaterialTraceabilityUI
}
ListBoxItemAdd(this.PlcLog, logStr + "强制下料触发成功,解除合卷报警");
LogHelperBusiness.LogInfo(logStr + "强制下料触发成功,解除合卷报警");
plcBusiness.writeDoublePlc("MW24624", 0);
plcBusiness.writeDoublePlc(appConfig.mqAddress., 0);
}catch(Exception ex)
{
LogHelperBusiness.LogInfo("强制下料异常:"+ex.Message);

Loading…
Cancel
Save