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.7 KiB
45 lines
1.7 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using QMAPP.FJC.Entity.Operation;
|
|
|
|
namespace QMAPP.FJC.TRACING.DataAnalyzers
|
|
{
|
|
/// <summary>
|
|
/// 具有相同条码的零件数据解析类
|
|
/// </summary>
|
|
public class SameCodePartAnalyzer : DAInterface.IDataAnalyzer
|
|
{
|
|
public void Analyze(DAInterface.DAObject data)
|
|
{
|
|
DAL.Produce.ProductDAL proddal = new DAL.Produce.ProductDAL();
|
|
//获取当前工序下状态为未使用的产品信息
|
|
var product = proddal.GetUnusedProduct(data.DAValue.ToString(), data.WorkLocState.WORKCELL_CODE);
|
|
if (product != null) //如果信息存在 将产品信息返回给采集点
|
|
{
|
|
data.ObjectPID = product.PID;
|
|
data.ObjectCacheList.Add(product);
|
|
data.AnalyzedValue = product.PRODUCTCODE;
|
|
data.MaterialCode = product.MATERIAL_CODE;
|
|
DAL.MD.MaterialDAL mdal = new DAL.MD.MaterialDAL();
|
|
var material = mdal.Get(data.MaterialCode);
|
|
data.MaterialName = material == null ? "" : material.MATERIAL_SHORT;
|
|
}
|
|
else //若不存在
|
|
{
|
|
//查询此条码先关的最新的信息
|
|
product = proddal.GetNewestProduct(data.DAValue.ToString());
|
|
if (product == null)
|
|
{
|
|
throw new Exception("无法查到与此条码相关的产品数据!");
|
|
}
|
|
else
|
|
{
|
|
throw new Exception("此产品未完成前序加工或已经过当前工序!");
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|