UAS_出货标签管理.cs 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094
  1. using System;
  2. using System.Data;
  3. using System.Drawing;
  4. using System.Windows.Forms;
  5. using System.Text.RegularExpressions;
  6. using System.Text;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Diagnostics;
  10. using UAS_LabelMachine.PublicMethod;
  11. using UAS_LabelMachine.Entity;
  12. using System.Reflection;
  13. namespace UAS_LabelMachine
  14. {
  15. public partial class UAS_出货标签打印 : Form
  16. {
  17. //自适应屏幕
  18. AutoSizeFormClass asc = new AutoSizeFormClass();
  19. DataHelper dh;
  20. DataTable dt;
  21. /// <summary>
  22. /// 已经打印过的Vivo外箱号
  23. /// </summary>
  24. StringBuilder sql = new StringBuilder();
  25. /// <summary>
  26. /// 当前品牌
  27. /// </summary>
  28. string Brand;
  29. string PI_ID;
  30. /// <summary>
  31. /// 当前扫描的项目
  32. /// </summary>
  33. int CurrentItemIndex = 0;
  34. /// <summary>
  35. /// 当前扫描的所在行
  36. /// </summary>
  37. int CurrentRowIndex = 0;
  38. bool Checking = false;
  39. /// <summary>
  40. /// 正则表达式用于项目匹配
  41. /// </summary>
  42. Regex reg;
  43. /*标识供应商物料编号采集是否通过*/
  44. bool CollectVeProdCodePass = true;
  45. bool CollectQTYPass = true;
  46. bool logout = false;
  47. //每个不同序号存在的
  48. object[] ItemData;
  49. Dictionary<string, string> CollectData;
  50. /// <summary>
  51. /// 是否全选
  52. /// </summary>
  53. bool AllChecked = false;
  54. /*用于存放采集项目的Grid信息*/
  55. Dictionary<string, Dictionary<string, string>> SiItem;
  56. int CloumnCount = 0;
  57. //使用二维数组进行排序
  58. ArrayList<ArrayList<string>> ScanData;
  59. ArrayList<string> GetData;
  60. //用于记录上一个扫描的型号,和当前的不一致则进行弹窗提示
  61. string LastSpec = "";
  62. public UAS_出货标签打印(string Master)
  63. {
  64. this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint, true);
  65. this.UpdateStyles();
  66. InitializeComponent();
  67. Type dgvType = this.LabelInf.GetType();
  68. PropertyInfo pi = dgvType.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);
  69. pi.SetValue(this.LabelInf, true, null);
  70. Text = Text + "-" + Master;
  71. }
  72. protected override void WndProc(ref Message m)
  73. {
  74. //拦截双击标题栏、移动窗体的系统消息
  75. if (m.Msg != 0xA3)
  76. {
  77. base.WndProc(ref m);
  78. }
  79. }
  80. private void 贴标机条码打印_Load(object sender, EventArgs e)
  81. {
  82. //杀死之前全部未关闭的进程
  83. Process[] processes = System.Diagnostics.Process.GetProcessesByName("lppa");
  84. for (int i = 0; i < processes.Length; i++)
  85. {
  86. processes[i].Kill();
  87. }
  88. //用计时器重置数据库链接
  89. LogManager.DoLog("程序启动,登陆人员【" + User.UserName + "】");
  90. dh = SystemInf.dh;
  91. CheckForIllegalCrossThreadCalls = false;
  92. CloumnCount = LabelInf.Columns.Count;
  93. pi_inoutno.Focus();
  94. //将本地读取的打印机设置进Combox,并选中默认打印机
  95. sg_brand.FormName = Name;
  96. sg_brand.SetValueField = new string[] { "sg_brand" };
  97. sg_brand.SelectField = "sg_code # 策略编号 ,sg_name # 策略名称,sg_brand # 品牌,sg_separator # 分隔符";
  98. sg_brand.TableName = "scangroup";
  99. sg_brand.DbChange += Sg_brand_DbChange;
  100. pr_code.FormName = Name;
  101. pr_code.SetValueField = new string[] { "pr_code" };
  102. pr_code.TableName = "prodiodetail left join product on pd_prodcode=pr_code";
  103. pr_code.SelectField = "pd_pdno # 行号,pr_code # 物料编号";
  104. cu_code.FormName = Name;
  105. cu_code.SetValueField = new string[] { "cu_code" };
  106. cu_code.TableName = "customer";
  107. cu_code.SelectField = "cu_code # 客户编号,cu_name # 客户名称";
  108. Point pt = new Point();
  109. //禁止所有列的排序
  110. foreach (DataGridViewColumn dgv in LabelInf.Columns)
  111. {
  112. dgv.SortMode = DataGridViewColumnSortMode.NotSortable;
  113. }
  114. int ScreenWidth = Screen.GetWorkingArea(pt).Width;
  115. //设置获取当前屏幕大小自动全屏但是保留任务栏
  116. Rectangle ScreenArea = Screen.GetWorkingArea(this);
  117. Top = 0;
  118. Left = 0;
  119. Width = ScreenArea.Width;
  120. Height = ScreenArea.Height;
  121. asc.controllInitializeSize(this);
  122. asc.controlAutoSize(this);
  123. }
  124. private void Sg_brand_DbChange(object sender, EventArgs e)
  125. {
  126. DataTable dt = sg_brand.ReturnData;
  127. BaseUtil.SetFormValue(this.Controls, dt);
  128. }
  129. //只执行一次窗体自适应
  130. bool AutoSized = false;
  131. private void 贴标机条码打印_SizeChanged(object sender, EventArgs e)
  132. {
  133. if (!AutoSized)
  134. {
  135. asc.controlAutoSize(this);
  136. AutoSized = true;
  137. }
  138. }
  139. private void GenerateBarCode_Click(object sender, EventArgs e)
  140. {
  141. 生成条码 form = new 生成条码(pi_inoutno.Text);
  142. form.FormClosed += LoadGridData;
  143. BaseUtil.SetFormCenter(form);
  144. form.ShowDialog();
  145. }
  146. private void CollectionSetting_Click(object sender, EventArgs e)
  147. {
  148. 采集策略 form = new 采集策略(sg_brand.Text);
  149. form.WindowState = FormWindowState.Maximized;
  150. form.FormClosed += sg_brand_UserControlTextChanged;
  151. BaseUtil.SetFormCenter(form);
  152. form.ShowDialog();
  153. }
  154. private void LabelFormClose(object sender, EventArgs e)
  155. {
  156. }
  157. /// <summary>
  158. /// 保存明细
  159. /// </summary>
  160. /// <param name="sender"></param>
  161. /// <param name="e"></param>
  162. private void SaveGrid_Click(object sender, EventArgs e)
  163. {
  164. DataTable savedt = (LabelInf.DataSource as DataTable);
  165. savedt.EndInit();
  166. if (savedt != null && savedt.GetChanges() != null)
  167. {
  168. dh.CallProcedure("sp_uploadbarcode", savedt.GetChanges());
  169. CheckRecheckStatus();
  170. MessageBox.Show("保存成功!");
  171. }
  172. }
  173. //放大镜选择后出发的事件
  174. private void sg_brand_UserControlTextChanged(object sender, EventArgs e)
  175. {
  176. //取已启用的的按照采集次序排序
  177. DataTable dt = (DataTable)dh.ExecuteSql("select si_item,si_detno,sg_separator,si_kind,si_expression,si_expressionitem,si_index,si_indexstring,si_length from scanitem left join scangroup on si_sgid=sg_id where sg_brand='" + sg_brand.Text + "' and si_enable<>0 order by si_detno,si_innerdetno", "select");
  178. if (dt.Rows.Count == 0)
  179. {
  180. dt = (DataTable)dh.ExecuteSql("select si_item,si_detno,sg_separator,si_kind,si_expression,si_expressionitem,si_index,si_indexstring,si_length from scanitem left join scangroup on si_sgid=sg_id where nvl(sg_brand,' ')=' ' and si_enable<>0 order by si_detno,si_innerdetno", "select");
  181. }
  182. BaseUtil.FillDgvWithDataTable(Si_ItemDGV, dt);
  183. if (dt.Rows.Count > 0)
  184. {
  185. sg_separator.Text = dt.Rows[0]["sg_separator"].ToString();
  186. }
  187. //按DetNo排列之后的采集项
  188. ScanData = new ArrayList<ArrayList<string>>();
  189. //每个采集项目的子项
  190. GetData = new ArrayList<string>();
  191. //将数据添加进一个List的二维数组中
  192. for (int i = 0; i < Si_ItemDGV.RowCount; i++)
  193. {
  194. //如果不包含这个则添加进数组
  195. if (!GetData.Contains(Si_ItemDGV.Rows[i].Cells["si_item"].Value.ToString()))
  196. {
  197. GetData.Add(Si_ItemDGV.Rows[i].Cells["si_item"].Value.ToString());
  198. }
  199. //如果和后一个的采集次序相同
  200. if (((i + 1) < Si_ItemDGV.RowCount) && Si_ItemDGV.Rows[i].Cells["si_detno"].Value.ToString() == Si_ItemDGV.Rows[i + 1].Cells["si_detno"].Value.ToString())
  201. {
  202. GetData.Add(Si_ItemDGV.Rows[i + 1].Cells["si_item"].Value.ToString());
  203. }
  204. else
  205. {
  206. ScanData.Add(GetData);
  207. //添加完一次数据需要一个新的List
  208. GetData = new ArrayList<string>();
  209. }
  210. }
  211. RemindUser();
  212. if (ScanData.ToArray().Length > 0)
  213. {
  214. object[] arr = (ScanData.ToArray()[0] as ArrayList<string>).ToArray();
  215. if (arr.Contains("MPN") || arr.Contains("CPN"))
  216. {
  217. AutoMatch.CheckState = CheckState.Checked;
  218. AutoMatch.Enabled = true;
  219. }
  220. else
  221. {
  222. AutoMatch.CheckState = CheckState.Unchecked;
  223. AutoMatch.Enabled = false;
  224. }
  225. }
  226. }
  227. //输入框Enter事件
  228. private void Input_KeyDown(object sender, KeyEventArgs e)
  229. {
  230. if (e.KeyCode == Keys.Enter)
  231. {
  232. if (Input.Text == "")
  233. {
  234. MessageBox.Show("采集的数据不能为空");
  235. return;
  236. }
  237. if (Si_ItemDGV.Rows.Count == 0)
  238. {
  239. MessageBox.Show("未维护采集策略");
  240. return;
  241. }
  242. CollectInputData();
  243. }
  244. }
  245. /// <summary>
  246. /// 设置自动匹配的数据的行号
  247. /// </summary>
  248. /// <returns></returns>
  249. private void SetAutoMatchRow()
  250. {
  251. //采集策略的第一组数据
  252. string[] arr = new string[ItemData.Length];
  253. if (sg_separator.Text == "")
  254. {
  255. for (int i = 0; i < arr.Length; i++)
  256. {
  257. arr[i] = Input.Text;
  258. }
  259. }
  260. else
  261. {
  262. arr = Input.Text.Split(sg_separator.Text.ToCharArray()).ToArray();
  263. }
  264. bool FindAutoMatch = false;
  265. for (int i = 0; i < LabelInf.RowCount; i++)
  266. {
  267. for (int j = 0; j < arr.Length; j++)
  268. {
  269. string orispeccode = LabelInf.Rows[i].Cells["pr_orispeccode"].Value.ToString();
  270. if ((MatchStr(arr[j].ToString(), "MPN").Contains(orispeccode) || MatchStr(arr[j].ToString(), "MPN").Trim().Replace(" ", "").Contains(orispeccode) || orispeccode == MatchStr(arr[j].ToString(), "MPN") ||( LabelInf.Rows[i].Cells["pd_custprodcode"].Value.ToString() == MatchStr(arr[j].ToString(), "CPN")|| MatchStr(arr[j].ToString(), "CPN").Contains(LabelInf.Rows[i].Cells["pd_custprodcode"].Value.ToString()))) && LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() != "True")
  271. {
  272. if (!Checking)
  273. {
  274. CurrentRowIndex = i;
  275. Checking = true;
  276. }
  277. if (CurrentRowIndex - 5 > 0)
  278. LabelInf.FirstDisplayedScrollingRowIndex = CurrentRowIndex - 5;
  279. else
  280. LabelInf.FirstDisplayedScrollingRowIndex = 0;
  281. Brand = LabelInf.Rows[CurrentRowIndex].Cells["pib_brand"].FormattedValue.ToString();
  282. if (Brand != "")
  283. sg_brand.Text = Brand;
  284. FindAutoMatch = true;
  285. if ((MatchStr(arr[j].ToString(), "MPN").Contains(orispeccode) || MatchStr(arr[j].ToString(), "MPN").Trim().Replace(" ", "").Contains(orispeccode) || orispeccode == MatchStr(arr[j].ToString(), "MPN")))
  286. {
  287. if (LastSpec == "")
  288. {
  289. LastSpec = orispeccode;
  290. }
  291. if (LastSpec != orispeccode)
  292. {
  293. LastSpec = orispeccode;
  294. MessageBox.Show("切换扫描型号" + orispeccode);
  295. }
  296. }
  297. break;
  298. }
  299. }
  300. if (FindAutoMatch)
  301. break;
  302. }
  303. }
  304. /// <summary>
  305. /// 采集数据
  306. /// </summary>
  307. private void CollectInputData()
  308. {
  309. LogManager.DoLog("采集数据【" + Input.Text + "】,使用采集策略编号【" + sg_brand.Text + "】");
  310. //按DetNo排列之后的采集项
  311. ScanData = new ArrayList<ArrayList<string>>();
  312. //每个采集项目的子项
  313. GetData = new ArrayList<string>();
  314. //用于保存采集策略的具体信息
  315. SiItem = new Dictionary<string, Dictionary<string, string>>();
  316. for (int i = 0; i < Si_ItemDGV.RowCount; i++)
  317. {
  318. //如果不包含这个则添加进数组
  319. if (!GetData.Contains(Si_ItemDGV.Rows[i].Cells["si_item"].Value.ToString()))
  320. GetData.Add(Si_ItemDGV.Rows[i].Cells["si_item"].Value.ToString());
  321. //如果和后一个的采集次序相同
  322. if (((i + 1) < Si_ItemDGV.RowCount) && Si_ItemDGV.Rows[i].Cells["si_detno"].Value.ToString() == Si_ItemDGV.Rows[i + 1].Cells["si_detno"].Value.ToString())
  323. GetData.Add(Si_ItemDGV.Rows[i + 1].Cells["si_item"].Value.ToString());
  324. else
  325. {
  326. ScanData.Add(GetData);
  327. //添加完一次数据需要一个新的List
  328. GetData = new ArrayList<string>();
  329. }
  330. Dictionary<string, string> item = new Dictionary<string, string>();
  331. for (int j = 0; j < Si_ItemDGV.ColumnCount; j++)
  332. {
  333. item.Add(Si_ItemDGV.Columns[j].DataPropertyName, Si_ItemDGV.Rows[i].Cells[j].Value.ToString());
  334. }
  335. SiItem.Add(Si_ItemDGV.Rows[i].Cells["si_item"].Value.ToString().ToUpper(), item);
  336. }
  337. //采集项目的数组
  338. ItemData = (ScanData.ToArray()[CurrentItemIndex] as ArrayList<string>).ToArray();
  339. //分隔符不为空的时候 //采集的项和Grid的数目不等
  340. //用户采集的数据的分割数组
  341. CollectData = new Dictionary<string, string>();
  342. if (sg_separator.Text == "")
  343. {
  344. for (int i = 0; i < ItemData.Length; i++)
  345. CollectData.Add(ItemData[i].ToString().ToUpper(), Input.Text);
  346. }
  347. else
  348. {
  349. int DataCount = Input.Text.Split(sg_separator.Text.ToCharArray()).Length;
  350. if (DataCount > ItemData.Length)
  351. {
  352. MessageBox.Show("采集数据大于采集项次");
  353. return;
  354. }
  355. else if (DataCount < ItemData.Length)
  356. {
  357. MessageBox.Show("采集数据小于采集项次");
  358. return;
  359. }
  360. for (int i = 0; i < DataCount; i++)
  361. CollectData.Add(ItemData[i].ToString().ToUpper(), Input.Text.Split(sg_separator.Text.ToCharArray())[i]);
  362. }
  363. //首先判断当前采集的个数,如果采集的个数为1则不对数据进行分隔符验证
  364. if (ItemData.Length == 1)
  365. {
  366. CollectData.Clear();
  367. CollectData.Add(ItemData[0].ToString().ToUpper(), Input.Text);
  368. //勾选了自动匹配调用该函数
  369. if (AutoMatch.Checked)
  370. SetAutoMatchRow();
  371. //将筛选之后的值赋给Cell
  372. SetDataToCell(ref CollectData, ItemData[0].ToString().ToUpper());
  373. }
  374. //如果本次采集的数据分割后和当前的采集项目个数不一样提示用户错误
  375. else if (CollectData.ToArray().Length == ItemData.Length)
  376. {
  377. for (int i = 0; i < ItemData.Length; i++)
  378. {
  379. //勾选了自动匹配调用该函数
  380. if (AutoMatch.Checked)
  381. SetAutoMatchRow();
  382. //将筛选之后的值赋给Cell
  383. SetDataToCell(ref CollectData, ItemData[i].ToString().ToUpper());
  384. }
  385. }
  386. else
  387. {
  388. MessageBox.Show("所采集的数据个数和采集项目不符");
  389. return;
  390. }
  391. //采集项目的索引+1
  392. CurrentItemIndex = CurrentItemIndex + 1;
  393. //如果已经采集完了最后一个
  394. if (CurrentItemIndex == ScanData.ToArray().Length)
  395. {
  396. //数据校验均已通过则勾选上已采集
  397. if (CollectVeProdCodePass && CollectQTYPass)
  398. {
  399. //如果按盒号采集,所有的此盒的均更新为
  400. DataTable dt = (DataTable)MidSource.DataSource;
  401. LabelInf.Rows[CurrentRowIndex].Cells["pib_ifpick"].Value = true;
  402. LabelInf.Rows[CurrentRowIndex].Cells["Choose"].Value = true;
  403. string datecode = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value.ToString();
  404. string lotno = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value.ToString();
  405. string pib_id = LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString();
  406. ErrorType.Clear();
  407. dh.ExecuteSql("update prodiobarcode set pib_datecode='" + datecode + "',pib_lotno='" + lotno + "',pib_ifpick=-1 where pib_id='" + pib_id + "'", "update");
  408. CheckRecheckStatus();
  409. LabelInf.Invalidate();
  410. Checking = false;
  411. ProcessRemind();
  412. }
  413. //采集未通过的时候
  414. else
  415. {
  416. ErrorType.Clear();
  417. //如果自动采集采集未成功需要移动到下一行
  418. if (!AutoMatch.Checked)
  419. SetRowIndexToCollectRow();
  420. }
  421. //当前项目已采集完成,重置采集项目
  422. CurrentItemIndex = 0;
  423. //未勾选自动匹配,设置到下一个未采集的行
  424. if (!AutoMatch.Checked)
  425. SetRowIndexToCollectRow();
  426. }
  427. RemindUser();
  428. //提醒用户需要采集的数据
  429. MessageLog.AppendText(">>扫描到数据" + Input.Text + "\n", Color.Blue);
  430. //如果所采集的行的物料不一样的话,重新计算箱内容量
  431. if (CurrentRowIndex - 1 > 0)
  432. {
  433. string LastRowProd = LabelInf.Rows[CurrentRowIndex - 1].Cells["pib_prodcode"].Value.ToString();
  434. string CurrentRowProd = LabelInf.Rows[CurrentRowIndex].Cells["pib_prodcode"].Value.ToString();
  435. }
  436. if (CleanInputAfterCollect.Checked)
  437. Input.Text = "";
  438. }
  439. //设置行的索引到当前需要采集的行
  440. private void SetRowIndexToCollectRow()
  441. {
  442. //获取当前需要采集的行
  443. for (int i = CurrentRowIndex; i < LabelInf.RowCount; i++)
  444. {
  445. if (LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() != "True")
  446. {
  447. griddetno.Text = LabelInf.Rows[i].Cells["pib_pdno"].FormattedValue.ToString();
  448. pr_code.Text = LabelInf.Rows[i].Cells["pib_prodcode"].FormattedValue.ToString();
  449. CurrentRowIndex = LabelInf.Rows[i].Cells["pib_prodcode"].RowIndex;
  450. break;
  451. }
  452. }
  453. }
  454. /// <summary>
  455. /// 提醒用户当前采集的项目
  456. /// </summary>
  457. private void RemindUser()
  458. {
  459. SetRowIndexToCollectRow();
  460. if (ScanData.ToArray().Length > 0)
  461. {
  462. object[] arr = (ScanData.ToArray()[CurrentItemIndex] as ArrayList<string>).ToArray();
  463. string Inf = "";
  464. for (int i = 0; i < arr.Length; i++)
  465. {
  466. Inf += arr[i] + " ";
  467. }
  468. MessageLog.AppendText(">>当前采集行" + (CurrentRowIndex + 1) + ",请采集" + Inf + "\n", Color.Green);
  469. }
  470. }
  471. private void ProcessRemind()
  472. {
  473. int Count = dh.getRowCount("prodiobarcode", "pib_piid=" + PI_ID + " and pib_ifpick<>0");
  474. CollectedCount.Text = Count.ToString();
  475. }
  476. List<string> ErrorType = new List<string>();
  477. /// <summary>
  478. /// 自定义函数 将匹配之后的值设置到Cell中,传递引用,每次赋值之后从List中移除已使用过的
  479. /// </summary>
  480. /// <param name="data"></param>
  481. /// <param name="kind"></param>
  482. private void SetDataToCell(ref Dictionary<string, string> setdata, string kind)
  483. {
  484. int length = setdata.Count;
  485. for (int j = 0; j < length; j++)
  486. {
  487. string[] data = new string[setdata.Count];
  488. for (int i = 0; i < length; i++)
  489. {
  490. data[i] = setdata[kind];
  491. }
  492. for (int i = 0; i < data.Length; i++)
  493. {
  494. DataGridViewCell cell = null;
  495. string Matchstr = "";
  496. switch (kind.ToString().ToUpper())
  497. {
  498. case "DATECODE":
  499. cell = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"];
  500. Matchstr = MatchStr(data[j], "DATECODE");
  501. setdata.Remove("DATECODE");
  502. length--;
  503. break;
  504. case "LOTNO":
  505. cell = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"];
  506. Matchstr = MatchStr(data[j], "LOTNO");
  507. setdata.Remove("LOTNO");
  508. length--;
  509. break;
  510. case "MPN":
  511. cell = LabelInf.Rows[CurrentRowIndex].Cells["pr_orispeccode"];
  512. Matchstr = MatchStr(data[j], "MPN");
  513. //采集的供应商号不匹配的话
  514. if (cell.Value.ToString() == Matchstr || Matchstr.Trim().Replace(" ", "").Contains(cell.Value.ToString()) || Matchstr.Contains(cell.Value.ToString()))
  515. {
  516. ErrorType.Add("OK_MPN");
  517. BaseUtil.PlaySound("OK.wav");
  518. LabelInf.Refresh();
  519. CollectVeProdCodePass = true;
  520. }
  521. else
  522. {
  523. ErrorType.Add("NG_MPN");
  524. CollectVeProdCodePass = false;
  525. BaseUtil.PlaySound("NG.wav");
  526. //添加需要重绘的Cell
  527. LabelInf.Refresh();
  528. MessageLog.AppendText(">>供应商物料编号不匹配\n", Color.Red);
  529. }
  530. setdata.Remove("MPN");
  531. length--;
  532. break;
  533. case "QTY":
  534. cell = LabelInf.Rows[CurrentRowIndex].Cells["pib_qty"];
  535. Matchstr = MatchStr(data[j], "QTY");
  536. //如果采集的数量不相等的话
  537. if (cell.Value.ToString() != Matchstr)
  538. {
  539. CollectQTYPass = false;
  540. LabelInf.Refresh();
  541. MessageLog.AppendText(">>数量不匹配\n", Color.Red);
  542. }
  543. else
  544. {
  545. LabelInf.Refresh();
  546. CollectQTYPass = true;
  547. }
  548. setdata.Remove("QTY");
  549. length--;
  550. break;
  551. case "CPN":
  552. cell = LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodcode"];
  553. Matchstr = MatchStr(data[j], "CPN");
  554. //如果采集的数量不相等的话
  555. if (cell.Value.ToString() != Matchstr && !Matchstr.Contains(cell.Value.ToString()))
  556. {
  557. ErrorType.Add("NG_CPN");
  558. BaseUtil.PlaySound("NG.wav");
  559. CollectQTYPass = false;
  560. LabelInf.Refresh();
  561. MessageLog.AppendText(">>CPN不匹配\n", Color.Red);
  562. }
  563. else
  564. {
  565. ErrorType.Add("OK_CPN");
  566. BaseUtil.PlaySound("OK.wav");
  567. LabelInf.Refresh();
  568. CollectQTYPass = true;
  569. }
  570. setdata.Remove("CPN");
  571. length--;
  572. break;
  573. default:
  574. break;
  575. }
  576. //如果数据为空或者数据不为空的时候但是和需要采集的数据不相等的情况下进行采集
  577. //MPN和QTY只做比较不需要赋值
  578. if (cell.Value.ToString() == "" || cell.Value.ToString() != Matchstr)
  579. {
  580. string MatchResult = "";
  581. if (kind != "MPN" && kind != "QTY" && kind != "CPN")
  582. {
  583. DataTable dt = (DataTable)MidSource.DataSource;
  584. cell.Value = Matchstr;
  585. MatchResult = "成功";
  586. }
  587. else
  588. MatchResult = "失败";
  589. switch (SiItem[kind]["si_kind"])
  590. {
  591. case "索引字符":
  592. LogManager.DoLog("采集项" + kind + ",匹配结果:【" + MatchResult + "】,匹配方式:" + SiItem[kind]["si_kind"] + ",使用字符" + SiItem[kind]["si_indexstring"] + ",匹配后字符串" + Matchstr);
  593. break;
  594. case "起始位置":
  595. LogManager.DoLog("采集项" + kind + ",匹配结果:【" + MatchResult + "】,匹配方式:" + SiItem[kind]["si_kind"] + ",从第" + SiItem[kind]["si_index"] + "位开始匹配,匹配后字符串" + Matchstr);
  596. break;
  597. case "二次解析":
  598. LogManager.DoLog("采集项" + kind + ",匹配结果:【" + MatchResult + "】,匹配方式:" + SiItem[kind]["si_kind"] + ",匹配后字符串" + Matchstr);
  599. break;
  600. case "全部":
  601. LogManager.DoLog("采集项" + kind + ",匹配结果:【" + MatchResult + "】,匹配方式:" + SiItem[kind]["si_kind"] + ",匹配后字符串" + Matchstr);
  602. break;
  603. default:
  604. break;
  605. }
  606. }
  607. else
  608. LogManager.DoLog("采集项" + kind + ",匹配结果:【成功】,匹配方式:" + SiItem[kind]["si_kind"] + ",,匹配后字符串" + Matchstr);
  609. }
  610. }
  611. }
  612. /// <summary>
  613. /// 自定义函数 根据匹配规则
  614. /// si_item的二维数组,str是需要赋值的字符串,item表示DateCode,LotNo等
  615. /// </summary>
  616. /// <param name="SiItem"></param>
  617. /// <param name="str"></param>
  618. /// <param name="item"></param>
  619. /// <returns></returns>
  620. private string MatchStr(string str, string item)
  621. {
  622. string kind = SiItem[item]["si_kind"];
  623. //起始字符不为空的时候
  624. switch (kind)
  625. {
  626. case "起始位置":
  627. if (SiItem[item]["si_index"] != "")
  628. {
  629. try
  630. {
  631. //长度不为空的时候按照指定的长度去取数据
  632. if (SiItem[item]["si_length"] != "")
  633. str = str.Substring(int.Parse(SiItem[item]["si_index"]), int.Parse(SiItem[item]["si_length"]));
  634. //长度为空的时候取index之后的全部数据
  635. else
  636. str = str.Substring(int.Parse(SiItem[item]["si_index"]));
  637. }
  638. catch (Exception e) { LogManager.DoLog(e.StackTrace); }
  639. }
  640. break;
  641. case "索引字符":
  642. try
  643. {
  644. if (SiItem[item]["si_indexstring"] != "")
  645. {
  646. //长度不为空的时候按照指定的长度去取数据
  647. if (SiItem[item]["si_length"] != "")
  648. str = str.Substring(str.IndexOf(SiItem[item]["si_indexstring"]) + 1, int.Parse(SiItem[item]["si_length"]));
  649. //长度为空的时候取index之后的全部数据
  650. else
  651. str = str.Substring(str.IndexOf(SiItem[item]["si_indexstring"]) + 1);
  652. }
  653. }
  654. catch (Exception e) { LogManager.DoLog(e.StackTrace); }
  655. break;
  656. case "全部":
  657. break;
  658. default:
  659. break;
  660. }
  661. if (SiItem[item]["si_expression"] != "")
  662. {
  663. string log = "使用正则表达式" + SiItem[item]["si_expression"] + "匹配数据" + str;
  664. reg = new Regex(SiItem[item]["si_expression"]);
  665. try
  666. {
  667. str = reg.Matches(str)[int.Parse(SiItem[item]["si_expressionitem"].ToString()) - 1].Value;
  668. }
  669. catch (Exception)
  670. {
  671. }
  672. log += ",匹配后数据" + str;
  673. LogManager.DoLog(log);
  674. }
  675. return str;
  676. }
  677. //关闭窗口前提示用户确认
  678. private void 贴标机条码打印_FormClosing(object sender, FormClosingEventArgs e)
  679. {
  680. //如果不是注销的话
  681. if (!logout)
  682. {
  683. string close = MessageBox.Show(this.ParentForm, "是否关闭", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
  684. if (close.ToString() != "Yes")
  685. e.Cancel = true;
  686. else
  687. {
  688. LogManager.DoLog("关闭程序");
  689. }
  690. }
  691. }
  692. /// <summary>
  693. /// 出入库单录入框的回车事件
  694. /// </summary>
  695. /// <param name="sender"></param>
  696. /// <param name="e"></param>
  697. private void pi_inoutno_KeyDown(object sender, KeyEventArgs e)
  698. {
  699. if (e.KeyCode == Keys.Enter)
  700. {
  701. sql.Clear();
  702. sql.Append("select pi_id,pi_cardcode,to_char(pi_date,'yyyymmdd')pi_date,nvl(cu_needrecheck,0)cu_needrecheck from prodinout left join customer on cu_code=pi_cardcode where pi_invoicecode='" + pi_invoicecode.Text + "' ");
  703. DataTable dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
  704. ErrorType.Clear();
  705. if (dt.Rows.Count > 0)
  706. {
  707. cu_code.Text = dt.Rows[0]["pi_cardcode"].ToString();
  708. cu_needrecheck.Text = dt.Rows[0]["cu_needrecheck"].ToString();
  709. pi_date.Text = dt.Rows[0]["pi_date"].ToString();
  710. PI_ID = dt.Rows[0]["pi_id"].ToString();
  711. dt = (DataTable)dh.ExecuteSql("select 1 from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "'", "select");
  712. if (dh.GetConfig("AutoBarcode", "ProdInOut!Sale").ToString() != "" && dt.Rows.Count == 0)
  713. {
  714. string Error = "";
  715. string[] param = new string[] { PI_ID, "", Error };
  716. dh.CallProcedure("GetCustBarcode", param);
  717. }
  718. LoadGridData(sender, e);
  719. //设置当前的最大箱号
  720. CurrentItemIndex = 0;
  721. LogManager.DoLog("输入单号【" + pi_inoutno.Text + "】");
  722. }
  723. else
  724. MessageBox.Show("当前出入库单号不存在或者未审核!");
  725. }
  726. }
  727. private void CleanDetail_Click(object sender, EventArgs e)
  728. {
  729. ArrayList<string> DeleteID = new ArrayList<string>();
  730. for (int i = 0; i < LabelInf.RowCount; i++)
  731. {
  732. if (LabelInf.Rows[i].Cells["Choose"].FormattedValue.ToString() == "True")
  733. DeleteID.Add(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString());
  734. }
  735. //勾选了删除的明细之后
  736. if (DeleteID.ToArray().Length > 0)
  737. {
  738. string close = MessageBox.Show(this.ParentForm, "删除后不可恢复,是否确认删除", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
  739. if (close.ToString() == "Yes")
  740. {
  741. dh.BatchInsert("delete from prodiobarcode where pib_id=:pib_id", new string[] { "pib_id" }, DeleteID.ToArray());
  742. MessageBox.Show("删除成功");
  743. LoadGridData(sender, e);
  744. }
  745. }
  746. else
  747. MessageBox.Show("尚未勾选需要删除的明细");
  748. }
  749. private void LoadGridData()
  750. {
  751. LoadGridData(new object(), new EventArgs());
  752. }
  753. /// <summary>
  754. /// 自定义函数 加载明细行的数据,多处使用添加进函数
  755. /// </summary>
  756. /// <param name="sender"></param>
  757. /// <param name="e"></param>
  758. private void LoadGridData(object sender, EventArgs e)
  759. {
  760. sql.Clear();
  761. sql.Append("select * from prodiobarcode_view1 where pib_piid='" + PI_ID + "'");
  762. dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
  763. MidSource.DataSource = dt;
  764. BaseUtil.FillDgvWithDataTable(LabelInf, (DataTable)MidSource.DataSource);
  765. //有数据的话默认取第一条的品牌去取采集策略
  766. TotalCount.Text = LabelInf.RowCount.ToString();
  767. ProcessRemind();
  768. if (LabelInf.RowCount > 0)
  769. {
  770. Brand = LabelInf.Rows[0].Cells["pib_brand"].FormattedValue.ToString();
  771. if (Brand != "")
  772. sg_brand.Text = Brand;
  773. }
  774. //绑定数据之后往下找到未采集的数据显示在当前采集的栏目
  775. for (int i = 0; i < LabelInf.RowCount; i++)
  776. {
  777. if (LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() != "True")
  778. {
  779. griddetno.Text = LabelInf.Rows[i].Cells["pib_pdno"].FormattedValue.ToString();
  780. pr_code.Text = LabelInf.Rows[i].Cells["pib_prodcode"].FormattedValue.ToString();
  781. pib_id.Text = LabelInf.Rows[i].Cells["pib_id1"].FormattedValue.ToString();
  782. CurrentRowIndex = LabelInf.Rows[i].Cells["pib_prodcode"].RowIndex;
  783. break;
  784. }
  785. }
  786. }
  787. /// <summary>
  788. /// 重绘Cell的颜色
  789. /// </summary>
  790. /// <param name="sender"></param>
  791. /// <param name="e"></param>
  792. private void LabelInf_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
  793. {
  794. bool mouseOver = e.CellBounds.Contains(this.PointToClient(Cursor.Position));
  795. if (e.ColumnIndex > 0)
  796. {
  797. if (LabelInf.Columns[e.ColumnIndex].Name == "pib_custbarcode" || LabelInf.Columns[e.ColumnIndex].Name == "pib_barcode" || LabelInf.Columns[e.ColumnIndex].Name == "pib_madein" || LabelInf.Columns[e.ColumnIndex].Name == "pib_lotno" || LabelInf.Columns[e.ColumnIndex].Name == "pib_datecode" || LabelInf.Columns[e.ColumnIndex].Name == "pib_outboxcode1" || LabelInf.Columns[e.ColumnIndex].Name == "pib_outboxcode2" || LabelInf.Columns[e.ColumnIndex].Name == "pib_brand")
  798. {
  799. SolidBrush solidBrush = new SolidBrush(Color.FromArgb(51, 153, 255));
  800. e.Graphics.FillRectangle(mouseOver ? solidBrush : Brushes.LightSeaGreen, e.CellBounds);
  801. Rectangle border = e.CellBounds;
  802. border.Width -= 1;
  803. e.Graphics.DrawRectangle(Pens.White, border);
  804. e.PaintContent(e.CellBounds);
  805. e.Handled = true;
  806. }
  807. if (e.RowIndex >= 0)
  808. {
  809. if (LabelInf.Rows[e.RowIndex].Cells["pib_ifpick"].FormattedValue.ToString() == "True")
  810. {
  811. if (LabelInf.Columns[e.ColumnIndex].Name == "pr_orispeccode" || LabelInf.Columns[e.ColumnIndex].Name == "pd_custprodcode")
  812. {
  813. SolidBrush solidBrush = new SolidBrush(Color.FromArgb(51, 153, 255));
  814. e.Graphics.FillRectangle(Brushes.ForestGreen, e.CellBounds);
  815. Rectangle border = e.CellBounds;
  816. border.Width -= 1;
  817. e.Graphics.DrawRectangle(Pens.Black, border);
  818. e.PaintContent(e.CellBounds);
  819. e.Handled = true;
  820. }
  821. }
  822. }
  823. if (e.RowIndex == CurrentRowIndex)
  824. {
  825. if (LabelInf.Columns[e.ColumnIndex].Name == "pr_orispeccode")
  826. {
  827. SolidBrush solidBrush = new SolidBrush(Color.FromArgb(51, 153, 255));
  828. if (ErrorType.Count > 0)
  829. {
  830. if (ErrorType.Contains("OK_MPN"))
  831. {
  832. e.Graphics.FillRectangle(Brushes.ForestGreen, e.CellBounds);
  833. Rectangle border = e.CellBounds;
  834. border.Width -= 1;
  835. e.Graphics.DrawRectangle(Pens.Black, border);
  836. e.PaintContent(e.CellBounds);
  837. e.Handled = true;
  838. }
  839. else if (ErrorType.Contains("NG_MPN"))
  840. {
  841. e.Graphics.FillRectangle(Brushes.Red, e.CellBounds);
  842. Rectangle border = e.CellBounds;
  843. border.Width -= 1;
  844. e.Graphics.DrawRectangle(Pens.Black, border);
  845. e.PaintContent(e.CellBounds);
  846. e.Handled = true;
  847. }
  848. }
  849. }
  850. if (LabelInf.Columns[e.ColumnIndex].Name == "pd_custprodcode")
  851. {
  852. SolidBrush solidBrush = new SolidBrush(Color.FromArgb(51, 153, 255));
  853. if (ErrorType.Count > 0)
  854. {
  855. if (ErrorType.Contains("OK_CPN"))
  856. {
  857. e.Graphics.FillRectangle(Brushes.ForestGreen, e.CellBounds);
  858. Rectangle border = e.CellBounds;
  859. border.Width -= 1;
  860. e.Graphics.DrawRectangle(Pens.Black, border);
  861. e.PaintContent(e.CellBounds);
  862. e.Handled = true;
  863. }
  864. else if (ErrorType.Contains("NG_CPN"))
  865. {
  866. e.Graphics.FillRectangle(Brushes.Red, e.CellBounds);
  867. Rectangle border = e.CellBounds;
  868. border.Width -= 1;
  869. e.Graphics.DrawRectangle(Pens.Black, border);
  870. e.PaintContent(e.CellBounds);
  871. e.Handled = true;
  872. }
  873. }
  874. }
  875. }
  876. }
  877. }
  878. private void pr_code_SearchIconClick(object sender, EventArgs e)
  879. {
  880. pr_code.Condition = " pd_inoutno='" + pi_inoutno.Text + "'";
  881. }
  882. private void pr_code_UserControlTextChanged(object sender, EventArgs e)
  883. {
  884. //用户在重新勾选后重置采集项目的索引
  885. for (int i = 0; i < LabelInf.RowCount; i++)
  886. {
  887. if (pr_code.Text == LabelInf.Rows[i].Cells["pib_prodcode"].Value.ToString() && LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() != "True")
  888. {
  889. CurrentRowIndex = i;
  890. break;
  891. }
  892. }
  893. }
  894. private void Refresh_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  895. {
  896. KeyEventArgs e2 = new KeyEventArgs(Keys.Enter);
  897. pi_inoutno_KeyDown(sender, e2);
  898. }
  899. /// <summary>
  900. /// 采集明细切换
  901. /// </summary>
  902. /// <param name="sender"></param>
  903. /// <param name="e"></param>
  904. private void griddetno_KeyDown(object sender, KeyEventArgs e)
  905. {
  906. if (Keys.Enter == e.KeyData)
  907. {
  908. bool FindDetno = false;
  909. for (int i = 0; i < LabelInf.RowCount; i++)
  910. {
  911. if (LabelInf.Rows[i].Cells["pib_pdno"].Value.ToString() == griddetno.Text && LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() != "True")
  912. {
  913. FindDetno = true;
  914. CurrentItemIndex = 0;
  915. CurrentRowIndex = i;
  916. RemindUser();
  917. break;
  918. }
  919. }
  920. if (!FindDetno)
  921. {
  922. MessageBox.Show("不存在未采集的明细序号" + griddetno.Text);
  923. return;
  924. }
  925. }
  926. }
  927. private void LogingOut_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  928. {
  929. string close = MessageBox.Show(this.ParentForm, "是否注销", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
  930. if (close.ToString() == "Yes")
  931. {
  932. Login login = new Login();
  933. //注销的时候需要将拼接的连接字符串置空
  934. DataHelper.DBConnectionString = null;
  935. logout = true;
  936. this.Hide();
  937. login.ShowDialog();
  938. this.Close();
  939. }
  940. }
  941. private void LabelInf_DataError(object sender, DataGridViewDataErrorEventArgs e) { }
  942. private void ChooseAll_Click(object sender, EventArgs e)
  943. {
  944. if (AllChecked)
  945. {
  946. foreach (DataGridViewRow dr in LabelInf.Rows)
  947. dr.Cells[0].Value = false;
  948. AllChecked = false;
  949. }
  950. else
  951. {
  952. foreach (DataGridViewRow dr in LabelInf.Rows)
  953. dr.Cells[0].Value = true;
  954. AllChecked = true;
  955. }
  956. }
  957. private void ExportData_Click(object sender, EventArgs e)
  958. {
  959. ExportFileDialog.Description = "选择导出的路径";
  960. DialogResult result = ExportFileDialog.ShowDialog();
  961. if (result == DialogResult.OK)
  962. {
  963. ExcelHandler eh = new ExcelHandler();
  964. DataTable dt = ((DataTable)MidSource.DataSource).Copy();
  965. for (int i = dt.Columns.Count - 1; i >= 0; i--)
  966. {
  967. for (int j = 0; j < LabelInf.Columns.Count; j++)
  968. {
  969. //去除ID列
  970. if (dt.Columns[i].ColumnName.ToLower().Contains("id") || dt.Columns[i].ColumnName.ToLower() == "pib_barcode" || dt.Columns[i].ColumnName.ToLower() == "pib_pdno" || dt.Columns[i].ColumnName.ToLower() == "pib_ifpick" || dt.Columns[i].ColumnName.ToLower() == "pib_ifprint" || dt.Columns[i].ColumnName.ToLower() == "pib_datecode1" || dt.Columns[i].ColumnName.ToLower() == "pr_vendprodcode")
  971. {
  972. dt.Columns.RemoveAt(i);
  973. break;
  974. }
  975. switch (dt.Columns[i].ColumnName.ToLower())
  976. {
  977. case "pib_lotno":
  978. dt.Columns[i].ColumnName = "批次号";
  979. break;
  980. case "pib_datecode":
  981. dt.Columns[i].ColumnName = "生产日期";
  982. break;
  983. case "pib_custbarcode":
  984. dt.Columns[i].ColumnName = "最小产品包装条码";
  985. break;
  986. default:
  987. break;
  988. }
  989. if (dt.Columns[i].ColumnName.ToLower() == LabelInf.Columns[j].DataPropertyName.ToLower())
  990. {
  991. dt.Columns[i].ColumnName = LabelInf.Columns[j].HeaderText;
  992. break;
  993. }
  994. }
  995. }
  996. eh.ExportExcel(dt, ExportFileDialog.SelectedPath, pi_date.Text + "-" + pi_inoutno.Text);
  997. string close = MessageBox.Show(this.ParentForm, "导出成功,是否打开文件", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
  998. if (close.ToString() == "Yes")
  999. System.Diagnostics.Process.Start(ExportFileDialog.SelectedPath + "\\" + pi_date.Text + "-" + pi_inoutno.Text + ".xls");
  1000. }
  1001. }
  1002. private void CleanBarCode_Click(object sender, EventArgs e)
  1003. {
  1004. string close = MessageBox.Show(this.ParentForm, "是否清除该出货单条码", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
  1005. if (close.ToString() == "Yes")
  1006. {
  1007. dh.ExecuteSql("delete from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "'", "delete");
  1008. LoadGridData(sender, e);
  1009. }
  1010. }
  1011. private void CollectAll_Click(object sender, EventArgs e)
  1012. {
  1013. int PickedCount = 0;
  1014. for (int i = 0; i < LabelInf.Rows.Count; i++)
  1015. {
  1016. if (LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() != "True")
  1017. {
  1018. LabelInf.Rows[i].Cells["pib_ifpick"].Value = true;
  1019. }
  1020. else
  1021. {
  1022. PickedCount = PickedCount + 1;
  1023. }
  1024. }
  1025. if (PickedCount == LabelInf.Rows.Count)
  1026. {
  1027. for (int i = 0; i < LabelInf.Rows.Count; i++)
  1028. {
  1029. LabelInf.Rows[i].Cells["pib_ifpick"].Value = false;
  1030. }
  1031. }
  1032. }
  1033. private void CheckRecheckStatus()
  1034. {
  1035. if (cu_needrecheck.Text == "0")
  1036. {
  1037. dh.ExecuteSql("update customer set cu_needrecheck=-1 where cu_code='" + cu_code.Text + "'", "update");
  1038. }
  1039. if (dh.getRowCount("prodiobarcode", "nvl(pib_ifpick,0)<>0 and pib_inoutno='" + pi_inoutno.Text + "'") == LabelInf.Rows.Count)
  1040. {
  1041. dh.ExecuteSql("update prodinout set pi_recheckstatus='已复核' where pi_inoutno='" + pi_inoutno.Text + "'", "update");
  1042. }
  1043. }
  1044. }
  1045. }