init: 导入项目到 meswork Gitea

This commit is contained in:
XingCheng3
2026-05-29 10:07:05 +08:00
commit ad9a4106fb
3582 changed files with 460312 additions and 0 deletions

View File

@@ -0,0 +1,158 @@
using System;
using bizFacade;
//using SystemFramework;
using MesServerWork;
namespace MesServerFunctions
{
partial class Functions_BASE_51
{
///第一步,判断条码类型,根据条码类型,执行对应的存储过程
///第二步,条码类型(将扫描的条码保存到对应的表中)
///第三步,扫描完成之后给出允许工作信号
/// 处理页面扫描条码
/// </summary>
/// <param name="OpName"></param>
/// <param name="barcode"></param>
public void Barcode(object e)
{
try
{
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
string OpName = Convert.ToString(msgEvent.OpName);
string barcode = Convert.ToString(msgEvent.TagValue);
int EngineTypeID;//机型代码
string EngineType;//机型
string EngineID;//工件编号
string OrderForm;
int Recipe1;
int Recipe2;
bool IsNotRepeatedNumber = false;
//1:获得申请上线信息后,扫描条码才处理业务
bool ispartload;
MIS_BASE.Read_WorkStart(OpName, out ispartload);
if(!ispartload)
{
AsyncSendMessage_Notice(OpName, "请检查设备是否到位DBX500.1=1");
return;
}
//判读条码是变速器序列号条码号还是物料号
//变速器序列号 '1333 050 062 0001*16012023*30000001'
if(barcode.Split('*').Length>2)
{
//2: 判断是否重号, 从数据库获得机型、机型代码等信息
string partSn = barcode;
EngineID = barcode;
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, "变速器序列号_MES", EngineID);
//Db.GetEngineType( partSn, out EngineTypeID, out EngineType, out EngineID, out IsRepeatedNumber);
//Db.GetEngineType( partSn, out EngineTypeID, out EngineType, out EngineID, out IsRepeatedNumber);
//IsRepeatedNumber true 不重号false 重号;
IsNotRepeatedNumber = BaseDataSystemMES.EngineTypeID_IsNotRepeatedNumber(partSn);
if (IsNotRepeatedNumber)
{
BaseDataSystemMES.GetEngineTypeUpLoadOpName(OpName, out EngineTypeID, out EngineType, out OrderForm, out Recipe1, out Recipe2);
////将产品信息写入PLC
MIS_BASE.Write_EngineTypeID_MES(OpName, EngineTypeID);
MIS_BASE.Write_EngineType_MES(OpName, EngineType);
MIS_BASE.Write_EngineID_MES(OpName, EngineID);
MIS_BASE.Write_OrderForm_MES(OpName, OrderForm);
// 工位号],[订单号],[产品型号代码],[变速器序列号],[发动机型号],[机型基本代码],[变速器总成号] ,[托盘号]
// [产品型号代码_MES],[变速器序列号_MES],[发动机型号_MES]
// [机床上电],[循环开始],[机床故障],[上料无件],[下料堵塞],[工件到位]
// [传递机型],[申请上件],[允许保存],[保存完成],[合格标志],[前序合格]
// [工号],[班次],[是否返修件],[合格放行],[不合格放行],[扫描条码]
//BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, "产品型号代码_MES", EngineTypeID.ToString());
//BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, "发动机型号_MES", EngineType);
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, true);
//等待PLC将数据写入RFID写入PLC的DB块通知MES验证RFID机型数据是否正确传递
}
else
{
AsyncSendMessage_Notice(OpName, "变速器序列号 重号,请确认!");
}
}
else//物料号
{
//读取PLC的传递机型信号
bool tagValue;
MIS_BASE.Read_EngineGetOver_PLC(OpName, out tagValue);
if (tagValue)
{
//验证物料
BaseDataSystemMES.PartMaterial_DM_Update(OpName, barcode, out bool IsSuccess);
if (!IsSuccess)
{
AsyncSendMessage_Notice(OpName, "条码无效,请确认");
return;
}
else
{
SendInfomation("MaterialList", "1", OpName);//通知界面更新零件信息
}
//获取是否允许工作
BaseDataSystemMES.MesServer_Judge_IsCanWork(OpName, out int IsAllowWork);
if (IsSuccess)
{
if (IsAllowWork == 1)
{
BaseDataSystemMES.Material_Insert(OpName, 1);
//更新订单完工数量及物料
Sendmessage("24", "11", OpName);
//通知PLC允许工作,允许工作在保存完成时清空
MIS_BASE.Write_FixAllow(OpName, true);
}
else
{
AsyncSendMessage_Notice(OpName, "请扫描物料!");
}
}
else
{
AsyncSendMessage_Notice(OpName, "PLC未传递机型");
}
}
else
{
SendMessage.AsyncSendMessage_Notice(OpName, "产品上线后,再验证物料!");
}
}
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "Function08:Barcode");
}
}
}
}