95 lines
3.0 KiB
C#
95 lines
3.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using MesServerWork;
|
|
using bizFacade;
|
|
using System.Data;
|
|
using SystemFramework;
|
|
using System.Data.SqlClient;
|
|
|
|
namespace MesServerFunctions
|
|
{
|
|
partial class Functions_BASE_01
|
|
{
|
|
/// <summary>
|
|
///1、物料验证
|
|
///2、MES生成总成编号
|
|
///3、MES传递机型
|
|
/// 处理页面扫描条码
|
|
/// </summary>
|
|
/// <param name="OpName"></param>
|
|
/// <param name="barcode"></param>
|
|
public void Barcode(object e)
|
|
{
|
|
try
|
|
{
|
|
OpcData.CustomeEvetnArgs msgEvent = (OpcData.CustomeEvetnArgs)e;
|
|
string OpName = Convert.ToString(msgEvent.OpName);
|
|
string barcode = Convert.ToString(msgEvent.TagValue);
|
|
|
|
bool ispartload = false;
|
|
int IsSuccess = 0;
|
|
int IsAllowWork;
|
|
int engineTypeID;
|
|
|
|
string engineID;
|
|
string engineType;
|
|
|
|
|
|
|
|
|
|
BaseDataSystemMES.PartMaterial_DM_Update(OpName, barcode, out IsSuccess);
|
|
|
|
MIS_BASE.Read_PartLoad(OpName, out ispartload);
|
|
if (!ispartload && IsSuccess==1)
|
|
{
|
|
AsyncSendMessage_Notice(OpName,"PLC未申请上线,请确认");
|
|
return;
|
|
}
|
|
|
|
|
|
|
|
if (IsSuccess == 0)
|
|
{
|
|
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);
|
|
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, true);
|
|
}
|
|
|
|
SendInfomation("ShowMobyMES", engineID + "&" + engineType, OpName);
|
|
}
|
|
|
|
}
|
|
catch (Exception err)
|
|
{
|
|
ApplicationLog.WriteLog(err, "Function01:Barcode");
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|