结果接口: 通过属性名与mes编码对应,不使用PLC相对地址
This commit is contained in:
@@ -299,7 +299,7 @@ namespace JY.Inspection.Common
|
||||
/// 使用MES员工信息接口校验登录信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public User CheckMesUserLogin(string userName, string passWord, ref string strErr)
|
||||
public User CheckMesUserLogin(string userName, string passWord, string icCardNum, ref string strErr)
|
||||
{
|
||||
User user = null;
|
||||
|
||||
@@ -310,7 +310,7 @@ namespace JY.Inspection.Common
|
||||
EquipNum = Global.systemConfig.equipCode,
|
||||
UserName = userName,
|
||||
PassWord = passWord,
|
||||
UserCardID = string.Empty
|
||||
UserCardID = icCardNum
|
||||
};
|
||||
|
||||
string strJson = JsonConvert.SerializeObject(req);
|
||||
|
||||
Binary file not shown.
@@ -17,6 +17,7 @@ using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
@@ -499,10 +500,26 @@ namespace JY.Inspection.Frm
|
||||
data.CCD14 = row.Cells["中ME4"].Value?.ToString();
|
||||
data.CCD15 = row.Cells["极柱(POS/NEG)"].Value?.ToString();
|
||||
data.CCD16 = row.Cells["防爆阀(PRO)"].Value?.ToString();
|
||||
data.Result = row.Cells["综合结果"].Value?.ToString();
|
||||
data.Result = row.Cells["综合结果"].Value?.ToString()?.Trim();
|
||||
data.Remark = row.Cells["备注"].Value?.ToString();
|
||||
data.Flag = Convert.ToInt32(row.Cells["状态"].Value);
|
||||
|
||||
//var cfgList = Global.systemConfig.CollectItemCfgList.Where(it => it.IsEnable && it.PLCRelAddress != null)
|
||||
// .OrderBy(it => it.PLCRelAddress).ToList();
|
||||
|
||||
//for (int k = 0; k < cfgList.Count; k++)
|
||||
//{
|
||||
// var item = cfgList[k];
|
||||
|
||||
// var prop = data.GetType().GetProperty(item.HCPropName);
|
||||
|
||||
// if (prop != null)
|
||||
// {
|
||||
// var code = prop.GetValue(data)?.ToString();
|
||||
// data.PLCValDic.Add((int)item.PLCRelAddress, code);
|
||||
// }
|
||||
//}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ namespace JY.Inspection.Frm
|
||||
pLogin_card.Location = new System.Drawing.Point(81, 282);
|
||||
|
||||
chkIsSK.CheckedChanged += chkIsSK_CheckedChanged;
|
||||
txtPassword2.KeyUp += txtPassWord_KeyUp;
|
||||
txtPassword2.KeyDown += txtPassword2_KeyDown;
|
||||
txtICCard.KeyUp += txtPassWord_KeyUp;
|
||||
txtICCard.KeyDown += txtPassword2_KeyDown;
|
||||
btLogin.Click += btLogin_Click;
|
||||
}
|
||||
|
||||
@@ -43,26 +43,26 @@ namespace JY.Inspection.Frm
|
||||
TimeSpan ts = _tempDt.Subtract(_dt);
|
||||
if (ts.Milliseconds > 100)
|
||||
{
|
||||
txtPassword2.Text = "";//清空
|
||||
txtICCard.Text = "";//清空
|
||||
}
|
||||
else
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
{
|
||||
|
||||
if (txtPassword2.Text == string.Empty)
|
||||
if (txtICCard.Text == string.Empty)
|
||||
{
|
||||
txtPassword2.Focus();
|
||||
txtICCard.Focus();
|
||||
MessageBox.Show("IC卡号为空", "系统提示");
|
||||
return;
|
||||
}
|
||||
UserHelper helper = new UserHelper("");
|
||||
string strErr = "";
|
||||
var res = helper.CheckUserLogin("user.pt", "", txtPassword2.Text.Trim(), ref strErr);
|
||||
var res = helper.CheckUserLogin("user.pt", "", txtICCard.Text.Trim(), ref strErr);
|
||||
if (res == null)
|
||||
{
|
||||
txtPassword2.Text = "";
|
||||
txtPassword2.Focus();
|
||||
txtICCard.Text = "";
|
||||
txtICCard.Focus();
|
||||
MessageBox.Show("IC卡号不正确" + strErr, "系统提示");
|
||||
return;
|
||||
}
|
||||
@@ -87,7 +87,14 @@ namespace JY.Inspection.Frm
|
||||
|
||||
if (check_isMesLogin.Checked)
|
||||
{
|
||||
res = helper.CheckMesUserLogin(txtUserID.Text.Trim(), txtPassWord.Text.Trim(), ref strErr);
|
||||
if (chkIsSK.Checked)
|
||||
{
|
||||
res = helper.CheckMesUserLogin(string.Empty, string.Empty, txtICCard.Text.Trim(), ref strErr);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = helper.CheckMesUserLogin(txtUserID.Text.Trim(), txtPassWord.Text.Trim(), string.Empty, ref strErr);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Generated
+32
-32
@@ -41,7 +41,7 @@ namespace JY.Inspection.Frm
|
||||
this.pLogin_pwd = new System.Windows.Forms.Panel();
|
||||
this.pLogin_card = new System.Windows.Forms.Panel();
|
||||
this.lblICCard = new MetroFramework.Controls.MetroLabel();
|
||||
this.txtPassword2 = new MetroFramework.Controls.MetroTextBox();
|
||||
this.txtICCard = new MetroFramework.Controls.MetroTextBox();
|
||||
this.check_isMesLogin = new MetroFramework.Controls.MetroCheckBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.pLogin_pwd.SuspendLayout();
|
||||
@@ -197,7 +197,7 @@ namespace JY.Inspection.Frm
|
||||
// pLogin_card
|
||||
//
|
||||
this.pLogin_card.Controls.Add(this.lblICCard);
|
||||
this.pLogin_card.Controls.Add(this.txtPassword2);
|
||||
this.pLogin_card.Controls.Add(this.txtICCard);
|
||||
this.pLogin_card.Location = new System.Drawing.Point(81, 207);
|
||||
this.pLogin_card.Name = "pLogin_card";
|
||||
this.pLogin_card.Size = new System.Drawing.Size(333, 50);
|
||||
@@ -213,39 +213,39 @@ namespace JY.Inspection.Frm
|
||||
this.lblICCard.TabIndex = 25;
|
||||
this.lblICCard.Text = "IC卡:";
|
||||
//
|
||||
// txtPassword2
|
||||
// txtICCard
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
this.txtPassword2.CustomButton.Image = null;
|
||||
this.txtPassword2.CustomButton.Location = new System.Drawing.Point(177, 1);
|
||||
this.txtPassword2.CustomButton.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.txtPassword2.CustomButton.Name = "";
|
||||
this.txtPassword2.CustomButton.Size = new System.Drawing.Size(27, 27);
|
||||
this.txtPassword2.CustomButton.Style = MetroFramework.MetroColorStyle.Blue;
|
||||
this.txtPassword2.CustomButton.TabIndex = 1;
|
||||
this.txtPassword2.CustomButton.Theme = MetroFramework.MetroThemeStyle.Light;
|
||||
this.txtPassword2.CustomButton.UseSelectable = true;
|
||||
this.txtPassword2.CustomButton.Visible = false;
|
||||
this.txtPassword2.Lines = new string[0];
|
||||
this.txtPassword2.Location = new System.Drawing.Point(105, 17);
|
||||
this.txtPassword2.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.txtPassword2.MaxLength = 32767;
|
||||
this.txtPassword2.Name = "txtPassword2";
|
||||
this.txtPassword2.PasswordChar = '*';
|
||||
this.txtPassword2.PromptText = "请刷卡";
|
||||
this.txtPassword2.ScrollBars = System.Windows.Forms.ScrollBars.None;
|
||||
this.txtPassword2.SelectedText = "";
|
||||
this.txtPassword2.SelectionLength = 0;
|
||||
this.txtPassword2.SelectionStart = 0;
|
||||
this.txtPassword2.ShortcutsEnabled = true;
|
||||
this.txtPassword2.Size = new System.Drawing.Size(205, 29);
|
||||
this.txtPassword2.TabIndex = 24;
|
||||
this.txtPassword2.UseSelectable = true;
|
||||
this.txtPassword2.WaterMark = "请刷卡";
|
||||
this.txtPassword2.WaterMarkColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109)))));
|
||||
this.txtPassword2.WaterMarkFont = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtICCard.CustomButton.Image = null;
|
||||
this.txtICCard.CustomButton.Location = new System.Drawing.Point(177, 1);
|
||||
this.txtICCard.CustomButton.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.txtICCard.CustomButton.Name = "";
|
||||
this.txtICCard.CustomButton.Size = new System.Drawing.Size(27, 27);
|
||||
this.txtICCard.CustomButton.Style = MetroFramework.MetroColorStyle.Blue;
|
||||
this.txtICCard.CustomButton.TabIndex = 1;
|
||||
this.txtICCard.CustomButton.Theme = MetroFramework.MetroThemeStyle.Light;
|
||||
this.txtICCard.CustomButton.UseSelectable = true;
|
||||
this.txtICCard.CustomButton.Visible = false;
|
||||
this.txtICCard.Lines = new string[0];
|
||||
this.txtICCard.Location = new System.Drawing.Point(105, 17);
|
||||
this.txtICCard.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.txtICCard.MaxLength = 32767;
|
||||
this.txtICCard.Name = "txtICCard";
|
||||
this.txtICCard.PasswordChar = '*';
|
||||
this.txtICCard.PromptText = "请刷卡";
|
||||
this.txtICCard.ScrollBars = System.Windows.Forms.ScrollBars.None;
|
||||
this.txtICCard.SelectedText = "";
|
||||
this.txtICCard.SelectionLength = 0;
|
||||
this.txtICCard.SelectionStart = 0;
|
||||
this.txtICCard.ShortcutsEnabled = true;
|
||||
this.txtICCard.Size = new System.Drawing.Size(205, 29);
|
||||
this.txtICCard.TabIndex = 24;
|
||||
this.txtICCard.UseSelectable = true;
|
||||
this.txtICCard.WaterMark = "请刷卡";
|
||||
this.txtICCard.WaterMarkColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109)))));
|
||||
this.txtICCard.WaterMarkFont = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Pixel);
|
||||
//
|
||||
// check_isMesLogin
|
||||
//
|
||||
@@ -304,7 +304,7 @@ namespace JY.Inspection.Frm
|
||||
private System.Windows.Forms.Panel pLogin_pwd;
|
||||
private System.Windows.Forms.Panel pLogin_card;
|
||||
private MetroFramework.Controls.MetroLabel lblICCard;
|
||||
private MetroFramework.Controls.MetroTextBox txtPassword2;
|
||||
private MetroFramework.Controls.MetroTextBox txtICCard;
|
||||
private MetroFramework.Controls.MetroCheckBox check_isMesLogin;
|
||||
}
|
||||
}
|
||||
+27
-27
@@ -1942,7 +1942,7 @@ namespace JY.Inspection
|
||||
LineCode = Global.systemConfig.lineCode,
|
||||
EquipNum = Global.systemConfig.equipCode,
|
||||
MaterialCode = Global.systemConfig.materialCode,
|
||||
UserName = "Test_HC",
|
||||
UserName = Global.systemConfig.userName,
|
||||
Identification = m.BarCode,
|
||||
ProductType = Global.systemConfig.productType
|
||||
};
|
||||
@@ -2130,22 +2130,22 @@ namespace JY.Inspection
|
||||
m.CCD15 = lstBarResult[14] == 1 ? "OK" : "NG";
|
||||
m.CCD16 = lstBarResult[15] == 1 ? "OK" : "NG";
|
||||
|
||||
var cfgList = Global.systemConfig.CollectItemCfgList
|
||||
.Where(it => it.IsEnable && it.PLCRelAddress != null)
|
||||
.OrderBy(it => it.PLCRelAddress).ToList();
|
||||
//var cfgList = Global.systemConfig.CollectItemCfgList
|
||||
// .Where(it => it.IsEnable && it.PLCRelAddress != null)
|
||||
// .OrderBy(it => it.PLCRelAddress).ToList();
|
||||
|
||||
for (int k = 0; k < cfgList.Count; k++)
|
||||
{
|
||||
var item = cfgList[k];
|
||||
//for (int k = 0; k < cfgList.Count; k++)
|
||||
//{
|
||||
// var item = cfgList[k];
|
||||
|
||||
int index = (int)item.PLCRelAddress - 1;
|
||||
// int index = (int)item.PLCRelAddress - 1;
|
||||
|
||||
if (index < listBar2Result.Count)
|
||||
{
|
||||
var code = listBar2Result[index] == 1 ? "OK" : "NG";
|
||||
m.PLCValDic.Add((int)item.PLCRelAddress, code);
|
||||
}
|
||||
}
|
||||
// if (index < listBar2Result.Count)
|
||||
// {
|
||||
// var code = listBar2Result[index] == 1 ? "OK" : "NG";
|
||||
// m.PLCValDic.Add((int)item.PLCRelAddress, code);
|
||||
// }
|
||||
//}
|
||||
#endregion
|
||||
string levelresult = null;
|
||||
string strErr = "";
|
||||
@@ -3625,22 +3625,22 @@ namespace JY.Inspection
|
||||
m.CCD14 = listBar2Result[13] == 1 ? "OK" : "NG";
|
||||
}
|
||||
|
||||
var cfgList = Global.systemConfig.CollectItemCfgList
|
||||
.Where(it => it.IsEnable && it.PLCRelAddress != null)
|
||||
.OrderBy(it => it.PLCRelAddress).ToList();
|
||||
//var cfgList = Global.systemConfig.CollectItemCfgList
|
||||
// .Where(it => it.IsEnable && it.PLCRelAddress != null)
|
||||
// .OrderBy(it => it.PLCRelAddress).ToList();
|
||||
|
||||
for (int k = 0; k < cfgList.Count; k++)
|
||||
{
|
||||
var item = cfgList[k];
|
||||
//for (int k = 0; k < cfgList.Count; k++)
|
||||
//{
|
||||
// var item = cfgList[k];
|
||||
|
||||
int index = (int)item.PLCRelAddress - 1;
|
||||
// int index = (int)item.PLCRelAddress - 1;
|
||||
|
||||
if (index < listBar2Result.Count)
|
||||
{
|
||||
var code = listBar2Result[index] == 1 ? "OK" : "NG";
|
||||
m.PLCValDic.Add((int)item.PLCRelAddress, code);
|
||||
}
|
||||
}
|
||||
// if (index < listBar2Result.Count)
|
||||
// {
|
||||
// var code = listBar2Result[index] == 1 ? "OK" : "NG";
|
||||
// m.PLCValDic.Add((int)item.PLCRelAddress, code);
|
||||
// }
|
||||
//}
|
||||
#endregion
|
||||
|
||||
string strErr = "";
|
||||
|
||||
@@ -3,4 +3,8 @@
|
||||
<PropertyGroup>
|
||||
<ProjectView>ProjectFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
|
||||
<StartAction>Program</StartAction>
|
||||
<StartProgram>D:\JY.Inspection\JY.Inspection.exe</StartProgram>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -7,6 +7,7 @@ using JY.Model;
|
||||
using JY.Utility;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using NPOI.OpenXmlFormats.Spreadsheet;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@@ -81,7 +82,7 @@ namespace JY.Inspection.Mes
|
||||
{
|
||||
siteCode = Global.systemConfig.siteCode,
|
||||
lineCode = Global.systemConfig.lineCode,
|
||||
userName = "admin",
|
||||
userName = Global.systemConfig.userName,
|
||||
equipCode = Global.systemConfig.equipCode,
|
||||
recordDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
qty = 1,
|
||||
@@ -160,7 +161,7 @@ namespace JY.Inspection.Mes
|
||||
Payload pl = new Payload();
|
||||
pl.siteCode = Global.systemConfig.siteCode;
|
||||
pl.lineCode = Global.systemConfig.lineCode;
|
||||
pl.userName = "admin";
|
||||
pl.userName = Global.systemConfig.userName;
|
||||
pl.materialCode = Global.systemConfig.materialCode;
|
||||
pl.carCode = "";
|
||||
pl.collection = "JS";
|
||||
@@ -179,44 +180,61 @@ namespace JY.Inspection.Mes
|
||||
TagDataVOListItem tag1;
|
||||
|
||||
// 结果采集项
|
||||
|
||||
|
||||
tag1 = new TagDataVOListItem() { tagCode = "WGJA001", tagValue = m.ArrivalBarCode, tagTime = m.OutTime, tagCalculateResult = "Y", tagRemark = "入站条码" }; tdvls.Add(tag1);
|
||||
tag1 = new TagDataVOListItem() { tagCode = "WGJA002", tagValue = m.DepartureBarCode, tagTime = m.OutTime, tagCalculateResult = "Y", tagRemark = "出站条码" }; tdvls.Add(tag1);
|
||||
tag1 = new TagDataVOListItem() { tagCode = "WGJA003", tagValue = m.WorkShift, tagTime = m.OutTime, tagCalculateResult = "Y", tagRemark = "班次" }; tdvls.Add(tag1);
|
||||
tag1 = new TagDataVOListItem() { tagCode = "WGJA004", tagValue = m.OutTime, tagTime = m.OutTime, tagCalculateResult = "Y", tagRemark = "出站时间" }; tdvls.Add(tag1);
|
||||
|
||||
foreach (var item in m.PLCValDic)
|
||||
var otherCfgList = Global.systemConfig.CollectItemCfgList
|
||||
.Where(it => it.IsEnable && !string.IsNullOrEmpty(it.HCPropName)).ToList();
|
||||
foreach (var item in otherCfgList)
|
||||
{
|
||||
// TODO 获取采集项配置
|
||||
var cfgItem = Global.systemConfig.CollectItemCfgList
|
||||
.Where(it => it.IsEnable && it.PLCRelAddress == item.Key)
|
||||
.FirstOrDefault();
|
||||
|
||||
if (cfgItem == null)
|
||||
// 判断m中的属性名是否存在it.HCPropName
|
||||
// 如果存在生成TagDataVoListItem
|
||||
var prop = m.GetType().GetProperty(item.HCPropName);
|
||||
if (prop != null)
|
||||
{
|
||||
continue;
|
||||
tdvls.Add(new TagDataVOListItem() {
|
||||
tagCode = item.MesItemCode,
|
||||
tagValue = prop.GetValue(m).ToString(),
|
||||
tagTime = m.OutTime,
|
||||
tagCalculateResult = "Y",
|
||||
tagRemark = item.MesItemName
|
||||
});
|
||||
}
|
||||
|
||||
// 生成TagDataVoListItem
|
||||
tdvls.Add(new TagDataVOListItem()
|
||||
{
|
||||
tagCode = cfgItem.MesItemCode,
|
||||
tagValue = item.Value,
|
||||
tagTime = m.OutTime,
|
||||
tagCalculateResult = "Y",
|
||||
tagRemark = cfgItem.MesItemName
|
||||
});
|
||||
}
|
||||
|
||||
tdvls.Add(new TagDataVOListItem()
|
||||
{
|
||||
tagCode = "WGJA021",
|
||||
tagValue = m.Result,
|
||||
tagTime = m.OutTime,
|
||||
tagCalculateResult = "Y",
|
||||
tagRemark = "电池总结果"
|
||||
});
|
||||
//tag1 = new TagDataVOListItem() { tagCode = "WGJA001", tagValue = m.ArrivalBarCode, tagTime = m.OutTime, tagCalculateResult = "Y", tagRemark = "入站条码" }; tdvls.Add(tag1);
|
||||
//tag1 = new TagDataVOListItem() { tagCode = "WGJA002", tagValue = m.DepartureBarCode, tagTime = m.OutTime, tagCalculateResult = "Y", tagRemark = "出站条码" }; tdvls.Add(tag1);
|
||||
//tag1 = new TagDataVOListItem() { tagCode = "WGJA003", tagValue = m.WorkShift, tagTime = m.OutTime, tagCalculateResult = "Y", tagRemark = "班次" }; tdvls.Add(tag1);
|
||||
//tag1 = new TagDataVOListItem() { tagCode = "WGJA004", tagValue = m.OutTime, tagTime = m.OutTime, tagCalculateResult = "Y", tagRemark = "出站时间" }; tdvls.Add(tag1);
|
||||
|
||||
//foreach (var item in m.PLCValDic)
|
||||
//{
|
||||
// // TODO 获取采集项配置
|
||||
// var cfgItem = Global.systemConfig.CollectItemCfgList
|
||||
// .Where(it => it.IsEnable && it.PLCRelAddress == item.Key)
|
||||
// .FirstOrDefault();
|
||||
|
||||
// if (cfgItem == null)
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// // 生成TagDataVoListItem
|
||||
// tdvls.Add(new TagDataVOListItem()
|
||||
// {
|
||||
// tagCode = cfgItem.MesItemCode,
|
||||
// tagValue = item.Value,
|
||||
// tagTime = m.OutTime,
|
||||
// tagCalculateResult = "Y",
|
||||
// tagRemark = cfgItem.MesItemName
|
||||
// });
|
||||
//}
|
||||
|
||||
//tdvls.Add(new TagDataVOListItem()
|
||||
//{
|
||||
// tagCode = "WGJA021",
|
||||
// tagValue = m.Result,
|
||||
// tagTime = m.OutTime,
|
||||
// tagCalculateResult = "Y",
|
||||
// tagRemark = "电池总结果"
|
||||
//});
|
||||
//多个
|
||||
|
||||
pl.tagDataVOList = tdvls;
|
||||
@@ -247,9 +265,6 @@ namespace JY.Inspection.Mes
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 登录
|
||||
#endregion
|
||||
|
||||
public RespArrivalStation PostProductArrivalStationData(ReqArrivalStation req)
|
||||
{
|
||||
if (req == null)
|
||||
|
||||
@@ -194,7 +194,7 @@ namespace JY.Model
|
||||
/// <summary>
|
||||
/// CCD列表(依据采集项参照表添加)
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public Dictionary<int, string> PLCValDic { get; set; } = new Dictionary<int, string>();
|
||||
//[SugarColumn(IsIgnore = true)]
|
||||
//public Dictionary<int, string> PLCValDic { get; set; } = new Dictionary<int, string>();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user