Ejemplo n.º 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<PartsInfoClassByPurchaseBill>();
         PartsInfoClassByPurchaseBill partsInfo = new PartsInfoClassByPurchaseBill();
         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["purchase_billing_id"].Value.ToString()))
                     {
                         partsInfo = new PartsInfoClassByPurchaseBill();
                         partsInfo.billID = dr.Cells["purchase_billing_id"].Value.ToString();
                         partsInfo.parts_code = dr.Cells["parts_code"].Value.ToString();
                         List_PartInfo.Add(partsInfo);
                     }
                 }
             }
         }
         if (List_PlanID.Count > 0)
         {
             foreach (string billid in List_PlanID)
             {
                 DataTable dt_parts_purchase = DBHelper.GetTable("查询采购开单配件表信息", "tb_parts_purchase_billing_p", "*", " purchase_billing_id='" + billid + "' 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 PartsInfoClassByPurchaseBill();
                         partsInfo.billID = dt_parts_purchase.Rows[i]["purchase_billing_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; }
 }
Ejemplo n.º 2
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 <PartsInfoClassByPurchaseBill>();
         PartsInfoClassByPurchaseBill partsInfo = new PartsInfoClassByPurchaseBill();
         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["purchase_billing_id"].Value.ToString()))
                     {
                         partsInfo            = new PartsInfoClassByPurchaseBill();
                         partsInfo.billID     = dr.Cells["purchase_billing_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 billid in List_PlanID)
             {
                 DataTable dt_parts_purchase = DBHelper.GetTable("查询采购开单配件表信息", "tb_parts_purchase_billing_p", "*", " purchase_billing_id='" + billid + "' and isnull(finish_counts,0)<isnull(business_counts,0) ", "", "");
                 if (dt_parts_purchase.Rows.Count > 0)
                 {
                     for (int i = 0; i < dt_parts_purchase.Rows.Count; i++)
                     {
                         partsInfo            = new PartsInfoClassByPurchaseBill();
                         partsInfo.billID     = dt_parts_purchase.Rows[i]["purchase_billing_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; }
 }