111 lines
5.2 KiB
C#
111 lines
5.2 KiB
C#
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;
|
||
|
||
namespace MesServerFunctions
|
||
{
|
||
public class Db
|
||
{
|
||
public static bool 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)
|
||
{
|
||
DataTable dt = new DataTable();
|
||
isCheckOk = 2;
|
||
EngineTypeID = 0;
|
||
EngineType = "";
|
||
EngineID = "";
|
||
OrderForm = "";
|
||
planCount = 0;
|
||
haveUplaodCount = 0;
|
||
remainingQuantity = 0;
|
||
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 && dt.Rows[0]["是否匹配"].ToString() == "1")
|
||
{
|
||
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]["待上料数量"]);
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 北汽福田变速器序列号总线上线_获得机型信息
|
||
/// </summary>
|
||
/// <param name="partSn"></param>
|
||
/// <param name="EngineTypeID"></param>
|
||
/// <param name="EngineType"></param>
|
||
/// <param name="EngineID"></param>
|
||
/// <param name="IsRepeatedNumber"> 0 不重号;1 重号;2:失败</param>
|
||
/// <returns></returns>
|
||
public static bool GetEngineTypeUpload(string partSn, out int EngineTypeID, out string EngineType, out string EngineID,out int IsRepeatedNumber)
|
||
{
|
||
DataTable dt = new DataTable();
|
||
EngineTypeID = 0;
|
||
EngineType = "";
|
||
EngineID = "";
|
||
IsRepeatedNumber = 2;
|
||
string produceName = "北汽福田变速器序列号总线上线_获得机型信息";
|
||
SqlParameter[] thisParms = new SqlParameter[1];
|
||
thisParms[0] = new System.Data.SqlClient.SqlParameter("@变速器序列号", partSn);
|
||
|
||
thisParms[2].Direction = ParameterDirection.Output;
|
||
if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms,out dt))
|
||
{
|
||
if(dt.Rows.Count > 0)
|
||
{
|
||
IsRepeatedNumber = Convert.ToInt32( dt.Rows[0]["IsRepeatedNumber"]);
|
||
EngineTypeID = Convert.ToInt32(dt.Rows[0]["EngineTypeID"]);
|
||
EngineType = dt.Rows[0]["EngineType"].ToString();
|
||
EngineID = partSn;
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
/// <summary>
|
||
/// 北汽福田变速器序列号总线上线_增加
|
||
/// </summary>
|
||
/// <param name="partSn"></param>
|
||
/// <param name="EngineTypeID"></param>
|
||
/// <param name="EngineType"></param>
|
||
/// <param name="OpName"></param>
|
||
/// <returns></returns>
|
||
public static bool UpLoadOpNameInsert(string partSn, int EngineTypeID, string EngineType, string OpName)
|
||
{
|
||
|
||
string produceName = "北汽福田变速器序列号总线上线_增加";
|
||
SqlParameter[] thisParms = new SqlParameter[4];
|
||
thisParms[0] = new System.Data.SqlClient.SqlParameter("@变速器序列号", partSn);
|
||
thisParms[1] = new System.Data.SqlClient.SqlParameter("@基本型号代码", EngineTypeID);
|
||
thisParms[2] = new System.Data.SqlClient.SqlParameter("@基本型号", EngineType);
|
||
thisParms[3] = new System.Data.SqlClient.SqlParameter("@工位号", OpName);
|
||
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
|
||
}
|
||
public static bool UpLoadOpNameInsert_Lungu(string partSn, string OpName)
|
||
{
|
||
string produceName = "北汽福田工位_轮毂上线_记录数据";
|
||
SqlParameter[] thisParms = new SqlParameter[2];
|
||
thisParms[0] = new System.Data.SqlClient.SqlParameter("@总成号", partSn);
|
||
thisParms[1] = new System.Data.SqlClient.SqlParameter("@工位号", OpName);
|
||
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
|
||
}
|
||
|
||
}
|
||
}
|