190 lines
8.1 KiB
C#
190 lines
8.1 KiB
C#
using System;
|
||
using System.Data;
|
||
using bizFacade;
|
||
using MesServerWork;
|
||
|
||
namespace MesServerFunctions
|
||
{
|
||
partial class Functions_BASE_02
|
||
{
|
||
/// <summary>
|
||
/// 正常逻辑工作(传递机型)
|
||
/// </summary>
|
||
/// <param name="OpName"></param>
|
||
/// <param name="EngineTypeID"></param>
|
||
/// <param name="EngineType"></param>
|
||
/// <param name="EngineID"></param>
|
||
/// <param name="PartPallet_Code"></param>
|
||
private void EngineTypeGetOver_PLC_Work(string OpName, int EngineTypeID, string EngineType, string EngineID, int PartPallet_Code,string OrderForm)
|
||
{
|
||
int IsClear;
|
||
int IsAllowWork;
|
||
int RepairPartStatusPLC = 0;
|
||
int MES_QualityMask = 1;
|
||
bool isFixAllow = false;
|
||
//string OrderForm = "";//订单号
|
||
DataTable dt;
|
||
|
||
if (EngineTypeID<=0)
|
||
{
|
||
AsyncSendMessage_Notice(OpName, "PLC传递机型为空");
|
||
MIS_BASE.Write_FixAllow(OpName, true);
|
||
return;
|
||
}
|
||
|
||
//第一步,查询订单号,保存机型、机型代码、总成号、托盘号、订单号到数据库
|
||
BaseDataSystemMES.GetEngineID_Select(OpName, EngineID, out dt);
|
||
//if (dt != null && dt.Rows.Count > 0)
|
||
//{
|
||
// OrderForm = Convert.ToString(dt.Rows[0]["订单号"]);
|
||
//}
|
||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, OrderForm, EngineTypeID, EngineType, EngineID, PartPallet_Code, 0, 0, "");
|
||
//SaveMobyMessage(OpName, EngineTypeID, EngineType, EngineID, OrderForm);
|
||
|
||
//第二步,将零件信息转移到零件_临时表中(本地BOM与订单BOM的选择显示关系)
|
||
// 获取该工位该订单的物料是否有已经扫描的,有的话就不更新临时表
|
||
BaseDataSystemMES.MesServer_Judge_IsClearOld(OpName, OrderForm, out IsClear);
|
||
//查看是否有允许工作
|
||
MIS_BASE.Read_FixAllow(OpName, out isFixAllow);
|
||
if (IsClear == 1 && isFixAllow == false)
|
||
{
|
||
//第二步,将零件信息转移到零件_临时表中(本地BOM与订单BOM的选择显示关系)
|
||
BaseDataSystemMES.MesServer_Process_EngineTypeOver(OpName);
|
||
}
|
||
|
||
//通知web显示
|
||
Sendmessage("5123", "1111", OpName);
|
||
MIS_BASE.Read_PalletInfo(OpName, out MES_QualityMask);//合格标志
|
||
MIS_BASE.Read_RepairStatus_PLC(OpName, out RepairPartStatusPLC);//返修标志
|
||
SendInfomation("QualityMask", Convert.ToString(MES_QualityMask), OpName);//显示合格标志
|
||
SendInfomation("RepairPartStatusPLC", Convert.ToString(RepairPartStatusPLC), OpName);//显示返修标志
|
||
|
||
//if (MES_QualityMask == 2)
|
||
//{
|
||
// //工作完成
|
||
// MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||
// SendInfomation("NgGO", "1", OpName);//显示不合格标志
|
||
// return;
|
||
//}
|
||
|
||
|
||
//第三步,用于工件离开后完工数量统计及工件编号追溯
|
||
BaseDataSystemMES.MaterialPush_EngineIDStatus_Insert(OpName);//更新订单产量
|
||
|
||
//如果是20工位判断是否已经输入壳体码 输入后才能进行接下来操作
|
||
if(OpName == "OP0020")
|
||
{
|
||
string EngineID_MES;
|
||
MIS_BASE.Read_EngineID_MES(OpName, out EngineID_MES);
|
||
if (EngineID_MES == null || EngineID_MES == "")
|
||
{
|
||
AsyncSendMessage_Notice(OpName, "请先输入壳体码再进行操作");
|
||
return;
|
||
}
|
||
}
|
||
|
||
//第四步,获取是否允许工作
|
||
BaseDataSystemMES.MesServer_Judge_IsCanWork(OpName, out IsAllowWork);
|
||
|
||
//判断扫码这里1050 与 2040 需要额外判断前面分线工位是否扫码,都扫码后才能允许工作 反之不允许工作
|
||
//给相关工位弹出弹窗提示,提示该去扫码才能进行放行操作
|
||
if (IsAllowWork == 1 && OpName == "OP1050")
|
||
{
|
||
BaseDataSystemMES.MesServer_Judge_IsCanWorkLineOut("OP1020", OrderForm, EngineType, out IsAllowWork);
|
||
if (IsAllowWork == 1)
|
||
{
|
||
BaseDataSystemMES.MesServer_Judge_IsCanWorkLineOut("OP1030", OrderForm, EngineType, out IsAllowWork);
|
||
if (IsAllowWork != 1)
|
||
{
|
||
MIS_BASE.WritePLC(70, OpName, 1);
|
||
AsyncSendMessage_Notice(OpName, OrderForm + "工件A30工位物料未扫描完毕,请扫描完毕后在进行工作!");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
MIS_BASE.WritePLC(70, OpName, 1);
|
||
AsyncSendMessage_Notice(OpName, OrderForm + "工件A20工位物料未扫描完毕,请扫描完毕后在进行工作!");
|
||
}
|
||
}
|
||
if (IsAllowWork == 1 && OpName == "OP2040")
|
||
{
|
||
BaseDataSystemMES.MesServer_Judge_IsCanWorkLineOut("OP2020", OrderForm, EngineType, out IsAllowWork);
|
||
if (IsAllowWork != 1)
|
||
{
|
||
MIS_BASE.WritePLC(70, OpName, 1);
|
||
AsyncSendMessage_Notice(OpName, OrderForm + "工件B20工位物料未扫描完毕,请扫描完毕后在进行工作!");
|
||
}
|
||
}
|
||
|
||
//暂时先定义为扫描完成才能进行压装工作,因为考虑到工作完成后,操作工未必会去扫描物料的情况
|
||
if (IsAllowWork == 1)
|
||
{
|
||
//通知PLC允许工作,允许工作在保存完成时清空
|
||
MIS_BASE.WritePLC(70, OpName, 0);
|
||
MIS_BASE.Write_FixAllow(OpName, true);
|
||
}
|
||
else
|
||
{
|
||
//AsyncSendMessage_Notice(OpName, "请扫描物料!");
|
||
}
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// 保存MOBY信息
|
||
/// </summary>
|
||
/// <param name="OpName"></param>
|
||
/// <param name="engineTypeID"></param>
|
||
/// <param name="engineType"></param>
|
||
/// <param name="engineID"></param>
|
||
private void SaveMobyMessage(string OpName, int engineTypeID, string engineType, string engineID, string orderForm)
|
||
{
|
||
if (MIS_BASE.hashtable_EngineGetOver_EngineTypeID == null)
|
||
{
|
||
MIS_BASE.InitHashtable_MesServerCode();
|
||
}
|
||
if (MIS_BASE.hashtable_EngineGetOver_EngineTypeID.ContainsKey(OpName))
|
||
{
|
||
MIS_BASE.hashtable_EngineGetOver_EngineTypeID[OpName] = engineTypeID;
|
||
}
|
||
if (MIS_BASE.hashtable_EngineGetOver_EngineType.ContainsKey(OpName))
|
||
{
|
||
MIS_BASE.hashtable_EngineGetOver_EngineType[OpName] = engineType;
|
||
}
|
||
if (MIS_BASE.hashtable_EngineGetOver_EngineID.ContainsKey(OpName))
|
||
{
|
||
MIS_BASE.hashtable_EngineGetOver_EngineID[OpName] = engineID;
|
||
}
|
||
if (MIS_BASE.hashtable_EngineGetOver_OrderForm.ContainsKey(OpName))
|
||
{
|
||
MIS_BASE.hashtable_EngineGetOver_OrderForm[OpName] = orderForm;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 返修件需要工作
|
||
/// </summary>
|
||
/// <param name="OpName">工位号</param>
|
||
private void IsNeedRepaire_OK(string OpName)
|
||
{
|
||
string orderForm = "";
|
||
int engineTypeID;
|
||
string engineType = "";
|
||
string engineID = "";
|
||
string palletCode = "";
|
||
int isRepair;
|
||
string repairCode = "";
|
||
//从监控系统中查询出本工位信息
|
||
BaseDataSystemMES.OpName_MIS_Moby_Select(OpName,
|
||
out orderForm, out engineTypeID, out engineType,
|
||
out engineID, out palletCode, out isRepair, out repairCode);
|
||
|
||
EngineTypeGetOver_PLC_Work(OpName, engineTypeID, engineType, engineID, Convert.ToInt32(palletCode),orderForm);
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|
||
}
|