コード例 #1
0
        public ActionResult Login(string username, string password)
        {
            if (ModelState.IsValid)
            {
                string pass = Encript.MD5Hash(password);

                var obj  = db.Administrators.Where(a => a.Username.Equals(username) && a.Password.Equals(pass) && a.Role.Equals("Admin")).FirstOrDefault();
                var obj1 = db.Administrators.Where(a => a.Username.Equals(username) && a.Password.Equals(pass) && a.Role.Equals("Manager")).FirstOrDefault();

                if (obj != null)
                {
                    Session["Admin"] = obj.Username.ToString();
                    ////Session["IAdmin"] = obj.image;
                    return(RedirectToAction("Index"));
                }
                if (obj1 != null)
                {
                    Session["Manager"] = obj1.Username.ToString();

                    return(RedirectToAction("Index", "Manager"));
                }
            }
            ViewBag.Error = "Wrong username or password, try again.";

            return(View("Login"));
        }
コード例 #2
0
        public async Task <IActionResult> Login(LoginDto loginDto)
        {
            try
            {
                var _user = await UserRepository.VerifyAcessAsync(Encript.HashValue(loginDto.Password), loginDto.LoginUser);

                if (_user != null)
                {
                    var result = LoginResult(_user);

                    if (result.StatusCode != 200)
                    {
                        return(result);
                    }

                    var userView = Mapper.Map <UserViewDto>(_user);

                    userView.Date = GetDateTimeZoneUser(userView.Date).Value;
                    return(Ok(new
                    {
                        user = userView,
                        token = result.Value
                    }));
                }

                return(Unauthorized("Usuário ou senha inválido"));
            }
            catch (Exception ex)
            {
                return(ErrorException(ex, nameof(Login)));
            }
        }
コード例 #3
0
        ///<summary>
        /// 修改节点
        ///</summary>
        private void UpdateXmlNode(hyProcess process)
        {
            //xmlDoc = new XmlDocument();
            //xmlDoc.Load("hyProcess.xml"); // 加载xml文件
            // 获取processgroup节点的所有子节点
            XmlNodeList xnl2 = xmlDoc.SelectSingleNode("processgroup").ChildNodes;

            // 遍历所有子节点
            foreach (XmlNode xn2 in xnl2)
            {
                XmlElement xe2 = (XmlElement)xn2;                                          // 将子节点类型转换为XmlElement类型

                if (Convert.ToInt32(xe2.GetAttribute("process_id")) == process.process_id) // 工艺ID 是否能够匹配上,工艺ID自动生成。
                {
                    xe2.SetAttribute("process_name", process.process_name.ToString());     // 工艺名称

                    // 循环修改station
                    XmlNodeList xnl3  = xe2.ChildNodes;
                    int         index = 0;
                    foreach (XmlNode xn3 in xnl3)
                    {//staion
                        XmlElement xe3 = (XmlElement)xn3;
                        index = Convert.ToInt32(xe3.GetAttribute("station_id"));
                        xe3.ChildNodes.Item(0).InnerText = Encript.Encode(process.stationParaList[index].workingTemp.ToString()); // 工作时间// 加密
                        xe3.ChildNodes.Item(1).InnerText = Encript.Encode(process.stationParaList[index].workingTime.ToString()); // 工作温度// 加密
                        xe3.ChildNodes.Item(2).InnerText = Encript.Encode(process.stationParaList[index].formula);                // 配方// 加密
                    }
                    break;
                }
            }

            xmlDoc.Save("hyProcess.xml");//保存。
        }
コード例 #4
0
        /*
         *
         * 在 xml 数据中  追加(插入)数据。
         *
         * */

        private void InsertXmlNode(hyPerson Person)
        {
            /**
             * 插入一个person
             * <person>
             * */
            XmlElement xe1 = xmlDoc.CreateElement("person"); //创建一个﹤person﹥节点

            person_id_max_assigned++;                        // ID
            Person.id = person_id_max_assigned;              // ID

            XmlElement xe2_1 = xmlDoc.CreateElement("id");   // id

            xe2_1.InnerText = Person.id.ToString();
            xe1.AppendChild(xe2_1);
            XmlElement xe2_2 = xmlDoc.CreateElement("name");// id

            xe2_2.InnerText = Person.name.ToString();
            xe1.AppendChild(xe2_2);
            XmlElement xe2_3 = xmlDoc.CreateElement("job_number");// id

            xe2_3.InnerText = Person.job_number.ToString();
            xe1.AppendChild(xe2_3);
            XmlElement xe2_4 = xmlDoc.CreateElement("position");// id

            xe2_4.InnerText = Person.position.ToString();
            xe1.AppendChild(xe2_4);
            XmlElement xe2_5 = xmlDoc.CreateElement("password");          // id

            xe2_5.InnerText = Encript.Encode(Person.password.ToString()); // 加密
            xe1.AppendChild(xe2_5);

            xroot.AppendChild(xe1);      //添加到﹤Persongroup﹥节点中
            xmlDoc.Save("hyPerson.xml"); //保存其更改
        }
