|
@@ -1,12 +1,15 @@
|
|
-using Sunny.UI.Win32;
|
|
|
|
|
|
+using MainForm.ClassFile.XiaomiAPI;
|
|
|
|
+using Sunny.UI.Win32;
|
|
using System;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data;
|
|
|
|
+using System.Diagnostics;
|
|
using System.Drawing;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using System.Windows.Forms;
|
|
|
|
+using static MainForm.ClassFile.XiaomiAPI.XiaomiMqttClient_Extend;
|
|
|
|
|
|
namespace MainForm.FaForm
|
|
namespace MainForm.FaForm
|
|
{
|
|
{
|
|
@@ -284,6 +287,483 @@ namespace MainForm.FaForm
|
|
}
|
|
}
|
|
#endregion 出站相关
|
|
#endregion 出站相关
|
|
|
|
|
|
|
|
+ #region Iot手动上传 Tap
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 上传按钮_Iot
|
|
|
|
+ /// </summary>
|
|
|
|
+ private async void btnSend_Iot_Click(object sender, EventArgs e)
|
|
|
|
+ {
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ await Task.Run(() =>
|
|
|
|
+ {
|
|
|
|
+ string stationStr = cmbStationName_Iot.Text.Trim(); // 工站名称
|
|
|
|
+ string mesStation = "";
|
|
|
|
+ switch (stationStr)
|
|
|
|
+ {
|
|
|
|
+ //[S1]Tray盘上料装备
|
|
|
|
+ //[S2]FCT
|
|
|
|
+ //[S3]值板机
|
|
|
|
+ //[S4_1]载具下线装备
|
|
|
|
+ //[S4_5]载具上线装备
|
|
|
|
+ //[S5]Tray盘下料装备
|
|
|
|
+ case "[OP10]壳体清洁上料":
|
|
|
|
+ mesStation = GlobalContext.S1_station;
|
|
|
|
+ break;
|
|
|
|
+ case "[OP20]上盖板上料装备":
|
|
|
|
+ mesStation = GlobalContext.S2_station;
|
|
|
|
+ break;
|
|
|
|
+ case "[OP30]点散热胶装备_Left":
|
|
|
|
+ mesStation = GlobalContext.s3_1_station;
|
|
|
|
+ break;
|
|
|
|
+ case "[OP30]点散热胶装备_Right":
|
|
|
|
+ mesStation = GlobalContext.s3_2_station;
|
|
|
|
+ break;
|
|
|
|
+ case "[OP40]胶线检测":
|
|
|
|
+ mesStation = GlobalContext.s4_station;
|
|
|
|
+ break;
|
|
|
|
+ case "[OP50]ADD板上料组装装备":
|
|
|
|
+ mesStation = GlobalContext.s5_station;
|
|
|
|
+ break;
|
|
|
|
+ case "[OP60]组上盖板":
|
|
|
|
+ mesStation = GlobalContext.s6_station;
|
|
|
|
+ break;
|
|
|
|
+ case "[OP70]上盖板锁螺丝_Left":
|
|
|
|
+ mesStation = GlobalContext.s7_1_station;
|
|
|
|
+ break;
|
|
|
|
+ case "[OP70]上盖板锁螺丝_Right":
|
|
|
|
+ mesStation = GlobalContext.s7_2_station;
|
|
|
|
+ break;
|
|
|
|
+ case "[OP80]NG下料":
|
|
|
|
+ mesStation = GlobalContext.s8_station;
|
|
|
|
+ break;
|
|
|
|
+ case "[OP90]半成品下料":
|
|
|
|
+ mesStation = GlobalContext.s8_station;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ string iotSendType = cmbSendType_Iot.Text.Trim();
|
|
|
|
+ switch (iotSendType)
|
|
|
|
+ {
|
|
|
|
+ //设备状态
|
|
|
|
+ //故障日志
|
|
|
|
+ //节拍日志
|
|
|
|
+ //操作记录
|
|
|
|
+ case "设备状态":
|
|
|
|
+ (int, string) resultDeviceState = SendIotDeviceStateFun(mesStation);
|
|
|
|
+ ShowLog_Iot($"[{resultDeviceState.Item1}]" + resultDeviceState.Item2);
|
|
|
|
+ break;
|
|
|
|
+ case "故障日志":
|
|
|
|
+ (int, string) resultFaultLog = SendIotFaultLogFun(mesStation);
|
|
|
|
+ ShowLog_Iot($"[{resultFaultLog.Item1}]" + resultFaultLog.Item2);
|
|
|
|
+ break;
|
|
|
|
+ case "节拍日志":
|
|
|
|
+ (int, string) resultInputBegin = SendIotInputBeginFun(mesStation);
|
|
|
|
+ ShowLog_Iot($"[{resultInputBegin.Item1}]" + resultInputBegin.Item2);
|
|
|
|
+ break;
|
|
|
|
+ case "操作记录":
|
|
|
|
+ (int, string) resultOperateLog = SendIotOperateLogFun(mesStation);
|
|
|
|
+ ShowLog_Iot($"[{resultOperateLog.Item1}]" + resultOperateLog.Item2);
|
|
|
|
+ break;
|
|
|
|
+ case "过站数据":
|
|
|
|
+ (int, string) resultPassStation = SendIotPassStationFun(mesStation);
|
|
|
|
+ ShowLog_Iot($"[{resultPassStation.Item1}]" + resultPassStation.Item2);
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ catch (Exception ex)
|
|
|
|
+ {
|
|
|
|
+ string str = ex.StackTrace;
|
|
|
|
+ MessageBox.Show("进站异常!异常位置:" + str.Substring(str.LastIndexOf("\\") + 1, str.Length - str.LastIndexOf("\\") - 1) + ";异常信息:" + ex.Message.ToString());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 上传设备状态_Iot
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="mesStation">mes工站名称</param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ private (int, string) SendIotDeviceStateFun(string mesStation)
|
|
|
|
+ {
|
|
|
|
+ string xmDeviceState = cmbXiaomiDeviceState.Text.Trim(); // 设备状态
|
|
|
|
+ if (string.IsNullOrEmpty(xmDeviceState))
|
|
|
|
+ return (999, "‘状态类型’不可为空!");
|
|
|
|
+
|
|
|
|
+ DeviceStateDataRequest request = new DeviceStateDataRequest();
|
|
|
|
+ request.station = mesStation; // ⼯位
|
|
|
|
+ request.state = xmDeviceState; // 设备状态
|
|
|
|
+ request.time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); // 状态切换时的时间 2022-06-01 14:27:57.283
|
|
|
|
+ if (xmDeviceState == "Fault" || xmDeviceState == "Alarm")
|
|
|
|
+ {
|
|
|
|
+ string faultCode = txtFaultCode.Text.Trim();
|
|
|
|
+ if (string.IsNullOrEmpty(faultCode))
|
|
|
|
+ return (999, "‘故障编码’不可为空!");
|
|
|
|
+
|
|
|
|
+ request.fault_code = faultCode; // 对应的故障编码
|
|
|
|
+ request.fault_tm = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); // 故障发⽣时间
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 上传
|
|
|
|
+ (int, string) iotResult = XiaomiMqttClient_Extend.Write_DeviceStateData(request);
|
|
|
|
+ return iotResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 上传故障日志_Iot
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="mesStation">mes工站名称</param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ private (int, string) SendIotFaultLogFun(string mesStation)
|
|
|
|
+ {
|
|
|
|
+ string xmFaultName = txtFaultName.Text.Trim(); // 故障名称
|
|
|
|
+ string xmFaultCode2 = txtFaultCode2.Text.Trim(); // 故障编码
|
|
|
|
+ string xmFaultCmpnt = txtFaultCmpnt.Text.Trim(); // 故障部件
|
|
|
|
+ string xmFaultDesc = txtFaultDesc.Text.Trim(); // 故障描述
|
|
|
|
+ if (string.IsNullOrEmpty(xmFaultName))
|
|
|
|
+ return (999, "‘故障名称’不可为空!");
|
|
|
|
+ else if (string.IsNullOrEmpty(xmFaultCode2))
|
|
|
|
+ return (999, "‘故障编码’不可为空!");
|
|
|
|
+ else if (string.IsNullOrEmpty(xmFaultCmpnt))
|
|
|
|
+ return (999, "‘故障部件’不可为空!");
|
|
|
|
+ else if (string.IsNullOrEmpty(xmFaultDesc))
|
|
|
|
+ return (999, "‘故障描述’不可为空!");
|
|
|
|
+
|
|
|
|
+ FaultLogRequest request = new FaultLogRequest();
|
|
|
|
+ request.station = mesStation; // ⼯位
|
|
|
|
+ request.fault_name = xmFaultName; // 故障名称(同数据字典中的事件名称)
|
|
|
|
+ request.fault_code = xmFaultCode2; // 故障编码(A,B,C,D,E)
|
|
|
|
+ request.fault_cmpnt = xmFaultCmpnt; // 故障部件
|
|
|
|
+ request.fault_desc = xmFaultDesc; // 故障描述
|
|
|
|
+ request.fault_tm = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); // 故障发⽣时间 2022-06-01 14:27:57.283
|
|
|
|
+ // 上传
|
|
|
|
+ //(int, string) iotResult = XiaomiMqttClient_Extend.Write_FaultLog(request);
|
|
|
|
+ (int, string) iotResult = (0, "");
|
|
|
|
+ return iotResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 上传节拍日志_Iot
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="mesStation">mes工站名称</param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ private (int, string) SendIotInputBeginFun(string mesStation)
|
|
|
|
+ {
|
|
|
|
+ string action = cmbAction.Text.Trim(); // 节拍动作
|
|
|
|
+ string partSn = txtPartSn.Text.Trim(); // 物料SN
|
|
|
|
+ string vSn = txtVSn.Text.Trim(); // 载具SN
|
|
|
|
+ string vIndexSn = txtVIndexSn.Text.Trim(); // 载具穴位编号
|
|
|
|
+ string extra = txtExtra.Text.Trim(); // 额外信息
|
|
|
|
+ string class_level_1 = txtClassLevel1.Text.Trim(); // 分类层级1
|
|
|
|
+ string class_level_2 = txtClassLevel2.Text.Trim(); // 分类层级2
|
|
|
|
+ string class_level_3 = txtClassLevel3.Text.Trim(); // 分类层级3
|
|
|
|
+
|
|
|
|
+ if (string.IsNullOrEmpty(action))
|
|
|
|
+ return (999, "‘节拍动作’不可为空!");
|
|
|
|
+ else if (string.IsNullOrEmpty(partSn))
|
|
|
|
+ return (999, "‘物料SN’不可为空!");
|
|
|
|
+ else if (string.IsNullOrEmpty(vSn))
|
|
|
|
+ return (999, "‘载具SN’不可为空!");
|
|
|
|
+ else if (string.IsNullOrEmpty(vIndexSn))
|
|
|
|
+ return (999, "‘载具穴位编号’不可为空!");
|
|
|
|
+ else if (string.IsNullOrEmpty(class_level_1))
|
|
|
|
+ return (999, "‘分类层级1’不可为空!");
|
|
|
|
+ else if (string.IsNullOrEmpty(class_level_2))
|
|
|
|
+ return (999, "‘分类层级2’不可为空!");
|
|
|
|
+ else if (string.IsNullOrEmpty(class_level_3))
|
|
|
|
+ return (999, "‘分类层级3’不可为空!");
|
|
|
|
+
|
|
|
|
+ StationInputBeginRequest request = new StationInputBeginRequest();
|
|
|
|
+ switch (action)
|
|
|
|
+ {
|
|
|
|
+ /// 上料开始:beat_log/business/OEE/station_input_begin
|
|
|
|
+ /// 上料结束:beat_log/business/OEE/station_input_end
|
|
|
|
+ /// 作业开始:beat_log/business/OEE/station_work_begin
|
|
|
|
+ /// 作业结束:beat_log/business/OEE/station_work_end
|
|
|
|
+ /// 下料开始:beat_log/business/OEE/station_output_begin
|
|
|
|
+ /// 下料结束:beat_log/business/OEE/station_output_end
|
|
|
|
+ case "上料开始":
|
|
|
|
+ request.action = "beat_log/business/OEE/station_input_begin"; // 节拍动作(XiaomiDeviceOEE)
|
|
|
|
+ break;
|
|
|
|
+ case "上料结束":
|
|
|
|
+ request.action = "beat_log/business/OEE/station_input_end"; // 节拍动作(XiaomiDeviceOEE)
|
|
|
|
+ break;
|
|
|
|
+ case "作业开始":
|
|
|
|
+ request.action = "beat_log/business/OEE/station_work_begin"; // 节拍动作(XiaomiDeviceOEE)
|
|
|
|
+ break;
|
|
|
|
+ case "作业结束":
|
|
|
|
+ request.action = "beat_log/business/OEE/station_work_end"; // 节拍动作(XiaomiDeviceOEE)
|
|
|
|
+ break;
|
|
|
|
+ case "下料开始":
|
|
|
|
+ request.action = "beat_log/business/OEE/station_output_begin"; // 节拍动作(XiaomiDeviceOEE)
|
|
|
|
+ break;
|
|
|
|
+ case "下料结束":
|
|
|
|
+ request.action = "beat_log/business/OEE/station_output_end"; // 节拍动作(XiaomiDeviceOEE)
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ request.beat_tm = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); // 节拍发⽣时间(2022-06-01 14:27:57.283)
|
|
|
|
+ request.action_subject = partSn; // 该动作操作的⽬标对象(SN)
|
|
|
|
+ request.action_subject_parent = vSn; // ⼤板SN/载具SN
|
|
|
|
+ request.action_location = mesStation; // 该动作的位置信息(⼯位、槽位),如:F06-GSTPLA11_01-SLOT-01
|
|
|
|
+ request.action_material = vIndexSn; // 该动作的物料信息
|
|
|
|
+ request.extra = extra; // 额外信息
|
|
|
|
+ request.class_level_1 = class_level_1; // 分类层级1
|
|
|
|
+ request.class_level_2 = class_level_2; // 分类层级2
|
|
|
|
+ request.class_level_3 = class_level_3; // 分类层级3
|
|
|
|
+
|
|
|
|
+ // 上传
|
|
|
|
+ (int, string) iotResult = XiaomiMqttClient_Extend.Write_StationInputBegin(request);
|
|
|
|
+ return iotResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 上传操作记录⽇志_Iot
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="mesStation">mes工站名称</param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ private (int, string) SendIotOperateLogFun(string mesStation)
|
|
|
|
+ {
|
|
|
|
+ string operateAction = cmbOperateAction.Text.Trim(); // 操作动作
|
|
|
|
+ string actionParam = txtActionParam.Text.Trim(); // 动作参数
|
|
|
|
+ string operateDesc = txtOperateDesc.Text.Trim(); // 操作描述
|
|
|
|
+ string operateResult = cmbOperateResult.Text.Trim(); // 操作结果
|
|
|
|
+
|
|
|
|
+ if (string.IsNullOrEmpty(operateAction))
|
|
|
|
+ return (999, "‘操作动作’不可为空!");
|
|
|
|
+ else if (string.IsNullOrEmpty(operateDesc))
|
|
|
|
+ return (999, "‘操作描述’不可为空!");
|
|
|
|
+ else if (string.IsNullOrEmpty(operateResult))
|
|
|
|
+ return (999, "‘操作结果’不可为空!");
|
|
|
|
+
|
|
|
|
+ OperateLogRequest request = new OperateLogRequest();
|
|
|
|
+ request.software_version = "V" + Application.ProductVersion; // 软件版本号;如:V1.2.4
|
|
|
|
+ request.operate_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); // 操作时间(2022-06-01 14:27:57.283)
|
|
|
|
+ request.operate_action = operateAction; // 操作动作(对应软件开启/关闭/重新加载项⽬;startup、shutdown、reload)
|
|
|
|
+ request.action_param = actionParam; // 动作参数;选填,附带额外的信息
|
|
|
|
+ request.operate_module = "MES调试模块"; // 操作模块;选填
|
|
|
|
+ request.operate_page = "手动调试页面"; // 操作⻚⾯;选填
|
|
|
|
+ request.current_process = Process.GetCurrentProcess()?.Id.ToString(); // 当前进程;进程ID
|
|
|
|
+ request.operate_desc = operateDesc; // 操作描述;如:供应商软件开启/关闭/重新加载项⽬
|
|
|
|
+ request.operate_result = operateResult; // 操作结果
|
|
|
|
+ //request.operator_name = GlobalContext.currentRole; // 操作账号名;填当前操作⽤⼾,如⽆则填default
|
|
|
|
+
|
|
|
|
+ // 上传
|
|
|
|
+ //(int, string) iotResult = XiaomiMqttClient_Extend.Write_OperateLog(request);
|
|
|
|
+ (int, string) iotResult=(0,"");
|
|
|
|
+ return iotResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 上传过站数据_Iot
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="mesStation">mes工站名称</param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ private (int, string) SendIotPassStationFun(string mesStation)
|
|
|
|
+ {
|
|
|
|
+ string stationStr = cmbStationName_Iot.Text.Trim(); // 工站名
|
|
|
|
+
|
|
|
|
+ string slot = txtSlot.Text.Trim(); // 槽位编码
|
|
|
|
+ string sn = txtSn_PassStation.Text.Trim(); // 产品SN
|
|
|
|
+ string enter_status = cmbEnterStatus.Text.Trim(); // 进站状态
|
|
|
|
+ string result = cmbResult.Text.Trim(); // 过站结果
|
|
|
|
+ string work_type = cmbWorkType.Text.Trim(); // 作业类型
|
|
|
|
+ if (string.IsNullOrEmpty(slot))
|
|
|
|
+ return (999, "‘槽位编码’不可为空!");
|
|
|
|
+ else if (string.IsNullOrEmpty(sn))
|
|
|
|
+ return (999, "‘产品SN’不可为空!");
|
|
|
|
+ else if (string.IsNullOrEmpty(enter_status))
|
|
|
|
+ return (999, "‘进站状态’不可为空!");
|
|
|
|
+ else if (string.IsNullOrEmpty(result))
|
|
|
|
+ return (999, "‘过站结果’不可为空!");
|
|
|
|
+ else if (string.IsNullOrEmpty(work_type))
|
|
|
|
+ return (999, "‘作业类型’不可为空!");
|
|
|
|
+
|
|
|
|
+ PassStationResultRequest request = new PassStationResultRequest();
|
|
|
|
+ request.project_code = GlobalContext.Project_Code; // 项⽬编码
|
|
|
|
+ request.factory_code = GlobalContext.Factory_Code; // ⼯⼚Id
|
|
|
|
+ request.process_section_code = GlobalContext.Process_Section_Code; // ⼯段编码
|
|
|
|
+ request.line_code = GlobalContext.LineCode; // 线体编码
|
|
|
|
+ switch (stationStr)
|
|
|
|
+ {
|
|
|
|
+ case "[S1]Tray盘上料装备":
|
|
|
|
+ request.work_station = GlobalContext.S1_work_station; // ⼯站
|
|
|
|
+ request.device_code = GlobalContext.S1_device_code; // 装备编码
|
|
|
|
+ break;
|
|
|
|
+ case "[S2]FCT":
|
|
|
|
+ request.work_station = GlobalContext.S2_work_station; // ⼯站
|
|
|
|
+ request.device_code = GlobalContext.S2_device_code; // 装备编码
|
|
|
|
+ break;
|
|
|
|
+ //case "[S3]值板机":
|
|
|
|
+ // request.work_station = GlobalContext.S3_work_station; // ⼯站
|
|
|
|
+ // request.device_code = GlobalContext.S3_device_code; // 装备编码
|
|
|
|
+ // break;
|
|
|
|
+ //case "[S4_1]载具下线装备":
|
|
|
|
+ // request.work_station = GlobalContext.S4_1_work_station; // ⼯站
|
|
|
|
+ // request.device_code = GlobalContext.S4_1_device_code; // 装备编码
|
|
|
|
+ // break;
|
|
|
|
+ //case "[S4_3]提升机1":
|
|
|
|
+ // request.work_station = GlobalContext.S4_3_work_station; // ⼯站
|
|
|
|
+ // request.device_code = GlobalContext.S4_3_device_code; // 装备编码
|
|
|
|
+ // break;
|
|
|
|
+ //case "[S4_4]提升机2":
|
|
|
|
+ // request.work_station = GlobalContext.S4_4_work_station; // ⼯站
|
|
|
|
+ // request.device_code = GlobalContext.S4_4_device_code; // 装备编码
|
|
|
|
+ // break;
|
|
|
|
+ //case "[S4_5]载具上线装备":
|
|
|
|
+ // request.work_station = GlobalContext.S4_5_work_station; // ⼯站
|
|
|
|
+ // request.device_code = GlobalContext.S4_5_device_code; // 装备编码
|
|
|
|
+ // break;
|
|
|
|
+ //case "[S5]Tray盘下料装备":
|
|
|
|
+ // request.work_station = GlobalContext.S5_work_station; // ⼯站
|
|
|
|
+ // request.device_code = GlobalContext.S5_device_code; // 装备编码
|
|
|
|
+ // break;
|
|
|
|
+ }
|
|
|
|
+ request.station = mesStation;
|
|
|
|
+ request.process_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); // 节拍发⽣时间(2022-06-01 14:27:57.283)
|
|
|
|
+ request.slot = slot; // 槽位编码
|
|
|
|
+ request.sn = sn; // 产品SN
|
|
|
|
+ request.enter_status = enter_status; // 进站状态
|
|
|
|
+ request.result = result; // 过站结果
|
|
|
|
+ request.work_type = work_type; // 作业类型
|
|
|
|
+
|
|
|
|
+ // 上传过站结果
|
|
|
|
+ //(int, string) iotResult = XiaomiMqttClient_Extend.Write_PassStationResult(request);
|
|
|
|
+ (int, string) iotResult = (0, "");
|
|
|
|
+ return iotResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 显示信息
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="msg">信息</param>
|
|
|
|
+ public void ShowLog_Iot(string msg)
|
|
|
|
+ {
|
|
|
|
+ txtInfo.Invoke(new Action(() =>
|
|
|
|
+ {
|
|
|
|
+ txtInfo_Iot.Text = string.Concat("\r\n", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), "=> ", msg);
|
|
|
|
+ }));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 更改上传类型
|
|
|
|
+ private void cmbSendType_Iot_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
+ {
|
|
|
|
+ string iotSendType = cmbSendType_Iot.Text.Trim();
|
|
|
|
+ switch (iotSendType)
|
|
|
|
+ {
|
|
|
|
+ //设备状态
|
|
|
|
+ //故障日志
|
|
|
|
+ //节拍日志
|
|
|
|
+ //操作记录
|
|
|
|
+ case "设备状态":
|
|
|
|
+ pnlDeviceState.Enabled = true;
|
|
|
|
+ pnlFaultLog.Enabled = false;
|
|
|
|
+ pnlStationInputBegin.Enabled = false;
|
|
|
|
+ pnlOperateLog.Enabled = false;
|
|
|
|
+ pnlPassStation.Enabled = false;
|
|
|
|
+ pnlDeviceState5.Enabled = false;
|
|
|
|
+ pnlDeviceState6.Enabled = false;
|
|
|
|
+ pnlDeviceState7.Enabled = false;
|
|
|
|
+ pnlDeviceState8.Enabled = false;
|
|
|
|
+
|
|
|
|
+ pnlDeviceState.BackColor = Color.Yellow;
|
|
|
|
+ pnlFaultLog.BackColor = Color.Gray;
|
|
|
|
+ pnlStationInputBegin.BackColor = Color.Gray;
|
|
|
|
+ pnlOperateLog.BackColor = Color.Gray;
|
|
|
|
+ pnlPassStation.BackColor = Color.Gray;
|
|
|
|
+ pnlDeviceState5.BackColor = Color.Gray;
|
|
|
|
+ pnlDeviceState6.BackColor = Color.Gray;
|
|
|
|
+ pnlDeviceState7.BackColor = Color.Gray;
|
|
|
|
+ pnlDeviceState8.BackColor = Color.Gray;
|
|
|
|
+ break;
|
|
|
|
+ case "故障日志":
|
|
|
|
+ pnlDeviceState.Enabled = false;
|
|
|
|
+ pnlFaultLog.Enabled = true;
|
|
|
|
+ pnlStationInputBegin.Enabled = false;
|
|
|
|
+ pnlOperateLog.Enabled = false;
|
|
|
|
+ pnlPassStation.Enabled = false;
|
|
|
|
+ pnlDeviceState5.Enabled = false;
|
|
|
|
+ pnlDeviceState6.Enabled = false;
|
|
|
|
+ pnlDeviceState7.Enabled = false;
|
|
|
|
+ pnlDeviceState8.Enabled = false;
|
|
|
|
+
|
|
|
|
+ pnlDeviceState.BackColor = Color.Gray;
|
|
|
|
+ pnlFaultLog.BackColor = Color.Yellow;
|
|
|
|
+ pnlStationInputBegin.BackColor = Color.Gray;
|
|
|
|
+ pnlOperateLog.BackColor = Color.Gray;
|
|
|
|
+ pnlPassStation.BackColor = Color.Gray;
|
|
|
|
+ pnlDeviceState5.BackColor = Color.Gray;
|
|
|
|
+ pnlDeviceState6.BackColor = Color.Gray;
|
|
|
|
+ pnlDeviceState7.BackColor = Color.Gray;
|
|
|
|
+ pnlDeviceState8.BackColor = Color.Gray;
|
|
|
|
+ break;
|
|
|
|
+ case "节拍日志":
|
|
|
|
+ pnlDeviceState.Enabled = false;
|
|
|
|
+ pnlFaultLog.Enabled = false;
|
|
|
|
+ pnlStationInputBegin.Enabled = true;
|
|
|
|
+ pnlOperateLog.Enabled = false;
|
|
|
|
+ pnlPassStation.Enabled = false;
|
|
|
|
+ pnlDeviceState5.Enabled = false;
|
|
|
|
+ pnlDeviceState6.Enabled = false;
|
|
|
|
+ pnlDeviceState7.Enabled = false;
|
|
|
|
+ pnlDeviceState8.Enabled = false;
|
|
|
|
+
|
|
|
|
+ pnlDeviceState.BackColor = Color.Gray;
|
|
|
|
+ pnlFaultLog.BackColor = Color.Gray;
|
|
|
|
+ pnlStationInputBegin.BackColor = Color.Yellow;
|
|
|
|
+ pnlOperateLog.BackColor = Color.Gray;
|
|
|
|
+ pnlPassStation.BackColor = Color.Gray;
|
|
|
|
+ pnlDeviceState5.BackColor = Color.Gray;
|
|
|
|
+ pnlDeviceState6.BackColor = Color.Gray;
|
|
|
|
+ pnlDeviceState7.BackColor = Color.Gray;
|
|
|
|
+ pnlDeviceState8.BackColor = Color.Gray;
|
|
|
|
+ break;
|
|
|
|
+ case "操作记录":
|
|
|
|
+ pnlDeviceState.Enabled = false;
|
|
|
|
+ pnlFaultLog.Enabled = false;
|
|
|
|
+ pnlStationInputBegin.Enabled = false;
|
|
|
|
+ pnlOperateLog.Enabled = true;
|
|
|
|
+ pnlPassStation.Enabled = false;
|
|
|
|
+ pnlDeviceState5.Enabled = false;
|
|
|
|
+ pnlDeviceState6.Enabled = false;
|
|
|
|
+ pnlDeviceState7.Enabled = false;
|
|
|
|
+ pnlDeviceState8.Enabled = false;
|
|
|
|
+
|
|
|
|
+ pnlDeviceState.BackColor = Color.Gray;
|
|
|
|
+ pnlFaultLog.BackColor = Color.Gray;
|
|
|
|
+ pnlStationInputBegin.BackColor = Color.Gray;
|
|
|
|
+ pnlOperateLog.BackColor = Color.Yellow;
|
|
|
|
+ pnlPassStation.BackColor = Color.Gray;
|
|
|
|
+ pnlDeviceState5.BackColor = Color.Gray;
|
|
|
|
+ pnlDeviceState6.BackColor = Color.Gray;
|
|
|
|
+ pnlDeviceState7.BackColor = Color.Gray;
|
|
|
|
+ pnlDeviceState8.BackColor = Color.Gray;
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 更改状态类型
|
|
|
|
+ private void cmbXiaomiDeviceState_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
+ {
|
|
|
|
+ string xmDeviceState = cmbXiaomiDeviceState.Text.Trim();
|
|
|
|
+ if (xmDeviceState == "Fault" || xmDeviceState == "Alarm")
|
|
|
|
+ {
|
|
|
|
+ label23.Enabled = true;
|
|
|
|
+ label24.Enabled = true;
|
|
|
|
+ txtFaultCode.Enabled = true;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ label23.Enabled = false;
|
|
|
|
+ label24.Enabled = false;
|
|
|
|
+ txtFaultCode.Enabled = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ #endregion Iot手动上传 Tap
|
|
|
|
+
|
|
#region 其他方法
|
|
#region 其他方法
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 显示信息
|
|
/// 显示信息
|
|
@@ -307,5 +787,6 @@ namespace MainForm.FaForm
|
|
MessageEvent?.Invoke(logType, msg);
|
|
MessageEvent?.Invoke(logType, msg);
|
|
}
|
|
}
|
|
#endregion 其他方法
|
|
#endregion 其他方法
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|