/// <summary> /// Обновить списки /// </summary> private void updateLists() { listView1.Items.Clear(); foreach (int id in CasLP16.Instance.getIDsOfPLUs()) { PLU plu = CasLP16.Instance.GetPLUbyID(id); ListViewItem lvi = listView1.Items.Add(plu.ID.ToString()); lvi.SubItems.Add(plu.Code.ToString()); lvi.SubItems.Add(plu.ProductName1); lvi.SubItems.Add(plu.ProductName2.ToString()); lvi.SubItems.Add(plu.Price.ToString()); lvi.SubItems.Add(plu.LiveTime.ToString()); lvi.SubItems.Add(plu.TaraWeight.ToString()); lvi.SubItems.Add(plu.GroupCode.ToString()); lvi.SubItems.Add(plu.MessageID.ToString()); lvi.Tag = plu; } ///Обновляем сообщения lvMSG.Items.Clear(); foreach (int id in CasLP16.Instance.getIDsOfMSGs()) { MSG msg = CasLP16.Instance.GetMSGbyID(id); ListViewItem lvi = lvMSG.Items.Add(msg.ID.ToString()); lvi.SubItems.Add(msg.Text); lvi.Tag = msg; } tbMessage.Text = ""; tbMessage.Enabled = false; Application.DoEvents(); if (!ScaleOpt.GetBoolOpt(ScaleOpt.OptType.Monitoring)) { saveSummarys(); } }
private static void saveSummarys() { if (SummarySaving == null) { return; } foreach (int id in CasLP16.Instance.getIDsOfPLUs()) { if (id == 0) { continue; } PLU plu = CasLP16.Instance.GetPLUbyID(id); _logger.DebugFormat("plu: {0:d},clear: {1:yyyy-MM-dd hh:mm:ss}", plu.ID, plu.LastClear); if (plu.TotalSell == 0 && plu.TotalSumm == 0 && plu.TotalWeight == 0) { continue; } if (!sumSaveded.needSend(plu.ID, plu.TotalSell, plu.TotalSumm, plu.TotalWeight)) { continue; } SummarySaving(plu.ID, plu.ProductName1, plu.TotalSell, plu.TotalSumm, plu.TotalWeight, plu.LastClear); } }
/// <summary> /// Добавление новой записи /// </summary> /// <param name="plu"></param> public PLUForm(PLU plu, int[] messageIDs, int[] existIDs) : this() { _plu = plu; tbID.Text = plu.ID.ToString(); mIdsFill(messageIDs); _IDs = existIDs; }
/// <summary> /// Изменение имеющейся /// </summary> public PLUForm(PLU plu, int[] messageIDs) : this() { _plu = plu; mIdsFill(messageIDs); _manual = false; tbID.Text = plu.ID.ToString(); tbCode.Text = plu.Code.ToString(); tbGroupcode.Text = plu.GroupCode.ToString(); tbName1.Text = plu.ProductName1; tbName2.Text = plu.ProductName2; tbLiveTime.Text = plu.LiveTime.ToString(); tbPrice.Text = plu.Price.ToString(); tbTara.Text = plu.TaraWeight.ToString(); tbID.Enabled = false; _manual = true; }
private void listView1_DoubleClick(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { (new PLUForm((listView1.SelectedItems[0].Tag as PLU), CasLP16.Instance.getIDsOfMSGs())).ShowDialog(); } else { PLU newPlu = new PLU(); newPlu.ID = (listView1.Items[listView1.Items.Count - 1].Tag as PLU).ID + 1; if ((new PLUForm(newPlu, CasLP16.Instance.getIDsOfMSGs(), CasLP16.Instance.getIDsOfPLUs())).ShowDialog() == DialogResult.OK) { CasLP16.Instance.AddPLU(newPlu); } } updateLists(); }