MVP!
This commit is contained in:
185
MisDataFunction/Function1053/Methods/EngineGetOverBaseWork.cs
Normal file
185
MisDataFunction/Function1053/Methods/EngineGetOverBaseWork.cs
Normal file
@@ -0,0 +1,185 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Threading;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using MisDataSaveDate;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <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)
|
||||
{
|
||||
// 0711Add 先给允许工作 然后进行电芯判断
|
||||
MIS_BASE.Write_TagValueByTagTypeID(66, OpName, true);
|
||||
string operationTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
|
||||
// 1.读取所有的电芯码
|
||||
string cell_code1 = "";
|
||||
string cell_code2 = "";
|
||||
string cell_code3 = "";
|
||||
string cell_code4 = "";
|
||||
string cell_code5 = "";
|
||||
string cell_code6 = "";
|
||||
string cell_code7 = "";
|
||||
string cell_code8 = "";
|
||||
|
||||
cell_code1 = MIS_BASE.Read_TagValueByTagTypeID(200, OpName).ToString();
|
||||
cell_code2 = MIS_BASE.Read_TagValueByTagTypeID(201, OpName).ToString();
|
||||
cell_code3 = MIS_BASE.Read_TagValueByTagTypeID(202, OpName).ToString();
|
||||
cell_code4 = MIS_BASE.Read_TagValueByTagTypeID(203, OpName).ToString();
|
||||
cell_code5 = MIS_BASE.Read_TagValueByTagTypeID(204, OpName).ToString();
|
||||
cell_code6 = MIS_BASE.Read_TagValueByTagTypeID(205, OpName).ToString();
|
||||
cell_code7 = MIS_BASE.Read_TagValueByTagTypeID(206, OpName).ToString();
|
||||
cell_code8 = MIS_BASE.Read_TagValueByTagTypeID(207, OpName).ToString();
|
||||
|
||||
List<string> inventoryArray = new List<string>();
|
||||
inventoryArray.Add(cell_code1);
|
||||
inventoryArray.Add(cell_code2);
|
||||
inventoryArray.Add(cell_code3);
|
||||
inventoryArray.Add(cell_code4);
|
||||
inventoryArray.Add(cell_code5);
|
||||
inventoryArray.Add(cell_code6);
|
||||
inventoryArray.Add(cell_code7);
|
||||
inventoryArray.Add(cell_code8);
|
||||
|
||||
Dictionary<string, string> checkResult = new Dictionary<string, string>();
|
||||
|
||||
for (int i = 0; i < inventoryArray.Count; i++)
|
||||
{
|
||||
string inventory = inventoryArray[i];
|
||||
// 2.OP030需要向CMaaS校验 接口校验
|
||||
CallWebService.Call_miCheckInventoryAttributes(OpName, inventory, out string code, out string message);
|
||||
string resCode = code == "0" ? "1" : "999";
|
||||
checkResult.Add(inventory, resCode);
|
||||
}
|
||||
|
||||
int cell_code1_result = Convert.ToInt32(checkResult[cell_code1]);
|
||||
int cell_code2_result = Convert.ToInt32(checkResult[cell_code2]);
|
||||
int cell_code3_result = Convert.ToInt32(checkResult[cell_code3]);
|
||||
int cell_code4_result = Convert.ToInt32(checkResult[cell_code4]);
|
||||
int cell_code5_result = Convert.ToInt32(checkResult[cell_code5]);
|
||||
int cell_code6_result = Convert.ToInt32(checkResult[cell_code6]);
|
||||
int cell_code7_result = Convert.ToInt32(checkResult[cell_code7]);
|
||||
int cell_code8_result = Convert.ToInt32(checkResult[cell_code8]);
|
||||
|
||||
// 3.校验结果储存数据库同时写给PLC
|
||||
MisDataFun.Cell_CheckDataAdd(OpName, cell_code1, operationTime, cell_code1_result);
|
||||
MisDataFun.Cell_CheckDataAdd(OpName, cell_code2, operationTime, cell_code2_result);
|
||||
MisDataFun.Cell_CheckDataAdd(OpName, cell_code3, operationTime, cell_code3_result);
|
||||
MisDataFun.Cell_CheckDataAdd(OpName, cell_code4, operationTime, cell_code4_result);
|
||||
MisDataFun.Cell_CheckDataAdd(OpName, cell_code5, operationTime, cell_code5_result);
|
||||
MisDataFun.Cell_CheckDataAdd(OpName, cell_code6, operationTime, cell_code6_result);
|
||||
MisDataFun.Cell_CheckDataAdd(OpName, cell_code7, operationTime, cell_code7_result);
|
||||
MisDataFun.Cell_CheckDataAdd(OpName, cell_code8, operationTime, cell_code8_result);
|
||||
|
||||
// 4.过站
|
||||
MisDataFun.Cell_PassStation(OpName, cell_code1, operationTime, cell_code1_result);
|
||||
MisDataFun.Cell_PassStation(OpName, cell_code2, operationTime, cell_code2_result);
|
||||
MisDataFun.Cell_PassStation(OpName, cell_code3, operationTime, cell_code3_result);
|
||||
MisDataFun.Cell_PassStation(OpName, cell_code4, operationTime, cell_code4_result);
|
||||
MisDataFun.Cell_PassStation(OpName, cell_code5, operationTime, cell_code5_result);
|
||||
MisDataFun.Cell_PassStation(OpName, cell_code6, operationTime, cell_code6_result);
|
||||
MisDataFun.Cell_PassStation(OpName, cell_code7, operationTime, cell_code7_result);
|
||||
MisDataFun.Cell_PassStation(OpName, cell_code8, operationTime, cell_code8_result);
|
||||
// 回写PLC
|
||||
MIS_BASE.Write_TagValueByTagTypeID(114, OpName, cell_code1_result);
|
||||
MIS_BASE.Write_TagValueByTagTypeID(115, OpName, cell_code2_result);
|
||||
MIS_BASE.Write_TagValueByTagTypeID(116, OpName, cell_code3_result);
|
||||
MIS_BASE.Write_TagValueByTagTypeID(117, OpName, cell_code4_result);
|
||||
MIS_BASE.Write_TagValueByTagTypeID(118, OpName, cell_code5_result);
|
||||
MIS_BASE.Write_TagValueByTagTypeID(119, OpName, cell_code6_result);
|
||||
MIS_BASE.Write_TagValueByTagTypeID(120, OpName, cell_code7_result);
|
||||
MIS_BASE.Write_TagValueByTagTypeID(121, OpName, cell_code8_result);
|
||||
|
||||
// 4.MES工作完成
|
||||
MIS_BASE.Write_TagValueByTagTypeID(7, OpName, 1);
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "MES工作完成!");
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 二次工作
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
private void EngineTypeGetOver_PLC_Work_two(string OpName)
|
||||
{
|
||||
int EngineTypeID;//机型代码
|
||||
int PartPallet_Code;//托盘编号
|
||||
|
||||
string EngineType;//机型
|
||||
string EngineID;//工件编号
|
||||
string OrderForm;
|
||||
MIS_BASE.GetEngineTypeFromPLC(OpName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out OrderForm);
|
||||
//EngineTypeGetOver_PLC_Work(OpName, EngineTypeID, EngineType, EngineID, Convert.ToInt32(PartPallet_Code), OrderForm);
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 跳过二次工作
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
private void EngineTypeGetOver_PLC_Work_Skip(string OpName)
|
||||
{
|
||||
//MIS_BASE.Write_MesReadOver(OpName, true);
|
||||
MIS_BASE.Write_MesWorkFinish(OpName, true);
|
||||
}
|
||||
|
||||
/// <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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新待上料数量
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
private void UpdateWait_NUM_PLC(object e)
|
||||
{
|
||||
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
// 更新待上料数量到数据库
|
||||
Db.UpdateWait_NUM_PLC(OpName, tagValue);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 空料握手plc
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
private void Handshake_Fun(object e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
164
MisDataFunction/Function1053/Methods/SubmitToMisweb.cs
Normal file
164
MisDataFunction/Function1053/Methods/SubmitToMisweb.cs
Normal file
@@ -0,0 +1,164 @@
|
||||
using System;
|
||||
//using SystemFramework;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 此类用于向WEB发送各种类型消息
|
||||
/// </summary>
|
||||
partial class FunctionMES
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 批量发送WEB消息(Value为BOOL值)
|
||||
/// </summary>
|
||||
/// <param name="MessageNumm">消息编号组合</param>
|
||||
/// <param name="Value">消息值组合</param>
|
||||
/// <param name="OpName">工位号</param>
|
||||
void Sendmessage(string MessageNumm,string Value, string OpName)
|
||||
{
|
||||
for (int i=0;i<MessageNumm.Length;i++)
|
||||
{
|
||||
Sendmessage(MessageNumm[i], Value[i].ToString(), OpName);
|
||||
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 选择发送给WEB的消息
|
||||
/// </summary>
|
||||
/// <param name="Num">消息类型</param>
|
||||
/// <param name="OpName">消息工位</param>
|
||||
string Sendmessage(char Num,string Value, string OpName)
|
||||
{
|
||||
string SendMessage;
|
||||
string result = "";
|
||||
switch (Num)
|
||||
{
|
||||
case '1':
|
||||
//1(直接在界面通过选择机型确认工序内容)
|
||||
SendMessage = "MES|ProcessList|" + OpName + "|" + Value;
|
||||
result = AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
case '2':
|
||||
//2显示物料
|
||||
SendMessage = "MES|MaterialList|" + OpName + "|" + Value;
|
||||
result = AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
case '3':
|
||||
//3显示操作指导图片
|
||||
SendMessage = "MES|PicShow|" + OpName + "|" + Value;
|
||||
result = AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
case '4':
|
||||
//4订单完工模块刷新完成数量
|
||||
SendMessage = "MES|OrderFormList|" + OpName + "|" + Value;
|
||||
AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
case '5':
|
||||
SendMessage = "MES|ShowMoby|" + OpName + "|" + Value;
|
||||
result = AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
case '6':
|
||||
SendMessage = "MES|MaterialCheckPosition|" + OpName + "|" +Value;
|
||||
result = AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
case '7':
|
||||
SendMessage = "MES|WorkStart|" + OpName + "|" + Value;
|
||||
result = AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
case '8'://清除MES生成编号
|
||||
|
||||
break;
|
||||
case '9':
|
||||
SendMessage = "MES|ConfirmOkGo|" + OpName + "|" + Value;
|
||||
result = AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
case 'a':
|
||||
SendMessage = "MES|FixAllow|" + OpName + "|" + Value;
|
||||
result = AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// 向WEB发送信息(value为字符串)
|
||||
/// </summary>
|
||||
/// <param name="Command">消息种类</param>
|
||||
/// <param name="Value">消息内容</param>
|
||||
/// <param name="OpName">工位号</param>
|
||||
string SendInfomation(string Command, string Value, string OpName)
|
||||
{
|
||||
string SendMessage = "MES|" + Command + "|" + OpName + "|" + Value;
|
||||
return AsyncSendMessage(SendMessage);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 发送在线产量、在线节拍
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void SendActuallyCount(string OpName, int tagValue)
|
||||
{
|
||||
//当工件离开时,更新在线产量、在线节拍
|
||||
if (tagValue == 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
int opNameCount = 0;//在线产量
|
||||
int opNameCountTime = 0;//在线节拍
|
||||
//基本数据_工作日历_班次产量查询_New
|
||||
//BaseDataSystemMES.OpNameCount_New(OpName, out opNameCount, out opNameCountTime);
|
||||
string SendMessage;
|
||||
SendMessage = "MES|ActuallyCount|" + OpName + "|" + opNameCount.ToString() + "&" + opNameCountTime.ToString();
|
||||
AsyncSendMessage(SendMessage);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:SendActuallyCount");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送页面点位 同时存入数据库状态
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
private static void MobySendWebAndSaveData(string OpName, string tagType, string tagValue)
|
||||
{
|
||||
//BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, tagType, tagValue);
|
||||
//// 判断是否为涉及前端页面的信号,如果是则同步发送点位
|
||||
//string tagName = "";
|
||||
//switch (tagType)
|
||||
//{
|
||||
// case "工件到位":
|
||||
// tagName = "WorkStart";
|
||||
// break;
|
||||
// case "传递机型":
|
||||
// tagName = "EngineTypeGetOverPLC";
|
||||
// break;
|
||||
// case "申请上件":
|
||||
// tagName = "PartLoad";
|
||||
// break;
|
||||
// case "允许工作":
|
||||
// tagName = "FixAllow";
|
||||
// break;
|
||||
// case "允许保存":
|
||||
// tagName = "MesRead";
|
||||
// break;
|
||||
// case "保存完成":
|
||||
// tagName = "MesReadOver";
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
//}
|
||||
//if (tagName != "")
|
||||
//{
|
||||
// SendMessageFun.SendInfomation(tagName, Convert.ToString(Convert.ToInt32(tagValue)), OpName);
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
52
MisDataFunction/Function1053/Methods/UDP.Send.cs
Normal file
52
MisDataFunction/Function1053/Methods/UDP.Send.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
using DataLinkMesWork1;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 发送信息到MES通讯服务器或者其他的
|
||||
/// </summary>
|
||||
/// <param name="Message"></param>
|
||||
private string AsyncSendMessage(string Message)
|
||||
{
|
||||
return MIS_SendMessage.asyncSendMessage(Message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送提示消息
|
||||
/// </summary>
|
||||
/// <param name="Message"></param>
|
||||
private void AsyncSendMessage_Notice(string opname, string notice)
|
||||
{
|
||||
//通知Web界面
|
||||
//BaseDataSystemMES.Web_Notice_Insert(opname, notice);
|
||||
string SendMessage = "MES|Notice|" + opname + "|" + "1";
|
||||
MIS_SendMessage.asyncSendMessage(SendMessage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送信息到打印机
|
||||
/// </summary>
|
||||
/// <param name="Message"></param>
|
||||
private void asyncSendMessageToMark(string Message)
|
||||
{
|
||||
string messageSend = (string)Message;
|
||||
//UDPClientSend.Send_ALL(ApplicationConfig.MES_MarkPortNum, messageSend);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送信息到LED
|
||||
/// </summary>
|
||||
/// <param name="Message"></param>
|
||||
private void asyncSendMessageLED(string OpName)
|
||||
{
|
||||
//发送到大屏幕显示 41104
|
||||
string strMessage = "MIS|" + OpName + "|" + "0" + "|" + "1";
|
||||
//UDPClientSend.Send_ALL(ApplicationConfig.Port_ShowLED_ProductCount, strMessage);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
MisDataFunction/Function1053/Methods/vssver2.scc
Normal file
BIN
MisDataFunction/Function1053/Methods/vssver2.scc
Normal file
Binary file not shown.
Reference in New Issue
Block a user