FrmInspection.cs 72 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685
  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.Windows.Forms;
  9. using CoreFS.CA06;
  10. using Core.StlMes.Client.Mcp.Common;
  11. using Core.Mes.Client.Comm.Server;
  12. using Core.Mes.Client.Comm.Control;
  13. using Infragistics.Win.UltraWinGrid;
  14. using Core.Mes.Client.Comm.Tool;
  15. using Core.StlMes.Client.Mcp.CollarMaterial;
  16. using System.Collections;
  17. using Core.StlMes.Client.Mcp.Control;
  18. using Core.StlMes.Client.Mcp.Coupling;
  19. using Core.StlMes.Client.Mcp.Entity;
  20. using Core.Mes.Client.Comm.Format;
  21. using Core.StlMes.Client.Mcp.Report;
  22. using System.Net;
  23. namespace Core.StlMes.Client.Mcp
  24. {
  25. public partial class FrmInspection : FrmBase
  26. {
  27. private string departm = "";//获取部门ID
  28. private string[] plineCode = null;//获取产线代码
  29. private string TsGx = "";//探伤工序
  30. private string TsName = "";//探伤名称
  31. public string LiXian = "";
  32. private string StrMemo = "";//备注
  33. private string[] plineCodes;
  34. private int CutPiece = 0;
  35. private int threadNum = 0;
  36. ArrayList listF = new ArrayList();//废品
  37. ArrayList listB = new ArrayList();//不合格
  38. public FrmInspection()
  39. {
  40. InitializeComponent();
  41. this.IsLoadUserView = true;
  42. }
  43. //protected override void OnLoad(EventArgs e)
  44. //{
  45. //base.OnLoad(e);
  46. ////禁控件过滤
  47. //this.coupWoIdPlanControl1.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  48. ////设置计划区控件只读
  49. ////this.coupWoIdPlanControl1.SetAllColumnsActiveOnly();
  50. //coupWoIdPlanControl1.Ob = this.ob;
  51. //}
  52. private void FrmInspection_Load(object sender, EventArgs e)
  53. {
  54. EntityHelper.ShowGridCaption<PlnZyJgWorkbillEntity>(ultraGridWoId.DisplayLayout.Bands[0]);
  55. EntityHelper.ShowGridCaption<PlnZyJgWorkbillEntity>(ultraGrid2.DisplayLayout.Bands[0]);
  56. departm = UserInfo.GetDeptid();
  57. //plineCode = McpBaseHelper.GetPCodePline(departm, this.ob);
  58. plineCodes = comm.GetPlineCode(this.ValidDataPurviewIds, "H", ob);
  59. ProTime.Value = DateTime.Today;
  60. //获取工序
  61. DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryGX", new object[] { "700307" }, this.ob);
  62. if (dt2.Rows.Count > 0)
  63. {
  64. TsGx = dt2.Rows[0]["BASECODE"].ToString();
  65. TsName = dt2.Rows[0]["BASENAME"].ToString();
  66. }
  67. txtBC.Value = this.UserInfo.GetUserOrder();
  68. txtBz.Value = this.UserInfo.GetUserGroup();
  69. //txtUser.Text = this.UserInfo.GetUserName();
  70. ////获取废品原因
  71. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupCutService.getCutResultFp", new object[] { "7010" }, this.ob);
  72. //cmbReason.DataSource = dt;
  73. //cmbReason.ValueMember = "BASENAME";
  74. //YdmBaseClass.SetComboItemHeight(cmbReason);
  75. ////获取不合格原因
  76. //DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupCutService.getCutResultFp", new object[] { "7011" }, this.ob);
  77. //UncmbReason.DataSource = dt1;
  78. //UncmbReason.ValueMember = "BASENAME";
  79. //YdmBaseClass.SetComboItemHeight(UncmbReason);
  80. //获取探伤标准
  81. DataTable dt3 = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupCutService.getCutResultFp", new object[] { "7001" }, this.ob);
  82. cmbStandard.DataSource = dt3;
  83. cmbStandard.ValueMember = "BASENAME";
  84. YdmBaseClass.SetComboItemHeight(cmbStandard);
  85. cmbStandard.SelectedIndex = 0;
  86. //获取试片类型
  87. DataTable dt4 = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupCutService.getCutResultFp", new object[] { "7008" }, this.ob);
  88. CmbType.DataSource = dt4;
  89. CmbType.ValueMember = "BASENAME";
  90. YdmBaseClass.SetComboItemHeight(CmbType);
  91. CmbType.SelectedIndex = 0;
  92. //获取磁粉种类
  93. DataTable dt5 = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupCutService.getCutResultFp", new object[] { "7009" }, this.ob);
  94. cmbPowder.DataSource = dt5;
  95. cmbPowder.ValueMember = "BASENAME";
  96. YdmBaseClass.SetComboItemHeight(cmbPowder);
  97. cmbPowder.SelectedIndex = 0;
  98. //获取试片磁痕显示
  99. DataTable dt6 = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupCutService.getCutResultFp", new object[] { "7028" }, this.ob);
  100. tXtMagnetic.DataSource = dt6;
  101. tXtMagnetic.ValueMember = "BASENAME";
  102. YdmBaseClass.SetComboItemHeight(tXtMagnetic);
  103. tXtMagnetic.SelectedIndex = 0;
  104. //获取检测位置及方向
  105. DataTable dt7 = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupCutService.getCutResultFp", new object[] { "7027" }, this.ob);
  106. txtPosi.DataSource = dt7;
  107. txtPosi.ValueMember = "BASENAME";
  108. YdmBaseClass.SetComboItemHeight(txtPosi);
  109. }
  110. public override void ToolBar_Click(object sender, string ToolbarKey)
  111. {
  112. switch (ToolbarKey)
  113. {
  114. case "DoQuery":
  115. QuerySinglePlan();//查询
  116. break;
  117. case "DoSave":
  118. DoSave();//新增
  119. break;
  120. case "DoDelete":
  121. DoDelete();//删除
  122. break;
  123. case "DoUpdate":
  124. DoUpdate();//更新
  125. break;
  126. case "DoComplete":
  127. DoComplete();//结庐
  128. break;
  129. case "UnDoComplete":
  130. UnDoComplete();//撤销结庐
  131. break;
  132. case "Offline"://离线
  133. Offline();
  134. break;
  135. case "unOffline"://撤销离线
  136. unOffline();
  137. break;
  138. case "Confirm":
  139. confirm();//确认
  140. break;
  141. case "CancelConfirm":
  142. cancelConfirm();
  143. break;
  144. case "DoClose":
  145. this.Close();//关闭
  146. break;
  147. }
  148. }
  149. ///
  150. /// 取消确认
  151. ///
  152. private void cancelConfirm()
  153. {
  154. ultraGrid1.UpdateData();
  155. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  156. if (uRow == null) { MessageUtil.ShowTips("无探伤实绩!"); return; }
  157. UltraGridRow row = this.ultraGridWoId.ActiveRow;
  158. if (row == null)
  159. {
  160. MessageUtil.ShowTips("无工单信息,不允许此操作!");
  161. }
  162. ArrayList list1 = new ArrayList();
  163. int UpdaCount = 0;
  164. foreach (UltraGridRow ugr in ultraGrid1.Rows)
  165. {
  166. if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true)
  167. {
  168. if (ugr.Cells["CONFIRM"].Value.ToString().Equals("0"))
  169. {
  170. MessageUtil.ShowTips("选中有没确认实绩,不允许取消确认!");
  171. return;
  172. }
  173. UpdaCount += 1;
  174. ArrayList list = new ArrayList();
  175. list.Add(ugr.Cells["RESULT_NO"].Text.ToString());
  176. list.Add(UserInfo.GetUserName());
  177. list.Add(DateTime.Now.ToString());
  178. list1.Add(list);
  179. }
  180. }
  181. if (UpdaCount == 0) { MessageUtil.ShowTips("请选择探伤实绩数据!"); return; }
  182. if (MessageUtil.ShowYesNoAndQuestion("是否取消确认探伤实绩?") == DialogResult.No)
  183. {
  184. return;
  185. }
  186. CoreClientParam ccp = new CoreClientParam();
  187. try
  188. {
  189. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  190. if (Constant.WaitingForm == null)
  191. {
  192. Constant.WaitingForm = new WaitingForm();
  193. }
  194. Constant.WaitingForm.ShowToUser = true;
  195. Constant.WaitingForm.Show();
  196. Constant.WaitingForm.Update();
  197. ccp.ServerName = "com.steering.mes.mcp.coup.FrmInspection";
  198. ccp.MethodName = "getCancelConfirm";
  199. ccp.ServerParams = new object[] { list1 };
  200. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  201. this.Cursor = Cursors.Default;
  202. Constant.WaitingForm.ShowToUser = false;
  203. Constant.WaitingForm.Close();
  204. Constant.WaitingForm = null;
  205. }
  206. catch (Exception ex)
  207. {
  208. this.Cursor = Cursors.Default;
  209. Constant.WaitingForm.ShowToUser = false;
  210. Constant.WaitingForm.Close();
  211. Constant.WaitingForm = null;
  212. }
  213. if (ccp.ReturnCode != -1)
  214. {
  215. MessageUtil.ShowTips(ccp.ReturnInfo);
  216. if (ccp.ReturnInfo.Equals("取消确认成功!"))
  217. {
  218. QuerySinglePlan();
  219. }
  220. }
  221. }
  222. ///
  223. /// 确认
  224. ///
  225. private void confirm()
  226. {
  227. ultraGrid1.UpdateData();
  228. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  229. if (uRow == null) { MessageUtil.ShowTips("无探伤实绩!"); return; }
  230. UltraGridRow row = this.ultraGridWoId.ActiveRow;
  231. if (row == null)
  232. {
  233. MessageUtil.ShowTips("无工单信息,不允许此操作!");
  234. }
  235. ArrayList list1 = new ArrayList();
  236. int UpdaCount = 0;
  237. foreach (UltraGridRow ugr in ultraGrid1.Rows)
  238. {
  239. if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true)
  240. {
  241. if (ugr.Cells["CONFIRM"].Value.ToString().Equals("1"))
  242. {
  243. MessageUtil.ShowTips("选中有已确认实绩,不允许再次确认!");
  244. return;
  245. }
  246. UpdaCount += 1;
  247. ArrayList list = new ArrayList();
  248. list.Add(ugr.Cells["RESULT_NO"].Text.ToString());
  249. list.Add(UserInfo.GetUserName());
  250. list.Add(DateTime.Now.ToString());
  251. list1.Add(list);
  252. }
  253. }
  254. if (UpdaCount == 0) { MessageUtil.ShowTips("请选择探伤实绩数据!"); return; }
  255. if (MessageUtil.ShowYesNoAndQuestion("是否确认探伤实绩?") == DialogResult.No)
  256. {
  257. return;
  258. }
  259. CoreClientParam ccp = new CoreClientParam();
  260. try
  261. {
  262. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  263. if (Constant.WaitingForm == null)
  264. {
  265. Constant.WaitingForm = new WaitingForm();
  266. }
  267. Constant.WaitingForm.ShowToUser = true;
  268. Constant.WaitingForm.Show();
  269. Constant.WaitingForm.Update();
  270. ccp.ServerName = "com.steering.mes.mcp.coup.FrmInspection";
  271. ccp.MethodName = "getConfirm";
  272. ccp.ServerParams = new object[] { list1 };
  273. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  274. this.Cursor = Cursors.Default;
  275. Constant.WaitingForm.ShowToUser = false;
  276. Constant.WaitingForm.Close();
  277. Constant.WaitingForm = null;
  278. }
  279. catch (Exception ex)
  280. {
  281. this.Cursor = Cursors.Default;
  282. Constant.WaitingForm.ShowToUser = false;
  283. Constant.WaitingForm.Close();
  284. Constant.WaitingForm = null;
  285. }
  286. if (ccp.ReturnCode != -1)
  287. {
  288. MessageUtil.ShowTips(ccp.ReturnInfo);
  289. if (ccp.ReturnInfo.Equals("确认成功!"))
  290. {
  291. QuerySinglePlan();
  292. }
  293. }
  294. }
  295. /// <summary>
  296. /// 离线
  297. /// </summary>
  298. private void Offline()
  299. {
  300. string _strat = "";
  301. UltraGridRow row = ultraGridWoId.ActiveRow;
  302. if (row == null) return;
  303. if (row.Cells["ZyBillStatus"].Value.ToString() == "生产完成")
  304. {
  305. MessageUtil.ShowTips("此炉次计划整体已生产完成,不允许此操作!");
  306. return;
  307. }
  308. //UltraGridRow row1 = ultraGrid1.ActiveRow;
  309. //if (row1 == null)
  310. //{
  311. // MessageUtil.ShowTips("没有探伤实绩不能离线!");
  312. // return;
  313. //}
  314. OffLineCut frm = new OffLineCut();
  315. frm.ShowDialog();
  316. LiXian = frm.StrNum;
  317. _strat = frm.Strat;
  318. StrMemo = frm.StrMemo;
  319. if (_strat.Equals("2")) return;
  320. if (LiXian.Equals("") || LiXian.Equals("0")) { MessageUtil.ShowTips("离线支数不能为空!"); return; }
  321. string woId = row.Cells["WoId"].Value.ToString();
  322. //查询切断实绩支数和
  323. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupCutService.getCutResult", new object[] { row.Cells["WoId"].Value.ToString() }, this.ob);
  324. //VrpLoadingResultEntity result1 = new VrpLoadingResultEntity();
  325. //this.planExpanQuery1.Value = result;
  326. string pronum = "";//锯切支数
  327. string cutnum = "";//锯切个数
  328. if (dt.Rows.Count > 0)
  329. {
  330. pronum = dt.Rows[0]["PRO_NUM"].ToString();
  331. cutnum = dt.Rows[0]["CUT_NUM"].ToString();
  332. }
  333. else
  334. {
  335. pronum = "0";
  336. cutnum = "0";
  337. }
  338. if (!row.Cells["Ifsplit"].Value.Equals("1"))
  339. {
  340. if (Convert.ToInt32(LiXian) > Convert.ToInt32(cutnum) - Convert.ToInt32(threadNum) - Convert.ToInt32(offlinePiece.Value))
  341. {
  342. MessageUtil.ShowTips("离线个数不能大于锯切个数减去已经探伤和离线个数的差!");
  343. return;
  344. }
  345. }
  346. offlinePiece.Value = Convert.ToInt32(LiXian) + Convert.ToInt32(offlinePiece.Value);
  347. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId }, this.ob);
  348. //if (dt.Rows[0]["DETECT_STATUS"].ToString().Equals("生产完成"))
  349. //{
  350. // MessageUtil.ShowTips("此工单探伤工序点已结炉,不允许此操作!");
  351. // return;
  352. //}
  353. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryCouplingcominfo", new object[] { woId, TsGx }, this.ob);
  354. //if(dt.Rows[0]["STATION_STATUS"].ToString().Equals("2"))
  355. //{
  356. // MessageUtil.ShowTips("此工单探伤工序点已结炉,不允许此操作!");
  357. // return;
  358. //}
  359. //if (row1.Cells["OFF_NUM"].Value.ToString()=="")
  360. //{
  361. // row1.Cells["OFF_NUM"].Value = "0";
  362. //}
  363. //if (int.Parse(row1.Cells["FINAL_QUALIFIED"].Value.ToString()) < int.Parse(LiXian) + int.Parse(row1.Cells["OFF_NUM"].Value.ToString()))
  364. //{
  365. // MessageUtil.ShowTips("离线个数不能大于合格个数!");
  366. // return;
  367. //}
  368. string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  369. ArrayList list = new ArrayList();
  370. list.Add(LiXian);
  371. list.Add(row.Cells["WoId"].Text.ToString());
  372. list.Add(row.Cells["HeatPlanNo"].Text.ToString());
  373. list.Add(row.Cells["JudgeStoveNo"].Text.ToString());
  374. list.Add(row.Cells["BatchNo"].Text.ToString());
  375. list.Add(row.Cells["PlineCode"].Text.ToString());
  376. list.Add(row.Cells["PlineName"].Text.ToString());
  377. list.Add(this.UserInfo.GetUserName());
  378. list.Add(this.UserInfo.GetUserOrder());
  379. list.Add(this.UserInfo.GetUserGroup());
  380. list.Add(time);
  381. list.Add("");
  382. list.Add(StrMemo);
  383. list.Add(row.Cells["BatchGroudNo"].Value.ToString());
  384. CoreClientParam ccp = new CoreClientParam();
  385. try
  386. {
  387. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  388. if (Constant.WaitingForm == null)
  389. {
  390. Constant.WaitingForm = new WaitingForm();
  391. }
  392. Constant.WaitingForm.ShowToUser = true;
  393. Constant.WaitingForm.Show();
  394. Constant.WaitingForm.Update();
  395. ccp.ServerName = "com.steering.mes.mcp.coup.CoupCutService";
  396. ccp.MethodName = "lixianThreadingResult";
  397. ccp.ServerParams = new object[] { list, TsGx ,TsName};
  398. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  399. this.Cursor = Cursors.Default;
  400. Constant.WaitingForm.ShowToUser = false;
  401. Constant.WaitingForm.Close();
  402. Constant.WaitingForm = null;
  403. }
  404. catch (Exception ex)
  405. {
  406. this.Cursor = Cursors.Default;
  407. Constant.WaitingForm.ShowToUser = false;
  408. Constant.WaitingForm.Close();
  409. Constant.WaitingForm = null;
  410. }
  411. if (ccp.ReturnCode != -1)
  412. {
  413. MessageUtil.ShowTips(ccp.ReturnInfo);
  414. if (ccp.ReturnInfo.Equals("离线成功!"))
  415. {
  416. QuerySinglePlan();
  417. DoClean();
  418. }
  419. }
  420. }
  421. //撤销离线
  422. private void unOffline()
  423. {
  424. ultraGrid1.UpdateData();
  425. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  426. if (uRow == null) { MessageUtil.ShowTips("探伤实绩无数据!"); return; }
  427. UltraGridRow row = this.ultraGridWoId.ActiveRow;
  428. if (uRow == null)
  429. {
  430. MessageUtil.ShowTips("无工单信息,不允许此操作!");
  431. }
  432. if (row.Cells["ZyBillStatus"].Value.ToString() == "生产完成")
  433. {
  434. MessageUtil.ShowTips("此炉次计划整体已生产完成,不允许此操作!");
  435. return;
  436. }
  437. string woId = row.Cells["WoId"].Value.ToString();
  438. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, zYgNo }, this.ob);
  439. //if (dt.Rows[0]["DETECT_STATUS"].ToString().Equals("生产完成"))
  440. //{
  441. // MessageUtil.ShowTips("此工单工序点已结炉,不允许此操作!");
  442. // return;
  443. //}
  444. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryCouplingcominfo", new object[] { woId, TsGx }, this.ob);
  445. //if (dt.Rows[0]["STATION_STATUS"].ToString().Equals("2"))
  446. //{
  447. // MessageUtil.ShowTips("此工单探伤工序点已结炉,不允许此操作!");
  448. // return;
  449. //}
  450. //if(!QueryStatusGd(row.Cells["WO_ID"].Value.ToString(), row.Cells["ZY_PLAN_ID"].Value.ToString())) return;
  451. ArrayList list1 = new ArrayList();
  452. int UpdaCount = 0;
  453. foreach (UltraGridRow ugr in ultraGrid1.Rows)
  454. {
  455. if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true)
  456. {
  457. UpdaCount += 1;
  458. ArrayList list = new ArrayList();
  459. list.Add(ugr.Cells["RESULT_NO"].Text.ToString());
  460. list.Add(ugr.Cells["OFF_NUM"].Value.ToString());
  461. list1.Add(list);
  462. }
  463. }
  464. if (UpdaCount == 0) { MessageUtil.ShowTips("请选择离线数据!"); return; }
  465. if (MessageUtil.ShowYesNoAndQuestion("是否撤销离线?") == DialogResult.No)
  466. {
  467. return;
  468. }
  469. CoreClientParam ccp = new CoreClientParam();
  470. try
  471. {
  472. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  473. if (Constant.WaitingForm == null)
  474. {
  475. Constant.WaitingForm = new WaitingForm();
  476. }
  477. Constant.WaitingForm.ShowToUser = true;
  478. Constant.WaitingForm.Show();
  479. Constant.WaitingForm.Update();
  480. ccp.ServerName = "com.steering.mes.mcp.coup.CoupCutService";
  481. ccp.MethodName = "unlixianThreadingResult";
  482. ccp.ServerParams = new object[] { list1, row.Cells["WoId"].Text.ToString(), TsGx };
  483. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  484. this.Cursor = Cursors.Default;
  485. Constant.WaitingForm.ShowToUser = false;
  486. Constant.WaitingForm.Close();
  487. Constant.WaitingForm = null;
  488. }
  489. catch (Exception ex)
  490. {
  491. this.Cursor = Cursors.Default;
  492. Constant.WaitingForm.ShowToUser = false;
  493. Constant.WaitingForm.Close();
  494. Constant.WaitingForm = null;
  495. }
  496. if (ccp.ReturnCode == -1) return;
  497. MessageUtil.ShowTips(ccp.ReturnInfo);
  498. if (ccp.ReturnInfo.Equals("撤销离线成功!"))
  499. {
  500. QuerySinglePlan();
  501. }
  502. }
  503. /// <summary>
  504. ///撤销结炉
  505. /// </summary>
  506. private void UnDoComplete()
  507. {
  508. UltraGridRow uRow = this.ultraGridWoId.ActiveRow;
  509. if (uRow == null)
  510. {
  511. MessageUtil.ShowTips("请选择需要结炉的作业工单号!");
  512. return;
  513. }
  514. //string zYgNo = uRow.Cells["ZY_PLAN_ID"].Value.ToString();
  515. string woId = uRow.Cells["WoId"].Value.ToString();
  516. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, zYgNo }, this.ob);
  517. //if (!dt.Rows[0]["DETECT_STATUS"].ToString().Equals("生产完成"))
  518. //{
  519. // MessageUtil.ShowTips("此工单探伤工序点未结炉,不允许此操作!");
  520. // return;
  521. //} if (dt.Rows[0]["ZY_BILL_STATUS"].ToString().Equals("生产完成"))
  522. //{
  523. // MessageUtil.ShowTips("此工单状态已生产完成,不允许此操作!");
  524. // return;
  525. //}
  526. //ArrayList list = new ArrayList();
  527. //list.Add(zYgNo);
  528. //list.Add(TsGx);
  529. //list.Add(woId);
  530. if (MessageUtil.ShowYesNoAndQuestion("是否撤销结炉?") == DialogResult.No)
  531. {
  532. return;
  533. }
  534. CoreClientParam ccp = new CoreClientParam();
  535. ccp.ServerName = "com.steering.mes.mcp.coup.FrmInspection";
  536. ccp.MethodName = "undoBeside";
  537. ccp.ServerParams = new object[] { TsGx,woId };
  538. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  539. if (ccp.ReturnCode != -1)
  540. {
  541. MessageUtil.ShowTips(ccp.ReturnInfo);
  542. if (ccp.ReturnInfo.Equals("撤销结炉成功!"))
  543. {
  544. QuerySinglePlan();
  545. }
  546. }
  547. }
  548. /// <summary>
  549. /// 结炉
  550. /// </summary>
  551. private void DoComplete()
  552. {
  553. UltraGridRow uRow = this.ultraGridWoId.ActiveRow;
  554. if (uRow == null)
  555. {
  556. MessageUtil.ShowTips("请选择需要结炉的工单号!");
  557. return;
  558. }
  559. // string zYgNo = uRow.Cells["ZY_PLAN_ID"].Value.ToString();
  560. string woId = uRow.Cells["WoId"].Value.ToString();
  561. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, zYgNo }, this.ob);
  562. //if (dt.Rows[0]["DETECT_STATUS"].ToString().Equals("生产完成"))
  563. //{
  564. // MessageUtil.ShowTips("此工单探伤工序点已结炉,不允许此操作!");
  565. // return;
  566. //}
  567. //if (dt.Rows[0]["ZY_BILL_STATUS"].ToString().Equals("生产完成"))
  568. //{
  569. // MessageUtil.ShowTips("此工单状态已生产完成,不允许此操作!");
  570. // return;
  571. //}
  572. //ArrayList list = new ArrayList();
  573. //list.Add(zYgNo);
  574. //list.Add(TsGx);
  575. //list.Add(woId);
  576. if (MessageUtil.ShowYesNoAndQuestion("是否结炉?") == DialogResult.No)
  577. {
  578. return;
  579. }
  580. CoreClientParam ccp = new CoreClientParam();
  581. ccp.ServerName = "com.steering.mes.mcp.coup.FrmInspection";
  582. ccp.MethodName = "doBeside";
  583. ccp.ServerParams = new object[] { TsGx,woId };
  584. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  585. if (ccp.ReturnCode != -1)
  586. {
  587. MessageUtil.ShowTips(ccp.ReturnInfo);
  588. if (ccp.ReturnInfo.Equals("结炉成功!"))
  589. {
  590. QuerySinglePlan();
  591. }
  592. }
  593. }
  594. /// <summary>
  595. /// 修改探伤实绩
  596. /// </summary>
  597. private void DoUpdate()
  598. {
  599. UltraGridRow urg = this.ultraGrid1.ActiveRow;
  600. if (urg == null)
  601. {
  602. MessageUtil.ShowTips("无探伤实绩,不允许此操作!");
  603. return;
  604. }
  605. if (urg.Cells["IF_ALL_OUT_WORK"].Value.ToString().Equals("是"))
  606. {
  607. MessageUtil.ShowTips("此工序已经离线,不允许此操作!");
  608. return;
  609. }
  610. UltraGridRow row = this.ultraGridWoId.ActiveRow;
  611. if (row == null)
  612. {
  613. MessageUtil.ShowTips("无工单信息,不允许此操作!");
  614. return;
  615. }
  616. //string zYgNo = urg.Cells["ZY_PLAN_ID"].Value.ToString();
  617. string woId = row.Cells["WoId"].Value.ToString();
  618. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, zYgNo }, this.ob);
  619. //if (dt.Rows[0]["DETECT_STATUS"].ToString().Equals("生产完成"))
  620. //{
  621. // MessageUtil.ShowTips("此工单探伤工序点已结炉,不允许此操作!");
  622. // return;
  623. //}
  624. if (!row.Cells["ZyBillStatus"].Value.ToString().Equals("生产中"))
  625. {
  626. MessageUtil.ShowTips("此工单状态不是生产中,不允许此操作!");
  627. return;
  628. }
  629. //if(!QueryStatusGd(row.Cells["WO_ID"].Value.ToString(), row.Cells["ZY_PLAN_ID"].Value.ToString())) return;
  630. string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  631. if (Convert.ToInt32(numPieces.Value.ToString()) != Convert.ToInt32(numQualified.Value.ToString()) + Convert.ToInt32(nuQualified.Value.ToString()))
  632. {
  633. MessageBox.Show("检验量=一次合格量+不合格量,请查验 ", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  634. return;
  635. }
  636. if (Convert.ToInt32(nuQualified.Value.ToString()) != Convert.ToInt32(numAmount.Value.ToString()) + Convert.ToInt32(numRejected.Value.ToString()))
  637. {
  638. MessageBox.Show("不合格量=修后复探量+废品量,请查验 ", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  639. return;
  640. }
  641. ArrayList list = new ArrayList();
  642. CouplingInspectionResultEntity sand = new CouplingInspectionResultEntity();
  643. sand.InspectPieces = Convert.ToDecimal(numPieces.Value.ToString());
  644. sand.QualiriedPcs = Convert.ToDecimal( numQualified.Value.ToString());
  645. sand.RejectedPcs = Convert.ToDecimal(numRejected.Value.ToString());
  646. sand.RejectedReason = cmbReason.Text.Trim();
  647. sand.UnqualiriedPcs = Convert.ToDecimal(nuQualified.Value.ToString());
  648. sand.ColOperator = cmbOperator.Text.Trim();
  649. sand.ColShift = txtBC.Value.ToString();
  650. sand.ColGroup = txtBz.Value.ToString();
  651. sand.UpdateName = this.UserInfo.GetUserName();
  652. sand.UnqualiriedReason = UncmbReason.Text.ToString();
  653. sand.AmountPcs = Convert.ToDecimal(numAmount.Value.ToString());
  654. sand.InspStandard = cmbStandard.Text.ToString();
  655. sand.Memo = txtMemo.Text.ToString();
  656. sand.MagneticPowder = cmbPowder.Text.ToString();
  657. sand.SpecimenMagnetic = tXtMagnetic.Text.ToString();
  658. sand.SpecimenType = CmbType.Text.ToString();
  659. sand.Concentration = Convert.ToDecimal(numConcentra.Value.ToString());
  660. sand.CoilIntensity = Convert.ToDecimal(numCoil.Value.ToString());
  661. sand.CenterIntensity = Convert.ToDecimal(numCenter.Value.ToString());
  662. sand.Issued = this.UserInfo.GetUserName() + "/MT-Ⅱ";
  663. sand.Magtimes = MagTimes.Value.ToString();
  664. //sand.ZyPlanId = urg.Cells["ZY_PLAN_ID"].Text.ToString();
  665. //sand.PlineCode = urg.Cells["PLINE_CODE"].Text.ToString();
  666. sand.FinalQualified = Convert.ToInt32(numQualified.Value.ToString()) + Convert.ToInt32(numAmount.Value.ToString());
  667. sand.UpdateDate = time;
  668. sand.ResultNo = urg.Cells["RESULT_NO"].Text.ToString();
  669. list.Add(JSONFormat.Format(sand));
  670. //sand.WoId = urg.Cells["WO_ID"].Text.ToString();
  671. //double PlnCount = 0;//计划个数
  672. //double CutCount = 0;//实际个数
  673. //DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.coup.PhosphateResultService.queryPlanJg", new Object[] { row.Cells["ZY_PLAN_ID"].Text.ToString() }, ob);
  674. //if (dt1.Rows.Count > 0)
  675. //{
  676. // PlnCount = Double.Parse(dt1.Rows[0]["DETECT_PLN_NUM"].ToString());
  677. // CutCount = Double.Parse(dt1.Rows[0]["DETECT_OK_NUM"].ToString());
  678. //}
  679. //// + Double.Parse(numQualified.Value.ToString())
  680. //if (CutCount > PlnCount)
  681. //{
  682. // if (MessageUtil.ShowYesNoAndQuestion("实际探伤个数超过计划探伤个数是否修改!") == DialogResult.No) { return; }
  683. //}
  684. if (MessageUtil.ShowYesNoAndQuestion("是否修改探伤记录?") == DialogResult.No)
  685. {
  686. return;
  687. }
  688. CoreClientParam ccp = new CoreClientParam();
  689. try
  690. {
  691. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  692. if (Constant.WaitingForm == null)
  693. {
  694. Constant.WaitingForm = new WaitingForm();
  695. }
  696. Constant.WaitingForm.ShowToUser = true;
  697. Constant.WaitingForm.Show();
  698. Constant.WaitingForm.Update();
  699. ccp.ServerName = "com.steering.mes.mcp.coup.FrmInspection";
  700. ccp.MethodName = "updateSandResult";
  701. ccp.ServerParams = new object[] { list, TsGx, woId };
  702. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  703. this.Cursor = Cursors.Default;
  704. Constant.WaitingForm.ShowToUser = false;
  705. Constant.WaitingForm.Close();
  706. Constant.WaitingForm = null;
  707. }
  708. catch (Exception ex)
  709. {
  710. this.Cursor = Cursors.Default;
  711. Constant.WaitingForm.ShowToUser = false;
  712. Constant.WaitingForm.Close();
  713. Constant.WaitingForm = null;
  714. }
  715. if (ccp.ReturnCode != -1)
  716. {
  717. MessageUtil.ShowTips(ccp.ReturnInfo);
  718. if (ccp.ReturnInfo.Equals("修改成功!"))
  719. {
  720. QuerySinglePlan();
  721. DoClean();
  722. }
  723. }
  724. }
  725. /// <summary>
  726. /// 删除探伤实绩
  727. /// </summary>
  728. private void DoDelete()
  729. {
  730. ultraGrid1.UpdateData();
  731. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  732. if (uRow == null) { MessageUtil.ShowTips("无探伤实绩!"); return; }
  733. if (uRow.Cells["CONFIRM"].Value.ToString().Equals("1"))
  734. {
  735. MessageUtil.ShowTips("选中的探伤实绩已经确认,不允许删除!");
  736. return;
  737. }
  738. UltraGridRow row = this.ultraGridWoId.ActiveRow;
  739. if (row == null)
  740. {
  741. MessageUtil.ShowTips("无工单信息,不允许此操作!");
  742. }
  743. //string zYgNo = row.Cells["ZY_PLAN_ID"].Value.ToString();
  744. string woId = row.Cells["WoId"].Value.ToString();
  745. string plinCode = row.Cells["PlineCode"].Value.ToString();
  746. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, zYgNo }, this.ob);
  747. //if (dt.Rows[0]["DETECT_STATUS"].ToString().Equals("生产完成"))
  748. //{
  749. // MessageUtil.ShowTips("此工单探伤工序点已结炉,不允许此操作!");
  750. // return;
  751. //}
  752. if (!row.Cells["ZyBillStatus"].Value.ToString().Equals("生产中"))
  753. {
  754. MessageUtil.ShowTips("此工单状态不是生产中,不允许此操作!");
  755. return;
  756. }
  757. if (uRow.Cells["OFF_NUM"].Text != "0"&&uRow.Cells["OFF_NUM"].Text != "")
  758. {
  759. MessageUtil.ShowTips("存在离线支数无法删除!");
  760. return;
  761. }
  762. //if(!QueryStatusGd(uRow.Cells["WO_ID"].Value.ToString(), uRow.Cells["ZY_PLAN_ID"].Value.ToString())) return;
  763. ArrayList list1 = new ArrayList();
  764. int UpdaCount = 0;
  765. foreach (UltraGridRow ugr in ultraGrid1.Rows)
  766. {
  767. if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true)
  768. {
  769. if (uRow.Cells["IF_ALL_OUT_WORK"].Value.ToString().Equals("是"))
  770. {
  771. MessageUtil.ShowTips("此工序已经离线,不允许此操作!");
  772. return;
  773. }
  774. UpdaCount += 1;
  775. ArrayList list = new ArrayList();
  776. list.Add(uRow.Cells["RESULT_NO"].Text.ToString());
  777. list.Add(uRow.Cells["REJECTED_PCS"].Text.ToString());
  778. list1.Add(list);
  779. }
  780. }
  781. if (UpdaCount == 0) { MessageUtil.ShowTips("请选择探伤数据!"); return; }
  782. if (MessageUtil.ShowYesNoAndQuestion("是否删除探伤实绩记录?") == DialogResult.No)
  783. {
  784. return;
  785. }
  786. CoreClientParam ccp = new CoreClientParam();
  787. try
  788. {
  789. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  790. if (Constant.WaitingForm == null)
  791. {
  792. Constant.WaitingForm = new WaitingForm();
  793. }
  794. Constant.WaitingForm.ShowToUser = true;
  795. Constant.WaitingForm.Show();
  796. Constant.WaitingForm.Update();
  797. ccp.ServerName = "com.steering.mes.mcp.coup.FrmInspection";
  798. ccp.MethodName = "deleteSandResult";
  799. ccp.ServerParams = new object[] { list1, TsGx, woId ,plinCode};
  800. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  801. this.Cursor = Cursors.Default;
  802. Constant.WaitingForm.ShowToUser = false;
  803. Constant.WaitingForm.Close();
  804. Constant.WaitingForm = null;
  805. }
  806. catch (Exception ex)
  807. {
  808. this.Cursor = Cursors.Default;
  809. Constant.WaitingForm.ShowToUser = false;
  810. Constant.WaitingForm.Close();
  811. Constant.WaitingForm = null;
  812. }
  813. if (ccp.ReturnCode != -1)
  814. {
  815. MessageUtil.ShowTips(ccp.ReturnInfo);
  816. if (ccp.ReturnInfo.Equals("删除成功!"))
  817. {
  818. QuerySinglePlan();
  819. DoClean();
  820. }
  821. }
  822. }
  823. /// <summary>
  824. /// 保存
  825. /// </summary>
  826. private void DoSave()
  827. {
  828. UltraGridRow row = this.ultraGridWoId.ActiveRow;
  829. if (row == null)
  830. {
  831. MessageUtil.ShowTips("无工单信息,不允许此操作!");
  832. return;
  833. }
  834. //if(!QueryStatusGd(row.Cells["WoId"].Value.ToString(), row.Cells["ZY_PLAN_ID"].Value.ToString())) return;
  835. if (row.Cells["DemandDetection"].Text.ToString().Equals("无探伤"))
  836. {
  837. MessageUtil.ShowTips("不需要进行此工序!");
  838. return;
  839. }
  840. //string zYgNo = row.Cells["ZY_PLAN_ID"].Value.ToString();
  841. string woId = row.Cells["WoId"].Value.ToString();
  842. if (numCenter.Value != null && !numCenter.Value.Equals(""))
  843. {
  844. if (Convert.ToInt32(numCenter.Value) < 500 || Convert.ToInt32(numCenter.Value) > 6000)
  845. {
  846. MessageUtil.ShowTips("中心棒电流强度不在500-6000之间!");
  847. return;
  848. }
  849. }
  850. if (numConcentra.Value != null && !numConcentra.Value.Equals(""))
  851. {
  852. if (Convert.ToDouble(numConcentra.Value) < 0.15 || Convert.ToDouble(numConcentra.Value) > 0.4)
  853. {
  854. MessageUtil.ShowTips("磁悬液浓度不在0.15-0.4之间!");
  855. return;
  856. }
  857. }
  858. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, zYgNo }, this.ob);
  859. //if (dt.Rows[0]["DETECT_STATUS"].ToString().Equals("生产完成"))
  860. //{
  861. // MessageUtil.ShowTips("此工单探伤工序点已结炉,不允许此操作!");
  862. // return;
  863. //}
  864. //if (!row.Cells["ZyBillStatus"].Value.ToString().Equals("生产中"))
  865. // {
  866. // MessageUtil.ShowTips("此工单状态不是生产中,不允许此操作!");
  867. // return;
  868. // }
  869. if (Convert.ToInt32(numPieces.Value.ToString()) != Convert.ToInt32(numQualified.Value.ToString()) + Convert.ToInt32(nuQualified.Value.ToString()))
  870. {
  871. MessageBox.Show("检验量=一次合格量+不合格量,请查验 ", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  872. return;
  873. }
  874. if (Convert.ToInt32(nuQualified.Value.ToString()) != Convert.ToInt32(numAmount.Value.ToString()) + Convert.ToInt32(numRejected.Value.ToString()))
  875. {
  876. MessageBox.Show("不合格量=修后复探量+废品量,请查验 ", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  877. return;
  878. }
  879. if (txtBC.Value == "")
  880. {
  881. MessageUtil.ShowTips("班次不能为空!");
  882. return;
  883. }
  884. if (txtBz.Value == "")
  885. {
  886. MessageUtil.ShowTips("班组不能为空!");
  887. return;
  888. }
  889. if (!row.Cells["Ifsplit"].Value.Equals("1"))
  890. {
  891. if (Convert.ToInt32(numPieces.Value) > CutPiece)
  892. {
  893. MessageUtil.ShowTips("探伤支数大于加工最大可切支数");
  894. return;
  895. }
  896. }
  897. ArrayList list = new ArrayList();
  898. CouplingInspectionResultEntity sand = new CouplingInspectionResultEntity();
  899. sand.InspectPieces = Convert.ToDecimal(numPieces.Value.ToString());
  900. sand.QualiriedPcs = Convert.ToDecimal(numQualified.Value.ToString());
  901. sand.RejectedPcs =Convert.ToDecimal( numRejected.Value.ToString());
  902. sand.RejectedReason = cmbReason.Text.Trim();
  903. sand.UnqualiriedPcs = Convert.ToDecimal(nuQualified.Value.ToString());
  904. sand.ColOperator = cmbOperator.Text.Trim();
  905. sand.ColShift = txtBC.Value.ToString();
  906. sand.ColGroup = txtBz.Value.ToString();
  907. sand.ColUser = this.UserInfo.GetUserName();
  908. sand.UnqualiriedReason = UncmbReason.Text.ToString();
  909. sand.AmountPcs = Convert.ToDecimal(numAmount.Value.ToString());
  910. sand.InspStandard = cmbStandard.Text.ToString();
  911. sand.Memo = txtMemo.Text.ToString();
  912. sand.MagneticPowder = cmbPowder.Text.ToString();
  913. sand.SpecimenMagnetic = tXtMagnetic.Text.ToString();
  914. sand.SpecimenType = CmbType.Text.ToString();
  915. sand.Concentration = Convert.ToDecimal(numConcentra.Value.ToString());
  916. sand.CoilIntensity = Convert.ToDecimal(numCoil.Value.ToString());
  917. sand.CenterIntensity = Convert.ToDecimal(numCenter.Value.ToString());
  918. sand.IfAllOutWork = row.Cells["IfAllOutWork"].Text.ToString();
  919. //sand.ZyPlanId = row.Cells["ZY_PLAN_ID"].Text.ToString();
  920. sand.PlineCode = row.Cells["PlineCode"].Text.ToString();
  921. sand.PlineName = row.Cells["PlineName"].Text.ToString();
  922. sand.ColTime = ProTime.Value.ToString();
  923. sand.Magtimes = MagTimes.Text.ToString() == null ? "" : MagTimes.Text.ToString();
  924. sand.Issued = this.UserInfo.GetUserName()+ "/MT-Ⅱ";
  925. //sand.WoId = row.Cells["WO_ID"].Text.ToString();
  926. sand.FinalQualified = Convert.ToInt32(numQualified.Value.ToString()) + Convert.ToInt32(numAmount.Value.ToString());
  927. sand.Position = txtPosi.Text.ToString();
  928. list.Add(JSONFormat.Format(sand));
  929. //double PlnCount = 0;//计划个数
  930. //double CutCount = 0;//实际个数
  931. //DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.coup.PhosphateResultService.queryPlanJg", new Object[] { row.Cells["ZY_PLAN_ID"].Text.ToString() }, ob);
  932. //if (dt1.Rows.Count > 0)
  933. //{
  934. // PlnCount = Double.Parse(dt1.Rows[0]["DETECT_PLN_NUM"].ToString());
  935. // CutCount = Double.Parse(dt1.Rows[0]["DETECT_OK_NUM"].ToString());
  936. //}
  937. //// + Double.Parse(numQualified.Value.ToString())
  938. //if (CutCount > PlnCount)
  939. //{
  940. // if (MessageUtil.ShowYesNoAndQuestion("实际探伤个数超过计划探伤个数是否新增!") == DialogResult.No) { return; }
  941. //}
  942. if (MessageUtil.ShowYesNoAndQuestion("是否保存探伤记录?") == DialogResult.No)
  943. {
  944. return;
  945. }
  946. CoreClientParam ccp = new CoreClientParam();
  947. try
  948. {
  949. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  950. if (Constant.WaitingForm == null)
  951. {
  952. Constant.WaitingForm = new WaitingForm();
  953. }
  954. Constant.WaitingForm.ShowToUser = true;
  955. Constant.WaitingForm.Show();
  956. Constant.WaitingForm.Update();
  957. ccp.ServerName = "com.steering.mes.mcp.coup.FrmInspection";
  958. ccp.MethodName = "addSandResult";
  959. ccp.ServerParams = new object[] { list, TsGx, woId, listF,listB };
  960. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  961. this.Cursor = Cursors.Default;
  962. Constant.WaitingForm.ShowToUser = false;
  963. Constant.WaitingForm.Close();
  964. Constant.WaitingForm = null;
  965. }
  966. catch (Exception ex)
  967. {
  968. this.Cursor = Cursors.Default;
  969. Constant.WaitingForm.ShowToUser = false;
  970. Constant.WaitingForm.Close();
  971. Constant.WaitingForm = null;
  972. }
  973. if (ccp.ReturnCode != -1)
  974. {
  975. if (ccp.ReturnInfo.Equals("保存成功!"))
  976. {
  977. MessageUtil.ShowTips(ccp.ReturnInfo);
  978. QuerySinglePlan();
  979. DoClean();
  980. }
  981. else
  982. {
  983. MessageUtil.ShowTips(ccp.ReturnInfo);
  984. }
  985. }
  986. }
  987. private void QuerySinglePlan()
  988. {
  989. string woId = "";
  990. string[] starts = { };
  991. string judgeStoveNo = "";
  992. string plnNo = "";
  993. #region 条件
  994. if (chkStarts.Checked)
  995. {
  996. if (string.IsNullOrEmpty(cmbStarts.Text.Trim()))
  997. {
  998. MessageUtil.ShowTips("请选择工单状态!");
  999. return;
  1000. }
  1001. else
  1002. {
  1003. starts = (cmbStarts.Value as List<object>).Select(p => p.ToString().Trim()).ToArray();
  1004. }
  1005. }
  1006. if (chkwoId.Checked)
  1007. {
  1008. if (chkwoId.Checked && string.IsNullOrEmpty(txtWoId.Text.Trim()))
  1009. {
  1010. MessageUtil.ShowTips("请输入工单号!");
  1011. return;
  1012. }
  1013. else
  1014. {
  1015. woId = txtWoId.Text.ToString().Trim();
  1016. }
  1017. }
  1018. else
  1019. {
  1020. woId = "";
  1021. }
  1022. if (chkPlnNo.Checked)
  1023. {
  1024. if (chkPlnNo.Checked && string.IsNullOrEmpty(txtPlnNo.Text.Trim()))
  1025. {
  1026. MessageUtil.ShowTips("请输入炉次计划号!");
  1027. return;
  1028. }
  1029. else
  1030. {
  1031. plnNo = txtPlnNo.Text.ToString().Trim();
  1032. }
  1033. }
  1034. else
  1035. {
  1036. plnNo = "";
  1037. }
  1038. if (chkJuNo.Checked)
  1039. {
  1040. if (chkJuNo.Checked && string.IsNullOrEmpty(txtJudgeStoveNO.Text.Trim()))
  1041. {
  1042. //MessageUtil.ShowTips("请输入炉号!");
  1043. //return;
  1044. judgeStoveNo = "";
  1045. }
  1046. else
  1047. {
  1048. judgeStoveNo = txtJudgeStoveNO.Text.ToString().Trim();
  1049. }
  1050. }
  1051. else
  1052. {
  1053. judgeStoveNo = "";
  1054. }
  1055. #endregion
  1056. List<PlnZyJgWorkbillEntity> listSource = EntityHelper.GetData<PlnZyJgWorkbillEntity>
  1057. ("com.steering.mes.mcp.coup.CoupLoadingService.getQueryWoId1", new object[] { woId, plnNo, judgeStoveNo, starts, plineCodes }, this.ob);
  1058. plnZyJgWorkbillEntitySource.DataSource = listSource;
  1059. //GridHelper.RefreshAndAutoSize(ultraGridWoId);
  1060. // List<PlnZyJgWorkbillEntity> listSource1 = EntityHelper.GetData<PlnZyJgWorkbillEntity>
  1061. //("com.steering.mes.mcp.coup.CoupLoadingService.ulgetQueryWoId", new object[] { woId, plnNo, judgeStoveNo, starts, plineCode[0].ToString() }, this.ob);
  1062. // bindingSource1.DataSource = listSource1;
  1063. // GridHelper.RefreshAndAutoSize(ultraGrid2);
  1064. }
  1065. /// <summary>
  1066. /// 判断状态
  1067. /// </summary>
  1068. /// <param name="woId"></param>
  1069. /// <param name="planNO"></param>
  1070. //private bool QueryStatusGd(string woId, string planNO)
  1071. //{
  1072. // DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, planNO }, this.ob);
  1073. // if (dt.Rows[0]["ZY_BILL_STATUS"].ToString().Equals("生产完成"))
  1074. // {
  1075. // MessageUtil.ShowTips("此工单已生产完成,不允许此操作!");
  1076. // return false;
  1077. // }
  1078. // if (dt.Rows[0]["DETECT_STATUS"].ToString().Equals("生产完成"))
  1079. // {
  1080. // MessageUtil.ShowTips("此工单探伤工序点已结炉,不允许此操作!");
  1081. // return false;
  1082. // }
  1083. // return true;
  1084. //}
  1085. /// <summary>
  1086. /// 按回车键触发查询按钮
  1087. /// </summary>
  1088. /// <param name="sender"></param>
  1089. /// <param name="e"></param>
  1090. private void ContPublic_KeyDown(object sender, KeyEventArgs e)
  1091. {
  1092. if (e.KeyCode == Keys.Enter)
  1093. {
  1094. QuerySinglePlan();
  1095. }
  1096. }
  1097. private void ultraGridWoId_AfterRowActivate(object sender, EventArgs e)
  1098. { UltraGridRow row = ultraGridWoId.ActiveRow;
  1099. if (row == null)return;
  1100. string planNO = row.Cells["HeatPlanNo"].Value.ToString();
  1101. string plinCode = row.Cells["PlineCode"].Value.ToString();
  1102. string woId = row.Cells["WoId"].Value.ToString();
  1103. //查询切断实绩支数和
  1104. DataTable dtCut = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupCutService.getCutResultPiece", new object[] { row.Cells["WoId"].Value.ToString() }, this.ob);
  1105. string pronum = "";
  1106. if (dtCut.Rows.Count > 0)
  1107. {
  1108. pronum = dtCut.Rows[0]["PRO_NUM"].ToString();
  1109. }
  1110. else
  1111. {
  1112. pronum = "0";
  1113. }
  1114. CutPiece = Convert.ToInt32(pronum);
  1115. //查询探伤实绩支数和
  1116. DataTable dtThread = ServerHelper.GetData("com.steering.mes.mcp.coup.FrmInspection.getInspectResult", new object[] { row.Cells["WoId"].Value.ToString() }, this.ob);
  1117. if (dtThread.Rows.Count > 0)
  1118. {
  1119. threadNum = Convert.ToInt32(dtThread.Rows[0]["PRO_NUM"].ToString());
  1120. }
  1121. else
  1122. {
  1123. threadNum = 0;
  1124. }
  1125. getCoupSandBlast(woId);
  1126. }
  1127. /// <summary>
  1128. /// 接箍加工计划详情
  1129. /// </summary>
  1130. /// <param name="planNo"></param>
  1131. //private void getCoupProcessPlan(string woId, string planNo)
  1132. //{
  1133. // DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, planNo }, this.ob);
  1134. // if (dt != null && dt.Rows.Count > 0)
  1135. // {
  1136. // this.coupWoIdPlanControl1.Value.PlineName = dt.Rows[0]["PLINE_NAME"].ToString();
  1137. // this.coupWoIdPlanControl1.Value.CutMachGrpNm = dt.Rows[0]["CUT_MACH_GRP_NM"].ToString();
  1138. // this.coupWoIdPlanControl1.Value.Memo = dt.Rows[0]["MEMO"].ToString();
  1139. // this.coupWoIdPlanControl1.Value.ZyPlanId = dt.Rows[0]["ZY_PLAN_ID"].ToString();
  1140. // this.coupWoIdPlanControl1.Value.IfMonitorJg = dt.Rows[0]["IF_MONITOR_JG"].ToString();
  1141. // this.coupWoIdPlanControl1.Value.LoadPieces = dt.Rows[0]["LOAD_PIECES"].ToString();
  1142. // this.coupWoIdPlanControl1.Value.LoadWeight = dt.Rows[0]["LOAD_WEIGHT"].ToString();
  1143. // this.coupWoIdPlanControl1.Value.ProPlanId = dt.Rows[0]["PRO_PLAN_ID"].ToString();
  1144. // this.coupWoIdPlanControl1.Value.Steelname = dt.Rows[0]["STEELNAME"].ToString();
  1145. // this.coupWoIdPlanControl1.Value.Gradename = dt.Rows[0]["GRADENAME"].ToString();
  1146. // this.coupWoIdPlanControl1.Value.JglDesc = dt.Rows[0]["JGL_DESC"].ToString();
  1147. // this.coupWoIdPlanControl1.Value.CodeJg = dt.Rows[0]["CODE_JG"].ToString();
  1148. // this.coupWoIdPlanControl1.Value.ModelDesc = dt.Rows[0]["MODEL_DESC"].ToString();
  1149. // this.coupWoIdPlanControl1.Value.SpecJgDesc = dt.Rows[0]["SPEC_JG_DESC"].ToString();
  1150. // this.coupWoIdPlanControl1.Value.StyleJg = dt.Rows[0]["STYLE_JG"].ToString();
  1151. // this.coupWoIdPlanControl1.Value.PlanJgNum = dt.Rows[0]["PLAN_JG_NUM"].ToString();
  1152. // this.coupWoIdPlanControl1.Value.CsJgNum = dt.Rows[0]["CS_JG_NUM"].ToString();
  1153. // this.coupWoIdPlanControl1.Value.XqJgNum = dt.Rows[0]["XQ_JG_NUM"].ToString();
  1154. // this.coupWoIdPlanControl1.Value.InstoreNum = dt.Rows[0]["INSTORE_NUM"].ToString();
  1155. // this.coupWoIdPlanControl1.Value.BlWlDesc = dt.Rows[0]["BL_WL_DESC"].ToString();
  1156. // //this.coupWoIdPlanControl1.Value.LoadWeight = "";
  1157. // this.coupWoIdPlanControl1.UpdateData();
  1158. // }
  1159. //}
  1160. /// <summary>
  1161. /// 查询探伤实绩
  1162. /// </summary>
  1163. /// <param name="planNo"></param>
  1164. private void getCoupSandBlast(string woId)
  1165. {
  1166. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.FrmInspection.getCoupSandBlast", new object[] { woId }, this.ob);
  1167. GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
  1168. foreach (UltraGridRow urg in ultraGrid1.Rows)
  1169. {
  1170. if (urg.Cells["CONFIRM"].Value.Equals("1"))
  1171. {
  1172. urg.Appearance.BackColor = Color.LightGreen;
  1173. }
  1174. }
  1175. txtUser.Text = this.UserInfo.GetUserName() + "/MT-Ⅱ";
  1176. }
  1177. /// <summary>
  1178. /// 清空
  1179. /// </summary>
  1180. private void DoClean()
  1181. {
  1182. nuQualified.Value = "0";
  1183. numQualified.Value = "0";
  1184. numPieces.Value = "0";
  1185. UncmbReason.Text = "";
  1186. numRejected.Value = "0";
  1187. numAmount.Value = "0";
  1188. cmbReason.Text = "";
  1189. cmbOperator.Text = "";
  1190. txtBC.Value = this.UserInfo.GetUserOrder();
  1191. txtBz.Value = this.UserInfo.GetUserGroup();
  1192. txtUser.Text = this.UserInfo.GetUserName() + "/MT-Ⅱ";
  1193. cmbStandard.Text = "";
  1194. CmbType.Text = "";
  1195. tXtMagnetic.Text = "";
  1196. cmbPowder.Text = "";
  1197. numConcentra.Text = "0.15";
  1198. numCoil.Value = "0";
  1199. numCenter.Value = "500";
  1200. txtMemo.Text = "";
  1201. }
  1202. /// <summary>
  1203. /// 不合格原因
  1204. /// </summary>
  1205. /// <param name="sender"></param>
  1206. /// <param name="e"></param>
  1207. private void nuQualified_ValueChanged(object sender, EventArgs e)
  1208. {
  1209. if (nuQualified.Value.ToString().Equals("0"))
  1210. {
  1211. UncmbReason.Enabled = false;
  1212. }
  1213. else
  1214. {
  1215. UncmbReason.Enabled = true;
  1216. }
  1217. if (nuQualified.Value.ToString().Equals("") || nuQualified.Value.ToString() == null)
  1218. {
  1219. nuQualified.Value = "0";
  1220. }
  1221. if (numQualified.Value.ToString().Equals("") || numQualified.Value.ToString() == null)
  1222. {
  1223. numQualified.Value = "0";
  1224. }
  1225. string zPieces = "";
  1226. string fPieces = "";
  1227. string gPieces = "";
  1228. if (numPieces.Text == null || numPieces.Text.Equals(""))
  1229. {
  1230. zPieces = "0";
  1231. }
  1232. else
  1233. {
  1234. zPieces = numPieces.Text.ToString();
  1235. }
  1236. if (numQualified.Text == null || numQualified.Text.Equals(""))
  1237. {
  1238. gPieces = "0";
  1239. }
  1240. else
  1241. {
  1242. gPieces = numQualified.Text.ToString();
  1243. }
  1244. if (nuQualified.Text == null || nuQualified.Text.Equals(""))
  1245. {
  1246. fPieces = "0";
  1247. }
  1248. else
  1249. {
  1250. fPieces = nuQualified.Text.ToString();
  1251. }
  1252. if (int.Parse(fPieces) > int.Parse(zPieces))
  1253. {
  1254. MessageUtil.ShowTips("一次不合格量不能大于检验量!");
  1255. return;
  1256. }
  1257. else
  1258. {
  1259. numQualified.Value = int.Parse(zPieces) - int.Parse(fPieces);
  1260. }
  1261. }
  1262. /// <summary>
  1263. /// 废品原因
  1264. /// </summary>
  1265. /// <param name="sender"></param>
  1266. /// <param name="e"></param>
  1267. private void numRejected_ValueChanged(object sender, EventArgs e)
  1268. {
  1269. if (numRejected.Value.ToString().Equals("0"))
  1270. {
  1271. cmbReason.Enabled = false;
  1272. }
  1273. else
  1274. {
  1275. cmbReason.Enabled = true;
  1276. }
  1277. }
  1278. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  1279. {
  1280. UltraGridRow ugr = ultraGrid1.ActiveRow;
  1281. if (ugr == null) return;
  1282. //if (ugr.Cells["IF_ALL_OUT_WORK"].Value.ToString().Equals("否"))
  1283. //{
  1284. //numPieces.Value = ugr.Cells["INSPECT_PIECES"].Text.ToString();
  1285. //numQualified.Value = ugr.Cells["QUALIRIED_PCS"].Text.ToString();
  1286. //nuQualified.Value = ugr.Cells["UNQUALIRIED_PCS"].Text.ToString();
  1287. //UncmbReason.Text = ugr.Cells["UNQUALIRIED_REASON"].Text.ToString();
  1288. //numRejected.Value = ugr.Cells["REJECTED_PCS"].Text.ToString();
  1289. //numAmount.Value = ugr.Cells["AMOUNT_PCS"].Text.ToString();
  1290. //cmbReason.Text = ugr.Cells["REJECTED_REASON"].Text.ToString();
  1291. //cmbOperator.Text = ugr.Cells["COL_OPERATOR"].Text.ToString();
  1292. //txtBz.Text = ugr.Cells["COL_GROUP"].Text.ToString();
  1293. //txtBC.Text = ugr.Cells["COL_SHIFT"].Text.ToString();
  1294. //txtUser.Text = ugr.Cells["COL_USER"].Text.ToString();
  1295. //cmbStandard.Text = ugr.Cells["INSP_STANDARD"].Text.ToString();
  1296. //CmbType.Text = ugr.Cells["SPECIMEN_TYPE"].Text.ToString();
  1297. //tXtMagnetic.Text = ugr.Cells["SPECIMEN_MAGNETIC"].Text.ToString();
  1298. //cmbPowder.Text = ugr.Cells["MAGNETIC_POWDER"].Text.ToString();
  1299. //numConcentra.Value = ugr.Cells["CONCENTRATION"].Text.ToString();
  1300. //numCoil.Value = ugr.Cells["COIL_INTENSITY"].Text.ToString();
  1301. //numCenter.Value = ugr.Cells["CENTER_INTENSITY"].Text.ToString();
  1302. //numVoltage.Value = ugr.Cells["VOLTAGE"].Text.ToString();
  1303. //txtMemo.Text = ugr.Cells["MEMO"].Text.ToString();
  1304. //}
  1305. }
  1306. private void chkStarts_CheckedChanged(object sender, EventArgs e)
  1307. {
  1308. if (chkStarts.Checked) { cmbStarts.Enabled = true; } else { cmbStarts.Enabled = false; }
  1309. if (chkJuNo.Checked) { txtJudgeStoveNO.Enabled = true; } else { txtJudgeStoveNO.Enabled = false; }
  1310. if (chkPlnNo.Checked) { txtPlnNo.Enabled = true; } else { txtPlnNo.Enabled = false; }
  1311. if (chkwoId.Checked) { txtWoId.Enabled = true; } else { txtWoId.Enabled = false; }
  1312. }
  1313. private void craftImg_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  1314. {
  1315. UltraGridRow row = ultraGridWoId.ActiveRow;
  1316. if (row == null) return;
  1317. string orderNo = row.Cells["OrderNoSeq"].Text.ToString();
  1318. string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilCouplingProcess2.cpt"
  1319. + "&ORDER_NO=" + orderNo;
  1320. FrmRepExcel down = new FrmRepExcel(ob, strurl);
  1321. down.Text = "接箍二级工艺";
  1322. down.Visible = false;
  1323. down.Size = new Size(740, this.Height);
  1324. down.WindowState = FormWindowState.Maximized;
  1325. down.ShowDialog();
  1326. }
  1327. private void numQualified_ValueChanged(object sender, EventArgs e)
  1328. {
  1329. if (nuQualified.Value.ToString().Equals("") || nuQualified.Value.ToString()==null)
  1330. {
  1331. nuQualified.Value = "0";
  1332. }
  1333. if (numQualified.Value.ToString().Equals("") || numQualified.Value.ToString() == null)
  1334. {
  1335. numQualified.Value = "0";
  1336. }
  1337. string zPieces = "";
  1338. string fPieces = "";
  1339. string gPieces = "";
  1340. if (numPieces.Text == null || numPieces.Text.Equals(""))
  1341. {
  1342. zPieces = "0";
  1343. }
  1344. else
  1345. {
  1346. zPieces = numPieces.Text.ToString();
  1347. }
  1348. if (numQualified.Text == null || numQualified.Text.Equals(""))
  1349. {
  1350. gPieces = "0";
  1351. }
  1352. else
  1353. {
  1354. gPieces = numQualified.Text.ToString();
  1355. }
  1356. if (nuQualified.Text == null || nuQualified.Text.Equals(""))
  1357. {
  1358. fPieces = "0";
  1359. }
  1360. else
  1361. {
  1362. fPieces = nuQualified.Text.ToString();
  1363. }
  1364. numPieces.Value = int.Parse(gPieces) + int.Parse(fPieces);
  1365. }
  1366. private void ultraGrid1_CellChange(object sender, CellEventArgs e)
  1367. {
  1368. UltraGridRow ugr = ultraGrid1.ActiveRow;
  1369. if (ugr == null) return;
  1370. //numPieces.Value = ugr.Cells["INSPECT_PIECES"].Text.ToString();
  1371. //numQualified.Value = ugr.Cells["QUALIRIED_PCS"].Text.ToString();
  1372. //nuQualified.Value = ugr.Cells["UNQUALIRIED_PCS"].Text.ToString();
  1373. //UncmbReason.Text = ugr.Cells["UNQUALIRIED_REASON"].Text.ToString();
  1374. //numRejected.Value = ugr.Cells["REJECTED_PCS"].Text.ToString();
  1375. //numAmount.Value = ugr.Cells["AMOUNT_PCS"].Text.ToString();
  1376. //cmbReason.Text = ugr.Cells["REJECTED_REASON"].Text.ToString();
  1377. //cmbOperator.Text = ugr.Cells["COL_OPERATOR"].Text.ToString();
  1378. //txtBz.Text = ugr.Cells["COL_GROUP"].Text.ToString();
  1379. //txtBC.Text = ugr.Cells["COL_SHIFT"].Text.ToString();
  1380. //txtUser.Text = ugr.Cells["COL_USER"].Text.ToString();
  1381. //cmbStandard.Text = ugr.Cells["INSP_STANDARD"].Text.ToString();
  1382. //CmbType.Text = ugr.Cells["SPECIMEN_TYPE"].Text.ToString();
  1383. //tXtMagnetic.Text = ugr.Cells["SPECIMEN_MAGNETIC"].Text.ToString();
  1384. //cmbPowder.Text = ugr.Cells["MAGNETIC_POWDER"].Text.ToString();
  1385. //numConcentra.Value = Convert.ToDouble(ugr.Cells["CONCENTRATION"].Value.ToString());
  1386. //numCoil.Value = ugr.Cells["COIL_INTENSITY"].Text.ToString();
  1387. //numCenter.Value = ugr.Cells["CENTER_INTENSITY"].Text.ToString();
  1388. //txtMemo.Text = ugr.Cells["MEMO"].Text.ToString();
  1389. }
  1390. private void numPieces_AfterEnterEditMode(object sender, EventArgs e)
  1391. {
  1392. this.BeginInvoke(new MethodInvoker(this.numPieces.SelectAll));
  1393. }
  1394. private void numQualified_AfterEnterEditMode(object sender, EventArgs e)
  1395. {
  1396. this.BeginInvoke(new MethodInvoker(this.numQualified.SelectAll));
  1397. }
  1398. private void nuQualified_AfterEnterEditMode(object sender, EventArgs e)
  1399. {
  1400. this.BeginInvoke(new MethodInvoker(this.nuQualified.SelectAll));
  1401. }
  1402. private void numAmount_AfterEnterEditMode(object sender, EventArgs e)
  1403. {
  1404. this.BeginInvoke(new MethodInvoker(this.numAmount.SelectAll));
  1405. }
  1406. private void numRejected_AfterEnterEditMode(object sender, EventArgs e)
  1407. {
  1408. this.BeginInvoke(new MethodInvoker(this.numRejected.SelectAll));
  1409. }
  1410. private void numPieces_ValueChanged(object sender, EventArgs e)
  1411. {
  1412. if (nuQualified.Value.ToString().Equals("") || nuQualified.Value.ToString() == null)
  1413. {
  1414. nuQualified.Value = "0";
  1415. }
  1416. if (numQualified.Value.ToString().Equals("") || numQualified.Value.ToString() == null)
  1417. {
  1418. numQualified.Value = "0";
  1419. }
  1420. string zPieces = "";
  1421. string fPieces = "";
  1422. string gPieces = "";
  1423. if (numPieces.Text == null || numPieces.Text.Equals(""))
  1424. {
  1425. zPieces = "0";
  1426. }
  1427. else
  1428. {
  1429. zPieces = numPieces.Text.ToString();
  1430. }
  1431. if (numQualified.Text == null || numQualified.Text.Equals(""))
  1432. {
  1433. gPieces = "0";
  1434. }
  1435. else
  1436. {
  1437. gPieces = numQualified.Text.ToString();
  1438. }
  1439. if (nuQualified.Text == null || nuQualified.Text.Equals(""))
  1440. {
  1441. fPieces = "0";
  1442. }
  1443. else
  1444. {
  1445. fPieces = nuQualified.Text.ToString();
  1446. }
  1447. numQualified.Value = int.Parse(zPieces) - int.Parse(fPieces);
  1448. }
  1449. private void numAmount_ValueChanged(object sender, EventArgs e)
  1450. {
  1451. if (nuQualified.Value.ToString().Equals("") || nuQualified.Value.ToString() == null)
  1452. {
  1453. nuQualified.Value = "0";
  1454. }
  1455. if (numRejected.Value.ToString().Equals("") || numRejected.Value.ToString() == null)
  1456. {
  1457. numRejected.Value = "0";
  1458. }
  1459. string zPieces = "";
  1460. string fPieces = "";
  1461. string gPieces = "";
  1462. if (nuQualified.Text == null || nuQualified.Text.Equals(""))
  1463. {
  1464. zPieces = "0";
  1465. }
  1466. else
  1467. {
  1468. zPieces = nuQualified.Text.ToString();
  1469. }
  1470. if (numAmount.Text == null || numAmount.Text.Equals(""))
  1471. {
  1472. gPieces = "0";
  1473. }
  1474. else
  1475. {
  1476. gPieces = numAmount.Text.ToString();
  1477. }
  1478. if (numRejected.Text == null || numRejected.Text.Equals(""))
  1479. {
  1480. fPieces = "0";
  1481. }
  1482. else
  1483. {
  1484. fPieces = numRejected.Text.ToString();
  1485. }
  1486. if (int.Parse(gPieces) > int.Parse(zPieces))
  1487. {
  1488. MessageUtil.ShowTips("修后复探量不能大于一次合格量!");
  1489. return;
  1490. }
  1491. numRejected.Value = int.Parse(zPieces) - int.Parse(gPieces);
  1492. }
  1493. private void utUpLoad1_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  1494. {
  1495. //var entity = ultraGrid1.ActiveRow.ListObject as CouplingInspectionResultEntity;
  1496. //if (entity == null) return;
  1497. UltraGridRow row = ultraGrid1.ActiveRow;
  1498. if (row == null) return;
  1499. string resultNo = row.Cells["RESULT_NO"].Value.ToString();
  1500. string judgeNo = row.Cells["JUDGE_STOVE_NO"].Value.ToString();
  1501. string batchNo = row.Cells["BATCH_NO"].Value.ToString();
  1502. string woid = row.Cells["WO_ID"].Value.ToString();
  1503. if (e.Button.Key == "VIEW")
  1504. {
  1505. var strurl = "";
  1506. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=CouplingInspect.cpt&op=view&resultNo=" + resultNo;
  1507. var fre = new FrmRepExcel(ob, strurl);
  1508. fre.AutoSize = true;
  1509. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width,
  1510. Screen.PrimaryScreen.WorkingArea.Height);
  1511. fre.WindowState = FormWindowState.Maximized;
  1512. fre.Show();
  1513. }
  1514. else if (e.Button.Key == "UPLOAD")
  1515. {
  1516. var strurl = "";
  1517. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=CouplingInspect.cpt&format=pdf&resultNo=" + resultNo;
  1518. var webClient = new WebClient();
  1519. var listPdf = new List<FileBean>();
  1520. var date = DateTime.Now.ToString("yyyyMMdd");
  1521. var filePathNew = ""; //报告目录
  1522. var reportNo = ""; //报告编号
  1523. filePathNew = "Coupling/Inspection/" + judgeNo + "/" + batchNo + "/" + woid + "/";
  1524. reportNo = resultNo + "_0";
  1525. var pdf = webClient.DownloadData(strurl);
  1526. var fileBean = new FileBean();
  1527. fileBean.setFile(pdf);
  1528. fileBean.setFileName(reportNo + ".pdf");
  1529. fileBean.setPathName(filePathNew);
  1530. listPdf.Add(fileBean);
  1531. webClient.Dispose();
  1532. var a = FileHelper.Upload(listPdf);
  1533. if (a)
  1534. {
  1535. ServerHelper.SetData("com.steering.mes.mcp.coup.FrmInspection.UpdateReportUrl",
  1536. new object[] { resultNo, filePathNew + reportNo + ".pdf" }, ob);
  1537. MessageUtil.ShowTips("上传报告成功!");
  1538. //GetHttCrackDetectionEtEntity(entity.WoId);
  1539. }
  1540. }
  1541. else
  1542. {
  1543. MessageUtil.ShowError("系统生成PDF失败,请稍后再试!");
  1544. }
  1545. }
  1546. private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e)
  1547. {
  1548. var CouplingInspectEtEntity = e.Row.ListObject as CouplingInspectionResultEntity;
  1549. if (CouplingInspectEtEntity==null)
  1550. { }
  1551. else
  1552. {
  1553. //ultraGrid1.DisplayLayout.Bands[0].Groups["NewGroup0"].Hidden = false;
  1554. e.Row.Cells["Report"].Appearance.BackColor = string.IsNullOrEmpty(CouplingInspectEtEntity.Report)
  1555. ? Color.Red
  1556. : Color.LightGreen;
  1557. e.Row.Cells["Report"].EditorComponent = utUpLoad1;
  1558. }
  1559. }
  1560. private void UncmbReason_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  1561. {
  1562. UltraGridRow row = ultraGridWoId.ActiveRow;
  1563. if (row == null) return;
  1564. string woid = row.Cells["WoId"].Text.ToString();
  1565. string judgeNo = row.Cells["JudgeStoveNo"].Text.ToString();
  1566. ComCoupBugReasion ccb = new ComCoupBugReasion(woid, judgeNo,"2", ob);
  1567. ccb.ShowDialog();
  1568. listF = ccb.List;
  1569. UncmbReason.Text = ccb.strMemo.ToString();
  1570. }
  1571. private void cmbReason_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  1572. {
  1573. UltraGridRow row = ultraGridWoId.ActiveRow;
  1574. if (row == null) return;
  1575. string woid = row.Cells["WoId"].Text.ToString();
  1576. string judgeNo = row.Cells["JudgeStoveNo"].Text.ToString();
  1577. ComCoupBugReasion ccb = new ComCoupBugReasion(woid, judgeNo, "1", ob);
  1578. ccb.ShowDialog();
  1579. listB = ccb.List;
  1580. cmbReason.Text = ccb.strMemo.ToString();
  1581. }
  1582. private void numConcentra_AfterEnterEditMode(object sender, EventArgs e)
  1583. {
  1584. this.BeginInvoke(new MethodInvoker(this.numConcentra.SelectAll));
  1585. }
  1586. private void numCenter_AfterEnterEditMode(object sender, EventArgs e)
  1587. {
  1588. this.BeginInvoke(new MethodInvoker(this.numCenter.SelectAll));
  1589. }
  1590. private void numCoil_AfterEnterEditMode(object sender, EventArgs e)
  1591. {
  1592. this.BeginInvoke(new MethodInvoker(this.numCoil.SelectAll));
  1593. }
  1594. private void txtPosi_ValueChanged(object sender, EventArgs e)
  1595. {
  1596. if (txtPosi.Text.Equals("内外表面纵向"))
  1597. {
  1598. numCoil.Enabled = false;
  1599. }
  1600. else
  1601. {
  1602. numCoil.Enabled = true;
  1603. }
  1604. }
  1605. private void txtBz_ValueChanged(object sender, EventArgs e)
  1606. {
  1607. //根据班组获取操作工
  1608. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.FrmInspection.getComBaseInfo", new object[] { "7034", txtBz.Text.ToString() }, this.ob);
  1609. cmbOperator.DataSource = dt;
  1610. cmbOperator.DisplayMember = "BASENAME";
  1611. YdmBaseClass.SetComboItemHeight(cmbOperator);
  1612. }
  1613. }
  1614. }