예제 #1
0
 private void Clear_Click(object sender, RoutedEventArgs e)
 {
     Isbn.Clear();
     isbnmsg.Visibility      = Visibility.Visible;
     Name.Content            = "";
     fkTypeCode.Content      = "";
     fkTypeName.Content      = "";
     fkPressName.Content     = "";
     Author.Content          = "";
     unifyNum.Content        = "";
     parallelTitle.Content   = "";
     postIssueNumber.Content = "";
     openBook.Content        = "";
     issnPrice.Content       = "";
     releaseCycle.Content    = "";
     remark.Content          = "";
     periodicalInfo          = new PeriodicalInfo();
     EPC.Clear();
     BookCode.Clear();
     info = new CallNumberInfo();
     CallNumberTxt.Clear();
     callNumbermsg.Visibility = Visibility.Visible;
     PeriodicalCode.Clear();
     PeriodicalMsg.Visibility   = Visibility.Visible;
     sNumber.Content            = "";
     page.Content               = "";
     publicationDateStr.Content = "";
     remarks.Content            = "";
     price.Content              = "";
 }
예제 #2
0
 public PeriodicalControl(MainControl mainControl)
 {
     InitializeComponent();
     DataContext        = null;
     DataContext        = new PeriodicalViewModel(this);
     this.mainControl   = mainControl;
     mainControl.thread = new Thread(new ThreadStart(() =>
     {
         while (true)
         {
             if (ServerSetting.rfid.IsOpen())
             {
                 ServerSetting.rfid.Start();
             }
             this.Dispatcher.BeginInvoke((Action) delegate
             {
                 lock (ServerSetting.EPClist)
                 {
                     if (ServerSetting.EPClist.Count == 0 && string.IsNullOrEmpty(EPC.Text))
                     {
                         BookCode.Text       = "请先扫描RFID";
                         BookCode.IsReadOnly = true;
                         EPC.Clear();
                     }
                     else
                     {
                         if (BookCode.IsReadOnly)
                         {
                             BookCode.IsReadOnly = false;
                             BookCode.Text       = "";
                             BookCode.Focus();
                             lock (ServerSetting.EPClist)
                             {
                                 string epc = ServerSetting.EPClist.Dequeue();
                                 ServerSetting.EPClist.Enqueue(epc);
                                 EPC.Text = epc;
                             }
                         }
                     }
                 }
             });
             Thread.Sleep(500);
         }
     }));
     mainControl.thread.IsBackground = true;
 }
 private void Clear_Click(object sender, RoutedEventArgs e)
 {
     EPC.Clear();
     BookCode.Clear();
     CallNumberTxt.Clear();
     Isbn.Clear();
     isbnmsg.Visibility     = Visibility.Visible;
     BookName.Content       = "";
     Price.Content          = "";
     Author.Content         = "";
     Press.Content          = "";
     PressDate.Content      = "";
     CallNumber.Content     = "";
     PageNumber.Content     = "";
     Classification.Content = "";
     info = new CallNumberInfo();
 }
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            lock (ServerSetting.EPClist)
            {
                if (place.SelectedIndex < 0)
                {
                    BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#FF2E2E"));
                    BindState.Content    = "未选择馆藏地";
                    return;
                }

                if (string.IsNullOrEmpty(id))
                {
                    BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#FF2E2E"));
                    BindState.Content    = "未选中需要合刊的刊期";
                    return;
                }
                if (string.IsNullOrEmpty(callNumber.Text))
                {
                    BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#FF2E2E"));
                    BindState.Content    = "索取号不能为空";
                    return;
                }
                if (string.IsNullOrEmpty(EPC.Text))
                {
                    BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#FF2E2E"));
                    BindState.Content    = "未扫描到可用RFID";
                    return;
                }
                if (string.IsNullOrEmpty(code.Text))
                {
                    BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#FF2E2E"));
                    BindState.Content    = "书籍编码不能为空";
                    return;
                }
                if (string.IsNullOrEmpty(EPC.Text))
                {
                    BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#FF2E2E"));
                    BindState.Content    = "未扫描到可用RFID";
                    return;
                }
                List <HDDCQKInfo> infos = grid.ItemsSource as List <HDDCQKInfo>;
                if (infos == null || infos.Count() <= 0)
                {
                    BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#FF2E2E"));
                    BindState.Content    = "未选中需要添加如刊期的子刊";
                    return;
                }

                string epc = null;
                if (ServerSetting.EPClist.Count <= 0)
                {
                    epc = EPC.Text;
                }
                else
                {
                    epc = ServerSetting.EPClist.Dequeue();
                }
                Dictionary <string, object> keyValuePairs = new Dictionary <string, object>();

                if ((bool)available.IsChecked)
                {
                    keyValuePairs.Add("available", 1);
                }
                else
                {
                    keyValuePairs.Add("available", 0);
                }
                if ((bool)lendingPermission.IsChecked)
                {
                    keyValuePairs.Add("lendingPermission", 1);
                }
                else
                {
                    keyValuePairs.Add("lendingPermission", 0);
                }
                var list = (from c in infos
                            select c.id).ToArray();
                keyValuePairs.Add("rfid", epc);
                keyValuePairs.Add("callNumber", callNumber.Text);
                keyValuePairs.Add("fkCataPeriodicalId", id);
                keyValuePairs.Add("code", code.Text);
                PlaceInfo placeInfo = place.SelectedItem as PlaceInfo;
                keyValuePairs.Add("placeCode", placeInfo.id);
                keyValuePairs.Add("ids", list);
                keyValuePairs.Add("hkPrice", hkPrice.Text.ToInt());
                keyValuePairs.Add("hkRemark", hkRemark.Text);
                if (!IsEdit)
                {
                    object errorMsg = keyValuePairs;
                    ///接口
                    AddHDDAL addHDDAL = new AddHDDAL();
                    EPC.Clear();
                    if (addHDDAL.AddHD(ref errorMsg))
                    {
                        RetrunInfo retrunInfo = errorMsg as RetrunInfo;
                        if (retrunInfo.TrueOrFalse)
                        {
                            BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#00E08E"));
                            BindState.Content    = "已绑定";
                            grid.ItemsSource     = null;
                            code.Clear();
                            EPC.Clear();
                        }
                        else
                        {
                            BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#FF2E2E"));
                            BindState.Content    = "未绑定";
                            EPC.Clear();
                            if (ServerSetting.IsOverDue)
                            {
                                ErrorPage errorPage = new ErrorPage(errorMsg.ToString(), mainControl.mainWindow);
                                DialogHelper.ShowDialog(errorPage);
                            }
                        }
                    }
                    else
                    {
                        BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#FF2E2E"));
                        BindState.Content    = "未绑定";
                    }
                    EPC.Clear();
                }
                else
                {
                    keyValuePairs.Add("id", EditId);
                    object errorMsg = keyValuePairs;
                    ///接口
                    HDEditDAL addHDDAL = new HDEditDAL();
                    if (addHDDAL.HDEdit(ref errorMsg))
                    {
                        RetrunInfo retrunInfo = errorMsg as RetrunInfo;
                        if (retrunInfo.TrueOrFalse)
                        {
                            BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#00E08E"));
                            BindState.Content    = "修改成功";
                        }
                        else
                        {
                            BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#FF2E2E"));
                            BindState.Content    = "修改失败";
                            if (ServerSetting.IsOverDue)
                            {
                                ErrorPage errorPage = new ErrorPage(errorMsg.ToString(), mainControl.mainWindow);
                                DialogHelper.ShowDialog(errorPage);
                            }
                        }
                    }
                    else
                    {
                        BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#FF2E2E"));
                        BindState.Content    = "修改失败";
                    }
                }
            }
        }
