订货号获取机型
This commit is contained in:
@@ -238,19 +238,21 @@ namespace MesWork
|
||||
// ====================================================================
|
||||
|
||||
/// <summary>
|
||||
/// 从工件管理表查询机型参数(加油量/抽油量/密度/残油量上下限)
|
||||
/// 根据订货号匹配工件管理规则,查询机型参数(加油量/抽油量/密度/残油量上下限)
|
||||
/// </summary>
|
||||
public static bool QueryWorkpieceByModel(string modelNo, out decimal addOilQty, out decimal extractOilQty, out decimal density,
|
||||
public static bool QueryWorkpieceByOrderNo(string orderNo, out string modelNo, out decimal addOilQty, out decimal extractOilQty, out decimal density,
|
||||
out decimal residualOilUpperLimit, out decimal residualOilLowerLimit)
|
||||
{
|
||||
modelNo = "";
|
||||
addOilQty = 0; extractOilQty = 0; density = 0; residualOilUpperLimit = 0; residualOilLowerLimit = 0;
|
||||
var sqlParameter = new SqlParameter[] {
|
||||
new SqlParameter("@机型号", modelNo)
|
||||
new SqlParameter("@订货号", orderNo)
|
||||
};
|
||||
SqlOperation.ExecuteStoredProcedure("称重_查询工件参数", sqlParameter, out DataTable dt, out string err);
|
||||
if (dt != null && dt.Rows.Count > 0 && dt.Rows[0]["result"].ToString() == "1")
|
||||
{
|
||||
var row = dt.Rows[0];
|
||||
modelNo = row["机型号"]?.ToString() ?? "";
|
||||
decimal.TryParse(row["加油量"]?.ToString(), out addOilQty);
|
||||
decimal.TryParse(row["抽油量"]?.ToString(), out extractOilQty);
|
||||
decimal.TryParse(row["密度"]?.ToString(), out density);
|
||||
|
||||
@@ -166,8 +166,7 @@ namespace MesWork
|
||||
string modelNo = PLC_R.GetString_CleanGarbled(ReadPLC(11, opName)); // 机型号
|
||||
string orderNo = PLC_R.GetString_CleanGarbled(ReadPLC(39, opName)); // 工单号
|
||||
string palletNo = PLC_R.GetString_CleanGarbled(ReadPLC(80, opName)); // 托盘号
|
||||
modelNo = "WP7";
|
||||
// 解析代码串格式: 0/DHN2.5Q0219-36/D426E016767 或 DHH02K0014-400/B726E00584555
|
||||
// 解析代码串格式: 0/DHN2.5Q0219-36/D426E016767 或 DHH02K0014-400/B726E00584555
|
||||
if (TryConvertCodeBlockData(engineNo, out string parsedOrderNo, out string parsedProductNo))
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(parsedOrderNo))
|
||||
@@ -176,18 +175,19 @@ namespace MesWork
|
||||
}
|
||||
engineNo = parsedProductNo;
|
||||
|
||||
B_DB_Opera.SaveLog_Response($"【{opName}】读取工件:发动机={engineNo},机型={modelNo},工单={orderNo},托盘={palletNo}", AID);
|
||||
int stIdx = WeighingPage?.GetStationIndex(opName) ?? 1;
|
||||
WeighingPage?.UpdateStationInfo(stIdx, engineNo, modelNo, orderNo);
|
||||
WeighingPage?.AppendLog($"[{opName}] 读取工件:{engineNo},机型={modelNo}");
|
||||
if (!B_DB_Opera.QueryWorkpieceByModel(modelNo, out decimal addOilQty, out decimal extractOilQty, out decimal density,
|
||||
out decimal residualOilUpperLimit, out decimal residualOilLowerLimit))
|
||||
{
|
||||
WritePLC_IF(112, opName, 3); // 报警代码=3,机型错误
|
||||
B_DB_Opera.SaveLog_Response($"【{opName}】工件管理中未找到机型[{modelNo}]的参数,发动机={engineNo}", AID);
|
||||
WeighingPage?.AppendLog($"[{opName}] 机型[{modelNo}]未找到配置参数");
|
||||
return;
|
||||
}
|
||||
int stIdx = WeighingPage?.GetStationIndex(opName) ?? 1;
|
||||
if (!B_DB_Opera.QueryWorkpieceByOrderNo(orderNo, out string matchedModelNo, out decimal addOilQty, out decimal extractOilQty, out decimal density,
|
||||
out decimal residualOilUpperLimit, out decimal residualOilLowerLimit))
|
||||
{
|
||||
WritePLC_IF(112, opName, 3); // 报警代码=3,机型错误
|
||||
B_DB_Opera.SaveLog_Response($"【{opName}】工件管理中未找到订货号[{orderNo}]的匹配规则,发动机={engineNo}", AID);
|
||||
WeighingPage?.AppendLog($"[{opName}] 订货号[{orderNo}]未匹配到工件参数");
|
||||
return;
|
||||
}
|
||||
modelNo = matchedModelNo;
|
||||
B_DB_Opera.SaveLog_Response($"【{opName}】读取工件:发动机={engineNo},机型={modelNo},订货号={orderNo},托盘={palletNo}", AID);
|
||||
WeighingPage?.UpdateStationInfo(stIdx, engineNo, modelNo, orderNo);
|
||||
WeighingPage?.AppendLog($"[{opName}] 读取工件:{engineNo},机型={modelNo}");
|
||||
WeighingPage?.UpdateOilInfo(stIdx, addOilQty, extractOilQty, density, 0, 0);
|
||||
string weighType = GetWeighingType(opName); // 地面/放油前/放油后
|
||||
string stationName = weighType; // 工位名称直接用称重类型名
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user