结果接口: 通过属性名与mes编码对应,不使用PLC相对地址
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user