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.
54 lines
2.1 KiB
54 lines
2.1 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using QMAPP.FJC.TRACING.DAInterface;
|
|
|
|
namespace QMAPP.FJC.TRACING.DataValidators
|
|
{
|
|
/// <summary>
|
|
/// FIS断号验证
|
|
/// </summary>
|
|
public class FISBreakValidator : IDataValidator
|
|
{
|
|
public ValidateResult Validate(DAObject data, Entity.QT.DAIValidation validOption)
|
|
{
|
|
|
|
DAL.ProductionPlan.WorkOrderDAL workorderdal = new DAL.ProductionPlan.WorkOrderDAL();
|
|
|
|
//获取当前工序优先级最高的工单
|
|
var workorder = workorderdal.GetMatchOrders(data.WorkLocState.WORKCELL_CODE);
|
|
if (workorder.Count > 0)
|
|
{
|
|
if (string.Equals(workorder[0].ORDER_TYPE, "0")) //如果为FIS工单
|
|
{
|
|
//获取前一个FIS计划顺序号
|
|
var lastseqstr = workorderdal.GetLastFISSEQ(workorder[0].PLAN_DATE, workorder[0].WORKCENTER_CODE);
|
|
if (!string.IsNullOrEmpty(lastseqstr))
|
|
{
|
|
int maxseq=1999;
|
|
int minseq = 1;
|
|
int lastseq = int.Parse(lastseqstr);
|
|
int currentseq = int.Parse(workorder[0].SEQ);
|
|
if (lastseq < maxseq)
|
|
{
|
|
if (currentseq - lastseq > 1)
|
|
{
|
|
return new ValidateResult(false, string.Format("当前FIS计划顺序号({0})发生断号,请确认FIS计划!", workorder[0].SEQ));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (currentseq != minseq)
|
|
{
|
|
return new ValidateResult(false, string.Format("当前FIS计划顺序号({0})发生断号,请确认FIS计划!", workorder[0].SEQ));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return new ValidateResult(true, "");
|
|
|
|
}
|
|
}
|
|
}
|
|
|