public ScannerHeandler(InitModel init, MainView view)
 {
     this.init = init;
     this.view = view;
     if (init.configHandler.SerialPort != "" && init.configHandler.SerialPort != null)
     {
         serialPort           = new SerialPort();
         serialPort.PortName  = init.configHandler.SerialPort;
         serialPort.BaudRate  = int.Parse(init.configHandler.BaudRate);
         serialPort.Parity    = (Parity)int.Parse(init.configHandler.Parity);
         serialPort.StopBits  = (StopBits)1;
         serialPort.Handshake = Handshake.None;
         serialPort.DataBits  = int.Parse(init.configHandler.DataBits);
         serialPort.NewLine   = "\r";
     }
     if (init.configHandler.DataOutputInterface == "COM")
     {
         outputSP           = new SerialPort();
         outputSP.PortName  = init.configHandler.OutSerialPort;
         outputSP.BaudRate  = int.Parse(init.configHandler.OutBaudRate);
         outputSP.Parity    = (Parity)int.Parse(init.configHandler.OutParity);
         outputSP.StopBits  = (StopBits)1;
         outputSP.Handshake = Handshake.None;
         outputSP.DataBits  = int.Parse(init.configHandler.OutDataBits);
         outputSP.NewLine   = "\r";
     }
 }
示例#2
0
        public ScannerHeandler(InitModel init, MainView view)
        {
            this.init = init;
            this.view = view;
            if (init.configHandler.SerialPort != "" && init.configHandler.SerialPort != null)
            {
                serialPort           = new SerialPort();
                serialPort.PortName  = init.configHandler.SerialPort;
                serialPort.BaudRate  = int.Parse(init.configHandler.BaudRate);
                serialPort.Parity    = (Parity)int.Parse(init.configHandler.Parity);
                serialPort.StopBits  = (StopBits)1;
                serialPort.Handshake = Handshake.None;
                serialPort.DataBits  = int.Parse(init.configHandler.DataBits);
                serialPort.NewLine   = "\r";
            }

            if (init.configHandler.IOSerialPort != "" && init.configHandler.IOSerialPort != null)
            {
                IOserialPort           = new SerialPort();
                IOserialPort.PortName  = init.configHandler.IOSerialPort;
                IOserialPort.BaudRate  = int.Parse(init.configHandler.IOBaudRate);
                IOserialPort.Parity    = (Parity)int.Parse(init.configHandler.IOParity);
                IOserialPort.StopBits  = (StopBits)1;
                IOserialPort.Handshake = Handshake.None;
                IOserialPort.DataBits  = int.Parse(init.configHandler.IODataBits);
                IOserialPort.NewLine   = "\r";
            }
        }
示例#3
0
        private void OpenLogInCOM()
        {
            initModel = new InitModel();
            try
            {
                initModel.configHandler = config;
            }
            catch
            {
                LogHelper.Error("Config error.");
            }

            try
            {
                if (config.LogInType == "COM")
                {
                    initModel.scannerHandler = new ScannerHeandler(initModel, view);
                    initModel.scannerHandler.handler().DataReceived += new SerialDataReceivedEventHandler(LogInDataRecivedHeandler);
                    initModel.scannerHandler.handler().Open();
                }
            }
            catch
            {
                SetStatusLabelText("COM打开异常", 1);
                LogHelper.Error("COM打开异常");
            }
        }
示例#4
0
        public InitModel Initialize()
        {
            initModel = new InitModel();

            try
            {
                initModel.configHandler = config;
                initModel.lang          = lang;
            }
            catch
            {
                view.errorHandler(2, lang.ERROR_CONFIG_ERROR, lang.ERROR_CONFIG_ERROR);
                isInitializeSucces = false;
            }

            if (isInitializeSucces)
            {
                view.errorHandler(0, initModel.lang.ERROR_INITIALIZE_SUCCESS, initModel.lang.ERROR_INITIALIZE_SUCCESS);
                view.SetStatusLabelText(initModel.lang.ERROR_INITIALIZE_SUCCESS);
            }
            else
            {
                view.errorHandler(3, initModel.lang.ERROR_INITIALIZE_ERROR, initModel.lang.ERROR_INITIALIZE_ERROR);
                view.SetStatusLabelText(initModel.lang.ERROR_INITIALIZE_ERROR);
            }

            return(initModel);
        }
