涂布工序修改mes接口查库

master
CaesarBao 3 months ago
parent e49aa25f69
commit e8a2398fb8

@ -717,7 +717,14 @@ namespace MaterialTraceability.Business
//DbHandler db = new DbHandler();
int machineId = appConfig.machineId;
Expression<Func<ProEquip, bool>> expression = s1 => true;
expression = expression.And(x => x.machineId == machineId);
if (appConfig.machineId == 1)
{
expression = expression.And(x => x.machineId == machineId && x.equipName.Contains("收卷"));
}
else
{
expression = expression.And(x => x.machineId == machineId);
}
_equipList = await equipServices.Query(expression);
foreach (var equip in _equipList)

@ -364,10 +364,10 @@ namespace MaterialTraceability.Business.Impl
#endregion
try
{
LogRefreshEvent?.Invoke(LogType.PlcLog, "模切" + logStr + "位放卷结束信号触发成功");
LogRefreshEvent?.Invoke(LogType.RfidLog, "模切" + logStr + "位放卷结束信号触发成功");
LogRefreshEvent?.Invoke(LogType.PlcLog, logStr + "位放卷结束信号触发成功");
LogRefreshEvent?.Invoke(LogType.RfidLog, logStr + "位放卷结束信号触发成功");
//upLoadBusiness.SaveLogRecord(position, logStr + "位放卷结束信号触发成功");
LogHelper.Info("模切" + logStr + "位结束信号触发成功");
LogHelper.Info(logStr + "位结束信号触发成功");
ProShaftInfo shaftInfo = await this.GetShaftInfoByPosition(position);
if (shaftInfo == null)
{
@ -431,7 +431,7 @@ namespace MaterialTraceability.Business.Impl
#endregion
try
{
LogRefreshEvent?.Invoke(LogType.PlcLog, logStr + "轴涨紧触发成功");
LogRefreshEvent?.Invoke(LogType.PlcLog, logStr + "轴涨紧信号触发成功");
LogRefreshEvent?.Invoke(LogType.RfidLog, String.Format("开始读取{0}轴卷筒RFID物料信息", logStr));
//读取卷筒RFID物料信息
@ -458,7 +458,7 @@ namespace MaterialTraceability.Business.Impl
epc = epc.Replace("\0", "").Trim();
if (StringExtension.IsBlank(epc) || epc.Length != 14 || !epc.Contains("JSLY") || !epc.Contains("CATT"))
if (StringExtension.IsBlank(epc) || epc.Length != 14 && !epc.Contains("JSLY") && !epc.Contains("CATT"))
{
LogHelper.Info(String.Format("{0}轴设备:{1};读取失败", logStr, proEquip.equipIp));
AngrilyResultSendToPlc(position, 2, 0);//收卷位报警
@ -728,7 +728,7 @@ namespace MaterialTraceability.Business.Impl
if (await spiltPreventDaze(position, shaftInfo))
{
writeError(position, 2);
LogRefreshEvent?.Invoke(LogType.AlarmLog, string.Format("{0}拆分异常,不允许直接拆分下收卷轴", logStr));
LogRefreshEvent?.Invoke(LogType.AlarmLog, string.Format("{0}拆分异常,不允许直接拆分下收卷轴,先拆分上轴再执行下轴拆分", logStr));
LogRefreshEvent?.Invoke(LogType.RfidLog, string.Format("{0}拆分异常,不允许直接拆分下收卷轴,先拆分上轴再执行下轴拆分", logStr));
}
else
@ -940,7 +940,7 @@ namespace MaterialTraceability.Business.Impl
#endregion
#region MES入账开始接口
LogRefreshEvent?.Invoke(LogType.MesLog, logStr + "MES入账开始接口");
LogRefreshEvent?.Invoke(LogType.MesLog, logStr + "c");
if (!SFCBegin(shaftInfo))
{
writeError(position, 2);
@ -1393,8 +1393,8 @@ namespace MaterialTraceability.Business.Impl
if (shaftInfo == null)
{
LogRefreshEvent?.Invoke(LogType.RfidLog, "绑定卷轴与物料信息,获取卷轴信息为空");
LogRefreshEvent?.Invoke(LogType.AlarmLog, "绑定卷轴与物料信息,获取卷轴信息为空");
LogRefreshEvent?.Invoke(LogType.RfidLog, "绑定卷轴与RFID,获取卷轴信息为空");
LogRefreshEvent?.Invoke(LogType.AlarmLog, "绑定卷轴与RFID,获取卷轴信息为空");
LogHelper.Info("绑定卷轴与物料信息,获取卷轴信息为空");
return;
}

@ -26,6 +26,8 @@ namespace MaterialTraceability.Business.Impl
{
// INIFile配置文件
private INIFile inifile = new INIFile(System.Environment.CurrentDirectory + "/MesConfig/App.InI");
private INIFile appinifile = new INIFile(System.Environment.CurrentDirectory + "/App.InI");
/// <summary>
/// 日志刷新
/// </summary>
@ -102,7 +104,7 @@ namespace MaterialTraceability.Business.Impl
private UpLoadBusiness upLoadBusiness = UpLoadBusiness.Instance;
private AppConfigDto appConfig = AppConfigDto.Instance;
string ran = "";
/// <summary>
/// 放卷位涨紧
/// </summary>
@ -206,12 +208,16 @@ namespace MaterialTraceability.Business.Impl
string epc = equipBusiness.ReadEPCByAntana(proEquip.equipId);
//string epc = System.Guid.NewGuid().ToString("N").Substring(0,14);
epc = epc.Replace("\0", "").Trim();
//if (epc == "" || epc == null)
//{
// Random random = new Random();
// epc = "JSLY3RDC005400";
//}
if (epc == "" || epc == null)
{
//Random random = new Random();
if (!string.IsNullOrEmpty(appinifile.IniReadValue("SystemConfig", "RFIDnum")))
{
ran = appinifile.IniReadValue("SystemConfig", "RFIDnum");
ran = ran.PadLeft(6, '0');
epc = "CATT1RDA" + ran;
}
}
//20231028新增读取到上一次相同标签报警泄气
bool iFlag = await GetSameRFIDInfo(position, epc);
@ -249,7 +255,7 @@ namespace MaterialTraceability.Business.Impl
});
return;
}
if (StringExtension.IsBlank(epc) || !epc.Contains("JSLY") || !epc.Contains("CATT"))
if (StringExtension.IsBlank(epc) || (!epc.Contains("JSLY") && !epc.Contains("CATT") && !epc.Contains("YBC")))
{
//读取失败控制PLC气胀轴
@ -376,7 +382,7 @@ namespace MaterialTraceability.Business.Impl
//site = "2100",
url = inifile.IniReadValue("ProcessLotServiceWSServiceParam", "url"),
site = inifile.IniReadValue("ProcessLotServiceWSServiceParam", "site"),
processlotref = String.Format("ProcessLotBO:2100,{0}", rfidStr),
processlotref = String.Format("ProcessLotBO:2400,{0}", rfidStr),
loginUser = inifile.IniReadValue("ProcessLotServiceWSServiceParam", "loginUser"),
password = inifile.IniReadValue("ProcessLotServiceWSServiceParam", "password"),
};
@ -418,8 +424,8 @@ namespace MaterialTraceability.Business.Impl
{
url = inifile.IniReadValue("ProcessLotServiceWSServiceParam", "url"),
site = inifile.IniReadValue("ProcessLotServiceWSServiceParam", "site"),
processlotref = "ProcessLotBO:2100," + rfidStr,
memberlist = new string[] { "SFCBO:2100," + sfcStr },
processlotref = "ProcessLotBO:2400," + rfidStr,
memberlist = new string[] { "SFCBO:2400," + sfcStr },
loginUser = inifile.IniReadValue("ProcessLotServiceWSServiceParam", "loginUser"),
password = inifile.IniReadValue("ProcessLotServiceWSServiceParam", "password"),
@ -501,14 +507,14 @@ namespace MaterialTraceability.Business.Impl
return;
}
if (sfc.Substring(0, 1) != "L")
{
sfc = GetSFC(position);
if (StringExtension.IsBlank(sfc))
{
return;
}
}
//if (sfc.Substring(0, 1) != "L")
//{
// sfc = GetSFC(position);
// if (StringExtension.IsBlank(sfc))
// {
// return;
// }
//}
#endregion
LogHelper.Info("涂布工单下达接口调用成功SFC膜卷号为" + sfc);
@ -516,6 +522,10 @@ namespace MaterialTraceability.Business.Impl
GetSFCByMesEvent?.Invoke(true, sfc);
WriteSfcAndEpc(position, sfc, epc);
if (!string.IsNullOrEmpty(appinifile.IniReadValue("SystemConfig", "RFIDnum")))
{
appinifile.IniWriteValue("SystemConfig", "RFIDnum", int.Parse(appinifile.IniReadValue("SystemConfig", "RFIDnum") + 1).ToString());
}
ViewModelRefreshEvent?.Invoke(new ViewModelDto()
{
@ -570,6 +580,7 @@ namespace MaterialTraceability.Business.Impl
};
await downRecordServices.Add(downRecord);
//upLoadBusiness.SaveDownRecord(downRecord);
}
catch (Exception e)
@ -706,7 +717,7 @@ namespace MaterialTraceability.Business.Impl
{
url = inifile.IniReadValue("FindShopRequestParam","url"),
site = inifile.IniReadValue("FindShopRequestParam", "site"),
shopOrder = String.Format("ShopOrderBO:2100,{0}", shopOrderStr),
shopOrder = String.Format("ShopOrderBO:2400,{0}", shopOrderStr),
loginUser = inifile.IniReadValue("FindShopRequestParam", "loginUser"),
password = inifile.IniReadValue("FindShopRequestParam", "password"),
};

@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MaterialTraceability.Business
{
public class LanguageHelper
{
public static string language { get; set; }
public static string ShowMessage(string Message)
{
string Result = Message;
switch (language)
{
case "de-DE":
if (Message == "PLC连接失败")
{
Result = "PLC Connect Fail";
}
if (Message == "PLC断开重新建立连接")
{
Result = "PLC Connect Fail,Reconnect...";
}
break;
case "en-US":
if (Message == "PLC连接失败")
{
Result = "PLC Connect Fail";
}
if (Message == "PLC断开重新建立连接")
{
Result = "PLC Connect Fail,Reconnect...";
}
if (Message == "PLC断开重新连接失败")
{
Result = "PLC Connect Fail,Reconnect Fail";
}
break;
case "pl-PL":
break;
case "zh-cn":
break;
default:
break;
}
return Result;
}
}
}

@ -8,6 +8,9 @@ using MaterialTraceability.SqlSugar;
using MaterialTraceability.SqlSugar.ServiceImpl;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Threading;
using static System.Net.Mime.MediaTypeNames;
namespace MaterialTraceability.Business
{
@ -157,7 +160,15 @@ namespace MaterialTraceability.Business
}
if (plcBusiness.Connect())
{
LogRefreshEvent?.Invoke(LogType.PlcLog, "PLC连接成功");
if(LanguageHelper.language == "en-us")
{
LogRefreshEvent?.Invoke(LogType.PlcLog, "PLC Connect Success");
}
else
{
LogRefreshEvent?.Invoke(LogType.PlcLog, "PLC连接成功");
}
viewModel.plcStatus = true;
switch (appConfig.processId)
@ -197,6 +208,7 @@ namespace MaterialTraceability.Business
{
LogRefreshEvent?.Invoke(LogType.PlcLog, "PLC连接失败");
LogRefreshEvent?.Invoke(LogType.AlarmLog, "PLC连接失败");
viewModel.plcStatus = false;
}
ViewModelRefreshEvent?.Invoke(viewModel);
@ -300,12 +312,14 @@ namespace MaterialTraceability.Business
if (!info)
{
//LanguageHelper.ShowMessage("cs");
LogRefreshEvent?.Invoke(LogType.PlcLog,"PLC断开重新建立连接");
LogHelper.Info("PLC断开重新建立连接");
bool result = plcBusiness.ReConnect();
if (result)
{
string ss = LanguageHelper.language;
LogRefreshEvent?.Invoke(LogType.PlcLog, "PLC断开重新连接成功");
LogHelper.Info("PLC断开重新连接成功");

@ -61,6 +61,7 @@
<Compile Include="Impl\MQSignalReadBusiness.cs" />
<Compile Include="Impl\TBSignalReadBusiness.cs" />
<Compile Include="ISignalReadFunction.cs" />
<Compile Include="LanguageHelper.cs" />
<Compile Include="LogHelperBusiness.cs" />
<Compile Include="MainBusiness.cs" />
<Compile Include="MaterialFeatureBusiness.cs" />

@ -118,6 +118,7 @@ namespace MaterialTraceability.Business
else
{
LogHelper.Info("PLC初始化成功");
#region 读取时间初始化
var initTime = DateTime.Now.AddMinutes(-1);
lastReadTime_A_Begin = initTime;

@ -510,13 +510,13 @@ namespace MaterialTraceability.Business
{
try
{
LogRecord logRecord = new LogRecord()
{
resource = appConfig.resource,
positionId = position,
message = msg
};
int result = _db.Insertable<LogRecord>(logRecord).ExecuteCommand();
//LogRecord logRecord = new LogRecord()
//{
// resource = appConfig.resource,
// positionId = position,
// message = msg
//};
//int result = _db.Insertable<LogRecord>(logRecord).ExecuteCommand();
}
catch (Exception ex)
{
@ -561,6 +561,7 @@ namespace MaterialTraceability.Business
{
try
{
return "MES接口错误码:"+code + "," + message;
AlarmInfo alarmInfo = new AlarmInfo();
DataTable info = _db.Queryable<AlarmInfo>().Where(x => x.alarmCode == code.ToString()).ToDataTable();
if (info.Rows.Count > 0)

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MaterialTraceability.Common
{
public class LanguageHelper
{
public string language { get; set; }
}
}

@ -44,10 +44,12 @@
<Reference Include="NPOI">
<HintPath>..\dll\NPOI.dll</HintPath>
</Reference>
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@ -61,6 +63,7 @@
<Compile Include="ExpressionExtensions.cs" />
<Compile Include="INIFile.cs" />
<Compile Include="JsonChange.cs" />
<Compile Include="LanguageHelper.cs" />
<Compile Include="LogHelper.cs" />
<Compile Include="MD5Helper.cs" />
<Compile Include="MsgUtil.cs" />

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MaterialTraceability.Entity.DAO
{
public class ApiResponse<T>
{
/// <summary>
/// 状态码(如 200 成功400 失败500 错误)
/// </summary>
public int Code { get; set; }
/// <summary>
/// 消息(如 "操作成功"、"参数错误"
/// </summary>
public string Msg { get; set; }
/// <summary>
/// 返回数据
/// </summary>
public List<T> Data { get; set; }
public ParameterList parameterList { get; set; }
}
public class ParameterList
{
private string Parameter;
private string Value;
}
}

@ -19,31 +19,31 @@ namespace MaterialTraceability.Entity.DAO
/// <summary>
///
///</summary>
[SugarColumn(ColumnName="userId" )]
public string userId { get; set; }
[SugarColumn(ColumnName= "CardID")]
public int CardID { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName="userName" )]
public string userName { get; set; }
[SugarColumn(ColumnName= "JobID")]
public int JobID { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName="userPwd" )]
public string userPwd { get; set; }
[SugarColumn(ColumnName= "Name")]
public string Name { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName="roleId" )]
public string roleId { get; set; }
[SugarColumn(ColumnName= "Level")]
public string Level { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "pwdKey")]
public string pwdKey { get; set; }
[SugarColumn(ColumnName = "PWD")]
public string PWD { get; set; }
}
}

@ -54,6 +54,8 @@ namespace MaterialTraceability.Entity.DTO
public int isSpiltPreventDaze = StringChange.ParseToInt(iNIFile.IniReadValue("SystemConfig", "isSpiltPreventDaze"));
public TbAddress TbAddress = TbAddress.Instance;
public LyAddress LyAddress = LyAddress.Instance;

@ -49,6 +49,7 @@
<Compile Include="Config\TJAddress.cs" />
<Compile Include="Config\MqAddress.cs" />
<Compile Include="Config\TbAddress.cs" />
<Compile Include="DAO\ApiResponse.cs" />
<Compile Include="DAO\ComPay.cs" />
<Compile Include="DAO\ProBindInfo.cs" />
<Compile Include="DAO\ProDownRecord.cs" />

@ -35,10 +35,6 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\dll\HslCommunication.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\dll\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />

@ -199,6 +199,6 @@ namespace MaterialTraceability.SqlSugar
/// sql语句
/// </summary>
Task<List<T>> QueryBySql<T>(string sql, List<SugarParameter> parameters) where T : class, new();
Task<bool> TruncateTable();
}
}

@ -744,5 +744,11 @@ namespace MaterialTraceability.SqlSugar.ServiceImpl
{
return await _db.Ado.SqlQueryAsync<T>(sql, parameters);
}
public async Task<bool> TruncateTable()
{
//var i = await Task.Run(() => _db.Deleteable<TEntity>().In(ids).ExecuteCommand());
//return i > 0;
return _db.DbMaintenance.TruncateTable<TEntity>();
}
}
}

@ -744,5 +744,10 @@ namespace MaterialTraceability.SqlSugar.ServiceImpl
{
return await _db.Ado.SqlQueryAsync<T>(sql, parameters);
}
public Task<bool> TruncateTable()
{
throw new NotImplementedException();
}
}
}

