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.
69 lines
2.5 KiB
69 lines
2.5 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 DPElectricalCheckValidator: IDataValidator
|
|
{
|
|
public ValidateResult Validate(DAObject data, DAIValidation validOption)
|
|
{
|
|
if (!string.Equals(data.DAI.DATA_TYPE, "SN")) //采集点类型为SN
|
|
{
|
|
return new ValidateResult(true, "");
|
|
}
|
|
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);
|
|
}
|
|
var bindingdal = new DAL.QT.MaterialBindingDAL();
|
|
//获取需要电检的产品物料信息
|
|
var bindings = bindingdal.GetBindingList("ECHECK", "ECHECK");
|
|
if (data.OrderPlan == null)
|
|
{
|
|
throw new Exception("查找计划信息失败!");
|
|
}
|
|
if (!bindings.Exists(p => p.MATERIAL_CODE == data.OrderPlan.MATERIAL_CODE))
|
|
{
|
|
//此门板不需要电检则直接返回校验合格
|
|
return new ValidateResult(true, "");
|
|
}
|
|
var echeckdal = new DAL.Operation.ElectricalCheckDAL();
|
|
var result = echeckdal.ValidElectricalCheck(product.PRODUCTCODE);
|
|
|
|
switch (result)
|
|
{
|
|
case 0:
|
|
{
|
|
return new ValidateResult(false, string.Format("零件“{0}”无电检记录!", product.PRODUCTCODE));
|
|
//break;
|
|
}
|
|
case 1:
|
|
{
|
|
return new ValidateResult(true, "");
|
|
//break;
|
|
}
|
|
case -1:
|
|
{
|
|
return new ValidateResult(false, string.Format("零件“{0}”电检不合格!", product.PRODUCTCODE));
|
|
////break;
|
|
}
|
|
}
|
|
return new ValidateResult(true, "");
|
|
}
|
|
}
|
|
}
|
|
|