685 lines
36 KiB
C#
685 lines
36 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using DataLinkMesWork;
|
|
using System.Security.Cryptography;
|
|
//using SystemFramework;
|
|
|
|
namespace bizFacade
|
|
{
|
|
public partial class MaterialPull
|
|
{
|
|
#region
|
|
//---------------------------------MES.Function中的----------------------------------
|
|
/// <summary>
|
|
/// 物料拉动_工位物料需求单_转移_查询_单号
|
|
/// </summary>
|
|
/// <param name="opName">工位号</param>
|
|
/// <param name="opName_Checked">1</param>
|
|
/// <param name="dt"></param>
|
|
static public void MaterialPush_ListNumer_Select(int orderNum_Check, string orderNum, int opName_Checked, string opName,int type_Check,string type, out DataTable dt)
|
|
{
|
|
dt = null;
|
|
string sql = "物料拉动_工位物料需求单_转移_查询_单号 " + orderNum_Check + ",'" + orderNum + "'," + opName_Checked + ",'" + opName + "'," + type_Check + ",'" + type+"'";
|
|
DataAccess.ExecuteDataTable(sql, out dt);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 物料拉动_工位物料需求单_转移_查询
|
|
/// </summary>
|
|
/// <param name="opName">工位号</param>
|
|
/// <param name="dt"></param>
|
|
static public void MaterialPush_Details_Select(string listNumber,string opName, out DataTable dt)
|
|
{
|
|
dt = null;
|
|
string sql = "物料拉动_工位物料需求单_转移_查询 '" + listNumber + "','" + opName + "'";
|
|
DataAccess.ExecuteDataTable(sql, out dt);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 物料拉动_线边库存_接受物料_物料需求单
|
|
/// </summary>
|
|
/// <param name="opName"></param>
|
|
/// <param name="DistributionNum"></param>
|
|
/// <param name="tb"></param>
|
|
/// <returns></returns>
|
|
public static bool DistributionNum(string opName, string DistributionNum)
|
|
{
|
|
string produceName = "物料拉动_线边库存_接受物料_物料需求单";
|
|
SqlParameter[] thisParms = new SqlParameter[2];
|
|
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
|
|
thisParms[1] = new System.Data.SqlClient.SqlParameter("@配送单号", DistributionNum);
|
|
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
|
|
}
|
|
/// <summary>
|
|
/// 配送单实时同步表数据增加
|
|
/// </summary>
|
|
/// <param name="dt"></param>
|
|
/// <returns></returns>
|
|
static public bool MaterialPull_DocumentInfo_Add(DataTable dt)
|
|
{
|
|
//string connectionString = ApplicationConfig.ConnectionString;
|
|
string produceName = "AMES_物料拉动_配送物料接收_配送物料信息_增加";
|
|
SqlParameter[] thisParms = new SqlParameter[12];
|
|
thisParms[0] = new System.Data.SqlClient.SqlParameter("@仓库地址", SqlDbType.NVarChar, 50, "WAREHOUSE_CODE");
|
|
thisParms[1] = new System.Data.SqlClient.SqlParameter("@创建时间", SqlDbType.DateTime, 50, "CREATION_DATE");
|
|
thisParms[2] = new System.Data.SqlClient.SqlParameter("@订单号", SqlDbType.NVarChar, 50, "ORDER_NUMBER");
|
|
thisParms[3] = new System.Data.SqlClient.SqlParameter("@工位号", SqlDbType.NVarChar, 50, "DISTRIBUTE_WKC_CODE");
|
|
thisParms[4] = new System.Data.SqlClient.SqlParameter("@供应商代码", SqlDbType.NVarChar, 50, "SUPPLIER_CODE");
|
|
thisParms[5] = new System.Data.SqlClient.SqlParameter("@卡片条码", SqlDbType.NVarChar, 50, "BARCODE");
|
|
thisParms[6] = new System.Data.SqlClient.SqlParameter("@类型", SqlDbType.NVarChar, 50, "IS_DOCUMENT");
|
|
thisParms[7] = new System.Data.SqlClient.SqlParameter("@配送单号", SqlDbType.NVarChar, 50, "DOCUMENT_NUM");
|
|
thisParms[8] = new System.Data.SqlClient.SqlParameter("@配送数量", SqlDbType.Int, 50, "QUANTITY");
|
|
thisParms[9] = new System.Data.SqlClient.SqlParameter("@批次号", SqlDbType.NVarChar, 50, "LOT_NUMBER");
|
|
thisParms[10] = new System.Data.SqlClient.SqlParameter("@条码数量", SqlDbType.Int, 50, "BARCODE_QTY");
|
|
thisParms[11] = new System.Data.SqlClient.SqlParameter("@物料号", SqlDbType.NVarChar, 50, "ITEM_CODE");
|
|
if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, dt))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取卡片一览信息查询
|
|
/// </summary>
|
|
/// <param name="opName"></param>
|
|
/// <param name="itemCode"></param>
|
|
/// <param name="dt"></param>
|
|
public static bool getMaterialNumInfo(string opName, string itemCode, out DataTable dt)
|
|
{
|
|
string errorMessage;
|
|
string sql;
|
|
//string connectionString_MES = ApplicationConfig.ConnectionString;
|
|
sql = "SELECT 线边库存流水号,订单号,工位号,物料号,卡片条码,批次号,当前数量 AS '库存数量',卡片数量,使用标志 FROM dbo.AMES_物料拉动_线边库存 WHERE 工位号='" + opName + "' AND 物料号='" + itemCode + "' ORDER BY 使用标志 DESC";
|
|
return DataAccess.ExecuteDataTable(sql, out dt);
|
|
}
|
|
/// <summary>
|
|
/// 物料号一览信息查询
|
|
/// </summary>
|
|
/// <param name="opcnum"></param>
|
|
/// <param name="dt"></param>
|
|
public static void InitMaterial_Dialog_MaterialNum(string opcnum, out DataTable dt)
|
|
{
|
|
//string connectionString = ApplicationConfig.ConnectionString;
|
|
string errorMessage;
|
|
string sql;
|
|
dt = null;
|
|
sql = "SELECT DISTINCT 物料号 FROM dbo.AMES_物料拉动_线边库存 WHERE 工位号='" + opcnum + "' GROUP BY 物料号 ORDER BY 物料号 ";
|
|
DataAccess.ExecuteDataTable(sql, out dt);
|
|
|
|
}
|
|
/// <summary>
|
|
/// 查询班次
|
|
/// </summary>
|
|
/// <param name="tb"></param>
|
|
public static void Getclasses(out DataTable tb)
|
|
{
|
|
string sql = "SELECT [班次代码],[班次描述] FROM [dbo].[AMES_物料拉动_人员班组管理_班次信息] ORDER BY 班次代码 ";
|
|
//string connectionString = ApplicationConfig.ConnectionString;
|
|
string errorMessage;
|
|
tb = null;
|
|
DataAccess.ExecuteDataTable(sql, out tb);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询打卡上线人数
|
|
/// </summary>
|
|
/// <param name="opname"></param>
|
|
/// <param name="dt"></param>
|
|
public static void Search_OnlineInfo(string opname, out DataTable dt)
|
|
{
|
|
string sql = "SELECT [工位号] ,[操作者工号],[操作者姓名] ,[班次] ,[操作时间] FROM [dbo].[AMES_物料拉动_测量数据工位_监控系统_员工在线信息表] WHERE [工位号]='" + opname + "'";
|
|
//string connectionString = ApplicationConfig.ConnectionString;
|
|
string errorMessage;
|
|
dt = null;
|
|
DataAccess.ExecuteDataTable(sql, out dt);
|
|
}
|
|
public static void ClassName_Select(string ClassCode, out DataTable dt)
|
|
{
|
|
//string connectionString = ApplicationConfig.ConnectionString;
|
|
string errorMessage;
|
|
string sql;
|
|
sql = "SELECT top 1 班次描述 FROM AMES_物料拉动_人员班组管理_班次信息 WHERE [班次代码]='" + ClassCode + "'";
|
|
dt = null;
|
|
DataAccess.ExecuteDataTable(sql, out dt);
|
|
}
|
|
public static bool ConfirmClass( out string confirmclass)
|
|
{
|
|
string procedureName = "AMES_物料拉动_人员班组管理_班次信息_查询";
|
|
//string connectionString = ApplicationConfig.ConnectionString;
|
|
string errorMessage;
|
|
confirmclass = "";
|
|
SqlParameter[] sqlParameters = new SqlParameter[1];
|
|
sqlParameters[0] = new SqlParameter("@班次", SqlDbType.NVarChar, 50);
|
|
sqlParameters[0].Direction = ParameterDirection.Output;
|
|
if (DataAccess.ExecuteStoredProcedure(procedureName, ref sqlParameters))
|
|
{
|
|
confirmclass = sqlParameters[0].Value.ToString();
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// [测量数据工位_监控系统_员工在线信息表_增加]
|
|
/// </summary>
|
|
/// <param name="OperatorName"></param>
|
|
/// <param name="Password"></param>
|
|
/// <param name="Classes"></param>
|
|
/// <param name="Msg"></param>
|
|
/// <returns></returns>
|
|
public static bool Insert_WorkingHours(string Opname, string OperatorName, string Password, string Classes, out string Msg)
|
|
{
|
|
string procedureName = "AMES_物料拉动_测量数据工位_监控系统_员工在线信息表_员工上线";
|
|
//string connectionString = ApplicationConfig.ConnectionString;
|
|
string errorMessage;
|
|
Msg = "";
|
|
SqlParameter[] sqlParameters = new SqlParameter[5];
|
|
sqlParameters[0] = new System.Data.SqlClient.SqlParameter("@操作者工号", OperatorName);
|
|
sqlParameters[1] = new System.Data.SqlClient.SqlParameter("@工位号", Opname);
|
|
sqlParameters[2] = new System.Data.SqlClient.SqlParameter("@员工密码", Password);
|
|
sqlParameters[3] = new System.Data.SqlClient.SqlParameter("@班次", Classes);
|
|
sqlParameters[4] = new SqlParameter("@Result", SqlDbType.NVarChar, 50);
|
|
sqlParameters[4].Direction = ParameterDirection.Output;
|
|
|
|
if (DataAccess.ExecuteStoredProcedure(procedureName, ref sqlParameters))
|
|
{
|
|
Msg = sqlParameters[4].Value.ToString();
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region
|
|
//---------------------------------login中的----------------------------------
|
|
/// <summary>
|
|
/// 查询工作中心
|
|
/// </summary>
|
|
/// <param name="barcode"></param>
|
|
/// <param name="dt"></param>
|
|
public static DataTable DirectUpload_WorkCenterCode_Select()
|
|
{
|
|
DataTable dt = null;
|
|
string sql;
|
|
sql = "SELECT top 1 工作中心 FROM dbo.AMES_物料拉动_MES_工厂与工作中心 ";
|
|
DataAccess.ExecuteDataTable(sql, out dt);
|
|
return dt;
|
|
}
|
|
|
|
//新增直供上线
|
|
public static bool DirectUpload_VerifyTempTable_Delete(string opName)
|
|
{
|
|
string produceName = "AMES_物料拉动_直供上线_验证临时表_删除";
|
|
SqlParameter[] thisParms = new SqlParameter[1];
|
|
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
|
|
|
|
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
|
|
}
|
|
//新增直供上线
|
|
public static bool DirectUpload_VerifyTempTable_Add(string opName, DataTable dt)
|
|
{
|
|
string produceName = "AMES_物料拉动_直供上线_验证临时表_增加";
|
|
SqlParameter[] thisParms = new SqlParameter[18];
|
|
thisParms[0] = new System.Data.SqlClient.SqlParameter("@仓库地址", SqlDbType.NVarChar, 50, "WAREHOUSE_CODE");
|
|
thisParms[1] = new System.Data.SqlClient.SqlParameter("@是否标准", SqlDbType.NVarChar, 50, "NOTIFICATION_TYPE_MEAN");
|
|
thisParms[2] = new System.Data.SqlClient.SqlParameter("@允许接收", SqlDbType.NVarChar, 50, "IS_NEED_VALIDATING");
|
|
thisParms[3] = new System.Data.SqlClient.SqlParameter("@工厂", SqlDbType.NVarChar, 50, "PLANT_ID");
|
|
thisParms[4] = new System.Data.SqlClient.SqlParameter("@工作中心", SqlDbType.NVarChar, 50, "PROD_LINE_CODE");
|
|
thisParms[5] = new System.Data.SqlClient.SqlParameter("@卡片条码", SqlDbType.NVarChar, 50, "SGL_CODE");
|
|
thisParms[6] = new System.Data.SqlClient.SqlParameter("@物料号", SqlDbType.NVarChar, 50, "ITEM_CODE");
|
|
thisParms[7] = new System.Data.SqlClient.SqlParameter("@物料描述", SqlDbType.NVarChar, 50, "DESCRIPTIONS");
|
|
thisParms[8] = new System.Data.SqlClient.SqlParameter("@卡片数量", SqlDbType.NVarChar, 50, "QUANTITY");
|
|
thisParms[9] = new System.Data.SqlClient.SqlParameter("@批次号", SqlDbType.NVarChar, 50, "LOT_NUMBER");
|
|
thisParms[10] = new System.Data.SqlClient.SqlParameter("@供应商代码", SqlDbType.NVarChar, 50, "SUPPLIER_CODE");
|
|
thisParms[11] = new System.Data.SqlClient.SqlParameter("@工位号", SqlDbType.NVarChar, 50, "DISTRIBUTE_WKC_CODE");
|
|
thisParms[12] = new System.Data.SqlClient.SqlParameter("@配送单号", SqlDbType.NVarChar, 50, "ATTRIBUTE9");
|
|
thisParms[13] = new System.Data.SqlClient.SqlParameter("@订单号", SqlDbType.NVarChar, 50, "ORDER_NUMBER");
|
|
thisParms[14] = new System.Data.SqlClient.SqlParameter("@线边地址", SqlDbType.NVarChar, 50, "WAREHOUSE_CODE1");
|
|
thisParms[15] = new System.Data.SqlClient.SqlParameter("@创建时间", SqlDbType.NVarChar, 50, "CREATION_DATE");
|
|
thisParms[16] = new System.Data.SqlClient.SqlParameter("@条码状态", SqlDbType.NVarChar, 50, "STATUS");
|
|
thisParms[17] = new System.Data.SqlClient.SqlParameter("@验证工位号", opName);
|
|
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, dt);
|
|
}
|
|
//新增直供上线
|
|
public static bool DirectUpload_VerifyTempTable_Select(string opName, string document_Num, out string process_Message, out DataTable dt)
|
|
{
|
|
process_Message = "";
|
|
string procedureName = "AMES_物料拉动_直供上线_验证临时表_查询_送货单行";
|
|
SqlParameter[] thisParms = new SqlParameter[3];
|
|
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
|
|
thisParms[1] = new System.Data.SqlClient.SqlParameter("@配送单号", document_Num);
|
|
thisParms[2] = new System.Data.SqlClient.SqlParameter("@PROCESS_MESSGE", SqlDbType.NVarChar, 200);
|
|
thisParms[2].Direction = ParameterDirection.Output;
|
|
if (DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms, out dt))
|
|
{
|
|
process_Message = thisParms[2].Value.ToString();
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public static bool DirectUpload_VerifyTempTable_Barcode_Select(string opName, string document_Num, string barcode, out string process_Message, out DataTable dt)
|
|
{
|
|
process_Message = "";
|
|
string procedureName = "AMES_物料拉动_直供上线_验证临时表_查询_料箱标签";
|
|
SqlParameter[] thisParms = new SqlParameter[4];
|
|
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
|
|
thisParms[1] = new System.Data.SqlClient.SqlParameter("@配送单号", document_Num);
|
|
thisParms[2] = new System.Data.SqlClient.SqlParameter("@卡片条码", barcode);
|
|
thisParms[3] = new System.Data.SqlClient.SqlParameter("@PROCESS_MESSGE", SqlDbType.NVarChar, 200);
|
|
thisParms[3].Direction = ParameterDirection.Output;
|
|
if (DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms, out dt))
|
|
{
|
|
process_Message = thisParms[3].Value.ToString();
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public static bool DirectUpload_VerifyTempTable_VerifyOK(string opName, string document_Num, out string process_Message)
|
|
{
|
|
process_Message = "";
|
|
string procedureName = "AMES_物料拉动_直供上线_验证临时表_验证成功";
|
|
SqlParameter[] thisParms = new SqlParameter[3];
|
|
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
|
|
thisParms[1] = new System.Data.SqlClient.SqlParameter("@配送单号", document_Num);
|
|
thisParms[2] = new System.Data.SqlClient.SqlParameter("@PROCESS_MESSGE", SqlDbType.NVarChar, 200);
|
|
thisParms[2].Direction = ParameterDirection.Output;
|
|
if (DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms))
|
|
{
|
|
process_Message = thisParms[2].Value.ToString();
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public static bool DirectUpload_ReceiveRecord_Select(string opName, string document_Num, string groupId, out DataTable dt)
|
|
{
|
|
|
|
string procedureName = "AMES_物料拉动_直供上线_接收记录_查询";
|
|
SqlParameter[] thisParms = new SqlParameter[2];
|
|
thisParms[0] = new System.Data.SqlClient.SqlParameter("@配送单号", document_Num);
|
|
thisParms[1] = new System.Data.SqlClient.SqlParameter("@GroupID", groupId);
|
|
return DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms, out dt);
|
|
}
|
|
public static bool DirectUpload_VerifyTempTable_NoticeOK(string opName, string document_Num, string groupId, int isOk, string outResult)
|
|
{
|
|
string produceName = "AMES_物料拉动_直供上线_验证临时表_调用成功";
|
|
SqlParameter[] thisParms = new SqlParameter[5];
|
|
thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
|
|
thisParms[1] = new System.Data.SqlClient.SqlParameter("@配送单号", document_Num);
|
|
thisParms[2] = new System.Data.SqlClient.SqlParameter("@GROUPID", groupId);
|
|
thisParms[3] = new System.Data.SqlClient.SqlParameter("@是否成功", isOk);
|
|
thisParms[4] = new System.Data.SqlClient.SqlParameter("@PROCESS_MESSGE", outResult);
|
|
return DataAccess.ExecuteStoredProcedure(produceName, ref thisParms);
|
|
}
|
|
|
|
public static DataTable DirectUpload_OpName_Select(string opName)
|
|
{
|
|
DataTable dt = null;
|
|
string sql;
|
|
sql = "SELECT top 1 指南工位号 FROM MES_计划BOM_工位与名称 WHERE 工位号='" + opName + "'";
|
|
DataAccess.ExecuteDataTable(sql, out dt);
|
|
return dt;
|
|
}
|
|
/// <summary>
|
|
/// 物料拉动_库存盘点_物料号查询
|
|
/// </summary>
|
|
/// <param name="tb"></param>
|
|
|
|
public static void Init_MaterialNumCombobox(string Opname, out DataTable dt_MaterialNum)
|
|
{
|
|
string sql = "SELECT DISTINCT ROW_NUMBER() OVER (ORDER BY 物料号 )AS ID,[物料号] FROM AMES_物料拉动_线边库存 WHERE 工位号='" + Opname + "' GROUP BY 物料号 ORDER BY 物料号 ";
|
|
//string connectionString = ApplicationConfig.ConnectionString;
|
|
string errorMessage;
|
|
dt_MaterialNum = null;
|
|
DataAccess.ExecuteDataTable(sql, out dt_MaterialNum);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 物料拉动_库存盘点_消耗
|
|
/// </summary>
|
|
/// <param name="OrderNumber"></param>
|
|
/// <param name="ConsumeNum"></param>
|
|
/// <returns></returns>
|
|
public static bool Consume_StockCount(string OrderNumber, string ConsumeNum, string Opname, string CardNum)
|
|
{
|
|
string procedureName = "[AMES_物料拉动_线边库存_消耗_人工盘点]";
|
|
//string connectionString = ApplicationConfig.ConnectionString_MES;
|
|
string errorMessage;
|
|
bool isOK;
|
|
SqlParameter[] sqlParameters = new SqlParameter[4];
|
|
sqlParameters[0] = new System.Data.SqlClient.SqlParameter("@订单号", OrderNumber);
|
|
sqlParameters[1] = new System.Data.SqlClient.SqlParameter("@消耗数量", ConsumeNum);
|
|
sqlParameters[2] = new System.Data.SqlClient.SqlParameter("@盘点工位号", Opname);
|
|
sqlParameters[3] = new System.Data.SqlClient.SqlParameter("@卡片条码", CardNum);
|
|
isOK = DataAccess.ExecuteStoredProcedure(procedureName, ref sqlParameters);
|
|
if (isOK)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
static public bool MaterialPull_DocumentInfo_ReceiveRecord_Select(string document_Num, string groupId, out DataTable dt)
|
|
{
|
|
//此存储过程与直供上线通用
|
|
string procedureName = "AMES_物料拉动_直供上线_接收记录_查询";
|
|
SqlParameter[] thisParms = new SqlParameter[2];
|
|
thisParms[0] = new System.Data.SqlClient.SqlParameter("@配送单号", document_Num);
|
|
thisParms[1] = new System.Data.SqlClient.SqlParameter("@GroupID", groupId);
|
|
if (DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms, out dt))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
|
|
//调用成功
|
|
static public bool MaterialPull_DocumentInfo_NoticeOK(string document_Num, string groupId, int isOk, string outResult)
|
|
{
|
|
string process_Message = "";
|
|
string produceName = "AMES_物料拉动_配送物料接收_调用成功";
|
|
SqlParameter[] thisParms = new SqlParameter[4];
|
|
thisParms[0] = new System.Data.SqlClient.SqlParameter("@配送单号", document_Num);
|
|
thisParms[1] = new System.Data.SqlClient.SqlParameter("@GROUPID", groupId);
|
|
thisParms[2] = new System.Data.SqlClient.SqlParameter("@是否成功", isOk);
|
|
thisParms[3] = new System.Data.SqlClient.SqlParameter("@PROCESS_MESSGE", outResult);
|
|
if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
public static bool DocumentOutLineInfo_Select(string distributionNum, out DataTable dt)
|
|
{
|
|
string sql;
|
|
sql = "SELECT * FROM AMES_物料拉动_线边库存_备份 WHERE 配送单号='" + distributionNum + "'";
|
|
dt = null;
|
|
return DataAccess.ExecuteDataTable(sql, out dt);
|
|
}
|
|
|
|
public static bool WorkStationInfo_Select(out DataTable dt)
|
|
{
|
|
string sql;
|
|
sql = "SELECT top 1 工作中心 FROM AMES_物料拉动_MES_工厂与工作中心 ";
|
|
return DataAccess.ExecuteDataTable(sql, out dt);
|
|
}
|
|
//物料拉动_库存盘点_初始化 DataGrid
|
|
public static void init_StockCount(string opname, string MaterialNum, out DataTable dt_StockCount)
|
|
{
|
|
string sql = "SELECT DISTINCT A.线边库存流水号,A.工位号, A.订单号,A.当前数量, A.物料号, B.物料描述, A.卡片条码 FROM AMES_物料拉动_线边库存 as A INNER JOIN dbo.AMES_物料拉动_生产计划_派工订单BOM_分配到工位 AS B ON A.物料号 = B.物料号 where A.工位号='" + opname + "'and A.物料号='" + MaterialNum + "' ORDER BY [物料号]";
|
|
//string connectionString = ApplicationConfig.ConnectionString;
|
|
string errorMessage;
|
|
dt_StockCount = null;
|
|
DataAccess.ExecuteDataTable(sql, out dt_StockCount);
|
|
}
|
|
/// <summary>
|
|
/// 物料拉动_库存盘点_订单号查询
|
|
/// </summary>
|
|
/// <param name="dt_OrderNumber"></param>
|
|
public static void Init_FinalOrderNumberCombobox(out DataTable dt_OrderNumber)
|
|
{
|
|
string dateString = DateTime.Now.ToString("yyyy-MM-01");
|
|
string sql = "SELECT DISTINCT ROW_NUMBER() OVER (ORDER BY 订单号 )AS ID,订单号 FROM [dbo].[AMES_物料拉动_生产计划_派工订单完工统计] WHERE 操作时间 > '" + dateString + "' GROUP BY 订单号 ORDER BY [订单号]";
|
|
//string connectionString = ApplicationConfig.ConnectionString;
|
|
string errorMessage;
|
|
dt_OrderNumber = null;
|
|
DataAccess.ExecuteDataTable(sql, out dt_OrderNumber);
|
|
}
|
|
/// <summary>
|
|
/// FTT总成编号查询
|
|
/// </summary>
|
|
/// <param name="dt_EngineNum"></param>
|
|
public static void Init_FinalListCombobox(string opName, out DataTable dt_EngineNum)
|
|
{
|
|
string sql;
|
|
sql = "SELECT TOP 20 ROW_NUMBER() OVER (ORDER BY 发动机号 )AS ID, 发动机号 FROM [dbo].[测量数据发动机在线状态_跟踪发动机条码状态]" + "WHERE 工位号='" + opName + "' ORDER BY 发动机号 DESC";
|
|
//string connectionString = ApplicationConfig.ConnectionString;
|
|
string errorMessage;
|
|
dt_EngineNum = null;
|
|
DataAccess.ExecuteDataTable(sql, out dt_EngineNum);
|
|
}
|
|
/// <summary>
|
|
/// 缺陷代码查询
|
|
/// </summary>
|
|
/// <param name="opName"></param>
|
|
/// <param name="dt_EngineNum"></param>
|
|
public static void Init_DefectCodeCombobox(string opName, out DataTable dt_DefectCode)
|
|
{
|
|
string sql;
|
|
sql = "SELECT [编号],[编号描述] FROM [dbo].[ANDON_类型_编号]where 工位号='" + opName + "'AND [安东类型代码]=2 ";
|
|
//string connectionString = ApplicationConfig.ConnectionString;
|
|
string errorMessage;
|
|
dt_DefectCode = null;
|
|
DataAccess.ExecuteDataTable(sql, out dt_DefectCode);
|
|
}
|
|
/// <summary>
|
|
/// 质量管理_质量FTT_不合格品补录_临时表_增加
|
|
/// </summary>
|
|
/// <param name="opname"></param>
|
|
/// <param name="andoTypeCode"></param>
|
|
/// <param name="EngineNum"></param>
|
|
/// <param name="group_Number"></param>
|
|
/// <param name="defect_Number"></param>
|
|
/// <param name="ProblemDate"></param>
|
|
/// <param name="callCount"></param>
|
|
/// <param name="Msg"></param>
|
|
/// <returns></returns>
|
|
public static bool Insert_FTTInformation(string opname, string andoTypeCode, string EngineNum, string group_Number, string defect_Number, string ProblemDate, int callCount, out string Msg)
|
|
{
|
|
string procedureName = "质量管理_质量FTT_不合格品补录_临时表_增加";
|
|
//string connectionString = ApplicationConfig.ConnectionString;
|
|
string errorMessage;
|
|
Msg = "";
|
|
SqlParameter[] sqlParameters = new SqlParameter[8];
|
|
sqlParameters[0] = new System.Data.SqlClient.SqlParameter("@工位号", opname);
|
|
sqlParameters[1] = new System.Data.SqlClient.SqlParameter("@代码组", group_Number);
|
|
sqlParameters[2] = new System.Data.SqlClient.SqlParameter("@代码", defect_Number);
|
|
sqlParameters[3] = new System.Data.SqlClient.SqlParameter("@呼叫数量", callCount);
|
|
sqlParameters[4] = new System.Data.SqlClient.SqlParameter("@安东类型代码", andoTypeCode);
|
|
sqlParameters[5] = new System.Data.SqlClient.SqlParameter("@工件编号", EngineNum);
|
|
sqlParameters[6] = new System.Data.SqlClient.SqlParameter("@问题日期", ProblemDate);
|
|
sqlParameters[7] = new SqlParameter("@Msg", SqlDbType.NVarChar, 50);
|
|
sqlParameters[7].Direction = ParameterDirection.Output;
|
|
|
|
if (DataAccess.ExecuteStoredProcedure(procedureName, ref sqlParameters))
|
|
{
|
|
Msg = sqlParameters[7].Value.ToString();
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
static public bool MaterialPull_DocumentInfo_CreateRecord(string document_Num, out string process_Message)
|
|
{
|
|
process_Message = "";
|
|
string procedureName = "AMES_物料拉动_配送物料接收_产生接收记录";
|
|
SqlParameter[] thisParms = new SqlParameter[2];
|
|
thisParms[0] = new System.Data.SqlClient.SqlParameter("@配送单号", document_Num);
|
|
thisParms[1] = new System.Data.SqlClient.SqlParameter("@PROCESS_MESSGE", SqlDbType.NVarChar, 200);
|
|
thisParms[1].Direction = ParameterDirection.Output;
|
|
if (DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms))
|
|
{
|
|
process_Message = thisParms[1].Value.ToString();
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 校验发动机号
|
|
/// </summary>
|
|
/// <param name="Final_EngineNum"></param>
|
|
/// <param name="dt_DefectCode"></param>
|
|
public static void Confirm_EngineNum(string Final_EngineNum, string DefectGroup, string DefectCode, string Opname, out DataTable dt_DefectCode)
|
|
{
|
|
string sql;
|
|
sql = " SELECT COUNT(*)FROM 质量管理_质量FTT_不合格品_临时表 WHERE 产品序列号 ='" + Final_EngineNum + "' AND 代码='" + DefectCode + "' AND 代码组='" + DefectGroup + "' AND 工位号='" + Opname + "' ";
|
|
//string connectionString = ApplicationConfig.ConnectionString;
|
|
string errorMessage;
|
|
dt_DefectCode = null;
|
|
DataAccess.ExecuteDataTable(sql, out dt_DefectCode);
|
|
}
|
|
/// 查询指南工位号
|
|
/// </summary>
|
|
/// <param name="Final_EngineNum"></param>
|
|
/// <param name="dt_DefectCode"></param>
|
|
public static void OpName_Convert_Select(string opname, out DataTable dt_ConvertOpname)
|
|
{
|
|
|
|
string errorMessage;
|
|
string sql;
|
|
sql = " SELECT 指南工位号 FROM MES_计划BOM_工位与名称 WHERE 工位号='" + opname + "' ";
|
|
//string connectionString = ApplicationConfig.ConnectionString;
|
|
dt_ConvertOpname = null;
|
|
DataAccess.ExecuteDataTable(sql, out dt_ConvertOpname);
|
|
|
|
}
|
|
#endregion
|
|
/// <summary>
|
|
/// 订单机型查询
|
|
/// </summary>
|
|
/// <param name="startTime"></param>
|
|
/// <param name="endTime"></param>
|
|
/// <param name="dt"></param>
|
|
public static void Init_OrderNum_Query(string startTime, string endTime, out DataTable dt)
|
|
{
|
|
string sql;
|
|
sql = "SELECT [订单号] ,[产品型号] FROM dbo.AMES_物料拉动_生产计划_派工订单_订单历史 where 计划开始时间>='" + startTime + "'and 计划开始时间<='" + endTime + "' ORDER BY 计划开始时间";
|
|
//string connectionString = ApplicationConfig.ConnectionString;
|
|
string errorMessage;
|
|
dt = null;
|
|
DataAccess.ExecuteDataTable(sql, out dt);
|
|
}
|
|
/// <summary>
|
|
/// 工位工时补报统计
|
|
/// </summary>
|
|
/// <param name="orderNum"></param>
|
|
/// <param name="Opname"></param>
|
|
/// <param name="dt"></param>
|
|
public static void Init_Worktime(string orderNum, string Opname, int Num, out DataTable dt)
|
|
{
|
|
string procedureName;
|
|
procedureName = "AMES_物料拉动_生产计划_派工订单完工统计_工时统计";
|
|
SqlParameter[] sqlParameters = new SqlParameter[3];
|
|
sqlParameters[0] = new System.Data.SqlClient.SqlParameter("@订单号", orderNum);
|
|
sqlParameters[1] = new System.Data.SqlClient.SqlParameter("@工位号", Opname);
|
|
sqlParameters[2] = new System.Data.SqlClient.SqlParameter("@Workplace", Num);
|
|
DataAccess.ExecuteStoredProcedure(procedureName, ref sqlParameters, out dt);
|
|
}
|
|
public static void workTime_CompleteCount(string OrderNum, out DataTable dt)
|
|
{
|
|
string sql = "SELECT SUM(报工数量) FROM [dbo].[测量数据发动机在线状态_跟踪发动机条码状态] WHERE [订单号]='" + OrderNum + "'AND [工位标识]='O' AND [使用标志]='1' AND 是否禁用=0";
|
|
//string connectionString = ApplicationConfig.ConnectionString;
|
|
string errorMessage;
|
|
dt = null;
|
|
DataAccess.ExecuteDataTable(sql, out dt);
|
|
}
|
|
public static void init_Statistics(string orderNum, string Opname, out DataTable dt)
|
|
{
|
|
string procedureName;
|
|
procedureName = "AMES_物料拉动_测量数据发动机在线状态_跟踪发动机条码状态_工时补报统计";
|
|
SqlParameter[] sqlParameters = new SqlParameter[2];
|
|
sqlParameters[0] = new System.Data.SqlClient.SqlParameter("@订单号", orderNum);
|
|
sqlParameters[1] = new System.Data.SqlClient.SqlParameter("@工位号", Opname);
|
|
|
|
DataAccess.ExecuteStoredProcedure(procedureName, ref sqlParameters, out dt);
|
|
}
|
|
/// <summary>
|
|
/// 校验工时补录人员[MES_用户管理_人员]
|
|
/// </summary>
|
|
/// <param name="OperatorName"></param>
|
|
/// <param name="dt"></param>
|
|
public static void Confirm_Person(string OperatorName, out DataTable dt)
|
|
{
|
|
string sql = "SELECT COUNT(*) FROM [dbo].[MES_用户管理_人员] WHERE [用户名]='" + OperatorName + "'";
|
|
//string connectionString = ApplicationConfig.ConnectionString;
|
|
string errorMessage;
|
|
dt = null;
|
|
DataAccess.ExecuteDataTable(sql, out dt);
|
|
}
|
|
/// <summary>
|
|
/// AMES_物料拉动_生产计划_派工订单_查询_根据订单
|
|
/// </summary>
|
|
/// <param name="orderNum"></param>
|
|
/// <param name="dt"></param>
|
|
public static void Init_Ordernum_data(string orderNum, out DataTable dt)
|
|
{
|
|
string procedureName;
|
|
procedureName = "AMES_物料拉动_生产计划_派工订单_查询_根据订单";
|
|
SqlParameter[] sqlParameters = new SqlParameter[1];
|
|
sqlParameters[0] = new System.Data.SqlClient.SqlParameter("@订单号", orderNum);
|
|
DataAccess.ExecuteStoredProcedure(procedureName, ref sqlParameters, out dt);
|
|
}
|
|
|
|
public static void ClassCode_Select(string ClassName, out DataTable dt)
|
|
{
|
|
//string connectionString = ApplicationConfig.ConnectionString;
|
|
string errorMessage;
|
|
string sql;
|
|
sql = "SELECT top 1 班次代码 FROM AMES_物料拉动_人员班组管理_班次信息 WHERE [班次描述]='" + ClassName + "'";
|
|
dt = null;
|
|
DataAccess.ExecuteDataTable(sql, out dt);
|
|
}
|
|
|
|
public static bool Workinghours_Insert(string OrderNum, string EngineType, string Opname, int Count, string OperatorName, string Classes, string UploadTime)
|
|
{
|
|
string procedureName = "AMES_物料拉动_测量数据发动机在线状态_跟踪发动机条码状态_工时补报_增加";
|
|
//string connectionString = ApplicationConfig.ConnectionString_MES;
|
|
string errorMessage;
|
|
bool isOK;
|
|
SqlParameter[] sqlParameters = new SqlParameter[7];
|
|
sqlParameters[0] = new System.Data.SqlClient.SqlParameter("@订单号", OrderNum);
|
|
sqlParameters[1] = new System.Data.SqlClient.SqlParameter("@发动机型号", EngineType);
|
|
sqlParameters[2] = new System.Data.SqlClient.SqlParameter("@工位号", Opname);
|
|
sqlParameters[3] = new System.Data.SqlClient.SqlParameter("@报工数量", Count);
|
|
sqlParameters[4] = new System.Data.SqlClient.SqlParameter("@操作者工号", OperatorName);
|
|
sqlParameters[5] = new System.Data.SqlClient.SqlParameter("@班次", Classes);
|
|
sqlParameters[6] = new System.Data.SqlClient.SqlParameter("@报工时间", UploadTime);
|
|
isOK = DataAccess.ExecuteStoredProcedure(procedureName, ref sqlParameters);
|
|
if (isOK)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 物料拉动工位库存查询
|
|
/// </summary>
|
|
/// <param name="opName"></param>
|
|
/// <param name="itemCode"></param>
|
|
/// <param name="dt"></param>
|
|
/// <returns></returns>
|
|
public static void getWorkStationMaterialInfo(string opName, out DataTable dt)
|
|
{
|
|
string procedureName;
|
|
procedureName = "AMES_电子看板_装配零件_库存信息_查询";
|
|
SqlParameter[] sqlParameters = new SqlParameter[1];
|
|
sqlParameters[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
|
|
DataAccess.ExecuteStoredProcedure(procedureName, ref sqlParameters, out dt);
|
|
}
|
|
}
|
|
|
|
|
|
}
|