|
@ -15,62 +15,179 @@ 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("无法查到此零件信息!");
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
if (product != null) |
|
|
|
|
|
{ |
|
|
//20220928 DQZhang 查询最新加工记录,增加工序条件,因为创建时间有可能被修改,按时间培训获取最新会出问题
|
|
|
data.ObjectPID = product.PID; |
|
|
string Cell = data.WorkLocState.WORKLOC_CODE; |
|
|
data.ObjectCacheList.Add(product); |
|
|
if (Cell.Equals("DP_R_PREASSY_2") || Cell.Equals("DP_L_PREASSY_2")) |
|
|
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 product = proddal.GetNewestProductCell(data.DAValue.ToString(), Cell); |
|
|
var material= mdal.Get(data.MaterialCode); |
|
|
if (product != null) |
|
|
if(material==null) |
|
|
|
|
|
{ |
|
|
{ |
|
|
throw new Exception("无法查到此零件信息!"); |
|
|
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; |
|
|
} |
|
|
} |
|
|
if (string.Equals(material.OUTSOURCE, "1")) // 如果是外购件则创建零件信息
|
|
|
else |
|
|
{ |
|
|
{ |
|
|
var part = new Product() |
|
|
DAL.MD.MaterialDAL mdal = new DAL.MD.MaterialDAL(); |
|
|
|
|
|
var material = mdal.Get(data.MaterialCode); |
|
|
|
|
|
if (material == null) |
|
|
{ |
|
|
{ |
|
|
PID = Guid.NewGuid().ToString(), |
|
|
throw new Exception("无法查到此零件信息!"); |
|
|
CAPACITY = material.STD_QTY, |
|
|
} |
|
|
CREATEDATE = DateTime.Now, |
|
|
if (string.Equals(material.OUTSOURCE, "1")) // 如果是外购件则创建零件信息
|
|
|
CREATEUSER = data.UserID, |
|
|
{ |
|
|
MATERIAL_CODE = material.MATERIAL_CODE, |
|
|
var part = new Product() |
|
|
OUTFLAG = "0", |
|
|
{ |
|
|
PRODUCESHIFTTCODE = "", |
|
|
PID = Guid.NewGuid().ToString(), |
|
|
PRODUCTCODE = data.DAValue.ToString(), |
|
|
CAPACITY = material.STD_QTY, |
|
|
PRODUCTSOURCE = "1", |
|
|
CREATEDATE = DateTime.Now, |
|
|
STATUS = "0", |
|
|
CREATEUSER = data.UserID, |
|
|
USINGCOUNT = 0, |
|
|
MATERIAL_CODE = material.MATERIAL_CODE, |
|
|
USINGSTATE = "0", |
|
|
OUTFLAG = "0", |
|
|
WORKCELL_CODE = "", |
|
|
PRODUCESHIFTTCODE = "", |
|
|
WORKCENTER_CODE = "", |
|
|
PRODUCTCODE = data.DAValue.ToString(), |
|
|
WORKLOC_CODE = "", |
|
|
PRODUCTSOURCE = "1", |
|
|
TEAM_CODE = "", |
|
|
STATUS = "0", |
|
|
MATERIAL_TYPE = material.MATERIAL_TYPE_CODE |
|
|
USINGCOUNT = 0, |
|
|
}; |
|
|
USINGSTATE = "0", |
|
|
proddal.Insert(part); |
|
|
WORKCELL_CODE = "", |
|
|
data.ObjectPID = part.PID; |
|
|
WORKCENTER_CODE = "", |
|
|
//data.ObjectCacheList.Add(part);
|
|
|
WORKLOC_CODE = "", |
|
|
data.AnalyzedValue = part.PRODUCTCODE; |
|
|
TEAM_CODE = "", |
|
|
data.MaterialCode = part.MATERIAL_CODE; |
|
|
MATERIAL_TYPE = material.MATERIAL_TYPE_CODE |
|
|
data.MaterialName = material.MATERIAL_SHORT; |
|
|
}; |
|
|
|
|
|
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("无法查到此零件信息!"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
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 |
|
|
else |
|
|
{ |
|
|
{ |
|
|
throw new Exception("无法查到此零件信息!"); |
|
|
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("无法查到此零件信息!"); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|