init: 导入项目到 meswork Gitea

This commit is contained in:
XingCheng3
2026-05-29 10:07:05 +08:00
commit ad9a4106fb
3582 changed files with 460312 additions and 0 deletions

View File

@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<!--变量模拟测试开关1为开启-->
<add key="IsDemoMesServer" value="0" />
<!--数据库链接-->
<!--<add key="ConnectionString_MES" value="server=.\H2012;User ID=sa;Password=126.com;database=MacroinfBasicDB;Connection Reset=FALSE"/>-->
<!--<add key="ConnectionString_MES" value="server=192.168.1.204\SQLExpress;User ID=sa;Password=126.com;database=MacroinfBasicDB;Connection Reset=FALSE"/>-->
<!--<add key="ConnectionString_MES" value="server=124.220.15.242\MSSQLSERVER2012,1433;User ID=meswork;Password=126.com;database=MacroinfBasicDB_HLMacroinfBasicDB_SY;Connection Reset=FALSE" />-->
<add key="ConnectionString_MES" value="server=.;User ID=sa;Password=126.com;database=MacroinfBasicDB_SY;Connection Reset=FALSE" />
<!-- 是否保存报警数据-->
<add key="IsSaveQualityData_MIS_Alarm" value="0" />
<!-- 发送给大屏幕的通讯端口-->
<add key="Port_ShowLED_ProductCount" value="41139" />
<!--发送给打印机UDP端口号-->
<add key="MES_MarkPortNum" value="41105" />
<!--是否启用设备保养通知计划-->
<add key="Is_MachinePlan" value="0"></add>
<!-- 是否启用UDP通讯-->
<add key="IsUsingUdpMonitor" value="0" />
<!-- 监控属性代码-->
<add key="MES_Code" value="1" />
<!--系统日志文件夹路径-->
<add key="TraceFolderPath" value="C:\MesWork\"></add>
<!--系统日志文件更新时间-->
<add key="TraceCreateTime" value="00:00"></add>
<!--版本信息,禁止修改-->
<add key="Version" value="3.0" />
<!--基础数据Excel表名称-->
<add key="BasicDataTableFile" value="长春一汽.xlsx" />
<!--MQTT-->
<!--订阅页面信息-->
<!--<add key="MqttUrl" value="192.168.0.1:1883,WEB/InstantMessaging/SY/MisServer" />-->
<!--<add key="MqttUrl" value="192.168.5.28:1883,WEB/InstantMessaging/SY/MisServer" />-->
<add key="MqttUrl" value="127.0.0.1:1883,WEB/InstantMessaging/SY/MisServer" />
<!--<add key="MqttUrlPLC" value="124.220.15.242:1883,PLC/InstantMessaging/MisServer" />-->
<!--发送到页面-->
<add key="MqttTargetTopic" value="MES/InstantMessaging/SY" />
<!--发送到function-->
<add key="MqttTargetTopicPLC" value="PLC/InstantMessaging/SY" />
<!--发送到function-->
<add key="MqttTargetTopicTagTypeCodeID" value="TAG/TagTypeCodeID/SY" />
<add key="Url_WebApi" value="http://localhost:41186" />
<!--WebApi端口号-->
<add key="WebApiPort" value="41185" />
<!--是启用写监控报错日志-->
<add key="IsWriteMonitorLog" value="1" />
</appSettings>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
<startup>
<!--supportedRuntime version="v2.0.50727"/-->
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /></startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Opc.Ua.Core" publicKeyToken="22186A540FC0B044" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.238.1" newVersion="1.0.238.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NetMQ" publicKeyToken="a6decef4ddc58b3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -0,0 +1,103 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MisDataName
{
class FunctionForm_HashiTable
{
public static Hashtable OpName_Hash = new Hashtable();
public static object OpName_Hash_Read(string Key)
{
if (OpName_Hash.ContainsKey(Key))
{
return OpName_Hash[Key];
}
else
{
return null;
}
}
public static void OpName_Hash_Write(string Key, object obj)
{
if (OpName_Hash.ContainsKey(Key))
{
OpName_Hash[Key] = obj;
}
else
{
OpName_Hash.Add(Key, obj);
}
}
public static Hashtable SignalName = new Hashtable();
public static string SignalName_Hash_Read(string Key)
{
if (SignalName.ContainsKey(Key))
{
return SignalName[Key].ToString ();
}
else
{
return null;
}
}
public static void SignalName_Hash_Write(string Key, string str)
{
if (SignalName.ContainsKey(Key))
{
SignalName[Key] = str;
}
else
{
SignalName.Add(Key, str);
}
}
public static Hashtable SignalConfig = new Hashtable();
public static object SignalConfig_Hash_Read(string Key)
{
if (SignalConfig.ContainsKey(Key))
{
return SignalConfig[Key];
}
else
{
return null;
}
}
public static void SignalConfig_Write(string Key, object str)
{
if (SignalConfig.ContainsKey(Key))
{
SignalConfig[Key] = str;
}
else
{
SignalConfig.Add(Key, str);
}
}
}
}

View File

