|
@@ -54,13 +54,13 @@ namespace UAS_BARCODEIO
|
|
|
|
|
|
private void Form1_Load(object sender, EventArgs e)
|
|
|
{
|
|
|
- PR_CODE.TableName = "product ";
|
|
|
- PR_CODE.SelectField = "pr_code # 物料编号 ,pr_orispeccode3 # 原厂型号 ,pr_brand # 品牌,pr_zxbz # 最小包装";
|
|
|
- PR_CODE.FormName = Name;
|
|
|
- PR_CODE.DBTitle = "解析规则查询";
|
|
|
- PR_CODE.SetValueField = new string[] { "pr_brand", "pr_zxbz" };
|
|
|
- PR_CODE.Condition = "";
|
|
|
- PR_CODE.DbChange += nr_rule_DBChange;
|
|
|
+ pr_code.TableName = "product";
|
|
|
+ pr_code.SelectField = "pr_code # 物料编号 ,pr_orispeccode # 原厂型号 ,pr_brand # 品牌,pr_zxbzs # 最小包装";
|
|
|
+ pr_code.FormName = Name;
|
|
|
+ pr_code.DBTitle = "物料资料查询";
|
|
|
+ pr_code.SetValueField = new string[] { "pr_code", "pr_orispeccode", "pr_brand", "pr_zxbzs" };
|
|
|
+ pr_code.Condition = "";
|
|
|
+ pr_code.DbChange += nr_rule_DBChange;
|
|
|
|
|
|
SystemInf.dh = dh;
|
|
|
try
|
|
@@ -74,7 +74,7 @@ namespace UAS_BARCODEIO
|
|
|
}
|
|
|
|
|
|
SingleDoc = lbl.Documents.Open(System.Windows.Forms.Application.StartupPath + @"\BARCODE.lab");
|
|
|
- OutDoc = lbl.Documents.Open(System.Windows.Forms.Application.StartupPath + @"\BOXCODE.lab");
|
|
|
+ OutDoc = lbl.Documents.Open(System.Windows.Forms.Application.StartupPath + @"\BOXCODESTOCK.lab");
|
|
|
asc.controllInitializeSize(this);
|
|
|
asc.controlAutoSize(this);
|
|
|
|
|
@@ -91,7 +91,7 @@ namespace UAS_BARCODEIO
|
|
|
|
|
|
private void nr_rule_DBChange(object sender, EventArgs e)
|
|
|
{
|
|
|
- Dbfind = PR_CODE.ReturnData;
|
|
|
+ Dbfind = pr_code.ReturnData;
|
|
|
BaseUtil.SetFormValue(this.Controls, Dbfind);
|
|
|
}
|
|
|
|
|
@@ -146,9 +146,13 @@ namespace UAS_BARCODEIO
|
|
|
}
|
|
|
string madedate;
|
|
|
string outqty;
|
|
|
- LogicHandler.GetWeekData(DC.Text, INQTY.Text, pr_brand.Text.ToUpper(), out madedate, out outqty);
|
|
|
+ string lotno;
|
|
|
+ string spec;
|
|
|
+ LogicHandler.GetWeekData(DC.Text, INQTY.Text, pr_brand.Text.ToUpper(), pr_orispeccode3.Text, LOTNO.Text, out madedate, out outqty, out lotno, out spec);
|
|
|
DC.Text = madedate;
|
|
|
INQTY.Text = outqty;
|
|
|
+ LOTNO.Text = lotno;
|
|
|
+ pr_orispeccode3.Text = spec;
|
|
|
}
|
|
|
}
|
|
|
bool AutoSized = false;
|
|
@@ -160,10 +164,10 @@ namespace UAS_BARCODEIO
|
|
|
AutoSized = true;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
private void GenBarCode_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
- if (pr_orispeccode2.Text != pr_orispeccode3.Text)
|
|
|
+ if (pr_orispeccode.Text != pr_orispeccode3.Text)
|
|
|
{
|
|
|
MessageBox.Show("解析型号和单据型号不对应");
|
|
|
return;
|
|
@@ -171,29 +175,29 @@ namespace UAS_BARCODEIO
|
|
|
int Minpackage = 0;
|
|
|
|
|
|
int NowInqty = int.Parse(INQTY.Text);
|
|
|
- if (!int.TryParse(pr_zxbz.Text, out Minpackage))
|
|
|
+ if (!int.TryParse(pr_zxbzs.Text, out Minpackage))
|
|
|
{
|
|
|
- MessageBox.Show("最小包装数错误,料号" + PR_CODE.Text);
|
|
|
+ MessageBox.Show("最小包装数错误,料号" + pr_code.Text);
|
|
|
return;
|
|
|
}
|
|
|
string outboxcode = "";
|
|
|
if (GenBoxCode.Checked)
|
|
|
{
|
|
|
- string[] param = new string[] { PR_CODE.Text, "", outboxcode };
|
|
|
+ string[] param = new string[] { pr_code.Text, "", outboxcode };
|
|
|
dh.CallProcedure("SP_GETBOX", ref param);
|
|
|
outboxcode = param[2].Replace("BOX:", "");
|
|
|
}
|
|
|
|
|
|
int barcount = NowInqty % Minpackage == 0 ? NowInqty / Minpackage : (NowInqty / Minpackage) + 1;
|
|
|
- List<string> bi_inqty = new List<string>();
|
|
|
- List<string> bi_barcode = new List<string>();
|
|
|
- List<string> bi_vendbarcode = new List<string>();
|
|
|
- List<string> bi_madedate = new List<string>();
|
|
|
+ List<string> BAR_inqty = new List<string>();
|
|
|
+ List<string> bar_code = new List<string>();
|
|
|
+ List<string> bar_vendbarcode = new List<string>();
|
|
|
+ List<string> bar_madedate = new List<string>();
|
|
|
for (int i = 0; i < barcount; i++)
|
|
|
{
|
|
|
string barcode = "";
|
|
|
int OneUnit = 0;
|
|
|
- string[] param = new string[] { PR_CODE.Text, "", barcode };
|
|
|
+ string[] param = new string[] { pr_code.Text, "", barcode };
|
|
|
dh.CallProcedure("SP_GETBARCODE", ref param);
|
|
|
barcode = param[2].Replace("BARCODE:", "");
|
|
|
|
|
@@ -213,24 +217,24 @@ namespace UAS_BARCODEIO
|
|
|
{
|
|
|
OneUnit = Minpackage;
|
|
|
}
|
|
|
- bi_inqty.Add(OneUnit.ToString());
|
|
|
- bi_barcode.Add(barcode);
|
|
|
- bi_vendbarcode.Add(LOTNO.Text);
|
|
|
- bi_madedate.Add(DC.Text);
|
|
|
+ BAR_inqty.Add(OneUnit.ToString());
|
|
|
+ bar_code.Add(barcode);
|
|
|
+ bar_vendbarcode.Add(LOTNO.Text);
|
|
|
+ bar_madedate.Add(DC.Text);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- LoadBarcodeioData(PR_CODE.Text);
|
|
|
+ string sql = "insert into barcode(BAR_ID, bar_code, bar_prodcode, BAR_remain,bar_vendbarcode, " +
|
|
|
+ "bar_madedate, BAR_PRODID, BAR_STATUS, BAR_CHECKMAN, BAR_INDATE,BAR_OUTBOXCODE1)select barcode_seq.nextval,:bar_code," +
|
|
|
+ "'" + pr_code.Text + "',:bar_remain,:bar_vendbarcode,to_date(:bar_madedate,'yyyy-mm-dd'),pr_id,1,'管理员',sysdate,'" + outboxcode + "' " +
|
|
|
+ " from product where pr_code='" + pr_code.Text + "'";
|
|
|
+ dh.BatchInsert(sql, new string[] { "bar_code", "bar_remain", "bar_vendbarcode", "bar_madedate" }, bar_code.ToArray(), BAR_inqty.ToArray(), bar_vendbarcode.ToArray(), bar_madedate.ToArray());
|
|
|
+ LoadBarcodeioData(pr_code.Text);
|
|
|
}
|
|
|
|
|
|
private void LoadBarcodeioData(string pr_code)
|
|
|
{
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ string sql = "select 0 CheckBox,bar_code,bar_remain,bar_indate,BAR_OUTBOXCODE1,bar_vendbarcode,to_char(bar_madedate,'yyyy-mm-dd')bar_madedate,pr_detail,pr_spec,bar_prodcode,pr_orispeccode from barcode left join product on bar_prodcode=pr_code where to_char(bar_indate,'yyyy-mm-dd')='" + bar_indate.Value.ToString("yyyy-MM-dd") + "' and bar_prodcode='" + pr_code + "'";
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql(sql, "select");
|
|
|
+ BaseUtil.FillDgvWithDataTable(BarcodeIO, dt);
|
|
|
}
|
|
|
|
|
|
private void PrintBarCode_Click(object sender, EventArgs e)
|
|
@@ -243,43 +247,43 @@ namespace UAS_BARCODEIO
|
|
|
{
|
|
|
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 (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
|
|
|
+ SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bar_code"].Value.ToString();
|
|
|
}
|
|
|
if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "DC")
|
|
|
{
|
|
|
- if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bi_madedate"].Value.ToString();
|
|
|
+ if (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
|
|
|
+ SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bar_madedate"].Value.ToString();
|
|
|
}
|
|
|
if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "LOTNO")
|
|
|
{
|
|
|
- if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bi_vendbarcode"].Value.ToString();
|
|
|
+ if (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
|
|
|
+ SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bar_vendbarcode"].Value.ToString();
|
|
|
}
|
|
|
if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "QTY")
|
|
|
{
|
|
|
- if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bi_inqty1"].Value.ToString();
|
|
|
+ if (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
|
|
|
+ SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bar_remain"].Value.ToString();
|
|
|
}
|
|
|
if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "PRCODE")
|
|
|
{
|
|
|
- if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bi_prodcode"].Value.ToString();
|
|
|
+ if (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
|
|
|
+ SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bar_prodcode"].Value.ToString();
|
|
|
}
|
|
|
if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "PRSPEC")
|
|
|
{
|
|
|
- if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
|
|
|
+ if (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
|
|
|
SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["pr_spec1"].Value.ToString();
|
|
|
}
|
|
|
if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "PRDETAIL")
|
|
|
{
|
|
|
- if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
|
|
|
+ if (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
|
|
|
SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["pr_detail1"].Value.ToString();
|
|
|
}
|
|
|
if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "ORISPEC")
|
|
|
{
|
|
|
- if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["pr_orispeccode"].Value.ToString();
|
|
|
+ if (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
|
|
|
+ SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["pr_orispeccode4"].Value.ToString();
|
|
|
}
|
|
|
}
|
|
|
SingleDoc.Printer.SwitchTo(PrinterList.Text);
|
|
@@ -303,58 +307,58 @@ namespace UAS_BARCODEIO
|
|
|
{
|
|
|
if (BarcodeIO.Rows[i].Cells["CheckBox"].FormattedValue != null && BarcodeIO.Rows[i].Cells["CheckBox"].FormattedValue.ToString() == "True")
|
|
|
{
|
|
|
- if (!outboxcode.Contains(BarcodeIO.Rows[i].Cells["bi_outboxcode"].FormattedValue))
|
|
|
+ if (!outboxcode.Contains(BarcodeIO.Rows[i].Cells["BAR_OUTBOXCODE1"].FormattedValue))
|
|
|
{
|
|
|
- outboxcode.Add(BarcodeIO.Rows[i].Cells["bi_outboxcode"].Value.ToString());
|
|
|
+ outboxcode.Add(BarcodeIO.Rows[i].Cells["BAR_OUTBOXCODE1"].Value.ToString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
string[] box = outboxcode.ToArray();
|
|
|
for (int i = 0; i < box.Length; i++)
|
|
|
{
|
|
|
- string sql = "select bi_outboxcode,sum(bi_inqty)bi_inqty,max(bi_datecode)bi_datecode,max(bi_vendbarcode)bi_vendbarcode,max(to_char(bi_madedate,'yyyy-mm-dd'))bi_madedate," +
|
|
|
- "max(pr_detail)pr_detail,max(pr_spec)pr_spec,max(bi_prodcode)bi_prodcode,max(pr_orispeccode)pr_orispeccode,max(pr_detail)pr_detail from barcodeio left join product on bi_prodcode=pr_code where bi_outboxcode='" + box[i] + "' group by bi_outboxcode";
|
|
|
+ string sql = "select BAR_OUTBOXCODE1,sum(BAR_remain)BAR_remain,max(bar_vendbarcode)bar_vendbarcode,max(to_char(bar_madedate,'yyyy-mm-dd'))bar_madedate," +
|
|
|
+ "max(pr_detail)pr_detail,max(pr_spec)pr_spec,max(bar_prodcode)bar_prodcode,max(pr_orispeccode)pr_orispeccode,max(pr_detail)pr_detail from barcode left join product on bar_prodcode=pr_code where BAR_OUTBOXCODE1='" + box[i] + "' group by BAR_OUTBOXCODE1";
|
|
|
DataTable dt = (DataTable)dh.ExecuteSql(sql, "select");
|
|
|
for (int j = 0; j < SingleDoc.Variables.FreeVariables.Count; j++)
|
|
|
{
|
|
|
if (OutDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "BARCODE")
|
|
|
{
|
|
|
- if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
|
|
|
- OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["bi_outboxcode"].ToString();
|
|
|
+ if (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
|
|
|
+ OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["BAR_OUTBOXCODE1"].ToString();
|
|
|
}
|
|
|
if (OutDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "DC")
|
|
|
{
|
|
|
- if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
|
|
|
- OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["bi_madedate"].ToString();
|
|
|
+ if (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
|
|
|
+ OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["bar_madedate"].ToString();
|
|
|
}
|
|
|
if (OutDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "LOTNO")
|
|
|
{
|
|
|
- if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
|
|
|
- OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["bi_vendbarcode"].ToString();
|
|
|
+ if (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
|
|
|
+ OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["bar_vendbarcode"].ToString();
|
|
|
}
|
|
|
if (OutDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "QTY")
|
|
|
{
|
|
|
- if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
|
|
|
- OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["bi_inqty"].ToString();
|
|
|
+ if (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
|
|
|
+ OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["BAR_remain"].ToString();
|
|
|
}
|
|
|
if (OutDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "PRCODE")
|
|
|
{
|
|
|
- if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
|
|
|
- OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["bi_prodcode"].ToString();
|
|
|
+ if (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
|
|
|
+ OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["bar_prodcode"].ToString();
|
|
|
}
|
|
|
if (OutDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "PRSPEC")
|
|
|
{
|
|
|
- if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
|
|
|
+ if (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
|
|
|
OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["pr_spec"].ToString();
|
|
|
}
|
|
|
if (OutDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "PRDETAIL")
|
|
|
{
|
|
|
- if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
|
|
|
+ if (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
|
|
|
OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["pr_detail"].ToString();
|
|
|
}
|
|
|
if (OutDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "ORISPEC")
|
|
|
{
|
|
|
- if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
|
|
|
+ if (BarcodeIO.Rows[i].Cells["bar_madedate"].Value != null)
|
|
|
OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["pr_orispeccode"].ToString();
|
|
|
}
|
|
|
}
|
|
@@ -362,5 +366,10 @@ namespace UAS_BARCODEIO
|
|
|
OutDoc.PrintDocument();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private void QueryBarcode_Click(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ LoadBarcodeioData(pr_code.Text);
|
|
|
+ }
|
|
|
}
|
|
|
}
|