public void ListFillFromQrObject(ListBox listbox, TreeView tree, QrCodeData qr, Dictionary dict) { if (dict != null) { listbox.Items.Clear(); tree.Nodes.Clear(); foreach (QrItem qritem in qr.ListQrItems) { QrItemDictionary qrdi = new QrItemDictionary(qritem, dict.GetTypeDescription(qritem.Type)); qrdi.DataLen = qritem.Value.Length; qrdi.ArrayItem = dict.GetValueArrayItemFromDictionary(qrdi.QrItem.Type, qrdi.QrItem.Value); listbox.Items.Add(qrdi); } if (qr.ListInPackets != null) { foreach (QrCodeData inqr in qr.ListInPackets) { TreeNode node = new TreeNode(inqr.ToString()); List <string> qrItemDataStrs = this.IdentificateQrData(inqr, dict); foreach (string qrs in qrItemDataStrs) { node.Nodes.Add(qrs); } node.Tag = inqr; tree.Nodes.Add(node); } } } }
/// <summary> /// генерирует массив печати серии номеров к копированием по колонкам /// </summary> /// <param name="current"></param> /// <param name="dict"></param> /// <param name="ammount"></param> /// <returns></returns> public QrCodeData[] GenerateQrDataArrayForSerialPrint(QrCodeData current, Dictionary dict, int ammount) { if (current != null && dict != null) { QrCodeData[] qr_result_arr = null; QrCodeData qr_add = new QrCodeData(current); List <QrItemDictionary> changeItems = new List <QrItemDictionary>(); List <int> qrItemIndexesList = new List <int>(); foreach (DictionaryItem di in dict.DictionaryDataBase) { for (int j = 0; j < current.ListQrItems.Count; j++) { if (current.ListQrItems[j].Type == di.TypeId && di.IsSerialDb) { QrItem qrAdd = new QrItem(current.ListQrItems[j].Type, current.ListQrItems[j].Value); qrAdd.NoIncrimented = current.ListQrItems[j].NoIncrimented; QrItemDictionary qr = new QrItemDictionary(qrAdd, di.DataLen); changeItems.Add(qr); qrItemIndexesList.Add(j); } } } if (changeItems.Count > 0) { List <QrCodeData> qr_codes_list = new List <QrCodeData>(); for (int i = 0; i < ammount; i++) { for (int j = 0; j < changeItems.Count; j++) { string str_format = ""; for (int v = 0; v < changeItems[j].DataLen; v++) { str_format += "0"; } if (!changeItems[j].QrItem.NoIncrimented) { qr_add.ChangeQrItemInList(qrItemIndexesList[j], changeItems[j].QrItem.Type, (int.Parse(changeItems[j].QrItem.Value) + i).ToString(str_format)); } } qr_codes_list.Add(new QrCodeData(qr_add)); } qr_result_arr = qr_codes_list.ToArray(); } return(qr_result_arr); } else { return(null); } }
private void notIncrementedMenuItem_Click(object sender, EventArgs e) { if (currentQrCodeListBox.SelectedIndex != -1) { QrItemDictionary qr_tmp = ((QrItemDictionary)currentQrCodeListBox.SelectedItem); if (m_DbDict.IsItemIsSerial(qr_tmp.QrItem)) { qr_tmp.QrItem.NoIncrimented = notIncrementedMenuItem.Checked; currentQrCodeListBox.Items[currentQrCodeListBox.SelectedIndex] = qr_tmp; } } }
private void опуститьВнизToolStripMenuItem_Click(object sender, EventArgs e) { if (currentQrCodeListBox.SelectedIndex != -1 && currentQrCodeListBox.SelectedIndex < currentQrCodeListBox.Items.Count - 1) { QrItemDictionary qr_tmp = ((QrItemDictionary)currentQrCodeListBox.SelectedItem); QrItemDictionary qr_tmp0 = ((QrItemDictionary)currentQrCodeListBox.Items[currentQrCodeListBox.SelectedIndex + 1]); currentQrCodeListBox.Items[currentQrCodeListBox.SelectedIndex] = qr_tmp0; currentQrCodeListBox.Items[currentQrCodeListBox.SelectedIndex + 1] = qr_tmp; m_CurrentPrintQrCode = m_QrProcessor.CreateQrCodeFromList(currentQrCodeListBox.Items, AddInPacketTreeView.Nodes); printPanelBox.Invalidate(); } }
private void contextMenuStripQrCodeListBox_Opening(object sender, CancelEventArgs e) { if (currentQrCodeListBox.SelectedIndex != -1) { QrItemDictionary qr_tmp = ((QrItemDictionary)currentQrCodeListBox.SelectedItem); notIncrementedMenuItem.Checked = qr_tmp.QrItem.NoIncrimented; if (m_DbDict.IsItemIsSerial(qr_tmp.QrItem)) { notIncrementedMenuItem.Enabled = true; LastVaqlueFromBdToolStripMenuItem.Enabled = true; } else { notIncrementedMenuItem.Enabled = false; LastVaqlueFromBdToolStripMenuItem.Enabled = false; } } }
/// <summary> /// //инкрементируем серийный номер,печатаем этикетку /// </summary> private void AutoOperationStep2() { if (m_AutoOperationFlags[1]) { for (int i = 0; i < currentQrCodeListBox.Items.Count; i++) { QrItemDictionary qr_tmp = (QrItemDictionary)currentQrCodeListBox.Items[i]; if (m_DbDict.IsItemIsSerial(qr_tmp.QrItem)) { // печатаем этикетку PrintDocument printDocument = new PrintDocument(); float h = ((float)(QrSizetrackBar.Value + UpOffsetNumeric.Value) * (float)3.779527559055); float w = (((QrPrintColumsTrack.Value * QrSizetrackBar.Value) + ((QrPrintColumsTrack.Value - 1) * SizeBeetweenQrTrack.Value)) * (float)3.779527559055); printDocument.PrintPage += PrintDocument_PrintPage; cur_page_packet_counter = 0; printDocument.Print(); // //инкрементируем номер string last_val = m_DbCollection.GetLastValueFromDb(m_CurrentPrintQrCode, qr_tmp.QrItem); if (last_val != null) { string str_format = ""; for (int v = 0; v < qr_tmp.DataLen; v++) { str_format += "0"; } string newVal = (int.Parse(last_val) + 1).ToString(str_format); qr_tmp.QrItem.Value = newVal; currentQrCodeListBox.Items[i] = qr_tmp; m_AutoOperationFlags[2] = true; AutoOperationStep3(); return; } } } } }
private void LastVaqlueFromBdToolStripMenuItem_Click(object sender, EventArgs e) { if (currentQrCodeListBox.SelectedIndex != -1) { QrItemDictionary qr_tmp = ((QrItemDictionary)currentQrCodeListBox.SelectedItem); if (m_DbDict.IsItemIsSerial(qr_tmp.QrItem)) { string last_val = m_DbCollection.GetLastValueFromDb(m_CurrentPrintQrCode, qr_tmp.QrItem); if (last_val != null) { string str_format = ""; for (int v = 0; v < qr_tmp.DataLen; v++) { str_format += "0"; } string newVal = (int.Parse(last_val) + 1).ToString(str_format); qr_tmp.QrItem.Value = newVal; currentQrCodeListBox.Items[currentQrCodeListBox.SelectedIndex] = qr_tmp; } } } }
private void dictionaryTreeOnPrintTab_DoubleClick(object sender, EventArgs e) { if (dictionaryTreeOnPrintTab.SelectedNode != null) { Type typeOfSelected = dictionaryTreeOnPrintTab.SelectedNode.Tag.GetType(); QrItemDictionary qr = null; if (typeOfSelected == typeof(DictionaryItem)) { DictionaryItem di = (DictionaryItem)dictionaryTreeOnPrintTab.SelectedNode.Tag; if (di.KeyValues != null) { return; } AddEditQrCodeData qrDialog = new AddEditQrCodeData(); if (di.Is_date) { qrDialog.dateTimePicker.Enabled = true; qrDialog.ValueTxb.Enabled = false; } qrDialog.groupBoxLabel.Text = di.DataDescr; qrDialog.DictionaryItem = di; if (qrDialog.ShowDialog() == DialogResult.OK) { if (qrDialog.dateTimePicker.Enabled) { qr = new QrItemDictionary(new QrItem(di.TypeId, qrDialog.dateTimePicker.Value.ToString("ddMMyy")), di.DataDescr, di.DataLen); } else { qr = new QrItemDictionary(new QrItem(di.TypeId, qrDialog.ValueTxb.Text), di.DataDescr, di.DataLen); } if (currentQrCodeListBox.SelectedItem != null) { currentQrCodeListBox.Items[currentQrCodeListBox.SelectedIndex] = qr; } else { currentQrCodeListBox.Items.Add(qr); } m_CurrentPrintQrCode = m_QrProcessor.CreateQrCodeFromList(currentQrCodeListBox.Items, AddInPacketTreeView.Nodes); printPanelBox.Invalidate(); } } if (typeOfSelected == typeof(ArrayItem)) { ArrayItem ar = (ArrayItem)dictionaryTreeOnPrintTab.SelectedNode.Tag; qr = new QrItemDictionary(new QrItem(ar.Type, ar.Key), m_DbDict.GetTypeDescription(ar.Type)); qr.ArrayItem = ar; if (currentQrCodeListBox.SelectedItem != null) { currentQrCodeListBox.Items[currentQrCodeListBox.SelectedIndex] = qr; } else { currentQrCodeListBox.Items.Add(qr); } m_CurrentPrintQrCode = m_QrProcessor.CreateQrCodeFromList(currentQrCodeListBox.Items, AddInPacketTreeView.Nodes); printPanelBox.Invalidate(); } // DictionaryItem di = (DictionaryItem)dictionaryTreeOnPrintTab.SelectedNode.Tag; } }