添加动态配置 与 SLS改造机型判断位置

This commit is contained in:
XingCheng3
2026-05-31 16:13:13 +08:00
parent 92c8f2d68d
commit d1403d22b8
6 changed files with 73 additions and 8 deletions

View File

@@ -228,7 +228,7 @@ namespace MisDataSaveDateMesRead
MisDataFun.BaseData_tagTable_QualityData_B5A_Insert_OP170Status(id_tagCF, engineTypeID, engineID, "72300031", MaxUseTime.ToString(), qualityMask, opName); MisDataFun.BaseData_tagTable_QualityData_B5A_Insert_OP170Status(id_tagCF, engineTypeID, engineID, "72300031", MaxUseTime.ToString(), qualityMask, opName);
} }
if(!((engineTypeID != 1 && engineTypeID != 1 ) && (opName == "OP120" || opName == "OP140" || opName == "OP160"))) // CC GQ UPS 固定架不涂胶 所以直接跳 PDC 和 W05 需要涂胶校验 if(!((engineTypeID != 1 && engineTypeID != 5 ) && (opName == "OP120" || opName == "OP140" || opName == "OP160"))) // CC GQ UPS 固定架不涂胶 所以直接跳 PDC 和 W05 需要涂胶校验
{ {
if (MisDataFun.GetSpecialOpExist(opName, "涂胶时间差校验")) if (MisDataFun.GetSpecialOpExist(opName, "涂胶时间差校验"))
{ {

View File

@@ -284,6 +284,10 @@ namespace MisDataFunDll
/// <returns></returns> /// <returns></returns>
public static bool GetSpecialOpExist(string opName, string type) public static bool GetSpecialOpExist(string opName, string type)
{ {
if (PP.SpecialOpList == null)
{
return false;
}
if (PP.SpecialOpList.ContainsKey(type)) if (PP.SpecialOpList.ContainsKey(type))
{ {
return PP.SpecialOpList[type].Contains(opName); return PP.SpecialOpList[type].Contains(opName);
@@ -291,6 +295,30 @@ namespace MisDataFunDll
return false; return false;
} }
/// <summary>
/// 从启动缓存中读取特殊工位规则配置。
/// </summary>
public static string GetSpecialOpRuleValue(string opName, string type, string ruleKey, string defaultValue = "")
{
if (PP.SpecialOpRuleConfig == null)
{
return defaultValue;
}
if (!PP.SpecialOpRuleConfig.ContainsKey(type))
{
return defaultValue;
}
if (!PP.SpecialOpRuleConfig[type].ContainsKey(opName))
{
return defaultValue;
}
if (!PP.SpecialOpRuleConfig[type][opName].ContainsKey(ruleKey))
{
return defaultValue;
}
return PP.SpecialOpRuleConfig[type][opName][ruleKey];
}
/// <summary> /// <summary>
/// 这是一个防错方法 判断200扫码工位 如果出现 产品到位 传递机型未完成时扫码 无物料与拧紧的情况下 会直接跳到出站 给两秒缓冲时间 确保物料已入库 /// 这是一个防错方法 判断200扫码工位 如果出现 产品到位 传递机型未完成时扫码 无物料与拧紧的情况下 会直接跳到出站 给两秒缓冲时间 确保物料已入库
/// </summary> /// </summary>
@@ -517,7 +545,7 @@ namespace MisDataFunDll
switch (EngineTypeID) switch (EngineTypeID)
{ {
case 1: case 5: targetField = "TEXT9"; break; case 1: case 5: targetField = "TEXT9"; break;
case 2: case 3: targetField = "TEXT14"; break; case 2: case 3: case 6: case 7: targetField = "TEXT14"; break;
case 4: targetField = "TEXT16"; break; case 4: targetField = "TEXT16"; break;
default: targetField = ""; break; default: targetField = ""; break;
} }

View File

@@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;

View File

@@ -1556,7 +1556,7 @@ namespace MisDataSaveDate
int EngineTypeID = Convert.ToInt32(dt_quality.Rows[0]["产品代码"]); int EngineTypeID = Convert.ToInt32(dt_quality.Rows[0]["产品代码"]);
if (opName == "OP320") if (opName == "OP320")
{ {
if (EngineTypeID == 2) dataCollectForResourceInspect.dcSequence = "B1"; if (EngineTypeID == 2 || EngineTypeID == 6 || EngineTypeID == 7) dataCollectForResourceInspect.dcSequence = "B1";
if (EngineTypeID == 3) dataCollectForResourceInspect.dcSequence = "B2"; if (EngineTypeID == 3) dataCollectForResourceInspect.dcSequence = "B2";
if (EngineTypeID == 4) dataCollectForResourceInspect.dcSequence = "B3"; if (EngineTypeID == 4) dataCollectForResourceInspect.dcSequence = "B3";
} }

View File

@@ -1,4 +1,4 @@
using DataLinkMesWork; using DataLinkMesWork;
using MesDataFunction; using MesDataFunction;
using MesServerWork; using MesServerWork;
using MesWork.PLC; using MesWork.PLC;
@@ -138,7 +138,7 @@ namespace MisDataSaveDate
var dt_Device = MisDataFunDll.MisDataFun.dt_Device(); var dt_Device = MisDataFunDll.MisDataFun.dt_Device();
var dt_TagTypeDataType = MisDataFunDll.MisDataFun.dt_TagTypeDataType(); var dt_TagTypeDataType = MisDataFunDll.MisDataFun.dt_TagTypeDataType();
Get_SpecialOpList(); ReloadSpecialConfig();
var sql = var sql =
$" SELECT [工位号],[工位名称],[PLC],[PLC代码],[MesDll]" + $" SELECT [工位号],[工位名称],[PLC],[PLC代码],[MesDll]" +
@@ -221,6 +221,13 @@ namespace MisDataSaveDate
} }
// 重新加载特殊工位及硬编码规则配置缓存
static public void ReloadSpecialConfig()
{
Get_SpecialOpList();
Get_SpecialOpRuleConfig();
}
// 获取特殊工位列表 // 获取特殊工位列表
static public void Get_SpecialOpList() static public void Get_SpecialOpList()
{ {
@@ -238,6 +245,35 @@ namespace MisDataSaveDate
PP.SpecialOpList = specialOpList; PP.SpecialOpList = specialOpList;
} }
// 获取特殊工位规则配置缓存结构type -> opName -> ruleKey -> ruleValue
static public void Get_SpecialOpRuleConfig()
{
string procedureName = "MES_特殊工位规则配置表_查询";
SqlParameter[] thisParms = new SqlParameter[0];
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms, out DataTable dt);
var ruleConfig = new Dictionary<string, Dictionary<string, Dictionary<string, string>>>();
foreach (DataRow row in dt.Rows)
{
string type = row["type"].ToString();
string opName = row["opName"].ToString();
string ruleKey = row["ruleKey"].ToString();
string ruleValue = row["ruleValue"].ToString();
if (!ruleConfig.ContainsKey(type))
{
ruleConfig[type] = new Dictionary<string, Dictionary<string, string>>();
}
if (!ruleConfig[type].ContainsKey(opName))
{
ruleConfig[type][opName] = new Dictionary<string, string>();
}
ruleConfig[type][opName][ruleKey] = ruleValue;
}
PP.SpecialOpRuleConfig = ruleConfig;
}
public void SaveData_Load(object sender, EventArgs e) public void SaveData_Load(object sender, EventArgs e)
{ {
@@ -1074,7 +1110,8 @@ namespace MisDataSaveDate
private void button19_Click_1(object sender, EventArgs e) private void button19_Click_1(object sender, EventArgs e)
{ {
Get_SpecialOpList(); ReloadSpecialConfig();
MessageBox.Show("特殊工位和规则配置已重新加载!");
} }
private void button21_Click(object sender, EventArgs e) private void button21_Click(object sender, EventArgs e)

View File

@@ -64,7 +64,7 @@ namespace MesServerFunctions
//InitWorkStep(OpName, EngineTypeID, EngineType, EngineID); //InitWorkStep(OpName, EngineTypeID, EngineType, EngineID);
//更新订单完工数量及物料 //更新订单完工数量及物料
SendMessageFun.SendMessage("2", "11", OpName); SendMessageFun.SendMessage("2", "11", OpName);
if(EngineTypeID == 2 || EngineTypeID == 3) PrinterCommandCenter.PrintToPrinter(OpName, EngineID); // 打印PACK条码 if(EngineTypeID == 2 || EngineTypeID == 3 || EngineTypeID == 6 || EngineTypeID == 7) PrinterCommandCenter.PrintToPrinter(OpName, EngineID); // 打印PACK条码
MIS_BASE.Write_FixAllow(OpName, true); // 允许工作 MIS_BASE.Write_FixAllow(OpName, true); // 允许工作
MisDataFun.LogRecording_OP(OpName, "INFO", "Barcode", "物料验证完成 允许工作!"); MisDataFun.LogRecording_OP(OpName, "INFO", "Barcode", "物料验证完成 允许工作!");
} }