chore: 初始化合力差速器MES采集程序
This commit is contained in:
25
MisDataSaveDate/MisDataSaveDate.sln
Normal file
25
MisDataSaveDate/MisDataSaveDate.sln
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.32602.291
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MisDataSaveDate", "MisDataSaveDate\MisDataSaveDate.csproj", "{9AEDE061-8490-436A-B38B-9495DC908F19}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{9AEDE061-8490-436A-B38B-9495DC908F19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9AEDE061-8490-436A-B38B-9495DC908F19}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9AEDE061-8490-436A-B38B-9495DC908F19}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9AEDE061-8490-436A-B38B-9495DC908F19}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {AC76E79B-C576-4AF6-889E-57D1B50CC4F4}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
22
MisDataSaveDate/MisDataSaveDate/App.config
Normal file
22
MisDataSaveDate/MisDataSaveDate/App.config
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
|
||||
<add key="MqttUrl" value="124.220.15.242:1883,MES/InstantMessaging/SY/MisServer" />
|
||||
<add key="MqttTargetTopic" value="MES/InstantMessaging/SY" />
|
||||
<add key="MqttTargetTopicTagTypeCodeID" value="MES/TagTypeCodeID" />
|
||||
<add key="Url_WebApi" value="http://localhost:41186" />
|
||||
<add key="ConnectionString_MES" value="server=124.220.15.242\MSSQLSERVER2012,1433;User ID=meswork;Password=126.com;database=MacroinfBasicDB_SY;Connection Reset=FALSE" />
|
||||
|
||||
|
||||
<!--<add key="MqttUrl" value="124.220.15.242:1883,MES/InstantMessaging/SY/MisServer" />
|
||||
<add key="MqttUrlPLC" value="124.220.15.242:1883,PLC/InstantMessaging/MisServer" />
|
||||
--><!--<add key="MqttUrl" value="192.168.1.188:1883,MES/InstantMessaging/MisServer" />--><!--
|
||||
<add key="MqttTargetTopic" value="MES/InstantMessaging/SY" />
|
||||
<add key="MqttTargetTopicPLC" value="MES/InstantMessaging/SY/MisServer" />
|
||||
<add key="MqttTargetTopicTagTypeCodeID" value="MES/TagTypeCodeID" />-->
|
||||
</appSettings>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||
</startup>
|
||||
</configuration>
|
||||
55
MisDataSaveDate/MisDataSaveDate/Funtion .Mqtt.cs
Normal file
55
MisDataSaveDate/MisDataSaveDate/Funtion .Mqtt.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using bizFacade;
|
||||
using DoWhatPlc;
|
||||
using MesServerWork;
|
||||
using MesWorkMqtt;
|
||||
using MQTTnet;
|
||||
using MQTTnet.Client.Connecting;
|
||||
using MQTTnet.Client.Disconnecting;
|
||||
using MQTTnet.Client.Receiving;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MisDataSaveDate
|
||||
{
|
||||
public partial class Funtion
|
||||
{
|
||||
|
||||
public Mqtt2 mqtt2;
|
||||
public void InitMqtt2(string url, string topic)
|
||||
{
|
||||
mqtt2 = new Mqtt2();
|
||||
mqtt2.MqttUrl = url;
|
||||
mqtt2.topic = topic;
|
||||
mqtt2.StartAsync();
|
||||
mqtt2.mqttClient.ConnectedHandler = new MqttClientConnectedHandlerDelegate(OnSubscriberConnected);
|
||||
mqtt2.mqttClient.DisconnectedHandler = new MqttClientDisconnectedHandlerDelegate(OnSubscriberDisconnected);
|
||||
mqtt2.mqttClient.ApplicationMessageReceivedHandler = new MqttApplicationMessageReceivedHandlerDelegate(OnSubscriberMessageReceived);
|
||||
|
||||
MesServerWork.MIS_BASE.InitHashtable_MesServerCode();
|
||||
}
|
||||
private void OnSubscriberConnected(MqttClientConnectedEventArgs x)
|
||||
{
|
||||
var rec = x.AuthenticateResult.ResultCode.ToString();
|
||||
//label_State.Text = rec;
|
||||
}
|
||||
|
||||
private void OnSubscriberDisconnected(MqttClientDisconnectedEventArgs x)
|
||||
{
|
||||
//var rec = x.AuthenticateResult.ResultCode.ToString();
|
||||
//label_State.Text = rec;
|
||||
}
|
||||
|
||||
private void OnSubscriberMessageReceived(MqttApplicationMessageReceivedEventArgs x)
|
||||
{
|
||||
var rec = x.ApplicationMessage.ConvertPayloadToString();
|
||||
ThreadPool.QueueUserWorkItem(MIS_Funtion, rec);
|
||||
}
|
||||
}
|
||||
}
|
||||
75
MisDataSaveDate/MisDataSaveDate/Funtion.Alarm.cs
Normal file
75
MisDataSaveDate/MisDataSaveDate/Funtion.Alarm.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using bizFacade;
|
||||
using DataLinkMesWork;
|
||||
using DoWhatPlc;
|
||||
using MesServerWork;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MisDataSaveDate
|
||||
{
|
||||
public partial class Funtion
|
||||
{
|
||||
|
||||
private static void Alarm_Insert(ReturnValueString rv)
|
||||
{
|
||||
string TagID;
|
||||
string opName;
|
||||
string tagTypeID;
|
||||
int TagValue;
|
||||
|
||||
DateTime alarmStartTime;
|
||||
DateTime alarmEndTime;
|
||||
int TimeDiff;
|
||||
string TagOrderBy;
|
||||
string Text1;
|
||||
string Text2;
|
||||
TagID = rv.TagID;
|
||||
tagTypeID = rv.TagTypeID;
|
||||
opName = rv.OpName;
|
||||
TagValue = Convert.ToInt32(rv.TagValue);
|
||||
|
||||
alarmStartTime = Convert.ToDateTime(rv.TimeStampBefore);
|
||||
alarmEndTime = Convert.ToDateTime(rv.TimeStamp);
|
||||
TimeDiff = Convert.ToInt32(rv.TagKeepTime);
|
||||
TagOrderBy = rv.TagOrderBy;
|
||||
Text1 = rv.ItemName;
|
||||
Text2 = rv.ShaftID;
|
||||
|
||||
Alarm_Insert(TagID, tagTypeID, opName, TagValue,
|
||||
alarmStartTime, alarmEndTime, TimeDiff, Text1, Text2, TagOrderBy);
|
||||
}
|
||||
|
||||
public static bool Alarm_Insert(string TagID, string tagTypeID, string opName, int TagValue,
|
||||
DateTime alarmStartTime, DateTime alarmEndTime, int TimeDiff,
|
||||
string Text1, string Text2, string TagOrderBy)
|
||||
{
|
||||
|
||||
|
||||
string produceName = "测量数据工位报警全部_增加数据";
|
||||
SqlParameter[] thisParms = new SqlParameter[10];
|
||||
thisParms[0] = new System.Data.SqlClient.SqlParameter("@TagID", TagID);
|
||||
thisParms[1] = new System.Data.SqlClient.SqlParameter("@TagTypeID", tagTypeID);
|
||||
thisParms[2] = new System.Data.SqlClient.SqlParameter("@opName", opName);
|
||||
thisParms[3] = new System.Data.SqlClient.SqlParameter("@TagValue", TagValue);
|
||||
thisParms[4] = new System.Data.SqlClient.SqlParameter("@alarmStartTime", alarmStartTime);
|
||||
thisParms[5] = new System.Data.SqlClient.SqlParameter("@alarmEndTime", alarmEndTime);
|
||||
thisParms[6] = new System.Data.SqlClient.SqlParameter("@TimeDiff", TimeDiff);
|
||||
thisParms[7] = new System.Data.SqlClient.SqlParameter("@Text1", Text1);
|
||||
thisParms[8] = new System.Data.SqlClient.SqlParameter("@Text2", Text2);
|
||||
thisParms[9] = new System.Data.SqlClient.SqlParameter("@TagOrderBy", TagOrderBy);
|
||||
if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms))
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
104
MisDataSaveDate/MisDataSaveDate/Funtion.EngTypeGetOver.cs
Normal file
104
MisDataSaveDate/MisDataSaveDate/Funtion.EngTypeGetOver.cs
Normal file
@@ -0,0 +1,104 @@
|
||||
using bizFacade;
|
||||
using DataLinkMesWork;
|
||||
using DoWhatPlc;
|
||||
using MesServerWork;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MisDataSaveDate
|
||||
{
|
||||
public partial class Funtion
|
||||
{
|
||||
private static void EngTypeGetOver(string opName,string tagValue)
|
||||
{
|
||||
if (hashtable_EngineGetOver.Contains(opName))
|
||||
{
|
||||
hashtable_EngineGetOver.Remove(opName);
|
||||
}
|
||||
hashtable_EngineGetOver.Add(opName, tagValue);
|
||||
if (tagValue == "1")
|
||||
{
|
||||
|
||||
int EngineTypeID;
|
||||
string EngineType;
|
||||
string EngineID;
|
||||
int PartPalletCode;
|
||||
// 1 读取机型等信息,保存到监控表
|
||||
|
||||
DtWebApi.ReadWritePLC.GetEngineTypeFromPLC(opName, out EngineTypeID, out EngineType, out EngineID, out PartPalletCode);
|
||||
|
||||
if (hashtable_EngineGetOver_EngineTypeID.Contains(opName))
|
||||
{
|
||||
hashtable_EngineGetOver_EngineTypeID.Remove(opName);
|
||||
}
|
||||
hashtable_EngineGetOver_EngineTypeID.Add(opName, EngineTypeID);
|
||||
|
||||
if (hashtable_EngineGetOver_EngineType.Contains(opName))
|
||||
{
|
||||
hashtable_EngineGetOver_EngineType.Remove(opName);
|
||||
}
|
||||
hashtable_EngineGetOver_EngineType.Add(opName, EngineType);
|
||||
|
||||
|
||||
if (hashtable_EngineGetOver_EngineID.Contains(opName))
|
||||
{
|
||||
hashtable_EngineGetOver_EngineID.Remove(opName);
|
||||
}
|
||||
hashtable_EngineGetOver_EngineID.Add(opName, EngineID);
|
||||
if (hashtable_PartPalletCode.Contains(opName))
|
||||
{
|
||||
hashtable_PartPalletCode.Remove(opName);
|
||||
}
|
||||
hashtable_PartPalletCode.Add(opName, PartPalletCode);
|
||||
|
||||
EngTypeGetOverInsert(opName, EngineTypeID, EngineType, EngineID, PartPalletCode);
|
||||
|
||||
|
||||
// 2 保存工件到位信息
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
/// <summary>
|
||||
/// @工位号 nvarchar(50)=null,
|
||||
///@产品型号代码 int=1 ,
|
||||
///@发动机型号 nvarchar(50)=null ,
|
||||
///@发动机号 nvarchar(50)=null ,
|
||||
///@托盘号 nvarchar(50)='0'
|
||||
/// </summary>
|
||||
/// <param name="EngineID"></param>
|
||||
/// <param name="tagID"></param>
|
||||
/// <param name="EngineType"></param>
|
||||
/// <param name="EngineTypeID"></param>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="isGoodBad"></param>
|
||||
/// <param name="PartPalletCode"></param>
|
||||
/// <param name="Id_tagCF"></param>
|
||||
/// <returns></returns>
|
||||
public static bool EngTypeGetOverInsert(string opName, int EngineTypeID, string EngineType,string EngineID, int PartPalletCode)
|
||||
{
|
||||
string procedureName;
|
||||
procedureName = "测量数据工位_监控系统_增加";
|
||||
SqlParameter[] thisParms = new SqlParameter[5];
|
||||
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
|
||||
thisParms[1] = new System.Data.SqlClient.SqlParameter("@产品型号代码", EngineTypeID);
|
||||
thisParms[2] = new System.Data.SqlClient.SqlParameter("@发动机型号", EngineType);
|
||||
thisParms[3] = new System.Data.SqlClient.SqlParameter("@发动机号", EngineID);
|
||||
thisParms[4] = new System.Data.SqlClient.SqlParameter("@托盘编号", PartPalletCode);
|
||||
|
||||
if (DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
351
MisDataSaveDate/MisDataSaveDate/Funtion.MesRead.cs
Normal file
351
MisDataSaveDate/MisDataSaveDate/Funtion.MesRead.cs
Normal file
@@ -0,0 +1,351 @@
|
||||
using bizFacade;
|
||||
using DataLinkMesWork;
|
||||
using DoWhatPlc;
|
||||
using MesServerWork;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MisDataSaveDate
|
||||
{
|
||||
public partial class Funtion
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 允许保存(针对半自动和手动压装工位)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private static void MesRead(string opName, string tagValue, int tagid)
|
||||
{
|
||||
if (tagValue == "0")
|
||||
{
|
||||
MIS_BASE.Write_TagTypeID(20, opName, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(MIS_BASE.hashtable_tagTable_OpName_SaveData==null)
|
||||
{
|
||||
MesServerWork.MIS_BASE.InitHashtable_MesServerCode();
|
||||
}
|
||||
if(MIS_BASE.hashtable_tagTable_OpName_SaveData.Contains(opName))
|
||||
{
|
||||
if (MIS_BASE.hashtable_tagTable_OpName_SaveData[opName].ToString() == "1")
|
||||
{
|
||||
SaveQualityData(opName, Convert.ToInt32(tagValue), tagid);
|
||||
MIS_BASE.Write_TagTypeID(20, opName, true);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//MIS_BASE.Write_TagTypeID(20, opName, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// MIS_BASE.Write_TagTypeID(20, opName, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static void SaveQualityData(string opName, int tagValue, int tagID)
|
||||
{
|
||||
try
|
||||
{
|
||||
int id_tagCF;
|
||||
int qualityMask = 0;
|
||||
int engineTypeID = 0;
|
||||
string engineID = "";
|
||||
string engineType = "";
|
||||
string engineTraceCode = "";
|
||||
string engineCap = "";
|
||||
string partPallet = "";
|
||||
DataTable dt_WWW;
|
||||
dt_WWW = BaseDataSystemMES.BuildDataTables_WWW();
|
||||
Hashtable valueList;
|
||||
//valueList = ReadPLC_Sync_DataList_MesRead(opName);
|
||||
ReadPLC_Sync_DataList_MesRead(opName, out valueList, out MIS_BASE.BasicDataTagValue, out MIS_BASE.BasicDataTagValueUpDown, out MIS_BASE.hashtable_EngineTypeID, out MIS_BASE.hashtable_tagTable_OpName_SaveData);
|
||||
valueList = GetQualityData_GoodBad_Values(valueList);
|
||||
int mes_MustTest = 0;
|
||||
int onLineState = 0;
|
||||
int partMoveDirection = 0;
|
||||
int pressIsOK = 0;
|
||||
int pressIsNoOK = 0;
|
||||
BaseDataSystemMES.GetQualityDataTable_B5A(valueList, opName, MIS_BASE.BasicDataTagValue,
|
||||
MIS_BASE.BasicDataTagValueUpDown,
|
||||
out dt_WWW,//数据列表
|
||||
out qualityMask,//工位合格标志
|
||||
out engineTypeID,//发动机类型代码
|
||||
out engineID,//发动机编号
|
||||
out engineType, //发动机型号
|
||||
out partPallet,//托盘编号
|
||||
out engineTraceCode, //发动机条码
|
||||
out engineCap,//缸盖号,
|
||||
MIS_BASE.hashtable_EngineTypeID,//发动机类型转换表
|
||||
out mes_MustTest, out onLineState, out partMoveDirection, out pressIsOK, out pressIsNoOK);
|
||||
|
||||
|
||||
|
||||
|
||||
// 1:通过监控系统保存采集的质量数据;0:不通过监控系统保存采集的质量数据
|
||||
if (Convert.ToInt32(MIS_BASE.hashtable_tagTable_OpName_SaveData[opName]) != 0)
|
||||
{
|
||||
DateTime lastupdatetime = DateTime.Now;
|
||||
|
||||
BaseData_tagTable_QualityData_B5A_IndexInsert(engineID, tagID, engineType, engineTypeID, opName, qualityMask, partPallet, out id_tagCF);
|
||||
BaseData_tagTable_QualityData_B5A_Insert(id_tagCF, engineTypeID, engineID, opName, dt_WWW);
|
||||
|
||||
}
|
||||
|
||||
//启动线程保存过站信息
|
||||
|
||||
|
||||
|
||||
MIS_BASE.Write_TagTypeID(20, opName, true);
|
||||
#region
|
||||
//string orderForm = "";
|
||||
//string operatorCode = "";
|
||||
//int shiftCode = 1;
|
||||
//DateTime arrivedTime;
|
||||
//DateTime leavedTime;
|
||||
//int TimeDiff;
|
||||
//int targetTime = 0;
|
||||
//string lineType = "";
|
||||
//string isPass;
|
||||
//int machineWorkOn = 0;
|
||||
//int arrivedOrLeaved = 2;
|
||||
//int cartColorOpName = 0;
|
||||
//int cartColorConfirm = 0;
|
||||
//// int partMoveDirection;
|
||||
//int partGoOver = 0;
|
||||
//if (qualityMask == 1)
|
||||
//{
|
||||
// isPass = "PASS";
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// isPass = "FAIL";
|
||||
//}
|
||||
|
||||
////工位上下线类型
|
||||
////(0普通工位)(1正常上线)(2正常下线)(3返修上线)(4返修下线)
|
||||
//int OpNameUpDownType;
|
||||
//OpNameUpDownType = Convert.ToInt32(hashtableOpName_OpType[opName]);
|
||||
//arrivedTime = (DateTime)m_WorkStart_OpName_Time[opName];
|
||||
//leavedTime = DateTime.Now;
|
||||
//TimeDiff = Convert.ToInt32(leavedTime.Subtract(arrivedTime).TotalSeconds);
|
||||
|
||||
//lineType = hashtableOpName_LineType[opName].ToString();
|
||||
|
||||
//string isHaveComputer = hashtableOpName_IsHaveComputer[opName].ToString();
|
||||
////isHaveComputer = MIS_BASE.hashtable_tagTable_OpName_SaveData[opName].ToString();
|
||||
////有计算机的工位,通过工位计算机保存[测量数据发动机在线状态]。
|
||||
//if (Convert.ToInt32(isHaveComputer) == 0)
|
||||
//{
|
||||
// //1->0 工件离开 工件刚刚离开
|
||||
// if (Convert.ToInt32(m_WorkStart_OpName[opName]) == 1)
|
||||
// {
|
||||
|
||||
// //[测量数据发动机在线状态]
|
||||
// QualityDataSystem.WorkStartInsert
|
||||
// (opName, orderForm, engineTypeID, engineType, engineID, partPallet.ToString(), operatorCode, shiftCode,
|
||||
// arrivedTime, leavedTime, TimeDiff, targetTime, lineType, isPass, machineWorkOn,
|
||||
// arrivedOrLeaved, cartColorOpName, cartColorConfirm, partMoveDirection, partGoOver, mes_MustTest, onLineState, OpNameUpDownType);
|
||||
// }
|
||||
//}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MIS_BASE.Write_TagTypeID(20, opName, true);
|
||||
////ApplicationLog.WriteLog(err, err.Message);
|
||||
}
|
||||
|
||||
}
|
||||
public static bool BaseData_tagTable_QualityData_B5A_IndexInsert
|
||||
(string EngineID, int tagID, string EngineType, int EngineTypeID, string opName,
|
||||
int isGoodBad, string PartPalletCode, out int Id_tagCF)
|
||||
{
|
||||
string procedureName;
|
||||
procedureName = "测量数据合格索引_增加";
|
||||
Id_tagCF = 0;
|
||||
SqlParameter[] thisParms = new SqlParameter[8];
|
||||
thisParms[0] = new System.Data.SqlClient.SqlParameter("@EngineID", EngineID);
|
||||
thisParms[1] = new System.Data.SqlClient.SqlParameter("@TagID_CF", tagID);
|
||||
thisParms[2] = new System.Data.SqlClient.SqlParameter("@EngineType", EngineType);
|
||||
thisParms[3] = new System.Data.SqlClient.SqlParameter("@EngineTypeID", EngineTypeID);
|
||||
thisParms[4] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
|
||||
thisParms[5] = new System.Data.SqlClient.SqlParameter("@托盘编号", PartPalletCode);
|
||||
thisParms[6] = new System.Data.SqlClient.SqlParameter("@合格标志", isGoodBad);
|
||||
thisParms[7] = new System.Data.SqlClient.SqlParameter("@Id_tagCF", Id_tagCF);
|
||||
thisParms[7].Direction = ParameterDirection.Output;
|
||||
|
||||
if (DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms))
|
||||
{
|
||||
Id_tagCF = Convert.ToInt32(thisParms[7].Value.ToString());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static bool BaseData_tagTable_QualityData_B5A_Insert
|
||||
(int Id_tagCF, int engineTypeID, string engineID, string opName, DataTable dt)
|
||||
{
|
||||
string procedureName;
|
||||
procedureName = "测量数据合格_增加";
|
||||
SqlParameter[] thisParms = new SqlParameter[6];
|
||||
thisParms[0] = new System.Data.SqlClient.SqlParameter("@Id_tagCF", Id_tagCF);
|
||||
thisParms[1] = new System.Data.SqlClient.SqlParameter("@EngineTypeID", engineTypeID);
|
||||
thisParms[2] = new System.Data.SqlClient.SqlParameter("@EngineID", engineID);
|
||||
thisParms[3] = new System.Data.SqlClient.SqlParameter("@TagID", SqlDbType.Int, 4, "TagID");
|
||||
thisParms[4] = new System.Data.SqlClient.SqlParameter("@TagValue", SqlDbType.NVarChar, 100, "TagValue");
|
||||
thisParms[5] = new System.Data.SqlClient.SqlParameter("@IsGoodBad", SqlDbType.Int, 4, "IsGoodBad");
|
||||
//thisParms[6] = new System.Data.SqlClient.SqlParameter("@测量位置", SqlDbType.NVarChar, 50, "测量位置");
|
||||
//thisParms[7] = new System.Data.SqlClient.SqlParameter("@测量项目", SqlDbType.NVarChar, 50, "测量项目");
|
||||
//thisParms[8] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
|
||||
//thisParms[9] = new System.Data.SqlClient.SqlParameter("@理论值", SqlDbType.NVarChar, 50, "理论值");
|
||||
//thisParms[10] = new System.Data.SqlClient.SqlParameter("@上限值", SqlDbType.NVarChar, 50, "上限值");
|
||||
//thisParms[11] = new System.Data.SqlClient.SqlParameter("@下限值", SqlDbType.NVarChar, 50, "下限值");
|
||||
//thisParms[12] = new System.Data.SqlClient.SqlParameter("@测量单位", SqlDbType.NVarChar, 50, "测量单位");
|
||||
//thisParms[13] = new System.Data.SqlClient.SqlParameter("@列位置", SqlDbType.Int, 4, "列位置");
|
||||
//thisParms[14] = new System.Data.SqlClient.SqlParameter("@变量排序", SqlDbType.Int, 4, "变量排序");
|
||||
//table.Columns.Add("TagID", typeof(System.Int32));
|
||||
//table.Columns.Add("TagValue", typeof(System.String));
|
||||
//table.Columns.Add("IsGoodBad", typeof(System.Int32));
|
||||
//table.Columns.Add("测量位置", typeof(System.String));
|
||||
//table.Columns.Add("测量项目", typeof(System.String));
|
||||
//table.Columns.Add("工位号", typeof(System.String));
|
||||
//table.Columns.Add("理论值", typeof(System.String));
|
||||
//table.Columns.Add("上限值", typeof(System.String));
|
||||
//table.Columns.Add("下限值", typeof(System.String));
|
||||
//table.Columns.Add("测量单位", typeof(System.String));
|
||||
//table.Columns.Add("列位置", typeof(System.Int32));
|
||||
//table.Columns.Add("变量排序", typeof(System.Int32));
|
||||
return DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms, dt);
|
||||
}
|
||||
public static void ReadPLC_Sync_DataList_MesRead(string opName, out Hashtable valueList, out DataTable BasicDataTagValue, out DataTable BasicDataTagValueUpDown, out Hashtable hashtable_EngineTypeID, out Hashtable hashtable_tagTable_OpName_SaveData)
|
||||
{
|
||||
//QualityDataSaveList QualityDataType
|
||||
valueList = new Hashtable();
|
||||
var qualityDataSaveList = DtWebApi.SaveData.ReadPLC_Sync_DataList_MesRead(opName);
|
||||
foreach (DictionaryEntry de in qualityDataSaveList.valuList)
|
||||
{
|
||||
valueList.Add(de.Key, JsonConvert.DeserializeObject<QualityDataType>(de.Value.ToString()));
|
||||
}
|
||||
BasicDataTagValue = qualityDataSaveList.BasicDataTagValue;
|
||||
BasicDataTagValueUpDown = qualityDataSaveList.BasicDataTagValueUpDown;
|
||||
hashtable_EngineTypeID = qualityDataSaveList.hashtable_EngineTypeID;
|
||||
hashtable_tagTable_OpName_SaveData = qualityDataSaveList.hashtable_tagTable_OpName_SaveData;
|
||||
}
|
||||
/// <summary>
|
||||
/// 确定合格标志
|
||||
/// </summary>
|
||||
/// <param name="valuList"></param>
|
||||
/// <returns></returns>
|
||||
static public Hashtable GetQualityData_GoodBad_Values(Hashtable valuList)
|
||||
{
|
||||
try
|
||||
{
|
||||
Hashtable valuList_Temp;
|
||||
valuList_Temp = (Hashtable)valuList.Clone();
|
||||
int[] value_GoodBad_New = new int[128];
|
||||
int tagID;
|
||||
QualityDataType value;
|
||||
//1:获得合格标志
|
||||
foreach (DictionaryEntry de in valuList) //ht为一个Hashtable实例
|
||||
{
|
||||
tagID = Convert.ToInt32(de.Key);
|
||||
value = (QualityDataType)de.Value;
|
||||
|
||||
//拧紧数据合格标志
|
||||
if (value.tagProperty == 1)
|
||||
{
|
||||
if (value.tagTypeID == 8203)
|
||||
{
|
||||
value_GoodBad_New = (int[])value.tagValue;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
value_GoodBad_New[value.tagOrderBy - 1] = Convert.ToInt32(value.tagValue);
|
||||
}
|
||||
}
|
||||
//拧紧数据合格标志
|
||||
if (value.tagProperty == 8)
|
||||
{
|
||||
if (value.tagTypeID == 8203)
|
||||
{
|
||||
value_GoodBad_New = (int[])value.tagValue;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
value_GoodBad_New[value.tagOrderBy - 1] = Convert.ToInt32(value.tagValue);
|
||||
}
|
||||
}
|
||||
//压装数据合格标志
|
||||
if (value.tagProperty == 7)
|
||||
{
|
||||
value_GoodBad_New[value.tagOrderBy - 1] = Convert.ToInt32(value.tagValue);
|
||||
}
|
||||
}
|
||||
//将合格标志赋予每个变量
|
||||
foreach (DictionaryEntry de in valuList) //ht为一个Hashtable实例
|
||||
{
|
||||
tagID = Convert.ToInt32(de.Key);
|
||||
value = (QualityDataType)de.Value;
|
||||
//201706061720新加
|
||||
if (value.tagTypeID == 11)
|
||||
{
|
||||
if (value.tagValue.ToString() == "False")
|
||||
{
|
||||
value.tagValue = "0";
|
||||
}
|
||||
else
|
||||
{
|
||||
value.tagValue = "1";
|
||||
}
|
||||
valuList_Temp[tagID] = value;
|
||||
//value.tagValue = Convert.ToInt32(value.tagValue);
|
||||
}
|
||||
|
||||
|
||||
//测量变量
|
||||
if (value.tagProperty == 2 || value.tagProperty == 6)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (value_GoodBad_New != null)
|
||||
{
|
||||
value.isGoodBad = Convert.ToInt32(value_GoodBad_New[value.tagOrderBy - 1]);
|
||||
valuList_Temp[tagID] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
value.isGoodBad = 0;
|
||||
valuList_Temp[tagID] = value;
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, err.Message);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return valuList_Temp;
|
||||
}
|
||||
catch//转换出了故障时
|
||||
{
|
||||
return valuList;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
228
MisDataSaveDate/MisDataSaveDate/Funtion.WorkStart.cs
Normal file
228
MisDataSaveDate/MisDataSaveDate/Funtion.WorkStart.cs
Normal file
@@ -0,0 +1,228 @@
|
||||
using bizFacade;
|
||||
using DataLinkMesWork;
|
||||
using DoWhatPlc;
|
||||
using MesServerWork;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MisDataSaveDate
|
||||
{
|
||||
public partial class Funtion
|
||||
{
|
||||
|
||||
private static void WorkStart(ReturnValueString rv)
|
||||
{
|
||||
var ro = rv.ReturnValueToObject();
|
||||
|
||||
string opName = ro.OpName;
|
||||
DateTime arrivedTime = ro.TimeStampBefore;
|
||||
DateTime leavedTime = ro.TimeStamp;
|
||||
int TimeDiff = ro.TagKeepTime;
|
||||
int targetTime = 0;
|
||||
string isPass = "";
|
||||
|
||||
int QualityMark = 0;
|
||||
string tagValue = "0";
|
||||
switch (ro.TagValue.ToString().ToLower())
|
||||
{
|
||||
case "1":
|
||||
case "true":
|
||||
tagValue = "1";
|
||||
break;
|
||||
default:
|
||||
tagValue = "0";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int EngineTypeID=-1;//机型代码
|
||||
int PartPalletCode=-1;//托盘编号
|
||||
string EngineType="-1";//机型
|
||||
string EngineID="-1";//工件编号
|
||||
if (hashtable_EngineGetOver_EngineTypeID.Contains(opName))
|
||||
{
|
||||
EngineTypeID = Convert.ToInt32( hashtable_EngineGetOver_EngineTypeID[opName]);
|
||||
}
|
||||
if (hashtable_EngineGetOver_EngineType.Contains(opName))
|
||||
{
|
||||
EngineType = hashtable_EngineGetOver_EngineType[opName].ToString();
|
||||
}
|
||||
if (hashtable_EngineGetOver_EngineID.Contains(opName))
|
||||
{
|
||||
EngineID = hashtable_EngineGetOver_EngineID[opName].ToString();
|
||||
}
|
||||
if (hashtable_PartPalletCode.Contains(opName))
|
||||
{
|
||||
PartPalletCode = Convert.ToInt32(hashtable_PartPalletCode[opName]);
|
||||
}
|
||||
|
||||
//MIS_BASE.GetEngineTypeFromPLC(opName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code);
|
||||
|
||||
//EngineData Enginedata = (EngineData)EngineData_Hash_Read(opName);
|
||||
//WorkStartInsert_AutoWorkStation(opName, EngineID, PartPalletCode, arrivedTime, leavedTime, TimeDiff, targetTime, null, isPass, 0);
|
||||
|
||||
if (tagValue == "0")
|
||||
{
|
||||
QualityMark = Convert.ToInt32(DtWebApi.ReadWritePLC.ReadPLC("21", opName));
|
||||
|
||||
if (QualityMark == 1)
|
||||
{
|
||||
isPass = "1";
|
||||
}
|
||||
else
|
||||
{
|
||||
isPass = "0";
|
||||
}
|
||||
|
||||
WorkStartInsert_V2022(opName, arrivedTime, leavedTime, TimeDiff, isPass);
|
||||
|
||||
MIS_BASE.Write_TagTypeID(5, opName, false);//MES传递机型
|
||||
MIS_BASE.Write_TagTypeID(66, opName, false);//允许工作
|
||||
MIS_BASE.Write_TagTypeID(51, opName, false);//合格放行
|
||||
MIS_BASE.Write_TagTypeID(8, opName, false);//不合格放行
|
||||
MIS_BASE.Write_TagTypeID(7, opName, false);//工作完成
|
||||
MIS_BASE.Write_TagTypeID(20, opName, false);//保存完成
|
||||
|
||||
|
||||
|
||||
//string isHaveComputer = hashtableOpName_IsHaveComputer[opName].ToString();
|
||||
//if (Convert.ToInt32(isHaveComputer) == 0)//自动工位 读合格标志
|
||||
//{
|
||||
// if (IsEngTypeGetOver_Read(opName))
|
||||
// {
|
||||
// //PLC未传递机型 不保存过站信息
|
||||
// SaveProductLeaveData_AutoWorkStation(opName, Convert.ToInt32(DtWebApi.ReadWritePLC.ReadPLC("21", opName)));
|
||||
// //SaveProductLeaveData_AutoWorkStation(opName, Convert.ToInt32(MesDataFunction.OpcOperation.ReadPLC(21, opName)));
|
||||
// }
|
||||
|
||||
//}
|
||||
|
||||
////清空信号
|
||||
////m_WorkStart_OpName[opName] = 0;//清空工件到位标志
|
||||
|
||||
}
|
||||
|
||||
//通知WEB更新产量
|
||||
SendActuallyCount(opName, 0);
|
||||
}
|
||||
/// <summary>
|
||||
/// 发送在线产量、在线节拍
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
static void SendActuallyCount(string OpName, int tagValue)
|
||||
{
|
||||
//当工件离开时,更新在线产量、在线节拍
|
||||
if (tagValue == 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
int opNameCount = 0;//在线产量
|
||||
int opNameCountTime = 0;//在线节拍
|
||||
//基本数据_工作日历_班次产量查询_New
|
||||
OpNameCount_New(OpName, out opNameCount, out opNameCountTime);
|
||||
|
||||
string SendMessage;
|
||||
SendMessage = "MES|ActuallyCount|" + OpName + "|" + opNameCount.ToString() + "&" + opNameCountTime.ToString();
|
||||
|
||||
MIS_BASE.asyncSendMessage(SendMessage);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function01:SendActuallyCount");
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 基本数据_工作日历_班次产量查询_New
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="opNameCount">在线产量</param>
|
||||
/// <param name="opNameCountTime">在线节拍</param>
|
||||
static public void OpNameCount_New(string opName, out int opNameCount, out int opNameCountTime)
|
||||
{
|
||||
opNameCount = 0;
|
||||
opNameCountTime = 0;
|
||||
string procedureName;
|
||||
procedureName = "基本数据_工作日历_班次产量查询_New";
|
||||
SqlParameter[] thisParms = new SqlParameter[3];
|
||||
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
|
||||
thisParms[1] = new System.Data.SqlClient.SqlParameter("@在线产量", 0);
|
||||
thisParms[1].Direction = ParameterDirection.Output;
|
||||
thisParms[2] = new System.Data.SqlClient.SqlParameter("@在线节拍", 0);
|
||||
thisParms[2].Direction = ParameterDirection.Output;
|
||||
if (DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms))
|
||||
{
|
||||
opNameCount = Convert.ToInt32(thisParms[1].Value);
|
||||
opNameCountTime = Convert.ToInt32(thisParms[2].Value);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 测量数据发动机在线状态_增加数据_自动工位
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="EngineID"></param>
|
||||
/// <param name="Pallet"></param>
|
||||
/// <param name="arrivedTime"></param>
|
||||
/// <param name="leavedTime"></param>
|
||||
/// <param name="TimeDiff"></param>
|
||||
/// <param name="Target"></param>
|
||||
/// <param name="lineType"></param>
|
||||
/// <param name="isPass"></param>
|
||||
/// <param name="OpNameUpDownType"></param>
|
||||
static public void WorkStartInsert_AutoWorkStation(string opName, string EngineID, int Pallet, DateTime arrivedTime, DateTime leavedTime, int TimeDiff, int Target, string lineType, string isPass, int OpNameUpDownType)
|
||||
{
|
||||
string procedureName;
|
||||
procedureName = "测量数据发动机在线状态_增加数据_自动工位";
|
||||
SqlParameter[] thisParms = new SqlParameter[10];
|
||||
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
|
||||
thisParms[1] = new System.Data.SqlClient.SqlParameter("@发动机号", EngineID);
|
||||
thisParms[2] = new System.Data.SqlClient.SqlParameter("@托盘编号", Pallet);
|
||||
thisParms[3] = new System.Data.SqlClient.SqlParameter("@到达时间", arrivedTime);
|
||||
thisParms[4] = new System.Data.SqlClient.SqlParameter("@离开时间", leavedTime);
|
||||
thisParms[5] = new System.Data.SqlClient.SqlParameter("@在线时间", TimeDiff);
|
||||
thisParms[6] = new System.Data.SqlClient.SqlParameter("@目标时间", Target);
|
||||
thisParms[7] = new System.Data.SqlClient.SqlParameter("@线体类型", lineType);
|
||||
thisParms[8] = new System.Data.SqlClient.SqlParameter("@是否合格", isPass);
|
||||
thisParms[9] = new System.Data.SqlClient.SqlParameter("@工位上下线类型", OpNameUpDownType);
|
||||
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
|
||||
}
|
||||
|
||||
static public void WorkStartInsert_V2022(string opName, DateTime arrivedTime, DateTime leavedTime, int TimeDiff, string isPass)
|
||||
{
|
||||
string procedureName;
|
||||
procedureName = "测量数据发动机在线状态_增加数据_V2022";
|
||||
SqlParameter[] thisParms = new SqlParameter[5];
|
||||
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
|
||||
thisParms[1] = new System.Data.SqlClient.SqlParameter("@到达时间", arrivedTime);
|
||||
thisParms[2] = new System.Data.SqlClient.SqlParameter("@离开时间", leavedTime);
|
||||
thisParms[3] = new System.Data.SqlClient.SqlParameter("@在线时间", TimeDiff);
|
||||
thisParms[4] = new System.Data.SqlClient.SqlParameter("@是否合格", isPass);
|
||||
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
|
||||
}
|
||||
|
||||
static public void WorkStartInsert(string opName, DateTime arrivedTime, DateTime leavedTime, int TimeDiff, int Target, string lineType, string isPass, int OpNameUpDownType)
|
||||
{
|
||||
string procedureName;
|
||||
procedureName = "测量数据发动机在线状态_增加数据";
|
||||
SqlParameter[] thisParms = new SqlParameter[8];
|
||||
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
|
||||
thisParms[1] = new System.Data.SqlClient.SqlParameter("@到达时间", arrivedTime);
|
||||
thisParms[2] = new System.Data.SqlClient.SqlParameter("@离开时间", leavedTime);
|
||||
thisParms[3] = new System.Data.SqlClient.SqlParameter("@在线时间", TimeDiff);
|
||||
thisParms[4] = new System.Data.SqlClient.SqlParameter("@目标时间", Target);
|
||||
thisParms[5] = new System.Data.SqlClient.SqlParameter("@线体类型", lineType);
|
||||
thisParms[6] = new System.Data.SqlClient.SqlParameter("@是否合格", isPass);
|
||||
thisParms[7] = new System.Data.SqlClient.SqlParameter("@工位上下线类型", OpNameUpDownType);
|
||||
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
|
||||
}
|
||||
}
|
||||
}
|
||||
152
MisDataSaveDate/MisDataSaveDate/Funtion.cs
Normal file
152
MisDataSaveDate/MisDataSaveDate/Funtion.cs
Normal file
@@ -0,0 +1,152 @@
|
||||
using bizFacade;
|
||||
using DoWhatPlc;
|
||||
using MesServerWork;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MisDataSaveDate
|
||||
{
|
||||
public partial class Funtion
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 发动机类型转换表
|
||||
/// SELECT ID,发动机机型代码 FROM MES_计划BOM_发动机型号代码
|
||||
/// </summary>
|
||||
public static Hashtable hashtable_EngineTypeID=new Hashtable ();
|
||||
/// <summary>
|
||||
/// 记录工件到位的发动机机型代码
|
||||
/// </summary>
|
||||
public static Hashtable hashtable_EngineGetOver_EngineTypeID = new Hashtable();
|
||||
/// <summary>
|
||||
/// 记录工件到位的发动机机型
|
||||
/// </summary>
|
||||
public static Hashtable hashtable_EngineGetOver_EngineType = new Hashtable();
|
||||
/// <summary>
|
||||
/// 记录工件到位的发动机号
|
||||
/// </summary>
|
||||
public static Hashtable hashtable_EngineGetOver_EngineID = new Hashtable();
|
||||
/// <summary>
|
||||
/// 记录工件到位的订单号
|
||||
/// </summary>
|
||||
public static Hashtable hashtable_EngineGetOver_OrderForm = new Hashtable();
|
||||
|
||||
public static Hashtable hashtable_EngineGetOver = new Hashtable();
|
||||
|
||||
public static Hashtable hashtable_PartPalletCode = new Hashtable();
|
||||
|
||||
public static void MIS_Funtion(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
string recData = e.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();
|
||||
|
||||
DoWhatPlc.ReturnValueString rv = Newtonsoft.Json.JsonConvert.DeserializeObject<DoWhatPlc.ReturnValueString>(m_Value);
|
||||
//Console.WriteLine($"【【{rv.TagID}【【【【{ rv.TagKeepTime}");
|
||||
|
||||
int tagType;
|
||||
string opName;
|
||||
string tagValue;
|
||||
int tagid;
|
||||
DoWhatPlc.ReturnValueString msgEvent = rv;
|
||||
if (msgEvent.TagValue == null) return;
|
||||
tagType = Convert.ToInt32(msgEvent.TagTypeID);
|
||||
opName = msgEvent.OpName.ToString();
|
||||
tagid = Convert.ToInt32(msgEvent.TagID);
|
||||
|
||||
|
||||
|
||||
switch (Convert.ToInt32(msgEvent.TagTypeCodeID))
|
||||
{
|
||||
case 11:
|
||||
switch (msgEvent.TagValue.ToLower())
|
||||
{
|
||||
case "1":
|
||||
case "true":
|
||||
tagValue = "1";
|
||||
break;
|
||||
default:
|
||||
tagValue = "0";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
tagValue = msgEvent.TagValue.ToString();
|
||||
break;
|
||||
}
|
||||
///根据信号处理逻辑
|
||||
switch (tagType)
|
||||
{
|
||||
case 19:
|
||||
//允许保存
|
||||
MesRead(opName, tagValue, tagid);
|
||||
break;
|
||||
case 14:
|
||||
//心跳
|
||||
//Heartbeat(opName, tagValue);
|
||||
break;
|
||||
case 44://PLC传递机型过后 才允许保存过站信息,否则不允许保存
|
||||
EngTypeGetOver(opName, tagValue);
|
||||
break;
|
||||
case 2://工件到位 离开信息
|
||||
|
||||
if (tagValue == "0")
|
||||
{
|
||||
//传递机型
|
||||
if (hashtable_EngineGetOver.Contains(opName))
|
||||
{
|
||||
if (hashtable_EngineGetOver[opName].ToString() == "1")
|
||||
{
|
||||
WorkStart(rv);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 51:
|
||||
//if (hashtableOpName_IsHaveComputer[opName].ToString() == "1")
|
||||
//{
|
||||
// SaveProductLeaveData(opName, 1);
|
||||
//}
|
||||
|
||||
break;
|
||||
case 8:
|
||||
//if (hashtableOpName_IsHaveComputer[opName].ToString() == "1")
|
||||
//{
|
||||
// SaveProductLeaveData(opName, 2);
|
||||
//}
|
||||
break;
|
||||
case 103:
|
||||
|
||||
Alarm_Insert(rv);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, err.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
159
MisDataSaveDate/MisDataSaveDate/MisDataSaveDate.csproj
Normal file
159
MisDataSaveDate/MisDataSaveDate/MisDataSaveDate.csproj
Normal file
@@ -0,0 +1,159 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" 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>{9AEDE061-8490-436A-B38B-9495DC908F19}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>MisDataSaveDate</RootNamespace>
|
||||
<AssemblyName>MisDataSaveDate</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</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>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="MQTTnet, Version=3.0.13.0, Culture=neutral, PublicKeyToken=b69712f52770c0a7, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\Common\dll\MQTTnet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MQTTnet.Extensions.ManagedClient, Version=3.0.13.0, Culture=neutral, PublicKeyToken=b69712f52770c0a7, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\Common\dll\MQTTnet.Extensions.ManagedClient.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Net.Security, Version=4.0.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Net.Security.4.3.2\lib\net46\System.Net.Security.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.WebSockets, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Net.WebSockets.4.3.0\lib\net46\System.Net.WebSockets.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.WebSockets.Client, Version=4.0.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Net.WebSockets.Client.4.3.2\lib\net46\System.Net.WebSockets.Client.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Funtion .Mqtt.cs" />
|
||||
<Compile Include="Funtion.EngTypeGetOver.cs" />
|
||||
<Compile Include="Funtion.WorkStart.cs" />
|
||||
<Compile Include="Funtion.Alarm.cs" />
|
||||
<Compile Include="Funtion.MesRead.cs" />
|
||||
<Compile Include="Funtion.cs" />
|
||||
<Compile Include="SaveData.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SaveData.Designer.cs">
|
||||
<DependentUpon>SaveData.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<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>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="SaveData.resx">
|
||||
<DependentUpon>SaveData.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<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>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Common\00-1Json8.3\Json8.3\00-0Json8.3.1.csproj">
|
||||
<Project>{1a10fdb2-1a6a-44a8-ab4d-33387563247e}</Project>
|
||||
<Name>00-0Json8.3.1</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Common\00MesWorkMqtt\MesWorkMqtt\00MesWorkMqtt.csproj">
|
||||
<Project>{f55da1a0-a982-4479-8c47-0d9a5aaf3e18}</Project>
|
||||
<Name>00MesWorkMqtt</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Common\01DoWhatPlc\01_01DoWhatPlc.csproj">
|
||||
<Project>{0d1af432-439a-4920-8692-43ae139f5530}</Project>
|
||||
<Name>01_01DoWhatPlc</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Common\02WebApiCall\02_02WebApiCallPLC.csproj">
|
||||
<Project>{3e6d1dd5-01c9-435f-9941-61f906ce35bb}</Project>
|
||||
<Name>02_02WebApiCallPLC</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Common\04DataBaseAccess\DataBaseAccess\04-DataBaseAccess.csproj">
|
||||
<Project>{f434e066-4c59-47c8-aa82-6f48cc84501a}</Project>
|
||||
<Name>04-DataBaseAccess</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Common\07WebBusinessFacade\BusinessFacade\07BusinessFacade.csproj">
|
||||
<Project>{f0a0c525-03fd-428a-9b17-7f54aa0e4475}</Project>
|
||||
<Name>07BusinessFacade</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Common\09MesDataFunction\MesDataFunction\09-MesDataFunction.csproj">
|
||||
<Project>{90e76fb4-646d-45e2-95db-0b8ab4e465d6}</Project>
|
||||
<Name>09-MesDataFunction</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\NETStandard.Library.2.0.0\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('..\packages\NETStandard.Library.2.0.0\build\netstandard2.0\NETStandard.Library.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\NETStandard.Library.2.0.0\build\netstandard2.0\NETStandard.Library.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NETStandard.Library.2.0.0\build\netstandard2.0\NETStandard.Library.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
22
MisDataSaveDate/MisDataSaveDate/Program.cs
Normal file
22
MisDataSaveDate/MisDataSaveDate/Program.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MisDataSaveDate
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// 应用程序的主入口点。
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new SaveData());
|
||||
}
|
||||
}
|
||||
}
|
||||
36
MisDataSaveDate/MisDataSaveDate/Properties/AssemblyInfo.cs
Normal file
36
MisDataSaveDate/MisDataSaveDate/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("MisDataSaveDate")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("MisDataSaveDate")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2022")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 会使此程序集中的类型
|
||||
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
|
||||
//请将此类型的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("9aede061-8490-436a-b38b-9495dc908f19")]
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||
//通过使用 "*",如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
70
MisDataSaveDate/MisDataSaveDate/Properties/Resources.Designer.cs
generated
Normal file
70
MisDataSaveDate/MisDataSaveDate/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,70 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本: 4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace MisDataSaveDate.Properties
|
||||
{
|
||||
/// <summary>
|
||||
/// 强类型资源类,用于查找本地化字符串等。
|
||||
/// </summary>
|
||||
// 此类是由 StronglyTypedResourceBuilder
|
||||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.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 ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MisDataSaveDate.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
MisDataSaveDate/MisDataSaveDate/Properties/Resources.resx
Normal file
117
MisDataSaveDate/MisDataSaveDate/Properties/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?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.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: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" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</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" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
29
MisDataSaveDate/MisDataSaveDate/Properties/Settings.Designer.cs
generated
Normal file
29
MisDataSaveDate/MisDataSaveDate/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,29 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace MisDataSaveDate.Properties
|
||||
{
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
49
MisDataSaveDate/MisDataSaveDate/SaveData.Designer.cs
generated
Normal file
49
MisDataSaveDate/MisDataSaveDate/SaveData.Designer.cs
generated
Normal file
@@ -0,0 +1,49 @@
|
||||
|
||||
namespace MisDataSaveDate
|
||||
{
|
||||
partial class SaveData
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows 窗体设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要修改
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// SaveData
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Name = "SaveData";
|
||||
this.Text = "Form1";
|
||||
this.Load += new System.EventHandler(this.SaveData_Load);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
69
MisDataSaveDate/MisDataSaveDate/SaveData.cs
Normal file
69
MisDataSaveDate/MisDataSaveDate/SaveData.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using MesWorkMqtt;
|
||||
using MisDataFunction;
|
||||
using MQTTnet;
|
||||
using MQTTnet.Client.Connecting;
|
||||
using MQTTnet.Client.Disconnecting;
|
||||
using MQTTnet.Client.Receiving;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MisDataSaveDate
|
||||
{
|
||||
public partial class SaveData : Form
|
||||
{
|
||||
public SaveData()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void SaveData_Load(object sender, EventArgs e)
|
||||
{
|
||||
//Task.Run(() => StartAsync());
|
||||
|
||||
Mqtt.StartAsync();
|
||||
Mqtt.mqttClient.ConnectedHandler = new MqttClientConnectedHandlerDelegate(OnSubscriberConnected);
|
||||
Mqtt.mqttClient.DisconnectedHandler = new MqttClientDisconnectedHandlerDelegate(OnSubscriberDisconnected);
|
||||
Mqtt.mqttClient.ApplicationMessageReceivedHandler = new MqttApplicationMessageReceivedHandlerDelegate(OnSubscriberMessageReceived);
|
||||
|
||||
string url;
|
||||
string topic;
|
||||
url = ConfigurationManager.AppSettings["MqttUrl"];
|
||||
topic = ConfigurationManager.AppSettings["MqttTargetTopicTagTypeCodeID"];
|
||||
new InitMqtt2(url, topic);
|
||||
|
||||
|
||||
MesServerWork.MIS_BASE.InitHashtable_MesServerCode();
|
||||
|
||||
|
||||
}
|
||||
private void OnSubscriberConnected(MqttClientConnectedEventArgs x)
|
||||
{
|
||||
var rec = x.AuthenticateResult.ResultCode.ToString();
|
||||
//label_State.Text = rec;
|
||||
}
|
||||
|
||||
private void OnSubscriberDisconnected(MqttClientDisconnectedEventArgs x)
|
||||
{
|
||||
//var rec = x.AuthenticateResult.ResultCode.ToString();
|
||||
//label_State.Text = rec;
|
||||
}
|
||||
|
||||
private void OnSubscriberMessageReceived(MqttApplicationMessageReceivedEventArgs x)
|
||||
{
|
||||
var rec = x.ApplicationMessage.ConvertPayloadToString();
|
||||
ThreadPool.QueueUserWorkItem(MisDataSaveDate.Funtion.MIS_Funtion, rec);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
120
MisDataSaveDate/MisDataSaveDate/SaveData.resx
Normal file
120
MisDataSaveDate/MisDataSaveDate/SaveData.resx
Normal 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>
|
||||
15
MisDataSaveDate/MisDataSaveDate/packages.config
Normal file
15
MisDataSaveDate/MisDataSaveDate/packages.config
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net461" />
|
||||
<package id="MQTTnet" version="3.0.13" targetFramework="net461" />
|
||||
<package id="MQTTnet.Extensions.ManagedClient" version="3.0.13" targetFramework="net461" />
|
||||
<package id="NETStandard.Library" version="2.0.0" targetFramework="net461" />
|
||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net461" />
|
||||
<package id="System.Net.Security" version="4.3.2" targetFramework="net461" />
|
||||
<package id="System.Net.WebSockets" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Net.WebSockets.Client" version="4.3.2" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net461" />
|
||||
</packages>
|
||||
BIN
MisDataSaveDate/dll/00MesWorkMqtt.dll
Normal file
BIN
MisDataSaveDate/dll/00MesWorkMqtt.dll
Normal file
Binary file not shown.
BIN
MisDataSaveDate/dll/00MesWorkMqtt.pdb
Normal file
BIN
MisDataSaveDate/dll/00MesWorkMqtt.pdb
Normal file
Binary file not shown.
BIN
MisDataSaveDate/dll/01DoWhatPlc.dll
Normal file
BIN
MisDataSaveDate/dll/01DoWhatPlc.dll
Normal file
Binary file not shown.
BIN
MisDataSaveDate/dll/01DoWhatPlc.pdb
Normal file
BIN
MisDataSaveDate/dll/01DoWhatPlc.pdb
Normal file
Binary file not shown.
BIN
MisDataSaveDate/dll/02WebApiCall.dll
Normal file
BIN
MisDataSaveDate/dll/02WebApiCall.dll
Normal file
Binary file not shown.
11
MisDataSaveDate/dll/02WebApiCall.dll.config
Normal file
11
MisDataSaveDate/dll/02WebApiCall.dll.config
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
|
||||
</startup>
|
||||
<appSettings>
|
||||
|
||||
<add key="Url_WebApi" value="http://localhost:41181"/>
|
||||
|
||||
</appSettings>
|
||||
</configuration>
|
||||
BIN
MisDataSaveDate/dll/02WebApiCall.pdb
Normal file
BIN
MisDataSaveDate/dll/02WebApiCall.pdb
Normal file
Binary file not shown.
BIN
MisDataSaveDate/dll/04DataBaseAccess.dll
Normal file
BIN
MisDataSaveDate/dll/04DataBaseAccess.dll
Normal file
Binary file not shown.
BIN
MisDataSaveDate/dll/04DataBaseAccess.pdb
Normal file
BIN
MisDataSaveDate/dll/04DataBaseAccess.pdb
Normal file
Binary file not shown.
BIN
MisDataSaveDate/dll/07BusinessFacade.dll
Normal file
BIN
MisDataSaveDate/dll/07BusinessFacade.dll
Normal file
Binary file not shown.
BIN
MisDataSaveDate/dll/07BusinessFacade.pdb
Normal file
BIN
MisDataSaveDate/dll/07BusinessFacade.pdb
Normal file
Binary file not shown.
BIN
MisDataSaveDate/dll/08WebFun_base.dll
Normal file
BIN
MisDataSaveDate/dll/08WebFun_base.dll
Normal file
Binary file not shown.
BIN
MisDataSaveDate/dll/08WebFun_base.pdb
Normal file
BIN
MisDataSaveDate/dll/08WebFun_base.pdb
Normal file
Binary file not shown.
BIN
MisDataSaveDate/dll/09MesDataFunction.dll
Normal file
BIN
MisDataSaveDate/dll/09MesDataFunction.dll
Normal file
Binary file not shown.
BIN
MisDataSaveDate/dll/09MesDataFunction.pdb
Normal file
BIN
MisDataSaveDate/dll/09MesDataFunction.pdb
Normal file
Binary file not shown.
BIN
MisDataSaveDate/dll/BusinessFacade.pdb
Normal file
BIN
MisDataSaveDate/dll/BusinessFacade.pdb
Normal file
Binary file not shown.
BIN
MisDataSaveDate/dll/MQTTnet.Extensions.ManagedClient.dll
Normal file
BIN
MisDataSaveDate/dll/MQTTnet.Extensions.ManagedClient.dll
Normal file
Binary file not shown.
BIN
MisDataSaveDate/dll/MQTTnet.dll
Normal file
BIN
MisDataSaveDate/dll/MQTTnet.dll
Normal file
Binary file not shown.
BIN
MisDataSaveDate/dll/Newtonsoft.Json.dll
Normal file
BIN
MisDataSaveDate/dll/Newtonsoft.Json.dll
Normal file
Binary file not shown.
Reference in New Issue
Block a user