FrmStuffSurfaceResult.cs 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968
  1. using Core.Mes.Client.Comm.Format;
  2. using Core.Mes.Client.Comm.Server;
  3. using Core.Mes.Client.Comm.Tool;
  4. using Core.StlMes.Client.YdmStuffManage.Entity;
  5. using CoreFS.CA06;
  6. using Infragistics.Win.UltraWinGrid;
  7. using System;
  8. using System.Collections;
  9. using System.Collections.Generic;
  10. using System.ComponentModel;
  11. using System.Data;
  12. using System.Drawing;
  13. using System.Linq;
  14. using System.Net;
  15. using System.Text;
  16. using System.Windows.Forms;
  17. namespace Core.StlMes.Client.YdmStuffManage
  18. {
  19. public partial class FrmStuffSurfaceResult : FrmBase
  20. {
  21. public FrmStuffSurfaceResult()
  22. {
  23. InitializeComponent();
  24. //surfaceResult1.initValue();
  25. }
  26. private StlLgSurfaceM1Entity qcmSurfaceM = new StlLgSurfaceM1Entity();//表检实绩信息
  27. private string PlineCode = "";//产线
  28. /// <summary>
  29. /// 重写基类方法
  30. /// </summary>
  31. /// <param name="sender"></param>
  32. /// <param name="ToolbarKey"></param>
  33. public override void ToolBar_Click(object sender, string ToolbarKey)
  34. {
  35. switch (ToolbarKey)
  36. {
  37. case "DoQuery":
  38. QuerySinglePlan();
  39. break;
  40. case "Save":
  41. SaveData();
  42. break;
  43. case "DoBeside":
  44. doBeside();
  45. break;
  46. case "DoBesideBack":
  47. doBesideBack();
  48. break;
  49. case "BatchScrapNum":
  50. batchScrapNum();
  51. break;
  52. case "BatchOffNum":
  53. batchOffNum();
  54. break;
  55. case "BatchSaveReason":
  56. batchSaveReason();
  57. break;
  58. case "ClearReason":
  59. clearReason();
  60. break;
  61. case "printSuface":
  62. printSuface();
  63. break;
  64. case"upLoadSuface":
  65. upLoadSuface();
  66. break;
  67. case "Close":
  68. this.Close();
  69. break;
  70. }
  71. }
  72. /// <summary>
  73. /// 清空缺陷原因
  74. /// </summary>
  75. private void clearReason()
  76. {
  77. this.ultraGrid1.UpdateData();
  78. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  79. PlnSteelforOrdEntity plnSteelTity = (PlnSteelforOrdEntity)uRow.ListObject;
  80. string plnSteelEntity = JSONFormat.Format(plnSteelTity);
  81. ArrayList list = new ArrayList();
  82. list.Add(plnSteelTity.Furnaceno);
  83. list.Add(plnSteelTity.Sequenceno);
  84. list.Add(plnSteelTity.StoveNo);
  85. list.Add(plnSteelTity.JudgeStoveNoSeq);
  86. CoreClientParam ccp = new CoreClientParam();
  87. ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult";
  88. ccp.MethodName = "clearReason";
  89. ccp.ServerParams = new object[] { plnSteelEntity };
  90. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  91. if (ccp.ReturnCode != -1)
  92. {
  93. if (ccp.ReturnInfo.Equals("清空成功!"))
  94. {
  95. doQueryRack(list);
  96. MessageUtil.ShowTips(ccp.ReturnInfo);
  97. }
  98. else
  99. {
  100. MessageUtil.ShowTips(ccp.ReturnInfo);
  101. }
  102. }
  103. }
  104. /// <summary>
  105. /// 保存缺陷原因
  106. /// </summary>
  107. private void batchSaveReason()
  108. {
  109. this.ultraGrid1.UpdateData();
  110. string scrapNum = "";
  111. string scrapReson = "";//缺陷原因
  112. if (this.TxtScrapNum.Text.Trim() != "" && StringUtil.IsInt(this.TxtScrapNum.Text.Trim()))
  113. {
  114. scrapNum = this.TxtScrapNum.Text.Trim();
  115. }
  116. else
  117. {
  118. MessageUtil.ShowTips("批量剔除时请输入支数并且为整数!");
  119. return;
  120. }
  121. if (this.TxtScrapNum.Text.Trim() != "")
  122. {
  123. scrapReson = this.ultraComboEditor1.Text.Trim();
  124. }
  125. else
  126. {
  127. MessageUtil.ShowTips("批量剔除时请选择废品原因!");
  128. return;
  129. }
  130. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  131. PlnSteelforOrdEntity plnSteelTity = (PlnSteelforOrdEntity)uRow.ListObject;
  132. string plnSteelEntity = JSONFormat.Format(plnSteelTity);
  133. ArrayList list = new ArrayList();
  134. list.Add(plnSteelTity.Furnaceno);
  135. list.Add(plnSteelTity.Sequenceno);
  136. list.Add(plnSteelTity.StoveNo);
  137. list.Add(plnSteelTity.JudgeStoveNoSeq);
  138. CoreClientParam ccp = new CoreClientParam();
  139. ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult";
  140. ccp.MethodName = "batchSaveReason";
  141. ccp.ServerParams = new object[] { plnSteelEntity, scrapNum, scrapReson };
  142. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  143. if (ccp.ReturnCode != -1)
  144. {
  145. if (ccp.ReturnInfo.Equals("保存成功!"))
  146. {
  147. doQueryRack(list);
  148. MessageUtil.ShowTips(ccp.ReturnInfo);
  149. }
  150. else
  151. {
  152. MessageUtil.ShowTips(ccp.ReturnInfo);
  153. }
  154. }
  155. }
  156. /// <summary>
  157. /// 批量剔除
  158. /// </summary>
  159. private void batchScrapNum()
  160. {
  161. this.ultraGrid1.UpdateData();
  162. string scrapNum = "";
  163. string scrapReson = "";//废品原因
  164. string okNum = "";
  165. if (this.TxtScrapNum.Text.Trim() != "" && StringUtil.IsInt(this.TxtScrapNum.Text.Trim()))
  166. {
  167. scrapNum = this.TxtScrapNum.Text.Trim();
  168. }
  169. else
  170. {
  171. MessageUtil.ShowTips("批量剔除时请输入支数并且为整数!");
  172. return;
  173. }
  174. if (this.TxtScrapNum.Text.Trim() != "")
  175. {
  176. scrapReson = this.ultraComboEditor1.Text.Trim();
  177. }
  178. else
  179. {
  180. MessageUtil.ShowTips("批量剔除时请选择废品原因!");
  181. return;
  182. }
  183. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  184. //if (uRow.HasChild())
  185. //{
  186. // return;
  187. //}
  188. PlnSteelforOrdEntity plnSteelTity = (PlnSteelforOrdEntity)uRow.ListObject;
  189. string plnSteelEntity = JSONFormat.Format(plnSteelTity);
  190. DataTable ds = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryOkNum", new object[] { plnSteelEntity }, ob);//查询合格坯料支数
  191. if (ds.Rows.Count > 0)
  192. {
  193. okNum = ds.Rows[0][0].ToString();
  194. }
  195. if (int.Parse(scrapNum) > int.Parse(okNum))
  196. {
  197. MessageUtil.ShowTips("输入的批量剔除支数已大于合格支数,不允许批量剔除!");
  198. return;
  199. }
  200. ArrayList list = new ArrayList();
  201. list.Add(plnSteelTity.Furnaceno);
  202. list.Add(plnSteelTity.Sequenceno);
  203. list.Add(plnSteelTity.StoveNo);
  204. list.Add(plnSteelTity.JudgeStoveNoSeq);
  205. CoreClientParam ccp = new CoreClientParam();
  206. ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult";
  207. ccp.MethodName = "batchScrapNum";
  208. ccp.ServerParams = new object[] { plnSteelEntity,scrapNum,scrapReson };
  209. ccp = ob.ExecuteNonQuery(ccp,CoreInvokeType.Internal);
  210. if (ccp.ReturnCode != -1)
  211. {
  212. if (ccp.ReturnInfo.Equals("剔除成功!"))
  213. {
  214. doQueryRack(list);
  215. MessageUtil.ShowTips(ccp.ReturnInfo);
  216. }
  217. else
  218. {
  219. MessageUtil.ShowTips(ccp.ReturnInfo);
  220. }
  221. }
  222. }
  223. /// <summary>
  224. /// 批量离线
  225. /// </summary>
  226. private void batchOffNum()
  227. {
  228. this.ultraGrid1.UpdateData();
  229. string scrapNum = "";
  230. string scrapReson = "";//废品原因
  231. string okNum = "";
  232. if (this.TxtScrapNum.Text.Trim() != "" && StringUtil.IsInt(this.TxtScrapNum.Text.Trim()))
  233. {
  234. scrapNum = this.TxtScrapNum.Text.Trim();
  235. }
  236. else
  237. {
  238. MessageUtil.ShowTips("批量离线时请输入支数并且为整数!");
  239. return;
  240. }
  241. if (this.TxtScrapNum.Text.Trim() != "")
  242. {
  243. scrapReson = this.ultraComboEditor1.Text.Trim();
  244. }
  245. else
  246. {
  247. MessageUtil.ShowTips("批量剔除时请选择废品原因!");
  248. return;
  249. }
  250. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  251. //if (uRow.HasChild())
  252. //{
  253. // return;
  254. //}
  255. PlnSteelforOrdEntity plnSteelTity = (PlnSteelforOrdEntity)uRow.ListObject;
  256. string plnSteelEntity = JSONFormat.Format(plnSteelTity);
  257. DataTable ds = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryOkNum", new object[] { plnSteelEntity }, ob);//查询合格坯料支数
  258. if (ds.Rows.Count > 0)
  259. {
  260. okNum = ds.Rows[0][0].ToString();
  261. }
  262. if (int.Parse(scrapNum) > int.Parse(okNum))
  263. {
  264. MessageUtil.ShowTips("输入的批量离线支数已大于合格支数,不允许批量离线!");
  265. return;
  266. }
  267. ArrayList list = new ArrayList();
  268. list.Add(plnSteelTity.Furnaceno);
  269. list.Add(plnSteelTity.Sequenceno);
  270. list.Add(plnSteelTity.StoveNo);
  271. list.Add(plnSteelTity.JudgeStoveNoSeq);
  272. CoreClientParam ccp = new CoreClientParam();
  273. ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult";
  274. ccp.MethodName = "batchOffNum";
  275. ccp.ServerParams = new object[] { plnSteelEntity, scrapNum, scrapReson, UserInfo.GetUserName(), UserInfo.GetUserOrder(), UserInfo.GetUserGroup() };
  276. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  277. if (ccp.ReturnCode != -1)
  278. {
  279. if (ccp.ReturnInfo.Equals("离线成功!"))
  280. {
  281. doQueryRack(list);
  282. MessageUtil.ShowTips(ccp.ReturnInfo);
  283. }
  284. else
  285. {
  286. MessageUtil.ShowTips(ccp.ReturnInfo);
  287. }
  288. }
  289. }
  290. /// <summary>
  291. /// 上传PDF表检报告
  292. /// </summary>
  293. private void upLoadSuface()
  294. {
  295. string filePathNew = ""; //表检报告目录
  296. WebClient webClient = new WebClient();
  297. List<FileBean> listPdf = new List<FileBean>();
  298. string date = DateTime.Now.ToString("yyyyMMdd");
  299. string judgeNo = "";
  300. string proPlanId = "";
  301. string gxPlanNo = "";
  302. string plineCode = "";
  303. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  304. if (uRow == null)
  305. {
  306. return;
  307. }
  308. judgeNo = uRow.Cells["JudgeStoveNo"].Text;
  309. proPlanId = uRow.Cells["ProPlanId"].Text;
  310. gxPlanNo = uRow.Cells["GxPlanNo"].Text;
  311. plineCode = uRow.Cells["PlineCode"].Text;
  312. string url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepLgCastingInspectionRecord.cpt&format=pdf&JUDGE_STOVE_NO=" + judgeNo + "&PRO_PLAN_ID=" + proPlanId + "&GX_PLAN_NO=" + gxPlanNo;
  313. filePathNew = "LgMil/surfcacReprot"+"/"+ plineCode + "/" + judgeNo + "/";
  314. byte[] pdf = webClient.DownloadData(url);
  315. FileBean fileBean = new FileBean();
  316. fileBean.setFile(pdf);
  317. fileBean.setFileName(proPlanId.Replace("/","-")+judgeNo + ".pdf");
  318. fileBean.setPathName(filePathNew);
  319. listPdf.Add(fileBean);
  320. webClient.Dispose();
  321. bool a = FileHelper.Upload(listPdf);
  322. if (a)
  323. {
  324. int count = ServerHelper.SetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.updateSurFace", new object[] { filePathNew, judgeNo, proPlanId, gxPlanNo }, ob);
  325. if (count > 0)
  326. {
  327. MessageUtil.ShowTips("上传成功!");
  328. SelectFile(filePathNew + proPlanId.Replace("/", "-") + judgeNo + ".pdf");
  329. }
  330. }
  331. }
  332. /// <summary>
  333. /// 查询上传的PDF文件
  334. /// </summary>
  335. private void SelectFile(string filePathNew)
  336. {
  337. dlgOrderAskDown down = new dlgOrderAskDown(this.ob, filePathNew);
  338. down.DeleteButton.Visible = false;
  339. down.ShowDialog();
  340. }
  341. /// <summary>
  342. /// 打印表检报告
  343. /// </summary>
  344. private void printSuface()
  345. {
  346. string judgeNo = "";
  347. string proPlanId = "";
  348. string gxPlanNo = "";
  349. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  350. if (uRow == null)
  351. {
  352. return;
  353. }
  354. judgeNo = uRow.Cells["JudgeStoveNo"].Text;
  355. proPlanId = uRow.Cells["ProPlanId"].Text;
  356. gxPlanNo = uRow.Cells["GxPlanNo"].Text;
  357. string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepLgCastingInspectionRecord.cpt&format=pdf&JUDGE_STOVE_NO=" + judgeNo + "&PRO_PLAN_ID=" + proPlanId + "&GX_PLAN_NO=" + gxPlanNo;
  358. FrmExcel fre = new FrmExcel(this.ob, strurl);
  359. fre.AutoSize = true;
  360. fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  361. fre.WindowState = FormWindowState.Maximized;
  362. fre.Show();
  363. }
  364. /// <summary>
  365. /// 查询炉计划
  366. /// </summary>
  367. private void QuerySinglePlan()
  368. {
  369. string[] L1 = new string[] { "Furnaceno", "StoveNo" };
  370. string[] L2 = new string[] { "Furnaceno","StoveNo" };
  371. string startTim = "";
  372. string endTim = "";
  373. string stoveNo = "";
  374. if (this.chkRegTime.Checked)
  375. {
  376. startTim = this.RegStartTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  377. endTim = this.RegEndTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  378. }
  379. if (this.chkFurnace.Checked && this.txtFurnace.Text.Trim() != "")
  380. {
  381. stoveNo = this.txtFurnace.Text.Trim();
  382. }
  383. StlLgSurfaceMEntitybindingSource.Clear();
  384. StlLgProgrrssEntitybindingSource.Clear();
  385. // List<PlnSteelforOrdEntity1> listSource = EntityHelper.GetData<PlnSteelforOrdEntity1>(
  386. //"Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryPlanStoveNo", new object[] { startTim, endTim, stoveNo,this.ultraOptionSet2.CheckedItem.DataValue.ToString(), arr,"0" }, this.ob);
  387. List<PlnSteelforOrdEntity> listSource1 = EntityHelper.GetData<PlnSteelforOrdEntity>(
  388. "Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryPlan", new object[] { startTim, endTim, stoveNo, this.ultraOptionSet2.CheckedItem.DataValue.ToString(), arr,"0" }, this.ob);
  389. //EntityHelper.AddEntityRelation(listSource, listSource1, L1, L2);
  390. plnSteelforOrdEntity1BindingSource.DataSource = listSource1;
  391. }
  392. /// <summary>
  393. /// 保存
  394. /// </summary>
  395. private void SaveData()
  396. {
  397. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  398. //if (uRow.HasChild())
  399. //{
  400. // return;
  401. //}
  402. if (uRow == null)
  403. {
  404. MessageUtil.ShowTips("无炉计划信息,无法保存!");
  405. return;
  406. }
  407. this.surfaceResult1.UltraGrid2.UpdateData();
  408. qcmSurfaceM = BaseMethod.GetUltraGridToEntityNEW(this.surfaceResult1.UltraGrid2,qcmSurfaceM);
  409. qcmSurfaceM.Furnaceno = uRow.Cells["Furnaceno"].Text;
  410. qcmSurfaceM.Sequenceno = uRow.Cells["Sequenceno"].Text;
  411. qcmSurfaceM.StoveNo = uRow.Cells["StoveNo"].Text;
  412. qcmSurfaceM.JudgeStoveNo = uRow.Cells["JudgeStoveNo"].Text;
  413. qcmSurfaceM.JudgeStoveNoSeq = uRow.Cells["JudgeStoveNoSeq"].Text;
  414. qcmSurfaceM.ProPlanId = uRow.Cells["ProPlanId"].Text;
  415. qcmSurfaceM.GxPlanNo = uRow.Cells["GxPlanNo"].Text;
  416. qcmSurfaceM.ColGroup = UserInfo.GetUserGroup();
  417. qcmSurfaceM.ColShift = UserInfo.GetUserOrder();
  418. qcmSurfaceM.PlineCode = PlineCode;
  419. //string qcmSurfaceMS = JSONFormat.Format(qcmSurfaceM);
  420. //qcmSurfaceM.PlineCode = "C001";
  421. //DataTable ds = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryStausSum", new object[] { qcmSurfaceMS, "0" }, ob);
  422. //qcmSurfaceM.Quantity = ds.Rows[0][0].ToString();
  423. //DataTable dd = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryStausSum", new object[] { qcmSurfaceMS, "1" }, ob);
  424. //qcmSurfaceM.ScrapNum = dd.Rows[0][0].ToString();
  425. //DataTable df = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryStausSum", new object[] { qcmSurfaceMS, "2" }, ob);
  426. //qcmSurfaceM.OfflineNum = df.Rows[0][0].ToString();
  427. //DataTable dh = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryStausSum", new object[] { qcmSurfaceMS, "3" }, ob);
  428. //qcmSurfaceM.Eligiblequty = dh.Rows[0][0].ToString();
  429. //qcmSurfaceM.ActWeight = decimal.Parse(dh.Rows[0][1].ToString());
  430. qcmSurfaceM.CreateName = UserInfo.GetUserName();
  431. string qcmSurfaceMTity = JSONFormat.Format(qcmSurfaceM);
  432. CoreClientParam ccp = new CoreClientParam();
  433. ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult";
  434. ccp.MethodName = "saveSurfaceResult";
  435. ccp.ServerParams = new object[] { qcmSurfaceMTity};
  436. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  437. if (ccp.ReturnCode != -1)
  438. {
  439. if (ccp.ReturnInfo.Equals("保存成功!"))
  440. {
  441. QuerySinglePlan();
  442. MessageUtil.ShowTips(ccp.ReturnInfo);
  443. }
  444. else
  445. {
  446. MessageUtil.ShowTips(ccp.ReturnInfo);
  447. }
  448. }
  449. }
  450. /// <summary>
  451. /// 结炉
  452. /// </summary>
  453. private void doBeside()
  454. {
  455. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  456. if (uRow == null) return;
  457. //if (uRow.HasChild())
  458. //{
  459. // return;
  460. //}
  461. ArrayList list = new ArrayList();
  462. list.Add(uRow.Cells["Furnaceno"].Text);
  463. list.Add(uRow.Cells["Sequenceno"].Text);
  464. list.Add(uRow.Cells["StoveNo"].Text);
  465. list.Add(uRow.Cells["JudgeStoveNoSeq"].Text);
  466. //DataTable ds = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryOffline", new object[] { list }, ob);
  467. //if (int.Parse(ds.Rows[0][0].ToString()) > 0)
  468. //{
  469. // MessageUtil.ShowTips("还存在待处理坯子,不允许结炉!");
  470. // return;
  471. //}
  472. DataTable dd = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryPlnSteeOrd", new object[] { list }, ob);
  473. if (!dd.Rows[0]["CCM_STATE"].ToString().Equals("10"))
  474. {
  475. MessageUtil.ShowTips("执行状态不是切割完成,不允许结炉!");
  476. return;
  477. }
  478. SaveData();
  479. int count = ServerHelper.SetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doBaside", new object[] { list,this.UserInfo.GetUserOrder(),this.UserInfo.GetUserGroup() }, ob);
  480. if (count > 0)
  481. {
  482. QuerySinglePlan();
  483. MessageUtil.ShowTips("结炉成功!");
  484. }
  485. }
  486. /// <summary>
  487. /// 结炉回退
  488. /// </summary>
  489. private void doBesideBack()
  490. {
  491. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  492. if (uRow == null) return;
  493. //if (uRow.HasChild())
  494. //{
  495. // return;
  496. //}
  497. ArrayList list = new ArrayList();
  498. list.Add(uRow.Cells["Furnaceno"].Text);
  499. list.Add(uRow.Cells["Sequenceno"].Text);
  500. list.Add(uRow.Cells["StoveNo"].Text);
  501. list.Add(uRow.Cells["JudgeStoveNoSeq"].Text);
  502. DataTable ds = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryPlnSteeOrd", new object[] { list }, ob);
  503. if (!ds.Rows[0]["CCM_STATE"].ToString().Equals("20"))
  504. {
  505. MessageUtil.ShowTips("执行状态不是表检完成,不允许结炉回退!");
  506. return;
  507. }
  508. DataTable dt = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryEntrust", new object[] { list }, ob);
  509. if (dt.Rows.Count > 0)
  510. {
  511. MessageUtil.ShowTips("已有进行委外加工委托,不允许结炉回退!");
  512. return;
  513. }
  514. DataTable dd = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryStlLgProcess", new object[] { list }, ob);
  515. if (dd.Rows.Count > 0)
  516. {
  517. MessageUtil.ShowTips("已有进行表检委托,不允许结炉回退!");
  518. return;
  519. }
  520. int count = ServerHelper.SetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doBasideBack", new object[] { list }, ob);
  521. if (count > 0)
  522. {
  523. QuerySinglePlan();
  524. MessageUtil.ShowTips("结炉回退成功!");
  525. }
  526. }
  527. private void chkFurnace_CheckedChanged(object sender, EventArgs e)
  528. {
  529. this.txtFurnace.Enabled = this.chkFurnace.Checked;
  530. }
  531. private void chkRegTime_CheckedChanged(object sender, EventArgs e)
  532. {
  533. this.RegStartTime.Enabled = this.RegEndTime.Enabled = this.chkRegTime.Checked;
  534. }
  535. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  536. {
  537. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  538. //if (uRow.HasChild())
  539. //{
  540. // return;
  541. //}
  542. if (uRow == null)
  543. {
  544. return;
  545. }
  546. ArrayList list = new ArrayList();
  547. DataTable ds = new DataTable();
  548. ds.Columns.Add("STOVE_NO");
  549. ds.Columns.Add("JUDGE_STOVE_NO");
  550. ds.Columns.Add("FLAG_STOVE_NO");
  551. ds.Columns.Add("MATERIAL_NAME");
  552. ds.Columns.Add("GRADENAME");
  553. ds.Columns.Add("DIAMETER");
  554. ds.Columns.Add("LEN_GP_SINGLE");
  555. ds.Columns.Add("CUT_NUM_GP");
  556. ds.Columns.Add("CAST_NO");
  557. ds.Columns.Add("FLOWNO");
  558. ds.Columns.Add("TOT_MUM_M");
  559. ds.Columns.Add("TOT_WEIGHT_M");
  560. DataRow dr = ds.NewRow();
  561. object[] obj = { uRow.Cells["StoveNo"].Text, uRow.Cells["JudgeStoveNo"].Text, uRow.Cells["FlagStoveNo"].Text, uRow.Cells["MaterialName"].Text, uRow.Cells["Gradename"].Text,uRow.Cells["Diameter"].Text, uRow.Cells["LenGpSingle"].Text, uRow.Cells["CutNumGp"].Text, uRow.Cells["CastNo"].Text, uRow.Cells["Flowno"].Text, uRow.Cells["TotMumM"].Text, uRow.Cells["TotWeightM"].Text };
  562. dr.ItemArray = obj;
  563. ds.Rows.Add(dr);
  564. if (ds.Rows.Count > 0)
  565. {
  566. GridEdit(ds);
  567. }
  568. list.Add(uRow.Cells["Furnaceno"].Text);
  569. list.Add(uRow.Cells["Sequenceno"].Text);
  570. list.Add(uRow.Cells["StoveNo"].Text);
  571. list.Add(uRow.Cells["JudgeStoveNoSeq"].Text);
  572. doQuerySurFace(list);
  573. //DataTable resultDt = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryResult", new object[] { list }, ob);
  574. //if (resultDt.Rows.Count > 0)
  575. //{
  576. // resultGridEdit(resultDt);
  577. //}
  578. }
  579. private void ultraGrid3_AfterRowActivate(object sender, EventArgs e)
  580. {
  581. UltraGridRow uRow = this.ultraGrid3.ActiveRow;
  582. if (uRow == null) return;
  583. ArrayList parm = new ArrayList();
  584. parm.Add(uRow.Cells["Furnaceno"].Text);
  585. parm.Add(uRow.Cells["Sequenceno"].Text);
  586. parm.Add(uRow.Cells["StoveNo"].Text);
  587. parm.Add(uRow.Cells["JudgeStoveNoSeq"].Text);
  588. doQueryRack(parm);//查询管坯队列
  589. }
  590. /// <summary>
  591. /// 查询表检实绩
  592. /// </summary>
  593. /// <param name="list"></param>
  594. private void doQuerySurFace(ArrayList list)
  595. {
  596. this.surfaceResult1.clear();
  597. StlLgProgrrssEntitybindingSource.Clear();
  598. List<StlLgSurfaceM1Entity> listSource = EntityHelper.GetData<StlLgSurfaceM1Entity>(
  599. "Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryResult", new object[] { list }, this.ob);
  600. StlLgSurfaceMEntitybindingSource.DataSource = listSource;
  601. if (listSource.Count()>0)
  602. {
  603. this.surfaceResult1.Value = listSource[0];
  604. }
  605. }
  606. private void doQueryRack(ArrayList list)
  607. {
  608. List<StlLgProgrrssEntity> listSource = EntityHelper.GetData<StlLgProgrrssEntity>(
  609. "Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryRack", new object[] { list }, this.ob);
  610. StlLgProgrrssEntitybindingSource.DataSource = listSource;
  611. foreach (UltraGridRow ugr in this.ultraGrid2.Rows)
  612. {
  613. if (ugr != null)
  614. {
  615. switch (ugr.Cells["Status"].Value.ToString())
  616. {
  617. case "剔除":
  618. ugr.Appearance.BackColor = Color.Yellow;
  619. break;
  620. case"待处理":
  621. ugr.Appearance.BackColor = Color.YellowGreen;
  622. break;
  623. case"委外废":
  624. ugr.Appearance.BackColor = Color.Yellow;
  625. break;
  626. }
  627. }
  628. }
  629. }
  630. /// <summary>
  631. /// 显示实绩信息
  632. /// </summary>
  633. private void resultGridEdit(DataTable resultDt)
  634. {
  635. //QcmLgSurfaceM1Entity qcmSurfaceM = new QcmLgSurfaceM1Entity();
  636. qcmSurfaceM = BaseMethod.GetTableToEntity(resultDt, qcmSurfaceM);
  637. this.surfaceResult1.Value = qcmSurfaceM;
  638. }
  639. /// <summary>
  640. /// 显示炉信息
  641. /// </summary>
  642. /// <param name="ds"></param>
  643. private void GridEdit(DataTable ds)
  644. {
  645. DataRow row = ds.Rows[0];
  646. this.planInfomation1.Value.StoveNo = row["STOVE_NO"].ToString();//熔炼炉号
  647. this.planInfomation1.Value.JudgeStoveNo = row["JUDGE_STOVE_NO"].ToString();//判定炉号
  648. this.planInfomation1.Value.MaterialName = row["MATERIAL_NAME"].ToString();//物料描述
  649. this.planInfomation1.Value.Diameter = row["DIAMETER"].ToString3();//直径
  650. this.planInfomation1.Value.Gradename = row["GRADENAME"].ToString();//钢种
  651. //this.planInfomation1.Value.LengthM = decimal.Parse(row["LENGTH_M"].ToString3());//总长度
  652. this.planInfomation1.Value.LenGpSingle = decimal.Parse(row["LEN_GP_SINGLE"].ToString3());//单倍坯长
  653. this.planInfomation1.Value.CutNumGp = decimal.Parse(row["CUT_NUM_GP"].ToString3());//倍尺数
  654. this.planInfomation1.Value.FlagStoveNo = row["FLAG_STOVE_NO"].ToString();
  655. this.planInfomation1.Value.CastNo = row["CAST_NO"].ToString();
  656. this.planInfomation1.Value.Flowno = row["FLOWNO"].ToString();
  657. this.planInfomation1.Value.TotMumM = decimal.Parse(row["TOT_MUM_M"].ToString3());
  658. this.planInfomation1.Value.TotWeightM = decimal.Parse(row["TOT_WEIGHT_M"].ToString3());
  659. this.planInfomation1.UpdateData();
  660. }
  661. private string[] arr = null;
  662. private void FrmStuffSurfaceResult_Load(object sender, EventArgs e)
  663. {
  664. DateTime now = DateTime.Now;
  665. DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天
  666. DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天
  667. this.RegStartTime.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00");
  668. this.RegEndTime.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59");
  669. //EntityHelper.ShowGridCaption<PlnSteelforfurnaceEntity1>(ultraGrid1.DisplayLayout.Bands[0]);
  670. EntityHelper.ShowGridCaption<PlnSteelforOrdEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  671. EntityHelper.ShowGridCaption<StlLgProgrrssEntity>(ultraGrid2.DisplayLayout.Bands[0]);
  672. EntityHelper.ShowGridCaption<StlLgSurfaceM1Entity>(ultraGrid3.DisplayLayout.Bands[0]);
  673. arr = BaseMethod.InitLgPermissions(this.ValidDataPurviewIds,"B", this.ob);
  674. getPlineCode();
  675. }
  676. /// <summary>
  677. /// 获取产线
  678. /// </summary>
  679. private void getPlineCode()
  680. {
  681. PlineCode = ClsLoad.GetPCode(UserInfo.GetDepartment(), ob);
  682. }
  683. private void ultraGrid2_ClickCellButton(object sender, CellEventArgs e)
  684. {
  685. this.ultraGrid2.UpdateData();
  686. UltraGridRow uRow1 = this.ultraGrid1.ActiveRow;
  687. UltraGridRow uRow = this.ultraGrid2.ActiveRow;
  688. ArrayList list = new ArrayList();
  689. list.Add(uRow.Cells["Furnaceno"].Text);
  690. list.Add(uRow.Cells["Sequenceno"].Text);
  691. list.Add(uRow.Cells["StoveNo"].Text);
  692. list.Add(uRow.Cells["JudgeStoveNoSeq"].Text);
  693. DataTable dt = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryPlanStaus", new object[] { list }, ob);
  694. if (int.Parse(dt.Rows[0][0].ToString()) >= 20)
  695. {
  696. MessageUtil.ShowTips("表检已结炉,不允许进行离线、剔废操作!");
  697. return;
  698. }
  699. string matNo = uRow.Cells["MatNo"].Text;
  700. DataTable ds = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.doQueryRackStaus", new object[] { list,matNo }, ob);
  701. string staus = ds.Rows[0][0].ToString();
  702. int count = 0;
  703. StlLgProgrrssEntity qcmLgProcessTity = (StlLgProgrrssEntity)uRow.ListObject;
  704. //qcmLgProcessTity.PlineCode = PlineCode;
  705. qcmLgProcessTity.ColUser = UserInfo.GetUserName();
  706. qcmLgProcessTity.ColShift = UserInfo.GetUserOrder();
  707. qcmLgProcessTity.ColGroup = UserInfo.GetUserGroup();
  708. qcmLgProcessTity.Standardremak = uRow1.Cells["OrderNo"].Text.Trim();
  709. qcmLgProcessTity.ScrapReason = uRow.Cells["ScrapReason"].Text;
  710. string qcmProcessTity = JSONFormat.Format(qcmLgProcessTity);
  711. if (e.Cell.Column.Key == "Scrap")
  712. {
  713. if (staus != "0")
  714. {
  715. MessageUtil.ShowTips("此坯已不是合格坯,不能进行剔除!");
  716. return;
  717. }
  718. else
  719. {
  720. if (uRow.Cells["ScrapReason"].Text == "")
  721. {
  722. MessageUtil.ShowTips("请选择剔除原因!");
  723. return;
  724. }
  725. CoreClientParam ccp = new CoreClientParam();
  726. ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult";
  727. ccp.MethodName = "updateRackStaus";
  728. ccp.ServerParams = new object[] { qcmProcessTity, "2", UserInfo.GetUserName(), uRow1.Cells["EfPlineCode"].Text,uRow1.Cells["EfPlineName"].Text };
  729. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  730. if (ccp.ReturnCode != -1)
  731. {
  732. if (ccp.ReturnInfo.Equals("剔除成功!"))
  733. {
  734. doQueryRack(list);//查询管坯队列
  735. }
  736. }
  737. //count = ServerHelper.SetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.updateRackStaus", new object[] { matNo, "2", uRow.Cells["ScrapReason"].Text, uRow.Cells["StoveNo"].Text, uRow.Cells["JudgeStoveNoSeq"].Text, uRow.Cells["Furnaceno"].Text, uRow.Cells["Sequenceno"].Text }, ob);
  738. //doQueryRack(list);//查询管坯队列
  739. }
  740. }
  741. else if (e.Cell.Column.Key == "ScrapBack")
  742. {
  743. if (staus != "2")
  744. {
  745. MessageUtil.ShowTips("此坯不是废品坯,不能进行剔除回退!");
  746. return;
  747. }
  748. else
  749. {
  750. CoreClientParam ccp = new CoreClientParam();
  751. ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult";
  752. ccp.MethodName = "updateRackStaus";
  753. ccp.ServerParams = new object[] { qcmProcessTity, "0", UserInfo.GetUserName(), uRow1.Cells["EfPlineCode"].Text, uRow1.Cells["EfPlineName"].Text };
  754. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  755. if (ccp.ReturnCode != -1)
  756. {
  757. if (ccp.ReturnInfo.Equals("剔除成功!"))
  758. {
  759. doQueryRack(list);//查询管坯队列
  760. }
  761. }
  762. //count = ServerHelper.SetData("Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult.updateRackStaus", new object[] { matNo, "0", "", uRow.Cells["StoveNo"].Text, uRow.Cells["JudgeStoveNoSeq"].Text, uRow.Cells["Furnaceno"].Text, uRow.Cells["Sequenceno"].Text }, ob);
  763. //doQueryRack(list);//查询管坯队列
  764. }
  765. }
  766. else if (e.Cell.Column.Key == "Alarm")
  767. {
  768. if (staus != "0")
  769. {
  770. MessageUtil.ShowTips("此坯已不是合格坯,不能进行离线操作!");
  771. return;
  772. }
  773. else
  774. {
  775. if (uRow.Cells["ScrapReason"].Text == "")
  776. {
  777. MessageUtil.ShowTips("请选择离线品中的废品原因!");
  778. return;
  779. }
  780. if (uRow.Cells["ScrapReasonNum"].Text == "")
  781. {
  782. MessageUtil.ShowTips("请选择离线品中的废的单倍坯支数!");
  783. return;
  784. }
  785. CoreClientParam ccp = new CoreClientParam();
  786. ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult";
  787. ccp.MethodName = "insertOffine";
  788. ccp.ServerParams = new object[] { qcmProcessTity,UserInfo.GetUserName() };
  789. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  790. if (ccp.ReturnCode != -1)
  791. {
  792. if (ccp.ReturnInfo.Equals("离线成功!"))
  793. {
  794. doQueryRack(list);//查询管坯队列
  795. }
  796. else
  797. {
  798. MessageUtil.ShowTips(ccp.ReturnInfo);
  799. }
  800. }
  801. }
  802. }
  803. else if (e.Cell.Column.Key == "AlarmBack")
  804. {
  805. if (staus != "1")
  806. {
  807. MessageUtil.ShowTips("此坯不是待处理坯,不能进行离线回退!");
  808. return;
  809. }
  810. else
  811. {
  812. CoreClientParam ccp = new CoreClientParam();
  813. ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult";
  814. ccp.MethodName = "insertOffineBack";
  815. ccp.ServerParams = new object[] { qcmProcessTity };
  816. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  817. if (ccp.ReturnCode != -1)
  818. {
  819. if (ccp.ReturnInfo.Equals("离线回退成功!"))
  820. {
  821. doQueryRack(list);//查询管坯队列
  822. }
  823. else
  824. {
  825. MessageUtil.ShowTips(ccp.ReturnInfo);
  826. }
  827. }
  828. }
  829. }
  830. }
  831. private void ultraTextEditor1_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  832. {
  833. this.ultraGrid2.UpdateData();
  834. UltraGridRow uRow = this.ultraGrid2.ActiveRow;
  835. if (uRow == null)
  836. {
  837. return;
  838. }
  839. if (!StringUtil.IsInt(uRow.Cells["ScrapLen"].Text.Trim().ToString3()))
  840. {
  841. MessageUtil.ShowTips("废品长度请输入正整数!");
  842. return;
  843. }
  844. if (uRow.Cells["ScrapReason"].Text.Trim().Equals(""))
  845. {
  846. MessageUtil.ShowTips("请选择废品原因!");
  847. return;
  848. }
  849. if(!uRow.Cells["Status"].Text.Trim().Equals("合格"))
  850. {
  851. MessageUtil.ShowTips("不是合格坯不允许记录废品长度!");
  852. return;
  853. }
  854. ArrayList list = new ArrayList();
  855. list.Add(uRow.Cells["Furnaceno"].Text);
  856. list.Add(uRow.Cells["Sequenceno"].Text);
  857. list.Add(uRow.Cells["StoveNo"].Text);
  858. list.Add(uRow.Cells["JudgeStoveNoSeq"].Text);
  859. StlLgProgrrssEntity stlLgProgss = (StlLgProgrrssEntity)uRow.ListObject;
  860. string stlProgssEntity = JSONFormat.Format(stlLgProgss);
  861. CoreClientParam ccp = new CoreClientParam();
  862. ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmStuffSurfaceResult";
  863. ccp.MethodName = "saveScrapLen";
  864. ccp.ServerParams = new object[] { stlProgssEntity };
  865. ccp = ob.ExecuteNonQuery(ccp,CoreInvokeType.Internal);
  866. if (ccp.ReturnCode != -1)
  867. {
  868. if (ccp.ReturnInfo.Equals("保存成功!"))
  869. {
  870. doQueryRack(list);//查询管坯队列
  871. }
  872. else
  873. {
  874. MessageUtil.ShowTips(ccp.ReturnInfo);
  875. }
  876. }
  877. }
  878. private void txtFurnace_KeyDown(object sender, KeyEventArgs e)
  879. {
  880. if(e.KeyValue == 13)
  881. {
  882. QuerySinglePlan();
  883. }
  884. }
  885. private void ultraGrid2_InitializeRow(object sender, InitializeRowEventArgs e)
  886. {
  887. Infragistics.Win.ValueList valueList = new Infragistics.Win.ValueList();
  888. if (e.Row.Cells["FixNum"].Text.ToString() != "")
  889. {
  890. int ScrapDBNum = int.Parse(e.Row.Cells["FixNum"].Text.ToString3()) -1;
  891. valueList.ValueListItems.Add("", "");
  892. for (int i = 0; i < ScrapDBNum; i++)
  893. {
  894. valueList.ValueListItems.Add((i + 1).ToString(), (i + 1).ToString());
  895. }
  896. }
  897. else
  898. {
  899. valueList.ValueListItems.Add("0", "0");
  900. }
  901. e.Row.Cells["ScrapReasonNum"].ValueList = valueList;
  902. }
  903. }
  904. }