change - 添加涂布放卷逻辑

master
wenjy 1 month ago
parent 1792a8be23
commit 7baf5a0aab

@ -2,9 +2,11 @@
using MaterialTraceability.Entity.DAO;
using MaterialTraceability.Entity.DTO;
using MaterialTraceability.Entity.Enum;
using MaterialTraceability.Entity.UpLoad;
using MaterialTraceability.SqlSugar;
using MaterialTraceability.SqlSugar.ServiceImpl;
using MaterialTraceability.WebService;
using MaterialTraceability.WebService.MiFirstOperationForsfcServiceService;
using MaterialTraceability.WebService.MiReleaseSfcWithActivityServiceService;
using MaterialTraceability.WebService.Param;
using MaterialTraceability.WebService.ProcessLotServiceWSService;
@ -94,6 +96,8 @@ namespace MaterialTraceability.Business.Impl
private IBaseServices<SysClient> sysClientServices = new BaseServices<SysClient>();
private IBaseServices<ProUpRecord> upRecordServices = new BaseServices<ProUpRecord>();
private MesAlarmInfo alarmInfo = new MesAlarmInfo();
private PlcBusiness plcBusiness = new PlcBusiness();
@ -108,16 +112,149 @@ namespace MaterialTraceability.Business.Impl
/// <param name="position"></param>
public void UpMaterialBegin(int position)
{
throw new NotImplementedException();
string logStr = position == 3 ? "A放卷轴" : "B放卷轴";
try
{
LogRefreshEvent?.Invoke(LogType.PlcLog, $"{logStr}涨紧信号触发成功");
ProEquip proEquip = equipBusiness.Equiplist.Where(x => x.positionId == position).FirstOrDefault();
if (proEquip == null)
{
LogRefreshEvent?.Invoke(LogType.AlarmLog, $"获取{logStr}读写器设备信息异常");
return;
}
string epc = equipBusiness.ReadEPCByAntana(proEquip.equipId);
epc = epc.Replace("\0", "").Trim();
SaveReadRecord(proEquip, epc);
if (StringExtension.IsBlank(epc))
{
plcBusiness.writePlc(appConfig.TbAddress., 1);
plcBusiness.writePlc(position == 3 ? appConfig.TbAddress.RFID : appConfig.TbAddress.RFID, 1);
LogHelper.Info($"{logStr}RFID条码信息读取失败下发PLC报警");
LogRefreshEvent?.Invoke(LogType.AlarmLog, $"{logStr}RFID条码信息读取失败");
ViewModelRefreshEvent?.Invoke(new ViewModelDto()
{
rfidInfo = new RfidInfoDto()
{
rfid = "",
sfc = "",
ea = "",
position = position,
},
plcStatus = true,
});
return;
}
LogHelper.Info($"{logStr}RFID条码信息读取成功{epc}");
LogRefreshEvent?.Invoke(LogType.RfidLog, $"{logStr}RFID条码信息读取成功,RFID为{epc}");
//判断RFID标签是否重复
LogHelper.Info($"{logStr}判断RFID标签是否重复");
if (BusinessHelper.UpRfidIsRecur(epc, position).Result)
{
//判断是否已经生产结束
if (UpMaterialIsEndProduction(epc).Result)
{
plcBusiness.writePlc(appConfig.LyAddress.RFID, 1);
LogRefreshEvent?.Invoke(LogType.AlarmLog, String.Format("当前读取的RFID{0},已经生产结束不允许再次上料", epc));
LogHelper.Info(String.Format("当前读取的RFID{0},已经生产结束不允许再次上料", epc));
return;
}
else
{
Expression<Func<ProUpRecord, bool>> exp = s1 => true;
Expression<Func<ProUpRecord, object>> order = (x) => x.RecordTime;
ProUpRecord upRecord = upRecordServices.QueryFirst(exp, order, false).Result;
if (upRecord != null)
{
PlcBusiness.writeStrPlc(position == 3 ? appConfig.TbAddress.ASFC : appConfig.TbAddress.BSFC, upRecord.Sfc);
ViewModelRefreshEvent?.Invoke(new ViewModelDto()
{
rfidInfo = new RfidInfoDto()
{
rfid = epc,
sfc = upRecord.Sfc,
position = position,
},
plcStatus = true,
});
}
LogHelper.Info($"{logStr}RFID读取到的条码{epc};与前一读取相同并且生产未结束,可以继续生产");
LogRefreshEvent?.Invoke(LogType.RfidLog, $"{logStr}RFID读取到的条码{epc};与前一读取相同并且生产未结束,可以继续生产");
LogHelper.Info("冷压放卷流程处理成功");
//plcBusiness.writePlc(appConfig.LyAddress.放卷OK, 0);
return;
}
}
//读取数据刷新
ViewModelRefreshEvent?.Invoke(new ViewModelDto()
{
rfidInfo = new RfidInfoDto()
{
rfid = epc,
//sfc = "",
position = position,
},
plcStatus = true,
});
FJMesBegin(position, epc, true);
}
catch (Exception ex)
{
LogHelper.Info($"{logStr}放卷涨紧流程RFID逻辑处理异常:{ex.Message}");
plcBusiness.writePlc(position == 3 ? appConfig.TbAddress.RFID : appConfig.TbAddress.RFID, 1);
}
}
/// <summary>
/// 放卷位结束
/// </summary>
/// <param name="position"></param>
public void UpMaterialEnd(int position)
public async void UpMaterialEnd(int position)
{
throw new NotImplementedException();
string logStr = position == 3 ? "A放卷轴" : "B放卷轴";
try
{
LogRefreshEvent?.Invoke(LogType.PlcLog, $"{logStr}结束信号触发成功");
ProShaftInfo shaftInfo = await this.GetShaftInfoByPosition(position);
if (shaftInfo == null)
{
LogRefreshEvent?.Invoke(LogType.RfidLog, $"{logStr}放卷结束,获取卷轴绑定的信息为空");
return;
}
Expression<Func<ProUpRecord, bool>> upExp = s1 => true;
upExp = upExp.And(x => x.Sfc == shaftInfo.bindSfc && x.Rfid == shaftInfo.bindRfid && x.IsProduction == 0);
Expression<Func<ProUpRecord, object>> upOrder = (x) => x.RecordTime;
ProUpRecord upRecord = await upRecordServices.QueryFirst(upExp, upOrder, false);
if (upRecord == null)
{
LogRefreshEvent?.Invoke(LogType.AlarmLog, $"{logStr}放卷结束,获取上料信息为空");
return;
}
//更新放卷信息
upRecord.endTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
upRecord.IsProduction = 1;
upRecord.isFinish = 1;
await upRecordServices.Update(upRecord);
LogRefreshEvent?.Invoke(LogType.RfidLog, "生成放卷信息");
shaftInfo.bindRfid = string.Empty;
shaftInfo.bindSfc = string.Empty;
shaftInfo.bindEaValue = string.Empty;
shaftInfo.bindTime = string.Empty;
await shaftInfoServices.Update(shaftInfo);
plcBusiness.writePlc(appConfig.TbAddress., 0);
}
catch (Exception ex)
{
LogHelper.Info($"{logStr}放卷结束流程RFID逻辑处理异常:{ex.Message}");
}
}
///add by yinzf
/// <summary>
@ -126,9 +263,169 @@ namespace MaterialTraceability.Business.Impl
/// <param name="position"></param>
public void UpBegin(int position)
{
string logStr = position == 3 ? "A放卷轴" : "B放卷轴";
try
{
LogRefreshEvent?.Invoke(LogType.PlcLog, $"{logStr}开始信号触发成功");
plcBusiness.writePlc(appConfig.TbAddress., 1);
}
catch(Exception ex)
{
LogHelper.Info($"{logStr}放卷结束流程RFID逻辑处理异常:{ex.Message}");
}
}
/// <summary>
/// 放卷涨紧MES处理
/// </summary>
/// <param name="position"></param>
/// <param name="epc"></param>
/// <param name="auto"></param>
public async void FJMesBegin(int position, string epc, bool auto)
{
string logStr = position == 3 ? "A放卷轴" : "B放卷轴";
string sfc = "";
string qty = "";
try
{
if (!auto)
{
plcBusiness.writePlc(position == 3 ? appConfig.TbAddress.RFID : appConfig.TbAddress.RFID, 0);
plcBusiness.writePlc(position == 3 ? appConfig.TbAddress.MES : appConfig.TbAddress.MES, 0);
}
#region 这里进行MES操作
LogHelper.Info("调用MES首工序获取SFC接口");
LogRefreshEvent?.Invoke(LogType.MesLog, "调用MES首工序获取SFC接口");
LogRefreshEvent?.Invoke(LogType.RfidLog, "调用MES首工序获取SFC接口");
//调MES首工序获取SFC接口
MiFirstOperationForsfcServiceServiceParam miFirstOperationForsfcServiceServiceParam = new MiFirstOperationForsfcServiceServiceParam()
{
url = inifile.IniReadValue("MiFirstOperationForsfcServiceServiceParam", "url"),
site = inifile.IniReadValue("MiFirstOperationForsfcServiceServiceParam", "site"),
sfc = "",
processLot = epc,
operation = appConfig.operation,
operationRevision = inifile.IniReadValue("MiFirstOperationForsfcServiceServiceParam", "operationRevision"),
resource = appConfig.resource,
user = inifile.IniReadValue("MiFirstOperationForsfcServiceServiceParam", "user"),
activity = inifile.IniReadValue("MiFirstOperationForsfcServiceServiceParam", "activity"),
modeProcessSfc = inifile.IniReadValue("MiFirstOperationForsfcServiceServiceParam", "modeProcessSfc"),
loginUser = "",
password = "",
};
LogHelper.Info("MES首工序获取SFC接口请求参数" + JsonChange.ModeToJson(miFirstOperationForsfcServiceServiceParam));
miFirstOperationForsfcResponse firstOperationForsfcResponse = new miFirstOperationForsfcResponse();
if (appConfig.isMesFlag == 1)
{
DateTime beginTime = DateTime.Now;
try
{
firstOperationForsfcResponse = MesWebServices.iMiFirstOperationForsfcServiceService(miFirstOperationForsfcServiceServiceParam);
LogHelper.Info("MES首工序获取SFC接口返回参数" + JsonChange.ModeToJson(firstOperationForsfcResponse));
//判断返回结果
if (firstOperationForsfcResponse.@return.code > 0)
{
LogHelper.Info("MES首工序获取SFC接口请求失败" + firstOperationForsfcResponse.@return.message);
plcBusiness.writePlc(appConfig.TbAddress., 1);
plcBusiness.writePlc(appConfig.TbAddress.MES, firstOperationForsfcResponse.@return.code);
LogHelper.Info("MES首工序获取SFC接口调用失败" + firstOperationForsfcResponse.@return.message);
LogRefreshEvent?.Invoke(LogType.RfidLog, "MES首工序获取SFC接口调用失败");
LogRefreshEvent?.Invoke(LogType.MesLog, "MES首工序获取SFC接口调用失败" + upLoadBusiness.GetMesMessage(firstOperationForsfcResponse.@return.code, firstOperationForsfcResponse.@return.message));
LogRefreshEvent?.Invoke(LogType.AlarmLog, "MES首工序获取SFC接口调用失败" + upLoadBusiness.GetMesMessage(firstOperationForsfcResponse.@return.code, firstOperationForsfcResponse.@return.message));
LogRefreshEvent?.Invoke(LogType.PlcLog, "MES首工序获取SFC接口调用失败");
return;
}
sfc = firstOperationForsfcResponse.@return.sfc;
qty = firstOperationForsfcResponse.@return.qty;
LogRefreshEvent?.Invoke(LogType.RfidLog, String.Format("MES首工序获取SFC接口调用成功SFC{0}EA{1}", sfc, qty));
LogHelper.Info(String.Format("MES首工序获取SFC接口调用成功SFC{0}EA{1}", sfc, qty));
}
catch (Exception ex)
{
LogHelper.Info("调用MES首工序获取SFC接口异常" + ex.Message);
LogRefreshEvent?.Invoke(LogType.AlarmLog, "调用MES首工序获取SFC接口异常" + ex.Message);
LogRefreshEvent?.Invoke(LogType.MesLog, "调用MES首工序获取SFC接口异常" + ex.Message);
WebServiceLog.saveMiFirstOperationForsfcServiceService(miFirstOperationForsfcServiceServiceParam, null
, beginTime, ex.Message);
plcBusiness.writePlc(appConfig.TbAddress., 1);
plcBusiness.writePlc(appConfig.TbAddress.MES, 1);
return;
}
}
else
{
sfc = System.Guid.NewGuid().ToString("N").Substring(0, 14);
qty = "2000";
LogRefreshEvent?.Invoke(LogType.RfidLog, String.Format("MES首工序获取SFC接口调用成功SFC{0}EA{1}", sfc, qty));
}
#endregion
//向PLC写入SFC膜卷号
PlcBusiness.writeStrPlc(position == 3 ? appConfig.TbAddress.ASFC : appConfig.TbAddress.BSFC, sfc);
ViewModelRefreshEvent?.Invoke(new ViewModelDto()
{
rfidInfo = new RfidInfoDto()
{
rfid = epc,
sfc = sfc,
position = position,
ea = qty,
},
plcStatus = true,
});
//实时绑定卷轴与RFID信息
LogHelper.Info($"{logStr}绑定放卷轴与RFID:{epc};获取卷轴信息");
ProShaftInfo shaftInfo = await this.GetShaftInfoByPosition(position);
if (shaftInfo == null || StringExtension.IsBlank(shaftInfo.processId))
{
LogRefreshEvent?.Invoke(LogType.RfidLog, $"{logStr}绑定卷轴与RFID获取卷轴信息为空");
LogRefreshEvent?.Invoke(LogType.AlarmLog, $"{logStr}绑定卷轴与RFID获取卷轴信息为空");
LogHelper.Info($"{logStr}绑定卷轴与RFID获取卷轴信息为空");
return;
}
LogHelper.Info($"{logStr}获取卷轴信息为:" + JsonChange.ModeToJson(shaftInfo));
shaftInfo.bindRfid = epc;
shaftInfo.bindSfc = sfc;
shaftInfo.bindEaValue = qty;
shaftInfo.bindTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
await shaftInfoServices.Update(shaftInfo);
//本地保存SFC,上料记录
ProUpRecord upRecord = new ProUpRecord()
{
Id = System.Guid.NewGuid().ToString(),
MachineId = appConfig.machineId,
PositionId = position,
Rfid = epc,
Sfc = sfc,
eaValue = StringChange.ParseToInt(qty),
IsProduction = 0,
beginTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
RecordTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
};
await upRecordServices.Add(upRecord);
upLoadBusiness.SaveUpRecord(upRecord);
LogHelper.Info($"{logStr}放卷流程处理成功");
plcBusiness.writePlc(position == 3 ? appConfig.TbAddress.AOK : appConfig.TbAddress.BOK, 1);
}
catch (Exception ex)
{
LogHelper.Info($"{logStr}放卷流程MES逻辑处理异常:{ex.Message}");
plcBusiness.writePlc(position == 3 ? appConfig.TbAddress.RFID : appConfig.TbAddress.RFID, 1);
}
}
//end add
/// <summary>
/// 收卷位涨紧
/// </summary>
@ -617,6 +914,15 @@ namespace MaterialTraceability.Business.Impl
{
try
{
///放卷强制下料
if(position > 2)
{
string logstr = position == 3 ? "A放卷轴" : "B放卷轴";
LogRefreshEvent?.Invoke(LogType.PlcLog, $"{logstr}强制下料信号触发成功");
UpMaterialEnd(position);
plcBusiness.writePlc(appConfig.TbAddress., 0);
return;
}
string logStr = position == 1 ? "A轴" : "B轴";
@ -793,5 +1099,34 @@ namespace MaterialTraceability.Business.Impl
};
upLoadBusiness.SaveReadRecord(readRecord);
}
/// <summary>
/// 放卷位物料是否结束生产
/// </summary>
/// <param name="epc"></param>
private async Task<bool> UpMaterialIsEndProduction(string rfidStr)
{
bool result = false;
Expression<Func<ProUpRecord, bool>> exp = s1 => true;
exp = exp.And(x => x.Rfid == rfidStr);
Expression<Func<ProUpRecord, object>> order = s1 => s1.RecordTime;
ProUpRecord upRecord = await upRecordServices.QueryFirst(exp, order, false);
if (upRecord != null)
{
if (StringExtension.IsBlank(upRecord.endTime))
{
LogRefreshEvent?.Invoke(LogType.RfidLog, String.Format("当前SFC{0}放卷结束时间为空,生产未结束", rfidStr));
result = false;
}
else
{
LogRefreshEvent?.Invoke(LogType.RfidLog, String.Format("当前SFC{0}放卷结束时间为:{1}", rfidStr, upRecord.endTime));
result = true;
}
}
return result;
}
}
}

