private void btnRefresh_Click(object sender, EventArgs e)
 {
     try
     {
         SelectDialog selectDialog = new SelectDialog(productTable, productFields, false);
         if (selectDialog.ShowDialog() == DialogResult.OK)
         {
             DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn.RemoveFilter(dgvMain);
             bsMain.DataSource = cellDal.GetCell(selectDialog["PRODUCTCODE"]);
         }
     }
     catch (Exception exp)
     {
         THOKUtil.ShowInfo("��������ʧ�ܣ�ԭ��" + exp.Message);
     }
 }
示例#2
0
        private void btnProduct_Click(object sender, EventArgs e)
        {
            SelectDialog selectDialog = new SelectDialog(productTable, productFields, false);
            if (selectDialog.ShowDialog() == DialogResult.OK)
            {
                if (Convert.ToInt32(detailTable.Compute("COUNT(PRODUCTCODE)", string.Format("PRODUCTCODE='{0}'", selectDialog.SelectedValue["PRODUCTCODE"]))) == 0)
                {
                    if (row == dgvDetail.NewRowIndex)
                    {

                            DataRow newRow = detailTable.NewRow();
                            newRow["PRODUCTCODE"] = selectDialog.SelectedValue["PRODUCTCODE"];
                            newRow["PRODUCTNAME"] = selectDialog.SelectedValue["PRODUCTNAME"];
                            newRow["QUANTITY"] = 0;
                            newRow["REALQUANTITY"] = 0;
                            newRow["PACKAGECOUNT"] = 0;
                            newRow["NCCOUNT"] = 0;
                            detailTable.Rows.Add(newRow);
                        }
                    else
                    {
                        dgvDetail.Rows[row].Cells["PRODUCTCODE"].Value = selectDialog.SelectedValue["PRODUCTCODE"];
                        dgvDetail.Rows[row].Cells["PRODUCTNAME"].Value = selectDialog.SelectedValue["PRODUCTNAME"];
                    }
                }
                else
                    THOKUtil.ShowInfo(string.Format("���ⵥ���Ѵ���'{0}',������ѡ��", selectDialog.SelectedValue["PRODUCTNAME"]));

            }
        }
示例#3
0
 private void btnBatch_Click(object sender, EventArgs e)
 {
     ScheduleDal scheduleDal = new ScheduleDal();
     TableDialogDal dialogDal = new TableDialogDal();
     //SelectDialog selectDialog = new SelectDialog(scheduleDal.GetSchedule(), dialogDal.GetField("SCHEDULE"), false);
     SelectDialog selectDialog = new SelectDialog(scheduleDal.GetNoneInSchedule(), dialogDal.GetField("SCHEDULE"), false);
     if (selectDialog.ShowDialog() == DialogResult.OK)
     {
         //if (selectDialog.SelectedValue["FORMULACODE"].Trim().Length != 0)
         //{
             txtScheduleNo.Text = selectDialog.SelectedValue["SCHEDULENO"];
         //}
         //else
         //    THOKUtil.ShowInfo("�������õ�ǰ�����ƻ���Ӧ�õ��䷽����");
     }
 }
