示例#1
0
        private void TransforTool(Tool tool)
        {
            var t = ObjectCopier.DeepCopyByReflect(tool);

            if (t.ToolState.Name != "正常")
            {
                MessageAlert.Alert("当前工具状态不可借出!");
                return;
            }
            //判断重复
            if (ExistBarcode(tool.Barcode))
            {
                return;
            }
            ToolRecord rcd = new ToolRecord()
            {
                ToolId           = t.Id,
                BorrowerId       = Borrower.Id,
                BorrowOperatorId = BorrowOperator.Id,
                BorrowTime       = DateTime.Now,
                ExceptReturnTime = this.ExceptReturnTime,
                Tool             = tool
            };

            ToolRecords.Add(rcd);
        }
示例#2
0
 private bool show()
 {
     try
     {
         PowerList pl = GetPowerList();
         if (pl == null)
         {
             MessageAlert.Alert("没有任何功能权限,无法登陆!");
             return(false);
         }
         list(menu);
         foreach (string s in pl.rolepower)
         {
             foreach (MenuItem m in mll)
             {
                 if (m.Items.Count > 0)
                 {
                     m.IsEnabled = true;
                 }
                 if (s == m.Header.ToString())
                 {
                     m.IsEnabled = true;
                 }
             }
         }
         return(true);
     }
     catch
     {
         return(false);
     }
 }
        void showwrench(Toolinfo t)
        {
            if (t.wrench == null)
            {
                // tbempty();
                return;
            }
            //  this.tb_setvalue.Text = t.wrench.targetvalue.ToString("f1");
            //this.tb_bjb.Text = t.wrench.wrenchCode.ToString();
            this.tb_lc.Text = t.wrench.rangeMin.ToString("f1") + "~" + t.wrench.rangeMax.ToString("f1") + "N.m";
            // this.tb_xh.Text = t.wrench.factory.ToString();
            if (erl == null || erl.Count <= 0)
            {
                MessageAlert.Alert("没有任何扳手误差设置!\n     无法校验!");
                return;
            }
            List <errorrangset> tm = erl.Where(p => p.speciesID == t.wrench.species).ToList();

            foreach (errorrangset e in tm)
            {
                if (e.rangmax > t.wrench.targetvalue && e.rangmin <= t.wrench.targetvalue)
                {
                    this.tb_jywm.Text = e.errorrangMax.ToString();
                    this.tb_jyw.Text  = e.errorrangMin.ToString();
                }
            }
            this.lb_status.Content = "工具信息获取成功!";
        }
示例#4
0
        private void add_Click(object sender, RoutedEventArgs e)
        {
            var c = tvProperties.SelectedItem as PropertyNodeItem;

            if (c == null)
            {
                c = new PropertyNodeItem();
                if (MessageAlert.Alter("是否添加顶级部门!"))
                {
                    c.id = 0;
                }
                else
                {
                    MessageAlert.Alert("请选则上级部门");
                    return;
                }
            }


            winDepartment wd = new winDepartment(c.id, c.id, true);

            wd.ShowDialog();
            this.tvProperties.ItemsSource = null;
            lt.TreeLoad();
            this.dataGrid1.ItemsSource = GetDepartmentModel();
        }
示例#5
0
        private void BtLogin_Click(object sender, RoutedEventArgs e)
        {
            if (String.IsNullOrEmpty(this.tb_name.Text.Trim()) || String.IsNullOrEmpty(this.tb_password.Password.Trim()))
            {
                MessageAlert.Alert("用户名或密码不能为空!");
                return;
            }
            userlogin = new UserLogin(this.tb_name.Text.Trim(), this.tb_password.Password.Trim(), null);

            //if ((this.tb_name.Text.Trim() == "QDDL.com" && this.tb_password.Password.Trim() == "!@#$%^&*()"))
            //{
            //    showall();
            //    return;
            //}

            if ((userlogin.emplogin() == 1))
            {
                SystData.userInfo = userlogin._userinfo;
                Main main = new Main(ruc);
                Application.Current.MainWindow = main;
                this.Close();
                main.Show();
            }
            else
            {
                MessageAlert.Alert("登录名或密码错误!\n   登录失败!");
                // _m._userinfo = null;
                return;
            }
        }
