Пример #1
0
        private void btnBarcode_Click(object sender, EventArgs e)
        {
            if (dgvMaster.CurrentRow != null)
            {
                DataRow masterRow = ((DataRowView)dgvMaster.CurrentRow.DataBoundItem).Row;
                DataTable barcodeTable = new ProductStateDal().GetBarcodes(masterRow["BILLNO"].ToString());
                BarcodePrinter printer = new BarcodePrinter();

                DialogResult dr = THOKUtil.ShowQuery2("ѡ����(Y)����ӡѡ����ⵥ��ѡ�񡰷�(N)����ӡѡ����ǩ��ѡ��ȡ������ִ�д�ӡ������");
                switch (dr)
                {
                    case DialogResult.Yes:
                        printer.Print(barcodeTable);

                        break;
                    case DialogResult.No:
                        if (dgvDetail.CurrentRow != null)
                        {
                            DataRow detailRow = ((DataRowView)dgvDetail.CurrentRow.DataBoundItem).Row;
                            printer.Print(barcodeTable, detailRow["BARCODE"].ToString());
                        }
                        break;

                }
            }
        }
Пример #2
0
        private void btnDetail_Click(object sender, EventArgs e)
        {
            if (dgvDetail.CurrentRow != null)
            {
                DataRow row = ((DataRowView)dgvDetail.CurrentRow.DataBoundItem).Row;

                productCode = row["PRODUCTCODE"].ToString().Trim();
                productName = row["PRODUCTNAME"].ToString().Trim();

                if (productName.EndsWith("����"))
                {
                    THOKUtil.ShowInfo("����������ԭ�Ͻ��б༭");
                    return;
                }
                productQuantity = Convert.ToInt32(dgvDetail.CurrentRow.Cells["DQUANTITY"].Value);

                productCount = Convert.ToInt32(row["PACKAGECOUNT"]);

                if (productQuantity == 0)
                {
                    THOKUtil.ShowInfo("��������Ϊ0,����������");
                    return;
                }

                //if (productCount == 0 && productQuantity != 0)
                //{
                //    THOKUtil.ShowInfo("��������Ϊ0,����������");
                //    return;
                //}

                if (productState.ContainsKey(productCode))
                {
                    stateTable = productState[productCode];
                }
                else
                {
                    ProductStateDal psDal = new ProductStateDal();
                    stateTable = psDal.GetProductState(dgvDetail.CurrentRow.Cells["DBILLNO"].Value.ToString().Trim(), productCode);
                    object o = stateTable.Compute("MAX(ITEMNO)", "");

                    stateTable.Columns["ITEMNO"].AutoIncrement = true;
                    stateTable.Columns["ITEMNO"].AutoIncrementSeed = o == DBNull.Value ? 1 : Convert.ToInt32(o) + 1;
                    productState.Add(productCode, stateTable);
                }

                totalQuantity = 0;

                if (stateTable.Rows.Count == 0)
                {
                    if (productCount == 0)
                    {
                        AddStateRow(productQuantity, 0, "1");
                    }
                    else if (productCount == 1)
                        AddStateRow(productQuantity, 1, "0");
                    else
                    {
                        for (int i = 0; i < productCount; i++)
                        {
                            AddStateRow(0, 0, "0");
                        }
                    }
                }

                SumQuantityCount();

                lblStatus.Text = string.Format("ʣ��������{0}       ʣ�������{1}", productQuantity - totalQuantity, productCount - totalCount);
                dgvProduct.DataSource = stateTable;

                ShowMaster(false);

                bool noMix = new ProductStateDal().GetMixCount(txtBillNo.Text, productCode) == 0;
                btnReturn.Enabled = btnReturn.Enabled && noMix;
                btnAddRow.Enabled = btnAddRow.Enabled && noMix;
                btnDeleteRow.Enabled = btnDeleteRow.Enabled && noMix;
                dgvProduct.ReadOnly = dgvProduct.ReadOnly || !noMix;
                if (canSave && !noMix)
                    THOKUtil.ShowInfo("�ò�Ʒ�в��������ѱ���װ������������޸IJ�����\n���Ҫ�����޸�����ȡ���ò�Ʒ��װ");
            }
        }
Пример #3
0
 private void btnBarcode_Click(object sender, EventArgs e)
 {
     if (dgvMaster.CurrentRow != null)
     {
         DataRow masterRow = ((DataRowView)dgvMaster.CurrentRow.DataBoundItem).Row;
         DataTable barcodeTable = new ProductStateDal().GetBarcodes(masterRow["BILLNO"].ToString(), UserID);
         BarcodePrinter printer = new BarcodePrinter();
         printer.Print(barcodeTable);
     }
 }
Пример #4
0
        private void btnTask_Click(object sender, EventArgs e)
        {
            if (dgvMaster.CurrentRow != null)
            {
                DataRow masterRow = ((DataRowView)dgvMaster.CurrentRow.DataBoundItem).Row;
                if (masterRow["STATE"].ToString() == "2")//�����
                {
                    try
                    {
                        billDal.TaskBill(masterRow["BILLNO"].ToString(), stateTable, UserID, SysDate);
                        if (stateTable.Rows.Count == 0)
                        {
                            ProductStateDal stateDal = new ProductStateDal();
                            stateTable = stateDal.GetDetail(masterRow["BILLNO"].ToString());
                            bsDetail.DataSource = stateTable;
                        }

                        masterRow["STATE"] = "3";
                        masterRow["STATEDESC"] = "��ҵ";
                        masterRow["TASKER"] = UserName;
                        masterRow["TASKDATE"] = SysDate;

                        SetButtonState(masterRow["STATE"].ToString());
                        THOKUtil.ShowInfo("��ʼ�����ҵ�����ɹ���");
                    }
                    catch (Exception exp)
                    {
                        THOKUtil.ShowInfo("��ʼ�����ҵ����ʧ�ܣ�ԭ��" + exp.Message);
                    }
                }
                else
                    THOKUtil.ShowInfo("����״̬��Ϊ'���'�����ܽ�����ҵ����");
            }
        }