f7219df390c962339287e5d150f4e0414e8ccd6a.svn-base 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Collections;
  9. using System.Windows.Forms;
  10. using CoreFS.CA06;
  11. namespace Core.LZMes.Client.UIM
  12. {
  13. public partial class UIM010181 : FrmBase
  14. {
  15. private int selectedIndex1 = -1;
  16. private int selectedIndex2 = -1;
  17. private int selectedIndex3 = -1;
  18. private bool rowClick1 = false;
  19. private bool rowClick2 = false;
  20. private bool rowClick3 = false;
  21. private ArrayList moveList = new ArrayList();
  22. public UIM010181()
  23. {
  24. InitializeComponent();
  25. }
  26. public override void ToolBar_Click(object sender, string ToolbarKey)
  27. {
  28. switch (ToolbarKey)
  29. {
  30. case "Query":
  31. this.DoQuery();
  32. break;
  33. case "Save":
  34. this.DoSave();
  35. break;
  36. case "Export":
  37. this.DoExport();
  38. break;
  39. case "Exit":
  40. this.Close();
  41. break;
  42. }
  43. }
  44. private void DoQuery()
  45. {
  46. ultraComboEditor1_ValueChanged(null, null);
  47. ultraComboEditor2_ValueChanged(null, null);
  48. ultraComboEditor3_ValueChanged(null, null);
  49. }
  50. private void DoSave()
  51. {
  52. //移垛时间
  53. string moveDate = "";
  54. if (this.ultraDateTimeEditor1.Value != null)
  55. {
  56. moveDate = this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMddHHmmss");
  57. }
  58. string regId = this.UserInfo.GetUserID();
  59. string moveOrder = this.UserInfo.GetUserOrder();//班次
  60. string moverGroup = this.UserInfo.GetUserGroup();//班组
  61. CoreClientParam ccp = new CoreClientParam();
  62. ccp.ServerName = "UIM.UIM010181";
  63. ccp.MethodName = "moveColdCoil";
  64. ccp.ServerParams = new object[] { moveList, regId, moveOrder, moverGroup, moveDate };
  65. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  66. this.DoQuery();
  67. }
  68. private void DoExport()
  69. {
  70. Microsoft.Office.Interop.Excel.Application excel = null;
  71. ET.Application et = null;
  72. int row = 0;
  73. try
  74. {
  75. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  76. {
  77. System.Reflection.Missing oMissing = System.Reflection.Missing.Value;
  78. string filePath = saveFileDialog1.FileName;
  79. int[] idxs = new int[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
  80. if (isExcelInstalled())
  81. {
  82. excel = new Microsoft.Office.Interop.Excel.Application();
  83. Microsoft.Office.Interop.Excel.Workbook workbook = excel.Application.Workbooks.Add(oMissing);
  84. //excel.Visible = true;
  85. Microsoft.Office.Interop.Excel.Worksheet ws = (Microsoft.Office.Interop.Excel.Worksheet)workbook.Worksheets.get_Item(1);
  86. foreach (DataRow dr in yardDS.Tables[0].Rows)
  87. {
  88. row = Convert.ToInt32(dr["VROW"]);
  89. row = row%10 != 0 ? row%10 : 10;
  90. ws.Cells[idxs[row - 1], row] = dr["YARD"].ToString();
  91. idxs[row - 1]++;
  92. }
  93. workbook.SaveAs(filePath, oMissing, oMissing, oMissing, oMissing, oMissing, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlShared, oMissing, oMissing, oMissing, oMissing, oMissing);
  94. workbook.Close(oMissing, oMissing, oMissing);
  95. excel.Quit();
  96. }
  97. else
  98. {
  99. et = new ET.Application();
  100. ET._Workbook ewb = et.Workbooks.Add(oMissing);
  101. ET.Worksheet ews = (ET.Worksheet)ewb.Worksheets.get_Item(1);
  102. foreach (DataRow dr in yardDS.Tables[0].Rows)
  103. {
  104. row = Convert.ToInt32(dr["VROW"]);
  105. row = row % 10 != 0 ? row % 10 : 10;
  106. ews.Cells[idxs[row - 1], row] = dr["YARD"].ToString();
  107. idxs[row - 1]++;
  108. }
  109. ewb.SaveAs(filePath, oMissing, oMissing, oMissing, oMissing, oMissing, ET.ETSaveAsAccessMode.etShared, oMissing, oMissing, oMissing, oMissing);
  110. ewb.Close(oMissing,oMissing,oMissing);
  111. et.Quit();
  112. }
  113. }
  114. }
  115. catch (Exception ex)
  116. {
  117. MessageBox.Show("导出失败!");
  118. }
  119. finally
  120. {
  121. System.Runtime.InteropServices.Marshal.ReleaseComObject(excel);
  122. System.Runtime.InteropServices.Marshal.ReleaseComObject(et);
  123. excel = null;
  124. et = null;
  125. GC.Collect();
  126. }
  127. }
  128. private void UIM010181_Load(object sender, EventArgs e)
  129. {
  130. loadYardArea();
  131. }
  132. private void loadYardArea()
  133. {
  134. int areaType = 2;
  135. //查询区域信息
  136. CoreClientParam ccp = new CoreClientParam();
  137. ccp.ServerName = "UIM.UIM010181";
  138. ccp.MethodName = "queryYardAreas";
  139. ccp = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  140. ArrayList list = (ArrayList)ccp.ReturnObject;
  141. int listSize = list.Count;
  142. Infragistics.Win.ValueListItem[] valueListItems1 = new Infragistics.Win.ValueListItem[listSize];
  143. Infragistics.Win.ValueListItem[] valueListItems2 = new Infragistics.Win.ValueListItem[listSize];
  144. Infragistics.Win.ValueListItem[] valueListItems3 = new Infragistics.Win.ValueListItem[listSize];
  145. for (int i = 0; i < listSize; i++)
  146. {
  147. Infragistics.Win.ValueListItem item1 = new Infragistics.Win.ValueListItem();
  148. Infragistics.Win.ValueListItem item2 = new Infragistics.Win.ValueListItem();
  149. Infragistics.Win.ValueListItem item3 = new Infragistics.Win.ValueListItem();
  150. Hashtable ht = (Hashtable)list[i];
  151. item1.DataValue = ((Hashtable)(ht["AREA_NO"]))["value"].ToString();
  152. item1.DisplayText = ht["AREA_NAME"].ToString();
  153. item2.DataValue = ((Hashtable)(ht["AREA_NO"]))["value"].ToString();
  154. item2.DisplayText = ht["AREA_NAME"].ToString();
  155. item3.DataValue = ((Hashtable)(ht["AREA_NO"]))["value"].ToString();
  156. item3.DisplayText = ht["AREA_NAME"].ToString();
  157. valueListItems1[i] = item1;
  158. valueListItems2[i] = item2;
  159. valueListItems3[i] = item3;
  160. }
  161. this.ultraComboEditor1.Items.AddRange(valueListItems1);
  162. this.ultraComboEditor2.Items.AddRange(valueListItems2);
  163. this.ultraComboEditor3.Items.AddRange(valueListItems3);
  164. }
  165. /// <summary>
  166. /// 根据钢卷号查询垛位
  167. /// </summary>
  168. private void findLoadLoc()
  169. {
  170. string coilNo = this.textBox1.Text.Trim();
  171. if ("".Equals(coilNo))
  172. {
  173. MessageBox.Show("请输入冷轧钢卷号!");
  174. return;
  175. }
  176. CoreClientParam ccp = new CoreClientParam();
  177. ccp.ServerName = "UIM.UIM010181";
  178. ccp.MethodName = "queryLoadLoc";
  179. ccp.ServerParams = new object[] { coilNo };
  180. ccp = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  181. string curLoadLoc = ccp.ReturnObject.ToString();
  182. this.textBox2.Text = curLoadLoc;
  183. }
  184. private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
  185. {
  186. if (13 == e.KeyChar)
  187. {
  188. findLoadLoc();
  189. }
  190. }
  191. private void button1_Click(object sender, EventArgs e)
  192. {
  193. findLoadLoc();
  194. }
  195. private void ultraComboEditor1_ValueChanged(object sender, EventArgs e)
  196. {
  197. moveList = new ArrayList();
  198. if (ultraComboEditor1.Value != null)
  199. {
  200. dataSet1.Tables[0].Clear();
  201. CoreClientParam ccp = new CoreClientParam();
  202. ccp.ServerName = "UIM.UIM010181";
  203. ccp.MethodName = "queryYardCoils";
  204. ccp.ServerParams = new object[] { ultraComboEditor1.Text };
  205. ccp.SourceDataTable = dataSet1.Tables[0];
  206. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  207. }
  208. //查询空余垛位
  209. yardDS.Tables[0].Clear();
  210. CoreClientParam ccp1 = new CoreClientParam();
  211. ccp1.ServerName = "UIM.UIM010181";
  212. ccp1.MethodName = "queryEmptyYards";
  213. ccp1.ServerParams = new object[] { ultraComboEditor1.Text };
  214. ccp1.SourceDataTable = yardDS.Tables[0];
  215. this.ExecuteQueryToDataTable(ccp1, CoreInvokeType.Internal);
  216. if (sender == null)
  217. {
  218. return;
  219. }
  220. ultraComboEditor2_ValueChanged(null, null);
  221. ultraComboEditor3_ValueChanged(null, null);
  222. }
  223. private void ultraComboEditor2_ValueChanged(object sender, EventArgs e)
  224. {
  225. if (ultraComboEditor2.Value != null)
  226. {
  227. dataSet2.Tables[0].Clear();
  228. CoreClientParam ccp = new CoreClientParam();
  229. ccp.ServerName = "UIM.UIM010181";
  230. ccp.MethodName = "queryYardCoils";
  231. ccp.ServerParams = new object[] { ultraComboEditor2.Text };
  232. ccp.SourceDataTable = dataSet2.Tables[0];
  233. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  234. }
  235. if (sender == null)
  236. {
  237. return;
  238. }
  239. ultraComboEditor1_ValueChanged(null, null);
  240. ultraComboEditor3_ValueChanged(null, null);
  241. }
  242. private void ultraComboEditor3_ValueChanged(object sender, EventArgs e)
  243. {
  244. if (ultraComboEditor3.Value != null)
  245. {
  246. dataSet3.Tables[0].Clear();
  247. CoreClientParam ccp = new CoreClientParam();
  248. ccp.ServerName = "UIM.UIM010181";
  249. ccp.MethodName = "queryYardCoils";
  250. ccp.ServerParams = new object[] { ultraComboEditor3.Text };
  251. ccp.SourceDataTable = dataSet3.Tables[0];
  252. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  253. }
  254. if (sender == null)
  255. {
  256. return;
  257. }
  258. ultraComboEditor1_ValueChanged(null, null);
  259. ultraComboEditor2_ValueChanged(null, null);
  260. }
  261. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  262. {
  263. if (e == null)
  264. {
  265. rowClick1 = true;
  266. }
  267. if (rowClick1 && e != null)
  268. {
  269. rowClick1 = false;
  270. return;
  271. }
  272. if (ultraGrid1.ActiveRow != null)
  273. {
  274. if (selectedIndex1 > -1 && ultraGrid1.ActiveRow.Index != selectedIndex1)
  275. {
  276. ultraGrid1.Rows[selectedIndex1].Cells["CHK"].Value = "FALSE";
  277. }
  278. ultraGrid1.Rows[ultraGrid1.ActiveRow.Index].Cells["CHK"].Value = ultraGrid1.Rows[ultraGrid1.ActiveRow.Index].Cells["CHK"].Value.ToString().Equals("TRUE") ? "FALSE" : "TRUE";
  279. selectedIndex1 = ultraGrid1.ActiveRow.Index;
  280. }
  281. }
  282. private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
  283. {
  284. if (e == null)
  285. {
  286. rowClick2 = true;
  287. }
  288. if (rowClick2 && e != null)
  289. {
  290. rowClick2 = false;
  291. return;
  292. }
  293. if (ultraGrid2.ActiveRow != null)
  294. {
  295. if (selectedIndex2 > -1 && ultraGrid2.ActiveRow.Index != selectedIndex2)
  296. {
  297. ultraGrid2.Rows[selectedIndex2].Cells["CHK"].Value = "FALSE";
  298. }
  299. ultraGrid2.Rows[ultraGrid2.ActiveRow.Index].Cells["CHK"].Value = ultraGrid2.Rows[ultraGrid2.ActiveRow.Index].Cells["CHK"].Value.ToString().Equals("TRUE") ? "FALSE" : "TRUE";
  300. selectedIndex2 = ultraGrid2.ActiveRow.Index;
  301. }
  302. }
  303. private void ultraGrid3_AfterRowActivate(object sender, EventArgs e)
  304. {
  305. if (e == null)
  306. {
  307. rowClick3 = true;
  308. }
  309. if (rowClick3 && e != null)
  310. {
  311. rowClick3 = false;
  312. return;
  313. }
  314. if (ultraGrid3.ActiveRow != null)
  315. {
  316. if (selectedIndex3 > -1 && ultraGrid3.ActiveRow.Index != selectedIndex3)
  317. {
  318. ultraGrid3.Rows[selectedIndex3].Cells["CHK"].Value = "FALSE";
  319. }
  320. ultraGrid3.Rows[ultraGrid3.ActiveRow.Index].Cells["CHK"].Value = ultraGrid3.Rows[ultraGrid3.ActiveRow.Index].Cells["CHK"].Value.ToString().Equals("TRUE") ? "FALSE" : "TRUE";
  321. selectedIndex3 = ultraGrid3.ActiveRow.Index;
  322. }
  323. }
  324. private void ultraGrid1_MouseClick(object sender, MouseEventArgs e)
  325. {
  326. ultraGrid1_AfterRowActivate(null, null);
  327. }
  328. private void ultraGrid2_MouseClick(object sender, MouseEventArgs e)
  329. {
  330. ultraGrid2_AfterRowActivate(null, null);
  331. }
  332. private void ultraGrid3_MouseClick(object sender, MouseEventArgs e)
  333. {
  334. ultraGrid3_AfterRowActivate(null, null);
  335. }
  336. private void pictureBox1_MouseEnter(object sender, EventArgs e)
  337. {
  338. this.toolTip1.Show("从原堆放位置->临时堆放位置", this.pictureBox1);
  339. }
  340. private void pictureBox2_MouseEnter(object sender, EventArgs e)
  341. {
  342. this.toolTip1.Show("从到堆放位置->原堆放位置或从临时堆放位置->原堆放位置", this.pictureBox2);
  343. }
  344. private void pictureBox3_MouseEnter(object sender, EventArgs e)
  345. {
  346. this.toolTip1.Show("从原堆放位置->到堆放位置或从临时堆放位置->到堆放位置", this.pictureBox3);
  347. }
  348. private void pictureBox4_MouseEnter(object sender, EventArgs e)
  349. {
  350. this.toolTip1.Show("从到堆放位置->临时堆放位置", this.pictureBox4);
  351. }
  352. /// <summary>
  353. /// 从原堆放位置->临时堆放位置
  354. /// </summary>
  355. /// <param name="sender"></param>
  356. /// <param name="e"></param>
  357. private void pictureBox1_Click(object sender, EventArgs e)
  358. {
  359. string[] mCoil = null;
  360. int fromRowCount = dataSet1.Tables[0].Rows.Count;
  361. for (int i = 0; i < fromRowCount; i++)
  362. {
  363. Infragistics.Win.UltraWinGrid.UltraGridRow fromUGR = ultraGrid1.Rows[i];
  364. if (fromUGR.Cells["CHK"].Value.ToString().ToUpper().Equals("TRUE"))
  365. {
  366. if (fromUGR.Cells["COIL_NO"].Value == null || fromUGR.Cells["COIL_NO"].Value.ToString().Equals(""))
  367. {
  368. MessageBox.Show("原堆放位置上没有钢卷,请重新选择!");
  369. return;
  370. }
  371. int tmpRowCount = dataSet2.Tables[0].Rows.Count;
  372. for (int j = 0; j < tmpRowCount; j++)
  373. {
  374. Infragistics.Win.UltraWinGrid.UltraGridRow tmpUGR = ultraGrid2.Rows[j];
  375. if (tmpUGR.Cells["CHK"].Value.ToString().ToUpper().Equals("TRUE"))
  376. {
  377. if (tmpUGR.Cells["COIL_NO"].Value != null && !tmpUGR.Cells["COIL_NO"].Value.ToString().Equals(""))
  378. {
  379. MessageBox.Show("临时堆放位置上存在钢卷,请重新选择!");
  380. return;
  381. }
  382. mCoil = new string[3];
  383. mCoil[0] = fromUGR.Cells["CUR_LOAD_LOC"].Value.ToString();
  384. mCoil[2] = fromUGR.Cells["COIL_NO"].Value.ToString();
  385. mCoil[1] = tmpUGR.Cells["CUR_LOAD_LOC"].Value.ToString();
  386. moveList.Add(mCoil);
  387. fromUGR.Cells["COIL_NO"].Value = "";
  388. tmpUGR.Cells["COIL_NO"].Value = mCoil[2];
  389. break;
  390. }
  391. }
  392. break;
  393. }
  394. }
  395. }
  396. /// <summary>
  397. /// 从到堆放位置->临时堆放位置
  398. /// </summary>
  399. /// <param name="sender"></param>
  400. /// <param name="e"></param>
  401. private void pictureBox4_Click(object sender, EventArgs e)
  402. {
  403. string[] mCoil = null;
  404. int toRowCount = dataSet3.Tables[0].Rows.Count;
  405. for (int i = 0; i < toRowCount; i++)
  406. {
  407. Infragistics.Win.UltraWinGrid.UltraGridRow toUGR = ultraGrid3.Rows[i];
  408. if (toUGR.Cells["CHK"].Value.ToString().ToUpper().Equals("TRUE"))
  409. {
  410. if (toUGR.Cells["COIL_NO"].Value == null || toUGR.Cells["COIL_NO"].Value.ToString().Equals(""))
  411. {
  412. MessageBox.Show("到堆放位置上没有钢卷,请重新选择!");
  413. return;
  414. }
  415. int tmpRowCount = dataSet2.Tables[0].Rows.Count;
  416. for (int j = 0; j < tmpRowCount; j++)
  417. {
  418. Infragistics.Win.UltraWinGrid.UltraGridRow tmpUGR = ultraGrid2.Rows[j];
  419. if (tmpUGR.Cells["CHK"].Value.ToString().ToUpper().Equals("TRUE"))
  420. {
  421. if (tmpUGR.Cells["COIL_NO"].Value != null && !tmpUGR.Cells["COIL_NO"].Value.ToString().Equals(""))
  422. {
  423. MessageBox.Show("临时堆放位置上存在钢卷,请重新选择!");
  424. return;
  425. }
  426. mCoil = new string[3];
  427. mCoil[0] = toUGR.Cells["CUR_LOAD_LOC"].Value.ToString();
  428. mCoil[2] = toUGR.Cells["COIL_NO"].Value.ToString();
  429. mCoil[1] = tmpUGR.Cells["CUR_LOAD_LOC"].Value.ToString();
  430. moveList.Add(mCoil);
  431. toUGR.Cells["COIL_NO"].Value = "";
  432. tmpUGR.Cells["COIL_NO"].Value = mCoil[2];
  433. break;
  434. }
  435. }
  436. break;
  437. }
  438. }
  439. }
  440. /// <summary>
  441. /// 从原堆放位置->到堆放位置或从临时堆放位置->到堆放位置
  442. /// </summary>
  443. /// <param name="sender"></param>
  444. /// <param name="e"></param>
  445. private void pictureBox3_Click(object sender, EventArgs e)
  446. {
  447. string[] mCoil = new string[3];
  448. int fromRowCount = dataSet1.Tables[0].Rows.Count;
  449. Infragistics.Win.UltraWinGrid.UltraGridRow fromUGR = null;
  450. for (int i = 0; i < fromRowCount; i++)
  451. {
  452. fromUGR = ultraGrid1.Rows[i];
  453. if (fromUGR.Cells["CHK"].Value.ToString().ToUpper().Equals("TRUE"))
  454. {
  455. if (fromUGR.Cells["CUR_LOAD_LOC"].Value != null && !fromUGR.Cells["CUR_LOAD_LOC"].Value.ToString().Equals(""))
  456. {
  457. mCoil[0] = fromUGR.Cells["CUR_LOAD_LOC"].Value.ToString();
  458. mCoil[2] = fromUGR.Cells["COIL_NO"].Value.ToString();
  459. }
  460. break;
  461. }
  462. }
  463. int tmpRowCount = dataSet2.Tables[0].Rows.Count;
  464. Infragistics.Win.UltraWinGrid.UltraGridRow tmpUGR = null;
  465. for (int i = 0; i < tmpRowCount; i++)
  466. {
  467. tmpUGR = ultraGrid2.Rows[i];
  468. if (tmpUGR.Cells["CHK"].Value.ToString().ToUpper().Equals("TRUE"))
  469. {
  470. if (tmpUGR.Cells["CUR_LOAD_LOC"].Value != null && !tmpUGR.Cells["CUR_LOAD_LOC"].Value.ToString().Equals(""))
  471. {
  472. if (mCoil[0] != null && !mCoil[0].Equals(""))
  473. {
  474. MessageBox.Show("原堆放位置和临时堆放位置不能同时选中,请确认后再重新选择!");
  475. return;
  476. }
  477. mCoil[0] = tmpUGR.Cells["CUR_LOAD_LOC"].Value.ToString();
  478. mCoil[2] = tmpUGR.Cells["COIL_NO"].Value.ToString();
  479. }
  480. break;
  481. }
  482. }
  483. int toRowCount = dataSet3.Tables[0].Rows.Count;
  484. Infragistics.Win.UltraWinGrid.UltraGridRow toUGR = null;
  485. for (int i = 0; i < toRowCount; i++)
  486. {
  487. toUGR = ultraGrid3.Rows[i];
  488. if (toUGR.Cells["CHK"].Value.ToString().ToUpper().Equals("TRUE"))
  489. {
  490. if (toUGR.Cells["COIL_NO"].Value != null && !toUGR.Cells["COIL_NO"].Value.ToString().Equals(""))
  491. {
  492. MessageBox.Show("到堆放位置上存在钢卷,请确认后再重新选择!");
  493. return;
  494. }
  495. mCoil[1] = toUGR.Cells["CUR_LOAD_LOC"].Value.ToString();
  496. break;
  497. }
  498. }
  499. if (mCoil[1] == null || mCoil[1].Equals(""))
  500. {
  501. MessageBox.Show("原堆放位置或临时堆放位置没有选中的钢卷,请确认后再重新选择!");
  502. return;
  503. }
  504. if (mCoil[2] == null || mCoil[2].Equals(""))
  505. {
  506. MessageBox.Show("没有选择到堆放位置,请确认后再重新选择!");
  507. return;
  508. }
  509. moveList.Add(mCoil);
  510. if (fromUGR != null && fromUGR.Cells["COIL_NO"].Value != null && !fromUGR.Cells["COIL_NO"].Value.ToString().Equals(""))
  511. {
  512. fromUGR.Cells["COIL_NO"].Value = "";
  513. }
  514. else
  515. {
  516. tmpUGR.Cells["COIL_NO"].Value = "";
  517. }
  518. toUGR.Cells["COIL_NO"].Value = mCoil[2];
  519. }
  520. /// <summary>
  521. /// 从到堆放位置->原堆放位置或从临时堆放位置->原堆放位置
  522. /// </summary>
  523. /// <param name="sender"></param>
  524. /// <param name="e"></param>
  525. private void pictureBox2_Click(object sender, EventArgs e)
  526. {
  527. string[] mCoil = new string[3];
  528. int toRowCount = dataSet3.Tables[0].Rows.Count;
  529. Infragistics.Win.UltraWinGrid.UltraGridRow toUGR = null;
  530. for (int i = 0; i < toRowCount; i++)
  531. {
  532. toUGR = ultraGrid3.Rows[i];
  533. if (toUGR.Cells["CHK"].Value.ToString().ToUpper().Equals("TRUE"))
  534. {
  535. if (toUGR.Cells["CUR_LOAD_LOC"].Value != null && !toUGR.Cells["CUR_LOAD_LOC"].Value.ToString().Equals(""))
  536. {
  537. mCoil[0] = toUGR.Cells["CUR_LOAD_LOC"].Value.ToString();
  538. mCoil[2] = toUGR.Cells["COIL_NO"].Value.ToString();
  539. }
  540. break;
  541. }
  542. }
  543. int tmpRowCount = dataSet2.Tables[0].Rows.Count;
  544. Infragistics.Win.UltraWinGrid.UltraGridRow tmpUGR = null;
  545. for (int i = 0; i < tmpRowCount; i++)
  546. {
  547. tmpUGR = ultraGrid2.Rows[i];
  548. if (tmpUGR.Cells["CHK"].Value.ToString().ToUpper().Equals("TRUE"))
  549. {
  550. if (tmpUGR.Cells["CUR_LOAD_LOC"].Value != null && !tmpUGR.Cells["CUR_LOAD_LOC"].Value.ToString().Equals(""))
  551. {
  552. if (mCoil[0] != null && !mCoil[0].Equals(""))
  553. {
  554. MessageBox.Show("到堆放位置和临时堆放位置不能同时选中,请确认后再重新选择!");
  555. return;
  556. }
  557. mCoil[0] = tmpUGR.Cells["CUR_LOAD_LOC"].Value.ToString();
  558. mCoil[2] = tmpUGR.Cells["COIL_NO"].Value.ToString();
  559. }
  560. break;
  561. }
  562. }
  563. int fromRowCount = dataSet1.Tables[0].Rows.Count;
  564. Infragistics.Win.UltraWinGrid.UltraGridRow fromUGR = null;
  565. for (int i = 0; i < fromRowCount; i++)
  566. {
  567. fromUGR = ultraGrid1.Rows[i];
  568. if (fromUGR.Cells["CHK"].Value.ToString().ToUpper().Equals("TRUE"))
  569. {
  570. if (fromUGR.Cells["COIL_NO"].Value != null && !fromUGR.Cells["COIL_NO"].Value.ToString().Equals(""))
  571. {
  572. MessageBox.Show("原堆放位置上存在钢卷,请确认后再重新选择!");
  573. return;
  574. }
  575. mCoil[1] = fromUGR.Cells["CUR_LOAD_LOC"].Value.ToString();
  576. break;
  577. }
  578. }
  579. if (mCoil[2] == null || mCoil[2].Equals(""))
  580. {
  581. MessageBox.Show("到堆放位置或临时堆放位置没有选中的钢卷,请确认后再重新选择!");
  582. return;
  583. }
  584. if (mCoil[1] == null || mCoil[1].Equals(""))
  585. {
  586. MessageBox.Show("没有选择原堆放位置,请确认后再重新选择!");
  587. return;
  588. }
  589. moveList.Add(mCoil);
  590. if (toUGR != null && toUGR.Cells["COIL_NO"].Value != null && !toUGR.Cells["COIL_NO"].Value.ToString().Equals(""))
  591. {
  592. toUGR.Cells["COIL_NO"].Value = "";
  593. }
  594. else
  595. {
  596. tmpUGR.Cells["COIL_NO"].Value = "";
  597. }
  598. fromUGR.Cells["COIL_NO"].Value = mCoil[2];
  599. }
  600. private void pictureBox1_MouseLeave(object sender, EventArgs e)
  601. {
  602. this.toolTip1.Hide(this.pictureBox1);
  603. }
  604. private void pictureBox2_MouseLeave(object sender, EventArgs e)
  605. {
  606. this.toolTip1.Hide(this.pictureBox2);
  607. }
  608. private void pictureBox3_MouseLeave(object sender, EventArgs e)
  609. {
  610. this.toolTip1.Hide(this.pictureBox3);
  611. }
  612. private void pictureBox4_MouseLeave(object sender, EventArgs e)
  613. {
  614. this.toolTip1.Hide(this.pictureBox4);
  615. }
  616. public bool isExcelInstalled()
  617. {
  618. Type type = Type.GetTypeFromProgID("Excel.Application");
  619. return type != null;
  620. }
  621. }
  622. }