Files
01-Siyuan-MesProject/MisDataFunction/MesServer.Function/Function10/OpcServer/Barcode.cs
2026-05-29 10:07:05 +08:00

99 lines
3.6 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using MesServerWork;
using bizFacade;
//using SystemFramework;
namespace MesServerFunctions
{
partial class Functions_BASE_10
{
/// <summary>
///1、物料验证
///2、MES生成总成编号
///3、MES传递机型
/// 处理页面扫描条码
/// </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 repairStatus=1;
repairStatus=RepairWorkStation.StationStatusSearch(OpName);
//repairStatus0返修 1正常 20170630
if (repairStatus != 1)
{
Barcode_Repair(OpName, barcode);
return;
}
bool ispartload = false;
bool IsSuccess = false;
int IsAllowWork;
int engineTypeID;
string engineID;
string engineType;
MIS_BASE.Read_PartLoad(OpName, out ispartload);
if (!ispartload)
{
AsyncSendMessage_Notice(OpName,"PLC未申请上线,请确认");
return;
}
BaseDataSystemMES.PartMaterial_DM_Update(OpName, barcode, out IsSuccess);
if (!IsSuccess)
{
AsyncSendMessage_Notice(OpName,"条码无效,请确认");
return;
}
Sendmessage("2", "1", OpName);//通知WEB前端更新零件信息
BaseDataSystemMES.MesServer_Judge_IsCanWork(OpName, out IsAllowWork);
//扫描完成线首工位需要创建发动机号
if (IsAllowWork == 1)
{
CreateEngineID(OpName, out engineType,out engineTypeID, out engineID);
if (engineType == "-1" || engineType == "" || engineTypeID == -1 || engineID == "")
{
AsyncSendMessage_Notice(OpName,"未选择订单或机型,请选择后重新到位");
return;
}
else
{
//将产品信息写入PLC
MIS_BASE.Write_EngineTypeID_MES(OpName, engineTypeID);
MIS_BASE.Write_EngineType_MES(OpName, engineType);
MIS_BASE.Write_EngineID_MES(OpName, engineID);
//获取订单号,发动机型号,发动机型号代码(在线首工位将选择的订单,机型等信息保存到监控表中)
bizFacade.BaseDataSystemMES.OpName_MIS_CreateMoby_Select(OpName, out string orderForm, out engineTypeID, out engineType, out engineID, out string palletCode, out int isRepair, out string repairCode);
MIS_BASE.Write_OrderForm_MES(OpName, orderForm);
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, true);
}
SendInfomation("ShowMobyMES", engineID + "&" + engineType, OpName);
}
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "Function10:Barcode");
}
}
}
}