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.
47 lines
1.1 KiB
47 lines
1.1 KiB
3 years ago
|
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 ProductMaxCodeDAL
|
||
|
{
|
||
|
#region 根据工单ID提取物料列表
|
||
|
/// <summary>
|
||
|
/// 根据工单ID提取物料列表
|
||
|
/// </summary>
|
||
|
/// <returns></returns>
|
||
|
public static int GetProductMaxCode(string MATERIAL_TYPE_CODE, string GenerateDate, string ProductType)
|
||
|
{
|
||
|
int returnVal = 1;
|
||
|
|
||
|
string sqlScript =
|
||
|
@"
|
||
|
SELECT ISNULL(MAX(RIGHT(PRODUCTCODE,6)),0)
|
||
|
FROM T_AW_PRODUCT WHERE MATERIAL_TYPE='{0}'
|
||
|
AND DATEDIFF(day,CREATEDATE,'{1}')=0
|
||
|
AND PRODUCTCODE LIKE '{2}%';
|
||
|
";
|
||
|
|
||
|
sqlScript = string.Format(sqlScript, MATERIAL_TYPE_CODE,GenerateDate, ProductType);
|
||
|
|
||
|
string result =
|
||
|
SqlHelper.ExecuteScalar(Config.maindbConnectionString, CommandType.Text, sqlScript).ToString();
|
||
|
|
||
|
|
||
|
int.TryParse(result, out returnVal);
|
||
|
|
||
|
return returnVal+1;
|
||
|
}
|
||
|
#endregion
|
||
|
}
|
||
|
}
|