53 lines
1.5 KiB
C#
53 lines
1.5 KiB
C#
|
using DeviceRepair.DataAccess.Data;
|
|||
|
using DeviceRepair.Models;
|
|||
|
using DeviceRepair.Models.SFC;
|
|||
|
using NLog;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Data.SqlClient;
|
|||
|
|
|||
|
namespace DeviceRepair.DataAccess.SFC
|
|||
|
{
|
|||
|
public class BatchDa : BaseDa
|
|||
|
{
|
|||
|
private static readonly Logger log = LogManager.GetCurrentClassLogger();
|
|||
|
|
|||
|
public BatchDa(IDictionary<string, string> apiParams) : base(apiParams)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 判断批次是否存在
|
|||
|
/// </summary>
|
|||
|
/// <param name=""></param>
|
|||
|
/// <returns></returns>
|
|||
|
public APIResponseData GetBatchInfoToStaff(out bool BatchExists)
|
|||
|
{
|
|||
|
BatchExists = false;
|
|||
|
try
|
|||
|
{
|
|||
|
string Batch = string.Empty;
|
|||
|
if (!ApiParameters.ContainsKey("Batch"))
|
|||
|
{
|
|||
|
throw new ArgumentException("参数批次号不能为空!");
|
|||
|
}
|
|||
|
|
|||
|
Batch = ApiParameters["Batch"].Trim();
|
|||
|
int Count = sfcData.Queryable<InspBatchInfo>().Count(x => x.Batch.ToUpper().Equals(Batch.ToUpper()));
|
|||
|
BatchExists = Count > 0;
|
|||
|
return new APIResponseData { Code = 1 };
|
|||
|
}
|
|||
|
catch (SqlException sqlEx)
|
|||
|
{
|
|||
|
throw sqlEx;
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
log.Error(ex);
|
|||
|
throw ex;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|