添加项目文件。

This commit is contained in:
liming 蔡
2026-07-14 13:55:17 +08:00
parent 63759495f2
commit 8bbdf78731
335 changed files with 81415 additions and 0 deletions
+58
View File
@@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JY.MES.Entity
{
/// <summary>
/// 检查条码接口参数类
/// </summary>
public class CheckBarcodeParam
{
/// <summary>
/// 数据组集合
/// </summary>
public DataIn data { get; set; }
/// <summary>
/// 资源编号
/// </summary>
public string resourceNo { get; set; }
}
public class DataIn
{
/// <summary>
/// 系统编号
/// </summary>
public string systemCode { get; set; }
/// <summary>
/// 产线编号
/// </summary>
public string houseCode { get; set; }
/// <summary>
/// 条码
/// </summary>
public string skuCode { get; set; }
/// <summary>
/// 设备号
/// </summary>
public string deviceCode { get; set; }
/// <summary>
/// 工序号
/// </summary>
public string processCode { get; set; }
/// <summary>
/// 状态反馈结果
/// </summary>
public string statusCode { get; set; }
/// <summary>
/// 返回说明信息
/// </summary>
public string stautsMessage { get; set; }
}
}
+29
View File
@@ -0,0 +1,29 @@
using JY.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JY.MES.Entity
{
/// <summary>
/// 检查条码接口结果类
/// </summary>
public class CheckBarcodeResult : RequestResult
{
/// <summary>
/// 返回的数据
/// </summary>
public string data { get; set; }
/// <summary>
/// 状态
/// </summary>
public string status { get; set; }
/// <summary>
/// code代码
/// </summary>
public int code { get; set; }
}
}
+44
View File
@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JY.MES.Entity
{
/// <summary>
/// 设备状态上传接口参数类
/// </summary>
public class StatusData
{
/// <summary>
///
/// </summary>
public string deviceNo { get; set; }
/// <summary>
///
/// </summary>
public string deviceState { get; set; }
/// <summary>
///
/// </summary>
public string stateCode { get; set; }
/// <summary>
///
/// </summary>
public string createTime { get; set; }
}
public class EqpStatusParam
{
/// <summary>
///
/// </summary>
public StatusData statusdata { get; set; }
/// <summary>
///
/// </summary>
public string resourceNo { get; set; }
}
}
+28
View File
@@ -0,0 +1,28 @@
using JY.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JY.MES.Entity
{
/// <summary>
/// 设备状态上传接口结果类
/// </summary>
public class EqpStatusResult : RequestResult
{
/// <summary>
/// 返回的数据
/// </summary>
public string data { get; set; }
/// <summary>
/// 状态
/// </summary>
public string status { get; set; }
/// <summary>
/// code代码
/// </summary>
public int code { get; set; }
}
}
+48
View File
@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JY.MES.Entity
{
/// <summary>
/// 报警数据上传接口参数类
/// </summary>
public class AlarmMesData
{
/// <summary>
///
/// </summary>
public string deviceNo { get; set; }
/// <summary>
///
/// </summary>
public string alarmCode { get; set; }
/// <summary>
///
/// </summary>
public string alarmType { get; set; }
/// <summary>
///
/// </summary>
public string alarmName { get; set; }
/// <summary>
///
/// </summary>
public string createTime { get; set; }
}
public class UploadAlarmParam
{
/// <summary>
///
/// </summary>
public AlarmMesData alarmMesData { get; set; }
/// <summary>
///
/// </summary>
public string resourceNo { get; set; }
}
}
+28
View File
@@ -0,0 +1,28 @@
using JY.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JY.MES.Entity
{
/// <summary>
/// 报警数据上传接口结果类
/// </summary>
public class UploadAlarmResult : RequestResult
{
/// <summary>
/// 返回的数据
/// </summary>
public string data { get; set; }
/// <summary>
/// 状态
/// </summary>
public string status { get; set; }
/// <summary>
/// code代码
/// </summary>
public int code { get; set; }
}
}
+421
View File
@@ -0,0 +1,421 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JY.MES.Entity
{
public class Surface1
{
/// <summary>
/// 检测面1设备
/// </summary>
public string device { get; set; }
/// <summary>
///
/// </summary>
public string checkResult { get; set; }
}
public class Surface2
{
/// <summary>
/// 检测面1设备
/// </summary>
public string device { get; set; }
/// <summary>
///
/// </summary>
public string checkResult { get; set; }
}
public class Surface3
{
/// <summary>
/// 检测面1设备
/// </summary>
public string device { get; set; }
/// <summary>
///
/// </summary>
public string checkResult { get; set; }
}
public class Surface4
{
/// <summary>
/// 检测面1设备
/// </summary>
public string device { get; set; }
/// <summary>
///
/// </summary>
public string checkResult { get; set; }
}
public class Surface5
{
/// <summary>
/// 检测面1设备
/// </summary>
public string device { get; set; }
/// <summary>
///
/// </summary>
public string checkResult { get; set; }
}
public class Surface6
{
/// <summary>
/// 检测面1设备
/// </summary>
public string device { get; set; }
/// <summary>
///
/// </summary>
public string checkResult { get; set; }
}
public class Surface7
{
/// <summary>
/// 检测面1设备
/// </summary>
public string device { get; set; }
/// <summary>
///
/// </summary>
public string checkResult { get; set; }
}
public class Surface8
{
/// <summary>
/// 检测面1设备
/// </summary>
public string device { get; set; }
/// <summary>
///
/// </summary>
public string checkResult { get; set; }
}
public class Surface9
{
/// <summary>
/// 检测面1设备
/// </summary>
public string device { get; set; }
/// <summary>
///
/// </summary>
public string checkResult { get; set; }
}
public class Surface10
{
/// <summary>
/// 检测面1设备
/// </summary>
public string device { get; set; }
/// <summary>
///
/// </summary>
public string checkResult { get; set; }
}
public class Surface11
{
/// <summary>
/// 检测面1设备
/// </summary>
public string device { get; set; }
/// <summary>
///
/// </summary>
public string checkResult { get; set; }
}
public class Surface12
{
/// <summary>
/// 检测面1设备
/// </summary>
public string device { get; set; }
/// <summary>
///
/// </summary>
public string checkResult { get; set; }
}
public class Surface13
{
/// <summary>
/// 检测面1设备
/// </summary>
public string device { get; set; }
/// <summary>
///
/// </summary>
public string checkResult { get; set; }
}
public class Surface14
{
/// <summary>
/// 检测面1设备
/// </summary>
public string device { get; set; }
/// <summary>
///
/// </summary>
public string checkResult { get; set; }
}
public class Other
{
/// <summary>
/// 其他设备
/// </summary>
public string device { get; set; }
/// <summary>
///
/// </summary>
public string checkResult { get; set; }
}
public class DataItem
{
#region 原来
/// <summary>
/// 进站时间
/// </summary>
public string inStation { get; set; }
/// <summary>
/// 出站时间
/// </summary>
public string outStation { get; set; }
/// <summary>
/// 外观检测
/// </summary>
public string deviceNo { get; set; }
/// <summary>
/// 电芯条码
/// </summary>
public string cellBarCode { get; set; }
/// <summary>
/// 检测面1结果
/// </summary>
public Surface1 surface1 { get; set; }
/// <summary>
/// 检测面2结果
/// </summary>
public Surface2 surface2 { get; set; }
/// <summary>
///
/// </summary>
public Surface3 surface3 { get; set; }
/// <summary>
///
/// </summary>
public Surface4 surface4 { get; set; }
/// <summary>
///
/// </summary>
public Surface5 surface5 { get; set; }
/// <summary>
///
/// </summary>
public Surface6 surface6 { get; set; }
/// <summary>
///
/// </summary>
public Surface7 surface7 { get; set; }
/// <summary>
///
/// </summary>
public Surface8 surface8 { get; set; }
/// <summary>
///
/// </summary>
public Surface9 surface9 { get; set; }
/// <summary>
///
/// </summary>
public Surface10 surface10 { get; set; }
/// <summary>
///
/// </summary>
public Surface11 surface11 { get; set; }
/// <summary>
///
/// </summary>
public Surface12 surface12 { get; set; }
/// <summary>
///
/// </summary>
public Surface13 surface13 { get; set; }
/// <summary>
///
/// </summary>
public Surface14 surface14 { get; set; }
/// <summary>
///
/// </summary>
public Other other { get; set; }
/// <summary>
/// 电芯状态 正常:100 异常:231
/// </summary>
public int cellState { get; set; }
/// <summary>
/// 错误编码
/// </summary>
public string errorCode { get; set; }
/// <summary>
/// 备注
/// </summary>
public string remark { get; set; }
/// <summary>
/// 是否复测 1复测 0是正常
/// </summary>
public int retest { get; set; }
/// <summary>
/// 班次
/// </summary>
public string workShift { get; set; }
///// <summary>
///// 工序编码
///// </summary>
//public string processCode { get; set; }
#endregion
/// <summary>
/// 系统编号
/// </summary>
public string systemCode { get; set; }
/// <summary>
/// 产线编号
/// </summary>
public string houseCode { get; set; }
/// <summary>
/// 条码
/// </summary>
public string skuCode { get; set; }
/// <summary>
/// 设备号
/// </summary>
public string deviceCode { get; set; }
/// <summary>
/// 工序号
/// </summary>
public string processCode { get; set; }
/// <summary>
/// 电芯结果
/// </summary>
public string testResult { get; set; }
/// <summary>
/// ng代码
/// </summary>
public string ngCode { get; set; }
/// <summary>
/// 工序数据集
/// </summary>
public string processData { get; set; }
/// <summary>
/// 进站时间
/// </summary>
public string inTime { get; set; }
/// <summary>
/// 出站时间
/// </summary>
public string outTime { get; set; }
/// <summary>
/// 参数判定结果
/// </summary>
public string cspdjg { get; set; }
/// <summary>
/// 测试时间
/// </summary>
public string cssj { get; set; }
/// <summary>
/// 测试批次
/// </summary>
public string cspc { get; set; }
/// <summary>
/// 测试结果
/// </summary>
public string csjg { get; set; }
/// <summary>
/// 复测标记
/// </summary>
public string fcbj { get; set; }
/// <summary>
/// 复测次数
/// </summary>
public string fccs { get; set; }
/// <summary>
/// 复测时间
/// </summary>
public string fcsj { get; set; }
/// <summary>
/// 复测原因
/// </summary>
public string fcyy { get; set; }
/// <summary>
/// NG原因
/// </summary>
public string ngyy { get; set; }
/// <summary>
/// NG时间
/// </summary>
public string ngsj { get; set; }
/// <summary>
/// NG位置
/// </summary>
public string ngwz { get; set; }
/// <summary>
/// 环境温度
/// </summary>
public string hjwd { get; set; }
/// <summary>
/// 环境湿度
/// </summary>
public string hjsd { get; set; }
/// <summary>
/// 空气洁净度
/// </summary>
public string kqjjd { get; set; }
/// <summary>
/// 状态反馈结果
/// </summary>
public string statusCode { get; set; }
/// <summary>
/// 返回说明信息
/// </summary>
public string stautsMessage { get; set; }
}
/// <summary>
/// 电芯出站数据
/// </summary>
public class UploadTestDataParam
{
/// <summary>
///
/// </summary>
public List<DataItem> data { get; set; }
/// <summary>
///
/// </summary>
public string resourceNo { get; set; }
}
}
+28
View File
@@ -0,0 +1,28 @@
using JY.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JY.MES.Entity
{
/// <summary>
/// 测试结果上传接口结果类
/// </summary>
public class UploadTestDataResult : RequestResult
{
/// <summary>
/// 返回的数据
/// </summary>
public string data { get; set; }
/// <summary>
/// 状态
/// </summary>
public string status { get; set; }
/// <summary>
/// code代码
/// </summary>
public int code { get; set; }
}
}
+56
View File
@@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JY.MES.FMS
{
public class FMS_Alarm
{
/// <summary>
/// 系统编号
/// </summary>
public string systemCode { get; set; }
/// <summary>
/// 产线编号
/// </summary>
public string houseCode { get; set; }
/// <summary>
/// 设备编号
/// </summary>
public string equipNum { get; set; }
/// <summary>
/// 库位ID
/// </summary>
public string seatId { get; set; }
/// <summary>
/// 采集时间
/// </summary>
public string recordDate { get; set; }
/// <summary>
/// 唯一标识符号
/// </summary>
public string guid { get; set; }
/// <summary>
/// 报警消除时间
/// </summary>
public string alarmEndTime { get; set; }
/// <summary>
/// 报警类型
/// </summary>
public string alarmType { get; set; }
/// <summary>
/// 报警名称
/// </summary>
public string alarmName { get; set; }
/// <summary>
/// 报警开始时间
/// </summary>
public string alarmStartTime { get; set; }
/// <summary>
/// 故障代码
/// </summary>
public string faultCode { get; set; }
}
}
+32
View File
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JY.MES.FMS
{
public class FMS_Materialln
{
/// <summary>
/// 系统编号
/// </summary>
public string systemCode { get; set; }
/// <summary>
/// 产线编号
/// </summary>
public string houseCode { get; set; }
/// <summary>
/// 电芯条码
/// </summary>
public string skuCode { get; set; }
/// <summary>
/// 设备号
/// </summary>
public string deviceCode { get; set; }
/// <summary>
/// 工序号
/// </summary>
public string processCode { get; set; }
}
}
+44
View File
@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JY.MES.FMS
{
public class FMS_Status
{
/// <summary>
/// 系统编号
/// </summary>
public string systemCode { get; set; }
/// <summary>
/// 产线编号
/// </summary>
public string houseCode { get; set; }
/// <summary>
/// 设备编号
/// </summary>
public string equipNum { get; set; }
/// <summary>
/// 库位ID
/// </summary>
public string seatId { get; set; }
/// <summary>
/// 采集时间
/// </summary>
public string recordDate { get; set; }
/// <summary>
/// 设备状态
/// </summary>
public string statusCode { get; set; }
/// <summary>
/// 状态变更时间
/// </summary>
public string uploadTime { get; set; }
/// <summary>
/// 唯一标识符号
/// </summary>
public string guid { get; set; }
}
}
+529
View File
@@ -0,0 +1,529 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace JY.MES.FMS
{
public class MesHelper_EVE
{
/// <summary>
/// 接口地址
/// </summary>
public string UserVerifyUrl = "http://10.6.1.155/core/api/public/equipment/base/user/login/verify";
//public static string InboundUrl = "http://10.6.1.155/core/api/public/in/station/process/true";
//public string OutboundUrl = "http://10.6.1.155/core/api/public/out/station/process/true";
public string ProductParamUrl = "http://10.6.1.155/core/api/public/product/process/param/result";
public string EquipmentStatusUrl = "http://10.6.1.155/core/api/public/eve/pm/eqm/run/status/operation";
public string AlarmStatusUrl = "http://10.6.1.155/core/api/public/equipment/alarm/currency";
public string GetRecipeUrl = "http://10.6.1.155/core/api/public/param/set/request";
public string UnloadRecipeUrl = "http://10.6.1.155/core/api/public/api/public/param/setting/change";
public string 电芯入站 = "http://192.168.1.11:30030/fms/restful/api/v3/process/CheckMaterialStatus";
public string 电芯出站 = "http://192.168.1.11:30030/fms/restful/api/v3/process/MaterialEX";
public string 设备状态 = "http://192.168.1.11:30030/fms/restful/api/v3/device/uploadDeviceStatus";
public string 报警 = "http://192.168.1.11:30030/fms/restful/api/v3/device/uploadDeviceError";
public static string InboundUrl = "http://192.168.1.11:30030/fms/restful/api/v3/process/CheckMaterialStatus";
public static string OutboundUrl = "http://192.168.1.11:30030/fms/restful/api/v3/process/MaterialEX";
public static string StatusUrl = "http://192.168.1.11:30030/fms/restful/api/v3/device/uploadDeviceStatus";
public static string AlarmUrl = "http://192.168.1.11:30030/fms/restful/api/v3/device/uploadDeviceError";
public static string MateriallnStationeUrl = "http://192.168.1.11:30030/fms/restful/api/v3/inventory/materiallnStatione";
/// <summary>
/// 超时
/// </summary>
public int _TimeOut = 3000;
/// <summary>
/// 凭证
/// </summary>
//public Credentials Credentials { get; set; }
MesRequestAndRespondParam mrrp = new MesRequestAndRespondParam();
/// <summary>
/// 初始标记为false(离线文件标记)
/// </summary>
public static bool WriteState { get; set; } = false;
public static List<string> listSource = new List<string>();
///// <summary>
///// 提交登录窗口填写的信息,登录MES
///// </summary>
///// <param name="mParam"></param>
///// <returns></returns>
//public MesRespondParam.MesResult MesPost<T>(T t, int Type) where T : class
//{
// var Start = DateTime.Now;
// MesRespondParam.MesResult _mesResult = new MesRespondParam.MesResult();
// try
// {
// //等待7秒,如果超过7秒未收到MES返回消息,视为超时
// new Task(() =>
// {
// if ((DateTime.Now - Start).TotalMilliseconds > 7000)
// {
// _mesResult.code = "-9999";
// _mesResult.message = "交互超时";
// _mesResult.success = false;
// }
// }).Start();
// var json = JsonHelper.SerializeObject(t);
// if (Type == 0)
// {
// Addlo.WriteEorr($@"【向服务端发送信息】: {Convert.ToString(json)}", "测试日志", "入站服务端数据", Type: "UTF-8");
// }
// else
// {
// SysLog.WriteEorr($@"【向服务端发送信息】: {Convert.ToString(json)}", "测试日志", "出站服务端数据", Type: "UTF-8");
// }
// string jsnstr = PostWebRequest(Type == 0 ? 电芯入站 : 电芯出站, json, Type == 0 ? "入站" : "出站"); //request.GetJsonResponse(UserVerifyUrl, JsonHelper.SerializeObject(mParam));
// _mesResult = JsonHelper.DeserializeJsonToObject<MesRespondParam.MesResult>(jsnstr);
// if (Type == 0)
// {
// SysLog.WriteEorr($@"【接收服务端返回信息】: {Convert.ToString(jsnstr)}", "测试日志", "入站服务端数据", Type: "UTF-8");
// }
// else
// {
// SysLog.WriteEorr($@"【接收服务端返回信息】: {Convert.ToString(jsnstr)}", "测试日志", "出站服务端数据", Type: "UTF-8");
// }
// }
// catch (Exception ex)
// {
// _mesResult.code = "-404";
// _mesResult.message = ex.Message;
// _mesResult.success = false;
// }
// return _mesResult;
//}
/// <summary>
/// 容量分档
/// </summary>
/// <param name="mParam"></param>
/// <returns></returns>
public static MesReturnParam.MesResult FMS_MateriallnStatione(FMS_Materialln mParam)
{
MesReturnParam.MesResult _mesResult = new FMS.MesReturnParam.MesResult();
try
{
string jsnstr = PostWebRequest(MateriallnStationeUrl, Newtonsoft.Json.JsonConvert.SerializeObject(mParam));
_mesResult = Newtonsoft.Json.JsonConvert.DeserializeObject<MesReturnParam.MesResult>(jsnstr);
}
catch (Exception ex)
{
_mesResult.statusCode = -9999;
_mesResult.statusMessage = ex.Message;
}
return _mesResult;
}
/// <summary>
/// 产品进站
/// </summary>
/// <param name="mParam"></param>
/// <returns></returns>
public static MesReturnParam.MesResult MES_Inbound(FMS_In mParam)
{
MesReturnParam.MesResult _mesResult = new FMS.MesReturnParam.MesResult();
try
{
string jsnstr = PostWebRequest(InboundUrl, Newtonsoft.Json.JsonConvert.SerializeObject(mParam));
_mesResult = Newtonsoft.Json.JsonConvert.DeserializeObject<MesReturnParam.MesResult>(jsnstr);
}
catch (Exception ex)
{
_mesResult.statusCode = -9999;
_mesResult.statusMessage = ex.Message;
}
return _mesResult;
}
/// <summary>
/// 产品出站
/// </summary>
/// <param name="mParam"></param>
/// <returns></returns>
public static MesRequestAndRespondParam.MesRespondParam.MesResult MES_Outbound(FMS_Out mParam)
{
MesRequestAndRespondParam.MesRespondParam.MesResult _mesResult = new MesRequestAndRespondParam.MesRespondParam.MesResult();
string jsnstr = PostWebRequest(OutboundUrl, Newtonsoft.Json.JsonConvert.SerializeObject(mParam));
try
{
if (jsnstr.Contains("【链接异常】"))
{
//异常视为离线,如果离线,则将数据保存到本地
SaveOutlineData(jsnstr);
}
_mesResult = Newtonsoft.Json.JsonConvert.DeserializeObject<MesRequestAndRespondParam.MesRespondParam.MesResult>(jsnstr);
}
catch (Exception ex)
{
_mesResult.statusCode = -9999;
_mesResult.statusMessage = ex.Message;
}
return _mesResult;
}
/// <summary>
/// 设备状态上传MES
/// </summary>
/// <param name="mParam"></param>
/// <returns></returns>
public static MesRequestAndRespondParam.MesRespondParam.GetRecipeRespond MES_Status(FMS_Status mParam)
{
//string jsnstr = PostHelper.HttpPostJsonAPI1(StatusUrl, Newtonsoft.Json.JsonConvert.SerializeObject(mParam));
//return Newtonsoft.Json.JsonConvert.DeserializeObject<MesRequestAndRespondParam.MesRespondParam.GetRecipeRespond>(jsnstr);
MesRequestAndRespondParam.MesRespondParam.GetRecipeRespond _mesResult = new MesRequestAndRespondParam.MesRespondParam.GetRecipeRespond();
try
{
string jsnstr = PostWebRequest(StatusUrl, Newtonsoft.Json.JsonConvert.SerializeObject(mParam));
_mesResult = Newtonsoft.Json.JsonConvert.DeserializeObject<MesRequestAndRespondParam.MesRespondParam.GetRecipeRespond>(jsnstr);
}
catch (Exception ex)
{
_mesResult.code = "-9999";
_mesResult.message = ex.Message;
_mesResult.success = "失败";
_mesResult.category = "";
}
return _mesResult;
}
/// <summary>
/// 报警上传MES
/// </summary>
/// <param name="mParam"></param>
/// <returns></returns>
public static MesRequestAndRespondParam.MesRespondParam.GetRecipeRespond MES_Alarm(FMS_Alarm mParam)
{
//string jsnstr = PostHelper.HttpPostJsonAPI1(AlarmUrl, Newtonsoft.Json.JsonConvert.SerializeObject(mParam));
//return Newtonsoft.Json.JsonConvert.DeserializeObject<MesRequestAndRespondParam.MesRespondParam.GetRecipeRespond>(jsnstr);
MesRequestAndRespondParam.MesRespondParam.GetRecipeRespond _mesResult = new MesRequestAndRespondParam.MesRespondParam.GetRecipeRespond();
try
{
string jsnstr = PostWebRequest(AlarmUrl, Newtonsoft.Json.JsonConvert.SerializeObject(mParam));
_mesResult = Newtonsoft.Json.JsonConvert.DeserializeObject<MesRequestAndRespondParam.MesRespondParam.GetRecipeRespond>(jsnstr);
}
catch (Exception ex)
{
_mesResult.code = "-9999";
_mesResult.message = ex.Message;
_mesResult.success = "失败";
_mesResult.category = "";
}
return _mesResult;
}
///// <summary>
///// 加工参数采集
///// </summary>
///// <param name="mParam"></param>
///// <returns></returns>
//public MesRequestAndRespondParam.MesRespondParam.MesResult MES_ProductParaColloctUniversal(MesRequestAndRespondParam.MesRequestParam.ProductDataRequest mParam)
//{
// MesRequestAndRespondParam.MesRespondParam.MesResult _mesResult = new MesRequestAndRespondParam.MesRespondParam.MesResult();
// string jsnstPostWebRequestr = (ProductParamUrl, JsonHelper.SerializeObject(mParam));
// try
// {
// _mesResult = JsonHelper.DeserializeJsonToObject<MesRequestAndRespondParam.MesRespondParam.MesResult>(jsnstr);
// }
// catch (Exception ex)
// {
// _mesResult.code = "-9999";
// _mesResult.message = ex.Message;
// _mesResult.success = false;
// }
// return _mesResult;
//}
/// <summary>
/// 加工参数采集(手动或离线传入上传内容)
/// </summary>
/// <param name="JsString"></param>
/// <returns></returns>
//public MesRequestAndRespondParam.MesRespondParam.MesResult MES_ProductParaColloctUniversal(string JsString)
//{
// MesRequestAndRespondParam.MesRespondParam.MesResult _mesResult = new MesRequestAndRespondParam.MesRespondParam.MesResult();
// try
// {
// string jsnstr = JsString;
// _mesResult = JsonHelper.DeserializeJsonToObject<MesRequestAndRespondParam.MesRespondParam.MesResult>(jsnstr);
// }
// catch (Exception ex)
// {
// _mesResult.code = "-9999";
// _mesResult.message = ex.Message;
// _mesResult.success = false;
// }
// return _mesResult;
//}
///// <summary>
///// 设备状态采集
///// </summary>
///// <param name="mParam"></param>
///// <returns></returns>
//public MesRespondParam.MesResult MES_EquipStatusCollect(MesRequestParam.EquipStatusRequest mParam)
//{
// MesRespondParam.MesResult _mesResult = new MesRespondParam.MesResult();
// try
// {
// string jsnstr = PostWebRequest(EquipmentStatusUrl, JsonHelper.SerializeObject(mParam));
// _mesResult = JsonHelper.DeserializeJsonToObject<MesRespondParam.MesResult>(jsnstr);
// }
// catch (Exception ex)
// {
// _mesResult.code = "-9999";
// _mesResult.message = ex.Message;
// _mesResult.success = false;
// }
// return _mesResult;
//}
///// <summary>
///// 设备报警采集
///// </summary>
///// <param name="mParam"></param>
///// <returns></returns>
//public MesRespondParam.MesResult MES_Alarm(MesRequestParam.AlarmRequest mParam)
//{
// MesRespondParam.MesResult _mesResult = new MesRespondParam.MesResult();
// try
// {
// string jsnstr = PostWebRequest(AlarmStatusUrl, JsonHelper.SerializeObject(mParam));
// _mesResult = JsonHelper.DeserializeJsonToObject<MesRespondParam.MesResult>(jsnstr);
// }
// catch (Exception ex)
// {
// _mesResult.code = "-9999";
// _mesResult.message = ex.Message;
// _mesResult.success = false;
// }
// return _mesResult;
//}
/// <summary>
/// 配方修改上传
/// </summary>
/// <param name="mParam"></param>
/// <returns></returns>
//public MesRespondParam.MesResult MES_UploadRecipe(MesRequestParam.SetRecipeRequest mParam)
//{
// MesRespondParam.MesResult _mesResult = new MesRespondParam.MesResult();
// try
// {
// string jsnstr = PostWebRequest(UnloadRecipeUrl, JsonHelper.SerializeObject(mParam));
// _mesResult = JsonHelper.DeserializeJsonToObject<MesRespondParam.MesResult>(jsnstr);
// }
// catch (Exception ex)
// {
// _mesResult.code = "-9999";
// _mesResult.message = ex.Message;
// _mesResult.success = false;
// }
// return _mesResult;
//}
///// <summary>
///// 配方下载
///// </summary>
///// <param name="mParam"></param>
///// <returns></returns>
//public MesRespondParam.GetRecipeRespond MES_GetRecipe(MesRequestParam.GetRecipeRequest mParam)
//{
// MesRespondParam.GetRecipeRespond _mesResult = new MesRespondParam.GetRecipeRespond();
// try
// {
// string jsnstr = PostWebRequest(GetRecipeUrl, JsonHelper.SerializeObject(mParam));
// _mesResult = JsonHelper.DeserializeJsonToObject<MesRespondParam.GetRecipeRespond>(jsnstr);
// }
// catch (Exception ex)
// {
// _mesResult.code = "-9999";
// _mesResult.message = ex.Message;
// _mesResult.success = false;
// }
// return _mesResult;
//}
#region 公共
/// <summary>
/// Post数据接口
/// </summary>
/// <param name="postUrl">接口地址</param>
/// <param name="paramData">提交json数据</param>
/// <param name="dataEncode">编码方式(Encoding.UTF8)</param>
/// <returns></returns>
public static string PostWebRequest(string postUrl, string paramData, string SockAction = "")
{
string responseContent = string.Empty;
try
{
string TypeName = string.Empty;
if (SockAction.Contains("入站"))
{
TypeName = "入站操作";
}
else
{
TypeName = "出站操作";
}
byte[] byteArray = Encoding.UTF8.GetBytes(paramData); //转化
HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create(new Uri(postUrl));
//webReq.Timeout = _TimeOut;
webReq.Method = "POST";
webReq.ContentType = "application/json;charset=UTF-8";
//webReq.ContentType = "application/x-www-form-urlencoded;charset=UTF-8";
//webReq.ContentLength = byteArray.Length;
if (SockAction.Length > 0)
webReq.Headers.Add("SOAPAction", SockAction);
//if (this.Credentials != null)
{
//(2)设置Headers Authorization
webReq.Headers.Add("Authorization", "Basic " /*+ Convert.ToBase64String(Encoding.UTF8.GetBytes($"{Credentials.UserName}:{Credentials.Password}"))*/);
}
//webReq.CookieContainer = new CookieContainer();
//webReq.ContentType = "application/json;";
////(1)设置请求Credentials
//CredentialCache credentialCache = new CredentialCache();
//credentialCache.Add(new Uri("接口地址"), "Basic", new NetworkCredential("用户名", "密码"));
//webReq.Credentials = credentialCache;
using (Stream reqStream = webReq.GetRequestStream())
{
StreamWriter mySwrite = new StreamWriter(reqStream, Encoding.GetEncoding("UTF-8"));
mySwrite.Write(paramData);//写入参数
mySwrite.Close();
}
using (HttpWebResponse response = (HttpWebResponse)webReq.GetResponse())
{
var code = response.StatusCode.ToString();
//在这里对接收到的页面内容进行处理
using (StreamReader sr = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding("UTF-8")))
{
responseContent = sr.ReadToEnd().ToString();
}
}
}
catch (WebException ex)
{
//SysLog.WriteEorr("【操作异常】:" + ex.Message.ToString() + "---------" + ex.StackTrace.ToString(), "测试日志", "服务端数据");
return ex.Message + "【链接异常】";
}
//catch ( Exception ex)
//{
// return "连接远程服务器出错"; ;
//}
return responseContent;
}
/// <summary>
///
/// </summary>
/// <param name="url">目标url</param>
/// <param name="strPost">要发送的post字符串</param>
/// <returns>接收后返回值</returns>
public string PostXML(string url, string strPost)
{
string result = string.Empty;
//生成文件流
byte[] buffer = Encoding.UTF8.GetBytes(strPost);
//向流中写字符串
StreamWriter mywriter = null;
//根据url创建请求对象
HttpWebRequest objrequest = (HttpWebRequest)WebRequest.Create(url);
//设置发送方式
objrequest.Method = "POST";
//提交长度
objrequest.ContentLength = buffer.Length;
//发送内容格式
objrequest.ContentType = "text/xml;charset=UTF-8";
objrequest.Timeout = _TimeOut;
try
{
mywriter = new StreamWriter(objrequest.GetRequestStream());
mywriter.Write(strPost);
mywriter.Close();
HttpWebResponse objresponse;
try
{
//读取服务器返回信息
objresponse = (HttpWebResponse)objrequest.GetResponse();
}
catch (WebException EX)
{
objresponse = (HttpWebResponse)EX.Response;
}
using (StreamReader sr = new StreamReader(objresponse.GetResponseStream()))
{
result = sr.ReadToEnd();
sr.Close();
}
}
catch (Exception ex)
{
result = "发送文件流失败!";
}
return result;
}
#endregion
/// <summary>
/// 当MES离线时,保存上传数据(MrLin)
/// </summary>
/// <param name="requestJson"></param>
private static void SaveOutlineData(string requestJson)
{
//每次创建一个新的文件文本
string logSite = $@"D:\MESData\ErrData{DateTime.Now.ToString("ffffff")}.txt";
try
{
WriteState = false;
//防止重复数据存入本地的判断
if (!listSource.Contains(requestJson))
{
//SysLog.WriteContext(requestJson, logSite);
//写入记录之后将数据存入到本地结合,防止重复数据存入到本地文件
listSource.Add(requestJson);
}
//文件写完标记
WriteState = true;
}
catch (Exception err)
{
//string str = SysLog.ReadContext(logSite) + "\r\n" + "";
WriteState = true;
}
}
}
}
+564
View File
@@ -0,0 +1,564 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JY.MES.FMS
{
public class MesRequestAndRespondParam
{
/// <summary>
/// MES请求对象
/// </summary>
public class MesRequestParam
{
#region 登录
/// <summary>
/// 操作员登录参数
/// </summary>
public class UserVerifyRequest
{
/// <summary>
/// :站点;必填
/// </summary>
public string siteCode { get; set; }
/// <summary>
/// :设备;必填
/// </summary>
public string equipNum { get; set; }
/// <summary>
/// 产线编号
/// </summary>
public string lineCode { get; set; }
/// <summary>
/// :用户;必填
/// </summary>
public string userName { get; set; }
/// <summary>
/// :密码;必填
/// </summary>
public string passWord { get; set; }
}
#endregion
#region 进站
/// <summary>
/// 产品进站信息
/// </summary>
public class InStationRequest
{
/// <summary>
/// 系统编号(上位机代号);必填
/// </summary>
public string systemCode { get; set; }
/// <summary>
/// 产线编号
/// </summary>
public string houseCode { get; set; }
/// <summary>
/// :设备号;必填
/// </summary>
public string deviceCode { get; set; }
/// <summary>
/// :工序号;必填
/// </summary>
public string processCode { get; set; }
/// <summary>
/// :工序号;必填
/// </summary>
public string skuCode { get; set; }
/// <summary>
/// :电芯结果;必填
/// </summary>
public string testResult { get; set; }
/// <summary>
/// :NG代码;必填
/// </summary>
public string ngCode { get; set; }
/// <summary>
/// :工序数据集;必填
/// </summary>
public string processData { get; set; }
}
#endregion
#region 出站
/// 产品出站参数
/// </summary>
public class OutStationRequest
{
/// <summary>
/// <summary>
/// :站点;必填
/// </summary>
public string siteCode { get; set; }
/// <summary>
/// 产线编号
/// </summary>
public string lineCode { get; set; }
/// <summary>
/// :设备;必填
/// </summary>
public string equipNum { get; set; }
/// <summary>
/// :用户;必填
/// </summary>
public string userName { get; set; }
/// <summary>
///工单生成的物料号
/// </summary>
public string materialCode { get; set; }
/// <summary>
/// :生产类型;(非必输)
/// </summary>
public string productType { get; set; }
/// <summary>
/// :完工数量;(非必输)
/// </summary>
public string completeQty { get; set; }
/// <summary>
/// 托盘码
/// </summary>
public string containerCode { get; set; }
/// <summary>
/// 1:通用出站(默认);2:其他待定;
/// </summary>
public int type { get; set; } = 1;
/// <summary>
/// 产品信息结构体
/// </summary>
public List<OutStationVO1> assembleLineList;
}
/// <summary>
/// 出站产品信息结构体
/// </summary>
public struct OutStationVO1
{
/// <summary>
/// 产品条码
/// </summary>
public string identification { get; set; }
/// <summary>
/// 质量状态
/// </summary>
public string qualityStatus { get; set; }
/// <summary>
/// 关联条码:组装段超声焊专用,其他工序可为空
/// </summary>
public string qrCode { get; set; }
/// <summary>
/// NG错误信息:质量状态OK不返回,质量状态NG返回具体报错消息
/// </summary>
public string ngMessage { get; set; }
}
#endregion
#region 产品加工参数
/// <summary>
/// 产品结果参数:单进单出
/// </summary>
public class ProductDataRequest
{
public string equipNum { get; set; }
public string type { get; set; }
public string payload { get; set; }
}
public class payloadDD
{
/// <summary>
/// 工厂
/// </summary>
public string siteCode { get; set; }
/// <summary>
/// 产线
/// </summary>
public string lineCode { get; set; }
/// <summary>
/// 物料
/// </summary>
public string materialCode { get; set; }
/// <summary>
/// 用户
/// </summary>
public string userName { get; set; }
/// <summary>
/// 小车号
/// </summary>
public string carCode { get; set; }
/// <summary>
/// 采集时间
/// </summary>
public string recordDate { get; set; }
/// <summary>
/// 条码数量
/// </summary>
public int qty { get; set; }
/// <summary>
/// 托盘码
/// </summary>
public string containerCode { get; set; }
public identificationParaDD identification { get; set; }
public List<tagDataVOPara> tagDataVOList { get; set; }
}
public class identificationParaDD
{
/// <summary>
/// 条码
/// </summary>
public string identification { get; set; }
/// <summary>
/// 质量状态Y/N
/// </summary>
public string qualityStatus { get; set; }
}
public class tagDataVOPara
{
public string tagCode { get; set; } = "0";
public string tagValue { get; set; } = "0";
public string tagTime { get; set; }
/// <summary>
/// 采集项判断结果(Y/N)
/// </summary>
public string tagCalculateResult { get; set; }
}
#endregion
#region 设备状态
/// <summary>
/// 设备状态参数
/// </summary>
public class EquipStatusRequest
{
/// <summary>
/// :站点;必填
/// </summary>
public string siteCode { get; set; }
public string lineCode { get; set; }
/// <summary>
/// :设备;必填
/// </summary>
public string equipNum { get; set; }
/// <summary>
/// :登录账号
/// </summary>
public string userName { get; set; }
public string materialCode { get; set; }
/// <summary>
/// 采集时间(2019-09-11 13:13:13)(非必输)
/// </summary>
public string recordDate { get; set; }
/// <summary>
/// 设备状态
/// </summary>
public string statusCode { get; set; }
/// <summary>
/// 状态变更时间
/// </summary>
public string uploadTime { get; set; }
/// <summary>
/// 故障代码(行,可以不传,可以多条,只有设备状态为故障时才需要传输)
/// </summary>
public List<faultCodes> faultCodeList { get; set; }
}
/// <summary>
/// 设备运行状态
/// </summary>
public struct faultCodes
{
public string faultCode { get; set; }
}
#endregion
#region 报警状态
public class AlarmRequest
{
/// <summary>
/// :站点;必填
/// </summary>
public string siteCode { get; set; }
public string lineCode { get; set; }
/// <summary>
/// :设备;必填
/// </summary>
public string equipNum { get; set; }
/// <summary>
/// :登录账号
/// </summary>
public string userName { get; set; }
public string materialCode { get; set; }
/// <summary>
/// 采集时间(2019-09-11 13:13:13)(非必输)
/// </summary>
public string recordDate { get; set; }
/// <summary>
/// 唯一标识符号
/// </summary>
public string guid { get; set; }
public List<AlarmLineList> alarmLineList { get; set; }
}
public struct AlarmLineList
{
/// <summary>
/// 报警消除时间
/// </summary>
public string alarmEndTime { get; set; }
/// <summary>
/// 报警类型
/// </summary>
public string alarmType { get; set; }
/// <summary>
/// 报警名称
/// </summary>
public string alarmName { get; set; }
/// <summary>
/// 报警开始时间
/// </summary>
public string alarmStartTime { get; set; }
/// <summary>
/// 故障代码
/// </summary>
public string faultCode { get; set; }
}
#endregion
#region 配方参数修改
/// <summary>
/// 参数修改
/// </summary>
public class SetRecipeRequest
{
public string siteCode { get; set; }
public string lineCode { get; set; }
public string equipNum { get; set; }
public string userName { get; set; }
public string materialCode { get; set; }
/// <summary>
/// 变更时间
/// </summary>
public string changeTime { get; set; }
/// <summary>
/// 数据组编码
/// </summary>
public string tagGroupCode { get; set; }
/// <summary>
/// 数据组描述
/// </summary>
public string tagGroupDescription { get; set; }
/// <summary>
/// 数据项数组
/// </summary>
public List<tagList> tagList { get; set; }
}
/// <summary>
/// 配方数据项数组对象
/// </summary>
public struct tagList
{
/// <summary>
/// 数据项编码
/// </summary>
public string tagCode { get; set; }
/// <summary>
/// 变更前计量单位
/// </summary>
public string unitBefore { get; set; }
/// <summary>
/// 变更前标准值
/// </summary>
public string standardValueBefore { get; set; }
/// <summary>
/// 变更前符合值
/// </summary>
public string trueValueBefore { get; set; }
/// <summary>
/// 变更前不符合值
/// </summary>
public string falseValueBefore { get; set; }
/// <summary>
/// 变更前最小值
/// </summary>
public double minValueBefore { get; set; }
/// <summary>
/// 变更前最大值
/// </summary>
public double maxValueBefore { get; set; }
/// <summary>
/// 变更后计量单位
/// </summary>
public string unitAfter { get; set; }
/// <summary>
/// 变更后标准值
/// </summary>
public string standardValueAfter { get; set; }
/// <summary>
/// 变更后符合值
/// </summary>
public string trueValueAfter { get; set; }
/// <summary>
/// 变更后不符合值
/// </summary>
public string falseValueAfter { get; set; }
/// <summary>
/// 变更后最小值
/// </summary>
public double minValueAfter { get; set; }
/// <summary>
/// 变更后最大值
/// </summary>
public double maxValueAfter { get; set; }
}
#endregion
#region 配方请求
/// <summary>
/// 配方请求
/// </summary>
public class GetRecipeRequest
{
public string siteCode { get; set; }
public string lineCode { get; set; }
public string equipNum { get; set; }
public string userName { get; set; }
public string materialCode { get; set; }
}
#endregion
}
/// <summary>
/// MES返回对象
/// </summary>
public class MesRespondParam
{
#region 通用返回
/// <summary>
/// Mes返回信息对象{"statusCode":0,"statusMessage": "该设备111找不到,请检查!"}
/// </summary>
public class MesResult
{
/// <summary>
/// 返回信息代码 0:成功
/// </summary>
public int statusCode { get; set; }
/// <summary>
/// 返回信息
/// </summary>
public string statusMessage { get; set; }
}
#endregion
#region 设备状态数据返回
/// <summary>
/// 设备状态MES返回参数
/// </summary>
public class GetRecipeRespond
{
/// <summary>
/// 错误代码
/// </summary>
public string code { get; set; }
/// <summary>
/// 成功标识
/// </summary>
public string success { get; set; }
/// <summary>
/// 数据处理消息
/// </summary>
public string message { get; set; }
/// <summary>
/// 报错消息类型
/// </summary>
public string category { get; set; }
}
#region 屏蔽
public struct rows
{
/// <summary>
/// 数据组编码
/// </summary>
public string tagGroupCode { get; set; }
/// <summary>
/// 数据组描述
/// </summary>
public string tagGroupDescription { get; set; }
/// <summary>
/// 数据项数组
/// </summary>
public List<tagList> tagList { get; set; }
}
public struct tagList
{
/// <summary>
/// 数据项编码
/// </summary>
public string tagCode { get; set; }
/// <summary>
/// 数据项描述
/// </summary>
public string tagDescription { get; set; }
/// <summary>
/// 数据项备注
/// </summary>
public string tagRemark { get; set; }
/// <summary>
/// 数据类型
/// </summary>
public string valueType { get; set; }
/// <summary>
/// 计量单位
/// </summary>
public string unit { get; set; }
/// <summary>
/// 符合值
/// </summary>
public double trueValue { get; set; }
/// <summary>
/// 不符合值
/// </summary>
public double falseValue { get; set; }
/// <summary>
/// 最小值
/// </summary>
public double minValue { get; set; }
/// <summary>
/// 最大值
/// </summary>
public double maxValue { get; set; }
/// <summary>
/// 标准值
/// </summary>
public double standardValue { get; set; }
}
#endregion
#endregion
}
}
}
+24
View File
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JY.MES.FMS
{
public class MesReturnParam
{
public class MesResult
{
/// <summary>
/// 返回信息代码 0:成功
/// </summary>
public int statusCode { get; set; }
/// <summary>
/// 返回信息
/// </summary>
public string statusMessage { get; set; }
}
}
}
+32
View File
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JY.MES.FMS
{
public class FMS_In
{
/// <summary>
/// 系统编号
/// </summary>
public string systemCode { get; set; }
/// <summary>
/// 产线编号
/// </summary>
public string houseCode { get; set; }
/// <summary>
/// 电芯条码
/// </summary>
public string skuCode { get; set; }
/// <summary>
/// 设备号
/// </summary>
public string deviceCode { get; set; }
/// <summary>
/// 工序号
/// </summary>
public string processCode { get; set; }
}
}
+101
View File
@@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JY.MES.FMS
{
public class FMS_Out
{
public string systemCode { get; set; }
public string houseCode { get; set; }
public string skuCode { get; set; }
public string deviceCode { get; set; }
public string processCode { get; set; }
public string testResult { get; set; }
public string ngCode { get; set; }
public processData processData { get; set; }
}
public class processData
{
/// <summary>
/// 结果
/// </summary>
public string testResult { get; set; }
/// <summary>
/// 进站时间;必填
/// </summary>
public string inTime { get; set; }
/// <summary>
/// 出站时间;必填
/// </summary>
public string outTime { get; set; }
/// <summary>
/// 参数判定结果;必填
/// </summary>
public string cspdjg { get; set; }
/// <summary>
/// 测试时间;必填
/// </summary>
public string cssj { get; set; }
/// <summary>
/// 测试批次;必填
/// </summary>
public string cspc { get; set; }
/// <summary>
/// 测试结果;必填
/// </summary>
public string csjg { get; set; }
/// <summary>
/// 复测标记;必填
/// </summary>
public string fcbj { get; set; }
/// <summary>
/// 复测次数;必填
/// </summary>
public string fccs { get; set; }
/// <summary>
/// 复测时间;必填
/// </summary>
public string fcsj { get; set; }
/// <summary>
/// 复测原因;必填
/// </summary>
public string fcyy { get; set; }
/// <summary>
/// NG原因;必填
/// </summary>
public string ngyy { get; set; }
/// <summary>
/// NG时间;必填
/// </summary>
public string ngsj { get; set; }
/// <summary>
/// NG位置;必填
/// </summary>
public string ngwz { get; set; }
/// <summary>
/// 环境温度;必填
/// </summary>
public string hjwd { get; set; }
/// <summary>
/// 环境湿度;必填
/// </summary>
public string hjsd { get; set; }
/// <summary>
/// 空气洁净度;必填
/// </summary>
public string kqjjd { get; set; }
/// <summary>
/// 班次
/// </summary>
public string workShift { get; set; }
}
}
+87
View File
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{168C8644-3975-450D-94D2-29D21C135C16}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>JY.MES</RootNamespace>
<AssemblyName>JY.MES</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\..\JY.Inspection\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Entity\UploadAlarmParam.cs" />
<Compile Include="Entity\UploadTestDataParam.cs" />
<Compile Include="Entity\UploadAlarmResult.cs" />
<Compile Include="Entity\UploadTestDataResult.cs" />
<Compile Include="Entity\CheckBarcodeResult.cs" />
<Compile Include="Entity\CheckBarcodeParam.cs" />
<Compile Include="Entity\EqpStatusResult.cs" />
<Compile Include="Entity\EqpStatusParam.cs" />
<Compile Include="FMS\FMS_Alarm.cs" />
<Compile Include="FMS\FMS_Materialln.cs" />
<Compile Include="FMS\FMS_Status.cs" />
<Compile Include="FMS\MesHelper_EVE.cs" />
<Compile Include="FMS\MesRequestAndRespondParam.cs" />
<Compile Include="FMS\MesReturnParam.cs" />
<Compile Include="FMS\Model\FMS_In.cs" />
<Compile Include="FMS\Model\FMS_Out.cs" />
<Compile Include="MESApiHelper.cs" />
<Compile Include="MesResponse.cs" />
<Compile Include="MES\GradingParam.cs" />
<Compile Include="MES\ProductResultParameters.cs" />
<Compile Include="MES\ReqArrivalStation.cs" />
<Compile Include="MES\ReqExitStation.cs" />
<Compile Include="MES\RespArrivalStation.cs" />
<Compile Include="MES\RespExitStation.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\JY.Model\JY.Model.csproj">
<Project>{F7DB3A93-FCA2-479B-8B2E-380116AAE9FC}</Project>
<Name>JY.Model</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+55
View File
@@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JY.MES.MES
{
/// <summary>
/// 获取电池竖表采集项值 分档查询
/// </summary>
public class GradingParam
{
/// <summary>
/// 工厂代码
/// </summary>
public string siteCode { get; set; }
/// <summary>
/// 产线名称
/// </summary>
public string lineCode { get; set; }
/// <summary>
/// 设备编码
/// </summary>
public string equipCode { get; set; }
/// <summary>
/// 物料编码
/// </summary>
public string materialCode { get; set; }
/// <summary>
/// 采集时间
/// </summary>
public string recordDate { get; set; }
/// <summary>
/// 条码数量
/// </summary>
public int qty { get; set; }
/// <summary>
/// 操作员
/// </summary>
public string userName { get; set; }
/// <summary>
/// 托盘码
/// </summary>
public string containerCode { get; set; }
/// <summary>
/// 条码数组
/// </summary>
public List<string> materiallotCodeList { get; set; }
}
}
+118
View File
@@ -0,0 +1,118 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JY.MES.MES
{
/// <summary>
/// 结果加工参数
/// </summary>
public class ProductResultParameters
{
/// <summary>
/// 设备编号
/// </summary>
public string equipNum { get; set; }
/// <summary>
/// 类型 单进整出:DZ 整进整出:ZZ 单进单出:DD 未传时默认按照ZZ进行数据解析
/// </summary>
public string type { get; set; }
/// <summary>
/// 设备数据
/// </summary>
public string payload { get; set; }
}
public class Payload
{
/// <summary>
/// 工厂代码
/// </summary>
public string siteCode { get; set; }
/// <summary>
/// 产线编号
/// </summary>
public string lineCode { get; set; }
/// <summary>
/// 员工账号
/// </summary>
public string userName { get; set; }
/// <summary>
/// 物料编码 工单产成品物料号
/// </summary>
public string materialCode { get; set; }
/// <summary>
/// 小车号 装载电池的小车编号
/// </summary>
public string carCode { get; set; }
/// <summary>
/// 补录 是否属于补录数据(BL=补录,JS=及时上传)
/// </summary>
public string collection { get; set; }
/// <summary>
/// 采集时间 数据的采集时间
/// </summary>
public string recordDate { get; set; }
/// <summary>
/// 条码数量 传入条码的个数
/// </summary>
public int qty { get; set; }
/// <summary>
/// 装载电池的托盘编号
/// </summary>
public string containerCode { get; set; }
/// <summary>
/// 条码对象
/// </summary>
public IdentificationItem identification { get; set; }
/// <summary>
/// 采集数组
/// </summary>
public List<TagDataVOListItem> tagDataVOList { get; set; }
}
/// <summary>
/// 条码对象
/// </summary>
public class IdentificationItem
{
/// <summary>
/// 条码
/// </summary>
public string identification { get; set; }
/// <summary>
/// 质量状态 各产品所有参数的整体判断结果(Y/N)
/// </summary>
public string qualityStatus { get; set; }
}
/// <summary>
/// 采集对象
/// </summary>
public class TagDataVOListItem
{
/// <summary>
/// 设备每个采集项规定的编号
/// </summary>
public string tagCode { get; set; }
/// <summary>
/// 采集值
/// </summary>
public string tagValue { get; set; }
/// <summary>
/// 采集项采集时间
/// </summary>
public string tagTime { get; set; }
/// <summary>
/// 各产品所有参数的整体判断结果(Y/N)
/// </summary>
public string tagCalculateResult { get; set; }
/// <summary>
/// 采集项描述
/// </summary>
public string tagRemark { get; set; }
}
}
+50
View File
@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JY.MES.MES
{
/// <summary>
/// 产品进站信息
/// </summary>
public class ReqArrivalStation
{
/// <summary>
/// 工厂代码
/// </summary>
public string SiteCode { get; set; }
/// <summary>
/// 产线编号
/// </summary>
public string LineCode { get; set; }
/// <summary>
/// 设备编号
/// </summary>
public string EquipNum { get; set; }
/// <summary>
/// 物料编码
/// </summary>
public string MaterialCode { get; set; }
/// <summary>
/// 员工账号
/// </summary>
public string UserName { get; set; }
/// <summary>
/// 成品条码
/// </summary>
public string Identification { get; set; }
/// <summary>
/// 产品类型
/// </summary>
public string ProductType { get; set; }
}
}
+72
View File
@@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JY.MES.MES
{
/// <summary>
/// 产品出站
/// </summary>
public class ReqExitStation
{
/// <summary>
/// 工厂代码
/// </summary>
public string SiteCode { get; set; }
/// <summary>
/// 产线编号
/// </summary>
public string LineCode { get; set; }
/// <summary>
/// 设备编号
/// </summary>
public string EquipNum { get; set; }
/// <summary>
/// 员工账号
/// </summary>
public string UserName { get; set; }
/// <summary>
/// 托盘码,没有托盘码可为空;A22超声波终焊作为顶盖码;
/// </summary>
public string ContainerCode { get; set; }
/// <summary>
/// 行信息
/// </summary>
public List<AssembleLine> AssembleLineList { get; set; }
}
public class AssembleLine
{
/// <summary>
/// 产品条码,A22超声波终焊作为蓝胶码;
/// </summary>
public string Identification { get; set; }
/// <summary>
/// 质量状态
/// </summary>
public string QualityStatus { get; set; }
/// <summary>
/// 关联条码,组装段超声焊专用,其他工序可为空
/// </summary>
public string QrCode { get; set; }
/// <summary>
/// NG编码,质量状态OK不返回,质量状态NG返回具体报错编码
/// </summary>
public string[] NgCode { get; set; }
/// <summary>
/// NG错误信息,质量状态OK不返回,质量状态NG返回具体报错消息
/// </summary>
public string NgMessage { get; set; }
}
}
+34
View File
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JY.MES.MES
{
/// <summary>
/// 产品进站响应信息
/// </summary>
public class RespArrivalStation
{
/// <summary>
/// 错误代码,成功不返回
/// </summary>
public string Code { get; set; }
/// <summary>
/// 成功标识,false失败 true 成功
/// </summary>
public bool Success { get; set; }
/// <summary>
/// 数据处理消息,成功不返回
/// </summary>
public string Message { get; set; }
/// <summary>
/// 报错消息类型 A:停线、B:排出、C:忽略(需警示)
/// </summary>
public string Category { get; set; }
}
}
+15
View File
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JY.MES.MES
{
/// <summary>
/// 产品出站响应信息
/// </summary>
public sealed class RespExitStation : RespArrivalStation
{
}
}
+41
View File
@@ -0,0 +1,41 @@
using JY.MES.Entity;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Runtime.Serialization.Json;
using System.Text;
using System.Threading.Tasks;
using System.Web.Script.Serialization;
namespace JY.MES
{
/// <summary>
/// MES接口类
/// </summary>
public class MESApiHelper
{
public static string HttpPostJsonAPI(string url, string strJosnData, double MesRequestTime)
{
MesResponse mesResponse = new MesResponse();
try
{
StringContent stringContent = new StringContent(strJosnData, Encoding.UTF8, "application/json");
return new HttpClient()
{
Timeout = TimeSpan.FromSeconds(MesRequestTime)
}.PostAsync(url, (HttpContent)stringContent).Result.Content.ReadAsStringAsync().Result;
}
catch (Exception ex)
{
mesResponse.success = false;
mesResponse.message = $"massage:[{ex.InnerException}],mes: [MES反馈超时或无法访间MES服务器]";
mesResponse.error = 99;
return JsonConvert.SerializeObject(mesResponse);
}
}
}
}
+65
View File
@@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static JY.MES.FMS.MesRequestAndRespondParam.MesRespondParam;
namespace JY.MES
{
public class MesResponse
{
/// <summary>
/// 异常代码(0:正常 9:解析异常 99:MES反馈超时或无法访问MES服务器)
/// </summary>
public int error { get; set; }
/// <summary>
/// 数据处理消息 成功不返回
/// </summary>
public string message { get; set; }
/// <summary>
/// 错误代码 错误代码,成功不返回
/// </summary>
public string code { get; set; }
/// <summary>
/// 报错消息类型 A=停线,B=排出,C=忽略(需警示)
/// </summary>
public string category { get; set; }
/// <summary>
/// 条码及档位结果信息
/// </summary>
public List<rowsListItem> rows { get; set; }
/// <summary>
/// 成功标识
/// </summary>
public bool success { get; set; }
/// <summary>
/// rows列表中数据总条数
/// </summary>
public int total { get; set; }
public class rowsListItem
{
/// <summary>
/// 电池条码
/// </summary>
public string identification { get; set; }
/// <summary>
/// 电池等级
/// </summary>
public string level { get; set; }
/// <summary>
/// 电池挡位
/// </summary>
public string rank { get; set; }
public object passage { get; set; }
public object message { get; set; }
}
}
}
+36
View File
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("JY.MES")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JY.MES")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("168c8644-3975-450d-94d2-29d21c135c16")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net452" />
<package id="NModbus4" version="2.1.0" targetFramework="net452" />
</packages>