@ -72,7 +72,7 @@ namespace MaterialTraceability.Business
}
//PLC初始化
this.PLCInit();
this.PLCInit();
//初始化设备连接
this.EquipInit();

@ -178,6 +178,71 @@ namespace MaterialTraceability.Business
LogHelper.PlcLog("RFID系统写入心跳D9628");
Thread.Sleep(200);
// A放卷涨紧 A轴position设为3
if (plcInstance.readInt32ByAddress(appConfig.TbAddress.A) == 1)
{
LogHelper.PlcLog("B放卷涨紧");
plcInstance.writeInt32ByAddress(appConfig.TbAddress., 1);
plcInstance.writeInt32ByAddress(appConfig.TbAddress.A, 0);
SignalRefreshEvent?.Invoke(1, 3);
}
// B放卷涨紧 B轴position设为4
if (plcInstance.readInt32ByAddress(appConfig.TbAddress.B) == 1)
{
LogHelper.PlcLog("B放卷涨紧");
plcInstance.writeInt32ByAddress(appConfig.TbAddress.B, 0);
SignalRefreshEvent?.Invoke(1, 4);
}
// A放卷开始 A轴position设为3
if (plcInstance.readInt32ByAddress(appConfig.TbAddress.A) == 1)
{
LogHelper.PlcLog("B放卷开始");
plcInstance.writeInt32ByAddress(appConfig.TbAddress.A, 0);
SignalRefreshEvent?.Invoke(6, 3);
}
// B放卷开始 B轴position设为4
if (plcInstance.readInt32ByAddress(appConfig.TbAddress.B) == 1)
{
LogHelper.PlcLog("B放卷开始");
plcInstance.writeInt32ByAddress(appConfig.TbAddress.B, 0);
SignalRefreshEvent?.Invoke(6, 4);
}
// A放卷结束 A轴position设为3
if (plcInstance.readInt32ByAddress(appConfig.TbAddress.A) == 1)
{
LogHelper.PlcLog("B放卷结束");
plcInstance.writeInt32ByAddress(appConfig.TbAddress.A, 0);
SignalRefreshEvent?.Invoke(2, 3);
}
// B放卷结束 B轴position设为4
if (plcInstance.readInt32ByAddress(appConfig.TbAddress.B) == 1)
{
LogHelper.PlcLog("B放卷结束");
plcInstance.writeInt32ByAddress(appConfig.TbAddress.B, 0);
SignalRefreshEvent?.Invoke(2, 4);
}
//A轴放卷强制下料
if (plcInstance.readInt32ByAddress(appConfig.TbAddress.) == 1)
{
LogHelper.PlcLog("A轴放卷强制下料");
plcInstance.writeInt32ByAddress(appConfig.TbAddress., 0);
SignalRefreshEvent?.Invoke(5, 3);
}
//B轴放卷强制下料
if (plcInstance.readInt32ByAddress(appConfig.TbAddress.) == 2)
{
LogHelper.PlcLog("B轴放卷强制下料");
plcInstance.writeInt32ByAddress(appConfig.TbAddress., 0);
SignalRefreshEvent?.Invoke(5, 4);
}
// A轴收卷涨紧 A轴position设为1
if (plcInstance.readInt32ByAddress(appConfig.TbAddress.A) == 1)
{

@ -60,5 +60,25 @@ namespace MaterialTraceability.Entity.Config
public string = iNIFile.IniReadValue("TBPLcAddress", "收卷轴米数");
public string A = iNIFile.IniReadValue("TBPLcAddress", "A放卷涨紧");
public string B = iNIFile.IniReadValue("TBPLcAddress", "B放卷涨紧");
public string A = iNIFile.IniReadValue("TBPLcAddress", "A放卷开始");
public string B = iNIFile.IniReadValue("TBPLcAddress", "B放卷开始");
public string A = iNIFile.IniReadValue("TBPLcAddress", "A放卷结束");
public string B = iNIFile.IniReadValue("TBPLcAddress", "B放卷结束");
public string ARFID = iNIFile.IniReadValue("TBPLcAddress", "A放卷RFID");
public string BRFID = iNIFile.IniReadValue("TBPLcAddress", "B放卷RFID");
public string ASFC = iNIFile.IniReadValue("TBPLcAddress", "A放卷SFC");
public string BSFC = iNIFile.IniReadValue("TBPLcAddress", "B放卷SFC");
public string AOK = iNIFile.IniReadValue("TBPLcAddress", "A放卷OK");
public string BOK = iNIFile.IniReadValue("TBPLcAddress", "B放卷OK");
public string RFID = iNIFile.IniReadValue("TBPLcAddress", "放卷RFID异常");
public string MES = iNIFile.IniReadValue("TBPLcAddress", "放卷MES异常");
public string = iNIFile.IniReadValue("TBPLcAddress", "放卷气胀泄气");
public string = iNIFile.IniReadValue("TBPLcAddress", "放卷控制下料");
public string = iNIFile.IniReadValue("TBPLcAddress", "放卷强制下料");
}
}

