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

79 lines
3.2 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMAPP.FJC.Entity.Operation;
using QMAPP.MD.DAL;
using QMAPP.MD.Entity;
using QMAPP.FJC.DAL.Operation;
namespace QMAPP.FJC.TRACING.DataAnalyzers
{
/// <summary>
/// 零件数据解析类
/// </summary>
public class PartAnalyzerNew : DAInterface.IDataAnalyzer
{
public void Analyze(DAInterface.DAObject data)
{
string camaterialtype = "IP_SKIN";
DAL.Produce.ProductDAL proddal = new DAL.Produce.ProductDAL();
var product = proddal.GetNewestProduct(data.DAValue.ToString());
if (product != null)
{
if (product.MATERIAL_TYPE == null || product.MATERIAL_TYPE == camaterialtype)
{
PbomDAL bl = new PbomDAL();
var bom = bl.GetBomWithMaterials(product.MATERIAL_CODE, "17G.857.003.010", "2036710", "2375444");
if (bom == null)
{
return;
}
MaterialDAL mar = new MaterialDAL();
Material materialInfo = new Material();
materialInfo.MATERIAL_CODE = bom.MATERIAL_CODE;
var material = mar.Get(materialInfo);
var gmp = bl.GetGMP(material.MATERIAL_CODE);
product = new Product
{
PID = Guid.NewGuid().ToString(),
CAPACITY = material.STD_QTY,
CREATEDATE = DateTime.Now,
CREATEUSER = "",
MATERIAL_CODE = material.MATERIAL_CODE,
MATERIAL_NAME = material.MATERIAL_NAME,
OUTFLAG = "0",
PRODUCESHIFTTCODE = "",
PRODUCTCODE = data.DAValue.ToString(),
PRODUCTSOURCE = "1",
STATUS = "0",
USINGCOUNT = 0,
USINGSTATE = "0",
WORKCELL_CODE = gmp == null ? "" : gmp.WORKCELL_CODE,
WORKCENTER_CODE = gmp == null ? "" : gmp.WORKCENTER_CODE,
WORKLOC_CODE = "",
TEAM_CODE = "",
MATERIAL_TYPE = material.MATERIAL_TYPE_CODE,
ENDOFLINE = "1",
UPDATEDATE = DateTime.Now,
UPDATEUSER = ""
};
ProductDAL pro = new ProductDAL();
pro.Insert(product);
}
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 materialT = mdal.Get(data.MaterialCode);
data.MaterialName = materialT == null ? "" : materialT.MATERIAL_SHORT;
}
else
{
throw new Exception("无法查到此零件信息!");
}
}
}
}