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.
53 lines
1.8 KiB
53 lines
1.8 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using QMAPP.FJC.TRACING.DAInterface;
|
|
using QMAPP.FJC.Entity.QT;
|
|
using QMAPP.FJC.Entity.Operation;
|
|
|
|
namespace QMAPP.FJC.TRACING.DataValidators
|
|
{
|
|
/// <summary>
|
|
/// 零件状态校验
|
|
/// </summary>
|
|
public class PartStateValidator:IDataValidator
|
|
{
|
|
public ValidateResult Validate(DAObject data, DAIValidation validOption)
|
|
{
|
|
if (string.Equals(data.DAI.DATA_TYPE, "SN") || string.Equals(data.DAI.DATA_TYPE, "BN")) //采集点类型为SN和BN的需要进行跳序校验
|
|
{
|
|
DAL.Produce.ProductDAL pdal = new DAL.Produce.ProductDAL();
|
|
var product = data.GetObjectFromCache<Product>(p => p.PID == data.ObjectPID);
|
|
if (product == null)
|
|
{
|
|
product = pdal.GetByPID(data.ObjectPID);
|
|
if (product == null)
|
|
{
|
|
throw new Exception("查找零件信息失败!");
|
|
}
|
|
data.ObjectCacheList.Add(product);
|
|
}
|
|
if (product != null)
|
|
{
|
|
if (string.Equals(product.STATUS, "0"))
|
|
{
|
|
return new ValidateResult(true, "");
|
|
}
|
|
else
|
|
{
|
|
return new ValidateResult(false, "此零件为不可用状态!");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
throw new Exception("查找零件信息失败!");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return new ValidateResult(true, "");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|