Пример #1
0
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            if (dgvMain.CurrentRow != null)
            {
                DataRow row = ((DataRowView)dgvMain.CurrentRow.DataBoundItem).Row;
                string balanceID = row["BALANCEID"].ToString();

                if (SysDate8.Substring(0, 6) != balanceID)//�½��·���ϵͳ���ڲ�һ��
                {
                    BillDal billDal = new BillDal();
                    if (billDal.GetUncheckBill(balanceID) == 0)//û���½��·�δ��˵ĵ���
                    {

                        try
                        {
                            string minID = balanceDal.GetMinUnBalanceID();
                            if (minID == balanceID)//�½��·�����Сδ�½��·�
                            {
                                btnGenerate.Enabled = false;
                                pnlStep.Top = (pnlMain.Height - pnlStep.Height) / 3;
                                pnlStep.Left = (pnlMain.Width - pnlStep.Width) / 2;
                                pnlStep.Visible = true;

                                balanceDal.GenerateBalance(balanceID, UserID, SysDate);

                                row["STATE"] = "1";
                                row["STATEDESC"] = "���½�";
                                row["OPERATER"] = UserID;
                                row["USERNAME"] = UserName;
                                row["BALANCEDATE"] = SysDate;
                            }
                            else
                                THOKUtil.ShowInfo(string.Format("���ܽ���'{0}'�½������ԭ��'{1}'��δ�����½������", row["BALANCEID"], balanceID));
                        }
                        catch (Exception exp)
                        {
                            btnGenerate.Enabled = true;
                            THOKUtil.ShowInfo("�½����ʧ�ܣ�ԭ��" + exp.Message);
                            pnlStep.Visible = false;
                        }
                    }
                    else
                        THOKUtil.ShowInfo(balanceID + "����δ��˵ĵ��ݣ����ܽ����½������");
                }
                else
                    THOKUtil.ShowInfo("���ܽ����½������ԭ�򣺷�����ϵͳ�������½��·���ͬ��");

            }
        }
Пример #2
0
        private void btnCheck_Click(object sender, EventArgs e)
        {
            if (dgvMaster.CurrentRow != null)
            {
                DataRow masterRow = ((DataRowView)dgvMaster.CurrentRow.DataBoundItem).Row;
                try
                {
                    BillDal billDal = new BillDal();
                    if (masterRow["STATE"].ToString() == "1")//�ѱ���
                    {
                        billDal.CheckBill(masterRow["BILLNO"].ToString(), "2", UserID, SysDate);
                        masterRow["STATE"] = "2";
                        masterRow["STATEDESC"] = "���";
                        masterRow["CHECKER"] = UserName;
                        masterRow["CHECKDATE"] = SysDate;
                        btnCheck.Text = "����";
                        THOKUtil.ShowInfo("������˲����ɹ���");
                    }
                    else if (masterRow["STATE"].ToString() == "2")//�����
                    {
                        billDal.CheckBill(dgvMaster.CurrentRow.Cells["BILLNO"].Value.ToString(), "1", "", "");
                        masterRow["STATE"] = "1";
                        masterRow["STATEDESC"] = "����";
                        masterRow["CHECKER"] = "";
                        masterRow["CHECKDATE"] = "";
                        btnCheck.Text = "���";
                        THOKUtil.ShowInfo("���ݷ�������ɹ���");
                    }

                    SetButtonState(masterRow);
                }
                catch (Exception exp)
                {
                    THOKUtil.ShowInfo(btnCheck.Text + "����ʧ�ܣ�ԭ��" + exp.Message);
                }
            }
        }
Пример #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtScheduleNo.Text.Trim().Length == 0)
            {
                THOKUtil.ShowInfo("���κŲ���Ϊ�ա�");
                return;
            }

            if (detailTable.Rows.Count == 0)
            {
                THOKUtil.ShowInfo("���ⵥ��ϸ����Ϊ�ա�");
                return;
            }

            try
            {
                BillDal billDal = new BillDal();
                billDal.VerifyQuantity(detailTable, productState);
            }
            catch (Exception exp)
            {
                THOKUtil.ShowInfo(exp.Message);
                return;
            }

            DialogResult = DialogResult.OK;
        }
Пример #4
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);
                }
            }
        }
Пример #5
0
        private void btnCheck_Click(object sender, EventArgs e)
        {
            if (dgvMaster.CurrentRow != null)
            {
                DataRow masterRow = ((DataRowView)dgvMaster.CurrentRow.DataBoundItem).Row;
                try
                {
                    BillDal billDal = new BillDal();

                    if (masterRow["STATE"].ToString().Trim() == "1")//�ѱ���
                    {
                        billDal.VerifyQuantity(detailTable, null);

                        if (new ProductStateDal().GetUnmixCount(masterRow["BILLNO"].ToString()) != 0)
                            throw new Exception("������Ҫ��װ�IJ�Ʒ�����Ƚ��л�װ����");

                        billDal.CheckBill(masterRow["BILLNO"].ToString(),"2", UserID, SysDate);

                        masterRow["STATE"] = "2";
                        masterRow["STATEDESC"] = "���";
                        masterRow["CHECKER"] = UserName;
                        masterRow["CHECKDATE"] = SysDate;
                        btnCheck.Text = "����";

                        SetButtonState(masterRow["STATE"].ToString());

                        THOKUtil.ShowInfo("������˲����ɹ���");
                    }
                    else if (masterRow["STATE"].ToString() == "2")//�����
                    {
                        billDal.CheckBill(masterRow["BILLNO"].ToString(), "1", "", "");
                        masterRow["STATE"] = "1";
                        masterRow["STATEDESC"] = "����";
                        masterRow["CHECKER"] = "";
                        masterRow["CHECKDATE"] = "";
                        btnCheck.Text = "���";
                        THOKUtil.ShowInfo("���ݷ�������ɹ���");
                        SetButtonState(masterRow["STATE"].ToString());
                    }

                }
                catch (Exception exp)
                {
                    THOKUtil.ShowInfo(btnCheck.Text + "����ʧ�ܣ�ԭ��" + exp.Message);
                }
            }
        }