Пример #1
0
        private void mainGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            WT     x      = (WT)mainGrid.SelectedValue;
            string pfSate = string.Empty;

            if (x != null)
            {
                using (jhbEntities ctx = new jhbEntities())
                {
                    List <PF> pfInfo = (from g in ctx.PFs
                                        where g.问题编号 == x.问题编号
                                        orderby g.派发日期 descending
                                        select g).ToList();
                    if (pfInfo.Count() > 0)
                    {
                        PF singlePf = (from g in pfInfo select g).First();
                        g_var.Bar.OtherTip =
                            string.Format("{0}#记录最后一次派发日期:{1}({2})   共派发过{3}次!",
                                          singlePf.问题编号,
                                          singlePf.派发日期.Value.ToString("yyyy年M月d日"),
                                          myFuc.IsthisWeek(singlePf.派发日期.Value),
                                          pfInfo.Count()
                                          );
                    }
                    else
                    {
                        g_var.Bar.OtherTip = "未派发!";
                    }
                }
            }
        }
Пример #2
0
 public xjWin(Int64 wid, string zn)
 {
     InitializeComponent();
     _wt   = new WT();
     _wtid = wid;
     _zn   = zn;
 }
Пример #3
0
        private void MainGrid_del(object sender, RoutedEventArgs e) //主记录删除
        {
            WT xWt = (WT)mainGrid.SelectedValue;

            myFuc.del_rec(xWt.问题编号, "wt");
            mainGrid.ItemsSource = myFuc.LoadWts();
        }
Пример #4
0
        private void MainGrid_xj(object sender, RoutedEventArgs e) // 销记操作
        {
            List <WT> oldItem = mainGrid.ItemsSource as List <WT>;

            if (oldItem == null)
            {
                return;
            }
            WT    xWt  = (WT)mainGrid.SelectedValue;
            xjWin xWin = new xjWin(xWt.问题编号, xWt.站名);

            g_var.Bar.Tip = "正在销记";
            xWin.Owner    = this;
            xWin.ShowDialog();

            if (g_var.g_xj_flag == true)
            {
                g_var.g_xj_flag = false;

                for (int i = 0; i < oldItem.Count(); i++)
                {
                    if (oldItem[i].问题编号 == xWt.问题编号)
                    {
                        oldItem.Remove(oldItem[i]);
                        oldItem.Add(g_var.g_chg_wt);
                    }
                }
                mainGrid.ItemsSource = oldItem;
                mainGrid.Items.Refresh();
            }
        }
Пример #5
0
        //-------主窗事件处理--------------------
        private void MainGrid_Pf(object sender, RoutedEventArgs e) // 派发操作
        {
            List <WT> oldItem = mainGrid.ItemsSource as List <WT>;

            if (oldItem == null)
            {
                return;
            }
            WT xWt = (WT)mainGrid.SelectedValue;

            pfDialog pfwin = new pfDialog(xWt.问题编号, xWt.站名);

            g_var.Bar.Tip = "正在派发";
            pfwin.Owner   = this;
            pfwin.ShowDialog();
            if (g_var.g_pf_flag == true)
            {
                g_var.g_pf_flag = false;

                for (int i = 0; i < oldItem.Count(); i++)
                {
                    if (oldItem[i].问题编号 == xWt.问题编号)
                    {
                        oldItem.Remove(oldItem[i]);
                        oldItem.Insert(i, g_var.g_chg_wt);
                    }
                }
                mainGrid.ItemsSource = oldItem;
                mainGrid.Items.Refresh();
                GridUpdate("pf");
                GridUpdate("tzd");
            }
        }
Пример #6
0
        private void mainGrid_detail(object sender, RoutedEventArgs e)
        {
            WT          xwt   = (WT)mainGrid.SelectedValue;
            detail_show dtail = new detail_show(xwt.问题编号);

            dtail.Owner = this;
            dtail.ShowDialog();
        }
Пример #7
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     using (jhbEntities ctx = new jhbEntities())
     {
         List <string> unit_info = (from g in ctx.WTs where g.站名 == _Zn select g.受理单位).Distinct().ToList();
         List <string> fix_info  = (from g in ctx.WTs where g.站名 == _Zn select g.整改方案).Distinct().ToList();
         pdUnit.ItemsSource  = unit_info.TakeWhile <string>(r => r != string.Empty);
         PlanFix.ItemsSource = fix_info.TakeWhile <string>(r => r != string.Empty);
         //根据编号(唯一)返回一条记录.
         _wt          = (from g in ctx.WTs where g.问题编号 == _Id select g).First();
         pdUnit.Text  = _wt.受理单位;
         PlanFix.Text = _wt.整改方案;
         run_1.Text   = string.Format("设备名称:   {0}", _wt.设备名称);
         run_2.Text   = string.Format("存在问题:   {0}", _wt.存在问题);
         run_3.Text   = string.Format("受理单位:   {0}", _wt.受理单位);
     }
 }
