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.
64 lines
2.4 KiB
64 lines
2.4 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using QMAPP.FJC.TRACING.DAInterface;
|
|
using System.Text.RegularExpressions;
|
|
|
|
namespace QMAPP.FJC.TRACING.DataValidators
|
|
{
|
|
/// <summary>
|
|
/// FIS顺序校验
|
|
/// </summary>
|
|
public class FISSEQValidator : IDataValidator
|
|
{
|
|
public ValidateResult Validate(DAObject data, Entity.QT.DAIValidation validOption)
|
|
{
|
|
string regexp_full = "^D\\d{2}\\w+[RF][LR]\\d{2}(10|11|12|0[1-9])(30|31|2\\d|1\\d|0[1-9])\\w\\d{5}$";
|
|
//如果不是FIS码 不校验
|
|
if(!Regex.IsMatch(data.DAValue.ToString(),regexp_full))
|
|
{
|
|
return new ValidateResult(true, "");
|
|
}
|
|
if (data.OrderPlan == null)
|
|
{
|
|
return new ValidateResult(true, "");
|
|
}
|
|
DAL.FIS.OrderPlanDAL odal = new DAL.FIS.OrderPlanDAL();
|
|
var plan= odal.Get(new Entity.FIS.OrderPlan { PID = data.OrderPlan.ORDERPLANID });
|
|
if (plan.IGNORE_FISBREAK == "1")
|
|
{
|
|
return new ValidateResult(true, "");
|
|
}
|
|
DAL.Basic.ProcessRouteDAL pdal = new DAL.Basic.ProcessRouteDAL();
|
|
string routecode=pdal.GetRouteCodeByWorkcell(data.DAI.WORKCELL_CODE);
|
|
DAL.ProductionPlan.WorkOrderDAL wdal = new DAL.ProductionPlan.WorkOrderDAL();
|
|
var lastplans=wdal.GetLastFISPlan(data.DAI.WORKCELL_CODE,routecode);
|
|
if (lastplans.Count < 1)
|
|
{
|
|
return new ValidateResult(true, "");
|
|
}
|
|
|
|
var inputSEQ = 0;
|
|
var correctSEQ = 0;
|
|
inputSEQ = int.Parse(data.OrderPlan.SEQ);
|
|
correctSEQ = int.Parse(lastplans[0].PLAN_SEQ);
|
|
if (lastplans.Count(p => p.PLAN_SEQ == lastplans[0].PLAN_SEQ) == 2)
|
|
{
|
|
if ((inputSEQ - correctSEQ) != 1 )
|
|
{
|
|
return new ValidateResult(false, string.Format("请按照FIS底盘号顺序生产!最后生产的工单号为“{0}”", lastplans[0].PLAN_NO));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if ((inputSEQ - correctSEQ) != 0)
|
|
{
|
|
return new ValidateResult(false, string.Format("请按照FIS底盘号顺序生产!最后生产的工单号为“{0}”", lastplans[0].PLAN_NO));
|
|
}
|
|
}
|
|
|
|
return new ValidateResult(true, "");
|
|
}
|
|
}
|
|
}
|
|
|