示例#4
0
        private void btnFormula_Click(object sender, EventArgs e)
        {
            if (dgvMain.CurrentRow != null)
            {
                DataRow masterRow = ((DataRowView)dgvMain.CurrentRow.DataBoundItem).Row;

                if (masterRow["FORMULACODE"].ToString().Trim().Length != 0)
                {
                    if (THOKUtil.ShowQuery("��ȷ��Ҫ����뵱ǰ�����ƻ��󶨵��䷽������") == DialogResult.Yes)
                    {
                        try
                        {
                            ScheduleDal scheduleDal = new ScheduleDal();
                            scheduleDal.ClearFormula(masterRow["SCHEDULENO"].ToString(),
                                                masterRow["FORMULACODE"].ToString());
                            masterRow["FORMULACODE"] = "";
                        }
                        catch (Exception exp)
                        {
                            THOKUtil.ShowInfo("�����䷽����ʧ�ܣ�ԭ��" + exp.Message);
                        }
                    }
                }
                else
                {
                    FormulaDal formulaDal = new FormulaDal();
                    DataTable table = formulaDal.GetFormulaMaster(masterRow["CIGARETTECODE"].ToString());
                    SelectDialog selectDialog = new SelectDialog(table, fields, false);
                    if (selectDialog.ShowDialog() == DialogResult.OK)
                    {
                        try
                        {
                            string minFormula = formulaDal.GetMinFormula(masterRow["CIGARETTENAME"].ToString(), selectDialog["FORMULACODE"]);
                            if (minFormula.Trim().Length != 0 &&
                                THOKUtil.ShowQuery(string.Format("��ѡ����䷽����Ϊ'{0}',�䷽��'{1}'��ʹ�ô�����0,ȷ��Ҫʹ��ѡ����䷽����?", selectDialog["FORMULACODE"], minFormula)) == DialogResult.No)
                                return;

                            ScheduleDal scheduleDal = new ScheduleDal();
                            scheduleDal.SaveFormula(masterRow["SCHEDULENO"].ToString(),
                                                masterRow["CIGARETTENAME"].ToString(),
                                                selectDialog.SelectedValue["FORMULACODE"]);
                            masterRow["FORMULACODE"] = selectDialog.SelectedValue["FORMULACODE"];
                        }
                        catch (Exception exp)
                        {
                            THOKUtil.ShowInfo("�����䷽����ʧ�ܣ�ԭ��" + exp.Message);
                        }
                    }
                }
            }
            else
                THOKUtil.ShowInfo("��ѡ��Ҫ����������ƻ���");
        }
示例#5
0
        private void btnBatch_Click(object sender, EventArgs e)
        {
            ScheduleDal scheduleDal = new ScheduleDal();
            SelectDialog selectDialog = new SelectDialog(scheduleDal.GetStockSchedule(), scheduleFields, false);
            if (selectDialog.ShowDialog() == DialogResult.OK)
            {
                txtScheduleNo.Text = selectDialog["SCHEDULENO"];

                productTable = new ProductDal().GetProducts(txtScheduleNo.Text);

                //BillDal billDal = new BillDal();

                //if (THOKUtil.ShowQuery("�Զ����ɴ����γ��ⵥ��") == DialogResult.Yes)
                //{
                //    DataTable masterTable = billDal.GetMaster(selectDialog["SCHEDULENO"]);
                //    DataTable oriMasterTable = billDal.GetMasterOri(selectDialog["SCHEDULENO"]);
                //    if (oriMasterTable.Rows.Count !=0)
                //    {
                //        txtBillNo.Text = oriMasterTable.Rows[0]["BILLNO"].ToString();
                //    }
                //    txtWarehouse.Text = "�䷽��";
                //    txtWarehouse.Tag = "001";

                //    detailTable = new CellDal().GetDetail(txtScheduleNo.Text);
                //    dgvDetail.DataSource = detailTable;
                //    btnDeleteRow.Enabled = false;
                //    dgvDetail.ReadOnly = true;
                //}
                //else
                //{
                //    productTable = new ProductDal().GetProducts(txtScheduleNo.Text);
                //}
            }
        }
示例#6
0
 private void btnWarehouse_Click(object sender, EventArgs e)
 {
     SelectDialog selectDialog = new SelectDialog(areaTable, areaFields, false);
     if (selectDialog.ShowDialog() == DialogResult.OK)
     {
         txtWarehouse.Text = selectDialog["AREANAME"];
         txtWarehouse.Tag = selectDialog["AREACODE"];
     }
 }