示例#6
0
        private async void Delete()
        {
            if (!Global.HasRight("1003"))
            {
                MessageAlert.Alert("权限不足!");
                return;
            }
            if (SelectRecord == null)
            {
                MessageAlert.Alert("请选择要删除的记录!");
                return;
            }
            var confirm = await MessageAlert.Confirm("确定删除此记录?");

            if (!confirm)
            {
                return;
            }
            ToolRecordDao dao = new ToolRecordDao();
            var           rlt = dao.DeleteToolRecord(SelectRecord.Id);

            if (rlt.HasError)
            {
                MessageAlert.Alert(rlt.Msg);
            }
            RefreshList(null);
        }
 wrench getwrench(wrench w)
 {
     try
     {
         w.wrenchCode    = this.tb_wrenchcode.Text.Trim();
         w.wrenchBarCode = this.tb_wrenchbarcode.Text.Trim();
         w.factory       = this.tb_factory.Text.Trim();
         w.rangeMax      = Convert.ToDecimal(this.tb_max.Text.Trim());
         w.rangeMin      = Convert.ToDecimal(this.tb_min.Text.Trim());
         w.comment       = this.tb_com.Text.Trim();
         w.offPset       = this.tb_Pset.Text.Trim();
         w.targetvalue   = Convert.ToDecimal(this.tb_targetvalue.Text.Trim());
         w.targetvalue1  = string.IsNullOrEmpty(this.tb_targetvalue1.Text.Trim()) ? 0 : Convert.ToDecimal(this.tb_targetvalue1.Text.Trim());
         w.targetvalue2  = string.IsNullOrEmpty(this.tb_targetvalue2.Text.Trim()) ? 0 : Convert.ToDecimal(this.tb_targetvalue2.Text.Trim());
         w.species       = (cb_species.SelectedItem as wrenchspecies).id.ToString();
         w.status        = (cb_status.SelectedItem as wrenchstatus).id.ToString();
         w.unit          = "N.m";
         w.createDate    = Convert.ToDateTime(Convert.ToDateTime(this.dp_time.Text.Trim()).ToString("s"));
         w.lastrepair    = Convert.ToDateTime(Convert.ToDateTime(this.dp_time_Copy.Text.Trim()).ToString("s"));
         return(w);
     }
     catch
     {
         MessageAlert.Alert("请输入正确的数字值!");
         return(null);
     }
 }
        private void bt_add_Click(object sender, RoutedEventArgs e)
        {
            if (this.lb_function.SelectedIndex < 0)
            {
                return;
            }
            if (cb_role.SelectedIndex < 0)
            {
                MessageAlert.Alert("请选择要分配的角色");
                return;
            }
            MenuItem mt = this.lb_function.SelectedItem as MenuItem;

            try
            {
                if (lv_havefunctio.Items.Count > 0)
                {
                    if (tempstring.FindIndex(p => p == mt.Header.ToString()) >= 0)
                    {
                        return;
                    }
                }
                tempstring.Add(mt.Header.ToString());
                lv_havefunctio.ItemsSource = null;
                lv_havefunctio.ItemsSource = tempstring;
            }
            catch { }
        }
        void GetWrench(string wrenchbarcode)
        {
            if (borrowuser == null)
            {
                MessageAlert.Alert("没有借用人信息");
                return;
            }
            if (borrowwrenchlist.FindIndex(p => p.wrenchbarcode == wrenchbarcode) >= 0)
            {
                MessageAlert.Alert("不能重复添加!");
                return;
            }

            wrench w = Wrench.selectByBarcode(this.wrenchbarcode.Text.Trim());

            if (w != null)
            {
                borrowwrenchlist.Add(new BorrowWrench()
                {
                    wrenchbarcode = w.wrenchBarCode,
                    wrenchcode    = w.wrenchCode,
                    factory       = w.factory,
                    borrowdate    = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                    userguid      = borrowuser.user.guid,
                    username      = borrowuser.user.username,
                    operatorguid  = SystData.userInfo.user.guid,
                    options       = SystData.userInfo.user.username,
                    wrenchid      = w.id.ToString()
                });
            }
            ShowWrench(w);
            DgBind(borrowwrenchlist);
        }
        bool IsUpdataRepeat(role r)
        {
            GetRole     gr     = new GetRole();
            List <role> rl     = gr.getrole();
            List <role> temprl = rl.FindAll(p => p.roleName == r.roleName);

            foreach (role re in temprl)
            {
                if (re != null && re.guid != r.guid)
                {
                    MessageAlert.Alert("该名称已经存在!");
                    return(true);
                }
            }
            temprl = rl.FindAll(p => p.roleDM == r.roleDM);
            foreach (role re in temprl)
            {
                if (re != null && re.guid != r.guid)
                {
                    MessageAlert.Alert("该编号已经存在!");
                    return(true);
                }
            }
            return(false);
        }
 bool SaveDate()
 {
     if (borrowwrenchlist == null || borrowwrenchlist.Count <= 0)
     {
         MessageAlert.Alert("没有数据");
         return(false);
     }
     try
     {
         foreach (BorrowWrench b in borrowwrenchlist)
         {
             borrow bw = new borrow()
             {
                 WrenchID       = b.wrenchid,
                 borrowUser     = b.userguid,
                 borrowDate     = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                 borrowOperator = b.operatorguid,
                 guid           = Guid.NewGuid().ToString(),
                 is_return      = false
             };
             Borrow.add(bw);
         }
     }
     catch { return(false); }
     return(true);
 }
        private void BtLogin_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(this.pb_name.Password) || string.IsNullOrEmpty(this.pb_password.Password) || string.IsNullOrEmpty(this.pb_qpwd.Password))
            {
                MessageAlert.Warning("请输入必要信息! * 为必填信息"); return;
            }

            if (!SystData.userInfo.user.password.Equals(MD5Encrypt.GetMD5(this.pb_name.Password)))
            {
                MessageAlert.Warning("输入密码和登录密码不匹配!");
                return;
            }
            if (!this.pb_password.Password.Equals(this.pb_qpwd.Password))
            {
                MessageAlert.Warning("新密码和确认密码不一致!");
                return;
            }
            try
            {
                if (_m != null)
                {
                    SystData.userInfo.user.password = MD5Encrypt.GetMD5(this.pb_qpwd.Password);
                    if (User.Update(SystData.userInfo.user))
                    {
                        MessageAlert.Alert("密码更新成功!");
                    }
                    else
                    {
                        MessageAlert.Alert("密码更新失败!");
                    }
                }
            }
            catch (Exception ex) { MessageAlert.Alert(ex.ToString()); }
        }
