using CPM; using MLL; using System; using System.Drawing; using System.Windows.Forms; using UI; namespace UI { public partial class NotasItensRastreabilidadePanel : FormularioModelo { private ModeloNotasItensRastreabilidade _rastreio = new ModeloNotasItensRastreabilidade(); public NotasItensRastreabilidadePanel() { this.Titulo = "Rastreabilidade de Lote e Logística"; this.Size = new Size(650, 450); MontarInterface(); } private void MontarInterface() { // IDs de Vinculação AddInput(content, "ID RASTREIO", 20, 20, 100, 30, true); AddInput(content, "CÓD. ITEM", 130, 20, 100, 30, true); content.Controls.Add(CreateSectionHeader("INFORMAÇÕES DO LOTE", 70)); // Dados do Lote var txtLote = AddInput(content, "NÚMERO DO LOTE", 20, 100, 250, 30); txtLote.ForeColor = Color.DarkRed; // Destaque para campo crítico AddInput(content, "QUANTIDADE NO LOTE", 280, 100, 150, 30); // Datas AddInput(content, "DATA FABRICAÇÃO", 20, 160, 180, 30); AddInput(content, "DATA VALIDADE", 210, 160, 180, 30); // Código de Agregação (Logística Avançada) content.Controls.Add(CreateSectionHeader("AGREGAÇÃO E LOGÍSTICA", 220)); var txtAgreg = AddInput(content, "CÓDIGO DE AGREGAÇÃO (CAgreg)", 20, 250, 400, 30); Label lblObs = new Label { Text = "* Utilizado para identificar volumes/paletes que agrupam unidades rastreáveis.", Location = new Point(20, 285), AutoSize = true, Font = new Font("Segoe UI", 8, FontStyle.Italic), ForeColor = Color.Gray }; content.Controls.Add(lblObs); content.Height = 330; } // --- LÓGICA DE OPERAÇÃO --- protected override void OnSalvar() { // Validação de segurança: Validade não pode ser menor que fabricação // No LevelOS, poderíamos disparar um alerta se o lote estiver vencido. MessageBox.Show("Dados de rastreabilidade salvos. O item está pronto para o XML.", "LevelOS Logística"); } protected override void OnAlterar() { throw new NotImplementedException(); } protected override void OnLocalizar() { throw new NotImplementedException(); } protected override void OnNovo() => LimparCamposRecursivo(content); protected override void OnExcluir() { if (MessageBox.Show("Remover rastreabilidade deste item?", "Confirmação", MessageBoxButtons.YesNo) == DialogResult.Yes) { MessageBox.Show("Rastreio removido."); } } protected override void OnCancelar() { } private void LimparCamposRecursivo(Control container) { foreach (Control c in container.Controls) { if (c is LV_TEXTBOX1 t) t.Text = ""; if (c.HasChildren) LimparCamposRecursivo(c); } } } }