예제 #5
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            lock (BookCode.Text)
            {
                if (place.SelectedIndex < 0)
                {
                    error.Content      = "未选择馆藏地";
                    Success.Visibility = Visibility.Hidden;
                    False.Visibility   = Visibility.Visible;
                    return;
                }
                if (periodicalInfo == null || string.IsNullOrEmpty(periodicalInfo.fkCataPeriodicalId))
                {
                    error.Content      = "未选中需要绑定的期刊";
                    Success.Visibility = Visibility.Hidden;
                    False.Visibility   = Visibility.Visible;
                    return;
                }
                if (string.IsNullOrEmpty(CallNumberTxt.Text))
                {
                    error.Content      = "索取号不能为空";
                    Success.Visibility = Visibility.Hidden;
                    False.Visibility   = Visibility.Visible;
                    return;
                }
                if (string.IsNullOrEmpty(periodicalInfo.pNumberId))
                {
                    error.Content      = "未选定子刊";
                    Success.Visibility = Visibility.Hidden;
                    False.Visibility   = Visibility.Visible;
                    return;
                }
                if (string.IsNullOrEmpty(BookCode.Text))
                {
                    error.Content      = "书籍编码不能为空";
                    Success.Visibility = Visibility.Hidden;
                    False.Visibility   = Visibility.Visible;
                    return;
                }
                if (string.IsNullOrEmpty(EPC.Text))
                {
                    error.Content      = "书籍编码不能为空";
                    Success.Visibility = Visibility.Hidden;
                    False.Visibility   = Visibility.Visible;
                    return;
                }
                if (periodicalInfo == null)
                {
                    return;
                }
                if (lendingPermission.IsChecked.Value == true)
                {
                    periodicalInfo.lendingPermission = "1";
                }
                else
                {
                    periodicalInfo.lendingPermission = "0";
                }
                if (available.IsChecked.Value == true)
                {
                    periodicalInfo.available = "1";
                }
                else
                {
                    periodicalInfo.available = "0";
                }
                periodicalInfo.callNumber = CallNumberTxt.Text;
                periodicalInfo.code       = BookCode.Text;
                string epc = ServerSetting.EPClist.Dequeue();
                periodicalInfo.rfid = epc;

                if (ServerSetting.OldEPClist.Contains(epc))
                {
                    error.Content      = "RFID重复";
                    Success.Visibility = Visibility.Hidden;
                    False.Visibility   = Visibility.Visible;
                    EPC.Clear();
                    return;
                }
                PlaceInfo placeInfo = place.SelectedItem as PlaceInfo;
                periodicalInfo.placeId = placeInfo.id;
                PeriodicalAddDAL periodicalAddDAL = new PeriodicalAddDAL();
                object           errorMsg         = periodicalInfo;
                if (periodicalAddDAL.PeriodicalAdd(ref errorMsg))
                {
                    RetrunInfo retrunInfo = errorMsg as RetrunInfo;
                    if (!retrunInfo.TrueOrFalse)
                    {
                        Success.Visibility = Visibility.Hidden;
                        False.Visibility   = Visibility.Visible;
                        if (retrunInfo.result.Equals("RFID重复"))
                        {
                            ServerSetting.OldEPClist.Enqueue(epc);
                        }
                        if (ServerSetting.IsOverDue)
                        {
                            ErrorPage errorPage = new ErrorPage(error.Content.ToString(), mainControl.mainWindow);
                            DialogHelper.ShowDialog(errorPage);
                        }
                        error.Content       = retrunInfo.result.ToString();
                        BookCode.IsReadOnly = true;
                    }
                    else
                    {
                        Success.Visibility = Visibility.Visible;
                        False.Visibility   = Visibility.Hidden;
                        EPC.Clear();
                        ///成功列入已处理列
                        ServerSetting.OldEPClist.Enqueue(epc);
                        BookCode.IsReadOnly = true;
                        ///增加图片
                        List <MarCodeInfo> infos = MarCodeList.ItemsSource as List <MarCodeInfo>;
                        AddCell(infos, CallNumberTxt.Text);
                        int    index = CallNumberTxt.Text.IndexOf("/");
                        string str1  = "";
                        string str   = CallNumberTxt.Text.Substring(0, index + 1);
                        if (CallNumberTxt.Text.Length > index + 1)
                        {
                            str1 = CallNumberTxt.Text.Substring(index + 1, CallNumberTxt.Text.Length - index - 1);
                        }
                        CallNumberTxt.Text = str + (str1.ToInt() + 1).ToString();
                        error.Content      = "";
                        if (!string.IsNullOrEmpty(infos[infos.Count - 1].MarCode3))
                        {
                            MessageBox.Show("单次操作最多可打印40张书标,后续绑定将不再生成");
                        }
                    }
                }
                else
                {
                    Success.Visibility = Visibility.Hidden;
                    False.Visibility   = Visibility.Visible;
                    EPC.Clear();
                }
                BookCode.Clear();
            }
            EPC.Clear();
        }
 private void Button_Click_2(object sender, RoutedEventArgs e)
 {
     lock (BookCode.Text)
     {
         if (mainControl.info == null)
         {
             return;
         }
         if (string.IsNullOrEmpty(mainControl.info.id))
         {
             error.Content      = "未选中需要绑定的书籍";
             Success.Visibility = Visibility.Hidden;
             False.Visibility   = Visibility.Visible;
             return;
         }
         if (string.IsNullOrEmpty(EPC.Text))
         {
             error.Content      = "未扫描到可用RFID";
             Success.Visibility = Visibility.Hidden;
             False.Visibility   = Visibility.Visible;
             return;
         }
         if (string.IsNullOrEmpty(CallNumberTxt.Text))
         {
             error.Content      = "索取号不能为空";
             Success.Visibility = Visibility.Hidden;
             False.Visibility   = Visibility.Visible;
             return;
         }
         if (string.IsNullOrEmpty(BookCode.Text))
         {
             error.Content      = "书籍编码不能为空";
             Success.Visibility = Visibility.Hidden;
             False.Visibility   = Visibility.Visible;
             return;
         }
         mainControl.info.CallNumber = CallNumberTxt.Text;
         mainControl.info.EPC        = ServerSetting.EPClist.Dequeue();
         if (ServerSetting.OldEPClist.Contains(mainControl.info.EPC))
         {
             error.Content      = "RFID重复";
             Success.Visibility = Visibility.Hidden;
             False.Visibility   = Visibility.Visible;
             EPC.Clear();
             return;
         }
         mainControl.info.BookCdoe = BookCode.Text;
         AddRfidDAL addRfidDAL = new AddRfidDAL();
         object     errorMsg   = mainControl.info;
         if (addRfidDAL.AddRfid(ref errorMsg))
         {
             Success.Visibility = Visibility.Visible;
             False.Visibility   = Visibility.Hidden;
             EPC.Clear();
             ///成功列入已处理列
             ServerSetting.OldEPClist.Enqueue(mainControl.info.EPC);
             BookCode.IsReadOnly = true;
             ///增加图片
             List <MarCodeInfo> infos = MarCodeList.ItemsSource as List <MarCodeInfo>;
             AddCell(infos, mainControl.info.CallNumber);
             int    index = CallNumberTxt.Text.IndexOf("/");
             string str1  = "";
             string str   = CallNumberTxt.Text.Substring(0, index + 1);
             if (CallNumberTxt.Text.Length > index + 1)
             {
                 str1 = CallNumberTxt.Text.Substring(index + 1, CallNumberTxt.Text.Length - index - 1);
             }
             CallNumberTxt.Text          = str + (str1.ToInt() + 1).ToString();
             mainControl.info.CallNumber = CallNumberTxt.Text;
             error.Content = "";
             if (!string.IsNullOrEmpty(infos[infos.Count - 1].MarCode3))
             {
                 MessageBox.Show("单次操作最多可打印40张书标,后续绑定将不再生成");
             }
         }
         else
         {
             try
             {
                 RetrunInfo retrunInfo = errorMsg as RetrunInfo;
                 if (retrunInfo.result.Equals("RFID重复"))
                 {
                     ServerSetting.OldEPClist.Enqueue(mainControl.info.EPC);
                 }
                 error.Content = retrunInfo.result.ToString();
             }
             catch
             { }
             Success.Visibility = Visibility.Hidden;
             False.Visibility   = Visibility.Visible;
             EPC.Clear();
             if (ServerSetting.IsOverDue)
             {
                 ErrorPage errorPage = new ErrorPage(error.Content.ToString(), mainControl.mainWindow);
                 DialogHelper.ShowDialog(errorPage);
             }
         }
         BookCode.Clear();
     }
     BookCode.IsReadOnly = true;
 }