update:更新B位静置库
This commit is contained in:
@@ -211,5 +211,26 @@ namespace MisDataFunDll
|
|||||||
MisDataFun.LogRecording_OP(OpName, "WARNING", "MOM", msg);
|
MisDataFun.LogRecording_OP(OpName, "WARNING", "MOM", msg);
|
||||||
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//通知PLC,MES工作完成
|
||||||
|
MIS_BASE.Write_MesWorkFinish(OpName, isOver);
|
||||||
|
//通知PLC,MES保存完成
|
||||||
|
MIS_BASE.Write_MesReadOver(OpName, isOver);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -542,12 +542,19 @@ namespace MisDataFunDll
|
|||||||
{
|
{
|
||||||
// 机型代码 对应客户标签字段映射
|
// 机型代码 对应客户标签字段映射
|
||||||
string targetField;
|
string targetField;
|
||||||
switch (EngineTypeID)
|
if (OpName.StartsWith("OP450"))
|
||||||
{
|
{
|
||||||
case 1: case 5: targetField = "TEXT9"; break;
|
targetField = "TEXT1";
|
||||||
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: case 6: case 7: targetField = "TEXT14"; break;
|
||||||
|
case 4: targetField = "TEXT16"; break;
|
||||||
|
default: targetField = ""; break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(targetField))
|
if (!string.IsNullOrEmpty(targetField))
|
||||||
|
|||||||
@@ -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,11 @@ 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 = "B4";
|
||||||
|
if (EngineTypeID == 6) dataCollectForResourceInspect.dcSequence = "B5";
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ParametricData> parametricDataArray = new List<ParametricData>();
|
List<ParametricData> parametricDataArray = new List<ParametricData>();
|
||||||
|
|||||||
@@ -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,10 @@ namespace MisDataSaveDate
|
|||||||
/// 产品型号代码
|
/// 产品型号代码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int EngineTypeID { get; set; }
|
public int EngineTypeID { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 工位号
|
||||||
|
/// </summary>
|
||||||
|
public string OpName { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GetClientTagValueRes
|
public class GetClientTagValueRes
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using MesDataFunction;
|
||||||
using MesServerWork;
|
using MesServerWork;
|
||||||
using MisDataFunDll;
|
using MisDataFunDll;
|
||||||
using MisDataSaveDate;
|
using MisDataSaveDate;
|
||||||
@@ -84,18 +85,15 @@ namespace MesServerFunctions
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//通知PLC,MES工作完成
|
// 保存完成工作完成
|
||||||
MIS_BASE.Write_MesWorkFinish(OpName, true);
|
MisDataBaseFun.WriteMesReadOver(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_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,16 @@ namespace MesServerFunctions
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//通知PLC,MES工作完成
|
// 保存完成工作完成
|
||||||
MIS_BASE.Write_MesWorkFinish(OpName, true);
|
MisDataBaseFun.WriteMesReadOver(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_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允许保存数据取消!");
|
||||||
|
|||||||
@@ -81,6 +81,7 @@
|
|||||||
<Compile Include="OpcServer\FixOver.cs" />
|
<Compile Include="OpcServer\FixOver.cs" />
|
||||||
<Compile Include="OpcServer\MesSaveNowData.cs" />
|
<Compile Include="OpcServer\MesSaveNowData.cs" />
|
||||||
<Compile Include="OpcServer\HeartBeat.cs" />
|
<Compile Include="OpcServer\HeartBeat.cs" />
|
||||||
|
<Compile Include="OpcServer\ManualStaticBSave.cs" />
|
||||||
<Compile Include="OpcServer\MesRead.cs" />
|
<Compile Include="OpcServer\MesRead.cs" />
|
||||||
<Compile Include="OpcServer\MesReadOver.cs" />
|
<Compile Include="OpcServer\MesReadOver.cs" />
|
||||||
<Compile Include="OpcServer\PartLoad.cs" />
|
<Compile Include="OpcServer\PartLoad.cs" />
|
||||||
@@ -116,4 +117,4 @@
|
|||||||
<Target Name="AfterBuild">
|
<Target Name="AfterBuild">
|
||||||
</Target>
|
</Target>
|
||||||
-->
|
-->
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -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);
|
||||||
@@ -251,6 +258,16 @@ namespace MesServerFunctions
|
|||||||
ThreadPool.QueueUserWorkItem(MesSaveNowData, e);
|
ThreadPool.QueueUserWorkItem(MesSaveNowData, 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>
|
||||||
|
|||||||
114
MisDataFunction/Function1055/OpcServer/ManualStaticBSave.cs
Normal file
114
MisDataFunction/Function1055/OpcServer/ManualStaticBSave.cs
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
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)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||||
|
string opName = Convert.ToString(msgEvent.OpName);
|
||||||
|
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||||
|
|
||||||
|
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 (!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("OP420", err.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存 OP420 静置B位开始记录,同一产品只保留最新一条。
|
||||||
|
/// </summary>
|
||||||
|
private 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>
|
||||||
|
/// 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using MesDataFunction;
|
||||||
//using SystemFramework;
|
//using SystemFramework;
|
||||||
using MesServerWork;
|
using MesServerWork;
|
||||||
using MisDataFunDll;
|
using MisDataFunDll;
|
||||||
@@ -99,8 +100,7 @@ namespace MesServerFunctions
|
|||||||
}
|
}
|
||||||
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允许保存数据取消!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,17 +111,14 @@ namespace MesServerFunctions
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//通知PLC,MES保存完成
|
// 保存完成工作完成
|
||||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
MisDataBaseFun.WriteMesReadOver(OpName, true);
|
||||||
//通知PLC,MES工作完成
|
|
||||||
MIS_BASE.Write_MesWorkFinish(OpName, true);
|
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "MES保存数据完成!");
|
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "MES保存数据完成!");
|
||||||
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允许保存数据取消!");
|
||||||
@@ -133,4 +130,4 @@ namespace MesServerFunctions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using MesServerWork;
|
using MesServerWork;
|
||||||
|
using MesDataFunction;
|
||||||
using MisDataFunDll;
|
using MisDataFunDll;
|
||||||
using MisDataSaveDate;
|
using MisDataSaveDate;
|
||||||
using System;
|
using System;
|
||||||
@@ -127,9 +128,8 @@ namespace MesServerFunctions
|
|||||||
// 都出站成功了 才给PLC信号
|
// 都出站成功了 才给PLC信号
|
||||||
if (part1_IsOk && part2_IsOk)
|
if (part1_IsOk && part2_IsOk)
|
||||||
{
|
{
|
||||||
// 4.通知PLC,MES保存完成 MES工作完成
|
// 保存完成工作完成
|
||||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
MisDataBaseFun.WriteMesReadOver(OpName, true);
|
||||||
MIS_BASE.Write_MesWorkFinish(OpName, true);
|
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "MES保存数据完成!");
|
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "MES保存数据完成!");
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "MES工作完成!");
|
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "MES工作完成!");
|
||||||
}
|
}
|
||||||
@@ -137,8 +137,7 @@ namespace MesServerFunctions
|
|||||||
}
|
}
|
||||||
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允许保存数据取消!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
//using SystemFramework;
|
//using SystemFramework;
|
||||||
|
using MesDataFunction;
|
||||||
using MesServerWork;
|
using MesServerWork;
|
||||||
using MisDataFunDll;
|
using MisDataFunDll;
|
||||||
|
|
||||||
@@ -65,10 +66,8 @@ namespace MesServerFunctions
|
|||||||
}
|
}
|
||||||
// 写入加工合格还是不合格 根据工位合格标志写
|
// 写入加工合格还是不合格 根据工位合格标志写
|
||||||
MIS_BASE.Write_OpNameIsOk(OpName, qualityMask);
|
MIS_BASE.Write_OpNameIsOk(OpName, qualityMask);
|
||||||
//通知PLC,MES保存完成
|
// 保存完成工作完成
|
||||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
MisDataBaseFun.WriteMesReadOver(OpName, true);
|
||||||
//通知PLC,MES工作完成
|
|
||||||
MIS_BASE.Write_MesWorkFinish(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工作完成!");
|
||||||
}
|
}
|
||||||
@@ -76,8 +75,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", "MIS", "PLC允许保存数据取消!");
|
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "PLC允许保存数据取消!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
//using SystemFramework;
|
//using SystemFramework;
|
||||||
|
using MesDataFunction;
|
||||||
using MesServerWork;
|
using MesServerWork;
|
||||||
using MisDataFunDll;
|
using MisDataFunDll;
|
||||||
using MisDataSaveDate;
|
using MisDataSaveDate;
|
||||||
@@ -99,10 +100,8 @@ namespace MesServerFunctions
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//通知PLC,MES保存完成
|
// 保存完成工作完成
|
||||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
MisDataBaseFun.WriteMesReadOver(OpName, true);
|
||||||
//通知PLC,MES工作完成
|
|
||||||
MIS_BASE.Write_MesWorkFinish(OpName, true);
|
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "MES保存数据完成!");
|
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "MES保存数据完成!");
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "MES工作完成!");
|
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "MES工作完成!");
|
||||||
}
|
}
|
||||||
@@ -120,8 +119,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允许保存数据取消!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using MesDataFunction;
|
||||||
using MesServerWork;
|
using MesServerWork;
|
||||||
using MisDataFunDll;
|
using MisDataFunDll;
|
||||||
using MisDataSaveDate;
|
using MisDataSaveDate;
|
||||||
@@ -81,18 +82,15 @@ namespace MesServerFunctions
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//通知PLC,MES工作完成
|
// 保存完成工作完成
|
||||||
MIS_BASE.Write_MesWorkFinish(OpName, true);
|
MisDataBaseFun.WriteMesReadOver(OpName, true);
|
||||||
//通知PLC,MES保存完成
|
|
||||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
|
||||||
|
|
||||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "MES保存数据完成!");
|
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "MES保存数据完成!");
|
||||||
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允许保存数据取消!");
|
||||||
|
|||||||
BIN
MisDataFunction/Function1062.zip
Normal file
BIN
MisDataFunction/Function1062.zip
Normal file
Binary file not shown.
@@ -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;
|
||||||
@@ -63,6 +75,9 @@ namespace MesServerFunctions
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <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 +86,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 +151,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 +165,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 +187,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 +200,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 +227,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 +264,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 +288,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 +332,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 +354,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 +379,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 +395,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 +414,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)
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 重新查询 MES 执行信息,避免直接使用 PLC 中不完整的订单/机型数据。
|
||||||
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