示例#7
0
 private void btnProduct_Click(object sender, EventArgs e)
 {
     if (productTable != null)
     {
         SelectDialog selectDialog = new SelectDialog(productTable, productFields, false);
         if (selectDialog.ShowDialog() == DialogResult.OK)
         {
             if (row == dgvDetail.NewRowIndex)
             {
                 DataRow newRow = detailTable.NewRow();
                 newRow["PRODUCTCODE"] = selectDialog.SelectedValue["PRODUCTCODE"];
                 newRow["PRODUCTNAME"] = selectDialog.SelectedValue["PRODUCTNAME"];
                 newRow["QUANTITY"] = 0;
                 newRow["REALQUANTITY"] = 0;
                 newRow["PACKAGECOUNT"] = 0;
                 newRow["NCCOUNT"] = 0;
                 detailTable.Rows.Add(newRow);
             }
             else
             {
                 dgvDetail.Rows[row].Cells["PRODUCTCODE"].Value = selectDialog.SelectedValue["PRODUCTCODE"];
                 dgvDetail.Rows[row].Cells["PRODUCTNAME"].Value = selectDialog.SelectedValue["PRODUCTNAME"];
             }
         }
     }
     else
         THOKUtil.ShowInfo("����ѡ���������Ρ�");
 }
示例#8
0
        private void btnBatch_Click(object sender, EventArgs e)
        {
            ScheduleDal scheduleDal = new ScheduleDal();
            SelectDialog selectDialog = new SelectDialog(scheduleDal.GetStockSchedule(), scheduleFields, false);
            if (selectDialog.ShowDialog() == DialogResult.OK)
            {
                txtScheduleNo.Text = selectDialog["SCHEDULENO"];
                cellTable = new CellDal().GetCellBySchedule(txtScheduleNo.Text);
                if ((billType == "3" || billType == "4") && THOKUtil.ShowQuery("�Զ����ɴ����ε�����") == DialogResult.Yes)
                {
                    foreach (DataRow row in cellTable.Rows)
                    {
                        DataRow newRow = detailTable.NewRow();

                        newRow["SCHEDULENO"] = row["SCHEDULENO"];
                        newRow["CELLCODE"] = row["CELLCODE"];
                        newRow["CELLNAME"] = row["CELLNAME"];
                        newRow["PRODUCTCODE"] = row["PRODUCTCODE"];
                        newRow["PRODUCTNAME"] = row["PRODUCTNAME"];
                        newRow["BARCODE"] = row["PRODUCTBARCODE"];
                        newRow["PALLETBARCODE"] = row["PALLETBARCODE"];
                        newRow["QUANTITY"] = row["QUANTITY"];
                        newRow["REALQUANTITY"] = 0;
                        detailTable.Rows.Add(newRow);
                    }
                }
            }
        }
示例#9
0
        private void SelectNewCell()
        {
            SelectDialog selectDialog = new SelectDialog(freeCellTable, cellFields, false);
            if (selectDialog.ShowDialog() == DialogResult.OK)
            {
                if (Convert.ToInt32(detailTable.Compute("COUNT(NEWCELLCODE)", string.Format("NEWCELLCODE='{0}'", selectDialog["CELLCODE"]))) == 0)
                {
                    if (row == dgvDetail.NewRowIndex)
                    {
                        DataRow newRow = detailTable.NewRow();

                        newRow["NEWCELLCODE"] = selectDialog["CELLCODE"];
                        newRow["NEWCELL"] = selectDialog["CELLNAME"];
                        detailTable.Rows.Add(newRow);
                    }
                    else
                    {
                        dgvDetail.Rows[row].Cells["NEWCELLCODE"].Value = selectDialog["CELLCODE"];
                        dgvDetail.Rows[row].Cells["NEWCELL"].Value = selectDialog["CELLNAME"];
                    }
                }
                else
                    THOKUtil.ShowInfo(string.Format("�������Ѵ���'{0}',������ѡ��", selectDialog["CELLNAME"]));
            }
        }
