Пример #1
0
        /// <summary>
        /// 窗体加载方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UCSalePlanManager_Load(object sender, EventArgs e)
        {
            //base.SetBaseButtonStatus();
            //base.SetButtonVisiableManager();
            string[] NotReadOnlyColumnsName = new string[] { "colCheck" };
            CommonFuncCall.SetColumnReadOnly(gvSalePlanList, NotReadOnlyColumnsName);
            //列表的右键操作功能
            base.SetContentMenuScrip(gvSalePlanList);
            //禁止列表自增列
            gvSalePlanList.AutoGenerateColumns = false;
            //设置查询按钮和清除按钮样式
            UIAssistants.SetButtonStyle4QueryAndClear(this, btnSearch, btnClear);

            dateTimeStart.Value = DateTime.Now.AddDays(-DateTime.Now.Day + 1);
            dateTimeEnd.Value   = DateTime.Now;

            string com_id = GlobalStaticObj.CurrUserCom_Id;//公司ID

            CommonFuncCall.BindDepartment(ddlDepartment, com_id, "全部");
            CommonFuncCall.BindHandle(ddlResponsiblePerson, "", "全部");
            CommonFuncCall.BindOrderStatus(ddlState, true);
            BindgvSalePlanList();
        }
Пример #2
0
        /// <summary>
        /// 窗体加载事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UCPurchaseBillManang_Load(object sender, EventArgs e)
        {
            base.SetBaseButtonStatus();
            base.SetButtonVisiableManager();
            string[] NotReadOnlyColumnsName = new string[] { "colCheck" };
            CommonFuncCall.SetColumnReadOnly(gvPurchaseOrderList, NotReadOnlyColumnsName);
            UIAssistants.SetButtonStyle4QueryAndClear(btnSearch, btnClear);  //设置查询按钮和清除按钮样式

            //单据类型
            CommonFuncCall.BindPurchaseOrderType(ddlorder_type, true, "全部");
            //运输方式
            CommonFuncCall.BindComBoxDataSource(ddltrans_way, "sys_trans_mode", "全部");
            //发票类型
            CommonFuncCall.BindComBoxDataSource(ddlreceipt_type, "sys_receipt_type", "全部");
            //单据状态
            CommonFuncCall.BindOrderStatus(ddlState, true);

            CommonFuncCall.BindCompany(ddlCompany, "全部");
            CommonFuncCall.BindDepartment(ddlDepartment, "", "全部");
            CommonFuncCall.BindHandle(ddlhandle, "", "全部");

            BindgvPurchaseOrderList();
        }
Пример #3
0
        /// <summary> 窗体初始化
        /// </summary>
        public UCChooseSaleOrder(string cust_id)
        {
            InitializeComponent();

            this.cust_id                 = cust_id;
            dgPurchaseOrder.ReadOnly     = false;
            dgAccessoriesDetail.ReadOnly = false;
            //unit_id.ReadOnly = true;

            dateTimeStart.Value     = DateTime.Now;
            dateTimeEnd.Value       = DateTime.Now;
            datedelivery_time.Value = DateTime.Now;
            //CommonFuncCall.BindUnit(unit_id);

            //公司ID
            string com_id = GlobalStaticObj.CurrUserCom_Id;

            CommonFuncCall.BindDepartment(ddlorg_id, com_id, "请选择");
            CommonFuncCall.BindHandle(ddlhandle, "", "请选择");
            CommonFuncCall.BindHandle(ddloperator, "", "请选择");

            BinddgPurchaseOrder();
        }
Пример #4
0
        /// <summary> 初始化窗体
        /// </summary>
        /// <param name="purchase_order_yt_id"></param>
        /// <param name="uc"></param>
        public UCYTView(string purchase_order_yt_id, UCYTManager uc)
        {
            InitializeComponent();
            this.uc = uc;
            this.purchase_order_yt_id = purchase_order_yt_id;
            base.SetBaseButtonStatus();
            if (uc != null)
            {
                base.SetButtonVisiableView();
                base.btnSync.Visible = true;
            }

            base.SyncEvent += new ClickHandler(UCYTView_SyncEvent);
            base.InvalidOrActivationEvent += new ClickHandler(UCPurchasePlanOrderView_InvalidOrActivationEvent);
            string[] NotReadOnlyColumnsName = new string[] { "colCheck" };
            CommonFuncCall.SetColumnReadOnly(gvPurchaseList, NotReadOnlyColumnsName);

            //CommonFuncCall.BindUnit(unit_id);
            LoadInfo(purchase_order_yt_id);
            GetAccessories(purchase_order_yt_id);
            //动态创建三种订单的panel区域
            LoadAllOrderTypeInfo();
        }
Пример #5
0
 /// <summary>
 ///  窗体加载初始化
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void UCStockCheckManager_Load(object sender, EventArgs e)
 {
     try
     {
         //获取默认系统时间
         dateTimeStart.Value = DateTime.Now.AddMonths(-3).ToShortDateString();
         dateTimeEnd.Value   = DateTime.Now.ToString();
         //获取仓库名称
         CommonFuncCall.BindWarehouse(ComBwh_name, "请选择");
         //单据状态
         CommonFuncCall.BindOrderStatus(ComBorder_status_name, true);
         //公司
         CommonFuncCall.BindCompany(ComBcom_name, "全部");
         //部门
         CommonFuncCall.BindDepartment(ComBorg_name, "", "全部");
         //经办人
         CommonFuncCall.BindHandle(ComBhandle_name, "", "全部");
     }
     catch (Exception ex)
     {
         MessageBoxEx.Show(ex.Message, "异常提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
     }
 }
Пример #6
0
        public UCPurchasePlanOrderView(string plan_id, UCPurchasePlanOrderManager uc)
        {
            InitializeComponent();
            this.uc     = uc;
            this.planId = plan_id;
            base.SetBaseButtonStatus();
            base.SetButtonVisiableView();
            base.btnSave.Visible = true;
            if (uc == null)
            {
                base.SetBaeButtonEnable();
            }

            //CommonFuncCall.BindUnit(unit_id);
            LoadInfo(plan_id);
            GetAccessories(plan_id);

            string[] NotReadOnlyColumnsName = new string[] { "colCheck", "is_suspend" };
            CommonFuncCall.SetColumnReadOnly(gvPurchasePlanList, NotReadOnlyColumnsName);
            base.SaveEvent += new ClickHandler(UCPurchasePlanOrderView_SaveEvent);
            base.InvalidOrActivationEvent += new ClickHandler(UCPurchasePlanOrderView_InvalidOrActivationEvent);
            gvPurchasePlanList.CellClick  += new DataGridViewCellEventHandler(gvPurchasePlanList_CellClick);
        }
Пример #7
0
        /// <summary> 加载窗体
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UCSaleOrderManager_Load(object sender, EventArgs e)
        {
            base.SetBaseButtonStatus();
            base.SetButtonVisiableManager();
            string[] NotReadOnlyColumnsName = new string[] { "colCheck" };
            CommonFuncCall.SetColumnReadOnly(gvPurchaseOrderList, NotReadOnlyColumnsName);
            UIAssistants.SetButtonStyle4QueryAndClear(btnSearch, btnClear);  //设置查询按钮和清除按钮样式

            dateTimeStart.Value = DateTime.Now;
            dateTimeEnd.Value   = DateTime.Now;

            //运输方式
            CommonFuncCall.BindComBoxDataSource(ddltrans_mode, "sys_trans_mode", "全部");
            //结算方式
            CommonFuncCall.BindBalanceWay(ddlclosing_way, "全部");

            CommonFuncCall.BindCompany(ddlCompany, "全部");
            CommonFuncCall.BindDepartment(ddlDepartment, "", "全部");
            CommonFuncCall.BindHandle(ddlhandle, "", "全部");
            CommonFuncCall.BindOrderStatus(ddlState, true);

            BindgvSaleOrderList();
        }
Пример #8
0
        public Hashtable PartHTable        = new Hashtable();     //存放开单主键ID与对应的配件编号

        #endregion

        #region 窗体初始化
        public UCImportBilling(string Bill_Type, string Billing_Type)
        {
            InitializeComponent();
            this.Text           = PrefixCaption + Billing_Type;                   //获取主窗体标题内容
            this.BillType       = Bill_Type;                                      //获取出入库单据类型
            this.BillingType    = Billing_Type;                                   //获取开单类型
            dateTimeStart.Value = DateTime.Now.AddMonths(-3).ToShortDateString(); //开始时间
            dateTimeEnd.Value   = DateTime.Now.ToShortDateString();               //结束时间
            //CommonFuncCall.BindUnit(unit);//从码表中获取单位名称
            if (Billing_Type == SaleBilling)
            {
                arrival_date.Visible = false;                           //隐藏到货时期
            }
            //单据列表
            dgBillList.ReadOnly = false;
            foreach (DataGridViewColumn dgCol in dgBillList.Columns)
            {
                if (dgCol.Name != colCheck.Name)
                {
                    dgCol.ReadOnly = true;
                }
            }
            //配件列表
            dgPartslist.ReadOnly = false;
            foreach (DataGridViewColumn dgCol in dgPartslist.Columns)
            {
                if (dgCol.Name != colDetailCheck.Name)
                {
                    dgCol.ReadOnly = true;
                }
            }
            string com_id = GlobalStaticObj.CurrUserCom_Id;                 //公司ID

            CommonFuncCall.BindDepartment(ddlorg_id, com_id, DefaultValue); //部门名称
            CommonFuncCall.BindHandle(ddlhandle, "", DefaultValue);         //经手人
            CommonFuncCall.BindHandle(ddloperator, "", DefaultValue);       //操作人
        }
Пример #9
0
        public Hashtable PartHTable = new Hashtable();                                        //存放开单主键ID与对应的配件编号

        #endregion

        #region 窗体初始化
        public UCImportBilling(string Bill_Type, string Billing_Type)
        {
            InitializeComponent();
            UIAssistants.SetButtonStyle4QueryAndClear(btnSearch, btnClear); //设置查询按钮和清除按钮样式
            this.Text           = PrefixCaption + Billing_Type;             //获取主窗体标题内容
            this.BillType       = Bill_Type;                                //获取出入库单据类型
            this.BillingType    = Billing_Type;                             //获取开单类型
            dateTimeStart.Value = DateTime.Now.AddMonths(-3).ToString();    //开始时间
            dateTimeEnd.Value   = DateTime.Now.ToString();                  //结束时间
            if (Billing_Type == SaleBilling)
            {
                arrival_date.Visible = false;                           //隐藏到货时期
            }
            //单据列表
            dgBillList.ReadOnly = false;
            foreach (DataGridViewColumn dgCol in dgBillList.Columns)
            {
                if (dgCol.Name != colCheck.Name)
                {
                    dgCol.ReadOnly = true;
                }
            }
            //配件列表
            dgPartslist.ReadOnly = false;
            foreach (DataGridViewColumn dgCol in dgPartslist.Columns)
            {
                if (dgCol.Name != colDetailCheck.Name)
                {
                    dgCol.ReadOnly = true;
                }
            }
            string com_id = GlobalStaticObj.CurrUserCom_Id;                   //公司ID

            CommonFuncCall.BindDepartment(ddlorg_name, com_id, DefaultValue); //部门名称
            CommonFuncCall.BindHandle(ddlhandle, "", DefaultValue);           //经手人
            GetBillResult();                                                  //获取单据查询结果
        }
Пример #10
0
        /// <summary>
        /// 加载仓库档案信息
        /// </summary>
        private void LoadInfo(string wareHouseId)
        {
            if (!string.IsNullOrEmpty(wareHouseId))
            {
                //1.加载仓库档案主信息
                DataTable dt = DBHelper.GetTable("查看一条仓库档案信息", "v_warehouse_companyname_username", "*", " wh_id='" + wareHouseId + "'", "", "");
                if (dt != null && dt.Rows.Count > 0)
                {
                    tb_warehouse tb_warehouse_Model = new tb_warehouse();
                    CommonFuncCall.SetModlByDataTable(tb_warehouse_Model, dt);
                    CommonFuncCall.SetShowControlValue(this, tb_warehouse_Model, "View");
                    lblcom_id.Text = dt.Rows[0]["com_name"].ToString();

                    DataSources.EnumDataSources enumDataSources = (DataSources.EnumDataSources)Convert.ToInt16(tb_warehouse_Model.data_source);
                    lbldata_source.Text = DataSources.GetDescription(enumDataSources, true);

                    if (!string.IsNullOrEmpty(tb_warehouse_Model.county))
                    {
                        lblwh_address.Text = CommonFuncCall.GetAddress(tb_warehouse_Model.county) + " " + lblwh_address.Text;
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(tb_warehouse_Model.city))
                        {
                            lblwh_address.Text = CommonFuncCall.GetAddress(tb_warehouse_Model.city) + " " + lblwh_address.Text;
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(tb_warehouse_Model.province))
                            {
                                lblwh_address.Text = CommonFuncCall.GetAddress(tb_warehouse_Model.province) + " " + lblwh_address.Text;
                            }
                        }
                    }
                }
            }
        }
