天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.8 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//Ref:
using System.Data;
using QMAPP.BoraUpgrade.Common;
using QMAPP.BoraUpgrade.Entity;
namespace QMAPP.BoraUpgrade.DAL
{
public class WorkCellDAL
{
#region 根据当前工位码提取前序工位处理码
/// <summary>
/// 根据当前工位码提取前序工位处理码
/// </summary>
/// <returns></returns>
public static string GetPreWorkCellProccessCode(string currWorkCellCode, int _Count, int OutTime, string metairal_type)
{
string returnVal = string.Empty;
string sqlScript =
@"
select top {0} A.PRODUCTCODE as PRODUCTCODE from T_AW_MAINOPERATION A left join (Select PRODUCTCODE From T_AW_Product
Where WORKLOC_CODE = '{2}' And Material_Type = '{3}' And UPDATEDATE > DATEADD(hh,-{1},GETDATE() )) B ON A.PRODUCTCODE = B.PRODUCTCODE
WHERE A.UPDATEDATE > DATEADD(hh,-{1},GETDATE() )
And A.WorkCell_Code In
(
Select Pre_WorkCell_Code From [dbo].T_MD_PROCESS_ROUTE_WORKCELL_SEQ Where FLGDEL = 0 And WorkCell_Code = '{2}'
)
and B.PRODUCTCODE IS NULL
Order By A.OperatedDate Desc
";
string aa = string.Format(sqlScript, _Count, OutTime, currWorkCellCode, metairal_type);
DataSet dataSet = SqlHelper.ExecuteDataset(
Config.maindbConnectionString, CommandType.Text, string.Format(sqlScript, _Count, OutTime, currWorkCellCode, metairal_type));
if (dataSet.Tables[0].Rows.Count > 0)
{
returnVal = dataSet.Tables[0].Rows[dataSet.Tables[0].Rows.Count - 1][0].ToString();
}
return returnVal;
}
#endregion
}
}