コード例 #5
0
        /*
         *
         * 从 xml 数据中  读取一个已经存在的工作组(N个工作流的组合)
         *
         * */

        private void LoadXml()
        {
            personList = new List <hyPerson>();// 创建工作流列表

            xmlDoc = new XmlDocument();
            xmlDoc.Load("hyPerson.xml"); //加载xml文件
            xroot = xmlDoc.SelectSingleNode("persongroup");

            XmlNodeList xnl1 = xroot.ChildNodes;

            foreach (XmlNode xn1 in xnl1)
            {// Person
                // 每一个工作流,都包含关联一个工艺
                // 每个工艺中,都包含了13个station(炉子,水槽)的参数.station para
                hyPerson Person = new hyPerson();

                XmlElement xe1 = (XmlElement)xn1;

                Person.id         = Convert.ToInt32(xe1.ChildNodes.Item(0).InnerText); // id
                Person.name       = xe1.ChildNodes.Item(1).InnerText;                  // 姓名
                Person.job_number = xe1.ChildNodes.Item(2).InnerText;                  // 工号
                Person.position   = xe1.ChildNodes.Item(3).InnerText;                  // 岗位
                Person.password   = Encript.Decode(xe1.ChildNodes.Item(4).InnerText);  // 密码//加密

                person_id_max_assigned = Math.Max(Person.id, person_id_max_assigned);

                personList.Add(Person);
            }
        }
コード例 #6
0
        ///<summary>
        /// 修改节点
        ///</summary>
        private void UpdateXmlNode(hyPerson Person)
        {
            //xmlDoc = new XmlDocument();
            //xmlDoc.Load("hyPerson.xml"); // 加载xml文件
            // 获取Persongroup节点的所有子节点
            XmlNodeList xnl2 = xmlDoc.SelectSingleNode("persongroup").ChildNodes;

            // 遍历所有子节点
            foreach (XmlNode xn2 in xnl2)
            {
                XmlElement xe2 = (XmlElement)xn2; // 将子节点类型转换为XmlElement类型

                if (Convert.ToInt32(xe2.ChildNodes.Item(0).InnerText) == Person.id)
                {
                    xe2.ChildNodes.Item(1).InnerText = Person.name;                     //
                    xe2.ChildNodes.Item(2).InnerText = Person.job_number;               //
                    xe2.ChildNodes.Item(3).InnerText = Person.position;                 //
                    xe2.ChildNodes.Item(4).InnerText = Encript.Encode(Person.password); // 加密

                    break;
                }
            }

            xmlDoc.Save("hyPerson.xml");//保存。
        }
コード例 #7
0
        public async Task <JsonResult <LoginResponse> > SignIn(LoginRequest loginRequest)
        {
            User user = new User();

            user = await _unitOfWork.UserRepository
                   .Find(x => x.Email.Equals(loginRequest.Email))
                   .FirstOrDefaultAsync();

            string pass = Encript.EncriptText("123456");

            if (user is null || user.IsActive == false)
            {
                return(new JsonResult <LoginResponse>(false, null, "The user doesn't exist", 1));
            }
            if (user.Password.Trim() != Encript.EncriptText(loginRequest.Password.Trim()))
            {
                return(new JsonResult <LoginResponse>(false, null, "Wrong Password", 2));
            }
            var token = await _jWTFactory.GetJWT(loginRequest.Email);

            var loginResponse = _mapper.Map <User, LoginResponse>(user);

            loginResponse.Token = token;
            return(new JsonResult <LoginResponse>(true, loginResponse, "Success", 0));
        }