@ -7,9 +7,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="3" />
<add key="MachineID" value="1" />
<!--涂布TB冷压LY_A模切MQ_A-->
<add key="PLCAddress" value="MQPLcAddress" />
<add key="PLCAddress" value="JTTBPLcAddress" />
<!--涂布TB冷压LY_A模切MQ_A,先导MQ_B-->
<add key="ProcessID" value="MQ_A" />
<!--设备资产编号参考公共盘设备资源表对应设备-->
@ -56,12 +56,20 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.116.0" newVersion="1.0.116.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.16.0" newVersion="8.0.16.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.web>

@ -1379,8 +1379,8 @@ namespace MaterialTraceabilityUI
else
{
MessageBox.Show("下右收卷强制下料触发");
ListBoxItemAdd(this.PlcLog, "下右收卷强制下料触发成功MW24830写入0");
LogHelperBusiness.LogInfo("下右收卷强制下料触发成功MW24830写入0");
ListBoxItemAdd(this.PlcLog, "下右收卷强制下料触发成功");
LogHelperBusiness.LogInfo("下右收卷强制下料触发成功");
plcBusiness.writePlc(appConfig.mqAddress., 0);
int position = 0;

@ -51,8 +51,11 @@
<RadioButton Content="{local:StringResource btnSY,DefaultValue=首页}" Style="{StaticResource NavRadioButtonStyle}" FontSize="15" Foreground="White" IsChecked="True" VerticalAlignment="Center" Click="IndexPage_Click"/> <!--CommandParameter="IndexPage" Command="{Binding ChangeContentCommand}"-->
<RadioButton Content="{local:StringResource btnJLBB,DefaultValue=记录报表}" Style="{StaticResource NavRadioButtonStyle}" FontSize="15" Foreground="White" VerticalAlignment="Center" Click="RecordPage_Click"/>
<RadioButton Content="{local:StringResource btnCSPZ,DefaultValue=参数配置}" Style="{StaticResource NavRadioButtonStyle}" FontSize="15" Foreground="White" IsChecked="False" VerticalAlignment="Center" Click="ConfigPage_Click" />
<RadioButton Content="{local:StringResource btnUser,DefaultValue=用户信息}" Style="{StaticResource NavRadioButtonStyle}" FontSize="15" Foreground="White" IsChecked="False" VerticalAlignment="Center" Click="UserInfoPage_Click" />
<RadioButton x:Name="alarmButton" Content="异常处理" Style="{StaticResource NavRadioButtonStyle}" FontSize="15" Foreground="White" IsChecked="False" VerticalAlignment="Center" Click="alarmButton_Click" Visibility="Hidden" />
<RadioButton Content="{local:StringResource btnChina,DefaultValue=中文}" Style="{StaticResource NavRadioButtonStyle}" FontSize="15" Foreground="White" IsChecked="False" VerticalAlignment="Center" Click="ChangeLanguage1_Click" />
<RadioButton Content="{local:StringResource btnEnglish,DefaultValue=德文}" Style="{StaticResource NavRadioButtonStyle}" FontSize="15" Foreground="White" IsChecked="False" VerticalAlignment="Center" Click="ChangeLanguage4_Click" />
<RadioButton Content="{local:StringResource btnEnglish,DefaultValue=英文}" Style="{StaticResource NavRadioButtonStyle}" FontSize="15" Foreground="White" IsChecked="False" VerticalAlignment="Center" Click="ChangeLanguage2_Click" />
<RadioButton Content="{local:StringResource btnBl,DefaultValue=波兰}" Style="{StaticResource NavRadioButtonStyle}" FontSize="15" Foreground="White" IsChecked="False" VerticalAlignment="Center" Click="ChangeLanguage3_Click" />

@ -2,11 +2,13 @@
using MaterialTraceability.Business;
using MaterialTraceability.Entity.DAO;
using MaterialTraceability.Entity.DTO;
using MaterialTraceability.Entity.Enum;
using MaterialTraceability.Entity.UpLoad;
using MaterialTraceability.SqlSugar;
using MaterialTraceability.SqlSugar.ServiceImpl;
using MaterialTraceabilityUI.Common;
using MaterialTraceabilityUI.Resources;
using MaterialTraceabilityUI.ViewModel;
using SqlSugar;
using System;
using System.Collections.Generic;
@ -44,6 +46,8 @@ namespace MaterialTraceabilityUI
//卷绕界面
private JRProcess JRProcess = new JRProcess();
private UserInfo UserInfo = new UserInfo();
//记录报表
private secondPage secondPage = new secondPage();
@ -168,6 +172,8 @@ namespace MaterialTraceabilityUI
{
try
{
GlobalClass.ChangeLanguage("zh-cn");
LanguageHelper.language = "zh-cn";
notifyIcon.Visible = true;
notifyIcon.Text = "RFID物料追溯系统";
notifyIcon.Icon = new Icon("amn06-tnywh-001.ico");
@ -229,7 +235,15 @@ namespace MaterialTraceabilityUI
{
action = () =>
{
this.TestTB.Text = "PLC连接成功";
if (LanguageHelper.language == "en-us")
{
this.TestTB.Text = "PLC Connect Success";
}
else
{
this.TestTB.Text = "PLC连接成功";
}
this.TestTB.Foreground = System.Windows.Media.Brushes.SpringGreen;
};
TestTB.Dispatcher.BeginInvoke(action);
@ -256,7 +270,15 @@ namespace MaterialTraceabilityUI
action = () =>
{
this.TestTB.Text = "PLC连接失败";
if (LanguageHelper.language == "en-us")
{
this.TestTB.Text = "PLC Connect Fail";
}
else
{
this.TestTB.Text = "PLC连接失败";
}
this.TestTB.Foreground = System.Windows.Media.Brushes.Red;
};
TestTB.Dispatcher.BeginInvoke(action);
@ -443,16 +465,38 @@ namespace MaterialTraceabilityUI
{
//LanguageManager.Instance.ChangeLanguage(new CultureInfo("zh-cn"));
GlobalClass.ChangeLanguage("zh-cn");
LanguageHelper.language = "zh-cn";
}
private void ChangeLanguage2_Click(object sender, RoutedEventArgs e)
{
//LanguageManager.Instance.ChangeLanguage(new CultureInfo("en-us"));
GlobalClass.ChangeLanguage("en-us");
GlobalClass.ChangeLanguage("en-US");
LanguageHelper.language = "en-US";
}
private void ChangeLanguage3_Click(object sender, RoutedEventArgs e)
{
//LanguageManager.Instance.ChangeLanguage(new CultureInfo("pl"));
GlobalClass.ChangeLanguage("pl");
GlobalClass.ChangeLanguage("pl-PL");
LanguageHelper.language = "pl-PL";
}
private void ChangeLanguage4_Click(object sender, RoutedEventArgs e)
{
//LanguageManager.Instance.ChangeLanguage(new CultureInfo("pl"));
GlobalClass.ChangeLanguage("de-DE");
LanguageHelper.language = "de-DE";
}
private void UserInfoPage_Click(object sender, RoutedEventArgs e)
{
if (!"2".Equals(ConfigHelper.GetConfig("roleId")))
{
System.Windows.MessageBox.Show("请登录系统管理账号进行操作");
}
else
{
UserContent = UserInfo;
}
}
}
}

@ -88,14 +88,16 @@
<HintPath>..\dll\Nancy.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\dll\Newtonsoft.Json.dll</HintPath>
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SqlSugar, Version=5.0.3.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\dll\SqlSugar.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\netstandard1.1\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
@ -109,7 +111,20 @@
<HintPath>..\dll\System.Data.SQLite.Linq.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\netstandard1.1\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\portable-net45+win8+wp8+wpa81\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
@ -121,6 +136,21 @@
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="TouchSocket, Version=3.1.19.0, Culture=neutral, PublicKeyToken=5f39d7da98dac6a9, processorArchitecture=MSIL">
<HintPath>..\packages\TouchSocket.3.1.19\lib\net45\TouchSocket.dll</HintPath>
</Reference>
<Reference Include="TouchSocket.Core, Version=3.1.19.0, Culture=neutral, PublicKeyToken=d6c415a2f58eda72, processorArchitecture=MSIL">
<HintPath>..\packages\TouchSocket.Core.3.1.19\lib\net45\TouchSocket.Core.dll</HintPath>
</Reference>
<Reference Include="TouchSocket.Http, Version=3.1.19.0, Culture=neutral, PublicKeyToken=ecea290704fb8ddd, processorArchitecture=MSIL">
<HintPath>..\packages\TouchSocket.Http.3.1.19\lib\net45\TouchSocket.Http.dll</HintPath>
</Reference>
<Reference Include="TouchSocket.Rpc, Version=3.1.19.0, Culture=neutral, PublicKeyToken=15eb0d7aa187fa38, processorArchitecture=MSIL">
<HintPath>..\packages\TouchSocket.Rpc.3.1.19\lib\net45\TouchSocket.Rpc.dll</HintPath>
</Reference>
<Reference Include="TouchSocket.WebApi, Version=3.1.19.0, Culture=neutral, PublicKeyToken=004e630594e1cb25, processorArchitecture=MSIL">
<HintPath>..\packages\TouchSocket.WebApi.3.1.19\lib\net45\TouchSocket.WebApi.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
@ -160,6 +190,9 @@
<Compile Include="SplitSfc.xaml.cs">
<DependentUpon>SplitSfc.xaml</DependentUpon>
</Compile>
<Compile Include="UserInfo.xaml.cs">
<DependentUpon>UserInfo.xaml</DependentUpon>
</Compile>
<Compile Include="UserLogin.xaml.cs">
<DependentUpon>UserLogin.xaml</DependentUpon>
</Compile>
@ -172,6 +205,7 @@
<Compile Include="firstPage.xaml.cs">
<DependentUpon>firstPage.xaml</DependentUpon>
</Compile>
<Compile Include="ViewModel\MesHttpClient.cs" />
<Compile Include="WriteInfo.xaml.cs">
<DependentUpon>WriteInfo.xaml</DependentUpon>
</Compile>
@ -224,6 +258,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UserInfo.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UserLogin.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@ -301,14 +339,16 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Lang.de-DE.resx" />
<EmbeddedResource Include="Resources\Lang.en-US.resx" />
<EmbeddedResource Include="Resources\Lang.pl.resx" />
<EmbeddedResource Include="Resources\Lang.pl-PL.resx" />
<EmbeddedResource Include="Resources\Lang.zh-cn.resx" />
<Resource Include="Assets\Fonts\iconfont.ttf" />
<None Include="Library\App.InI" />
<None Include="Library\data\test.db" />
<None Include="Library\MesConfig\App.InI" />
<None Include="Library\PlcAddress\MqAddress.InI" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@ -373,5 +413,10 @@
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\TouchSocket.Core.3.1.19\analyzers\dotnet\cs\TouchSocket.Core.SourceGenerator.dll" />
<Analyzer Include="..\packages\TouchSocket.Rpc.3.1.19\analyzers\dotnet\cs\TouchSocket.Rpc.SourceGenerator.dll" />
<Analyzer Include="..\packages\TouchSocket.WebApi.3.1.19\analyzers\dotnet\cs\TouchSocket.WebApi.SourceGenerator.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:MaterialTraceabilityUI"
xmlns:local="clr-namespace:MaterialTraceabilityUI.Resources"
mc:Ignorable="d"
d:DesignHeight="452" d:DesignWidth="640" Background="Transparent" Loaded="UserControl_Loaded">
<Border CornerRadius="10" Background="White">
@ -107,7 +107,7 @@
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding PositionID}" Header="编号" Width="60"/>
<DataGridTextColumn Binding="{Binding PositionID}" Header="{local:StringResource RRID,DefaultValue=编号}" Width="60"/>
<!--<DataGridTextColumn Binding="{Binding MachineID}" Header="机台编号" Width="60"/>-->
<DataGridTextColumn Binding="{Binding EquipID}" Header="设备编号" Width="*"/>
<DataGridTextColumn Binding="{Binding Ant}" Header="天线编号" Width="*"/>

@ -0,0 +1 @@
[{"ProjectName":"MaterialTraceabilityUI","UniqueName":"Properties\\Resources","Entries":[]},{"ProjectName":"MaterialTraceabilityUI","UniqueName":"Resources\\Lang","Entries":[{"Key":"btnChina","Data":[{"L":".en-US","T":"Chinese"},{"L":".pl","T":"Chińczycy"},{"L":".zh-CN","T":"中文"}]},{"Key":"btnEnglish","Data":[{"L":".en-US","T":"English"},{"L":".pl","T":"yw"},{"L":".zh-CN","T":"英文"}]},{"Key":"btnBl","Data":[{"L":".en-US","T":"bolan"},{"L":".pl","T":"pl"},{"L":".zh-CN","T":"波兰"}]},{"Key":"btnJLBB","Data":[{"L":".en-US","T":"Report"},{"L":".pl","T":"jlbb"},{"L":".zh-CN","T":"记录报表"}]},{"Key":"btnCSPZ","Data":[{"L":".en-US","T":"Config"},{"L":".pl","T":"cspz"},{"L":".zh-CN","T":"参数配置"}]},{"Key":"btnDL","Data":[{"L":".en-US","T":"Login in"},{"L":".pl","T":"dl"},{"L":".zh-CN","T":"登录"}]},{"Key":"btnZX","Data":[{"L":".en-US","T":"Login out"},{"L":".pl","T":"zx"},{"L":".zh-CN","T":"注销"}]},{"Key":"btnSY","Data":[{"L":".en-US","T":"Fistpage"},{"L":".pl","T":"sy"},{"L":".zh-CN","T":"首页"}]},{"Key":"lbtext","Data":[{"L":".en-US","T":"RFID MaterialTraceability System"},{"L":".pl","T":"RFID"},{"L":".zh-CN","T":"RFID物料追溯系统"}]},{"Key":"lbPLCStatus","Data":[{"L":".en-US","T":"PLC Offline"},{"L":".pl","T":"PLC"},{"L":".zh-CN","T":"PLC状态异常"}]},{"Key":"lbLoginStatus","Data":[{"L":".en-US","T":"NLI"},{"L":".pl","T":"nli"},{"L":".zh-CN","T":"未登录"}]},{"Key":"MQDevice","Data":[{"L":".en-US","T":"MQ DeviceStatus"},{"L":".pl","T":"mqds"},{"L":".zh-CN","T":"设备状态"}]}]}]

@ -69,11 +69,29 @@ namespace MaterialTraceabilityUI.Resources
Thread.CurrentThread.CurrentUICulture = culture;
StringResource.CurrentCulture = culture;
// 如果是WPF应用需要更新应用级别的文化
if (Application.Current != null)
{
Application.Current.MainWindow?.UpdateLayout();
// 重新加载资源字典(如果有语言资源文件)
//UpdateResourceDictionary(cultureName);
}
if (LanguageChangeEvent != null)
{
LanguageChangeEvent(null, null);
}
}
// 检查当前是否为中文
public static bool IsChinese()
{
return Thread.CurrentThread.CurrentUICulture.Name.StartsWith("zh");
}
// 检查当前是否为英文
public static bool IsEnglish()
{
return Thread.CurrentThread.CurrentUICulture.Name.StartsWith("en");
}
}
}

