FrmMchBase.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Drawing;
  5. using System.Linq;
  6. using System.Windows.Forms;
  7. using Core.Mes.Client.Comm;
  8. using Core.Mes.Client.Comm.Control;
  9. using Core.Mes.Client.Comm.Server;
  10. using Core.Mes.Client.Comm.Tool;
  11. using Core.StlMes.Client.Mcp.Control;
  12. using Core.StlMes.Client.Mcp.Control.Common;
  13. using Core.StlMes.Client.Mcp.Control.Entity;
  14. using Core.StlMes.Client.Mcp.Control.Machining;
  15. using CoreFS.CA06;
  16. using Infragistics.Win.UltraWinEditors;
  17. using Infragistics.Win.UltraWinGrid;
  18. using System.Threading;
  19. namespace Core.StlMes.Client.Mcp.Mch.MchResult
  20. {
  21. public partial class FrmMchBase : FrmBase
  22. {
  23. protected MchControlBase mchControlBase1 = null;
  24. private string[] plineCodes;
  25. private bool isViewDelete = false;
  26. public FrmMchBase()
  27. {
  28. InitializeComponent();
  29. }
  30. public string DefaultGx = "";
  31. public string Gx
  32. {
  33. get { return mchControlBase1 == null ? DefaultGx : mchControlBase1.gx; }
  34. }
  35. public bool IsViewDelete
  36. {
  37. get { return isViewDelete; }
  38. set { isViewDelete = value; }
  39. }
  40. public PlnZyJgxCEntity ActiveRow
  41. {
  42. get
  43. {
  44. if (ultraGrid1.ActiveRow == null) return null;
  45. return ultraGrid1.ActiveRow.ListObject as PlnZyJgxCEntity;
  46. }
  47. }
  48. protected virtual UltraGridRow ActitveResultRow
  49. {
  50. get { return null; }
  51. }
  52. protected virtual object Value
  53. {
  54. get { return null; }
  55. }
  56. protected override void OnLoad(EventArgs e)
  57. {
  58. base.OnLoad(e);
  59. EntityHelper.ShowGridCaption<PlnZyJgxCEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  60. commHelper.RefreshAndAutoSize(ultraGrid1);
  61. ultraGrid1.DisplayLayout.Bands[0].Override.HeaderClickAction = HeaderClickAction.Select;
  62. if(ob==null) return;
  63. plineCodes = comm.InitDropPlinePower("G",ucePline, ValidDataPurviewIds,this.CustomInfo, ob);
  64. comm.InitDroCheckStation("G", uceFactory, ValidDataPurviewIds, ob);
  65. if (mchControlBase1 != null)
  66. {
  67. mchControlBase1.Ob = ob;
  68. mchControlBase1.DisableFiltering();
  69. var f1 = new Font("宋体", 11F, FontStyle.Bold);
  70. mchControlBase1.SetFont(f1);
  71. }
  72. portMchBatchControl1.ob = ob;
  73. portMchBatchControl1.userName = this.UserInfo.GetUserName();
  74. portMchBatchControl1.Shift = this.UserInfo.GetUserOrder();
  75. portMchBatchControl1.Group = this.UserInfo.GetUserGroup();
  76. portMchBatchControl1.DisableFiltering();
  77. ultraGrid1.DisplayLayout.Bands[0].Columns["MeasureCount"].Hidden = true;
  78. ultraGrid1.DisplayLayout.Bands[0].Columns["ProDate"].Hidden = true;
  79. ultraGrid1.DisplayLayout.Bands[0].Columns["CurrentStatus"].Hidden = true;
  80. ultraGrid1.DisplayLayout.Bands[0].Columns["BesideDate"].Hidden = true;
  81. ultraGrid1.DisplayLayout.Bands[0].Columns["BatchNo"].MergedCellStyle = MergedCellStyle.Always;
  82. ultraGrid1.DisplayLayout.Bands[0].Columns["BatchNo"].MergedCellEvaluator =
  83. new CustomMergedCellEvaluator(new[] { "JudgeStoveNo" });
  84. ultraGrid1.DisplayLayout.Bands[0].Columns["ProCount"].EditorComponent = uteCard;
  85. }
  86. public override void ToolBar_Click(object sender, string ToolbarKey)
  87. {
  88. switch (ToolbarKey)
  89. {
  90. case "DoQuery":
  91. Query(true);
  92. break;
  93. case "DoAdd":
  94. DoAdd();
  95. break;
  96. case "DoAddNew":
  97. DoAddNew();
  98. break;
  99. case "DoDelete":
  100. DoDelete();
  101. break;
  102. case "DoForceDelete":
  103. DoForceDelete();
  104. break;
  105. case "DoUpdate":
  106. DoUpdate();
  107. break;
  108. case "DoBeside":
  109. DoBeside();
  110. break;
  111. case "CelBeside":
  112. DoCelBeside();
  113. break;
  114. case "doBesideQuery":
  115. DoBesideQuery();
  116. break;
  117. case "doPrint":
  118. DoTransferPrint();
  119. break;
  120. case "SetGroup":
  121. SetGroup();
  122. break;
  123. case "SetMesureData":
  124. SetMesureData();
  125. break;
  126. case "Export":
  127. Globals.ulGridToExcel(ultraGrid1, Text);
  128. break;
  129. case "DoClose":
  130. Close();
  131. break;
  132. case "DoApproval":
  133. DoApproval();
  134. break;
  135. case "DoCancleApproval":
  136. DoCancleApproval();
  137. break;
  138. case "Print":
  139. Print();
  140. break;
  141. case "UpLoad":
  142. UpLoad();
  143. break;
  144. case "updateLen":
  145. updateLen();
  146. break;
  147. }
  148. }
  149. private void updateLen()
  150. {
  151. if (ActiveRow == null)
  152. {
  153. MessageUtil.ShowTips("请选择需要炉计划!");
  154. return;
  155. }
  156. var ccp = new CoreClientParam();
  157. ccp.ServerName = "com.steering.mes.mcp.Mch.MchComm";
  158. ccp.MethodName = "updateLen";
  159. ccp.ServerParams = new object[] { ActiveRow.OrderNo, ActiveRow.OrderSeq, ActiveRow.BatchGroudNo };
  160. ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  161. if (ccp.ReturnCode != -1)
  162. {
  163. MessageUtil.ShowTips(ccp.ReturnInfo);
  164. if (ccp.ReturnInfo.Equals("操作成功!"))
  165. Query();
  166. }
  167. }
  168. protected virtual void DoUpdate()
  169. {
  170. }
  171. private void SetGroup()
  172. {
  173. if (ActiveRow == null)
  174. {
  175. MessageUtil.ShowTips("请选择需要炉计划!");
  176. return;
  177. }
  178. FrmGroupSetting fgs = new FrmGroupSetting(ActiveRow.OrderNoSeq,ActiveRow.HeatPlanNo,ob);
  179. fgs.ShowDialog();
  180. }
  181. public void Query(bool ActiveFirst= false)
  182. {
  183. var starts = "";
  184. var plnNo = "";
  185. var judgeStoveNo = "";
  186. var feedStoveNo = "";
  187. var checkStaion = "";
  188. string[] plines = plineCodes;
  189. var start = contorlPlanStatus1.statusArr;
  190. if (chkPlnNo.Checked)
  191. if (string.IsNullOrEmpty(txtRollBatchId.Text.Trim()))
  192. {
  193. MessageUtil.ShowTips("请输入炉次计划号!");
  194. return;
  195. }
  196. else
  197. {
  198. plnNo = txtRollBatchId.Text.Trim();
  199. start = new string[4] {"10", "20", "30", "40"};
  200. }
  201. if (chkJuNo.Checked)
  202. if (string.IsNullOrEmpty(txtZyBatchId.Text.Trim()))
  203. {
  204. MessageUtil.ShowTips("请输入炉号!");
  205. return;
  206. }
  207. else
  208. {
  209. judgeStoveNo = txtZyBatchId.Text.Trim();
  210. start = new string[4] {"10", "20", "30", "40"};
  211. }
  212. if (chkFeedNo.Checked)
  213. if (string.IsNullOrEmpty(txtFeedNo.Text.Trim()))
  214. {
  215. MessageUtil.ShowTips("请输入炉号!");
  216. return;
  217. }
  218. else
  219. {
  220. feedStoveNo = txtFeedNo.Text.Trim();
  221. start = new string[4] {"10", "20", "30", "40"};
  222. }
  223. if (chkPline.Checked && ucePline.SelectedIndex >= 0)
  224. {
  225. plines = new string[] { ucePline.SelectedItem.DataValue.ToString2()};
  226. }
  227. if (chkFactory.Checked && uceFactory.SelectedIndex >= 0)
  228. {
  229. checkStaion = uceFactory.SelectedItem.DataValue.ToString2();
  230. }
  231. ResetUI();
  232. plnZyJgxCEntityBindingSource.DataSource = EntityHelper.GetData<PlnZyJgxCEntity>(
  233. "com.steering.mes.mcp.common.PlanService.getSingleJGPlan",
  234. new object[] { Gx != "701301", plnNo, judgeStoveNo,feedStoveNo, plines, start, Gx, ultraOptionSet2.Visible ? ultraOptionSet2.Value.ToString2() : "2", checkStaion, ultraOptionOther.Value.ToString2() },
  235. ob);
  236. if (ActiveFirst && ultraGrid1.Rows.Count > 0 && judgeStoveNo!="") ultraGrid1.Rows[0].Activated = true;
  237. commHelper.RefreshAndAutoSizeExceptColumns(ultraGrid1, new string[] { "ProdStandard", "StationRoad", "Lengthdisc" });
  238. DecisionRed(ultraGrid1);
  239. }
  240. protected virtual void Print()
  241. {
  242. }
  243. protected virtual void ResetUI()
  244. {
  245. }
  246. protected virtual void UpLoad()
  247. {
  248. }
  249. protected virtual void UpLoadDelete()
  250. {
  251. }
  252. /// <summary>
  253. /// 实绩保存
  254. /// </summary>
  255. protected virtual void DoAdd()
  256. {
  257. //}
  258. }
  259. /// <summary>
  260. /// 实绩保存
  261. /// </summary>
  262. protected virtual void DoAddNew()
  263. {
  264. //}
  265. }
  266. protected virtual void DoApproval()
  267. {
  268. //}
  269. }
  270. protected virtual void DoCancleApproval()
  271. {
  272. //}
  273. }
  274. protected virtual void DecisionRed(UltraGrid DataGrid)
  275. {
  276. //}
  277. }
  278. /// <summary>
  279. /// 结炉实绩查询
  280. /// </summary>
  281. private void DoBesideQuery()
  282. {
  283. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmCrackDetectResult.getMchBugD", new object[] { txtZyBatchId.Text.ToString(), txtRollBatchId.Text.ToString(), plineCode, start }, this.ob);
  284. //GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true);
  285. var heatno = "";
  286. var lotno = "";
  287. var plinename = "";
  288. var urg = ultraGrid1.ActiveRow;
  289. var matfrm = new FrmReason(ob, urg, "");
  290. matfrm.ShowDialog();
  291. }
  292. /// <summary>
  293. /// 传递卡打印
  294. /// </summary>
  295. private void DoTransferPrint()
  296. {
  297. if (ActiveRow == null)
  298. {
  299. MessageUtil.ShowTips("请选择要打印的炉信息!");
  300. return;
  301. }
  302. var strurl = "";
  303. if (ActiveRow.PlineCode.Equals("C021")) //镦粗
  304. strurl =
  305. "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=MchDeliveryCard.cpt&T.HEAT_PLAN_NO=" +
  306. ActiveRow.HeatPlanNo + "&T.JUDGE_STOVE_NO=" + ActiveRow.JudgeStoveNo + "&T.PLINE_CODE=" +
  307. ActiveRow.PlineCode + "&T2.BATCH_GROUD_NO=" + ActiveRow.BatchGroudNo + "&TT.STATION_DESC='上料'";
  308. else
  309. strurl = "http://localhost:8075/webroot/decision/view/report?viewlet=MchDeliveryCard.cpt&heatNo=" +
  310. ActiveRow.HeatPlanNo + "&judgeNo=" + ActiveRow.JudgeStoveNo + "&plineCode=" +
  311. ActiveRow.PlineCode + "&groupNo=" + ActiveRow.BatchGroudNo + "&batchNo=" + ActiveRow.BatchNo +
  312. "&abc=上料";
  313. var fre = new FrmRepExcel(ob, strurl);
  314. fre.AutoSize = true;
  315. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  316. fre.WindowState = FormWindowState.Maximized;
  317. fre.Show();
  318. }
  319. private void DoCelBeside()
  320. {
  321. if (ActiveRow == null) return;
  322. if (MessageUtil.ShowYesNoAndQuestion("是否撤销结炉?") == DialogResult.No)
  323. return;
  324. var ccp = new CoreClientParam();
  325. ccp.ServerName = "com.steering.mes.mcp.Mch.MchComm";
  326. ccp.MethodName = "undoBeside";
  327. ccp.ServerParams = new object[] {ActiveRow.HeatPlanNo, ActiveRow.BatchNo, Gx, ActiveRow.PlineCode};
  328. ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  329. if (ccp.ReturnCode != -1)
  330. {
  331. MessageUtil.ShowTips(ccp.ReturnInfo);
  332. if (ccp.ReturnInfo.Equals("撤销结炉成功!"))
  333. Query();
  334. }
  335. }
  336. /// <summary>
  337. /// 工序结炉
  338. /// </summary>
  339. protected void DoBeside(bool DoNotQuey = false)
  340. {
  341. if (ActiveRow == null)
  342. {
  343. MessageUtil.ShowTips("请选择需要结炉的炉计划!");
  344. return;
  345. }
  346. if (Gx=="701313"){
  347. DataTable CountDt = ServerHelper.GetData("com.steering.mes.mcp.Mch.MchComm.getUnCheckCout", new object[] { ActiveRow.HeatPlanNo, ActiveRow.BatchNo }, ob);
  348. if (CountDt.Rows.Count > 0)
  349. {
  350. int Count = 0;
  351. if (int.TryParse(CountDt.Rows[0]["COUNT"].ToString3(), out Count))
  352. {
  353. if (Count > 0)
  354. {
  355. if (MessageUtil.ShowYesNoAndQuestion("有"+Count+ "支管未检验,是否确认依然结炉?") == DialogResult.No)
  356. return;
  357. }
  358. }
  359. }
  360. }
  361. if (MessageUtil.ShowYesNoAndQuestion("是否结炉?") == DialogResult.No)
  362. return;
  363. var ccp = new CoreClientParam();
  364. ccp.ServerName = "com.steering.mes.mcp.Mch.MchComm";
  365. ccp.MethodName = "updateDoBeside";
  366. ccp.ServerParams = new object[] {ActiveRow.HeatPlanNo, ActiveRow.BatchNo, Gx, ActiveRow.PlineCode};
  367. ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  368. if (ccp.ReturnCode != -1)
  369. {
  370. MessageUtil.ShowTips(ccp.ReturnInfo);
  371. if (ccp.ReturnInfo.Equals("结炉成功!"))
  372. if (!DoNotQuey) Query();
  373. }
  374. }
  375. /// <summary>
  376. /// 撤销上料
  377. /// </summary>
  378. protected virtual void DoDelete()
  379. {
  380. }
  381. /// <summary>
  382. /// 撤销上料
  383. /// </summary>
  384. protected virtual void DoForceDelete()
  385. {
  386. }
  387. private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e)
  388. {
  389. var PlnZyRclCEntity = e.Row.ListObject as PlnZyJgxCEntity;
  390. if (PlnZyRclCEntity == null) return;
  391. if (PlnZyRclCEntity.Planstatus == "20")
  392. {
  393. e.Row.Cells["Planstatus"].Appearance.BackColor = Color.LightGreen;
  394. }
  395. else if ((PlnZyRclCEntity.Planstatus == "30") || (PlnZyRclCEntity.Planstatus == "40"))
  396. {
  397. e.Row.Cells["Planstatus"].Appearance.BackColor = Color.Red;
  398. e.Row.Appearance.BackColor = Color.LightGray;
  399. }
  400. if (PlnZyRclCEntity.ActCount > 0)
  401. e.Row.Cells["ActCount"].Appearance.BackColor = Color.LightGreen;
  402. }
  403. private void craftImg_EditorButtonClick(object sender, EditorButtonEventArgs e)
  404. {
  405. if (ActiveRow == null) return;
  406. var craftPath = YdmBaseClass.getQueryCraftNo(ActiveRow.CraftFileNo, ActiveRow.CraftSeq.ToString2(),
  407. ob);
  408. if (e.Button.Key.ToLower().Equals("select"))
  409. {
  410. var down = new FormFileDown(ob, craftPath);
  411. down.CtrlFileDown1.Button3.Visible = false;
  412. down.ShowDialog();
  413. }
  414. }
  415. private void chkStarts_CheckedChanged(object sender, EventArgs e)
  416. {
  417. if (chkPlnNo.Checked) txtRollBatchId.Enabled = true;
  418. else txtRollBatchId.Enabled = false;
  419. if (chkJuNo.Checked) txtZyBatchId.Enabled = true;
  420. else txtZyBatchId.Enabled = false;
  421. if (chkFeedNo.Checked) txtFeedNo.Enabled = true;
  422. else txtFeedNo.Enabled = false;
  423. }
  424. private void uteCraft2_EditorButtonClick(object sender, EditorButtonEventArgs e)
  425. {
  426. if (ActiveRow == null) return;
  427. if (e.Button.Key.ToLower().Equals("select"))
  428. {
  429. var down = new FormFileDown(ob, "Qcm/CraftLv2/" + ActiveRow.OrderNoSeq + "/" + ActiveRow.SecCraftFileNo);
  430. down.CtrlFileDown1.Button3.Visible = false;
  431. down.ShowDialog();
  432. }
  433. }
  434. protected void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  435. {
  436. if (mchControlBase1!=null) mchControlBase1.PlnZyJgxCEntity = ActiveRow;
  437. portMchBatchControl1.Query(ActiveRow.HeatPlanNo, ActiveRow.BatchNo, Gx, ActiveRow.ProducType == "C" || ActiveRow.ProducType=="E");
  438. GetResultData();
  439. }
  440. /// <summary>
  441. /// 获取当前工序的实绩
  442. /// </summary>
  443. protected virtual void GetResultData()
  444. {
  445. if (mchControlBase1 != null) mchControlBase1.PortHttBatchSampleResultEntitys = portMchBatchControl1.Data;
  446. }
  447. public class CustomMergedCellEvaluator : IMergedCellEvaluator
  448. {
  449. private readonly string[] keys;
  450. public CustomMergedCellEvaluator(string[] GroupKey)
  451. {
  452. keys = GroupKey;
  453. }
  454. public bool ShouldCellsBeMerged(UltraGridRow row1, UltraGridRow row2, UltraGridColumn column)
  455. //控件自带的方法,会自动进行调用,column为初始化中设置的行
  456. {
  457. foreach (var key in keys)
  458. if (row1.Cells[key].Value.ToString() != row2.Cells[key].Value.ToString()) return false;
  459. return row1.Cells[column].Value.ToString() == row2.Cells[column].Value.ToString();
  460. }
  461. }
  462. private void uteMeasureData_EditorButtonClick(object sender, EditorButtonEventArgs e)
  463. {
  464. using (MesureData MesureData = new MesureData(ActiveRow, ob, this.UserInfo.GetUserName(), false, this.CustomInfo))
  465. {
  466. MesureData.ShowDialog();
  467. ultraGrid1.ActiveCell.Value =(decimal) MesureData.list.Where(p => p.Flag == "00").Select(p => p.MatNo).Distinct().Count();
  468. portMchBatchControl1.Query(ActiveRow.HeatPlanNo, ActiveRow.BatchNo, Gx, ActiveRow.ProducType == "C" || ActiveRow.ProducType == "E");
  469. ultraGrid1.UpdateData();
  470. ultraGrid1.Refresh();
  471. }
  472. }
  473. private void SetMesureData()
  474. {
  475. using (MesureData MesureData = new MesureData(ActiveRow, ob, this.UserInfo.GetUserName(), true,this.CustomInfo))
  476. {
  477. MesureData.ShowDialog();
  478. ultraGrid1.ActiveRow.Cells["MeasureCount"].Value = (decimal)MesureData.list.Where(p => p.Flag == "00").Select(p => p.MatNo).Distinct().Count();
  479. portMchBatchControl1.Query(ActiveRow.HeatPlanNo, ActiveRow.BatchNo, Gx, ActiveRow.ProducType == "C" || ActiveRow.ProducType == "E");
  480. ultraGrid1.UpdateData();
  481. ultraGrid1.Refresh();
  482. }
  483. }
  484. private void uteCard_EditorButtonClick(object sender, EditorButtonEventArgs e)
  485. {
  486. PlnZyJgxCEntity entity = ultraGrid1.ActiveRow.ListObject as PlnZyJgxCEntity;
  487. string strurl =
  488. "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMchDeliveryCard.cpt&op=view&HEAT_PLAN_NO=" +
  489. entity.HeatPlanNo + "&BATCH_NO=" + entity.BatchNo;
  490. var fre = new FrmRepExcel(ob, strurl);
  491. fre.AutoSize = true;
  492. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width,
  493. Screen.PrimaryScreen.WorkingArea.Height);
  494. fre.WindowState = FormWindowState.Maximized;
  495. fre.Show();
  496. }
  497. protected int GetReturnNum()
  498. {
  499. List<MchOfflineResultEntity> OffList = EntityHelper.GetData<MchOfflineResultEntity>(
  500. "com.steering.mes.mcp.common.OfflineHelper.QueryMchOffLineData",
  501. new object[] { ActiveRow.HeatPlanNo, ActiveRow.BatchNo },
  502. ob);
  503. //返线到前工序的
  504. return (int)(OffList.Where(p => p.ReturnProcess != p.StationCode && mchControlBase1.CheckGx2(p.StationCode, Gx) && mchControlBase1.CheckGx2(Gx, p.ReturnProcess)).Sum(p => p.ReNum) ?? 0);
  505. }
  506. private void uteFilePath_EditorButtonClick(object sender, EditorButtonEventArgs e)
  507. {
  508. if (ActiveRow == null) return;
  509. UltraGridRow row = ultraGrid1.ActiveRow;
  510. FormFileDown down = new FormFileDown(this.ob, row.Cells["FilePath"].Text);
  511. if (!IsViewDelete)
  512. {
  513. down.CtrlFileDown1.Button3.Visible = false;
  514. }
  515. else {
  516. down.CtrlFileDown1.FileDeleteEvent += (() =>
  517. {
  518. List<Core.Mes.Client.Comm.Server.FileBean> list = down.CtrlFileDown1.List;
  519. if (list == null || list.Count <= 0)
  520. {
  521. UpLoadDelete();
  522. }
  523. });
  524. }
  525. down.ShowDialog();
  526. }
  527. private void FilePath2Editor_EditorButtonClick(object sender, EditorButtonEventArgs e)
  528. {
  529. if (ActiveRow == null) return;
  530. UltraGridRow row = ultraGrid1.ActiveRow;
  531. if (e.Button.Key.ToLower().Equals("select"))
  532. {
  533. FormFileDown down = new FormFileDown(this.ob, row.Cells["FilePath2"].Text);
  534. down.ShowDialog();
  535. }
  536. else
  537. {
  538. string filePath = "JGMESServer/" + "CMD" + "/" + ActiveRow.PlineCode + "/" + ActiveRow.JudgeStoveNo + "/";
  539. FormFileDown down = new FormFileDown(this.ob, filePath);
  540. down.CtrlFileDown1.FilePath = filePath;
  541. List<FileBean> list = new List<FileBean>();
  542. FileBean bean = new FileBean();
  543. OpenFileDialog file = new OpenFileDialog();
  544. file.Multiselect = true;
  545. DialogResult drStat;
  546. drStat = file.ShowDialog();
  547. if (drStat == DialogResult.OK)
  548. {
  549. foreach (string fileName in file.FileNames)
  550. {
  551. bean = new FileBean();
  552. string filena = System.IO.Path.GetFileName(fileName);
  553. bean.setFileName(filena);
  554. bean.setPathName(filePath);
  555. bean.setFile(FileHelper.FileToArray(fileName));
  556. list.Add(bean);
  557. }
  558. bool isSuccess = Core.Mes.Client.Comm.Server.FileHelper.Upload(list);
  559. if (isSuccess)
  560. {
  561. Thread.Sleep(100); //等待一下下
  562. DoUpdateFilePath(filePath, true);
  563. }
  564. else
  565. {
  566. MessageBox.Show("上传失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
  567. }
  568. }
  569. }
  570. }
  571. public void DoUpdateFilePath(string filePath, bool showTips)
  572. {
  573. var ccp = new CoreClientParam
  574. {
  575. ServerName = "com.steering.mes.mcp.Mch.FrmMcpLoading",
  576. MethodName = "DoUpdateFilePath2",
  577. ServerParams = new object[]
  578. {
  579. ActiveRow.HeatPlanNo,
  580. filePath
  581. }
  582. };
  583. ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  584. if (ccp.ReturnCode != -1 && showTips)
  585. {
  586. MessageUtil.ShowTips(ccp.ReturnInfo);
  587. if (ccp.ReturnInfo.Contains("成功!"))
  588. Query(true);
  589. }
  590. else if (!showTips)
  591. {
  592. Query(true);
  593. }
  594. }
  595. }
  596. }