void addToList(scanMain_stock item, bool select) { string[] tmpstr = new string[2]; tmpstr[0] = item.rfid_no; tmpstr[1] = item.shelf_no; ListViewItem tmpitems1 = new ListViewItem(tmpstr); listView1.Items.Add(tmpitems1); listView1.Items[0].Selected = true; }
scanMain_stock getInList(string findvalue) { var dd = new scanMain_stock(); for (int i = 0; i < _lisCtnNo.Count; i++) { if (_lisCtnNo[i].rfid_no.Equals(findvalue)) { return(_lisCtnNo[i]); } } return(dd); }
//has txt bool editInList(scanMain_stock value) { for (int i = 0; i < _lisCtnNo.Count; i++) { if (_lisCtnNo[i].rfid_no.Equals(value.rfid_no)) { _lisCtnNo.RemoveAt(i); value.shelf_no = txt2ShelfNo.Text.Trim(); _lisCtnNo.Add(value); return(true); } } return(false); }
void addToListView(scanMain_stock selectitem) { listView1.Items.Clear(); addToList(selectitem, true); foreach (var item in _lisCtnNo) { addToList(item, false); } _lisCtnNo.Add(selectitem); lbl0Count.Text = _lisCtnNo.Count.ToString(); SetMsg(lnlTotal, "add " + selectitem.rfid_no + " success。"); AllInit(false); }
private void txt21ctnno_no_KeyDown(object sender, KeyEventArgs e) { var tmpmsg = ""; var tmpprdct_no = ""; var tmpstockin_id = ""; Cursor.Current = Cursors.WaitCursor; try { if (e.KeyCode == Keys.Enter) { if (!string.IsNullOrEmpty(txt1RfidNo.Text.Trim()) && !string.IsNullOrEmpty(txt2ShelfNo.Text.Trim())) { //check is in stock deatils //set value StringDictionary dis1WhereValuet_stockinctnno = new StringDictionary(); StringDictionary dis2ForValuet_stockinctnno = new StringDictionary(); //select StringDictionary dis2ForValuet_stockdetail = new StringDictionary(); StringDictionary dis1WhereValuet_stockdetail = new StringDictionary(); StringDictionary dis1WhereValuem_shelf = new StringDictionary(); StringDictionary dis2ForValuem_shelf = new StringDictionary(); //t_stockinctnno dis1WhereValuet_stockinctnno[MasterTableWHS.t_stockinctnnodetail.rfid_no] = txt1RfidNo.Text.Trim(); dis2ForValuet_stockinctnno[MasterTableWHS.t_stockinctnnodetail.rfid_no] = "true"; //check shelf no dis1WhereValuem_shelf[MasterTableWHS.m_shelf.shelf_no] = txt2ShelfNo.Text.Trim(); dis2ForValuem_shelf[MasterTableWHS.m_shelf.shelf_no] = "true"; //check shelf details dis1WhereValuet_stockdetail[MasterTableWHS.t_stockdetail.rfid_no] = txt1RfidNo.Text.Trim(); dis2ForValuet_stockdetail[MasterTableWHS.t_stockdetail.rfid_no] = "true"; //dis1WhereValuet_stockinctnno[MasterTableWHS.t_stockinctnno.status] = "0"; //dis2ForValuet_stockinctnno[MasterTableWHS.t_stockinctnno.status] = "true"; #region check t_stockinctnno var dtIn = this.m_daoCommon.GetTableInfo(MasterTableWHS.ViewOrTable.t_stockinctnnodetail, dis1WhereValuet_stockinctnno, dis2ForValuet_stockinctnno, _disNull, "", false); if (dtIn.Rows.Count > 0) { var tmpstatus = dtIn.Rows[0][MasterTableWHS.t_stockinctnnodetail.status].ToString().Trim(); tmpstockin_id = dtIn.Rows[0][MasterTableWHS.t_stockinctnnodetail.stockin_id].ToString(); tmpprdct_no = dtIn.Rows[0][MasterTableWHS.t_stockinctnnodetail.prdct_no].ToString(); if (tmpstatus.Equals("0")) { tmpmsg = "RFID:" + txt1RfidNo.Text + " 已失效。货物编码:" + tmpprdct_no + ",入库单:" + tmpstockin_id; AllInit(false); SetMsg(lnlTotal, tmpmsg); MessageBox.Show(tmpmsg); return; } } else { tmpmsg = "Error1: RFID:" + txt1RfidNo.Text + " 不存在系统中。。。请检查数据的准确性。"; AllInit(false); SetMsg(lnlTotal, tmpmsg); MessageBox.Show(tmpmsg); return; } #endregion #region check shell no var dtShell = this.m_daoCommon.GetTableInfo(MasterTableWHS.ViewOrTable.m_shelf, dis1WhereValuem_shelf, dis2ForValuem_shelf, _disNull, "", false); if (dtShell.Rows.Count > 0) { var tmpstatus = dtShell.Rows[0][MasterTableWHS.m_shelf.status].ToString().Trim(); if (tmpstatus.Equals("0")) { tmpmsg = "货架:" + txt2ShelfNo.Text + " 已失效."; SetMsg(lnlTotal, tmpmsg); MessageBox.Show(tmpmsg); AllInit(false); return; } } else { tmpmsg = "Error1: 货架:" + txt2ShelfNo.Text + " 不存在系统中。。。请检查数据的准确性。"; SetMsg(lnlTotal, tmpmsg); MessageBox.Show(tmpmsg); AllInit(false); return; } #endregion #region check shelf details var dt = this.m_daoCommon.GetTableInfo(MasterTableWHS.ViewOrTable.t_stockdetail, dis1WhereValuet_stockdetail, dis2ForValuet_stockdetail, _disNull, "", false); if (dt != null) { if (dt.Rows.Count > 0) { var tmpshelf = dt.Rows[0][MasterTableWHS.t_stockdetail.shelf_no].ToString(); tmpmsg = "RFID:" + txt1RfidNo.Text + " 已上架。货架:" + tmpshelf; SetMsg(lnlTotal, tmpmsg); MessageBox.Show(tmpmsg); AllInit(false); return; } } #endregion if (!checkInList(txt1RfidNo.Text.Trim(), false)) { scanMain_stock tmp = new scanMain_stock(); tmp.rfid_no = txt1RfidNo.Text.Trim(); tmp.shelf_no = txt2ShelfNo.Text.Trim(); tmp.stockin_id = tmpstockin_id; tmp.prdct_no = tmpprdct_no; addToListView(tmp); } else { SetMsg(lnlTotal, "RFID:" + txt1RfidNo.Text + " 已扫。"); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { Cursor.Current = Cursors.Default; } }