Пример #8
0
        private void wt_insert_new()  //插入新记录
        {
            using (jhbEntities ctx = new jhbEntities())
            {
                WT wt_in = new WT();
                wt_in.站名   = Rec_info.站名.Trim();
                wt_in.设备名称 = Rec_info.设备名称.Trim();
                wt_in.存在问题 = Rec_info.存在问题;
                wt_in.发现时间 = Rec_info.发现时间.Value.Date;
                if (Rec_info.检查人 != null)
                {
                    wt_in.检查人 = Rec_info.检查人.Trim();
                }
                else
                {
                    wt_in.检查人 = string.Empty;
                }

                wt_in.天窗需求 = Rec_info.天窗需求;
                wt_in.严重程度 = Rec_info.严重程度;
                if (Rec_info.受理单位 != null)
                {
                    wt_in.受理单位 = Rec_info.受理单位.Trim();
                }
                else
                {
                    wt_in.设备名称 = string.Empty;
                }
                wt_in.备注       = Rec_info.备注;
                wt_in.销记       = false;
                wt_in.lastEdit = myFuc.getNowDateHashcode();
                wt_in.OpTrack  = "NE";
                ctx.WTs.Add(wt_in);
                ctx.SaveChangesAsync();
                //Console.WriteLine("----插入新记录");
                //ctx.SaveChanges();
            }
        }
Пример #9
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            using (jhbEntities ctx = new jhbEntities())
            {
                _wt = (from g in ctx.WTs
                       where g.问题编号 == _wtid && g.站名 == _zn
                       select g).Single();
                try
                {
                    var tmp_pf = (from g in ctx.PFs
                                  where g.问题编号 == _wtid
                                  orderby g.派发编号 descending
                                  select g);
                    if (tmp_pf.Count() > 0)
                    {
                        _pf = tmp_pf.First();
                    }
                    else
                    {
                        _pf = null;
                    }
                }
                catch (Exception err)
                {
                    Console.WriteLine(err.Message);
                }


                var man = (from g in ctx.WTs
                           where g.站名 == _zn
                           select g.整治负责人).Distinct();
                //Replace("\r", string.Empty).Replace("\n", string.Empty)
                var state = (from g in ctx.WTs where g.站名 == _zn select g.整治情况).Distinct();
                foreach (var ix in man)
                {
                    if (ix != null)
                    {
                        string tx = ix.Replace("\r", string.Empty).Replace("\n", string.Empty);
                        if (tx != string.Empty)
                        {
                            x3man.Add(tx);
                        }
                    }
                }
                foreach (var iy in state)
                {
                    if (iy != null)
                    {
                        string ty = iy.Replace("\r", string.Empty).Replace("\n", string.Empty);
                        if (ty != string.Empty)
                        {
                            x2state.Add(ty);
                        }
                    }
                }
                x3.ItemsSource = x3man.Distinct();
                x2.ItemsSource = x2state.Distinct();
                wtTip.Content  = string.Format("{0}站 => {1}: {2}", _wt.站名, _wt.设备名称, _wt.存在问题);
                if (_pf == null)
                {
                    pfTip.Content = "没有派发信息!";
                }
                else
                {
                    pfTip.Content = string.Format("[{0}]通知 [{1}] 处理.", _pf.派发日期.Value.ToString("yyyy年M月d日"), _pf.受理单位);
                }
            }
        }
Пример #10
0
        private void mainGrid_LoadingRow(object sender, DataGridRowEventArgs e) //主WT 行格式化...
        {
            WT wt = e.Row.DataContext as WT;

            //着色: 1, 最近修改的当天, 显示绿色, 近3天显示淡绿. 发现时间和今天差15天未动的显示红色 销记的显示灰色
            //--- wt.lastEdit.
            DateTime lastEd = DateTime.FromBinary(wt.lastEdit.Value).Date;

            //只介入 上次处理时间和今天比较.... 因为录入时, 就有个处理时间...

            e.Row.Header = wt.OpTrack;
            if (wt.销记 == true)
            {
                e.Row.Background = new SolidColorBrush(Colors.Gray);
            }
            else
            {
                switch (myFuc.diffDays(lastEd, mNow))
                {
                case 0:
                case 1:
                    e.Row.Background = new SolidColorBrush(Colors.Aquamarine);
                    break;

                //case -2:
                //case -3:
                //case -4:
                //case -5:
                //case -6:
                //case -7:
                //    e.Row.Background = new SolidColorBrush(Color.FromRgb(189, 252, 201));
                //    break;
                //case -8:
                //case -9:
                //case -10:
                //case -11:
                //case -12:
                //case -13:
                //case -14:
                //    e.Row.Background = new SolidColorBrush(Color.FromRgb(255, 227, 132));
                //    break;
                case -15:
                case -16:
                case -17:
                case -18:
                case -19:
                case -20:
                    e.Row.Background = new SolidColorBrush(Colors.IndianRed);
                    break;

                default:
                    if (e.Row.AlternationIndex == 0)
                    {
                        e.Row.Background = null;
                    }
                    else
                    {
                        e.Row.Background = new SolidColorBrush(Colors.Azure);
                    }
                    break;
                }
            }
        }