コード例 #8
0
        /*
         *
         * 从 xml 数据中  读取一个已经存在的工作组(N个工作流的组合)
         *
         * */

        private void LoadXml()
        {
            processList = new List <hyProcess>();// 创建工作流列表

            xmlDoc = new XmlDocument();
            xmlDoc.Load("hyProcess.xml"); //加载xml文件
            xroot = xmlDoc.SelectSingleNode("processgroup");

            XmlNodeList xnl1 = xroot.ChildNodes;

            foreach (XmlNode xn1 in xnl1)
            {// process
                // 每一个工作流,都包含关联一个工艺
                // 每个工艺中,都包含了13个station(炉子,水槽)的参数.station para
                hyProcess process = new hyProcess();

                XmlElement xe1 = (XmlElement)xn1;
                process.process_id      = Convert.ToInt32(xe1.GetAttribute("process_id"));       // 工艺ID
                process.process_name    = xe1.GetAttribute("process_name");                      // 工艺名称
                process_id_max_assigned = Math.Max(process_id_max_assigned, process.process_id); // 已经分配的最大process_id

                XmlNodeList xnl2  = xe1.ChildNodes;
                int         index = 0;
                foreach (XmlNode xn2 in xnl2)
                {//staion
                    XmlElement xe2 = (XmlElement)xn2;
                    index = Convert.ToInt32(xe2.GetAttribute("station_id"));
                    process.stationParaList[index].workingTemp = Convert.ToInt32(Encript.Decode(xe2.ChildNodes.Item(0).InnerText)); // 工作温度// 加密
                    process.stationParaList[index].workingTime = Convert.ToInt32(Encript.Decode(xe2.ChildNodes.Item(1).InnerText)); // 工作时间// 加密
                    process.stationParaList[index].formula     = Encript.Decode(xe2.ChildNodes.Item(2).InnerText);                  // 配方// 加密
                }
                processList.Add(process);
            }
        }
