private void button1_Click(object sender, EventArgs e) { if (isOnLine) { if (btnAllInfo.Text == "所 有") { if (ListmbInfo.Count > 0) { groupBoxUnionInfo.Visible = false; List <UnionTaskInfo> listunion = new List <UnionTaskInfo>(); for (int i = 0; i < ListmbInfo.Count; i++) { for (int j = 0; j < ListmbInfo[i].taskInfo.Count; j++) { UnionTaskInfo un = new UnionTaskInfo(); if (ListmbInfo[i].taskInfo != null && ListmbInfo[i].taskInfo.Count > 0)//当数据不为空 { un.CIGARETTDECODE = ListmbInfo[i].taskInfo[j].CIGARETTDECODE; un.CIGARETTDENAME = ListmbInfo[i].taskInfo[j].CIGARETTDENAME; un.POKENUM = ListmbInfo[i].taskInfo[j].POKENUM; un.MainBelt = ListmbInfo[i].taskInfo[j].MainBelt; un.SortNum = ListmbInfo[i].taskInfo[j].SortNum; un.Place = ListmbInfo[i].Place; listunion.Add(un); } } } DgvBind(); dgvSortingBeltInfo.DataSource = listunion.Select(x => new { CIGARETTECODE = x.CIGARETTDECODE, CIGARETTNAME = x.CIGARETTDENAME, MAINBELT = x.MainBelt, QTY = x.POKENUM, GroupNo = x.groupno, MEACHINESEQ = x.machineseq, SORTNUM = x.SortNum, PLACE = x.Place + "米", }).ToList();//根据索引读取相对应数据 ; btnAllInfo.Text = "返回"; } else { MessageBox.Show("当前没有数据"); } } else { ReadListInfo(ReadIndex); btnAllInfo.Text = "所 有"; } } else { updateListBox("与服务器断开连接...."); } }
private void btnAllInfo_Click(object sender, EventArgs e) { List <UnionTaskInfo> listunion = new List <UnionTaskInfo>(); if (btnAllInfo.Text == "所 有") { if (ListmbInfo.Count > 0) { groupBoxUnionInfo.Visible = false; for (int i = 0; i < ListmbInfo.Count; i++) { for (int j = 0; j < ListmbInfo[i].taskInfo.Count; j++) { UnionTaskInfo un = new UnionTaskInfo(); if (ListmbInfo[i].taskInfo != null && ListmbInfo[i].taskInfo.Count > 0)//当数据不为空 { if (ListmbInfo[i].taskInfo[j].IsOnMainBelt == 1) { un.CIGARETTDECODE = ListmbInfo[i].taskInfo[j].CIGARETTDECODE; un.CIGARETTDENAME = ListmbInfo[i].taskInfo[j].CIGARETTDENAME; un.POKENUM = ListmbInfo[i].taskInfo[j].POKENUM; un.MainBelt = ListmbInfo[i].taskInfo[j].MainBelt; un.SortNum = ListmbInfo[i].taskInfo[j].SortNum; un.IsOnMainBelt = ListmbInfo[i].taskInfo[j].IsOnMainBelt; un.Place = ListmbInfo[i].Place; listunion.Add(un); } } } } dgvMainBeltInfo.DataSource = listunion.Select(x => new { CIGARETTECODE = x.CIGARETTDECODE, CIGARETTNAME = x.CIGARETTDENAME, QTY = x.POKENUM, MAINBELT = x.MainBelt, SORTNUM = x.SortNum, IsOnBelt = x.IsOnMainBelt, Place = x.Place + "米", }).ToList();//根据索引读取相对应数据 DgvBind(); btnAllInfo.Text = "返 回"; } else { MessageBox.Show("当前没有数据"); } } else { ReadListInfo(ReadIndexByBtn); btnAllInfo.Text = "所 有"; } }