private void btnClear_Click(object sender, EventArgs e) { if (dgvMain.CurrentRow != null) { if (THOKUtil.ShowQuery("��ȷʵҪ��������ɵĵ�����?") == DialogResult.Yes) { DataRow masterRow = ((DataRowView)dgvMain.CurrentRow.DataBoundItem).Row; ScheduleDal scheduleDal = new ScheduleDal(); try { scheduleDal.ClearBillNo(masterRow["SCHEDULENO"].ToString(), masterRow["BILLNO"].ToString()); dgvMain.CurrentRow.Cells["BILLNO"].Value = ""; btnFormula.Enabled = true; btnGenerate.Enabled = true; btnClear.Enabled = false; } catch (Exception exp) { THOKUtil.ShowInfo("��������ɵĵ���ʧ�ܣ�ԭ��" + exp.Message); } } } }
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("�������õ�ǰ�����ƻ���Ӧ�õ��䷽����"); } }
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("��ѡ��Ҫ����������ƻ���"); }
private void btnImport_Click(object sender, EventArgs e) { ScheduleDialog scheduleDialog = new ScheduleDialog(); if (scheduleDialog.ShowDialog() == DialogResult.OK) { try { ScheduleDal scheduleDal = new ScheduleDal(); scheduleDal.AddSchedule(scheduleDialog.ScheduleBatch, //scheduleDialog.ScheduleUnit, scheduleDialog.CigaretteCode, scheduleDialog.CigaretteName, scheduleDialog.Quantity); bsMain.DataSource = scheduleDal.GetSchedule(); } catch (Exception exp) { THOKUtil.ShowInfo(exp.Message); } } }
private void btnRefresh_Click(object sender, EventArgs e) { try { TableDialogDal dialogDal = new TableDialogDal(); fields = dialogDal.GetField("FORMULAMASTER"); ScheduleDal scheduleDal = new ScheduleDal(); bsMain.DataSource = scheduleDal.GetSchedule(); DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn.RemoveFilter(dgvMain); } catch (Exception exp) { THOKUtil.ShowInfo("���������ƻ�����ʧ�ܣ�ԭ��" + exp.Message); } }
private void btnGenerate_Click(object sender, EventArgs e) { if (dgvMain.CurrentRow != null) { DataRow masterRow = ((DataRowView)dgvMain.CurrentRow.DataBoundItem).Row; if (masterRow["FORMULACODE"].ToString().Trim().Length != 0) { try { ScheduleDal scheduleDal = new ScheduleDal(); string billNo = scheduleDal.GenBill(masterRow["FORMULACODE"].ToString(), masterRow["SCHEDULENO"].ToString(), Convert.ToDouble(masterRow["QUANTITY"]), UserID, SysDate, SysDate8); dgvMain.CurrentRow.Cells["BILLNO"].Value = billNo; btnFormula.Enabled = false; btnGenerate.Enabled = false; btnClear.Enabled = true; THOKUtil.ShowInfo(string.Format("���ɴ�������ⵥ�ݳɹ������ݺ�'{0}'��", billNo)); } catch (Exception exp) { THOKUtil.ShowInfo("���浥��ʧ�ܣ�ԭ��" + exp.Message); } } else THOKUtil.ShowInfo("�������õ�ǰ�����ƻ���Ӧ�õ��䷽����"); } else THOKUtil.ShowInfo("��ѡ��Ҫ���ɵ��ݵ������ƻ���"); }
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); //} } }
private void btnModify_Click(object sender, EventArgs e) { if (dgvMaster.CurrentRow != null) { DataRow masterRow = ((DataRowView)dgvMaster.CurrentRow.DataBoundItem).Row; bool canSave = new THOK.PFK.Dal.ScheduleDal().GetFormula(masterRow["FORMULACODE"].ToString()) == 0; FormulaDialog formulaDialog = new FormulaDialog(masterRow["FORMULACODE"].ToString(), masterRow["FORMULANAME"].ToString(), masterRow["FORMULADATE"].ToString(), masterRow["CIGARETTENAME"].ToString(), masterRow["USECOUNT"].ToString(), masterRow["FORMULANO"].ToString(), detailTable, canSave); formulaDialog.FormulaCode = masterRow[0].ToString(); if (formulaDialog.ShowDialog() == DialogResult.OK) { try { FormulaDal formulaDal = new FormulaDal(); formulaDal.SaveFormula(formulaDialog.FormulaCode, formulaDialog.FormulaName, formulaDialog.FormulaDate, formulaDialog.CigaretteName, formulaDialog.Quantity, UserID, formulaDialog.FormulaNo, formulaDialog.FormulaDetail); bsMain.DataSource = formulaDal.GetFormulaMaster(); } catch (Exception exp) { THOKUtil.ShowInfo("�����䷽������ʧ�ܣ�ԭ��" + exp.Message); } } } }
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); } } } }
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"]; } }