206 lines
8.1 KiB
C#
206 lines
8.1 KiB
C#
using System;
|
||
using System.Data;
|
||
using System.Security.Cryptography;
|
||
using bizFacade;
|
||
using DataLinkMesWork;
|
||
//using SystemFramework;
|
||
using MesServerWork;
|
||
|
||
namespace MesServerFunctions
|
||
{
|
||
partial class Functions_BASE_24
|
||
{
|
||
/// <summary>
|
||
/// 申请上线
|
||
/// </summary>
|
||
/// <param name="OpName"></param>
|
||
/// <param name="tagValue"></param>
|
||
private void PartLoad(object e)
|
||
{
|
||
try
|
||
{
|
||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||
string OpName = Convert.ToString(msgEvent.OpName);
|
||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||
|
||
int engineTypeID;
|
||
string engineID;
|
||
string orderForm;
|
||
string engineType="";
|
||
|
||
if (tagValue == 1)
|
||
{
|
||
// 判断上线工位过站数是否与大于等于下单数
|
||
// 若上线数大于等于订单数则写空托盘放行标志
|
||
DataTable dt2;
|
||
BaseDataSystemMES.GetStartGoCount(out dt2);
|
||
if(Convert.ToInt32(dt2.Rows[0]["未上线数"]) == 0)
|
||
{
|
||
MIS_BASE.Write_TagTypeID(4, OpName, true);
|
||
}
|
||
else
|
||
{
|
||
MIS_BASE.Write_TagTypeID(4, OpName, false);
|
||
}
|
||
|
||
|
||
//机器人取件到线体,物料验证
|
||
MIS_BASE.Read_EngineID(OpName, out engineID);
|
||
|
||
//******************测试时用
|
||
string sql;
|
||
string workType = "0";
|
||
string desType = "0";
|
||
DataTable dt;
|
||
BaseDataSystemMES.GetUpLoadPart(out dt);
|
||
if (dt.Rows.Count > 0)
|
||
{
|
||
engineID = dt.Rows[0]["壳体码"].ToString();
|
||
workType = dt.Rows[0]["接地方式"].ToString();
|
||
desType = dt.Rows[0]["加工方式"].ToString();
|
||
}
|
||
else
|
||
{
|
||
MIS_BASE.Write_TagTypeID(69, OpName, "0");
|
||
return;
|
||
}
|
||
//******************
|
||
|
||
// 取消界面选择订单功能,改为自动选择订单
|
||
string result = "2";
|
||
BaseDataSystemMES.MesServer_Process_OrderAdd_FirstOpName(OpName, engineID, out result);
|
||
if (result == "2")
|
||
{
|
||
MIS_BASE.Write_TagTypeID(69, OpName, "0");
|
||
return;
|
||
}
|
||
//创建线首物料验证表
|
||
BaseDataSystemMES.MesServer_Process_EngineTypeOver_FirstOpName(OpName);
|
||
//第二步,将零件信息转移到零件_临时表中(本地BOM与订单BOM的选择显示关系)
|
||
BaseDataSystemMES.MesServer_Process_EngineTypeOver(OpName,1);
|
||
//第三步直接验证物料
|
||
bool IsSuccess;
|
||
BaseDataSystemMES.PartMaterial_DM_Update(OpName, engineID, out IsSuccess);
|
||
Sendmessage("123", "111", OpName);//向前台发送显示操作指南、物料、图片的命令
|
||
|
||
// 1上线零件条码与订单验证
|
||
// 取消物料验证
|
||
// Barcode(OpName, engineID);
|
||
// if (Barcode( OpName, barcode))
|
||
{
|
||
// 不创建发动机号 仅仅获得机型engineType, 机型代码engineTypeID,订单号orderForm 思源
|
||
// 直接用机器人扫描到的物料码,唯一 当作发动机号 engineID
|
||
// DES壳体 2302180001,8S061803AA
|
||
CreateEngineID(OpName, engineID, out engineType, out engineTypeID, out orderForm);
|
||
//string[]str1 = engineID.Split(',');
|
||
//if(str1.Length > 1)
|
||
//{
|
||
// engineID = str1[1];
|
||
//}
|
||
//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_TagTypeID(116, OpName, orderForm);
|
||
MIS_BASE.Write_TagTypeID(77, OpName, workType);
|
||
MIS_BASE.Write_TagTypeID(88, OpName, desType);
|
||
MIS_BASE.Write_TagTypeID(69, OpName, "1");
|
||
// 传递机型(MES)
|
||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, true);
|
||
|
||
// 更新零件申请上线状态
|
||
BaseDataSystemMES.UpdateOrderStatus(orderForm);
|
||
|
||
}
|
||
SendInfomation("ShowMobyMES", engineID + "&" + engineType, OpName);
|
||
}
|
||
//else
|
||
//{
|
||
// MIS_BASE.Write_TagTypeID(25, OpName, false);
|
||
// AsyncSendMessage_Notice(OpName, "机器人扫描的二维码不合适");
|
||
//}
|
||
}
|
||
|
||
}
|
||
catch (Exception err)
|
||
{
|
||
////ApplicationLog.WriteLog(err, "Function03:PartLoad");
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
///1、物料验证
|
||
///2、MES生成总成编号
|
||
///3、MES传递机型
|
||
/// 处理页面扫描条码
|
||
/// </summary>
|
||
/// <param name="OpName"></param>
|
||
/// <param name="barcode"></param>
|
||
public bool Barcode(string OpName,string barcode)
|
||
{
|
||
try
|
||
{
|
||
//20161228 条码连续扫描拼接错误
|
||
//if (!BaseDataSystemMES.BarConfirm(barcode))
|
||
//{
|
||
// AsyncSendMessage_Notice(OpName, "条码号存在重复数据,请重新扫描!");
|
||
// return;
|
||
|
||
//}
|
||
//DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||
//string OpName = Convert.ToString(msgEvent.OpName);
|
||
//string barcode = Convert.ToString(msgEvent.TagValue);
|
||
|
||
bool ispartload = false;
|
||
bool IsSuccess = false;
|
||
int IsAllowWork;
|
||
|
||
BaseDataSystemMES.PartMaterial_DM_Update(OpName, barcode, out IsSuccess);
|
||
//MIS_BASE.Read_PartLoad(OpName, out ispartload);
|
||
|
||
|
||
|
||
|
||
if (!IsSuccess)
|
||
{
|
||
AsyncSendMessage_Notice(OpName, "条码无效,请确认");
|
||
return false;
|
||
}
|
||
|
||
Sendmessage("2", "1", OpName);//通知WEB前端更新零件信息
|
||
|
||
BaseDataSystemMES.MesServer_Judge_IsCanWork(OpName, out IsAllowWork);
|
||
if (IsAllowWork == 1)
|
||
{
|
||
//物料数据
|
||
BaseDataSystemMES.Material_Insert(OpName, 1);
|
||
|
||
Sendmessage("49", "11", OpName);//向web发送消息
|
||
|
||
//工作完成
|
||
//MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||
|
||
//MIS_BASE.Write_FixAllow(OpName, true);
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
catch (Exception err)
|
||
{
|
||
////ApplicationLog.WriteLog(err, "Function03:Barcode");
|
||
return false;
|
||
}
|
||
|
||
}
|
||
|
||
|
||
}
|
||
}
|