Query_SOP.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. using System;
  2. using System.IO;
  3. using System.Text;
  4. using System.Windows.Forms;
  5. using System.Net;
  6. using System.Collections.Generic;
  7. using System.Threading;
  8. using System.Data;
  9. using System.Drawing.Imaging;
  10. using System.Drawing;
  11. using UAS_MES_NEW.Entity;
  12. using UAS_MES_NEW.PublicMethod;
  13. using Aspose.Cells;
  14. using UAS_MES_NEW.DataOperate;
  15. using UAS_MES_NEW.PublicForm;
  16. using Aspose.Cells.Drawing;
  17. using Aspose.Cells.Rendering;
  18. using System.Web.Script.Serialization;
  19. using Seagull.BarTender.Print;
  20. namespace UAS_MES_NEW.Query
  21. {
  22. public partial class Query_SOP : Form
  23. {
  24. DataHelper dh;
  25. string usercode;
  26. string sourcecode;
  27. DataTable Dbfind;
  28. public Query_SOP()
  29. {
  30. usercode = "";
  31. sourcecode = "";
  32. InitializeComponent();
  33. }
  34. private void Form3_Load(object sender, EventArgs e)
  35. {
  36. CheckForIllegalCrossThreadCalls = false;
  37. ps_prodcode.TableName = "productsop";
  38. ps_prodcode.SelectField = "ps_code # 流水号,ps_prodcode # SOP编号";
  39. ps_prodcode.FormName = Name;
  40. ps_prodcode.DBTitle = "SOP查询";
  41. ps_prodcode.SetValueField = new string[] { "ps_code", "ps_prodcode" };
  42. ps_prodcode.Condition = "";
  43. ps_prodcode.DbChange += nr_rule_DBChange;
  44. dh = SystemInf.dh;
  45. }
  46. private void nr_rule_DBChange(object sender, EventArgs e)
  47. {
  48. Dbfind = ps_prodcode.ReturnData;
  49. BaseUtil.SetFormValue(this.Controls, Dbfind);
  50. }
  51. void uploadfile()
  52. {
  53. if (FilePath.Text == "")
  54. {
  55. MessageBox.Show("文件不能为空!");
  56. return;
  57. }
  58. if (JPG.Checked)
  59. {
  60. ps_prodcode.Text = FilePath.Text.Substring(FilePath.Text.LastIndexOf(@"\") + 1).Replace(".xls", "").Replace(".xlsx", "");
  61. pr_code_Leave(new object(), new EventArgs());
  62. DataTable dt = (DataTable)dh.ExecuteSql("select * from productsop where ps_prodcode='" + ps_prodcode.Text + "' ", "select");
  63. if (dt.Rows.Count == 0)
  64. {
  65. string code = LogicHandler.GetPiInoutCode("ProductSOP", "1");
  66. ps_code.Text = code;
  67. if (VaildDate.Checked)
  68. {
  69. dh.ExecuteSql("insert into productsop(ps_id,ps_code,ps_prodcode,ps_indate,ps_inman,ps_status,ps_statuscode,ps_vailddate)values(productsop_seq.nextval,'" + code + "','" + ps_prodcode.Text + "',sysdate,'" + User.UserName + "','在录入','ENTERING',to_date('" + DateCode.Value.ToString("yyyy-MM-dd") + "','yyyy-mm-dd'))", "insert");
  70. }
  71. else
  72. {
  73. dh.ExecuteSql("insert into productsop(ps_id,ps_code,ps_prodcode,ps_indate,ps_inman,ps_status,ps_statuscode)values(productsop_seq.nextval,'" + code + "','" + ps_prodcode.Text + "',sysdate,'" + User.UserName + "','在录入','ENTERING')", "insert");
  74. }
  75. }
  76. else
  77. {
  78. string ps_id = dt.Rows[0]["ps_id"].ToString();
  79. dh.ExecuteSql("delete from ProductSOPdetail where psd_psid='" + ps_id + "'", "delete");
  80. ps_prodcode.Text = dt.Rows[0]["ps_prodcode"].ToString();
  81. }
  82. Workbook workbook = new Workbook(FilePath.Text);
  83. List<Worksheet> list = new List<Worksheet>();
  84. List<string> filename = new List<string>();
  85. if (VaildDate.Checked)
  86. {
  87. dh.ExecuteSql("update ProductSOP set ps_attachsop='',ps_inman='" + User.UserName + "',ps_vailddate=to_date('" + DateCode.Value.ToString("yyyy-MM-dd") + "','yyyy-mm-dd') where ps_prodcode='" + ps_prodcode.Text + "'", "update");
  88. }
  89. else
  90. {
  91. dh.ExecuteSql("update ProductSOP set ps_attachsop='',ps_inman='" + User.UserName + "' where ps_prodcode='" + ps_prodcode.Text + "'", "update");
  92. }
  93. OperatResult.AppendText("一共Sheet: " + workbook.Worksheets.Count + "\n");
  94. for (int i = 0; i < workbook.Worksheets.Count; i++)
  95. {
  96. OperatResult.AppendText("正在解析Sheet" + workbook.Worksheets[i].Name + "\n");
  97. string path = Application.StartupPath + @"\" + ps_prodcode.Text + @"\";
  98. Worksheet she = workbook.Worksheets[i];
  99. int lastColIndex = she.Cells.MaxDataColumn;
  100. string lastColLetter = CellsHelper.ColumnIndexToName(lastColIndex);
  101. she.PageSetup.LeftMargin = 0;
  102. she.PageSetup.RightMargin = 0;
  103. she.PageSetup.TopMargin = 0;
  104. she.PageSetup.BottomMargin = 0;
  105. if (JPG.Checked)
  106. {
  107. try
  108. {
  109. if (!Directory.Exists(Application.StartupPath + @"\" + ps_prodcode.Text))
  110. {
  111. Directory.CreateDirectory(Application.StartupPath + @"\" + ps_prodcode.Text);
  112. }
  113. string sheetname = she.Name;
  114. // 获取工作表中的所有图片
  115. List<Picture> pictures = new List<Picture>();
  116. foreach (Aspose.Cells.Drawing.Picture picture in she.Pictures)
  117. {
  118. pictures.Add(picture);
  119. }
  120. // 获取使用的行数
  121. int totalRows = she.Cells.MaxDataRow + 1;
  122. int imageIndex = 1;
  123. // 每40行生成一张图片
  124. for (int startRow = 0; startRow < totalRows; startRow += int.Parse(RowCount.Value.ToString()))
  125. {
  126. int endRow = Math.Min(startRow + int.Parse(RowCount.Value.ToString()) - 1, totalRows - 1);
  127. // 创建图片选项
  128. ImageOrPrintOptions options = new ImageOrPrintOptions();
  129. options.ImageFormat = ImageFormat.Png;
  130. options.OnePagePerSheet = false;
  131. options.PrintingPage = PrintingPageType.IgnoreBlank;
  132. she.PageSetup.PrintArea = $"A{startRow + 1}:{lastColLetter}{endRow + 1}";
  133. if (File.Exists(PrintPath.Text))
  134. {
  135. if (startRow == 0)
  136. {
  137. she.Pictures.Add(startRow + int.Parse(Y.Value.ToString()), int.Parse(X.Value.ToString()), PrintPath.Text);
  138. }
  139. else
  140. {
  141. she.Pictures.Add(startRow - 4 + int.Parse(Y.Value.ToString()), int.Parse(X.Value.ToString()), PrintPath.Text);
  142. }
  143. }
  144. // 创建SheetRender对象
  145. SheetRender sr = new SheetRender(she, options);
  146. string imagename = $"{she.Name}_{imageIndex}.png";
  147. // 获取渲染后的图像
  148. Bitmap bitmap = sr.ToImage(0);
  149. string imagePath = "";
  150. // 如果有图片在当前行范围内,将它们添加到最终图像中
  151. if (pictures.Count > 0)
  152. {
  153. using (Bitmap finalImage = new Bitmap(bitmap.Width, bitmap.Height))
  154. using (Graphics g = Graphics.FromImage(finalImage))
  155. {
  156. // 绘制Excel内容
  157. g.DrawImage(bitmap, 0, 0);
  158. // 绘制原始Excel中的图片
  159. int yOffset = bitmap.Height;
  160. // 保存图像
  161. imagePath = Path.Combine(path, $"{she.Name}_{imageIndex}.png");
  162. finalImage.Save(imagePath, ImageFormat.Png);
  163. Console.WriteLine($"Saved: {imagePath}");
  164. }
  165. }
  166. else
  167. {
  168. // 如果没有图片,直接保存渲染的图像
  169. imagePath = Path.Combine(path, $"{she.Name}_{imageIndex}.png");
  170. bitmap.Save(imagePath, ImageFormat.Png);
  171. Console.WriteLine($"Saved: {imagePath}");
  172. }
  173. imageIndex++;
  174. OperatResult.AppendText("解析图片【" + imagePath + ".jpg】" + "\n");
  175. Dictionary<string, object> dic = new Dictionary<string, object>();
  176. dic.Add("em_name", "管理员");
  177. dic.Add("em_code", "ADMIN");
  178. dic.Add("caller", "ProductSOP");
  179. OperatResult.AppendText("上传文件【" + imagePath + ".jpg" + "】\n");
  180. string fp_id = UploadFilesToRemoteUrl("https://mes.lihantech.cn/mes/MEScommon/uploadFiles.action?_noc=1", Application.StartupPath + @"\" + ps_prodcode.Text + @"\" + imagename, dic);
  181. string ps_id = dh.getFieldDataByCondition("ProductSOP", "ps_id", "ps_prodcode='" + ps_prodcode.Text + "'").ToString();
  182. dh.ExecuteSql("insert into ProductSOPdetail(psd_id,psd_psid,psd_attach) select ProductSOPdetail_seq.nextval,ps_id,'" + imagename + ";" + fp_id + "' from ProductSOP where ps_prodcode='" + ps_prodcode.Text + "'", "insert");
  183. }
  184. }
  185. catch (Exception ex)
  186. {
  187. OperatResult.AppendText(ex.Message + ex.StackTrace);
  188. }
  189. filename.Add(she.Name + ".jpg");
  190. }
  191. }
  192. }
  193. else if (PDF.Checked)
  194. {
  195. ps_prodcode.Text = FilePath.Text.Substring(FilePath.Text.LastIndexOf(@"\") + 1).Replace(".pdf","");
  196. pr_code_Leave(new object(), new EventArgs());
  197. DataTable dt = (DataTable)dh.ExecuteSql("select * from productsop where ps_prodcode='" + ps_prodcode.Text + "' ", "select");
  198. if (dt.Rows.Count == 0)
  199. {
  200. string code = LogicHandler.GetPiInoutCode("ProductSOP", "1");
  201. ps_code.Text = code;
  202. if (VaildDate.Checked)
  203. {
  204. dh.ExecuteSql("insert into productsop(ps_id,ps_code,ps_prodcode,ps_indate,ps_inman,ps_status,ps_statuscode,ps_vailddate)values(productsop_seq.nextval,'" + code + "','" + ps_prodcode.Text + "',sysdate,'" + User.UserName + "','在录入','ENTERING',to_date('" + DateCode.Value.ToString("yyyy-MM-dd") + "','yyyy-mm-dd'))", "insert");
  205. }
  206. else
  207. {
  208. dh.ExecuteSql("insert into productsop(ps_id,ps_code,ps_prodcode,ps_indate,ps_inman,ps_status,ps_statuscode)values(productsop_seq.nextval,'" + code + "','" + ps_prodcode.Text + "',sysdate,'" + User.UserName + "','在录入','ENTERING')", "insert");
  209. }
  210. }
  211. else
  212. {
  213. string psid = dt.Rows[0]["ps_id"].ToString();
  214. dh.ExecuteSql("delete from ProductSOPdetail where psd_psid='" + psid + "'", "delete");
  215. ps_prodcode.Text = dt.Rows[0]["ps_prodcode"].ToString();
  216. }
  217. if (VaildDate.Checked)
  218. {
  219. dh.ExecuteSql("update ProductSOP set ps_attachsop='',ps_inman='" + User.UserName + "',ps_vailddate=to_date('" + DateCode.Value.ToString("yyyy-MM-dd") + "','yyyy-mm-dd') where ps_prodcode='" + ps_prodcode.Text + "'", "update");
  220. }
  221. else
  222. {
  223. dh.ExecuteSql("update ProductSOP set ps_attachsop='',ps_inman='" + User.UserName + "' where ps_prodcode='" + ps_prodcode.Text + "'", "update");
  224. }
  225. Dictionary<string, object> dic = new Dictionary<string, object>();
  226. dic.Add("em_name", "管理员");
  227. dic.Add("em_code", "ADMIN");
  228. dic.Add("caller", "ProductSOP");
  229. OperatResult.AppendText("上传文件【" + ps_prodcode.Text + "" + "】\n");
  230. string fp_id = UploadFilesToRemoteUrl("https://mes.lihantech.cn/mes/MEScommon/uploadFiles.action?_noc=1", FilePath.Text, dic);
  231. string ps_id = dh.getFieldDataByCondition("ProductSOP", "ps_id", "ps_prodcode='" + ps_prodcode.Text + "'").ToString();
  232. dh.ExecuteSql("insert into ProductSOPdetail(psd_id,psd_psid,psd_attach) select ProductSOPdetail_seq.nextval,ps_id,'" + ps_prodcode.Text + ";" + fp_id + "' from ProductSOP where ps_prodcode='" + ps_prodcode.Text + "'", "insert");
  233. }
  234. }
  235. /// <summary>
  236. /// 请求上传图片到阿里云
  237. /// </summary>
  238. /// <param name="url">上传地址</param>
  239. /// <param name="filepath">本地文件路径</param>
  240. /// <param name="dic">上传的数据信息</param>
  241. /// <returns></returns>
  242. public string UploadFilesToRemoteUrl(string url1, string filepath, Dictionary<string, object> dic)
  243. {
  244. try
  245. {
  246. ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11;
  247. ServicePointManager.DefaultConnectionLimit = 50;
  248. string boundary = DateTime.Now.Ticks.ToString("x");
  249. byte[] boundarybytes = System.Text.Encoding.UTF8.GetBytes("--" + boundary + "\r\n");
  250. HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url1);
  251. request.Method = "POST";
  252. request.Timeout = 10 * 10000;
  253. request.ContentType = "multipart/form-data; boundary=" + boundary;
  254. Stream rs = request.GetRequestStream();
  255. var endBoundaryBytes = Encoding.UTF8.GetBytes("--" + boundary + "--\r\n");
  256. string formdataTemplate = "Content-Disposition: form-data; name=\"{0}\"\r\n" + "\r\n" + "{1}" + "\r\n";
  257. if (dic != null)
  258. {
  259. foreach (string key in dic.Keys)
  260. {
  261. rs.Write(boundarybytes, 0, boundarybytes.Length);
  262. string formitem = string.Format(formdataTemplate, key, dic[key]);
  263. byte[] formitembytes = System.Text.Encoding.UTF8.GetBytes(formitem);
  264. rs.Write(formitembytes, 0, formitembytes.Length);
  265. }
  266. }
  267. string headerTemplate = "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\n\r\n";
  268. {
  269. rs.Write(boundarybytes, 0, boundarybytes.Length);
  270. var header = string.Format(headerTemplate, "file", Path.GetFileName(filepath));
  271. var headerbytes = System.Text.Encoding.UTF8.GetBytes(header);
  272. rs.Write(headerbytes, 0, headerbytes.Length);
  273. using (var fileStream = new FileStream(filepath, FileMode.Open, FileAccess.Read))
  274. {
  275. var buffer = new byte[1024];
  276. var bytesRead = 0;
  277. while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0)
  278. {
  279. rs.Write(buffer, 0, bytesRead);
  280. }
  281. }
  282. var cr = Encoding.UTF8.GetBytes("\r\n");
  283. rs.Write(cr, 0, cr.Length);
  284. }
  285. rs.Write(endBoundaryBytes, 0, endBoundaryBytes.Length);
  286. var response = request.GetResponse() as HttpWebResponse;
  287. StreamReader newReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
  288. string Content = newReader.ReadToEnd();
  289. Dictionary<string, object> dic1 = new Dictionary<string, object>();
  290. List<Dictionary<string, object>> dic2 = null;
  291. dic1 = BaseUtil.ToDictionary(Content);
  292. dic2 = dic1["data"] as List<Dictionary<string, object>>;
  293. string fp_id = "";
  294. if (dic2[0]["filepath"] != null)
  295. {
  296. fp_id = dic2[0]["filepath"].ToString();
  297. }
  298. if (response.StatusCode == HttpStatusCode.OK)
  299. {
  300. return fp_id;
  301. }
  302. }
  303. catch (Exception e)
  304. {
  305. LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "上传SOP", "上传失败", ps_prodcode.Text, "");
  306. Console.WriteLine(e.Message + e.StackTrace);
  307. }
  308. return "";
  309. }
  310. private void ChooseFile_Click(object sender, EventArgs e)
  311. {
  312. ChoosePath.Filter = "(*.xlsx)|*.xlsx|(*.xls)|*.xls|(*.pdf)|*.pdf";
  313. DialogResult result = ChoosePath.ShowDialog();
  314. if (result == DialogResult.OK)
  315. {
  316. FilePath.Text = ChoosePath.FileName;
  317. }
  318. }
  319. private void UploadSOP_Click(object sender, EventArgs e)
  320. {
  321. Thread thread = new Thread(uploadfile);
  322. SetLoadingWindow stw = new SetLoadingWindow(thread, "上传文件");
  323. stw.StartPosition = FormStartPosition.CenterScreen;
  324. stw.ShowDialog();
  325. if (JPG.Checked)
  326. {
  327. LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "上传SOP【图片格式】", "上传成功", ps_prodcode.Text, "");
  328. }
  329. else
  330. {
  331. LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "上传SOP【PDF格式】", "上传成功", ps_prodcode.Text, "");
  332. }
  333. }
  334. private void OperatResult_TextChanged(object sender, EventArgs e)
  335. {
  336. //OperatResult.SelectionStart = Text.Length;
  337. OperatResult.ScrollToCaret();
  338. }
  339. private void SendSop_Click(object sender, EventArgs e)
  340. {
  341. try
  342. {
  343. if (ps_prodcode.Text == "")
  344. {
  345. MessageBox.Show("线别和SOP文档不能为空");
  346. return;
  347. }
  348. if (SendDGV.Rows.Count > 0)
  349. {
  350. List<Dictionary<string, string>> listr = new List<Dictionary<string, string>>();
  351. JavaScriptSerializer jss = new JavaScriptSerializer();
  352. Dictionary<string, object> map1 = new Dictionary<string, object>();
  353. Dictionary<string, object> map = new Dictionary<string, object>();
  354. string path;
  355. string pathroot = dh.GetConfig("filePathUrl", "sys").ToString();
  356. dh.ExecuteSql("insert into soprelease(SR_ID, sr_pscode, SR_STATUS, SR_MACHINETYPE,sr_releaseman,sr_readman)" +
  357. "select soprelease_seq.nextval,'" + ps_code.Text + "',0,'" + ps_prodcode.Text + "','" + User.UserName + "',em_code from employee ", "insert");
  358. LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "广播SOP", "广播成功", ps_prodcode.Text, "");
  359. MessageBox.Show("文档[" + ps_prodcode.Text + "]下放成功");
  360. }
  361. else
  362. {
  363. MessageBox.Show("产品编号" + ps_prodcode.Text + "未维护SOP文档");
  364. LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "广播SOP", "广播失败,未维护SOP文档", ps_prodcode.Text, "");
  365. }
  366. }
  367. catch (Exception ex)
  368. {
  369. LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "广播SOP", "广播失败", ps_prodcode.Text, "");
  370. Console.WriteLine(ex.Message + ex.StackTrace);
  371. }
  372. }
  373. public string encryptBASE64(string key)
  374. {
  375. Console.WriteLine(key);
  376. byte[] bytes = Encoding.Default.GetBytes(key);
  377. return Convert.ToBase64String(bytes);
  378. }
  379. public static string EncodeBase64(string code_type, string code)
  380. {
  381. string encode = "";
  382. byte[] bytes = Encoding.GetEncoding(code_type).GetBytes(code);
  383. try
  384. {
  385. encode = Convert.ToBase64String(bytes);
  386. }
  387. catch
  388. {
  389. encode = code;
  390. }
  391. return encode;
  392. }
  393. private void pr_code_KeyDown(object sender, KeyEventArgs e)
  394. {
  395. if (e.KeyCode == Keys.Enter)
  396. {
  397. LoadPrCode();
  398. }
  399. }
  400. private BindingSource bs = new BindingSource(); // 类成员变量
  401. private void LoadPrCode()
  402. {
  403. DataTable dt = (DataTable)dh.ExecuteSql("select * from productsop where ps_prodcode='" + ps_prodcode.Text + "'", "select");
  404. if (dt.Rows.Count > 0)
  405. {
  406. string ps_id = dt.Rows[0]["ps_id"].ToString();
  407. dt = (DataTable)dh.ExecuteSql(@"select fp_name,fp_path,'' issend,psd_iskey
  408. from ProductSOPdetail
  409. left join filepath on FP_ID=substr(PSD_ATTACH,instr(PSD_ATTACH,';')+1)
  410. where psd_psid=" + ps_id, "select");
  411. if (dt.Rows.Count > 0)
  412. {
  413. // 在 UI 线程安全执行(如果已经在 UI 线程则直接调用)
  414. if (SendDGV.InvokeRequired)
  415. SendDGV.Invoke(new Action(() => BindData(dt)));
  416. else
  417. BindData(dt);
  418. }
  419. }
  420. }
  421. private void BindData(DataTable dt)
  422. {
  423. // 使用 BindingSource 避免直接置 null
  424. if (SendDGV.DataSource == null)
  425. {
  426. bs.DataSource = dt;
  427. SendDGV.DataSource = bs;
  428. }
  429. else
  430. {
  431. bs.DataSource = dt; // 直接替换内部数据,控件不会经历“无数据”状态
  432. }
  433. // 可选:刷新显示
  434. SendDGV.Refresh();
  435. }
  436. private void pr_code_Leave(object sender, EventArgs e)
  437. {
  438. //LoadPrCode();
  439. }
  440. bool AllChecked = false;
  441. private void ChooseALL_Click(object sender, EventArgs e)
  442. {
  443. if (AllChecked)
  444. {
  445. foreach (DataGridViewRow dr in SendDGV.Rows)
  446. dr.Cells[0].Value = false;
  447. AllChecked = false;
  448. }
  449. else
  450. {
  451. foreach (DataGridViewRow dr in SendDGV.Rows)
  452. dr.Cells[0].Value = true;
  453. AllChecked = true;
  454. }
  455. }
  456. private void ps_prodcode_UserControlTextChanged(object sender, EventArgs e)
  457. {
  458. LoadPrCode();
  459. }
  460. private void GetSOP_Click(object sender, EventArgs e)
  461. {
  462. LoadPrCode();
  463. }
  464. private void ChoosePrint_Click(object sender, EventArgs e)
  465. {
  466. ChoosePath.Filter = "(*.png)|*.png";
  467. DialogResult result = ChoosePath.ShowDialog();
  468. if (result == DialogResult.OK)
  469. {
  470. PrintPath.Text = ChoosePath.FileName;
  471. }
  472. }
  473. private void SendDGV_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
  474. {
  475. if (e.RowIndex < 0 || e.ColumnIndex < 0) return;
  476. }
  477. }
  478. }