Compare commits
4 Commits
d1403d22b8
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d504245fcf | ||
|
|
ff5249fa75 | ||
|
|
5ef3cf5346 | ||
|
|
4aab62831a |
@@ -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 != 5 ) && (opName == "OP120" || opName == "OP140" || opName == "OP160"))) // CC GQ UPS 固定架不涂胶 所以直接跳 PDC 和 W05 需要涂胶校验
|
if(!((engineTypeID != 1 && engineTypeID != 1 ) && (opName == "OP120" || opName == "OP140" || opName == "OP160"))) // CC GQ UPS 固定架不涂胶 所以直接跳 PDC 和 W05 需要涂胶校验
|
||||||
{
|
{
|
||||||
if (MisDataFun.GetSpecialOpExist(opName, "涂胶时间差校验"))
|
if (MisDataFun.GetSpecialOpExist(opName, "涂胶时间差校验"))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -176,6 +176,34 @@ namespace MisDataFunDll
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 写入 保存完成和工作完成 并且对此进行一定判断校验
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="isOver"></param>
|
||||||
|
public static void WriteMesReadOver(string OpName, bool isOver)
|
||||||
|
{
|
||||||
|
if (isOver)
|
||||||
|
{
|
||||||
|
MIS_BASE.Read_WorkStart(OpName, out bool isWorkStart);
|
||||||
|
if (!isWorkStart)
|
||||||
|
{
|
||||||
|
MisDataFun.LogRecording_OP(OpName, "WARNING", "WriteMesReadOver", "产品未在位 不予写入工作完成");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "MES保存数据完成!");
|
||||||
|
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "MES工作完成!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MIS_BASE.Write_FalseGO(OpName, false); // 不合格放行(MES)
|
||||||
|
MIS_BASE.Write_ConfirmOkGo(OpName, false); // 合格放行(MES)
|
||||||
|
}
|
||||||
|
//通知PLC,MES工作完成
|
||||||
|
MIS_BASE.Write_MesWorkFinish(OpName, isOver);
|
||||||
|
//通知PLC,MES保存完成
|
||||||
|
MIS_BASE.Write_MesReadOver(OpName, isOver);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 上盖装配新产品 根据工位扫码 写入产品信息至PLC
|
/// 上盖装配新产品 根据工位扫码 写入产品信息至PLC
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -284,10 +284,6 @@ 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);
|
||||||
@@ -295,30 +291,6 @@ 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>
|
||||||
@@ -542,12 +514,19 @@ namespace MisDataFunDll
|
|||||||
{
|
{
|
||||||
// 机型代码 对应客户标签字段映射
|
// 机型代码 对应客户标签字段映射
|
||||||
string targetField;
|
string targetField;
|
||||||
switch (EngineTypeID)
|
if (OpName.StartsWith("OP450"))
|
||||||
{
|
{
|
||||||
case 1: case 5: targetField = "TEXT9"; break;
|
targetField = "TEXT2";
|
||||||
case 2: case 3: case 6: case 7: targetField = "TEXT14"; break;
|
}
|
||||||
case 4: targetField = "TEXT16"; break;
|
else
|
||||||
default: targetField = ""; break;
|
{
|
||||||
|
switch (EngineTypeID)
|
||||||
|
{
|
||||||
|
case 1: case 5: targetField = "TEXT9"; break;
|
||||||
|
case 2: case 3: targetField = "TEXT14"; break;
|
||||||
|
case 4: case 6: case 7: targetField = "TEXT16"; break;
|
||||||
|
default: targetField = ""; break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(targetField))
|
if (!string.IsNullOrEmpty(targetField))
|
||||||
@@ -1820,6 +1799,31 @@ namespace MisDataFunDll
|
|||||||
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
|
DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存 OP420 静置B位开始记录,同一产品只保留最新一条。
|
||||||
|
/// </summary>
|
||||||
|
public static bool SaveManualStaticBRecord(string engineID, string engineType, int engineTypeID, out string message)
|
||||||
|
{
|
||||||
|
message = "";
|
||||||
|
SqlParameter[] sqlParameters = new SqlParameter[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@产品编号", engineID),
|
||||||
|
new SqlParameter("@产品型号", engineType),
|
||||||
|
new SqlParameter("@产品型号代码", engineTypeID),
|
||||||
|
new SqlParameter("@静置开始时间", DateTime.Now)
|
||||||
|
};
|
||||||
|
|
||||||
|
string errorMessage;
|
||||||
|
DataAccess.ExecuteStoredProcedure("线下手动静置_记录_保存", ref sqlParameters, out errorMessage);
|
||||||
|
if (!string.IsNullOrWhiteSpace(errorMessage))
|
||||||
|
{
|
||||||
|
message = "保存线下手动静置记录失败:" + errorMessage;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 工位打码记录 增加
|
/// 工位打码记录 增加
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -515,13 +515,11 @@ namespace MesServerWork
|
|||||||
// -99 是复位
|
// -99 是复位
|
||||||
if (qualityMask == -99)
|
if (qualityMask == -99)
|
||||||
{
|
{
|
||||||
Write_TagValueByTagTypeID(51, opName, false);
|
MIS_BASE.Write_FalseGO(opName, false); // 不合格放行(MES)
|
||||||
Write_TagValueByTagTypeID(8, opName, false);
|
MIS_BASE.Write_ConfirmOkGo(opName, false); // 合格放行(MES)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Write_TagValueByTagTypeID(51, opName, false);
|
|
||||||
//Write_TagValueByTagTypeID(8, opName, false);
|
|
||||||
Write_TagValueByTagTypeID(qualityMask == 1 ? 51 : 8, opName, true);
|
Write_TagValueByTagTypeID(qualityMask == 1 ? 51 : 8, opName, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -13,7 +13,6 @@ namespace MesDataFunction
|
|||||||
public static string PrintURL { get; set; }
|
public static string PrintURL { get; set; }
|
||||||
public static int IsDemoMesServer { get; set; }
|
public static int IsDemoMesServer { get; set; }
|
||||||
public static Dictionary<string, string[]> SpecialOpList { get; set; }
|
public static Dictionary<string, string[]> SpecialOpList { get; set; }
|
||||||
public static Dictionary<string, Dictionary<string, Dictionary<string, string>>> SpecialOpRuleConfig { get; set; }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1405,6 +1405,7 @@ namespace MisDataSaveDate
|
|||||||
}
|
}
|
||||||
getAllLabelContents.sfcList = sfc;
|
getAllLabelContents.sfcList = sfc;
|
||||||
if (opName == "OP490-3") getAllLabelContents.Y = "2";
|
if (opName == "OP490-3") getAllLabelContents.Y = "2";
|
||||||
|
if (opName.StartsWith("OP450")) getAllLabelContents.Y = "3";
|
||||||
MisDataFun.LogRecording_OP(opName, "INFO", "MOM", "调用打印配置接口");
|
MisDataFun.LogRecording_OP(opName, "INFO", "MOM", "调用打印配置接口");
|
||||||
ND_Api.getAllLabelContents(apiName, opName, getAllLabelContents,out string responseContent, out code, out message);
|
ND_Api.getAllLabelContents(apiName, opName, getAllLabelContents,out string responseContent, out code, out message);
|
||||||
if (code == "0")
|
if (code == "0")
|
||||||
@@ -1535,6 +1536,9 @@ namespace MisDataSaveDate
|
|||||||
case "dcGroupRevision":
|
case "dcGroupRevision":
|
||||||
dataCollectForResourceInspect.dcGroupRevision = paramValue?.ToString() ?? "";
|
dataCollectForResourceInspect.dcGroupRevision = paramValue?.ToString() ?? "";
|
||||||
break;
|
break;
|
||||||
|
case "executeMode":
|
||||||
|
dataCollectForResourceInspect.executeMode = paramValue?.ToString() ?? "";
|
||||||
|
break;
|
||||||
case "operation":
|
case "operation":
|
||||||
dataCollectForResourceInspect.operation = operation;
|
dataCollectForResourceInspect.operation = operation;
|
||||||
break;
|
break;
|
||||||
@@ -1556,9 +1560,12 @@ 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 || EngineTypeID == 6 || EngineTypeID == 7) dataCollectForResourceInspect.dcSequence = "B1";
|
if (EngineTypeID == 2) 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";
|
||||||
|
if (EngineTypeID == 5) dataCollectForResourceInspect.dcSequence = "B5";
|
||||||
|
if (EngineTypeID == 6) dataCollectForResourceInspect.dcSequence = "B4";
|
||||||
|
if (EngineTypeID == 7) dataCollectForResourceInspect.dcSequence = "B4";
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ParametricData> parametricDataArray = new List<ParametricData>();
|
List<ParametricData> parametricDataArray = new List<ParametricData>();
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Function1061", "MisDataFunc
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Function1065", "MisDataFunction\Function1065\Function1065.csproj", "{ABE98FA8-80EB-40E8-A93A-D70F14EB80DC}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Function1065", "MisDataFunction\Function1065\Function1065.csproj", "{ABE98FA8-80EB-40E8-A93A-D70F14EB80DC}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Function1062", "MisDataFunction\Function1062\Function1062.csproj", "{304A54D1-63AD-44DE-B573-772EE533C47F}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -163,6 +165,14 @@ Global
|
|||||||
{ABE98FA8-80EB-40E8-A93A-D70F14EB80DC}.Release|Any CPU.Build.0 = Release|Any CPU
|
{ABE98FA8-80EB-40E8-A93A-D70F14EB80DC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{ABE98FA8-80EB-40E8-A93A-D70F14EB80DC}.Release|x86.ActiveCfg = Release|Any CPU
|
{ABE98FA8-80EB-40E8-A93A-D70F14EB80DC}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
{ABE98FA8-80EB-40E8-A93A-D70F14EB80DC}.Release|x86.Build.0 = Release|Any CPU
|
{ABE98FA8-80EB-40E8-A93A-D70F14EB80DC}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{304A54D1-63AD-44DE-B573-772EE533C47F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{304A54D1-63AD-44DE-B573-772EE533C47F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{304A54D1-63AD-44DE-B573-772EE533C47F}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{304A54D1-63AD-44DE-B573-772EE533C47F}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{304A54D1-63AD-44DE-B573-772EE533C47F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{304A54D1-63AD-44DE-B573-772EE533C47F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{304A54D1-63AD-44DE-B573-772EE533C47F}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{304A54D1-63AD-44DE-B573-772EE533C47F}.Release|x86.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@@ -180,6 +190,7 @@ Global
|
|||||||
{D5DC93C7-91DD-4C82-9444-64180F15A9C9} = {4BF576F8-7AFE-41D3-A998-2AE62375DEC6}
|
{D5DC93C7-91DD-4C82-9444-64180F15A9C9} = {4BF576F8-7AFE-41D3-A998-2AE62375DEC6}
|
||||||
{9ACE8658-5E01-4323-8A59-D43CFFCB47F3} = {4BF576F8-7AFE-41D3-A998-2AE62375DEC6}
|
{9ACE8658-5E01-4323-8A59-D43CFFCB47F3} = {4BF576F8-7AFE-41D3-A998-2AE62375DEC6}
|
||||||
{ABE98FA8-80EB-40E8-A93A-D70F14EB80DC} = {4BF576F8-7AFE-41D3-A998-2AE62375DEC6}
|
{ABE98FA8-80EB-40E8-A93A-D70F14EB80DC} = {4BF576F8-7AFE-41D3-A998-2AE62375DEC6}
|
||||||
|
{304A54D1-63AD-44DE-B573-772EE533C47F} = {4BF576F8-7AFE-41D3-A998-2AE62375DEC6}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {9BB32B35-134E-4853-B853-73A014D416DF}
|
SolutionGuid = {9BB32B35-134E-4853-B853-73A014D416DF}
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|
||||||
ReloadSpecialConfig();
|
Get_SpecialOpList();
|
||||||
|
|
||||||
var sql =
|
var sql =
|
||||||
$" SELECT [工位号],[工位名称],[PLC],[PLC代码],[MesDll]" +
|
$" SELECT [工位号],[工位名称],[PLC],[PLC代码],[MesDll]" +
|
||||||
@@ -221,13 +221,6 @@ namespace MisDataSaveDate
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重新加载特殊工位及硬编码规则配置缓存
|
|
||||||
static public void ReloadSpecialConfig()
|
|
||||||
{
|
|
||||||
Get_SpecialOpList();
|
|
||||||
Get_SpecialOpRuleConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取特殊工位列表
|
// 获取特殊工位列表
|
||||||
static public void Get_SpecialOpList()
|
static public void Get_SpecialOpList()
|
||||||
{
|
{
|
||||||
@@ -245,35 +238,6 @@ 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)
|
||||||
{
|
{
|
||||||
@@ -1110,8 +1074,7 @@ namespace MisDataSaveDate
|
|||||||
|
|
||||||
private void button19_Click_1(object sender, EventArgs e)
|
private void button19_Click_1(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
ReloadSpecialConfig();
|
Get_SpecialOpList();
|
||||||
MessageBox.Show("特殊工位和规则配置已重新加载!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void button21_Click(object sender, EventArgs e)
|
private void button21_Click(object sender, EventArgs e)
|
||||||
|
|||||||
@@ -275,6 +275,10 @@
|
|||||||
<Project>{9ace8658-5e01-4323-8a59-d43cffcb47f3}</Project>
|
<Project>{9ace8658-5e01-4323-8a59-d43cffcb47f3}</Project>
|
||||||
<Name>Function1061</Name>
|
<Name>Function1061</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\MisDataFunction\Function1062\Function1062.csproj">
|
||||||
|
<Project>{304a54d1-63ad-44de-b573-772ee533c47f}</Project>
|
||||||
|
<Name>Function1062</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\MisDataFunction\Function1065\Function1065.csproj">
|
<ProjectReference Include="..\..\MisDataFunction\Function1065\Function1065.csproj">
|
||||||
<Project>{abe98fa8-80eb-40e8-a93a-d70f14eb80dc}</Project>
|
<Project>{abe98fa8-80eb-40e8-a93a-d70f14eb80dc}</Project>
|
||||||
<Name>Function1065</Name>
|
<Name>Function1065</Name>
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ namespace MisDataSaveDate
|
|||||||
readonly string headUrl = "WebSend/";
|
readonly string headUrl = "WebSend/";
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
|
||||||
[Route("ApiFailRetry")]
|
[Route("ApiFailRetry")]
|
||||||
public HttpResponseMessage ReceiveMomPlanData([FromBody] JObject jobj)
|
public HttpResponseMessage ReceiveMomPlanData([FromBody] JObject jobj)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -701,6 +701,10 @@ namespace MisDataSaveDate
|
|||||||
{
|
{
|
||||||
throw new Exception("参数EngineID为空!");
|
throw new Exception("参数EngineID为空!");
|
||||||
}
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(req.OpName))
|
||||||
|
{
|
||||||
|
throw new Exception("参数OpName为空!");
|
||||||
|
}
|
||||||
if (req.EngineTypeID <= 0)
|
if (req.EngineTypeID <= 0)
|
||||||
{
|
{
|
||||||
throw new Exception("参数EngineTypeID无效!");
|
throw new Exception("参数EngineTypeID无效!");
|
||||||
@@ -708,7 +712,7 @@ namespace MisDataSaveDate
|
|||||||
|
|
||||||
string engineID = req.EngineID.Trim();
|
string engineID = req.EngineID.Trim();
|
||||||
int engineTypeID = req.EngineTypeID;
|
int engineTypeID = req.EngineTypeID;
|
||||||
string opName = "OP490-3";
|
string opName = req.OpName.Trim();
|
||||||
|
|
||||||
string tagValue = MisDataFunDll.MisDataFun.GetMesClientTagValue(opName, engineID, engineTypeID);
|
string tagValue = MisDataFunDll.MisDataFun.GetMesClientTagValue(opName, engineID, engineTypeID);
|
||||||
|
|
||||||
@@ -857,6 +861,11 @@ namespace MisDataSaveDate
|
|||||||
/// 产品型号代码
|
/// 产品型号代码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int EngineTypeID { get; set; }
|
public int EngineTypeID { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 工位号,如 OP120
|
||||||
|
/// </summary>
|
||||||
|
public string OpName { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GetClientTagValueRes
|
public class GetClientTagValueRes
|
||||||
|
|||||||
19
MisDataFun_Exe/Function1062.dll.config
Normal file
19
MisDataFun_Exe/Function1062.dll.config
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="MQTTnet" publicKeyToken="b69712f52770c0a7" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-3.0.13.0" newVersion="3.0.13.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
|
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /></startup></configuration>
|
||||||
@@ -84,18 +84,11 @@ namespace MesServerFunctions
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//通知PLC,MES工作完成
|
MisDataBaseFun.WriteMesReadOver(OpName, true); // 保存完成工作完成
|
||||||
MIS_BASE.Write_MesWorkFinish(OpName, true);
|
|
||||||
//通知PLC,MES保存完成
|
|
||||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
|
||||||
|
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "MES保存数据完成!");
|
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "MES工作完成!");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MIS_BASE.Write_MesReadOver(OpName, false);
|
MisDataBaseFun.WriteMesReadOver(OpName, false); // 保存完成工作完成
|
||||||
MIS_BASE.Write_MesWorkFinish(OpName, false);
|
|
||||||
// 写入加工合格还是不合格 根据工位合格标志写
|
// 写入加工合格还是不合格 根据工位合格标志写
|
||||||
MIS_BASE.Write_OpNameIsOk(OpName, -99);
|
MIS_BASE.Write_OpNameIsOk(OpName, -99);
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "PLC允许保存数据取消!");
|
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "PLC允许保存数据取消!");
|
||||||
|
|||||||
@@ -124,18 +124,11 @@ namespace MesServerFunctions
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//通知PLC,MES工作完成
|
MisDataBaseFun.WriteMesReadOver(OpName, true); // 保存完成工作完成
|
||||||
MIS_BASE.Write_MesWorkFinish(OpName, true);
|
|
||||||
//通知PLC,MES保存完成
|
|
||||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
|
||||||
|
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "MES保存数据完成!");
|
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "MES工作完成!");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MIS_BASE.Write_MesReadOver(OpName, false);
|
MisDataBaseFun.WriteMesReadOver(OpName, false); // 保存完成工作完成
|
||||||
MIS_BASE.Write_MesWorkFinish(OpName, false);
|
|
||||||
// 写入加工合格还是不合格 根据工位合格标志写
|
// 写入加工合格还是不合格 根据工位合格标志写
|
||||||
MIS_BASE.Write_OpNameIsOk(OpName, -99);
|
MIS_BASE.Write_OpNameIsOk(OpName, -99);
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "PLC允许保存数据取消!");
|
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "PLC允许保存数据取消!");
|
||||||
|
|||||||
@@ -79,6 +79,7 @@
|
|||||||
<Compile Include="OpcServer\FalseGO.cs" />
|
<Compile Include="OpcServer\FalseGO.cs" />
|
||||||
<Compile Include="OpcServer\FixOK.cs" />
|
<Compile Include="OpcServer\FixOK.cs" />
|
||||||
<Compile Include="OpcServer\FixOver.cs" />
|
<Compile Include="OpcServer\FixOver.cs" />
|
||||||
|
<Compile Include="OpcServer\ManualStaticBSave.cs" />
|
||||||
<Compile Include="OpcServer\MesSaveNowData.cs" />
|
<Compile Include="OpcServer\MesSaveNowData.cs" />
|
||||||
<Compile Include="OpcServer\HeartBeat.cs" />
|
<Compile Include="OpcServer\HeartBeat.cs" />
|
||||||
<Compile Include="OpcServer\MesRead.cs" />
|
<Compile Include="OpcServer\MesRead.cs" />
|
||||||
|
|||||||
@@ -100,6 +100,13 @@ namespace MesServerFunctions
|
|||||||
case "65":
|
case "65":
|
||||||
fun_MesSaveNowData(e);
|
fun_MesSaveNowData(e);
|
||||||
break;
|
break;
|
||||||
|
//OP420 静置B位产品信息保存请求
|
||||||
|
case "64":
|
||||||
|
if (m_OpName == "OP420")
|
||||||
|
{
|
||||||
|
fun_ManualStaticBSave(e);
|
||||||
|
}
|
||||||
|
break;
|
||||||
//MES 系统健康心跳
|
//MES 系统健康心跳
|
||||||
case "14":
|
case "14":
|
||||||
fun_HeartBeatMIS(e);
|
fun_HeartBeatMIS(e);
|
||||||
@@ -180,6 +187,16 @@ namespace MesServerFunctions
|
|||||||
ThreadPool.QueueUserWorkItem(FalseGO, e);
|
ThreadPool.QueueUserWorkItem(FalseGO, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// OP420 静置B位产品信息保存
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="OpName"></param>
|
||||||
|
/// <param name="tagValue"></param>
|
||||||
|
public void fun_ManualStaticBSave(DeviceDriver_BasicData.CustomeEvetnArgs e)
|
||||||
|
{
|
||||||
|
ThreadPool.QueueUserWorkItem(ManualStaticBSave, e);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 允许保存
|
/// 允许保存
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
91
MisDataFunction/Function1055/OpcServer/ManualStaticBSave.cs
Normal file
91
MisDataFunction/Function1055/OpcServer/ManualStaticBSave.cs
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
using DataLinkMesWork1;
|
||||||
|
using MesServerWork;
|
||||||
|
using MisDataFunDll;
|
||||||
|
using System;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
|
||||||
|
namespace MesServerFunctions
|
||||||
|
{
|
||||||
|
partial class FunctionMES
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// OP420 静置B位产品信息保存:64=1 保存开始静置信息,64=0 复位保存完成点位。
|
||||||
|
/// </summary>
|
||||||
|
private void ManualStaticBSave(object e)
|
||||||
|
{
|
||||||
|
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||||
|
string opName = Convert.ToString(msgEvent.OpName);
|
||||||
|
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (opName != "OP420")
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tagValue != 1)
|
||||||
|
{
|
||||||
|
MIS_BASE.Write_TagValueByTagTypeID(31, opName, false);
|
||||||
|
MisDataFun.LogRecording_OP(opName, "INFO", "ManualStaticBSave", "PLC请求保存静置B位产品信息取消!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int engineTypeID;
|
||||||
|
string engineType;
|
||||||
|
string engineID;
|
||||||
|
int palletCode;
|
||||||
|
string orderForm;
|
||||||
|
|
||||||
|
// 从 PLC 当前产品区读取 B 位产品信息,作为线下手动静置开始记录。
|
||||||
|
MIS_BASE.GetEngineTypeFromPLC(opName, out engineTypeID, out engineType, out engineID, out palletCode, out orderForm);
|
||||||
|
if (string.IsNullOrWhiteSpace(engineID))
|
||||||
|
{
|
||||||
|
WriteManualStaticBSaveError(opName, "PLC当前产品码为空,无法记录静置B位产品信息");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// PLC 可能只给产品码和机型代码,补查数据库中的产品型号。
|
||||||
|
string dbEngineType;
|
||||||
|
int dbEngineTypeID;
|
||||||
|
MisDataFun.Moby_Select_PDC(engineID, out orderForm, out dbEngineType, out dbEngineTypeID);
|
||||||
|
if (dbEngineTypeID > 0)
|
||||||
|
{
|
||||||
|
engineTypeID = dbEngineTypeID;
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrWhiteSpace(dbEngineType))
|
||||||
|
{
|
||||||
|
engineType = dbEngineType;
|
||||||
|
}
|
||||||
|
|
||||||
|
string message;
|
||||||
|
if (!MisDataFun.SaveManualStaticBRecord(engineID, engineType, engineTypeID, out message))
|
||||||
|
{
|
||||||
|
WriteManualStaticBSaveError(opName, message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MIS_BASE.Write_TagValueByTagTypeID(31, opName, true);
|
||||||
|
MisDataFun.LogRecording_OP(opName, "INFO", "ManualStaticBSave", "静置B位产品信息保存完成:" + engineID);
|
||||||
|
}
|
||||||
|
catch (Exception err)
|
||||||
|
{
|
||||||
|
MyLog4Net.MyLogHelper.Error("Function1055.ManualStaticBSave", err.Message);
|
||||||
|
WriteManualStaticBSaveError(opName, err.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// OP420 静置B位保存失败时复位完成点位并通知页面。
|
||||||
|
/// </summary>
|
||||||
|
private void WriteManualStaticBSaveError(string opName, string message)
|
||||||
|
{
|
||||||
|
MIS_BASE.Write_TagValueByTagTypeID(31, opName, false);
|
||||||
|
MIS_BASE.Write_TagValueByTagTypeID(34, opName, true);
|
||||||
|
SendMessage.AsyncSendMessage_Notice(opName, "【" + opName + "】" + message);
|
||||||
|
MisDataFun.LogRecording_OP(opName, "ERROR", "ManualStaticBSave", message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -111,17 +111,11 @@ namespace MesServerFunctions
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//通知PLC,MES保存完成
|
MisDataBaseFun.WriteMesReadOver(OpName, true); // 保存完成工作完成
|
||||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
|
||||||
//通知PLC,MES工作完成
|
|
||||||
MIS_BASE.Write_MesWorkFinish(OpName, true);
|
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "MES保存数据完成!");
|
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "MES工作完成!");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MIS_BASE.Write_MesReadOver(OpName, false);
|
MisDataBaseFun.WriteMesReadOver(OpName, false); // 保存完成工作完成
|
||||||
MIS_BASE.Write_MesWorkFinish(OpName, false);
|
|
||||||
// 写入加工合格还是不合格 根据工位合格标志写
|
// 写入加工合格还是不合格 根据工位合格标志写
|
||||||
MIS_BASE.Write_OpNameIsOk(OpName, -99);
|
MIS_BASE.Write_OpNameIsOk(OpName, -99);
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "PLC允许保存数据取消!");
|
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "PLC允许保存数据取消!");
|
||||||
|
|||||||
@@ -127,18 +127,19 @@ namespace MesServerFunctions
|
|||||||
// 都出站成功了 才给PLC信号
|
// 都出站成功了 才给PLC信号
|
||||||
if (part1_IsOk && part2_IsOk)
|
if (part1_IsOk && part2_IsOk)
|
||||||
{
|
{
|
||||||
// 4.通知PLC,MES保存完成 MES工作完成
|
//通知PLC,MES工作完成
|
||||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
|
||||||
MIS_BASE.Write_MesWorkFinish(OpName, true);
|
MIS_BASE.Write_MesWorkFinish(OpName, true);
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "MES保存数据完成!");
|
//通知PLC,MES保存完成
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "MES工作完成!");
|
MIS_BASE.Write_MesReadOver(OpName, true);
|
||||||
|
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "MES保存数据完成!");
|
||||||
|
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "MES工作完成!");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MIS_BASE.Write_MesReadOver(OpName, false);
|
MisDataBaseFun.WriteMesReadOver(OpName, false); // 保存完成工作完成
|
||||||
MIS_BASE.Write_MesWorkFinish(OpName, false);
|
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "PLC允许保存数据取消!");
|
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "PLC允许保存数据取消!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,19 +65,20 @@ namespace MesServerFunctions
|
|||||||
}
|
}
|
||||||
// 写入加工合格还是不合格 根据工位合格标志写
|
// 写入加工合格还是不合格 根据工位合格标志写
|
||||||
MIS_BASE.Write_OpNameIsOk(OpName, qualityMask);
|
MIS_BASE.Write_OpNameIsOk(OpName, qualityMask);
|
||||||
//通知PLC,MES保存完成
|
|
||||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
|
||||||
//通知PLC,MES工作完成
|
//通知PLC,MES工作完成
|
||||||
MIS_BASE.Write_MesWorkFinish(OpName, true);
|
MIS_BASE.Write_MesWorkFinish(OpName, true);
|
||||||
|
//通知PLC,MES保存完成
|
||||||
|
MIS_BASE.Write_MesReadOver(OpName, true);
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "MES保存数据完成!");
|
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "MES保存数据完成!");
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "MES工作完成!");
|
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "MES工作完成!");
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 写入加工合格还是不合格 根据工位合格标志写
|
// 写入加工合格还是不合格 根据工位合格标志写
|
||||||
MIS_BASE.Write_OpNameIsOk(OpName, -99);
|
MIS_BASE.Write_OpNameIsOk(OpName, -99);
|
||||||
MIS_BASE.Write_MesReadOver(OpName, false);
|
MisDataBaseFun.WriteMesReadOver(OpName, false); // 保存完成工作完成
|
||||||
MIS_BASE.Write_MesWorkFinish(OpName, false);
|
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "PLC允许保存数据取消!");
|
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "PLC允许保存数据取消!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -99,12 +99,7 @@ namespace MesServerFunctions
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//通知PLC,MES保存完成
|
MisDataBaseFun.WriteMesReadOver(OpName, true); // 保存完成工作完成
|
||||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
|
||||||
//通知PLC,MES工作完成
|
|
||||||
MIS_BASE.Write_MesWorkFinish(OpName, true);
|
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "MES保存数据完成!");
|
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "MES工作完成!");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -120,8 +115,7 @@ namespace MesServerFunctions
|
|||||||
{
|
{
|
||||||
// 写入加工合格还是不合格 根据工位合格标志写
|
// 写入加工合格还是不合格 根据工位合格标志写
|
||||||
MIS_BASE.Write_OpNameIsOk(OpName, -99);
|
MIS_BASE.Write_OpNameIsOk(OpName, -99);
|
||||||
MIS_BASE.Write_MesReadOver(OpName, false);
|
MisDataBaseFun.WriteMesReadOver(OpName, false); // 保存完成工作完成
|
||||||
MIS_BASE.Write_MesWorkFinish(OpName, false);
|
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "PLC允许保存数据取消!");
|
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "PLC允许保存数据取消!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,19 +49,13 @@ namespace MesServerFunctions
|
|||||||
|
|
||||||
// 写入加工合格还是不合格 根据工位合格标志写
|
// 写入加工合格还是不合格 根据工位合格标志写
|
||||||
MIS_BASE.Write_OpNameIsOk(OpName, qualityMask);
|
MIS_BASE.Write_OpNameIsOk(OpName, qualityMask);
|
||||||
//通知PLC,MES保存完成
|
MisDataBaseFun.WriteMesReadOver(OpName, true); // 保存完成工作完成
|
||||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
|
||||||
//通知PLC,MES工作完成
|
|
||||||
MIS_BASE.Write_MesWorkFinish(OpName, true);
|
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "MES保存数据完成!");
|
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "MES工作完成!");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 写入加工合格还是不合格 根据工位合格标志写
|
// 写入加工合格还是不合格 根据工位合格标志写
|
||||||
MIS_BASE.Write_OpNameIsOk(OpName, -99);
|
MIS_BASE.Write_OpNameIsOk(OpName, -99);
|
||||||
MIS_BASE.Write_MesReadOver(OpName, false);
|
MisDataBaseFun.WriteMesReadOver(OpName, false); // 保存完成工作完成
|
||||||
MIS_BASE.Write_MesWorkFinish(OpName, false);
|
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "PLC允许保存数据取消!");
|
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "PLC允许保存数据取消!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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 || EngineTypeID == 6 || EngineTypeID == 7) PrinterCommandCenter.PrintToPrinter(OpName, EngineID); // 打印PACK条码
|
if(EngineTypeID == 2 || EngineTypeID == 3) 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", "物料验证完成 允许工作!");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,18 +81,11 @@ namespace MesServerFunctions
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//通知PLC,MES工作完成
|
MisDataBaseFun.WriteMesReadOver(OpName, true); // 保存完成工作完成
|
||||||
MIS_BASE.Write_MesWorkFinish(OpName, true);
|
|
||||||
//通知PLC,MES保存完成
|
|
||||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
|
||||||
|
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "MES保存数据完成!");
|
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "MES工作完成!");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MIS_BASE.Write_MesReadOver(OpName, false);
|
MisDataBaseFun.WriteMesReadOver(OpName, false); // 保存完成工作完成
|
||||||
MIS_BASE.Write_MesWorkFinish(OpName, false);
|
|
||||||
// 写入加工合格还是不合格 根据工位合格标志写
|
// 写入加工合格还是不合格 根据工位合格标志写
|
||||||
MIS_BASE.Write_OpNameIsOk(OpName, -99);
|
MIS_BASE.Write_OpNameIsOk(OpName, -99);
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "PLC允许保存数据取消!");
|
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "PLC允许保存数据取消!");
|
||||||
|
|||||||
@@ -10,14 +10,20 @@ namespace MesServerFunctions
|
|||||||
{
|
{
|
||||||
partial class FunctionMES
|
partial class FunctionMES
|
||||||
{
|
{
|
||||||
|
// OP431 手动静置出库固定配置。
|
||||||
private const string ManualStaticOutOpName = "OP431";
|
private const string ManualStaticOutOpName = "OP431";
|
||||||
private const string ManualStaticPadTopic = "OP431PAD";
|
private const string ManualStaticPadTopic = "OP431PAD";
|
||||||
private const decimal DefaultManualStaticMinutes = 30m;
|
private const decimal DefaultManualStaticMinutes = 30m;
|
||||||
private const string ManualStaticLocation = "777777";
|
private const string ManualStaticLocation = "777777";
|
||||||
private const string ManualStaticOperator = "PAD";
|
private const string ManualStaticOperator = "PAD";
|
||||||
|
|
||||||
|
// 记录 PAD 确认时使用的最小静置分钟数,保存质量数据时沿用同一标准。
|
||||||
private static readonly object ManualStaticMinutesLocker = new object();
|
private static readonly object ManualStaticMinutesLocker = new object();
|
||||||
private static readonly Dictionary<string, decimal> ManualStaticMinutesByEngine = new Dictionary<string, decimal>();
|
private static readonly Dictionary<string, decimal> ManualStaticMinutesByEngine = new Dictionary<string, decimal>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// OP431 当前产品基础信息。
|
||||||
|
/// </summary>
|
||||||
private class ManualStaticOutProduct
|
private class ManualStaticOutProduct
|
||||||
{
|
{
|
||||||
public string EngineID { get; set; }
|
public string EngineID { get; set; }
|
||||||
@@ -26,6 +32,9 @@ namespace MesServerFunctions
|
|||||||
public int EngineTypeID { get; set; }
|
public int EngineTypeID { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// OP431 静置质量数据计算结果。
|
||||||
|
/// </summary>
|
||||||
private class ManualStaticOutData
|
private class ManualStaticOutData
|
||||||
{
|
{
|
||||||
public string SourceOpName { get; set; }
|
public string SourceOpName { get; set; }
|
||||||
@@ -35,6 +44,9 @@ namespace MesServerFunctions
|
|||||||
public int QualityMask { get; set; }
|
public int QualityMask { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询产品订单、型号和机型代码。
|
||||||
|
/// </summary>
|
||||||
private bool TryGetManualStaticOutProduct(string engineID, out ManualStaticOutProduct product, out string message)
|
private bool TryGetManualStaticOutProduct(string engineID, out ManualStaticOutProduct product, out string message)
|
||||||
{
|
{
|
||||||
product = null;
|
product = null;
|
||||||
@@ -46,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
|
||||||
@@ -63,6 +74,59 @@ 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>
|
||||||
|
/// 查询 OP420 记录的线下手动静置开始时间。
|
||||||
|
/// </summary>
|
||||||
private bool TryGetManualStaticStartTime(string engineID, out string sourceOpName, out DateTime startTime, out string message)
|
private bool TryGetManualStaticStartTime(string engineID, out string sourceOpName, out DateTime startTime, out string message)
|
||||||
{
|
{
|
||||||
sourceOpName = "";
|
sourceOpName = "";
|
||||||
@@ -71,35 +135,61 @@ namespace MesServerFunctions
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 取 OP400/OP410/OP420 最后一条有效离开记录作为常温静置开始时间。
|
// OP431 手动出库以 OP420 记录的线下静置开始时间为准。
|
||||||
string procedureName = "OP431手动静置出库_前序离开时间_查询";
|
string procedureName = "线下手动静置_记录_查询";
|
||||||
SqlParameter[] sqlParameters = new SqlParameter[1];
|
SqlParameter[] sqlParameters = new SqlParameter[1];
|
||||||
sqlParameters[0] = new SqlParameter("@发动机号", engineID);
|
sqlParameters[0] = new SqlParameter("@产品编号", engineID);
|
||||||
|
|
||||||
DataAccess.ExecuteStoredProcedure(procedureName, ref sqlParameters, out DataTable dt, out string errorMessage);
|
DataAccess.ExecuteStoredProcedure(procedureName, ref sqlParameters, out DataTable dt, out string errorMessage);
|
||||||
if (!string.IsNullOrWhiteSpace(errorMessage))
|
if (!string.IsNullOrWhiteSpace(errorMessage))
|
||||||
{
|
{
|
||||||
message = "查询前序出站时间失败:" + errorMessage;
|
message = "查询线下手动静置开始时间失败:" + errorMessage;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dt == null || dt.Rows.Count == 0)
|
if (dt == null || dt.Rows.Count == 0)
|
||||||
{
|
{
|
||||||
message = "未查询到 OP400/OP410/OP420 前序出站记录";
|
message = "未查询到线下手动静置开始记录:" + engineID;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceOpName = Convert.ToString(dt.Rows[0]["工位号"]);
|
sourceOpName = "OP420";
|
||||||
startTime = Convert.ToDateTime(dt.Rows[0]["开始静置时间"]);
|
startTime = Convert.ToDateTime(dt.Rows[0]["静置开始时间"]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception err)
|
catch (Exception err)
|
||||||
{
|
{
|
||||||
message = "查询前序出站时间失败:" + err.Message;
|
message = "查询线下手动静置开始时间失败:" + err.Message;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// OP431 保存时回写线下手动静置结束时间和静置时长。
|
||||||
|
/// </summary>
|
||||||
|
private bool FinishManualStaticRecord(string engineID, DateTime finishTime, decimal minutes, out string message)
|
||||||
|
{
|
||||||
|
message = "";
|
||||||
|
SqlParameter[] sqlParameters = new SqlParameter[]
|
||||||
|
{
|
||||||
|
new SqlParameter("@产品编号", engineID),
|
||||||
|
new SqlParameter("@静置结束时间", finishTime),
|
||||||
|
new SqlParameter("@静置时长", minutes)
|
||||||
|
};
|
||||||
|
|
||||||
|
DataAccess.ExecuteStoredProcedure("线下手动静置_记录_结束", ref sqlParameters, out string errorMessage);
|
||||||
|
if (!string.IsNullOrWhiteSpace(errorMessage))
|
||||||
|
{
|
||||||
|
message = "回写线下手动静置结束时间失败:" + errorMessage;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生成 OP431 保存时需要的静置时间和质量标识。
|
||||||
|
/// </summary>
|
||||||
private bool TryBuildManualStaticOutData(string engineID, int qualityMask, out ManualStaticOutData staticOutData, out string message)
|
private bool TryBuildManualStaticOutData(string engineID, int qualityMask, out ManualStaticOutData staticOutData, out string message)
|
||||||
{
|
{
|
||||||
staticOutData = null;
|
staticOutData = null;
|
||||||
@@ -110,6 +200,7 @@ namespace MesServerFunctions
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PLC 允许保存到达时的服务器时间作为静置完成时间。
|
||||||
DateTime finishTime = DateTime.Now;
|
DateTime finishTime = DateTime.Now;
|
||||||
decimal minutes = Math.Round(Convert.ToDecimal((finishTime - startTime).TotalMinutes), 2);
|
decimal minutes = Math.Round(Convert.ToDecimal((finishTime - startTime).TotalMinutes), 2);
|
||||||
staticOutData = new ManualStaticOutData
|
staticOutData = new ManualStaticOutData
|
||||||
@@ -123,11 +214,17 @@ namespace MesServerFunctions
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 标准化质量标识:1 为合格,其余均按不合格处理。
|
||||||
|
/// </summary>
|
||||||
private int NormalizeManualStaticQualityMask(int qualityMask)
|
private int NormalizeManualStaticQualityMask(int qualityMask)
|
||||||
{
|
{
|
||||||
return qualityMask == 1 ? 1 : 2;
|
return qualityMask == 1 ? 1 : 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 判断静置时长是否达到 PAD 配置的最小分钟数。
|
||||||
|
/// </summary>
|
||||||
private bool IsManualStaticTimeEnough(ManualStaticOutData staticOutData, decimal minStaticMinutes, out string message)
|
private bool IsManualStaticTimeEnough(ManualStaticOutData staticOutData, decimal minStaticMinutes, out string message)
|
||||||
{
|
{
|
||||||
message = "";
|
message = "";
|
||||||
@@ -139,6 +236,9 @@ namespace MesServerFunctions
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 直接写入 OP431 四项静置质量数据。
|
||||||
|
/// </summary>
|
||||||
private bool WriteManualStaticOutQualityData(string opName, string engineID, ManualStaticOutData data, out string message)
|
private bool WriteManualStaticOutQualityData(string opName, string engineID, ManualStaticOutData data, out string message)
|
||||||
{
|
{
|
||||||
message = "";
|
message = "";
|
||||||
@@ -149,6 +249,7 @@ namespace MesServerFunctions
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 先写质量索引,取返回的 Id_tagCF 作为明细关联键。
|
||||||
string minStaticMinutes = rememberedMinStaticMinutes.ToString("0.##");
|
string minStaticMinutes = rememberedMinStaticMinutes.ToString("0.##");
|
||||||
|
|
||||||
// OP431 的静置数据由 Function 直接落库,不再通过 OnlineCheckData 做 HTTP 自调用。
|
// OP431 的静置数据由 Function 直接落库,不再通过 OnlineCheckData 做 HTTP 自调用。
|
||||||
@@ -175,6 +276,7 @@ namespace MesServerFunctions
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 四条质量明细必须与 MOM 数据收集组配置的 TagID 保持一致。
|
||||||
object[,] detailRows = new object[,]
|
object[,] detailRows = new object[,]
|
||||||
{
|
{
|
||||||
{ "OP431_M0001_001", "开始静置时间", "min", "1", "60", minStaticMinutes, data.StartTime.ToString("yyyy-MM-dd HH:mm:ss"), data.QualityMask },
|
{ "OP431_M0001_001", "开始静置时间", "min", "1", "60", minStaticMinutes, data.StartTime.ToString("yyyy-MM-dd HH:mm:ss"), data.QualityMask },
|
||||||
@@ -211,6 +313,9 @@ namespace MesServerFunctions
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 确认上线前校验托盘到位和 PLC 申请上线状态。
|
||||||
|
/// </summary>
|
||||||
private bool CheckManualStaticPadPrecondition(string opName, out string message)
|
private bool CheckManualStaticPadPrecondition(string opName, out string message)
|
||||||
{
|
{
|
||||||
message = "";
|
message = "";
|
||||||
@@ -232,6 +337,9 @@ namespace MesServerFunctions
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// PAD 确认上线:校验静置条件,通过后写入 PLC 产品区。
|
||||||
|
/// </summary>
|
||||||
private bool ConfirmManualStaticOutProduct(string opName, string engineID, decimal minStaticMinutes, out string message)
|
private bool ConfirmManualStaticOutProduct(string opName, string engineID, decimal minStaticMinutes, out string message)
|
||||||
{
|
{
|
||||||
message = "";
|
message = "";
|
||||||
@@ -273,6 +381,9 @@ namespace MesServerFunctions
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// PAD 扫码查询:返回产品、静置时间和是否允许确认。
|
||||||
|
/// </summary>
|
||||||
private bool QueryManualStaticOutProduct(string opName, string engineID, decimal minStaticMinutes, out string resultMessage)
|
private bool QueryManualStaticOutProduct(string opName, string engineID, decimal minStaticMinutes, out string resultMessage)
|
||||||
{
|
{
|
||||||
resultMessage = "";
|
resultMessage = "";
|
||||||
@@ -292,6 +403,7 @@ namespace MesServerFunctions
|
|||||||
bool timeEnough = IsManualStaticTimeEnough(staticOutData, minStaticMinutes, out string timeMessage);
|
bool timeEnough = IsManualStaticTimeEnough(staticOutData, minStaticMinutes, out string timeMessage);
|
||||||
MIS_BASE.Read_PartLoad(opName, out bool partLoad);
|
MIS_BASE.Read_PartLoad(opName, out bool partLoad);
|
||||||
|
|
||||||
|
// PAD 直接使用 canConfirm 控制按钮,不再自行组合判断条件。
|
||||||
bool canConfirm = timeEnough && partLoad;
|
bool canConfirm = timeEnough && partLoad;
|
||||||
string confirmMessage = canConfirm
|
string confirmMessage = canConfirm
|
||||||
? "允许确认上线"
|
? "允许确认上线"
|
||||||
@@ -316,6 +428,9 @@ namespace MesServerFunctions
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 将 PAD 业务结果同时发送到 PAD 主题和工位主题。
|
||||||
|
/// </summary>
|
||||||
private void SendManualStaticOutResult(string opName, string command, bool success, string message)
|
private void SendManualStaticOutResult(string opName, string command, bool success, string message)
|
||||||
{
|
{
|
||||||
string value = (success ? "1" : "0") + "^" + message;
|
string value = (success ? "1" : "0") + "^" + message;
|
||||||
@@ -329,11 +444,17 @@ namespace MesServerFunctions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 向 OP431 PAD 专用主题发送 MQTT 回包。
|
||||||
|
/// </summary>
|
||||||
private void SendManualStaticPadMqttMessage(string command, string opName, string value)
|
private void SendManualStaticPadMqttMessage(string command, string opName, string value)
|
||||||
{
|
{
|
||||||
SendMessage.AsyncSendNotOpMessage(ManualStaticPadTopic, "MES|" + command + "|" + opName + "|" + value);
|
SendMessage.AsyncSendNotOpMessage(ManualStaticPadTopic, "MES|" + command + "|" + opName + "|" + value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 记录产品确认上线时使用的最小静置标准。
|
||||||
|
/// </summary>
|
||||||
private void RememberManualStaticMinutesForProduct(string engineID, decimal minStaticMinutes)
|
private void RememberManualStaticMinutesForProduct(string engineID, decimal minStaticMinutes)
|
||||||
{
|
{
|
||||||
lock (ManualStaticMinutesLocker)
|
lock (ManualStaticMinutesLocker)
|
||||||
@@ -342,6 +463,9 @@ namespace MesServerFunctions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取产品确认上线时记录的最小静置标准。
|
||||||
|
/// </summary>
|
||||||
private bool TryGetManualStaticMinutesForProduct(string engineID, out decimal minStaticMinutes)
|
private bool TryGetManualStaticMinutesForProduct(string engineID, out decimal minStaticMinutes)
|
||||||
{
|
{
|
||||||
lock (ManualStaticMinutesLocker)
|
lock (ManualStaticMinutesLocker)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProductVersion>8.0.30703</ProductVersion>
|
<ProductVersion>8.0.30703</ProductVersion>
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
<ProjectGuid>{B5A0BAA3-C1A7-4AAB-9486-2E650ADACA7E}</ProjectGuid>
|
<ProjectGuid>{304A54D1-63AD-44DE-B573-772EE533C47F}</ProjectGuid>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>Function1062</RootNamespace>
|
<RootNamespace>Function1062</RootNamespace>
|
||||||
@@ -106,4 +106,4 @@
|
|||||||
<Target Name="AfterBuild">
|
<Target Name="AfterBuild">
|
||||||
</Target>
|
</Target>
|
||||||
-->
|
-->
|
||||||
</Project>
|
</Project>
|
||||||
@@ -7,6 +7,7 @@ namespace MesServerFunctions
|
|||||||
{
|
{
|
||||||
partial class FunctionMES
|
partial class FunctionMES
|
||||||
{
|
{
|
||||||
|
// 防止 PLC 传递机型信号重复触发时并发进站。
|
||||||
object lockBarcodeEngineTypeGetOver = new object();
|
object lockBarcodeEngineTypeGetOver = new object();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -32,6 +33,7 @@ namespace MesServerFunctions
|
|||||||
MisDataFun.LogRecording_OP(opName, "INFO", "MIS", "PLC传递机型!");
|
MisDataFun.LogRecording_OP(opName, "INFO", "MIS", "PLC传递机型!");
|
||||||
MIS_BASE.Write_TagValueByTagTypeID(34, opName, false);
|
MIS_BASE.Write_TagValueByTagTypeID(34, opName, false);
|
||||||
|
|
||||||
|
// 同时读取 PLC 回传信息和 PAD 确认时写入的 MES 产品区信息。
|
||||||
MIS_BASE.GetEngineTypeFromPLC(opName, out int engineTypeID, out string engineType, out string engineID, out int palletCode, out string orderForm);
|
MIS_BASE.GetEngineTypeFromPLC(opName, out int engineTypeID, out string engineType, out string engineID, out int palletCode, out string orderForm);
|
||||||
MIS_BASE.GetEngineTypeFromPLC_MES(opName, out int engineTypeIDMes, out string engineTypeMes, out string engineIDMes, out string orderFormMes);
|
MIS_BASE.GetEngineTypeFromPLC_MES(opName, out int engineTypeIDMes, out string engineTypeMes, out string engineIDMes, out string orderFormMes);
|
||||||
|
|
||||||
@@ -47,6 +49,7 @@ namespace MesServerFunctions
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PLC 回传产品必须与 PAD 确认上线产品一致,避免错件进站。
|
||||||
if (!string.Equals(engineID.Trim(), engineIDMes.Trim(), StringComparison.OrdinalIgnoreCase))
|
if (!string.Equals(engineID.Trim(), engineIDMes.Trim(), StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
WriteManualStaticEngineError(opName, "PLC产品码与PAD确认产品码不一致,PLC:" + engineID + ",PAD:" + engineIDMes);
|
WriteManualStaticEngineError(opName, "PLC产品码与PAD确认产品码不一致,PLC:" + engineID + ",PAD:" + engineIDMes);
|
||||||
@@ -59,12 +62,14 @@ namespace MesServerFunctions
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 进站前再次取产品执行信息,后续写 MOBY 使用数据库中的订单和型号。
|
||||||
if (!TryGetManualStaticOutProduct(engineID, out ManualStaticOutProduct product, out string productMessage))
|
if (!TryGetManualStaticOutProduct(engineID, out ManualStaticOutProduct product, out string productMessage))
|
||||||
{
|
{
|
||||||
WriteManualStaticEngineError(opName, productMessage);
|
WriteManualStaticEngineError(opName, productMessage);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 调用工厂 MES 进站,成功后才允许 PLC 工作。
|
||||||
CallWebService.Call_miFindCustomAndSfcData(opName, engineID, out string code, out string message);
|
CallWebService.Call_miFindCustomAndSfcData(opName, engineID, out string code, out string message);
|
||||||
if (code != "0")
|
if (code != "0")
|
||||||
{
|
{
|
||||||
@@ -73,6 +78,8 @@ namespace MesServerFunctions
|
|||||||
}
|
}
|
||||||
|
|
||||||
MisDataFun.LogRecording_OP(opName, "INFO", "MOM", "进站成功:" + engineID);
|
MisDataFun.LogRecording_OP(opName, "INFO", "MOM", "进站成功:" + engineID);
|
||||||
|
|
||||||
|
// 写普通 MOBY 当前工位状态,供后续正常过站过程取数。
|
||||||
MisDataFun.OpName_MIS_MOBY_Insert(opName, product.EngineTypeID, product.EngineType, product.EngineID, palletCode, product.OrderForm, 0, 0, "");
|
MisDataFun.OpName_MIS_MOBY_Insert(opName, product.EngineTypeID, product.EngineType, product.EngineID, palletCode, product.OrderForm, 0, 0, "");
|
||||||
|
|
||||||
MIS_BASE.Write_FixAllow(opName, true);
|
MIS_BASE.Write_FixAllow(opName, true);
|
||||||
@@ -86,6 +93,9 @@ namespace MesServerFunctions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// OP431 进站失败时禁止 PLC 工作、置 MES 报警并通知页面。
|
||||||
|
/// </summary>
|
||||||
private void WriteManualStaticEngineError(string opName, string message)
|
private void WriteManualStaticEngineError(string opName, string message)
|
||||||
{
|
{
|
||||||
MIS_BASE.Write_FixAllow(opName, false);
|
MIS_BASE.Write_FixAllow(opName, false);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using MesServerWork;
|
using MesServerWork;
|
||||||
|
using MesDataFunction;
|
||||||
using MisDataFunDll;
|
using MisDataFunDll;
|
||||||
using MisDataSaveDate;
|
using MisDataSaveDate;
|
||||||
using System;
|
using System;
|
||||||
@@ -21,8 +22,7 @@ namespace MesServerFunctions
|
|||||||
|
|
||||||
if (tagValue != 1)
|
if (tagValue != 1)
|
||||||
{
|
{
|
||||||
MIS_BASE.Write_MesReadOver(opName, false);
|
MisDataBaseFun.WriteMesReadOver(opName, false);
|
||||||
MIS_BASE.Write_MesWorkFinish(opName, false);
|
|
||||||
MIS_BASE.Write_OpNameIsOk(opName, -99);
|
MIS_BASE.Write_OpNameIsOk(opName, -99);
|
||||||
MisDataFun.LogRecording_OP(opName, "INFO", "MIS", "PLC允许保存数据取消!");
|
MisDataFun.LogRecording_OP(opName, "INFO", "MIS", "PLC允许保存数据取消!");
|
||||||
return;
|
return;
|
||||||
@@ -30,6 +30,7 @@ namespace MesServerFunctions
|
|||||||
|
|
||||||
MisDataFun.LogRecording_OP(opName, "INFO", "MIS", "PLC允许保存OP431静置数据!");
|
MisDataFun.LogRecording_OP(opName, "INFO", "MIS", "PLC允许保存OP431静置数据!");
|
||||||
|
|
||||||
|
// 读取 PLC 当前产品信息,后续质量数据和出站都以该产品码为准。
|
||||||
MIS_BASE.GetEngineTypeFromPLC(opName, out int engineTypeID, out string engineType, out string engineID, out int palletCode, out string orderForm);
|
MIS_BASE.GetEngineTypeFromPLC(opName, out int engineTypeID, out string engineType, out string engineID, out int palletCode, out string orderForm);
|
||||||
if (string.IsNullOrWhiteSpace(engineID))
|
if (string.IsNullOrWhiteSpace(engineID))
|
||||||
{
|
{
|
||||||
@@ -37,6 +38,7 @@ namespace MesServerFunctions
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 保存阶段从 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)
|
||||||
{
|
{
|
||||||
@@ -44,21 +46,32 @@ namespace MesServerFunctions
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PLC 合格标识只保留合格/不合格两种结果。
|
||||||
MIS_BASE.Read_QualityMask(opName, out int qualityMask);
|
MIS_BASE.Read_QualityMask(opName, out int qualityMask);
|
||||||
qualityMask = NormalizeManualStaticQualityMask(qualityMask);
|
qualityMask = NormalizeManualStaticQualityMask(qualityMask);
|
||||||
|
|
||||||
|
// 组装 OP431 静置质量数据:开始时间、完成时间、时间差、库位号。
|
||||||
if (!TryBuildManualStaticOutData(engineID, qualityMask, out ManualStaticOutData staticOutData, out string message))
|
if (!TryBuildManualStaticOutData(engineID, qualityMask, out ManualStaticOutData staticOutData, out string message))
|
||||||
{
|
{
|
||||||
WriteManualStaticMesReadError(opName, message);
|
WriteManualStaticMesReadError(opName, message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 保存信号到达时,回写线下静置结束时间和静置时长。
|
||||||
|
if (!FinishManualStaticRecord(engineID, staticOutData.FinishTime, staticOutData.Minutes, out message))
|
||||||
|
{
|
||||||
|
WriteManualStaticMesReadError(opName, message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将四项静置质量数据写入测量数据合格索引和明细表。
|
||||||
if (!WriteManualStaticOutQualityData(opName, engineID, staticOutData, out message))
|
if (!WriteManualStaticOutQualityData(opName, engineID, staticOutData, out message))
|
||||||
{
|
{
|
||||||
WriteManualStaticMesReadError(opName, message);
|
WriteManualStaticMesReadError(opName, message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 写正常过站记录后查询 MOM 上传质量数据组。
|
||||||
MisDataFun.WorkStartInsert(opName, qualityMask);
|
MisDataFun.WorkStartInsert(opName, qualityMask);
|
||||||
MisDataFun.GetPartQualityGroupParams(opName, engineID, out DataTable dtQuality);
|
MisDataFun.GetPartQualityGroupParams(opName, engineID, out DataTable dtQuality);
|
||||||
if (dtQuality == null || dtQuality.Rows.Count == 0)
|
if (dtQuality == null || dtQuality.Rows.Count == 0)
|
||||||
@@ -67,6 +80,7 @@ namespace MesServerFunctions
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 带质量数据调用工厂 MES 出站,返回 13921 时按不合格完成。
|
||||||
CallWebService.Call_dataCollectForSfcEx(opName, engineID, dtQuality, qualityMask, out string code, out string momMessage);
|
CallWebService.Call_dataCollectForSfcEx(opName, engineID, dtQuality, qualityMask, out string code, out string momMessage);
|
||||||
if (code == "0")
|
if (code == "0")
|
||||||
{
|
{
|
||||||
@@ -84,8 +98,7 @@ namespace MesServerFunctions
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MIS_BASE.Write_MesWorkFinish(opName, true);
|
MisDataBaseFun.WriteMesReadOver(opName, true);
|
||||||
MIS_BASE.Write_MesReadOver(opName, true);
|
|
||||||
|
|
||||||
MisDataFun.LogRecording_OP(opName, "INFO", "MIS", "MES保存OP431静置数据完成!");
|
MisDataFun.LogRecording_OP(opName, "INFO", "MIS", "MES保存OP431静置数据完成!");
|
||||||
MisDataFun.LogRecording_OP(opName, "INFO", "MIS", "MES工作完成!");
|
MisDataFun.LogRecording_OP(opName, "INFO", "MIS", "MES工作完成!");
|
||||||
@@ -97,10 +110,12 @@ namespace MesServerFunctions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// OP431 保存失败时统一复位保存完成、置 MES 报警并通知页面。
|
||||||
|
/// </summary>
|
||||||
private void WriteManualStaticMesReadError(string opName, string message)
|
private void WriteManualStaticMesReadError(string opName, string message)
|
||||||
{
|
{
|
||||||
MIS_BASE.Write_MesReadOver(opName, false);
|
MisDataBaseFun.WriteMesReadOver(opName, false);
|
||||||
MIS_BASE.Write_MesWorkFinish(opName, false);
|
|
||||||
MIS_BASE.Write_TagValueByTagTypeID(34, opName, true);
|
MIS_BASE.Write_TagValueByTagTypeID(34, opName, true);
|
||||||
SendMessage.AsyncSendMessage_Notice(opName, "【" + opName + "】" + message);
|
SendMessage.AsyncSendMessage_Notice(opName, "【" + opName + "】" + message);
|
||||||
MisDataFun.LogRecording_OP(opName, "ERROR", "MesRead", message);
|
MisDataFun.LogRecording_OP(opName, "ERROR", "MesRead", message);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ namespace MesServerFunctions
|
|||||||
|
|
||||||
if (tagValue == 1)
|
if (tagValue == 1)
|
||||||
{
|
{
|
||||||
|
// OP431 不申请新 SFC,只通知 PAD 可以扫描已有产品。
|
||||||
MisDataFun.LogRecording_OP(opName, "INFO", "MIS", "PLC申请上线,等待PAD扫描已有产品!");
|
MisDataFun.LogRecording_OP(opName, "INFO", "MIS", "PLC申请上线,等待PAD扫描已有产品!");
|
||||||
MIS_BASE.Write_TagValueByTagTypeID(34, opName, false);
|
MIS_BASE.Write_TagValueByTagTypeID(34, opName, false);
|
||||||
SendMessage.AsyncSendMessage_Notice(opName, "【" + opName + "】PLC已申请上线,请PAD扫描产品码");
|
SendMessage.AsyncSendMessage_Notice(opName, "【" + opName + "】PLC已申请上线,请PAD扫描产品码");
|
||||||
@@ -28,6 +29,7 @@ namespace MesServerFunctions
|
|||||||
}
|
}
|
||||||
|
|
||||||
MisDataFun.LogRecording_OP(opName, "INFO", "MIS", "PLC申请上线取消!");
|
MisDataFun.LogRecording_OP(opName, "INFO", "MIS", "PLC申请上线取消!");
|
||||||
|
// 取消申请时清掉本轮未完成的 MES 输出信号。
|
||||||
MIS_BASE.Write_EngineTypeGetOver_MES(opName, false);
|
MIS_BASE.Write_EngineTypeGetOver_MES(opName, false);
|
||||||
MIS_BASE.Write_FixAllow(opName, false);
|
MIS_BASE.Write_FixAllow(opName, false);
|
||||||
MIS_BASE.Write_TagValueByTagTypeID(34, opName, false);
|
MIS_BASE.Write_TagValueByTagTypeID(34, opName, false);
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ namespace MesServerFunctions
|
|||||||
|
|
||||||
bool success = QueryManualStaticOutProduct(opName, engineID, minStaticMinutes, out string message);
|
bool success = QueryManualStaticOutProduct(opName, engineID, minStaticMinutes, out string message);
|
||||||
SendManualStaticOutResult(opName, "PadScanQuery", success, message);
|
SendManualStaticOutResult(opName, "PadScanQuery", success, message);
|
||||||
MisDataFun.LogRecording_OP(opName, success ? "INFO" : "WARNING", "PadScanQuery", message);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// PAD 确认上线:重新校验托盘到位、PLC申请上线和前端配置的最小静置时间,通过后写 PLC 产品区。
|
// PAD 确认上线:重新校验托盘到位、PLC申请上线和前端配置的最小静置时间,通过后写 PLC 产品区。
|
||||||
@@ -77,6 +76,9 @@ namespace MesServerFunctions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 解析 PAD 命令参数,取得产品码和最小静置分钟数。
|
||||||
|
/// </summary>
|
||||||
private bool TryGetManualStaticPadRequest(string opName, string command, string value, out string engineID, out decimal minStaticMinutes)
|
private bool TryGetManualStaticPadRequest(string opName, string command, string value, out string engineID, out decimal minStaticMinutes)
|
||||||
{
|
{
|
||||||
engineID = "";
|
engineID = "";
|
||||||
@@ -100,6 +102,7 @@ namespace MesServerFunctions
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 参数最多允许“产品码^最小静置分钟数”两段。
|
||||||
string[] requestItems = requestValue.Split('^');
|
string[] requestItems = requestValue.Split('^');
|
||||||
if (requestItems.Length > 2)
|
if (requestItems.Length > 2)
|
||||||
{
|
{
|
||||||
@@ -120,6 +123,7 @@ namespace MesServerFunctions
|
|||||||
|
|
||||||
if (requestItems.Length == 2)
|
if (requestItems.Length == 2)
|
||||||
{
|
{
|
||||||
|
// 最小静置分钟数由 PAD 配置传入,未传时使用默认 30 分钟。
|
||||||
string minStaticMinutesText = requestItems[1].Trim();
|
string minStaticMinutesText = requestItems[1].Trim();
|
||||||
if (!decimal.TryParse(minStaticMinutesText, out minStaticMinutes) || minStaticMinutes < 0)
|
if (!decimal.TryParse(minStaticMinutesText, out minStaticMinutes) || minStaticMinutes < 0)
|
||||||
{
|
{
|
||||||
@@ -171,6 +175,9 @@ namespace MesServerFunctions
|
|||||||
InitAlarm(opName);
|
InitAlarm(opName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重新发送当前工位报警状态。
|
||||||
|
/// </summary>
|
||||||
private void InitAlarm(string opName)
|
private void InitAlarm(string opName)
|
||||||
{
|
{
|
||||||
FuntionMesRead.Alarm_InitAlarm_Send(opName, out Hashtable ht);
|
FuntionMesRead.Alarm_InitAlarm_Send(opName, out Hashtable ht);
|
||||||
|
|||||||
Reference in New Issue
Block a user