Пример #11
0
        private void UCReceivableDanDetail_Load(object sender, EventArgs e)
        {
            //绑定结算方式
            CommonFuncCall.BindBalanceWayByItem(cboBalanceWay, "全部");
            //绑定结算账户
            CommonFuncCall.BindAccount(cboPaymentAccount, "全部");
            //客户类别
            CommonFuncCall.BindComBoxDataSource(cboCust_type, "sys_customer_category", "全部");
            //公司
            CommonFuncCall.BindCompany(cboCompany, "全部");
            //是否会员
            DataSources.BindComBoxDataEnum(cboIsMember, typeof(DataSources.EnumYesNo), true);
            //绑定收款类型
            DataSources.BindComBoxDataEnum(cboPaymentType, typeof(DataSources.EnumReceivableType), true);
            listNegative = new List <string>();
            listNegative.Add("金额");

            txtcCust_code.Text              = custCode;
            txtCust_name.Caption            = custName;
            cboCust_type.SelectedValue      = custType;
            cboIsMember.SelectedValue       = is_member;
            cboBalanceWay.SelectedValue     = balanceWay;
            cboPaymentType.SelectedValue    = receivableType;
            cboPaymentAccount.SelectedValue = account;
            dicreate_time.StartDate         = startDate;
            dicreate_time.EndDate           = endDate;
            cboCompany.SelectedValue        = company;
            cboorg_id.SelectedValue         = orgID;

            BindData();

            //双击查看明细,要手动调用权限
            if (this.Name != "CL_BusinessAnalysis_ARAP_RecDanDet")
            {
                base.RoleButtonStstus("CL_BusinessAnalysis_ARAP_RecDanDet");
            }
        }
Пример #12
0
        private void UCReceivableDetail_Load(object sender, EventArgs e)
        {
            //客户类别
            CommonFuncCall.BindComBoxDataSource(cboCust_type, "sys_customer_category", "全部");
            //公司
            CommonFuncCall.BindCompany(cboCompany, "全部");
            //是否会员
            DataSources.BindComBoxDataEnum(cboIsMember, typeof(DataSources.EnumYesNo), true);
            base.listNegative = new List <string>();
            listNegative.Add("其中商业折扣"); //其中商业折扣
            listNegative.Add("本期付款");   //本期付款
            listNegative.Add("其中现金折扣"); //其中现金折扣
            listNegative.Add("期末应付");   //期末应付

            txtcCust_code.Text         = custCode;
            txtCust_name.Caption       = custName;
            cboCust_type.SelectedValue = custType;
            cboIsMember.SelectedValue  = is_member;
            dicreate_time.StartDate    = startDate;
            dicreate_time.EndDate      = endDate;
            cboCompany.SelectedValue   = company;
            cboorg_id.SelectedValue    = orgID;
            BindData();
        }
Пример #13
0
 public void GetControlInfo(tb_parts_purchase_order_2 model)
 {
     if (!string.IsNullOrEmpty(ddtreq_delivery_time.Value))
     {
         ddtreq_delivery_time.Value = Convert.ToDateTime(ddtreq_delivery_time.Value).ToShortDateString() + " 23:59:59";
     }
     CommonFuncCall.SetModelObjectValue(this, model);
     if (!string.IsNullOrEmpty(ddlemergency_level.SelectedValue.ToString()))
     {
         model.emergency_level_name = ddlemergency_level.SelectedItem.ToString();
     }
     if (!string.IsNullOrEmpty(ddlcenter_library.SelectedValue.ToString()))
     {
         model.center_library_name = ddlcenter_library.SelectedItem.ToString();
     }
     if (!string.IsNullOrEmpty(ddlreq_delivery.SelectedValue.ToString()))
     {
         model.req_delivery_name = ddlreq_delivery.SelectedItem.ToString();
     }
     if (!string.IsNullOrEmpty(ddlconsignee_code.SelectedValue.ToString()))
     {
         model.consignee = ddlconsignee_code.Text.ToString();
     }
 }
Пример #14
0
        private void UCPaperDetail_Load(object sender, EventArgs e)
        {
            CommonFuncCall.BindCompany(cboCompany, "全部");     //绑定公司
            CommonFuncCall.BindWarehouse(cboWarehouse, "全部"); //绑定仓库

            #region 显示合并表头
            dgvReport.MergeColumnNames.Add("收入");
            dgvReport.AddSpanHeader(5, 3, "收入");
            dgvReport.MergeColumnNames.Add("发出");
            dgvReport.AddSpanHeader(8, 3, "发出");
            dgvReport.MergeColumnNames.Add("结存");
            dgvReport.AddSpanHeader(11, 3, "结存");
            #endregion

            #region 报表合并表头
            List <string> listRevenues = new List <string>();
            listRevenues.Add("单价");
            listRevenues.Add("数量");
            listRevenues.Add("金额");
            AddSpanRows("收入", listRevenues);

            List <string> listExpend = new List <string>();
            listExpend.Add("单价");
            listExpend.Add("数量");
            listExpend.Add("金额");
            AddSpanRows("支出", listExpend);

            List <string> listBalance = new List <string>();
            listBalance.Add("单价");
            listBalance.Add("数量");
            listBalance.Add("金额");
            AddSpanRows("结存", listBalance);
            #endregion

            BindData();
        }