示例#13
0
        private void del_Click(object sender, RoutedEventArgs e)
        {
            var c = tvProperties.SelectedItem as PropertyNodeItem;

            if (c == null)
            {
                MessageAlert.Alert("请先选择要操作的部门");
                return;
            }

            department d = new department();

            if (c.Children.Count > 0)
            {
                MessageAlert.Alert("该部门存在子部门\n不能删除!");
                return;
            }
            if (MessageAlert.Alter("是否删除!"))
            {
                d = Department.SelectById(c.id.ToString());
                d.delDepartment = true;
                if (Department.Update(d))
                {
                    MessageAlert.Alert("删除成功!");
                }
            }
            lt.TreeLoad();
            this.dataGrid1.ItemsSource = GetDepartmentModel();
        }
示例#14
0
        private async void Delete()
        {
            if (!Global.HasRight("0503"))
            {
                MessageAlert.Alert("权限不足!");
                return;
            }
            if (SelectedRole == null)
            {
                MessageAlert.Alert("请选择要删除的记录!");
                return;
            }
            var confirm = await MessageAlert.Confirm("确定删除此记录?");

            if (!confirm)
            {
                return;
            }
            RoleDao dao = new RoleDao();
            var     rlt = dao.DeleteRole(SelectedRole.Id);

            if (rlt.HasError)
            {
                MessageAlert.Alert(rlt.Msg);
            }
            RefreshList(null);
        }
        private void bt_go_Click(object sender, RoutedEventArgs e)
        {
            this.Cursor = Cursors.Wait;
            if (string.IsNullOrEmpty(this.tb_mbpage.Text))
            {
                return;
            }
            int count = 1;

            try
            {
                count = Convert.ToInt16(this.tb_mbpage.Text.Trim());
            }
            catch
            {
                MessageAlert.Alert("请输入正确的数值!");
                return;
            }
            if (count > 0 && count <= CheckResultSetPage.TotalPage)
            {
                showdata(CheckResultSetPage.targetPage(count));
            }
            CheckResultSetPage.PageNo = count - 1;
            //this.tb_mbpage.Text = "1";
            this.Cursor = Cursors.Arrow;
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            this.Cursor = Cursors.AppStarting;
            if (wrenchchecklist == null || wrenchchecklist.Count <= 0)
            {
                MessageAlert.Alert("没有数据不能导出!");
                this.Cursor = Cursors.Arrow;
                return;
            }
            CheckDataOutExcel     cdoe           = new CheckDataOutExcel();
            SaveFileDialog        saveFileDialog = new SaveFileDialog();
            CheckDataOutExcelHelp _excelHelper   = new CheckDataOutExcelHelp();

            saveFileDialog.Filter = "Excel (*.XLS)|*.xls";
            if ((bool)(saveFileDialog.ShowDialog()))
            {
                try
                {
                    // _excelHelper.SaveToExcel(saveFileDialog.FileName, cdoe.ToTable (wrenchchecklist),"智能扭矩校验数据");


                    _excelHelper.SaveToExcel(saveFileDialog.FileName, cdoe.Header(wrenchchecklist), wrenchchecklist, "智能扭矩校验数据");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("导出失败:" + ex.Message);
                    this.Cursor = Cursors.Arrow;
                    return;
                }
                MessageBox.Show("导出成功");
                this.Cursor = Cursors.Arrow;
            }
        }
