Cambios en la Etiqueta.prn
Se agregaron dos nuevos valores: $v4 y $v5 para agregar un número de serie y la fecha de impresión. Cambios en el modo debug para realizar pruebas de impresorea sin el sensor
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
//using Keyence.AutoID.SDK;
|
||||
//using Keyence.AutoID.SDK;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
@@ -158,7 +158,7 @@ namespace ScaBox30
|
||||
|
||||
m_searcher.Start((res) =>
|
||||
{
|
||||
//Define searched actions here.Defined actions work asynchronously.
|
||||
//Defines searched actions here.Defined actions work asynchronously.
|
||||
//"SearchListUp" works when a reader was searched.
|
||||
BeginInvoke(new delegateUserControl(SearchListUp), res.IpAddress);
|
||||
});
|
||||
@@ -347,14 +347,14 @@ namespace ScaBox30
|
||||
if (received_data_package != "")
|
||||
{
|
||||
|
||||
// En la exploración obtenemos los códigos recibidos y encontramos el que se repita más veces
|
||||
// En la exploraci<EFBFBD>n obtenemos los c<EFBFBD>digos recibidos y encontramos el que se repita m<EFBFBD>s veces
|
||||
string[] tempTriad = new string[3];
|
||||
string boxType = "";
|
||||
string command = "BLOAD,";
|
||||
string response = "";
|
||||
Data element = null;
|
||||
|
||||
// Limpieza de códigos coincidentes cada lectura
|
||||
// Limpieza de c<EFBFBD>digos coincidentes cada lectura
|
||||
foundCodes.Clear();
|
||||
for (int i = 0; i < individual_receivedData.Count(); i++)
|
||||
{
|
||||
@@ -394,7 +394,7 @@ namespace ScaBox30
|
||||
labelCapacity.Text = temp.Length > 2 ? temp.Substring(0, 2) : temp;
|
||||
|
||||
|
||||
// El layout no está programado en el scanner
|
||||
// El layout no est<EFBFBD> programado en el scanner
|
||||
if (boxType == null)
|
||||
{
|
||||
ClearScreen();
|
||||
@@ -406,7 +406,15 @@ namespace ScaBox30
|
||||
{
|
||||
int lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
|
||||
Console.WriteLine("Ejecutando: {0} en la linea {1}", command, lineNumber + 2);
|
||||
response = m_reader.ExecCommand(command);
|
||||
// En modo debug, no enviar comando al sensor
|
||||
if (!Globals.debug)
|
||||
{
|
||||
response = m_reader.ExecCommand(command);
|
||||
}
|
||||
else
|
||||
{
|
||||
response = "OK"; // Simular respuesta
|
||||
}
|
||||
System.Threading.Thread.Sleep(Globals.cfg.interval);
|
||||
|
||||
}
|
||||
@@ -432,7 +440,7 @@ namespace ScaBox30
|
||||
response = "";
|
||||
}
|
||||
}
|
||||
//Console.WriteLine(command);
|
||||
Console.WriteLine(command);
|
||||
}
|
||||
|
||||
|
||||
@@ -505,9 +513,6 @@ namespace ScaBox30
|
||||
{
|
||||
ok_count++;
|
||||
labels_ok2[ordered_receivedData[i + 1].position].Visible = true;
|
||||
//labels_ok2[ordered_receivedData[i + 1].position].Text = "OK";
|
||||
//labels_ok2[ordered_receivedData[i + 1].position].Text = ordered_receivedData[i + 1].position.ToString();
|
||||
//labels_ok2[ordered_receivedData[i + 1].position].Text = Globals.cfg.resultado.Equals("number") ? ordered_receivedData[i + 1].position.ToString() : "OK" ;
|
||||
switch (Globals.cfg.resultado)
|
||||
{
|
||||
case "number":
|
||||
@@ -531,9 +536,6 @@ namespace ScaBox30
|
||||
{
|
||||
bad_count++;
|
||||
labels_ok2[ordered_receivedData[i + 1].position].Visible = true;
|
||||
//labels_ok2[ordered_receivedData[i + 1].position].Text = "X";
|
||||
//labels_ok2[ordered_receivedData[i + 1].position].Text = ordered_receivedData[i + 1].position.ToString();
|
||||
//labels_ok2[ordered_receivedData[i + 1].position].Text = Globals.cfg.resultado.Equals("number") ? ordered_receivedData[i + 1].position.ToString() : "X";
|
||||
switch (Globals.cfg.resultado)
|
||||
{
|
||||
case "number":
|
||||
@@ -575,7 +577,7 @@ namespace ScaBox30
|
||||
TgrBtn.Enabled = true;
|
||||
//Change background color to red
|
||||
this.BackColor = Color.Red;
|
||||
DialogResult dialogResult = RJMessageBox.Show("Uno o más codigos son incorrectos!", "ScanBox", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
DialogResult dialogResult = RJMessageBox.Show("Uno o m<EFBFBD>s codigos son incorrectos!", "ScanBox", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
this.BackColor = SystemColors.Control;
|
||||
}
|
||||
|
||||
@@ -587,7 +589,7 @@ namespace ScaBox30
|
||||
TgrBtn.Enabled = true;
|
||||
//Change background color to red
|
||||
this.BackColor = Color.Red;
|
||||
DialogResult dialogResult = RJMessageBox.Show("¿Desea realizar la prueba de nuevo?", "ScanBox", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
|
||||
DialogResult dialogResult = RJMessageBox.Show("<EFBFBD>Desea realizar la prueba de nuevo?", "ScanBox", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
|
||||
this.BackColor = SystemColors.Control;
|
||||
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
@@ -626,7 +628,7 @@ namespace ScaBox30
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
RJMessageBox.Show("¡El archivo se encuentra abierto!\nCierre el archivo y repita la lectura.", "ScanBox", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
RJMessageBox.Show("<EFBFBD>El archivo se encuentra abierto!\nCierre el archivo y repita la lectura.", "ScanBox", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -683,7 +685,7 @@ namespace ScaBox30
|
||||
}
|
||||
else
|
||||
{
|
||||
RJMessageBox.Show("El opc no tiene un boxcapacity correcto. Por favor configúrelo en la base de datos primero y después repita la prueba.", "ScanBox", MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
||||
RJMessageBox.Show("El opc no tiene un boxcapacity correcto. Por favor config<EFBFBD>relo en la base de datos primero y despu<EFBFBD>s repita la prueba.", "ScanBox", MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
||||
}
|
||||
|
||||
save_data = false;
|
||||
@@ -696,7 +698,7 @@ namespace ScaBox30
|
||||
private void btnToogleMode_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
DialogResult result = RJMessageBox.Show("Desea cambiar el modo de operación a " + (scanbox ? operation_mode.manual : operation_mode.automatico) + "?", "ScanBox", MessageBoxButtons.OKCancel);
|
||||
DialogResult result = RJMessageBox.Show("Desea cambiar el modo de operaci<EFBFBD>n a " + (scanbox ? operation_mode.manual : operation_mode.automatico) + "?", "ScanBox", MessageBoxButtons.OKCancel);
|
||||
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
@@ -713,7 +715,8 @@ namespace ScaBox30
|
||||
{
|
||||
//ESTABLECE EL MODO DE OPERACION A MANUAL (ESCANER 1D)
|
||||
scanbox = false;
|
||||
TgrBtn.Enabled = false;
|
||||
// En modo manual, habilitar el bot<6F>n si debug est<73> activado o hay sensor
|
||||
TgrBtn.Enabled = (Globals.debug || reader_connected) ? true : false;
|
||||
UpdateTgrBtn();
|
||||
KeyPreview = true; //Habilita el scanner 1d
|
||||
ActiveControl = barcode_lbl;
|
||||
@@ -759,8 +762,8 @@ namespace ScaBox30
|
||||
// REFERENCIA DE COMANDOS UTILIZADOS OBTENIDOS DEL MANUAL
|
||||
// LON -> Inicia la lectura
|
||||
// BLOAD -> Carga archivos de copia de seguridad
|
||||
// RP -> Comando de configuración de operación
|
||||
// RP 215 -> Especificación de rango de captura de imagen
|
||||
// RP -> Comando de configuraci<EFBFBD>n de operaci<EFBFBD>n
|
||||
// RP 215 -> Especificaci<EFBFBD>n de rango de captura de imagen
|
||||
|
||||
if (reader_found)
|
||||
{
|
||||
@@ -768,7 +771,7 @@ namespace ScaBox30
|
||||
string command = "BLOAD," + program;
|
||||
string response = "";
|
||||
|
||||
//Envía el comando hasta obtener una respuest
|
||||
//Env<EFBFBD>a el comando hasta obtener una respuest
|
||||
while (response.Equals(string.Empty))
|
||||
{
|
||||
int lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
|
||||
@@ -805,9 +808,9 @@ namespace ScaBox30
|
||||
//Dispose before closing Form for avoiding error.
|
||||
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
m_reader.Dispose();
|
||||
m_searcher.Dispose();
|
||||
liveviewForm1.Dispose();
|
||||
m_reader?.Dispose();
|
||||
m_searcher?.Dispose();
|
||||
liveviewForm1?.Dispose();
|
||||
}
|
||||
|
||||
|
||||
@@ -1043,7 +1046,7 @@ namespace ScaBox30
|
||||
{
|
||||
sensor_ip_list.Add(ip);
|
||||
//if (ConfigurationManager.AppSettings.Get("sr2000w_ip") == ip)
|
||||
if (Globals.cfg.ipscanner == ip)
|
||||
if ( Globals.cfg.ipscanner == ip)
|
||||
{
|
||||
sr2000w_ip_lbl.Text = ip;
|
||||
reader_found = true;
|
||||
@@ -1094,7 +1097,7 @@ namespace ScaBox30
|
||||
Globals.cfg.usbprinter = "none";
|
||||
Globals.cfg.ipprinter = "192.168.100.101";
|
||||
Globals.cfg.printertype = "eth"; // Puede ser eth o usb
|
||||
Globals.cfg.resultado = "label"; // Etiquetas mostradas en el layout (OK,X), Región ó (OK,X) + Región
|
||||
Globals.cfg.resultado = "label"; // Etiquetas mostradas en el layout (OK,X), Regi<EFBFBD>n <EFBFBD> (OK,X) + Regi<EFBFBD>n
|
||||
Globals.cfg.printerenabled = true;
|
||||
|
||||
Globals.config.Clear();
|
||||
@@ -1122,8 +1125,25 @@ namespace ScaBox30
|
||||
// | |
|
||||
// | |
|
||||
// -----------------*
|
||||
|
||||
// (c,d)
|
||||
|
||||
// En modo debug, no intentar leer del sensor
|
||||
if (Globals.debug)
|
||||
{
|
||||
// Usar valores por defecto para debug
|
||||
xLeftCornner = 0;
|
||||
yLeftCornner = 0;
|
||||
xScale = 1;
|
||||
yScale = 1;
|
||||
globalScale = 1;
|
||||
imgWidth = liveviewForm1?.Bounds.Width ?? 800;
|
||||
imgHeight = liveviewForm1?.Bounds.Height ?? 600;
|
||||
xOffset = 0;
|
||||
yOffset = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
//Get LiveView Size for scale and scale from sensor using command RP,215
|
||||
imageAreaStr = m_reader.ExecCommand("RP,215"); //Read captured image area
|
||||
//List<string> coordinates = (from Match m in Regex.Matches(imageAreaStr, @"\d{4}") select m.Value).Where(p => !string.IsNullOrEmpty(p)).ToList();
|
||||
@@ -1178,7 +1198,7 @@ namespace ScaBox30
|
||||
// Reset daily consecutive counter if day changed
|
||||
if (Globals.consecDate.Date != DateTime.Today)
|
||||
{
|
||||
Globals.consec = 0;
|
||||
Globals.consec = 1;
|
||||
Globals.consecDate = DateTime.Today;
|
||||
}
|
||||
|
||||
@@ -1188,10 +1208,10 @@ namespace ScaBox30
|
||||
{
|
||||
String v1 = Globals.found_element.nom_1;
|
||||
String v2 = Globals.found_element.@base + " / " + Globals.found_element.addition + " " + Globals.found_element.oeil;
|
||||
//String v3 = btnToogleMode.Text == operation_mode.manual ? "" : completa_parcial + " contiene: " + ok_count.ToString() + " de: " + Globals.found_element.Box_Capacity.Substring(0,2);
|
||||
String v3 = btnToogleMode.Text == operation_mode.manual ? "" : completa_parcial + ok_count.ToString() + " de " + Globals.found_element.Box_Capacity.Substring(0, 2);
|
||||
String v4 = Globals.consec.ToString(); //Numero consecutivo
|
||||
DateTime v5 = DateTime.Now; //Fecha y hora de impresión
|
||||
// Mostrar informaci<63>n en todos los modos (manual y scanbox)
|
||||
String v3 = completa_parcial + ": " + ok_count.ToString() + " de " + Globals.found_element.Box_Capacity.Substring(0, 2);
|
||||
String v4 = Globals.consec.ToString("D5"); //Numero consecutivo
|
||||
DateTime v5 = DateTime.Now; //Fecha y hora de impresi<EFBFBD>n
|
||||
String barcode = Globals.found_element.CCE;
|
||||
|
||||
ZT231.buildPrn(v1, v2, v3, v4, v5, barcode);
|
||||
@@ -1270,7 +1290,7 @@ namespace ScaBox30
|
||||
{
|
||||
if (result != DialogResult.Cancel)
|
||||
{
|
||||
RJMessageBox.Show("No tiene permiso para realizar esta acción", "ScanBox", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
RJMessageBox.Show("No tiene permiso para realizar esta acci<EFBFBD>n", "ScanBox", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user