Beispiel #1
0
 /// <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 <PartsInfoClassByPurchaseOrder>();
         PartsInfoClassByPurchaseOrder partsInfo = new PartsInfoClassByPurchaseOrder();
         string CheckPlanID = string.Empty;
         //1.判断获取采购订单列表中选中的项
         if (dgPurchaseOrder.Rows.Count > 0)
         {
             foreach (DataGridViewRow dr in dgPurchaseOrder.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["order_id"].Value.ToString()))
                     {
                         partsInfo            = new PartsInfoClassByPurchaseOrder();
                         partsInfo.orderID    = dr.Cells["order_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 order_id in List_PlanID)
             {
                 DataTable dt_parts_purchase = DBHelper.GetTable("查询采购订单配件表信息", "tb_parts_purchase_order_p", "*", " order_id='" + order_id + "' 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 PartsInfoClassByPurchaseOrder();
                         partsInfo.orderID    = dt_parts_purchase.Rows[i]["order_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<PartsInfoClassByPurchaseOrder>();
         PartsInfoClassByPurchaseOrder partsInfo = new PartsInfoClassByPurchaseOrder();
         string CheckPlanID = string.Empty;
         //1.判断获取采购订单列表中选中的项
         if (dgPurchaseOrder.Rows.Count > 0)
         {
             foreach (DataGridViewRow dr in dgPurchaseOrder.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["order_id"].Value.ToString()))
                     {
                         partsInfo = new PartsInfoClassByPurchaseOrder();
                         partsInfo.orderID = dr.Cells["order_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 order_id in List_PlanID)
             {
                 DataTable dt_parts_purchase = DBHelper.GetTable("查询采购订单配件表信息", "tb_parts_purchase_order_p", "*", " order_id='" + order_id + "' 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 PartsInfoClassByPurchaseOrder();
                         partsInfo.orderID = dt_parts_purchase.Rows[i]["order_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; }
 }