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

45 lines
1.5 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace QMAPP.FJC.TRACING.DataAnalyzers
{
/// <summary>
/// 计划标签数据解析类
/// </summary>
public class PlanLabelAnalyzer : DAInterface.IDataAnalyzer
{
public void Analyze(DAInterface.DAObject data)
{
string[] planlabel = data.DAValue.ToString().Split('-');
if (planlabel.Length < 2)
{
throw new Exception("此计划标签条码格式异常!");
}
string sn = planlabel[planlabel.Length - 1];
string planno = planlabel[0];
data.WorkOrderID = planno;
var plandal = new DAL.FIS.OrderPlanDAL();
var plan = plandal.GetInfo(new Entity.FIS.OrderPlan { PLAN_NO = planno });
if (plan == null)
{
throw new Exception("未找到此计划标签相关计划");
}
data.OrderPlan = plan;
//data.WorkLocState.CurrentState.ORDERPLAN_PID = plan.PID;
DAL.Produce.ProductDAL dal = new DAL.Produce.ProductDAL();
var product = dal.GetNewestProduct(sn);
if (product == null)
{
throw new Exception("无法查到与此条码相关的产品数据!");
}
data.ObjectPID = product.PID;
data.AnalyzedValue = product.PRODUCTCODE;
data.MaterialCode = product.MATERIAL_CODE;
}
}
}