コード例 #9
0
        public async Task <IActionResult> CambiarPassword([FromBody] CambiarPasswordDTO cambiarPasswordDTO)
        {
            try
            {
                ClaimsIdentity identity    = HttpContext.User.Identity as ClaimsIdentity;
                int            idUsuario   = JwtConfigurator.GetTokenIdUsuario(identity);
                string         oldPassword = Encript.EncriptText(cambiarPasswordDTO.oldPassword);

                Usuario usuario = await _usuarioService.ValidaPassword(idUsuario, oldPassword);

                if (usuario == null)
                {
                    return(BadRequest(new { message = $"El password no es correcto" }));
                }
                else
                {
                    usuario.Password = Encript.EncriptText(cambiarPasswordDTO.newPassword);

                    await _usuarioService.UpdatePassword(usuario);

                    return(Ok(new { message = "El password se cambió con éxito" }));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
コード例 #10
0
        public async Task <IActionResult> Register(UserInsertDto userInsertDto)
        {
            try
            {
                var user = Mapper.Map <User>(userInsertDto);

                user.NextPasswordUpdate = DateTimeOffset.UtcNow.AddDays(15).DateTime;
                user.Password           = Encript.HashValue(user.Password);
                user.Date = DateTimeOffset.UtcNow.Date;

                if (await UserRepository.AddAsync(user))
                {
                    var userToReturn = Mapper.Map <UserViewDto>(user);
                    userToReturn.Date = GetDateTimeZoneUser(userToReturn.Date).Value;
                    return(Created(string.Empty, userToReturn));
                }
                else
                {
                    return(BadRequest("Não foi possível concluir o seu registro, por favor tente novamente em alguns instantes"));
                }
            }
            catch (Exception ex)
            {
                return(ErrorException(ex, nameof(Register)));
            }
        }
コード例 #11
0
        public UserProfile()
        {
            CreateMap <User, LoginResponse>()
            .ForMember(l => l.Username, l => l.MapFrom(u => u.Username));

            CreateMap <SignUpRequest, User>()
            .ForMember(u => u.Username, s => s.MapFrom(s => s.Username))
            .ForMember(u => u.Password, s => s.MapFrom(s => Encript.EncriptText(s.Password)));
        }
コード例 #12
0
        public async Task <ActionResult <Member> > SetMember(Member newMember)
        {
            newMember.Password = Encript.Encrypt_user(newMember.Password);
            await _db.Members.AddAsync(newMember);

            await _db.SaveChangesAsync();

            return(newMember);
        }
コード例 #13
0
        public Usuario Login(string login, string senha)
        {
            #region Params
            param = new DynamicParameters();
            param.Add("@Login", login);
            param.Add("@Senha", Encript.EncriptData(senha));
            #endregion

            return(Login(Procedures.UsuarioLogin, param));
        }
コード例 #14
0
ファイル: AccesoDatos.cs プロジェクト: ErikZeus/Plantillas
    public static void GuardarElValorDelParametro(string llave, string valor)
    {
        string        key       = Encript.Encriptar(llave);
        string        value     = Encript.Encriptar(valor);
        Configuration webConfig = WebConfigurationManager.OpenWebConfiguration("~");

        webConfig.AppSettings.Settings.Remove(llave);
        webConfig.AppSettings.Settings.Add(llave, value);

        webConfig.Save();
    }
コード例 #15
0
 public MemberController(NarfoContext db)
 {
     _db = db;
     if (!_db.Members.Any())
     {
         Member newMember = new Member();
         newMember.LastName  = "admin";
         newMember.Username  = "******";
         newMember.FirstName = "admin";
         newMember.Password  = Encript.Encrypt_user("admin");
         _db.Members.AddAsync(newMember);
         _db.SaveChanges();
     }
 }
コード例 #16
0
        public UserResponse Auth(AuthRequest model)
        {
            UserResponse UsrResp = new UserResponse();

            using (var db = new MVC_SEGURIDADContext()) {
                string spwd    = Encript.GetSHA256(model.password);
                var    usuario = db.Usuarios.Where(d => d.Email == model.Email &&
                                                   d.Pwd == spwd).FirstOrDefault();

                if (usuario != null)
                {
                    UsrResp.Email = usuario.Email;
                }
            }
            return(UsrResp);
        }
コード例 #17
0
        /*
         *
         * 在 xml 数据中  追加(插入)数据。
         *
         * */

        private void InsertXmlNode()
        {
            /**
             * 插入一个工作流
             * <workflow>
             * */
            XmlElement xe1 = xmlDoc.CreateElement("workflow");                                 //创建一个﹤workflow﹥节点

            xe1.SetAttribute("workflow_id", currWorkFlow.workflow_id.ToString());              // 工作流ID
            xe1.SetAttribute("process_id", currWorkFlow.process_id.ToString());                // 工艺ID
            xe1.SetAttribute("person_id", currWorkFlow.person_id.ToString());                  // 创建人员ID
            xe1.SetAttribute("carrier_id", currWorkFlow.carrier_id.ToString());                // 夹具ID
            xe1.SetAttribute("carrier_name", currWorkFlow.carrier.name.ToString());            // 夹具名称
            xe1.SetAttribute("carrier_status", ((int)currWorkFlow.carrier.status).ToString()); // 夹具状态
            xe1.SetAttribute("carrier_pos", currWorkFlow.carrier.pos.ToString());              //夹具pos

            /**
             * 循环插入station
             * <station>
             * */
            foreach (hyStationPara stationPara in currWorkFlow.process.stationParaList)
            {
                XmlElement xe2 = xmlDoc.CreateElement("station");
                xe2.SetAttribute("station_id", stationPara.station_id.ToString());// 工位ID

                /**
                 * <working_time>,<workint_temp>,<starting_time>,<ending_time>
                 * */
                XmlElement xe3_1 = xmlDoc.CreateElement("working_time");
                xe3_1.InnerText = Encript.Encode(stationPara.workingTime.ToString());// 工作时间   加密
                xe2.AppendChild(xe3_1);
                XmlElement xe3_2 = xmlDoc.CreateElement("workint_temp");
                xe3_2.InnerText = Encript.Encode(stationPara.workingTemp.ToString());//工作温度  加密
                xe2.AppendChild(xe3_2);
                XmlElement xe3_3 = xmlDoc.CreateElement("starting_time");
                xe3_3.InnerText = Encript.Encode(stationPara.startingTime.ToString());// 开始时间 加密
                xe2.AppendChild(xe3_3);
                XmlElement xe3_4 = xmlDoc.CreateElement("ending_time");
                xe3_4.InnerText = Encript.Encode(stationPara.endingTime.ToString()); // 结束时间 加密
                xe2.AppendChild(xe3_4);                                              //添加到﹤staion﹥节点中

                xe1.AppendChild(xe2);                                                //添加到﹤workflow﹥节点中
            }

            xroot.AppendChild(xe1); //添加到﹤workgroup﹥节点中
            xmlDoc.Save(xmlName);   //保存其更改
        }
コード例 #18
0
        public async Task <IActionResult> Post([FromBody] Usuario usuario)
        {
            try
            {
                if (await _usuarioService.ValidaExistencia(usuario))
                {
                    return(BadRequest(new { message = $"El usuario {usuario.NombreUsuario} ya está registrado" }));
                }

                usuario.Password = Encript.EncriptText(usuario.Password);
                await _usuarioService.SaveUser(usuario);

                return(Ok(new{ message = "Usuario registrado con éxito" }));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
コード例 #19
0
ファイル: UserService.cs プロジェクト: GPDevelop/TodoListApi
        public UserResponseSvr Auth(AuthRequest model)
        {
            UserResponseSvr userResponse = new UserResponseSvr();

            using (var db = new TodoListContext()) {
                string spassword = Encript.GetSHA256(model.Password);

                var usuario = db.Usuario.Where(d => d.UserName == model.UserName && d.Password == spassword).FirstOrDefault();

                if (usuario == null)
                {
                    return(null);
                }

                userResponse.userName = usuario.UserName;
                userResponse.token    = GetToken(usuario);
            }

            return(userResponse);
        }
コード例 #20
0
        /*
         *
         * 在 xml 数据中  追加(插入)数据。
         *
         * */

        private void InsertXmlNode(hyProcess process)
        {
            /**
             * 插入一个工作流
             * <workflow>
             * */
            XmlElement xe1 = xmlDoc.CreateElement("process");                  //创建一个﹤workflow﹥节点

            process_id_max_assigned++;                                         // 工艺ID
            process.process_id = process_id_max_assigned;                      // 工艺ID
            xe1.SetAttribute("process_id", process.process_id.ToString());     // 工艺ID
            xe1.SetAttribute("process_name", process.process_name.ToString()); // 工艺名称

            /**
             * 循环插入station
             * <station>
             * */
            foreach (hyStationPara stationPara in process.stationParaList)
            {
                XmlElement xe2 = xmlDoc.CreateElement("station");
                xe2.SetAttribute("station_id", stationPara.station_id.ToString());// 工位ID

                /**
                 * <working_time>,<working_temp>,<starting_time>,<ending_time>
                 * */
                XmlElement xe3_1 = xmlDoc.CreateElement("working_temp");              // 工作温度
                xe3_1.InnerText = Encript.Encode(stationPara.workingTemp.ToString()); // 加密
                xe2.AppendChild(xe3_1);
                XmlElement xe3_2 = xmlDoc.CreateElement("working_time");              // 工作时间
                xe3_2.InnerText = Encript.Encode(stationPara.workingTime.ToString()); // 加密
                xe2.AppendChild(xe3_2);
                XmlElement xe3_3 = xmlDoc.CreateElement("formula");                   // 配方
                xe3_3.InnerText = Encript.Encode(stationPara.formula.ToString());     // 加密
                xe2.AppendChild(xe3_3);                                               //添加到﹤staion﹥节点中

                xe1.AppendChild(xe2);                                                 //添加到﹤process﹥节点中
            }

            xroot.AppendChild(xe1);       //添加到﹤processgroup﹥节点中
            xmlDoc.Save("hyProcess.xml"); //保存其更改
        }
コード例 #21
0
        public UserProfile()
        {
            CreateMap <User, LoginResponse>()
            .ForMember(u => u.Id, l => l.MapFrom(u => u.Id))
            .ForMember(u => u.Name, l => l.MapFrom(u => u.Name))
            .ForMember(u => u.FirstLastName, l => l.MapFrom(u => u.FirstLastName))
            .ForMember(u => u.SecondLastName, l => l.MapFrom(u => u.SecondLastName))
            .ForMember(u => u.Direction, l => l.MapFrom(u => u.Direction))
            .ForMember(u => u.Dni, l => l.MapFrom(u => u.Dni))
            .ForMember(u => u.Email, l => l.MapFrom(u => u.Email))
            .ForMember(u => u.Password, l => l.MapFrom(u => Encript.DesencriptText(u.Password)));

            CreateMap <User, UserResponse>()
            .ForMember(u => u.Id, l => l.MapFrom(u => u.Id))
            .ForMember(u => u.Name, l => l.MapFrom(u => u.Name))
            .ForMember(u => u.FirstLastName, l => l.MapFrom(u => u.FirstLastName))
            .ForMember(u => u.SecondLastName, l => l.MapFrom(u => u.SecondLastName))
            .ForMember(u => u.Direction, l => l.MapFrom(u => u.Direction))
            .ForMember(u => u.Dni, l => l.MapFrom(u => u.Dni))
            .ForMember(u => u.Email, l => l.MapFrom(u => u.Email))
            .ForMember(u => u.Password, l => l.MapFrom(u => Encript.DesencriptText(u.Password)));

            CreateMap <SignUpRequest, User>()
            .ForMember(u => u.Email, u => u.MapFrom(s => s.Email))
            .ForMember(u => u.Password, u => u.MapFrom(s => Encript.EncriptText(s.Password)))
            .ForMember(u => u.Name, u => u.MapFrom(s => s.Name))
            .ForMember(u => u.FirstLastName, u => u.MapFrom(s => s.FirstLastName))
            .ForMember(u => u.SecondLastName, u => u.MapFrom(s => s.SecondLastName));

            CreateMap <UserUpdateRequest, User>()
            .ForMember(u => u.Name, u => u.MapFrom(ur => ur.Name))
            .ForMember(u => u.FirstLastName, u => u.MapFrom(ur => ur.FirstLastName))
            .ForMember(u => u.SecondLastName, u => u.MapFrom(ur => ur.SecondLastName))
            .ForMember(u => u.Email, u => u.MapFrom(ur => ur.Email))
            .ForMember(u => u.Password, u => u.MapFrom(ur => Encript.EncriptText(ur.Password)))
            .ForMember(u => u.Direction, u => u.MapFrom(ur => ur.Direction))
            .ForMember(u => u.Dni, u => u.MapFrom(ur => ur.Dni));
        }
コード例 #22
0
        public async Task <IActionResult> Post([FromBody] Usuario usuario)
        {
            try
            {
                usuario.Password = Encript.EncriptText(usuario.Password);

                Usuario user = await _loginService.ValidaUsuario(usuario);

                if (user == null)
                {
                    return(BadRequest(new { message = $"Usuario o contraseña incorrectos" }));
                }
                else
                {
                    string tokenString = JwtConfigurator.GetToken(user, _configuration);
                    return(Ok(new { token = tokenString }));
                    //return Ok(new { message = $"Sesión iniciada por {usuario.NombreUsuario}" });
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
コード例 #23
0
        /*
         *
         * 从 xml 数据中  读取一个已经存在的工作组(N个工作流的组合)
         *
         * */

        private void LoadXml(string dfname)
        {
            xmlName = dfname;
            xmlDoc  = new XmlDocument();
            xmlDoc.Load(xmlName); //加载xml文件
            xroot = xmlDoc.SelectSingleNode("workgroup");

            XmlNodeList xnl1 = xroot.ChildNodes;

            XmlElement xre     = (XmlElement)xroot;
            string     strTime = xre.GetAttribute("created");

            string[] strTime2 = strTime.Split('/');
            createdTime = new DateTime(Convert.ToInt32(strTime2[0]), Convert.ToInt32(strTime2[1]), Convert.ToInt32(strTime2[2]), Convert.ToInt32(strTime2[3]), Convert.ToInt32(strTime2[4]), 0);//Convert.ToInt32();// 表格创建时间

            foreach (XmlNode xn1 in xnl1)
            {// workflow
                // 每一个工作流,都包含关联一个工艺
                // 每个工艺中,都包含了13个station(炉子,水槽)的参数.station para
                hyWorkFlow workFlow = currWorkFlow = new hyWorkFlow(this);

                XmlElement xe1 = (XmlElement)xn1;
                workFlow.workflow_id = Convert.ToInt32(xe1.GetAttribute("workflow_id"));                           // 工作流ID
                workFlow.process_id  = Convert.ToInt32(xe1.GetAttribute("process_id"));                            // 工艺ID
                workFlow.person_id   = Convert.ToInt32(xe1.GetAttribute("person_id"));                             // 创建人员ID

                workFlow.carrier_id     = Convert.ToInt32(xe1.GetAttribute("carrier_id"));                         // 夹具ID
                workFlow.carrier.name   = Convert.ToInt32(xe1.GetAttribute("carrier_name"));                       // 夹具名称
                workFlow.carrier.status = (hyCarrier.STATUS)(Convert.ToInt32(xe1.GetAttribute("carrier_status"))); // 夹具状态
                workFlow.carrier.pos    = Convert.ToInt32(xe1.GetAttribute("carrier_pos"));                        // 夹具pos

                max_workflow_id_assigned = Math.Max(max_workflow_id_assigned, workFlow.workflow_id);               // 已经分配的最大ID

                XmlNodeList xnl2  = xe1.ChildNodes;
                int         index = 0;
                foreach (XmlNode xn2 in xnl2)
                {//staion
                    XmlElement xe2 = (XmlElement)xn2;
                    index = Convert.ToInt32(xe2.GetAttribute("station_id"));
                    workFlow.process.stationParaList[index].workingTime  = Convert.ToInt32(Encript.Decode(xe2.ChildNodes.Item(0).InnerText)); // 工作时间  加密
                    workFlow.process.stationParaList[index].workingTemp  = Convert.ToInt32(Encript.Decode(xe2.ChildNodes.Item(1).InnerText)); // 工作温度  加密
                    workFlow.process.stationParaList[index].startingTime = Convert.ToInt32(Encript.Decode(xe2.ChildNodes.Item(2).InnerText)); // 起始时间  加密
                    workFlow.process.stationParaList[index].endingTime   = Convert.ToInt32(Encript.Decode(xe2.ChildNodes.Item(3).InnerText)); //结束时间  加密
                                                                                                                                              //
                    if (workFlow.process.stationParaList[index].workingTemp > 0)
                    {
                        switch (index)
                        {
                        case 0:
                            GenericOp.temperature1_1 = (workFlow.process.stationParaList[index].workingTemp);
                            break;

                        case 2:
                            GenericOp.temperature2_1 = (workFlow.process.stationParaList[index].workingTemp);
                            break;

                        case 3:
                            GenericOp.temperature4 = (workFlow.process.stationParaList[index].workingTemp);
                            break;

                        case 4:
                            GenericOp.temperature5 = (workFlow.process.stationParaList[index].workingTemp);
                            break;

                        case 5:
                            GenericOp.temperature6 = (workFlow.process.stationParaList[index].workingTemp);
                            break;

                        case 6:
                            GenericOp.temperature7 = (workFlow.process.stationParaList[index].workingTemp);
                            break;

                        case 9:
                            GenericOp.temperature3_1 = (workFlow.process.stationParaList[index].workingTemp);
                            break;

                        case 10:
                            GenericOp.temperature11 = (workFlow.process.stationParaList[index].workingTemp);
                            break;

                        case 11:
                            GenericOp.temperature12 = (workFlow.process.stationParaList[index].workingTemp);
                            break;

                        default:
                            break;
                        }
                    }
                    if (workFlow.process.stationParaList[index].workingTime != 0)
                    {
                        this.max_station_endingTime[index] = workFlow.process.stationParaList[index].endingTime; // 更新每一行的总结束时间
                        workFlow.max_workflow_endingtime   = workFlow.process.stationParaList[index].endingTime; // 更新总结束时间
                    }
                }
                SerialTemp.commState = SerialTemp.COMM_STATE.IDLE;
                Thread.Sleep(100);
                SerialTemp.commState = SerialTemp.COMM_STATE.IDLE;
                Thread.Sleep(100);
                SerialTemp.commState = SerialTemp.COMM_STATE.IDLE;
                Thread.Sleep(100);
                SerialTemp.commState = SerialTemp.COMM_STATE.IDLE;
                if ((workFlow.carrier.pos >= hyWorkFlow.POS_FIRST_STATION) && (workFlow.carrier_pos <= hyWorkFlow.POS_LAST_STATION))
                {                                                                                                    //  从 POS_LOAD 到 POS_LAST_STATION 都是有endingTime的。
                    workFlow.carrier.endingTime = workFlow.process.stationParaList[workFlow.carrier.pos].endingTime; // 更新carrier结束时间
                }
                if (workFlow.carrier.pos == hyWorkFlow.POS_LOAD)
                {
                    workFlow.carrier.endingTime = workFlow.process.stationParaList[hyWorkFlow.POS_FIRST_STATION].startingTime;
                }
                workFlowList.Add(workFlow);
            }

            UpdateChangeOverTime();     // 更新 换型过度时间
        }