@@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SystemFramework;
namespace MisDataName
{
public partial class SecondForm
{
void InitMainSignalEvent()
{
MisData.PlcChange = new PlcChangeEvent(MainSignalChange);
}
void MainSignalChange(OpcData.CustomeEvetnArgs msgEvent)
{
try
{
int tagType;
string opName, tagValue;
if (msgEvent.TagValue == null) return;
tagType = Convert.ToInt32(msgEvent.TagType);
opName = msgEvent.OpName.ToString();
switch (Convert.ToInt32(msgEvent.TagValueType))
{
case 11:
tagValue = (Convert.ToInt32(msgEvent.TagValue)).ToString();
break;
default:
tagValue = msgEvent.TagValue.ToString();
break;
}
if (Convert.ToInt32(msgEvent.TagValueType)==11)
{
WriteWorkStationSignal(opName, tagType.ToString(), Convert.ToBoolean(Convert.ToInt32(tagValue)));
}
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
}
}

View File

@@ -0,0 +1,138 @@
using MesControl;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using SystemFramework;
namespace MisDataName
{
public delegate void ControlConnectPLC();
public partial class SecondForm
{
ControlConnectPLC PlcConnectTimer;
void InitFormDynamicControls()
{
try
{
// DataTable dt_OpName=(DataTable) FunctionForm_HashiTable.OpName_Hash_Read("OpNameList");
List<MesBoolSignal> signalItems = InitWorkStationSignal();
RecordWorkStationSignal(signalItems);
int RowsWidth = SignalPanel.Width-20;
int RowsNum = RowsWidth / 133;
int i = 0;
foreach (var opName in MesWork.PlcLinkForm.opNameList)
{
PlcWorkStationSignal plcWorkStationSignal = new PlcWorkStationSignal();
plcWorkStationSignal.BackColor = System.Drawing.Color.Transparent;
plcWorkStationSignal.Location = new System.Drawing.Point(3 + ((i % RowsNum) * 133), (i / RowsNum) * ((signalItems.Count * 25) + 60));
plcWorkStationSignal.MaximumSize = new System.Drawing.Size(0, 0);
plcWorkStationSignal.MinimumSize = new System.Drawing.Size(0, 0);
plcWorkStationSignal.Name = "plcWorkStationSignal_" + opName;
plcWorkStationSignal.Size = new System.Drawing.Size(136, 60);
plcWorkStationSignal.TabIndex = i;
plcWorkStationSignal.SignalItems = signalItems;
plcWorkStationSignal.WorkStationNameText = opName;
plcWorkStationSignal.WS_PlcLabelText = "PLC连接";
plcWorkStationSignal.TestPLC_Interval = 10000;
plcWorkStationSignal.TestPLC_Enable = true;
PlcConnectTimer += plcWorkStationSignal.ExternalTimerExcute;
this.SignalPanel.Controls.Add(plcWorkStationSignal);
i++;
}
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
public List<MesBoolSignal> InitWorkStationSignal()
{
try
{
List<MesBoolSignal> signalItems = new List<MesBoolSignal>();
MesBoolSignal MBS;
signalItems.Clear();
XDocument SystemConfig = XDocument.Load("SystemConfig.xml");
IEnumerable<XElement> plc = SystemConfig.Descendants ("PLC");
IEnumerable<XElement> plcSignal = plc.Elements();
foreach (XElement PlcSignal in plcSignal)
{
XElement Name = PlcSignal.Element("Name");
XElement TagType = PlcSignal.Element("TagType");
XElement Text = PlcSignal.Element("Text");
XElement Index = PlcSignal.Element("Index");
XElement Enabled = PlcSignal.Element("Enabled");
MBS = new MesBoolSignal();
MBS.Name = "TagType_" + TagType.Value ;
MBS.SignalText = Text.Value ;
MBS.SignalImage = MesBoolSignal.SignalImage_Enum.none;
if (Convert.ToBoolean(Enabled.Value))
{
signalItems.Add(MBS);
}
}
IEnumerable<XElement> mes = SystemConfig.Descendants("MES");
IEnumerable<XElement> mesSignal = mes.Elements();
foreach (XElement MesSignal in mesSignal)
{
XElement Name = MesSignal.Element("Name");
XElement TagType = MesSignal.Element("TagType");
XElement Text = MesSignal.Element("Text");
XElement Index = MesSignal.Element("Index");
XElement Enabled = MesSignal.Element("Enabled");
MBS = new MesBoolSignal();
MBS.Name = "TagType_" + TagType.Value;
MBS.SignalText = Text.Value;
MBS.SignalImage = MesBoolSignal.SignalImage_Enum.none;
if (Convert .ToBoolean ( Enabled .Value))
{
signalItems.Add(MBS);
}
}
return signalItems;
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
return null;
}
}
string[] SignalNames = new string[50];
void RecordWorkStationSignal(List<MesBoolSignal> items)
{
for (int i=0;i< items.Count;i++)
{
SignalNames[i] = items[i].Name;
}
}
}
}

View File

@@ -0,0 +1,91 @@
namespace MisDataName
{
partial class SecondForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.SignalPanel = new System.Windows.Forms.Panel();
this.groupBox_PlcSignal = new System.Windows.Forms.GroupBox();
this.timer_ControlInternalChange = new System.Windows.Forms.Timer(this.components);
this.groupBox_PlcSignal.SuspendLayout();
this.SuspendLayout();
//
// SignalPanel
//
this.SignalPanel.AutoScroll = true;
this.SignalPanel.Location = new System.Drawing.Point(6, 20);
this.SignalPanel.Name = "SignalPanel";
this.SignalPanel.Size = new System.Drawing.Size(706, 650);
this.SignalPanel.TabIndex = 0;
//
// groupBox_PlcSignal
//
this.groupBox_PlcSignal.Controls.Add(this.SignalPanel);
this.groupBox_PlcSignal.Location = new System.Drawing.Point(12, 12);
this.groupBox_PlcSignal.Name = "groupBox_PlcSignal";
this.groupBox_PlcSignal.Size = new System.Drawing.Size(718, 676);
this.groupBox_PlcSignal.TabIndex = 1;
this.groupBox_PlcSignal.TabStop = false;
this.groupBox_PlcSignal.Text = "LineStatus";
//
// timer_ControlInternalChange
//
this.timer_ControlInternalChange.Enabled = true;
this.timer_ControlInternalChange.Interval = 400;
this.timer_ControlInternalChange.Tick += new System.EventHandler(this.timer_ControlInternalChange_Tick);
//
// SecondForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(741, 700);
this.Controls.Add(this.groupBox_PlcSignal);
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(757, 738);
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(757, 738);
this.Name = "SecondForm";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "PlcSignal";
this.TopMost = true;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SecondForm_FormClosing);
this.LocationChanged += new System.EventHandler(this.SecondForm_LocationChanged);
this.groupBox_PlcSignal.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel SignalPanel;
private System.Windows.Forms.GroupBox groupBox_PlcSignal;
private System.Windows.Forms.Timer timer_ControlInternalChange;
}
}

View File

@@ -0,0 +1,231 @@
using MesControl;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SystemFramework;
namespace MisDataName
{
public partial class SecondForm : Form
{
public SecondForm(Point Position)
{
InitializeComponent();
InitFormDynamicControls();
InitMainSignalEvent();
FormPositionInit(Position);
InitOtherFormAction();
SyncForm_Init();
}
Form MainForm;
public SecondForm(object mainForm)
{
MainForm = (Form)mainForm;
InitializeComponent();
InitFormDynamicControls();
InitMainSignalEvent();
Point Position = new Point(MainForm.Left + MainForm.Width, MainForm.Top);
FormPositionInit(Position);
InitOtherFormAction();
SyncForm_Init();
}
void WorkStation_RefreshWorkStationStatus(string OpName, bool value)
{
try
{
PlcWorkStationSignal plcWorkStationSignal = (PlcWorkStationSignal)Controls.Find("plcWorkStationSignal_" + OpName, true)[0];
plcWorkStationSignal.PlcConnectStatusChange(value);
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
void WriteWorkStationSignal(string OpName,string SignalName,bool value)
{
try
{
if (Array.IndexOf(SignalNames, "TagType_"+SignalName)!=-1)
{
PlcWorkStationSignal plcWorkStationSignal = (PlcWorkStationSignal)Controls.Find("plcWorkStationSignal_" + OpName, true)[0];
plcWorkStationSignal.SignalChange("TagType_"+SignalName, value);
if (SignalName=="14")
{
WorkStation_RefreshWorkStationStatus(OpName, value);
}
}
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
private void SecondForm_FormClosing(object sender, FormClosingEventArgs e)
{
try
{
MisData.PlcChange =null;
if (MisData.SyncSecondForm != null)
{
SyncForm_Cancel();
}
CancelOtherFormAction();
MainForm.BeginInvoke(MainMenuRefresh, "ToolStripMenuItem_VWSStatus");
this.Dispose();
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
void SyncForm_Init()
{
try
{
MisData.SyncSecondForm = new SyncOtherForm(FormSync);
MisData.MainFormActive = new MisDataName.SyncOtherForm(MainFormActive);
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
void SyncForm_Cancel()
{
MisData.SyncSecondForm = null;
MisData.MainFormActive = null;
}
void FormPositionInit(Point Position)
{
try
{
this.Location = (Point)new Size(Position);
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
void FormSync(object Position)
{
try
{
this.Location = (Point)Position;
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
void MainFormActive(object obj)
{
if(Convert .ToBoolean (obj ))
{
this.TopMost = true;
this.TopMost = false;
}
}
void InitOtherFormAction()
{
try
{
MisData.SecondFormClose = new MainAct(this.Close);
MisData.OtherFormHide = new MainAct(HideThisForm);
MisData.OtherFormShow = new MainAct(ShowThisForm);
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
void CancelOtherFormAction()
{
MisData.SecondFormClose = null;
MisData.OtherFormHide = null;
MisData.OtherFormShow = null;
}
void ShowThisForm()
{
this.Show();
this.WindowState = FormWindowState.Normal;
}
void HideThisForm()
{
this.Hide();
}
private void SecondForm_LocationChanged(object sender, EventArgs e)
{
try
{
Point MainPosation=(Point)MisData.QueryMainFormPosition(null);
if(Math.Abs ( MainPosation .X -this .Left)<25&& Math.Abs(MainPosation.Y - this.Top ) < 20)
{
if (MisData.SyncSecondForm == null)
{
SyncForm_Init();
MainForm.Invoke(MisData.MainActived);
FormSync(MainPosation);
}
}
else
{
if (MisData.SyncSecondForm != null)
{
SyncForm_Cancel();
}
}
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
private void timer_ControlInternalChange_Tick(object sender, EventArgs e)
{
if(PlcConnectTimer!=null)
{
PlcConnectTimer();
}
}
}
}

View File

@@ -0,0 +1,123 @@
<?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>
<metadata name="timer_ControlInternalChange.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MisDataName
{
public delegate void SecondAct(string ControlName);
public partial class SecondForm
{
public static SecondAct MainMenuRefresh;
}
}

View File

@@ -0,0 +1,68 @@
using System;
using System.Collections;
using SystemFramework;
using BasicData;
using bizFacade;
namespace MisDataName
{
public partial class MisData
{
//TagTypeID
//X Bit(bool)----Boolean true=-1,false=0 11 1.0
//B Byte(unsigned) ----1 byte Integer without sign 17 1
//W Word(unsigned) ----2 byte Integer without sign 18 2
//D Double word(unsigned) ----4 byte Integer without sign 19 4
//CHAR Byte(signed)----1 byte Integer with sign 16 1
//INT Word(signed) ----2 byte Integer with sign 2 2
//DINT Double word(signed) ----4 byte Integer with sign 3 4
//REAL Float point number----4 byte float number 4 4
//String string 8 每字符一字节
//DT Date and time 8 bytes BCD format 7 8
static public void WritePLC(string tagID, string tagValue)
{
MesDataFunction.OpcOperation.WritePLC(tagID, tagValue);
}
static void WritePLC(string tagID, object tagValue)
{
Write_TagID(tagID, tagValue);
}
static public void WritePLC(int tagType, string opName, object tagValue)
{
Write_TagTypeID(tagType, opName, tagValue);
}
static public object ReadPLC(int tagType, string opName)
{
object obj = null;
Read_TagTypeID(tagType,opName, out obj);
return obj;
}
/// <summary>
/// 获取质量数据Hashtable
/// </summary>
/// <param name="opName"></param>
/// <returns></returns>
static public Hashtable ReadPLC_Sync_DataList_MesRead(string opName)
{
if (IsDemoMesServer == 1)
{
Hashtable valueList=new Hashtable();
ReadPLC_Sync_ValueList(opName, out valueList);
return valueList;
}
else
{
return (Hashtable)MesDataFunction.OpcOperation.ReadPLC_Sync_DataList_MesRead(opName);
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MisDataName
{
public struct ControlData
{
public ControlData(Control Ctrl, string OpName)
{
string[] Array_NameSplit;
Array_NameSplit = Ctrl.Name.Split('_');
TagType = Convert.ToInt32(Array_NameSplit[2]);
opName = OpName;
btn = Ctrl;
}
public int TagType;
public string opName;
public Control btn;
}
public struct ControlChangeByTagType
{
public ControlChangeByTagType(int tagType, string value)
{
TagType = tagType;
Value = value;
}
public int TagType;
public string Value;
}
}

View File

@@ -0,0 +1,83 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using SystemFramework;
namespace MisDataName
{
public partial class MisData
{
void OpenSecondForm_Thread()
{
try
{
ToolStripMenuItem_VWSStatus.Checked = true;
Thread t = new Thread(new ParameterizedThreadStart(OpenSecondForm));
t.Start(this);
SecondForm.MainMenuRefresh = new MisDataName.SecondAct(RefreshToolStripMenuItem_Checked_ByName);
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message );
}
}
Form Sencondform;
void OpenSecondForm( object ThisForm)
{
try
{
SecondForm f1 = new SecondForm( ThisForm);
Sencondform = f1;
f1.ShowDialog();
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message );
}
}
void RefreshToolStripMenuItem_Checked_ByName(string ControlName)
{
try
{
ToolStripItem[] tsItems = menuStrip_Main.Items.Find(ControlName, true);
ToolStripMenuItem tsmItem = (ToolStripMenuItem)tsItems[0];
if (PlcChange == null)
{
tsmItem.Checked = false;
}
else
{
tsmItem.Checked = true;
}
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message );
}
}
object QueryFormPosition(object obj)
{
try
{
return new Point(this.Left + this.Width, this.Top);
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
return null;
}
}
}
}

View File

@@ -0,0 +1,515 @@
using BasicData;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms;
using SystemFramework;
namespace MisDataName
{
public partial class MisData
{
public void InitFormBtnColor()
{
try
{
if (!Cbx_StatusDisplay.Checked) return;
string OpName = WorkStationNum_Now;
foreach (Control GroupBox in this.groupBox_SignialSimulator.Controls)
{
foreach (Control Btn in GroupBox.Controls)
{
if (Btn.Name.Length < 8) continue;
if (Btn.Name.Substring(0, 8) == "Btn_PLC_" || Btn.Name.Substring(0, 8) == "Btn_MES_")
{
ControlData Ctrl1 = new ControlData(Btn, OpName);
Thread t=new Thread(new ParameterizedThreadStart(InitFormBtn_Thread));
t.Start(Ctrl1);
}
}
}
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
static object test;
static void InitFormBtn_Thread(Object obj)
{
try
{
ControlData Btn = (ControlData)obj;
test = ReadPLC(Btn.TagType, Btn.opName);
bool Result = Convert.ToBoolean(test);
if (Btn.btn.InvokeRequired)
{
Action<System.Drawing.Color> actionDelegate = (x) => { Btn.btn.BackColor = x; };
if (Result)
{
Btn.btn.BeginInvoke(actionDelegate, System.Drawing.Color.Green);
}
else
{
Btn.btn.BeginInvoke(actionDelegate, System.Drawing.Color.SlateGray);
}
}
else
{
if (Result)
{
Btn.btn.BackColor = System.Drawing.Color.Green;
}
else
{
Btn.btn.BackColor = System.Drawing.Color.SlateGray;
}
}
}
catch (Exception err)
{
ControlData Btn = (ControlData)obj;
ApplicationLog.WriteLog(err, err.Message+"采集数据值:"+ ";按钮名称:"+test+ Btn.btn .Name +"工位号"+ WorkStationNum_Now);
}
}
/// <summary>
/// 通过点击界面按钮写入Bool信号
/// </summary>
/// <param name="tagType"></param>
/// <param name="opName"></param>
private void WriteBoolSignalByFormBtn(Object Sender)
{
try
{
string BtnName = ((System.Windows.Forms.Control)Sender).Name;
string[] Array_BtnNameSplit = BtnName.Split('_');
int tagType = Convert.ToInt32(Array_BtnNameSplit[2]);
string OpName = WorkStationNum_Now;
QualityDataQueryStruct QualityQueryStruct = new QualityDataQueryStruct(OpName, tagType);
Thread t = new Thread(new ParameterizedThreadStart(WriteBoolSignal_Thread));
t.Start(QualityQueryStruct);
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
void WriteBoolSignal_Thread(object obj)
{
try
{
QualityDataQueryStruct QDQ = (QualityDataQueryStruct)obj;
if (IsDemoMesServer==1)
{
string tagValueStr = "";
Read_TagTypeID(QDQ.tagType, QDQ.OpName, out tagValueStr);
if (tagValueStr=="1")
{
tagValueStr = "True";
}
else if (tagValueStr == "0")
{
tagValueStr = "False";
}
bool ReadResult = Convert.ToBoolean(tagValueStr);
if (ReadResult)
{
Write_TagTypeID(QDQ.tagType, QDQ.OpName, false);
}
else
{
Write_TagTypeID(QDQ.tagType, QDQ.OpName, true);
}
}
else
{
bool ReadResult = Convert.ToBoolean(MesDataFunction.OpcOperation.ReadPLC(QDQ.tagType, QDQ.OpName));
if (ReadResult)
{
MesDataFunction.OpcOperation.WritePLC(QDQ.tagType, QDQ.OpName, false);
}
else
{
MesDataFunction.OpcOperation.WritePLC(QDQ.tagType, QDQ.OpName, true);
}
}
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
/// <summary>
/// 写入机型
/// </summary>
/// <param name="Sender"></param>
private void WriteNormalDataBygroupBox_SignialSimulatorWriteBtn(object Sender)
{
try
{
string BtnName = ((System.Windows.Forms.Control)Sender).Name;
string OpName = WorkStationNum_Now;
if (BtnName == "Btn_Write_PLC")
{
foreach (Control Tbx in this.groupBox_PLC.Controls)
{
if (Tbx.Name.Length < 12) continue;
if (Tbx.Name.Substring(0, 8) != "Tbx_PLC_") continue;
string[] TbxName_Split = Tbx.Name.Split('_');
int TagType = Convert.ToInt32(TbxName_Split[2]);
int tagDataType = Convert.ToInt32(MesDataFunction.OpcOperation.hashtable_TagTypeDataType[TagType.ToString()]);
string tagValue = Tbx.Text.Trim();
short tagValue_int;
string tagValue_str;
byte tagValue_byte;
bool tagValue_bool;
switch (tagDataType)
{
case 2:
if (!Regex.IsMatch(tagValue, @"^[-]?\d*$"))
{
MessageBox.Show("文本框\"" + Tbx.Name + "\"输入不是整数!");
return;
}
if (tagValue == "") return;
tagValue_int = Convert.ToInt16(tagValue);
WriteAnyData_Thread(TagType, OpName, tagValue_int);
break;
case 8:
tagValue_str = tagValue.ToString();
WriteAnyData_Thread(TagType, OpName, tagValue_str);
break;
case 17:
if (!Regex.IsMatch(tagValue, @"^[-]?\d*$"))
{
MessageBox.Show("文本框\"" + Tbx.Name + "\"输入不是整数!");
return;
}
if (Convert.ToInt32(tagValue) > 255)
{
MessageBox.Show("文本框\"" + Tbx.Name + "\"输入数据不在范围内");
return;
}
if (tagValue == "") return;
tagValue_byte = Convert.ToByte(tagValue);
WriteAnyData_Thread(TagType, OpName, tagValue_byte);
break;
case 11:
tagValue_bool = Convert.ToBoolean(Convert.ToInt32(tagValue));
WriteAnyData_Thread(TagType, OpName, tagValue_bool);
break;
default:
tagValue_str = tagValue.ToString();
WriteAnyData_Thread(TagType, OpName, tagValue_str);
break;
}
}
}
else if (BtnName == "Btn_Write_MES")
{
foreach (Control Tbx in this.groupBox_MES.Controls)
{
if (Tbx.Name.Length < 12) continue;
if (Tbx.Name.Substring(0, 8) != "Tbx_MES_") continue;
string[] TbxName_Split = Tbx.Name.Split('_');
int TagType = Convert.ToInt32(TbxName_Split[2]);
int tagDataType = Convert.ToInt32(MesDataFunction.OpcOperation.hashtable_TagTypeDataType[TagType.ToString()]);
string tagValue = Tbx.Text.Trim();
short tagValue_int;
string tagValue_str;
byte tagValue_byte;
bool tagValue_bool;
switch (tagDataType)
{
case 2:
if (!Regex.IsMatch(tagValue, @"^[-]?\d*$"))
{
MessageBox.Show("文本框\"" + Tbx.Name + "\"输入不是整数!");
return;
}
tagValue_int = Convert.ToInt16(tagValue);
WriteAnyData_Thread(TagType, OpName, tagValue_int);
break;
case 8:
tagValue_str = tagValue.ToString();
WriteAnyData_Thread(TagType, OpName, tagValue_str);
break;
case 17:
if (!Regex.IsMatch(tagValue, @"^[-]?\d*$"))
{
MessageBox.Show("文本框\"" + Tbx.Name + "\"输入不是整数!");
return;
}
if (Convert.ToInt32(tagValue) > 255)
{
MessageBox.Show("文本框\"" + Tbx.Name + "\"输入数据不在范围内");
return;
}
tagValue_byte = Convert.ToByte(tagValue);
WriteAnyData_Thread(TagType, OpName, tagValue_byte);
break;
case 11:
tagValue_bool = Convert.ToBoolean(Convert.ToInt32(tagValue));
WriteAnyData_Thread(TagType, OpName, tagValue_bool);
break;
default:
tagValue_str = tagValue.ToString();
WriteAnyData_Thread(TagType, OpName, tagValue_str);
break;
}
}
}
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
void WriteAnyData_Thread(int tagType, string opName, object tagValue)
{
try
{
QualityDataQueryStruct QualityStruct = new QualityDataQueryStruct(opName, tagType, tagValue);
Thread t = new Thread(new ParameterizedThreadStart(WriteNormalDataBygroupBox_SignialSimulatorWriteBtn_Thread));
t.Start(QualityStruct);
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
void WriteNormalDataBygroupBox_SignialSimulatorWriteBtn_Thread(object obj)
{
try
{
QualityDataQueryStruct QualityStruct = (QualityDataQueryStruct)obj;
WritePLC(QualityStruct.tagType, QualityStruct. OpName, QualityStruct.tagValue);
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
/// <summary>
/// 根据工位号查询质量数据,返回质量数据列表
/// </summary>
/// <param name="opName"></param>
/// <returns></returns>
QualityDataType[] ReadPLC_ValueListForQualityDataTypeArray(string opName)
{
try
{
int i1 = 0;
Hashtable valueList;
valueList = MisDataFunction.Function.ReadPLC_Sync_DataList_MesRead(opName);
if (valueList != null)
{
QualityDataType[] QualityValue = new QualityDataType[valueList.Count];
foreach (DictionaryEntry de in valueList)
{
try
{
QualityValue[i1] = (QualityDataType)de.Value;
i1++;
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
//ThisWorkStationData = QualityValue;
return QualityValue;
}
return null;
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
return null;
}
}
public QualityDataType[] ThisWorkStationData
{ get; set; }
object QueryThisWorkStationDataByTagTypeFromThisWorkStationDataProperty(int TagType)
{
try
{
foreach (QualityDataType Data in ThisWorkStationData)
{
if (Data.tagValueType == TagType)
{
return Data.tagValue;
}
}
return null;
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
return null;
}
}
void RefreshBtnColor(object obj)
{
try
{
ControlChangeByTagType ControlValue = (ControlChangeByTagType)obj;
if (!Cbx_StatusDisplay.Checked) return;
string OpName = WorkStationNum_Now;
foreach (Control GroupBox in this.groupBox_SignialSimulator.Controls)
{
foreach (Control Btn in GroupBox.Controls)
{
if (Btn.Name.Length < 8) continue;
if (Btn.Name.Substring(0, 8) == "Btn_PLC_" || Btn.Name.Substring(0, 8) == "Btn_MES_")
{
string BtnName = Btn.Name;
string[] BtnName_SplitArray = BtnName.Split('_');
if (Btn.InvokeRequired)
{
Action<System.Drawing.Color> ActionDelegate = (x) => { Btn.BackColor = x; };
if (Convert.ToInt32(BtnName_SplitArray[2]) == ControlValue.TagType)
{
if (ControlValue.Value == "1")
{
Btn.BeginInvoke(ActionDelegate, System.Drawing.Color.Green);
}
else
{
Btn.BeginInvoke(ActionDelegate, System.Drawing.Color.LightGray);
}
}
}
else
{
if (Convert.ToInt32(BtnName_SplitArray[2]) == ControlValue.TagType)
{
if (ControlValue.Value == "1")
{
Btn.BackColor = System.Drawing.Color.Green;
}
else
{
Btn.BackColor = System.Drawing.Color.LightGray;
}
}
}
}
}
}
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
void RefreshBtnColor_Thread(int TagType, string Value)
{
ControlChangeByTagType ControlValue = new ControlChangeByTagType(TagType, Value);
Thread t = new Thread(new ParameterizedThreadStart(RefreshBtnColor));
t.Start(ControlValue);
}
/// <summary>
/// 按钮颜色还原
/// </summary>
void RefreshBtnColorWriteNull()
{
try
{
string OpName = WorkStationNum_Now;
foreach (Control GroupBox in this.groupBox_SignialSimulator.Controls)
{
foreach (Control Btn in GroupBox.Controls)
{
if (Btn.Name.Length < 8) continue;
if (Btn.Name.Substring(0, 8) == "Btn_PLC_" || Btn.Name.Substring(0, 8) == "Btn_MES_")
{
if (Btn.InvokeRequired)
{
Action<System.Drawing.Color> ActionDelegate = (x) => { Btn.BackColor = x; };
Btn.BeginInvoke(ActionDelegate, System.Drawing.Color.LightGray);
}
else
{
Btn.BackColor = System.Drawing.Color.LightGray;
}
}
}
}
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
}
}

View File

@@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading;
using SystemFramework;
namespace MisDataName
{
partial class MisData
{
void TestPlcConnectInit()
{
//try
//{
// DataTable dt_OpName = (DataTable)FunctionForm_HashiTable.OpName_Hash_Read("OpNameList");
// for (int i=0;i< dt_OpName.Rows .Count;i++)
// {
// TestPlcConnect NewPlcConnect = new TestPlcConnect(dt_OpName.Rows [i][0].ToString ());
// TestPlcConnect.TestPlcTimerChangedDelegate += NewPlcConnect.ExternalTimerExcute;
// NewPlcConnect.PlcConnect += PlcStatusChanged_Connect;
// NewPlcConnect.PlcBreak += PlcStatusChanged_Break;
// TestPlcConnect.HashTable_Write(TestPlcConnect.WorkStationTestExample, dt_OpName.Rows[i][0].ToString(), NewPlcConnect);
// }
//}
//catch (Exception err)
//{
// ApplicationLog.WriteLog(err, err.Message);
//}
}
public static void PlcStatusChanged_Connect(object sender, EventArgs e)
{
try
{
//查询在线工位数量
int i= TestPlcConnect. CalculateWorkStationCount("OnlineWorkStation");
if (MisData.TestPlcStatusDel!=null )
MisData.TestPlcStatusDel(i.ToString (), e);
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
public static void PlcStatusChanged_Break(object sender, EventArgs e)
{
try
{
//查询在线工位数量
int i = TestPlcConnect.CalculateWorkStationCount("OnlineWorkStation");
if (MisData.TestPlcStatusDel != null)
MisData.TestPlcStatusDel(i.ToString(), e);
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
void ListBox1_Item_Init()
{
listBox1.Items.Clear();
foreach (var i in MesDataFunction.OpcOperation.hashtable_TagType)
{
listBox1.Items.Add("MES|" + i.ToString() + "|"+ WorkStationNum_Now + "|1");
}
}
}
}

View File

@@ -0,0 +1,87 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MisDataName
{
public struct QualityDataQueryStruct
{
public QualityDataQueryStruct(string opName, Control ctrl)
{
OpName = opName;
Ctrl = ctrl;
tagType = 0;
tagValue = "";
tagID = "";
tagTypeID = 0;
tempForm = null;
tagValue2 = null;
}
public QualityDataQueryStruct(string opName,int TagType)
{
OpName = opName;
Ctrl = null;
tagType = TagType;
tagValue = "";
tagID = "";
tagTypeID = 0;
tempForm = null;
tagValue2 = null;
}
public QualityDataQueryStruct(string opName, int TagType, Control ctrl)
{
OpName = opName;
Ctrl = ctrl;
tagType = TagType;
tagValue = "";
tagID = "";
tagTypeID = 0;
tempForm = null;
tagValue2 = null;
}
public QualityDataQueryStruct(string opName, int TagType,object TagValue)
{
OpName = opName;
Ctrl = null;
tagType = TagType;
tagValue = TagValue;
tagID = "";
tagTypeID = 0;
tempForm = null;
tagValue2 = null;
}
public QualityDataQueryStruct(string TagID,int TagTypeID , object TagValue, object TagValue2, Form TempForm)
{
OpName = "" ;
Ctrl = null;
tagType = 0;
tagValue = TagValue;
tagID = TagID;
tagTypeID = TagTypeID;
tempForm = TempForm;
tagValue2 = TagValue2;
}
public string OpName;
public Control Ctrl;
public int tagType;
public object tagValue;
public object tagValue2;
public string tagID;
public int tagTypeID;
public Form tempForm;
}
}

View File

@@ -0,0 +1,107 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using SystemFramework;
namespace MisDataName
{
public partial class MisData
{
void ReadPLC_ProductInfo()
{
try
{
foreach (Control Tbx in this.groupBox_PLC.Controls)
{
Thread t = new Thread(new ParameterizedThreadStart(ReadPLC_ProductInfo_Thread));
t.Start(Tbx);
}
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
void ReadPLC_ProductInfo_Thread(object obj)
{
try
{
Control Tbx = (Control)obj;
if (Tbx.Name.Length < 12) return;
if (Tbx.Name.Substring(0, 8) != "Tbx_PLC_") return;
string[] TbxName_Split = Tbx.Name.Split('_');
int TagType = Convert.ToInt32(TbxName_Split[2]);
if (Tbx.InvokeRequired )
{
Action<string> actionDelegate = (x) => { Tbx.Text = x; };
Tbx.BeginInvoke(actionDelegate, ReadPLC(TagType, WorkStationNum_Now).ToString());
}
else
{
Tbx.Text = ReadPLC(TagType, WorkStationNum_Now).ToString();
}
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
void ReadMES_ProductInfo()
{
try
{
foreach (Control Tbx in this.groupBox_MES.Controls)
{
Thread t = new Thread(new ParameterizedThreadStart(ReadMES_ProductInfo_Thread));
t.Start(Tbx);
}
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
void ReadMES_ProductInfo_Thread(object obj)
{
try
{
Control Tbx = (Control)obj;
if (Tbx.Name.Length < 12) return;
if (Tbx.Name.Substring(0, 8) != "Tbx_MES_") return;
string[] TbxName_Split = Tbx.Name.Split('_');
int TagType = Convert.ToInt32(TbxName_Split[2]);
if (Tbx .InvokeRequired )
{
Action<string> ActionDelegate = (x) => { Tbx.Text = x; };
Tbx.BeginInvoke(ActionDelegate, ReadPLC(TagType, WorkStationNum_Now).ToString());
}
else
{
Tbx.Text = ReadPLC(TagType, WorkStationNum_Now).ToString();
}
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
}
}

View File

@@ -0,0 +1,175 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace MisDataName
{
public delegate void TestPlcDelegate();
public class TestPlcConnect
{
public static Hashtable WorkStationStatus_Hash = new Hashtable();
public static Hashtable WorkStationTestExample = new Hashtable();
string WorkStationStr = "";
public EventHandler PlcBreak,PlcConnect;
bool PlcStatus=false ;
static int testTime = 10;
int TestInterval = testTime;
string OpName;
public TestPlcConnect(string opName)
{
OpName = opName;
}
public void ExternalSignalChange()
{
TestInterval = testTime;
if(!PlcStatus)
{
WorkStationStr=ReadWorkStationStr("OnlineWorkStation");
HashTable_Write(WorkStationStatus_Hash,"OnlineWorkStation", String_Combine(WorkStationStr, OpName));
WorkStationStr = ReadWorkStationStr("DownlineWorkStation");
HashTable_Write(WorkStationStatus_Hash, "DownlineWorkStation", String_Spl(WorkStationStr, OpName));
if (PlcConnect != null)
{
PlcConnect(OpName, null);
}
PlcStatus = true;
}
}
public void ExternalTimerExcute()
{
if (TestInterval>0)
{
TestInterval--;
}
else
{
if(PlcStatus)
{
WorkStationStr = ReadWorkStationStr("DownlineWorkStation");
HashTable_Write(WorkStationStatus_Hash, "DownlineWorkStation", String_Combine(WorkStationStr, OpName));
WorkStationStr = ReadWorkStationStr("OnlineWorkStation");
HashTable_Write(WorkStationStatus_Hash, "OnlineWorkStation", String_Spl(WorkStationStr, OpName));
if (PlcBreak != null)
{
PlcBreak(OpName, null);
}
PlcStatus = false;
}
}
}
public static void HashTable_Write(Hashtable hashtable, string Key,object obj)
{
if (hashtable.ContainsKey (Key))
{
hashtable[Key] = obj;
}
else
{
hashtable.Add(Key, obj);
}
}
public static object HashTable_Read(Hashtable hashtable, string Key)
{
if (hashtable.ContainsKey(Key))
{
return hashtable[Key];
}
else
{
return null;
}
}
string ReadWorkStationStr(string Key)
{
if ( HashTable_Read(WorkStationStatus_Hash, Key) !=null )
{
return HashTable_Read(WorkStationStatus_Hash, Key).ToString();
}
return "";
}
string String_Combine(string MainStr,string AddStr)
{
return MainStr+ AddStr + "|";
}
string String_Spl(string MainStr, string DelStr)
{
return MainStr.Replace(DelStr + "|", "");
}
public static int CalculateWorkStationCount(string Key)
{
string wksta="";
if(WorkStationStatus_Hash.ContainsKey (Key))
{
wksta = WorkStationStatus_Hash[Key].ToString();
}
string[] wksta_SplitArray = wksta.Split('|');
return wksta_SplitArray.Length-1;
}
public static void HeartBeatChange(string OpName, int TagTypeID)
{
if (TagTypeID == 14)
{
Thread t = new Thread(new ParameterizedThreadStart(HeartBeatChange_Thread));
t.Start(OpName);
}
}
static void HeartBeatChange_Thread(object obj)
{
string OpName = (string)obj;
if (TestPlcConnect.HashTable_Read(TestPlcConnect.WorkStationTestExample, OpName) != null)
{
TestPlcConnect PlcConnectExample = (TestPlcConnect)TestPlcConnect.HashTable_Read(TestPlcConnect.WorkStationTestExample, OpName);
PlcConnectExample.ExternalSignalChange();
}
}
}
}

View File

@@ -0,0 +1,128 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SystemFramework;
using System.Threading;
namespace MisDataName
{
public partial class MisData
{
void initStationStatus()
{
try
{
if (!Cbx_StatusDisplay.Checked) return;
foreach (Control Tbx in this.groupBox_WorkStationStatus.Controls)
{
Thread t = new Thread(new ParameterizedThreadStart(initStationStatus_Thread));
t.Start(Tbx);
}
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
void initStationStatus_Thread(object obj )
{
try
{
Control Tbx = (Control)obj;
if (Tbx.Name.Length < 12) return ;
if (Tbx.Name.Substring(0, 11) == "Tbx_Status_")
{
string[] TbxNameSplitArray = Tbx.Name.Split('_');
int Tagtype = Convert.ToInt32(TbxNameSplitArray[2]);
if (Tbx .InvokeRequired )
{
Action<string> ActionDelegate = (x) => { Tbx.Text = x; };
Tbx.BeginInvoke(ActionDelegate, MesDataFunction.OpcOperation.ReadPLC(Tagtype, WorkStationNum_Now).ToString());
}
else
{
Tbx.Text = MesDataFunction.OpcOperation.ReadPLC(Tagtype, WorkStationNum_Now).ToString();
}
}
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
void RefreshStationStatus(object obj)
{
try
{
ControlChangeByTagType ControlValue = (ControlChangeByTagType)obj;
if (!Cbx_StatusDisplay.Checked) return;
foreach (Control Tbx in this.groupBox_WorkStationStatus.Controls)
{
if (Tbx.Name.Length < 12) continue;
if (Tbx.Name.Substring(0, 11) == "Tbx_Status_")
{
string[] TbxNameSplitArray = Tbx.Name.Split('_');
int Tagtype = Convert.ToInt32(TbxNameSplitArray[2]);
if (ControlValue.TagType == Tagtype)
{
if (Tbx.InvokeRequired)
{
Action<string> ActionDelegate = (x) => { Tbx.Text = x; };
Tbx.BeginInvoke(ActionDelegate, ControlValue.Value);
}
else
{
Tbx.Text = ControlValue.Value;
}
}
}
}
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
void RefreshStationStatus_Thread(int TargetTagtype, string TbxText)
{
ControlChangeByTagType ControlValue = new MisDataName.ControlChangeByTagType(TargetTagtype, TbxText);
Thread t = new Thread(new ParameterizedThreadStart(RefreshStationStatus));
t.Start(ControlValue);
}
void RefreshStationStatusWriteNull()
{
try
{
foreach (Control Tbx in this.groupBox_WorkStationStatus.Controls)
{
if (Tbx.Name.Length < 12) continue;
if (Tbx.Name.Substring(0, 11) == "Tbx_Status_")
{
Tbx.Text = "未开启同步";
}
}
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
}
}

View File

@@ -0,0 +1,114 @@
namespace MisDataName
{
partial class WriteQualityValueForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label_Message = new System.Windows.Forms.Label();
this.textBox_InputValue = new System.Windows.Forms.TextBox();
this.button_OK = new System.Windows.Forms.Button();
this.button_Cancle = new System.Windows.Forms.Button();
this.comboBox_InputValue = new System.Windows.Forms.ComboBox();
this.SuspendLayout();
//
// label_Message
//
this.label_Message.AutoSize = true;
this.label_Message.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label_Message.Location = new System.Drawing.Point(15, 10);
this.label_Message.Name = "label_Message";
this.label_Message.Size = new System.Drawing.Size(41, 12);
this.label_Message.TabIndex = 0;
this.label_Message.Text = "label1";
//
// textBox_InputValue
//
this.textBox_InputValue.Location = new System.Drawing.Point(10, 50);
this.textBox_InputValue.Name = "textBox_InputValue";
this.textBox_InputValue.Size = new System.Drawing.Size(475, 21);
this.textBox_InputValue.TabIndex = 1;
//
// button_OK
//
this.button_OK.Location = new System.Drawing.Point(268, 81);
this.button_OK.Name = "button_OK";
this.button_OK.Size = new System.Drawing.Size(95, 25);
this.button_OK.TabIndex = 2;
this.button_OK.Text = "OK";
this.button_OK.UseVisualStyleBackColor = true;
this.button_OK.Click += new System.EventHandler(this.button_OK_Click);
//
// button_Cancle
//
this.button_Cancle.Location = new System.Drawing.Point(369, 81);
this.button_Cancle.Name = "button_Cancle";
this.button_Cancle.Size = new System.Drawing.Size(95, 25);
this.button_Cancle.TabIndex = 2;
this.button_Cancle.Text = "Cancel";
this.button_Cancle.UseVisualStyleBackColor = true;
this.button_Cancle.Click += new System.EventHandler(this.button_Cancle_Click);
//
// comboBox_InputValue
//
this.comboBox_InputValue.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox_InputValue.FormattingEnabled = true;
this.comboBox_InputValue.Items.AddRange(new object[] {
"false",
"true"});
this.comboBox_InputValue.Location = new System.Drawing.Point(10, 50);
this.comboBox_InputValue.Name = "comboBox_InputValue";
this.comboBox_InputValue.Size = new System.Drawing.Size(475, 20);
this.comboBox_InputValue.TabIndex = 3;
//
// WriteQualityValueForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(494, 111);
this.Controls.Add(this.comboBox_InputValue);
this.Controls.Add(this.button_Cancle);
this.Controls.Add(this.button_OK);
this.Controls.Add(this.textBox_InputValue);
this.Controls.Add(this.label_Message);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "WriteQualityValueForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Write value";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label_Message;
private System.Windows.Forms.TextBox textBox_InputValue;
private System.Windows.Forms.Button button_OK;
private System.Windows.Forms.Button button_Cancle;
private System.Windows.Forms.ComboBox comboBox_InputValue;
}
}

View File

@@ -0,0 +1,265 @@
using System;
using System.Windows.Forms;
using BasicData;
using System.Text.RegularExpressions;
using SystemFramework;
using System.Threading;
namespace MisDataName
{
public partial class WriteQualityValueForm : Form
{
QualityDataType SelectListData;
Form MainForm;
public WriteQualityValueForm(QualityDataType SelectData,Form Mainform)
{
try
{
InitializeComponent();
SelectListData = new QualityDataType();
SelectListData = SelectData;
SetForm(SelectData.tagTypeID, SelectData.tagValue);
MainForm = Mainform;
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
private void button_OK_Click(object sender, EventArgs e)
{
try
{
if (!TagTypeID_Confirm(SelectListData.tagTypeID)) return;
this.Hide () ;
QualityDataQueryStruct QualityStruct = new QualityDataQueryStruct(SelectListData.tagID , SelectListData.tagTypeID , comboBox_InputValue.SelectedIndex.ToString(), textBox_InputValue.Text,this);
Thread t = new Thread(new ParameterizedThreadStart(WriteQualityDataByTagID_Thread));
t.Start(QualityStruct);
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
void WriteQualityDataByTagID_Thread(object obj)
{
try
{
QualityDataQueryStruct QualityStruct = (QualityDataQueryStruct)obj;
Form ThisForm = (Form)QualityStruct.tempForm;
if (QualityStruct.tagTypeID == 11)
{
MisData.WritePLC(QualityStruct.tagID, QualityStruct.tagValue.ToString());
}
else
{
MisData.WritePLC(SelectListData.tagID, QualityStruct.tagValue2.ToString());
}
MainForm.BeginInvoke (MisData.MainFormRefresh, null, null);
Action ActionDelete = () => { this.Close();this.Dispose(); };
if(this.InvokeRequired )
{
ThisForm.BeginInvoke(ActionDelete);
}
else
{
ActionDelete();
}
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
private void button_Cancle_Click(object sender, EventArgs e)
{
this.Close();
this.Dispose();
}
void SetForm( int TagTypeID,object TagValue)
{
try
{
switch (TagTypeID)
{
case 11://BOOL
comboBox_InputValue.Enabled = true;
comboBox_InputValue.Visible = true;
textBox_InputValue.Enabled = false;
textBox_InputValue.Visible = false;
label_Message.Text = "Data type: Boolean";
if (Convert.ToBoolean(TagValue))
{
comboBox_InputValue.SelectedIndex = 1;
}
else
{
comboBox_InputValue.SelectedIndex = 0;
}
break;
case 2://INT.
label_Message.Text = "Data type: Int16 Range from -32768 to 32767";
comboBox_InputValue.Enabled = false;
comboBox_InputValue.Visible = false;
textBox_InputValue.Enabled = true;
textBox_InputValue.Visible = true;
textBox_InputValue.Text = TagValue.ToString();
break;
case 17://BYTE
label_Message.Text = "Data type: Byte Range from 0 to 255";
comboBox_InputValue.Enabled = false;
comboBox_InputValue.Visible = false;
textBox_InputValue.Enabled = true;
textBox_InputValue.Visible = true;
textBox_InputValue.Text = TagValue.ToString();
break;
case 8://STRING
label_Message.Text = "Data type: String";
comboBox_InputValue.Enabled = false;
comboBox_InputValue.Visible = false;
textBox_InputValue.Enabled = true;
textBox_InputValue.Visible = true;
textBox_InputValue.Text = TagValue.ToString();
break;
case 18://Word
label_Message.Text = "Data type: UInt16 Range from 0 to 65535";
comboBox_InputValue.Enabled = false;
comboBox_InputValue.Visible = false;
textBox_InputValue.Enabled = true;
textBox_InputValue.Visible = true;
textBox_InputValue.Text = TagValue.ToString();
break;
case 4://real
label_Message.Text = "Data type: Single Range from -3.402823E+38 to 3.402823E+38";
comboBox_InputValue.Enabled = false;
comboBox_InputValue.Visible = false;
textBox_InputValue.Enabled = true;
textBox_InputValue.Visible = true;
textBox_InputValue.Text = TagValue.ToString();
break;
default://Unknow
label_Message.Text = "Data type: Unknow";
comboBox_InputValue.Enabled = false;
comboBox_InputValue.Visible = false;
textBox_InputValue.Enabled = true;
textBox_InputValue.Visible = true;
textBox_InputValue.Text = TagValue.ToString();
break;
}
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
bool TagTypeID_Confirm( int TagTypeID)
{
try
{
switch (TagTypeID)
{
case 2://INT
//TextBox存在非数字字符 报错
if (!Regex.IsMatch(textBox_InputValue.Text, @"^[-]?\d*$"))
{
MessageBox.Show("输入不是整数!");
return false;
}
if (textBox_InputValue.Text.Length > 9)
{
MessageBox.Show("输入数据不在范围内");
return false;
}
break;
case 17://BYTE
//TextBox存在非数字字符 报错
if (!Regex.IsMatch(textBox_InputValue.Text, @"^[-]?\d*$"))
{
MessageBox.Show("输入不是整数!");
return false;
}
if (Convert.ToInt32(textBox_InputValue.Text.Trim()) > 255)
{
MessageBox.Show("输入数据不在范围内");
return false;
}
break;
case 8://STRING
break;
case 18://Word
//TextBox存在非数字字符 报错
if (!Regex.IsMatch(textBox_InputValue.Text, @"^[-]?\d*$"))
{
MessageBox.Show("输入不是整数!");
return false;
}
if (textBox_InputValue.Text.Trim().Length > 4)
{
MessageBox.Show("输入数据不在范围内");
return false;
}
break;
case 4://real
//TextBox存在非数字字符 报错
//TextBox存在非数字字符 报错
if (!Regex.IsMatch(textBox_InputValue.Text, @"^-?\d+\.?\d*$"))
{
MessageBox.Show("输入不是实数!");
return false;
}
break;
default:
break;
}
return true;
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
return true;
}
}
}
}

View File

@@ -0,0 +1,120 @@
<?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>
</root>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,356 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2A10D165-63D7-4FA5-BAB9-340599AAF4F0}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MisData</RootNamespace>
<AssemblyName>MisData</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\MisData\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Mes32X32.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="AsyncIO">
<HintPath>..\DLL\AsyncIO.dll</HintPath>
</Reference>
<Reference Include="BasicData">
<HintPath>..\DLL\BasicData.dll</HintPath>
</Reference>
<Reference Include="BouncyCastle.Crypto">
<HintPath>..\DLL\BouncyCastle.Crypto.dll</HintPath>
</Reference>
<Reference Include="ConLink">
<HintPath>..\DLL\ConLink.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib">
<HintPath>..\DLL\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="MesControl, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\MesControl\bin\Debug\MesControl.dll</HintPath>
</Reference>
<Reference Include="MesWork.DeviceDriver">
<HintPath>..\DLL\MesWork.DeviceDriver.dll</HintPath>
</Reference>
<Reference Include="MesWork.PLC">
<HintPath>..\DLL\MesWork.PLC.dll</HintPath>
</Reference>
<Reference Include="Monitor.MesWork">
<HintPath>..\DLL\Monitor.MesWork.dll</HintPath>
</Reference>
<Reference Include="MQTTnet">
<HintPath>..\DLL\MQTTnet.dll</HintPath>
</Reference>
<Reference Include="MQTTnet.Extensions.ManagedClient">
<HintPath>..\DLL\MQTTnet.Extensions.ManagedClient.dll</HintPath>
</Reference>
<Reference Include="NetMQ">
<HintPath>..\DLL\NetMQ.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NPOI">
<HintPath>..\DLL\NPOI.dll</HintPath>
</Reference>
<Reference Include="NPOI.OOXML">
<HintPath>..\DLL\NPOI.OOXML.dll</HintPath>
</Reference>
<Reference Include="NPOI.OpenXml4Net">
<HintPath>..\DLL\NPOI.OpenXml4Net.dll</HintPath>
</Reference>
<Reference Include="NPOI.OpenXmlFormats">
<HintPath>..\DLL\NPOI.OpenXmlFormats.dll</HintPath>
</Reference>
<Reference Include="Opc.Ua.Client">
<HintPath>..\DLL\Opc.Ua.Client.dll</HintPath>
</Reference>
<Reference Include="Opc.Ua.Configuration">
<HintPath>..\DLL\Opc.Ua.Configuration.dll</HintPath>
</Reference>
<Reference Include="Opc.Ua.Core">
<HintPath>..\DLL\Opc.Ua.Core.dll</HintPath>
</Reference>
<Reference Include="OpcUaHelper">
<HintPath>..\DLL\OpcUaHelper.dll</HintPath>
</Reference>
<Reference Include="SqlCmd">
<HintPath>..\DLL\SqlCmd.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http">
<HintPath>..\DLL\System.Net.Http.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Formatting">
<HintPath>..\DLL\System.Net.Http.Formatting.dll</HintPath>
</Reference>
<Reference Include="System.ServiceModel" />
<Reference Include="System.Web.Cors">
<HintPath>..\DLL\System.Web.Cors.dll</HintPath>
</Reference>
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Http">
<HintPath>..\DLL\System.Web.Http.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http.Cors">
<HintPath>..\DLL\System.Web.Http.Cors.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http.SelfHost">
<HintPath>..\DLL\System.Web.Http.SelfHost.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="FunctionForm\FunctionForm_HashiTable.cs" />
<Compile Include="FunctionForm\MainSignalChangeEvent.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FunctionForm\SecondForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FunctionForm\SecondForm.Designer.cs">
<DependentUpon>SecondForm.cs</DependentUpon>
</Compile>
<Compile Include="FunctionForm\PlcSignalDynamicCreate.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FunctionForm\SecondFormDelegate.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="LoadInitOpcData_Using\MIS.OpcServerMIS.Write.LoadInitOpcData.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MisAddition\MisAdditionInit.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MisAddition\TestPlcConnect.cs" />
<Compile Include="MisDataChange\MesData.TagTypeCodeID.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MisDataChange\MisData.SyncRawData.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MisDataChange\MisData.ShowMessagePLC.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MisDataChange\MisData.WebServerInterface.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MisDataChange\MisData.Change.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MisDataChange\MesData.MisDataChange.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MisDataChange\MesData.WebAndBarChange.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MisAddition\ControlData.cs" />
<Compile Include="MisAddition\ForOtherForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MisAddition\QualityDataQueryStruct.cs" />
<Compile Include="MisMenuFunction\Help\Versions\VersionsInformation.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MisMenuFunction\Help\Versions\VersionsInformation.Designer.cs">
<DependentUpon>VersionsInformation.cs</DependentUpon>
</Compile>
<Compile Include="MisMenuFunction\MainFormDelegate.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MisMenuFunction\Start\MainLockConfirm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MisMenuFunction\Start\MainLockConfirm.Designer.cs">
<DependentUpon>MainLockConfirm.cs</DependentUpon>
</Compile>
<Compile Include="MisMenuFunction\Start\MainLockForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MisMenuFunction\Start\MainLockForm.Designer.cs">
<DependentUpon>MainLockForm.cs</DependentUpon>
</Compile>
<Compile Include="MisMenuFunction\MisMenuFunHash.cs" />
<Compile Include="MisMenuFunction\Start\PrintScreen.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MisAddition\ReadThisStationProductInfo.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MisAddition\ThisStationStatusDisplay.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MisAddition\ManualSimulateSignal.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MisData.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MisData.Designer.cs">
<DependentUpon>MisData.cs</DependentUpon>
</Compile>
<Compile Include="MisMenuFunction\Start\SavePLCMessage.cs" />
<Compile Include="MisMenuFunction\Windows\AssemblyManagement.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MisMenuFunction\Windows\AssemblyManagement.Designer.cs">
<DependentUpon>AssemblyManagement.cs</DependentUpon>
</Compile>
<Compile Include="MisMenuFunction\Windows\UploadAssembly.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MisMenuFunction\Windows\UploadAssembly.Designer.cs">
<DependentUpon>UploadAssembly.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="MisAddition\WriteQualityValueForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MisAddition\WriteQualityValueForm.Designer.cs">
<DependentUpon>WriteQualityValueForm.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="FunctionForm\SecondForm.resx">
<DependentUpon>SecondForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MisData.resx">
<DependentUpon>MisData.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="MisMenuFunction\Help\Versions\VersionsInformation.resx">
<DependentUpon>VersionsInformation.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="MisMenuFunction\Start\MainLockConfirm.resx">
<DependentUpon>MainLockConfirm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MisMenuFunction\Start\MainLockForm.resx">
<DependentUpon>MainLockForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="MisMenuFunction\Windows\AssemblyManagement.resx">
<DependentUpon>AssemblyManagement.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MisMenuFunction\Windows\UploadAssembly.resx">
<DependentUpon>UploadAssembly.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="MisAddition\WriteQualityValueForm.resx">
<DependentUpon>WriteQualityValueForm.cs</DependentUpon>
</EmbeddedResource>
<None Include="App.config">
<SubType>Designer</SubType>
</None>
<None Include="app.manifest" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="logo1.ico" />
<Content Include="Mes32X32.ico" />
<None Include="MES方标1.png" />
<None Include="ME长标.png" />
<None Include="MES图片.jpg" />
<None Include="MES方标.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Common\00-2AppConfigSet\AppConfigSet\00-1AppConfigSetForm.csproj">
<Project>{5fd5de57-cc26-4fd0-b852-5362123bc4ff}</Project>
<Name>00-1AppConfigSetForm</Name>
</ProjectReference>
<ProjectReference Include="..\..\Common\01DoWhatPlc\01_01DoWhatPlc.csproj">
<Project>{0d1af432-439a-4920-8692-43ae139f5530}</Project>
<Name>01_01DoWhatPlc</Name>
</ProjectReference>
<ProjectReference Include="..\02DataLinkMesWork\00_DataLinkMesWork.csproj">
<Project>{97127b87-d43d-457c-9894-5f2244e4d2e7}</Project>
<Name>00_DataLinkMesWork</Name>
</ProjectReference>
<ProjectReference Include="..\MES.BizFacade\02_P1.MIS.BizFacade.csproj">
<Project>{f191342c-2dbe-4865-84c3-6b6a286c7686}</Project>
<Name>02_P1.MIS.BizFacade</Name>
</ProjectReference>
<ProjectReference Include="..\MesDataFunctionWebApi\01_MesDataFunctionWebApi.csproj">
<Project>{0d55e2c7-82a4-4607-b4cc-e6cf2c1d1e4a}</Project>
<Name>01_MesDataFunctionWebApi</Name>
</ProjectReference>
<ProjectReference Include="..\MesDataFunction\01_MesDataFunction.csproj">
<Project>{594929d5-60d6-4049-9d3b-a6642b5ccb77}</Project>
<Name>01_MesDataFunction</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,247 @@
using OpcData;
using System;
using SystemFramework;
using System.Threading;
using System.Collections;
using System.Collections.Specialized;
using DataLinkMesWork;
namespace MisDataName
{
//public partial class ___ { }
public partial class MisData
{
//
private void TagData_MisData_TagDataOnChangeCustomeEvetnArgs(object msgEvent)
{
lock (locker)
{
try
{
CustomeEvetnArgs e = (CustomeEvetnArgs)msgEvent;
string OpName = e.OpName.ToString();//工位号
string MesCode = e.TagType.ToString();//变量类型代码
object tagValue = e.TagValue;//变量0或者1
string cmd = "";
cmd = MesDataFunction.OpcOperation.hashtable_TagTypeTagName[MesCode];
string mesServerdllName;
mesServerdllName = GetMesServeDllByOpName(OpName);
//DoWhatPlc.ReturnValueString rv =
//new DoWhatPlc.ReturnValueString(e.TagID.ToString(), e.TagValue.ToString(), e.OpName.ToString(), e.TagValueType.ToString(), e.TagType.ToString(), e.TagKeepTime.ToString(), mesServerdllName, fun, mesServerCode.ToString("00"));
//string rvMsg = Newtonsoft.Json.JsonConvert.SerializeObject(rv);
//if (MesCode == "0") return;
string fun = "fun_" + cmd;
int mesServerCode;
mesServerCode = GetMesServerCodeByOpName(OpName);
string rvMsg = Newtonsoft.Json.JsonConvert.SerializeObject(e);
string msg;
if (cmd == null)
{
//DoWhatPlc.ReturnValueString rv =
//new DoWhatPlc.ReturnValueString(e.TagID.ToString(), e.TagValue.ToString(), e.OpName.ToString(), e.TagTypeCodeID.ToString(), e.TagTypeID.ToString(), e.TagKeepTime.ToString(), mesServerdllName, fun, mesServerCode.ToString("00"),
//e.TimeStamp, e.TimeStampBefore, e.TagValueBefore.ToString(), e.TagName.ToString(), e.ItemName.ToString(), e.ShaftID.ToString(), e.TagOrderBy.ToString());
//string rvMsg = Newtonsoft.Json.JsonConvert.SerializeObject(rv);
cmd = MesCode;
msg = $"PLC|{cmd}|{OpName}|{rvMsg}";
}
else
{
//if (Convert.ToInt32(MesDataFunction.OpcOperation.hashtable_MesTagTypeChange[cmd]) == 0 && MesDataFunction.OpcOperation.hashtable_MesTagTypeChange[cmd] != null) return;
//DoWhatPlc.ReturnValueString rv =
//new DoWhatPlc.ReturnValueString(e.TagID.ToString(), e.TagValue.ToString(), e.OpName.ToString(), e.TagTypeCodeID.ToString(), e.TagTypeID.ToString(), e.TagKeepTime.ToString(), mesServerdllName, fun, mesServerCode.ToString("00"),
//e.TimeStamp, e.TimeStampBefore, e.TagValueBefore.ToString(), e.TagName.ToString(), e.ItemName.ToString(), e.ShaftID.ToString(), e.TagOrderBy.ToString());
////DoWhatPlc.ReturnValueString rv =
////new DoWhatPlc.ReturnValueString(e.TagID.ToString(), e.TagValue.ToString(), e.OpName.ToString(), e.TagValueType.ToString(), e.TagType.ToString(), e.TagKeepTime.ToString(), mesServerdllName, fun, mesServerCode.ToString("00"));
//string rvMsg = Newtonsoft.Json.JsonConvert.SerializeObject(rv);
msg = $"PLC|{cmd}|{OpName}|{rvMsg}";
//MesServerWork.MIS_BASE.asyncSendMessagePLC(mesServerdllName, msg);
//MesServerFunction(OpName, tagValue, fun);
}
MesServerWork.MIS_BASE.asyncSendMessagePLC(mesServerdllName, msg,OpName);
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, "TagData_Lable_TagDataOnChange");
}
}
}
//private void TagData_MisData_TagDataOnChange(object msgEvent)
//{
// lock (locker)
// {
// try
// {
// CustomeEvetnArgs e = (CustomeEvetnArgs)msgEvent;
// string OpName = e.OpName.ToString();//工位号
// string MesCode = e.TagType.ToString();//变量类型代码
// object tagValue = e.TagValue;//变量0或者1
// string cmd = "";
// cmd = MesDataFunction.OpcOperation.hashtable_TagTypeTagName[MesCode];
// string mesServerdllName;
// mesServerdllName = GetMesServeDllByOpName(OpName);
// //DoWhatPlc.ReturnValueString rv =
// //new DoWhatPlc.ReturnValueString(e.TagID.ToString(), e.TagValue.ToString(), e.OpName.ToString(), e.TagValueType.ToString(), e.TagType.ToString(), e.TagKeepTime.ToString(), mesServerdllName, fun, mesServerCode.ToString("00"));
// //string rvMsg = Newtonsoft.Json.JsonConvert.SerializeObject(rv);
// //if (MesCode == "0") return;
// string fun = "fun_" + cmd;
// int mesServerCode;
// mesServerCode = GetMesServerCodeByOpName(OpName);
// if (cmd == null)
// {
// string rvMsg = Newtonsoft.Json.JsonConvert.SerializeObject(e);
// cmd = MesCode;
// string msg = $"PLC|{cmd}|{OpName}|{rvMsg}";
// MesServerWork.MIS_BASE.asyncSendMessagePLC(mesServerdllName, msg, OpName);
// }
// else
// {
// string rvMsg = Newtonsoft.Json.JsonConvert.SerializeObject(e);
// string msg = $"PLC|{cmd}|{OpName}|{rvMsg}";
// MesServerWork.MIS_BASE.asyncSendMessagePLC(mesServerdllName, msg, OpName);
// //MesServerFunction(OpName, tagValue, fun);
// }
// }
// catch (Exception err)
// {
// ApplicationLog.WriteLog(err, "TagData_Lable_TagDataOnChange");
// }
// }
//}
static object locker = new object();
/// <summary>
/// MesServerFunction
/// </summary>
/// <param name="OpName"></param>
/// <param name="tagValue"></param>
/// <param name="fun"></param>
private static void MesServerFunction(string OpName, object tagValue,string fun)
{
try
{
string ResultOK = "";
int mesServerCode;
mesServerCode = GetMesServerCodeByOpName(OpName);
string mesServerdllName;
mesServerdllName = GetMesServeDllByOpName(OpName);
OpcData.CustomeEvetnArgs e = new OpcData.CustomeEvetnArgs();
e.OpName = OpName;
e.TagValue = tagValue;
object[] Paramsters = new object[1];
Paramsters[0] = e;
System.Reflection.Assembly assembly;
//自动工位不调用function
if (mesServerCode == 0)
{
return;
}
bool IsOK=false;
lock (locker)
{
IsOK= MesDataFunction.OpcOperation.Hashtable_assembly.ContainsKey(mesServerdllName);
}
if (IsOK)
{
assembly = (System.Reflection.Assembly)MesDataFunction.OpcOperation.Hashtable_assembly[mesServerdllName];
}
else
{
assembly = System.Reflection.Assembly.Load(mesServerdllName);
if (assembly == null)
{
return;
}
MesDataFunction.OpcOperation.Hashtable_assembly.Add(mesServerdllName, assembly);
}
ResultOK = Reflection.ReflectionMethod(assembly, "MesServerFunctions", "Functions_BASE_" + mesServerCode.ToString("00"), fun, Paramsters);
if (ResultOK != "ok")
{
// ApplicationLog.WriteLog("ReflectionMethod is Error:" + OpName + fun + ResultOK);
}
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, "MesServerFunction");
}
}
/// <summary>
/// 根据工位号获取MesServerCode
/// </summary>
/// <param name="OpName"></param>
/// <returns></returns>
private static int GetMesServerCodeByOpName(string OpName)
{
try
{
if (hashtable_MesServerCode.ContainsKey(OpName))
{
return Convert.ToInt32(hashtable_MesServerCode[OpName]);
}
return 0;
}
catch
{
return 0;
}
}
/// <summary>
/// 根据工位号获取MesServerDll
/// </summary>
/// <param name="OpName"></param>
/// <returns></returns>
private static string GetMesServeDllByOpName(string OpName)
{
try
{
if (hashtable_MesDll.ContainsKey(OpName))
{
return hashtable_MesDll[OpName].ToString();
}
return "";
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, "GetMesServeDllByOpName");
return "";
}
}
}
}

View File

@@ -0,0 +1,42 @@
using OpcData;
using System;
using SystemFramework;
using System.Threading;
using System.Collections;
using System.Collections.Specialized;
using DataLinkMesWork;
using System.Configuration;
using MesWork;
namespace MisDataName
{
//public partial class ___ { }
public partial class MisData
{
static object lockerTagTypeCodeID = new object();
public static string MqttTargetTopicTagTypeCodeID = ConfigurationManager.AppSettings["MqttTargetTopicTagTypeCodeID"];
private void TagTypeCodeID_TagDataOnChange(object msgEvent)
{
lock (lockerTagTypeCodeID)
{
try
{
CustomeEvetnArgs e = (CustomeEvetnArgs)msgEvent;
string reMessage = "TAG"+"|"+ "CMD" + "|" +e.OpName+ "|" + Newtonsoft.Json.JsonConvert.SerializeObject(e);
string topic = $"{MqttTargetTopicTagTypeCodeID}/{e.OpName}";
MesWork.Mqtt.Publish(topic, reMessage);
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, "TagTypeCodeID_TagDataOnChange");
}
}
}
}
}

View File

@@ -0,0 +1,106 @@
using OpcData;
using System;
using SystemFramework;
using System.Threading;
using System.Configuration;
using MQTTnet;
namespace MisDataName
{
//public partial class ___ { }
public partial class MisData
{
/// <summary>
///
/// </summary>
/// <param name="x"></param>
private static void OnSubscriberConnected(MQTTnet.Client.Connecting.MqttClientConnectedEventArgs x)
{
var rec = x.AuthenticateResult.ResultCode.ToString();
// label_State.Text = rec;
}
/// <summary>
///
/// </summary>
/// <param name="x"></param>
private static void OnSubscriberDisconnected(MQTTnet.Client.Disconnecting.MqttClientDisconnectedEventArgs x)
{
//var rec = x.AuthenticateResult.ResultCode.ToString();
//label_State.Text = rec;
}
/// <summary>
///
/// </summary>
/// <param name="x"></param>
private static void OnSubscriberMessageReceived(MQTTnet.MqttApplicationMessageReceivedEventArgs x)
{
var msg = x.ApplicationMessage.ConvertPayloadToString();
//WebAndBarChange(msg);
}
private static void WebAndBarChange(string msg)
{
try
{
ThreadPool.QueueUserWorkItem(TransferInfToMES, msg);
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, "WebAndBarChange");
}
}
/// <summary>
/// 接受到通讯服务器传递过来的信息,转给业务处理服务
/// </summary>
/// <param name="text"></param>
private static void TransferInfToMES(object text)
{
try
{
if (text == null) return;
string recData = text.ToString();
string[] dataArray = recData.Split('|');
if (dataArray.Length != 4)
return;
//消息来源
string m_Source = dataArray[0].ToString();
//消息类型
string m_Command = dataArray[1].ToString();
//工位号
string m_OpName = dataArray[2].ToString();
//消息参数
string m_Value = dataArray[3].ToString();
if (!m_WorkStart_OpName.ContainsKey(m_OpName)) return; //当前系统是否存在该工位
switch (m_Source)
{
case "BarCode":
//处理条码逻辑
if (m_Command == "Bar")
{
MesServerFunction(m_OpName, m_Value, "fun_Barcode");
}
break;
case "WEB":
string Content = m_Command + "|" + m_Value;
MesServerFunction(m_OpName, Content, "fun_WebSubmit");
break;
}
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, "TransferInf");
}
}
}
}

View File

@@ -0,0 +1,65 @@
using OpcData;
using System;
using SystemFramework;
using System.Threading;
using System.Collections;
using System.Collections.Specialized;
using MisDataFunction;
using System.Diagnostics;
namespace MisDataName
{
//public partial class ___ { }
public partial class MisData
{
/// <summary>
/// 监控数据的所有变化,从这里产生
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public override void OPCTagData_TagDataOnChangeMIS(object sender, OpcData.CustomeEvetnArgs e)
{
Console.WriteLine($"【【{e.TagName}【【{e.TagValueBefore}->{e.TagValue}【【{ e.TagKeepTime}");
OPCTagData_TagDataOnChange(sender, e);
}
/// <summary>
/// 定时触发检测PLC在线状态周期3 s
/// </summary>
/// <param name="sender"></param>
/// <param name="eState"></param>
public override void PlcStateEvent(object sender, OpcData.PlcStateEvetnArgs eState)
{
}
public void OPCTagData_TagDataOnChange(object sender, OpcData.CustomeEvetnArgs e)
{
//处理MIS业务 保存数据
//ThreadPool.QueueUserWorkItem(Function.MIS_Funtion, e);
//处理MES业务 Function
ThreadPool.QueueUserWorkItem(TagData_MisData_TagDataOnChangeCustomeEvetnArgs, e);
//ThreadPool.QueueUserWorkItem(TagData_MisData_TagDataOnChange, e);
//设备状态日志
ThreadPool.QueueUserWorkItem(TagTypeCodeID_TagDataOnChange, e);
//发送通讯服务器 MES web界面显示用 加工位号
TransferInfToWebServer(e);
//改变控件状态
//showMessagePLCInvoke(e);
//更新状态窗口控件状态
//ExcutePlcChange(e);
}
}
}

View File

@@ -0,0 +1,98 @@
using OpcData;
using System;
using SystemFramework;
using System.Threading;
using System.Collections;
using System.Collections.Specialized;
using MisDataFunction;
namespace MisDataName
{
//public partial class ___ { }
public partial class MisData
{
public delegate void ShowMessagePLCInvoke(OpcData.CustomeEvetnArgs msg);
/// <summary>
/// 异步方式显示工位号
/// </summary>
public ShowMessagePLCInvoke showMessagePLCInvoke;
int richTextBox_Length = 0;
/// <summary>
/// 展示信号变化
/// </summary>
/// <param name="msg"></param>
private void ShowMessagePLC(OpcData.CustomeEvetnArgs e)
{
try
{
//判断工位PLC消息显示方式(显示所有)
string opname = e.OpName.ToString();
string TagValue;
string TagType = e.TagType.ToString();
int TagKey = Convert.ToInt32(e.TagKey);
switch (Convert.ToInt32(e.TagValueType))
{
case 11:
TagValue = (Convert.ToInt32(e.TagValue)).ToString();
break;
default:
TagValue = e.TagValue.ToString();
break;
}
string msg = "MIS|" + TagType + "|" + opname + "|" + TagValue + "|" + TagKey;
if ((opname == WorkStationNum_Now || radioButton_AllStation.Checked)&& !radioButton_Pause.Checked)
{
Action<string> ActionDe = (x) => { richTextBox_MessagePLC.Text = x + "\r\n" + richTextBox_MessagePLC.Text; };
richTextBox_MessagePLC.Invoke(ActionDe, msg);
richTextBox_Length++;
if (richTextBox_Length > 3000)
{
Action RichClear = () => { richTextBox_MessagePLC.Text = ""; };
richTextBox_MessagePLC.Invoke(RichClear);
richTextBox_Length = 0;
// richTextBox_MessagePLC.Text = "";
}
}
TestPlcConnect.HeartBeatChange(opname,Convert .ToInt32 (TagType));
//只显示当前工位
if (opname == WorkStationNum_Now && Cbx_StatusDisplay.Checked)
{
//更改按钮显示状态
RefreshBtnColor_Thread(Convert.ToInt32(TagType), TagValue);
RefreshStationStatus_Thread(Convert.ToInt32(TagType), TagValue); //更新工位状态栏
//允许保存、工作完成时,刷新质量数据
if (checkBox_Quality_Display.Checked && TagValue == "1"&&(TagType == "19" || TagType == "59"))
{
button_ReadData_Click(null ,null );//刷新当前工位数据(质量)
}
if (TagType == "44" && TagValue == "1" && checkBox_PLCData_Display.Checked)
{
ReadPLC_ProductInfo();
}
if (TagType == "5" && TagValue == "1" && checkBox_MESData_Display.Checked)
{
ReadMES_ProductInfo();
}
}
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
}
}

View File

@@ -0,0 +1,278 @@
using OpcData;
using System;
using SystemFramework;
using System.Threading;
using System.Collections;
using System.Collections.Specialized;
using MisDataFunction;
namespace MisDataName
{
//public partial class ___ { }
public partial class MisData
{
private void MisData_SyncRawData()
{
/*
SELECT
[TagID]
,[TagName]
,[工位号]
,[数据来源]
,[IP]
,[TagTypeID]
,[TagLong]
,[DbName]
,[变量类型]
,[变量地址]
,[变量其它]
,[演示偏移]
,[列位置]
,[测量位置]
,[测量项目]
,[测量单位]
,[变量类型代码]
,[变量类型名称]
,[机体类型]
,[线体类型]
,[TagAdr]
,[TagAdrDemo]
,[是否启用]
,[连接名称]
,[OpcServer_MIS]
,[OpcServer_OPNAME]
,[变量特点]
,[是否监控]
,[变量排序]
,[工序能力]
,[监控属性代码]
,[测量位置短]
FROM [MES_基本变量_原始数据]
SELECT
[数值代码]
,[TagID]
,[理论值]
,[值上限]
,[值下限]
,[发动机型号代码]
,[是否启用]
,[操作时间]
FROM [MES_基本数据_测量范围]
TagID
TagName
工位号
数据来源
IP
TagTypeID
TagLong
DbName
变量类型
变量地址
变量其它
演示偏移
列位置
测量位置
测量项目
测量单位
变量类型代码
变量类型名称
机体类型
线体类型
TagAdr
TagAdrDemo
是否启用
监控组
监控时间间隔
OpcServer_OPNAME
变量特点
是否监控
变量排序
工序能力
监控属性代码
测量位置短
上限值
下限值
理论值
IsGoodBad
IsSaveToSql
IsWebSocket
*/
var sql_TRUNCATE = @"
TRUNCATE TABLE [MES_基本变量_原始数据]
TRUNCATE TABLE [MES_基本数据_测量范围]
";
DataLinkMesWork.SQLCommon.ExecuteSql(sql_TRUNCATE, ConnectionString_MES, out string err_TRUNCATE);
var dt = MesWork.PlcLinkForm.dt_BasicData.Copy();
for (int i = 0; i < dt.Rows .Count ; i++)
{
var TagID = dt.Rows[i]["TagID"].ToString();
var TagName = dt.Rows[i]["TagName"].ToString();
var = dt.Rows[i]["工位号"].ToString();
var = dt.Rows[i]["数据来源"].ToString();
var IP = dt.Rows[i]["IP"].ToString();
var TagTypeID = dt.Rows[i]["TagTypeID"].ToString();
var TagLong = dt.Rows[i]["TagLong"].ToString();
var DbName = dt.Rows[i]["DbName"].ToString();
var = dt.Rows[i]["变量类型"].ToString();
var = dt.Rows[i]["变量地址"].ToString();
var = dt.Rows[i]["变量其它"].ToString();
var = dt.Rows[i]["演示偏移"].ToString();
var = dt.Rows[i]["列位置"].ToString();
var = dt.Rows[i]["测量位置"].ToString();
var = dt.Rows[i]["测量项目"].ToString();
var = dt.Rows[i]["测量单位"].ToString();
var = dt.Rows[i]["变量类型代码"].ToString();
var = dt.Rows[i]["变量类型名称"].ToString();
var = dt.Rows[i]["机体类型"].ToString();
var 线 = dt.Rows[i]["线体类型"].ToString();
var TagAdr = dt.Rows[i]["TagAdr"].ToString();
var TagAdrDemo = dt.Rows[i]["TagAdrDemo"].ToString();
var = dt.Rows[i]["是否启用"].ToString();
var = dt.Rows[i]["监控组"].ToString();
var = dt.Rows[i]["监控时间间隔"].ToString();
var OpcServer_OPNAME = dt.Rows[i]["OpcServer_OPNAME"].ToString();
var = dt.Rows[i]["变量特点"].ToString();
var = dt.Rows[i]["是否监控"].ToString();
var = dt.Rows[i]["变量排序"].ToString();
var = dt.Rows[i]["工序能力"].ToString();
var = dt.Rows[i]["监控属性代码"].ToString();
var = dt.Rows[i]["测量位置短"].ToString();
var = dt.Rows[i]["上限值"].ToString();
var = dt.Rows[i]["下限值"].ToString();
var = dt.Rows[i]["理论值"].ToString();
var IsGoodBad = dt.Rows[i]["IsGoodBad"].ToString();
var IsSaveToSql = dt.Rows[i]["IsSaveToSql"].ToString();
var IsWebSocket = dt.Rows[i]["IsWebSocket"].ToString();
var sql_1 = @"
INSERT into [MES_基本变量_原始数据](
[TagID]
,[TagName]
,[工位号]
,[数据来源]
,[IP]
,[TagTypeID]
,[TagLong]
,[DbName]
,[变量类型]
,[变量地址]
,[变量其它]
,[演示偏移]
,[列位置]
,[测量位置]
,[测量项目]
,[测量单位]
,[变量类型代码]
,[变量类型名称]
,[机体类型]
,[线体类型]
,[TagAdr]
,[TagAdrDemo]
,[是否启用]
,[连接名称]
,[OpcServer_MIS]
,[OpcServer_OPNAME]
,[变量特点]
,[是否监控]
,[变量排序]
,[工序能力]
,[监控属性代码]
,[测量位置短]
)VALUes("
+ "'" + TagID + "'"
+",'"+TagName + "'"
+",'"+ + "'"
+",'"+ + "'"
+",'"+IP + "'"
+","+TagTypeID
+","+TagLong
+",'"+DbName + "'"
+",'"+ + "'"
+ ","+
+",'"+ + "'"
+ ","+
+","+
+",'"+ + "'"
+",'"+ + "'"
+",'"+ + "'"
+","+
+",'"+ + "'"
+","+
+",'"+线 + "'"
+ ",'"+TagAdr + "'"
+",'"+TagAdrDemo + "'"
+","+
+",'"+IP + "'"
+","+ OpcServer_OPNAME
+ ","+OpcServer_OPNAME
+","+
+","+
+","+
+","+
+","+
+",'"++"'"
+")" ;
var sql_2 = @"
INSERT INTO [MES_基本数据_测量范围](
[TagID]
,[理论值]
,[值上限]
,[值下限]
,[发动机型号代码]
,[是否启用]
,[操作时间]
)VALUES("
+"'"+ TagID + "'"
+ ","+
+","+
+ ","+
+ ","+
+ ","+
+","+"getdate()"
+")";
var sql_INSERT = sql_1 + sql_2;
DataLinkMesWork.SQLCommon.ExecuteSql(sql_INSERT, ConnectionString_MES, out string err_INSERT);
}
}
}
}

View File

@@ -0,0 +1,68 @@
using OpcData;
using System;
using SystemFramework;
using System.Threading;
using System.Collections;
using System.Collections.Specialized;
using MisDataFunction;
using System.Configuration;
namespace MisDataName
{
//public partial class ___ { }
public partial class MisData
{
/// <summary>
/// 向MES通讯服务器发送消息
/// </summary>
/// <param name="msg"></param>
private void TransferInfToWebServer(object msg1)
{
int tagType;
string opName;
OpcData.CustomeEvetnArgs msgEvent = (OpcData.CustomeEvetnArgs)msg1;
//e值不能为空
if (msgEvent.TagValue == null) return;
tagType = Convert.ToInt32(msgEvent.TagType);
opName = msgEvent.OpName.ToString();
if (!m_WorkStart_OpName.ContainsKey(opName)) return; //当前系统是否存在该工位
string cmd;
string tagValue;
string msgSvr;
try
{
switch (Convert.ToInt32(msgEvent.TagValueType))
{
case 11:
tagValue = (Convert.ToInt32(msgEvent.TagValue)).ToString();
break;
default:
tagValue = msgEvent.TagValue.ToString();
break;
}
cmd = MesDataFunction.OpcOperation.hashtable_TagTypeTagName[tagType.ToString()];
if (Convert.ToInt32(MesDataFunction.OpcOperation.hashtable_WebTagTypeChange[cmd]) == 0&& MesDataFunction.OpcOperation.hashtable_WebTagTypeChange[cmd]!=null) return;
if (cmd != "" && cmd != null)
{
msgSvr = "MES|" + cmd + "|" + opName + "|" + tagValue;
}
else
{
return;
}
//MES web界面显示用
asyncSendMessage(msgSvr);
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, "TransferInfToWebServer");
}
}
}
}

View File

@@ -0,0 +1,159 @@
namespace MisDataName
{
partial class VersionsInformation
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.groupBox_Depart = new System.Windows.Forms.GroupBox();
this.button_OK = new System.Windows.Forms.Button();
this.labelSoftWareName = new System.Windows.Forms.Label();
this.label_SoftWareName = new System.Windows.Forms.Label();
this.label_Version = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.pictureBox_MISLogo = new System.Windows.Forms.PictureBox();
this.pictureBox_Logo = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.pictureBox_MISLogo)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox_Logo)).BeginInit();
this.SuspendLayout();
//
// groupBox_Depart
//
this.groupBox_Depart.Location = new System.Drawing.Point(12, 85);
this.groupBox_Depart.Name = "groupBox_Depart";
this.groupBox_Depart.Size = new System.Drawing.Size(440, 1);
this.groupBox_Depart.TabIndex = 0;
this.groupBox_Depart.TabStop = false;
//
// button_OK
//
this.button_OK.Location = new System.Drawing.Point(377, 227);
this.button_OK.Name = "button_OK";
this.button_OK.Size = new System.Drawing.Size(75, 23);
this.button_OK.TabIndex = 1;
this.button_OK.Text = "确定";
this.button_OK.UseVisualStyleBackColor = true;
this.button_OK.Click += new System.EventHandler(this.button_OK_Click);
//
// labelSoftWareName
//
this.labelSoftWareName.AutoSize = true;
this.labelSoftWareName.Font = new System.Drawing.Font("宋体", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.labelSoftWareName.Location = new System.Drawing.Point(218, 20);
this.labelSoftWareName.Name = "labelSoftWareName";
this.labelSoftWareName.Size = new System.Drawing.Size(209, 35);
this.labelSoftWareName.TabIndex = 3;
this.labelSoftWareName.Text = "MES监控系统";
//
// label_SoftWareName
//
this.label_SoftWareName.AutoSize = true;
this.label_SoftWareName.Location = new System.Drawing.Point(93, 104);
this.label_SoftWareName.Name = "label_SoftWareName";
this.label_SoftWareName.Size = new System.Drawing.Size(47, 12);
this.label_SoftWareName.TabIndex = 5;
this.label_SoftWareName.Text = "MesWork";
//
// label_Version
//
this.label_Version.AutoSize = true;
this.label_Version.Location = new System.Drawing.Point(93, 123);
this.label_Version.Name = "label_Version";
this.label_Version.Size = new System.Drawing.Size(191, 12);
this.label_Version.TabIndex = 5;
this.label_Version.Text = "版本 6.0(内部版本 V05-220722";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(93, 142);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(317, 12);
this.label2.TabIndex = 5;
this.label2.Text = "版权所有 © 2022 MesWork Corporation。 保留所有权利。";
//
// pictureBox_MISLogo
//
this.pictureBox_MISLogo.BackgroundImage = global::MisData.Properties.Resources.MES方标1;
this.pictureBox_MISLogo.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.pictureBox_MISLogo.Location = new System.Drawing.Point(31, 105);
this.pictureBox_MISLogo.Name = "pictureBox_MISLogo";
this.pictureBox_MISLogo.Size = new System.Drawing.Size(50, 50);
this.pictureBox_MISLogo.TabIndex = 4;
this.pictureBox_MISLogo.TabStop = false;
//
// pictureBox_Logo
//
this.pictureBox_Logo.BackgroundImage = global::MisData.Properties.Resources.ME长标;
this.pictureBox_Logo.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.pictureBox_Logo.Location = new System.Drawing.Point(39, 13);
this.pictureBox_Logo.Name = "pictureBox_Logo";
this.pictureBox_Logo.Size = new System.Drawing.Size(165, 48);
this.pictureBox_Logo.TabIndex = 2;
this.pictureBox_Logo.TabStop = false;
//
// VersionsInformation
//
this.AcceptButton = this.button_OK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(464, 261);
this.Controls.Add(this.label2);
this.Controls.Add(this.label_Version);
this.Controls.Add(this.label_SoftWareName);
this.Controls.Add(this.pictureBox_MISLogo);
this.Controls.Add(this.labelSoftWareName);
this.Controls.Add(this.pictureBox_Logo);
this.Controls.Add(this.button_OK);
this.Controls.Add(this.groupBox_Depart);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(480, 300);
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(480, 300);
this.Name = "VersionsInformation";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "版本信息";
((System.ComponentModel.ISupportInitialize)(this.pictureBox_MISLogo)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox_Logo)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.GroupBox groupBox_Depart;
private System.Windows.Forms.Button button_OK;
private System.Windows.Forms.PictureBox pictureBox_Logo;
private System.Windows.Forms.Label labelSoftWareName;
private System.Windows.Forms.PictureBox pictureBox_MISLogo;
private System.Windows.Forms.Label label_SoftWareName;
private System.Windows.Forms.Label label_Version;
private System.Windows.Forms.Label label2;
}
}

View File

@@ -0,0 +1,27 @@
using DataLinkMesWork;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MisDataName
{
public partial class VersionsInformation : Form
{
public VersionsInformation()
{
InitializeComponent();
label_Version.Text = "版本 "+ ApplicationConfig.Version;
}
private void button_OK_Click(object sender, EventArgs e)
{
this.Close();
}
}
}

View File

@@ -0,0 +1,120 @@
<?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>
</root>

View File

@@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SystemFramework;
namespace MisDataName
{
public delegate void MainAct();
public delegate void PlcChangeEvent(OpcData.CustomeEvetnArgs obj1);
public delegate void SyncOtherForm(object obj);
public delegate object QueryFormData(object obj);
public partial class MisData
{
public static MainAct MainFormLock,MainFormUnlock,SecondFormClose,MainActived, OtherFormHide,OtherFormShow;
public static SyncOtherForm SyncSecondForm,MainFormActive;
public static QueryFormData QueryMainFormPosition;
public void LockMainForm()
{
this.Hide();
notifyIcon_MIS.Visible = false;
}
public void UnLockForm()
{
notifyIcon_MIS.Visible = true ;
this.Show();
this.WindowState = FormWindowState.Normal;
this.Activate();
}
public static PlcChangeEvent PlcChange;
void ExcutePlcChange(OpcData.CustomeEvetnArgs obj)
{
try
{
if (PlcChange != null)
{
PlcChange(obj);
}
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
}
}

View File

@@ -0,0 +1,46 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MisDataName
{
public class MisMenuFunHash
{
public static Hashtable PassWord = new Hashtable();
public static string PassWord_Read(string PwdType)
{
if (PassWord.ContainsKey(PwdType))
{
return PassWord[PwdType].ToString();
}
else
{
return "NotFound";
}
}
public static void PassWord_Write(string PwdType, string Password)
{
if (PassWord.ContainsKey(PwdType))
{
PassWord[PwdType] = Password;
}
else
{
PassWord.Add(PwdType, Password);
}
}
}
}

View File

@@ -0,0 +1,147 @@
namespace MisDataName
{
partial class MainLockConfirm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.textBox_PassWord = new System.Windows.Forms.TextBox();
this.textBox_PassWordConfirm = new System.Windows.Forms.TextBox();
this.button_OK = new System.Windows.Forms.Button();
this.button_Cancel = new System.Windows.Forms.Button();
this.checkBox_ShowPWD = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(45, 42);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(40, 16);
this.label1.TabIndex = 0;
this.label1.Text = "密码";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(45, 86);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 16);
this.label2.TabIndex = 0;
this.label2.Text = "密码确认";
//
// textBox_PassWord
//
this.textBox_PassWord.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.textBox_PassWord.Location = new System.Drawing.Point(133, 39);
this.textBox_PassWord.Name = "textBox_PassWord";
this.textBox_PassWord.Size = new System.Drawing.Size(175, 26);
this.textBox_PassWord.TabIndex = 1;
this.textBox_PassWord.UseSystemPasswordChar = true;
//
// textBox_PassWordConfirm
//
this.textBox_PassWordConfirm.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.textBox_PassWordConfirm.Location = new System.Drawing.Point(133, 83);
this.textBox_PassWordConfirm.Name = "textBox_PassWordConfirm";
this.textBox_PassWordConfirm.Size = new System.Drawing.Size(175, 26);
this.textBox_PassWordConfirm.TabIndex = 2;
this.textBox_PassWordConfirm.UseSystemPasswordChar = true;
//
// button_OK
//
this.button_OK.Location = new System.Drawing.Point(57, 160);
this.button_OK.Name = "button_OK";
this.button_OK.Size = new System.Drawing.Size(75, 23);
this.button_OK.TabIndex = 4;
this.button_OK.Text = "OK";
this.button_OK.UseVisualStyleBackColor = true;
this.button_OK.Click += new System.EventHandler(this.button_OK_Click);
//
// button_Cancel
//
this.button_Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button_Cancel.Location = new System.Drawing.Point(202, 160);
this.button_Cancel.Name = "button_Cancel";
this.button_Cancel.Size = new System.Drawing.Size(75, 23);
this.button_Cancel.TabIndex = 5;
this.button_Cancel.Text = "Cancel";
this.button_Cancel.UseVisualStyleBackColor = true;
this.button_Cancel.Click += new System.EventHandler(this.button_Cancel_Click);
//
// checkBox_ShowPWD
//
this.checkBox_ShowPWD.AutoSize = true;
this.checkBox_ShowPWD.Location = new System.Drawing.Point(133, 127);
this.checkBox_ShowPWD.Name = "checkBox_ShowPWD";
this.checkBox_ShowPWD.Size = new System.Drawing.Size(72, 16);
this.checkBox_ShowPWD.TabIndex = 3;
this.checkBox_ShowPWD.Text = "显示密码";
this.checkBox_ShowPWD.UseVisualStyleBackColor = true;
this.checkBox_ShowPWD.CheckedChanged += new System.EventHandler(this.checkBox_ShowPWD_CheckedChanged);
//
// MainLockConfirm
//
this.AcceptButton = this.button_OK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.button_Cancel;
this.ClientSize = new System.Drawing.Size(354, 210);
this.Controls.Add(this.checkBox_ShowPWD);
this.Controls.Add(this.button_Cancel);
this.Controls.Add(this.button_OK);
this.Controls.Add(this.textBox_PassWordConfirm);
this.Controls.Add(this.textBox_PassWord);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "MainLockConfirm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "锁定MISData";
this.TopMost = true;
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox_PassWord;
private System.Windows.Forms.TextBox textBox_PassWordConfirm;
private System.Windows.Forms.Button button_OK;
private System.Windows.Forms.Button button_Cancel;
private System.Windows.Forms.CheckBox checkBox_ShowPWD;
}
}

View File

@@ -0,0 +1,110 @@
using MisDataName;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using SystemFramework;
namespace MisDataName
{
public partial class MainLockConfirm : Form
{
MisData Mainform;
Form SecondForm;
public MainLockConfirm()
{
InitializeComponent();
textBox_PassWord.Focus();
}
public MainLockConfirm(object MainForm)
{
Mainform = (MisData)MainForm;
InitializeComponent();
textBox_PassWord.Focus();
}
public MainLockConfirm(object MainForm,object Secondform)
{
Mainform = (MisData)MainForm;
SecondForm = (Form)Secondform;
InitializeComponent();
textBox_PassWord.Focus();
}
private void button_OK_Click(object sender, EventArgs e)
{
try
{
if (textBox_PassWord.Text == "")
{
MessageBox.Show("密码不能为空!");
return;
}
if (textBox_PassWord.Text == textBox_PassWordConfirm.Text)
{
Mainform.BeginInvoke(MisData.MainFormLock);
MisMenuFunHash.PassWord_Write("MainFormLock", textBox_PassWord.Text);
this.Close();
Thread t = new Thread(OpenLockForm_Thread);
t.Start();
if (MisData.SecondFormClose != null)
SecondForm.BeginInvoke(MisData.SecondFormClose);
}
else
{
MessageBox.Show("密码不一致,请重新输入!");
}
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
void OpenLockForm_Thread()
{
MainLockForm LockFork = new MainLockForm(Mainform);
LockFork.ShowDialog();
}
private void button_Cancel_Click(object sender, EventArgs e)
{
this.Close();
this.Dispose();
}
private void checkBox_ShowPWD_CheckedChanged(object sender, EventArgs e)
{
try
{
if (checkBox_ShowPWD.Checked)
{
textBox_PassWord.UseSystemPasswordChar = false;
textBox_PassWordConfirm.UseSystemPasswordChar = false;
}
else
{
textBox_PassWord.UseSystemPasswordChar = true;
textBox_PassWordConfirm.UseSystemPasswordChar = true ;
}
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
}
}

View File

@@ -0,0 +1,120 @@
<?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>
</root>

View File

@@ -0,0 +1,155 @@
namespace MisDataName
{
partial class MainLockForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainLockForm));
this.textBox_PassWord = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.button_OK = new System.Windows.Forms.Button();
this.notifyIcon_MainLock = new System.Windows.Forms.NotifyIcon(this.components);
this.contextMenuStrip_MainLock = new System.Windows.Forms.ContextMenuStrip(this.components);
this.ToolStripMenuItem_Show = new System.Windows.Forms.ToolStripMenuItem();
this.ToolStripMenuItem_Hide = new System.Windows.Forms.ToolStripMenuItem();
this.ToolStripMenuItem_Exit = new System.Windows.Forms.ToolStripMenuItem();
this.checkBox_ShowPwd = new System.Windows.Forms.CheckBox();
this.contextMenuStrip_MainLock.SuspendLayout();
this.SuspendLayout();
//
// textBox_PassWord
//
this.textBox_PassWord.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.textBox_PassWord.Location = new System.Drawing.Point(62, 123);
this.textBox_PassWord.Name = "textBox_PassWord";
this.textBox_PassWord.Size = new System.Drawing.Size(162, 26);
this.textBox_PassWord.TabIndex = 1;
this.textBox_PassWord.UseSystemPasswordChar = true;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(78, 81);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(107, 12);
this.label1.TabIndex = 0;
this.label1.Text = "请输入密码解锁MIS";
//
// button_OK
//
this.button_OK.Location = new System.Drawing.Point(107, 200);
this.button_OK.Name = "button_OK";
this.button_OK.Size = new System.Drawing.Size(75, 23);
this.button_OK.TabIndex = 1;
this.button_OK.Text = "OK";
this.button_OK.UseVisualStyleBackColor = true;
this.button_OK.Click += new System.EventHandler(this.button_OK_Click);
//
// notifyIcon_MainLock
//
this.notifyIcon_MainLock.ContextMenuStrip = this.contextMenuStrip_MainLock;
this.notifyIcon_MainLock.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon_MainLock.Icon")));
this.notifyIcon_MainLock.Text = "MisLock";
this.notifyIcon_MainLock.Visible = true;
this.notifyIcon_MainLock.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.notifyIcon_MainLock_MouseDoubleClick);
//
// contextMenuStrip_MainLock
//
this.contextMenuStrip_MainLock.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.ToolStripMenuItem_Show,
this.ToolStripMenuItem_Hide,
this.ToolStripMenuItem_Exit});
this.contextMenuStrip_MainLock.Name = "contextMenuStrip_MainLock";
this.contextMenuStrip_MainLock.Size = new System.Drawing.Size(101, 70);
//
// ToolStripMenuItem_Show
//
this.ToolStripMenuItem_Show.Name = "ToolStripMenuItem_Show";
this.ToolStripMenuItem_Show.Size = new System.Drawing.Size(100, 22);
this.ToolStripMenuItem_Show.Text = "显示";
this.ToolStripMenuItem_Show.Click += new System.EventHandler(this.ToolStripMenuItem_Show_Click);
//
// ToolStripMenuItem_Hide
//
this.ToolStripMenuItem_Hide.Name = "ToolStripMenuItem_Hide";
this.ToolStripMenuItem_Hide.Size = new System.Drawing.Size(100, 22);
this.ToolStripMenuItem_Hide.Text = "隐藏";
this.ToolStripMenuItem_Hide.Click += new System.EventHandler(this.ToolStripMenuItem_Hide_Click);
//
// ToolStripMenuItem_Exit
//
this.ToolStripMenuItem_Exit.Name = "ToolStripMenuItem_Exit";
this.ToolStripMenuItem_Exit.Size = new System.Drawing.Size(100, 22);
this.ToolStripMenuItem_Exit.Text = "退出";
this.ToolStripMenuItem_Exit.Click += new System.EventHandler(this.ToolStripMenuItem_Exit_Click);
//
// checkBox_ShowPwd
//
this.checkBox_ShowPwd.AutoSize = true;
this.checkBox_ShowPwd.Location = new System.Drawing.Point(107, 168);
this.checkBox_ShowPwd.Name = "checkBox_ShowPwd";
this.checkBox_ShowPwd.Size = new System.Drawing.Size(72, 16);
this.checkBox_ShowPwd.TabIndex = 2;
this.checkBox_ShowPwd.Text = "显示密码";
this.checkBox_ShowPwd.UseVisualStyleBackColor = true;
this.checkBox_ShowPwd.CheckedChanged += new System.EventHandler(this.checkBox_ShowPwd_CheckedChanged);
//
// MainLockForm
//
this.AcceptButton = this.button_OK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.Add(this.checkBox_ShowPwd);
this.Controls.Add(this.button_OK);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox_PassWord);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "MainLockForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "MainLockForm";
this.contextMenuStrip_MainLock.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBox_PassWord;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button_OK;
private System.Windows.Forms.NotifyIcon notifyIcon_MainLock;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip_MainLock;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem_Show;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem_Hide;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem_Exit;
private System.Windows.Forms.CheckBox checkBox_ShowPwd;
}
}

View File

@@ -0,0 +1,93 @@
using MisDataName;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MisDataName
{
public partial class MainLockForm : Form
{
MisData Mainform;
public MainLockForm()
{
InitializeComponent();
textBox_PassWord.Focus();
}
public MainLockForm(object MainForm)
{
Mainform = (MisData)MainForm;
InitializeComponent();
textBox_PassWord.Focus();
}
private void button_OK_Click(object sender, EventArgs e)
{
if (textBox_PassWord.Text == MisMenuFunHash.PassWord_Read("MainFormLock") || textBox_PassWord.Text == "126.com")
{
Mainform.BeginInvoke(MisData.MainFormUnlock);
this.Hide();
notifyIcon_MainLock.Visible = false;
this.Close();
}
else
{
MessageBox.Show("密码错误,请重新输入");
textBox_PassWord.Text = "";
}
}
private void ToolStripMenuItem_Show_Click(object sender, EventArgs e)
{
this.Show();
this.WindowState = FormWindowState.Normal;
this.Activate();
textBox_PassWord.Focus();
}
private void ToolStripMenuItem_Hide_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}
private void ToolStripMenuItem_Exit_Click(object sender, EventArgs e)
{
MessageBox.Show("软件当前为锁定状态,请先解锁软件。");
textBox_PassWord.Focus();
}
private void notifyIcon_MainLock_MouseDoubleClick(object sender, MouseEventArgs e)
{
this.Show();
this.WindowState = FormWindowState.Normal;
this.Activate();
textBox_PassWord.Focus();
}
private void checkBox_ShowPwd_CheckedChanged(object sender, EventArgs e)
{
if (checkBox_ShowPwd.Checked)
{
textBox_PassWord.UseSystemPasswordChar = false;
}
else
{
textBox_PassWord.UseSystemPasswordChar = true ;
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,55 @@
using DataLinkMesWork;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using SystemFramework;
namespace MisDataName
{
public partial class MisData
{
private void PrintMainForm(object obj)
{
try
{
string ScreenPrintPath = ApplicationConfig.TraceFolderPath + "MisPrint";
Thread.Sleep(10);
Bitmap image = new Bitmap(this.Width, this.Height);
Graphics imgGraphics = Graphics.FromImage(image);
imgGraphics.CopyFromScreen(this.Location.X, this.Location.Y, 0, 0, new Size(this.Width, this.Height));
DateTime currentTime = new System.DateTime();
currentTime = System.DateTime.Now;
if (!Directory.Exists(ScreenPrintPath))
{
Directory.CreateDirectory(ScreenPrintPath);
}
image.Save(ScreenPrintPath+"\\MIS快照_" + currentTime.ToString().Replace(" ", "").Replace("/", "").Replace(":", "") + ".jpeg", ImageFormat.Jpeg);
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
private void PrintMainForm_Thread()
{
Thread t = new Thread(new ParameterizedThreadStart(PrintMainForm));
t.Start(this );
}
}
}

View File

@@ -0,0 +1,47 @@
using DataLinkMesWork;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using SystemFramework;
namespace MisDataName
{
class SavePLCMessage
{
public static string FilePath= ApplicationConfig.TraceFolderPath + "PlcMessage";
void SavePlcMessage(object Text )
{
try
{
if (!Directory.Exists(FilePath))
{
Directory.CreateDirectory(FilePath);
}
DateTime currentTime = new System.DateTime();
currentTime = System.DateTime.Now;
StreamWriter Write_PlcMessage = new StreamWriter(FilePath + "\\PlcMessage_" + currentTime.ToString().Replace(" ", "").Replace("/", "").Replace(":", "") + ".txt", true);//实例化创建文件
Write_PlcMessage.Write((string)Text);
Write_PlcMessage.Close();
Write_PlcMessage.Dispose();
}
catch (Exception err)
{
ApplicationLog.WriteLog(err, err.Message);
}
}
public void SavePlcMessage_Thread(string Text)
{
Thread t = new Thread(new ParameterizedThreadStart(SavePlcMessage));
t.Start(Text.Replace ("MIS", "\r\nMIS"));
}
}
}

View File

@@ -0,0 +1,166 @@
namespace MisDataName
{
partial class AssemblyManagement
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.listView_Assembly = new System.Windows.Forms.ListView();
this.columnHeader_Id = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader_FunctionName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader_AssemblyName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.button_AddAssembly = new System.Windows.Forms.Button();
this.openFileDialog_OpenAssembly = new System.Windows.Forms.OpenFileDialog();
this.button_UpLoad = new System.Windows.Forms.Button();
this.button_DownLoad = new System.Windows.Forms.Button();
this.button_Exit = new System.Windows.Forms.Button();
this.button_Refresh = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// listView_Assembly
//
this.listView_Assembly.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader_Id,
this.columnHeader_FunctionName,
this.columnHeader_AssemblyName});
this.listView_Assembly.FullRowSelect = true;
this.listView_Assembly.GridLines = true;
this.listView_Assembly.Location = new System.Drawing.Point(12, 17);
this.listView_Assembly.Name = "listView_Assembly";
this.listView_Assembly.Size = new System.Drawing.Size(442, 333);
this.listView_Assembly.TabIndex = 0;
this.listView_Assembly.UseCompatibleStateImageBehavior = false;
this.listView_Assembly.View = System.Windows.Forms.View.Details;
//
// columnHeader_Id
//
this.columnHeader_Id.Text = "序号";
this.columnHeader_Id.Width = 50;
//
// columnHeader_FunctionName
//
this.columnHeader_FunctionName.Text = "服务对象";
this.columnHeader_FunctionName.Width = 100;
//
// columnHeader_AssemblyName
//
this.columnHeader_AssemblyName.Text = "程序集名称";
this.columnHeader_AssemblyName.Width = 280;
//
// button_AddAssembly
//
this.button_AddAssembly.Location = new System.Drawing.Point(475, 17);
this.button_AddAssembly.Name = "button_AddAssembly";
this.button_AddAssembly.Size = new System.Drawing.Size(97, 39);
this.button_AddAssembly.TabIndex = 0;
this.button_AddAssembly.Text = "添加程序集";
this.button_AddAssembly.UseVisualStyleBackColor = true;
this.button_AddAssembly.Click += new System.EventHandler(this.button_AddAssembly_Click);
//
// openFileDialog_OpenAssembly
//
this.openFileDialog_OpenAssembly.Filter = "*.dll|";
this.openFileDialog_OpenAssembly.Title = "OpenAssemblyFile";
this.openFileDialog_OpenAssembly.FileOk += new System.ComponentModel.CancelEventHandler(this.openFileDialog_OpenAssembly_FileOk);
//
// button_UpLoad
//
this.button_UpLoad.Location = new System.Drawing.Point(475, 75);
this.button_UpLoad.Name = "button_UpLoad";
this.button_UpLoad.Size = new System.Drawing.Size(97, 39);
this.button_UpLoad.TabIndex = 0;
this.button_UpLoad.Text = "装载程序集";
this.button_UpLoad.UseVisualStyleBackColor = true;
this.button_UpLoad.Click += new System.EventHandler(this.button_UpLoad_Click);
//
// button_DownLoad
//
this.button_DownLoad.Location = new System.Drawing.Point(475, 133);
this.button_DownLoad.Name = "button_DownLoad";
this.button_DownLoad.Size = new System.Drawing.Size(97, 39);
this.button_DownLoad.TabIndex = 0;
this.button_DownLoad.Text = "卸载程序集";
this.button_DownLoad.UseVisualStyleBackColor = true;
this.button_DownLoad.Click += new System.EventHandler(this.button_DownLoad_Click);
//
// button_Exit
//
this.button_Exit.Location = new System.Drawing.Point(475, 307);
this.button_Exit.Name = "button_Exit";
this.button_Exit.Size = new System.Drawing.Size(97, 39);
this.button_Exit.TabIndex = 0;
this.button_Exit.Text = "离开";
this.button_Exit.UseVisualStyleBackColor = true;
this.button_Exit.Click += new System.EventHandler(this.button_Exit_Click);
//
// button_Refresh
//
this.button_Refresh.Location = new System.Drawing.Point(475, 191);
this.button_Refresh.Name = "button_Refresh";
this.button_Refresh.Size = new System.Drawing.Size(97, 39);
this.button_Refresh.TabIndex = 0;
this.button_Refresh.Text = "刷新列表";
this.button_Refresh.UseVisualStyleBackColor = true;
this.button_Refresh.Click += new System.EventHandler(this.button_Refresh_Click);
//
// AssemblyManagement
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(584, 362);
this.Controls.Add(this.listView_Assembly);
this.Controls.Add(this.button_Exit);
this.Controls.Add(this.button_Refresh);
this.Controls.Add(this.button_DownLoad);
this.Controls.Add(this.button_UpLoad);
this.Controls.Add(this.button_AddAssembly);
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(600, 400);
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(600, 400);
this.Name = "AssemblyManagement";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "程序集管理";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ListView listView_Assembly;
private System.Windows.Forms.Button button_AddAssembly;
private System.Windows.Forms.OpenFileDialog openFileDialog_OpenAssembly;
private System.Windows.Forms.Button button_UpLoad;
private System.Windows.Forms.Button button_DownLoad;
private System.Windows.Forms.ColumnHeader columnHeader_Id;
private System.Windows.Forms.ColumnHeader columnHeader_AssemblyName;
private System.Windows.Forms.ColumnHeader columnHeader_FunctionName;
private System.Windows.Forms.Button button_Exit;
private System.Windows.Forms.Button button_Refresh;
}
}

View File

@@ -0,0 +1,347 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MisDataName
{
public delegate void NormalDel();
public partial class AssemblyManagement : Form
{
public static Hashtable ExternalAssembly = new Hashtable();
public static Hashtable MisAssembly_UnLoad = new Hashtable();//储存所有已卸载的程序集
public static NormalDel UploadAssemblyDel ;
public static string UpLoadObject = "";
public AssemblyManagement()
{
CreateAssemblyFolder();
InitializeComponent();
UploadAssemblyDel = new NormalDel(UploadAssembly);
InitAssemblyList();
}
/// <summary>
/// 创建程序集文件夹
/// </summary>
void CreateAssemblyFolder()
{
try
{
//获取程序集路径
string AssemblyCreatePath = System.IO.Directory.GetCurrentDirectory();
//判断当前路径是否存在对应文件夹
if (!Directory.Exists(AssemblyCreatePath + "\\Assembly_External"))
{
Directory.CreateDirectory(AssemblyCreatePath + "\\Assembly_External");
}
if (!Directory.Exists(AssemblyCreatePath + "\\Assembly_Recycle"))
{
Directory.CreateDirectory(AssemblyCreatePath + "\\Assembly_Recycle");
}
}
catch (Exception err)
{
SystemFramework.ApplicationLog.WriteLog(err, err.Message);
}
}
/// <summary>
/// 初始化回收文件夹,删除内部所有文件
/// </summary>
public static void InitAssembly_Recycle()
{
try
{
DirectoryInfo folder_Recycle = new DirectoryInfo(System.IO.Directory.GetCurrentDirectory() + "\\Assembly_Recycle");
foreach (FileInfo file in folder_Recycle.GetFiles("*.dll"))
{
file.Delete();
}
}
catch (Exception err)
{
SystemFramework.ApplicationLog.WriteLog(err, err.Message);
}
}
/// <summary>
/// 初始化程序集列表
/// </summary>
void InitAssemblyList()
{
try
{
ExternalAssembly = new Hashtable();
listView_Assembly.Items.Clear();
ListViewItem AssemblyItem;
string[] AssemblyStrArrary = new string[3];
int i = 1, k = 0;
string[] AssemblyKeys = new string[MesDataFunction.OpcOperation.Hashtable_assembly.Count];
foreach (string _key in MesDataFunction.OpcOperation.Hashtable_assembly.Keys)
{
AssemblyKeys[k] = _key;
k++;
}
Array.Sort(AssemblyKeys);
for (int j = 0; j < AssemblyKeys.Length; j++)
{
AssemblyStrArrary[0] = i.ToString();
AssemblyStrArrary[1] = AssemblyKeys[j];
if (MesDataFunction.OpcOperation.Hashtable_assembly[AssemblyKeys[j]] != null)
{
AssemblyStrArrary[2] = ((System.Reflection.Assembly)MesDataFunction.OpcOperation.Hashtable_assembly[AssemblyKeys[j]]).FullName.Split(',')[0] + ".dll";
}
else
{
AssemblyStrArrary[2] = "";
}
AssemblyItem = new ListViewItem(AssemblyStrArrary);
listView_Assembly.Items.Add(AssemblyItem);
i++;
}
//初始化外部程序集
DirectoryInfo folder_External = new DirectoryInfo(System.IO.Directory.GetCurrentDirectory() + "\\Assembly_External");
foreach (FileInfo file in folder_External.GetFiles("*.dll"))
{
AssemblyStrArrary[0] = i.ToString();
AssemblyStrArrary[1] = "未挂载";
AssemblyStrArrary[2] = "..MisData" + file.FullName.Replace("MisData\\Assembly_External", "!\\Assembly_External").Split('!')[1];
AssemblyItem = new ListViewItem(AssemblyStrArrary);
listView_Assembly.Items.Add(AssemblyItem);
i++;
}
//初始化外部程序集
DirectoryInfo folder_Recycle = new DirectoryInfo(System.IO.Directory.GetCurrentDirectory() + "\\Assembly_Recycle");
foreach (FileInfo file in folder_Recycle.GetFiles("*.dll"))
{
AssemblyStrArrary[0] = i.ToString();
AssemblyStrArrary[1] = "已卸载";
AssemblyStrArrary[2] = "..MisData" + file.FullName.Replace("MisData\\Assembly_Recycle", "!\\Assembly_Recycle").Split('!')[1];
AssemblyItem = new ListViewItem(AssemblyStrArrary);
listView_Assembly.Items.Add(AssemblyItem);
i++;
}
}
catch (Exception err)
{
SystemFramework.ApplicationLog.WriteLog(err, err.Message);
}
}
private void button_Exit_Click(object sender, EventArgs e)
{
Close();
}
private void button_AddAssembly_Click(object sender, EventArgs e)
{
openFileDialog_OpenAssembly.ShowDialog();
//刷新listview
}
private void button_UpLoad_Click(object sender, EventArgs e)
{
try
{
if (listView_Assembly.SelectedItems.Count > 0)
{
if (listView_Assembly.SelectedItems[0].SubItems[2].Text.Length > 3)
{
if (listView_Assembly.SelectedItems[0].SubItems[2].Text.Split('\\').Length <= 1)
{
MessageBox.Show("当前程序集已装载,禁止重复装载!");
return;
}
UploadAssembly UploadAssemblyForm = new MisDataName.UploadAssembly(listView_Assembly.SelectedItems[0].SubItems[2].Text);
UploadAssemblyForm.ShowDialog();
InitAssemblyList();
}
else
{
MessageBox.Show("请选择要操作的程序集。");
}
}
else
{
MessageBox.Show("请选择要操作的程序集。");
}
}
catch (Exception err)
{
SystemFramework.ApplicationLog.WriteLog(err, err.Message);
}
}
private void button_DownLoad_Click(object sender, EventArgs e)
{
try
{
if (listView_Assembly.SelectedItems.Count > 0)
{
string AssemblyFileName = listView_Assembly.SelectedItems[0].SubItems[1].Text;
if (AssemblyFileName.Substring(0, 3) != "Fun")
{
MessageBox.Show("当前程序集未被引用,请选择要卸载的服务!");
return;
}
List<string> DownLoadServerName = new List<string>();
//卸载所有调用当前程序集服务的程序集
System.Reflection.Assembly DownLoadAssembly = ((System.Reflection.Assembly)MesDataFunction.OpcOperation.Hashtable_assembly[AssemblyFileName]);
//遍历所有对当前程序集有调用的服务
foreach (string _key in MesDataFunction.OpcOperation.Hashtable_assembly.Keys)
{
if (MesDataFunction.OpcOperation.Hashtable_assembly[_key] == null)
continue;
if (((System.Reflection.Assembly)MesDataFunction.OpcOperation.Hashtable_assembly[_key]).FullName == DownLoadAssembly.FullName)
{
DownLoadServerName.Add(_key);
}
}
foreach (string _key in DownLoadServerName)
{
MesDataFunction.OpcOperation.Hashtable_assembly[_key] = null;
}
//将卸载的DLL文件移出到回收文件
File.Move(System.IO.Directory.GetCurrentDirectory() + "\\" + listView_Assembly.SelectedItems[0].SubItems[2].Text, System.IO.Directory.GetCurrentDirectory() + "\\Assembly_Recycle\\" + listView_Assembly.SelectedItems[0].SubItems[2].Text.Replace(".dll", "") + "_" + DateTime.Now.ToUniversalTime().ToString().Replace('/', '_').Replace(' ', '_').Replace(':', '_') + ".dll");
InitAssemblyList();
MessageBox.Show("程序集卸载成功!");
}
else
{
MessageBox.Show("请选择要卸载的程序集。");
}
}
catch (Exception err)
{
SystemFramework.ApplicationLog.WriteLog(err, err.Message);
}
}
/// <summary>
/// 装载程序集
/// </summary>
void UploadAssembly()
{
try
{
//获取选中行的 dll 名称
string BinPath = System.IO.Directory.GetCurrentDirectory();
string AssemblyFileName = listView_Assembly.SelectedItems[0].SubItems[2].Text.Replace("..MisData\\", "");
AssemblyFileName = AssemblyFileName.Split('\\')[1].ToString();//程序集文件名称
//此步骤需要将所有引用的同名DLL全部替换
System.Reflection.Assembly new_LoadAssembly = System.Reflection.Assembly.LoadFile(BinPath + listView_Assembly.SelectedItems[0].SubItems[2].Text.Replace("..MisData", ""));
System.Reflection.Assembly old_LoadAssembly = (System.Reflection.Assembly)MesDataFunction.OpcOperation.Hashtable_assembly[UpLoadObject];
int Compare_i = 0;
foreach (string _key in MesDataFunction.OpcOperation.Hashtable_assembly.Keys)
{
if (((System.Reflection.Assembly)MesDataFunction.OpcOperation.Hashtable_assembly[_key]) == null) continue;
if (((System.Reflection.Assembly)MesDataFunction.OpcOperation.Hashtable_assembly[_key]).FullName == new_LoadAssembly.FullName && _key != UpLoadObject)
{
//提示存在同名程序集 若要替换 请先卸载同名程序集
Compare_i++;
}
}
if (Compare_i > 0)
{
//存在多个引用项
MessageBox.Show("系统存在与当前程序集同名的程序集引用,如果要引用新程序集,请提前卸载其他服务引用的同名程序集:", "提示:");
return;
}
else
{
//移出旧程序集
if (old_LoadAssembly != null)
{
File.Move(System.IO.Directory.GetCurrentDirectory() + "\\" + old_LoadAssembly.FullName.Split(',')[0] + ".dll", System.IO.Directory.GetCurrentDirectory() + "\\Assembly_Recycle\\" + old_LoadAssembly.FullName.Split(',')[0] + "_" + DateTime.Now.ToUniversalTime().ToString().Replace('/', '_').Replace(' ', '_').Replace(':', '_') + ".dll");
}
MesDataFunction.OpcOperation.Hashtable_assembly[UpLoadObject] = new_LoadAssembly;
//移动原程序集 然后移动新程序集 系统文件夹是否存在同名Dll文件
if (File.Exists(System.IO.Directory.GetCurrentDirectory() + "\\" + AssemblyFileName))
{
//将同名DLL文件移出到回收文件
File.Move(System.IO.Directory.GetCurrentDirectory() + "\\" + AssemblyFileName, System.IO.Directory.GetCurrentDirectory() + "\\Assembly_Recycle\\" + AssemblyFileName.Replace(".dll", "") + "_" + DateTime.Now.ToUniversalTime().ToString().Replace('/', '_').Replace(' ', '_').Replace(':', '_') + ".dll");
}
File.Move(System.IO.Directory.GetCurrentDirectory() + "\\" + listView_Assembly.SelectedItems[0].SubItems[2].Text.Replace("..MisData\\", ""), System.IO.Directory.GetCurrentDirectory() + "\\" + (AssemblyFileName.Split('_')[0]).Replace(".dll", "") + ".dll");//移入新程序集
MessageBox.Show("程序集装载成功!");
}
}
catch (Exception err)
{
SystemFramework.ApplicationLog.WriteLog(err, err.Message);
}
}
private void openFileDialog_OpenAssembly_FileOk(object sender, CancelEventArgs e)
{
try
{
//将文件复制到Assembly_External 文件夹
if (openFileDialog_OpenAssembly.SafeFileName.Split('.')[openFileDialog_OpenAssembly.SafeFileName.Split('.').Length - 1] != "dll")
{
MessageBox.Show("添加的文件无效请选择需要添加的“dll”文件");
return;
}
FileInfo file = new FileInfo(openFileDialog_OpenAssembly.FileName);
file.CopyTo(System.IO.Directory.GetCurrentDirectory() + "\\Assembly_External\\" + openFileDialog_OpenAssembly.SafeFileName, true);
InitAssemblyList();
}
catch (Exception err)
{
SystemFramework.ApplicationLog.WriteLog(err, err.Message);
}
}
private void button_Refresh_Click(object sender, EventArgs e)
{
InitAssemblyList();
}
}
}

View File

@@ -0,0 +1,123 @@
<?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>
<metadata name="openFileDialog_OpenAssembly.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -0,0 +1,118 @@
namespace MisDataName
{
partial class UploadAssembly
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.listBox_AssemblyTag = new System.Windows.Forms.ListBox();
this.button_OK = new System.Windows.Forms.Button();
this.button_Cancel = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.label_AssemblyName = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// listBox_AssemblyTag
//
this.listBox_AssemblyTag.FormattingEnabled = true;
this.listBox_AssemblyTag.ItemHeight = 12;
this.listBox_AssemblyTag.Location = new System.Drawing.Point(12, 36);
this.listBox_AssemblyTag.Name = "listBox_AssemblyTag";
this.listBox_AssemblyTag.Size = new System.Drawing.Size(260, 172);
this.listBox_AssemblyTag.TabIndex = 0;
//
// button_OK
//
this.button_OK.Location = new System.Drawing.Point(20, 220);
this.button_OK.Name = "button_OK";
this.button_OK.Size = new System.Drawing.Size(75, 23);
this.button_OK.TabIndex = 1;
this.button_OK.Text = "OK";
this.button_OK.UseVisualStyleBackColor = true;
this.button_OK.Click += new System.EventHandler(this.button_OK_Click);
//
// button_Cancel
//
this.button_Cancel.Location = new System.Drawing.Point(167, 220);
this.button_Cancel.Name = "button_Cancel";
this.button_Cancel.Size = new System.Drawing.Size(75, 23);
this.button_Cancel.TabIndex = 2;
this.button_Cancel.Text = "Cancel";
this.button_Cancel.UseVisualStyleBackColor = true;
this.button_Cancel.Click += new System.EventHandler(this.button_Cancel_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(10, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(53, 12);
this.label1.TabIndex = 3;
this.label1.Text = "程序集:";
//
// label_AssemblyName
//
this.label_AssemblyName.AutoSize = true;
this.label_AssemblyName.Location = new System.Drawing.Point(64, 9);
this.label_AssemblyName.Name = "label_AssemblyName";
this.label_AssemblyName.Size = new System.Drawing.Size(77, 12);
this.label_AssemblyName.TabIndex = 4;
this.label_AssemblyName.Text = "ServerObject";
//
// UploadAssembly
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 262);
this.Controls.Add(this.label_AssemblyName);
this.Controls.Add(this.label1);
this.Controls.Add(this.button_Cancel);
this.Controls.Add(this.button_OK);
this.Controls.Add(this.listBox_AssemblyTag);
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(300, 300);
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(300, 300);
this.Name = "UploadAssembly";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "绑定程序集";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ListBox listBox_AssemblyTag;
private System.Windows.Forms.Button button_OK;
private System.Windows.Forms.Button button_Cancel;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label_AssemblyName;
}
}

View File

@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MisDataName
{
public partial class UploadAssembly : Form
{
public UploadAssembly()
{
InitializeComponent();
InitAssemblyTag();
}
public UploadAssembly(string Str)
{
InitializeComponent();
label_AssemblyName.Text = Str.Replace ("MisData\\", "");
InitAssemblyTag();
}
void InitAssemblyTag()
{
int k = 0;
listBox_AssemblyTag.Items.Clear();
string[] AssemblyKeys = new string[MesDataFunction.OpcOperation.Hashtable_assembly.Count];
foreach (string _key in MesDataFunction.OpcOperation.Hashtable_assembly.Keys)
{
AssemblyKeys[k] = _key;
k++;
}
Array.Sort(AssemblyKeys);
for (int i = 0; i < AssemblyKeys.Length; i++)
{
listBox_AssemblyTag.Items.Add(AssemblyKeys[i]);
}
}
private void button_OK_Click(object sender, EventArgs e)
{
if(listBox_AssemblyTag.SelectedItems .Count ==0)
{
MessageBox.Show("请选择需要挂载的服务对象!");
}
else
{
AssemblyManagement.UpLoadObject = listBox_AssemblyTag.SelectedItems[0].ToString();
}
AssemblyManagement.UploadAssemblyDel();
Close();
}
private void button_Cancel_Click(object sender, EventArgs e)
{
Close();
}
}
}

View File

@@ -0,0 +1,120 @@
<?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>
</root>

View File

@@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using SystemFramework;
namespace MisDataName
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
// if (System.Diagnostics.Process.GetProcessesByName(System.Diagnostics.Process.GetCurrentProcess().ProcessName).Length <= 1)
{
object sds = System.Diagnostics.Process.GetProcessesByName(System.Diagnostics.Process.GetCurrentProcess().ProcessName);
//处理未捕获的异常
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
//处理UI线程异常
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
//处理非UI线程异常
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MisData());
}
//else
//{
// object sds = System.Diagnostics.Process.GetProcessesByName(System.Diagnostics.Process.GetCurrentProcess().ProcessName);
// MessageBox.Show("程序已经打开!");
//}
}
/// <summary>
/// Application_ThreadException
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
string str = "";
string strDateInfo = "出现应用程序未处理的异常:" + DateTime.Now.ToString() + "\r\n";
Exception error = e.Exception as Exception;
if (error != null)
{
str = string.Format(strDateInfo + "异常类型:{0}\r\n异常消息{1}\r\n异常信息{2}\r\n",
error.GetType().Name, error.Message, error.StackTrace);
}
else
{
str = string.Format("应用程序线程错误:{0}", e);
}
ApplicationLog.WriteLog("ProgramApplication_ThreadException" + str);
}
/// <summary>
/// CurrentDomain_UnhandledException
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
string str = "";
Exception error = e.ExceptionObject as Exception;
string strDateInfo = "出现应用程序未处理的异常:" + DateTime.Now.ToString() + "\r\n";
if (error != null)
{
str = string.Format(strDateInfo + "Application UnhandledException:{0};\n\r堆栈信息:{1}", error.Message, error.StackTrace);
}
else
{
str = string.Format("Application UnhandledError:{0}", e);
}
ApplicationLog.WriteLog("ProgramApplication_ThreadException" + str);
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("MisData")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("MisData")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//将 ComVisible 设置为 false 将使此程序集中的类型
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("2a10d165-63d7-4fa5-bab9-340599aaf4f0")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,103 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace MisData.Properties {
using System;
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MisData.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap MES图片 {
get {
object obj = ResourceManager.GetObject("MES图片", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap MES方标 {
get {
object obj = ResourceManager.GetObject("MES方标", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap MES方标1 {
get {
object obj = ResourceManager.GetObject("MES方标1", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap ME长标 {
get {
object obj = ResourceManager.GetObject("ME长标", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@@ -0,0 +1,133 @@
<?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>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="MES图片" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\MES图片.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="MES方标" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\MES方标.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="MES方标1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\MES方标1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ME长标" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\ME长标.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace MisData.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC 清单选项
如果想要更改 Windows 用户帐户控制级别,请使用
以下节点之一替换 requestedExecutionLevel 节点。n
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
指定 requestedExecutionLevel 元素将禁用文件和注册表虚拟化。
如果你的应用程序需要此虚拟化来实现向后兼容性,则删除此
元素。
-->
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的
Windows 版本的列表。取消评论适当的元素,
Windows 将自动选择最兼容的环境。 -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- 指示该应用程序可感知 DPI 且 Windows 在 DPI 较高时将不会对其进行
自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI无需
选择加入。选择加入此设置的 Windows 窗体应用程序(面向 .NET Framework 4.6)还应
在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。
将应用程序设为感知长路径。请参阅 https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
-->
<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net461" />
</packages>