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

32 lines
1.0 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 EquipMaterialBindValidator: IDataValidator
{
public ValidateResult Validate(DAObject data,DAIValidation validOption)
{
var bindingdal = new DAL.QT.MaterialBindingDAL();
var bindings = bindingdal.GetBindingList("EQUIP", data.MachineCode);
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));
}
}
}