master
CaesarBao 3 weeks ago
parent 57539694e1
commit 432759579a

@ -81,18 +81,40 @@ namespace MaterialTraceability.Business
//{
// taglist.Add(new TagInfo
// {
// Antana = 4,
// Count = 2,
// EPCstring = "JSLY1RDA00000302"
// Antana = 1,
// Count = 1,
// EPCstring = "CATT1RDB00011801"
// });
// taglist.Add(new TagInfo
// {
// Antana = 2,
// Count = 6,
// EPCstring = "CATT1RDB00011802"
// });
// taglist.Add(new TagInfo
// {
// Antana = 1,
// Count = 8,
// EPCstring = "CATT1RDB00023202"
// });
// taglist.Add(new TagInfo
// {
// Antana = 4,
// Count = 25,
// EPCstring = "CATT1RDB00011201"
// });
// taglist.Add(new TagInfo
// {
// Antana = 3,
// Count = 7,
// EPCstring = "CATT1RDB00014702"
// });
//}
//if (taglist.Count < 1)
//{
// taglist = equip.DeviceAdapter.Device_GetTagInfoList(DeviceType.Mesnac_GRUR445, int.Parse(Convert.ToString(waitTime * 1000)));
//}
eq = equip;
//if (taglist.Count < 1)
//{
// taglist = equip.DeviceAdapter.Device_GetTagInfoList(DeviceType.Mesnac_GRUR445, int.Parse(Convert.ToString(waitTime * 1000)));
//}
eq = equip;
LogHelper.RfidLog("gettaglist函数结果" + JsonChange.ModeToJson(taglist));
if (isFilter)
{
@ -405,11 +427,11 @@ namespace MaterialTraceability.Business
}
if (ConfigHelper.GetConfig("tagAmount") == "3")
{
if (minpostion == 5 || minpostion == 8)
if (minpostion == 1 || minpostion == 4)
{
LogRefreshEvent?.Invoke(LogType.RfidLog, "天线:" + minpostion + ",未读到标签,改为" + (minpostion + 1) + "进行读取");
ta = GetAntEPC(info2, minpostion + 1, "");
LogRefreshEvent?.Invoke(LogType.RfidLog, "天线:" + (minpostion + 1) + ",读到标签:" + ta.EPC);
LogRefreshEvent?.Invoke(LogType.RfidLog, "位置:" + minpostion + ",未读到标签,改为" + (minpostion - 1) + "进行读取");
ta = GetAntEPC(info2, minpostion - 1, "");
LogRefreshEvent?.Invoke(LogType.RfidLog, "天线:" + (minpostion - 1) + ",读到标签:" + ta.EPC);
}
//if (minpostion == 8)
@ -419,7 +441,6 @@ namespace MaterialTraceability.Business
// LogRefreshEvent?.Invoke(LogType.RfidLog, "天线:" + (minpostion - 1) + ",读到标签:" + ta.EPC);
//}
}
ta.position = minpostion;
}
outepc = ta.EPC;
@ -436,7 +457,7 @@ namespace MaterialTraceability.Business
foreach (var a in tagList)
{
LogHelper.RfidLog("RFID读取日志" + a.position + "位置读到标签:" + a.EPC);
LogHelper.RfidLog("RFID读取日志" + a.position + "位置,天线:"+a.Ant+"读到标签:" + a.EPC);
}
return tagList;
@ -458,7 +479,7 @@ namespace MaterialTraceability.Business
{
//小天线的位置是13
if (po == 1 || po == 4)
if (po == 1 || po == 3)
{
minPostion = po;
//positionGroup.Remove(po);
@ -492,6 +513,7 @@ namespace MaterialTraceability.Business
var result = cFliterRFID.filterByAnt(taglist, Convert.ToInt32(equip.equipAnt), outEPC);
TagMessage tag = new TagMessage()
{
Ant = equip.equipAnt,
EPC = result,
position = pos
};
@ -960,6 +982,7 @@ namespace MaterialTraceability.Business
public class TagMessage
{
public string Ant { get; set; }
/// <summary>
/// epc
/// </summary>

@ -143,12 +143,12 @@ namespace MaterialTraceability.Business.Impl
epc = epc.Replace("\0", "").Trim();
//RFID写入PLC
//WriteRFIDtoPLC(position, epc);
//if (epc == "" || epc == null)
//{
// Random random = new Random();
if (epc == "" || epc == null)
{
Random random = new Random();
// epc = "JSLY4RDA0000" + random.Next(10, 99);
//}
epc = "JSLY4RDA0000" + random.Next(10, 99);
}
if (StringExtension.IsBlank(epc) || !epc.Contains("JSLY") && !epc.Contains("CATT"))
@ -264,6 +264,16 @@ namespace MaterialTraceability.Business.Impl
{
try
{
//放卷结束置位手动上料
if (position == 0)
{
plcBusiness.writePlc(appConfig.LyAddress.A, 0);
}
else
{
plcBusiness.writePlc(appConfig.LyAddress.B, 0);
}
string logStr = position == 0 ? LanguageHelper.ShowMessage("A放卷轴") : LanguageHelper.ShowMessage("B放卷轴");
LogRefreshEvent?.Invoke(LogType.PlcLog, logStr+ LanguageHelper.ShowMessage("放卷位结束信号触发成功"));
LogRefreshEvent?.Invoke(LogType.RfidLog, logStr + LanguageHelper.ShowMessage("放卷位结束信号触发成功"));
@ -306,15 +316,15 @@ namespace MaterialTraceability.Business.Impl
}
if (PlcBusiness.readPlc(appConfig.LyAddress.2A) == 1)
{
UpdateShaftEndFlag(3);
}
//if (PlcBusiness.readPlc(appConfig.LyAddress.收卷2A状态) == 1)
//{
// UpdateShaftEndFlag(3);
//}
if (PlcBusiness.readPlc(appConfig.LyAddress.2B) == 1)
{
UpdateShaftEndFlag(4);
}
//if (PlcBusiness.readPlc(appConfig.LyAddress.收卷2B状态) == 1)
//{
// UpdateShaftEndFlag(4);
//}
//更新放卷信息
@ -386,7 +396,7 @@ namespace MaterialTraceability.Business.Impl
}
if (FJSFC.Length > 0)
{
FJSFC = FJSFC.Substring(0, 18);
FJSFC = FJSFC.Substring(0, 20);
}
if (StringExtension.IsBlank(FJSFC))
{
@ -401,14 +411,14 @@ namespace MaterialTraceability.Business.Impl
List<TagMessage> positionTag = equipBusiness.ReadEPCByAntanaGroup(positionList);
foreach (var item in positionList)
{
if (item == 1) logStr = LanguageHelper.ShowMessage("1A轴1#天线");
if (item == 2) logStr = LanguageHelper.ShowMessage("1A轴2#天线");
if (item == 3) logStr = LanguageHelper.ShowMessage("1B轴1#天线");
if (item == 4) logStr = LanguageHelper.ShowMessage("1B轴2#天线");
if (item == 5) logStr = LanguageHelper.ShowMessage("2A轴3#天线");
if (item == 6) logStr = LanguageHelper.ShowMessage("2A轴4#天线");
if (item == 7) logStr = LanguageHelper.ShowMessage("2B轴3#天线");
if (item == 8) logStr = LanguageHelper.ShowMessage("2B轴4#天线");
if (item == 1) logStr = LanguageHelper.ShowMessage("1A轴3#天线");
if (item == 2) logStr = LanguageHelper.ShowMessage("1A轴4#天线");
if (item == 3) logStr = LanguageHelper.ShowMessage("1B轴4#天线");
if (item == 4) logStr = LanguageHelper.ShowMessage("1B轴3#天线");
if (item == 5) logStr = LanguageHelper.ShowMessage("2A轴1#天线");
if (item == 6) logStr = LanguageHelper.ShowMessage("2A轴2#天线");
if (item == 7) logStr = LanguageHelper.ShowMessage("2B轴1#天线");
if (item == 8) logStr = LanguageHelper.ShowMessage("2B轴2#天线");
string epc = "";
//add by wenjy 判断读取结果是否为null 20220825
@ -542,23 +552,24 @@ namespace MaterialTraceability.Business.Impl
}
else if (ConfigHelper.GetConfig("tagAmount") == "3")
{
if (position < 3)
if (position > 2)
{
if (tagInfoList.Count == 2)
{
LogHelper.Info("收卷位涨紧流程处理完工下发OK信号");
this.sendSuccessByDownBegin(position);
//这里要判断是否存在其他位置
if (JudgeSame(tagInfoList, position))
{
WriteNGToPLC(position);
sendError(position, 2, false, 1);
LogHelper.Info(logStr + "RFID条码" + epc + "已存在其它位置,检查是否重复");
LogRefreshEvent?.Invoke(LogType.AlarmLog, logStr + epc + LanguageHelper.ShowMessage("RFID条码已存在其它位置检查是否重复"));
}
else
{
LogHelper.Info("收卷位涨紧流程处理完工下发OK信号");
this.sendSuccessByDownBegin(position);
}
//if (JudgeSame(tagInfoList, position))
//{
// WriteNGToPLC(position);
// sendError(position, 2, false, 1);
// LogHelper.Info(logStr + "RFID条码" + epc + "已存在其它位置,检查是否重复");
// LogRefreshEvent?.Invoke(LogType.AlarmLog, logStr + epc + LanguageHelper.ShowMessage("RFID条码已存在其它位置检查是否重复"));
//}
//else
//{
//}
}
}
else
@ -580,13 +591,24 @@ namespace MaterialTraceability.Business.Impl
}
}
}
else
{
if (position < 5)
{
if (tagInfoList.Count == 2)
{
LogHelper.Info("收卷位涨紧流程处理完工下发OK信号");
this.sendSuccessByDownBegin(position);
}
}
}
if (appConfig.isMesFlag == 1)
{
{
//解绑RFID与SFC的绑定信息
LogHelper.Info("解绑RFID条码" + epc + "绑定的SFC信息");
LogRefreshEvent?.Invoke(LogType.RfidLog, logStr + epc+ LanguageHelper.ShowMessage("解绑RFID条码绑定的SFC信息"));
LogRefreshEvent?.Invoke(LogType.RfidLog, logStr + epc + LanguageHelper.ShowMessage("解绑RFID条码绑定的SFC信息"));
this.UnBindRfidAndSfc(epc);
}
@ -663,10 +685,10 @@ namespace MaterialTraceability.Business.Impl
LogHelper.Info(logStr + "收卷结束信号触发成功");
//通过PLC读取收卷轴绑定的放卷位SFC信
ProShaftInfo upMaterialInfo = new ProShaftInfo();
if (position == 1) upMaterialInfo.bindSfc = PlcBusiness.readStrPlc(appConfig.LyAddress.1ASFC, 18).Replace("\0", "").Trim();
if (position == 2) upMaterialInfo.bindSfc = PlcBusiness.readStrPlc(appConfig.LyAddress.1BSFC, 18).Replace("\0", "").Trim();
if (position == 3) upMaterialInfo.bindSfc = PlcBusiness.readStrPlc(appConfig.LyAddress.2ASFC, 18).Replace("\0", "").Trim();
if (position == 4) upMaterialInfo.bindSfc = PlcBusiness.readStrPlc(appConfig.LyAddress.2BSFC, 18).Replace("\0", "").Trim();
if (position == 1) upMaterialInfo.bindSfc = PlcBusiness.readStrPlc(appConfig.LyAddress.1ASFC, 20).Replace("\0", "").Trim();
if (position == 2) upMaterialInfo.bindSfc = PlcBusiness.readStrPlc(appConfig.LyAddress.1BSFC, 20).Replace("\0", "").Trim();
if (position == 3) upMaterialInfo.bindSfc = PlcBusiness.readStrPlc(appConfig.LyAddress.2ASFC, 20).Replace("\0", "").Trim();
if (position == 4) upMaterialInfo.bindSfc = PlcBusiness.readStrPlc(appConfig.LyAddress.2BSFC, 20).Replace("\0", "").Trim();
//LogHelper.PlcLog("通过PLC获取SFC截取前长度:" + upMaterialInfo.bindSfc.Length);
//LogHelper.PlcLog("PLC获取截取前的SFC为:" + upMaterialInfo.bindSfc);
if (StringExtension.IsBlank(upMaterialInfo.bindSfc))
@ -679,8 +701,8 @@ namespace MaterialTraceability.Business.Impl
if (upMaterialInfo.bindSfc.Length > 0)
{
//LogRefreshEvent?.Invoke(LogType.RfidLog, "PLC获取的18位SFC为" + upMaterialInfo.bindSfc + "长度超过18位进行截取");
upMaterialInfo.bindSfc = upMaterialInfo.bindSfc.Substring(0, 18);
//LogRefreshEvent?.Invoke(LogType.RfidLog, "PLC获取的20位SFC为" + upMaterialInfo.bindSfc + "长度超过20位进行截取");
upMaterialInfo.bindSfc = upMaterialInfo.bindSfc.Substring(0, 20);
}
LogRefreshEvent?.Invoke(LogType.RfidLog, LanguageHelper.ShowMessage("通过PLC获取的SFC为") + upMaterialInfo.bindSfc);
@ -1356,14 +1378,14 @@ namespace MaterialTraceability.Business.Impl
/// <returns></returns>
private bool GetSameSfcByPlc(string bindSfc, int position)
{
string SJ_1A = PlcBusiness.readStrPlc(appConfig.LyAddress.1ASFC, (ushort)18).Replace("\0", "").Trim();
string SJ_1B = PlcBusiness.readStrPlc(appConfig.LyAddress.1BSFC, (ushort)18).Replace("\0", "").Trim();
string SJ_2A = PlcBusiness.readStrPlc(appConfig.LyAddress.2ASFC, (ushort)18).Replace("\0", "").Trim();
string SJ_2B = PlcBusiness.readStrPlc(appConfig.LyAddress.2BSFC, (ushort)18).Replace("\0", "").Trim();
string SJ_1A = PlcBusiness.readStrPlc(appConfig.LyAddress.1ASFC, (ushort)20).Replace("\0", "").Trim();
string SJ_1B = PlcBusiness.readStrPlc(appConfig.LyAddress.1BSFC, (ushort)20).Replace("\0", "").Trim();
string SJ_2A = PlcBusiness.readStrPlc(appConfig.LyAddress.2ASFC, (ushort)20).Replace("\0", "").Trim();
string SJ_2B = PlcBusiness.readStrPlc(appConfig.LyAddress.2BSFC, (ushort)20).Replace("\0", "").Trim();
if (position != 1)
{
if (!SJ_1A.IsBlank() && SJ_1A.Length == 18)
if (!SJ_1A.IsBlank() && SJ_1A.Length == 20)
{
if (SJ_1A == bindSfc)
return true;
@ -1372,7 +1394,7 @@ namespace MaterialTraceability.Business.Impl
if (position != 2)
{
if (!SJ_1B.IsBlank() && SJ_1B.Length == 18)
if (!SJ_1B.IsBlank() && SJ_1B.Length == 20)
{
if (SJ_1B == bindSfc)
return true;
@ -1380,7 +1402,7 @@ namespace MaterialTraceability.Business.Impl
}
if (position != 3)
{
if (!SJ_2A.IsBlank() && SJ_2A.Length == 18)
if (!SJ_2A.IsBlank() && SJ_2A.Length == 20)
{
if (SJ_2A == bindSfc)
return true;
@ -1388,7 +1410,7 @@ namespace MaterialTraceability.Business.Impl
}
if (position != 4)
{
if (!SJ_2B.IsBlank() && SJ_2B.Length == 18)
if (!SJ_2B.IsBlank() && SJ_2B.Length == 20)
{
if (SJ_2B == bindSfc)
return true;
@ -1648,7 +1670,7 @@ namespace MaterialTraceability.Business.Impl
//1A
if (PlcBusiness.readPlc(appConfig.LyAddress.1A) == 1)
{
downSfc = PlcBusiness.readStrPlc(appConfig.LyAddress.1ASFC, (ushort)18).Replace("\0", "").Trim().Substring(0,18);
downSfc = PlcBusiness.readStrPlc(appConfig.LyAddress.1ASFC, (ushort)20).Replace("\0", "").Trim().Substring(0,20);
LogHelper.Info("1A轴在生产SFC" + downSfc);
if (StringExtension.IsBlank(downSfc))
{
@ -1672,7 +1694,7 @@ namespace MaterialTraceability.Business.Impl
//1B
if (PlcBusiness.readPlc(appConfig.LyAddress.1B) == 1)
{
downSfc = PlcBusiness.readStrPlc(appConfig.LyAddress.1BSFC, (ushort)18).Replace("\0", "").Trim().Substring(0, 18);
downSfc = PlcBusiness.readStrPlc(appConfig.LyAddress.1BSFC, (ushort)20).Replace("\0", "").Trim().Substring(0, 20);
LogHelper.Info("1B轴在生产SFC" + downSfc);
if (StringExtension.IsBlank(downSfc))
{
@ -1696,7 +1718,7 @@ namespace MaterialTraceability.Business.Impl
//2A
if (PlcBusiness.readPlc(appConfig.LyAddress.2A) == 1)
{
downSfc = PlcBusiness.readStrPlc(appConfig.LyAddress.2ASFC, (ushort)18).Replace("\0", "").Trim().Substring(0, 18);
downSfc = PlcBusiness.readStrPlc(appConfig.LyAddress.2ASFC, (ushort)20).Replace("\0", "").Trim().Substring(0, 20);
LogHelper.Info("2A轴在生产SFC" + downSfc);
if (StringExtension.IsBlank(downSfc))
{
@ -1720,7 +1742,7 @@ namespace MaterialTraceability.Business.Impl
//2B
if (PlcBusiness.readPlc(appConfig.LyAddress.2B) == 1)
{
downSfc = PlcBusiness.readStrPlc(appConfig.LyAddress.2BSFC, (ushort)18).Replace("\0", "").Trim().Substring(0, 18);
downSfc = PlcBusiness.readStrPlc(appConfig.LyAddress.2BSFC, (ushort)20).Replace("\0", "").Trim().Substring(0, 20);
LogHelper.Info("2B轴在生产SFC" + downSfc);
if (StringExtension.IsBlank(downSfc))
{
@ -1823,7 +1845,7 @@ namespace MaterialTraceability.Business.Impl
//plcBusiness.writePlc(appConfig.LyAddress.收卷上料1AOK, 1);
plcBusiness.writePlc(appConfig.LyAddress.1AOK, 1);
}
if(appConfig.PLCType == "LY4NKLYPLcAddress")
if(appConfig.PLCType == "LY4NKLYPLcAddress" || appConfig.PLCType == "HNLYPLcAddress")
{
plcBusiness.writePlc(appConfig.LyAddress.1AOK, 1);
}
@ -1839,7 +1861,7 @@ namespace MaterialTraceability.Business.Impl
//plcBusiness.writePlc(appConfig.LyAddress.收卷上料1BOK, 1);
plcBusiness.writePlc(appConfig.LyAddress.1BOK, 1);
}
if (appConfig.PLCType == "LY4NKLYPLcAddress")
if (appConfig.PLCType == "LY4NKLYPLcAddress" || appConfig.PLCType == "HNLYPLcAddress")
{
plcBusiness.writePlc(appConfig.LyAddress.1BOK, 1);
}
@ -1856,7 +1878,7 @@ namespace MaterialTraceability.Business.Impl
plcBusiness.writePlc(appConfig.LyAddress.2AOK, 1);
//plcBusiness.writePlc(appConfig.LyAddress.收卷下料2AOK, 0);
}
if (appConfig.PLCType == "LY4NKLYPLcAddress")
if (appConfig.PLCType == "LY4NKLYPLcAddress" || appConfig.PLCType == "HNLYPLcAddress")
{
plcBusiness.writePlc(appConfig.LyAddress.2AOK, 1);
}
@ -1873,7 +1895,7 @@ namespace MaterialTraceability.Business.Impl
plcBusiness.writePlc(appConfig.LyAddress.2BOK, 1);
//plcBusiness.writePlc(appConfig.LyAddress.收卷下料2BOK, 0);
}
if (appConfig.PLCType == "LY4NKLYPLcAddress")
if (appConfig.PLCType == "LY4NKLYPLcAddress" || appConfig.PLCType == "HNLYPLcAddress")
{
plcBusiness.writePlc(appConfig.LyAddress.2BOK, 1);
}
@ -1893,62 +1915,19 @@ namespace MaterialTraceability.Business.Impl
{
if (position == 1)
{
if (appConfig.PLCType != ("LY4NKLYPLcAddress") && appConfig.PLCType != ("LY4YHLYPLcAddress"))
{
plcBusiness.writePlc(appConfig.LyAddress.1A, 0);
//plcBusiness.writePlc(appConfig.LyAddress.收卷下料1AOK, 1);
}
else
{
plcBusiness.writePlc(appConfig.LyAddress.1A, 1);
}
plcBusiness.writePlc(appConfig.LyAddress.1A, 1);
}
if (position == 2)
{
if (appConfig.PLCType != ("LY4NKLYPLcAddress") && appConfig.PLCType != ("LY4YHLYPLcAddress"))
{
plcBusiness.writePlc(appConfig.LyAddress.1B, 0);
//plcBusiness.writePlc(appConfig.LyAddress.收卷下料1BOK, 1);
}
else
{
plcBusiness.writePlc(appConfig.LyAddress.1B, 1);
}
plcBusiness.writePlc(appConfig.LyAddress.1B, 1);
}
if (position == 3)
{
if (appConfig.PLCType != ("LY4NKLYPLcAddress") && appConfig.PLCType != ("LY4YHLYPLcAddress"))
{
plcBusiness.writePlc(appConfig.LyAddress.2A, 0);
//plcBusiness.writePlc(appConfig.LyAddress.收卷下料2AOK, 1);
}
else
{
plcBusiness.writePlc(appConfig.LyAddress.2A, 1);
}
plcBusiness.writePlc(appConfig.LyAddress.2A, 1);
}
if (position == 4)
{
if (appConfig.PLCType != ("LY4NKLYPLcAddress") && appConfig.PLCType != ("LY4YHLYPLcAddress"))
{
plcBusiness.writePlc(appConfig.LyAddress.2B, 0);
//plcBusiness.writePlc(appConfig.LyAddress.收卷下料2BOK, 1);
}
else
{
plcBusiness.writePlc(appConfig.LyAddress.2B, 1);
}
plcBusiness.writePlc(appConfig.LyAddress.2B, 1);
}
}
@ -1965,6 +1944,13 @@ namespace MaterialTraceability.Business.Impl
if (position == 3) plcBusiness.writePlc(appConfig.LyAddress.2A, 2);
if (position == 4) plcBusiness.writePlc(appConfig.LyAddress.2B, 2);
}
else if (appConfig.PLCType == ("HNLYPLcAddress"))
{
if (position == 1) plcBusiness.writePlc(appConfig.LyAddress.1A, 0);
if (position == 2) plcBusiness.writePlc(appConfig.LyAddress.1B, 0);
if (position == 3) plcBusiness.writePlc(appConfig.LyAddress.2A, 0);
if (position == 4) plcBusiness.writePlc(appConfig.LyAddress.2B, 0);
}
else
{
if (position == 1) plcBusiness.writePlc(appConfig.LyAddress.1A, 1);
@ -2149,7 +2135,7 @@ namespace MaterialTraceability.Business.Impl
}
else
{
if (item == 5 || item == 8)
if (item == 1 || item == 4)
{
shaftInfo.endFlag = 1;
LogHelper.Info("放卷结束确定最后一卷收卷物料RFID条码为" + shaftInfo.bindRfid);
@ -2189,7 +2175,7 @@ namespace MaterialTraceability.Business.Impl
}
if (ConfigHelper.GetConfig("tagAmount") == "3" || ConfigHelper.GetConfig("tagAmount") == "2")
{
if (position > 2)
if (position < 5)
{
shaftInfo.endFlag = 1;
LogHelper.Info("放卷结束确定最后一卷收卷物料RFID条码为" + shaftInfo.bindRfid);
@ -2207,7 +2193,7 @@ namespace MaterialTraceability.Business.Impl
}
else
{
if (item == 5 || item == 8)
if (item == 1 || item == 4)
{
shaftInfo.endFlag = 1;
LogHelper.Info("放卷结束确定最后一卷收卷物料RFID条码为" + shaftInfo.bindRfid);
@ -2227,7 +2213,7 @@ namespace MaterialTraceability.Business.Impl
}
if (ConfigHelper.GetConfig("tagAmount") == "4")
{
if (item == 5 || item == 8)
if (item == 1 || item == 4)
{
shaftInfo.endFlag = 1;
LogHelper.Info("放卷结束确定最后一卷收卷物料RFID条码为" + shaftInfo.bindRfid);
@ -2271,7 +2257,7 @@ namespace MaterialTraceability.Business.Impl
LogHelper.Info("1A轴异常下料信号触发,下发下料信号");
if (appConfig.PLCType == ("LY4NKLYPLcAddress"))
if (appConfig.PLCType == ("LY4NKLYPLcAddress") || appConfig.PLCType == ("HNLYPLcAddress"))
{
plcBusiness.writePlc(appConfig.LyAddress.1A, 1);
}
@ -2291,7 +2277,7 @@ namespace MaterialTraceability.Business.Impl
//LogRefreshEvent?.Invoke(LogType.PlcLog, "1B轴异常下料信号触发,下发下料信号");
LogHelper.Info("1B轴异常下料信号触发,下发下料信号");
if (appConfig.PLCType == ("LY4NKLYPLcAddress"))
if (appConfig.PLCType == ("LY4NKLYPLcAddress") || appConfig.PLCType == ("HNLYPLcAddress"))
{
plcBusiness.writePlc(appConfig.LyAddress.1B, 1);
}
@ -2312,7 +2298,7 @@ namespace MaterialTraceability.Business.Impl
//LogRefreshEvent?.Invoke(LogType.PlcLog, "2A轴异常下料信号触发,下发下料信号");
LogHelper.Info("2A轴异常下料信号触发,下发下料信号");
if (appConfig.PLCType == ("LY4NKLYPLcAddress"))
if (appConfig.PLCType == ("LY4NKLYPLcAddress") || appConfig.PLCType == ("HNLYPLcAddress"))
{
plcBusiness.writePlc(appConfig.LyAddress.2A,1);
}
@ -2333,7 +2319,7 @@ namespace MaterialTraceability.Business.Impl
//LogRefreshEvent?.Invoke(LogType.PlcLog, "2B轴异常下料信号触发,下发下料信号");
LogHelper.Info("2B轴异常下料信号触发,下发下料信号");
if (appConfig.PLCType == ("LY4NKLYPLcAddress"))
if (appConfig.PLCType == ("LY4NKLYPLcAddress") || appConfig.PLCType == ("HNLYPLcAddress"))
{
plcBusiness.writePlc(appConfig.LyAddress.2B,1);
}
@ -2386,12 +2372,12 @@ namespace MaterialTraceability.Business.Impl
if (position == 3)
{
exp = exp.And(x => x.bindRfid == epc && x.positionId != "5" && x.processId == appConfig.processId);
exp = exp.And(x => x.bindRfid == epc && x.positionId != "5" && x.positionId != "6" && x.processId == appConfig.processId);
}
if (position == 4)
{
exp = exp.And(x => x.bindRfid == epc && x.positionId != "8" && x.processId == appConfig.processId);
exp = exp.And(x => x.bindRfid == epc && x.positionId != "8" && x.positionId != "7" && x.processId == appConfig.processId);
}
List<ProShaftInfo> shaftInfos = await shaftInfoServices.Query(exp);
if (shaftInfos.Count > 0)
@ -2417,15 +2403,22 @@ namespace MaterialTraceability.Business.Impl
logStr = "1A轴";
if (ConfigHelper.GetConfig("tagAmount") == "2"|| ConfigHelper.GetConfig("tagAmount") == "1")
{
positionList.Add(2);
positionList.Add(1);
//冷压1拆2用小天线
//positionList.Add(1);
}
if (ConfigHelper.GetConfig("tagAmount") == "4")
{
positionList.Add(1);
//冷压1拆2用小天线
positionList.Add(2);
}
else
{
positionList.Add(1);
positionList.Add(2);
//positionList.Add(4);
}
}
if (position == 2)
@ -2433,16 +2426,21 @@ namespace MaterialTraceability.Business.Impl
positionList.Clear();
logStr = "1B轴";
if (ConfigHelper.GetConfig("tagAmount") == "2" || ConfigHelper.GetConfig("tagAmount") == "1")
{
//冷压1拆2用小天线
positionList.Add(4);
}
if (ConfigHelper.GetConfig("tagAmount") == "4")
{
positionList.Add(3);
//冷压1拆2用小天线
//positionList.Add(4);
positionList.Add(4);
}
else
{
positionList.Add(4);
positionList.Add(3);
}
}
if (position == 3)
@ -2451,7 +2449,7 @@ namespace MaterialTraceability.Business.Impl
positionList.Clear();
if (ConfigHelper.GetConfig("tagAmount") == "3" || ConfigHelper.GetConfig("tagAmount") == "2" || ConfigHelper.GetConfig("tagAmount") == "1")
{
//positionList.Add(6);
positionList.Add(6);
positionList.Add(5);
}
else
@ -2466,7 +2464,7 @@ namespace MaterialTraceability.Business.Impl
positionList.Clear();
if (ConfigHelper.GetConfig("tagAmount") == "3" || ConfigHelper.GetConfig("tagAmount") == "2" || ConfigHelper.GetConfig("tagAmount") == "1")
{
//positionList.Add(7);
positionList.Add(7);
positionList.Add(8);
}
else
@ -2505,12 +2503,12 @@ namespace MaterialTraceability.Business.Impl
int FJAstate = PlcBusiness.readPlc(appConfig.LyAddress.A);
if (FJAstate == 1)
{
sfc = PlcBusiness.readStrPlc(appConfig.LyAddress.ASFC, (ushort)18).Replace("\0", "").Trim().Substring(0, 18);
sfc = PlcBusiness.readStrPlc(appConfig.LyAddress.ASFC, (ushort)20).Replace("\0", "").Trim().Substring(2, 20);
}
int FJBstate = PlcBusiness.readPlc(appConfig.LyAddress.B);
if (FJBstate == 1)
{
sfc = PlcBusiness.readStrPlc(appConfig.LyAddress.BSFC, (ushort)18).Replace("\0", "").Trim().Substring(0, 18);
sfc = PlcBusiness.readStrPlc(appConfig.LyAddress.BSFC, (ushort)20).Replace("\0", "").Trim().Substring(2, 20);
}
//JudgementMaterial(放卷膜卷号)返回true合卷报警=>PLC 写报警值返回false不处理

@ -10,6 +10,7 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Threading;
using System.Threading.Tasks;
using static System.Net.Mime.MediaTypeNames;
namespace MaterialTraceability.Business
@ -241,7 +242,7 @@ namespace MaterialTraceability.Business
/// </summary>
/// <param name="signal"></param>
/// <param name="position"></param>
public void SignalRead_Invoke(int signal, int position)
public async void SignalRead_Invoke(int signal, int position)
{
try
{
@ -273,6 +274,7 @@ namespace MaterialTraceability.Business
break;
default:
break;
Task.Delay(1);
}
}catch(Exception ex)
{

@ -287,11 +287,11 @@ namespace MaterialTraceability.Business
}
}
private void readplc(object o)
private async void readplc(object o)
{
while (ReadContinue)
{
Thread.Sleep(appConfig.plcSingalReadTime);
try
{
//获取工序编号 TB-涂布、LY冷压预分切、MQ-模切、JR-卷绕
@ -617,7 +617,7 @@ namespace MaterialTraceability.Business
//A放卷结束信号
if (plcInstance.readInteractiveSignal(appConfig.LyAddress.A) == 1)
{
plcInstance.writeInt16ByAddress(appConfig.LyAddress.A, 2);
plcInstance.writeInt16ByAddress(appConfig.LyAddress.A, 0);
if (isReadFlag(ref LastEndTime, 30))
{
@ -627,37 +627,50 @@ namespace MaterialTraceability.Business
//B放卷结束信号
if (plcInstance.readInteractiveSignal(appConfig.LyAddress.B) == 1)
{
plcInstance.writeInt16ByAddress(appConfig.LyAddress.B, 2);
plcInstance.writeInt16ByAddress(appConfig.LyAddress.B, 0);
if (isReadFlag(ref LastEndTime, 30))
{
SignalRefreshEvent?.Invoke(2, 9);
}
}
//收卷涨紧信号-1A气胀轴
if (plcInstance.readInteractiveSignal(appConfig.LyAddress.1A) == 1)
{
//LogHelper.Info("1A涨紧信号");
plcInstance.writeInt16ByAddress(appConfig.LyAddress.1A, 0);
SignalRefreshEvent?.Invoke(3, 1);
lock (string.Empty)
{
SignalRefreshEvent?.Invoke(3, 1);
}
}
//收卷涨紧信号-1B气胀轴
if (plcInstance.readInteractiveSignal(appConfig.LyAddress.1B) == 1)
{
{ LogHelper.Info("1A涨紧信号");
plcInstance.writeInt16ByAddress(appConfig.LyAddress.1B, 0);
SignalRefreshEvent?.Invoke(3, 2);
lock (string.Empty)
{
SignalRefreshEvent?.Invoke(3, 2);
}
}
//收卷涨紧信号-2A气胀轴
if (plcInstance.readInteractiveSignal(appConfig.LyAddress.2A) == 1)
{
//LogHelper.Info("2A涨紧信号");
plcInstance.writeInt16ByAddress(appConfig.LyAddress.2A, 0);
SignalRefreshEvent?.Invoke(3, 3);
lock (string.Empty)
{
SignalRefreshEvent?.Invoke(3, 3);
}
}
//收卷涨紧信号-2B气胀轴
if (plcInstance.readInteractiveSignal(appConfig.LyAddress.2B) == 1)
{
plcInstance.writeInt16ByAddress(appConfig.LyAddress.2B, 0);
SignalRefreshEvent?.Invoke(3, 4);
lock (string.Empty)
{
SignalRefreshEvent?.Invoke(3, 4);
}
}
//收卷结束信号-1A气胀轴
@ -2132,6 +2145,8 @@ namespace MaterialTraceability.Business
#endregion 开始过账信号
}
#endregion
await Task.Delay(appConfig.plcSingalReadTime);
//Thread.Sleep(appConfig.plcSingalReadTime);
}
catch (Exception ex)
{

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace MaterialTraceability.Rfid.Impl
{
@ -1492,13 +1493,13 @@ namespace MaterialTraceability.Rfid.Impl
//m_OneEpcSem.WaitOne(1, false);
GetAllRelese(m_OneEpcSem);
LogHelper.SemaphoreLog("信号量m_OneEpcSemWaitOne(1, false)");
//LogHelper.SemaphoreLog("信号量m_OneEpcSemWaitOne(1, false)");
m_OneEpcDataLen = 0;
DeviceType = devicetype;
if (m_ICommunicateService.SendMessage(pMessagePack)) //发送报文成功
{
m_ReadDataSuccessful = true;
LogHelper.SemaphoreLog("信号量m_OneEpcSemWaitOne("+ waitTime + ", false)");
//LogHelper.SemaphoreLog("信号量m_OneEpcSemWaitOne("+ waitTime + ", false)");
if (m_OneEpcSem.WaitOne(waitTime+2000, false)) //等待结果,并取结果返回。
{
if (m_OneEpcDataLen > 0) //有数据,正常

@ -40,8 +40,8 @@
<add key="AnalysisFlag" value="1" />
<add key="userName" value="Admin" />
<add key="roleId" value="2" />
<add key="tagAmount" value="2" />
<add key="readTime" value="15" />
<add key="tagAmount" value="3" />
<add key="readTime" value="9" />
<!--用户登录时间(S)-->
<add key="ClearTime" value="2" />
<!--冷压拆分EA防呆-->

@ -175,22 +175,22 @@ namespace MaterialTraceabilityUI
//根据当前轴写入PLC下料OK
if (appConfig.PLCType != ("LY4NKLYPLcAddress") && appConfig.PLCType != ("LY4YHLYPLcAddress"))
{
//if (positionId == 1 || positionId == 2)
//{
// plcBusiness.writePlc(appConfig.LyAddress.收卷下料1AOK, 1);
//}
//else if (positionId == 3 || positionId == 4)
//{
// plcBusiness.writePlc(appConfig.LyAddress.收卷下料1BOK, 1);
//}
//else if (positionId == 5 || positionId == 6)
//{
// plcBusiness.writePlc(appConfig.LyAddress.收卷下料2AOK, 1);
//}
//else if (positionId == 7 || positionId == 8)
//{
// plcBusiness.writePlc(appConfig.LyAddress.收卷下料2BOK, 1);
//}
if (positionId == 1 || positionId == 2)
{
plcBusiness.writePlc(appConfig.LyAddress.1A, 1);
}
else if (positionId == 3 || positionId == 4)
{
plcBusiness.writePlc(appConfig.LyAddress.1B, 1);
}
else if (positionId == 5 || positionId == 6)
{
plcBusiness.writePlc(appConfig.LyAddress.2A, 1);
}
else if (positionId == 7 || positionId == 8)
{
plcBusiness.writePlc(appConfig.LyAddress.2B, 1);
}
}
MessageBox.Show("手动拆分成功ea:" + eaStr);

@ -28,7 +28,7 @@
<RowDefinition Height="100"/>
</Grid.RowDefinitions>
<UniformGrid Columns="4" Margin="0,5">
<Border x:Name="upMaterial" BorderThickness="1,1,1,1" BorderBrush="#DBE6FA" Background="#F0F7FF" CornerRadius="5" Margin="5,0" Width="220" MouseDown="upMaterial_MouseDown">
<Border x:Name="upMaterial" BorderThickness="1,1,1,1" BorderBrush="#DBE6FA" Background="#F0F7FF" CornerRadius="5" Margin="5,0" Width="220" MouseDown="upMaterial_MouseDown_A">
<StackPanel Margin="5,5">
<TextBlock Text="{local:StringResource 放卷A轴,DefaultValue=放卷A轴}" FontSize="15" Foreground="#666867" HorizontalAlignment="Center"/>
<TextBlock x:Name="upMaterial_SFC" Text="SFC" FontSize="13" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2" FontWeight="Bold"/>
@ -38,7 +38,7 @@
</Border>
<Border x:Name="upMaterialB" BorderThickness="1,1,1,1" BorderBrush="#DBE6FA" Background="#F0F7FF" CornerRadius="5" Margin="5,0" Width="220" MouseDown="upMaterial_MouseDown">
<Border x:Name="upMaterialB" BorderThickness="1,1,1,1" BorderBrush="#DBE6FA" Background="#F0F7FF" CornerRadius="5" Margin="5,0" Width="220" MouseDown="upMaterial_MouseDown_B">
<StackPanel Margin="5,5">
<TextBlock Text="{local:StringResource 放卷B轴,DefaultValue=放卷B轴}" FontSize="15" Foreground="#666867" HorizontalAlignment="Center"/>
<TextBlock x:Name="upMaterial_SFC1" Text="SFC" FontSize="13" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2" FontWeight="Bold"/>
@ -49,7 +49,7 @@
</Border>
<Border Margin="5,0" MouseDown="upMaterial_MouseDown">
<Border Margin="5,0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>

@ -576,7 +576,7 @@ namespace MaterialTraceabilityUI
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void upMaterial_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
private void upMaterial_MouseDown_A(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
try
{
@ -589,6 +589,20 @@ namespace MaterialTraceabilityUI
LogHelperBusiness.LogError("界面upMaterial_MouseDown异常", ex);
}
}
private void upMaterial_MouseDown_B(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
try
{
WriteInfo write = new WriteInfo(appConfig.processId, 9);
write.ShowDialog();
refreshMaterialInfo(appConfig.processId, "9");
}
catch (Exception ex)
{
LogHelperBusiness.LogError("界面upMaterial_MouseDown异常", ex);
}
}
/// <summary>
/// 收卷1轴内侧

Loading…
Cancel
Save