using DevComponents.DotNetBar.Layout; using DevComponents.DotNetBar.SuperGrid; using FreeRedis; using MessagePack; using MessagePack.Resolvers; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using WCS.Data; using WCS.Entity.Protocol; using WCS_Client.UC; using WCS_Client.Utility; namespace WCS_Client.Frm { public partial class FrmEquMsg_dtl : Form { DataTable dt = null; string equName = string.Empty; public FrmEquMsg_dtl(string equNo) { InitializeComponent(); equName = equNo; InitFrm(); } private void InitFrm() { //var plcItem = Current.PlcSet.FirstOrDefault(v => v.WCS_EquipmentInfoSet.Any(t => t.DEVICECODE == equName)); //var plcItem = SugarBase.DB.Queryable().First(v => v.DEVICECODE == equName && v.ISLAST == true); //RedisClient Redis = new RedisClient("81.69.99.176,database=11"); //MessagePackSerializer.DefaultOptions = StandardResolver.Options.WithCompression(MessagePackCompression.Lz4Block); //Redis.Serialize = obj => //{ // var bytes = MessagePackSerializer.Serialize(obj); // return bytes; //}; //Redis.DeserializeRaw = (bytes, type) => //{ // var obj = MessagePackSerializer.Deserialize(type, bytes); // return obj; //}; var pack = eqpData.deviceDataPack; var convdata = pack.StationDatas;//输送机数据 var rgvdata = pack.RGVDatas;//穿梭车数据 var plcItem = pack.StationDatas.Datas.Where(o => o.Code == equName).FirstOrDefault(); dt = plcItem.D520.GetAttributesDataTable(); if (plcItem == null) { MessageBox.Show("该设备无数据。"); return; } // var equ = plcItem.WCS_EquipmentInfoSet.FirstOrDefault(v => v.DEVICECODE == equName); string result = string.Empty; //if (equ.Equ_Type == EquipmentType.srm.ToString()) //{ // result = equ.EquSignal_Srm.ToJson(); // dt = equ.EquSignal_Srm.GetAttributesDataTable(); //} //else if (equ.Equ_Type == EquipmentType.rgv.ToString()) //{ // result = equ.EquSignal_Rgv.ToJson(); // dt = equ.EquSignal_Rgv.GetAttributesDataTable(); //} //else if (equ.Equ_Type == EquipmentType.conveyor.ToString()) //{ // result = equ.EquSignal_Conv.ToJson(); // dt = equ.EquSignal_Conv.GetAttributesDataTable(); //} List GCList = new List() { SuperGridUtil.Get_GridColumn("信号名称", "信号名称", 200), SuperGridUtil.Get_GridColumn("信号值", "信号值", 160), SuperGridUtil.Get_GridColumn("信号说明", "信号说明", 900), }; List LCIList = new List(); string buttonName = string.Format("刷新(设备编号:[{0}])", equName); LCIList.Add(LCItemUtil.Add_ButtonX("btn_QDB", buttonName, 180, 30, SubmitMethods)); uC_QueryPage1.Init_QueryPage(30, true, true, "", GCList, LCIList, QueryPageDataMethodsms, RefreshRoleMethodsms, DoubleClikMethod, null, null); CommonShow.ShowProcessing("正在处理中,请稍候...", this, (obj) => { uC_QueryPage1.RefreshData(1, 0); }, null); } private PageData QueryPageDataMethodsms(int PageIndex, int PageSize) { PageData pd = BaseWorkflow.QueryDatatble(dt, PageIndex, PageSize); return pd; } private void RefreshRoleMethodsms(bool ChkValue) { } private void DoubleClikMethod(DataRow dr) { } private void SubmitMethods(string LCName) { if (LCName == "btn_QDB") { //Current.RefreshData(); //var plcItem = Current.PlcSet.FirstOrDefault(v => v.WCS_EquipmentInfoSet.Any(t => t.Equ_No == equName)); //var equ = plcItem.WCS_EquipmentInfoSet.FirstOrDefault(v => v.Equ_No == equName); //string result = string.Empty; //if (equ.Equ_Type == EquipmentType.srm.ToString()) //{ // //result = equ.EquSignal_Srm.ToJson(); // dt = equ.EquSignal_Srm.GetAttributesDataTable(); //} //else if (equ.Equ_Type == EquipmentType.rgv.ToString()) //{ // //result = equ.EquSignal_Rgv.ToJson(); // dt = equ.EquSignal_Rgv.GetAttributesDataTable(); //} //else if (equ.Equ_Type == EquipmentType.conveyor.ToString()) //{ // //result = equ.EquSignal_Conv.ToJson(); // dt = equ.EquSignal_Conv.GetAttributesDataTable(); //} //uC_QueryPage1.RefreshData(); } } } }