可通过PACK码查询 产品静置记录 进行静置上线

This commit is contained in:
XingCheng3
2026-06-10 18:53:57 +08:00
parent 4aab62831a
commit 5ef3cf5346
3 changed files with 59 additions and 15 deletions

View File

@@ -45,17 +45,12 @@ namespace MesServerFunctions
return;
}
// PLC 可能只给产品码和机型代码,补查数据库中的产品型号。
string dbEngineType;
int dbEngineTypeID;
MisDataFun.Moby_Select_PDC(engineID, out orderForm, out dbEngineType, out dbEngineTypeID);
if (dbEngineTypeID > 0)
// PLC 当前产品区已是最终 PACK 码,补查订单和产品型号。
MisDataFun.Moby_Select_PDC(engineID, out orderForm, out engineType, out engineTypeID);
if (engineTypeID <= 0)
{
engineTypeID = dbEngineTypeID;
}
if (!string.IsNullOrWhiteSpace(dbEngineType))
{
engineType = dbEngineType;
WriteManualStaticBSaveError(opName, "未查询到产品执行信息:" + engineID);
return;
}
string message;

View File

@@ -58,16 +58,15 @@ namespace MesServerFunctions
return false;
}
MisDataFun.Moby_Select_PDC(engineID, out string orderForm, out string engineType, out int engineTypeID);
if (engineTypeID <= 0 || string.IsNullOrWhiteSpace(engineType))
// PAD 可能扫描箱体码,最终产品编号以存储过程返回的产品编号为准。
if (!TrySelectManualStaticPdcProduct(engineID, out string productCode, out string orderForm, out string engineType, out int engineTypeID, out message))
{
message = "未查询到产品执行信息:" + engineID;
return false;
}
product = new ManualStaticOutProduct
{
EngineID = engineID.Trim(),
EngineID = productCode,
OrderForm = orderForm,
EngineType = engineType,
EngineTypeID = engineTypeID
@@ -75,6 +74,56 @@ namespace MesServerFunctions
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>
/// 查询 OP420 记录的线下手动静置开始时间。
/// </summary>

View File

@@ -38,7 +38,7 @@ namespace MesServerFunctions
return;
}
// 重新查询 MES 执行信息,避免直接使用 PLC 中不完整的订单/机型数据
// 保存阶段从 PLC 读取到的已经是最终 PACK 码,只补查订单机型信息
MisDataFun.Moby_Select_PDC(engineID, out orderForm, out engineType, out engineTypeID);
if (engineTypeID <= 0)
{