@ -0,0 +1,165 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="btnBl" xml:space="preserve">
<value>1</value>
</data>
<data name="btnChina" xml:space="preserve">
<value>2</value>
</data>
<data name="btnCSPZ" xml:space="preserve">
<value>3</value>
</data>
<data name="btnDL" xml:space="preserve">
<value>4</value>
</data>
<data name="btnEnglish" xml:space="preserve">
<value>5</value>
</data>
<data name="btnJLBB" xml:space="preserve">
<value>6</value>
</data>
<data name="btnZX" xml:space="preserve">
<value>8</value>
</data>
<data name="btnSY" xml:space="preserve">
<value>7</value>
</data>
<data name="lbtext" xml:space="preserve">
<value>0</value>
</data>
<data name="lbPLCStatus" xml:space="preserve">
<value>0</value>
</data>
<data name="lbLoginStatus" xml:space="preserve">
<value>9</value>
</data>
<data name="MQDevice" xml:space="preserve">
<value>0</value>
</data>
<data name="RRID" xml:space="preserve">
<value>0</value>
</data>
<data name="ShaftInfoControlName" xml:space="preserve">
<value>0</value>
</data>
<data name="btnUser" xml:space="preserve">
<value>用户信息</value>
</data>
</root>

@ -117,17 +117,11 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="btnChina" xml:space="preserve">
<value>Chinese</value>
</data>
<data name="btnEnglish" xml:space="preserve">
<value>English</value>
</data>
<data name="btnBl" xml:space="preserve">
<value>bolan</value>
</data>
<data name="btnJLBB" xml:space="preserve">
<value>Report</value>
<data name="btnChina" xml:space="preserve">
<value>中文</value>
</data>
<data name="btnCSPZ" xml:space="preserve">
<value>Config</value>
@ -135,6 +129,12 @@
<data name="btnDL" xml:space="preserve">
<value>Login in</value>
</data>
<data name="btnEnglish" xml:space="preserve">
<value>English</value>
</data>
<data name="btnJLBB" xml:space="preserve">
<value>Report</value>
</data>
<data name="btnZX" xml:space="preserve">
<value>Login out</value>
</data>
@ -153,4 +153,13 @@
<data name="MQDevice" xml:space="preserve">
<value>MQ DeviceStatus</value>
</data>
<data name="RRID" xml:space="preserve">
<value>ID</value>
</data>
<data name="ShaftInfoControlName" xml:space="preserve">
<value>Device Name</value>
</data>
<data name="btnUser" xml:space="preserve">
<value>用户信息</value>
</data>
</root>

