91 lines
3.6 KiB
C#
91 lines
3.6 KiB
C#
using System;
|
|
using System.Data;
|
|
using bizFacade;
|
|
//using SystemFramework;
|
|
using MesServerWork;
|
|
|
|
namespace MesServerFunctions
|
|
{
|
|
partial class Functions_BASE_26
|
|
{
|
|
/// <summary>
|
|
/// PLC传递机型处理
|
|
/// </summary>
|
|
/// <param name="OpName"></param>
|
|
/// <param name="tagValue"></param>
|
|
private void EngineTypeGetOver_PLC(object e)
|
|
{
|
|
try
|
|
{
|
|
object locker = new object();
|
|
lock (locker)
|
|
{
|
|
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
|
string OpName = Convert.ToString(msgEvent.OpName);
|
|
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
|
EngineTypeGetOverPLC(OpName, tagValue.ToString());
|
|
//if (tagValue == 1)
|
|
//{
|
|
// int EngineTypeID;//机型代码
|
|
// int PartPallet_Code;//托盘编号
|
|
// string EngineType;//机型
|
|
// string EngineID;//工件编号
|
|
|
|
// MIS_BASE.GetEngineTypeFromPLC(OpName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code);
|
|
// EngineTypeGetOver_PLC_Work(OpName, EngineTypeID, EngineType, EngineID, PartPallet_Code);
|
|
//}
|
|
}
|
|
}
|
|
catch (Exception err)
|
|
{
|
|
////ApplicationLog.WriteLog(err, "Function03:EngineTypeGetOver_PLC");
|
|
}
|
|
}
|
|
|
|
public static void EngineTypeGetOverPLC(string opName, string tagValue)
|
|
{
|
|
switch (tagValue)
|
|
{
|
|
case "0":
|
|
MIS_BASE.Write_EngineTypeGetOver_MES(opName, false);
|
|
MIS_BASE.Write_MaterialVerifyOver(opName, false);
|
|
break;
|
|
case "1":
|
|
//string opName;
|
|
string orderForm = "";
|
|
int PartPalletCode;
|
|
string engineType;
|
|
int engineTypeID;
|
|
string engineID;
|
|
string barCodeType = "1";
|
|
|
|
// BaseDataSystemMES.MesServer_Process_EngineTypeOver(OpName);
|
|
|
|
////将产品信息从PLC读取
|
|
MIS_BASE.Read_EngineTypeID(opName, out engineTypeID);
|
|
MIS_BASE.Read_EngineType(opName, out engineType);
|
|
MIS_BASE.Read_EngineID(opName, out engineID);
|
|
MIS_BASE.Read_PalletCode(opName, out PartPalletCode);
|
|
string kuweiNum = DtWebApi.ReadWritePLC.ReadPLC("112", opName).ToString();
|
|
BaseDataSystemMES.GetUpLoadEngineIDOrderForm(opName, kuweiNum, out DataTable dt);
|
|
if (dt.Rows.Count > 0)
|
|
{
|
|
orderForm = dt.Rows[0]["订单号"].ToString();
|
|
}
|
|
|
|
|
|
BaseDataSystemMES.OpName_MIS_MOBY_Insert(opName, orderForm, engineTypeID, engineType, engineID, PartPalletCode, 0, 0, "");
|
|
|
|
BaseDataSystemMES.GetEngineID_Save_Outline(opName, orderForm, PartPalletCode.ToString(), engineType, engineTypeID, engineID, barCodeType);
|
|
// MES保存数据 减掉盆子库存 // 写占用盆子 更新数据库是否占用 = 0
|
|
BaseDataSystemMES.GetUpLoadBarCode_0utUpdate(opName, kuweiNum);
|
|
|
|
// MES允许工作
|
|
MIS_BASE.Write_FixAllow(opName, true);
|
|
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|