init: 导入项目到 meswork Gitea
This commit is contained in:
64
MisDataFun/SendMessageToWebMqtt/12SendMessageToWeb.csproj
Normal file
64
MisDataFun/SendMessageToWebMqtt/12SendMessageToWeb.csproj
Normal file
@@ -0,0 +1,64 @@
|
||||
<?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>{E4EB6420-906D-4672-947A-CA33DDCDADFC}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SendMessageToWebMqtt</RootNamespace>
|
||||
<AssemblyName>SendMessageToWebMqtt</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<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' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="SendMessage.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Common\00MesWorkMqtt\MesWorkMqtt\00MesWorkMqtt.csproj">
|
||||
<Project>{f55da1a0-a982-4479-8c47-0d9a5aaf3e18}</Project>
|
||||
<Name>00MesWorkMqtt</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>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
36
MisDataFun/SendMessageToWebMqtt/Properties/AssemblyInfo.cs
Normal file
36
MisDataFun/SendMessageToWebMqtt/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("SendMessageToWebMqtt")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("SendMessageToWebMqtt")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2023")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 会使此程序集中的类型
|
||||
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
|
||||
//请将此类型的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("e4eb6420-906d-4672-947a-ca33ddcdadfc")]
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||
//通过使用 "*",如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
412
MisDataFun/SendMessageToWebMqtt/SendMessage.cs
Normal file
412
MisDataFun/SendMessageToWebMqtt/SendMessage.cs
Normal file
@@ -0,0 +1,412 @@
|
||||
using bizFacade;
|
||||
using MesWorkMqtt;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
/// <summary>
|
||||
/// 命令
|
||||
///显示托盘信息√ case "ShowMoby":
|
||||
///显示操作指南√ case "ProcessList":
|
||||
///显示物料√ case "MaterialList":
|
||||
///显示操作图片√ case "PicShow":
|
||||
///显示拧紧位置√ case "ShaftPosition":
|
||||
///实时显示质量数据√ case "ShowTimelyQuality":
|
||||
///手动拧紧实时显示质量数据√case "ShowTimelyQuality_Tight":
|
||||
///√ case "OrderFormList":
|
||||
///弹窗消息√ case "Notice":
|
||||
///LED消息提醒√ case "ScrollNotice":
|
||||
///物料检测初始化√ case "MaterialCheckPosition":
|
||||
///返修质量数据显示√ case "RepairQuality"
|
||||
///
|
||||
/// </summary>
|
||||
public class SendMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// MES/InstantMessaging/BQ
|
||||
/// </summary>
|
||||
public static string MqttTargetTopic = ConfigurationManager.AppSettings["MqttTargetTopic"];
|
||||
/// <summary>
|
||||
/// WEB/InstantMessaging/BQ/MisServer
|
||||
/// </summary>
|
||||
public static string MqttTargetTopicWEB = ConfigurationManager.AppSettings["MqttTargetTopicWEB"];
|
||||
/// <summary>
|
||||
/// BAR/InstantMessaging/BQ
|
||||
/// </summary>
|
||||
public static string MqttTargetTopicBAR = ConfigurationManager.AppSettings["MqttTargetTopicBAR"];
|
||||
|
||||
public static void SendMessageBARToMES(string opName, string msgText)
|
||||
{
|
||||
var topic = $"{MqttTargetTopicBAR}";
|
||||
|
||||
if (msgText.Length > 0)
|
||||
{
|
||||
Task.Run(() => Mqtt.Publish(topic, msgText));
|
||||
}
|
||||
SendMessageMESToWEB(opName, msgText);
|
||||
}
|
||||
public static void SendMessageMESToWEB(string opName, string msgText)
|
||||
{
|
||||
var topic = $"{MqttTargetTopic}/{opName}";
|
||||
|
||||
if (msgText.Length > 0)
|
||||
{
|
||||
Task.Run(() => Mqtt.Publish(topic, msgText));
|
||||
}
|
||||
}
|
||||
public static void SendMessageWEBToMES(string msgText)
|
||||
{
|
||||
var topic = $"{MqttTargetTopicWEB}";
|
||||
|
||||
if (msgText.Length > 0)
|
||||
{
|
||||
Task.Run(() => Mqtt.Publish(topic, msgText));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 5 显示订单、机型信息
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
public static void ShowMoby(string opName)
|
||||
{
|
||||
var topic = $"{MqttTargetTopic}/{opName}";
|
||||
var responseStr = ShowMoby_String(opName);
|
||||
string cmd = "ShowMoby";
|
||||
if (responseStr.Length > 0)
|
||||
{
|
||||
Task.Run(() => Mqtt.Publish(topic, $"MES|{cmd}_Resources|{opName}|{responseStr}"));
|
||||
}
|
||||
}
|
||||
public static void MaterialList_Dif(string opName,string msgText)
|
||||
{
|
||||
var topic = $"{MqttTargetTopic}/{opName}";
|
||||
string cmd = "MaterialList_Dif";
|
||||
if (msgText.Length > 0)
|
||||
{
|
||||
Task.Run(() => Mqtt.Publish(topic, $"MES|{cmd}_Resources|{opName}|{msgText}"));
|
||||
}
|
||||
}
|
||||
public static void AsyncSendMessage_Notice(string opname, string notice)
|
||||
{
|
||||
//通知Web界面
|
||||
BaseDataSystemMES.Web_Notice_Insert(opname, notice);
|
||||
Notice(opname);
|
||||
}
|
||||
public static void Notice(string opName)
|
||||
{
|
||||
var topic = $"{MqttTargetTopic}/{opName}";
|
||||
var responseStr = Notice_String(opName);
|
||||
string cmd = "Notice";
|
||||
if (responseStr.Length > 0)
|
||||
{
|
||||
Task.Run(() => Mqtt.Publish(topic, $"MES|{cmd}_Resources|{opName}|{responseStr}"));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 1(直接在界面通过选择机型确认工序内容)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
public static void ProcessList(string opName)
|
||||
{
|
||||
var topic = $"{MqttTargetTopic}/{opName}";
|
||||
var responseStr = ProcessList_String(opName);
|
||||
string cmd = "ProcessList";
|
||||
if (responseStr.Length > 0)
|
||||
{
|
||||
Task.Run(() => Mqtt.Publish(topic, $"MES|{cmd}_Resources|{opName}|{responseStr}"));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 2显示物料
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
public static void MaterialList(string opName)
|
||||
{
|
||||
var topic = $"{MqttTargetTopic}/{opName}";
|
||||
var responseStr = MaterialList_String(opName);
|
||||
string cmd = "MaterialList";
|
||||
if (responseStr.Length > 0)
|
||||
{
|
||||
Task.Run(() => Mqtt.Publish(topic, $"MES|{cmd}_Resources|{opName}|{responseStr}"));
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 3显示操作指导图片
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
public static void PicShow(string opName)
|
||||
{
|
||||
var topic = $"{MqttTargetTopic}/{opName}";
|
||||
var responseStr = PicShow_String(opName);
|
||||
string cmd = "PicShow";
|
||||
if (responseStr.Length > 0)
|
||||
{
|
||||
Task.Run(() => Mqtt.Publish(topic, $"MES|{cmd}_Resources|{opName}|{responseStr}"));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 4订单完工模块刷新完成数量
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
public static void OrderFormList(string opName)
|
||||
{
|
||||
var topic = $"{MqttTargetTopic}/{opName}";
|
||||
var responseStr = OrderFormList_String();
|
||||
string cmd = "OrderFormList";
|
||||
if (responseStr.Length > 0)
|
||||
{
|
||||
Task.Run(() => Mqtt.Publish(topic, $"MES|{cmd}_Resources|{opName}|{responseStr}"));
|
||||
}
|
||||
}
|
||||
|
||||
//实时显示质量数据√
|
||||
public static void ShowTimelyQuality(string opName)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static void SendActuallyCount(string OpName, int tagValue)
|
||||
{
|
||||
//当工件离开时,更新在线产量、在线节拍
|
||||
if (tagValue == 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
int opNameCount = 0;//在线产量
|
||||
int opNameCountTime = 0;//在线节拍
|
||||
|
||||
BaseDataSystemMES.OpNameCount_New(OpName, out opNameCount, out opNameCountTime); //基本数据_工作日历_班次产量查询_New
|
||||
|
||||
SendInfomation("ActuallyCount", opNameCount.ToString() + "&" + opNameCountTime.ToString(), OpName);
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function01:SendActuallyCount");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void SendInfomation(string Command, string Value, string OpName)
|
||||
{
|
||||
|
||||
string SendMessage = "MES|" + Command + "|" + OpName + "|" + Value;
|
||||
AsyncSendMessage(SendMessage);
|
||||
}
|
||||
|
||||
private static void AsyncSendMessage(string Message)
|
||||
{
|
||||
//lock (locker)
|
||||
{
|
||||
//"MES|MachinePlan|OpName|Value
|
||||
var array = Message.Split('|');
|
||||
var cmd = array[1];
|
||||
var opName = array[2];
|
||||
var topic = $"{MqttTargetTopic}/{opName}";
|
||||
Task.Run(() => Mqtt.Publish(topic, Message));
|
||||
|
||||
}
|
||||
}
|
||||
private static string ProcessList_String(string OpName)
|
||||
{
|
||||
string jsonStr_Process = "";
|
||||
try
|
||||
{
|
||||
string orderNum = "";
|
||||
int EngineTypeID = 0;
|
||||
string EngineType = "";
|
||||
string EngineID = "";
|
||||
string PartPallet_Code = "";
|
||||
int IsrepairBarcode = 0;
|
||||
string repairBarcode = "";
|
||||
DataTable dt_Proccess;
|
||||
|
||||
MES1.Moby_Select(OpName, out orderNum, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out IsrepairBarcode, out repairBarcode);
|
||||
|
||||
MES.Process_Select(OpName, EngineTypeID, EngineType, out dt_Proccess);
|
||||
if (dt_Proccess != null)
|
||||
{
|
||||
if (dt_Proccess.Rows.Count > 0)
|
||||
{
|
||||
jsonStr_Process = JsonHelper.CreateJsonParameters(dt_Proccess);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "MesWebFun_baseFun:ProcessList");
|
||||
}
|
||||
return jsonStr_Process;
|
||||
}
|
||||
private static string PicShow_String(string OpName)
|
||||
{
|
||||
string data = "";
|
||||
try
|
||||
{
|
||||
string orderNum = "";
|
||||
int EngineTypeID = 0;
|
||||
string EngineType = "";
|
||||
string EngineID = "";
|
||||
string PartPallet_Code = "";
|
||||
int IsrepairBarcode = 0;
|
||||
string repairBarcode = "";
|
||||
byte[] imgBytesIn;
|
||||
MES1.Moby_Select(OpName, out orderNum, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out IsrepairBarcode, out repairBarcode);
|
||||
BaseDataSystemMES.GetImageFile(OpName, EngineTypeID.ToString(), out imgBytesIn);
|
||||
if (imgBytesIn == null)
|
||||
{
|
||||
return data;
|
||||
}
|
||||
data = Convert.ToBase64String(imgBytesIn);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "MesWebFun_baseFun:PictureShow");
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
private static string ShowMoby_String(string OpName)
|
||||
{
|
||||
string data = "";
|
||||
try
|
||||
{
|
||||
string orderNum = "";
|
||||
int EngineTypeID = 0;
|
||||
string EngineType = "";
|
||||
string EngineID = "";
|
||||
string PartPallet_Code = "";
|
||||
int IsrepairBarcode = 0;
|
||||
string repairBarcode = "";
|
||||
MES1.Moby_Select(OpName, out orderNum, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out IsrepairBarcode, out repairBarcode);
|
||||
data = orderNum + "&" + EngineTypeID + "&" + EngineType + "&" + EngineID + "&" + PartPallet_Code + "&" + IsrepairBarcode + "&" + repairBarcode;
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "MesWebFun_baseFun:MobySelect");
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
private static string MaterialList_String(string OpName)
|
||||
{
|
||||
string jsonStr_Materail = "";
|
||||
try
|
||||
{
|
||||
string orderNum = "";
|
||||
int EngineTypeID = 0;
|
||||
string EngineType = "";
|
||||
string EngineID = "";
|
||||
string PartPallet_Code = "";
|
||||
int IsrepairBarcode = 0;
|
||||
string repairBarcode = "";
|
||||
|
||||
MES1.Moby_Select(OpName, out orderNum, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out IsrepairBarcode, out repairBarcode);
|
||||
DataTable dt_Material;
|
||||
|
||||
MES.PartMaterialVerify_Select(OpName, EngineTypeID, EngineType, out dt_Material);
|
||||
if (dt_Material != null)
|
||||
{
|
||||
if (dt_Material.Rows.Count > 0)
|
||||
{
|
||||
jsonStr_Materail = JsonHelper.CreateJsonParameters(dt_Material);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "MesWebFun_baseFun:MaterialList");
|
||||
}
|
||||
return jsonStr_Materail;
|
||||
}
|
||||
|
||||
private static string ShowTimelyQuality_String(string OpName)
|
||||
{
|
||||
string text = "";
|
||||
try
|
||||
{
|
||||
string orderNum = "";
|
||||
int EngineTypeID = 0;
|
||||
string EngineType = "";
|
||||
string EngineID = "";
|
||||
string PartPallet_Code = "";
|
||||
int IsrepairBarcode = 0;
|
||||
string repairBarcode = "";
|
||||
DataTable dt;
|
||||
|
||||
MES1.Moby_Select(OpName, out orderNum, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out IsrepairBarcode, out repairBarcode);
|
||||
MES.QualitySelect(OpName, EngineID, out dt);
|
||||
if (dt != null)
|
||||
{
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
text = JsonHelper.CreateJsonParameters(dt);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "MesWebFun_baseFun:Quality_Select");
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
private static string OrderFormList_String()
|
||||
{
|
||||
string enginetypelist = "";
|
||||
try
|
||||
{
|
||||
System.Data.DataTable dt = null;
|
||||
ShaftPosition.EngineType_Select(out dt);
|
||||
if (dt != null)
|
||||
{
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
enginetypelist = JsonHelper.DataTableToJson(dt);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "MesWebFun_baseFun:Orderenginetypeselect");
|
||||
}
|
||||
return enginetypelist;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 消息提醒
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static string Notice_String(string opname)
|
||||
{
|
||||
string text = "";
|
||||
try
|
||||
{
|
||||
System.Data.DataTable dt = null;
|
||||
MES.ShowWindowNotice(opname, out dt);
|
||||
if (dt != null)
|
||||
{
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
text = JsonHelper.DataTableToJson(dt);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "MesWebFun_baseFun:ShowWindowNotice");
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user