using OpcBasic; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Net.Http; using System.Text; using System.Web; using System.Web.Http; using MesWork; using System.Collections.Concurrent; using DoWhatPlc; using Newtonsoft.Json.Linq; namespace MesWorkWebApp { public partial class PLC1Controller : ApiController { /// /// http://localhost:41186/api/PLC/ReadAllTagValue?opname=OP1010 /// /// /// ReturnValue [HttpGet] public HttpResponseMessage ReadAllTagValue1(string opname) { var objValue = PlcLinkForm.ReadAllTagValue(opname); var pp = JsonConvert.SerializeObject(objValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// MES保存完数据(必须MIS)(X102.2)(20) /// /// /// [HttpGet] public HttpResponseMessage Read_MesReadOver(string opName) { bool tagValue; PlcLinkForm.Read_MesReadOver(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 发动机到位(X0.1)(2) /// /// /// [HttpGet] public HttpResponseMessage Read_WorkStart(string opName) { bool tagValue; PlcLinkForm.Read_WorkStart(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 发动机机型标志(INT4)(9) /// [HttpGet] public HttpResponseMessage Read_EngineTypeID(string opName) { int tagValue; PlcLinkForm.Read_EngineTypeID(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 发动机ID(STRING6.38)(10) /// [HttpGet] public HttpResponseMessage Read_EngineID(string opName) { string tagValue; PlcLinkForm.Read_EngineID(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 发动机型号(STRING46.38)(11) /// [HttpGet] public HttpResponseMessage Read_EngineType(string opName) { string tagValue; PlcLinkForm.Read_EngineType(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 工位直通(X101.6)(1006) /// [HttpGet] public HttpResponseMessage Read_PartGoOver(string opName) { bool tagValue; PlcLinkForm.Read_PartGoOver(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 托盘到位(1)托盘离开(0) (DBX101.5)(13) /// [HttpGet] public HttpResponseMessage Read_PartPalletStatus(string opName) { bool tagValue; PlcLinkForm.Read_PartPalletStatus(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 加工时间变量目标时间 (DINT 106)(17) /// [HttpGet] public HttpResponseMessage Read_MachineTime_TargetTime(string opName) { int tagValue; PlcLinkForm.Read_MachineTime_TargetTime(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 加工时间变量实际时间 (DINT 110)(18) /// [HttpGet] public HttpResponseMessage Read_MachineTime_ActualTime(string opName) { int tagValue; PlcLinkForm.Read_MachineTime_TargetTime(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 质量数据总成合格标志(INT104)(21) /// [HttpGet] public HttpResponseMessage Read_QualityMask(string opName) { int tagValue; PlcLinkForm.Read_QualityMask(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 机体流向标志(1 BYTE): /// 0普通工位: /// 1:上线(发动机上线); /// 2:下线(发动机下线);(INT114)(41) /// [HttpGet] public HttpResponseMessage Read_PartMoveDirection(string opName) { int tagValue; PlcLinkForm.Read_PartMoveDirection(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 强制MES(X103.0)(78) /// [HttpGet] public HttpResponseMessage Read_Mes_MustTest(string opName) { bool tagValue; PlcLinkForm.Read_Mes_MustTest(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 工位三种状态:在线、离线、屏蔽(0,1,2)(DBB116)(79) /// [HttpGet] public HttpResponseMessage Read_OnLineState(string opName) { int tagValue; PlcLinkForm.Read_OnLineState(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 变量类型代码=44 CF0.4 /// PLC向MES传递机型,机型代码,零件编号完成,通知PLC。 /// 机型可读 /// /// [HttpGet] public HttpResponseMessage Read_EngineGetOver_PLC(string opName) { bool tagValue; PlcLinkForm.Read_EngineGetOver_PLC(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// X100.2允许保存质量数据(19) /// /// /// [HttpGet] public HttpResponseMessage Read_QualityData_Read_CF(string opName) { bool tagValue; PlcLinkForm.Read_QualityData_Read_CF(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// MES向PLC传递机型(DBX2.1)(5) /// /// /// [HttpGet] public HttpResponseMessage Read_EngineTypeGetOver_MES(string opName) { bool tagValue; PlcLinkForm.Read_EngineTypeGetOver_MES(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// X2.3 工作完成 /// /// /// [HttpGet] public HttpResponseMessage Read_MaterialVerifyOver(string opName) { bool tagValue; PlcLinkForm.Read_MaterialVerifyOver(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 申请上线(DBX0.3)(43) /// /// /// [HttpGet] public HttpResponseMessage Read_PartLoad(string opName) { bool tagValue; PlcLinkForm.Read_PartLoad(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 上线完成(DBX0.3)(48) /// /// /// [HttpGet] public HttpResponseMessage Read_PartLoad_OK(string opName) { bool tagValue; PlcLinkForm.Read_PartLoad_OK(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 合格放行(51) /// /// /// [HttpGet] public HttpResponseMessage Read_ConfirmOkGo(string opName) { bool tagValue; PlcLinkForm.Read_ConfirmOkGo(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 拧紧结束(DBX1.1)(59) /// /// /// [HttpGet] public HttpResponseMessage Read_FixOK(string opName) { bool tagValue; PlcLinkForm.Read_FixOK(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 蘑菇按钮(DBX1.3)(61) /// /// /// [HttpGet] public HttpResponseMessage Read_NextPushButton(string opName) { bool tagValue; PlcLinkForm.Read_NextPushButton(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 允许拧紧(DBX3.1)(66) /// /// /// [HttpGet] public HttpResponseMessage Read_FixAllow(string opName) { bool tagValue; PlcLinkForm.Read_FixAllow(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 拧紧结束确认(DBX3.2)(67) /// /// /// [HttpGet] public HttpResponseMessage Read_FixOver(string opName) { bool tagValue; PlcLinkForm.Read_FixOver(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// ///返修上线,在上线工位,MES依据工件情况,设定为返修件,PLC见到MES设定为1后,将返修标志写入到DBX0.2为1 ///MES设定完返修返修上线后,MES清空该信号 ///DBX3.7(72) /// /// /// [HttpGet] public HttpResponseMessage Read_RepairUpline_MES(string opName) { bool tagValue; PlcLinkForm.Read_RepairUpline_MES(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 匹配结果(DBX3.4)(69) /// /// /// [HttpGet] public HttpResponseMessage Read_Match(string opName) { bool tagValue; PlcLinkForm.Read_Match(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 发动机机型代码(DBB404)(73)[false] /// /// /// [HttpGet] public HttpResponseMessage Read_EngineTypeID_MES(string opName) { int tagValue; PlcLinkForm.Read_EngineTypeID_MES(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 发动机机型(DBB446)(75) /// /// /// [HttpGet] public HttpResponseMessage Read_EngineType_MES(string opName) { string tagValue; PlcLinkForm.Read_EngineType_MES(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 发动机号(DBB406)(74) /// /// /// [HttpGet] public HttpResponseMessage Read_EngineID_MES(string opName) { string tagValue; PlcLinkForm.Read_EngineID_MES(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 拧紧序号(拧紧或者称重的顺序)(DBB88)(77)[false] /// /// /// [HttpGet] public HttpResponseMessage Read_OrderBy(string opName) { int tagValue; PlcLinkForm.Read_OrderBy(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 工步属性(工作性质)(DBB90)(88)[false] /// /// /// [HttpGet] public HttpResponseMessage Read_ProcessCode(string opName) { int tagValue; PlcLinkForm.Read_ProcessCode(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 套筒号、子程序代码子程序(DBB26)(2025)[false] /// /// /// [HttpGet] public HttpResponseMessage Read_BoltCode(string opName) { int tagValue; PlcLinkForm.Read_BoltCode(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 托盘代码(DBB86)(80) /// [HttpGet] public HttpResponseMessage Read_PalletCode(string opName) { int tagValue; PlcLinkForm.Read_PalletCode(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 获得机型,零件编号,机型代码,托盘号,(从PLC) /// /// /// /// /// /// [HttpGet] public HttpResponseMessage GetEngineTypeFromPLC(string opName) { int EngineTypeID; string EngineType; string EngineID; int PartPallet_Code; PlcLinkForm.GetEngineTypeFromPLC(opName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code); EngineValue ev = new EngineValue(); ev.OpName = opName; ev.EngineID = EngineID; ev.EngineTypeID = EngineTypeID; ev.EngineType = EngineType; ev.PalletCode = PartPallet_Code; //PlcLinkForm.Read_EngineTypeID(opName, out EngineTypeID); //PlcLinkForm.Read_EngineType(opName, out EngineType); //PlcLinkForm.Read_EngineID(opName, out EngineID); //PlcLinkForm.Read_PalletCode(opName, out PartPallet_Code); //JObject jObj = new JObject(); //jObj["EngineTypeID"] = EngineTypeID; //jObj["EngineType"] = EngineType; //jObj["EngineID"] = EngineID; //jObj["PartPallet_Code"] = PartPallet_Code; var pp = JsonConvert.SerializeObject(ev); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 获得机型,零件编号,机型代码,托盘号,(从DB) /// /// /// /// /// /// //public static void GetEngineTypeFromDB(string opName, out int EngineTypeID, out string EngineType, out string EngineID, out int PartPallet_Code) //{ // string orderForm = ""; // int isRepair = 0; // string repairCode = ""; // string palletCode = "0"; // BaseDataSystemMES.OpName_MIS_Moby_Select(opName, // out orderForm, out EngineTypeID, out EngineType, // out EngineID, out palletCode, out isRepair, out repairCode); // PartPallet_Code = Convert.ToInt32(palletCode); //} /// /// 0:不修改;1:可以修改。(上线工位)通知PLC。(DBX1.2)(76) /// /// /// [HttpGet] public HttpResponseMessage Read_PartPalletCode_PLC_ToMES(string opName) { int tagValue; PlcLinkForm.Read_PartPalletCode_PLC_ToMES(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 通知写入托盘号(DBX3.5)(70) /// /// /// [HttpGet] public HttpResponseMessage Read_PartPalletCode_PLC(string opName) { int tagValue; PlcLinkForm.Read_PartPalletCode_PLC(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 变量类型代码=86,打印第一行(机型),用于线首打印机。STRING 486 .38 /// /// /// [HttpGet] public HttpResponseMessage Read_PrintBarCode1_MES(string opName) { string tagValue; PlcLinkForm.Read_PrintBarCode1_MES(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 变量类型代码=87,打印第二行(流水号),用于线首打印机。STRING 526 .38 /// /// /// [HttpGet] public HttpResponseMessage Read_PrintBarCode2_MES(string opName) { string tagValue; PlcLinkForm.Read_PrintBarCode2_MES(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 上线工位。0:正常工作;1:空托盘放行(DBX2.2)(6) /// /// /// [HttpGet] public HttpResponseMessage Read_PartPalletGoOver(string opName) { bool tagValue; PlcLinkForm.Read_PartPalletGoOver(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 自动手动申请工件编号,0是自动方式;1:手动方式。切换时,(DBX2.1)(71) /// /// /// [HttpGet] public HttpResponseMessage Read_IsAutoGetEngineID(string opName) { int tagValue; PlcLinkForm.Read_IsAutoGetEngineID(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 正常拧紧时选择(DBX100.3)(81) /// /// /// [HttpGet] public HttpResponseMessage Read_Normal(string opName) { bool tagValue; PlcLinkForm.Read_Normal(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 备用拧紧时选择(DBX100.4)(82) /// /// /// [HttpGet] public HttpResponseMessage Read_UnNormal(string opName) { bool tagValue; PlcLinkForm.Read_UnNormal(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 允许拧紧2(DBX100.5)(83) /// /// /// [HttpGet] public HttpResponseMessage Read_FixAllow_2(string opName) { bool tagValue; PlcLinkForm.Read_FixAllow_2(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 拧紧结束2(DBX100.6)(84) /// /// /// [HttpGet] public HttpResponseMessage Read_FixOK_2(string opName) { bool tagValue; PlcLinkForm.Read_FixOK_2(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 拧紧结束确认2(DBX100.7)(85) /// /// /// [HttpGet] public HttpResponseMessage Read_FixOver_2(string opName) { bool tagValue; PlcLinkForm.Read_FixOver_2(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 拧紧顺序2(DBX101.7)(1007) /// MES通知PLC开始拧紧顺序(0为其他位,1为第一位置)(必须MES) /// /// /// [HttpGet] public HttpResponseMessage Read_WriteShaft_2(string opName) { bool tagValue; PlcLinkForm.Read_WriteShaft_2(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 返修上线(DBX2.6)(52) /// /// /// [HttpGet] public HttpResponseMessage Read_PartLoadFinish(string opName) { bool tagValue; PlcLinkForm.Read_PartLoadFinish(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 返修上线后,PLC确认(DBX1.0)(58) /// /// /// [HttpGet] public HttpResponseMessage Read_PartLoadOver(string opName) { bool tagValue; PlcLinkForm.Read_PartLoadOver(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 变量类型代码=22,读取托盘信息 DBW126 /// /// /// [HttpGet] public HttpResponseMessage Read_PalletInfo(string opName) { int tagValue; PlcLinkForm.Read_PalletInfo(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 变量类型代码=23,读取托盘信息 DBW194 /// /// /// [HttpGet] public HttpResponseMessage Read_RepairStatus_PLC(string opName) { int tagValue; PlcLinkForm.Read_RepairStatus_PLC(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// PLC将MOBY信息成功写入到了对应的DB,然后通知MES(DBX1.5)(63) /// /// /// [HttpGet] public HttpResponseMessage Read_PalletMobyReadOver(string opName) { bool tagValue; PlcLinkForm.Read_PalletMobyReadOver(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 在线返修状态(DBX4.0)(91) /// /// /// [HttpGet] public HttpResponseMessage Read_OnlineRepair(string opName) { bool tagValue; PlcLinkForm.Read_OnlineRepair(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 离线返修状态(DBX4.1)(92) /// /// /// [HttpGet] public HttpResponseMessage Read_OutLineRepair(string opName) { bool tagValue; PlcLinkForm.Read_OutLineRepair(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// MES通知PLC修改托盘状态成功(DBX4.2)(93) /// /// /// [HttpGet] public HttpResponseMessage Read_UpdatePalletOK(string opName) { bool tagValue; PlcLinkForm.Read_UpdatePalletOK(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// MES向PLC要求申请下线(DBX0.7)(50) /// /// /// [HttpGet] public HttpResponseMessage Read_PalletDown(string opName) { bool tagValue; PlcLinkForm.Read_PalletDown(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 物料检测(99) /// /// /// //public static void Read_CheckMaterial(string opName, out object tagValue) //{ // bool tagValue; // PlcLinkForm.Read_CheckMaterial(opName, out tagValue); // var pp = JsonConvert.SerializeObject(tagValue); // HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; // return result; //} /// /// 备用功能是否启用(95) /// /// /// [HttpGet] public HttpResponseMessage Read_BakOpNameIsWork(string opName) { bool tagValue; PlcLinkForm.Read_BakOpNameIsWork(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 质量呼叫(DBX301.2)(2011) /// /// /// [HttpGet] public HttpResponseMessage Read_QualityCall(string opName) { bool tagValue; PlcLinkForm.Read_QualityCall(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 物料呼叫(DBX301.3)(2012) /// /// /// [HttpGet] public HttpResponseMessage Read_MaterialCall(string opName) { bool tagValue; PlcLinkForm.Read_MaterialCall(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } /// /// 故障呼叫(DBX301.4)(2013) /// /// /// [HttpGet] public HttpResponseMessage Read_FaultCall(string opName) { bool tagValue; PlcLinkForm.Read_FaultCall(opName, out tagValue); var pp = JsonConvert.SerializeObject(tagValue); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; return result; } } }