85 lines
3.5 KiB
C#
85 lines
3.5 KiB
C#
using CPM;
|
|
using MLL;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
|
|
namespace UI
|
|
{
|
|
public class OSPecasPanel : FormularioModelo
|
|
{
|
|
private LV_TEXTBOX1 txtId, txtCodOs, txtCodPeca, txtDescricao, txtQtd;
|
|
private LV_TEXTBOX1 txtValor, txtCusto, txtTecnico, txtDia;
|
|
private LV_TEXTBOX1 txtSeriais, txtLotes, txtXPed, txtNItemPed;
|
|
|
|
public OSPecasPanel()
|
|
{
|
|
this.Titulo = "GESTÃO DE PEÇAS E COMPONENTES (O.S.)";
|
|
MontarInterface();
|
|
}
|
|
|
|
private void MontarInterface()
|
|
{
|
|
// --- SEÇÃO 1: IDENTIFICAÇÃO E DESCRIÇÃO ---
|
|
content.Controls.Add(CreateSectionHeader("Dados da Peça / Produto", 20));
|
|
txtId = AddInput(content, "ID REGISTRO", 20, 55, 100, 28, true);
|
|
txtCodOs = AddInput(content, "Nº DA O.S.", 130, 55, 120, 28, true);
|
|
txtCodPeca = AddInput(content, "CÓD. PEÇA", 260, 55, 150, 28);
|
|
txtDescricao = AddInput(content, "DESCRIÇÃO DA PEÇA", 420, 55, 560, 28);
|
|
|
|
// --- SEÇÃO 2: QUANTIDADES, VALORES E TÉCNICO ---
|
|
content.Controls.Add(CreateSectionHeader("Financeiro e Atribuição", 115));
|
|
txtQtd = AddInput(content, "QTD", 20, 150, 80, 28);
|
|
txtValor = AddInput(content, "VALOR UNIT.", 110, 150, 120, 28);
|
|
txtCusto = AddInput(content, "CUSTO UNIT.", 240, 150, 120, 28);
|
|
txtTecnico = AddInput(content, "TÉCNICO RESP.", 370, 150, 250, 28);
|
|
txtDia = AddInput(content, "DATA APLICAÇÃO", 630, 150, 150, 28);
|
|
|
|
// --- SEÇÃO 3: RASTREABILIDADE (SERIAIS E LOTES) ---
|
|
content.Controls.Add(CreateSectionHeader("Rastreabilidade e Logística", 210));
|
|
txtSeriais = AddInput(content, "NÚMEROS DE SÉRIE (IN)", 20, 245, 470, 28);
|
|
txtLotes = AddInput(content, "LOTES", 500, 245, 480, 28);
|
|
|
|
// --- SEÇÃO 4: PEDIDO DE COMPRA / IMPORTAÇÃO ---
|
|
content.Controls.Add(CreateSectionHeader("Referência de Pedido (XPED)", 305));
|
|
txtXPed = AddInput(content, "PEDIDO (XPED)", 20, 340, 200, 28);
|
|
txtNItemPed = AddInput(content, "Nº ITEM PEDIDO", 230, 340, 150, 28);
|
|
}
|
|
|
|
protected override void OnNovo()
|
|
{
|
|
// Limpa os campos iterando pelo content (padrão que você usa)
|
|
foreach (Control c in content.Controls)
|
|
{
|
|
if (c is LV_TEXTBOX1 txt && !txt.ReadOnly) txt.Text = string.Empty;
|
|
}
|
|
txtCodPeca.Focus();
|
|
}
|
|
|
|
protected override void OnSalvar()
|
|
{
|
|
var peca = new ModeloOSPecas
|
|
{
|
|
COD_OS = txtCodOs.Text,
|
|
COD_PECA = txtCodPeca.Text,
|
|
DESCRICAO = txtDescricao.Text,
|
|
QTD = txtQtd.Text,
|
|
VALOR = txtValor.Text,
|
|
CUSTO = txtCusto.Text,
|
|
TECNICO = txtTecnico.Text,
|
|
DIA = txtDia.Text,
|
|
SERIAIS_IN = txtSeriais.Text,
|
|
LOTES = txtLotes.Text,
|
|
XPED = txtXPed.Text,
|
|
NITEMPED = txtNItemPed.Text
|
|
};
|
|
|
|
// Lógica de persistência na DAL...
|
|
MessageBox.Show("Peça registrada com sucesso na O.S.!", "LevelOS", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
}
|
|
|
|
protected override void OnAlterar() { /* Implementar */ }
|
|
protected override void OnExcluir() { /* Implementar */ }
|
|
protected override void OnLocalizar() { /* Implementar */ }
|
|
protected override void OnCancelar() { OnNovo(); }
|
|
}
|
|
} |