上传设备状态
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
+58
-9
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -2815,14 +2815,14 @@ namespace JY.Inspection
|
||||
strStatues = "";
|
||||
while (true)
|
||||
{
|
||||
//SendStatus();
|
||||
SendStatus();
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 设备状态上传
|
||||
/// TODO 设备状态上传 上传时机
|
||||
/// </summary>
|
||||
/// <param name="mt"></param>
|
||||
|
||||
@@ -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<FaultCodeInfo>() {
|
||||
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<RespEquipStatus> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,9 +52,10 @@ namespace JY.Inspection.Mes
|
||||
|
||||
MesCallResult<RespLoginMes> LoginMes(ReqLoginMes req);
|
||||
|
||||
// TODO 上传设备状态信息
|
||||
// 上传设备状态信息
|
||||
MesCallResult<RespEquipStatus> UpEquipStatus(ReqEquipStatus req);
|
||||
|
||||
// TODO 上传设备报警信息
|
||||
// 上传设备报警信息
|
||||
MesCallResult<RespAlarm> UpAlarmData(ReqAlarm req);
|
||||
|
||||
// TODO 能耗
|
||||
@@ -470,5 +471,50 @@ namespace JY.Inspection.Mes
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
public MesCallResult<RespEquipStatus> UpEquipStatus(ReqEquipStatus req)
|
||||
{
|
||||
if (req == null)
|
||||
{
|
||||
throw new ArgumentNullException("MES设备状态信息为空");
|
||||
}
|
||||
|
||||
// MES登录请求地址
|
||||
DateTime currentTime = DateTime.Now;
|
||||
// 设备状态URL
|
||||
string reqUrl = Global.systemConfig.EquipStatusUrl;
|
||||
MesCallResult<RespEquipStatus> resp = new MesCallResult<RespEquipStatus>();
|
||||
|
||||
try
|
||||
{
|
||||
string reqJsonStr = JsonHelper.Serialize(req);
|
||||
var sw = new Stopwatch();
|
||||
sw.Start();
|
||||
string mesRes = MESApiHelper.HttpPostJsonAPI(
|
||||
reqUrl,
|
||||
reqJsonStr,
|
||||
Global.systemConfig.MesRequestTime
|
||||
);
|
||||
resp = MESApiHelper.HttpPostJsonAPI<RespEquipStatus>(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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,16 @@ namespace JY.Inspection.ViewModel
|
||||
set { equipAlarmUrl = value; OnPropertyChanged(); }
|
||||
}
|
||||
|
||||
private string equipStatusUrl;
|
||||
|
||||
/// <summary>
|
||||
/// 设备状态接口地址
|
||||
/// </summary>
|
||||
public string EquipStatusUrl
|
||||
{
|
||||
get { return equipStatusUrl; }
|
||||
set { equipStatusUrl = value; OnPropertyChanged(); }
|
||||
}
|
||||
|
||||
private string productType;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user