/// <summary>
        /// 保存设置
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!CheckData())
            {
                return;
            }

            if (dataGridView1.Rows.Count == 0)
            {
                MessageDialog.ShowErrorMessage("还没有设置条形码列表,不允许进行此操作");
                return;
            }

            View_P_PrintBillForVehicleBarcode bill = m_printBill;

            if (bill == null)
            {
                bill = new View_P_PrintBillForVehicleBarcode();

                bill.工号     = BasicInfo.LoginID;
                bill.打印设置日期 = ServerTime.Time;
                bill.是否已经打印 = false;
                bill.打印说明   = txtPrintRemark.Text.Trim();
            }

            List <P_PrintListForVehicleBarcode> printList = new List <P_PrintListForVehicleBarcode>();

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                View_P_PrintListForVehicleBarcode data = dataGridView1.Rows[i].Tag as View_P_PrintListForVehicleBarcode;

                P_PrintListForVehicleBarcode listInfo = new P_PrintListForVehicleBarcode();

                listInfo.BillID      = data.打印编号;
                listInfo.BuildRuleID = data.打印规则编号;
                listInfo.BeginNumber = data.打印起始编号;
                listInfo.EndNumber   = data.打印结束编号;
                listInfo.PrintDegree = data.打印份数;
                listInfo.Date        = data.产品日期;
                listInfo.PrintMode   = data.打印模式编号;

                printList.Add(listInfo);
            }

            if (m_productBarcodeServer.SavePrintSetting(bill, printList, out m_error))
            {
                m_printBill = m_productBarcodeServer.GetPrintSetting(bill.打印编号);

                InitDataGridView(m_printBill);

                btnPrint.Enabled             = true;
                btnPrintSelectedList.Enabled = true;

                MessageDialog.ShowPromptMessage("操作成功");
            }
            else
            {
                MessageDialog.ShowErrorMessage(m_error);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 刷新DataGridView
        /// </summary>
        void RefreshDataGridView()
        {
            if (rbtnPrintSetting.Checked)
            {
                IQueryable <View_P_PrintBillForVehicleBarcode> data = m_productBarcodeServer.GetPrintSetting(
                    dateTimePicker1.Value, dateTimePicker2.Value);

                if (cmbFindCondition.Text == "未打印")
                {
                    data = from r in data
                           where r.是否已经打印 == false
                           select r;
                }
                else if (cmbFindCondition.Text == "已打印")
                {
                    data = from r in data
                           where r.是否已经打印 == true
                           select r;
                }

                dataGridView1.DataSource = data;
            }
            else
            {
                IQueryable <View_P_PrintLogForVehicleBarcode> data = m_productBarcodeServer.GetPrintLog(
                    dateTimePicker1.Value, dateTimePicker2.Value);

                dataGridView1.DataSource = data;
            }

            this.dataGridView1.ColumnWidthChanged -= new System.Windows.Forms.DataGridViewColumnEventHandler(
                this.dataGridView1_ColumnWidthChanged);

            ColumnWidthControl.SetDataGridView(labelTitle.Text, dataGridView1);

            this.dataGridView1.ColumnWidthChanged += new System.Windows.Forms.DataGridViewColumnEventHandler(
                this.dataGridView1_ColumnWidthChanged);
        }