|
@@ -73,43 +73,166 @@ namespace UAS_MES_NEW.SystemSetting
|
|
|
return;
|
|
|
}
|
|
|
}*/
|
|
|
- for (int i = int.Parse(Rn.Text); i < (int.Parse(Num.Text) + int.Parse(Rn.Text)); i = i + 3)
|
|
|
+ if (OneColumn.Checked)
|
|
|
{
|
|
|
- int temp = i;
|
|
|
- for (int j = 0; j < format.SubStrings.Count; j++)
|
|
|
+ format = engine.Documents.Open(Application.StartupPath + "/单排.btw");
|
|
|
+ for (int i = int.Parse(Rn.Text); i < (int.Parse(Num.Text) + int.Parse(Rn.Text)); i = i + 1)
|
|
|
{
|
|
|
- switch (format.SubStrings[j].Name)
|
|
|
+ int temp = i;
|
|
|
+ for (int j = 0; j < format.SubStrings.Count; j++)
|
|
|
{
|
|
|
- case "SN":
|
|
|
- format.SubStrings[j].Value = (ma_code.Text + Date.Value.ToString("yyyyMMdd") + lpad(int.Parse(numericUpDown1.Value.ToString()), (temp).ToString()));
|
|
|
- if (!dh.CheckExist("makesnlist", "msl_sncode='" + format.SubStrings[j].Value + "' and msl_makecode='" + ma_code.Text + "'"))
|
|
|
- dh.ExecuteSql("insert into makesnlist(msl_id,msl_indate,msl_makecode,msl_sncode,msl_type,msl_printstatus)values(makesnlist_seq.nextval,sysdate,'" + ma_code.Text + "','" + format.SubStrings[j].Value + "','before',-1)", "insert");
|
|
|
- break;
|
|
|
- case "SN2":
|
|
|
- format.SubStrings[j].Value = (ma_code.Text + Date.Value.ToString("yyyyMMdd") + lpad(int.Parse(numericUpDown1.Value.ToString()), (temp + 1).ToString()));
|
|
|
- if (!dh.CheckExist("makesnlist", "msl_sncode='" + format.SubStrings[j].Value + "' and msl_makecode='" + ma_code.Text + "'"))
|
|
|
- dh.ExecuteSql("insert into makesnlist(msl_id,msl_indate,msl_makecode,msl_sncode,msl_type,msl_printstatus)values(makesnlist_seq.nextval,sysdate,'" + ma_code.Text + "','" + format.SubStrings[j].Value + "','before',-1)", "insert");
|
|
|
- break;
|
|
|
- case "SN3":
|
|
|
- format.SubStrings[j].Value = (ma_code.Text + Date.Value.ToString("yyyyMMdd") + lpad(int.Parse(numericUpDown1.Value.ToString()), (temp + 2).ToString()));
|
|
|
- if (!dh.CheckExist("makesnlist", "msl_sncode='" + format.SubStrings[j].Value + "' and msl_makecode='" + ma_code.Text + "'"))
|
|
|
- dh.ExecuteSql("insert into makesnlist(msl_id,msl_indate,msl_makecode,msl_sncode,msl_type,msl_printstatus)values(makesnlist_seq.nextval,sysdate,'" + ma_code.Text + "','" + format.SubStrings[j].Value + "','before',-1)", "insert");
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
+ switch (format.SubStrings[j].Name)
|
|
|
+ {
|
|
|
+ case "SN":
|
|
|
+ format.SubStrings[j].Value = (ma_code.Text + Date.Value.ToString("yyyyMMdd") + lpad(int.Parse(numericUpDown1.Value.ToString()), (temp).ToString()));
|
|
|
+ if (!dh.CheckExist("makesnlist", "msl_sncode='" + format.SubStrings[j].Value + "' and msl_makecode='" + ma_code.Text + "'"))
|
|
|
+ dh.ExecuteSql("insert into makesnlist(msl_id,msl_indate,msl_makecode,msl_sncode,msl_type,msl_printstatus)values(makesnlist_seq.nextval,sysdate,'" + ma_code.Text + "','" + format.SubStrings[j].Value + "','before',-1)", "insert");
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ format.PrintSetup.PrinterName = PrinterList.Text;
|
|
|
+ format.PrintSetup.IdenticalCopiesOfLabel = 1;
|
|
|
+ format.Print();
|
|
|
+
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql("select ma_qty,ma_prodcode,pr_detail,ma_printnum from make left join product on ma_prodcode=pr_code left join (select count(1)ma_printnum,msl_makecode from makesnlist where msl_printstatus=-1 group by msl_makecode) on msl_makecode=ma_code where ma_code='" + ma_code.Text + "'", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ pr_code.Text = dt.Rows[0]["ma_prodcode"].ToString();
|
|
|
+ ma_qty.Text = dt.Rows[0]["ma_qty"].ToString();
|
|
|
+ ma_printcount.Text = dt.Rows[0]["ma_printnum"].ToString();
|
|
|
+ pr_detail.Text = dt.Rows[0]["pr_detail"].ToString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (TwoColumn.Checked)
|
|
|
+ {
|
|
|
+ format = engine.Documents.Open(Application.StartupPath + "/双排.btw");
|
|
|
+ for (int i = int.Parse(Rn.Text); i < (int.Parse(Num.Text) + int.Parse(Rn.Text)); i = i + 2)
|
|
|
+ {
|
|
|
+ int temp = i;
|
|
|
+ for (int j = 0; j < format.SubStrings.Count; j++)
|
|
|
+ {
|
|
|
+ switch (format.SubStrings[j].Name)
|
|
|
+ {
|
|
|
+ case "SN":
|
|
|
+ format.SubStrings[j].Value = (ma_code.Text + Date.Value.ToString("yyyyMMdd") + lpad(int.Parse(numericUpDown1.Value.ToString()), (temp).ToString()));
|
|
|
+ if (!dh.CheckExist("makesnlist", "msl_sncode='" + format.SubStrings[j].Value + "' and msl_makecode='" + ma_code.Text + "'"))
|
|
|
+ dh.ExecuteSql("insert into makesnlist(msl_id,msl_indate,msl_makecode,msl_sncode,msl_type,msl_printstatus)values(makesnlist_seq.nextval,sysdate,'" + ma_code.Text + "','" + format.SubStrings[j].Value + "','before',-1)", "insert");
|
|
|
+ break;
|
|
|
+ case "SN2":
|
|
|
+ format.SubStrings[j].Value = (ma_code.Text + Date.Value.ToString("yyyyMMdd") + lpad(int.Parse(numericUpDown1.Value.ToString()), (temp + 1).ToString()));
|
|
|
+ if (!dh.CheckExist("makesnlist", "msl_sncode='" + format.SubStrings[j].Value + "' and msl_makecode='" + ma_code.Text + "'"))
|
|
|
+ dh.ExecuteSql("insert into makesnlist(msl_id,msl_indate,msl_makecode,msl_sncode,msl_type,msl_printstatus)values(makesnlist_seq.nextval,sysdate,'" + ma_code.Text + "','" + format.SubStrings[j].Value + "','before',-1)", "insert");
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ format.PrintSetup.PrinterName = PrinterList.Text;
|
|
|
+ format.PrintSetup.IdenticalCopiesOfLabel = 1;
|
|
|
+ format.Print();
|
|
|
+
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql("select ma_qty,ma_prodcode,pr_detail,ma_printnum from make left join product on ma_prodcode=pr_code left join (select count(1)ma_printnum,msl_makecode from makesnlist where msl_printstatus=-1 group by msl_makecode) on msl_makecode=ma_code where ma_code='" + ma_code.Text + "'", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ pr_code.Text = dt.Rows[0]["ma_prodcode"].ToString();
|
|
|
+ ma_qty.Text = dt.Rows[0]["ma_qty"].ToString();
|
|
|
+ ma_printcount.Text = dt.Rows[0]["ma_printnum"].ToString();
|
|
|
+ pr_detail.Text = dt.Rows[0]["pr_detail"].ToString();
|
|
|
}
|
|
|
}
|
|
|
- format.PrintSetup.PrinterName = PrinterList.Text;
|
|
|
- format.PrintSetup.IdenticalCopiesOfLabel = 1;
|
|
|
- format.Print();
|
|
|
+ }
|
|
|
+ if (ThreeColumn.Checked)
|
|
|
+ {
|
|
|
+ format = engine.Documents.Open(Application.StartupPath + "/Label.btw");
|
|
|
+ for (int i = int.Parse(Rn.Text); i < (int.Parse(Num.Text) + int.Parse(Rn.Text)); i = i + 3)
|
|
|
+ {
|
|
|
+ int temp = i;
|
|
|
+ for (int j = 0; j < format.SubStrings.Count; j++)
|
|
|
+ {
|
|
|
+ switch (format.SubStrings[j].Name)
|
|
|
+ {
|
|
|
+ case "SN":
|
|
|
+ format.SubStrings[j].Value = (ma_code.Text + Date.Value.ToString("yyyyMMdd") + lpad(int.Parse(numericUpDown1.Value.ToString()), (temp).ToString()));
|
|
|
+ if (!dh.CheckExist("makesnlist", "msl_sncode='" + format.SubStrings[j].Value + "' and msl_makecode='" + ma_code.Text + "'"))
|
|
|
+ dh.ExecuteSql("insert into makesnlist(msl_id,msl_indate,msl_makecode,msl_sncode,msl_type,msl_printstatus)values(makesnlist_seq.nextval,sysdate,'" + ma_code.Text + "','" + format.SubStrings[j].Value + "','before',-1)", "insert");
|
|
|
+ break;
|
|
|
+ case "SN2":
|
|
|
+ format.SubStrings[j].Value = (ma_code.Text + Date.Value.ToString("yyyyMMdd") + lpad(int.Parse(numericUpDown1.Value.ToString()), (temp + 1).ToString()));
|
|
|
+ if (!dh.CheckExist("makesnlist", "msl_sncode='" + format.SubStrings[j].Value + "' and msl_makecode='" + ma_code.Text + "'"))
|
|
|
+ dh.ExecuteSql("insert into makesnlist(msl_id,msl_indate,msl_makecode,msl_sncode,msl_type,msl_printstatus)values(makesnlist_seq.nextval,sysdate,'" + ma_code.Text + "','" + format.SubStrings[j].Value + "','before',-1)", "insert");
|
|
|
+ break;
|
|
|
+ case "SN3":
|
|
|
+ format.SubStrings[j].Value = (ma_code.Text + Date.Value.ToString("yyyyMMdd") + lpad(int.Parse(numericUpDown1.Value.ToString()), (temp + 2).ToString()));
|
|
|
+ if (!dh.CheckExist("makesnlist", "msl_sncode='" + format.SubStrings[j].Value + "' and msl_makecode='" + ma_code.Text + "'"))
|
|
|
+ dh.ExecuteSql("insert into makesnlist(msl_id,msl_indate,msl_makecode,msl_sncode,msl_type,msl_printstatus)values(makesnlist_seq.nextval,sysdate,'" + ma_code.Text + "','" + format.SubStrings[j].Value + "','before',-1)", "insert");
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ format.PrintSetup.PrinterName = PrinterList.Text;
|
|
|
+ format.PrintSetup.IdenticalCopiesOfLabel = 1;
|
|
|
+ format.Print();
|
|
|
|
|
|
- DataTable dt = (DataTable)dh.ExecuteSql("select ma_qty,ma_prodcode,pr_detail,ma_printnum from make left join product on ma_prodcode=pr_code left join (select count(1)ma_printnum,msl_makecode from makesnlist where msl_printstatus=-1 group by msl_makecode) on msl_makecode=ma_code where ma_code='" + ma_code.Text + "'", "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql("select ma_qty,ma_prodcode,pr_detail,ma_printnum from make left join product on ma_prodcode=pr_code left join (select count(1)ma_printnum,msl_makecode from makesnlist where msl_printstatus=-1 group by msl_makecode) on msl_makecode=ma_code where ma_code='" + ma_code.Text + "'", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ pr_code.Text = dt.Rows[0]["ma_prodcode"].ToString();
|
|
|
+ ma_qty.Text = dt.Rows[0]["ma_qty"].ToString();
|
|
|
+ ma_printcount.Text = dt.Rows[0]["ma_printnum"].ToString();
|
|
|
+ pr_detail.Text = dt.Rows[0]["pr_detail"].ToString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (FourColumn.Checked)
|
|
|
+ {
|
|
|
+ format = engine.Documents.Open(Application.StartupPath + "/四排.btw");
|
|
|
+ for (int i = int.Parse(Rn.Text); i < (int.Parse(Num.Text) + int.Parse(Rn.Text)); i = i + 4)
|
|
|
{
|
|
|
- pr_code.Text = dt.Rows[0]["ma_prodcode"].ToString();
|
|
|
- ma_qty.Text = dt.Rows[0]["ma_qty"].ToString();
|
|
|
- ma_printcount.Text = dt.Rows[0]["ma_printnum"].ToString();
|
|
|
- pr_detail.Text = dt.Rows[0]["pr_detail"].ToString();
|
|
|
+ int temp = i;
|
|
|
+ for (int j = 0; j < format.SubStrings.Count; j++)
|
|
|
+ {
|
|
|
+ switch (format.SubStrings[j].Name)
|
|
|
+ {
|
|
|
+ case "SN":
|
|
|
+ format.SubStrings[j].Value = (ma_code.Text + Date.Value.ToString("yyyyMMdd") + lpad(int.Parse(numericUpDown1.Value.ToString()), (temp).ToString()));
|
|
|
+ if (!dh.CheckExist("makesnlist", "msl_sncode='" + format.SubStrings[j].Value + "' and msl_makecode='" + ma_code.Text + "'"))
|
|
|
+ dh.ExecuteSql("insert into makesnlist(msl_id,msl_indate,msl_makecode,msl_sncode,msl_type,msl_printstatus)values(makesnlist_seq.nextval,sysdate,'" + ma_code.Text + "','" + format.SubStrings[j].Value + "','before',-1)", "insert");
|
|
|
+ break;
|
|
|
+ case "SN2":
|
|
|
+ format.SubStrings[j].Value = (ma_code.Text + Date.Value.ToString("yyyyMMdd") + lpad(int.Parse(numericUpDown1.Value.ToString()), (temp + 1).ToString()));
|
|
|
+ if (!dh.CheckExist("makesnlist", "msl_sncode='" + format.SubStrings[j].Value + "' and msl_makecode='" + ma_code.Text + "'"))
|
|
|
+ dh.ExecuteSql("insert into makesnlist(msl_id,msl_indate,msl_makecode,msl_sncode,msl_type,msl_printstatus)values(makesnlist_seq.nextval,sysdate,'" + ma_code.Text + "','" + format.SubStrings[j].Value + "','before',-1)", "insert");
|
|
|
+ break;
|
|
|
+ case "SN3":
|
|
|
+ format.SubStrings[j].Value = (ma_code.Text + Date.Value.ToString("yyyyMMdd") + lpad(int.Parse(numericUpDown1.Value.ToString()), (temp + 2).ToString()));
|
|
|
+ if (!dh.CheckExist("makesnlist", "msl_sncode='" + format.SubStrings[j].Value + "' and msl_makecode='" + ma_code.Text + "'"))
|
|
|
+ dh.ExecuteSql("insert into makesnlist(msl_id,msl_indate,msl_makecode,msl_sncode,msl_type,msl_printstatus)values(makesnlist_seq.nextval,sysdate,'" + ma_code.Text + "','" + format.SubStrings[j].Value + "','before',-1)", "insert");
|
|
|
+ break;
|
|
|
+ case "SN4":
|
|
|
+ format.SubStrings[j].Value = (ma_code.Text + Date.Value.ToString("yyyyMMdd") + lpad(int.Parse(numericUpDown1.Value.ToString()), (temp + 3).ToString()));
|
|
|
+ if (!dh.CheckExist("makesnlist", "msl_sncode='" + format.SubStrings[j].Value + "' and msl_makecode='" + ma_code.Text + "'"))
|
|
|
+ dh.ExecuteSql("insert into makesnlist(msl_id,msl_indate,msl_makecode,msl_sncode,msl_type,msl_printstatus)values(makesnlist_seq.nextval,sysdate,'" + ma_code.Text + "','" + format.SubStrings[j].Value + "','before',-1)", "insert");
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ format.PrintSetup.PrinterName = PrinterList.Text;
|
|
|
+ format.PrintSetup.IdenticalCopiesOfLabel = 1;
|
|
|
+ format.Print();
|
|
|
+
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql("select ma_qty,ma_prodcode,pr_detail,ma_printnum from make left join product on ma_prodcode=pr_code left join (select count(1)ma_printnum,msl_makecode from makesnlist where msl_printstatus=-1 group by msl_makecode) on msl_makecode=ma_code where ma_code='" + ma_code.Text + "'", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ pr_code.Text = dt.Rows[0]["ma_prodcode"].ToString();
|
|
|
+ ma_qty.Text = dt.Rows[0]["ma_qty"].ToString();
|
|
|
+ ma_printcount.Text = dt.Rows[0]["ma_printnum"].ToString();
|
|
|
+ pr_detail.Text = dt.Rows[0]["pr_detail"].ToString();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -127,7 +250,7 @@ namespace UAS_MES_NEW.SystemSetting
|
|
|
private void SystemSetting_PrinterTest_Load(object sender, EventArgs e)
|
|
|
{
|
|
|
engine.Start();
|
|
|
- format = engine.Documents.Open(Application.StartupPath + "/Label.btw");
|
|
|
+
|
|
|
|
|
|
ma_code.TableName = " make left join product on ma_prodcode=pr_code";
|
|
|
ma_code.SelectField = "ma_code # 工单编号,pr_code # 产品编号,pr_spec # 型号";
|