示例#17
0
        void savecheckset()
        {
            List <systemcheckset> ls = new List <systemcheckset>();

            try {
                systemcheckset s = new systemcheckset();
                s.throwvalue = Convert.ToDecimal(this.tb_throw.Text.Trim());
                // s.boundaryvalue = Convert.ToDecimal(this.tb_jmax .Text .Trim  ());
                s.count       = Convert.ToInt32(this.tb_jcount.Text.Trim());
                s.arry        = Convert.ToInt32(this.tb_jarry.Text.Trim());
                s.ishavejuser = (this.rb_true.IsChecked == null || this.rb_true.IsChecked == false) ? false : true;
                s.noticeshow  = (this.rb_show.IsChecked == null || this.rb_show.IsChecked == false) ? false : true;
                s.noticetime  = Convert.ToInt32(this.tb_hour.Text.Trim()).ToString("D2") + ":" + Convert.ToInt32(this.tb_min.Text.Trim()).ToString("D2") + ":" + Convert.ToInt32(this.tb_second.Text.Trim()).ToString("D2");
                s.noticedays  = this.tb_day.Text.Trim();
                ls.Add(s);
                if (SerializeXML <systemcheckset> .exit())
                {
                    SerializeXML <systemcheckset> .del();
                }
                SerializeXML <systemcheckset> .SaveList(ls);

                MessageAlert.Alert("设置成功!");
            }

            catch (Exception ex) { MessageAlert.Error("出错!" + ex); }
        }