@ -117,17 +117,11 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="btnChina" xml:space="preserve">
<value>zw</value>
</data>
<data name="btnEnglish" xml:space="preserve">
<value>yw</value>
</data>
<data name="btnBl" xml:space="preserve">
<value>bl</value>
<value>pl</value>
</data>
<data name="btnJLBB" xml:space="preserve">
<value>jlbb</value>
<data name="btnChina" xml:space="preserve">
<value>Chińczycy</value>
</data>
<data name="btnCSPZ" xml:space="preserve">
<value>cspz</value>
@ -135,6 +129,12 @@
<data name="btnDL" xml:space="preserve">
<value>dl</value>
</data>
<data name="btnEnglish" xml:space="preserve">
<value>yw</value>
</data>
<data name="btnJLBB" xml:space="preserve">
<value>jlbb</value>
</data>
<data name="btnZX" xml:space="preserve">
<value>zx</value>
</data>
@ -153,4 +153,13 @@
<data name="MQDevice" xml:space="preserve">
<value>mqds</value>
</data>
<data name="RRID" xml:space="preserve">
<value>id</value>
</data>
<data name="ShaftInfoControlName" xml:space="preserve">
<value>Device Name</value>
</data>
<data name="btnUser" xml:space="preserve">
<value>用户信息</value>
</data>
</root>