Пример #15
0
        BusinessPrint businessPrint;//业务打印功能
        #endregion

        #region 初始化窗体
        /// <summary> 初始化窗体
        /// </summary>
        public UCPurchasePlanOrderManagView()
        {
            InitializeComponent();

            //base.SetBaseButtonStatus();
            //base.SetButtonVisiableManagerSearch();
            string[] NotReadOnlyColumnsName = new string[] { "colCheck" };
            CommonFuncCall.SetColumnReadOnly(gvPurchasePlanOrderList, NotReadOnlyColumnsName);

            //禁止列表自增列
            gvPurchasePlanOrderList.AutoGenerateColumns = false;
            dateTimeStart.Value = DateTime.Now.AddDays(-DateTime.Now.Day + 1);
            dateTimeEnd.Value   = DateTime.Now;
            string com_id = GlobalStaticObj.CurrUserCom_Id;//公司ID

            CommonFuncCall.BindDepartment(ddlDepartment, com_id, "全部");
            CommonFuncCall.BindHandle(ddlResponsiblePerson, "", "全部");
            CommonFuncCall.BindPurchasePlanFinishStatus(ddlFinishStatus, true);
            BindgvPurchasePlanOrderList();

            gvPurchasePlanOrderList.CellMouseClick += new DataGridViewCellMouseEventHandler(gvPurchasePlanOrderList_CellMouseClick);
            base.ExportEvent += new ClickHandler(UCPurchasePlanOrderManagView_ExportEvent);
            base.ViewEvent   += new ClickHandler(UCPurchasePlanOrderManagView_ViewEvent);
            base.PrintEvent  += new ClickHandler(UCPurchasePlanOrderManagView_PrintEvent);
            base.SetEvent    += new ClickHandler(UCPurchasePlanOrderManagView_SetEvent);
            #region 预览、打印设置
            string        printObject  = "tb_parts_purchase_plan_s";
            string        printTitle   = "采购计划单查询";
            List <string> listNotPrint = new List <string>();
            listNotPrint.Add(plan_id.Name);
            PaperSize paperSize = new PaperSize();
            paperSize.Width  = 297;
            paperSize.Height = 210;
            businessPrint    = new BusinessPrint(gvPurchasePlanOrderList, printObject, printTitle, paperSize, listNotPrint);
            #endregion
        }
Пример #16
0
 /// <summary> 通过审核后向宇通发送宇通采购订单信息
 /// </summary>
 /// <param name="listField">宇通采购订单号集合</param>
 void DealPurascherToYT(List <string> listField)
 {
     try
     {
         if (listField.Count > 0)
         {
             for (int a = 0; a < listField.Count; a++)
             {
                 DataTable dt = DBHelper.GetTable("查看一条宇通采购订单信息", "tb_parts_purchase_order_2", "*", " purchase_order_yt_id='" + listField[a] + "'", "", "");
                 if (dt != null && dt.Rows.Count > 0)
                 {
                     yt_purchaseorder_model             = new tb_parts_purchase_order_2();
                     yt_purchaseorder_model.listDetails = new List <tb_parts_purchase_order_p_2>();
                     CommonFuncCall.SetModlByDataTable(yt_purchaseorder_model, dt);
                     DataTable dt_parts = DBHelper.GetTable("查看宇通采购订单配件信息", "tb_parts_purchase_order_p_2", "*", " purchase_order_yt_id='" + listField[a] + "'", "", "");
                     if (dt_parts != null && dt_parts.Rows.Count > 0)
                     {
                         for (int i = 0; i < dt_parts.Rows.Count; i++)
                         {
                             yt_partsorder_model = new tb_parts_purchase_order_p_2();
                             CommonFuncCall.SetModlByDataTable(yt_partsorder_model, dt_parts, i);
                             yt_purchaseorder_model.listDetails.Add(yt_partsorder_model);
                         }
                     }
                     if (yt_purchaseorder_model.crm_bill_id == ".")
                     {
                         yt_purchaseorder_model.crm_bill_id = string.Empty;
                     }
                     DBHelper.WebServHandler("", EnumWebServFunName.UpLoadPartPurchase, yt_purchaseorder_model);
                 }
             }
         }
     }
     catch (Exception ex)
     { }
 }
Пример #17
0
        /// <summary>
        /// 设置选择项后状态
        /// </summary>
        //void SetSelectedStatus()
        //{
        //    //已选择状态列表
        //    List<string> listFiles = new List<string>();
        //    listIDs.Clear();
        //    listStart.Clear();
        //    listStop.Clear();

        //    foreach (DataGridViewRow dgvr in dgvSupplierList.Rows)
        //    {
        //        if (Convert.ToBoolean(dgvr.Cells[colCheck.Name].EditedFormattedValue))
        //        {
        //            string cont_id = dgvr.Cells[suppID.Name].Value.ToString();
        //            listIDs.Add(cont_id);
        //            //if (dgvr.Cells[status.Name].Tag == null)
        //            //{
        //            //    continue;
        //            //}
        //            //enumStatus = (DataSources.EnumStatus)Convert.ToInt32(dgvr.Cells[status.Name].Value);//状态

        //            enumStatus = (DataSources.EnumStatus)Convert.ToInt32(dgvr.Cells[status.Name].Value);//状态

        //            if (enumStatus == DataSources.EnumStatus.Start)
        //            {
        //                listStart.Add(cont_id);
        //            }
        //            else if (enumStatus == DataSources.EnumStatus.Stop)
        //            {
        //                listStop.Add(cont_id);
        //            }
        //        }
        //    }
        //    #region 设置启用/停用
        //    if (listStart.Count > 0 && listStop.Count > 0)
        //    {
        //        btnStatus.Enabled = false;
        //    }
        //    else if (listStart.Count == 0 && listStop.Count == 0)
        //    {
        //        btnStatus.Enabled = false;
        //    }
        //    else if (listStart.Count > 0 && listStop.Count == 0)
        //    {
        //        btnStatus.Enabled = true;
        //        btnStatus.Caption = "停用";
        //        enumStatus = DataSources.EnumStatus.Start;
        //    }
        //    else if (listStart.Count == 0 && listStop.Count > 0)
        //    {
        //        btnStatus.Enabled = true;
        //        btnStatus.Caption = "启用";
        //        enumStatus = DataSources.EnumStatus.Stop;
        //    }
        //    #endregion


        //}
        #endregion

        #region dgv事件

        private void gvSupplierList_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.Value == null || e.Value.ToString() == string.Empty)
            {
                return;
            }
            string fieldNmae = dgvSupplierList.Columns[e.ColumnIndex].DataPropertyName;

            if (fieldNmae.Equals("create_time") || fieldNmae.Equals("update_time"))
            {
                long ticks = (long)e.Value;
                e.Value = Common.UtcLongToLocalDateTime(ticks);
            }
            if (fieldNmae.Equals("status"))
            {
                DataSources.EnumStatus enumDataSources = (DataSources.EnumStatus)Convert.ToInt16(e.Value.ToString());
                //e.Value = enumDataSources.ToString();
                e.Value = DataSources.GetDescription(enumDataSources, true);
            }
            if (fieldNmae.Equals("unit_properties") || fieldNmae.Equals("sup_type") || fieldNmae.Equals("credit_class"))
            {
                e.Value = CommonFuncCall.GetBillNameByBillCode(dt_bill, e.Value.ToString());
            }
        }
Пример #18
0
        /// <summary> 窗体初始化
        /// </summary>
        /// <param name="sale_order_id"></param>
        /// <param name="order_status"></param>
        /// <param name="uc"></param>
        public UCPurchaseOrderView2(string order_id, string order_status, UCPurchaseOrderManagerView uc)
        {
            InitializeComponent();
            base.SetBaseButtonStatus();
            base.SetButtonVisiableView();
            base.btnSave.Visible = true;
            this.orderId         = order_id;
            this.uc = uc;

            string[] NotReadOnlyColumnsName = new string[] { "colCheck", "is_suspend" };
            CommonFuncCall.SetColumnReadOnly(gvPurchaseList, NotReadOnlyColumnsName);

            //当采购订单状态是已审核时才可以中止,否则不可以中止
            DataSources.EnumAuditStatus enumDataSources = (DataSources.EnumAuditStatus)Convert.ToInt16(order_status);
            if (enumDataSources != DataSources.EnumAuditStatus.AUDIT)
            {
                chkis_suspend.Enabled = false;
                is_suspend.ReadOnly   = true;
            }
            //CommonFuncCall.BindUnit(unit_id);
            LoadInfo(order_id);
            GetAccessories(order_id);
            base.SaveEvent += new ClickHandler(UCPurchaseOrderView_SaveEvent);
        }
Пример #19
0
        BusinessPrint businessPrint;//业务打印功能
        #endregion

        #region 初始化窗体
        public UCOldPartsInventoryQuery()
        {
            InitializeComponent();
            UIAssistants.SetButtonStyle4QueryAndClear(btnQuery, btnClear); //设置查询按钮和清除按钮样式
            CommonFuncCall.BindCompany(cobCompany, "全部");                  //公司信息
            #region 显示合并表头
            dgvRData.ColumnHeadersHeight         = 40;
            dgvRData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
            dgvRData.MergeColumnNames.Add("基本单位");
            dgvRData.AddSpanHeader(7, 5, "基本单位");
            #endregion
            SetQuick();
            #region 预览、打印设置
            string        printObject  = "tb_maintain_oldpart_inventory";
            string        printTitle   = "旧件库存查询";
            List <string> listNotPrint = new List <string>();
            listNotPrint.Add(inventory_id.Name);
            //listNotPrint.Add(v_brand.Name);
            PaperSize paperSize = new PaperSize();
            paperSize.Width  = 297;
            paperSize.Height = 210;
            businessPrint    = new BusinessPrint(dgvRData, printObject, printTitle, paperSize, listNotPrint);
            #endregion
        }
Пример #20
0
 /// <summary>
 /// 选择不同部门显示对应部门的经办人和操作人
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ddlorg_id_SelectedIndexChanged(object sender, EventArgs e)
 {
     CommonFuncCall.BindHandle(ddlhandle, ddlorg_id.SelectedValue.ToString(), DefaultValue);   //经办人
     CommonFuncCall.BindHandle(ddloperator, ddlorg_id.SelectedValue.ToString(), DefaultValue); //操作人
 }
