|
@ -15,9 +15,65 @@ namespace QMAPP.FJC.TRACING.DataAnalyzers |
|
|
{ |
|
|
{ |
|
|
DAL.Produce.ProductDAL proddal = new DAL.Produce.ProductDAL(); |
|
|
DAL.Produce.ProductDAL proddal = new DAL.Produce.ProductDAL(); |
|
|
//var product=proddal.GetNewestProduct(data.DAValue.ToString());
|
|
|
//var product=proddal.GetNewestProduct(data.DAValue.ToString());
|
|
|
//20220928 DQZhang 查询最新Product增加工序条件,时间有可能
|
|
|
//if (product != null)
|
|
|
var product = proddal.GetNewestProductCell(data.DAValue.ToString(),data.WorkLocState.WORKCELL_CODE); |
|
|
//{
|
|
|
|
|
|
// 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
|
|
|
|
|
|
// };
|
|
|
|
|
|
// proddal.Insert(part);
|
|
|
|
|
|
// data.ObjectPID = part.PID;
|
|
|
|
|
|
// //data.ObjectCacheList.Add(part);
|
|
|
|
|
|
// data.AnalyzedValue = part.PRODUCTCODE;
|
|
|
|
|
|
// data.MaterialCode = part.MATERIAL_CODE;
|
|
|
|
|
|
// data.MaterialName = material.MATERIAL_SHORT;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// throw new Exception("无法查到此零件信息!");
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//20220928 DQZhang 查询最新加工记录,增加工序条件,因为创建时间有可能被修改,按时间培训获取最新会出问题
|
|
|
|
|
|
string Cell = data.WorkLocState.WORKLOC_CODE; |
|
|
|
|
|
if (Cell.Equals("DP_R_PREASSY_2") || Cell.Equals("DP_L_PREASSY_2")) |
|
|
|
|
|
{ |
|
|
|
|
|
var product = proddal.GetNewestProductCell(data.DAValue.ToString(), Cell); |
|
|
if (product != null) |
|
|
if (product != null) |
|
|
{ |
|
|
{ |
|
|
data.ObjectPID = product.PID; |
|
|
data.ObjectPID = product.PID; |
|
@ -30,9 +86,9 @@ namespace QMAPP.FJC.TRACING.DataAnalyzers |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
DAL.MD.MaterialDAL mdal=new DAL.MD.MaterialDAL(); |
|
|
DAL.MD.MaterialDAL mdal = new DAL.MD.MaterialDAL(); |
|
|
var material= mdal.Get(data.MaterialCode); |
|
|
var material = mdal.Get(data.MaterialCode); |
|
|
if(material==null) |
|
|
if (material == null) |
|
|
{ |
|
|
{ |
|
|
throw new Exception("无法查到此零件信息!"); |
|
|
throw new Exception("无法查到此零件信息!"); |
|
|
} |
|
|
} |
|
@ -70,6 +126,67 @@ namespace QMAPP.FJC.TRACING.DataAnalyzers |
|
|
throw new Exception("无法查到此零件信息!"); |
|
|
throw new Exception("无法查到此零件信息!"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
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 |
|
|
|
|
|
}; |
|
|
|
|
|
proddal.Insert(part); |
|
|
|
|
|
data.ObjectPID = part.PID; |
|
|
|
|
|
//data.ObjectCacheList.Add(part);
|
|
|
|
|
|
data.AnalyzedValue = part.PRODUCTCODE; |
|
|
|
|
|
data.MaterialCode = part.MATERIAL_CODE; |
|
|
|
|
|
data.MaterialName = material.MATERIAL_SHORT; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
throw new Exception("无法查到此零件信息!"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|