@ -117,17 +117,11 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="btnChina" xml:space="preserve">
<value>中文</value>
</data>
<data name="btnEnglish" xml:space="preserve">
<value>英文</value>
</data>
<data name="btnBl" xml:space="preserve">
<value>波兰</value>
</data>
<data name="btnJLBB" xml:space="preserve">
<value>记录报表</value>
<data name="btnChina" xml:space="preserve">
<value>中文</value>
</data>
<data name="btnCSPZ" xml:space="preserve">
<value>参数配置</value>
@ -135,6 +129,12 @@
<data name="btnDL" xml:space="preserve">
<value>登录</value>
</data>
<data name="btnEnglish" xml:space="preserve">
<value>English</value>
</data>
<data name="btnJLBB" xml:space="preserve">
<value>记录报表</value>
</data>
<data name="btnZX" xml:space="preserve">
<value>注销</value>
</data>
@ -153,4 +153,13 @@
<data name="MQDevice" xml:space="preserve">
<value>设备状态</value>
</data>
<data name="RRID" xml:space="preserve">
<value>编号</value>
</data>
<data name="ShaftInfoControlName" xml:space="preserve">
<value>设备名称</value>
</data>
<data name="btnUser" xml:space="preserve">
<value>用户信息</value>
</data>
</root>

