private void Load_Lsv_NewOrderBOM() { listView_NewOrder.Items.Clear(); List <MaterialInfo> materialsList = new List <MaterialInfo>(); if (this.textProdNo.Text.Trim().Length > 0) { materialsList = _newOrderProductBOMs.GetProductBOMList(this.textProdNo.Text.Trim()); } int serialNumber = 1; foreach (var Bominfo in materialsList) { ListViewItem lsvBOMSubItem = new ListViewItem(); lsvBOMSubItem.Text = serialNumber++.ToString(); lsvBOMSubItem.SubItems.Add(Bominfo.MaterialNo.Trim()); lsvBOMSubItem.SubItems.Add(Bominfo.MaterialName.Trim()); lsvBOMSubItem.SubItems.Add((Bominfo.MaterialPcs * int.Parse(this.textNewOrderCount.Text.Trim())).ToString()); listView_NewOrder.Items.Add(lsvBOMSubItem); } this.txtNewOrderNo.Focus(); }
private void btn_Query_Click(object sender, EventArgs e) { //product info query if (this.txt_ProductNo.Text.Trim().Length > 0) { clearBOMText(); List <MaterialInfo> materialsList = new List <MaterialInfo>(); ProductBOMs _productBOMs = new ProductBOMs(); if (this.txt_ProductNo.Text.Trim().Length > 0) { materialsList = _productBOMs.GetProductBOMList(this.txt_ProductNo.Text.Trim()); materialsList = materialsList.OrderBy(o => o.MaterialSeq).ToList();//升序 if (materialsList.Count > 0) { fillMaterialsInfo(materialsList); this.txt_ProductName.Text = ProductBOMBLL.GetProductName(this.txt_ProductNo.Text.Trim()); } else { SpMessageBox.Show("没有查找到对应产品BOM信息, 请重新输入正确的产品号.", "产品信息维护"); } } } else { } }
private void Load_Lsv_BOMList() { listView_CurrentOrder.Items.Clear(); MainForm.CurrentOrderBOMList.Clear(); List <MaterialInfo> materialsList = new List <MaterialInfo>(); if (this.textProdNo.Text.Trim().Length > 0) { materialsList = _productBOMs.GetProductBOMList(this.textProdNo.Text.Trim()); materialsList = materialsList.OrderBy(o => o.MaterialSeq).ToList();//升序 CurrentOrderMaterialsList = materialsList; if (CurrentOrderMaterialsList.Count > 1) { for (int i = 1; i < CurrentOrderMaterialsList.Count; i++) { if (CurrentOrderMaterialsList[i].MaterialNo == CurrentOrderMaterialsList[i - 1].MaterialNo) { for (int j = i; j < CurrentOrderMaterialsList.Count; j++) { CurrentOrderMaterialsList[j].MaterialSeq = (byte)(CurrentOrderMaterialsList[j].MaterialSeq + 1); } } } } } int serialNumber = 1; foreach (var Bominfo in materialsList) { ListViewItem lsvBOMSubItem = new ListViewItem(); lsvBOMSubItem.Text = serialNumber++.ToString(); lsvBOMSubItem.SubItems.Add(Bominfo.MaterialNo.Trim()); lsvBOMSubItem.SubItems.Add(Bominfo.MaterialName.Trim()); lsvBOMSubItem.SubItems.Add(Bominfo.MaterialSeq.ToString()); //string aaa = MainForm.MaterialAndLabelList[0].MaterialNo; listView_CurrentOrder.Items.Add(lsvBOMSubItem); MainForm.CurrentOrderBOMList.Add(new MaterialAndLabel() { MaterialNo = Bominfo.MaterialNo.Trim(), LabelsNo = serialNumber - 1 }); } }