订货号获取机型
This commit is contained in:
@@ -238,19 +238,21 @@ namespace MesWork
|
|||||||
// ====================================================================
|
// ====================================================================
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 从工件管理表查询机型参数(加油量/抽油量/密度/残油量上下限)
|
/// 根据订货号匹配工件管理规则,查询机型参数(加油量/抽油量/密度/残油量上下限)
|
||||||
/// </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)
|
out decimal residualOilUpperLimit, out decimal residualOilLowerLimit)
|
||||||
{
|
{
|
||||||
|
modelNo = "";
|
||||||
addOilQty = 0; extractOilQty = 0; density = 0; residualOilUpperLimit = 0; residualOilLowerLimit = 0;
|
addOilQty = 0; extractOilQty = 0; density = 0; residualOilUpperLimit = 0; residualOilLowerLimit = 0;
|
||||||
var sqlParameter = new SqlParameter[] {
|
var sqlParameter = new SqlParameter[] {
|
||||||
new SqlParameter("@机型号", modelNo)
|
new SqlParameter("@订货号", orderNo)
|
||||||
};
|
};
|
||||||
SqlOperation.ExecuteStoredProcedure("称重_查询工件参数", sqlParameter, out DataTable dt, out string err);
|
SqlOperation.ExecuteStoredProcedure("称重_查询工件参数", sqlParameter, out DataTable dt, out string err);
|
||||||
if (dt != null && dt.Rows.Count > 0 && dt.Rows[0]["result"].ToString() == "1")
|
if (dt != null && dt.Rows.Count > 0 && dt.Rows[0]["result"].ToString() == "1")
|
||||||
{
|
{
|
||||||
var row = dt.Rows[0];
|
var row = dt.Rows[0];
|
||||||
|
modelNo = row["机型号"]?.ToString() ?? "";
|
||||||
decimal.TryParse(row["加油量"]?.ToString(), out addOilQty);
|
decimal.TryParse(row["加油量"]?.ToString(), out addOilQty);
|
||||||
decimal.TryParse(row["抽油量"]?.ToString(), out extractOilQty);
|
decimal.TryParse(row["抽油量"]?.ToString(), out extractOilQty);
|
||||||
decimal.TryParse(row["密度"]?.ToString(), out density);
|
decimal.TryParse(row["密度"]?.ToString(), out density);
|
||||||
|
|||||||
@@ -166,7 +166,6 @@ namespace MesWork
|
|||||||
string modelNo = PLC_R.GetString_CleanGarbled(ReadPLC(11, opName)); // 机型号
|
string modelNo = PLC_R.GetString_CleanGarbled(ReadPLC(11, opName)); // 机型号
|
||||||
string orderNo = PLC_R.GetString_CleanGarbled(ReadPLC(39, opName)); // 工单号
|
string orderNo = PLC_R.GetString_CleanGarbled(ReadPLC(39, opName)); // 工单号
|
||||||
string palletNo = PLC_R.GetString_CleanGarbled(ReadPLC(80, 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 (TryConvertCodeBlockData(engineNo, out string parsedOrderNo, out string parsedProductNo))
|
||||||
{
|
{
|
||||||
@@ -176,18 +175,19 @@ namespace MesWork
|
|||||||
}
|
}
|
||||||
engineNo = parsedProductNo;
|
engineNo = parsedProductNo;
|
||||||
|
|
||||||
B_DB_Opera.SaveLog_Response($"【{opName}】读取工件:发动机={engineNo},机型={modelNo},工单={orderNo},托盘={palletNo}", AID);
|
|
||||||
int stIdx = WeighingPage?.GetStationIndex(opName) ?? 1;
|
int stIdx = WeighingPage?.GetStationIndex(opName) ?? 1;
|
||||||
WeighingPage?.UpdateStationInfo(stIdx, engineNo, modelNo, orderNo);
|
if (!B_DB_Opera.QueryWorkpieceByOrderNo(orderNo, out string matchedModelNo, out decimal addOilQty, out decimal extractOilQty, out decimal density,
|
||||||
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))
|
out decimal residualOilUpperLimit, out decimal residualOilLowerLimit))
|
||||||
{
|
{
|
||||||
WritePLC_IF(112, opName, 3); // 报警代码=3,机型错误
|
WritePLC_IF(112, opName, 3); // 报警代码=3,机型错误
|
||||||
B_DB_Opera.SaveLog_Response($"【{opName}】工件管理中未找到机型[{modelNo}]的参数,发动机={engineNo}", AID);
|
B_DB_Opera.SaveLog_Response($"【{opName}】工件管理中未找到订货号[{orderNo}]的匹配规则,发动机={engineNo}", AID);
|
||||||
WeighingPage?.AppendLog($"[{opName}] 机型[{modelNo}]未找到配置参数");
|
WeighingPage?.AppendLog($"[{opName}] 订货号[{orderNo}]未匹配到工件参数");
|
||||||
return;
|
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);
|
WeighingPage?.UpdateOilInfo(stIdx, addOilQty, extractOilQty, density, 0, 0);
|
||||||
string weighType = GetWeighingType(opName); // 地面/放油前/放油后
|
string weighType = GetWeighingType(opName); // 地面/放油前/放油后
|
||||||
string stationName = weighType; // 工位名称直接用称重类型名
|
string stationName = weighType; // 工位名称直接用称重类型名
|
||||||
|
|||||||
@@ -150,6 +150,14 @@ namespace MesWork.Pages
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
dgv_Data.Columns.Add(new DataGridViewTextBoxColumn { Name = "匹配规则", HeaderText = "匹配规则", DataPropertyName = "匹配规则", FillWeight = 120 });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
dgv_Data.Columns.Add(new DataGridViewTextBoxColumn { Name = "优先级", HeaderText = "优先级", DataPropertyName = "优先级", FillWeight = 50 });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dgv_Data.Columns.Add(new DataGridViewTextBoxColumn { Name = "加油量", HeaderText = "加油量(L)", DataPropertyName = "加油量", FillWeight = 70 });
|
dgv_Data.Columns.Add(new DataGridViewTextBoxColumn { Name = "加油量", HeaderText = "加油量(L)", DataPropertyName = "加油量", FillWeight = 70 });
|
||||||
|
|
||||||
|
|
||||||
@@ -426,7 +434,7 @@ namespace MesWork.Pages
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
using (var dlg = CrudHelper.CreateEditDialog(isEdit ? "修改工件" : "新增工件", 500, 450))
|
using (var dlg = CrudHelper.CreateEditDialog(isEdit ? "修改工件" : "新增工件", 500, 520))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -446,6 +454,14 @@ namespace MesWork.Pages
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var txtMatchRule = CrudHelper.AddTextField(dlg, "匹配规则:", ref y, isEdit ? row.Cells["匹配规则"]?.Value?.ToString() : "", inputX: 170, inputWidth: 280);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var txtPriority = CrudHelper.AddTextField(dlg, "优先级:", ref y, isEdit ? row.Cells["优先级"]?.Value?.ToString() : "0", inputX: 170, inputWidth: 280);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var txtOilIn = CrudHelper.AddTextField(dlg, "加油量(L):", ref y, isEdit ? row.Cells["加油量"]?.Value?.ToString() : "0", inputX: 170, inputWidth: 280);
|
var txtOilIn = CrudHelper.AddTextField(dlg, "加油量(L):", ref y, isEdit ? row.Cells["加油量"]?.Value?.ToString() : "0", inputX: 170, inputWidth: 280);
|
||||||
|
|
||||||
|
|
||||||
@@ -490,6 +506,14 @@ namespace MesWork.Pages
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (!int.TryParse(txtPriority.Text.Trim(), out int priority))
|
||||||
|
{
|
||||||
|
MessageBox.Show("优先级必须是整数", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
string sp = isEdit ? "工件管理_编辑" : "工件管理_增加";
|
string sp = isEdit ? "工件管理_编辑" : "工件管理_增加";
|
||||||
|
|
||||||
|
|
||||||
@@ -510,6 +534,14 @@ namespace MesWork.Pages
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
new SqlParameter("@匹配规则", txtMatchRule.Text.Trim()),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
new SqlParameter("@优先级", priority),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
new SqlParameter("@加油量", decimal.Parse(txtOilIn.Text)),
|
new SqlParameter("@加油量", decimal.Parse(txtOilIn.Text)),
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user