入库条码规则解析.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. using LabelManager2;
  2. using Seagull.BarTender.Print;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Drawing.Printing;
  8. using System.Linq;
  9. using System.Windows.Forms;
  10. using static System.Runtime.CompilerServices.RuntimeHelpers;
  11. namespace UAS_BARCODEIO
  12. {
  13. public partial class 入库条码规则解析 : Form
  14. {
  15. ApplicationClass lbl;
  16. DataHelper dh = new DataHelper();
  17. Document SingleDoc;
  18. Document OutDoc;
  19. DataTable Dbfind;
  20. //自适应屏幕
  21. AutoSizeFormClass asc = new AutoSizeFormClass();
  22. public 入库条码规则解析()
  23. {
  24. InitializeComponent();
  25. }
  26. delegate void BindDataSource(DataGridView dgv, DataTable dt);//定义委托
  27. void bindingsource(DataGridView dgv, DataTable dt)
  28. {
  29. //dgv.AutoGenerateColumns = false;
  30. //dgv.DataSource = null;
  31. //dgv.DataSource = dt;
  32. if (dgv.InvokeRequired)
  33. {
  34. dgv.Invoke(new BindDataSource(bindingsource), new object[] { dgv, dt });
  35. }
  36. else
  37. {
  38. dgv.AutoGenerateColumns = false;
  39. dgv.DataSource = dt;
  40. }
  41. }
  42. private void Form1_Load(object sender, EventArgs e)
  43. {
  44. es_custcode.TableName = "CS_EXPORTSETTING ";
  45. es_custcode.SelectField = "es_custcode # 品牌";
  46. es_custcode.FormName = Name;
  47. es_custcode.DBTitle = "解析规则查询";
  48. es_custcode.SetValueField = new string[] { "es_custcode" };
  49. es_custcode.Condition = "";
  50. es_custcode.DbChange += nr_rule_DBChange;
  51. SystemInf.dh = dh;
  52. try
  53. {
  54. lbl = new ApplicationClass();
  55. }
  56. catch (Exception ex)
  57. {
  58. Console.WriteLine(ex.Message);
  59. throw;
  60. }
  61. SingleDoc = lbl.Documents.Open(System.Windows.Forms.Application.StartupPath + @"\BARCODE.lab");
  62. OutDoc = lbl.Documents.Open(System.Windows.Forms.Application.StartupPath + @"\BOXCODE.lab");
  63. asc.controllInitializeSize(this);
  64. asc.controlAutoSize(this);
  65. PrintDocument print = new PrintDocument();
  66. string sDefault = print.PrinterSettings.PrinterName;//默认打印机名
  67. foreach (string sPrint in PrinterSettings.InstalledPrinters)//获取所有打印机名称
  68. {
  69. PrinterList.Items.Add(sPrint);
  70. if (sPrint == sDefault)
  71. PrinterList.SelectedIndex = PrinterList.Items.IndexOf(sPrint);
  72. }
  73. }
  74. private void nr_rule_DBChange(object sender, EventArgs e)
  75. {
  76. Dbfind = es_custcode.ReturnData;
  77. BaseUtil.SetFormValue(this.Controls, Dbfind);
  78. }
  79. private void pi_inoutnokeydown(object sender, KeyEventArgs e)
  80. {
  81. if (e.KeyCode == Keys.Enter)
  82. {
  83. LoadGridData();
  84. }
  85. }
  86. private void LoadGridData()
  87. {
  88. string sql = "select pd_inqty,pd_prodcode,pr_detail,pr_orispeccode,pr_spec,bi_inqty,pr_brand from " +
  89. "(select max(pd_prodcode)pd_prodcode,sum(pd_inqty)pd_inqty from prodiodetail left join product on pd_prodcode=pr_code where pd_inoutno='" + pi_inoutno.Text + "' group by pr_orispeccode,pr_brand)" +
  90. " left join (select max(bi_prodcode)bi_prodcode,nvl(sum(bi_inqty),0)bi_inqty from barcodeio left join product on pr_code=bi_prodcode " +
  91. "where bi_inoutno='" + pi_inoutno.Text + "' group by pr_orispeccode,pr_brand) on pd_prodcode=bi_prodcode left join product on pr_code=pd_prodcode order by pr_code";
  92. DataTable dt = (DataTable)dh.ExecuteSql(sql, "select");
  93. BaseUtil.FillDgvWithDataTable(Prodiodetail, dt);
  94. }
  95. private void Barcode_KeyDown(object sender, KeyEventArgs e)
  96. {
  97. if (e.KeyCode == Keys.Enter)
  98. {
  99. DataTable dt = (DataTable)dh.ExecuteSql("select esd_caption,esd_enable,el_type from cs_exportsettingdetail left join CS_EXPORTSETTING" +
  100. " on es_id=esd_esid where es_custcode='" + es_custcode.Text + "'", "select");
  101. if (dt.Rows.Count == 0)
  102. {
  103. MessageBox.Show("无条码解析规则");
  104. return;
  105. }
  106. string split = dt.Rows[0]["el_type"].ToString();
  107. string[] str = Barcode.Text.Split(split.ToCharArray()[0]);
  108. //分割后的字符串数组需要大于设置的参数解析
  109. if (str.Length < dt.Rows.Count)
  110. {
  111. MessageBox.Show("解析参数与解析规则不匹配");
  112. return;
  113. }
  114. for (int i = 0; i < dt.Rows.Count; i++)
  115. {
  116. string name = dt.Rows[i]["esd_caption"].ToString();
  117. string index = dt.Rows[i]["esd_enable"].ToString();
  118. switch (name)
  119. {
  120. case "LOTNO":
  121. LOTNO.Text = str[int.Parse(index) - 1];
  122. break;
  123. case "DC":
  124. DC.Text = str[int.Parse(index) - 1];
  125. break;
  126. case "PROD":
  127. pr_orispeccode3.Text = str[int.Parse(index) - 1];
  128. break;
  129. case "QTY":
  130. INQTY.Text = str[int.Parse(index) - 1];
  131. break;
  132. default:
  133. break;
  134. }
  135. }
  136. string madedate;
  137. string outqty;
  138. string lotno;
  139. string spec;
  140. LogicHandler.GetWeekData(DC.Text, INQTY.Text, es_custcode.Text.ToUpper(), pr_orispeccode3.Text,LOTNO.Text, out madedate, out outqty, out lotno,out spec);
  141. DC.Text = madedate;
  142. INQTY.Text = outqty;
  143. LOTNO.Text = lotno;
  144. pr_orispeccode3.Text = spec;
  145. }
  146. }
  147. bool AutoSized = false;
  148. private void 入库条码规则解析_AutoSizeChanged(object sender, EventArgs e)
  149. {
  150. if (!AutoSized)
  151. {
  152. asc.controlAutoSize(this);
  153. AutoSized = true;
  154. }
  155. }
  156. private void Prodiodetail_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
  157. {
  158. bool mouseOver = e.CellBounds.Contains(this.PointToClient(Cursor.Position));
  159. if (e.ColumnIndex > 0 && e.RowIndex >= 0)
  160. {
  161. if (Prodiodetail.Columns[e.ColumnIndex].Name == "pd_prodcode")
  162. {
  163. SolidBrush solidBrush = new SolidBrush(Color.FromArgb(51, 153, 255));
  164. if (Prodiodetail.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString() != Prodiodetail.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString())
  165. e.Graphics.FillRectangle(mouseOver ? solidBrush : Brushes.Yellow, e.CellBounds);
  166. else
  167. e.Graphics.FillRectangle(mouseOver ? solidBrush : Brushes.White, e.CellBounds);
  168. Rectangle border = e.CellBounds;
  169. border.Width -= 1;
  170. e.Graphics.DrawRectangle(Pens.White, border);
  171. e.PaintContent(e.CellBounds);
  172. e.Handled = true;
  173. }
  174. }
  175. }
  176. private void Prodiodetail_SelectionChanged(object sender, EventArgs e)
  177. {
  178. if (Prodiodetail.SelectedRows.Count > 0)
  179. {
  180. DataGridViewSelectedRowCollection dsc = Prodiodetail.SelectedRows;
  181. Prodiodetail.Rows[dsc[0].Index].Selected = true;
  182. if (dsc[0].Index - 2 >= 0)
  183. Prodiodetail.FirstDisplayedScrollingRowIndex = dsc[0].Index - 2;
  184. else
  185. Prodiodetail.FirstDisplayedScrollingRowIndex = dsc[0].Index;
  186. }
  187. }
  188. private void GenBarCode_Click(object sender, EventArgs e)
  189. {
  190. string sql = "select pr_zxbzs,pd_piid,pd_piclass,pd_inqty,pd_prodcode,pr_detail,pr_spec,nvl(bi_inqty,0)bi_inqty from " +
  191. "(select max(pd_piid)pd_piid,max(pd_piclass)pd_piclass,max(pd_prodcode)pd_prodcode,sum(pd_inqty)pd_inqty from prodiodetail left join product on pr_code=pd_prodcode where pd_inoutno='" + pi_inoutno.Text + "' group by pr_orispeccode,pr_brand)" +
  192. " left join (select max(bi_prodcode)bi_prodcode,nvl(sum(bi_inqty),0)bi_inqty from barcodeio left join product on pr_code=bi_prodcode " +
  193. "where bi_inoutno='" + pi_inoutno.Text + "' group by pr_orispeccode,pr_brand) on pd_prodcode=bi_prodcode left join product on pr_code=pd_prodcode " +
  194. "where pr_code='" + PR_CODE.Text + "'";
  195. DataTable dt = (DataTable)dh.ExecuteSql(sql, "select");
  196. if (dt.Rows.Count == 0)
  197. {
  198. MessageBox.Show("物料不在对应入库单中" + pi_inoutno.Text);
  199. return;
  200. }
  201. if (pr_orispeccode2.Text != pr_orispeccode3.Text)
  202. {
  203. MessageBox.Show("解析型号和单据型号不对应");
  204. return;
  205. }
  206. ZXBZ.Text = dt.Rows[0]["pr_zxbzs"].ToString();
  207. int pdinqty = int.Parse(dt.Rows[0]["pd_inqty"].ToString());
  208. int barqty = int.Parse(dt.Rows[0]["bi_inqty"].ToString());
  209. int Minpackage = 0;
  210. string pi_id = dt.Rows[0]["pd_piid"].ToString();
  211. string pd_piclass = dt.Rows[0]["pd_piclass"].ToString();
  212. //本次入库数
  213. int NowInqty = int.Parse(INQTY.Text);
  214. if (!int.TryParse(ZXBZ.Text, out Minpackage))
  215. {
  216. MessageBox.Show("最小包装数错误,料号" + PR_CODE.Text);
  217. return;
  218. }
  219. if (int.Parse(INQTY.Text) > pdinqty - barqty)
  220. {
  221. MessageBox.Show("物料采集后超出入库单数量" + PR_CODE.Text);
  222. return;
  223. }
  224. string outboxcode = "";
  225. if (GenBoxCode.Checked)
  226. {
  227. string[] param = new string[] { PR_CODE.Text, "", outboxcode };
  228. dh.CallProcedure("SP_GETBOX", ref param);
  229. outboxcode = param[2].Replace("BOX:", "");
  230. }
  231. //生成条码数量
  232. int barcount = NowInqty % Minpackage == 0 ? NowInqty / Minpackage : (NowInqty / Minpackage) + 1;
  233. List<string> bi_inqty = new List<string>();
  234. List<string> bi_barcode = new List<string>();
  235. List<string> bi_vendbarcode = new List<string>();
  236. List<string> bi_madedate = new List<string>();
  237. for (int i = 0; i < barcount; i++)
  238. {
  239. string barcode = "";
  240. int OneUnit = 0;
  241. string[] param = new string[] { PR_CODE.Text, "", barcode };
  242. dh.CallProcedure("SP_GETBARCODE", ref param);
  243. barcode = param[2].Replace("BARCODE:", "");
  244. //如果最后有尾数的话
  245. if (i == barcount - 1)
  246. {
  247. if (NowInqty % Minpackage == 0)
  248. {
  249. OneUnit = Minpackage;
  250. }
  251. else
  252. {
  253. OneUnit = NowInqty % Minpackage;
  254. }
  255. }
  256. else
  257. {
  258. OneUnit = Minpackage;
  259. }
  260. bi_inqty.Add(OneUnit.ToString());
  261. bi_barcode.Add(barcode);
  262. bi_vendbarcode.Add(LOTNO.Text);
  263. bi_madedate.Add(DC.Text);
  264. }
  265. sql = "insert into barcodeio(BI_ID, BI_BARCODE, BI_PIID, BI_PICLASS, BI_INOUTNO, BI_PDNO, BI_PDID, BI_PRODCODE, BI_INQTY,bi_vendbarcode, " +
  266. "BI_MADEDATE, BI_PRODID, BI_STATUS, BI_ORDERCODE, BI_INMAN, BI_INDATE,BI_OUTBOXCODE)select barcodeio_seq.nextval,:bi_barcode,'" + pi_id + "'," +
  267. "'" + pd_piclass + "','" + pi_inoutno.Text + "',0,0,'" + PR_CODE.Text + "',:bi_inqty,:bi_vendbarcode,to_date(:bi_madedate,'yyyy-mm-dd'),pr_id,0,'','管理员',sysdate,'" + outboxcode + "' " +
  268. " from product where pr_code='" + PR_CODE.Text + "'";
  269. dh.BatchInsert(sql, new string[] { "bi_inqty", "bi_barcode", "bi_vendbarcode", "bi_madedate" }, bi_barcode.ToArray(), bi_inqty.ToArray(), bi_vendbarcode.ToArray(), bi_madedate.ToArray());
  270. LoadGridData();
  271. LoadBarcodeioData(PR_CODE.Text);
  272. }
  273. private void LoadBarcodeioData(string pr_code)
  274. {
  275. string sql = "select 0 CheckBox,bi_barcode,bi_inqty,bi_datecode,bi_outboxcode,bi_vendbarcode,to_char(bi_madedate,'yyyy-mm-dd')bi_madedate,pr_detail,pr_spec,bi_prodcode,pr_orispeccode from barcodeio left join product on bi_prodcode=pr_code where bi_inoutno='" + pi_inoutno.Text + "' and bi_prodcode='" + pr_code + "'";
  276. DataTable dt = (DataTable)dh.ExecuteSql(sql, "select");
  277. BaseUtil.FillDgvWithDataTable(BarcodeIO, dt);
  278. }
  279. private void PrintBarCode_Click(object sender, EventArgs e)
  280. {
  281. for (int i = 0; i < BarcodeIO.Rows.Count; i++)
  282. {
  283. if (BarcodeIO.Rows[i].Cells["CheckBox"].FormattedValue != null && BarcodeIO.Rows[i].Cells["CheckBox"].FormattedValue.ToString() == "True")
  284. {
  285. for (int j = 0; j < SingleDoc.Variables.FreeVariables.Count; j++)
  286. {
  287. if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "BARCODE")
  288. {
  289. if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
  290. SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bi_barcode"].Value.ToString();
  291. }
  292. if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "DC")
  293. {
  294. if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
  295. SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bi_madedate"].Value.ToString();
  296. }
  297. if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "LOTNO")
  298. {
  299. if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
  300. SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bi_vendbarcode"].Value.ToString();
  301. }
  302. if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "QTY")
  303. {
  304. if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
  305. SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bi_inqty1"].Value.ToString();
  306. }
  307. if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "PRCODE")
  308. {
  309. if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
  310. SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["bi_prodcode"].Value.ToString();
  311. }
  312. if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "PRSPEC")
  313. {
  314. if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
  315. SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["pr_spec1"].Value.ToString();
  316. }
  317. if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "PRDETAIL")
  318. {
  319. if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
  320. SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["pr_detail1"].Value.ToString();
  321. }
  322. if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "ORISPEC")
  323. {
  324. if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
  325. SingleDoc.Variables.FreeVariables.Item(j + 1).Value = BarcodeIO.Rows[i].Cells["pr_orispeccode"].Value.ToString();
  326. }
  327. }
  328. SingleDoc.Printer.SwitchTo(PrinterList.Text);
  329. SingleDoc.PrintDocument();
  330. }
  331. }
  332. }
  333. private void Prodiodetail_CellContentClick(object sender, DataGridViewCellEventArgs e)
  334. {
  335. if (Prodiodetail.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString() != "")
  336. {
  337. }
  338. }
  339. private void Prodiodetail_CellClick(object sender, DataGridViewCellEventArgs e)
  340. {
  341. if (Prodiodetail.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString() != "")
  342. {
  343. LoadBarcodeioData(Prodiodetail.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString());
  344. Console.WriteLine(Prodiodetail.Rows[e.RowIndex].Cells["pr_brand"].Value.ToString());
  345. es_custcode.Text = Prodiodetail.Rows[e.RowIndex].Cells["pr_brand"].Value.ToString();
  346. PR_CODE.Text = Prodiodetail.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString();
  347. pr_orispeccode2.Text = Prodiodetail.Rows[e.RowIndex].Cells["pr_orispeccode1"].Value.ToString();
  348. LoadBarcodeioData(Prodiodetail.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString());
  349. }
  350. }
  351. private void ChooseAll_Click(object sender, EventArgs e)
  352. {
  353. for (int i = 0; i < BarcodeIO.Rows.Count; i++)
  354. {
  355. BarcodeIO.Rows[i].Cells["CheckBox"].Value = true;
  356. }
  357. }
  358. private void PrintBox_Click(object sender, EventArgs e)
  359. {
  360. List<string> outboxcode = new List<string>();
  361. for (int i = 0; i < BarcodeIO.Rows.Count; i++)
  362. {
  363. if (BarcodeIO.Rows[i].Cells["CheckBox"].FormattedValue != null && BarcodeIO.Rows[i].Cells["CheckBox"].FormattedValue.ToString() == "True")
  364. {
  365. if (!outboxcode.Contains(BarcodeIO.Rows[i].Cells["bi_outboxcode"].FormattedValue))
  366. {
  367. outboxcode.Add(BarcodeIO.Rows[i].Cells["bi_outboxcode"].Value.ToString());
  368. }
  369. }
  370. }
  371. string[] box = outboxcode.ToArray();
  372. for (int i = 0; i < box.Length; i++)
  373. {
  374. 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," +
  375. "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";
  376. DataTable dt = (DataTable)dh.ExecuteSql(sql, "select");
  377. for (int j = 0; j < SingleDoc.Variables.FreeVariables.Count; j++)
  378. {
  379. if (OutDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "BARCODE")
  380. {
  381. if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
  382. OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["bi_outboxcode"].ToString();
  383. }
  384. if (OutDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "DC")
  385. {
  386. if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
  387. OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["bi_madedate"].ToString();
  388. }
  389. if (OutDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "LOTNO")
  390. {
  391. if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
  392. OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["bi_vendbarcode"].ToString();
  393. }
  394. if (OutDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "QTY")
  395. {
  396. if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
  397. OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["bi_inqty"].ToString();
  398. }
  399. if (OutDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "PRCODE")
  400. {
  401. if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
  402. OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["bi_prodcode"].ToString();
  403. }
  404. if (OutDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "PRSPEC")
  405. {
  406. if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
  407. OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["pr_spec"].ToString();
  408. }
  409. if (OutDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "PRDETAIL")
  410. {
  411. if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
  412. OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["pr_detail"].ToString();
  413. }
  414. if (OutDoc.Variables.FreeVariables.Item(j + 1).Name.ToUpper() == "ORISPEC")
  415. {
  416. if (BarcodeIO.Rows[i].Cells["bi_madedate"].Value != null)
  417. OutDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0]["pr_orispeccode"].ToString();
  418. }
  419. }
  420. OutDoc.Printer.SwitchTo(PrinterList.Text);
  421. OutDoc.PrintDocument();
  422. }
  423. }
  424. private void PrintStockBarCode_Click(object sender, EventArgs e)
  425. {
  426. 库存条码打印 form = new 库存条码打印();
  427. form.ShowDialog();
  428. }
  429. }
  430. }