private void CCigTransfer_Load(object sender, EventArgs e) { DataGridViewTranslation.LoadMainColHeader(dgvnewlinebox); DataGridViewTranslation.LoadMainColHeader(dgvoldlinebox); dgvoldlinebox.DataSource = SortingLineBoxList.GetBindLineBoxList(); dgvnewlinebox.DataSource = SortingLineBoxList.GetEmptyLineBoxList(); }
private void customButton3_Click(object sender, EventArgs e) { if (dgvnewlinebox.SelectedRows.Count > 0 && dgvoldlinebox.SelectedRows.Count > 0) { if (MessageBox.Show("是否转换烟仓?请确认烟仓拨烟数相同。", "", MessageBoxButtons.YesNo) == DialogResult.Yes) { if (dgvoldlinebox.SelectedRows[0].Cells["oldPutNum"].Value.ToString() == dgvnewlinebox.SelectedRows[0].Cells["newPutNum"].Value.ToString()) { SortingLineBox oldsortingLineBox = new SortingLineBox(); SortingLineBox newsortingLineBox = new SortingLineBox(); oldsortingLineBox.LineBoxCode = dgvoldlinebox.SelectedRows[0].Cells["oldlineBoxCode"].Value.ToString(); oldsortingLineBox.LineBoxName = dgvoldlinebox.SelectedRows[0].Cells["oldlineBoxName"].Value.ToString(); oldsortingLineBox.PlcAddress = dgvoldlinebox.SelectedRows[0].Cells["oldplcAddress"].Value.ToString(); newsortingLineBox.LineBoxCode = dgvnewlinebox.SelectedRows[0].Cells["newLineBoxCode"].Value.ToString(); newsortingLineBox.LineBoxName = dgvnewlinebox.SelectedRows[0].Cells["newLineBoxName"].Value.ToString(); newsortingLineBox.PlcAddress = dgvnewlinebox.SelectedRows[0].Cells["newPlcAddress"].Value.ToString(); SortingLineBoxList.TransactCigBox(oldsortingLineBox, newsortingLineBox); dgvoldlinebox.DataSource = SortingLineBoxList.GetBindLineBoxList(); dgvnewlinebox.DataSource = SortingLineBoxList.GetEmptyLineBoxList(); MessageBox.Show("烟仓转移完成,如转移烟仓为立式烟仓请重新生成LED数据并发送!"); } else { MessageBox.Show("需要转移的烟道拨烟数不相符!"); } } } else { MessageBox.Show("未选择转移的烟道!"); } }
/// <summary> /// 发送订单到数码管 /// </summary> static public Dictionary <int, Tag> SetOrderNixielight(SortingLineTask[] sortingLineTasks) { Dictionary <int, int> senDictionary = new Dictionary <int, int>(); Dictionary <int, Tag> tagDictionary = new Dictionary <int, Tag>(); int sortinglineboxcount = SortingLineBoxList.GetLineBoxList().Count; try { for (int i = 1; i <= sortinglineboxcount; i++) { senDictionary.Add(i, 0); } SortingSubLine[] sortingSubLineList = SortingSubLineList.GetSubSortingLineList().OrderBy(o => o.sequence).ToArray(); for (int j = 1; j < sortingLineTasks.Length; j++) { if (sortingLineTasks[j] != null) { //当前子线包含的所有任务明细列表 IEnumerable <SortingLineTaskDetail> sortingLineTaskDetails = sortingLineTasks[j].SortingLineTaskDetails.GetAreaDetails(sortingSubLineList[j - 1].sublineCode); foreach (SortingLineTaskDetail detail in sortingLineTaskDetails) { try { tagDictionary.Add(Convert.ToInt32(detail.LINEBOXCODE), new Tag(sortingLineTasks[j].ID, Convert.ToInt32(detail.LINEBOXCODE), detail.QTY)); senDictionary[Convert.ToInt32(detail.LINEBOXCODE)] = detail.QTY; } catch (Exception) { } } //NixielightSDK.SendByMODBUS(senDictionary); } } } catch (Exception) { } return(tagDictionary); }
/// <summary> /// 更新盘点信息 /// </summary> public void UpdateLineboxCapacity() { if (chkshowqty.Checked) { SortingLineBoxList sortingLineBoxList = SortingLineBoxList.GetOverLineBoxQty(); SortingLineBoxList dynamicsortingLineBoxList = SortingLineBoxList.GetDynamicLineBoxList(); foreach (SortingLineBox sortingLineBox in sortingLineBoxList) { try { cShelves[sortingLineBox.LineBoxCode].ShowCigQty(sortingLineBox.NONQTY - sortingLineBox.PutNum); cShelves[sortingLineBox.LineBoxCode].SetTooltip(sortingLineBox.NONQTY - sortingLineBox.PutNum, sortingLineBox.TOTQTY); } catch (Exception) { } } foreach (SortingLineBox sortingLineBox in dynamicsortingLineBoxList) { try { cShelves[sortingLineBox.LineBoxCode].ShowCigQty(sortingLineBox.NONQTY - sortingLineBox.PutNum); cShelves[sortingLineBox.LineBoxCode].SetTooltip(sortingLineBox.NONQTY - sortingLineBox.PutNum, sortingLineBox.TOTQTY); } catch (Exception) { } } } else { foreach (KeyValuePair <string, C_Shelf> cShelf in cShelves) { cShelf.Value.ShowCigQty(0); } } }
/// <summary> /// 加载烟仓控件 /// </summary> public void LoadLinBox() { //建立空的烟仓控件 SortingLineBoxList sortingLineBoxList = SortingLineBoxList.GetLineBoxList(); c_Cubes = new List <C_Cube>(); cShelves = new Dictionary <string, C_Shelf>(); //cbefortUpShelves = new List<C_Shelf>(); //cbefortDownShelves = new List<C_Shelf>(); //cafterUpShelves = new List<C_Shelf>(); //cafterDownShelves = new List<C_Shelf>(); f1.Controls.Clear(); f2.Controls.Clear(); f3.Controls.Clear(); f4.Controls.Clear(); f5.Controls.Clear(); f6.Controls.Clear(); f7.Controls.Clear(); f8.Controls.Clear(); SortingSubLineList sortingSubLineList = SortingSubLineList.GetSubSortingLineList(); if (sortingSubLineList.Count == 1) { f1.Width += f2.Width; top.SetColumnSpan(f1, 3); panel1.Visible = false; top.SetColumnSpan(f3, 3); panel2.Visible = false; bottom.SetColumnSpan(f5, 3); panel4.Visible = false; bottom.SetColumnSpan(f7, 3); panel5.Visible = false; f2.Visible = false; f4.Visible = false; f6.Visible = false; f8.Visible = false; } if (sortingLineBoxList.Count > 0) { foreach (SortingLineBox sortingLineBox in sortingLineBoxList) { if (sortingLineBox.PARENTLINEBOX == "1" && sortingLineBox.ABANDONPARENT == "2" && sortingLineBox.SublineSeq == 1) { C_Shelf cShelf = CreateShelf(sortingLineBox); cShelves.Add(cShelf.Name, cShelf); cShelf.Margin = new Padding(0, 0, 1, 0); InitLineBoxControl(cShelf, f1); } else if (sortingLineBox.PARENTLINEBOX == "1" && sortingLineBox.ABANDONPARENT == "2" && sortingLineBox.SublineSeq == 2) { C_Shelf cShelf = CreateShelf(sortingLineBox); cShelves.Add(cShelf.Name, cShelf); cShelf.Margin = new Padding(0, 0, 1, 0); InitLineBoxControl(cShelf, f1); } else if (sortingLineBox.PARENTLINEBOX == "1" && sortingLineBox.ABANDONPARENT == "1" && sortingLineBox.SublineSeq == 1) { C_Shelf cShelf = CreateShelf(sortingLineBox); cShelves.Add(cShelf.Name, cShelf); cShelf.Margin = new Padding(0, 0, 1, 0); InitLineBoxControl(cShelf, f3); } else if (sortingLineBox.PARENTLINEBOX == "1" && sortingLineBox.ABANDONPARENT == "1" && sortingLineBox.SublineSeq == 2) { C_Shelf cShelf = CreateShelf(sortingLineBox); cShelves.Add(cShelf.Name, cShelf); cShelf.Margin = new Padding(0, 0, 1, 0); InitLineBoxControl(cShelf, f3); } else if (sortingLineBox.PARENTLINEBOX == "2" && sortingLineBox.ABANDONPARENT == "2" && sortingLineBox.SublineSeq == 1) { C_Shelf cShelf = CreateShelf(sortingLineBox); cShelves.Add(cShelf.Name, cShelf); cShelf.Margin = new Padding(0, 0, 1, 0); InitLineBoxControl(cShelf, f5); } else if (sortingLineBox.PARENTLINEBOX == "2" && sortingLineBox.ABANDONPARENT == "2" && sortingLineBox.SublineSeq == 2) { C_Shelf cShelf = CreateShelf(sortingLineBox); cShelves.Add(cShelf.Name, cShelf); cShelf.Margin = new Padding(0, 0, 1, 0); InitLineBoxControl(cShelf, f5); } else if (sortingLineBox.PARENTLINEBOX == "2" && sortingLineBox.ABANDONPARENT == "1" && sortingLineBox.SublineSeq == 1) { C_Shelf cShelf = CreateShelf(sortingLineBox); cShelves.Add(cShelf.Name, cShelf); cShelf.Margin = new Padding(0, 0, 1, 0); InitLineBoxControl(cShelf, f7); } else if (sortingLineBox.PARENTLINEBOX == "2" && sortingLineBox.ABANDONPARENT == "1" && sortingLineBox.SublineSeq == 2) { C_Shelf cShelf = CreateShelf(sortingLineBox); if (sortingLineBox.LineBoxCode == "123") { cShelf = CreateShelf(sortingLineBox); } else { cShelf = CreateShelf(sortingLineBox); } cShelves.Add(cShelf.Name, cShelf); cShelf.Margin = new Padding(0, 0, 1, 0); InitLineBoxControl(cShelf, f7); } } } //如果不能下达任务根据老的列表,给数码管发信号 SortingTaskIssued sortingTaskIssued = SortingTaskIssued.GetSortingTaskIssued("0"); if (sortingTaskIssued.PLCFLAG == 1) { ATOPTagSdk.instance.SetOrderNixielight(SortingLineTaskQueue.GetInstance().SortingLineTasks); UpdateLineboxNum(); } //是否显示烟仓容量 if (chkshowqty.Checked) { chkshowqty_CheckedChanged(null, null); } }