天津投入产出系统后端
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.
 
 
 
 
 
 

41 lines
1.4 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMAPP.FJC.TRACING.DAInterface;
using QMAPP.FJC.Entity.QT;
namespace QMAPP.FJC.TRACING.DataValidators
{
/// <summary>
/// 校验采集到的物料信息与模具号的绑定关系
/// </summary>
public class MouldNoMaterialBindValidator : IDataValidator
{
public ValidateResult Validate(DAObject data, DAIValidation validOption)
{
var mn = data.WorkLocState.DataCache.FirstOrDefault(p => p.DATA_TYPE == "MN");
if (mn != null&&!string.IsNullOrEmpty(mn.DA_VALUE))
{
var bindingdal = new DAL.QT.MaterialBindingDAL();
var bindings = bindingdal.GetBindingList(data.DAI.WORKLOC_CODE + "_MOULD", mn.DA_VALUE);
if (bindings.Count == 0)
{
return new ValidateResult(true, "");
}
if (bindings.FirstOrDefault(p => p.MATERIAL_CODE == data.MaterialCode) != null)
{
return new ValidateResult(true, "");
}
return new ValidateResult(false, string.Format("物料“{0}”不可在当前模具上加工!", data.MaterialCode));
}
else
{
return new ValidateResult(false, string.Format("缺少模具信息!", data.MaterialCode));
}
}
}
}