示例#18
0
        private void delbuttonclick(object sender, RoutedEventArgs e)
        {
            if (this.dataGrid1.SelectedIndex < 0)
            {
                return;
            }


            UserModel um = this.dataGrid1.SelectedItem as UserModel;

            if (um == null || um.guid == null)
            {
                return;
            }
            List <QDDL.Model.UserToRoleModel.usertorole> ut = new List <UserToRoleModel.usertorole>();

            ut = UserToRole.selectbyroleid(um.roleID, um.guid);
            if (ut.Count > 0)
            {
                if (!MessageAlert.Alter("是否删除该人员信息"))
                {
                    return;
                }
                if (UserToRole.delete(ut.FirstOrDefault()))
                {
                    userediter.BindUserModel(dataGrid1);
                    MessageAlert.Alert("删除成功!");
                }
            }
        }
示例#19
0
        public RightSetViewModel()
        {
            //查询角色
            RoleDao roleDao = new RoleDao();
            var     roleRlt = roleDao.GetRoles();

            if (roleRlt.HasError)
            {
                MessageAlert.Alert(roleRlt.Msg);
            }
            else
            {
                Roles = roleRlt.Entities;
            }
            //查询所有权限
            RightDao rightDao = new RightDao();
            var      rightRlt = rightDao.GetRights();

            if (rightRlt.HasError)
            {
                MessageAlert.Alert(rightRlt.Msg);
            }
            else
            {
                Rights = rightRlt.Entities;
            }
        }
示例#20
0
        void GetBycontion(Dictionary <string, string> contion)
        {
            List <wrench> wrenchs = Wrench.selectByContion(contion);

            if (wrenchs == null || wrenchs.Count < 0)
            {
                MessageAlert.Alert("没有该工具信息!");
                return;
            }
            foreach (wrench w in wrenchs)
            {
                if (wrenchRepairList.FindIndex(p => p.wrenchBarCode == w.wrenchBarCode) < 0)
                {
                    ToolModel e = GetToolModel(w);
                    wrenchRepairList.Add
                    (
                        new WrenchRepairBind()
                    {
                        wrenchCode       = e.wrenchCode,
                        wrenchBarCode    = e.wrenchBarCode,
                        wrenchParentName = e.speciesName,
                        isCheck          = true,
                        lastRepair       = e.lastrepair,
                        days             = e.cycletime.ToString("f0"),
                        isNeedCheck      = e.isallowcheck,
                        guid             = e.guid
                    }
                    );
                    // _toolmodellist.Add(e);
                }
            }
            return;
        }
