using DataLinkMesWork1;
using MesServerFunctions;
using Newtonsoft.Json;
using Opc.Ua.Export;
using System;
using System.Data;
using System.Data.SqlClient;
using System.Diagnostics.Eventing.Reader;
namespace MisDataFunDll
{
public partial class MisDataFun
{
public class MobyTagType
{
///
/// 配方号
///
public static string PLCRcipe = "配方号";
///
/// 工位号
///
public static string OpName = "工位号";
///
/// 订单号
///
public static string OrderForm = "订单号";
///
/// 订单号
///
public static string OrderForm_MES = "订单号_MES";
///
/// 产品型号代码
///
public static string EngineTypeID = "产品型号代码";
///
/// 变速器序列号
/// 变速器序列号
public static string EngineID = "变速器序列号";
///
/// 发动机型号
///
public static string EngineType = "发动机型号";
///
/// 机型基本代码
///
public static string EngineTypeBasicID = "机型基本代码";
///
/// 机型基本代码
///
public static string EngineTypeBasic = "基本机型";
///
/// 变速器总成号
///
public static string EngineIDPrinte = "变速器总成号";
///
/// 托盘号
///
public static string PartPallet_Code = "托盘号";
///
/// 产品型号代码_MES
///
public static string EngineTypeID_MES = "产品型号代码_MES";
///
/// 变速器序列号_MES
///
public static string EngineID_MES = "变速器序列号_MES";
///
/// 发动机型号_MES
///
public static string EngineType_MES = "发动机型号_MES";
///
/// 到达时间线外工位
///
public static string WorkStartOutSideIn = "到达时间线外工位";
///
/// 离开时间线外工位
///
public static string WorkStartOutSideOut = "离开时间线外工位";
///
/// 到达时间
///
public static string WorkStartIn = "到达时间";
///
/// 离开时间
///
public static string WorkStartOut = "离开时间";
///
/// 持续时间
///
public static string WorkStartTime = "持续时间";
///
/// 扫描条码
///
public static string BarCode = "扫描条码";
///
/// 工件到位 2
///
public static string WorkStart = "工件到位";
///
/// 传递机型 44
///
public static string EngineTypeGetOverPLC = "传递机型";
///
/// 申请上件 43
///
public static string PartLoad = "申请上件";
///
/// 允许保存 19
///
public static string MesRead = "允许保存";
///
/// 保存完成 20
///
public static string MesReadOver = "保存完成";
///
/// 允许工作 20
///
public static string FixAllow = "允许工作";
/// [机床上电],[循环开始],[机床故障],[上料无件],[下料堵塞],[工件到位]
/// [传递机型],[申请上件],[允许保存],[保存完成],[合格标志],[前序合格]
/// [工号],[班次],[是否返修件],[合格放行],[不合格放行]
/// [到达时间],[离开时间],[持续时间]
// engineTypeID = Convert.ToInt32(thisParms[2].Value);
//engineType = thisParms[3].Value.ToString();
//engineID = thisParms[4].Value.ToString();
//palletCode = thisParms[5].Value.ToString();
}
///
/// 测量数据工位_监控系统_MOBY_线首_增加
///
///
///
///
///
///
///
///
///
///
///
///
public static bool OpName_MIS_MOBY_Insert_FirstOpName(string opName, int engineTypeID, int engineTypeID_MES, string engineType, string engineType_MES, string engineID, string engineID_MES, int palletCode, string orderForm, string orderForm_MES)
{
string produceName = "测量数据工位_监控系统_MOBY_线首_增加";
SqlParameter[] thisParms = new SqlParameter[10];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@产品型号代码", engineTypeID);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@产品型号代码_MES", engineTypeID_MES);
thisParms[3] = new System.Data.SqlClient.SqlParameter("@发动机型号", engineType);
thisParms[4] = new System.Data.SqlClient.SqlParameter("@发动机型号_MES", engineType_MES);
thisParms[5] = new System.Data.SqlClient.SqlParameter("@发动机号", engineID);
thisParms[6] = new System.Data.SqlClient.SqlParameter("@发动机号_MES", engineID_MES);
thisParms[7] = new System.Data.SqlClient.SqlParameter("@订单号", orderForm);
thisParms[8] = new System.Data.SqlClient.SqlParameter("@订单号_MES", orderForm_MES);
thisParms[9] = new System.Data.SqlClient.SqlParameter("@托盘号", palletCode);
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
}
///
/// 测量数据工位_监控系统_MOBY_增加
///
///
///
///
///
///
///
///
///
///
///
public static bool OpName_MIS_MOBY_Insert(string opName, string tagType, string tagValue)
{
string produceName = "北汽福田工位状态监控MOBY_增加";
SqlParameter[] thisParms = new SqlParameter[3];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@变量类型", tagType);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@变量值", tagValue);
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
}
///
/// 生产计划_派工订单_工件追溯_校验
///
///
///
///
public static DataTable WorkOrderCheck(string opName, string EngineID, string OrderFrom, string EngineType)
{
string produceName = "生产计划_派工订单_工件追溯_校验";
SqlParameter[] thisParms = new SqlParameter[4];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@工件编号", EngineID);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@订单号", OrderFrom);
thisParms[3] = new System.Data.SqlClient.SqlParameter("@机型", EngineType);
DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out DataTable dt);
return dt;
}
///
/// 接口_IOT接口_报工记录_是否报工判断
///
///
///
///
public static DataTable IOT_ReqData_UpLoad_IsSend(string opName, string OrderFrom, string reqType)
{
string produceName = "接口_IOT接口_报工记录_是否报工判断";
SqlParameter[] thisParms = new SqlParameter[3];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@订单号", OrderFrom);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@报工类型", reqType);
DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out DataTable dt);
return dt;
}
///
/// 测量数据工位_监控系统_MOBY_增加
///
///
///
///
///
///
///
///
///
///
///
public static bool OpName_MIS_MOBY_Insert_JZ(string opName, string engineID)
{
string produceName = "测量数据工位_监控系统_MOBY_静置工位_增加";
SqlParameter[] thisParms = new SqlParameter[2];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@发动机号", engineID);
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
}
public static void BarCodeIsSecondVerification(string opName, out bool isSecondVerification)
{
isSecondVerification = false;
DataTable dt = new DataTable();
string produceName = "测量数据工位_监控系统_是否二次验证_查询";
SqlParameter[] thisParms = new SqlParameter[1];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt);
if (dt.Rows.Count > 0)
{
string isVerification = dt.Rows[0]["是否验证"].ToString();
if (isVerification == "1")
{
isSecondVerification = true;
}
}
}
///
/// 日志_工位操作_增加
///
///
///
///
///
///
public static bool LogRecording_OP(string OpName, string type, string msgType, string content)
{
string produceName = "日志_工位操作_增加";
SqlParameter[] thisParms = new SqlParameter[4];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", OpName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@消息类型", type);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@操作类型", msgType);
thisParms[3] = new System.Data.SqlClient.SqlParameter("@内容", content);
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
}
///
/// 电子看板_工序内容_临时表_增加
///
///
///
public static bool MesServer_ProcessList_EngineTypeOver(string opName)
{
string produceName = "电子看板_工序内容_临时表_增加";
SqlParameter[] thisParms = new SqlParameter[1];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
}
///
/// 电子看板_装配零件_临时表_增加
///
///
///
public static bool MesServer_Process_EngineTypeOver(string opName)
{
string produceName = "电子看板_装配零件_临时表_增加";
SqlParameter[] thisParms = new SqlParameter[1];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
}
///
/// 测量数据工位_监控系统_MOBY_查询
///
///
///
///
///
///
///
///
///
///
public static void Moby_Select(string opName, out string OrderForm, out int EngineTypeID, out string EngineType, out string EngineID, out string PartPallet_Code, out int IsrepairBarcode, out string repairBarcode, out string EngineTypeString)
{
DataTable dt = new DataTable();
OrderForm = "";
EngineTypeID = 0;
EngineType = "";
EngineID = "";
PartPallet_Code = "0";
IsrepairBarcode = 0;
repairBarcode = "0";
EngineTypeString = "";
try
{
string procedureName;
procedureName = "测量数据工位_监控系统_MOBY_查询";
SqlParameter[] thisParms = new SqlParameter[1];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms, out dt);
if (dt.Rows.Count > 0)
{
OrderForm = dt.Rows[0]["订单号"].ToString();
EngineTypeID = Convert.ToInt32(dt.Rows[0]["产品型号代码"]); ;
EngineType = dt.Rows[0]["发动机型号"].ToString();
EngineID = dt.Rows[0]["发动机号"].ToString();
PartPallet_Code = dt.Rows[0]["托盘号"].ToString();
}
}
catch
{
OrderForm = "";
EngineTypeID = 0;
EngineType = "";
EngineID = "";
PartPallet_Code = "0";
IsrepairBarcode = 0;
repairBarcode = "";
EngineTypeString = "";
}
}
///
/// 测量数据工位_监控系统_MOBY_查询
///
///
///
///
///
///
///
///
///
///
public static void Moby_Select(string opName, out string orderNum,
out int EngineTypeID, out string EngineType, out string EngineID, out string PartPallet_Code,
out int IsrepairBarcode, out string repairBarcode,
out string workCode, out string projectName, out string splitCode, out string unidCode, out string engineType, out string engineTypeModel, out string startTime)
{
orderNum = "";
EngineTypeID = 0;
EngineType = "";
EngineID = "";
PartPallet_Code = "";
IsrepairBarcode = 0;
repairBarcode = "";
workCode = ""; // 制造编号
projectName = ""; // 项目名称
splitCode = ""; // 间隔号
unidCode = ""; // 单元号
engineType = ""; // 本体类型
engineTypeModel = ""; // 附件类型
startTime = ""; // 开始时间
try
{
string procedureName;
procedureName = "测量数据工位_监控系统_MOBY_查询";
SqlParameter[] thisParms = new SqlParameter[15];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@订单号", SqlDbType.NVarChar, 50, "订单号");
thisParms[1].Direction = ParameterDirection.Output;
thisParms[2] = new System.Data.SqlClient.SqlParameter("@产品型号代码", SqlDbType.Int, 4, "产品型号代码");
thisParms[2].Direction = ParameterDirection.Output;
thisParms[3] = new System.Data.SqlClient.SqlParameter("@发动机型号", SqlDbType.NVarChar, 50, "发动机型号");
thisParms[3].Direction = ParameterDirection.Output;
thisParms[4] = new System.Data.SqlClient.SqlParameter("@发动机号", SqlDbType.NVarChar, 50, "发动机号");
thisParms[4].Direction = ParameterDirection.Output;
thisParms[5] = new System.Data.SqlClient.SqlParameter("@托盘号", SqlDbType.NVarChar, 50, "托盘号");
thisParms[5].Direction = ParameterDirection.Output;
thisParms[6] = new System.Data.SqlClient.SqlParameter("@拆解标志", SqlDbType.Int, 4, "拆解标志");
thisParms[6].Direction = ParameterDirection.Output;
thisParms[7] = new System.Data.SqlClient.SqlParameter("@拆解返修条码", SqlDbType.NVarChar, 50, "拆解返修条码");
thisParms[7].Direction = ParameterDirection.Output;
thisParms[8] = new System.Data.SqlClient.SqlParameter("@制造编号", SqlDbType.NVarChar, 50, "制造编号");
thisParms[8].Direction = ParameterDirection.Output;
thisParms[9] = new System.Data.SqlClient.SqlParameter("@间隔号", SqlDbType.NVarChar, 50, "间隔号");
thisParms[9].Direction = ParameterDirection.Output;
thisParms[10] = new System.Data.SqlClient.SqlParameter("@单元号", SqlDbType.NVarChar, 50, "单元号");
thisParms[10].Direction = ParameterDirection.Output;
thisParms[11] = new System.Data.SqlClient.SqlParameter("@项目名称", SqlDbType.NVarChar, 50, "项目名称");
thisParms[11].Direction = ParameterDirection.Output;
thisParms[12] = new System.Data.SqlClient.SqlParameter("@本体类型", SqlDbType.NVarChar, 50, "本体类型");
thisParms[12].Direction = ParameterDirection.Output;
thisParms[13] = new System.Data.SqlClient.SqlParameter("@附件类型", SqlDbType.NVarChar, 50, "附件类型");
thisParms[13].Direction = ParameterDirection.Output;
thisParms[14] = new System.Data.SqlClient.SqlParameter("@开始时间", SqlDbType.NVarChar, 50, "开始时间");
thisParms[14].Direction = ParameterDirection.Output;
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
if (thisParms[1].Value != null && thisParms[2].Value != null && thisParms[3].Value != null && thisParms[4].Value != null && thisParms[5].Value != null && thisParms[6].Value != null && thisParms[7].Value != null)
{
orderNum = thisParms[1].Value.ToString();
EngineTypeID = Convert.ToInt32(thisParms[2].Value); ;
EngineType = thisParms[3].Value.ToString();
EngineID = thisParms[4].Value.ToString();
PartPallet_Code = thisParms[5].Value.ToString();
IsrepairBarcode = Convert.ToInt32(thisParms[6].Value);
repairBarcode = thisParms[7].Value.ToString();
workCode = thisParms[8].Value.ToString(); // 制造编号
projectName = thisParms[9].Value.ToString(); // 项目名称
splitCode = thisParms[10].Value.ToString();// 间隔号
unidCode = thisParms[11].Value.ToString(); // 单元号
engineType = thisParms[12].Value.ToString(); // 本体类型
engineTypeModel = thisParms[13].Value.ToString(); // 附件类型
startTime = thisParms[14].Value.ToString(); // 开始时间
}
}
catch
{
orderNum = "";
EngineTypeID = 0;
EngineType = "";
EngineID = "";
PartPallet_Code = "";
IsrepairBarcode = 0;
repairBarcode = "";
workCode = ""; // 制造编号
projectName = ""; // 项目名称
splitCode = ""; // 间隔号
unidCode = ""; // 单元号
engineType = ""; // 本体类型
engineTypeModel = ""; // 附件类型
}
}
///
/// 电子看板_工序内容_查询
///
/// 工位号
/// 产品型号代码
///
static public void Process_Select(string opName, int engineTypeID, string EngineType, out DataTable dt)
{
dt = null;
string sql = "exec 电子看板_工序内容_查询 '" + opName + "'," + engineTypeID.ToString() + ",'" + EngineType + "'";
DataAccess.ExecuteDataTable(sql, out dt);
}
///
/// 电子看板_装配零件_物料验证_查询
///
/// 工位号
/// 发动机号
///
static public bool PartMaterialVerify_Select(string opName, int engineTypeID, string engineType, out DataTable dt)
{
dt = null;
string procedureName;
procedureName = "电子看板_装配零件_临时表_查询";
SqlParameter[] thisParms = new SqlParameter[1];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
return DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms, out dt);
}
///
/// 电子看板_装配零件_临时表_判断_是否允许工作
///
///
///
///
public static bool MesServer_Judge_IsCanWork(string opName, out int IsAllowWork)
{
IsAllowWork = 0;
string produceName = "电子看板_装配零件_临时表_判断_是否允许工作";
SqlParameter[] thisParms = new SqlParameter[2];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@是否允许工作", IsAllowWork);
thisParms[1].Direction = ParameterDirection.Output;
if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms))
{
IsAllowWork = Convert.ToInt32(thisParms[1].Value);
return true;
}
return false;
}
///
/// [电子看板_装配零件_临时表_增加_北汽]
///
///
///
public static bool MesServer_Process_EngineTypeOverBQ(string opName)
{
string produceName = "电子看板_装配零件_临时表_增加_北汽";
SqlParameter[] thisParms = new SqlParameter[1];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
}
///
/// 发送页面点位 同时存入数据库状态
///
///
public static void MobySendWebAndSaveData(string OpName, string tagType, string tagValue)
{
MisDataFun.OpName_MIS_MOBY_Insert(OpName, tagType, tagValue);
// 判断是否为涉及前端页面的信号,如果是则同步发送点位
string tagName = "";
switch (tagType)
{
case "工件到位":
tagName = "WorkStart";
break;
case "传递机型":
tagName = "EngineTypeGetOverPLC";
break;
case "申请上件":
tagName = "PartLoad";
break;
case "允许工作":
tagName = "FixAllow";
break;
case "允许保存":
tagName = "MesRead";
break;
case "保存完成":
tagName = "MesReadOver";
break;
default:
break;
}
if (tagName != "")
{
SendMessageFun.SendInfomation(tagName, Convert.ToString(Convert.ToInt32(tagValue)), OpName);
}
}
///
/// 电子看板_装配零件_临时表_修改_零件条码
///
///
///
///
///
public static bool PartMaterial_DM_Update(string opName, string barCode, out bool IsSuccess)
{
IsSuccess = false;
string produceName = "电子看板_装配零件_临时表_修改_零件条码";
SqlParameter[] thisParms = new SqlParameter[3];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@条码", barCode);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@条码是否符合", IsSuccess);
thisParms[2].Direction = ParameterDirection.Output;
if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms))
{
IsSuccess = Convert.ToBoolean(thisParms[2].Value);
return true;
}
return false;
}
///
/// 测量数据合格索引_增加
///
///
///
///
///
///
///
///
///
///
public static bool BaseData_tagTable_QualityData_B5A_IndexInsert(string EngineID, string tagID, string EngineType, int EngineTypeID, string opName, int isGoodBad, string PartPalletCode, out int Id_tagCF)
{
string procedureName;
procedureName = "测量数据合格索引_增加";
Id_tagCF = 0;
SqlParameter[] thisParms = new SqlParameter[8];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@EngineID", EngineID);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@TagID_CF", tagID);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@EngineType", EngineType);
thisParms[3] = new System.Data.SqlClient.SqlParameter("@EngineTypeID", EngineTypeID);
thisParms[4] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[5] = new System.Data.SqlClient.SqlParameter("@托盘编号", PartPalletCode);
thisParms[6] = new System.Data.SqlClient.SqlParameter("@合格标志", isGoodBad);
thisParms[7] = new System.Data.SqlClient.SqlParameter("@Id_tagCF", Id_tagCF);
thisParms[7].Direction = ParameterDirection.Output;
if (DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms))
{
Id_tagCF = Convert.ToInt32(thisParms[7].Value.ToString());
return true;
}
return false;
}
///
/// 测量数据合格_增加
///
///
///
///
///
///
///
///
public static bool BaseData_tagTable_QualityData_B5A_Insert(int Id_tagCF, int engineTypeID, string engineID, string opName, DataTable dt, bool IsCheck = false)
{
string procedureName;
procedureName = "测量数据合格_增加";
SqlParameter[] thisParms = new SqlParameter[15];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@Id_tagCF", Id_tagCF);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@EngineTypeID", engineTypeID);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@EngineID", engineID);
thisParms[3] = new System.Data.SqlClient.SqlParameter("@TagID", SqlDbType.Int, 4, "TagID");
thisParms[4] = new System.Data.SqlClient.SqlParameter("@TagValue", SqlDbType.NVarChar, 100, "TagValue");
thisParms[5] = new System.Data.SqlClient.SqlParameter("@IsGoodBad", SqlDbType.Int, 4, "IsGoodBad");
//是否保存无合格标志数据数据
//thisParms[6] = new System.Data.SqlClient.SqlParameter("@IsCheck", IsCheck);
thisParms[6] = new System.Data.SqlClient.SqlParameter("@测量位置", SqlDbType.NVarChar, 50, "测量位置");
thisParms[7] = new System.Data.SqlClient.SqlParameter("@测量项目", SqlDbType.NVarChar, 50, "测量项目");
thisParms[8] = new System.Data.SqlClient.SqlParameter("@工位号", opName); //为了给J07MA020 保留四位精度而设置
thisParms[9] = new System.Data.SqlClient.SqlParameter("@理论值", SqlDbType.NVarChar, 50, "理论值");
thisParms[10] = new System.Data.SqlClient.SqlParameter("@上限值", SqlDbType.NVarChar, 50, "上限值");
thisParms[11] = new System.Data.SqlClient.SqlParameter("@下限值", SqlDbType.NVarChar, 50, "下限值");
thisParms[12] = new System.Data.SqlClient.SqlParameter("@测量单位", SqlDbType.NVarChar, 50, "测量单位");
thisParms[13] = new System.Data.SqlClient.SqlParameter("@列位置", SqlDbType.Int, 4, "列位置");
thisParms[14] = new System.Data.SqlClient.SqlParameter("@变量排序", SqlDbType.Int, 4, "变量排序");
//table.Columns.Add("TagID", typeof(System.Int32));
//table.Columns.Add("TagValue", typeof(System.String));
//table.Columns.Add("IsGoodBad", typeof(System.Int32));
//table.Columns.Add("测量位置", typeof(System.String));
//table.Columns.Add("测量项目", typeof(System.String));
//table.Columns.Add("工位号", typeof(System.String));
//table.Columns.Add("理论值", typeof(System.String));
//table.Columns.Add("上限值", typeof(System.String));
//table.Columns.Add("下限值", typeof(System.String));
//table.Columns.Add("测量单位", typeof(System.String));
//table.Columns.Add("列位置", typeof(System.Int32));
//table.Columns.Add("变量排序", typeof(System.Int32));
return DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms, dt);
}
///
/// 测量数据合格_手动拧紧_增加
///
///
///
///
///
///
///
///
///
///
///
public static bool BaseData_tagTable_QualityData_B5A_Insert(int engineTypeID, string engineType, string engineID, string tagValue, int isGoodBad, string opName, string partPallet, int tagID, int tagID_CF, string MaxValue, string MinValue)
{
string procedureName;
procedureName = "测量数据合格_手动拧紧_增加";
SqlParameter[] thisParms = new SqlParameter[11];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@EngineTypeID", engineTypeID);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@EngineType", engineType);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@EngineID", engineID);
thisParms[3] = new System.Data.SqlClient.SqlParameter("@TagValue", tagValue);
thisParms[4] = new System.Data.SqlClient.SqlParameter("@合格标志", isGoodBad);
thisParms[5] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[6] = new System.Data.SqlClient.SqlParameter("@托盘编号", partPallet);
thisParms[7] = new System.Data.SqlClient.SqlParameter("@TagID", tagID);
thisParms[8] = new System.Data.SqlClient.SqlParameter("@TagID_CF", tagID_CF);
thisParms[9] = new System.Data.SqlClient.SqlParameter("@上限值", MaxValue);
thisParms[10] = new System.Data.SqlClient.SqlParameter("@下限值", MinValue);
return DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
}
///
/// 测量数据合格索引_增加_电芯
///
///
///
///
///
///
///
///
///
///
public static bool BaseData_tagTable_QualityData_B5A_IndexInsert_cell(string EngineID, string tagID, string EngineType, int EngineTypeID, string opName, int isGoodBad, string PartPalletCode, out int Id_tagCF)
{
string procedureName;
procedureName = "测量数据合格索引_增加_电芯";
Id_tagCF = 0;
SqlParameter[] thisParms = new SqlParameter[8];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@EngineID", EngineID);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@TagID_CF", tagID);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@EngineType", EngineType);
thisParms[3] = new System.Data.SqlClient.SqlParameter("@EngineTypeID", EngineTypeID);
thisParms[4] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[5] = new System.Data.SqlClient.SqlParameter("@托盘编号", PartPalletCode);
thisParms[6] = new System.Data.SqlClient.SqlParameter("@合格标志", isGoodBad);
thisParms[7] = new System.Data.SqlClient.SqlParameter("@Id_tagCF", Id_tagCF);
thisParms[7].Direction = ParameterDirection.Output;
if (DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms))
{
Id_tagCF = Convert.ToInt32(thisParms[7].Value.ToString());
return true;
}
return false;
}
///
/// 测量数据合格_增加_电芯
///
///
///
///
///
///
///
///
public static bool BaseData_tagTable_QualityData_B5A_Insert_cell(int Id_tagCF, int engineTypeID, string engineID, string opName, DataTable dt, bool IsCheck = false)
{
string procedureName;
procedureName = "测量数据合格_增加_电芯";
SqlParameter[] thisParms = new SqlParameter[15];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@Id_tagCF", Id_tagCF);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@EngineTypeID", engineTypeID);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@EngineID", engineID);
thisParms[3] = new System.Data.SqlClient.SqlParameter("@TagID", SqlDbType.Int, 4, "TagID");
thisParms[4] = new System.Data.SqlClient.SqlParameter("@TagValue", SqlDbType.NVarChar, 100, "TagValue");
thisParms[5] = new System.Data.SqlClient.SqlParameter("@IsGoodBad", SqlDbType.Int, 4, "IsGoodBad");
//是否保存无合格标志数据数据
//thisParms[6] = new System.Data.SqlClient.SqlParameter("@IsCheck", IsCheck);
thisParms[6] = new System.Data.SqlClient.SqlParameter("@测量位置", SqlDbType.NVarChar, 50, "测量位置");
thisParms[7] = new System.Data.SqlClient.SqlParameter("@测量项目", SqlDbType.NVarChar, 50, "测量项目");
thisParms[8] = new System.Data.SqlClient.SqlParameter("@工位号", opName); //为了给J07MA020 保留四位精度而设置
thisParms[9] = new System.Data.SqlClient.SqlParameter("@理论值", SqlDbType.NVarChar, 50, "理论值");
thisParms[10] = new System.Data.SqlClient.SqlParameter("@上限值", SqlDbType.NVarChar, 50, "上限值");
thisParms[11] = new System.Data.SqlClient.SqlParameter("@下限值", SqlDbType.NVarChar, 50, "下限值");
thisParms[12] = new System.Data.SqlClient.SqlParameter("@测量单位", SqlDbType.NVarChar, 50, "测量单位");
thisParms[13] = new System.Data.SqlClient.SqlParameter("@列位置", SqlDbType.Int, 4, "列位置");
thisParms[14] = new System.Data.SqlClient.SqlParameter("@变量排序", SqlDbType.Int, 4, "变量排序");
//table.Columns.Add("TagID", typeof(System.Int32));
//table.Columns.Add("TagValue", typeof(System.String));
//table.Columns.Add("IsGoodBad", typeof(System.Int32));
//table.Columns.Add("测量位置", typeof(System.String));
//table.Columns.Add("测量项目", typeof(System.String));
//table.Columns.Add("工位号", typeof(System.String));
//table.Columns.Add("理论值", typeof(System.String));
//table.Columns.Add("上限值", typeof(System.String));
//table.Columns.Add("下限值", typeof(System.String));
//table.Columns.Add("测量单位", typeof(System.String));
//table.Columns.Add("列位置", typeof(System.Int32));
//table.Columns.Add("变量排序", typeof(System.Int32));
return DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms, dt);
}
///
/// MES_装配数据_零部件追溯_增加
///
///
///
///
public static bool Material_Insert(string opName, int m_ConfirmOkGo)
{
string produceName = "MES_装配数据_零部件追溯_增加";
SqlParameter[] thisParms = new SqlParameter[2];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@放行方式", m_ConfirmOkGo);
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
}
///
/// 测量数据发动机在线状态_增加数据
///
///
///
static public void WorkStartInsert_JZ(string opName, string engineID, int isOK)
{
string procedureName;
procedureName = "测量数据发动机在线状态_增加数据_JZ";
SqlParameter[] thisParms = new SqlParameter[3];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@发动机号", engineID);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@是否合格", isOK.ToString());
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
}
///
/// 测量数据发动机在线状态_增加数据
///
///
///
static public void WorkStartInsert(string opName, int isOK)
{
string procedureName;
procedureName = "测量数据发动机在线状态_增加数据";
SqlParameter[] thisParms = new SqlParameter[2];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@是否合格", isOK.ToString());
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
}
///
/// 接口_IOT接口_报工记录_增加
///
///
public static void IOT_Data_UpLode_Res_Save(string opName, string OrderID, string EngineID, string ReqType, bool reqIsOk, string ResText)
{
string produceName = "接口_IOT接口_报工记录_增加";
SqlParameter[] thisParms = new SqlParameter[6];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@订单号", OrderID);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@工件编号", EngineID);
thisParms[3] = new System.Data.SqlClient.SqlParameter("@报工类型", ReqType);
thisParms[4] = new System.Data.SqlClient.SqlParameter("@报工结果", reqIsOk);
thisParms[5] = new System.Data.SqlClient.SqlParameter("@结果报文", ResText);
DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
}
///
/// CallWebApi_FactoryMes_NGRecordSave
///
///
public static void CallWebApi_FactoryMes_NGRecordSave(string InterfaceName, int AID, string InterfaceUrl, string ReqText, string ResText)
{
string produceName = "CallWebApi_FactoryMes_NGRecordSave";
SqlParameter[] thisParms = new SqlParameter[5];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@接口名称", InterfaceName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@AID", AID);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@接口地址", InterfaceUrl);
thisParms[3] = new System.Data.SqlClient.SqlParameter("@请求内容", ReqText);
thisParms[4] = new System.Data.SqlClient.SqlParameter("@响应内容", ResText);
DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
}
///
/// 生产计划_派工订单_工件追溯_工位完工
///
///
///
///
public static bool WorkOrderOpWorkOver(string opName, string EngineID, string OrderFrom)
{
string produceName = "生产计划_派工订单_工件追溯_工位完工";
SqlParameter[] thisParms = new SqlParameter[3];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@订单号", OrderFrom);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@工件编号", EngineID);
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
}
///
/// 生产计划_派工订单_工件追溯_工位完工
///
///
///
///
public static bool SaveQualityInterfaceData(string opName, string EngineID)
{
string produceName = "接口_质量数据_增加";
SqlParameter[] thisParms = new SqlParameter[2];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@工件编号", EngineID);
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
}
///
/// 数据表
///
///
static public DataTable BuildDataTables_WWW()
{
DataTable table;
DataColumnCollection columns;
table = new DataTable();
columns = table.Columns;
table.Columns.Add("TagID", typeof(System.String));
table.Columns.Add("TagValue", typeof(System.String));
table.Columns.Add("IsGoodBad", typeof(System.Int32));
table.Columns.Add("测量位置", typeof(System.String));
table.Columns.Add("测量项目", typeof(System.String));
table.Columns.Add("工位号", typeof(System.String));
table.Columns.Add("理论值", typeof(System.String));
table.Columns.Add("上限值", typeof(System.String));
table.Columns.Add("下限值", typeof(System.String));
table.Columns.Add("测量单位", typeof(System.String));
table.Columns.Add("列位置", typeof(System.Int32));
table.Columns.Add("变量排序", typeof(System.Int32));
return table;
}
static public DataTable GetMobyTableByOpName(string opName)
{
DataTable dt;
string procedureName;
procedureName = "北汽福田工位状态监控MOBY_工位_查询";
SqlParameter[] thisParms = new SqlParameter[1];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms, out dt);
return dt;
}
///
/// 生产计划_派工订单_工件追溯_工件下线
///
///
///
///
public static bool WorkOrderOpWorkOutLine(string EngineID, string OrderFrom)
{
string produceName = "生产计划_派工订单_工件追溯_工件下线";
SqlParameter[] thisParms = new SqlParameter[2];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@订单号", OrderFrom);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@工件编号", EngineID);
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
}
///
/// XD_提前上料记录_获取
///
///
///
public static DataTable Get_ReqEarlyFeedingData(string opName)
{
DataTable dt = new DataTable();
string produceName = "XD_提前上料记录_获取";
SqlParameter[] thisParms = new SqlParameter[1];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt);
return dt;
}
///
///
///
///
///
///
///
public static bool Location_MIS_MOBY_Insert(string opName, string tagType, string tagValue)
{
string produceName = "XD_库位Moby_增加";
SqlParameter[] thisParms = new SqlParameter[3];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@库位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@变量类型", tagType);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@变量值", tagValue);
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
}
public static DataTable GetRequestReturnMaterials_Type(string opName, string type)
{
DataTable dt = new DataTable();
string produceName = "XD_库位叫料_叫料类型装换";
SqlParameter[] thisParms = new SqlParameter[2];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@叫料类型", type);
DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt);
return dt;
}
public static DataTable GetEngineType_Order(string opName, out int EngineTypeID, out string EngineType, out string EngineID, out string OrderForm, out int parType, out int isCheckOk, out string msg)
{
DataTable dt = new DataTable();
isCheckOk = 2;
EngineTypeID = 0;
EngineType = "";
EngineID = "";
parType = 0;
OrderForm = "";
msg = "";
string produceName = "XD_产品上线";
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)
{
EngineTypeID = Convert.ToInt32(dt.Rows[0]["产品型号代码"]);
EngineType = dt.Rows[0]["产品型号"].ToString();
EngineID = dt.Rows[0]["工件编号"].ToString();
OrderForm = dt.Rows[0]["订单号"].ToString();
parType = Convert.ToInt32(dt.Rows[0]["小机型"]);
isCheckOk = Convert.ToInt32(dt.Rows[0]["result"]);
msg = dt.Rows[0]["msg"].ToString();
return dt;
}
}
return dt;
}
public static DataTable GetEngineType_Order(string opName, string Program_No, out int EngineTypeID, out string EngineType, out string EngineID, out string OrderForm, out int isCheckOk, out int planCount, out int haveUplaodCount, out int remainingQuantity, out string msg)
{
DataTable dt = new DataTable();
isCheckOk = 2;
EngineTypeID = 0;
EngineType = "";
EngineID = "";
OrderForm = "";
planCount = 0;
haveUplaodCount = 0;
remainingQuantity = 0;
msg = "";
string produceName = "平芝_生产上线_判断机型订单是否匹配_分线";
SqlParameter[] thisParms = new SqlParameter[1];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
//thisParms[1] = new System.Data.SqlClient.SqlParameter("@PLC_机型代码", Program_No);
if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt))
{
if (dt.Rows.Count > 0)
{
EngineTypeID = Convert.ToInt32(dt.Rows[0]["机型代码"]);
EngineType = dt.Rows[0]["机型"].ToString();
EngineID = dt.Rows[0]["变速箱总成号"].ToString();
OrderForm = dt.Rows[0]["订单号"].ToString();
isCheckOk = Convert.ToInt32(dt.Rows[0]["是否匹配"]);
planCount = Convert.ToInt32(dt.Rows[0]["计划上料数量"]);
haveUplaodCount = Convert.ToInt32(dt.Rows[0]["已上料数量"]);
remainingQuantity = Convert.ToInt32(dt.Rows[0]["待上料数量"]);
msg = dt.Rows[0]["msg"].ToString();
return dt;
}
}
return dt;
}
///
/// 29 工位具体零件合格标志
///
///
static public string GetQualityData_GoodBad_String(bool[] QualityData_GoodBad)
{
string str;
str = "";
if (QualityData_GoodBad != null)
{
for (int i = 0; i < QualityData_GoodBad.Length; i++)
{
str = str + (Convert.ToInt32(QualityData_GoodBad[i])).ToString() + "|";
}
}
return str;
}
///
/// 返回非标准real
///
///
///
static public string GetNoNormalReal(object vDataValue)
{
try
{
string real_a;
string real_b;
string groupValueString;
int length;
//int real_b_Int;
length = ((System.Array)(vDataValue)).Length;
groupValueString = "";
if (length != 2)
return "0.0";
real_a = Convert.ToUInt16((((System.Array)(vDataValue)).GetValue(0))).ToString();
real_b = Convert.ToUInt16((((System.Array)(vDataValue)).GetValue(1))).ToString("00");
groupValueString = real_a + "." + real_b;
return groupValueString;
}
catch
{
////ApplicationLog.WriteLog(err, "GetNoNormalReal");
return "0.0";
}
}
///
/// 测量数据工位_监控系统_MOBY_查询_PDC
///
///
///
///
public static void Moby_Select_PDC(string EngineID, out string OrderForm, out string EngineType, out int EngineTypeCode)
{
DataTable dt = new DataTable();
OrderForm = "";
EngineType = "";
EngineTypeCode = 0;
try
{
string procedureName;
procedureName = "测量数据工位_监控系统_MOBY_查询_PDC";
SqlParameter[] thisParms = new SqlParameter[1];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@发动机号", EngineID);
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms, out dt);
if (dt.Rows.Count > 0)
{
OrderForm = dt.Rows[0]["订单号"].ToString();
EngineType = dt.Rows[0]["产品型号"].ToString();
EngineTypeCode = Convert.ToInt32(dt.Rows[0]["机型代码"].ToString());
}
}
catch
{
OrderForm = "";
EngineType = "";
EngineTypeCode = 0;
}
}
///
/// 基本数据_工作日历_班次产量查询_Web页面显示_初始化查询
///
///
///
///
public static void InitOpNameOuputCount(string opName, out int outputValue, out int nowOutputValue,
out int opNameBeatValue, out int NowOpNameBeatValue, out int classNumber)
{
outputValue = 0;//工位产量
nowOutputValue = 0;//在线产量
opNameBeatValue = 0;//工位节拍
NowOpNameBeatValue = 0;//在线节拍
classNumber = 0;//班次
try
{
string procedureName;
procedureName = "Web页面显示_计划产量初始化查询";
SqlParameter[] thisParms = new SqlParameter[6];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@工位产量", SqlDbType.Int, 4, "工位产量");
thisParms[1].Direction = ParameterDirection.Output;
thisParms[2] = new System.Data.SqlClient.SqlParameter("@工位节拍", SqlDbType.Int, 4, "工位节拍");
thisParms[2].Direction = ParameterDirection.Output;
thisParms[3] = new System.Data.SqlClient.SqlParameter("@在线产量", SqlDbType.Int, 4, "在线产量");
thisParms[3].Direction = ParameterDirection.Output;
thisParms[4] = new System.Data.SqlClient.SqlParameter("@在线节拍", SqlDbType.Int, 4, "在线节拍");
thisParms[4].Direction = ParameterDirection.Output;
thisParms[5] = new System.Data.SqlClient.SqlParameter("@班次代码", SqlDbType.Int, 4, "班次代码");
thisParms[5].Direction = ParameterDirection.Output;
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
if (thisParms[1].Value != null && thisParms[2].Value != null && thisParms[3].Value != null && thisParms[4].Value != null && thisParms[5].Value != null)
{
outputValue = Convert.ToInt32(thisParms[1].Value);
opNameBeatValue = Convert.ToInt32(thisParms[2].Value);
nowOutputValue = Convert.ToInt32(thisParms[3].Value);
NowOpNameBeatValue = Convert.ToInt32(thisParms[4].Value);
classNumber = Convert.ToInt32(thisParms[5].Value);
}
}
catch
{
outputValue = 0;
opNameBeatValue = 0;
nowOutputValue = 0;
NowOpNameBeatValue = 0;
classNumber = 0;
}
}
static public void GetImageFile(string opName, int engineTypeID, out byte[] pic)
{
string sql;
DataTable dt;
pic = null;
sql = "exec 电子看板_工位名称与产品型号产品图片_查询 '" + opName + "'," + engineTypeID.ToString();
DataAccess.ExecuteDataTable(sql, out dt);
if (dt != null)
{
if (dt.Rows.Count > 0)
{
pic = (byte[])dt.Rows[0]["产品图片"];
}
}
}
///
/// 电子看板_工位机型_质量数据测量位置_查询_工作顺序
///
/// 工位号
/// 产品型号代码
///
static public bool ShaftPositionSelect(string opNum, int EngineTypeID, out DataTable dt)
{
string procedureName = "电子看板_工位机型_质量数据测量位置_临时表_查询";
SqlParameter[] thisParms = new SqlParameter[2];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opNum);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@产品型号代码", EngineTypeID);
return DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms, out dt);
}
///
/// 测量数据合格_查询
///
///
///
///
///
static public bool QualitySelect(string opName, string engineID, out DataTable dt)
{
string procedureName = "测量数据合格_查询";
SqlParameter[] thisParms = new SqlParameter[2];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@发动机号", engineID);
return DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms, out dt);
}
///
/// 生产计划_派工订单_查询_工位执行_完工判断
///
///
///
///
///
public static void Select_OrderFormList_OrderComplete(string opName, out int isCompleted, out int num_plan, out int num_complete)
{
isCompleted = 0;//订单数量是否完全上线
num_plan = 0;//计划数量
num_complete = 0;//上线数量
try
{
string procedureName;
procedureName = "生产计划_派工订单_查询_工位执行_完工判断";
SqlParameter[] thisParms = new SqlParameter[4];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@ISCOMPLETE", SqlDbType.Int, 4, "ISCOMPLETE");
thisParms[1].Direction = ParameterDirection.Output;
thisParms[2] = new System.Data.SqlClient.SqlParameter("@NUM_PLAN", SqlDbType.Int, 4, "NUM_PLAN");
thisParms[2].Direction = ParameterDirection.Output;
thisParms[3] = new System.Data.SqlClient.SqlParameter("@NUM_COMPLETE", SqlDbType.Int, 4, "NUM_COMPLETE");
thisParms[3].Direction = ParameterDirection.Output;
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
if (thisParms[1].Value != null && thisParms[2].Value != null && thisParms[3].Value != null)
{
isCompleted = Convert.ToInt32(thisParms[1].Value);
num_plan = Convert.ToInt32(thisParms[2].Value);
num_complete = Convert.ToInt32(thisParms[3].Value);
}
}
catch
{
isCompleted = 0;
num_plan = 0;
num_complete = 0;
}
}
///
/// 生产计划_派工订单_查询_工位执行
///
/// 工位号
///
static public void OrderFormList_Select(string opName, out DataTable dt)
{
dt = null;
string sql = "exec 生产计划_派工订单_查询_工位执行 '" + opName + "'";
DataAccess.ExecuteDataTable(sql, out dt);
}
///
/// MES界面显示_弹窗消息_查询
///
///
///
///
public static bool ShowWindowNotice(string opname, out DataTable dt)
{
string procedureName = "MES界面显示_弹窗消息_查询";
SqlParameter[] sqlParameters = new SqlParameter[1];
sqlParameters[0] = new System.Data.SqlClient.SqlParameter("@工位号", opname);
return DataAccess.ExecuteStoredProcedure(procedureName, ref sqlParameters, out dt);
}
///
/// MES界面显示_消息滚动_查询
///
///
///
///
public static bool ShowLEDNotice(string opname, out DataTable dt)
{
string procedureName = "MES界面显示_消息滚动_查询";
SqlParameter[] sqlParameters = new SqlParameter[1];
sqlParameters[0] = new System.Data.SqlClient.SqlParameter("@工位号", opname);
return DataAccess.ExecuteStoredProcedure(procedureName, ref sqlParameters, out dt);
}
///
/// 电子看板_工位机型_物料检测测量位置_查询_物料检测
///
///
///
///
static public bool MaterialCheckSelect(string opName, out DataTable dt)
{
string procedureName = "电子看板_工位机型_物料检测测量位置_查询_物料检测";
SqlParameter[] thisParms = new SqlParameter[1];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
return DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms, out dt);
}
///
/// 电芯进站 离站
///
///
///
///
public static bool Cell_CheckDataAdd(string opName, string EngineID, string operationTime, int isOK)
{
string produceName = "测量数据合格_增加数据_电芯";
SqlParameter[] thisParms = new SqlParameter[4];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@发动机号", EngineID);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@操作时间", operationTime);
thisParms[3] = new System.Data.SqlClient.SqlParameter("@合格标志", isOK);
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
}
public static bool Cell_PassStation(string opName, string EngineID, string operationTime, int passType, int isOK = 1)
{
string produceName = "测量数据发动机在线状态_增加数据_电芯";
SqlParameter[] thisParms = new SqlParameter[5];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@发动机号", EngineID);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@操作时间", operationTime);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@合格标志", isOK);
thisParms[3] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[4] = new System.Data.SqlClient.SqlParameter("@过站类型", passType);
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
}
///
/// 报警接口记录 存储
/// 关机(0)/开机(1)/报警(2)/故障(3) 运行(4) 待机(5)
/// 注意事项:当设备状态发生变化时,给表里插入一条数据。状态时间字段精确到年月日时分秒。当状态没变化时,不用重复去存数据,不同的故障告警,认为是不同的状态,当前如果是报警1,先存一条报警1,如果一直是报警1,就不用重复存报警1,当又产生了报警2时,需要给表里再存一条报警2。场景如下:
////1.开机后,状态先存一条开机,3秒后,再继续存一条待机
////2.设备运行后,存一条运行
////3.有故障1时,存一条故障,内容为故障1
////4.有故障2时,存一条故障,内容为故障2
////5.故障1解除后,先存一条运行,如果还有故障2, 继续再存一条故障,内容为故障2
////6.故障2解除后,存一条运行或者待机(看设备具体是运行还是待机状态)
///
/// 工位号
/// 状态代码
/// 故障代码 如状态为故障/报警,记录故障/报警代码。
/// 故障名称 如状态为故障/报警,记录故障/报警名称
/// 故障说明 如状态为故障/报警,记录故障/报警说明。
/// 备注
///
public static bool errorPortSave(string opName, string DeviceStatus, string MalfunctionCode = null, string MalfunctionName = null, string Malfunctionexplain = null, string Remark = null, int? alarmRemove = null)
{
string produceName = "接口_工位运行状态_增加";
SqlParameter[] thisParms = new SqlParameter[7];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@状态代码", DeviceStatus);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@故障代码", MalfunctionCode);
thisParms[3] = new System.Data.SqlClient.SqlParameter("@故障名称", MalfunctionName);
thisParms[4] = new System.Data.SqlClient.SqlParameter("@故障说明", Malfunctionexplain);
thisParms[5] = new System.Data.SqlClient.SqlParameter("@备注", Remark);
thisParms[6] = new System.Data.SqlClient.SqlParameter("@alarmRemove", (object)alarmRemove ?? DBNull.Value);
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
}
///
/// 工位运行状态 存储
///
///
///
///
public static bool WorkRunStatusSave(string opName, int toolPowered, int toolStart, float energy)
{
string produceName = "接口_工位使用情况_增加";
SqlParameter[] thisParms = new SqlParameter[4];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@机床上电", toolPowered);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@循环开始", toolStart);
thisParms[3] = new System.Data.SqlClient.SqlParameter("@能耗", energy);
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
}
///
/// MES界面显示_弹窗消息_增加
///
///
///
///
public static bool Web_Notice_Insert(string opName, string notice)
{
string produceName = "MES界面显示_弹窗消息_增加";
SqlParameter[] thisParms = new SqlParameter[2];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@Notice", notice);
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
}
///
/// 基本数据_工作日历_班次产量查询_New
///
///
/// 在线产量
/// 在线节拍
static public void OpNameCount_New(string opName, out int opNameCount, out int opNameCountTime)
{
opNameCount = 0;
opNameCountTime = 0;
string procedureName;
procedureName = "基本数据_工作日历_班次产量查询_New";
SqlParameter[] thisParms = new SqlParameter[3];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@在线产量", 0);
thisParms[1].Direction = ParameterDirection.Output;
thisParms[2] = new System.Data.SqlClient.SqlParameter("@在线节拍", 0);
thisParms[2].Direction = ParameterDirection.Output;
if (DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms))
{
opNameCount = Convert.ToInt32(thisParms[1].Value);
opNameCountTime = Convert.ToInt32(thisParms[2].Value);
}
}
///
/// 基本数据_工作日历_班次产量查询_New
///
///
/// 在线产量
/// 在线节拍
static public void OpNameCount_BQ(string opName, out int opNameCount, out int opNameCountTime)
{
opNameCount = 0;
opNameCountTime = 0;
string procedureName;
procedureName = "基本数据_工作日历_班次产量查询_北汽";
SqlParameter[] thisParms = new SqlParameter[3];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@在线产量", 0);
thisParms[1].Direction = ParameterDirection.Output;
thisParms[2] = new System.Data.SqlClient.SqlParameter("@在线节拍", 0);
thisParms[2].Direction = ParameterDirection.Output;
if (DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms))
{
opNameCount = Convert.ToInt32(thisParms[1].Value);
opNameCountTime = Convert.ToInt32(thisParms[2].Value);
}
}
///
/// 电子看板_工位机型_质量数据测量位置_临时表_增加
///
///
///
public static bool MesServer_ShaftPosition_EngineTypeOver(string opName)
{
string produceName = "电子看板_工位机型_质量数据测量位置_临时表_增加";
SqlParameter[] thisParms = new SqlParameter[1];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
}
///
/// 电子看板_工位机型_质量数据测量位置_临时表_查询_完成情况
///
///
///
///
///
///
public static bool MesServer_ShaftPosition_Select_FinishResult(string opName, out int workGroupIndex, out string BoltCode, out bool sn_WorkingStepIsOver, out bool isHaveNg)
{
workGroupIndex = 0;
BoltCode = "";
sn_WorkingStepIsOver = true;
isHaveNg = false;
string produceName = "电子看板_工位机型_质量数据测量位置_临时表_查询_完成情况";
SqlParameter[] thisParms = new SqlParameter[5];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@组号", SqlDbType.Int, 4);
thisParms[1].Direction = ParameterDirection.Output;
thisParms[2] = new System.Data.SqlClient.SqlParameter("@套筒号", SqlDbType.NVarChar, 50);
thisParms[2].Direction = ParameterDirection.Output;
thisParms[3] = new System.Data.SqlClient.SqlParameter("@是否全部完成", SqlDbType.Int, 4);
thisParms[3].Direction = ParameterDirection.Output;
thisParms[4] = new System.Data.SqlClient.SqlParameter("@是否全部完成", SqlDbType.Int, 4);
thisParms[4].Direction = ParameterDirection.Output;
if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms))
{
workGroupIndex = Convert.ToInt32(thisParms[1].Value);
BoltCode = thisParms[2].Value.ToString();
sn_WorkingStepIsOver = Convert.ToBoolean(thisParms[3].Value);
isHaveNg = Convert.ToBoolean(thisParms[3].Value);
return true;
}
return false;
}
///
/// 电子看板_工位机型_质量数据测量位置_临时表_修改
///
///
///
///
///
///
public static bool MesServer_ShaftPosition_Update(string opName, int workGroupIndex, int IsOK, out bool IsFinish)
{
IsFinish = true;
string produceName = "电子看板_工位机型_质量数据测量位置_临时表_修改";
SqlParameter[] thisParms = new SqlParameter[4];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@组号", workGroupIndex);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@合格标志", IsOK);
thisParms[3] = new System.Data.SqlClient.SqlParameter("@是否全部完成", SqlDbType.Int, 4);
thisParms[3].Direction = ParameterDirection.Output;
if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms))
{
IsFinish = Convert.ToBoolean(thisParms[3].Value);
return true;
}
return false;
}
///
/// 电子看板_工位机型_质量数据测量位置_临时表_查询_完成情况
///
/// 工位号
/// 拧紧序号
/// 套筒号
/// 工步属性
/// 是否全部完成
///
public static bool MesServer_ShaftPosition_Select_FinishResult(string opName, out int ProcessCode, out int BoltCode, out int workStepProperty, out bool sn_WorkingStepIsOver, out bool isHaveNg)
{
BoltCode = 0;
ProcessCode = 512;
workStepProperty = 0;
sn_WorkingStepIsOver = true;
isHaveNg = false;
string produceName = "电子看板_工位机型_质量数据测量位置_临时表_查询_完成情况";
SqlParameter[] thisParms = new SqlParameter[6];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@拧紧序号", SqlDbType.Int, 4);
thisParms[1].Direction = ParameterDirection.Output;
thisParms[2] = new System.Data.SqlClient.SqlParameter("@套筒号", SqlDbType.Int, 4);
thisParms[2].Direction = ParameterDirection.Output;
thisParms[3] = new System.Data.SqlClient.SqlParameter("@工步属性", SqlDbType.Int, 4);
thisParms[3].Direction = ParameterDirection.Output;
thisParms[4] = new System.Data.SqlClient.SqlParameter("@是否全部完成", SqlDbType.Int, 4);
thisParms[4].Direction = ParameterDirection.Output;
thisParms[5] = new System.Data.SqlClient.SqlParameter("@是否存在不合格", SqlDbType.Int, 4);
thisParms[5].Direction = ParameterDirection.Output;
if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms))
{
ProcessCode = Convert.ToInt32(thisParms[1].Value);
BoltCode = Convert.ToInt32(thisParms[2].Value);
workStepProperty = Convert.ToInt32(thisParms[3].Value);
sn_WorkingStepIsOver = Convert.ToBoolean(thisParms[4].Value);
isHaveNg = Convert.ToBoolean(thisParms[5].Value);
return true;
}
return false;
}
///
/// 电子看板_工位机型_质量数据测量位置_临时表_修改_重新拧紧
///
/// 工位号
/// 拧紧序号
///
public static bool MesServer_ShaftPosition_FixAllow_Again(string opName, int ProcessCode)
{
string produceName = "电子看板_工位机型_质量数据测量位置_临时表_修改_重新拧紧";
SqlParameter[] thisParms = new SqlParameter[2];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@组号", ProcessCode);
if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms))
{
return true;
}
return false;
}
///
/// 测量数据项目
/// 用于B5A项目
///
///
public static DataTable BaseData_tagTable_QualityData_Item_B5A()
{
DataTable dt;
string sql;
sql = "SELECT TagID,0 as TagValue,TagName,工位号,数据来源,TagTypeID,TagLong,列位置,测量位置,变量类型代码,测量项目,TagAdr,TagAdrDemo,变量特点,变量排序 FROM [MES_基本变量_原始数据] "
+ " where (TagID <> 0 ) and "
+ " ((变量类型代码 = 9) "
+ " or (变量类型代码 = 10) "
+ " or (变量类型代码 = 11) "
+ " or (变量类型代码 = 80) "
+ " or (变量类型代码 = 101) "
+ " or (变量类型代码 = 102) "
+ " or (变量类型代码 = 78) "
+ " or (变量类型代码 = 79) "
+ " or (变量类型代码 = 41) "
+ " or (变量类型代码 = 51) "
+ " or (变量类型代码 = 8) "
+ " or (变量类型代码 = 21) "
+ " or (变量类型代码 = 105)) "
+ " and (是否启用 = 1)";
DataAccess.ExecuteDataTable(sql, out dt);
return dt;
}
///
/// 测量数据合格索引_分线数据_删除
///
///
///
///
public static bool BaseData_tagTable_QualityData_B5A_SubTable_Delete
(string engineID, string opName)
{
string procedureName;
procedureName = "测量数据合格索引_分线数据_删除";
SqlParameter[] thisParms = new SqlParameter[2];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@EngineID", engineID);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
return DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
}
///
/// MES_装配数据_零部件追溯_增加_不合格
///
///
///
///
public static bool Material_Insert_NG(string opName, int m_ConfirmOkGo)
{
string produceName = "MES_装配数据_零部件追溯_增加_不合格";
SqlParameter[] thisParms = new SqlParameter[2];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@放行方式", m_ConfirmOkGo);
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
}
///
/// 测量数据发动机在线状态_查询_是否已工作
///
///
/// 新零件号(机型)
///
public static DataTable EngineIsTwoWork(string opName, string OrderForm, string EngineID)
{
DataTable dt = new DataTable();
string produceName = "测量数据发动机在线状态_查询_是否已工作";
SqlParameter[] thisParms = new SqlParameter[3];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@订单号", OrderForm);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@总成号", EngineID);
DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt);
return dt;
}
///
/// 测量数据发动机在线状态_增加数据
///
///
///
static public DataTable CheckAllFinish(string opName, string EngineID, int type)
{
string procedureName;
DataTable dt = new DataTable();
procedureName = "测量数据工位_测试工位状态_修改";
SqlParameter[] thisParms = new SqlParameter[3];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@发动机号", EngineID);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@type", type);
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms, out dt);
return dt;
}
///
/// 报警工位记录表_新增
///
///
///
///
///
///
static public void Alarm_Insert2(int TagID, string opName, string Text, int Status, string errType)
{
//@TagID ,
//@工位号,
// @报警内容,
// @报警类型,
// @报警状态
string procedureName;
procedureName = "报警工位记录表_新增";
SqlParameter[] thisParms = new SqlParameter[5];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@TagID", TagID);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@报警内容", Text);
thisParms[3] = new System.Data.SqlClient.SqlParameter("@报警类型", errType);
thisParms[4] = new System.Data.SqlClient.SqlParameter("@报警状态", Status);
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
}
public static DataTable XD_MaterialsVerify(string opName, string engineID, string materialsCode, int MaterialsTypeCode)
{
DataTable dt = new DataTable();
string produceName = "XD_物料记录_增加";
SqlParameter[] thisParms = new SqlParameter[4];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工件编号", engineID);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@物料编码", materialsCode);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
thisParms[3] = new System.Data.SqlClient.SqlParameter("@物料类型编号", MaterialsTypeCode);
DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt);
return dt;
}
///
/// 报警工位记录表_MOBY_查询
///
public static void Alarm_Moby_Search(out DataTable dt)
{
string procedureName;
procedureName = "报警工位记录表_MOBY_查询";
SqlParameter[] thisParms = new SqlParameter[0];
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms, out dt);
}
///
/// 生产计划_派工订单_配送信息_验证记录_校验
///
///
///
public static DataTable Get_MaterialsScanOverRes(string opName, string order, string engineID, string materialsCode)
{
DataTable dt = new DataTable();
string produceName = "生产计划_派工订单_配送信息_验证记录_校验";
SqlParameter[] thisParms = new SqlParameter[4];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@订单号", order);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@工件编号", engineID);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@物料编码", materialsCode);
thisParms[3] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt);
return dt;
}
public static DataTable Rrunning_AGV_Arrive(string opName)
{
DataTable dt = new DataTable();
string produceName = "XD_磨合_AGV到达";
SqlParameter[] thisParms = new SqlParameter[1];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@库位号", opName);
DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt);
return dt;
}
public static DataTable Rrunning_AGV_Leave(string opName)
{
DataTable dt = new DataTable();
string produceName = "XD_磨合_AGV离开";
SqlParameter[] thisParms = new SqlParameter[1];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@库位号", opName);
DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt);
return dt;
}
public static DataTable Rrunning_GetNextStoreData(string opName, string EngineID, string EngineType)
{
DataTable dt = new DataTable();
string produceName = "XD_磨合_获取下一序";
SqlParameter[] thisParms = new SqlParameter[3];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@库位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@产品编号", EngineID);
thisParms[2] = new System.Data.SqlClient.SqlParameter("@产品型号", EngineType);
DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt);
return dt;
}
public static DataTable Rrunning_UpdateOpCallStatus(string opName, int status)
{
DataTable dt = new DataTable();
string produceName = "XD_磨合_状态_是否呼叫_更新";
SqlParameter[] thisParms = new SqlParameter[2];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@库位号", opName);
thisParms[1] = new System.Data.SqlClient.SqlParameter("@是否呼叫", status);
DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt);
return dt;
}
}
}