示例#10
0
        private void SelectCell()
        {
            SelectDialog selectDialog = new SelectDialog(cellTable, cellFields, false);
            if (selectDialog.ShowDialog() == DialogResult.OK)
            {
                if (Convert.ToInt32(detailTable.Compute("COUNT(CELLCODE)", string.Format("CELLCODE='{0}'", selectDialog["CELLCODE"]))) == 0)
                {
                    if (row == dgvDetail.NewRowIndex)
                    {
                        DataRow newRow = detailTable.NewRow();

                        newRow["SCHEDULENO"] = selectDialog["SCHEDULENO"];
                        newRow["CELLCODE"] = selectDialog["CELLCODE"];
                        newRow["CELLNAME"] = selectDialog["CELLNAME"];
                        newRow["PRODUCTCODE"] = selectDialog["PRODUCTCODE"];
                        newRow["PRODUCTNAME"] = selectDialog["PRODUCTNAME"];
                        newRow["BARCODE"] = selectDialog["PRODUCTBARCODE"];
                        newRow["PALLETBARCODE"] = selectDialog["PALLETBARCODE"];
                        newRow["QUANTITY"] = selectDialog["QUANTITY"];
                        newRow["REALQUANTITY"] = 0;
                        detailTable.Rows.Add(newRow);
                    }
                    else
                    {
                        dgvDetail.Rows[row].Cells["SCHEDULENO"].Value = selectDialog["SCHEDULENO"];
                        dgvDetail.Rows[row].Cells["CELLCODE"].Value = selectDialog["CELLCODE"];
                        dgvDetail.Rows[row].Cells["CELLNAME"].Value = selectDialog["CELLNAME"];
                        dgvDetail.Rows[row].Cells["PRODUCTCODE"].Value = selectDialog["PRODUCTCODE"];
                        dgvDetail.Rows[row].Cells["PRODUCTNAME"].Value = selectDialog["PRODUCTNAME"];
                        dgvDetail.Rows[row].Cells["BARCODE"].Value = selectDialog["PRODUCTBARCODE"];
                        dgvDetail.Rows[row].Cells["PALLETBARCODE"].Value = selectDialog["PALLETBARCODE"];
                        dgvDetail.Rows[row].Cells["QUANTITY"].Value = selectDialog["QUANTITY"];
                        dgvDetail.Rows[row].Cells["REALQUANTITY"].Value = 0;
                    }
                }
                else
                    THOKUtil.ShowInfo(string.Format("���ⵥ���Ѵ���'{0}',������ѡ��", selectDialog["CELLNAME"]));
            }
        }
示例#11
0
 private void btnBatch_Click(object sender, EventArgs e)
 {
     ScheduleDal scheduleDal = new ScheduleDal();
     SelectDialog selectDialog = new SelectDialog(scheduleDal.GetNoneInSchedule(), scheduleFields, false);
     if (selectDialog.ShowDialog() == DialogResult.OK)
     {
         txtScheduleNo.Text = selectDialog["SCHEDULENO"];
     }
 }
示例#12
0
        private void btnProduct_Click(object sender, EventArgs e)
        {
            SelectDialog selectDialog = null;
            if (txtScheduleNo.Text.Length == 0)
                selectDialog = new SelectDialog(new ProductDal().GetProducts(), productFields, false);
            else
                selectDialog = new SelectDialog(productTable, productFields, false);

            if (selectDialog.ShowDialog() == DialogResult.OK)
            {
                if (row == dgvDetail.NewRowIndex)
                {
                    DataRow newRow = detailTable.NewRow();
                    newRow["PRODUCTCODE"] = selectDialog.SelectedValue["PRODUCTCODE"];
                    newRow["PRODUCTNAME"] = selectDialog.SelectedValue["PRODUCTNAME"];
                    newRow["QUANTITY"] = 0;
                    newRow["REALQUANTITY"] = 0;
                    newRow["PACKAGECOUNT"] = 0;
                    newRow["NCCOUNT"] = 0;
                    detailTable.Rows.Add(newRow);
                }
                else
                {
                    dgvDetail.Rows[row].Cells["PRODUCTCODE"].Value = selectDialog.SelectedValue["PRODUCTCODE"];
                    dgvDetail.Rows[row].Cells["PRODUCTNAME"].Value = selectDialog.SelectedValue["PRODUCTNAME"];
                }
            }
        }