private void sendText(string context, int row) { LEDSender.Do_LED_Startup(); TSenderParam param = new TSenderParam(); ushort K; GetDeviceParam(ref param.devParam); param.notifyMode = LEDSender.NOTIFY_BLOCK; param.wmHandle = (UInt32)0; param.wmMessage = WM_LED_NOTIFY; System.Drawing.Font font = new System.Drawing.Font("宋体", float.Parse(zt)); K = (ushort)LEDSender.Do_MakeRoot(LEDSender.ROOT_PLAY, LEDSender.COLOR_MODE_DOUBLE, LEDSender.SURVIVE_ALWAYS); LEDSender.Do_AddChapter(K, 3000, LEDSender.WAIT_CHILD); LEDSender.Do_AddRegion(K, int.Parse(left), int.Parse(top) + font.Height * row + 3, int.Parse(width), int.Parse(height), 0);//-18 //第1页面 LEDSender.Do_AddLeaf(K, 3000, LEDSender.WAIT_CHILD); //自动换行的文字 // LEDSender.Do_AddText(K, 0, 0, 64, 16, LEDSender.V_TRUE, 0, "Hello world! 宁采成,HELLO WORLD!", "宋体", 9, 0xff, LEDSender.WFS_NONE, LEDSender.V_TRUE, 0, 0, 1, 1, 1, 0, 1, 3); //非自动换行的文字 if (row >= 0) { LEDSender.Do_AddText(K, 0, 16, 64, 64, LEDSender.V_TRUE, 0, context, "宋体", int.Parse(zt), 0xff00, LEDSender.WFS_NONE, LEDSender.V_TRUE, 0, 2, 3, 1, 1, 0, 0, 1);//0 静态显示 } //if (row >=1) // LEDSender.Do_AddText(K, 0, 16+font.Height*row+3, 64, 32, LEDSender.V_TRUE, 0, context, "宋体", int.Parse(zt), 0xff00, LEDSender.WFS_NONE, LEDSender.V_TRUE, 0, 2, 3, 1, 1, 1, 0, 1); //System.Threading.Thread.Sleep(100000); // LEDSender.Do_AddText(K, 0, 16, 64, 32, LEDSender.V_TRUE, 0, "谢谢,收您1000.找您50", "宋体", 12, 0xff00, LEDSender.WFS_NONE, LEDSender.V_TRUE,0, 2, 3, 1, 1, 1, 1, 1); //第2页面 // LEDSender.Do_AddLeaf(K, 10000, LEDSender.WAIT_CHILD); //非自动换行的文字 // LEDSender.Do_AddText(K, 0, 0, 64, 16, LEDSender.V_TRUE, 0, "Hello world!", "宋体", 12, 0xffff, LEDSender.WFS_NONE, LEDSender.V_TRUE, 0, 0, 1, 1, 1, 1, 1, 5); Parse2(LEDSender.Do_LED_SendToScreen(ref param, K)); }
int SendLEDMessage(string ip, ushort port, int colorMode, string deviceAddr, string position, string text, bool isFlash) { LogService.Debug(string.Format("SendLEDMessage->Start:Text={0}", text)); var strArr = position.Split(','); int ChapterIndex = Convert.ToInt32(strArr[0]), RegionIndex = Convert.ToInt32(strArr[1]), LeafIndex = Convert.ToInt32(strArr[2]), ObjectIndex = Convert.ToInt32(strArr[3]); TSenderParam param = new TSenderParam(); param.devParam.devType = LEDSender.DEVICE_TYPE_UDP; param.devParam.rmtHost = ip; param.devParam.locPort = port; param.devParam.rmtPort = 6666; param.devParam.dstAddr = ushort.Parse(deviceAddr); param.notifyMode = LEDSender.NOTIFY_EVENT; param.wmHandle = this.handle; param.wmMessage = WM_LED_NOTIFY; //这个操作中,ChapterIndex=0,RegionIndex=0,LeafIndex=0,ObjectIndex=0 只更新控制卡内第1个节目中的第1个分区中的第1个页面中的第1个对象 //如果ChapterIndex=1,RegionIndex=2,LeafIndex=1,ObjectIndex=2只更新控制卡内第2个节目中的第3个分区中的第2个页面中的第3个对象 //以此类推 ushort K = (ushort)LEDSender.Do_MakeObject(LEDSender.ROOT_PLAY_OBJECT, LEDSender.ACTMODE_REPLACE, ChapterIndex, RegionIndex, LeafIndex, ObjectIndex, colorMode); LEDSender.Do_AddText(K, rectText.Left, rectText.Top, rectText.Width, rectText.Height, LEDSender.V_TRUE, 0, text, this.fontName, this.fontSize, this.fontColor, this.fontStyle, LEDSender.V_FALSE, 1, 1, 5, 1, 5, isFlash ? 1 : 0, 1000, 10000); var result = LEDSender.Do_LED_SendToScreen(ref param, K); if (result == LEDSender.R_DEVICE_READY) { this.messageIndicator1.SetState(StateType.Success, "发送成功"); } else if (result == LEDSender.R_DEVICE_INVALID) { this.messageIndicator1.SetState(StateType.Success, "打开通讯设备失败"); } else if (result == LEDSender.R_DEVICE_BUSY) { this.messageIndicator1.SetState(StateType.Success, "设备忙,正在通讯中..."); } LogService.Debug("SendLEDMessage->End:Result=" + result); return(result); }
private void button2_Click(object sender, EventArgs e) { string xc, crk, source, to, sku, desc; xc = null; crk = null; source = null; to = null; sku = null; desc = null; SqlConnection conne = new SqlConnection(con); //获取小车号/出入库类型/起始位/目标位 conne.Open(); string sql = "select * from OD_TASK where RELEASESTATUS='Y' and HADFINISH='Y'"; SqlCommand cmd = new SqlCommand(sql, conne); SqlDataReader read = cmd.ExecuteReader(); read.Read(); xc = read["CONTAINERNO"].ToString(); crk = read["TASKTYPEDESCRIPTION"].ToString().Replace("堆垛机", ""); source = read["SOURCEPLACE"].ToString(); to = read["TOPLACE"].ToString(); conne.Close(); //根据小车号获取物料号/物料名称 conne.Open(); string sqlsku = "select * from IV_CONTAINER_VS_ITEM where CONTAINERID='" + xc + "'"; SqlCommand cmdsku = new SqlCommand(sqlsku, conne); SqlDataReader readsku = cmdsku.ExecuteReader(); while (readsku.Read()) { sku += readsku["ITEMSKU"].ToString() + ";"; desc += readsku["ITEMDESC"].ToString() + ";"; } conne.Close(); ////获取物料名称 //string sqldesc = "select ITEMDESC from IV_CONTAINER_VS_ITEM where CONTAINERID='" + xc + "'"; //conne.Open(); //SqlCommand cmddesc = new SqlCommand(sqldesc, conne); //desc = cmddesc.ExecuteScalar().ToString(); //conne.Close(); Int32 param_index = 0; ushort K; GetDeviceParamWithoutStruct(param_index, (Int32)LEDSender2.NOTIFY_EVENT, (Int32)Handle, WM_LED_NOTIFY); K = (ushort)LEDSender2.Do_MakeRoot(LEDSender2.ROOT_PLAY, LEDSender2.COLOR_MODE_DOUBLE, LEDSender2.SURVIVE_ALWAYS); LEDSender2.Do_AddChapter(K, 30000, LEDSender2.WAIT_CHILD); LEDSender2.Do_AddRegion(K, 0, 0, 256, 160, 0); //添加表头 LEDSender2.Do_AddLeaf(K, 10000000, LEDSender2.WAIT_CHILD); LEDSender2.Do_AddText(K, 0, 1, 256, 16, 1, 0, "吉利沃尔沃立体库", "宋体", 12, 255, 0, 0, 1, 1, 5, 1, 5, 0, 0, 100000); LEDSender2.Do_AddText(K, 10, 26, 110, 16, 1, 0, "小车号:" + xc, "宋体", 11, 255, 0, 0, 0, 1, 5, 1, 5, 0, 0, 100000); LEDSender2.Do_AddText(K, 125, 26, 131, 16, 1, 0, "任务类型:" + crk, "宋体", 11, 255, 0, 0, 0, 1, 5, 1, 5, 0, 0, 100000); LEDSender2.Do_AddText(K, 10, 47, 256, 16, 1, 0, "物料号:" + sku, "宋体", 11, 255, 0, 0, 0, 1, 5, 1, 5, 0, 0, 100000); LEDSender2.Do_AddText(K, 10, 69, 256, 16, 1, 0, "物料名称:" + desc, "宋体", 11, 255, 0, 0, 0, 1, 5, 1, 5, 0, 0, 100000); LEDSender2.Do_AddText(K, 10, 92, 110, 16, 1, 0, "起始位:" + source, "宋体", 11, 255, 0, 0, 0, 1, 5, 1, 5, 0, 0, 100000); LEDSender2.Do_AddText(K, 125, 92, 131, 16, 1, 0, "目标位:" + to, "宋体", 11, 255, 0, 0, 0, 1, 5, 1, 5, 0, 0, 100000); LEDSender2.Do_AddText(K, 10, 116, 256, 16, 1, 0, "作业时间:" + DateTime.Now, "宋体", 11, 255, 0, 0, 0, 1, 5, 1, 5, 0, 0, 100000); LEDSender2.Do_AddText(K, 0, 140, 256, 16, 1, 0, "技术支持:伟本智能机电(上海)股份有限公司", "宋体", 10, 255, 0, 0, 1, 1, 5, 1, 5, 0, 0, 100000); Parse(LEDSender2.Do_LED_SendToScreen2(param_index, K)); }