/// <summary> 确定按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOK_Click(object sender, EventArgs e) { try { List <string> List_PlanID = new List <string>(); List_PartInfo = new List <PartsInfoClassByPurchasePlan>(); PartsInfoClassByPurchasePlan partsInfo = new PartsInfoClassByPurchasePlan(); string CheckPlanID = string.Empty; //1.判断获取采购计划单列表中选中的项 if (dgPurchasePlan.Rows.Count > 0) { foreach (DataGridViewRow dr in dgPurchasePlan.Rows) { object isCheck = dr.Cells["colCheck"].EditedFormattedValue; if (isCheck != null && (bool)isCheck) { List_PlanID.Add(dr.Cells["ID"].Value.ToString()); } } } //2.判断获取配件明细列表中选中的项 if (dgAccessoriesDetail.Rows.Count > 0) { foreach (DataGridViewRow dr in dgAccessoriesDetail.Rows) { object isCheck = dr.Cells["colDetailCheck"].EditedFormattedValue; if (isCheck != null && (bool)isCheck) { if (!List_PlanID.Contains(dr.Cells["plan_id"].Value.ToString())) { partsInfo = new PartsInfoClassByPurchasePlan(); partsInfo.planID = dr.Cells["plan_id"].Value.ToString(); partsInfo.parts_id = dr.Cells["parts_id"].Value.ToString(); partsInfo.parts_code = dr.Cells["parts_code"].Value.ToString(); List_PartInfo.Add(partsInfo); } } } } if (List_PlanID.Count > 0) { foreach (string planid in List_PlanID) { DataTable dt_parts_purchase = DBHelper.GetTable("查询采购计划单配件表信息", "tb_parts_purchase_plan_p", "*", " plan_id='" + planid + "' and is_suspend=1 and finish_counts<business_counts ", "", ""); if (dt_parts_purchase.Rows.Count > 0) { for (int i = 0; i < dt_parts_purchase.Rows.Count; i++) { partsInfo = new PartsInfoClassByPurchasePlan(); partsInfo.planID = dt_parts_purchase.Rows[i]["plan_id"].ToString(); partsInfo.parts_id = dt_parts_purchase.Rows[i]["parts_id"].ToString(); partsInfo.parts_code = dt_parts_purchase.Rows[i]["parts_code"].ToString(); List_PartInfo.Add(partsInfo); } } } } DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { } finally { dgPlanRowIndex = -1; } }
/// <summary> 确定按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOK_Click(object sender, EventArgs e) { try { List<string> List_PlanID = new List<string>(); List_PartInfo = new List<PartsInfoClassByPurchasePlan>(); PartsInfoClassByPurchasePlan partsInfo = new PartsInfoClassByPurchasePlan(); string CheckPlanID = string.Empty; //1.判断获取采购计划单列表中选中的项 if (dgPurchasePlan.Rows.Count > 0) { foreach (DataGridViewRow dr in dgPurchasePlan.Rows) { object isCheck = dr.Cells["colCheck"].EditedFormattedValue; if (isCheck != null && (bool)isCheck) { List_PlanID.Add(dr.Cells["ID"].Value.ToString()); } } } //2.判断获取配件明细列表中选中的项 if (dgAccessoriesDetail.Rows.Count > 0) { foreach (DataGridViewRow dr in dgAccessoriesDetail.Rows) { object isCheck = dr.Cells["colDetailCheck"].EditedFormattedValue; if (isCheck != null && (bool)isCheck) { if (!List_PlanID.Contains(dr.Cells["plan_id"].Value.ToString())) { partsInfo = new PartsInfoClassByPurchasePlan(); partsInfo.planID = dr.Cells["plan_id"].Value.ToString(); partsInfo.parts_code = dr.Cells["parts_code"].Value.ToString(); List_PartInfo.Add(partsInfo); } } } } if (List_PlanID.Count > 0) { foreach (string planid in List_PlanID) { DataTable dt_parts_purchase = DBHelper.GetTable("查询采购计划单配件表信息", "tb_parts_purchase_plan_p", "*", " plan_id='" + planid + "' and is_suspend=1 and finish_counts<business_counts ", "", ""); if (dt_parts_purchase.Rows.Count > 0) { for (int i = 0; i < dt_parts_purchase.Rows.Count; i++) { partsInfo = new PartsInfoClassByPurchasePlan(); partsInfo.planID = dt_parts_purchase.Rows[i]["plan_id"].ToString(); partsInfo.parts_code = dt_parts_purchase.Rows[i]["parts_code"].ToString(); List_PartInfo.Add(partsInfo); } } } } DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { } finally { dgPlanRowIndex = -1; } }