示例#21
0
        void gettester1content()
        {
            TorqueTestModel t = new TorqueTestModel();

            t.testername = this.tb_name.Text.Trim();
            t.portname   = this.cb_name.SelectedItem == null ? "" : this.cb_name.SelectedItem.ToString();
            t.databit    = Convert.ToInt32(this.tb_databit.Text.Trim());
            t.minvalue   = Convert.ToDecimal(this.tb_1min.Text.Trim());
            t.maxvalue   = Convert.ToDecimal(this.tb_1max.Text.Trim());
            t.baundrate  = Convert.ToInt32(this.cb_baundrate.SelectedItem);
            if (ttmlist.FindIndex(p => p.testername == t.testername) >= 0)
            {
                ttmlist.RemoveAt(ttmlist.FindIndex(p => p.testername == t.testername));
            }
            // List<TorqueTestModel> ltt = new List<TorqueTestModel>();
            TorqueTestModel ltt = ttmlist.Find(p => p.testername == "校验仪2");

            if (ltt != null)
            {
                if ((t.maxvalue <= ltt.maxvalue && t.maxvalue > ltt.minvalue) || (t.minvalue < ltt.maxvalue && t.minvalue >= ltt.minvalue))
                {
                    MessageAlert.Alert("校验仪1量程不能与校验仪2量程重合");
                    return;
                }
                if (t.minvalue <= ltt.minvalue && t.maxvalue >= ltt.maxvalue)
                {
                    MessageAlert.Alert("校验仪1量程不能与校验仪2量程重合");
                    return;
                }
            }
            ttmlist.Add(t);
            MessageAlert.Alert("校验仪1设置成功!");
        }
 private void bt_submit_Click(object sender, RoutedEventArgs e)
 {
     if (SaveDate())
     {
         MessageAlert.Alert("借出成功!");
         Clear();
     }
 }
        void saveErrorRang(errorrangset et)
        {
            errorrangset er = new errorrangset();

            er = et;
            try
            {
                er.speciesID    = this.cb_species.SelectedValue.ToString();
                er.speciesname  = (this.cb_species.SelectedItem as wrenchspecies).speciesName;
                er.rangmax      = Convert.ToDecimal(this.tb_max.Text.Trim());
                er.rangmin      = Convert.ToDecimal(this.tb_min.Text.Trim());
                er.errorrangMax = Convert.ToDecimal(this.tb_errormax.Text.Trim());
                er.errorrangMin = Convert.ToDecimal(this.tb_errormin.Text.Trim());
                er.errorrang    = _errorrangset.errorrangMin.ToString() + "~" + _errorrangset.errorrangMax.ToString();
                er.rangvalue    = this.tb_min.Text.Trim() + "~" + this.tb_max.Text.Trim();
            }
            catch
            {
                MessageAlert.Error("请填写正确的数值!"); return;
            }
            if (!string.IsNullOrEmpty(er.guid))
            {
                if (errorset.FindIndex(p => p.guid == er.guid) >= 0)
                {
                    errorset.RemoveAt(errorset.FindIndex(p => p.guid == er.guid));
                }
            }
            else
            {
                er.guid = Guid.NewGuid().ToString();
            }

            List <errorrangset> esl = errorset.FindAll(p => p.speciesname == er.speciesname);

            foreach (errorrangset e in esl)
            {
                if ((e.rangmin < er.rangmax && er.rangmax <= e.rangmax) || (e.rangmin <= er.rangmin && er.rangmin < e.rangmax))
                {
                    MessageAlert.Alert("设置数值范围重合!");
                    return;
                }
                if ((er.rangmax >= e.rangmax) && (er.rangmin <= e.rangmin))
                {
                    MessageAlert.Alert("设置数值范围重合!");
                    return;
                }
            }

            errorset.Add(er);
            if (SerializeXML <errorrangset> .exit())
            {
                SerializeXML <errorrangset> .del();
            }
            SerializeXML <errorrangset> .SaveList(errorset);

            getErrorRanng();
            Clear();
        }
 bool IsEmpty()
 {
     if (string.IsNullOrEmpty(this.tbox_roleName.Text.Trim()) || string.IsNullOrEmpty(this.tbox_dm.Text.Trim()))
     {
         MessageAlert.Alert("请填写必要信息!");
         return(true);
     }
     return(false);
 }
示例#25
0
 bool IsEmpty()
 {
     if (string.IsNullOrEmpty(this.tb_name.Text.Trim()))
     {
         MessageAlert.Alert("部门名称不能为空!");
         return(true);
     }
     return(false);
 }
 private void bt_wrenchbarcode_Click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrEmpty(this.wrenchbarcode.Text.Trim()))
     {
         MessageAlert.Alert("请填写扳手编号");
         return;
     }
     GetWrench(this.wrenchbarcode.Text.Trim());
 }
示例#27
0
 private void Commit()
 {
     if (SelectedTool == null)
     {
         MessageAlert.Alert("请选择工具!");
         return;
     }
     MessengerInstance.Send <Tool>(SelectedTool, MsgToken.TransforTool);
     MessengerInstance.Send <bool>(true, MsgToken.CloseSelectTool);
 }
示例#28
0
 private void Commit()
 {
     if (SelectedUser == null)
     {
         MessageAlert.Alert("请选择用户!");
         return;
     }
     MessengerInstance.Send <User>(SelectedUser, MsgToken.TransforUser);
     MessengerInstance.Send <bool>(true, MsgToken.CloseSelectUser);
 }
 private void Grid_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         this.bt_search_Click(sender, e);
     }
     if (e.Key == Key.B)
     {
         MessageAlert.Alert("BBB");
     }
 }
示例#30
0
        private void Add()
        {
            if (!Global.HasRight("0502"))
            {
                MessageAlert.Alert("权限不足!");
                return;
            }
            Role role = new Role();

            MessengerInstance.Send <object>(role, MsgToken.OpenRoleInfo);
        }