|
|
@@ -1,4 +1,5 @@
|
|
|
-using Seagull.BarTender.Print;
|
|
|
+using LabelManager2;
|
|
|
+using Seagull.BarTender.Print;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Data;
|
|
|
@@ -11,14 +12,17 @@ namespace UAS_BARCODEIO
|
|
|
public partial class 入库条码规则解析 : Form
|
|
|
{
|
|
|
|
|
|
+ ApplicationClass lbl;
|
|
|
+
|
|
|
DataHelper dh = new DataHelper();
|
|
|
|
|
|
+ Document SingleDoc;
|
|
|
+
|
|
|
DataTable Dbfind;
|
|
|
|
|
|
//自适应屏幕
|
|
|
AutoSizeFormClass asc = new AutoSizeFormClass();
|
|
|
|
|
|
- Engine engine;
|
|
|
|
|
|
public 入库条码规则解析()
|
|
|
{
|
|
|
@@ -43,11 +47,10 @@ namespace UAS_BARCODEIO
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- static LabelFormatDocument format;
|
|
|
|
|
|
private void Form1_Load(object sender, EventArgs e)
|
|
|
{
|
|
|
- es_custcode.TableName = "CS_EXPORTSETTING ";
|
|
|
+ es_custcode.TableName = "CS_EXPORTSETTING ";
|
|
|
es_custcode.SelectField = "es_custcode # 品牌";
|
|
|
es_custcode.FormName = Name;
|
|
|
es_custcode.DBTitle = "解析规则查询";
|
|
|
@@ -57,7 +60,7 @@ namespace UAS_BARCODEIO
|
|
|
SystemInf.dh = dh;
|
|
|
try
|
|
|
{
|
|
|
- engine = new Engine(true);
|
|
|
+ lbl = new ApplicationClass();
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
@@ -65,7 +68,7 @@ namespace UAS_BARCODEIO
|
|
|
throw;
|
|
|
}
|
|
|
|
|
|
- format = engine.Documents.Open(Application.StartupPath + @"\BARCODE.btw");
|
|
|
+ SingleDoc = lbl.Documents.Open(System.Windows.Forms.Application.StartupPath + @"\BARCODE.lab");
|
|
|
asc.controllInitializeSize(this);
|
|
|
asc.controlAutoSize(this);
|
|
|
|
|
|
@@ -96,10 +99,10 @@ namespace UAS_BARCODEIO
|
|
|
|
|
|
private void LoadGridData()
|
|
|
{
|
|
|
- string sql = "select pd_inqty,pd_prodcode,pr_detail,pr_spec,bi_inqty from " +
|
|
|
- "(select pd_prodcode,sum(pd_inqty)pd_inqty from prodiodetail where pd_inoutno='" + pi_inoutno.Text + "' group by pd_prodcode)" +
|
|
|
- " left join (select bi_prodcode,nvl(sum(bi_inqty),0)bi_inqty from barcodeio " +
|
|
|
- "where bi_inoutno='" + pi_inoutno.Text + "' group by bi_prodcode) on pd_prodcode=bi_prodcode left join product on pr_code=pd_prodcode order by pr_code";
|
|
|
+ string sql = "select pd_inqty,pd_prodcode,pr_detail,pr_orispeccode,pr_spec,bi_inqty,pr_brand from " +
|
|
|
+ "(select max(pd_prodcode)pd_prodcode,sum(pd_inqty)pd_inqty from prodiodetail left join product on pd_prodcode=pr_code where pd_inoutno='" + pi_inoutno.Text + "' group by pr_orispeccode)" +
|
|
|
+ " left join (select max(bi_prodcode)bi_prodcode,nvl(sum(bi_inqty),0)bi_inqty from barcodeio left join product on pr_code=bi_prodcode" +
|
|
|
+ "where bi_inoutno='" + pi_inoutno.Text + "' group by pr_orispeccode) on pd_prodcode=bi_prodcode left join product on pr_code=pd_prodcode order by pr_code";
|
|
|
DataTable dt = (DataTable)dh.ExecuteSql(sql, "select");
|
|
|
BaseUtil.FillDgvWithDataTable(Prodiodetail, dt);
|
|
|
}
|
|
|
@@ -145,6 +148,11 @@ namespace UAS_BARCODEIO
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
+ string madedate;
|
|
|
+ string outqty;
|
|
|
+ LogicHandler.GetWeekData(DC.Text, INQTY.Text, es_custcode.Text.ToUpper(), out madedate, out outqty);
|
|
|
+ DC.Text = madedate;
|
|
|
+ INQTY.Text = outqty;
|
|
|
}
|
|
|
}
|
|
|
bool AutoSized = false;
|
|
|
@@ -194,9 +202,9 @@ namespace UAS_BARCODEIO
|
|
|
private void GenBarCode_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
string sql = "select pr_zxbzs,pd_piid,pd_piclass,pd_inqty,pd_prodcode,pr_detail,pr_spec,nvl(bi_inqty,0)bi_inqty from " +
|
|
|
- "(select max(pd_piid)pd_piid,max(pd_piclass)pd_piclass,pd_prodcode,sum(pd_inqty)pd_inqty from prodiodetail where pd_inoutno='" + pi_inoutno.Text + "' group by pd_prodcode)" +
|
|
|
- " left join (select bi_prodcode,nvl(sum(bi_inqty),0)bi_inqty from barcodeio " +
|
|
|
- "where bi_inoutno='" + pi_inoutno.Text + "' group by bi_prodcode) on pd_prodcode=bi_prodcode left join product on pr_code=pd_prodcode " +
|
|
|
+ "(select max(pd_piid)pd_piid,max(pd_piclass)pd_piclass,max(pd_prodcode)pd_prodcode,sum(pd_inqty)pd_inqty from prodiodetail left join product on pr_code=pd_prodcode where pd_inoutno='" + pi_inoutno.Text + "' group by pr_orispeccode)" +
|
|
|
+ " left join (select max(bi_prodcode)bi_prodcode,nvl(sum(bi_inqty),0)bi_inqty from barcodeio left join product on pr_code=bi_prodcode " +
|
|
|
+ "where bi_inoutno='" + pi_inoutno.Text + "' group by pr_orispeccode) on pd_prodcode=bi_prodcode left join product on pr_code=pd_prodcode " +
|
|
|
"where pd_prodcode='" + PR_CODE.Text + "'";
|
|
|
DataTable dt = (DataTable)dh.ExecuteSql(sql, "select");
|
|
|
if (dt.Rows.Count == 0)
|
|
|
@@ -228,7 +236,6 @@ namespace UAS_BARCODEIO
|
|
|
List<string> bi_barcode = new List<string>();
|
|
|
List<string> bi_vendbarcode = new List<string>();
|
|
|
List<string> bi_madedate = new List<string>();
|
|
|
- string datecode = dh.getFieldDataByCondition("dual", "WEEK_TO_DATE('" + DC.Text + "')", "1=1").ToString();
|
|
|
for (int i = 0; i < barcount; i++)
|
|
|
{
|
|
|
string barcode = "";
|
|
|
@@ -256,7 +263,7 @@ namespace UAS_BARCODEIO
|
|
|
bi_inqty.Add(OneUnit.ToString());
|
|
|
bi_barcode.Add(barcode);
|
|
|
bi_vendbarcode.Add(LOTNO.Text);
|
|
|
- bi_madedate.Add(datecode);
|
|
|
+ bi_madedate.Add(DC.Text);
|
|
|
}
|
|
|
sql = "insert into barcodeio(BI_ID, BI_BARCODE, BI_PIID, BI_PICLASS, BI_INOUTNO, BI_PDNO, BI_PDID, BI_PRODCODE, BI_INQTY,bi_vendbarcode, " +
|
|
|
"BI_MADEDATE, BI_PRODID, BI_STATUS, BI_ORDERCODE, BI_INMAN, BI_INDATE)select barcodeio_seq.nextval,:bi_barcode,'" + pi_id + "'," +
|
|
|
@@ -269,7 +276,7 @@ namespace UAS_BARCODEIO
|
|
|
|
|
|
private void LoadBarcodeioData(string pr_code)
|
|
|
{
|
|
|
- string sql = "select 0 CheckBox,bi_barcode,bi_inqty,bi_datecode,bi_vendbarcode,to_char(bi_madedate,'yyyy-mm-dd')bi_madedate,pr_detail,pr_spec,bi_prodcode from barcodeio left join product on bi_prodcode=pr_code where bi_inoutno='" + pi_inoutno.Text + "' and bi_prodcode='" + pr_code + "'";
|
|
|
+ string sql = "select 0 CheckBox,bi_barcode,bi_inqty,bi_datecode,bi_vendbarcode,to_char(bi_madedate,'yyyy-mm-dd')bi_madedate,pr_detail,pr_spec,bi_prodcode,pr_orispeccode from barcodeio left join product on bi_prodcode=pr_code where bi_inoutno='" + pi_inoutno.Text + "' and bi_prodcode='" + pr_code + "'";
|
|
|
DataTable dt = (DataTable)dh.ExecuteSql(sql, "select");
|
|
|
BaseUtil.FillDgvWithDataTable(BarcodeIO, dt);
|
|
|
}
|
|
|
@@ -280,47 +287,51 @@ namespace UAS_BARCODEIO
|
|
|
{
|
|
|
if (BarcodeIO.Rows[i].Cells["CheckBox"].FormattedValue != null && BarcodeIO.Rows[i].Cells["CheckBox"].FormattedValue.ToString() == "True")
|
|
|
{
|
|
|
- for (int j = 0; j < format.SubStrings.Count; j++)
|
|
|
+ for (int j = 0; j < SingleDoc.Variables.FreeVariables.Count; j++)
|
|
|
{
|
|
|
- if (format.SubStrings[j].Name == "BARCODE")
|
|
|
+ if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "BARCODE")
|
|
|
+ {
|
|
|
+ if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
|
|
|
+ SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bi_barcode"].Value.ToString();
|
|
|
+ }
|
|
|
+ if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "DC")
|
|
|
{
|
|
|
if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
|
|
|
- format.SubStrings[j].Value = BarcodeIO.Rows[i].Cells["bi_barcode"].Value.ToString();
|
|
|
+ SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bi_madedate"].Value.ToString();
|
|
|
}
|
|
|
- if (format.SubStrings[j].Name == "DC")
|
|
|
+ if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "LOTNO")
|
|
|
{
|
|
|
if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
|
|
|
- format.SubStrings[j].Value = BarcodeIO.Rows[i].Cells["bi_madedate"].Value.ToString();
|
|
|
+ SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bi_vendbarcode"].Value.ToString();
|
|
|
}
|
|
|
- if (format.SubStrings[j].Name == "LOTNO")
|
|
|
+ if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "QTY")
|
|
|
{
|
|
|
if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
|
|
|
- format.SubStrings[j].Value = BarcodeIO.Rows[i].Cells["bi_vendbarcode"].Value.ToString();
|
|
|
+ SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bi_inqty1"].Value.ToString();
|
|
|
}
|
|
|
- if (format.SubStrings[j].Name == "QTY")
|
|
|
+ if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "PRCODE")
|
|
|
{
|
|
|
if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
|
|
|
- format.SubStrings[j].Value = BarcodeIO.Rows[i].Cells["bi_inqty1"].Value.ToString();
|
|
|
+ SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bi_prodcode"].Value.ToString();
|
|
|
}
|
|
|
- if (format.SubStrings[j].Name == "PRCODE")
|
|
|
+ if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "PRSPEC")
|
|
|
{
|
|
|
if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
|
|
|
- format.SubStrings[j].Value = BarcodeIO.Rows[i].Cells["bi_prodcode"].Value.ToString();
|
|
|
+ SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["pr_spec1"].Value.ToString();
|
|
|
}
|
|
|
- if (format.SubStrings[j].Name == "PRSPEC")
|
|
|
+ if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "PRDETAIL")
|
|
|
{
|
|
|
if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
|
|
|
- format.SubStrings[j].Value = BarcodeIO.Rows[i].Cells["pr_spec1"].Value.ToString();
|
|
|
+ SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["pr_detail1"].Value.ToString();
|
|
|
}
|
|
|
- if (format.SubStrings[j].Name == "PRDETAIL")
|
|
|
+ if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "ORISPEC")
|
|
|
{
|
|
|
if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
|
|
|
- format.SubStrings[j].Value = BarcodeIO.Rows[i].Cells["pr_detail1"].Value.ToString();
|
|
|
+ SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["pr_orispeccode"].Value.ToString();
|
|
|
}
|
|
|
}
|
|
|
- format.PrintSetup.PrinterName = PrinterList.Text;
|
|
|
- format.PrintSetup.IdenticalCopiesOfLabel = 1;
|
|
|
- format.Print();
|
|
|
+ SingleDoc.Printer.SwitchTo(PrinterList.Text);
|
|
|
+ SingleDoc.PrintDocument();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -329,7 +340,7 @@ namespace UAS_BARCODEIO
|
|
|
{
|
|
|
if (Prodiodetail.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString() != "")
|
|
|
{
|
|
|
- LoadBarcodeioData(Prodiodetail.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString());
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -338,6 +349,9 @@ namespace UAS_BARCODEIO
|
|
|
if (Prodiodetail.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString() != "")
|
|
|
{
|
|
|
LoadBarcodeioData(Prodiodetail.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString());
|
|
|
+ Console.WriteLine(Prodiodetail.Rows[e.RowIndex].Cells["pr_brand"].Value.ToString());
|
|
|
+ es_custcode.Text = Prodiodetail.Rows[e.RowIndex].Cells["pr_brand"].Value.ToString();
|
|
|
+ LoadBarcodeioData(Prodiodetail.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString());
|
|
|
}
|
|
|
}
|
|
|
|