/// <summary> /// 初始化SocketListen /// </summary> void InitSocketListen() { string hostName = System.Net.Dns.GetHostName(); //using (clsLIS_Svc2 svc = (clsLIS_Svc2)com.digitalwave.iCare.common.clsObjectGenerator.objCreatorObjectByType(typeof(clsLIS_Svc2))) using (clsQueryLIS_Svc svc = (clsQueryLIS_Svc)com.digitalwave.iCare.common.clsObjectGenerator.objCreatorObjectByType(typeof(clsQueryLIS_Svc))) //using(clsQueryLIS_Svc svc = (clsQueryLIS_Svc)com.digitalwave.iCare.common.clsObjectGenerator.objCreatorObjectByType(typeof(com.digitalwave.iCare.middletier.LIS.clsQueryLIS_Svc))) { long ret = svc.lngGetInstrumentSerialSetting(hostName, out EquipConfig); if (ret == 1) { if (EquipConfig != null && EquipConfig.Length > 0) { this.lblEquipName.Text = EquipConfig[0].strLIS_Instrument_Name; this.DeviceID = EquipConfig[0].strLIS_Instrument_ID; } } } string ipAddr = this.txtIpAddr.Text.Trim(); string portNo = this.txtPortNo.Text.Trim(); if (ipAddr == string.Empty) { MessageBox.Show("请输入IP地址", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (portNo == string.Empty) { MessageBox.Show("请输入端口号", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //服务器启动侦听 try { IPEndPoint localep = new IPEndPoint(IPAddress.Parse(ipAddr), Convert.ToInt32(portNo)); listener = new TcpListener(localep); listener.Start(10); } catch (Exception ex) { this.SetSocketInfo("OM设备监听端口错误,请修改后重试!\r\n\r\n" + ex.Message); return; } listener.BeginAcceptSocket(new AsyncCallback(AcceptCallback), listener); isListenStart = true; // 监听服务运行中... this.SetSocketInfo("监听服务运行中... " + "地址: " + ipAddr + " 端口: " + portNo); }
/// <summary> /// 获取指定检验编号的检验项目字符串 /// </summary> /// <param name="p_strSampleNO"></param> /// <returns></returns> private string GetSampleCheckItems(string p_strSampleNO, string p_strSampleID, string p_strDeviceNO, string p_strDeviceID) { string strReturn = null; long lngRes = 0; if (string.IsNullOrEmpty(p_strSampleID)) { clsQueryLIS_Svc objQueryLISServ = (clsQueryLIS_Svc)com.digitalwave.iCare.common.clsObjectGenerator.objCreatorObjectByType(typeof(clsQueryLIS_Svc)); lngRes = objQueryLISServ.m_lngGetSampleCheckItems(p_strDeviceNO + p_strSampleNO, out strReturn); } else { clsLIS_Svc objLISServ = (clsLIS_Svc)com.digitalwave.iCare.common.clsObjectGenerator.objCreatorObjectByType(typeof(clsLIS_Svc)); lngRes = objLISServ.m_lngGetSampleCheckItems(p_strSampleNO, p_strSampleID, p_strDeviceID, p_strDeviceNO, out strReturn); } return(strReturn); }