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.
84 lines
3.3 KiB
84 lines
3.3 KiB
4 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
using QMAPP.FJC.Entity.Operation;
|
||
|
using QMAPP.MD.DAL;
|
||
|
|
||
|
namespace QMAPP.FJC.TRACING.DataAnalyzers
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 门板零件数据解析类
|
||
|
/// </summary>
|
||
|
public class DPPartAnalyzer : DAInterface.IDataAnalyzer
|
||
|
{
|
||
|
public void Analyze(DAInterface.DAObject data)
|
||
|
{
|
||
|
DAL.Produce.ProductDAL proddal = new DAL.Produce.ProductDAL();
|
||
|
var product=proddal.GetNewestProduct(data.DAValue.ToString());
|
||
|
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
|
||
|
{
|
||
|
DAL.MD.MaterialDAL mdal=new DAL.MD.MaterialDAL();
|
||
|
var material= mdal.Get(data.MaterialCode);
|
||
|
if(material==null)
|
||
|
{
|
||
|
throw new Exception("无法查到此零件信息!");
|
||
|
}
|
||
|
if (string.Equals(material.OUTSOURCE, "1")) // 如果是外购件则创建零件信息
|
||
|
{
|
||
|
var part = new Product()
|
||
|
{
|
||
|
PID = Guid.NewGuid().ToString(),
|
||
|
CAPACITY = material.STD_QTY,
|
||
|
CREATEDATE = DateTime.Now,
|
||
|
CREATEUSER = data.UserID,
|
||
|
MATERIAL_CODE = material.MATERIAL_CODE,
|
||
|
OUTFLAG = "0",
|
||
|
PRODUCESHIFTTCODE = "",
|
||
|
PRODUCTCODE = data.DAValue.ToString(),
|
||
|
PRODUCTSOURCE = "1",
|
||
|
STATUS = "0",
|
||
|
USINGCOUNT = 0,
|
||
|
USINGSTATE = "0",
|
||
|
WORKCELL_CODE = "",
|
||
|
WORKCENTER_CODE = "",
|
||
|
WORKLOC_CODE = "",
|
||
|
TEAM_CODE = "",
|
||
|
MATERIAL_TYPE=material.MATERIAL_TYPE_CODE //data.DAI.MATERIAL_TYPE
|
||
|
};
|
||
|
proddal.Insert(part);
|
||
|
//data.ObjectCacheList.Add(part);
|
||
|
data.ObjectPID = part.PID;
|
||
|
data.AnalyzedValue = part.PRODUCTCODE;
|
||
|
data.MaterialCode = part.MATERIAL_CODE;
|
||
|
data.MaterialName = material.MATERIAL_SHORT;
|
||
|
product = part;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
throw new Exception("无法查到此零件信息!");
|
||
|
}
|
||
|
}
|
||
|
var bindingdal = new DAL.QT.MaterialBindingDAL();
|
||
|
var binding = bindingdal.GetBindingTarget(data.DAI.WORKLOC_CODE + "_MOULD", product.MATERIAL_TYPE);
|
||
|
if (binding == null)
|
||
|
{
|
||
|
throw new Exception("此产品无法在当前工位进行加工!");
|
||
|
}
|
||
|
data.MouldCode = binding.TARGET_CODE;
|
||
|
data.MouldReLocate = true;
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|