@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:MaterialTraceabilityUI"
xmlns:local="clr-namespace:MaterialTraceabilityUI.Resources"
mc:Ignorable="d"
d:DesignHeight="452" d:DesignWidth="640" Background="Transparent" Loaded="UserControl_Loaded">
<Border CornerRadius="10" Background="White">
@ -99,8 +99,8 @@
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding positionId}" Header="设备编号" Width="60" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding shaftName}" Header="设备名" Width="*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding positionId}" Header="{local:StringResource RRID,DefaultValue=设备编号}" Width="60" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding shaftName}" Header="{local:StringResource ShaftInfoControlName,DefaultValue=设备名称}" Width="*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding bindRfid}" Header="RFID" Width="*"/>
<DataGridTextColumn Binding="{Binding bindSfc}" Header="SFC" Width="*"/>
<DataGridTextColumn Binding="{Binding bindEaValue}" Header="EA" Width="*"/>

@ -325,7 +325,7 @@ namespace MaterialTraceabilityUI
string info = massage;
string logTypeStr = "";
int isAlarm = 0;
massage = LanguageHelper.ShowMessage(massage);
if (logType == LogType.MesLog)
{
logTypeStr = "MES";

@ -0,0 +1,115 @@
<UserControl x:Class="MaterialTraceabilityUI.UserInfo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:MaterialTraceabilityUI.Resources"
mc:Ignorable="d"
d:DesignHeight="452" d:DesignWidth="640" Background="Transparent" Loaded="UserControl_Loaded">
<Border CornerRadius="10" Background="White" Margin="0,0,-137,0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" BorderBrush="#007DFA" BorderThickness="1" CornerRadius="10" Background="Transparent">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<StackPanel Margin="15,0" Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Center">
<Label Margin="20,0,0,0" Content="用户名" Foreground="#007DFA" Height="30" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<TextBox x:Name="userText" Width="150" Foreground="#007DFA" HorizontalAlignment="Left" VerticalAlignment="Center" Height="30"/>
<!--<RadioButton Content="查询" Style="{StaticResource NavRadioButtonStyle}" Background="Blue"/>-->
<Button x:Name="seach" Content="查询" Background="#007DFA" Foreground="White" Margin="20,0,0,0" Height="30" BorderBrush="DeepSkyBlue" BorderThickness="1" Width="80" Click="Seach_Click"/>
<Button x:Name="LoadMESdata" Content="同步数据" Background="#007DFA" Foreground="White" Margin="20,0,0,0" Height="30" BorderBrush="DeepSkyBlue" BorderThickness="1" Width="80" Click="Loaddata_Click"/>
</StackPanel>
<!--<StackPanel Margin="15,0" Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center">
<Button x:Name="seach1" Content="查询" Background="#007DFA" Foreground="White" Margin="20,0,0,0" Height="30" BorderBrush="DeepSkyBlue" BorderThickness="1" Width="80" Click="Seach_Click"/>
</StackPanel>-->
</Grid>
</Border>
<Border Grid.Row="1" Margin="0,5,0,0" BorderBrush="#007DFA" BorderThickness="1" CornerRadius="0" Background="Transparent">
<DataGrid x:Name="UserInfoDataGrid" Style="{DynamicResource DataGridStyle}" ColumnHeaderHeight="22" RowHeight="20" AutoGenerateColumns="False" RowHeaderWidth="0" GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="0">
<DataGrid.Resources>
<Style x:Key="DataGridStyle" TargetType="DataGrid">
<Setter Property="AlternationCount" Value="2"/>
<Setter Property="ColumnHeaderStyle" Value="{DynamicResource DataGridColumnHeaderStyle}"/>
<Setter Property="CellStyle" Value="{DynamicResource DataGridCellStyle}"/>
<Setter Property="RowStyle" Value="{DynamicResource DataGridRowStyle}"/>
</Style>
<Style x:Key="DataGridColumnHeaderStyle" TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Background" Value="White"/>
</Style>
<Style x:Key="DataGridRowStyle" TargetType="{x:Type DataGridRow}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridRow}">
<Grid x:Name="DGR_Border" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1"/>
<DataGridCellsPresenter Grid.Column="1" ItemsPanel="{TemplateBinding ItemsPanel}"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="BorderBrush" Value="#00BCD4"/>
</Trigger>
<Trigger Property="AlternationIndex" Value="0">
<Setter Property="Background" Value="#E9F3FD"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsNewItem" Value="True">
<Setter Property="Margin" Value="{Binding NewItemMargin, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="DataGridCellStyle" TargetType="{x:Type DataGridCell}">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True">
<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Foreground" Value="Gray"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding objId}" Header="{local:StringResource RRID,DefaultValue=序号}" Width="60"/>
<!--<DataGridTextColumn Binding="{Binding MachineID}" Header="机台编号" Width="60"/>-->
<DataGridTextColumn Binding="{Binding JobID}" Header="工号" Width="*"/>
<DataGridTextColumn Binding="{Binding Level}" Header="角色" Width="*"/>
</DataGrid.Columns>
</DataGrid>
</Border>
</Grid>
</Border>
</UserControl>

@ -0,0 +1,189 @@
using MaterialTraceability.Entity.DAO;
using MaterialTraceability.Entity.DTO;
using MaterialTraceability.SqlSugar;
using MaterialTraceability.SqlSugar.ServiceImpl;
using MaterialTraceabilityUI.Common;
using MaterialTraceabilityUI.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace MaterialTraceabilityUI
{
/// <summary>
/// UserInfo.xaml 的交互逻辑
/// </summary>
public partial class UserInfo : UserControl
{
private AppConfigDto appConfig = AppConfigDto.Instance;
private static IBaseServices<SysUserInfo> _sysUserbaseServices = new BaseServices<SysUserInfo>();
/// <summary>
/// level
/// 3:ME
/// 2:PRD技师
/// 4:PE
/// 5:管理员
/// </summary>
public UserInfo()
{
InitializeComponent();
}
private async void Refresh()
{
Expression<Func<SysUserInfo, bool>> exp = s1 => true;
if (userText.Text.Trim().ToString() != "")
{
exp = exp.And(x => x.Name.Contains(userText.Text.Trim().ToString()));
}
Expression<Func<SysUserInfo, object>> order = (x) => x.objId;
List<SysUserInfo> UserInfoRecord = await _sysUserbaseServices.Query(exp, order, false);
if (UserInfoRecord != null)
{
UserInfoRecord.ForEach(x =>
{
if (x.Level == "1")
{
x.Level = "未知";
}
else if (x.Level == "2")
{
x.Level = "PRD技师";
}else if (x.Level == "3")
{
x.Level = "ME";
}
else if (x.Level == "4")
{
x.Level = "PE";
}
else if (x.Level == "5")
{
x.Level = "管理员";
}
});
UserInfoDataGrid.ItemsSource = UserInfoRecord;
}
}
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
Refresh();
}
private void Seach_Click(object sender, RoutedEventArgs e)
{
Refresh();
}
private void Loaddata_Click(object sender, RoutedEventArgs e)
{
try
{
MesHttpClient mesHttpClient = new MesHttpClient();
mesHttpClient.init();
var data = mesHttpClient.LoadMESdata(appConfig.resource);
//更新本地库
CompareData(data.Data);
Refresh();
}
catch (Exception ex)
{
}
}
private async void CompareData(List<SysUserInfo> MesUserInfo)
{
try
{
Expression<Func<SysUserInfo, bool>> exp = s1 => true;
Expression<Func<SysUserInfo, object>> order = (x) => x.objId;
List<SysUserInfo> LocalUserInfoRecord = await _sysUserbaseServices.Query(exp, order, false);
if (LocalUserInfoRecord != null)
{
var newdata = CompareAndUpdate(LocalUserInfoRecord, MesUserInfo);
//先清空表
await _sysUserbaseServices.TruncateTable();
int ifalg = await _sysUserbaseServices.Add(newdata);
}
}
catch (Exception ex)
{
}
}
// 比较两个Data对象同一CardID的其他属性是否相同
private static bool ArePropertiesEqual(SysUserInfo source, SysUserInfo target)
{
if (source == null || target == null) return false;
return source.CardID == target.CardID
&& source.Name == target.Name
&& source.Level == target.Level
&& source.PWD == target.PWD;
}
// 比较两个列表并更新sourceList
public List<SysUserInfo> CompareAndUpdate(List<SysUserInfo> sourceList, List<SysUserInfo> targetList)
{
// 1. 将targetList转为字典CardID为键高效查找
var targetDict = targetList.ToDictionary(d => d.JobID);
// 2. 存储需要从sourceList删除的对象target中没有的
var toRemove = new List<SysUserInfo>();
// 3. 遍历sourceList匹配target并更新差异
foreach (var source in sourceList)
{
if (targetDict.TryGetValue(source.JobID, out var target))
{
// 找到匹配的CardID检查属性是否不同
if (!ArePropertiesEqual(source, target))
{
// 属性不同用target的数据更新source
source.CardID = target.CardID;
source.Name = target.Name;
source.Level = target.Level;
source.PWD = target.PWD;
Console.WriteLine($"已更新JobID={source.JobID}的对象");
}
// 从字典移除已处理的剩余的就是target独有的待新增
targetDict.Remove(source.JobID);
}
else
{
// source有而target没有标记为待删除
toRemove.Add(source);
}
}
// 4. 执行删除从sourceList移除toRemove中的对象
foreach (var item in toRemove)
{
sourceList.Remove(item);
Console.WriteLine($"已删除JobID={item.JobID}的对象target中不存在");
}
// 5. 处理target独有的对象新增到sourceList
foreach (var newItem in targetDict.Values)
{
sourceList.Add(newItem);
Console.WriteLine($"已新增JobID={newItem.JobID}的对象source中不存在");
}
return sourceList;
}
}
}

