Initial commit
This commit is contained in:
228
Handler/Project/Dialog/fManualPrint.cs
Normal file
228
Handler/Project/Dialog/fManualPrint.cs
Normal file
@@ -0,0 +1,228 @@
|
||||
using Emgu.CV.OCR;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using AR;
|
||||
|
||||
namespace Project.Dialog
|
||||
{
|
||||
public partial class fManualPrint : Form
|
||||
{
|
||||
bool ReprintMode = false;
|
||||
public fManualPrint()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.FormClosed += FManualPrint_FormClosed;
|
||||
}
|
||||
public fManualPrint(string sid, string lot, string qty, string mfg, string rid, string spy, string pn)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.FormClosed += FManualPrint_FormClosed;
|
||||
this.tbSID.Text = sid;
|
||||
this.tbVLot.Text = lot;
|
||||
this.tbQty.Text = qty;
|
||||
this.tbDate.Text = mfg;
|
||||
this.tbRID.Text = rid;
|
||||
this.tbSPY.Text = spy;
|
||||
this.tbPN.Text = pn;
|
||||
chkDelinfo.Enabled = false;
|
||||
chkDelinfo.Checked = false;
|
||||
tbBarcodeInput.Enabled = false;
|
||||
this.ReprintMode = true;
|
||||
}
|
||||
|
||||
private void fManualPrint_Load(object sender, EventArgs e)
|
||||
{
|
||||
var lockvalue = true;
|
||||
PUB.iLock[(int)eAxis.PZ_PICK].set((int)eILock.MPrint, lockvalue, "COMMINTERLOCK");
|
||||
PUB.iLock[(int)eAxis.Z_THETA].set((int)eILock.MPrint, lockvalue, "COMMINTERLOCK");
|
||||
PUB.iLock[(int)eAxis.PX_PICK].set((int)eILock.MPrint, lockvalue, "COMMINTERLOCK");
|
||||
|
||||
PUB.iLock[(int)eAxis.PL_MOVE].set((int)eILock.MPrint, lockvalue, "COMMINTERLOCK");
|
||||
PUB.iLock[(int)eAxis.PR_MOVE].set((int)eILock.MPrint, lockvalue, "COMMINTERLOCK");
|
||||
|
||||
if (ReprintMode) button1.Focus();
|
||||
else tbBarcodeInput.Focus();
|
||||
}
|
||||
|
||||
private void FManualPrint_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
//PUB.LockPKT.set((int)eILockPKX.MPrint, false, "COMMINTERLOCK");
|
||||
var lockvalue = false;
|
||||
PUB.iLock[(int)eAxis.PZ_PICK].set((int)eILock.MPrint, lockvalue, "COMMINTERLOCK");
|
||||
PUB.iLock[(int)eAxis.Z_THETA].set((int)eILock.MPrint, lockvalue, "COMMINTERLOCK");
|
||||
PUB.iLock[(int)eAxis.PX_PICK].set((int)eILock.MPrint, lockvalue, "COMMINTERLOCK");
|
||||
|
||||
PUB.iLock[(int)eAxis.PL_MOVE].set((int)eILock.MPrint, lockvalue, "COMMINTERLOCK");
|
||||
PUB.iLock[(int)eAxis.PR_MOVE].set((int)eILock.MPrint, lockvalue, "COMMINTERLOCK");
|
||||
}
|
||||
|
||||
private void btPrint_Click(object sender, EventArgs e)
|
||||
{
|
||||
//프린트해야한다
|
||||
string zpl = "";
|
||||
string qrdata = "";
|
||||
|
||||
var Printer = radLeft.Checked ? PUB.PrinterL : PUB.PrinterR;
|
||||
var sid = tbSID.Text.Trim();
|
||||
var rid = tbRID.Text.Trim();
|
||||
var lot = tbVLot.Text.Trim();
|
||||
var mfg = tbDate.Text.Trim();
|
||||
var qty = tbQty.Text.Trim();
|
||||
var spy = tbSPY.Text.Trim();
|
||||
var pan = tbPN.Text.Trim();
|
||||
|
||||
if (int.TryParse(qty, out int vqty) == false)
|
||||
{
|
||||
UTIL.MsgE("수량은 숫자로 입력하세요");
|
||||
tbQty.SelectAll();
|
||||
tbQty.Focus();
|
||||
return;
|
||||
}
|
||||
|
||||
zpl = Printer.makeZPL_210908(new Class.Reel
|
||||
{
|
||||
sid = sid,
|
||||
lot = lot,
|
||||
manu = spy,
|
||||
qty = vqty,
|
||||
id = rid,
|
||||
mfg = mfg,
|
||||
partnum = pan,
|
||||
}, SETTING.Data.DrawOutbox, out qrdata);
|
||||
|
||||
var cnt = (int)nudCnt.Value;
|
||||
for (int i = 0; i < cnt; i++)
|
||||
{
|
||||
if (Printer.Print(zpl) == false)
|
||||
{
|
||||
//인쇄실패시 처리하지 않음
|
||||
UTIL.MsgE("인쇄 실패로 인해 더이상 진행하지 않습니다");
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i == 0) //첫장만 로깅
|
||||
PUB.log.Add("사용자 프린트 완료" + string.Join("|", new string[] { sid, lot, spy, qty, rid, mfg, pan }));
|
||||
}
|
||||
System.Threading.Thread.Sleep(100);
|
||||
}
|
||||
|
||||
if (ReprintMode) DialogResult = DialogResult.OK;
|
||||
else
|
||||
{
|
||||
//자료를 삭제해야한다
|
||||
if (chkDelinfo.Checked)
|
||||
{
|
||||
ClearData(tbSID, tbVLot, tbQty, tbDate, tbRID, tbSPY, tbPN);
|
||||
tbSID.Focus();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
void ClearData(params TextBox[] tbs)
|
||||
{
|
||||
foreach (var tb in tbs)
|
||||
{
|
||||
tb.Text = "";
|
||||
tb.Focus();
|
||||
}
|
||||
|
||||
}
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
//sid
|
||||
ClearData(tbSID);
|
||||
}
|
||||
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
//vlot
|
||||
ClearData(tbVLot);
|
||||
}
|
||||
|
||||
private void button3_Click(object sender, EventArgs e)
|
||||
{
|
||||
//qty
|
||||
ClearData(tbQty);
|
||||
}
|
||||
|
||||
|
||||
private void button4_Click(object sender, EventArgs e)
|
||||
{
|
||||
//date
|
||||
ClearData(tbDate);
|
||||
}
|
||||
|
||||
private void button5_Click(object sender, EventArgs e)
|
||||
{
|
||||
//rid
|
||||
ClearData(tbRID);
|
||||
}
|
||||
|
||||
private void button6_Click(object sender, EventArgs e)
|
||||
{
|
||||
//spy
|
||||
ClearData(tbSPY);
|
||||
}
|
||||
|
||||
private void button7_Click(object sender, EventArgs e)
|
||||
{
|
||||
//pn
|
||||
ClearData(tbPN);
|
||||
}
|
||||
|
||||
private void tbSID_Click(object sender, EventArgs e)
|
||||
{
|
||||
var tb = sender as TextBox;
|
||||
var rlt = AR.UTIL.InputBox("값을 입력하세요", tb.Text, AR.UTIL.eInputbox.TouchFullSingleLine);
|
||||
if (rlt.Item1) tb.Text = rlt.Item2;
|
||||
}
|
||||
|
||||
private void button8_Click(object sender, EventArgs e)
|
||||
{
|
||||
tbSPY.Text = "N/A";
|
||||
}
|
||||
|
||||
private void button9_Click(object sender, EventArgs e)
|
||||
{
|
||||
tbPN.Text = "N/A";
|
||||
}
|
||||
|
||||
private void tbBarcodeInput_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
{
|
||||
var buf = tbBarcodeInput.Text.Trim().Split(';');
|
||||
if (buf.Length != 7)
|
||||
{
|
||||
UTIL.MsgE("바코드 데이터가 7개가 아닙니다");
|
||||
tbBarcodeInput.SelectAll();
|
||||
return;
|
||||
}
|
||||
if (int.TryParse(buf[3], out var code) == false)
|
||||
{
|
||||
UTIL.MsgE("4번데이터(수량)가 숫자가 아닙니다\nAmkor STD 바코드만 허용 됩니다");
|
||||
return;
|
||||
}
|
||||
tbSID.Text = buf[0];
|
||||
tbVLot.Text = buf[1];
|
||||
tbSPY.Text = buf[2];
|
||||
tbQty.Text = buf[3];
|
||||
tbRID.Text = buf[4];
|
||||
tbDate.Text = buf[5];
|
||||
tbPN.Text = buf[6];
|
||||
tbBarcodeInput.SelectAll();
|
||||
tbBarcodeInput.Focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user