141 lines
5.2 KiB
C#
141 lines
5.2 KiB
C#
using CPM;
|
|
using MLL;
|
|
using System;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
using UI;
|
|
|
|
namespace UI
|
|
{
|
|
public partial class ItensSerialCadastroPanel : FormularioModelo
|
|
{
|
|
private ModeloItensSerial _serial = new ModeloItensSerial();
|
|
|
|
// Controles - Identificação
|
|
private LV_TEXTBOX1 txtId, txtCodigo, txtCodItem, txtSerial, txtNomeItem;
|
|
private Button btnBuscaItem;
|
|
|
|
// Controles - Histórico de Entrada
|
|
private LV_TEXTBOX1 txtCodEntrada, txtNfEntrada;
|
|
|
|
// Controles - Histórico de Saída
|
|
private LV_TEXTBOX1 txtCodSaida, txtNfSaida, txtDataMovim;
|
|
|
|
// Status e Notas
|
|
private LV_TEXTBOX1 txtObs;
|
|
private ComboBox cbBaixado;
|
|
|
|
public ItensSerialCadastroPanel()
|
|
{
|
|
this.Titulo = "Rastreamento de Número de Série / Garantia";
|
|
MontarInterface();
|
|
}
|
|
|
|
private void MontarInterface()
|
|
{
|
|
// --- SEÇÃO 1: O Produto e seu RG (Serial) ---
|
|
content.Controls.Add(CreateSectionHeader("IDENTIFICAÇÃO DO HARDWARE", 20));
|
|
|
|
txtId = AddInput(content, "ID", 20, 50, 70, 30, true);
|
|
txtCodigo = AddInput(content, "CÓD. VÍNCULO", 100, 50, 110, 30);
|
|
|
|
txtCodItem = AddInput(content, "CÓD. ITEM", 220, 50, 90, 30);
|
|
btnBuscaItem = CriarBotaoLupa(315, 66, OnBuscaItem);
|
|
txtNomeItem = AddInput(content, "NOME DO PRODUTO", 355, 50, 480, 30, true);
|
|
|
|
txtSerial = AddInput(content, "NÚMERO DE SÉRIE (S/N)", 20, 105, 380, 30);
|
|
txtSerial.BackColor = Color.LightYellow;
|
|
txtSerial.Font = new Font("Segoe UI", 10, FontStyle.Bold);
|
|
|
|
Label lblStatus = new Label { Text = "ESTÁ BAIXADO?", Location = new Point(415, 88), AutoSize = true };
|
|
cbBaixado = new ComboBox
|
|
{
|
|
Location = new Point(415, 105),
|
|
Size = new Size(120, 30),
|
|
DropDownStyle = ComboBoxStyle.DropDownList,
|
|
FlatStyle = FlatStyle.Flat
|
|
};
|
|
cbBaixado.Items.AddRange(new object[] { "NÃO", "SIM" });
|
|
cbBaixado.SelectedIndex = 0;
|
|
content.Controls.Add(lblStatus);
|
|
content.Controls.Add(cbBaixado);
|
|
|
|
// --- SEÇÃO 2: Origem (Entrada) ---
|
|
content.Controls.Add(CreateSectionHeader("HISTÓRICO DE ENTRADA / COMPRA", 165));
|
|
|
|
txtCodEntrada = AddInput(content, "ID MOV. ENTRADA", 20, 195, 150, 30);
|
|
txtNfEntrada = AddInput(content, "NF-e ENTRADA", 185, 195, 150, 30);
|
|
|
|
// --- SEÇÃO 3: Destino (Saída) ---
|
|
content.Controls.Add(CreateSectionHeader("HISTÓRICO DE SAÍDA / VENDA", 250));
|
|
|
|
txtCodSaida = AddInput(content, "ID MOV. SAÍDA", 20, 280, 150, 30);
|
|
txtNfSaida = AddInput(content, "NF-e SAÍDA", 185, 280, 150, 30);
|
|
txtDataMovim = AddInput(content, "DATA ÚLT. MOV.", 350, 280, 150, 30);
|
|
|
|
// --- SEÇÃO 4: Observações de Garantia ---
|
|
content.Controls.Add(CreateSectionHeader("OBSERVAÇÕES TÉCNICAS / ESTADO", 345));
|
|
txtObs = AddInput(content, "EX: ESTADO FÍSICO, DETALHES DE GARANTIA, ETC.", 20, 375, 815, 50);
|
|
|
|
content.Height = 460;
|
|
}
|
|
|
|
private Button CriarBotaoLupa(int x, int y, EventHandler clickEvent)
|
|
{
|
|
var btn = new Button
|
|
{
|
|
Text = "🔍",
|
|
Location = new Point(x, y),
|
|
Size = new Size(32, 30),
|
|
BackColor = AccentBlue,
|
|
ForeColor = Color.White,
|
|
FlatStyle = FlatStyle.Flat,
|
|
Cursor = Cursors.Hand
|
|
};
|
|
btn.FlatAppearance.BorderSize = 0;
|
|
btn.Click += clickEvent;
|
|
content.Controls.Add(btn);
|
|
return btn;
|
|
}
|
|
|
|
private void OnBuscaItem(object sender, EventArgs e) => MessageBox.Show("Busca de Itens");
|
|
|
|
private void PreencherModel()
|
|
{
|
|
_serial.CODIGO = txtCodigo.Text;
|
|
_serial.COD_ITEM = txtCodItem.Text;
|
|
_serial.SERIAL = txtSerial.Text;
|
|
_serial.COD_NF_ENTRADA = txtNfEntrada.Text;
|
|
_serial.COD_NF_SAIDA = txtNfSaida.Text;
|
|
_serial.COD_ENTRADA = txtCodEntrada.Text;
|
|
_serial.COD_SAIDA = txtCodSaida.Text;
|
|
_serial.DATA_MOVIM = txtDataMovim.Text;
|
|
_serial.BAIXADO = cbBaixado.SelectedItem.ToString();
|
|
_serial.OBS = txtObs.Text;
|
|
}
|
|
|
|
protected override void OnNovo()
|
|
{
|
|
_serial = new ModeloItensSerial();
|
|
txtSerial.Focus();
|
|
}
|
|
|
|
protected override void OnSalvar()
|
|
{
|
|
try
|
|
{
|
|
PreencherModel();
|
|
MessageBox.Show("Número de série registrado no histórico!", "Garantia LevelOS", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show("Erro: " + ex.Message);
|
|
}
|
|
}
|
|
|
|
protected override void OnAlterar() { }
|
|
protected override void OnExcluir() { }
|
|
protected override void OnLocalizar() { }
|
|
protected override void OnCancelar() { OnNovo(); }
|
|
}
|
|
} |