diff --git a/JY.Inspection/Config/Configure.ini b/JY.Inspection/Config/Configure.ini
index bfe3741..cf20884 100644
--- a/JY.Inspection/Config/Configure.ini
+++ b/JY.Inspection/Config/Configure.ini
@@ -23,7 +23,8 @@ ResultProcessMesUrl=http://10.22.167.2/core/api/public/product/process/param/new
StationArrivalUrl=http://10.22.167.2/core/api/public/formation/section/arrival/bz
StationExitUrl=http://10.22.167.2/core/api/public/eve/pm/formation-section/bz
LoginMesUrl=http://10.22.167.2/core/api/public/equipment/base/user/permission/verify
-EquipAlarmUrl=http://127.0.0.1
+EquipAlarmUrl=http://10.22.167.2/core/api/public/equipment/alarm/currency
+EquipStatusUrl=http://10.22.167.2/api/public/eve/pm/eqm/run/status/operation
NGMessage=²»·ÖÀà,ÕýÃæ(2D/3D),·´Ãæ(2D/3D),×ó²àÃæ(2D/3D),ÓҲàÃæ(2D/3D),¶¥Ãæ(2D/3D),µ×Ãæ(2D/3D),µ×WE2,µ×WE2,µ×WE3,µ×WE4,ÖÐME1,ÖÐME2,ÖÐME3,ÖÐME1,¼«Öù(POS/NEG),·À±¬·§(PRO),ɨÂëNG,·ֵµNG,ÆäËû
CCDResultMessage=²»·ÖÀà,NG,OK
Grading1=K77
diff --git a/JY.Inspection/Frm/FormMesDataSet.cs b/JY.Inspection/Frm/FormMesDataSet.cs
index 6387ae3..250d22f 100644
--- a/JY.Inspection/Frm/FormMesDataSet.cs
+++ b/JY.Inspection/Frm/FormMesDataSet.cs
@@ -37,6 +37,7 @@ namespace JY.Inspection.Frm
tb_stationExit.DataBindings.Add(new Binding("Text", bindingSource1, "StationExitUrl", true, DataSourceUpdateMode.OnPropertyChanged));
tb_loginMes.DataBindings.Add(new Binding("Text", bindingSource1, "LoginMesUrl", true, DataSourceUpdateMode.OnPropertyChanged));
tb_euipAlarm.DataBindings.Add(new Binding("Text", bindingSource1, "EquipAlarmUrl", true, DataSourceUpdateMode.OnPropertyChanged));
+ tb_euipStatus.DataBindings.Add(new Binding("Text", bindingSource1, "EquipStatusUrl", true, DataSourceUpdateMode.OnPropertyChanged));
}
#endregion
@@ -60,6 +61,7 @@ namespace JY.Inspection.Frm
_viewModel.StationExitUrl = IniFileHelper.ReadIniData("MES配置", "StationExitUrl");
_viewModel.LoginMesUrl = IniFileHelper.ReadIniData("MES配置", "LoginMesUrl");
_viewModel.EquipAlarmUrl = IniFileHelper.ReadIniData("MES配置", "EquipAlarmUrl");
+ _viewModel.EquipStatusUrl = IniFileHelper.ReadIniData("MES配置", "EquipStatusUrl");
LoginTime.Text = IniFileHelper.ReadIniData("MES配置", "LoginTime");
txtMesRequestTime.Text = IniFileHelper.ReadIniData("MES配置", "MesRequestTime");
@@ -87,6 +89,7 @@ namespace JY.Inspection.Frm
IniFileHelper.WriteIniData("MES配置", "StationExitUrl", _viewModel.StationExitUrl.Trim());
IniFileHelper.WriteIniData("MES配置", "LoginMesUrl", _viewModel.LoginMesUrl.Trim());
IniFileHelper.WriteIniData("MES配置", "EquipAlarmUrl", _viewModel.EquipAlarmUrl.Trim());
+ IniFileHelper.WriteIniData("MES配置", "EquipStatusUrl", _viewModel.EquipStatusUrl.Trim());
IniFileHelper.WriteIniData("MES配置", "LoginTime", LoginTime.Text.Trim());
LogManagerControl.AddLog($"用户[{Global.systemConfig.userName}]设置权限超时时间[{LoginTime.Text.Trim()}]", LogAddtype.local, Logtype.Warning);
diff --git a/JY.Inspection/Frm/FormMesDataSet.designer.cs b/JY.Inspection/Frm/FormMesDataSet.designer.cs
index f8d1d86..a6b2b06 100644
--- a/JY.Inspection/Frm/FormMesDataSet.designer.cs
+++ b/JY.Inspection/Frm/FormMesDataSet.designer.cs
@@ -69,6 +69,8 @@ namespace JY.Inspection.Frm
this.linkLabel_editCollectItemCfg = new System.Windows.Forms.LinkLabel();
this.chkIsMesUP = new System.Windows.Forms.CheckBox();
this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components);
+ this.metroLabel12 = new MetroFramework.Controls.MetroLabel();
+ this.tb_euipStatus = new MetroFramework.Controls.MetroTextBox();
this.groupBox1.SuspendLayout();
this.metroPanel_mid.SuspendLayout();
this.metroPanel_top.SuspendLayout();
@@ -368,17 +370,20 @@ namespace JY.Inspection.Frm
this.groupBox1.Controls.Add(this.metroPanel_mid);
this.groupBox1.Controls.Add(this.metroPanel_top);
this.groupBox1.Controls.Add(this.metroPanel_bottom);
- this.groupBox1.Location = new System.Drawing.Point(31, 79);
+ this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.groupBox1.Location = new System.Drawing.Point(27, 75);
this.groupBox1.Margin = new System.Windows.Forms.Padding(4);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(4);
- this.groupBox1.Size = new System.Drawing.Size(959, 615);
+ this.groupBox1.Size = new System.Drawing.Size(981, 651);
this.groupBox1.TabIndex = 36;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "MES配置";
//
// metroPanel_mid
//
+ this.metroPanel_mid.Controls.Add(this.tb_euipStatus);
+ this.metroPanel_mid.Controls.Add(this.metroLabel12);
this.metroPanel_mid.Controls.Add(this.tb_euipAlarm);
this.metroPanel_mid.Controls.Add(this.metroLabel11);
this.metroPanel_mid.Controls.Add(this.tb_loginMes);
@@ -398,7 +403,7 @@ namespace JY.Inspection.Frm
this.metroPanel_mid.Location = new System.Drawing.Point(4, 226);
this.metroPanel_mid.Margin = new System.Windows.Forms.Padding(4);
this.metroPanel_mid.Name = "metroPanel_mid";
- this.metroPanel_mid.Size = new System.Drawing.Size(951, 269);
+ this.metroPanel_mid.Size = new System.Drawing.Size(973, 305);
this.metroPanel_mid.TabIndex = 186;
this.metroPanel_mid.VerticalScrollbar = true;
this.metroPanel_mid.VerticalScrollbarBarColor = true;
@@ -598,7 +603,7 @@ namespace JY.Inspection.Frm
this.metroPanel_top.Location = new System.Drawing.Point(4, 22);
this.metroPanel_top.Margin = new System.Windows.Forms.Padding(4);
this.metroPanel_top.Name = "metroPanel_top";
- this.metroPanel_top.Size = new System.Drawing.Size(951, 204);
+ this.metroPanel_top.Size = new System.Drawing.Size(973, 204);
this.metroPanel_top.TabIndex = 185;
this.metroPanel_top.VerticalScrollbarBarColor = true;
this.metroPanel_top.VerticalScrollbarHighlightOnWheel = false;
@@ -720,7 +725,7 @@ namespace JY.Inspection.Frm
// metroLabel22
//
this.metroLabel22.AutoSize = true;
- this.metroLabel22.Location = new System.Drawing.Point(504, 159);
+ this.metroLabel22.Location = new System.Drawing.Point(511, 159);
this.metroLabel22.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.metroLabel22.Name = "metroLabel22";
this.metroLabel22.Size = new System.Drawing.Size(114, 20);
@@ -731,7 +736,7 @@ namespace JY.Inspection.Frm
// metroLabel20
//
this.metroLabel20.AutoSize = true;
- this.metroLabel20.Location = new System.Drawing.Point(469, 66);
+ this.metroLabel20.Location = new System.Drawing.Point(477, 66);
this.metroLabel20.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.metroLabel20.Name = "metroLabel20";
this.metroLabel20.Size = new System.Drawing.Size(141, 20);
@@ -749,10 +754,10 @@ namespace JY.Inspection.Frm
this.metroPanel_bottom.HorizontalScrollbarBarColor = true;
this.metroPanel_bottom.HorizontalScrollbarHighlightOnWheel = false;
this.metroPanel_bottom.HorizontalScrollbarSize = 12;
- this.metroPanel_bottom.Location = new System.Drawing.Point(4, 495);
+ this.metroPanel_bottom.Location = new System.Drawing.Point(4, 531);
this.metroPanel_bottom.Margin = new System.Windows.Forms.Padding(4);
this.metroPanel_bottom.Name = "metroPanel_bottom";
- this.metroPanel_bottom.Size = new System.Drawing.Size(951, 116);
+ this.metroPanel_bottom.Size = new System.Drawing.Size(973, 116);
this.metroPanel_bottom.TabIndex = 187;
this.metroPanel_bottom.VerticalScrollbarBarColor = true;
this.metroPanel_bottom.VerticalScrollbarHighlightOnWheel = false;
@@ -781,11 +786,53 @@ namespace JY.Inspection.Frm
this.chkIsMesUP.Text = "开启MES模式";
this.chkIsMesUP.UseVisualStyleBackColor = true;
//
+ // metroLabel12
+ //
+ this.metroLabel12.AutoSize = true;
+ this.metroLabel12.Location = new System.Drawing.Point(41, 269);
+ this.metroLabel12.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+ this.metroLabel12.Name = "metroLabel12";
+ this.metroLabel12.Size = new System.Drawing.Size(144, 20);
+ this.metroLabel12.TabIndex = 44;
+ this.metroLabel12.Text = "设备状态接口地址:";
+ //
+ // tb_euipStatus
+ //
+ //
+ //
+ //
+ this.tb_euipStatus.CustomButton.Image = null;
+ this.tb_euipStatus.CustomButton.Location = new System.Drawing.Point(671, 1);
+ this.tb_euipStatus.CustomButton.Margin = new System.Windows.Forms.Padding(4);
+ this.tb_euipStatus.CustomButton.Name = "";
+ this.tb_euipStatus.CustomButton.Size = new System.Drawing.Size(27, 27);
+ this.tb_euipStatus.CustomButton.Style = MetroFramework.MetroColorStyle.Blue;
+ this.tb_euipStatus.CustomButton.TabIndex = 1;
+ this.tb_euipStatus.CustomButton.Theme = MetroFramework.MetroThemeStyle.Light;
+ this.tb_euipStatus.CustomButton.UseSelectable = true;
+ this.tb_euipStatus.CustomButton.Visible = false;
+ this.tb_euipStatus.Lines = new string[0];
+ this.tb_euipStatus.Location = new System.Drawing.Point(235, 260);
+ this.tb_euipStatus.Margin = new System.Windows.Forms.Padding(4);
+ this.tb_euipStatus.MaxLength = 32767;
+ this.tb_euipStatus.Name = "tb_euipStatus";
+ this.tb_euipStatus.PasswordChar = '\0';
+ this.tb_euipStatus.ScrollBars = System.Windows.Forms.ScrollBars.None;
+ this.tb_euipStatus.SelectedText = "";
+ this.tb_euipStatus.SelectionLength = 0;
+ this.tb_euipStatus.SelectionStart = 0;
+ this.tb_euipStatus.ShortcutsEnabled = true;
+ this.tb_euipStatus.Size = new System.Drawing.Size(699, 29);
+ this.tb_euipStatus.TabIndex = 45;
+ this.tb_euipStatus.UseSelectable = true;
+ this.tb_euipStatus.WaterMarkColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109)))));
+ this.tb_euipStatus.WaterMarkFont = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Pixel);
+ //
// FormMesDataSet
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(1017, 722);
+ this.ClientSize = new System.Drawing.Size(1035, 751);
this.Controls.Add(this.groupBox1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(4);
@@ -849,5 +896,7 @@ namespace JY.Inspection.Frm
private MetroFramework.Controls.MetroTextBox tb_loginMes;
private MetroFramework.Controls.MetroTextBox tb_euipAlarm;
private MetroFramework.Controls.MetroLabel metroLabel11;
+ private MetroFramework.Controls.MetroTextBox tb_euipStatus;
+ private MetroFramework.Controls.MetroLabel metroLabel12;
}
}
\ No newline at end of file
diff --git a/JY.Inspection/HomeForm.cs b/JY.Inspection/HomeForm.cs
index ff0cc34..96ec46b 100644
--- a/JY.Inspection/HomeForm.cs
+++ b/JY.Inspection/HomeForm.cs
@@ -2815,14 +2815,14 @@ namespace JY.Inspection
strStatues = "";
while (true)
{
- //SendStatus();
+ SendStatus();
Thread.Sleep(1000);
}
}
///
- /// 设备状态上传
+ /// TODO 设备状态上传 上传时机
///
///
@@ -2883,24 +2883,43 @@ namespace JY.Inspection
if (Global.systemConfig.isUpMes)
{
- string strJosn = JsonConvert.SerializeObject(Status);
+ ReqEquipStatus req = new ReqEquipStatus()
+ {
+ SiteCode = Global.systemConfig.siteCode,
+ LineCode = Global.systemConfig.lineCode,
+ EquipNum = Global.systemConfig.equipCode,
+ MaterialCode = Global.systemConfig.materialCode,
+ UserName = Global.systemConfig.userName,
+ SeatId = string.Empty,
+ RecordDate = Status.recordDate,
+ StatusCode = Status.statusCode,
+ UploadTime = Status.uploadTime,
+ Guid = Status.guid,
+ FaultCodeList = new List() {
+ new FaultCodeInfo() { FaultCode = string.Empty }
+ }
+ };
+
+ //string strJosn = JsonConvert.SerializeObject(req);
// LogManagerControl.AddLog($"PC->FMS[MES_Status]:{strJosn}", LogAddtype.MES);
//TxtHelper.WriteTxt($@"{Global.strMesLogspath}\{DateTime.Now.ToString("yyyyMMdd")}\设备运行状态\{DateTime.Now.ToString("HH")}.txt", strJosn);
Stopwatch swTime = new Stopwatch();
swTime.Start();
- var result = JY.MES.FMS.MesHelper_EVE.MES_Status(Status);
+ //var result = JY.MES.FMS.MesHelper_EVE.MES_Status(Status);
+ MesCallResult result = new MESDataCombin().UpEquipStatus(req);
+
swTime.Stop();
LogManagerControl.AddLog($"处理设备状态上报FMS耗时:{swTime.ElapsedMilliseconds}ms", LogAddtype.local, Logtype.Message);
if (result != null)
{
- string strRes = "code" + "[" + result.code + "]" + "success" + "[" + result.success + "]" + "message" + "[" + result.message + "]" + "category" + "[" + result.category + "]";
+ string strRes = "code" + "[" + result?.OriResponse.Code + "]" + "success" + "[" + result?.OriResponse.Success + "]" + "message" + "[" + result?.OriResponse.Message + "]" + "category" + "[" + result?.OriResponse.Category + "]";
LogManagerControl.AddLog($"FMS->PC[MES_Status]:{strRes}", LogAddtype.MES);
}
else
{
- LogManagerControl.AddLog($"设备状态上报FMS出错", LogAddtype.local, Logtype.Message);
+ LogManagerControl.AddLog($"设备状态上报MES出错", LogAddtype.local, Logtype.Message);
}
}
diff --git a/JY.Inspection/Mes/MESDataCombin.cs b/JY.Inspection/Mes/MESDataCombin.cs
index 9349ab6..e40f1ad 100644
--- a/JY.Inspection/Mes/MESDataCombin.cs
+++ b/JY.Inspection/Mes/MESDataCombin.cs
@@ -52,9 +52,10 @@ namespace JY.Inspection.Mes
MesCallResult LoginMes(ReqLoginMes req);
- // TODO 上传设备状态信息
+ // 上传设备状态信息
+ MesCallResult UpEquipStatus(ReqEquipStatus req);
- // TODO 上传设备报警信息
+ // 上传设备报警信息
MesCallResult UpAlarmData(ReqAlarm req);
// TODO 能耗
@@ -470,5 +471,50 @@ namespace JY.Inspection.Mes
return resp;
}
+
+ public MesCallResult UpEquipStatus(ReqEquipStatus req)
+ {
+ if (req == null)
+ {
+ throw new ArgumentNullException("MES设备状态信息为空");
+ }
+
+ // MES登录请求地址
+ DateTime currentTime = DateTime.Now;
+ // 设备状态URL
+ string reqUrl = Global.systemConfig.EquipStatusUrl;
+ MesCallResult resp = new MesCallResult();
+
+ try
+ {
+ string reqJsonStr = JsonHelper.Serialize(req);
+ var sw = new Stopwatch();
+ sw.Start();
+ string mesRes = MESApiHelper.HttpPostJsonAPI(
+ reqUrl,
+ reqJsonStr,
+ Global.systemConfig.MesRequestTime
+ );
+ resp = MESApiHelper.HttpPostJsonAPI(reqUrl, reqJsonStr, Global.systemConfig.MesRequestTime);
+ sw.Stop();
+
+ if (resp?.OriResponse != null && resp?.OriResponse.Success != true)
+ {
+ resp.IsSuccess = false;
+ resp.ErrorType = MesErrorType.BusinessError;
+ resp.ErrorMessage = resp?.OriResponse?.Message ?? "MES业务处理失败, 错误消息为空";
+ }
+
+ new MesLog().LogEqupStatus(currentTime, reqJsonStr, resp.OriRespJsonStr, sw.ElapsedMilliseconds);
+ }
+ catch (Exception ex)
+ {
+ resp.IsSuccess = false;
+ resp.ErrorType = MesErrorType.ClientError;
+ resp.ErrorMessage = "上传设备状态信息异常:" + ex.Message;
+ }
+
+ return resp;
+ }
}
}
diff --git a/JY.Inspection/Mes/MesLog.cs b/JY.Inspection/Mes/MesLog.cs
index b47a049..dc13d11 100644
--- a/JY.Inspection/Mes/MesLog.cs
+++ b/JY.Inspection/Mes/MesLog.cs
@@ -19,6 +19,8 @@ namespace JY.Inspection.Mes
void LogLoginMes(DateTime curTime, string reqJsonStr, string respMes, long costTime);
void LogEqupAlarmInfo(DateTime curTime, string reqJsonStr, string respMes, long costTime);
+
+ void LogEqupStatus(DateTime curTime, string reqJsonStr, string respMes, long costTime);
}
public class MesLog : IMesLog
@@ -80,5 +82,12 @@ namespace JY.Inspection.Mes
LogoutAction(actionName, curTime, reqJsonStr, respMes, costTime);
}
+
+ public void LogEqupStatus(DateTime curTime, string reqJsonStr, string respMes, long costTime)
+ {
+ string actionName = "设备状态";
+
+ LogoutAction(actionName, curTime, reqJsonStr, respMes, costTime);
+ }
}
}
diff --git a/JY.Inspection/ViewModel/FrmMesSettingVM.cs b/JY.Inspection/ViewModel/FrmMesSettingVM.cs
index 252cfed..929f796 100644
--- a/JY.Inspection/ViewModel/FrmMesSettingVM.cs
+++ b/JY.Inspection/ViewModel/FrmMesSettingVM.cs
@@ -68,7 +68,16 @@ namespace JY.Inspection.ViewModel
set { equipAlarmUrl = value; OnPropertyChanged(); }
}
+ private string equipStatusUrl;
+ ///
+ /// 设备状态接口地址
+ ///
+ public string EquipStatusUrl
+ {
+ get { return equipStatusUrl; }
+ set { equipStatusUrl = value; OnPropertyChanged(); }
+ }
private string productType;
diff --git a/JY.MES/JY.MES.csproj b/JY.MES/JY.MES.csproj
index 66dde2b..eecd5d3 100644
--- a/JY.MES/JY.MES.csproj
+++ b/JY.MES/JY.MES.csproj
@@ -74,11 +74,13 @@
+
+
diff --git a/JY.MES/MES/ReqEquipStatus.cs b/JY.MES/MES/ReqEquipStatus.cs
new file mode 100644
index 0000000..454b7c5
--- /dev/null
+++ b/JY.MES/MES/ReqEquipStatus.cs
@@ -0,0 +1,74 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace JY.MES.MES
+{
+ ///
+ /// 请求-设备状态
+ ///
+ public class ReqEquipStatus
+ {
+ ///
+ /// 工厂代码
+ ///
+ public string SiteCode { get; set; }
+
+ ///
+ /// 产线编号
+ ///
+ public string LineCode { get; set; }
+
+ ///
+ /// 设备编号
+ ///
+ public string EquipNum { get; set; }
+
+ ///
+ /// 物料编码
+ ///
+ public string MaterialCode { get; set; }
+
+ ///
+ /// 员工账号
+ ///
+ public string UserName { get; set; }
+
+ ///
+ /// 库位ID
+ ///
+ public string SeatId { get; set; }
+
+ ///
+ /// 采集时间
+ ///
+ public string RecordDate { get; set; }
+
+ ///
+ /// 设备状态
+ ///
+ public string StatusCode { get; set; }
+
+ ///
+ /// 状态变更时间
+ ///
+ public string UploadTime { get; set; }
+
+ ///
+ /// 唯一标识符号
+ ///
+ public string Guid { get; set; }
+
+ ///
+ /// 故障代码数组
+ ///
+ public List FaultCodeList { get; set; }
+ }
+
+ public class FaultCodeInfo
+ {
+ public string FaultCode { get; set; }
+ }
+}
diff --git a/JY.MES/MES/RespEquipStatus.cs b/JY.MES/MES/RespEquipStatus.cs
new file mode 100644
index 0000000..4616924
--- /dev/null
+++ b/JY.MES/MES/RespEquipStatus.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace JY.MES.MES
+{
+ public class RespEquipStatus : RespBase
+ {
+ }
+}
diff --git a/JY.Model/DB.Entity/SystemConfig.cs b/JY.Model/DB.Entity/SystemConfig.cs
index ec3514a..863bd0e 100644
--- a/JY.Model/DB.Entity/SystemConfig.cs
+++ b/JY.Model/DB.Entity/SystemConfig.cs
@@ -62,6 +62,11 @@ namespace JY.Model
///
public string EquipAlarmUrl = "http://127.0.0.1";
+ ///
+ /// 设备状态接口地址
+ ///
+ public string EquipStatusUrl = "http://127.0.0.1";
+
public List CollectItemCfgList { get; set; } = new List();
#endregion