@ -0,0 +1,75 @@
using MaterialTraceability.Entity.DAO;
using Nancy;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TouchSocket.Core;
using TouchSocket.Rpc;
using TouchSocket.Sockets;
using TouchSocket.WebApi;
namespace MaterialTraceabilityUI.ViewModel
{
public class MesHttpClient
{
public static WebApiClient _MeshttpClient;
public async void init()
{
try
{
_MeshttpClient = new WebApiClient();
await _MeshttpClient.SetupAsync(new TouchSocketConfig()
//.SetRemoteIPHost("10.150.144.83:5001")
.SetRemoteIPHost("127.0.0.1:9880")
.ConfigurePlugins(a =>
{
//a.Add<Myweb>
//a.UseWebApi();
//.ConfigureConverter(converter =>
//{
// //配置转换器
// //converter.Clear();//可以选择性的清空现有所有格式化器
// //添加Json格式化器可以自定义Json的一些设置
// converter.AddJsonSerializerFormatter(new Newtonsoft.Json.JsonSerializerSettings() { Formatting = Newtonsoft.Json.Formatting.None });
// //添加Xml格式化器
// converter.AddXmlSerializerFormatter();
//});
}));
await _MeshttpClient.ConnectAsync();
}
catch (Exception ex)
{
//FrmDisplayView.LogInfo.Fatal("MES接口连接异常: " + ex.Message);
}
}
public ApiResponse<SysUserInfo> LoadMESdata(string Resource)
{
try
{
IInvokeOption invokeOption = new InvokeOption();
var requestForPost = new WebApiRequest();
requestForPost.Method = HttpMethodType.Get;
requestForPost.Body = new KeyValuePair<string, string>[] { new KeyValuePair<string, string>("Resource", Resource) };
//FrmDisplayView.LogInfo.Info(JsonSerializer.Serialize(requestForPost.Body));
//JToken responseValue = _MeshttpClient.InvokeT<JToken>("/autoread", null, requestForPost);
return _MeshttpClient.InvokeT<ApiResponse<SysUserInfo>>("/GetUserList", invokeOption, requestForPost);
}
catch (Exception ex)
{
//FrmDisplayView.LogInfo.Fatal("MES接口调用异常: " + ex.Message);
return null;
}
}
}
}

@ -48,7 +48,7 @@ namespace MaterialTraceabilityUI
this.processId = processId;
this.position = position;
InitializeComponent();
this.rfidCode.Text = "JSLY3RD";
this.rfidCode.Text = "CATT1RD";
}
/// <summary>

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net452" />
<package id="System.Buffers" version="4.5.1" targetFramework="net452" />
<package id="System.Memory" version="4.5.5" targetFramework="net452" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net452" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net452" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net452" />
<package id="TouchSocket" version="3.1.19" targetFramework="net452" />
<package id="TouchSocket.Core" version="3.1.19" targetFramework="net452" />
<package id="TouchSocket.Http" version="3.1.19" targetFramework="net452" />
<package id="TouchSocket.Rpc" version="3.1.19" targetFramework="net452" />
<package id="TouchSocket.WebApi" version="3.1.19" targetFramework="net452" />
</packages>
Loading…
Cancel
Save