MVP!
This commit is contained in:
@@ -0,0 +1,176 @@
|
||||
|
||||
using System.Data.SqlClient;
|
||||
using System.Data;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using DataLinkMesWork;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using Opc.Ua;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MisDataFunDll
|
||||
{
|
||||
public partial class MisDataFun
|
||||
{
|
||||
|
||||
public static void GetApiAuth(string apiName, out string Username, out string Password, out int ApiTimeout, out string ApiUrl, out string code, out string message)
|
||||
{
|
||||
DataTable dt = new DataTable();
|
||||
Username = "";
|
||||
Password = "";
|
||||
ApiTimeout = 50000;
|
||||
ApiUrl = "";
|
||||
code = "99998";
|
||||
message = "MOM_基础数据_接口列表_获取基本参数_出错";
|
||||
try
|
||||
{
|
||||
string produceName = "MOM_基础数据_接口列表_获取基本参数";
|
||||
SqlParameter[] thisParms = new SqlParameter[1];
|
||||
thisParms[0] = new System.Data.SqlClient.SqlParameter("@接口名称", apiName);
|
||||
if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt))
|
||||
{
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
ApiTimeout = Convert.ToInt32(dt.Rows[0]["超时时间"]);
|
||||
Username = dt.Rows[0]["授权账号"].ToString();
|
||||
Password = dt.Rows[0]["授权密码"].ToString();
|
||||
ApiUrl = dt.Rows[0]["访问地址"].ToString();
|
||||
code = "0";
|
||||
message = "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
message = err.Message.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void GetApiParams(string apiName, string opName, out string code, out string message, out DataTable dt)
|
||||
{
|
||||
dt = new DataTable();
|
||||
code = "99998";
|
||||
message = "获取基本参数出错!";
|
||||
try
|
||||
{
|
||||
string produceName = "MOM_基础数据_接口参数_获取基本参数";
|
||||
SqlParameter[] thisParms = new SqlParameter[1];
|
||||
thisParms[0] = new System.Data.SqlClient.SqlParameter("@接口名称", apiName);
|
||||
if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt))
|
||||
{
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
code = "0";
|
||||
message = "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
message = err.Message.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public static void GetApiParams_operation(string opName, out string operation, out string resource, out string code, out string message)
|
||||
{
|
||||
DataTable dt = new DataTable();
|
||||
operation = "";
|
||||
resource = "";
|
||||
code = "99997";
|
||||
message = "获取工位operation与resource失败!";
|
||||
try
|
||||
{
|
||||
string produceName = "MOM_基础数据_接口参数_获取基本参数_工位代码";
|
||||
SqlParameter[] thisParms = new SqlParameter[1];
|
||||
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
|
||||
if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt))
|
||||
{
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
operation = dt.Rows[0]["operation"].ToString();
|
||||
resource = dt.Rows[0]["resource"].ToString();
|
||||
code = "0";
|
||||
message = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public static void GetApiEnable(string apiName, string opName, string sfc, out string enable, out DataTable dt)
|
||||
{
|
||||
enable = "0";
|
||||
dt = new DataTable();
|
||||
try
|
||||
{
|
||||
string produceName = "MOM_基础数据_接口列表_获取接口状态";
|
||||
SqlParameter[] thisParms = new SqlParameter[3];
|
||||
thisParms[0] = new System.Data.SqlClient.SqlParameter("@接口名称", apiName);
|
||||
thisParms[1] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
|
||||
thisParms[2] = new System.Data.SqlClient.SqlParameter("@EngineID", sfc);
|
||||
if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt))
|
||||
{
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
enable = dt.Rows[0]["接口状态"].ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public static void GetApiStatus_EngineID(string apiName, string opName, string sfc, out string initCode, out string initTime)
|
||||
{
|
||||
initCode = "99999"; // 非0都是 未成功进站/出站
|
||||
initTime = ""; //
|
||||
try
|
||||
{
|
||||
string produceName = "MOM_接口列表_MOBY_获取接口状态";
|
||||
SqlParameter[] thisParms = new SqlParameter[3];
|
||||
thisParms[0] = new System.Data.SqlClient.SqlParameter("@接口名称", apiName);
|
||||
thisParms[1] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
|
||||
thisParms[2] = new System.Data.SqlClient.SqlParameter("@工件编号", sfc);
|
||||
if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out DataTable dt))
|
||||
{
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
initCode = dt.Rows[0]["initCode"].ToString();
|
||||
initTime = dt.Rows[0]["initTime"].ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public static void RecordApiContent(string apiName, string opName, string sfc, string requestTime, string requestContent, string responseTime, string totalTime, string code, string message)
|
||||
{
|
||||
try
|
||||
{
|
||||
string produceName = "MOM_接口_Moby_更新";
|
||||
SqlParameter[] thisParms = new SqlParameter[9];
|
||||
thisParms[0] = new SqlParameter("@接口名称", apiName);
|
||||
thisParms[1] = new SqlParameter("@工位号", opName);
|
||||
thisParms[2] = new SqlParameter("@发动机号", sfc);
|
||||
thisParms[3] = new SqlParameter("@请求时间", requestTime);
|
||||
thisParms[4] = new SqlParameter("@请求内容", requestContent);
|
||||
thisParms[5] = new SqlParameter("@返回时间", responseTime);
|
||||
thisParms[6] = new SqlParameter("@返回代码", code);
|
||||
thisParms[7] = new SqlParameter("@返回内容", message);
|
||||
thisParms[8] = new SqlParameter("@累积用时", totalTime);
|
||||
DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out DataTable dt);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,299 @@
|
||||
|
||||
using DataLinkMesWork1;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace MisDataFunDll
|
||||
{
|
||||
public partial class MisDataFun
|
||||
{
|
||||
public static DataTable BaseData_tagTable_TagName()
|
||||
{
|
||||
DataTable dt = null;
|
||||
string sql;
|
||||
sql = "SELECT distinct[TagName],[变量类型代码] FROM[MES_基本变量_原始数据] ";
|
||||
DataAccess.ExecuteDataTable(sql, out dt);
|
||||
return dt;
|
||||
}
|
||||
|
||||
public static DataTable GetMesServerCodeFromMIS()
|
||||
{
|
||||
DataTable dt;
|
||||
string sql;
|
||||
sql = "exec MES_计划BOM_工位与名称_查询应用程序";
|
||||
DataAccess.ExecuteDataTable(sql, out dt);
|
||||
return dt;
|
||||
}
|
||||
|
||||
public static DataTable dt_Signal()
|
||||
{
|
||||
DataTable dt;
|
||||
string sql;
|
||||
sql = "SELECT * FROM [MES_基本变量_原始数据]";
|
||||
DataAccess.ExecuteDataTable(sql, out dt);
|
||||
return dt;
|
||||
}
|
||||
|
||||
public static DataTable dt_Device()
|
||||
{
|
||||
DataTable dt;
|
||||
string sql;
|
||||
sql = "SELECT * FROM [MES_基本变量设备类型对应表]";
|
||||
DataAccess.ExecuteDataTable(sql, out dt);
|
||||
return dt;
|
||||
}
|
||||
|
||||
public static DataTable dt_TagTypeDataType()
|
||||
{
|
||||
DataTable dt;
|
||||
string sql;
|
||||
sql = "SELECT TOP (1000) [序号],[变量类型],[TagTypeDataType],[TagName],[变量类型代码],[TagTypeChange],[MesTagTypeChange],[WebTagTypeChange],[信号点名称][变量类型名称] FROM [MES_基本变量变量类型代码]";
|
||||
DataAccess.ExecuteDataTable(sql, out dt);
|
||||
return dt;
|
||||
}
|
||||
public static DataTable GetCheckOpName()
|
||||
{
|
||||
DataTable dt = new DataTable();
|
||||
string produceName = "MES_计划BOM_工位与名称_查询";
|
||||
SqlParameter[] thisParms = null;
|
||||
|
||||
|
||||
DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt);
|
||||
|
||||
return dt;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询工步属性
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static DataTable GetworkStepPropertyFromMIS()
|
||||
{
|
||||
DataTable dt;
|
||||
string sql;
|
||||
sql = "SELECT distinct 工位号,工步属性 FROM [MES_计划BOM_工位与名称] where 是否监控=1";
|
||||
DataAccess.ExecuteDataTable(sql, out dt);
|
||||
return dt;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询返修工位号
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static DataTable GetOpNameRepairFromMIS()
|
||||
{
|
||||
DataTable dt;
|
||||
string sql;
|
||||
sql = "SELECT distinct 工位号,返修工位号 FROM [MES_计划BOM_工位与名称] where 是否监控=1";
|
||||
DataAccess.ExecuteDataTable(sql, out dt);
|
||||
return dt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 测量工位号和工位名称
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static DataTable BaseData_tagTable_QualityData_OpName_Name()
|
||||
{
|
||||
DataTable dt;
|
||||
string sql = "SELECT distinct [工位号],[工位名称] FROM [MES_计划BOM_工位与名称] "
|
||||
+ " where (监控属性代码 = '" + 1 + "')"
|
||||
+ " ORDER BY 工位号 ";
|
||||
//来源于SQL Server
|
||||
DataAccess.ExecuteDataTable(sql, out dt);
|
||||
return dt;
|
||||
}
|
||||
/// <summary>
|
||||
/// MES_计划BOM_工位与名称
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static DataTable BaseData_tagTable_OpName()
|
||||
{
|
||||
//DataTable dt;
|
||||
//string sql = "SELECT * FROM [MES_计划BOM_工位与名称] "
|
||||
// + " where (监控属性代码 = '" + ApplicationConfig.MES_Code.ToString() + "')"
|
||||
// + " ORDER BY 工位号 ";
|
||||
//DataAccess.ExecuteDataTable(sql, out dt);
|
||||
//return dt;
|
||||
|
||||
//2022.07.27.LLX 处理了一下子
|
||||
DataTable dt;
|
||||
string sql = "SELECT * FROM [MES_计划BOM_工位与名称] "
|
||||
+ " where (监控属性代码 = '" + 1 + "') and [是否通过监控系统保存数据] is not null"
|
||||
+ " ORDER BY 工位号 ";
|
||||
DataAccess.ExecuteDataTable(sql, out dt);
|
||||
return dt;
|
||||
}
|
||||
/// <summary>
|
||||
/// MES_基本变量_DB数据结构_根据工位代码_获得普通变量
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static DataTable BaseData_tagTable_OpcServerMES(int mesCode, string opName)
|
||||
{
|
||||
DataTable dt;
|
||||
string sql;
|
||||
sql = "SELECT TagID,0 as TagValue,TagName,工位号,数据来源,TagTypeID,TagLong,列位置,测量位置,变量类型代码,测量项目,TagAdr,TagAdrDemo,变量特点,变量排序 "
|
||||
+ " FROM MES_基本变量_原始数据 "
|
||||
+ " where 变量类型代码 = " + mesCode.ToString() + " and 是否启用 = 1"
|
||||
+ " and 工位号='" + opName + "'"
|
||||
+ " and (监控属性代码 = '" + 1 + "')";
|
||||
DataAccess.ExecuteDataTable(sql, out dt);
|
||||
return dt;
|
||||
}
|
||||
/// <summary>
|
||||
/// MES_基本变量_DB数据结构_根据工位代码_获得普通变量
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static DataTable BaseData_tagTable_OpcServerMES(int mesCode)
|
||||
{
|
||||
DataTable dt;
|
||||
string sql;
|
||||
sql = "SELECT TagID,0 as TagValue,TagName,工位号,数据来源,TagTypeID,TagLong,列位置,测量位置,变量类型代码,测量项目,TagAdr,TagAdrDemo,变量特点,变量排序 "
|
||||
+ " FROM MES_基本变量_原始数据 "
|
||||
+ " where 变量类型代码 = " + mesCode.ToString() + " and 是否启用 = 1"
|
||||
+ " and (监控属性代码 = '" + 1 + "')";
|
||||
DataAccess.ExecuteDataTable(sql, out dt);
|
||||
return dt;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MES_基本变量_DB数据结构_获得激发变量
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static DataTable BaseData_tagTable_All()
|
||||
{
|
||||
//string errorMessage;
|
||||
DataTable dt = null;
|
||||
string sql;
|
||||
sql = "SELECT TagID,0 as TagValue,TagName,工位号,数据来源,TagTypeID,TagLong,列位置,测量位置,变量类型代码,测量项目,TagAdr,TagAdrDemo,变量特点,变量排序 FROM [MES_基本变量_原始数据] "
|
||||
+ " where ((变量类型代码 >= 19 and 变量类型代码 <= 27) or (变量类型代码 = 101) or (变量类型代码 = 102) or (变量类型代码 = 105) or (变量类型代码 = 1000) or (变量类型代码 = 1001) or (变量类型代码 = 1002) or (变量类型代码 = 1003) or (变量类型代码 = 1004)) and (是否启用 = 1) "
|
||||
+ " and (监控属性代码 = '" + 1 + "')"
|
||||
+ " ORDER BY TagID ";
|
||||
DataAccess.ExecuteDataTable(sql, out dt);
|
||||
return dt;
|
||||
}
|
||||
/// <summary>
|
||||
/// MES_基本变量_DB数据结构_获得激发变量
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static DataTable BaseData_tagTable_All_B5A()
|
||||
{
|
||||
//string errorMessage;
|
||||
DataTable dt = null;
|
||||
string sql;
|
||||
sql = "SELECT TagID,0 as TagValue,TagName,工位号,数据来源,TagTypeID,TagLong,列位置,测量位置,变量类型代码,测量项目,TagAdr,TagAdrDemo,变量特点,变量排序 FROM [MES_基本变量_原始数据] "
|
||||
+ " where ((变量类型代码 = 101) or (变量类型代码 = 102) ) and (是否启用 = 1) "
|
||||
+ " and (监控属性代码 = '" + 1 + "')"
|
||||
+ " ORDER BY TagID ";
|
||||
DataAccess.ExecuteDataTable(sql, out dt);
|
||||
return dt;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 20170310 新加
|
||||
/// MES_基本变量_DB数据结构_获得所有普通变量(除101.102.103.104.105)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static DataTable BaseData_tagTable_OpcServerMES_ALL_CF()
|
||||
{
|
||||
DataTable dt;
|
||||
string sql;
|
||||
sql = "SELECT TagID,0 as TagValue,TagName,工位号,数据来源,TagTypeID,TagLong,列位置,测量位置,变量类型代码,测量项目,TagAdr,TagAdrDemo,变量特点,变量排序 "
|
||||
+ " FROM MES_基本变量_原始数据 "
|
||||
+ " where 变量类型代码 <> 101 and 变量类型代码 <> 102 and 变量类型代码 <> 103 and 变量类型代码 <> 104 and 变量类型代码 <> 105 and 是否启用 = 1"
|
||||
+ " and (监控属性代码 = '" + 1 + "')";
|
||||
DataAccess.ExecuteDataTable(sql, out dt);
|
||||
return dt;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发动机类型转换表
|
||||
/// SELECT ID,发动机机型代码 FROM MES_计划BOM_发动机型号代码
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static DataTable BaseData_tagTable_QualityData_EngineTypeID()
|
||||
{
|
||||
DataTable dt;
|
||||
string sql;
|
||||
sql = "SELECT ID,发动机机型代码 FROM MES_计划BOM_发动机型号代码 ";
|
||||
DataAccess.ExecuteDataTable(sql, out dt);
|
||||
return dt;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 测量合格标志
|
||||
/// 全部测量数据的测量工位
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static DataTable BaseData_tagTable_QualityData_GoodBad_MIS_OpName_B5A()
|
||||
{
|
||||
DataTable dt;
|
||||
string sql;
|
||||
sql = "SELECT distinct 工位号 "
|
||||
+ " FROM MES_基本变量_原始数据 "
|
||||
+ " where 变量特点 = 8 and 是否启用 = 1 "
|
||||
+ " and (监控属性代码 = '" + 1 + "')";
|
||||
DataAccess.ExecuteDataTable(sql, out dt);
|
||||
return dt;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 测量合格标志
|
||||
/// 全部测量数据的测量工位的数据来源
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static DataTable BaseData_tagTable_QualityData_GoodBad_MIS_OpName(string opName)
|
||||
{
|
||||
DataTable dt;
|
||||
string sql;
|
||||
sql = "SELECT TagID,工位号,数据来源 "
|
||||
+ " FROM MES_基本变量_原始数据 "
|
||||
+ " where OpcServer_OPNAME = '1' and 是否启用 = 1 "
|
||||
+ " and 工位号='" + opName + "'"
|
||||
+ " and (监控属性代码 = '" + 1 + "')";
|
||||
DataAccess.ExecuteDataTable(sql, out dt);
|
||||
return dt;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 测量合格标志
|
||||
/// 全部测量数据的测量工位的数据来源的测量变量
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static DataTable BaseData_tagTable_QualityData_GoodBad_MIS_OpName(string opName, string opNameFrom)
|
||||
{
|
||||
DataTable dt;
|
||||
string sql;
|
||||
sql = "SELECT TagID "
|
||||
+ " FROM MES_基本变量_原始数据 "
|
||||
+ " where OpcServer_OPNAME = '2' and 是否启用 = 1 "
|
||||
+ " and 工位号='" + opName + "'"
|
||||
+ " and 数据来源='" + opNameFrom + "'"
|
||||
+ " and (监控属性代码 = '" + 1 + "')";
|
||||
DataAccess.ExecuteDataTable(sql, out dt);
|
||||
return dt;
|
||||
}
|
||||
/// <summary>
|
||||
/// MES_基本变量_机型代码_查询
|
||||
/// </summary>
|
||||
/// <param name="dt"></param>
|
||||
static public void EngineType_Select(out DataTable dt)
|
||||
{
|
||||
dt = null;
|
||||
string sql = "exec MES_基本变量_机型代码_查询";
|
||||
DataAccess.ExecuteDataTable(sql, out dt);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,215 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DataLinkMesWork;
|
||||
using MesDataFunction;
|
||||
using MesServerFunctions;
|
||||
using MesServerWork;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MisDataFunDll
|
||||
{
|
||||
public partial class MisDataBaseFun
|
||||
{
|
||||
/// <summary>
|
||||
/// 扫描托盘码进行托盘校验 主要Pack线使用 拉取Pack号校验
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="BarCode"></param>
|
||||
/// <param name="EngineID"></param>
|
||||
/// <returns>1 已通过或者无需验证 2 验证失败 3 本次验证成功</returns>
|
||||
public static int ScanPalletCode(string OpName,string BarCode, string EngineID)
|
||||
{
|
||||
if(MisDataFun.GetSpecialOpExist(OpName, "到站扫托盘码"))
|
||||
{
|
||||
// 判断是否完成二次验证
|
||||
string IsMatchBarcode = "0";
|
||||
MIS_BASE.Read_TagValueByTagTypeID(54, OpName, out IsMatchBarcode);
|
||||
if (IsMatchBarcode != "1")
|
||||
{
|
||||
|
||||
MIS_BASE.Read_EngineGetOver_PLC(OpName, out bool PartLoad_EngineGetOver_PLC);
|
||||
if (!PartLoad_EngineGetOver_PLC)
|
||||
{
|
||||
string msg1 = "无法扫码,PLC未传递机型!";
|
||||
MisDataFun.LogRecording_OP(OpName, "ERROR", "Barcode", msg1);
|
||||
SendMessageFun.AsyncSendMessage_Notice_Error(OpName, msg1, "条码扫描");
|
||||
return 2;
|
||||
}
|
||||
|
||||
// 这里根据BarCode获取到 对于需要与PLC托盘信息校验的码值
|
||||
string CheckCode = MisDataFun.GetPartCodeByBarCodde(OpName, BarCode);
|
||||
// 部分特殊工位不需要拉去PACK进行校验 如 150
|
||||
if (MisDataFun.GetSpecialOpExist(OpName, "校验托盘码不拉PACK码")) CheckCode = BarCode;
|
||||
|
||||
if (EngineID == CheckCode)
|
||||
{
|
||||
// MES比对信息完成
|
||||
MIS_BASE.Write_MachineTime_ReadOver(OpName, true);
|
||||
|
||||
string msgErr = "【" + OpName + "】" + "托盘信息与扫码信息比对成功!";
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "barcode", msgErr);
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, msgErr);
|
||||
|
||||
return 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
// MES比对信息完成 比对不成功
|
||||
MIS_BASE.Write_MachineTime_ReadOver(OpName, false);
|
||||
// MES报警
|
||||
MIS_BASE.Write_TagValueByTagTypeID(34, OpName, true);
|
||||
|
||||
string msgErr = "【" + OpName + "】" + "托盘信息与扫码信息比对失败,扫码信息:" + BarCode;
|
||||
SendMessageFun.AsyncSendMessage_Notice_Error(OpName, msgErr, "条码扫描");
|
||||
MisDataFun.LogRecording_OP(OpName, "ERROR", "barcode", msgErr);
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 前序是否合格校验
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <returns></returns>
|
||||
public static bool NotAllowWorkVerify(string OpName,string EngineID)
|
||||
{
|
||||
// 查询是否 不允许工作
|
||||
MisDataFun.Get_NotAllowWork(EngineID, OpName, out bool NotAllowWork);
|
||||
if (NotAllowWork)
|
||||
{
|
||||
string msg = "前序不合格 不进行工作:" + EngineID;
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MOM", msg);
|
||||
SendMessageFun.AsyncSendMessage_Notice_Error(OpName, msg, "返修放行");
|
||||
MIS_BASE.Write_NotAllowWork(OpName, true); // 不允许工作
|
||||
MIS_BASE.Write_MesErrorType(OpName, 1004); // 工位报警 前序不合格 不允许工作!
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 传递机型 判空
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="EngineID"></param>
|
||||
/// <param name="EngineTypeID"></param>
|
||||
/// <returns>true 通过 false 不通过</returns>
|
||||
public static bool EngineTypeVerify(string OpName, string EngineID, int EngineTypeID)
|
||||
{
|
||||
// 判断PLC机型是否写入
|
||||
if (EngineTypeID == 0 || EngineID == "")
|
||||
{
|
||||
MIS_BASE.Write_TagValueByTagTypeID(34, OpName, true);// MES报警
|
||||
string msg = "【" + OpName + "】" + "PLC机型写入为空,EngineTypeID:" + EngineTypeID + ",EngineID:" + EngineID;
|
||||
SendMessageFun.AsyncSendMessage_Notice_Error(OpName, msg, "传递机型");
|
||||
MisDataFun.LogRecording_OP(OpName, "ERROR", "EngineTypeGetOver", msg);
|
||||
MIS_BASE.Write_MesErrorType(OpName, 1002); // 工位报警 未读取到托盘产品信息!
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上线用传递机型 判空 并且 判断一致性
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="EngineID"></param>
|
||||
/// <param name="EngineTypeID"></param>
|
||||
/// <param name="EngineID_MES"></param>
|
||||
/// <param name="EngineTypeID_MES"></param>
|
||||
/// <returns>true 通过 false 不通过</returns>
|
||||
public static bool EngineTypeVerifyOnLine(string OpName,string EngineID,int EngineTypeID,string EngineID_MES,int EngineTypeID_MES)
|
||||
{
|
||||
// 判断PLC机型是否写入
|
||||
if (EngineTypeID == 0 || EngineID == "")
|
||||
{
|
||||
MIS_BASE.Write_TagValueByTagTypeID(34, OpName, true);// MES报警
|
||||
string msg = "【" + OpName + "】" + "PLC机型写入为空,EngineTypeID:" + EngineTypeID + ",EngineID:" + EngineID;
|
||||
SendMessageFun.AsyncSendMessage_Notice_Error(OpName, msg, "传递机型");
|
||||
MisDataFun.LogRecording_OP(OpName, "ERROR", "EngineTypeGetOver", msg);
|
||||
MIS_BASE.Write_MesErrorType(OpName, 1002); // 工位报警 未读取到托盘产品信息!
|
||||
return false;
|
||||
}
|
||||
//判断PLC机型与MES机型是否一致
|
||||
if (EngineTypeID != EngineTypeID_MES || EngineID != EngineID_MES)
|
||||
{
|
||||
MIS_BASE.Write_TagValueByTagTypeID(34, OpName, true);// MES报警
|
||||
string msg = "【" + OpName + "】" + "PLC机型与MES机型不一致,EngineTypeID:" + EngineTypeID + ",EngineID:" + EngineID + ",EngineTypeID_MES:" + EngineTypeID_MES + ",EngineID_MES:" + EngineID_MES;
|
||||
SendMessageFun.AsyncSendMessage_Notice_Error(OpName, msg, "传递机型");
|
||||
MisDataFun.LogRecording_OP(OpName, "ERROR", "EngineTypeGetOver", msg);
|
||||
MIS_BASE.Write_MesErrorType(OpName, 1001); // 工位报警 PLC机型与MES机型不一致 信息校验失败!
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool CheckMesApiIsOk(string OpName, string EngineID, string apiName)
|
||||
{
|
||||
string procedureName;
|
||||
procedureName = "MOM_接口_Moby_执行状态_查询";
|
||||
SqlParameter[] thisParms = new SqlParameter[3];
|
||||
thisParms[0] = new System.Data.SqlClient.SqlParameter("@产品编号", EngineID);
|
||||
thisParms[1] = new System.Data.SqlClient.SqlParameter("@工位号", OpName);
|
||||
thisParms[2] = new System.Data.SqlClient.SqlParameter("@接口名称", apiName);
|
||||
|
||||
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms, out DataTable dt);
|
||||
if(dt.Rows.Count > 0)
|
||||
{
|
||||
int result = Convert.ToInt32(dt.Rows[0]["result"]);
|
||||
if (result != 2) return true;
|
||||
else
|
||||
{
|
||||
string msg = $"产品{EngineID}未成功入站 请成功入站后再操作";
|
||||
SendMessageFun.AsyncSendMessage_Notice_Error(OpName, msg, "扫码校验");
|
||||
MisDataFun.LogRecording_OP(OpName, "WARNING", "MOM", msg);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上盖装配新产品 根据工位扫码 写入产品信息至PLC
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="BarCode"></param>
|
||||
/// <returns></returns>
|
||||
public static bool WriteEngineDataByEngineID(string OpName, string BarCode)
|
||||
{
|
||||
string procedureName;
|
||||
procedureName = "生产计划_派工订单_执行列表_获取产品信息";
|
||||
SqlParameter[] thisParms = new SqlParameter[2];
|
||||
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", OpName);
|
||||
thisParms[1] = new System.Data.SqlClient.SqlParameter("@BarCode", BarCode);
|
||||
|
||||
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms, out DataTable dt);
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
// 写入产品信息 并且默认为扫描托盘码完成
|
||||
string EngineID = dt.Rows[0]["发动机号"].ToString();
|
||||
int EngineTypeID = Convert.ToInt32(dt.Rows[0]["机型代码"]);
|
||||
string EngineType = dt.Rows[0]["产品型号"].ToString();
|
||||
string OrderForm = dt.Rows[0]["订单号"].ToString();
|
||||
MIS_BASE.Write_EngineTypeID_MES(OpName, EngineTypeID); // 机型代码(MES)
|
||||
MIS_BASE.Write_EngineID_MES(OpName, EngineID); // 发动机号(MES)
|
||||
MIS_BASE.Write_EngineType_MES(OpName, EngineType); // 机型(MES)
|
||||
MIS_BASE.Write_OrderForm_MES(OpName, OrderForm); // 订单号(MES)
|
||||
MIS_BASE.Write_MachineTime_ReadOver(OpName, true); // 托盘信息校验成功
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, true); // 传递机型(MES)
|
||||
return true;
|
||||
}
|
||||
string msg = $"无 {BarCode} 对应产品 请确认产品编码是否正确";
|
||||
SendMessageFun.AsyncSendMessage_Notice_Error(OpName, msg, "扫码校验");
|
||||
MisDataFun.LogRecording_OP(OpName, "WARNING", "MOM", msg);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
|
||||
namespace MisDataFunDll
|
||||
{
|
||||
public partial class MisDataFun
|
||||
{
|
||||
/// <summary>
|
||||
/// Source|Cmd|OpName|TagValue
|
||||
/// </summary>
|
||||
/// <param name="cmd"></param>
|
||||
/// <returns></returns>
|
||||
public static List<string> GetCmdStringList(string cmd)
|
||||
{
|
||||
List<string> list = new List<string>();
|
||||
string item;
|
||||
int index;
|
||||
try
|
||||
{
|
||||
index = cmd.IndexOf('|');
|
||||
item = cmd.Substring(0, index);
|
||||
list.Add(item);
|
||||
|
||||
cmd = cmd.Substring(index + 1);
|
||||
index = cmd.IndexOf('|');
|
||||
item = cmd.Substring(0, index);
|
||||
list.Add(item);
|
||||
|
||||
cmd = cmd.Substring(index + 1);
|
||||
index = cmd.IndexOf('|');
|
||||
item = cmd.Substring(0, index);
|
||||
list.Add(item);
|
||||
|
||||
item = cmd.Substring(index + 1);
|
||||
|
||||
list.Add(item);
|
||||
|
||||
}
|
||||
catch { }
|
||||
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,157 @@
|
||||
using DataLinkMesWork1;
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
|
||||
namespace MisDataFunDll
|
||||
{
|
||||
public partial class MisDataFun
|
||||
{
|
||||
static object locker = new object();
|
||||
/// <summary>
|
||||
///引用程序集Hashtable
|
||||
/// </summary>
|
||||
public static Hashtable Hashtable_assembly = new Hashtable();
|
||||
public static Hashtable hashtable_MesServerCode = new Hashtable();
|
||||
public static Hashtable hashtable_MesDll = new Hashtable();
|
||||
public static Hashtable hashtable_TagTypeTagName = new Hashtable();
|
||||
public static Hashtable hashtable_TagName = new Hashtable();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="hashtable_TagName">变量名称对应的变量类型代码</param>
|
||||
/// <param name="hashtable_TagTypeTagName">变量类型代码对应的变量名称</param>
|
||||
public static void GetBaseData_tagTable_TagName(out Hashtable hashtable_TagName, out Hashtable hashtable_TagTypeTagName)
|
||||
{
|
||||
hashtable_TagName = new Hashtable();
|
||||
hashtable_TagTypeTagName = new Hashtable();
|
||||
|
||||
string tagName;
|
||||
string tagTypeCode;
|
||||
DataTable dt;//GetMesServerCodeFromMIS
|
||||
dt = BaseData_tagTable_TagName();
|
||||
if (dt != null)
|
||||
{
|
||||
for (int i = 0; i < dt.Rows.Count; i++)
|
||||
{
|
||||
tagName = dt.Rows[i]["TagName"].ToString();
|
||||
tagTypeCode = dt.Rows[i]["变量类型代码"].ToString();
|
||||
if (!hashtable_TagName.Contains(tagName))
|
||||
{
|
||||
hashtable_TagName.Add(tagName, tagTypeCode);
|
||||
}
|
||||
if (!hashtable_TagTypeTagName.Contains(tagTypeCode))
|
||||
{
|
||||
hashtable_TagTypeTagName.Add(tagTypeCode, tagName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void GetMesServerCodeAndMesDll(out Hashtable hashtable_MesServerCode, out Hashtable hashtable_MesDll)
|
||||
{
|
||||
hashtable_MesServerCode = new Hashtable();
|
||||
hashtable_MesDll = new Hashtable();
|
||||
|
||||
string OpName;
|
||||
string MesServerCode;
|
||||
string MesDll;
|
||||
DataTable dt;//GetMesServerCodeFromMIS
|
||||
dt = GetMesServerCodeFromMIS();
|
||||
if (dt != null)
|
||||
{
|
||||
for (int i = 0; i < dt.Rows.Count; i++)
|
||||
{
|
||||
OpName = dt.Rows[i]["工位号"].ToString();
|
||||
MesServerCode = dt.Rows[i]["MesServerCode"].ToString();
|
||||
MesDll = dt.Rows[i]["MesDll"].ToString();
|
||||
if (!hashtable_MesDll.Contains(OpName))
|
||||
{
|
||||
hashtable_MesDll.Add(OpName, MesDll);
|
||||
}
|
||||
if (!hashtable_MesServerCode.Contains(OpName))
|
||||
{
|
||||
hashtable_MesServerCode.Add(OpName, MesServerCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// MesServerFunction
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
/// <param name="fun"></param>
|
||||
public static void TransferInfToMES(object text)
|
||||
{
|
||||
try
|
||||
{
|
||||
var recData = text.ToString();
|
||||
var dataArray = GetCmdStringList(recData);
|
||||
//消息来源
|
||||
var m_Source = dataArray[0].ToString();
|
||||
//消息类型 Barcode
|
||||
var m_Command = dataArray[1].ToString();
|
||||
//工位号
|
||||
var m_OpName = dataArray[2].ToString();
|
||||
//消息参数
|
||||
var m_Value = dataArray[3].ToString();
|
||||
|
||||
//获得工位对应的 dll
|
||||
if (!GetMesServerDllNameByOpName(out string mesServerdllName, m_OpName)) return;
|
||||
if (mesServerdllName == null) return;
|
||||
if (mesServerdllName.Length < 1) return;
|
||||
|
||||
System.Reflection.Assembly assembly = null;
|
||||
|
||||
if (Hashtable_assembly.ContainsKey(mesServerdllName))
|
||||
{
|
||||
assembly = (System.Reflection.Assembly)Hashtable_assembly[mesServerdllName];
|
||||
}
|
||||
else
|
||||
{
|
||||
assembly = System.Reflection.Assembly.Load(mesServerdllName);
|
||||
if (assembly == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Hashtable_assembly.Add(mesServerdllName, assembly);
|
||||
}
|
||||
var ResultOK = Reflection.ReflectionMethod(assembly, "MesServerFunctions", "FunctionMES", "FunWork", new object[] { text });
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "TransferInf");
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 获得工位对应的 dll
|
||||
/// </summary>
|
||||
/// <param name="mesServerdllName"></param>
|
||||
/// <param name="opName"></param>
|
||||
/// <returns></returns>
|
||||
private static bool GetMesServerDllNameByOpName(out string mesServerdllName, string opName)
|
||||
{
|
||||
try
|
||||
{
|
||||
mesServerdllName = hashtable_MesDll[opName].ToString();
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
mesServerdllName = "";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
using DataLinkMesWork1;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MisDataFunDll
|
||||
{
|
||||
public partial class ShaftPosition
|
||||
{
|
||||
/// <summary>
|
||||
/// 测量数据合格_电子看板_质量数据_临时表_增加_返修工位
|
||||
/// @EngineID nvarchar(50)=null,
|
||||
/// @EngineType nvarchar(50)=null,
|
||||
/// @EngineTypeID int = null,
|
||||
/// @工位号 nvarchar(50)=null,
|
||||
/// @工位号返修工位 nvarchar(50)=null,
|
||||
/// @订单号 nvarchar(50)=null,
|
||||
/// @合格标志 int
|
||||
/// </summary>
|
||||
/// <param name="engineID">工件号</param>
|
||||
/// <param name="engineType">机型</param>
|
||||
/// <param name="engineTypeID">机型代码</param>
|
||||
/// <param name="opName">工位号(被返修的工位号)</param>
|
||||
/// <param name="opNameRepair">工位号返修工位</param>
|
||||
/// <param name="orderForm">订单号</param>
|
||||
/// <param name="isOK">合格标志</param>
|
||||
static public void ShaftPosition_Data_OpNameRepair_Insert(string engineID, string engineType, int engineTypeID, string opName, string opNameRepair, string orderForm, int isOK)
|
||||
{
|
||||
string procedureName;
|
||||
procedureName = "测量数据合格_电子看板_质量数据_临时表_增加_返修工位";
|
||||
SqlParameter[] thisParmsSql = new SqlParameter[7];
|
||||
thisParmsSql[0] = new SqlParameter("@EngineID", engineID);
|
||||
thisParmsSql[1] = new SqlParameter("@EngineType", engineType);
|
||||
thisParmsSql[2] = new SqlParameter("@EngineTypeID", engineTypeID);
|
||||
thisParmsSql[3] = new SqlParameter("@工位号", opName);
|
||||
thisParmsSql[4] = new SqlParameter("@工位号返修工位", opNameRepair);
|
||||
thisParmsSql[5] = new SqlParameter("@订单号", orderForm);
|
||||
thisParmsSql[6] = new SqlParameter("@合格标志", isOK);
|
||||
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParmsSql);
|
||||
}
|
||||
/// <summary>
|
||||
/// 测量数据合格_电子看板_质量数据_临时表_增加
|
||||
/// @EngineID nvarchar(50)=null,
|
||||
/// @EngineType nvarchar(50)=null,
|
||||
/// @EngineTypeID int = null,
|
||||
/// @工位号 nvarchar(50)=null,
|
||||
/// @订单号 nvarchar(50)=null,
|
||||
/// @合格标志 int
|
||||
/// </summary>
|
||||
/// <param name="engineID">工件号</param>
|
||||
/// <param name="engineType">机型</param>
|
||||
/// <param name="engineTypeID">机型代码</param>
|
||||
/// <param name="opName">工位号</param>
|
||||
/// <param name="orderForm">订单号</param>
|
||||
/// <param name="isOK">合格标志</param>
|
||||
static public void ShaftPosition_Data_Insert(string engineID, string engineType, int engineTypeID, string opName, string orderForm, int isOK)
|
||||
{
|
||||
string procedureName;
|
||||
procedureName = "测量数据合格_电子看板_质量数据_临时表_增加";
|
||||
SqlParameter[] thisParmsSql = new SqlParameter[6];
|
||||
thisParmsSql[0] = new SqlParameter("@EngineID", engineID);
|
||||
thisParmsSql[1] = new SqlParameter("@EngineType", engineType);
|
||||
thisParmsSql[2] = new SqlParameter("@EngineTypeID", engineTypeID);
|
||||
thisParmsSql[3] = new SqlParameter("@工位号", opName);
|
||||
thisParmsSql[4] = new SqlParameter("@订单号", orderForm);
|
||||
thisParmsSql[5] = new SqlParameter("@合格标志", isOK);
|
||||
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParmsSql);
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="shaftStep"></param>
|
||||
/// <param name="engineID"></param>
|
||||
/// <param name="engineType"></param>
|
||||
/// <param name="engineTypeID"></param>
|
||||
/// <param name="orderBy"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
/// <param name="isOK"></param>
|
||||
static public void ShaftPosition_Data_Insert_RepairOpName(string opName, int shaftStep, string engineID, string engineType, int engineTypeID, int orderBy, string tagValue, int isOK)
|
||||
{
|
||||
string procedureName;
|
||||
procedureName = "电子看板_质量数据_临时表_增加_备用拧紧工位";
|
||||
SqlParameter[] thisParmsSql = new SqlParameter[8];
|
||||
thisParmsSql[0] = new SqlParameter("@工位号", opName);
|
||||
thisParmsSql[1] = new SqlParameter("@序号", shaftStep);
|
||||
thisParmsSql[2] = new SqlParameter("@EngineID", engineID);
|
||||
thisParmsSql[3] = new SqlParameter("@EngineType", engineType);
|
||||
thisParmsSql[4] = new SqlParameter("@EngineTypeID", engineTypeID);
|
||||
thisParmsSql[5] = new SqlParameter("@变量排序", orderBy);
|
||||
thisParmsSql[6] = new SqlParameter("@测量值", tagValue);
|
||||
thisParmsSql[7] = new SqlParameter("@合格标志", isOK);
|
||||
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParmsSql);
|
||||
}
|
||||
/// <summary>
|
||||
/// 电子看板_质量数据_临时表_增加
|
||||
/// </summary>
|
||||
/// <param name="opName">工位号</param>
|
||||
/// <param name="shaftStep">序号</param>
|
||||
/// <param name="engineID">工件号</param>
|
||||
/// <param name="engineType">机型</param>
|
||||
/// <param name="engineTypeID">机型代码</param>
|
||||
/// <param name="tagID">变量代码</param>
|
||||
/// <param name="tagValue">变量值</param>
|
||||
/// <param name="isOK">合格标志</param>
|
||||
static public void ShaftPosition_Data_Insert(string opName, int shaftStep, string engineID, string engineType, int engineTypeID, int tagID, string tagValue, int isOK)
|
||||
{
|
||||
string procedureName;
|
||||
procedureName = "电子看板_质量数据_临时表_增加";
|
||||
SqlParameter[] thisParmsSql = new SqlParameter[8];
|
||||
thisParmsSql[0] = new SqlParameter("@工位号", opName);
|
||||
thisParmsSql[1] = new SqlParameter("@序号", shaftStep);
|
||||
thisParmsSql[2] = new SqlParameter("@EngineID", engineID);
|
||||
thisParmsSql[3] = new SqlParameter("@EngineType", engineType);
|
||||
thisParmsSql[4] = new SqlParameter("@EngineTypeID", engineTypeID);
|
||||
thisParmsSql[5] = new SqlParameter("@TagID", tagID);
|
||||
thisParmsSql[6] = new SqlParameter("@测量值", tagValue);
|
||||
thisParmsSql[7] = new SqlParameter("@合格标志", isOK);
|
||||
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParmsSql);
|
||||
}
|
||||
/// <summary>
|
||||
/// 电子看板_工位机型_质量数据测量位置_查询_工作顺序
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="engineTypeID"></param>
|
||||
/// <param name="dt"></param>
|
||||
static public void ShaftPosition_Select_WorkingStep(string opName, int engineTypeID, out DataTable dt)
|
||||
{
|
||||
dt = null;
|
||||
|
||||
string sql = "exec 电子看板_工位机型_质量数据测量位置_查询_工作顺序 '" + opName + "'," + engineTypeID.ToString();
|
||||
DataAccess.ExecuteDataTable(sql, out dt);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 电子看板_质量数据_临时表_删除
|
||||
/// </summary>
|
||||
/// <param name="opName">工位号</param>
|
||||
/// <param name="shaftStep">列位置</param>
|
||||
/// <param name="engineID">EngineID</param>
|
||||
static public void ShaftPosition_Data_Delete(string opName, int shaftStep, string engineID)
|
||||
{
|
||||
string procedureName;
|
||||
procedureName = "电子看板_质量数据_临时表_删除";
|
||||
SqlParameter[] thisParmsSql = new SqlParameter[3];
|
||||
thisParmsSql[0] = new SqlParameter("@工位号", opName);
|
||||
thisParmsSql[1] = new SqlParameter("@列位置", shaftStep);
|
||||
thisParmsSql[2] = new SqlParameter("@EngineID", engineID);
|
||||
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParmsSql);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,462 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
///1 X WorkStart 2 工件到位(PLC) 工件到位。托盘到达工位,并且托盘上有工件。
|
||||
///2 X RepairPartStatusPLC 3 RepairPartStatusPLC 备用
|
||||
///3 STRING RepairPathString 4 RepairPathString "工位返修字符串(121211112222111),前2位是西门子字符串格式,第一位是总长度,第二位是实际长度"
|
||||
///4 X EngineTypeGetOverMES 5 传递机型(MES) MES传递总成信息给PLC(上线工位)
|
||||
///5 X PartPalletGoOver 6 PartPalletGoOver 上线工位。0:正常工作;1:空托盘放行,PLC读取到此标志不走申请上线逻辑。
|
||||
///6 X MaterialVerifyOver 7 MaterialVerifyOver MES保存完质量数据,物料数据等与PLC信号交互完成后通知PLC,所以工步都完成,才可以放行工件,正常工作时工件放行的必要条件。
|
||||
///7 X FalseGo 8 FalseGo 按MES界面[不合格放行]按钮,MES发送此信号。操作者判断工件不合格,通知设备,按不合格方式放行工件,工件流转到返修下线工位后,返修下线。MES工作完成MES0.3=1,MES合格放行MES0.5=0,MES0.4=1
|
||||
///8 INT EngineTypeID 9 EngineTypeID MES发动机机型标志(必须PLC)
|
||||
///9 STRING EngineID 10 EngineID MES发动机编号(必须PLC)
|
||||
///10 STRING EngineType 11 机型(MES) MES发动机机型(必须PLC)
|
||||
///11 X PartPalletStatus 13 PartPalletStatus MES激发变量托盘到位离开(必须PLC)
|
||||
///12 X HeartBeatPLC 14 HeartBeatPLC 心跳处理:PLC收到MES心跳信号后,PLC延时5秒后,数值取反再写回PLC,写回PLC开始计时,如果5秒钟MES无反馈报通讯故障。
|
||||
///13 X HeartBeatMIS 15 HeartBeatMIS 间隔时间5S,心跳处理。收到PLC心跳信号后,MES按原值回写。PLC收到MES信号后延时5秒,取反写入,以此循环。
|
||||
///14 X TargetTimeRead 16 TargetTimeRead MES允许可读工位运行时间
|
||||
///15 Int MachineTargetTime 17 MachineTargetTime 目标运行时间
|
||||
///16 Int MachineActualTime 18 MachineActualTime 实际运行时间
|
||||
///17 X MesRead 19 允许保存(PLC) 质量数据可以读数据
|
||||
///18 X MesReadOver 20 保存完成(MES) MES保存完数据(必须MIS)
|
||||
///19 INT QualityMask 21 合格标志(PLC) 质量数据工位合格标志0:没有工作;1:合格 ;2 :不合格(必须PLC)
|
||||
///20 B PalletInfo 22 PalletInfo 0空托盘,1合格件,2不合格件
|
||||
///21 INT RepairStatusPLC 23 RepairStatusPLC 0正常件,1返修件
|
||||
///22 INT OrderNo 24 订单号(MES) 订单号(MES)
|
||||
///23 X StorageNo 25 库位号(MES) 库位号(MES)
|
||||
///24 X AllowPass 26 允许放行(MES) 允许放行
|
||||
///25 X PartLoadFinish 27 PartLoadFinish PartLoadFinish
|
||||
///26 X Reserved_7 28 Reserved_7 备用
|
||||
///27 X Reserved_8 29 Reserved_8 备用
|
||||
///28 X Reserved_9 30 Reserved_9 备用
|
||||
///29 X Reserved_10 31 Reserved_10 备用
|
||||
///30 X Reserved_11 32 Reserved_11 备用
|
||||
///31 X Reserved_12 33 Reserved_12 备用
|
||||
///32 X Reserved_13 34 Reserved_13 备用
|
||||
///33 X Reserved_14 35 Reserved_14 备用
|
||||
///34 Int PLCSPareint1 36 PLCSPareint1 备用
|
||||
///35 Int PLCSPareint2 37 PLCSPareint2 备用
|
||||
///36 Int PLCSPareint3 38 PLCSPareint3 备用
|
||||
///37 STRING PLCSarestring1 39 PLCSarestring1 备用
|
||||
///38 STRING PLCSarestring2 40 PLCSarestring2 备用
|
||||
///39 STRING MarkID 42 MarkID 机体打标号(MES)前2位是西门子字符串格式,第一位是总长度,第二位是实际长度
|
||||
///40 X PartLoad 43 PartLoad 上线工位,PLC向MES申请总成编号。收到该信号后,MES将机型标志(DBB22 ~23)、总成号(DBB24 ~63)、总成机型DBB64 ~103写入PLC。之后MES通过信号“传递机型(DBX0.1)”通知PLC。
|
||||
///41 X EngineTypeGetOverPLC 44 传递机型(PLC) PLC将机型标志(DBB50…51)、工件编号(DBB52…101)、产品型号(DBB102…187)、托盘编号(DBB188…189)准备完毕后,通知MES。
|
||||
///42 X PartLoadOK 48 PartLoadOK 备用
|
||||
///43 X Reserved_18 49 Reserved_18 备用
|
||||
///44 X PalletDown 50 PalletDown 暂时保留,项目未使用
|
||||
///45 X ConfirmOkGo 51 ConfirmOkGo 按MES界面[合格放行]按钮,MES发送此信号。操作者判断工件合格,通知设备,工件按合格方式放行工件。MES工作完成MES0.3=1,MES合格放行MES0.5=1,MES0.4=0
|
||||
///46 X ResetDevice 52 ResetDevice 针对手动工位,无HMI,需要复位设备在MES页面操作。
|
||||
///47 X UnloadCompleted 53 UnloadCompleted 暂时保留,项目未使用
|
||||
///48 X MachineTime_ReadOver 54 MachineTime_ReadOver 备用
|
||||
///49 X Reserved_19 58 Reserved_19 备用
|
||||
///50 X FixOK 59 FixOK 手动拧紧工位,单工步螺栓拧紧完成,通知PC读取数据。
|
||||
///51 X Reserved_21 61 Reserved_21 备用
|
||||
///52 X Reserved_22 62 Reserved_22 备用
|
||||
///53 X Reserved_23 63 Reserved_23 备用
|
||||
///54 X Reserved_24 64 Reserved_24 备用
|
||||
///55 X Reserved_25 65 Reserved_25 备用
|
||||
///56 X FixAllow 66 FixAllow "设备工作的必须信号,对于有物料验证的工位,MES验证完成给出此信号,对于无物料验证工位,MES直接给出此信号。"
|
||||
///57 X FixOver 67 FixOver 用于手动拧紧且有质量数据工位。通知设备当前工步拧紧螺钉工作结束。
|
||||
///58 X MatchingCompleted 68 MatchingCompleted 分线上总线,匹配成功是1;不成功是0。
|
||||
///59 X Match 69 Match 分线上总线,匹配成功是1;不成功是0。
|
||||
///60 X Reserved_2 70 Reserved_2 备用
|
||||
///61 X IsAutoGetEngineID 71 IsAutoGetEngineID 自动手动申请工件编号。0是自动方式;1:手动方式。暂时保留,生成流水号方式是在数据库中实现的
|
||||
///62 X RepairUplineMES 72 RepairUplineMES 上线清空MOBY(针对上线工位):通知PLC从新开始申请上线流程
|
||||
///63 INT EngineTypeID_MES 73 机型代码(MES) MES发动机机型标志(必须MES)
|
||||
///64 STRING EngineID_MES 74 工件编号(MES) MES发动机编号(必须MES)
|
||||
///65 STRING EngineType_MES 75 EngineType_MES MES发动机机型(必须MES)
|
||||
///66 X Reserved_20 76 Reserved_20 备用
|
||||
///67 INT ProcessCode 77 ProcessCode 手动拧紧工位:由MES通知PLC拧紧序号
|
||||
///68 B OnLineState 79 OnLineState 通过线体工位PC实现下达工位工作状态:工位有三种状态:在线、离线、屏蔽。在线:0正常状态,实现正常功能。1离线:设备脱离MES工作,进入不交互模式。
|
||||
///69 INT PartPalletCode 80 托盘号(MES) 托盘编号(B5A)
|
||||
///70 INT BoltCode 88 BoltCode 手动拧紧工位:指导PLC所用套筒
|
||||
///71 INT RepairStatus 93 RepairStatus "0正常件,1返修件。对于上线工位MES给出是正常上线还是返修上线,返修路径"
|
||||
///72 DInt Reserved_15 110 Reserved_15 备用
|
||||
///73 DInt Reserved_16 111 Reserved_16 备用
|
||||
///74 B Reserved_17 112 Reserved_17 备用
|
||||
///75 INT SPareint1 113 SPareint1 备用int1
|
||||
///76 INT SPareint2 114 SPareint2 备用int2
|
||||
///77 INT SPareint3 115 SPareint3 备用int3
|
||||
///78 STRING Sparestring1 116 Sparestring1 备用字符串1
|
||||
///79 STRING Sparestring2 117 Sparestring2 备用字符串2
|
||||
///80 X MachineStatusPutOn 1000 机床上电(PLC) 机床上电(必须PLC)
|
||||
///81 X MachineStatusWorkOn 1001 循环开始(PLC) 循环开始(必须PLC)
|
||||
///82 X MachineStatusAlarm 1002 设备报警(PLC) 机床故障(必须PLC)
|
||||
///83 X MachineStatusNoPart 1003 MachineStatusNoPart 上料无件(必须PLC)
|
||||
///84 X MachineStatusBlock 1004 MachineStatusBlock 下料堵塞(必须PLC)
|
||||
|
||||
|
||||
namespace MisDataFunDll
|
||||
{
|
||||
/// <summary>
|
||||
/// 这是变量类型代码的配置,几乎是不变的
|
||||
/// 请不要随意修改,为了保证变量版本同一,并且方便维护,请联系发行人修改!
|
||||
/// 请注意,此修改为全局修改!
|
||||
/// </summary>
|
||||
public enum EnumTagTypeCodeID
|
||||
{
|
||||
/// <summary>
|
||||
/// 工件到位(PLC)
|
||||
/// 变量类型:Bool
|
||||
/// 解释:托盘到达工位,并且托盘上有工件。
|
||||
/// </summary>
|
||||
WorkStart = 2,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
RepairPartStatusPLC = 3,
|
||||
/// <summary>
|
||||
/// 工位返修字符串
|
||||
/// 变量类型:String
|
||||
/// 解释:工位返修字符串
|
||||
/// </summary>
|
||||
RepairPathString = 4,
|
||||
/// <summary>
|
||||
/// 传递机型(MES)
|
||||
/// 变量类型:Bool
|
||||
/// 解释:MES传递总成信息给PLC(上线工位)
|
||||
/// </summary>
|
||||
EngineTypeGetOverMES = 5,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
PartPalletGoOver = 6,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
MaterialVerifyOver = 7,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
FalseGo = 8,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
EngineTypeID = 9,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
EngineID = 10,
|
||||
/// <summary>
|
||||
/// 机型(MES)
|
||||
/// 变量类型:String
|
||||
/// </summary>
|
||||
EngineType = 11,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
PartPalletStatus = 13,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
HeartBeatPLC = 14,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
HeartBeatMIS = 15,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
TargetTimeRead = 16,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
MachineTargetTime = 17,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
MachineActualTime = 18,
|
||||
/// <summary>
|
||||
/// 允许保存(PLC)
|
||||
/// 变量类型:Bool
|
||||
/// </summary>
|
||||
MesRead = 19,
|
||||
/// <summary>
|
||||
/// 保存完成(MES)
|
||||
/// 变量类型:Bool
|
||||
/// </summary>
|
||||
MesReadOver = 20,
|
||||
/// <summary>
|
||||
/// 合格标志(PLC)
|
||||
/// 变量类型:Int
|
||||
/// </summary>
|
||||
QualityMask = 21,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
PalletInfo = 22,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
RepairStatusPLC = 23,
|
||||
/// <summary>
|
||||
/// 订单号(MES)
|
||||
/// 变量类型:Int
|
||||
/// </summary>
|
||||
OrderNo = 24,
|
||||
/// <summary>
|
||||
/// 库位号(MES)
|
||||
/// 变量类型:Bool
|
||||
/// </summary>
|
||||
StorageNo = 25,
|
||||
/// <summary>
|
||||
/// 允许放行(MES)
|
||||
/// 变量类型:Bool
|
||||
/// </summary>
|
||||
AllowPass = 26,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
PartLoadFinish = 27,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Reserved_7 = 28,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Reserved_8 = 29,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Reserved_9 = 30,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Reserved_10 = 31,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Reserved_11 = 32,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Reserved_12 = 33,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Reserved_13 = 34,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Reserved_14 = 35,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
PLCSPareint1 = 36,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
PLCSPareint2 = 37,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
PLCSPareint3 = 38,
|
||||
/// <summary>
|
||||
/// 订单号(PLC)
|
||||
/// </summary>
|
||||
OrderFormPLC = 39,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
PLCSarestring2 = 40,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
MarkID = 42,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
PartLoad = 43,
|
||||
/// <summary>
|
||||
/// 传递机型(PLC)
|
||||
/// 变量类型:Bool
|
||||
/// </summary>
|
||||
EngineTypeGetOverPLC = 44,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
PartLoadOK = 48,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Reserved_18 = 49,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
PalletDown = 50,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
ConfirmOkGo = 51,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
ResetDevice = 52,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
UnloadCompleted = 53,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
MachineTime_ReadOver = 54,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Reserved_19 = 58,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
FixOK = 59,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Reserved_21 = 61,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Reserved_22 = 62,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Reserved_23 = 63,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Reserved_24 = 64,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Reserved_25 = 65,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
FixAllow = 66,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
FixOver = 67,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
MatchingCompleted = 68,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Match = 69,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Reserved_2 = 70,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
IsAutoGetEngineID = 71,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
RepairUplineMES = 72,
|
||||
/// <summary>
|
||||
/// 机型代码(MES)
|
||||
/// 变量类型:Int
|
||||
/// </summary>
|
||||
EngineTypeID_MES = 73,
|
||||
/// <summary>
|
||||
/// 工件编号(MES)
|
||||
/// 变量类型:String
|
||||
/// </summary>
|
||||
EngineID_MES = 74,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
EngineType_MES = 75,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Reserved_20 = 76,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
ProcessCode = 77,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
OnLineState = 79,
|
||||
/// <summary>
|
||||
/// 托盘号(MES)
|
||||
/// 变量类型:Int
|
||||
/// </summary>
|
||||
PartPalletCode = 80,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
BoltCode = 88,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
RepairStatus = 93,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Reserved_15 = 110,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Reserved_16 = 111,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Reserved_17 = 112,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
SPareint1 = 113,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
SPareint2 = 114,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// MES订单号
|
||||
/// </summary>
|
||||
OrdeFormMES = 116,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Sparestring2 = 117,
|
||||
/// <summary>
|
||||
/// 机床上电(PLC)
|
||||
/// 变量类型:Bool
|
||||
/// </summary>
|
||||
MachineStatusPutOn = 1000,
|
||||
/// <summary>
|
||||
/// 循环开始(PLC)
|
||||
/// 变量类型:Bool
|
||||
/// </summary>
|
||||
MachineStatusWorkOn = 1001,
|
||||
/// <summary>
|
||||
/// 设备报警(PLC)
|
||||
/// 变量类型:Bool
|
||||
/// </summary>
|
||||
MachineStatusAlarm = 1002,
|
||||
/// <summary>
|
||||
/// 上料无件(PLC)
|
||||
/// 变量类型:Bool
|
||||
/// </summary>
|
||||
MachineStatusNoPart = 1003,
|
||||
/// <summary>
|
||||
/// 下料堵塞(PLC)
|
||||
/// 变量类型:Bool
|
||||
/// </summary>
|
||||
MachineStatusBlock = 1004,
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.Web;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace MisDataFunDll
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class Reflection
|
||||
{
|
||||
/// <summary>
|
||||
/// 通过反射调用动态连接库方法
|
||||
/// </summary>
|
||||
/// <param name="assembly">程序集(DLL)</param>
|
||||
/// <param name="Namespace">命名空间名称,如果无命名空间写“”</param>
|
||||
/// <param name="Classname">类名</param>
|
||||
/// <param name="Method">方法名</param>
|
||||
/// <param name="Paramsters">函数参数数组</param>
|
||||
static public string ReflectionMethod(Assembly assembly, string Namespace, string Classname, string Method, object[] Paramsters)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
Type t;
|
||||
//类
|
||||
if (Namespace == "")
|
||||
{
|
||||
t = assembly.GetType(Classname);
|
||||
}
|
||||
else
|
||||
{
|
||||
t = assembly.GetType(Namespace + "." + Classname);
|
||||
}
|
||||
if (t == null)
|
||||
{
|
||||
return "类不存在";
|
||||
}
|
||||
////方法
|
||||
var mi = t.GetMethod(Method); //获取方法
|
||||
if (mi == null)
|
||||
{
|
||||
return "方法不存在";
|
||||
}
|
||||
var paramsInfo = mi.GetParameters();
|
||||
for (int i = 0; i < paramsInfo.Length; i++)
|
||||
{
|
||||
var tType = paramsInfo[i].ParameterType;
|
||||
//改变参数类型
|
||||
Paramsters[i]= SD_ChanageType(Paramsters[i],tType);
|
||||
}
|
||||
/// 建一个实例化的类
|
||||
var instanceObject = Activator.CreateInstance(t);
|
||||
mi.Invoke(instanceObject, Paramsters);
|
||||
return "ok";
|
||||
}
|
||||
catch(Exception err)
|
||||
{
|
||||
return err.ToString();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="convertsionType"></param>
|
||||
/// <returns></returns>
|
||||
public static object SD_ChanageType(object value, Type convertsionType)
|
||||
{
|
||||
//判断convertsionType类型是否为泛型,因为nullable是泛型类,
|
||||
if (convertsionType.IsGenericType &&
|
||||
//判断convertsionType是否为nullable泛型类
|
||||
convertsionType.GetGenericTypeDefinition().Equals(typeof(Nullable<>)))
|
||||
{
|
||||
if (value == null || value.ToString().Length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
//如果convertsionType为nullable类,声明一个NullableConverter类,该类提供从Nullable类到基础基元类型的转换
|
||||
NullableConverter nullableConverter = new NullableConverter(convertsionType);
|
||||
//将convertsionType转换为nullable对的基础基元类型
|
||||
convertsionType = nullableConverter.UnderlyingType;
|
||||
}
|
||||
return Convert.ChangeType(value, convertsionType);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user