示例#5
0
        private void PassConnectionToForm <T>(T connection, InitModel model) where T : Tcp
        {
            HobbyToFormModel <T> .TcpConnection = connection;
            HobbyToFormModel <T> .InitModel     = model;

            Form1.Form.SetConnection(connection);
            Close();
        }
示例#6
0
    void Awake()
    {
        this.m_Model = new InitModel();

        Btn_Start = transform.Find("Btn_Start").gameObject.GetComponent <Button> ();
        Btn_Video = transform.Find("Btn_Video").gameObject.GetComponent <Button> ();
        Btn_Quit  = transform.Find("Btn_Quit").gameObject.GetComponent <Button> ();
    }
示例#7
0
        public InitUi(InitModel model)
        {
            Logger.PageView("Init");

            this.model = model;
            InitializeComponent();
            DataContext = model;
        }
 public PosGraghicsForm(MainView mv1, IMSApiSessionContextStruct _sessionContext, InitModel _init, string _partnumber, string _processlayer)
 {
     InitializeComponent();
     mv             = mv1;
     sessionContext = _sessionContext;
     init           = _init;
     partnumber     = _partnumber;
     processlayer   = _processlayer;
 }
示例#9
0
        public void AddItem(InitModel result)
        {
            if (_tokensDiscovered.Contains(result.Token))
            {
                return;
            }

            _tokensDiscovered.Add(result.Token);
            listBoxServersList.Items.Add(result);
        }
        public GitFlowInitSection()
        {
            try
            {
                model          = new InitModel(this);
                Title          = "Recommended actions";
                SectionContent = new InitUi(model);

                UpdateVisibleState();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
示例#11
0
        public static void GetInitModel(int id, string field, ref InitModel initModel, ref List <Dict_SystemModel> listDict_SystemModel)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(string.Format(" declare @TempID int = {0} ", id));
            sb.Append(string.Format(" declare @FieldName varchar(50) = '{0}' ", field));
            sb.Append(string.Format(" declare @DictID int = -1 "));
            sb.Append(@" select top 1 * from Search_Template_Detail where TempID = @TempID and FieldName = @FieldName ");
            sb.Append(@" select @DictID=DictID from Search_Template_Detail where TempID = @TempID and FieldName = @FieldName ");
            sb.Append(@" select * from Dict_System where PID=@DictID ");
            DataAccess ac = new DataAccess(DataAccessDB.XCCloudDB);
            DataSet    ds = ac.ExecuteQuery(sb.ToString());

            initModel            = Utils.GetModelList <InitModel>(ds.Tables[0]).FirstOrDefault();
            listDict_SystemModel = Utils.GetModelList <Dict_SystemModel>(ds.Tables[1]);
        }
示例#12
0
        private async void buttonConnect_Click(object sender, EventArgs e)
        {
            InitModel joueur2 = listBoxServersList.SelectedItem as InitModel;

            if (joueur2 == null)
            {
                MessageBox.Show(@"Veuillez sélectionner un serveur.");
                return;
            }

            _clientBroadcastServer.EndBroadcast();             // ferme les req broadcast

            // démarre le client tcp
            ClientTcpController client = new ClientTcpController();
            await client.ConnectAsync(new IPEndPoint(Reseau.Reseau.GetLocalIpAddress(), 32430));

            PassConnectionToForm(client, GetInitModel(_clientBroadcastServer.Udp.Token));
        }
示例#13
0
        public LogoutForm(string userName, MainView _view, InitModel _init, IMSApiSessionContextStruct _sessionContext)
        {
            InitializeComponent();
            sessionContext        = _sessionContext;
            this.txtUserName.Text = userName;
            view = _view;
            init = _init;
            SetControlStatus(false);
            this.progressBar1.Value   = 0;
            this.progressBar1.Maximum = 100;
            this.progressBar1.Step    = 1;

            this.timer1.Interval = 100;
            this.timer1.Tick    += new EventHandler(timer_Tick);

            backgroundWorker1.WorkerReportsProgress = true;
            backgroundWorker1.DoWork             += new DoWorkEventHandler(worker_DoWork);
            backgroundWorker1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
        }
示例#14
0
        public IActionResult Init()
        {
            HomeInfo home = new HomeInfo()
            {
                Title = "主页", Icon = "layui-icon layui-icon-home", Href = Url.Action("Dashboard")
            };
            LogoInfo logo = new LogoInfo()
            {
                Title = "OSHARP", Image = "/images/logo.png", Href = Url.Action("Index")
            };
            List <MenuInfo> menus = GetMenuInfos();
            InitModel       model = new InitModel()
            {
                HomeInfo = home, LogoInfo = logo, MenuInfo = menus
            };

            return(Json(model, new JsonSerializerSettings()
            {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            }));
        }
        //public DateTime GetServerDateTime()
        //{
        //    var calendarDataResultKeys = new string[] { "CURRENT_TIME_MILLIS" };
        //    var calendarDataResultValues = new string[] { };
        //    int error = imsapi.mdataGetCalendarData(sessionContext, init.configHandler.StationNumber, calendarDataResultKeys, out calendarDataResultValues);
        //    if (error != 0)
        //    {
        //        LogHelper.Info("API mdataGetCalendarData error code = " + error);
        //        return DateTime.Now;
        //    }
        //    long numer = long.Parse(calendarDataResultValues[0]);
        //    DateTime start = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
        //    DateTime date = start.AddMilliseconds(numer).ToLocalTime();
        //    return date;
        //}

        public static string GetZHSErrorString(int iErrorCode, InitModel _init, IMSApiSessionContextStruct _sessionContext)
        {
            string errorString = "";

            if (_init.configHandler.Language == "US")
            {
                imsapi.imsapiGetErrorText(sessionContext, iErrorCode, out errorString);
            }
            else
            {
                if (_init.ErrorCodeZHS.ContainsKey(iErrorCode))
                {
                    errorString = _init.ErrorCodeZHS[iErrorCode];
                }
                else
                {
                    imsapi.imsapiGetErrorText(sessionContext, iErrorCode, out errorString);
                }
            }

            return(errorString);
        }
示例#16
0
        public InitModel getModel()
        {
            var model = new InitModel();

            // this guy is not in use
            //
            model.sqlDesignText     = @"-- Remove the sample code below and copy/paste yours
* e:Trip d:DevCode hform:2
TripId	int	Unchecked
TripDate	datetime	Unchecked ? DP
--AirportId	int	Unchecked l:Airport c:TA s:ArptLookup
AirportId	int	Unchecked label:Airport control:comp service:arpt-lookup ref:1
TransTypeId	int	Unchecked lbl:Trans_Mode s:TransTypeDesc
GroupName	varchar(50)	Unchecked col:8
GroupSize	int	Unchecked
Active	    bit	Unchecked
Note	    varchar(256)	Checked  c:textarea
* control:AirportLookup type:TA
";
            model.lookupControltext = "* control:AirportLookup type:TA";

            return(model);
        }
示例#17
0
 public UploadProcessResult(IMSApiSessionContextStruct sessionContext, InitModel init, MainView view)
 {
     this.sessionContext = sessionContext;
     this.init           = init;
     this.view           = view;
 }
示例#18
0
 public MergeManger(IMSApiSessionContextStruct sessionContext, InitModel init, MainView view)
 {
     this.sessionContext = sessionContext;
     this.init           = init;
     this.view           = view;
 }
 public GetNumbersOfSingleBoards(IMSApiSessionContextStruct sessionContext, InitModel init, MainView view)
 {
     this.sessionContext = sessionContext;
     this.init           = init;
     this.view           = view;
 }
示例#20
0
 public CommonFunction(IMSApiSessionContextStruct sessionContext, InitModel init, MainView view)
 {
     this.sessionContext = sessionContext;
     this.init           = init;
     this.view           = view;
 }
 public UploadResultDataRecipe(IMSApiSessionContextStruct sessionContext, InitModel init, MainView view)
 {
     this.sessionContext = sessionContext;
     this.init           = init;
     this.view           = view;
 }
示例#22
0
        private InitModel GetInitModel(IEnumerable <ReportModel> reportDataList, string reportType, bool isRandomData)
        {
            string jsonResult = ReadJsonFromFile("~\\JsonData\\russian-regions-code.json");
            var    jTokenList = JObject.Parse(jsonResult).Children().ToList();

            List <dynamic> mapModelGeoList = new List <dynamic>();
            Random         r = new Random();

            foreach (var jToken in jTokenList)
            {
                JProperty jprop       = jToken.ToObject <JProperty>();
                var       SubjectCode = default(int);
                try
                {
                    SubjectCode = (int)jToken.First["1"];
                }
                catch (Exception)
                {
                    //
                }
                var SubjectName        = jprop.Name;
                var SubjectCoordinates = jToken.First["0"].ToString(); //try to Object

                var ReportData = default(dynamic);
                switch (reportType.ToLower())
                {
                case "projectcount":
                    ReportData = new { ProjectCount = GetProjectCount(reportDataList, SubjectCode) };
                    break;

                case "productreadiness":
                    ReportData = new { ProductReadiness = GetProductReadiness(reportDataList, SubjectCode) };

                    break;

                case "successstory":
                    ReportData = GetSuccessStory(reportDataList, SubjectCode);
                    break;

                case "risks":
                    ReportData = GetProjectRisks(reportDataList, SubjectCode);
                    break;

                case "deadlines":
                    ReportData = GetProjectDeadlines(reportDataList, SubjectCode);
                    break;

                default:
                    break;
                }

                mapModelGeoList.Add(new
                {
                    SubjectCode,
                    SubjectName,
                    SubjectCoordinates,
                    ReportData
                });
            }

            var initModel = new InitModel()
            {
                MapModels = mapModelGeoList, ProductCatalog = getProductCatalog(), ReportType = reportType
            };

            return(initModel);
        }
 public BaseRepository()
 {
     this.dbCntx = dbCntx ?? new InitModel();
 }
 public UtilityFunction(IMSApiSessionContextStruct _sessionContext, InitModel _init, MainView view)
 {
     sessionContext = _sessionContext;
     init           = _init;
     this.view      = view;
 }
示例#25
0
        public InitModel Initialize()
        {
            initModel = new InitModel();

            try
            {
                initModel.configHandler = config;
                initModel.lang          = lang;
            }
            catch
            {
                view.errorHandler(2, "Config error.", "");
                isInitializeSucces = false;
            }

            try
            {
                if (config.ScanSNType != "PFC")//config.IsMaterialSetup=="Y"||config.IsEquipSetup=="Y"
                {
                    initModel.scannerHandler = new ScannerHeandler(initModel, view);
                    initModel.scannerHandler.handler().DataReceived += new SerialDataReceivedEventHandler(view.DataRecivedHeandler);
                    initModel.scannerHandler.handler().Open();
                    view.errorHandler(0, lang.ERROR_SCANNER_PORT_OPEN, "");
                }
                if (config.DataOutputInterface == "COM" && config.OutSerialPort != "" && config.OutSerialPort != null)
                {
                    initModel.scannerHandler.OutputCOM().Open();
                    view.errorHandler(0, lang.ERROR_SCANNER_PORT_OPEN, "");
                }
            }
            catch (Exception e)
            {
                view.errorHandler(2, lang.ERROR_SCANNER_PORT_CLOSE, "");
                isInitializeSucces = false;
                LogHelper.Error(e.Message);
            }

            if (isInitializeSucces)
            {
                try
                {
                    //GetCurrentWorkorder currentWorkorder = new GetCurrentWorkorder(sessionContext, initModel, view);
                    //initModel.currentSettings = currentWorkorder.GetCurrentWorkorderResultCall();
                }
                catch (Exception ex)
                {
                    view.errorHandler(2, "current setting error", "current setting error");
                    isInitializeSucces = false;
                    LogHelper.Error(ex.Message);
                }
            }

            if (initModel.currentSettings != null)
            {
                try
                {
                    GetNumbersOfSingleBoards getNumBoard = new GetNumbersOfSingleBoards(sessionContext, initModel, view);
                    List <MdataGetPartData>  listData    = getNumBoard.GetNumbersOfSingleBoardsResultCall(initModel.currentSettings.partNumber);
                    if (listData != null && listData.Count > 0)
                    {
                        MdataGetPartData mData = listData[0];
                        initModel.numberOfSingleBoards = mData.quantityMultipleBoard;
                    }
                }
                catch (Exception ex)
                {
                    view.errorHandler(2, "current setting error", "current setting error");
                    isInitializeSucces = false;
                    LogHelper.Error(ex.Message);
                }

                try
                {
                    switch (initModel.currentSettings.getError)
                    {
                    case 0:
                        view.Invoke(new MethodInvoker(delegate
                        {
                            view.getFieldPartNumber().Text = initModel.currentSettings.partNumber;
                            view.getFieldWorkorder().Text  = initModel.currentSettings.workorderNumber;
                        }));
                        break;

                    default:
                        isInitializeSucces = false;
                        return(initModel);
                    }
                }
                catch
                {
                    view.errorHandler(2, "Station Setting Error.", "");
                    isInitializeSucces = false;
                    return(initModel);
                }
            }
            //read error code ZHS from excel
            try
            {
                string[] LineList = File.ReadAllLines(@"ErrorCodeZH.csv", Encoding.Default);
                Dictionary <int, string> dicErrorCodeMapping = new Dictionary <int, string>();
                if (LineList == null || LineList.Length == 0)
                {
                }
                else
                {
                    for (int i = 1; i < LineList.Length; i++)
                    {
                        string   linecontent = LineList[i].Trim();
                        string[] linegroups  = linecontent.Split(new char[] { ',' });
                        int      iErrorCode  = Convert.ToInt32(linegroups[0].Trim());
                        string   strECDesc   = linegroups[2].ToString();
                        if (!dicErrorCodeMapping.ContainsKey(iErrorCode))
                        {
                            dicErrorCodeMapping[iErrorCode] = strECDesc;
                        }
                    }
                }
                initModel.ErrorCodeZHS = dicErrorCodeMapping;
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
                isInitializeSucces = false;
            }
            if (isInitializeSucces)
            {
                view.errorHandler(0, view.message(initModel.lang.ERROR_INITIALIZE_SUCCESS), initModel.lang.ERROR_INITIALIZE_SUCCESS);
                view.SetStatusLabelText(view.message(initModel.lang.ERROR_INITIALIZE_SUCCESS));
            }
            else
            {
                view.errorHandler(3, view.message(initModel.lang.ERROR_INITIALIZE_ERROR), initModel.lang.ERROR_INITIALIZE_ERROR);
                view.SetStatusLabelText(view.message(initModel.lang.ERROR_INITIALIZE_ERROR));
            }

            #region add by qy
            switch (config.Language)
            {
            case "US":
                SystemVariable.CurrentLangaugeCode = LanguageType.English;
                break;

            case "ZHS":
                SystemVariable.CurrentLangaugeCode = LanguageType.SimplifiedChinese;
                break;

            case "ZHT":
                SystemVariable.CurrentLangaugeCode = LanguageType.TraditionalChinese;
                break;

            default:
                break;
            }
            if (config.IsListenerFolder == "1")
            {
                ListenerFolder(config.LogFileFolder);
            }
            #endregion
            return(initModel);
        }
示例#26
0
 public ActivateWorkorder(IMSApiSessionContextStruct sessionContext, InitModel init, MainView view)
 {
     this.sessionContext = sessionContext;
     this.init           = init;
     this.view           = view;
 }
 public RemoveAttributeValue(IMSApiSessionContextStruct sessionContext, InitModel init, MainView view)
 {
     this.sessionContext = sessionContext;
     this.init           = init;
     this.view           = view;
 }
示例#28
0
 public GetNextSerialNumber(IMSApiSessionContextStruct sessionContext, InitModel init, MainView view)
 {
     this.sessionContext = sessionContext;
     this.init           = init;
     this.view           = view;
 }
 public GetMaterialBinData(IMSApiSessionContextStruct sessionContext, InitModel init, MainView view)
 {
     this.sessionContext = sessionContext;
     this.init           = init;
     this.view           = view;
 }
示例#30
0
 public GetMachineStructrue(IMSApiSessionContextStruct sessionContext, InitModel init, MainView view)
 {
     this.sessionContext = sessionContext;
     this.init           = init;
     this.view           = view;
 }