示例#1
0
 private static COMSettingInfo PO2VO(IMES.DataModel.COMSettingDef def)
 {
     COMSettingInfo vo = new COMSettingInfo();
     vo.id = def.id;
     vo.name = def.name;
     vo.commPort = def.commport;
     vo.baudRate = def.baudRate;
     vo.rthreshold = Convert.ToInt32(def.rthreshold);
     vo.sthreshold = Convert.ToInt32(def.sthreshold);
     vo.handshaking = Convert.ToInt32(def.handshaking);
     vo.editor = def.editor;
     //vo.cdt = Convert.ToDateTime(def.cdt);
     //vo.udt = Convert.ToDateTime(def.udt);
     return vo;
 }
示例#2
0
        /// <summary>
        /// 根据hostname获取Comm设置列表
        /// </summary>
        public IList<COMSettingInfo> getCommSetting(string hostname, string editor)
        {
            logger.Debug("(_LabelLightGuide)getCommSetting start, hostname:" + hostname);
            try
            {
                IPalletRepository iPalletRepository = RepositoryFactory.GetInstance().GetRepository<IPalletRepository, Pallet>();
                IList<COMSettingInfo> commSettingList = new List<COMSettingInfo>();
                commSettingList = iPalletRepository.FindCOMSettingByName(hostname);

                if (commSettingList == null || commSettingList.Count <= 0)
                {
                    COMSettingInfo ele = new COMSettingInfo();
                    ele.name = hostname;
                    ele.editor = editor;
                    ele.commPort = "1";
                    ele.baudRate = "9600,n,8,1";
                    ele.rthreshold = 1;
                    ele.sthreshold = 1;
                    ele.handshaking = 0;
                    iPalletRepository.AddCOMSettingItem(ele);
                    commSettingList.Add(ele);
                }
                return commSettingList;
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg, e);
                throw new Exception(e.mErrmsg);
            }
            catch (Exception e)
            {
                logger.Error(e.Message, e);
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(_LabelLightGuide)getCommSetting end, hostname:" + hostname);
            }
        }