using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace QMAPP.FJC.TRACING.DataAnalyzers { /// /// 计划标签数据解析类 /// 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; } } }