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.
74 lines
3.3 KiB
74 lines
3.3 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using QMAPP.FJC.TRACING.DAInterface;
|
|
using System.Text.RegularExpressions;
|
|
using QMAPP.FJC.Entity;
|
|
|
|
namespace QMAPP.FJC.TRACING.DataValidators
|
|
{
|
|
/// <summary>
|
|
/// 生产计划验证
|
|
/// </summary>
|
|
public class FISValidator : 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, "");
|
|
}
|
|
if (data.OrderPlan.STATE == EnumGeter.WorkOrderState.Suspended.GetHashCode())
|
|
{
|
|
return new ValidateResult(false, "当前工单已挂起,无法进行生产,请先取消挂起!");
|
|
}
|
|
|
|
//DAL.ProductionPlan.WorkOrderDAL workorderdal = new DAL.ProductionPlan.WorkOrderDAL();
|
|
//var workorder = workorderdal.GetOne(data.OrderPlan.PID);
|
|
//if (workorder == null)
|
|
//{
|
|
// return new ValidateResult(false, "无法查询到当前FIS工单,已完成或被删除!");
|
|
//}
|
|
if (!string.Equals(data.WorkLocState.WORKCELL_CODE, data.OrderPlan.WORKCELL_CODE))
|
|
{
|
|
MD.DAL.WorkCellDAL workcelldal = new MD.DAL.WorkCellDAL();
|
|
var workcell = workcelldal.GetWorkCellByCode(data.OrderPlan.WORKCELL_CODE);
|
|
if (workcell != null)
|
|
{
|
|
return new ValidateResult(false, string.Format("当前FIS工单目前在工序“{0}”,不可跳序生产!", workcell.WORKCELL_NAME));
|
|
}
|
|
else
|
|
{
|
|
return new ValidateResult(false, string.Format("当前FIS工单不在此工序上,不可跳序生产!"));
|
|
}
|
|
}
|
|
//if (!string.IsNullOrEmpty(data.OrderPlan.MOULD_CODE) && !string.Equals(data.WorkLocState.WORKLOC_CODE, data.OrderPlan.WORKLOC_CODE))
|
|
//{
|
|
// MD.DAL.WorkCellDAL workcelldal = new MD.DAL.WorkCellDAL();
|
|
// var workcell = workcelldal.GetWorkCellByCode(data.OrderPlan.WORKCELL_CODE);
|
|
// if (workcell != null)
|
|
// {
|
|
// return new ValidateResult(false, string.Format("当前FIS工单目前在工序“{0}”,不可跳序生产!", workcell.WORKCELL_NAME));
|
|
// }
|
|
// else
|
|
// {
|
|
// return new ValidateResult(false, string.Format("当前FIS工单不在此工序上,不可跳序生产!"));
|
|
// }
|
|
//}
|
|
//if (!string.IsNullOrEmpty(data.OrderPlan.MOULD_CODE) && !string.Equals(data.OrderPlan.MOULD_CODE, data.MouldCode))
|
|
//{
|
|
// return new ValidateResult(false, string.Format("当前工单正在本工位另一模架{0}上进行生产!", data.MouldCode));
|
|
//}
|
|
|
|
return new ValidateResult(true, "");
|
|
|
|
}
|
|
}
|
|
}
|
|
|