Пример #21
0
        private void UCCompanyAddOrEdit_Load(object sender, EventArgs e)
        {
            SetBtnStatus();
            CommonCtrl.BindComboBoxByDictionarr(cborepair_qualification, "sys_repair_qualification", true); //维修资质
            CommonCtrl.BindComboBoxByDictionarr(cbounit_properties, "sys_enterprise_property", true);       //单位性质
            CommonFuncCall.BindProviceComBox(cboprovince, "请选择");
            if (this.dr != null)
            {
                txtcom_code.Caption                   = this.dr["com_code"].ToString();                           //公司编码
                txtcom_name.Caption                   = this.dr["com_name"].ToString();                           //公司全名
                txtcom_short_name.Caption             = this.dr["com_short_name"].ToString();                     //公司简称
                cborepair_qualification.SelectedValue = this.dr["repair_qualification"].ToString();               //维修资质
                cbounit_properties.SelectedValue      = this.dr["unit_properties"].ToString();                    //单位性质
                txtlegal_person.Caption               = this.dr["legal_person"].ToString();                       //法人负责人
                txtcertificate_code.Caption           = this.dr["certificate_code"].ToString();                   //组织机构代码
                txtzip_code.Caption                   = this.dr["zip_code"].ToString();                           //邮编
                cboprovince.SelectedValue             = this.dr["province"].ToString();                           //省份
                cbocity.SelectedValue                 = this.dr["city"].ToString();                               //城市
                cbocounty.SelectedValue               = this.dr["county"].ToString();                             //区县
                txtcom_address.Caption                = this.dr["com_address"].ToString();                        //详细地址
                txtcom_tel.Caption             = this.dr["com_tel"].ToString();                                   //固话
                txtcom_phone.Caption           = this.dr["com_phone"].ToString();                                 //手机
                txtcom_email.Caption           = this.dr["com_email"].ToString();                                 //电子邮件
                txtcom_fax.Caption             = this.dr["com_fax"].ToString();                                   //传真
                txttax_account.Caption         = this.dr["tax_account"].ToString();                               //税号
                txttax_qualification.Caption   = this.dr["tax_qualification"].ToString();                         //纳税人资格
                ckbindepen_check.Checked       = this.dr["indepen_check"].ToString() == "1" ? true : false;       //独立核算  0 为否  1为是
                ckbindepen_legalperson.Checked = this.dr["indepen_legalperson"].ToString() == "1" ? true : false; //独立法人  0 为否  1为是
                ckbfinancial_indepen.Checked   = this.dr["financial_indepen"].ToString() == "1" ? true : false;   // 财务独立 0 为否  1为是
                txtremark.Caption = this.dr["remark"].ToString();                                                 //备注
                if (!string.IsNullOrEmpty(this.dr["work_time"].ToString()))
                {
                    long time = 0;
                    if (long.TryParse(this.dr["work_time"].ToString(), out time))
                    {
                        dtpwork_time.Value = Common.UtcLongToLocalDateTime(time);//上班时间
                    }
                }
                txtser_car_num.Caption               = this.dr["ser_car_num"].ToString();                                                  //服务车数
                chkis_repair_newenergy.Checked       = this.dr["is_repair_newenergy"].ToString() == "1" ? true : false;                    // 是否维修新能源  0 为否  1为是
                chkis_repair_ng.Checked              = this.dr["is_repair_ng"].ToString() == "1" ? true : false;                           // 是否维修NG车 0 为否  1为是
                txtstaff_counts.Caption              = this.dr["staff_counts"].ToString();                                                 //人员总数
                txtser_staff_counts.Caption          = this.dr["ser_staff_counts"].ToString();                                             //服务人员数
                txtmach_repair_staff_counts.Caption  = this.dr["mach_repair_staff_counts"].ToString();                                     //机器人数
                txtholder_electrician_counts.Caption = this.dr["holder_electrician_counts"].ToString();                                    //持证电工数
                txttrench_counts.Caption             = this.dr["trench_counts"].ToString();                                                //地沟\举升机数
                txttwelve_trench_counts.Caption      = this.dr["twelve_trench_counts"].ToString();                                         //标准地沟\举升机数
                txtfour_location_counts.Caption      = this.dr["four_location_counts"].ToString();                                         //四轮定位仪数
                txtengine_test_counts.Caption        = this.dr["engine_test_counts"].ToString();                                           //发动机检测仪数

                txtfactory_area.Caption       = CommonUtility.DecimalRightZeroFill(this.dr["factory_area"].ToString(), 2);                 //厂区占地面积
                txtparking_area.Caption       = CommonUtility.DecimalRightZeroFill(this.dr["parking_area"].ToString(), 2);                 //停车区面积
                txtreception_area.Caption     = CommonUtility.DecimalRightZeroFill(this.dr["reception_area"].ToString(), 2);               //接待室面积
                txtcust_lounge_area.Caption   = CommonUtility.DecimalRightZeroFill(this.dr["cust_lounge_area"].ToString(), 2);             //客户休息室面积
                txtcust_toilet_area.Caption   = CommonUtility.DecimalRightZeroFill(this.dr["cust_toilet_area"].ToString(), 2);             //客户洗手间面积
                txtmeeting_room_area.Caption  = CommonUtility.DecimalRightZeroFill(this.dr["meeting_room_area"].ToString(), 2);            //会议室面积
                txttraining_room_area.Caption = CommonUtility.DecimalRightZeroFill(this.dr["training_room_area"].ToString(), 2);           //培训室面积
                txtsettlement_area.Caption    = CommonUtility.DecimalRightZeroFill(this.dr["settlement_area"].ToString(), 2);              //结算区面积

                txtrepaired_area.Caption           = CommonUtility.DecimalRightZeroFill(this.dr["repaired_area"].ToString(), 2);           //待修区面积
                txtcheck_area.Caption              = CommonUtility.DecimalRightZeroFill(this.dr["check_area"].ToString(), 2);              //检查区面积
                txtrepair_workshop_area.Caption    = CommonUtility.DecimalRightZeroFill(this.dr["repair_workshop_area"].ToString(), 2);    //维修车间面积
                txtbig_repaired_area.Caption       = CommonUtility.DecimalRightZeroFill(this.dr["big_repaired_area"].ToString(), 2);       //总成大修面积
                txtparts_sales_area.Caption        = CommonUtility.DecimalRightZeroFill(this.dr["parts_sales_area"].ToString(), 2);        //配件销售面积
                txtparts_warehouse_area.Caption    = CommonUtility.DecimalRightZeroFill(this.dr["parts_warehouse_area"].ToString(), 2);    //配件仓库面积
                txtoldparts_warehouse_area.Caption = CommonUtility.DecimalRightZeroFill(this.dr["oldparts_warehouse_area"].ToString(), 2); //旧件仓库面积
                txtrepair_instructions.Caption     = this.dr["repair_instructions"].ToString();                                            //维修说明
            }
        }
Пример #22
0
 /// <summary> 加载采购计划信息和配件信息
 /// </summary>
 /// <param name="sale_order_id"></param>
 private void LoadInfo(string sale_order_id)
 {
     if (!string.IsNullOrEmpty(sale_order_id))
     {
         //1.查看一条采购订单信息
         DataTable dt = DBHelper.GetTable("查看一条采购订单信息", "tb_parts_sale_order", "*", " sale_order_id='" + sale_order_id + "'", "", "");
         if (dt != null && dt.Rows.Count > 0)
         {
             CommonFuncCall.SetModlByDataTable(tb_partspurchaseorder_Model, dt);
             CommonFuncCall.SetShowControlValue(this, tb_partspurchaseorder_Model, "");
             chkis_suspend.Checked = tb_partspurchaseorder_Model.is_suspend == "0";//选中(中止):0,未选中(不中止):1
             if (!string.IsNullOrEmpty(lblorder_date.Text))
             {
                 long ticks = Convert.ToInt64(lblorder_date.Text);
                 lblorder_date.Text = Common.UtcLongToLocalDateTime(ticks).ToString();
             }
             if (!string.IsNullOrEmpty(lblvalid_till.Text))
             {
                 long ticks = Convert.ToInt64(lblvalid_till.Text);
                 lblvalid_till.Text = Common.UtcLongToLocalDateTime(ticks).ToString();
             }
             if (!string.IsNullOrEmpty(lbldelivery_time.Text))
             {
                 long ticks = Convert.ToInt64(lbldelivery_time.Text);
                 lbldelivery_time.Text = Common.UtcLongToLocalDateTime(ticks).ToString();
             }
             lblcreate_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(tb_partspurchaseorder_Model.create_time.ToString())).ToString();
             if (tb_partspurchaseorder_Model.update_time > 0)
             {
                 lblupdate_time.Text = Common.UtcLongToLocalDateTime(Convert.ToInt64(tb_partspurchaseorder_Model.update_time.ToString())).ToString();
             }
             orderstatus = tb_partspurchaseorder_Model.order_status;
             if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.SUBMIT).ToString())
             {
                 //已提交状态屏蔽提交、编辑、删除按钮
                 base.btnSubmit.Enabled     = false;
                 base.btnEdit.Enabled       = false;
                 base.btnDelete.Enabled     = false;
                 base.btnActivation.Enabled = false;
             }
             else if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.AUDIT).ToString())
             {
                 //已审核时屏蔽提交、审核、编辑、删除按钮
                 base.btnSubmit.Enabled     = false;
                 base.btnVerify.Enabled     = false;
                 base.btnEdit.Enabled       = false;
                 base.btnDelete.Enabled     = false;
                 base.btnActivation.Enabled = false;
             }
             else if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.NOTAUDIT).ToString() || orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString())
             {
                 //审核没通过时屏蔽审核按钮
                 base.btnVerify.Enabled = false;
             }
             else if (orderstatus == Convert.ToInt32(DataSources.EnumAuditStatus.Invalid).ToString())
             {
                 base.btnActivation.Caption = "激活";
                 base.btnSubmit.Enabled     = false;
                 base.btnVerify.Enabled     = false;
                 base.btnEdit.Enabled       = false;
             }
         }
     }
 }
