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

71 lines
2.6 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMAPP.FJC.TRACING.DAInterface;
using QMAPP.FJC.BLL.FwMark;
namespace QMAPP.FJC.TRACING.DataValidators
{
public class LightOn: IDataValidator
{
public ValidateResult Validate(DAObject data, Entity.QT.DAIValidation validOption)
{
try
{
if (data.OrderPlan != null)
{
var bomdal = new MD.DAL.PbomDAL();
var bomitems = bomdal.GetPbomItemList(new MD.Entity.PbomItem { PBOM_CODE = data.OrderPlan.PBOM_CODE, GMP = data.DAI.WORKCELL_CODE, UP_SQ_NUM = -1 });
var adaptmaterials = (from bomtiem in bomitems
select bomtiem.MATERIAL_CODE).ToList();
Action act = new Action(() =>
{
try
{
//亮灯
FJC.BLL.X_Gate.LightController lightcontrollor = new BLL.X_Gate.LightController();
lightcontrollor.LightOnCell(data.WorkLocState.WORKLOC_CODE, adaptmaterials);
}
catch
{
}
});
act.BeginInvoke(null, null);
}
else
{
var bomdal = new MD.DAL.PbomDAL();
var bomloclas=bomdal.LocateBom(data.MaterialCode);
if (bomloclas.Count == 1)
{
var bomitems = bomdal.GetBomItemsByLocate(bomloclas[0]);
var adaptmaterials = (from bomtiem in bomitems
select bomtiem.MATERIAL_CODE).ToList();
Action act = new Action(() =>
{
try
{
//亮灯
FJC.BLL.X_Gate.LightController lightcontrollor = new BLL.X_Gate.LightController();
lightcontrollor.LightOnCell(data.WorkLocState.WORKLOC_CODE, adaptmaterials);
}
catch
{
}
});
act.BeginInvoke(null, null);
}
}
}
catch (Exception ex)
{
throw ex;
}
return new ValidateResult(true, "");
}
}
}