可通过PACK码查询 产品静置记录 进行静置上线
This commit is contained in:
@@ -45,17 +45,12 @@ namespace MesServerFunctions
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// PLC 可能只给产品码和机型代码,补查数据库中的产品型号。
|
// PLC 当前产品区已是最终 PACK 码,只补查订单和产品型号。
|
||||||
string dbEngineType;
|
MisDataFun.Moby_Select_PDC(engineID, out orderForm, out engineType, out engineTypeID);
|
||||||
int dbEngineTypeID;
|
if (engineTypeID <= 0)
|
||||||
MisDataFun.Moby_Select_PDC(engineID, out orderForm, out dbEngineType, out dbEngineTypeID);
|
|
||||||
if (dbEngineTypeID > 0)
|
|
||||||
{
|
{
|
||||||
engineTypeID = dbEngineTypeID;
|
WriteManualStaticBSaveError(opName, "未查询到产品执行信息:" + engineID);
|
||||||
}
|
return;
|
||||||
if (!string.IsNullOrWhiteSpace(dbEngineType))
|
|
||||||
{
|
|
||||||
engineType = dbEngineType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string message;
|
string message;
|
||||||
|
|||||||
@@ -58,16 +58,15 @@ namespace MesServerFunctions
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
MisDataFun.Moby_Select_PDC(engineID, out string orderForm, out string engineType, out int engineTypeID);
|
// PAD 可能扫描箱体码,最终产品编号以存储过程返回的产品编号为准。
|
||||||
if (engineTypeID <= 0 || string.IsNullOrWhiteSpace(engineType))
|
if (!TrySelectManualStaticPdcProduct(engineID, out string productCode, out string orderForm, out string engineType, out int engineTypeID, out message))
|
||||||
{
|
{
|
||||||
message = "未查询到产品执行信息:" + engineID;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
product = new ManualStaticOutProduct
|
product = new ManualStaticOutProduct
|
||||||
{
|
{
|
||||||
EngineID = engineID.Trim(),
|
EngineID = productCode,
|
||||||
OrderForm = orderForm,
|
OrderForm = orderForm,
|
||||||
EngineType = engineType,
|
EngineType = engineType,
|
||||||
EngineTypeID = engineTypeID
|
EngineTypeID = engineTypeID
|
||||||
@@ -75,6 +74,56 @@ namespace MesServerFunctions
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询 PDC 产品执行信息,兼容产品码和箱体码输入。
|
||||||
|
/// </summary>
|
||||||
|
private bool TrySelectManualStaticPdcProduct(string scanCode, out string productCode, out string orderForm, out string engineType, out int engineTypeID, out string message)
|
||||||
|
{
|
||||||
|
productCode = "";
|
||||||
|
orderForm = "";
|
||||||
|
engineType = "";
|
||||||
|
engineTypeID = 0;
|
||||||
|
message = "";
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SqlParameter[] sqlParameters = new SqlParameter[1];
|
||||||
|
sqlParameters[0] = new SqlParameter("@发动机号", scanCode);
|
||||||
|
DataAccess.ExecuteStoredProcedure("测量数据工位_监控系统_MOBY_查询_PDC", ref sqlParameters, out DataTable dt, out string errorMessage);
|
||||||
|
if (!string.IsNullOrWhiteSpace(errorMessage))
|
||||||
|
{
|
||||||
|
message = "查询产品执行信息失败:" + errorMessage;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dt == null || dt.Rows.Count == 0)
|
||||||
|
{
|
||||||
|
message = "未查询到产品执行信息:" + scanCode;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
DataRow row = dt.Rows[0];
|
||||||
|
productCode = dt.Columns.Contains("产品编号") ? Convert.ToString(row["产品编号"]) : Convert.ToString(row["发动机号"]);
|
||||||
|
orderForm = Convert.ToString(row["订单号"]);
|
||||||
|
engineType = Convert.ToString(row["产品型号"]);
|
||||||
|
engineTypeID = Convert.ToInt32(row["机型代码"]);
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(productCode) || engineTypeID <= 0 || string.IsNullOrWhiteSpace(engineType))
|
||||||
|
{
|
||||||
|
message = "产品执行信息不完整:" + scanCode;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
productCode = productCode.Trim();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception err)
|
||||||
|
{
|
||||||
|
message = "查询产品执行信息失败:" + err.Message;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询 OP420 记录的线下手动静置开始时间。
|
/// 查询 OP420 记录的线下手动静置开始时间。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace MesServerFunctions
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重新查询 MES 执行信息,避免直接使用 PLC 中不完整的订单/机型数据。
|
// 保存阶段从 PLC 读取到的已经是最终 PACK 码,只补查订单和机型信息。
|
||||||
MisDataFun.Moby_Select_PDC(engineID, out orderForm, out engineType, out engineTypeID);
|
MisDataFun.Moby_Select_PDC(engineID, out orderForm, out engineType, out engineTypeID);
|
||||||
if (engineTypeID <= 0)
|
if (engineTypeID <= 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user