@ -9,9 +9,9 @@
<add key="connectionString" value="Data Source=172.21.29.56;Port=6066;Initial Catalog=ry;uid=root; pwd=root" />
<!--涂布1冷压11双数模切机台号3单数模切机台号4-->
<add key="MachineID" value="11" />
<add key="MachineID" value="1" />
<!--涂布TB冷压LY_A模切MQ_A-->
<add key="ProcessID" value="LY_A" />
<add key="ProcessID" value="TB" />
<!--设备资产编号参考公共盘设备资源表对应设备-->
<add key="resource" value="COLDA02A" />
<!--涂布ANNOC1冷压ANCAP1模切ANEFS1-->

@ -11,53 +11,36 @@
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="70*"/>
<RowDefinition Height="50*"/>
<RowDefinition Height="40*"/>
</Grid.RowDefinitions>
<StackPanel Margin="0,5,0,0" Width="890" Orientation="Horizontal" HorizontalAlignment="Left">
<StackPanel Margin="0,5,0,0" Width="920" Orientation="Horizontal" HorizontalAlignment="Left">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition Height="100"/>
<RowDefinition Height="100"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="0.9*"/>
<RowDefinition Height="0.9*"/>
</Grid.RowDefinitions>
<UniformGrid Columns="5" Grid.Row="1" Margin="0,5" Width="730" Height="100">
<Border x:Name="CancelSfc" BorderThickness="1,1,1,1" BorderBrush="#DBE6FA" Background="#F0F7FF" Height="50" CornerRadius="5" Margin="5,0" Width="100">
<StackPanel Margin="5,5" VerticalAlignment="Center">
<TextBlock x:Name="CancelSfcText" Text="工单下达" FontSize="15" Foreground="#666867" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</StackPanel>
</Border>
<Border BorderThickness="0" BorderBrush="#DBE6FA" Background="#F0F7FF" Height="50" CornerRadius="5" Margin="5,0" Width="50">
<StackPanel Margin="5,5" VerticalAlignment="Center">
<TextBlock Text="=>" FontSize="15" Foreground="#666867" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</StackPanel>
</Border>
<Border x:Name="BeginAdjustNumberByA" BorderThickness="1,1,1,1" BorderBrush="#DBE6FA" Background="#F0F7FF" Height="50" CornerRadius="5" Margin="5,0" Width="125">
<StackPanel Margin="5,5" VerticalAlignment="Center">
<TextBlock x:Name="BeginAdjustNumberByAText" Text="开始调整" FontSize="15" Foreground="#666867" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock x:Name="BeginAdjustNumberByATexts" Text="A面数量" FontSize="15" Foreground="#666867" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</StackPanel>
</Border>
<Border BorderThickness="0" BorderBrush="#DBE6FA" Background="#F0F7FF" Height="50" CornerRadius="5" Margin="5,0" Width="50">
<StackPanel Margin="5,5" VerticalAlignment="Center">
<TextBlock Text="=>" FontSize="15" Foreground="#666867" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<UniformGrid Columns="4" Grid.Row="0" Margin="0,0">
<Border BorderThickness="1,1,1,1" BorderBrush="#DBE6FA" Background="#F0F7FF" CornerRadius="5" Margin="5,0" Width="220" MouseDown="FJ_A_MouseDown">
<StackPanel Margin="5,5">
<TextBlock Text="放卷位" FontSize="15" Foreground="#666867" HorizontalAlignment="Center"/>
<TextBlock x:Name="SFC_Position1" Text="SFC" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2"/>
<TextBlock x:Name="RFID_Position1" Text="RFID" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2"/>
<TextBlock x:Name="EA_Position1" Text="EA" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2"/>
</StackPanel>
</Border>
<Border BorderThickness="1,1,1,1" HorizontalAlignment="Center" BorderBrush="#DBE6FA" Background="#F0F7FF" Height="50" CornerRadius="5" Margin="1,0" Width="125">
<StackPanel x:Name="CollectA" Margin="5,5" VerticalAlignment="Center" >
<RadioButton Width="123" Height="50" Style="{StaticResource NavRadioButtonStyle}" FontSize="15" Foreground="#666867" IsChecked="True" VerticalAlignment="Center" RenderTransformOrigin="0.502,0.5" Click="Btn_Click_A">
<StackPanel VerticalAlignment="Center">
<TextBlock x:Name="ADataCollect" Text="A面数据采集" FontSize="15" Foreground="#666867" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock x:Name="ADataCollect2" Text="A面物料消耗" FontSize="15" Foreground="#666867" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</StackPanel>
</RadioButton>
<Border BorderThickness="1,1,1,1" BorderBrush="#DBE6FA" Background="#F0F7FF" CornerRadius="5" Margin="5,0" Width="220" MouseDown="FJ_B_MouseDown">
<StackPanel Margin="5,5">
<TextBlock Text="放卷位" FontSize="15" Foreground="#666867" HorizontalAlignment="Center"/>
<TextBlock x:Name="SFC_Position2" Text="SFC" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2"/>
<TextBlock x:Name="RFID_Position2" Text="RFID" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2"/>
<TextBlock x:Name="EA_Position2" Text="EA" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2"/>
</StackPanel>
</Border>
</UniformGrid>
<UniformGrid Columns="4" Margin="0,5">
<Border BorderThickness="1,1,1,1" BorderBrush="#DBE6FA" Background="#F0F7FF" CornerRadius="5" Margin="5,0" Width="220" MouseDown="Border_MouseDown">
<StackPanel Margin="5,5">
<TextBlock Text="A轴收卷位" FontSize="15" Foreground="#666867" HorizontalAlignment="Center"/>
@ -75,14 +58,16 @@
<TextBlock x:Name="EA_Finish" Text="EA" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2"/>
</StackPanel>
</Border>
</UniformGrid>
<Border Background="#F0F7FF" Height="90" CornerRadius="5" Margin="5,0" Width="150">
<UniformGrid Columns="4" Grid.Row="1" Margin="0,0">
<Border Background="#F0F7FF" Height="90" CornerRadius="5" Margin="15,5,0,0" Width="150">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="35"/>
<RowDefinition Height="55"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<StackPanel Grid.Row="0" >
<TextBlock Text="结束流程SFC" FontSize="14" Foreground="#666867" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock x:Name="EndSfc" Text="" FontSize="14" Foreground="#666867" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</StackPanel>
@ -118,14 +103,47 @@
</StackPanel>
</Grid>
</Border>
</UniformGrid>
<UniformGrid Columns="5" Grid.Row="2" Margin="0,5" Width="730">
<Border x:Name="CancelSfc" BorderThickness="1,1,1,1" BorderBrush="#DBE6FA" Background="#F0F7FF" Height="50" CornerRadius="5" Margin="5,0" Width="100">
<StackPanel Margin="5,5" VerticalAlignment="Center">
<TextBlock x:Name="CancelSfcText" Text="工单下达" FontSize="15" Foreground="#666867" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</StackPanel>
</Border>
<Border BorderThickness="0" BorderBrush="#DBE6FA" Background="#F0F7FF" Height="50" CornerRadius="5" Margin="5,0" Width="50">
<StackPanel Margin="5,5" VerticalAlignment="Center">
<TextBlock Text="=>" FontSize="15" Foreground="#666867" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</StackPanel>
</Border>
<!--<StackPanel Margin="5,5" VerticalAlignment="Center">
<TextBlock Text="结束流程SFC" FontSize="15" Foreground="#666867" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock x:Name="EndSfc" Text="" FontSize="15" Foreground="#666867" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</StackPanel>-->
<Border x:Name="BeginAdjustNumberByA" BorderThickness="1,1,1,1" BorderBrush="#DBE6FA" Background="#F0F7FF" Height="50" CornerRadius="5" Margin="5,0" Width="125">
<StackPanel Margin="5,5" VerticalAlignment="Center">
<TextBlock x:Name="BeginAdjustNumberByAText" Text="开始调整" FontSize="15" Foreground="#666867" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock x:Name="BeginAdjustNumberByATexts" Text="A面数量" FontSize="15" Foreground="#666867" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</StackPanel>
</Border>
<Border BorderThickness="0" BorderBrush="#DBE6FA" Background="#F0F7FF" Height="50" CornerRadius="5" Margin="5,0" Width="50">
<StackPanel Margin="5,5" VerticalAlignment="Center">
<TextBlock Text="=>" FontSize="15" Foreground="#666867" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</StackPanel>
</Border>
<Border BorderThickness="1,1,1,1" HorizontalAlignment="Center" BorderBrush="#DBE6FA" Background="#F0F7FF" Height="50" CornerRadius="5" Margin="1,0" Width="125">
<StackPanel x:Name="CollectA" Margin="5,5" VerticalAlignment="Center" >
<RadioButton Width="123" Height="50" Style="{StaticResource NavRadioButtonStyle}" FontSize="15" Foreground="#666867" IsChecked="True" VerticalAlignment="Center" RenderTransformOrigin="0.502,0.5" Click="Btn_Click_A">
<StackPanel VerticalAlignment="Center">
<TextBlock x:Name="ADataCollect" Text="A面数据采集" FontSize="15" Foreground="#666867" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock x:Name="ADataCollect2" Text="A面物料消耗" FontSize="15" Foreground="#666867" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</StackPanel>
</RadioButton>
</StackPanel>
</Border>
</UniformGrid>
<UniformGrid Columns="5" Grid.Row="2" Margin="0,5" Width="730" Height="100">
<UniformGrid Columns="5" Grid.Row="3" Margin="0,0" Width="730" >
<Border x:Name="EndAdjustNumberByA" BorderThickness="1,1,1,1" BorderBrush="#DBE6FA" Background="#F0F7FF" Height="50" CornerRadius="5" Margin="5,0" Width="125">
<StackPanel Margin="5,5" VerticalAlignment="Center">
<TextBlock x:Name="BeginBdjustNumberByBText2" Text="A面调整完成" FontSize="15" Foreground="#666867" HorizontalAlignment="Center" VerticalAlignment="Center"/>
@ -208,74 +226,6 @@
</Grid>
</StackPanel>
<!--<StackPanel Grid.Row="1" Height="200" Width="250" Background="White" Margin="0,5,0,10" Orientation="Horizontal" HorizontalAlignment="Left" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="170"/>
</Grid.RowDefinitions>
<StackPanel Margin="0,0,0,0" Width="250" Orientation="Horizontal" HorizontalAlignment="Left" Background="#007dfa">
<RadioButton Content="设备状态" Margin="5,0" Style="{StaticResource NavRadioButtonStyle}" FontSize="15" Foreground="White" IsChecked="True" VerticalAlignment="Center" CommandParameter="MesLogControl" Command="{Binding LogChangeContentCommand}"/>
</StackPanel>
<StackPanel Grid.Row="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="309*"/>
<ColumnDefinition Width="41*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<UniformGrid Columns="1" Margin="25,5,0,0" Grid.ColumnSpan="2"/>
<UniformGrid Columns="1" Grid.Row="1" Margin="25,5,0,0" Grid.ColumnSpan="2">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<Border Width="30" Height="30" CornerRadius="15">
<Border.Background>
<ImageBrush x:Name="EquipStatusImage" ImageSource="Assets/Images/失败-01.png"/>
</Border.Background>
</Border>
<TextBlock x:Name="TestTC" Text="连接失败" VerticalAlignment="Center" FontSize="15" Margin="10,0"/>
</StackPanel>
</UniformGrid>
</Grid>
</StackPanel>
</Grid>
</StackPanel>
<StackPanel Grid.Row="1" Height="200" Width="465" Background="White" Margin="0,5,150,10" HorizontalAlignment="Center">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="170"/>
</Grid.RowDefinitions>
<StackPanel Margin="0,0,0,0" Width="465" Orientation="Horizontal" HorizontalAlignment="Left" Background="#007dfa">
<RadioButton Content="RFID日志" Margin="5,0" Style="{StaticResource NavRadioButtonStyle}" FontSize="15" Foreground="White" IsChecked="True" VerticalAlignment="Center" CommandParameter="MesLogControl" Command="{Binding LogChangeContentCommand}"/>
</StackPanel>
<StackPanel Grid.Row="1">
<ListBox x:Name="RfidLog" FontSize="12" Foreground="Gray" HorizontalAlignment="Left" Height="150" VerticalAlignment="Center" Width="465" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="0"></ListBox>
</StackPanel>
</Grid>
</StackPanel>
<StackPanel Grid.Row="1" Height="200" Width="400" Background="White" Margin="0,5,0,10" HorizontalAlignment="Right">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="170"/>
</Grid.RowDefinitions>
<StackPanel Margin="0,0,0,0" Width="400" Orientation="Horizontal" HorizontalAlignment="Left" Background="#007dfa">
<RadioButton Content="报警日志" Margin="5,0" Style="{StaticResource NavRadioButtonStyle}" FontSize="15" Foreground="White" IsChecked="True" VerticalAlignment="Center" CommandParameter="MesLogControl" Command="{Binding LogChangeContentCommand}"/>
</StackPanel>
<StackPanel Grid.Row="1">
<ListBox x:Name="AlarmLog" FontSize="12" Foreground="Red" HorizontalAlignment="Left" Height="150" VerticalAlignment="Center" Width="400" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="0"/>
</StackPanel>
</Grid>
</StackPanel>-->
<StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Bottom">
<Grid>
<Grid.ColumnDefinitions>
@ -293,28 +243,24 @@
<RadioButton Content="设备状态" Margin="5,0" Style="{StaticResource NavRadioButtonStyle}" FontSize="15" Foreground="White" IsChecked="True" VerticalAlignment="Center" CommandParameter="MesLogControl" Command="{Binding LogChangeContentCommand}"/>
</StackPanel>
<StackPanel Grid.Row="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="309*"/>
<ColumnDefinition Width="41*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<UniformGrid Columns="1" Margin="25,5,0,0" Grid.ColumnSpan="2"/>
<UniformGrid Columns="1" Grid.Row="1" Margin="25,5,0,0" Grid.ColumnSpan="2">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<Border Width="30" Height="30" CornerRadius="15">
<Border.Background>
<ImageBrush x:Name="EquipStatusImage" ImageSource="Assets/Images/失败-01.png"/>
</Border.Background>
</Border>
<TextBlock x:Name="TestTC" Text="连接失败" VerticalAlignment="Center" FontSize="15" Margin="10,0"/>
</StackPanel>
</UniformGrid>
</Grid>
<StackPanel Grid.Row="1" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<Border Width="30" Height="30" CornerRadius="15">
<Border.Background>
<ImageBrush x:Name="EquipStatusImage2" ImageSource="Assets/Images/失败-01.png"/>
</Border.Background>
</Border>
<TextBlock x:Name="TestTC2" Text="连接失败" VerticalAlignment="Center" FontSize="15" Margin="10,0"/>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,10,0,0">
<Border Width="30" Height="30" CornerRadius="15">
<Border.Background>
<ImageBrush x:Name="EquipStatusImage" ImageSource="Assets/Images/失败-01.png"/>
</Border.Background>
</Border>
<TextBlock x:Name="TestTC" Text="连接失败" VerticalAlignment="Center" FontSize="15" Margin="10,0"/>
</StackPanel>
</StackPanel>
</Grid>
</StackPanel>

