| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- using System;
- using System.Data;
- using System.Drawing;
- using System.Drawing.Printing;
- using System.Text.RegularExpressions;
- using System.Windows.Forms;
- using UAS_MES.DataOperate;
- using UAS_MES.Entity;
- namespace UAS_MES.Query
- {
- public partial class Query_RadiumSN : Form
- {
- int serialnum = 0;
- //客户的流水号
- int custserialnum = 0;
- DataHelper dh = SystemInf.dh;
- //前缀条件
- //生成条码的流水号
- DataTable Dbfind;
- public Query_RadiumSN()
- {
- InitializeComponent();
- }
- private void PrintTest_Click(object sender, EventArgs e)
- {
- }
- private void Print_PrintPage(object sender, PrintPageEventArgs e)
- {
- Graphics g = e.Graphics;
- float leftMargin = 10f; //左边距
- SolidBrush myBrush = new SolidBrush(Color.Black);//刷子
- float yPosition = 5f;//行定位
- Font printFont = new Font("微软雅黑", 20f, FontStyle.Bold);//设置字体
- yPosition += printFont.GetHeight(g);//另起一行
- g.DrawString("成功连接此打印机", printFont, myBrush, leftMargin, yPosition, new StringFormat());
- }
- private void Setting_Click(object sender, EventArgs e)
- {
- }
- private void Export_Click(object sender, EventArgs e)
- {
- }
- private static string lpad(int length, string number)
- {
- while (number.Length < length)
- {
- number = "0" + number;
- }
- number = number.Substring(number.Length - length, length);
- return number;
- }
- private void SystemSetting_PrinterTest_Load(object sender, EventArgs e)
- {
- }
- private void Export_Click_1(object sender, EventArgs e)
- {
- string sql = "select mssncode SN,pr_detail 产品名称,pr_spec 产品规格,case when cm_fsoncode like '%072002%' then 'LCD-'||" +
- "cm_barcode when cm_fsoncode like '%070301%' then 'TP-'||cm_barcode when PR_SPEC like '%MID%' and " +
- "pr_detail='[半成品]-主板' then 'TM-'||cm_barcode when PR_SPEC like '%TC%' and pr_detail='[半成品]-主板' then " +
- "'CM-'||cm_barcode else cm_barcode end 物料条码,cm_indate 生产日期,ms_salecode 销售订单 from ( select " +
- "mssncode ,cm_barcode ,cm_firstsn Firstsn, cmsncode,cm_fsoncode ,ms_salecode ,to_char(cm_indate,'dd/mm/yyyy') " +
- "cm_indate,pr_detail ,pr_spec from CRAFTMATERIAL left join (select ms_sncode mssncode,cm_barcode cmbarcode," +
- "cm_sncode cmsncode,pr_detail,pr_spec from craftmaterial left join product on pr_code=cm_fsoncode left join " +
- "makeserial on ms_code=cm_sncode where pr_detail='[自制]-液晶屏组件' and cm_status=0) on cmbarcode=cm_sncode left join " +
- "makeserial on ms_code=cm_sncode where cm_status=0 and mssncode in (select v_barcode from mes_package_view where v_outboxcode " +
- "BETWEEN '"+box1.Text + "' and '"+box2.Text + "') union select ms_sncode,cm_barcode,cm_firstsn,cm_sncode cmsncode,cm_fsoncode,ms_salecode cmmakecode,to_char(cm_indate,'dd/mm/yyyy') " +
- " cmindate,pr_detail,pr_spec from craftmaterial left join product on pr_code=cm_fsoncode left join makeserial on ms_code=cm_sncode " +
- " where cm_status=0 and ms_sncode in (select v_barcode from mes_package_view where v_outboxcode BETWEEN '"+box1.Text + "' and '"+box2.Text + "'))";
- DataTable dt = (DataTable)dh.ExecuteSql(sql, "select");
- ExcelHandler ex = new ExcelHandler();
- ExportFileDialog.ShowDialog();
- ExportFileDialog.Description = "选择导出的路径";
- ex.ExportExcel(dt, ExportFileDialog.SelectedPath);
- }
- }
- }
|