FrmBaoJianResult.cs 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Format;
  3. using Core.Mes.Client.Comm.Server;
  4. using Core.Mes.Client.Comm.Tool;
  5. using Core.StlMes.Client.Mcp.VRP.Entity;
  6. using CoreFS.CA06;
  7. using Infragistics.Win.UltraWinGrid;
  8. using System;
  9. using System.Collections;
  10. using System.Collections.Generic;
  11. using System.ComponentModel;
  12. using System.Data;
  13. using System.Drawing;
  14. using System.Linq;
  15. using System.Text;
  16. using System.Windows.Forms;
  17. namespace Core.StlMes.Client.Mcp.VRP.Vrp
  18. {
  19. public partial class FrmBaoJianResult : FrmBase
  20. {
  21. public FrmBaoJianResult()
  22. {
  23. InitializeComponent();
  24. }
  25. private string Processcode = "";//参数
  26. private DataTable _dtPline = null;
  27. private void FrmBaoJianResult_Load(object sender, EventArgs e)
  28. {
  29. EntityHelper.ShowGridCaption<BaoJiaoResultMainEntity>(ultraGrid1.DisplayLayout.Bands[0]);//中文注释替换字段名
  30. EntityHelper.ShowGridCaption<BaoJiaoResultDetailEntity>(ultraGrid2.DisplayLayout.Bands[0]);
  31. this.BeginTime.Value = System.DateTime.Now.AddDays(-1);//设置开始日期为前一天
  32. this.EndTime.Value = System.DateTime.Now.AddDays(0);//设置结束日期为当前日期
  33. Processcode = this.CustomInfo.ToString();//参数
  34. _dtPline = ServerHelper.GetData("com.steering.mes.mcp.Vrp.FrmBaoJianResult.doQueryPlineCode", new object[] { Processcode }, ob);
  35. }
  36. /// <summary>
  37. /// 设置条件参数的可选状态随选中按钮变化
  38. /// </summary>
  39. /// <param name="sender"></param>
  40. /// <param name="e"></param>
  41. private void checkBox2_CheckedChanged(object sender, EventArgs e)
  42. {
  43. this.PlcodeEditor.Enabled = this.ChkPlcode.Checked;
  44. }
  45. private void checkBox4_CheckedChanged(object sender, EventArgs e)
  46. {
  47. this.InsflagOptionSet.Enabled = this.ChkInsflag.Checked;
  48. }
  49. private void checkBox5_CheckedChanged(object sender, EventArgs e)
  50. {
  51. this.ResultOptionSet.Enabled = this.ChkResult.Checked;
  52. }
  53. private void checkBox3_CheckedChanged(object sender, EventArgs e)
  54. {
  55. this.JudstNoEditor.Enabled = this.ChkJudstNo.Checked;
  56. }
  57. private void Chkdealflag_CheckedChanged(object sender, EventArgs e)
  58. {
  59. this.DealflagOptionSet.Enabled = this.Chkdealflag.Checked;
  60. }
  61. /// <summary>
  62. /// 设置关键字与产销软件对应
  63. /// </summary>
  64. /// <param name="sender"></param>
  65. /// <param name="ToolbarKey"></param>
  66. public override void ToolBar_Click(object sender, string ToolbarKey)
  67. {
  68. switch (ToolbarKey)
  69. {
  70. case "Query":
  71. doQuery();
  72. break;
  73. case "Save":
  74. doSave();
  75. break;
  76. case "Chuzhi":
  77. doChuzhi();
  78. break;
  79. case "RevokeChuzhi":
  80. doRevokeChuzhi();
  81. break;
  82. case "Del":
  83. doDel();
  84. break;
  85. case "RevokeDel":
  86. doRevokeDel();
  87. break;
  88. case "UpdateActCount":
  89. doUpdateActCount();
  90. break;
  91. case "PrintReport":
  92. doPrintReport();
  93. break;
  94. case "PrintReportZG":
  95. doPrintReportZG();
  96. break;
  97. case "PrintReportCP":
  98. doPrintReportCP();
  99. break;
  100. case "PrintReportTestKey":
  101. doPrintReportTestKey();
  102. break;
  103. case "Close":
  104. this.Close();
  105. break;
  106. case "Export":
  107. Export();
  108. break;
  109. case "UpdateInsflag1":
  110. doUpdateInsflag1();
  111. break;
  112. case "UpdateInsflag2":
  113. doUpdateInsflag2();
  114. break;
  115. }
  116. }
  117. /// <summary>
  118. /// 查询报检主表
  119. /// </summary>
  120. public void doQuery()
  121. {
  122. string begintime = "";
  123. string endtime = "";
  124. string plinecode = "";
  125. string inspectionflag = "";
  126. string result = "";
  127. string judgestoveno = "";
  128. string validflag = "";
  129. string disposalflag = "";
  130. ArrayList list = new ArrayList();
  131. if(ChkTime.Checked){
  132. if(DateTime.Parse(this.BeginTime.Value.ToString())>DateTime.Parse(this.EndTime.Value.ToString())){
  133. MessageUtil.ShowTips("开始时间不能大于结束时间!");
  134. return;
  135. }
  136. else
  137. {
  138. begintime = this.BeginTime.Value.ToString("yyyy-MM-dd 07:00:00");
  139. endtime = this.EndTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  140. }
  141. }
  142. if(this.ChkPlcode.Checked && this.PlcodeEditor.Text.Trim() != ""){
  143. string pc = PlcodeEditor.Tag.ToString();
  144. plinecode = PlcodeEditor.Tag.ToString().Replace(",", "', '");
  145. }
  146. if(this.ChkInsflag.Checked){
  147. inspectionflag = this.InsflagOptionSet.CheckedItem.DataValue.ToString();
  148. }
  149. if(this.ChkResult.Checked){
  150. result = this.ResultOptionSet.CheckedItem.DataValue.ToString();
  151. }
  152. if(this.ChkJudstNo.Checked && this.JudstNoEditor.Text.Trim() !=""){
  153. judgestoveno = this.JudstNoEditor.Text.Trim();
  154. }
  155. if (this.ChkValid.Checked)
  156. {
  157. validflag = "0";
  158. }
  159. if (this.Chkdealflag.Checked)
  160. {
  161. disposalflag = this.DealflagOptionSet.CheckedItem.DataValue.ToString();
  162. }
  163. list.Add(begintime);
  164. list.Add(endtime);
  165. list.Add(plinecode);
  166. list.Add(inspectionflag);
  167. list.Add(result);
  168. list.Add(judgestoveno);
  169. list.Add(Processcode);
  170. list.Add(validflag);
  171. list.Add(disposalflag);
  172. //WaitingForm2 wf = new WaitingForm2("正在加载,请稍候....");
  173. List<BaoJiaoResultMainEntity> listSourcemain = EntityHelper.GetData<BaoJiaoResultMainEntity>(
  174. "com.steering.mes.mcp.Vrp.FrmBaoJianResult.QueryMain", new object[] { list }, this.ob);
  175. baoJiaoResultMainEntityBindingSource.DataSource = listSourcemain;
  176. }
  177. /// <summary>
  178. /// 查询报检子表
  179. /// </summary>
  180. /// <param name="sender"></param>
  181. /// <param name="e"></param>
  182. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  183. {
  184. string inspectionno = "";
  185. string inspectionnum = "";
  186. ArrayList list = new ArrayList();
  187. inspectionno = this.ultraGrid1.ActiveRow.Cells["inspectionNo"].Value.ToString();
  188. inspectionnum = this.ultraGrid1.ActiveRow.Cells["inspectionNum"].Value.ToString();
  189. list.Add(inspectionno);
  190. list.Add(inspectionnum);
  191. List<BaoJiaoResultDetailEntity> listSourcedetail = EntityHelper.GetData<BaoJiaoResultDetailEntity>(
  192. "com.steering.mes.mcp.Vrp.FrmBaoJianResult.QueryDetail", new object[] { list }, this.ob);
  193. baoJiaoResultDetailEntityBindingSource.DataSource = listSourcedetail;
  194. List<BaoJiaoResultMainEntity> listSourcemain = EntityHelper.GetData<BaoJiaoResultMainEntity>(
  195. "com.steering.mes.mcp.Vrp.FrmBaoJianResult.QueryMain1", new object[] { list }, this.ob);
  196. var list1 = listSourcemain.ToList();
  197. var recheck = list1.Select(p => p.Recheck).ToList();
  198. foreach(var item in recheck){
  199. if(item.Equals("已重检")){
  200. this.ultraGrid2.Enabled = false;
  201. }
  202. }
  203. string disposalflag = this.ultraGrid1.ActiveRow.Cells["disposalFlag"].Value.ToString();
  204. string validflag = this.ultraGrid1.ActiveRow.Cells["validFlag"].Value.ToString();
  205. if (disposalflag.Equals("已完成") || validflag.Equals("无效"))
  206. {
  207. this.ultraGrid2.Enabled = false;
  208. }
  209. else
  210. {
  211. this.ultraGrid2.Enabled = true;
  212. }
  213. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  214. {
  215. if (ugr.Cells["validflag"].Text.ToString().Equals("无效"))
  216. {
  217. ugr.Appearance.ForeColor = Color.Red;
  218. }
  219. else
  220. {
  221. ugr.Appearance.ForeColor = Color.Black;
  222. }
  223. }
  224. }
  225. /// <summary>
  226. /// 修改报检子表字段信息
  227. /// </summary>
  228. public void doSave()
  229. {
  230. if(!ultraGrid1.ActiveRow.Cells["inspectionflag"].Text.ToString().Equals("待检") &&
  231. !ultraGrid1.ActiveRow.Cells["inspectionflag"].Text.ToString().Equals("已检"))
  232. {
  233. MessageUtil.ShowTips("抽检状态不符,无法修改!");
  234. return;
  235. }
  236. string flag = "1";
  237. foreach (UltraGridRow ugr1 in ultraGrid2.Rows) {
  238. if (ugr1 == null)
  239. {
  240. MessageUtil.ShowTips("无数据!");
  241. return;
  242. }
  243. string s = ugr1.Cells["result"].Text.ToString();
  244. if (ugr1.Cells["result"].Text.ToString().Equals(""))
  245. {
  246. MessageUtil.ShowTips("检验结果项不能为空!请重试!");
  247. return;
  248. }
  249. }
  250. if (MessageUtil.ShowYesNoAndQuestion("确认保存?") == DialogResult.No)
  251. {
  252. return;
  253. }
  254. foreach(UltraGridRow ugr in ultraGrid2.Rows){
  255. ArrayList list = new ArrayList();
  256. string Result = ugr.Cells["result"].Text.ToString();
  257. string Reasons = ugr.Cells["reasons"].Text.ToString();
  258. string Mome = ugr.Cells["mome"].Text.ToString();
  259. string detectiondode = ugr.Cells["detectionCode"].Text.ToString();
  260. string Guid = ugr.Cells["guid"].Text.ToString();
  261. list.Add(Result);
  262. list.Add(Reasons);
  263. list.Add(Mome);
  264. list.Add(detectiondode);
  265. list.Add(Guid);
  266. CoreClientParam ccp = new CoreClientParam();
  267. ccp.ServerName = "com.steering.mes.mcp.Vrp.FrmBaoJianResult";
  268. ccp.MethodName = "SaveDetail";
  269. ccp.ServerParams = new object[] { list };
  270. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  271. if(ccp.ReturnCode == -1){
  272. flag = "0";
  273. MessageUtil.ShowTips(ccp.ReturnInfo);
  274. }
  275. }
  276. if(flag == "1"){
  277. UpdateMain();
  278. doQuery();
  279. MessageUtil.ShowTips("修改成功!");
  280. }
  281. }
  282. /// <summary>
  283. /// 根据子表result更新主表inspectionresult
  284. /// </summary>
  285. public void UpdateMain()
  286. {
  287. UltraGridRow mainrow = ultraGrid1.ActiveRow;
  288. BaoJiaoResultMainEntity baojianresultmainentity = (BaoJiaoResultMainEntity)ultraGrid1.ActiveRow.ListObject;
  289. baojianresultmainentity.InspectionNo = mainrow.Cells["Inspectionno"].Text.ToString();
  290. baojianresultmainentity.InspectionNum = decimal.Parse(mainrow.Cells["Inspectionnum"].Text.ToString());
  291. baojianresultmainentity.InspectionTime = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  292. baojianresultmainentity.InspectionName = this.UserInfo.GetUserName();
  293. baojianresultmainentity.UnqualifiedReasons = "";
  294. baojianresultmainentity.InspectionResult = "";
  295. foreach (UltraGridRow ugr in this.ultraGrid2.Rows)
  296. {
  297. string result = ugr.Cells["result"].Text.ToString();
  298. if (result=="不合格")
  299. {
  300. baojianresultmainentity.InspectionResult = "不合格";
  301. baojianresultmainentity.UnqualifiedReasons +=
  302. //ugr.Cells["projectCategory"].Text.ToString() + "-" +
  303. ugr.Cells["projectName"].Text.ToString() + "-" +
  304. ugr.Cells["reasons"].Text.ToString() +"\n";
  305. baojianresultmainentity.DisposalFlag = "0";
  306. }
  307. }
  308. if(baojianresultmainentity.InspectionResult.Equals("")){
  309. baojianresultmainentity.InspectionResult = "合格";
  310. baojianresultmainentity.DisposalFlag = "";
  311. }
  312. if (!baojianresultmainentity.UnqualifiedReasons.Equals(""))
  313. {
  314. baojianresultmainentity.UnqualifiedReasons = baojianresultmainentity.UnqualifiedReasons.Substring(0, baojianresultmainentity.UnqualifiedReasons.Length - 1);
  315. }
  316. string jsonstr = JSONFormat.Format(baojianresultmainentity);
  317. CoreClientParam ccp1 = new CoreClientParam();
  318. ccp1.ServerName = "com.steering.mes.mcp.Vrp.FrmBaoJianResult";
  319. ccp1.MethodName = "UpdateMain";
  320. ccp1.ServerParams = new object[] { jsonstr };
  321. ccp1 = ob.ExecuteNonQuery(ccp1, CoreInvokeType.Internal);
  322. }
  323. /// <summary>
  324. /// 处置
  325. /// </summary>
  326. public void doChuzhi()
  327. {
  328. UltraGridRow mainrow = ultraGrid1.ActiveRow;
  329. if (mainrow.Cells["validflag"].Text.ToString().Equals("无效"))
  330. {
  331. MessageUtil.ShowTips("无效数据!无法进行操作!");
  332. return;
  333. }
  334. if (mainrow.Cells["inspectionResult"].Text.ToString().Equals("合格") ||
  335. mainrow.Cells["inspectionResult"].Text.ToString().Equals(""))
  336. {
  337. MessageUtil.ShowTips("报检结果不符,不能处置!");
  338. return;
  339. }
  340. if (mainrow.Cells["disposalMethod"].Text.ToString().Equals(""))
  341. {
  342. MessageUtil.ShowTips("处置方式不能为空!请重试!");
  343. return;
  344. }
  345. if (MessageUtil.ShowYesNoAndQuestion("确认处置?") == DialogResult.No)
  346. {
  347. return;
  348. }
  349. BaoJiaoResultMainEntity baojianresultmainentity = (BaoJiaoResultMainEntity)ultraGrid1.ActiveRow.ListObject;
  350. baojianresultmainentity.InspectionNo = mainrow.Cells["inspectionNo"].Text.ToString();
  351. baojianresultmainentity.InspectionNum = decimal.Parse(mainrow.Cells["Inspectionnum"].Text.ToString());
  352. baojianresultmainentity.DisposalMethod = mainrow.Cells["disposalMethod"].Text.ToString();
  353. baojianresultmainentity.DisposalFlag = "1";
  354. baojianresultmainentity.DisposalTime = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  355. baojianresultmainentity.DisposalName = this.UserInfo.GetUserName();
  356. string jsonstr = JSONFormat.Format(baojianresultmainentity);
  357. CoreClientParam ccp = new CoreClientParam();
  358. ccp.ServerName = "com.steering.mes.mcp.Vrp.FrmBaoJianResult";
  359. ccp.MethodName = "Chuzhi";
  360. ccp.ServerParams = new object[]{ jsonstr };
  361. ccp = ob.ExecuteNonQuery(ccp,CoreInvokeType.Internal);
  362. if(ccp.ReturnCode != -1){
  363. if(ccp.ReturnInfo.Equals("处置成功!")){
  364. doQuery();
  365. MessageUtil.ShowTips(ccp.ReturnInfo);
  366. }
  367. else
  368. {
  369. MessageUtil.ShowTips(ccp.ReturnInfo);
  370. }
  371. }
  372. }
  373. /// <summary>
  374. /// 撤销处置
  375. /// </summary>
  376. public void doRevokeChuzhi()
  377. {
  378. UltraGridRow mainrow = ultraGrid1.ActiveRow;
  379. if (mainrow.Cells["validflag"].Text.ToString().Equals("无效"))
  380. {
  381. MessageUtil.ShowTips("无效数据!无法进行操作!");
  382. return;
  383. }
  384. if (!mainrow.Cells["disposalFlag"].Text.ToString().Equals("已完成"))
  385. {
  386. MessageUtil.ShowTips("还未进行处置,不能撤销!");
  387. return;
  388. }
  389. if (MessageUtil.ShowYesNoAndQuestion("确认撤销处置?") == DialogResult.No)
  390. {
  391. return;
  392. }
  393. BaoJiaoResultMainEntity baojianresultmainentity = (BaoJiaoResultMainEntity)ultraGrid1.ActiveRow.ListObject;
  394. baojianresultmainentity.InspectionNo = mainrow.Cells["inspectionNo"].Text.ToString();
  395. baojianresultmainentity.InspectionNum = decimal.Parse(mainrow.Cells["Inspectionnum"].Text.ToString());
  396. baojianresultmainentity.DisposalMethod = "";
  397. baojianresultmainentity.DisposalFlag = "0";
  398. baojianresultmainentity.DisposalTime = "";
  399. baojianresultmainentity.DisposalName = "";
  400. string jsonstr = JSONFormat.Format(baojianresultmainentity);
  401. CoreClientParam ccp = new CoreClientParam();
  402. ccp.ServerName = "com.steering.mes.mcp.Vrp.FrmBaoJianResult";
  403. ccp.MethodName = "RevokeChuzhi";
  404. ccp.ServerParams = new object[] { jsonstr };
  405. ccp = ob.ExecuteNonQuery(ccp,CoreInvokeType.Internal);
  406. if(ccp.ReturnCode != -1){
  407. if(ccp.ReturnInfo.Equals("撤销成功!")){
  408. doQuery();
  409. MessageUtil.ShowTips(ccp.ReturnInfo);
  410. }
  411. else
  412. {
  413. MessageUtil.ShowTips(ccp.ReturnInfo);
  414. }
  415. }
  416. }
  417. /// <summary>
  418. /// 废除
  419. /// </summary>
  420. public void doDel()
  421. {
  422. UltraGridRow mainrow = ultraGrid1.ActiveRow;
  423. if (mainrow.Cells["validflag"].Text.ToString().Equals("无效"))
  424. {
  425. MessageUtil.ShowTips("已经退回的数据无法再废除!");
  426. return;
  427. }
  428. ArrayList list = new ArrayList();
  429. string inspectionNo = "";
  430. string inspectionNum = "";
  431. inspectionNo = mainrow.Cells["inspectionNo"].Text.ToString();
  432. inspectionNum = mainrow.Cells["inspectionNum"].Text.ToString();
  433. list.Add(inspectionNo);
  434. list.Add(inspectionNum);
  435. if(MessageUtil.ShowYesNoAndQuestion("确认退回?") == DialogResult.No) return;
  436. CoreClientParam ccp = new CoreClientParam();
  437. ccp.ServerName = "com.steering.mes.mcp.Vrp.FrmBaoJianResult";
  438. ccp.MethodName = "DelMain";
  439. ccp.ServerParams = new object[] { list };
  440. ccp = ob.ExecuteNonQuery(ccp,CoreInvokeType.Internal);
  441. int returncode = ccp.ReturnCode;
  442. if(returncode != -1){
  443. if (ccp.ReturnInfo.Equals("退回成功!"))
  444. {
  445. doQuery();
  446. MessageUtil.ShowTips(ccp.ReturnInfo);
  447. }
  448. }
  449. else
  450. {
  451. MessageUtil.ShowTips(ccp.ReturnInfo);
  452. }
  453. }
  454. /// <summary>
  455. /// 撤销废除
  456. /// </summary>
  457. public void doRevokeDel()
  458. {
  459. UltraGridRow mainrow = ultraGrid1.ActiveRow;
  460. if (mainrow.Cells["validflag"].Text.ToString().Equals("有效"))
  461. {
  462. MessageUtil.ShowTips("有效数据,无法撤销废除!");
  463. return;
  464. }
  465. if (MessageUtil.ShowYesNoAndQuestion("确认撤销废除?") == DialogResult.No)
  466. {
  467. return;
  468. }
  469. ArrayList list = new ArrayList();
  470. string inspectionno = mainrow.Cells["inspectionNo"].Text.ToString();
  471. string inspectionnum = mainrow.Cells["inspectionNum"].Text.ToString();
  472. list.Add(inspectionno);
  473. list.Add(inspectionnum);
  474. CoreClientParam ccp = new CoreClientParam();
  475. ccp.ServerName = "com.steering.mes.mcp.Vrp.FrmBaoJianResult";
  476. ccp.MethodName = "RevokeDel";
  477. ccp.ServerParams = new object[] { list };
  478. ccp = ob.ExecuteNonQuery(ccp,CoreInvokeType.Internal);
  479. if(ccp.ReturnCode != -1){
  480. if(ccp.ReturnInfo.Equals("撤销废除成功!")){
  481. doQuery();
  482. MessageUtil.ShowTips(ccp.ReturnInfo);
  483. }
  484. }
  485. else
  486. {
  487. MessageUtil.ShowTips(ccp.ReturnInfo);
  488. }
  489. }
  490. #region 抽检doChoujian()
  491. /// <summary>
  492. /// 抽检
  493. /// </summary>
  494. public void doChoujian()
  495. {
  496. ArrayList listPT = new ArrayList();
  497. foreach(UltraGridRow ugr in this.ultraGrid1.Rows){
  498. if (ugr.Cells["gradecode"].Text.ToString() == "20" &&
  499. ugr.Cells["stdCode"].Text.ToString() == "8162" ||
  500. ugr.Cells["stdCode"].Text.ToString() == "8163" &&
  501. ugr.Cells["InspectionFlag"].Text.ToString().Equals("待抽") &&
  502. ugr.Cells["validflag"].Text.ToString().Equals("有效"))
  503. {
  504. string idcode = ugr.Cells["idcode"].Text.ToString();
  505. listPT.Add(idcode);
  506. }
  507. else
  508. {
  509. if (ugr.Cells["validflag"].Text.ToString().Equals("无效"))
  510. {
  511. return;
  512. }
  513. if (ugr.Cells["inspectionFlag"].Text.ToString().Equals("待抽"))
  514. {
  515. ArrayList listTS = new ArrayList();
  516. string idcode = ugr.Cells["idcode"].Text.ToString();
  517. listTS.Add(idcode);
  518. CoreClientParam ccpTS = new CoreClientParam();
  519. ccpTS.ServerName = "com.steering.mes.mcp.Vrp.FrmBaoJianResult";
  520. ccpTS.MethodName = "ChoujianTS";
  521. ccpTS.ServerParams = new object[] { listTS };
  522. ccpTS = ob.ExecuteNonQuery(ccpTS, CoreInvokeType.Internal);
  523. if(ccpTS.ReturnCode == -1){
  524. MessageUtil.ShowTips(ccpTS.ReturnInfo);
  525. return;
  526. }
  527. }
  528. }
  529. }
  530. CoreClientParam ccpPT = new CoreClientParam();
  531. ccpPT.ServerName = "com.steering.mes.mcp.Vrp.FrmBaoJianResult";
  532. ccpPT.MethodName = "ChoujianPT";
  533. ccpPT.ServerParams = new object[] { listPT };
  534. ccpPT = ob.ExecuteNonQuery(ccpPT, CoreInvokeType.Internal);
  535. if(ccpPT.ReturnCode != -1){
  536. if(ccpPT.ReturnInfo.Equals("已抽检!")){
  537. doQuery();
  538. MessageUtil.ShowTips(ccpPT.ReturnInfo);
  539. }
  540. }
  541. else
  542. {
  543. MessageUtil.ShowTips(ccpPT.ReturnInfo);
  544. }
  545. }
  546. #endregion
  547. /// <summary>
  548. /// 修改支数
  549. /// </summary>
  550. public void doUpdateActCount()
  551. {
  552. UltraGridRow ugr = ultraGrid1.ActiveRow;
  553. if(!ugr.Cells["inspectionFlag"].Text.ToString().Equals("待检")){
  554. MessageUtil.ShowTips("抽检状态不符,不能修改支数!");
  555. return;
  556. }
  557. ArrayList list = new ArrayList();
  558. string inspectionno = ugr.Cells["inspectionNo"].Text.ToString();
  559. string inspectionum = ugr.Cells["inspectionNum"].Text.ToString();
  560. decimal countpre = decimal.Parse(ugr.Cells["actCount"].Value.ToString());
  561. decimal count = decimal.Parse(ugr.Cells["actCount"].Text.ToString());
  562. if(count>countpre){
  563. MessageUtil.ShowTips("修改后的支数不能大于原支数!");
  564. return;
  565. }
  566. if (MessageUtil.ShowYesNoAndQuestion("确认修改?") == DialogResult.No)
  567. {
  568. return;
  569. }
  570. string countnew = count.ToString();
  571. decimal weightpre = decimal.Parse(ugr.Cells["actWeight"].Text.ToString());
  572. decimal eachweight = (weightpre / countpre);
  573. string weightnew = Math.Round((eachweight * count),2).ToString();
  574. string scarpnum = (countpre - count).ToString();
  575. string scarpwt = (weightpre - decimal.Parse(weightnew)).ToString();
  576. list.Add(inspectionno);
  577. list.Add(inspectionum);
  578. list.Add(countnew);
  579. list.Add(weightnew);
  580. list.Add(scarpnum);
  581. list.Add(scarpwt);
  582. CoreClientParam ccp = new CoreClientParam();
  583. ccp.ServerName = "com.steering.mes.mcp.Vrp.FrmBaoJianResult";
  584. ccp.MethodName = "UpdateActCount";
  585. ccp.ServerParams = new object[] { list };
  586. ccp = ob.ExecuteNonQuery(ccp,CoreInvokeType.Internal);
  587. if(ccp.ReturnCode != -1){
  588. if(ccp.ReturnInfo.Equals("修改成功!")){
  589. doQuery();
  590. MessageUtil.ShowTips(ccp.ReturnInfo);
  591. }
  592. }
  593. else
  594. {
  595. MessageUtil.ShowTips(ccp.ReturnInfo);
  596. }
  597. }
  598. /// <summary>
  599. /// 打印报检单
  600. /// </summary>
  601. public void doPrintReport()
  602. {
  603. UltraGridRow ugr = ultraGrid1.ActiveRow;
  604. if (ugr == null)
  605. {
  606. MessageUtil.ShowTips("未查询到数据!");
  607. return;
  608. }
  609. string inspectionno = ugr.Cells["inspectionno"].Text.ToString();
  610. string inspectionnum = ugr.Cells["inspectionnum"].Text.ToString();
  611. string heatplanno = ugr.Cells["heatplanno"].Text.ToString();
  612. string judgestoveno = ugr.Cells["judgestoveno"].Text.ToString();
  613. string plinecode = ugr.Cells["plinecode"].Text.ToString();
  614. string processcode = ugr.Cells["processcode"].Text.ToString();
  615. var strurl = "";
  616. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepPipeBj.cpt&INSPECTION_NO=" +
  617. inspectionno + "&INSPECTION_NUM=" + inspectionnum + "&HEAT_PLAN_NO=" + heatplanno +
  618. "&JUDGE_STOVE_NO=" + judgestoveno + "&PLINE_CODE=" + plinecode + "&PROCESS_CODE=" + processcode;
  619. var fre = new FrmRepExcel(ob,strurl);
  620. fre.AutoSize = true;
  621. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  622. fre.WindowState = FormWindowState.Maximized;
  623. fre.Show();
  624. }
  625. /// <summary>
  626. /// 打印整改单
  627. /// </summary>
  628. public void doPrintReportZG()
  629. {
  630. UltraGridRow ugr = ultraGrid1.ActiveRow;
  631. if (ugr == null)
  632. {
  633. MessageUtil.ShowTips("未查询到数据!");
  634. return;
  635. }
  636. string inspectionno = ugr.Cells["inspectionNo"].Text.ToString();
  637. string inspectionum = ugr.Cells["inspectionNum"].Text.ToString();
  638. string plinename = ugr.Cells["plineName"].Text.ToString();
  639. string judgestoveno = ugr.Cells["judgeStoveNo"].Text.ToString();
  640. string betchno = ugr.Cells["batchNo"].Text.ToString();
  641. string gradename = ugr.Cells["gradename"].Text.ToString();
  642. string steelname = ugr.Cells["steelname"].Text.ToString();
  643. string specname = ugr.Cells["specName"].Text.ToString();
  644. string craftfileno = ugr.Cells["craftFileNo"].Text.ToString();
  645. string unqreason = ugr.Cells["unqualifiedReasons"].Text.ToString();
  646. string inspectiontime = ugr.Cells["inspectionTime"].Text.ToString();
  647. string inspectionname = ugr.Cells["inspectionName"].Text.ToString();
  648. string disposalmethod = ugr.Cells["disposalMethod"].Text.ToString();
  649. string disposaltime = ugr.Cells["disposalTime"].Text.ToString();
  650. string disposalname = ugr.Cells["disposalName"].Text.ToString();
  651. var strurl = "";
  652. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepPipeBjUnqualifiedProductsZG.cpt&INSPECTION_NO=" +
  653. inspectionno + "&INSPECTION_NUM=" + inspectionum;
  654. var fre =new FrmRepExcel(ob,strurl);
  655. fre.AutoSize = true;
  656. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  657. fre.WindowState = FormWindowState.Maximized;
  658. fre.Show();
  659. }
  660. /// <summary>
  661. /// 打印成品钢管报检单
  662. /// </summary>
  663. public void doPrintReportCP()
  664. {
  665. UltraGridRow ugr = ultraGrid1.ActiveRow;
  666. if(ugr == null){
  667. MessageUtil.ShowTips("未查询到数据!");
  668. return;
  669. }
  670. string inspectionno = ugr.Cells["inspectionno"].Text.ToString();
  671. string inspectionnum = ugr.Cells["inspectionnum"].Text.ToString();
  672. string heatplanno = ugr.Cells["heatplanno"].Text.ToString();
  673. string judgestoveno = ugr.Cells["judgestoveno"].Text.ToString();
  674. string plinecode = ugr.Cells["plinecode"].Text.ToString();
  675. string processcode = ugr.Cells["processcode"].Text.ToString();
  676. string batchno = ugr.Cells["batchno"].Text.ToString();
  677. var strurl = "";
  678. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepPipeBjCheck.cpt&INSPECTION_NO=" +
  679. inspectionno + "&INSPECTION_NUM=" + inspectionnum + "&HEAT_PLAN_NO=" + heatplanno +
  680. "&JUDGE_STOVE_NO=" + judgestoveno + "&PLINE_CODE=" + plinecode + "&PROCESS_CODE=" + processcode +
  681. "&BATCH_NO=" + batchno;
  682. var fre = new FrmRepExcel(ob, strurl);
  683. fre.AutoSize = true;
  684. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  685. fre.WindowState = FormWindowState.Maximized;
  686. fre.Show();
  687. }
  688. /// <summary>
  689. /// 打印检验要点
  690. /// </summary>
  691. public void doPrintReportTestKey()
  692. {
  693. UltraGridRow ugr = ultraGrid1.ActiveRow;
  694. if(ugr == null){
  695. MessageUtil.ShowTips("未查询到数据!");
  696. return;
  697. }
  698. string PROCESS_CODE = ugr.Cells["processCode"].Text.ToString();
  699. string ORDER_NO = ugr.Cells["orderNo"].Text.ToString() + "/" + ugr.Cells["orderSeq"].Text.ToString();
  700. var strurl = "";
  701. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilTestKey2.cpt&PROCESS_CODE=" +
  702. "D" + "&ORDER_NO=" + ORDER_NO;
  703. var fre = new FrmRepExcel(ob,strurl);
  704. fre.AutoSize = true;
  705. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width,Screen.PrimaryScreen.WorkingArea.Height);
  706. fre.WindowState = FormWindowState.Maximized;
  707. fre.Show();
  708. }
  709. /// <summary>
  710. /// 查询产线
  711. /// </summary>
  712. /// <param name="sender"></param>
  713. /// <param name="e"></param>
  714. private void PlcodeEditor_EditorButtonClick_1(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  715. {
  716. ChoicePlineFrm frm = new ChoicePlineFrm(_dtPline, this.ob);
  717. //frm.ShowDialog();
  718. if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  719. {
  720. PlcodeEditor.Tag = frm.ChoicePlineCode;
  721. PlcodeEditor.Text = frm.ChoicePlineName;
  722. }
  723. }
  724. /// <summary>
  725. /// 工艺文件查看
  726. /// </summary>
  727. /// <param name="sender"></param>
  728. /// <param name="e"></param>
  729. private void ultraTextEditor1_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  730. {
  731. UltraGridRow row = ultraGrid1.ActiveRow;
  732. if (row == null) return;
  733. string CraftPath = row.Cells["CraftPath"].Text.ToString();
  734. FormFileDown askDown = new FormFileDown(this.ob, CraftPath);
  735. askDown.CtrlFileDown1.Button3.Visible = false;
  736. askDown.Show();
  737. }
  738. /// <summary>
  739. /// 导出
  740. /// </summary>
  741. private void Export()
  742. {
  743. string title = "";
  744. title += "报检实绩[轧管]";
  745. GridHelper.ulGridToExcel(ultraGrid1, title);
  746. }
  747. /// <summary>
  748. /// 20钢抽检改待检
  749. /// </summary>
  750. public void doUpdateInsflag1()
  751. {
  752. string inspectionNo = "";
  753. string inspectionNum = "";
  754. string insflag = "1";
  755. if (!this.ultraGrid1.ActiveRow.Cells["inspectionFlag"].Text.ToString().Equals("待抽"))
  756. {
  757. MessageUtil.ShowTips("此操作只对状态为待抽的数据有效,请重试!");
  758. return;
  759. }
  760. if (MessageUtil.ShowYesNoAndQuestion("确认修改?") == DialogResult.No)
  761. {
  762. return;
  763. }
  764. ArrayList list = new ArrayList();
  765. inspectionNo = this.ultraGrid1.ActiveRow.Cells["inspectionNo"].Text.ToString();
  766. inspectionNum = this.ultraGrid1.ActiveRow.Cells["inspectionNum"].Text.ToString();
  767. list.Add(inspectionNo);
  768. list.Add(inspectionNum);
  769. list.Add(insflag);
  770. CoreClientParam ccp = new CoreClientParam();
  771. ccp.ServerName = "com.steering.mes.mcp.Vrp.FrmBaoJianResult";
  772. ccp.MethodName = "UpdateInsflag";
  773. ccp.ServerParams = new object[] { list };
  774. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  775. if (ccp.ReturnCode != -1)
  776. {
  777. if (ccp.ReturnInfo.Equals("修改成功!"))
  778. {
  779. doQuery();
  780. MessageUtil.ShowTips(ccp.ReturnInfo);
  781. }
  782. }
  783. else
  784. {
  785. MessageUtil.ShowTips(ccp.ReturnInfo);
  786. }
  787. }
  788. /// <summary>
  789. /// 20钢抽检改免检
  790. /// </summary>
  791. public void doUpdateInsflag2()
  792. {
  793. string inspectionNo = "";
  794. string inspectionNum = "";
  795. string insflag = "3";
  796. if (!this.ultraGrid1.ActiveRow.Cells["inspectionFlag"].Text.ToString().Equals("待抽"))
  797. {
  798. MessageUtil.ShowTips("此操作只对状态为待抽的数据有效,请重试!");
  799. return;
  800. }
  801. if (MessageUtil.ShowYesNoAndQuestion("确认修改?") == DialogResult.No)
  802. {
  803. return;
  804. }
  805. ArrayList list = new ArrayList();
  806. inspectionNo = this.ultraGrid1.ActiveRow.Cells["inspectionNo"].Text.ToString();
  807. inspectionNum = this.ultraGrid1.ActiveRow.Cells["inspectionNum"].Text.ToString();
  808. list.Add(inspectionNo);
  809. list.Add(inspectionNum);
  810. list.Add(insflag);
  811. CoreClientParam ccp = new CoreClientParam();
  812. ccp.ServerName = "com.steering.mes.mcp.Vrp.FrmBaoJianResult";
  813. ccp.MethodName = "UpdateInsflag";
  814. ccp.ServerParams = new object[] { list };
  815. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  816. if (ccp.ReturnCode != -1)
  817. {
  818. if (ccp.ReturnInfo.Equals("修改成功!"))
  819. {
  820. doQuery();
  821. MessageUtil.ShowTips(ccp.ReturnInfo);
  822. }
  823. }
  824. else
  825. {
  826. MessageUtil.ShowTips(ccp.ReturnInfo);
  827. }
  828. }
  829. }
  830. }