@ -135,6 +135,34 @@ namespace MaterialTraceabilityUI
EA_Finish.Dispatcher.BeginInvoke(action);
}
else if (viewModelDto.rfidInfo.position == 3)
{
action = () =>
{
this.RFID_Position1.Text = "RFID:" + viewModelDto.rfidInfo.rfid;
};
RFID_Position1.Dispatcher.BeginInvoke(action);
action = () =>
{
this.EA_Position1.Text = "EA:";
};
EA_Position1.Dispatcher.BeginInvoke(action);
}
else if (viewModelDto.rfidInfo.position == 4)
{
action = () =>
{
this.RFID_Position2.Text = "RFID:" + viewModelDto.rfidInfo.rfid;
};
RFID_Position2.Dispatcher.BeginInvoke(action);
action = () =>
{
this.EA_Position2.Text = "EA:";
};
EA_Position2.Dispatcher.BeginInvoke(action);
}
}
if (!String.IsNullOrEmpty(viewModelDto.rfidInfo.sfc))
@ -157,6 +185,24 @@ namespace MaterialTraceabilityUI
SFC_Finish.Dispatcher.BeginInvoke(action);
}
else if (viewModelDto.rfidInfo.position == 4)
{
action = () =>
{
this.SFC_Position1.Text = "SFC:" + viewModelDto.rfidInfo.sfc;
};
SFC_Position1.Dispatcher.BeginInvoke(action);
}
else if (viewModelDto.rfidInfo.position == 4)
{
action = () =>
{
this.SFC_Position2.Text = "SFC:" + viewModelDto.rfidInfo.sfc;
};
SFC_Position2.Dispatcher.BeginInvoke(action);
}
}
}
}
@ -184,45 +230,76 @@ namespace MaterialTraceabilityUI
{
var info = equipBusiness.Equiplist.FirstOrDefault();
Action action;
var infos = equipBusiness.Equiplist;
if (info != null)
if(infos != null)
{
if (info.IsConnect)
foreach(var item in infos)
{
action = () =>
App.Current.Dispatcher.Invoke(() =>
{
this.TestTC.Text = "收卷位设备连接成功";
this.TestTC.Foreground = Brushes.Green;
};
TestTC.Dispatcher.BeginInvoke(action);
action = () =>
{
string imageUrl = "pack://application:,,,/MaterialTraceabilityUI;component/Assets/Images/正常.png";
BitmapImage bitmapImage = new BitmapImage(new Uri(imageUrl));
this.EquipStatusImage.ImageSource = bitmapImage;
};
EquipStatusImage.Dispatcher.BeginInvoke(action);
}
else
{
action = () =>
{
this.TestTC.Text = "收卷位设备连接失败";
this.TestTC.Foreground = Brushes.Red;
};
TestTC.Dispatcher.BeginInvoke(action);
if (item.equipName.Contains("收卷"))
{
this.TestTC.Text = $"收卷位设备连接{(item.IsConnect ? "" : "")}";
this.TestTC.Foreground = item.IsConnect ? Brushes.Green : Brushes.Red;
action = () =>
{
string imageUrl = "pack://application:,,,/MaterialTraceabilityUI;component/Assets/Images/失败-01.png";
BitmapImage bitmapImage = new BitmapImage(new Uri(imageUrl));
this.EquipStatusImage.ImageSource = bitmapImage;
};
EquipStatusImage.Dispatcher.BeginInvoke(action);
string imageUrl = $"pack://application:,,,/MaterialTraceabilityUI;component/Assets/Images/{(item.IsConnect ? "" : "-01")}.png";
BitmapImage bitmapImage = new BitmapImage(new Uri(imageUrl));
this.EquipStatusImage.ImageSource = bitmapImage;
}
else
{
this.TestTC2.Text = $"放卷位设备连接{(item.IsConnect ? "" : "")}";
this.TestTC2.Foreground = item.IsConnect ? Brushes.Green : Brushes.Red;
string imageUrl = $"pack://application:,,,/MaterialTraceabilityUI;component/Assets/Images/{(item.IsConnect ? "" : "-01")}.png";
BitmapImage bitmapImage = new BitmapImage(new Uri(imageUrl));
this.EquipStatusImage2.ImageSource = bitmapImage;
}
});
}
}
//Action action;
//if (info != null)
//{
// if (info.IsConnect)
// {
// action = () =>
// {
// this.TestTC.Text = "收卷位设备连接成功";
// this.TestTC.Foreground = Brushes.Green;
// };
// TestTC.Dispatcher.BeginInvoke(action);
// action = () =>
// {
// string imageUrl = "pack://application:,,,/MaterialTraceabilityUI;component/Assets/Images/正常.png";
// BitmapImage bitmapImage = new BitmapImage(new Uri(imageUrl));
// this.EquipStatusImage.ImageSource = bitmapImage;
// };
// EquipStatusImage.Dispatcher.BeginInvoke(action);
// }
// else
// {
// action = () =>
// {
// this.TestTC.Text = "收卷位设备连接失败";
// this.TestTC.Foreground = Brushes.Red;
// };
// TestTC.Dispatcher.BeginInvoke(action);
// action = () =>
// {
// string imageUrl = "pack://application:,,,/MaterialTraceabilityUI;component/Assets/Images/失败-01.png";
// BitmapImage bitmapImage = new BitmapImage(new Uri(imageUrl));
// this.EquipStatusImage.ImageSource = bitmapImage;
// };
// EquipStatusImage.Dispatcher.BeginInvoke(action);
// }
//}
}
/// <summary>
@ -1487,6 +1564,33 @@ namespace MaterialTraceabilityUI
};
SFC_Finish.Dispatcher.BeginInvoke(action);
break;
case 3:
action = () =>
{
this.RFID_Position1.Text = "RFID:" + shaftInfo.bindRfid;
};
RFID_Position1.Dispatcher.BeginInvoke(action);
action = () =>
{
this.SFC_Position1.Text = "SFC:" + shaftInfo.bindSfc;
};
SFC_Position1.Dispatcher.BeginInvoke(action);
break;
case 4:
action = () =>
{
this.RFID_Position2.Text = "RFID:" + shaftInfo.bindRfid;
};
RFID_Position2.Dispatcher.BeginInvoke(action);
action = () =>
{
this.SFC_Position2.Text = "SFC:" + shaftInfo.bindSfc;
};
SFC_Position2.Dispatcher.BeginInvoke(action);
break;
default:
break;
}
@ -1648,5 +1752,22 @@ namespace MaterialTraceabilityUI
}
}
private void FJ_A_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
WriteInfo write = new WriteInfo("TB", 3);
write.ShowDialog();
RefreshMaterialInfo("TB", "3");
}
private void FJ_B_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
WriteInfo write = new WriteInfo("TB", 4);
write.ShowDialog();
RefreshMaterialInfo("TB", "4");
}
}
}

@ -73,7 +73,14 @@ namespace MaterialTraceabilityUI
if(processId == "TB")
{
tBSignalRead.MesBegin(position,rfidCode,false);
if(position < 3)
{
tBSignalRead.MesBegin(position, rfidCode, false);
}
else
{
tBSignalRead.FJMesBegin(position, rfidCode, false);
}
MessageBox.Show("涂布RFID条码信息写入成功");
}else if(processId == "MQ_A")
{

Loading…
Cancel
Save