Пример #23
0
        /// <summary>
        /// 审核通过后需要自动生成的单子的方法
        /// </summary>
        void CreateBill(List <string> listField)
        {
            if (listField.Count > 0)
            {
                for (int i = 0; i < listField.Count; i++)
                {
                    DataTable dt = DBHelper.GetTable("", "tb_parts_purchase_billing", "*", string.Format("purchase_billing_id='{0}'", listField[i]), "", "");
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        tb_parts_purchase_billing model = new tb_parts_purchase_billing();
                        CommonFuncCall.SetModlByDataTable(model, dt);

                        #region 当金额大于0时,自动生成预付款单
                        if (model.this_payment > 0)
                        {
                            tb_bill_receivable   a = new tb_bill_receivable();
                            tb_balance_documents b = new tb_balance_documents();
                            tb_payment_detail    c = new tb_payment_detail();
                            a.cust_id      = model.sup_id;                                                //供应商ID
                            a.order_num    = CommonUtility.GetNewNo(DataSources.EnumProjectType.PAYMENT); //订单号
                            a.order_type   = (int)DataSources.EnumOrderType.PAYMENT;
                            a.payment_type = (int)DataSources.EnumPaymentType.PAYMENT;
                            a.org_id       = model.org_id;

                            b.billing_money  = model.this_payment;        //开单金额
                            b.documents_date = model.order_date;          //单据日期
                            b.documents_id   = model.purchase_billing_id; //单据ID
                            b.documents_name = "采购开单";                    //单据名称
                            b.documents_num  = model.order_num;           //单据编码

                            c.money        = model.this_payment;          //金额
                            c.balance_way  = model.balance_way;           //结算方式
                            c.check_number = model.check_number;          //票号

                            DBOperation.AddBillReceivable(a, b, c);
                        }
                        #endregion

                        #region 自动生产出入库单
                        #region 一:采购收货单-->自动生成入库单
                        if (model.order_type == DataSources.EnumPurchaseOrderType.PurchaseReceive.ToString())
                        {
                            string stock_inout_id = string.Empty;
                            //1.生成入库单
                            if (CreateIntoStock("入库单", model, ref stock_inout_id))
                            {
                                //2.查询配件信息,生成配件信息入库单
                                DataTable dt_parts = DBHelper.GetTable("查询采购开单配件信息表", "tb_parts_purchase_billing_p", "*", " purchase_billing_id='" + model.purchase_billing_id + "'", "", "");
                                if (dt_parts != null && dt_parts.Rows.Count > 0)
                                {
                                    for (int a = 0; a < dt_parts.Rows.Count; a++)
                                    {
                                        tb_parts_purchase_billing_p bill_p_model = new tb_parts_purchase_billing_p();
                                        CommonFuncCall.SetModlByDataTable(bill_p_model, dt_parts, a);
                                        CreateIntoPartsStock(stock_inout_id, bill_p_model);
                                    }
                                }
                            }
                        }
                        #endregion

                        #region 二:采购退货-->自动生成出库单
                        else if (model.order_type == DataSources.EnumPurchaseOrderType.PurchaseBack.ToString())
                        {
                            string stock_inout_id = string.Empty;
                            //1.生成出库单
                            if (CreateIntoStock("出库单", model, ref stock_inout_id))
                            {
                                //2.查询配件信息,生成配件信息出库单
                                DataTable dt_parts = DBHelper.GetTable("查询采购开单配件信息表", "tb_parts_purchase_billing_p", "*", " purchase_billing_id='" + model.purchase_billing_id + "'", "", "");
                                if (dt_parts != null && dt_parts.Rows.Count > 0)
                                {
                                    for (int a = 0; a < dt_parts.Rows.Count; a++)
                                    {
                                        tb_parts_purchase_billing_p bill_p_model = new tb_parts_purchase_billing_p();
                                        CommonFuncCall.SetModlByDataTable(bill_p_model, dt_parts, a);
                                        CreateIntoPartsStock(stock_inout_id, bill_p_model);
                                    }
                                }
                            }
                        }
                        #endregion

                        #region  :采购换货-->自动生成出、入库单(数量大于0是入库,小于0是出库)
                        else if (model.order_type == DataSources.EnumPurchaseOrderType.PurchaseExchange.ToString())
                        {
                            string stock_in_id  = string.Empty;
                            string stock_out_id = string.Empty;
                            //1.生成入库单
                            if (CreateIntoStock("入库单", model, ref stock_in_id))
                            {
                                //2.查询配件入库数量大于0的,生成配件信息入库单
                                DataTable dt_parts = DBHelper.GetTable("查询采购开单配件信息表", "tb_parts_purchase_billing_p", "*", " purchase_billing_id='" + model.purchase_billing_id + "' and storage_count>0 ", "", "");
                                if (dt_parts != null && dt_parts.Rows.Count > 0)
                                {
                                    for (int a = 0; a < dt_parts.Rows.Count; a++)
                                    {
                                        tb_parts_purchase_billing_p bill_p_model = new tb_parts_purchase_billing_p();
                                        CommonFuncCall.SetModlByDataTable(bill_p_model, dt_parts, a);
                                        CreateIntoPartsStock(stock_in_id, bill_p_model);
                                    }
                                }
                            }

                            //3.生成出库单
                            if (CreateIntoStock("出库单", model, ref stock_out_id))
                            {
                                //4.查询配件入库数量小于0的,生成配件信息出库单
                                DataTable dt_parts = DBHelper.GetTable("查询采购开单配件信息表", "tb_parts_purchase_billing_p", "*", " purchase_billing_id='" + model.purchase_billing_id + "' and storage_count<0 ", "", "");
                                if (dt_parts != null && dt_parts.Rows.Count > 0)
                                {
                                    for (int a = 0; a < dt_parts.Rows.Count; a++)
                                    {
                                        tb_parts_purchase_billing_p bill_p_model = new tb_parts_purchase_billing_p();
                                        CommonFuncCall.SetModlByDataTable(bill_p_model, dt_parts, a);
                                        CreateIntoPartsStock(stock_out_id, bill_p_model);
                                    }
                                }
                            }
                        }
                        #endregion
                        #endregion

                        #region 向宇通发送配送单号
                        if (!string.IsNullOrEmpty(model.ration_send_code))
                        {
                            //DBHelper.WebServHandler("审核通过入库时发送配送单号到宇通系统", EnumWebServFunName.UpLoadPartPutStore, model.ration_send_code);
                            DBHelper.WebServHandler("", EnumWebServFunName.LoadPartInStore, model.ration_send_code);
                        }
                        #endregion
                    }
                }
            }
        }
Пример #24
0
        /// <summary>
        /// 添加情况下组装sql的方法
        /// </summary>
        /// <param name="listSql"></param>
        /// <param name="purchase_billing_id"></param>
        private void AddReceiptBillSql(List <SysSQLString> listSql, tb_parts_stock_check stockCheckEntity, string StockCheckId, string HandleType)
        {
            try
            {
                const string NoDelFlag = "1";                                                                  //默认删除标记1表示未删除,0表示删除
                string       Save      = DataSources.GetDescription(DataSources.EnumOperateType.save, true);   //保存操作
                string       Submit    = DataSources.GetDescription(DataSources.EnumOperateType.submit, true); //提交操作
                //SQL语句拼装操作
                SysSQLString sysStringSql = new SysSQLString();
                sysStringSql.cmdType = CommandType.Text;
                Dictionary <string, string> dicParam = new Dictionary <string, string>();//保存SQL语句参数值
                CommonFuncCall.FillEntityByControls(this, stockCheckEntity);
                stockCheckEntity.stock_check_id = StockCheckId;

                stockCheckEntity.update_by   = GlobalStaticObj.UserID;
                stockCheckEntity.operators   = GlobalStaticObj.UserID;
                stockCheckEntity.enable_flag = NoDelFlag;
                if (HandleType == Save)
                {
                    stockCheckEntity.order_status      = Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString();
                    stockCheckEntity.order_status_name = DataSources.GetDescription(DataSources.EnumAuditStatus.DRAFT, true);
                }
                else if (HandleType == Submit)
                {
                    stockCheckEntity.order_status      = Convert.ToInt32(DataSources.EnumAuditStatus.SUBMIT).ToString();
                    stockCheckEntity.order_status_name = DataSources.GetDescription(DataSources.EnumAuditStatus.SUBMIT, true);
                }
                if (stockCheckEntity != null)
                {
                    long          CurrentDate = Common.LocalDateTimeToUtcLong(Convert.ToDateTime(DateTime.Now.ToShortDateString()));
                    StringBuilder sb          = new StringBuilder();
                    sb.Append(" Insert Into tb_parts_stock_check( ");
                    StringBuilder sb_PrValue = new StringBuilder();
                    StringBuilder sb_PrName  = new StringBuilder();
                    foreach (PropertyInfo info in stockCheckEntity.GetType().GetProperties())
                    {
                        string name  = info.Name;
                        object value = info.GetValue(stockCheckEntity, null);
                        sb_PrName.Append("," + name);   //数据表字段名
                        sb_PrValue.Append(",@" + name); //数据表字段值
                        if (name == "create_time")
                        {
                            dicParam.Add(name, CurrentDate.ToString());//添加创建时间
                        }
                        else
                        {
                            dicParam.Add(name, value == null ? "" : value.ToString());
                        }
                    }
                    sb.Append(sb_PrName.ToString().Substring(1, sb_PrName.ToString().Length - 1) + ") Values ("); //追加字段名
                    sb.Append(sb_PrValue.ToString().Substring(1, sb_PrValue.ToString().Length - 1) + ");");       //追加字段值
                    //完成SQL语句的拼装
                    sysStringSql.sqlString = sb.ToString();
                    sysStringSql.Param     = dicParam;
                    listSql.Add(sysStringSql);
                }
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show(ex.Message, "异常提示", MessageBoxButtons.OK, MessageBoxIcon.Question); MessageBoxEx.Show(ex.Message);
            }
        }
