private void toolStripMenuItem1_Click(object sender, EventArgs e)
 {
     try
     {
         //if (!string.IsNullOrEmpty(strBefore_orderId))
         //{
         //    List<SQLObj> listSql = new List<SQLObj>();
         //    UpdateMaintainInfo(listSql, strBefore_orderId, "0");
         //    DBHelper.BatchExeSQLMultiByTrans("更新前置单据状体", listSql);
         //}
         UCRepairCallbackImport CallbackImport = new UCRepairCallbackImport();
         CallbackImport.Fetchuc = this;
         CallbackImport.strTag = "1";
         CallbackImport.ShowDialog();
     }
     catch (Exception ex)
     {
         HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex);
     }
 }
        private void InitEventHandle() //注册控件相关事件
        {
            btnSave.Click += (sender, args) => Save();
            btnCancel.Click += delegate
            {
                UCForm.BindPageData();
                deleteMenuByTag(Tag.ToString(), UCForm.Name);
            };
            btnImport.Click += delegate
            {
                //var import = new UCMaintainSettlementImprot();
                //import.ShowDialog();
                //return;
                var callbackImport = new UCRepairCallbackImport {MaintainThreeGuarantyEdit = this, strTag = "4"};
                callbackImport.ShowDialog();
            };
            cbo_whether_yt.SelectedIndexChanged += delegate  //是否宇通车
            {
                //if (cbo_receipt_type.SelectedValue == null) return;
                //var selectedValue4BillType = cbo_receipt_type.SelectedValue == null ? "" : cbo_receipt_type.SelectedValue.ToString().ToUpper();
                if (cbo_whether_yt.SelectedValue == null) return;
                var selectedValue = cbo_whether_yt.SelectedValue == null ? "" : cbo_whether_yt.SelectedValue.ToString().ToUpper();
                if (selectedValue == DbDic2Enum.TRUE)
                {
                    lbl__vehicle_vin.Visible = true;
                    lbl_depot_no.Visible = true;
                    lbl_engine_num.Visible = true;
                }
                else
                {
                    lbl__vehicle_vin.Visible = false;
                    lbl_depot_no.Visible = false;
                    lbl_engine_num.Visible = false;
                }
            };
            cbo_whether_go_out.SelectedIndexChanged += delegate   //根据是否外出不同显示不同的可填字段
            {
                if (cbo_whether_go_out.SelectedValue == null) return;
                var selectedValue = cbo_whether_go_out.SelectedValue == null ? "" : cbo_whether_go_out.SelectedValue.ToString().ToUpper();
                pnl_goout_info.Visible = selectedValue == DbDic2Enum.TRUE;  //外出情况
                dtp_repairs_time.Focus();
            };
            btnCommit.Click += delegate
            {
                //if (!CheckControlValue()) return;
                //上报厂家/宇通
                if (windowStatus == WindowStatus.Add || windowStatus == WindowStatus.Copy)
                {
                    lbl_service_no.Text = CommonUtility.GetNewNo(DataSources.EnumProjectType.ThreeGuarantyService);
                }
                var result = SaveThreeGuarantyItem(DbDic2Enum.SYS_SERVICE_INFO_STATUS_YTJ);
                var id = windowStatus == WindowStatus.Edit ? TgId : _newTgId;
                if (UIAssistants.ThreeServiceAudit)
                {
                    if (result)
                    {
                        SaveAttachement(id);
                        SaveMaterialDetail(id);
                        if ((cbo_contain_man_hour_cost.SelectedValue == null ? "" : cbo_contain_man_hour_cost.SelectedValue.ToString().ToUpper()) == DbDic2Enum.TRUE)
                            SaveProjectData(id);
                        MessageBoxEx.Show("数据提交成功!", "操作提示");
                        return;
                    }
                    MessageBoxEx.Show("数据提交失败!", "操作提示");
                    return;
                }
                if (result)
                {
                    SaveAttachement(id);
                    SaveMaterialDetail(id);
                    if ((cbo_contain_man_hour_cost.SelectedValue == null
                        ? ""
                        : cbo_contain_man_hour_cost.SelectedValue.ToString().ToUpper()) == DbDic2Enum.TRUE)
                        SaveProjectData(id);
                    var resultStr = UCForm.Submit2Company(id, "100000001");
                    if (String.IsNullOrEmpty(resultStr))
                    {
                        MessageBoxEx.Show("三包服务单上报厂家成功!", "操作提示");
                    }
                    else
                    {
                        MessageBoxEx.Show("三包服务单上报厂家失败!", "操作提示");
                    }
                }
                else
                {
                    MessageBoxEx.Show("上报厂家失败!", "操作提示");
                }
            };
            cbo_contain_man_hour_cost.SelectedIndexChanged += delegate   //根据是否包含工时费决定是否显示维修项目表
            {
                if (cbo_contain_man_hour_cost.SelectedValue == null) return;
                var selectedValueManHourCost = cbo_contain_man_hour_cost.SelectedValue == null ? "" : cbo_contain_man_hour_cost.SelectedValue.ToString().ToUpper();
                if (selectedValueManHourCost == DbDic2Enum.TRUE) //是
                {
                    if(!tabControlExBottom.TabPages.Contains(tb_wxxm))
                        tabControlExBottom.TabPages.Insert(0,tb_wxxm);
                    tabControlExBottom.SelectTab(tb_wxxm);
                }
                else
                {
                    if (tabControlExBottom.TabPages.Contains(tb_wxxm))
                        tabControlExBottom.TabPages.Remove(tb_wxxm);
                }
                dtp_repairs_time.Focus();
            };
            #region 根据宇通单据类型不同显示不同的可填字段
            cbo_receipt_type.SelectedIndexChanged += delegate   
            {
                pnl_promise_guarantee.Visible = false;  //维修 -- 特殊约定质保

                pnl_approver_name_yt.Visible = false;   //政策照顾 -- 宇通批准信息

                pnl_product_notice_no.Visible = false;  //产品改进 -- 产品改进通知

                pnl_cost_type_service_fwhd.Visible = false; //服务活动 -- 费用类型

                pnl_custome_property.Visible = true;
                pnl_cust_address.Visible = true;
                pnl_customer_postcode.Visible = true;
                pnl_linkman.Visible = true;
                pnl_link_man_mobi.Visible = true;
                pnl_vehicle_use_corp.Visible = true;
                pnl_vehicle_location.Visible = true;

                pnl_driving_license_no.Visible = true;
                pnl_travel_mileage.Visible = true;
                pnl_whether_yt.Visible = true;
                pnl_maintain_time.Visible = true;
                pnl_maintain_mileage.Visible = true;
                pnl_whether_yt.Visible = false;
                lbl_vehicle_model.Visible = true;

                pnl_customer_info.Height = 130;
                pnl_vehicle.Height = 100;

                tableLayoutPanel3.Controls.Remove(pnl_driving_license_no);

                var selectedValue = cbo_receipt_type.SelectedValue == null ? "" : cbo_receipt_type.SelectedValue.ToString().ToUpper();

                if (selectedValue == DbDic2Enum.BILL_TYPE_YT_100000007) //配件三包
                {
                    tableLayoutPanel3.Controls.Add(pnl_driving_license_no, 1, 2);

                    pnl_part_info.Visible = true;
                    var selectedValueManHourCost = cbo_contain_man_hour_cost.SelectedValue == null ? "" : cbo_contain_man_hour_cost.SelectedValue.ToString().ToUpper();
                    if (selectedValueManHourCost == DbDic2Enum.TRUE) //是
                    {
                        if (!tabControlExBottom.TabPages.Contains(tb_wxxm))
                            tabControlExBottom.TabPages.Insert(0, tb_wxxm);
                        tabControlExBottom.SelectTab(tb_wxxm);
                    }
                    else
                    {
                        if (!tabControlExBottom.TabPages.Contains(tb_wxxm))
                            tabControlExBottom.TabPages.Insert(0, tb_wxxm);
                        tabControlExBottom.SelectTab(tb_wxxm);
                    }
                }
                else
                {
                    tableLayoutPanel3.Controls.Add(pnl_driving_license_no, 3, 0);

                    if (!tabControlExBottom.TabPages.Contains(tb_wxxm))
                        tabControlExBottom.TabPages.Insert(0, tb_wxxm);
                    tabControlExBottom.SelectTab(tb_wxxm);
                    pnl_part_info.Visible = false;

                    var selectedValue4WhetherYt = cbo_whether_yt.SelectedValue == null ? "" : cbo_whether_yt.SelectedValue.ToString().ToUpper();
                    if (selectedValue4WhetherYt == DbDic2Enum.TRUE)
                    {
                        lbl__vehicle_vin.Visible = true;
                        lbl_depot_no.Visible = true;
                        lbl_engine_num.Visible = true;
                    }
                    else
                    {
                        lbl__vehicle_vin.Visible = false;
                        lbl_depot_no.Visible = false;
                        lbl_engine_num.Visible = false;
                    }
                }

                if (selectedValue == DbDic2Enum.BILL_TYPE_YT_100000007) //配件三包
                {
                    pnl_cust_address.Visible = false;
                    pnl_customer_postcode.Visible = false;
                    pnl_linkman.Visible = false;
                    pnl_link_man_mobi.Visible = false;
                    pnl_vehicle_location.Visible = false;

                    pnl_driving_license_no.Visible = false;
                    pnl_travel_mileage.Visible = false;
                    pnl_whether_yt.Visible = false;
                    pnl_maintain_time.Visible = false;
                    pnl_whether_yt.Visible = true;
                    pnl_maintain_mileage.Visible = false;

                }
                else if (selectedValue == DbDic2Enum.BILL_TYPE_YT_100000003) //维修
                {
                    pnl_promise_guarantee.Visible = true;   //特殊约定质保
                }
                else if (selectedValue == DbDic2Enum.BILL_TYPE_YT_100000005) //政策照顾
                {
                    pnl_approver_name_yt.Visible = true;    //宇通批准信息
                }
                else if (selectedValue == DbDic2Enum.BILL_TYPE_YT_100000006) //产品改进
                {
                    pnl_product_notice_no.Visible = true;   //产品改进通知
                }
                else if (selectedValue == DbDic2Enum.BILL_TYPE_YT_100000004) //服务活动
                {
                    pnl_cost_type_service_fwhd.Visible = true;  //费用类型
                }

                if (selectedValue == DbDic2Enum.BILL_TYPE_YT_100000007 ||
                    selectedValue == DbDic2Enum.BILL_TYPE_YT_100000003 ||
                    selectedValue == DbDic2Enum.BILL_TYPE_YT_100000005 ||
                    selectedValue == DbDic2Enum.BILL_TYPE_YT_100000006 ||
                    selectedValue == DbDic2Enum.BILL_TYPE_YT_100000004)
                {
                    pnl_fault.Height = 170;
                    pnl_fault_duty_corp.Visible = true;
                    pnl_fault_cause.Visible = true;
                    pnl_fault_system.Visible = true;
                    pnl_fault_assembly.Visible = true;
                    pnl_fault_part.Visible = true;
                    pnl_fault_schema.Visible = true;
                    pnl_fault_describe.Visible = true;
                    pnl_reason_analysis.Visible = true;
                    pnl_dispose_result.Visible = true;
                }
                else
                {
                    pnl_fault.Height = 75;
                    pnl_fault_duty_corp.Visible = false;
                    pnl_fault_cause.Visible = false;
                    pnl_fault_system.Visible = false;
                    pnl_fault_assembly.Visible = false;
                    pnl_fault_part.Visible = false;
                    pnl_fault_schema.Visible = false;
                    pnl_fault_describe.Visible = false;
                    pnl_reason_analysis.Visible = false;
                    pnl_dispose_result.Visible = false;
                }

                if (selectedValue == DbDic2Enum.BILL_TYPE_YT_100000000) //新车报道
                {
                    if (tabControlExBottom.TabPages.Contains(tb_wxyl))
                        tabControlExBottom.TabPages.Remove(tb_wxyl);
                }
                else
                {
                    if (!tabControlExBottom.TabPages.Contains(tb_wxyl))
                        tabControlExBottom.TabPages.Insert(0, tb_wxyl);
                    tabControlExBottom.SelectTab(tb_wxyl);
                }
                if (selectedValue == DbDic2Enum.BILL_TYPE_YT_100000007 ||
                    selectedValue == DbDic2Enum.BILL_TYPE_YT_100000003 ||
                    selectedValue == DbDic2Enum.BILL_TYPE_YT_100000005 ||
                    selectedValue == DbDic2Enum.BILL_TYPE_YT_100000006 ||
                    selectedValue == DbDic2Enum.BILL_TYPE_YT_100000004 ||
                    selectedValue == DbDic2Enum.BILL_TYPE_YT_100000000)
                {
                    tb_wxxm.Enabled = true;
                }
                else
                {
                    tb_wxxm.Enabled = false;
                }
                dtp_repairs_time.Focus();
            };
            #endregion
        }
 private void toolStripMenuItem1_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(strBefore_orderId))
     {
         List<SQLObj> listSql = new List<SQLObj>();
         UpdateMaintainInfo(listSql, strBefore_orderId, "0");
         DBHelper.BatchExeSQLMultiByTrans("更新前置单据导入状态", listSql);
     }
     UCRepairCallbackImport CallbackImport = new UCRepairCallbackImport();
     CallbackImport.PatrsRuc = this;
     CallbackImport.strTag = "2";
     CallbackImport.ShowDialog();
 }