예제 #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<PartsInfoClassBySaleBill>();
         PartsInfoClassBySaleBill partsInfo = new PartsInfoClassBySaleBill();
         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["sale_billing_id"].Value.ToString()))
                     {
                         partsInfo = new PartsInfoClassBySaleBill();
                         partsInfo.sale_billing_id = dr.Cells["sale_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_sale = DBHelper.GetTable("查询销售开单配件表信息", "tb_parts_sale_billing_p", "*", " sale_billing_id='" + billid + "' 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 PartsInfoClassBySaleBill();
                         partsInfo.sale_billing_id = dt_parts_sale.Rows[i]["sale_billing_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; }
 }
예제 #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 <PartsInfoClassBySaleBill>();
         PartsInfoClassBySaleBill partsInfo = new PartsInfoClassBySaleBill();
         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["sale_billing_id"].Value.ToString()))
                     {
                         partsInfo = new PartsInfoClassBySaleBill();
                         partsInfo.sale_billing_id = dr.Cells["sale_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_sale = DBHelper.GetTable("查询销售开单配件表信息", "tb_parts_sale_billing_p", "*", " sale_billing_id='" + billid + "' and isnull(finish_count,0)<isnull(business_count,0) ", "", "");
                 if (dt_parts_sale.Rows.Count > 0)
                 {
                     for (int i = 0; i < dt_parts_sale.Rows.Count; i++)
                     {
                         partsInfo = new PartsInfoClassBySaleBill();
                         partsInfo.sale_billing_id = dt_parts_sale.Rows[i]["sale_billing_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; }
 }