Пример #25
0
        /// <summary>
        /// 编辑情况下组装sql的方法
        /// </summary>
        /// <param name="listSql"></param>
        /// <param name="purchase_billing_id"></param>
        /// <param name="model"></param>
        private void EditReceiptBillSql(List <SysSQLString> listSql, tb_parts_stock_check stockCheckEntity, string StockCheckId, string HandleType)
        {
            try
            {
                const string NoDelFlag = "1";                                                                  //默认删除标记,1表示未删除,0表示删除
                string       Save      = DataSources.GetDescription(DataSources.EnumOperateType.save, true);   //保存操作
                string       Submit    = DataSources.GetDescription(DataSources.EnumOperateType.submit, true); //提交操作
                SysSQLString sysStrSql = new SysSQLString();
                sysStrSql.cmdType = CommandType.Text;                                                          //sql字符串语句执行函数
                Dictionary <string, string> dicParam = new Dictionary <string, string>();                      //参数
                CommonFuncCall.FillEntityByControls(this, CheckBillEntity);

                stockCheckEntity.handle      = GlobalStaticObj.UserID;
                stockCheckEntity.operators   = GlobalStaticObj.UserID;
                stockCheckEntity.enable_flag = NoDelFlag;
                if (HandleType == Save)
                {
                    stockCheckEntity.order_status      = Convert.ToInt32(DataSources.EnumAuditStatus.DRAFT).ToString();
                    stockCheckEntity.order_status_name = DataSources.GetDescription(DataSources.EnumAuditStatus.DRAFT, true);
                }
                else if (HandleType == Submit)
                {
                    stockCheckEntity.order_status      = Convert.ToInt32(DataSources.EnumAuditStatus.SUBMIT).ToString();
                    stockCheckEntity.order_status_name = DataSources.GetDescription(DataSources.EnumAuditStatus.SUBMIT, true);
                }
                if (CheckBillEntity != null)
                {
                    long          CurrentDate = Common.LocalDateTimeToUtcLong(Convert.ToDateTime(DateTime.Now.ToShortDateString()));
                    StringBuilder sb          = new StringBuilder();
                    sb.Append(" Update tb_parts_stock_check Set ");
                    bool isFirstValue = true;
                    foreach (PropertyInfo info in stockCheckEntity.GetType().GetProperties())
                    {
                        string name  = info.Name;
                        object value = info.GetValue(stockCheckEntity, null);
                        if (isFirstValue)
                        {
                            isFirstValue = false;
                            sb.Append(name);
                            sb.Append("=");
                            sb.Append("@" + name);
                        }
                        else
                        {
                            sb.Append("," + name);
                            sb.Append("=");
                            sb.Append("@" + name);
                        }
                        if (name == "update_time")
                        {
                            dicParam.Add(name, CurrentDate.ToString());//添加更新时间
                        }
                        else
                        {
                            dicParam.Add(name, value == null ? "" : value.ToString());
                        }
                    }
                    sb.Append(" where stock_check_id='" + StockCheckId + "';");
                    sysStrSql.sqlString = sb.ToString();
                    sysStrSql.Param     = dicParam;
                    listSql.Add(sysStrSql);//完成SQL语句的拼装
                }
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show(ex.Message, "异常提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }
        }
Пример #26
0
 /// <summary>
 /// 部门选择
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Comborg_name_SelectedIndexChanged(object sender, EventArgs e)
 {
     CommonFuncCall.BindHandle(Combhandle_name, Comborg_name.SelectedValue.ToString(), "请选择");//选择经手人
 }
Пример #27
0
        private void UCPersonnelView_Load(object sender, EventArgs e)
        {
            //base.RoleButtonStstus(uc.Name);//角色按钮权限-是否隐藏
            base.SetBtnStatus(wStatus);
            DataSources.BindComBoxDataEnum(cbostatus, typeof(DataSources.EnumStatus), true);            //绑定状态 启用 停用
            DataSources.BindComBoxDataEnum(cbodata_sources, typeof(DataSources.EnumDataSources), true); //数据来源 自建 宇通

            //CommonCtrl.BindComboBoxByDictionarr(cbostatus, "sys_data_status", true);//绑定状态 启用 停用
            //CommonCtrl.BindComboBoxByDictionarr(cbodata_sources, "sys_data_source", true);//数据来源 自建 宇通

            DataSources.BindComBoxDataEnum(cbois_operator, typeof(DataSources.EnumYesNo), false); //是否操作员
            CommonFuncCall.BindComBoxDataSource(cbonation, "sys_nation", "请选择");                  //民族
            CommonFuncCall.BindComBoxDataSource(cbosex, "sys_sex", "请选择");                        //性别
            CommonFuncCall.BindComBoxDataSource(cboidcard_type, "sys_certificates_type", "请选择");  //证件类型
            CommonFuncCall.BindComBoxDataSource(cboeducation, "sys_education", "请选择");            //学历
            CommonFuncCall.BindComBoxDataSource(cboposition, "sys_post", "请选择");                  //岗位
            CommonFuncCall.BindComBoxDataSource(cbolevel, "sys_personnel_level", "请选择");          //级别
            DataTable dt = DBHelper.GetTable("查询人员信息", GlobalStaticObj_Server.DbPrefix + accCode, "v_User", "*", "user_id='" + id + "'", "", "");

            if (dt.Rows.Count <= 0)
            {
                MessageBoxEx.Show("查询人员失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            lbluser_code.Text             = dt.Rows[0]["user_code"].ToString();
            lbluser_name.Text             = dt.Rows[0]["user_name"].ToString();
            lblland_name.Text             = dt.Rows[0]["land_name"].ToString();
            lblremark.Text                = dt.Rows[0]["remark"].ToString();
            lbluser_phone.Text            = dt.Rows[0]["user_phone"].ToString();
            lbluser_telephone.Text        = dt.Rows[0]["user_telephone"].ToString();
            txtcom_name.Caption           = dt.Rows[0]["com_name"].ToString();
            txcorg_name.Text              = dt.Rows[0]["org_name"].ToString();
            lbluser_fax.Text              = dt.Rows[0]["user_fax"].ToString();
            cbosex.SelectedValue          = dt.Rows[0]["sex"].ToString();
            cbois_operator.SelectedValue  = dt.Rows[0]["is_operator"].ToString();
            cboidcard_type.SelectedValue  = dt.Rows[0]["idcard_type"].ToString();
            lbluser_email.Text            = dt.Rows[0]["user_email"].ToString();
            lblidcard_num.Text            = dt.Rows[0]["idcard_num"].ToString();
            lbluser_address.Text          = dt.Rows[0]["user_address"].ToString();
            lblcreate_by.Text             = dt.Rows[0]["create_Username"].ToString();
            lblcreate_time.Text           = Common.UtcLongToLocalDateTime(Convert.ToInt64(dt.Rows[0]["create_time"].ToString())).ToString();
            lblupdate_by.Text             = dt.Rows[0]["update_username"].ToString();
            lblupdate_time.Text           = Common.UtcLongToLocalDateTime(Convert.ToInt64(dt.Rows[0]["update_time"].ToString())).ToString();
            cbostatus.SelectedValue       = dt.Rows[0]["status"].ToString();
            cbodata_sources.SelectedValue = dt.Rows[0]["data_sources"].ToString();

            cbonation.SelectedValue       = dt.Rows[0]["nation"].ToString();
            lblgraduate_institutions.Text = dt.Rows[0]["graduate_institutions"].ToString();
            lbltechnical_expertise.Text   = dt.Rows[0]["technical_expertise"].ToString();
            lbluser_height.Text           = dt.Rows[0]["user_height"].ToString();
            lblnative_place.Text          = dt.Rows[0]["native_place"].ToString();
            lblspecialty.Text             = dt.Rows[0]["specialty"].ToString();
            lblentry_date.Text            = Common.UtcLongToLocalDateTime(Convert.ToInt64(dt.Rows[0]["entry_date"].ToString())).ToString();
            lbluser_weight.Text           = dt.Rows[0]["user_weight"].ToString();
            lblregister_address.Text      = dt.Rows[0]["register_address"].ToString();
            lblgraduate_date.Text         = Common.UtcLongToLocalDateTime(Convert.ToInt64(dt.Rows[0]["graduate_date"].ToString())).ToString();
            lblwage.Text               = dt.Rows[0]["wage"].ToString();
            lblbirthday.Text           = Common.UtcLongToLocalDateTime(Convert.ToInt64(dt.Rows[0]["birthday"].ToString())).ToString();
            cboeducation.SelectedValue = dt.Rows[0]["education"].ToString();
            cboposition.SelectedValue  = dt.Rows[0]["position"].ToString();
            lblpolitical_status.Text   = dt.Rows[0]["political_status"].ToString();
            cbolevel.SelectedValue     = dt.Rows[0]["level"].ToString();


            DataTable dt_pic = DBHelper.GetTable("查询用户图片", GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, "attachment_info", "*", "relation_object_id='" + id + "' and att_name='用户图片' and att_type='图片'", "", "");

            if (dt_pic != null && dt_pic.Rows.Count > 0)
            {
                string photoPath = CommonCtrl.IsNullToString(dt_pic.Rows[0]["att_path"]);
                string photoID   = CommonCtrl.IsNullToString(dt_pic.Rows[0]["att_id"]);
                picuser.BackgroundImage = FileOperation.DownLoadImage(photoPath);
            }
            BindAData("sys_user", id);
        }
Пример #28
0
        void UCFetchMaterialManager_VerifyEvent(object sender, EventArgs e)
        {
            List <string> listField = new List <string>();

            foreach (DataGridViewRow dr in dgvRData.Rows)
            {
                object isCheck = dr.Cells["colCheck"].EditedFormattedValue;
                if (isCheck != null && (bool)isCheck)
                {
                    listField.Add(dr.Cells["fetch_id"].Value.ToString());
                }
            }
            if (listField.Count <= 0)
            {
                MessageBoxEx.Show("请选择需要审核的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (MessageBoxEx.Show("确认要审核吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK)
            {
                return;
            }
            Dictionary <string, long> OrderIDDateDic = new Dictionary <string, long>();//获取需要核实的记录行

            verify = new UCVerify();
            if (verify.ShowDialog() == DialogResult.OK)
            {
                List <SQLObj> listSql = new List <SQLObj>();
                foreach (DataGridViewRow dr in dgvRData.Rows)
                {
                    object isCheck = dr.Cells["colCheck"].EditedFormattedValue;
                    if (isCheck != null && (bool)isCheck)
                    {
                        SQLObj obj = new SQLObj();
                        obj.cmdType = CommandType.Text;
                        Dictionary <string, ParamObj> dicParam = new Dictionary <string, ParamObj>();
                        dicParam.Add("fetch_id", new ParamObj("fetch_id", dr.Cells["fetch_id"].Value, SysDbType.VarChar, 40));                                                             //单据ID
                        dicParam.Add("info_status", new ParamObj("info_status", verify.auditStatus, SysDbType.VarChar, 40));                                                               //单据状态
                        dicParam.Add("Verify_advice", new ParamObj("Verify_advice", verify.Content, SysDbType.VarChar, 200));                                                              //审核意见
                        dicParam.Add("update_by", new ParamObj("update_by", HXCPcClient.GlobalStaticObj.UserID, SysDbType.VarChar, 40));                                                   //修改人Id
                        dicParam.Add("update_name", new ParamObj("update_name", HXCPcClient.GlobalStaticObj.UserName, SysDbType.VarChar, 40));                                             //修改人姓名
                        dicParam.Add("update_time", new ParamObj("update_time", Common.LocalDateTimeToUtcLong(HXCPcClient.GlobalStaticObj.CurrentDateTime).ToString(), SysDbType.BigInt)); //修改时间
                        obj.sqlString = "update tb_maintain_fetch_material set info_status=@info_status,Verify_advice=@Verify_advice,update_by=@update_by,update_name=@update_name,update_time=@update_time where fetch_id=@fetch_id";
                        obj.Param     = dicParam;
                        listSql.Add(obj);
                        long OrdeDate = (long)dr.Cells["fetch_time"].Value;
                        OrderIDDateDic.Add(dr.Cells["fetch_id"].Value.ToString(), OrdeDate);//添加已审核单据主键ID和单据日期键值对
                    }
                }

                if (DBHelper.BatchExeSQLMultiByTrans("更新单据状态为审核", listSql))
                {
                    string strMsg = string.Empty;
                    if (verify.auditStatus == DataSources.EnumAuditStatus.AUDIT)
                    {
                        strMsg = "成功";
                        CommonFuncCall.StatisticStock(GetInoutPart(OrderIDDateDic), "领料单明细数据表");//同步更新实际库存
                    }
                    else
                    {
                        strMsg = "不通过";
                    }
                    MessageBoxEx.Show("审核" + strMsg + "!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    BindPageData();
                }
            }
        }
Пример #29
0
        /// <summary>
        /// 绑定数据
        /// </summary>
        public void BindPageData()
        {
            try
            {
                var where = " c.enable_flag='1' ";                       //enable_flag 1未删除
                if (!string.IsNullOrEmpty(txt_cust_code.Caption.Trim())) //客户编码
                {
                    where += string.Format(" and  c.cust_code like '%{0}%'", txt_cust_code.Caption.Trim());
                }
                if (!string.IsNullOrEmpty(txt_cust_name.Caption.Trim()))//客户名称
                {
                    where += string.Format(" and  c.cust_name like '%{0}%'", txt_cust_name.Caption.Trim());
                }
                if (cbo_cust_type.SelectedValue != null && cbo_cust_type.SelectedValue.ToString() != "")
                {
                    where += string.Format(" and  c.cust_type = '{0}'", cbo_cust_type.SelectedValue);
                }
                if (cbo_is_member.SelectedValue != null && cbo_is_member.SelectedValue.ToString() != "")
                {
                    where += string.Format(" and  c.is_member = '{0}'", cbo_is_member.SelectedValue);
                }
                if (cboprovince.SelectedValue != null && cboprovince.SelectedValue.ToString() != "")
                {
                    where += string.Format(" and  c.province = '{0}'", cboprovince.SelectedValue);
                }
                if (cbocity.SelectedValue != null && cbocity.SelectedValue.ToString() != "")
                {
                    where += string.Format(" and  c.city = '{0}'", cbocity.SelectedValue);
                }
                if (cbocounty.SelectedValue != null && cbocounty.SelectedValue.ToString() != "")
                {
                    where += string.Format(" and  c.county = '{0}'", cbocounty.SelectedValue);
                }
                if (!string.IsNullOrEmpty(txtcust_address.Caption.Trim()))
                {
                    where += string.Format(" and  c.cust_address like '%{0}%'", txtcust_address.Caption.Trim());
                }
                if (dtp_create_time_s.Value.Trim() != "" && Validator.IsDateTime(dtp_create_time_s.Value))
                {
                    var startTicks = Common.LocalDateTimeToUtcLong(Convert.ToDateTime(dtp_create_time_s.Value).Date);
                    where += " and c.create_time>=" + startTicks;
                }
                if (dtp_create_time_e.Value.Trim() != "" && Validator.IsDateTime(dtp_create_time_e.Value))
                {
                    var endTicks = Common.LocalDateTimeToUtcLong(Convert.ToDateTime(dtp_create_time_e.Value).Date.AddDays(1));
                    where += " and c.create_time<" + endTicks;
                }
                if (cbo_status.SelectedValue != null && cbo_status.SelectedValue.ToString() != "")
                {
                    where += string.Format(" and  c.status = '{0}'", cbo_status.SelectedValue);
                }
                if (cbo_data_source.SelectedValue != null && cbo_data_source.SelectedValue.ToString() != "")
                {
                    where += string.Format(" and  c.data_source = '{0}'", cbo_data_source.SelectedValue);
                }
                if (!string.IsNullOrEmpty(txt_yt_customer_manager.Caption.Trim()))
                {
                    where += string.Format(" and  c.yt_customer_manager like '%{0}%'", txt_yt_customer_manager.Caption.Trim());
                }
                if (!string.IsNullOrEmpty(txt_yt_sap_code.Caption.Trim()))
                {
                    where += string.Format(" and  c.sap_code like '%{0}%'", txt_yt_sap_code.Caption.Trim());
                }
                if (!string.IsNullOrEmpty(uccont_name.ResultWords.Trim().Replace("请输入名称、手机或电话", "")))
                {
                    where += string.Format(" and  c.cust_id in {0}",
                                           " ( select distinct b.relation_object_id from tb_contacts c,tr_base_contacts b where c.cont_id=b.cont_id and b.relation_object='客户档案' and c.cont_name='" + uccont_name.ResultWords.Trim().Replace("请输入名称、手机或电话", "") + "' ) "
                                           );
                }


                var al = new ArrayList {
                    "sys_enterprise_property", "sys_data_source", "sys_customer_category"
                };
                _dtdic = CommonFuncCall.GetDictionariesByPDic_codes(al);

                int recordCount;
                var dt = DBHelper.GetTableByPage("分页查询客户档案", "tb_customer c left join sys_user u on c.create_by=u.user_id", "c.*,u.user_name", where, "", "c.create_time", pageQ.PageIndex, pageQ.PageSize, out recordCount);
                dgv_table.DataSource = dt;
                pageQ.RecordCount    = recordCount;
                pageQ.SetBtnState();
            }
            catch (Exception ex)
            {
                LogService4Customer.WriteLog(1, ex);
                MessageBoxEx.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Пример #30
0
        private void FuncationRegiste() //事件注册
        {
            #region 数据表数据选择
            //单元格数据转换
            dgv_table.CellFormatting += (sender, args) => ConvertDataGridColumnsData(args);
            //数据行双击事件
            dgv_table.CellDoubleClick += delegate(object sender, DataGridViewCellEventArgs e)
            {
                try
                {
                    if (e.RowIndex < 0)
                    {
                        return;
                    }
                    var value = dgv_table.Rows[e.RowIndex].Cells[cust_id.Name].Value;
                    if (value == null)
                    {
                        return;
                    }
                    var id             = value.ToString();
                    var ucCustomerView = new UCCustomerViews
                    {
                        Id = id,
                        UCCustomerManager = this
                    };
                    addUserControl(ucCustomerView, "客户详细信息", "UCCustomerViews" + id, Tag.ToString(), Name);
                }
                catch (Exception ex)
                {
                    LogService4Customer.WriteLog(1, ex);
                }
            };
            #endregion

            #region 数据翻页
            pageQ.PageIndexChanged += delegate
            {
                BindPageData();
            };
            #endregion

            #region 清除按钮事件
            btn_clear.Click += delegate
            {
                try
                {
                    UIAssistants.ClearQueryControlValue(pnl_query);
                }
                catch (Exception ex)
                {
                    LogService4Customer.WriteLog(1, ex);
                }
            };
            #endregion

            #region 查询
            btn_query.Click += (sender, args) =>
            {
                pageQ.PageIndex   = 1;
                pageQ.RecordCount = 0;
                BindPageData();
            };
            #endregion

            #region 新增
            btnAdd.Click += delegate
            {
                try
                {
                    var ucCustomerAddOrEdit = new UCCustomerAddOrEdit {
                        UCCustomerManager = this, windowStatus = WindowStatus.Add
                    };
                    addUserControl(ucCustomerAddOrEdit, "客户信息新增", "UCCustomerAddOrEdit-Add", Tag.ToString(), Name);
                }
                catch (Exception ex)
                {
                    LogService4Customer.WriteLog(1, ex);
                }
            };
            #endregion

            #region  制
            btnCopy.Click += delegate
            {
                try
                {
                    var id       = "";
                    var dataView = UIAssistants.GetDataGridCheckRows(dgv_table, colCheck, cust_id, TableName);
                    if (dataView == null)
                    {
                        return;
                    }
                    foreach (DataRowView rowView in dataView)
                    {
                        id = rowView["cust_id"].ToString();
                        break;
                    }
                    var ucCustomerAddOrEdit = new UCCustomerAddOrEdit
                    {
                        UCCustomerManager = this,
                        windowStatus      = WindowStatus.Copy,
                        Id = id
                    };
                    addUserControl(ucCustomerAddOrEdit, "客户信息拷贝", "UCCustomerAddOrEdit-Copy" + ucCustomerAddOrEdit.Id, Tag.ToString(), Name);
                }
                catch (Exception ex)
                {
                    LogService4Customer.WriteLog(1, ex);
                }
            };
            #endregion

            #region 编辑
            btnEdit.Click += delegate
            {
                try
                {
                    var id       = "";
                    var dataView = UIAssistants.GetDataGridCheckRows(dgv_table, colCheck, cust_id, TableName);
                    if (dataView == null)
                    {
                        return;
                    }
                    foreach (DataRowView rowView in dataView)
                    {
                        id = rowView["cust_id"].ToString();
                        break;
                    }
                    var ucCustomerAddOrEdit = new UCCustomerAddOrEdit
                    {
                        UCCustomerManager = this,
                        windowStatus      = WindowStatus.Edit,
                        Id = id
                    };
                    addUserControl(ucCustomerAddOrEdit, "客户信息编辑", "UCCustomerAddOrEdit-Edit" + ucCustomerAddOrEdit.Id, Tag.ToString(), Name);
                }
                catch (Exception ex)
                {
                    LogService4Customer.WriteLog(1, ex);
                }
            };
            #endregion

            #region  除
            btnDelete.Click += delegate
            {
                try
                {
                    var selectedRows = UIAssistants.GetDataGridCheckRows(dgv_table, colCheck, cust_id);
                    if (selectedRows.Count == 0)
                    {
                        MessageBoxEx.Show("请选择删除记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    if (MessageBoxEx.Show("确认要删除吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK)
                    {
                        return;
                    }
                    //var comField = new Dictionary<string, string> { { "enable_flag", "0" } };
                    //flag = DBHelper.BatchUpdateDataByIn("删除三包服务单", TableName, comField, "tg_id", selectedRows.ToArray());
                    var comField = new Dictionary <string, string> {
                        { "enable_flag", "0" }
                    };
                    var flag = DBHelper.BatchUpdateDataByIn("批量删除客户档案", "tb_customer", comField, "cust_id", selectedRows.ToArray());
                    foreach (var selectedRow in selectedRows)
                    {
                        var crmIdDt = DBHelper.GetTable("查询客户档案信息", "tb_customer", "cust_crm_guid",
                                                        String.Format("cust_id = '{0}'", selectedRow), "", "");
                        if (crmIdDt != null && crmIdDt.Rows.Count == 1)
                        {
                            DBHelper.WebServHandler("删除客户档案", EnumWebServFunName.UpLoadCustomer,
                                                    new tb_customer {
                                cust_crm_guid = CommonCtrl.IsNullToString(crmIdDt.Rows[0][0]), status = "0"
                            });
                        }
                    }
                    if (flag)
                    {
                        BindPageData();
                        if (dgv_table.Rows.Count > 0)
                        {
                            dgv_table.CurrentCell = dgv_table.Rows[0].Cells[0];
                        }
                        MessageBoxEx.Show("删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBoxEx.Show("删除失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                catch (Exception ex)
                {
                    LogService4Customer.WriteLog(1, ex);
                    MessageBoxEx.Show("删除失败!" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            };
            #endregion

            #region 省市区联动
            cboprovince.SelectedIndexChanged += delegate
            {
                try
                {
                    if (!string.IsNullOrEmpty(cboprovince.SelectedValue.ToString()))
                    {
                        CommonFuncCall.BindCityComBox(cbocity, cboprovince.SelectedValue.ToString(), "市");
                        CommonFuncCall.BindCountryComBox(cbocounty, cbocity.SelectedValue.ToString(), "区/县");
                    }
                    else
                    {
                        CommonFuncCall.BindCityComBox(cbocity, "", "市");
                        CommonFuncCall.BindCountryComBox(cbocounty, "", "区/县");
                    }
                }
                catch (Exception ex)
                {
                    LogService4Customer.WriteLog(1, ex);
                }
            };
            cbocity.SelectedIndexChanged += delegate
            {
                try
                {
                    if (!string.IsNullOrEmpty(cbocity.SelectedValue.ToString()))
                    {
                        CommonFuncCall.BindCountryComBox(cbocounty, cbocity.SelectedValue.ToString(), "区/县");
                    }
                    else
                    {
                        CommonFuncCall.BindCountryComBox(cbocounty, "", "区/县");
                    }
                }
                catch (Exception ex)
                {
                    LogService4Customer.WriteLog(1, ex);
                }
            };
            #endregion

            #region 启用停用事件
            StatusEvent += delegate
            {
                try
                {
                    var          listSql   = new List <SQLObj>();
                    const string opName    = "修改客户档案状态";
                    var          strStatus = Convert.ToInt16(_eStatus).ToString(CultureInfo.InvariantCulture);
                    string       msg;
                    if (_eStatus == DataSources.EnumStatus.Start) //启用
                    {
                        StatusSql(listSql, _tiList, strStatus);   //停用的ti_list改为启用
                        msg = "启用";
                    }
                    else//停用
                    {
                        StatusSql(listSql, _qiList, strStatus);//启用的qi_list 改为停用
                        msg = "停用";
                    }
                    if (MessageBoxEx.Show("确认要" + msg + "吗?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK)
                    {
                        return;
                    }
                    if (DBHelper.BatchExeSQLMultiByTrans(opName, listSql))
                    {
                        btnStatus.Enabled = false;
                        BindPageData();
                        MessageBoxEx.Show(msg + "成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBoxEx.Show(msg + "失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                catch (Exception ex)
                {
                    LogService4Customer.WriteLog(1, ex);
                }
            };
            #endregion

            #region 数据表格事件
            dgv_table.CellContentClick += delegate(object sender, DataGridViewCellEventArgs e)
            {
                try
                {
                    if (e.ColumnIndex != 0)
                    {
                        return;
                    }
                    _qiList.Clear();
                    _tiList.Clear();
                    _eStatus = new DataSources.EnumStatus();
                    foreach (DataGridViewRow row in dgv_table.Rows)
                    {
                        if (!Convert.ToBoolean(row.Cells[0].EditedFormattedValue))
                        {
                            continue;
                        }
                        if (row.Cells["status"].EditedFormattedValue.ToString() == DataSources.EnumStatus.Start.GetDescription()) //表格中是启用
                        {
                            _qiList.Add(row.Cells["cust_id"].EditedFormattedValue.ToString());
                        }
                        else//表格中是停用
                        {
                            _tiList.Add(row.Cells["cust_id"].EditedFormattedValue.ToString());
                        }
                    }
                    BtnStatus(_qiList, _tiList);
                }
                catch (Exception ex)
                {
                    LogService4Customer.WriteLog(1, ex);
                }
            };
            dgv_table.HeadCheckChanged += delegate
            {
                try
                {
                    _qiList.Clear();
                    _tiList.Clear();
                    _eStatus = new DataSources.EnumStatus();
                    foreach (DataGridViewRow row in dgv_table.Rows)
                    {
                        if (Convert.ToBoolean(row.Cells[0].Value))
                        {
                            if (row.Cells["status"].Value.ToString() == DataSources.EnumStatus.Start.GetDescription())//表格中是启用
                            {
                                _qiList.Add(row.Cells["cust_id"].Value.ToString());
                            }
                            else//表格中是停用
                            {
                                _tiList.Add(row.Cells["cust_id"].Value.ToString());
                            }
                        }
                    }
                    BtnStatus(_qiList, _tiList);
                }
                catch (Exception ex)
                {
                    LogService4Customer.WriteLog(1, ex);
                }
            };
            #endregion

            #region 根据选择的数据判断功能按钮的显示状态
            dgv_table.CellMouseUp += delegate
            {
                try
                {
                    var dataView = UIAssistants.GetDataGridCheckRows(dgv_table, colCheck, cust_id, TableName);
                    if (dataView == null)
                    {
                        btnCopy.Enabled   = false;
                        btnEdit.Enabled   = false;
                        btnDelete.Enabled = false;
                        return;
                    }
                    var isYt      = dataView.Cast <DataRowView>().Any(rowView => CommonCtrl.IsNullToString(rowView["data_source"]) == "2");
                    var listField = UIAssistants.GetDataGridCheckRows(dgv_table, colCheck, cust_id);
                    if (listField.Count == 0)
                    {
                        btnCopy.Enabled   = false;
                        btnEdit.Enabled   = false;
                        btnDelete.Enabled = false;
                    }
                    else
                    {
                        btnCopy.Enabled   = true;
                        btnEdit.Enabled   = true;
                        btnDelete.Enabled = true;
                    }
                    if (isYt)
                    {
                        btnEdit.Enabled   = false;
                        btnDelete.Enabled = false;
                    }
                }
                catch (Exception ex)
                {
                    LogService4Customer.WriteLog(1, ex);
                }
            };
            #endregion
        }