| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941 |
- using Common;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using com.hnshituo.core.webapp.vo;
- namespace MeterPlugInLibrary
- {
- public class Print
- {
- //MeterWorkCarActualFirstService firstService = new MeterWorkCarActualFirstService();
- QRCode qr = new QRCode();
- /// <summary>
- /// 打印纸数量递减
- /// </summary>
- /// <param name="strPntID"></param>
- public void PrintNum(string strPntID)
- {//update jl_pointinfo t set t.remainpaper=t.remainpaper-1 where t.pointid='CAR04'
- try
- {
- MeterWorkMonitorService monitorService = new MeterWorkMonitorService();
- RESTfulResult<string> rm = monitorService.doUpdateWf(new MeterWorkMonitor { pointNo = strPntID, printNum = PbCache.monitor.printNum - 1 });
- if (!rm.Succeed)
- {
- string log = "打印纸数量递减错误!" + rm.ResultMessage;
- WriteLog(log);
- }
- }
- catch (Exception exp)
- {
- WriteLog("打印纸数量递减写入异常!" + exp.Message);
- }
- }
- /// <summary>
- /// 结净打印
- /// </summary>
- /// <param name="e"></param>
- /// <param name="_strCarNo"></param>
- public void PrintAllPage(System.Drawing.Printing.PrintPageEventArgs e, MeterWorkCarActual first, string strCode)
- {
- try
- {
- Image img = qr.rtImgQRCode(strCode);
- int oX = 0, oY = -2; //偏移量
- int[] xPos = { 0, 65, 140, 210, 280 };
- int[] yPos = { 0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300, 320, 340, 360, 380, 400, 420 };
- Font headFont = new Font("Arial", 10);
- Font txtFont = new Font("Arial", 9);
- Font txtFont1 = new Font("Arial", 8);//注的字体
- Font MemoFont = new Font("Arial", 12);
- Font txtFont2 = new Font("Arial", 7);
- Font txtFontWeight = new Font("Arial", 9);
- Pen blackPen = new Pen(Color.Black, 2);
- StringFormat drawFormat1 = new StringFormat();
- drawFormat1.Alignment = StringAlignment.Center;
- drawFormat1.LineAlignment = StringAlignment.Center;
- StringFormat drawFormat3 = new StringFormat();//注的字体
- drawFormat3.Alignment = StringAlignment.Near;
- drawFormat3.LineAlignment = StringAlignment.Near;
- StringFormat drawFormat5 = new StringFormat();//注的字体
- drawFormat5.Alignment = StringAlignment.Center;
- drawFormat5.LineAlignment = StringAlignment.Near;
- StringFormat drawFormat2 = new StringFormat();
- drawFormat2.Alignment = StringAlignment.Near;
- drawFormat2.LineAlignment = StringAlignment.Center;
- StringFormat drawFormat4 = new StringFormat();//
- drawFormat4.Alignment = StringAlignment.Far;
- drawFormat4.LineAlignment = StringAlignment.Far;
- //*
- Rectangle rec = new Rectangle(oX + xPos[0], oY + yPos[0], xPos[4] - xPos[0], yPos[1] - yPos[0]);
- e.Graphics.DrawString("九钢集团股份有限公司", headFont, Brushes.Black, rec, drawFormat1);
- rec = new Rectangle(oX + xPos[0], oY + yPos[1], xPos[4] - xPos[0], yPos[2] - yPos[1]);
- e.Graphics.DrawString("检斤小票", headFont, Brushes.Black, rec, drawFormat1);
- //e.Graphics.DrawString("凌字311-005", txtFont2, Brushes.Black, rec, drawFormat4);
- //*/
- //-----------------------------
- //-----------------------正文
- rec.X = xPos[0] + oX; //35
- rec.Y = yPos[2] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("流水号", txtFont2, Brushes.Black, rec, drawFormat1); //35
- rec.X = xPos[1] + oX;
- rec.Y = yPos[2] + oY;
- rec.Width = xPos[2] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.actualNo, txtFont2, Brushes.Black, rec, drawFormat1); //流水号值
- rec.X = xPos[0] + oX;
- rec.Y = yPos[3] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("预报编号", txtFont2, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[3] + oY;
- rec.Width = xPos[2] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.predictionNo, txtFont2, Brushes.Black, rec, drawFormat1); //预报编号值
- rec.X = xPos[0] + oX;
- rec.Y = yPos[4] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("车号", txtFont2, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[4] + oY;
- rec.Width = xPos[2] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.carNo, txtFont2, Brushes.Black, rec, drawFormat1); //车号
- rec.X = xPos[0] + oX;
- rec.Y = yPos[5] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("检斤类型", txtFont2, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[5] + oY;
- rec.Width = xPos[2] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.meterTypeName, txtFont2, Brushes.Black, rec, drawFormat1); //检斤类型值
- rec.X = xPos[0] + oX;
- rec.Y = yPos[6] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("毛重(t)", txtFont2, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[6] + oY;
- rec.Width = xPos[2] - xPos[1];
- rec.Height = 20;
- //e.Graphics.DrawString((first.grossWeight.Value / 1000) + "", txtFont2, Brushes.Black, rec, drawFormat1); //车号
- switch (first.meterTypeNo)
- {
- case "0":
- e.Graphics.DrawString((first.grossWeight.Value / 1000) + "", txtFontWeight, Brushes.Black, rec, drawFormat1);
- break;
- case "x":
- e.Graphics.DrawString((first.grossWeight.Value / 1000) + "", txtFontWeight, Brushes.Black, rec, drawFormat1);
- break;
- default:
- e.Graphics.DrawString("", txtFontWeight, Brushes.Black, rec, drawFormat1);
- break;
- }
- rec.X = xPos[0] + oX;
- rec.Y = yPos[7] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("皮重(t)", txtFont2, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[7] + oY;
- rec.Width = xPos[2] - xPos[1];
- rec.Height = 20;
- switch (first.meterTypeNo)
- {
- case "0":
- e.Graphics.DrawString("", txtFontWeight, Brushes.Black, rec, drawFormat1);
- break;
- case "x":
- e.Graphics.DrawString((first.tareWeight.Value / 1000) + "", txtFontWeight, Brushes.Black, rec, drawFormat1);
- break;
- default:
- e.Graphics.DrawString((first.grossWeight.Value / 1000) + "", txtFontWeight, Brushes.Black, rec, drawFormat1);
- break;
- }
- rec.X = xPos[0] + oX;
- rec.Y = yPos[8] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("净重(t)", txtFont2, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[8] + oY;
- rec.Width = xPos[2] - xPos[1];
- rec.Height = 20;
- switch (first.meterTypeNo)
- {
- case "x":
- e.Graphics.DrawString((first.netWeight.Value / 1000) + "", txtFontWeight, Brushes.Black, rec, drawFormat1);
- break;
- default:
- e.Graphics.DrawString("", txtFontWeight, Brushes.Black, rec, drawFormat1);
- break;
- }
- #region 二维码部分
- /*
- rec.X = xPos[2] + oX + 2;
- rec.Y = yPos[2] + oY + 2;
- rec.Width = xPos[4] - xPos[2] - 4;
- rec.Height = 136; //140-4
- //*/
- e.Graphics.DrawImage(img, xPos[2] + oX + 5, yPos[2] + oY + 5, xPos[4] - xPos[2] - 10, 128);
- #endregion
- rec.X = xPos[0] + oX;
- rec.Y = yPos[9] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("附加重量(t)", txtFont2, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[9] + oY;
- rec.Width = xPos[2] - xPos[1];
- rec.Height = 20;
- if (first.addWeight == null)
- {
- e.Graphics.DrawString("", txtFont2, Brushes.Black, rec, drawFormat1); //附加重量
- }
- else if (first.meterTypeNo == "x" || first.meterTypeNo == "0") //结净或者过毛
- {
- e.Graphics.DrawString((first.addWeight.Value / 1000) + "", txtFontWeight, Brushes.Black, rec, drawFormat1); //附加重量
- }
- rec.X = xPos[0] + oX;
- rec.Y = yPos[10] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("物资名称", txtFont2, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[10] + oY;
- rec.Width = xPos[4] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.matterName, txtFont2, Brushes.Black, rec, drawFormat1); //物资名称
- rec.X = xPos[0] + oX;
- rec.Y = yPos[11] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("来源", txtFont2, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[11] + oY;
- rec.Width = xPos[4] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.forwardingUnitName, txtFont2, Brushes.Black, rec, drawFormat1); //来源值
- rec.X = xPos[0] + oX;
- rec.Y = yPos[12] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("去向", txtFont2, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[12] + oY;
- rec.Width = xPos[4] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.receivingUintName, txtFont2, Brushes.Black, rec, drawFormat1); //去向值
- rec.X = xPos[0] + oX;
- rec.Y = yPos[13] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("计量时间", txtFont2, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[13] + oY;
- rec.Width = xPos[4] - xPos[1];
- rec.Height = 20;
- //first.meterTypeNo == "0" ? "毛重" : "皮重";
- switch (first.meterTypeNo)
- {
- case "0":
- e.Graphics.DrawString(first.grossTime.Value.ToString("yyyy/MM/dd HH:mm"), txtFont2, Brushes.Black, rec, drawFormat1);
- break;
- case "x":
- e.Graphics.DrawString(first.netTime.Value.ToString("yyyy/MM/dd HH:mm"), txtFont2, Brushes.Black, rec, drawFormat1);
- break;
- default:
- e.Graphics.DrawString(first.tareTime.Value.ToString("yyyy/MM/dd HH:mm"), txtFont2, Brushes.Black, rec, drawFormat1);
- break;
- }
- rec.X = xPos[0] + oX;
- rec.Y = yPos[14] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("规格", txtFont2, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[14] + oY;
- rec.Width = xPos[4] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.specName, txtFont2, Brushes.Black, rec, drawFormat1);
- //*/
- rec.X = xPos[0] + oX;
- rec.Y = yPos[15] + oY;
- rec.Width = xPos[4] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("注:本小票不作为结算凭证,请注意保管!", txtFont2, Brushes.Black, rec, drawFormat3); //注意
- rec.X = xPos[0] + oX;
- rec.Y = yPos[16] + oY;
- rec.Width = xPos[4] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("打票时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), txtFont2, Brushes.Black, rec, drawFormat3);//注意//Now.ToString("yyyy-MM-dd HH:mm:ss")
- //打印横线
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[2] + oY, xPos[4] + oX, yPos[2] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[3] + oY, xPos[2] + oX, yPos[3] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[4] + oY, xPos[2] + oX, yPos[4] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[5] + oY, xPos[2] + oX, yPos[5] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[6] + oY, xPos[2] + oX, yPos[6] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[7] + oY, xPos[2] + oX, yPos[7] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[8] + oY, xPos[2] + oX, yPos[8] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[9] + oY, xPos[4] + oX, yPos[9] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[10] + oY, xPos[4] + oX, yPos[10] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[11] + oY, xPos[4] + oX, yPos[11] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[12] + oY, xPos[4] + oX, yPos[12] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[13] + oY, xPos[4] + oX, yPos[13] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[14] + oY, xPos[4] + oX, yPos[14] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[15] + oY, xPos[4] + oX, yPos[15] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[16] + oY, xPos[4] + oX, yPos[16] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[17] + oY, xPos[4] + oX, yPos[17] + oY);
- //打印竖线
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[2] + oY, xPos[0] + oX, yPos[17] + oY);
- e.Graphics.DrawLine(blackPen, xPos[1] + oX, yPos[2] + oY, xPos[1] + oX, yPos[15] + oY);
- e.Graphics.DrawLine(blackPen, xPos[2] + oX, yPos[2] + oY, xPos[2] + oX, yPos[9] + oY);
- e.Graphics.DrawLine(blackPen, xPos[4] + oX, yPos[2] + oY, xPos[4] + oX, yPos[17] + oY);
- PrintNum(PbCache.sportInfo.baseSpotNo);
- WriteLog("完成打印!" + PbCache.sportInfo.baseSpotNo);
- }
- catch (Exception exp)
- {
- WriteLog("计量打印异常!" + exp.Message);
- }
- }
- /// <summary>
- /// 结净打印
- /// </summary>
- /// <param name="e"></param>
- /// <param name="_strCarNo"></param>
- public void PrintPage(System.Drawing.Printing.PrintPageEventArgs e, MeterWorkCarActual first, string strCode)
- {
- try
- {
- Image img = qr.rtImgQRCode(strCode);
- int oX = 0, oY = -2; //偏移量
- int[] xPos = { 0, 65, 125, 205, 265 };
- int[] yPos = { 0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300, 320, 420, 440, 420, 440, 460 };
- //int[] xPos = { 0, 65, 110, 170, 220 };
- //int[] yPos = { 0, 20, 40, 60, 80, 100, 120, 160, 180, 220, 240, 260, 280, 300, 320, 350, 390, 410, 430, 450, 470, 490 };
- Font headFont = new Font("Arial", 10);
- Font txtFont = new Font("Arial", 9);
- Font txtFont1 = new Font("Arial", 8);//注的字体
- Font MemoFont = new Font("Arial", 12);
- Font txtFont2 = new Font("Arial", 7);
- Pen blackPen = new Pen(Color.Black, 2);
- StringFormat drawFormat1 = new StringFormat();
- drawFormat1.Alignment = StringAlignment.Center;
- drawFormat1.LineAlignment = StringAlignment.Center;
- StringFormat drawFormat3 = new StringFormat();//注的字体
- drawFormat3.Alignment = StringAlignment.Near;
- drawFormat3.LineAlignment = StringAlignment.Near;
- StringFormat drawFormat5 = new StringFormat();//注的字体
- drawFormat5.Alignment = StringAlignment.Center;
- drawFormat5.LineAlignment = StringAlignment.Near;
- StringFormat drawFormat2 = new StringFormat();
- drawFormat2.Alignment = StringAlignment.Near;
- drawFormat2.LineAlignment = StringAlignment.Center;
- StringFormat drawFormat4 = new StringFormat();//
- drawFormat4.Alignment = StringAlignment.Far;
- drawFormat4.LineAlignment = StringAlignment.Far;
- //-----------------------标题
- /*
- Rectangle rec = new Rectangle(oX + xPos[1], oY + yPos[0], xPos[4] - xPos[1], yPos[1] - yPos[0]);
- e.Graphics.DrawString("九钢集团有限责任公司", headFont, Brushes.Black, rec, drawFormat1);
- rec = new Rectangle(oX + xPos[1], oY + yPos[1], xPos[4] - xPos[1], yPos[2] - yPos[1]);
- e.Graphics.DrawString("检斤小票", headFont, Brushes.Black, rec, drawFormat1);
- e.Graphics.DrawImage(img, oX + xPos[0], oY + yPos[0], xPos[1] - xPos[0], 40);
- //*/
- //*
- Rectangle rec = new Rectangle(oX + xPos[0], oY + yPos[0], xPos[4] - xPos[0], yPos[1] - yPos[0]);
- e.Graphics.DrawString("九钢集团股份有限公司", headFont, Brushes.Black, rec, drawFormat1);
- rec = new Rectangle(oX + xPos[0], oY + yPos[1], xPos[4] - xPos[0], yPos[2] - yPos[1]);
- e.Graphics.DrawString("检斤小票", headFont, Brushes.Black, rec, drawFormat1);
- //e.Graphics.DrawString("凌字311-005", txtFont2, Brushes.Black, rec, drawFormat4);
- //*/
- //-----------------------------
- //-----------------------正文
- rec.X = xPos[0] + oX; //35
- rec.Y = yPos[2] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("流水号", txtFont, Brushes.Black, rec, drawFormat1); //35
- rec.X = xPos[1] + oX;
- rec.Y = yPos[2] + oY;
- rec.Width = xPos[4] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.actualNo, txtFont, Brushes.Black, rec, drawFormat1); //流水号值
- rec.X = xPos[0] + oX;
- rec.Y = yPos[3] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("预报编号", txtFont, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[3] + oY;
- rec.Width = xPos[4] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.predictionNo, txtFont, Brushes.Black, rec, drawFormat1); //预报编号值
-
- rec.X = xPos[0] + oX;
- rec.Y = yPos[4] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("车号", txtFont, Brushes.Black, rec, drawFormat1);
-
- rec.X = xPos[1] + oX;
- rec.Y = yPos[4] + oY;
- rec.Width = xPos[4] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.carNo, txtFont, Brushes.Black, rec, drawFormat1); //车号
-
- rec.X = xPos[0] + oX;
- rec.Y = yPos[5] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("物资名称", txtFont, Brushes.Black, rec, drawFormat1);
-
- rec.X = xPos[1] + oX;
- rec.Y = yPos[5] + oY;
- rec.Width = xPos[4] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.matterName, txtFont, Brushes.Black, rec, drawFormat1); //物资名称
-
- rec.X = xPos[0] + oX;
- rec.Y = yPos[6] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("检斤类型", txtFont, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[6] + oY;
- rec.Width = xPos[4] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.meterTypeName, txtFont, Brushes.Black, rec, drawFormat1); //检斤类型值
- rec.X = xPos[0] + oX;
- rec.Y = yPos[7] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("来源", txtFont, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[7] + oY;
- rec.Width = xPos[4] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.forwardingUnitName, txtFont2, Brushes.Black, rec, drawFormat1); //来源值
- rec.X = xPos[0] + oX;
- rec.Y = yPos[8] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("去向", txtFont, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[8] + oY;
- rec.Width = xPos[4] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.receivingUintName, txtFont2, Brushes.Black, rec, drawFormat1); //去向值
- rec.X = xPos[0] + oX;
- rec.Y = yPos[9] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("毛重时间", txtFont, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[9] + oY;
- rec.Width = xPos[4] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.grossTime.Value.ToString("yyyy/MM/dd HH:mm"), txtFont, Brushes.Black, rec, drawFormat1); //一次计量时间值
- rec.X = xPos[0] + oX;
- rec.Y = yPos[10] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("皮重时间", txtFont, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[10] + oY;
- rec.Width = xPos[4] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.tareTime.Value.ToString("yyyy/MM/dd HH:mm"), txtFont, Brushes.Black, rec, drawFormat1); //二次计量时间值
- rec.X = xPos[0] + oX;
- rec.Y = yPos[11] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("毛重(t)", txtFont, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[11] + oY;
- rec.Width = xPos[2] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString((first.grossWeight.Value / 1000) + "", txtFont, Brushes.Black, rec, drawFormat1); //毛重值
- rec.X = xPos[2] + oX;
- rec.Y = yPos[11] + oY;
- rec.Width = xPos[3] - xPos[2];
- rec.Height = 20;
- e.Graphics.DrawString("附加重量", txtFont, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[3] + oX;
- rec.Y = yPos[11] + oY;
- rec.Width = xPos[4] - xPos[3];
- rec.Height = 20;
- e.Graphics.DrawString(((first.grossWeight.Value - first.tareWeight.Value - first.netWeight.Value) / 1000) + "", txtFont, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[0] + oX;
- rec.Y = yPos[12] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("皮重(t)", txtFont, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[12] + oY;
- rec.Width = xPos[2] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString((first.tareWeight.Value / 1000) + "", txtFont, Brushes.Black, rec, drawFormat1); //皮重值
- rec.X = xPos[2] + oX;
- rec.Y = yPos[12] + oY;
- rec.Width = xPos[3] - xPos[2];
- rec.Height = 20;
- e.Graphics.DrawString("净重(t)", txtFont, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[3] + oX;
- rec.Y = yPos[12] + oY;
- rec.Width = xPos[4] - xPos[3];
- rec.Height = 20;
- e.Graphics.DrawString((first.netWeight.Value / 1000) + "", txtFont, Brushes.Black, rec, drawFormat1); //净重值
- rec.X = xPos[0] + oX;
- rec.Y = yPos[13] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("规格", txtFont, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[13] + oY;
- rec.Width = xPos[4] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.specName, txtFont, Brushes.Black, rec, drawFormat1);
- //*/
- rec.X = xPos[0] + oX;
- rec.Y = yPos[14] + oY;
- rec.Width = xPos[4] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("注:本小票不作为结算凭证,请注意保管!", txtFont1, Brushes.Black, rec, drawFormat3); //注意
- rec.X = xPos[0] + oX;
- rec.Y = yPos[15] + oY;
- rec.Width = xPos[4] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("打票时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), txtFont1, Brushes.Black, rec, drawFormat3);//注意//Now.ToString("yyyy-MM-dd HH:mm:ss")
-
- e.Graphics.DrawImage(img, 180, 2 + yPos[16], xPos[1] - xPos[0], 40);
- //打印横线
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[2] + oY, xPos[4] + oX, yPos[2] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[3] + oY, xPos[4] + oX, yPos[3] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[4] + oY, xPos[4] + oX, yPos[4] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[5] + oY, xPos[4] + oX, yPos[5] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[6] + oY, xPos[4] + oX, yPos[6] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[7] + oY, xPos[4] + oX, yPos[7] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[8] + oY, xPos[4] + oX, yPos[8] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[9] + oY, xPos[4] + oX, yPos[9] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[10] + oY, xPos[4] + oX, yPos[10] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[11] + oY, xPos[4] + oX, yPos[11] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[12] + oY, xPos[4] + oX, yPos[12] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[13] + oY, xPos[4] + oX, yPos[13] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[14] + oY, xPos[4] + oX, yPos[14] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[15] + oY, xPos[4] + oX, yPos[15] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[16] + oY, xPos[4] + oX, yPos[16] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[17] + oY, xPos[4] + oX, yPos[17] + oY);
- //打印竖线
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[2] + oY, xPos[0] + oX, yPos[17] + oY);
- e.Graphics.DrawLine(blackPen, xPos[1] + oX, yPos[2] + oY, xPos[1] + oX, yPos[14] + oY);
- e.Graphics.DrawLine(blackPen, xPos[2] + oX, yPos[11] + oY, xPos[2] + oX, yPos[13] + oY);
- e.Graphics.DrawLine(blackPen, xPos[3] + oX, yPos[11] + oY, xPos[3] + oX, yPos[13] + oY);
- e.Graphics.DrawLine(blackPen, xPos[4] + oX, yPos[2] + oY, xPos[4] + oX, yPos[17] + oY);
- PrintNum(PbCache.sportInfo.baseSpotNo);
- }
- catch (Exception exp)
- {
- WriteLog("结净计量打印异常!" + exp.Message);
- }
- }
- /// <summary>
- /// 过磅打印
- /// </summary>
- /// <param name="e"></param>
- /// <param name="_strCarNo"></param>
- public void PrintWgtPage(System.Drawing.Printing.PrintPageEventArgs e, MeterWorkCarActual first, string strCode)
- {
- try
- {
- Image img = qr.rtImgQRCode(strCode);
- int oX = 0, oY = -2; //偏移量
- int[] xPos = { 0, 65, 125, 205, 265 };
- int[] yPos = { 0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300, 360, 380, 400, 420, 440, 460 };
- //int[] xPos = { 0, 65, 110, 170, 220 };
- //int[] yPos = { 0, 20, 40, 60, 80, 100, 120, 160, 180, 220, 240, 260, 280, 300, 320, 350, 390, 410, 430, 450, 470, 490 };
- Font headFont = new Font("Arial", 10);
- Font txtFont = new Font("Arial", 9);
- Font txtFont1 = new Font("Arial", 8);//注的字体
- Font MemoFont = new Font("Arial", 12);
- Font txtFont2 = new Font("Arial", 7);
- Pen blackPen = new Pen(Color.Black, 2);
- StringFormat drawFormat1 = new StringFormat();
- drawFormat1.Alignment = StringAlignment.Center;
- drawFormat1.LineAlignment = StringAlignment.Center;
- StringFormat drawFormat3 = new StringFormat();//注的字体
- drawFormat3.Alignment = StringAlignment.Near;
- drawFormat3.LineAlignment = StringAlignment.Near;
- StringFormat drawFormat5 = new StringFormat();//注的字体
- drawFormat5.Alignment = StringAlignment.Center;
- drawFormat5.LineAlignment = StringAlignment.Near;
- StringFormat drawFormat2 = new StringFormat();
- drawFormat2.Alignment = StringAlignment.Near;
- drawFormat2.LineAlignment = StringAlignment.Center;
- StringFormat drawFormat4 = new StringFormat();//
- drawFormat4.Alignment = StringAlignment.Far;
- drawFormat4.LineAlignment = StringAlignment.Far;
- //-----------------------标题
- Rectangle rec = new Rectangle(oX + xPos[1], oY + yPos[0], xPos[4] - xPos[1], yPos[1] - yPos[0]);
- e.Graphics.DrawString("九钢集团股份有限公司", headFont, Brushes.Black, rec, drawFormat1);
- rec = new Rectangle(oX + xPos[1], oY + yPos[1], xPos[4] - xPos[1], yPos[2] - yPos[1]);
- e.Graphics.DrawString("检斤小票", headFont, Brushes.Black, rec, drawFormat1);
- e.Graphics.DrawImage(img, oX + xPos[0], oY + yPos[0], xPos[1] - xPos[0], 40);
- /*
- Rectangle rec = new Rectangle(oX + xPos[0], oY + yPos[0], xPos[4] - xPos[0], yPos[1] - yPos[0]);
- e.Graphics.DrawString("九钢集团股份有限公司", headFont, Brushes.Black, rec, drawFormat1);
- rec = new Rectangle(oX + xPos[0], oY + yPos[1], xPos[4] - xPos[0], yPos[2] - yPos[1]);
- e.Graphics.DrawString("检斤小票", headFont, Brushes.Black, rec, drawFormat1);
- //e.Graphics.DrawString("凌字311-005", txtFont2, Brushes.Black, rec, drawFormat4);
- //*/
- //-----------------------------
- //-----------------------正文
- rec.X = xPos[0] + oX; //35
- rec.Y = yPos[2] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("流水号", txtFont, Brushes.Black, rec, drawFormat1); //35
- rec.X = xPos[1] + oX;
- rec.Y = yPos[2] + oY;
- rec.Width = xPos[4] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.actualNo, txtFont, Brushes.Black, rec, drawFormat1); //流水号值
- rec.X = xPos[0] + oX;
- rec.Y = yPos[3] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("预报编号", txtFont, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[3] + oY;
- rec.Width = xPos[4] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.predictionNo, txtFont, Brushes.Black, rec, drawFormat1); //预报编号值
- rec.X = xPos[0] + oX;
- rec.Y = yPos[4] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("车号", txtFont, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[4] + oY;
- rec.Width = xPos[4] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.carNo, txtFont, Brushes.Black, rec, drawFormat1); //车号
- rec.X = xPos[0] + oX;
- rec.Y = yPos[5] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("物资名称", txtFont, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[5] + oY;
- rec.Width = xPos[4] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.matterName, txtFont, Brushes.Black, rec, drawFormat1); //物资名称
- rec.X = xPos[0] + oX;
- rec.Y = yPos[6] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("检斤类型", txtFont, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[6] + oY;
- rec.Width = xPos[4] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.meterTypeName, txtFont, Brushes.Black, rec, drawFormat1); //检斤类型值
- rec.X = xPos[0] + oX;
- rec.Y = yPos[7] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("来源", txtFont, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[7] + oY;
- rec.Width = xPos[4] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.forwardingUnitName, txtFont2, Brushes.Black, rec, drawFormat1); //来源值
- rec.X = xPos[0] + oX;
- rec.Y = yPos[8] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("去向", txtFont, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[8] + oY;
- rec.Width = xPos[4] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.receivingUintName, txtFont2, Brushes.Black, rec, drawFormat1); //去向值
- rec.X = xPos[0] + oX;
- rec.Y = yPos[9] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("计量类型", txtFont, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[9] + oY;
- rec.Width = xPos[4] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.meterTypeNo == "0" ? "毛重" : "皮重", txtFont, Brushes.Black, rec, drawFormat1); //计量类型
- rec.X = xPos[0] + oX;
- rec.Y = yPos[10] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("计量时间", txtFont, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[10] + oY;
- rec.Width = xPos[4] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.grossTime.Value.ToString("yyyy/MM/dd HH:mm"), txtFont, Brushes.Black, rec, drawFormat1); //计量时间
- rec.X = xPos[0] + oX;
- rec.Y = yPos[11] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("重量(t)", txtFont, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[11] + oY;
- rec.Width = xPos[2] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString((first.grossWeight.Value / 1000) + "", txtFont, Brushes.Black, rec, drawFormat1); //毛重值
- rec.X = xPos[2] + oX;
- rec.Y = yPos[11] + oY;
- rec.Width = xPos[3] - xPos[2];
- rec.Height = 20;
- e.Graphics.DrawString("附加重量", txtFont, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[3] + oX;
- rec.Y = yPos[11] + oY;
- rec.Width = xPos[4] - xPos[3];
- rec.Height = 20;
- e.Graphics.DrawString(((string.IsNullOrEmpty(first.valueFlag)?0:Convert.ToInt32(first.valueFlag)) / 1000) + "", txtFont, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[0] + oX;
- rec.Y = yPos[12] + oY;
- rec.Width = xPos[1] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("规格", txtFont, Brushes.Black, rec, drawFormat1);
- rec.X = xPos[1] + oX;
- rec.Y = yPos[12] + oY;
- rec.Width = xPos[4] - xPos[1];
- rec.Height = 20;
- e.Graphics.DrawString(first.specName, txtFont, Brushes.Black, rec, drawFormat1);
- //*/
- rec.X = xPos[0] + oX;
- rec.Y = yPos[13] + oY;
- rec.Width = xPos[4] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("注:本小票不作为结算凭证,请注意保管!", txtFont1, Brushes.Black, rec, drawFormat3); //注意
- rec.X = xPos[0] + oX;
- rec.Y = yPos[14] + oY;
- rec.Width = xPos[4] - xPos[0];
- rec.Height = 20;
- e.Graphics.DrawString("打票时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), txtFont1, Brushes.Black, rec, drawFormat3);//注意//Now.ToString("yyyy-MM-dd HH:mm:ss")
- e.Graphics.DrawImage(img, 180, 2 + yPos[15], xPos[1] - xPos[0], 40);
- //打印横线
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[2] + oY, xPos[4] + oX, yPos[2] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[3] + oY, xPos[4] + oX, yPos[3] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[4] + oY, xPos[4] + oX, yPos[4] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[5] + oY, xPos[4] + oX, yPos[5] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[6] + oY, xPos[4] + oX, yPos[6] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[7] + oY, xPos[4] + oX, yPos[7] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[8] + oY, xPos[4] + oX, yPos[8] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[9] + oY, xPos[4] + oX, yPos[9] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[10] + oY, xPos[4] + oX, yPos[10] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[11] + oY, xPos[4] + oX, yPos[11] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[12] + oY, xPos[4] + oX, yPos[12] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[13] + oY, xPos[4] + oX, yPos[13] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[14] + oY, xPos[4] + oX, yPos[14] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[15] + oY, xPos[4] + oX, yPos[15] + oY);
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[16] + oY, xPos[4] + oX, yPos[16] + oY);
- //打印竖线
- e.Graphics.DrawLine(blackPen, xPos[0] + oX, yPos[2] + oY, xPos[0] + oX, yPos[16] + oY);
- e.Graphics.DrawLine(blackPen, xPos[1] + oX, yPos[2] + oY, xPos[1] + oX, yPos[12] + oY);
- e.Graphics.DrawLine(blackPen, xPos[2] + oX, yPos[11] + oY, xPos[2] + oX, yPos[12] + oY);
- e.Graphics.DrawLine(blackPen, xPos[3] + oX, yPos[11] + oY, xPos[3] + oX, yPos[12] + oY);
- e.Graphics.DrawLine(blackPen, xPos[4] + oX, yPos[2] + oY, xPos[4] + oX, yPos[16] + oY);
- PrintNum(PbCache.sportInfo.baseSpotNo);
- }
- catch (Exception exp)
- {
- WriteLog("一次计量打印异常!" + exp.Message);
- }
- }
- private void WriteLog(string str)
- {
- string m_szRunPath;
- m_szRunPath = System.Environment.CurrentDirectory;
- if (System.IO.Directory.Exists(m_szRunPath + "\\log") == false)
- {
- System.IO.Directory.CreateDirectory(m_szRunPath + "\\log");
- }
- string strDate = System.DateTime.Now.ToString("yyyyMMdd");
- string strPathFile = m_szRunPath + "\\log\\" + strDate;
- if (!Directory.Exists(strPathFile))//如果不存在就创建file文件夹
- {
- Directory.CreateDirectory(strPathFile);
- }
- System.IO.TextWriter tw = new System.IO.StreamWriter(strPathFile + "\\打印_" + strDate + ".log", true);
- tw.WriteLine(System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
- tw.WriteLine(str);
- tw.WriteLine("\r\n");
- tw.Close();
- }
- }
- }
|