/// <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<PartsInfoClassBySalePlan>(); PartsInfoClassBySalePlan partsInfo = new PartsInfoClassBySalePlan(); string CheckPlanID = string.Empty; //1.判断获取采购计划单列表中选中的项 if (dgSalePlan.Rows.Count > 0) { foreach (DataGridViewRow dr in dgSalePlan.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["sale_plan_id"].Value.ToString())) { partsInfo = new PartsInfoClassBySalePlan(); partsInfo.sale_plan_id = dr.Cells["sale_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 sale_plan_id in List_PlanID) { DataTable dt_parts_sale = DBHelper.GetTable("查询销售计划单配件表信息", "tb_parts_sale_plan_p", "*", " sale_plan_id='" + sale_plan_id + "' and is_suspend=1 and finish_count<business_count ", "", ""); if (dt_parts_sale.Rows.Count > 0) { for (int i = 0; i < dt_parts_sale.Rows.Count; i++) { partsInfo = new PartsInfoClassBySalePlan(); partsInfo.sale_plan_id = dt_parts_sale.Rows[i]["sale_plan_id"].ToString(); partsInfo.parts_id = dt_parts_sale.Rows[i]["parts_id"].ToString(); partsInfo.parts_code = dt_parts_sale.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 <PartsInfoClassBySalePlan>(); PartsInfoClassBySalePlan partsInfo = new PartsInfoClassBySalePlan(); string CheckPlanID = string.Empty; //1.判断获取采购计划单列表中选中的项 if (dgSalePlan.Rows.Count > 0) { foreach (DataGridViewRow dr in dgSalePlan.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["sale_plan_id"].Value.ToString())) { partsInfo = new PartsInfoClassBySalePlan(); partsInfo.sale_plan_id = dr.Cells["sale_plan_id"].Value.ToString(); partsInfo.parts_code = dr.Cells["parts_code"].Value.ToString(); List_PartInfo.Add(partsInfo); } } } } if (List_PlanID.Count > 0) { foreach (string sale_plan_id in List_PlanID) { DataTable dt_parts_sale = DBHelper.GetTable("查询销售计划单配件表信息", "tb_parts_sale_plan_p", "*", " sale_plan_id='" + sale_plan_id + "' and is_suspend=1 and finish_count<business_count ", "", ""); if (dt_parts_sale.Rows.Count > 0) { for (int i = 0; i < dt_parts_sale.Rows.Count; i++) { partsInfo = new PartsInfoClassBySalePlan(); partsInfo.sale_plan_id = dt_parts_sale.Rows[i]["sale_plan_id"].ToString(); partsInfo.parts_code = dt_parts_sale.Rows[i]["parts_code"].ToString(); List_PartInfo.Add(partsInfo); } } } } DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { } finally { dgPlanRowIndex = -1; } }