FrmEndLibrary.cs 75 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Server;
  3. using Core.Mes.Client.Comm.Tool;
  4. using Core.StlMes.Client.PlnSaleOrd.BaseMethod;
  5. using Core.StlMes.Client.PlnSaleOrd.工序排产;
  6. using Core.StlMes.Client.PlnSaleOrd.工序排产.entity;
  7. using Core.StlMes.Client.PlnSaleOrd.炼钢计划;
  8. using Core.StlMes.Client.PlnSaleOrd.炉计划.Entity;
  9. using Core.StlMes.Client.PlnSaleOrd.炉计划.Tool;
  10. using CoreFS.CA06;
  11. using Infragistics.Win.UltraWinGrid;
  12. using System;
  13. using System.Collections;
  14. using System.Collections.Generic;
  15. using System.ComponentModel;
  16. using System.Data;
  17. using System.Drawing;
  18. using System.Linq;
  19. using System.Text;
  20. using System.Windows.Forms;
  21. namespace Core.StlMes.Client.PlnSaleOrd.炉计划
  22. {
  23. public partial class FrmEndLibrary : FrmBase
  24. {
  25. private string[] plineCode = null;//获取产线代码
  26. public delegate int MyDelegate(int number);
  27. public FrmEndLibrary()
  28. {
  29. InitializeComponent();
  30. }
  31. private string proessCode = "";
  32. private void FrmEndLibrary_Load(object sender, EventArgs e)
  33. {
  34. EntityHelper.ShowGridCaption<MatBcMEntityEnd>(ultraGridChoose.DisplayLayout.Bands[0]);
  35. EntityHelper.ShowGridCaption<MatBcTrackEntity>(entityGrid1.DisplayLayout.Bands[0]);
  36. EntityHelper.ShowGridCaption<QcmBcJudgeChangeEntity>(entityGrid3.DisplayLayout.Bands[0]);
  37. EntityHelper.ShowGridCaption<PlnOrderZgSOEntityGp>(ultraGridZgS.DisplayLayout.Bands[0]);
  38. EntityHelper.ShowGridCaption<PlnOrderDbkSOEntity>(ultraGridDbks.DisplayLayout.Bands[0]);
  39. EntityHelper.ShowGridCaption<PlnOrderRclSOEntity>(ultraGridRcls.DisplayLayout.Bands[0]);
  40. EntityHelper.ShowGridCaption<PlnOrderJgxSOEntity>(ultraGridJgxs.DisplayLayout.Bands[0]);
  41. SteelHelper.InitGrade(comGrade, this.ob);
  42. BaseHelper.setOtherColumnReadOnly(ultraGridChoose, new string[] { "CHC", "TakeCount" });
  43. BaseHelper.InitCellPosition(ultraGridChoose, new string[] { "ActTheoryWeight", "ActWeight", "ActCount", "ActLen" });
  44. BaseHelper.GridColumnSum(ultraGridChoose, new string[] { "ActWeight", "ActTheoryWeight" });
  45. BaseHelper.GridColumnCount(ultraGridChoose, new string[] { "ActCount" });
  46. BaseHelper.setUltraGridColumnMaxInput(ultraGridChoose, new string[] { "ActTheoryWeight", "ActWeight" });
  47. BaseHelper.setUltraGridColumnBits(ultraGridChoose, new string[] { "ActCount" });
  48. //BaseHelper.ForbidSort(ultraGridChoose);
  49. BaseHelper.setColumnBackColor(ultraGridChoose, new string[] { "SpecCic" });
  50. ultraTabControl1.Tabs[0].Visible = false;
  51. ultraTabControl1.Tabs[1].Visible = false;
  52. ultraTabControl1.Tabs[2].Visible = false;
  53. ultraTabControl1.Tabs[3].Visible = false;
  54. if (CustomInfo.Equals("D"))//查询轧管可利库
  55. {
  56. proessCode = "D";
  57. plineCode = PlanHelper.InitDropPlinePower("D", txtbelong, this.ValidDataPurviewIds, this.ob);
  58. }
  59. else if (CustomInfo.Equals("E"))//查询镦拔扩可利库
  60. {
  61. proessCode = "E";
  62. plineCode = PlanHelper.InitDropPlinePower("E", txtbelong, this.ValidDataPurviewIds, this.ob);
  63. }
  64. else if (CustomInfo.Equals("F"))//查询热处理可利库
  65. {
  66. proessCode = "F";
  67. plineCode = PlanHelper.InitDropPlinePower("F", txtbelong, this.ValidDataPurviewIds, this.ob);
  68. }
  69. else if (CustomInfo.Equals("G"))//查询加工线可利库
  70. {
  71. proessCode = "G";
  72. plineCode = PlanHelper.InitDropPlinePower("G", txtbelong, this.ValidDataPurviewIds, this.ob);
  73. }
  74. ultraGridChoose.DisplayLayout.Bands[0].Columns["SpecCic"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.EditButton;
  75. }
  76. private void chcGrade_CheckedChanged(object sender, EventArgs e)
  77. {
  78. if (Chcbelong.Checked) { txtbelong.Enabled = true; } else { txtbelong.Enabled = false; }
  79. if (chcGrade.Checked) { comGrade.Enabled = true; } else { comGrade.Enabled = false; }
  80. if (chcJudgeNo.Checked) { txtJudgeNo.Enabled = true; } else { txtJudgeNo.Enabled = false; }
  81. }
  82. public override void ToolBar_Click(object sender, string ToolbarKey)
  83. {
  84. base.ToolBar_Click(sender, ToolbarKey);
  85. switch (ToolbarKey)
  86. {
  87. case "Query":
  88. QueryAll();
  89. break;
  90. case "Liku": //利库
  91. Liku();
  92. break;
  93. case "Monomer": // 脱单
  94. Monomer();
  95. break;
  96. case "Sentence": // 物料改判
  97. doSentence();
  98. break;
  99. case"NoOrderSentence"://无合同改判
  100. doNoSentence();
  101. break;
  102. case "UnSentence": // 撤销物料改判
  103. doUnSentence();
  104. break;
  105. case "ReturnLine": // 返线
  106. doReturnLine();
  107. break;
  108. case "ProcessLk": // 跨工序利库
  109. doProcessLk();
  110. break;
  111. case "UpdateReq": // 修改转短节备料合同
  112. doUpdateReq();
  113. break;
  114. case "Export":
  115. ExportData();
  116. break;
  117. case "Close":
  118. this.Close();
  119. break;
  120. default:
  121. break;
  122. }
  123. }
  124. /// <summary>
  125. /// 导出
  126. /// </summary>
  127. private void ExportData()
  128. {
  129. if (ultraTabControl2.SelectedTab.Key == "0")
  130. {
  131. GridHelper.ulGridToExcel(ultraGridChoose, "半成品库存信息");
  132. }
  133. else if (ultraTabControl2.SelectedTab.Key == "1")
  134. {
  135. GridHelper.ulGridToExcel(entityGrid1, "脱单利库历史记录");
  136. }
  137. else if (ultraTabControl2.SelectedTab.Key == "2")
  138. {
  139. GridHelper.ulGridToExcel(entityGrid3, "改判历史记录");
  140. }
  141. }
  142. /// <summary>
  143. /// 无合同改判
  144. /// </summary>
  145. private void doNoSentence()
  146. {
  147. this.ultraGridChoose.UpdateData();
  148. IQueryable<UltraGridRow> checkMagRows = this.ultraGridChoose.Rows.AsQueryable().Where(" CHC = 'True'");
  149. if (checkMagRows.Count() == 0)
  150. {
  151. MessageUtil.ShowTips("请选择需要做无合同改判物料信息!");
  152. return;
  153. }
  154. if(checkMagRows.Count() >1)
  155. {
  156. MessageUtil.ShowTips("无合同改判时,只允许选择一条物料信息!");
  157. return;
  158. }
  159. int m = 0;
  160. MatBcMEntityEnd ydmTity = new MatBcMEntityEnd();
  161. foreach (UltraGridRow row in checkMagRows)
  162. {
  163. ydmTity = (MatBcMEntityEnd)row.ListObject;
  164. if (int.Parse(ydmTity.ActCount.ToString3()) < int.Parse(row.Cells["TakeCount"].Text.ToString3()))
  165. {
  166. m = m + 1;
  167. }
  168. }
  169. if(m > 0)
  170. {
  171. MessageUtil.ShowTips("改判支数不能大于库存支数!");
  172. return;
  173. }
  174. FrmNoOrderSentence frm = new FrmNoOrderSentence(this.ob, ydmTity);
  175. frm.ShowDialog();
  176. if (frm.flag.Equals("1"))
  177. {
  178. QueryAll();
  179. MessageUtil.ShowTips("改判成功!");
  180. }
  181. }
  182. /// <summary>
  183. /// 查询
  184. /// </summary>
  185. private void QueryAll()
  186. {
  187. #region 查询条件
  188. string belongCode = "";
  189. string gradeCode = "";
  190. string judgeNo = "";
  191. if (Chcbelong.Checked)
  192. {
  193. if (txtbelong.Text.ToString().Trim().Equals(""))
  194. {
  195. MessageUtil.ShowTips("请选择产线!");
  196. return;
  197. }
  198. else
  199. {
  200. belongCode = txtbelong.Value.ToString();
  201. }
  202. }
  203. if (chcGrade.Checked)
  204. {
  205. if (comGrade.Text.ToString().Trim().Equals(""))
  206. {
  207. MessageUtil.ShowTips("请选择钢种!");
  208. return;
  209. }
  210. else
  211. {
  212. gradeCode = comGrade.Value.ToString();
  213. }
  214. }
  215. if (chcJudgeNo.Checked)
  216. {
  217. if (txtJudgeNo.Text.ToString().Trim().Equals(""))
  218. {
  219. MessageUtil.ShowTips("请输入判定炉号!");
  220. return;
  221. }
  222. else
  223. {
  224. judgeNo = txtJudgeNo.Text.ToString();
  225. }
  226. }
  227. if (plineCode == null)
  228. {
  229. MessageUtil.ShowTips("该用户没有产线查看权限!");
  230. return;
  231. }
  232. #endregion
  233. if (ultraTabControl2.SelectedTab.Key.Equals("0"))
  234. {
  235. Query(belongCode, gradeCode, judgeNo);
  236. }
  237. else if (ultraTabControl2.SelectedTab.Key.Equals("1"))
  238. {
  239. QueryTrack(belongCode, gradeCode, judgeNo);
  240. }
  241. else
  242. {
  243. QueryQcmBcJude(judgeNo);
  244. }
  245. }
  246. /// <summary>
  247. /// 查询利库信息
  248. /// </summary>
  249. private void Query(string belongCode, string gradeCode, string judgeNo)
  250. {
  251. List<MatBcMEntityEnd> listSourceM = null;
  252. if (chcLen.Checked)
  253. {
  254. listSourceM = EntityHelper.GetData<MatBcMEntityEnd>
  255. ("com.steering.pss.plnsaleord.planStove.FrmEndLibrary.queryMaterial1", new object[] { belongCode, gradeCode, judgeNo, plineCode, proessCode }, ob);
  256. }
  257. else
  258. {
  259. listSourceM = EntityHelper.GetData<MatBcMEntityEnd>
  260. ("com.steering.pss.plnsaleord.planStove.FrmEndLibrary.queryMaterial", new object[] { belongCode, gradeCode, judgeNo, plineCode, proessCode }, ob);
  261. }
  262. matBcMEntityBindingSource.DataSource = listSourceM;
  263. GridHelper.RefreshAndAutoSize(ultraGridChoose);
  264. if (listSourceM.Count <= 0)
  265. {
  266. plnOrderZgSOEntityBindingSource.DataSource = new List<PlnOrderZgSOEntityGp>();
  267. plnOrderDbkSOEntityBindingSource.DataSource = new List<PlnOrderDbkSOEntity>();
  268. plnOrderRclSOEntityBindingSource.DataSource = new List<PlnOrderRclSOEntity>();
  269. plnOrderJgxSOEntityBindingSource.DataSource = new List<PlnOrderJgxSOEntity>();
  270. DataTable tab = new DataTable();
  271. GridHelper.CopyDataToDatatable(tab, dataTable2, true);
  272. }
  273. }
  274. /// <summary>
  275. /// 查询精整脱单利库记录
  276. /// </summary>
  277. /// <param name="belongCode"></param>
  278. /// <param name="gradeCode"></param>
  279. /// <param name="judgeNo"></param>
  280. private void QueryTrack(string belongCode, string gradeCode, string judgeNo)
  281. {
  282. List<MatBcTrackEntity> listSource = EntityHelper.GetData<MatBcTrackEntity>
  283. ("com.steering.pss.plnsaleord.planStove.FrmEndLibrary.queryMatGpTrack", new object[] { belongCode, gradeCode, judgeNo, plineCode, proessCode }, this.ob);
  284. matBcTrackEntityBindingSource.DataSource = listSource;
  285. GridHelper.RefreshAndAutoSize(entityGrid1);
  286. }
  287. /// <summary>
  288. /// 查询改判记录
  289. /// </summary>
  290. /// <param name="judgeNo"></param>
  291. private void QueryQcmBcJude(string judgeNo)
  292. {
  293. List<QcmBcJudgeChangeEntity> listSource = EntityHelper.GetData<QcmBcJudgeChangeEntity>
  294. ("com.steering.pss.plnsaleord.planStove.FrmEndLibrary.queryQcmBcJude", new object[] { judgeNo, proessCode }, this.ob);
  295. bindingSource1.DataSource = listSource;
  296. GridHelper.RefreshAndAutoSize(entityGrid3);
  297. }
  298. /// <summary>
  299. /// 脱单
  300. /// </summary>
  301. private void Monomer()
  302. {
  303. UltraGridRow row = ultraGridChoose.ActiveRow;
  304. if (row == null) return;
  305. ArrayList list1 = new ArrayList();
  306. int count = 0;
  307. foreach (UltraGridRow item in ultraGridChoose.Rows)
  308. {
  309. if (Convert.ToBoolean(item.Cells["CHC"].Text) == true)
  310. {
  311. count++;
  312. if (!item.Cells["JugdeApplyCode"].Text.ToString().Equals("") && !item.Cells["MatStatus"].Text.ToString().Contains("材料产出待判"))
  313. {
  314. MessageUtil.ShowTips("你选择的半成品物料已送判且不是材料产出未判,不能脱单!");
  315. return;
  316. }
  317. ArrayList list = new ArrayList();
  318. list.Add(item.Cells["JudgeStoveNo"].Text.ToString());
  319. list.Add(item.Cells["BatchNo"].Text.ToString());
  320. list.Add(item.Cells["BatchGroudNo"].Text.ToString());
  321. list.Add(item.Cells["TakeCount"].Value.ToString());
  322. list.Add(item.Cells["HeatPlanNoNext"].Text.ToString());
  323. list.Add(item.Cells["ProcessCdoe"].Text.ToString());
  324. list.Add(item.Cells["JugdeApplyCode"].Text.ToString());
  325. list.Add(item.Cells["ProOrderNo"].Text.ToString());
  326. list.Add(item.Cells["ActLen"].Text.ToString());
  327. list.Add(item.Cells["MatNo"].Text.ToString());
  328. list.Add(item.Cells["MaterialNo"].Text.ToString());
  329. list1.Add(list);
  330. }
  331. }
  332. if (count == 0)
  333. {
  334. MessageUtil.ShowTips("请选择库存信息!");
  335. return;
  336. }
  337. string lenFalg = "0";//不分组
  338. if (chcLen.Checked)
  339. {
  340. lenFalg = "1";//分组
  341. }
  342. if (MessageUtil.ShowYesNoAndQuestion("是否确认脱单,脱单后不能利原合同!") ==
  343. DialogResult.No)
  344. return;
  345. PlanComm.WaitFromOpen(this.Cursor);
  346. CoreClientParam ccp = new CoreClientParam();
  347. ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmEndLibrary";
  348. ccp.MethodName = "doDeleteMonomerLg";
  349. ccp.ServerParams = new object[] { list1, this.UserInfo.GetUserName(), lenFalg };
  350. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  351. PlanComm.WaitFromColse(this.Cursor);
  352. if (ccp.ReturnCode == -1) return;
  353. MessageUtil.ShowTips(ccp.ReturnInfo);
  354. if (ccp.ReturnInfo.Equals("脱单成功!"))
  355. {
  356. QueryAll();
  357. }
  358. }
  359. /// <summary>
  360. /// 利库
  361. /// </summary>
  362. private void Liku()
  363. {
  364. UltraGridRow row = ultraGridChoose.ActiveRow;
  365. if (row == null) return;
  366. double wt = 0;
  367. if (row.Cells["ActWeight"].Value.ToString().Equals("0"))
  368. {
  369. MessageUtil.ShowTips("您选择的判定炉号重量为零,不能利库!");
  370. return;
  371. }
  372. //if (!row.Cells["HeatPlanNoNext"].Text.ToString().Equals(""))
  373. //{
  374. // MessageUtil.ShowTips("您选择的判定炉号已挂下个工序订单,不能利库!");
  375. // return;
  376. //}
  377. if (!row.Cells["ProOrderNo"].Text.ToString().Equals(""))
  378. {
  379. MessageUtil.ShowTips("您选择的判定炉号已存在生产合同,不能利库!");
  380. return;
  381. }
  382. string porderstatus = "";//合同状态
  383. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.doQueryPorderstatus", new object[] { row.Cells["OrdLnDlyPk"].Text.Trim() }, ob);
  384. if (dt.Rows.Count > 0)
  385. {
  386. porderstatus = dt.Rows[0]["PORDERSTATUS"].ToString();
  387. }
  388. if (porderstatus.Equals("4") || porderstatus.Equals("5"))
  389. {
  390. MessageUtil.ShowTips("该合同已生产完成或关闭,请联系销售!");
  391. return;
  392. }
  393. string specCic = row.Cells["SpecCic"].Text.ToString();
  394. int countCic = 0;
  395. if (specCic.Equals(""))
  396. {
  397. string gradeName = row.Cells["Gradename"].Text.ToString();
  398. string cic = row.Cells["Cic"].Text.ToString();
  399. UltraGridRow rowCic = entityGrid2.ActiveRow;
  400. //if (rowCic == null) return;
  401. //int countCic = 0;
  402. foreach (UltraGridRow item in entityGrid2.Rows)
  403. {
  404. if (item.Cells["GRADENAME"].Text.ToString().Equals(gradeName) && item.Cells["CIC"].Text.ToString().Equals(cic))
  405. {
  406. countCic++;
  407. }
  408. }
  409. }
  410. wt += double.Parse(row.Cells["ActWeight"].Value.ToString());
  411. ArrayList list = new ArrayList();
  412. string processCdoe=row.Cells["ProcessCdoe"].Text.ToString().Trim();
  413. list.Add(row.Cells["JudgeStoveNo"].Text.ToString());
  414. list.Add(row.Cells["BatchNo"].Value.ToString());
  415. list.Add(row.Cells["BatchGroudNo"].Value.ToString());
  416. list.Add(row.Cells["TakeCount"].Value.ToString());
  417. list.Add(row.Cells["ActWeight"].Value.ToString());
  418. list.Add(processCdoe);
  419. //list.Add(item.Cells["Gradecode"].Text.ToString());
  420. list.Add(row.Cells["MaterialNo"].Text.ToString());
  421. if (!specCic.Equals(""))
  422. {
  423. list.Add(row.Cells["SpecCic"].Text.ToString());
  424. }
  425. else
  426. {
  427. list.Add(row.Cells["Cic"].Text.ToString());
  428. specCic = row.Cells["Cic"].Text.ToString();
  429. }
  430. list.Add(row.Cells["ProOrderNo"].Text.ToString());
  431. list.Add(row.Cells["ActLen"].Text.ToString());
  432. list.Add(row.Cells["MatNo"].Text.ToString());
  433. if (processCdoe.Equals("D"))
  434. {
  435. doAddLibraryZg(list, countCic, specCic, "");
  436. // if (comPlanEndZg1.flag == true)
  437. // {
  438. // QueryAll();
  439. // }
  440. }
  441. else if (processCdoe.Equals("E"))
  442. {
  443. doAddLibraryDbk(list,countCic, specCic);
  444. //if (comPlanEndDbk1.flag == true)
  445. //{
  446. // QueryAll();
  447. //}
  448. }
  449. else if (processCdoe.Equals("F"))
  450. {
  451. doAddLibraryRcl(list, countCic, specCic);
  452. //if (comPlanEndRcl1.flag == true)
  453. //{
  454. // QueryAll();
  455. //}
  456. }
  457. else if (processCdoe.Equals("G"))
  458. {
  459. doAddLibraryJgx(list, countCic,specCic);
  460. //if (comPlanEndJgx1.flag == true)
  461. //{
  462. // QueryAll();
  463. //}
  464. }
  465. }
  466. /// <summary>
  467. /// 跨工序利库
  468. /// </summary>
  469. private void doProcessLk()
  470. {
  471. UltraGridRow row = ultraGridChoose.ActiveRow;
  472. if (row == null) return;
  473. double wt = 0;
  474. if (row.Cells["ActWeight"].Value.ToString().Equals("0"))
  475. {
  476. MessageUtil.ShowTips("您选择的判定炉号重量为零,不能利库!");
  477. return;
  478. }
  479. //if (!row.Cells["HeatPlanNoNext"].Text.ToString().Equals(""))
  480. //{
  481. // MessageUtil.ShowTips("您选择的判定炉号已挂下个工序订单,不能利库!");
  482. // return;
  483. //}
  484. if (!row.Cells["ProOrderNo"].Text.ToString().Equals(""))
  485. {
  486. MessageUtil.ShowTips("您选择的判定炉号已存在生产合同,不能利库!");
  487. return;
  488. }
  489. string porderstatus = "";//合同状态
  490. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.doQueryPorderstatus", new object[] { row.Cells["OrdLnDlyPk"].Text.Trim() }, ob);
  491. if (dt.Rows.Count > 0)
  492. {
  493. porderstatus = dt.Rows[0]["PORDERSTATUS"].ToString();
  494. }
  495. if (porderstatus.Equals("4") || porderstatus.Equals("5"))
  496. {
  497. MessageUtil.ShowTips("该合同已生产完成或关闭,请联系销售!");
  498. return;
  499. }
  500. string specCic = row.Cells["SpecCic"].Text.ToString();
  501. int countCic = 0;
  502. if (specCic.Equals(""))
  503. {
  504. string gradeName = row.Cells["Gradename"].Text.ToString();
  505. string cic = row.Cells["Cic"].Text.ToString();
  506. UltraGridRow rowCic = entityGrid2.ActiveRow;
  507. if (rowCic == null) return;
  508. //int countCic = 0;
  509. foreach (UltraGridRow item in entityGrid2.Rows)
  510. {
  511. if (item.Cells["GRADENAME"].Text.ToString().Equals(gradeName) && item.Cells["CIC"].Text.ToString().Equals(cic))
  512. {
  513. countCic++;
  514. }
  515. }
  516. }
  517. wt += double.Parse(row.Cells["ActWeight"].Value.ToString());
  518. ArrayList list = new ArrayList();
  519. string processCdoe = "D";//row.Cells["ProcessCdoe"].Text.ToString().Trim();
  520. list.Add(row.Cells["JudgeStoveNo"].Text.ToString());
  521. list.Add(row.Cells["BatchNo"].Value.ToString());
  522. list.Add(row.Cells["BatchGroudNo"].Value.ToString());
  523. list.Add(row.Cells["TakeCount"].Value.ToString());
  524. list.Add(row.Cells["ActWeight"].Value.ToString());
  525. list.Add(processCdoe);
  526. //list.Add(item.Cells["Gradecode"].Text.ToString());
  527. list.Add(row.Cells["MaterialNo"].Text.ToString());
  528. if (!specCic.Equals(""))
  529. {
  530. list.Add(row.Cells["SpecCic"].Text.ToString());
  531. }
  532. else
  533. {
  534. list.Add(row.Cells["Cic"].Text.ToString());
  535. }
  536. list.Add(row.Cells["ProOrderNo"].Text.ToString());
  537. list.Add(row.Cells["ActLen"].Text.ToString());
  538. list.Add(row.Cells["MatNo"].Text.ToString());
  539. if (processCdoe.Equals("D"))
  540. {
  541. doAddLibraryZg(list, countCic, specCic,"1");
  542. // if (comPlanEndZg1.flag == true)
  543. // {
  544. // QueryAll();
  545. // }
  546. }
  547. else if (processCdoe.Equals("E"))
  548. {
  549. doAddLibraryDbk(list, countCic, specCic);
  550. //if (comPlanEndDbk1.flag == true)
  551. //{
  552. // QueryAll();
  553. //}
  554. }
  555. else if (processCdoe.Equals("F"))
  556. {
  557. doAddLibraryRcl(list, countCic, specCic);
  558. //if (comPlanEndRcl1.flag == true)
  559. //{
  560. // QueryAll();
  561. //}
  562. }
  563. else if (processCdoe.Equals("G"))
  564. {
  565. doAddLibraryJgx(list, countCic, specCic);
  566. //if (comPlanEndJgx1.flag == true)
  567. //{
  568. // QueryAll();
  569. //}
  570. }
  571. }
  572. /// <summary>
  573. /// 返线
  574. /// </summary>
  575. private void doReturnLine()
  576. {
  577. UltraGridRow row = ultraGridChoose.ActiveRow;
  578. if (row == null) return;
  579. double wt = 0;
  580. if (row.Cells["TakeCount"].Value.ToString().Equals("0"))
  581. {
  582. MessageUtil.ShowTips("您选择的脱单/利库支为零,不能返线!");
  583. return;
  584. }
  585. string porderstatus = "";//合同状态
  586. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.doQueryPorderstatus", new object[] { row.Cells["OrdLnDlyPk"].Text.Trim() }, ob);
  587. if (dt.Rows.Count > 0)
  588. {
  589. porderstatus = dt.Rows[0]["PORDERSTATUS"].ToString();
  590. }
  591. if (porderstatus.Equals("4") || porderstatus.Equals("5"))
  592. {
  593. MessageUtil.ShowTips("该合同已生产完成或关闭,请联系销售!");
  594. return;
  595. }
  596. int countCic = 0;
  597. string gradeName = row.Cells["Gradename"].Text.ToString();
  598. string cic = row.Cells["Cic"].Text.ToString();
  599. UltraGridRow rowCic = entityGrid2.ActiveRow;
  600. //if (rowCic == null) return;
  601. //int countCic = 0;
  602. foreach (UltraGridRow item in entityGrid2.Rows)
  603. {
  604. if (item.Cells["GRADENAME"].Text.ToString().Equals(gradeName) && item.Cells["CIC"].Text.ToString().Equals(cic))
  605. {
  606. countCic++;
  607. }
  608. }
  609. ArrayList list = new ArrayList();
  610. string processCdoe = row.Cells["ProcessCdoe"].Text.ToString().Trim();
  611. list.Add(row.Cells["JudgeStoveNo"].Text.ToString());
  612. list.Add(row.Cells["BatchNo"].Value.ToString());
  613. list.Add(row.Cells["BatchGroudNo"].Value.ToString());
  614. list.Add(row.Cells["TakeCount"].Value.ToString());
  615. list.Add(row.Cells["ActWeight"].Value.ToString());
  616. list.Add(processCdoe);
  617. list.Add(row.Cells["OnProOrderId"].Value.ToString());
  618. list.Add(row.Cells["HeatPlanNoOld"].Value.ToString());
  619. list.Add(row.Cells["HeatPlanNo"].Value.ToString());
  620. list.Add(row.Cells["ProOrderNo"].Text.ToString());
  621. list.Add(row.Cells["ActLen"].Text.ToString());
  622. list.Add(row.Cells["MaterialNo"].Text.ToString());
  623. if (processCdoe.Equals("F"))
  624. {
  625. string pointGx = "";
  626. string plineName = "";
  627. FrmReturnCon line = new FrmReturnCon(plineName, ob, "6002");
  628. //FrmReturnCon line = new FrmReturnCon(plineCode, ob, "6002");
  629. line.ShowDialog();
  630. if (line.DialogResult == System.Windows.Forms.DialogResult.OK)
  631. {
  632. //获取弹出窗体的属性值
  633. pointGx = line.RetPro;
  634. }
  635. else
  636. {
  637. //MessageUtil.ShowTips("请选择返线经过工序点!");
  638. return;
  639. }
  640. list.Add(pointGx);
  641. list.Add(this.UserInfo.GetUserOrder());
  642. list.Add(this.UserInfo.GetUserGroup());
  643. list.Add(row.Cells["HeatPlanNoNext"].Value.ToString());
  644. doAddLibraryRclFx(list);
  645. }
  646. else if (processCdoe.Equals("G"))
  647. {
  648. list.Add("");
  649. list.Add(this.UserInfo.GetUserOrder());
  650. list.Add(this.UserInfo.GetUserGroup());
  651. list.Add(row.Cells["HeatPlanNoNext"].Value.ToString());
  652. doAddLibraryJgxFx(list);
  653. }
  654. else if (processCdoe.Equals("E"))
  655. {
  656. list.Add("");
  657. list.Add(this.UserInfo.GetUserOrder());
  658. list.Add(this.UserInfo.GetUserGroup());
  659. list.Add(row.Cells["HeatPlanNoNext"].Value.ToString());
  660. doAddLibraryDbkFx(list);
  661. }
  662. }
  663. /// <summary>
  664. ///镦拔扩炉计划返线
  665. /// </summary>
  666. /// <param name="list"></param>
  667. public void doAddLibraryDbkFx(ArrayList list)
  668. {
  669. UltraGridRow row = ultraGridDbks.ActiveRow;
  670. if (row == null) return;
  671. int count = 0;
  672. string proPlanId = "";
  673. string gxPlanNo = "";
  674. foreach (UltraGridRow ugr in ultraGridDbks.Rows)
  675. {
  676. if (Convert.ToBoolean(ugr.Cells["CHC"].Text) == true)
  677. {
  678. count++;
  679. proPlanId = ugr.Cells["ProPlanId"].Value.ToString();
  680. gxPlanNo = ugr.Cells["GxPlanNo"].Value.ToString();
  681. }
  682. }
  683. if (count == 0 || count > 1)
  684. {
  685. MessageUtil.ShowTips("请选择一个镦拔扩订单!");
  686. return;
  687. }
  688. string lenFalg = "0";//不分组
  689. if (chcLen.Checked)
  690. {
  691. lenFalg = "1";//分组
  692. }
  693. if (MessageUtil.ShowYesNoAndQuestion("是否确认返线?") ==
  694. DialogResult.No)
  695. return;
  696. PlanComm.WaitFromOpen(this.Cursor);
  697. CoreClientParam ccp = new CoreClientParam();
  698. ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmEndLibrary";
  699. ccp.MethodName = "doReturnLine";
  700. ccp.ServerParams = new object[] { list, this.UserInfo.GetUserName(), proPlanId, gxPlanNo, lenFalg };
  701. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  702. PlanComm.WaitFromColse(this.Cursor);
  703. if (ccp.ReturnCode == -1) return;
  704. MessageUtil.ShowTips(ccp.ReturnInfo);
  705. if (ccp.ReturnInfo.Equals("返线成功!"))
  706. {
  707. QueryAll();
  708. }
  709. }
  710. /// <summary>
  711. /// 加工线炉计划返线
  712. /// </summary>
  713. /// <param name="list"></param>
  714. public void doAddLibraryJgxFx(ArrayList list)
  715. {
  716. UltraGridRow row = ultraGridJgxs.ActiveRow;
  717. if (row == null) return;
  718. int count = 0;
  719. string proPlanId = "";
  720. string gxPlanNo = "";
  721. foreach (UltraGridRow ugr in ultraGridJgxs.Rows)
  722. {
  723. if (Convert.ToBoolean(ugr.Cells["CHC"].Text) == true)
  724. {
  725. count++;
  726. proPlanId = ugr.Cells["ProPlanId"].Value.ToString();
  727. gxPlanNo = ugr.Cells["GxPlanNo"].Value.ToString();
  728. }
  729. }
  730. if (count == 0 || count > 1)
  731. {
  732. MessageUtil.ShowTips("请选择一个加工线订单!");
  733. return;
  734. }
  735. string lenFalg = "0";//不分组
  736. if (chcLen.Checked)
  737. {
  738. lenFalg = "1";//分组
  739. }
  740. if (MessageUtil.ShowYesNoAndQuestion("是否确认返线?") ==
  741. DialogResult.No)
  742. return;
  743. PlanComm.WaitFromOpen(this.Cursor);
  744. CoreClientParam ccp = new CoreClientParam();
  745. ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmEndLibrary";
  746. ccp.MethodName = "doReturnLine";
  747. ccp.ServerParams = new object[] { list, this.UserInfo.GetUserName(), proPlanId, gxPlanNo, lenFalg};
  748. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  749. PlanComm.WaitFromColse(this.Cursor);
  750. if (ccp.ReturnCode == -1) return;
  751. MessageUtil.ShowTips(ccp.ReturnInfo);
  752. if (ccp.ReturnInfo.Equals("返线成功!"))
  753. {
  754. QueryAll();
  755. }
  756. }
  757. /// <summary>
  758. /// 热处理返线
  759. /// </summary>
  760. /// <param name="list"></param>
  761. public void doAddLibraryRclFx(ArrayList list)
  762. {
  763. UltraGridRow row = ultraGridRcls.ActiveRow;
  764. if (row == null) return;
  765. int count = 0;
  766. string proPlanId = "";
  767. string gxPlanNo = "";
  768. foreach (UltraGridRow ugr in ultraGridRcls.Rows)
  769. {
  770. if (Convert.ToBoolean(ugr.Cells["CHC"].Text) == true)
  771. {
  772. count++;
  773. proPlanId = ugr.Cells["ProPlanId"].Value.ToString();
  774. gxPlanNo = ugr.Cells["GxPlanNo"].Value.ToString();
  775. }
  776. }
  777. if (count == 0 || count > 1)
  778. {
  779. MessageUtil.ShowTips("请选择一个热处理订单!");
  780. return;
  781. }
  782. string lenFalg = "0";//不分组
  783. if (chcLen.Checked)
  784. {
  785. lenFalg = "1";//分组
  786. }
  787. if (MessageUtil.ShowYesNoAndQuestion("是否确认返线?") ==
  788. DialogResult.No)
  789. return;
  790. PlanComm.WaitFromOpen(this.Cursor);
  791. CoreClientParam ccp = new CoreClientParam();
  792. ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmEndLibrary";
  793. ccp.MethodName = "doReturnLine";
  794. ccp.ServerParams = new object[] { list, this.UserInfo.GetUserName(), proPlanId, gxPlanNo, lenFalg };
  795. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  796. PlanComm.WaitFromColse(this.Cursor);
  797. if (ccp.ReturnCode == -1) return;
  798. MessageUtil.ShowTips(ccp.ReturnInfo);
  799. if (ccp.ReturnInfo.Equals("返线成功!"))
  800. {
  801. QueryAll();
  802. }
  803. }
  804. /// <summary>
  805. /// 物料改判
  806. /// </summary>
  807. private void doSentence()
  808. {
  809. UltraGridRow row = ultraGridChoose.ActiveRow;
  810. if (row == null) return;
  811. double wt = 0;
  812. if (row.Cells["ActWeight"].Value.ToString().Equals("0"))
  813. {
  814. MessageUtil.ShowTips("您选择的判定炉号重量为零,不能改判!");
  815. return;
  816. }
  817. /* if (!row.Cells["HeatPlanNoNext"].Text.ToString().Equals(""))
  818. {
  819. MessageUtil.ShowTips("您选择的判定炉号已挂下个工序订单,不能改判!");
  820. return;
  821. }*/
  822. //if (!row.Cells["ProOrderNo"].Text.ToString().Equals(""))
  823. //{
  824. // MessageUtil.ShowTips("您选择的判定炉号已存在生产合同,不能改判!");
  825. // return;
  826. //}
  827. //string specCic = row.Cells["SpecCic"].Text.ToString();
  828. //int countCic = 0;
  829. //if (specCic.Equals(""))
  830. //{
  831. // string gradeName = row.Cells["Gradename"].Text.ToString();
  832. // string cic = row.Cells["Cic"].Text.ToString();
  833. // UltraGridRow rowCic = entityGrid2.ActiveRow;
  834. // if (rowCic == null) return;
  835. // //int countCic = 0;
  836. // foreach (UltraGridRow item in entityGrid2.Rows)
  837. // {
  838. // if (item.Cells["GRADENAME"].Text.ToString().Equals(gradeName) && item.Cells["CIC"].Text.ToString().Equals(cic))
  839. // {
  840. // countCic++;
  841. // }
  842. // }
  843. //}
  844. wt += double.Parse(row.Cells["ActWeight"].Value.ToString());
  845. ArrayList list = new ArrayList();
  846. string processCdoe = row.Cells["ProcessCdoe"].Text.ToString().Trim();
  847. list.Add(row.Cells["JudgeStoveNo"].Text.ToString());
  848. list.Add(row.Cells["BatchNo"].Value.ToString());
  849. list.Add(row.Cells["BatchGroudNo"].Value.ToString());
  850. list.Add(row.Cells["TakeCount"].Value.ToString());
  851. list.Add(row.Cells["ActWeight"].Value.ToString());
  852. list.Add(processCdoe);
  853. //list.Add(item.Cells["Gradecode"].Text.ToString());
  854. list.Add(row.Cells["MaterialNo"].Text.ToString());
  855. //if (!specCic.Equals(""))
  856. //{
  857. // list.Add(row.Cells["SpecCic"].Text.ToString());
  858. //}
  859. //else
  860. //{
  861. // list.Add(row.Cells["Cic"].Text.ToString());
  862. //}
  863. list.Add(row.Cells["ProOrderNo"].Text.ToString());
  864. list.Add(row.Cells["ActLen"].Text.ToString());
  865. string judgeId = row.Cells["JudgeId"].Text.ToString();
  866. if (!judgeId.Equals(""))
  867. {
  868. if (MessageUtil.ShowYesNoAndQuestion("选中的炉号已物料改判,是否继续改判!") ==
  869. DialogResult.No)
  870. return;
  871. }
  872. if (processCdoe.Equals("D"))
  873. {
  874. doSentenceZg(list);
  875. //if (comPlanEndZg1.flag == true)
  876. //{
  877. // QueryAll();
  878. //}
  879. }
  880. else if (processCdoe.Equals("E"))
  881. {
  882. doSentenceDbk(list);
  883. //if (comPlanEndDbk1.flag == true)
  884. //{
  885. // QueryAll();
  886. //}
  887. }
  888. else if (processCdoe.Equals("F"))
  889. {
  890. doSentenceRcl(list);
  891. //if (comPlanEndRcl1.flag == true)
  892. //{
  893. // QueryAll();
  894. //}
  895. }
  896. else if (processCdoe.Equals("G"))
  897. {
  898. doSentenceJgx(list);
  899. //if (comPlanEndJgx1.flag == true)
  900. //{
  901. // QueryAll();
  902. //}
  903. }
  904. }
  905. /// <summary>
  906. /// 撤销物料改判
  907. /// </summary>
  908. private void doUnSentence()
  909. {
  910. UltraGridRow row = ultraGridChoose.ActiveRow;
  911. if (row == null) return;
  912. ArrayList list1 = new ArrayList();
  913. int count = 0;
  914. foreach (UltraGridRow item in ultraGridChoose.Rows)
  915. {
  916. if (Convert.ToBoolean(item.Cells["CHC"].Text) == true)
  917. {
  918. count++;
  919. string judgeId = row.Cells["JudgeId"].Text.ToString();
  920. if (judgeId.Equals(""))
  921. {
  922. MessageUtil.ShowTips("选中的炉号未物料改判,不能撤销改判!");
  923. return;
  924. }
  925. if (!item.Cells["JugdeApplyCode"].Text.ToString().Equals("") && !item.Cells["MatStatus"].Text.ToString().Equals("材料产出(已判定)"))
  926. {
  927. MessageUtil.ShowTips("你选择的半成品物料已送判且不是材料产出已判,不能撤销改判!");
  928. return;
  929. }
  930. /*if (!row.Cells["HeatPlanNoNext"].Text.ToString().Equals(""))
  931. {
  932. MessageUtil.ShowTips("您选择的判定炉号已挂下个工序订单,不能撤销改判!");
  933. return;
  934. }*/
  935. ArrayList list = new ArrayList();
  936. list.Add(item.Cells["JudgeStoveNo"].Text.ToString());
  937. list.Add(item.Cells["BatchNo"].Text.ToString());
  938. list.Add(item.Cells["BatchGroudNo"].Text.ToString());
  939. list.Add(item.Cells["TakeCount"].Text.ToString());
  940. list.Add(item.Cells["HeatPlanNoNext"].Text.ToString());
  941. list.Add(item.Cells["ProcessCdoe"].Text.ToString());
  942. list.Add(item.Cells["JugdeApplyCode"].Text.ToString());
  943. list.Add(item.Cells["JudgeId"].Text.ToString());
  944. list.Add(item.Cells["ProOrderNo"].Text.ToString());
  945. list.Add(item.Cells["ActLen"].Text.ToString());
  946. list.Add(item.Cells["MaterialNo"].Text.ToString());
  947. list1.Add(list);
  948. }
  949. }
  950. if (count == 0)
  951. {
  952. MessageUtil.ShowTips("请选择库存信息!");
  953. return;
  954. }
  955. string lenFalg = "0";//不分组
  956. if (chcLen.Checked)
  957. {
  958. lenFalg = "1";//分组
  959. }
  960. if (MessageUtil.ShowYesNoAndQuestion("是否确认撤销改判!") ==
  961. DialogResult.No)
  962. return;
  963. PlanComm.WaitFromOpen(this.Cursor);
  964. CoreClientParam ccp = new CoreClientParam();
  965. ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmEndLibrary";
  966. ccp.MethodName = "doUnSentence";
  967. ccp.ServerParams = new object[] { list1, this.UserInfo.GetUserName(), lenFalg };
  968. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  969. PlanComm.WaitFromColse(this.Cursor);
  970. if (ccp.ReturnCode == -1) return;
  971. MessageUtil.ShowTips(ccp.ReturnInfo);
  972. if (ccp.ReturnInfo.Equals("撤销改判成功!"))
  973. {
  974. QueryAll();
  975. }
  976. }
  977. ///
  978. private void doUpdateReq()
  979. {
  980. }
  981. DataTable dtCic = new DataTable();
  982. /// <summary>
  983. /// 查询工艺评审CIC
  984. /// </summary>
  985. /// <param name="ordLnDlyPk"></param>
  986. /// <param name="indexSeq"></param>
  987. /// <param name="carftSeq"></param>
  988. public void QueryCic(string ordLnDlyPk, string indexSeq, string carftSeq, string gradeName)
  989. {
  990. dtCic = ServerHelper.GetData("com.steering.pss.plnsaleord.planStove.StoveHelper.queryCic", new object[] { ordLnDlyPk, indexSeq, carftSeq },ob);
  991. DataRow[] datarows = dtCic.Select("GRADENAME = '" + gradeName + "'");
  992. DataTable tab = StoveHelper.ToDataTable(datarows);
  993. GridHelper.CopyDataToDatatable(tab, dataTable2, true);
  994. GridHelper.RefreshAndAutoSize(entityGrid2);
  995. foreach (UltraGridRow ugr in entityGrid2.Rows)
  996. {
  997. ugr.Cells["CHC"].Value = "指定";
  998. }
  999. }
  1000. public void QueryCicAll(string ordLnDlyPk, string indexSeq, string carftSeq, string gradeName,OpeBase _ob)
  1001. {
  1002. //QueryCic(ordLnDlyPk, indexSeq, carftSeq, _ob);
  1003. entityGrid2.UpdateData();
  1004. DataRow[] datarows = dtCic.Select("GRADENAME = '" + gradeName + "'");
  1005. DataTable tab = StoveHelper.ToDataTable(datarows);
  1006. GridHelper.CopyDataToDatatable(ref tab, ref dataTable2, true);
  1007. GridHelper.RefreshAndAutoSize(entityGrid2);
  1008. foreach (UltraGridRow ugr in entityGrid2.Rows)
  1009. {
  1010. ugr.Cells["CHC"].Value = "指定";
  1011. }
  1012. entityGrid2.Refresh();
  1013. entityGrid2.Update();
  1014. //comPlanEndZg1.ordLnDlyPk = "";
  1015. }
  1016. private void ultraGridChoose_AfterRowActivate(object sender, EventArgs e)
  1017. {
  1018. UltraGridRow row = ultraGridChoose.ActiveRow;
  1019. if (row == null) return;
  1020. string processCode = row.Cells["ProcessCdoe"].Value.ToString();
  1021. string materialNo= row.Cells["MaterialNo"].Text.ToString();
  1022. string StoveNo = row.Cells["StoveNo"].Text.ToString();
  1023. string gradeName = row.Cells["Gradename"].Text.ToString();
  1024. if (processCode.Equals("D"))
  1025. {
  1026. ultraTabControl1.Tabs[0].Visible = true;
  1027. ultraTabControl1.Tabs[1].Visible = false;
  1028. ultraTabControl1.Tabs[2].Visible = false;
  1029. ultraTabControl1.Tabs[3].Visible = false;
  1030. //查询满足产出物料的订单信息
  1031. QueryPlanZg(materialNo, StoveNo);
  1032. //if (!comPlanEndZg1.ordLnDlyPk.Equals(""))
  1033. //{
  1034. // QueryCic(comPlanEndZg1.ordLnDlyPk, comPlanEndZg1.indexSeq, comPlanEndZg1.carftSeq);
  1035. // string gradeName = row.Cells["Gradename"].Text.ToString();
  1036. // entityGrid2.UpdateData();
  1037. // DataRow[] datarows = dtCic.Select("GRADENAME = '" + gradeName + "'");
  1038. // DataTable tab = StoveHelper.ToDataTable(datarows);
  1039. // GridHelper.CopyDataToDatatable(tab, dataTable2, true);
  1040. // GridHelper.RefreshAndAutoSize(entityGrid2);
  1041. // foreach (UltraGridRow ugr in entityGrid2.Rows)
  1042. // {
  1043. // ugr.Cells["CHC"].Value = "指定";
  1044. // }
  1045. // entityGrid2.Refresh();
  1046. // entityGrid2.Update();
  1047. // comPlanEndZg1.ordLnDlyPk = "";
  1048. //}
  1049. //else
  1050. //{
  1051. // DataTable tab = new DataTable();
  1052. // GridHelper.CopyDataToDatatable(tab, dataTable2, true);
  1053. //}
  1054. }
  1055. else if (processCode.Equals("E"))
  1056. {
  1057. ultraTabControl1.Tabs[0].Visible = false;
  1058. ultraTabControl1.Tabs[1].Visible = true;
  1059. ultraTabControl1.Tabs[2].Visible = false;
  1060. ultraTabControl1.Tabs[3].Visible = false;
  1061. QueryPlanDbk(materialNo, StoveNo);
  1062. //if (!comPlanEndDbk1.ordLnDlyPk.Equals(""))
  1063. //{
  1064. // QueryCic(comPlanEndDbk1.ordLnDlyPk, comPlanEndDbk1.indexSeq, comPlanEndDbk1.carftSeq);
  1065. // string gradeName = row.Cells["Gradename"].Text.ToString();
  1066. // entityGrid2.UpdateData();
  1067. // DataRow[] datarows = dtCic.Select("GRADENAME = '" + gradeName + "'");
  1068. // DataTable tab = StoveHelper.ToDataTable(datarows);
  1069. // GridHelper.CopyDataToDatatable(tab, dataTable2, true);
  1070. // GridHelper.RefreshAndAutoSize(entityGrid2);
  1071. // foreach (UltraGridRow ugr in entityGrid2.Rows)
  1072. // {
  1073. // ugr.Cells["CHC"].Value = "指定";
  1074. // }
  1075. // entityGrid2.Refresh();
  1076. // entityGrid2.Update();
  1077. // comPlanEndDbk1.ordLnDlyPk = "";
  1078. //}
  1079. //else
  1080. //{
  1081. // DataTable tab = new DataTable();
  1082. // GridHelper.CopyDataToDatatable(tab, dataTable2, true);
  1083. //}
  1084. }
  1085. else if (processCode.Equals("F"))
  1086. {
  1087. ultraTabControl1.Tabs[0].Visible = true;
  1088. ultraTabControl1.Tabs[1].Visible = false;
  1089. ultraTabControl1.Tabs[2].Visible = true;
  1090. ultraTabControl1.Tabs[3].Visible = false;
  1091. QueryPlanZg(materialNo, StoveNo);
  1092. QueryPlanRcl(materialNo, StoveNo);
  1093. //if (!comPlanEndRcl1.ordLnDlyPk.Equals(""))
  1094. //{
  1095. // QueryCic(comPlanEndRcl1.ordLnDlyPk, comPlanEndRcl1.indexSeq, comPlanEndRcl1.carftSeq);
  1096. // string gradeName = row.Cells["Gradename"].Text.ToString();
  1097. // entityGrid2.UpdateData();
  1098. // DataRow[] datarows = dtCic.Select("GRADENAME = '" + gradeName + "'");
  1099. // DataTable tab = StoveHelper.ToDataTable(datarows);
  1100. // GridHelper.CopyDataToDatatable(tab, dataTable2, true);
  1101. // GridHelper.RefreshAndAutoSize(entityGrid2);
  1102. // foreach (UltraGridRow ugr in entityGrid2.Rows)
  1103. // {
  1104. // ugr.Cells["CHC"].Value = "指定";
  1105. // }
  1106. // entityGrid2.Refresh();
  1107. // entityGrid2.Update();
  1108. // comPlanEndRcl1.ordLnDlyPk = "";
  1109. //}
  1110. //else
  1111. //{
  1112. // DataTable tab = new DataTable();
  1113. // GridHelper.CopyDataToDatatable(tab, dataTable2, true);
  1114. //}
  1115. }
  1116. else if (processCode.Equals("G"))
  1117. {
  1118. ultraTabControl1.Tabs[0].Visible = false;
  1119. ultraTabControl1.Tabs[1].Visible = false;
  1120. ultraTabControl1.Tabs[2].Visible = false;
  1121. ultraTabControl1.Tabs[3].Visible = true;
  1122. QueryPlanJgx(materialNo, StoveNo);
  1123. //if (!comPlanEndJgx1.ordLnDlyPk.Equals(""))
  1124. //{
  1125. // QueryCic(comPlanEndJgx1.ordLnDlyPk, comPlanEndJgx1.indexSeq, comPlanEndJgx1.carftSeq);
  1126. // string gradeName = row.Cells["Gradename"].Text.ToString();
  1127. // entityGrid2.UpdateData();
  1128. // DataRow[] datarows = dtCic.Select("GRADENAME = '" + gradeName + "'");
  1129. // DataTable tab = StoveHelper.ToDataTable(datarows);
  1130. // GridHelper.CopyDataToDatatable(tab, dataTable2, true);
  1131. // GridHelper.RefreshAndAutoSize(entityGrid2);
  1132. // foreach (UltraGridRow ugr in entityGrid2.Rows)
  1133. // {
  1134. // ugr.Cells["CHC"].Value = "指定";
  1135. // }
  1136. // entityGrid2.Refresh();
  1137. // entityGrid2.Update();
  1138. // comPlanEndJgx1.ordLnDlyPk = "";
  1139. //}
  1140. //else
  1141. //{
  1142. // DataTable tab = new DataTable();
  1143. // GridHelper.CopyDataToDatatable(tab, dataTable2, true);
  1144. //}
  1145. }
  1146. }
  1147. private void entityGrid2_ClickCellButton(object sender, CellEventArgs e)
  1148. {
  1149. UltraGridRow row = ultraGridChoose.ActiveRow;
  1150. if (row == null) return;
  1151. if (e.Cell.Column.Key.Equals("CHC"))
  1152. {
  1153. UltraGridRow rowCic = entityGrid2.ActiveRow;
  1154. if (rowCic == null) return;
  1155. row.Cells["SpecCic"].Value = rowCic.Cells["CIC"].Value.ToString();
  1156. }
  1157. }
  1158. private void ultraGridChoose_ClickCellButton(object sender, CellEventArgs e)
  1159. {
  1160. UltraGridRow row = ultraGridChoose.ActiveRow;
  1161. if (row == null) return;
  1162. if (e.Cell.Column.Key.Equals("SpecCic"))
  1163. {
  1164. e.Cell.Row.Cells["SpecCic"].Value = "";
  1165. }
  1166. }
  1167. #region 轧管订单
  1168. /// <summary>
  1169. /// 查询轧管订单信息
  1170. /// </summary>
  1171. public void QueryPlanZg(string materialNo, string gradecode)
  1172. {
  1173. List<PlnOrderZgSOEntityGp> listSource = EntityHelper.GetData<PlnOrderZgSOEntityGp>("com.steering.pss.plnsaleord.planStove.FrmEndLibrary.getPlnOrderZgS",
  1174. new object[] { materialNo, gradecode, "D" }, ob);
  1175. plnOrderZgSOEntityBindingSource.DataSource = listSource;
  1176. //GridHelper.RefreshAndAutoSize(ultraGridZgS);
  1177. foreach (UltraGridRow ugr in ultraGridZgS.Rows)
  1178. {
  1179. #region 赋值LJ,装炉,出库
  1180. int numLj = 0;
  1181. double wtLj = 0;
  1182. if (!ugr.Cells["LjNum"].Text.Equals(""))
  1183. {
  1184. numLj = int.Parse(ugr.Cells["LjNum"].Value.ToString());
  1185. wtLj = double.Parse(ugr.Cells["LjWeight"].Value.ToString());
  1186. }
  1187. int gpNum = 0;
  1188. double gpWt = 0;
  1189. if (!ugr.Cells["GpreqNum"].Text.Equals(""))
  1190. {
  1191. gpNum = int.Parse(ugr.Cells["GpreqNum"].Value.ToString());
  1192. gpWt = double.Parse(ugr.Cells["GpreqWeight"].Value.ToString());
  1193. }
  1194. if (gpNum - numLj <= 0)
  1195. {
  1196. ugr.Cells["ReallNum"].Value = "0";
  1197. ugr.Cells["ReallWt"].Value = "0";
  1198. }
  1199. else
  1200. {
  1201. ugr.Cells["ReallNum"].Value = (gpNum - numLj).ToString();
  1202. ugr.Cells["ReallWt"].Value = (gpWt - wtLj).ToString("f3");
  1203. }
  1204. #endregion
  1205. }
  1206. plnOrderZgSOEntityBindingSource.DataSource = listSource.Where(w => w.ReallWt > 0).ToList();
  1207. //if (listSource.Count == 0)
  1208. //{
  1209. // ordLnDlyPk = "";
  1210. //}
  1211. }
  1212. /// <summary>
  1213. /// 利库
  1214. /// </summary>
  1215. /// <param name="materialNo"></param>
  1216. /// <param name="ob"></param>
  1217. public void doAddLibraryZg(ArrayList list, int countCic, string specCic, string falg)
  1218. {
  1219. UltraGridRow row = ultraGridZgS.ActiveRow;
  1220. if (row == null) return;
  1221. int count = 0;
  1222. string proPlanId = "";
  1223. string gxPlanNo = "";
  1224. foreach (UltraGridRow ugr in ultraGridZgS.Rows)
  1225. {
  1226. if (Convert.ToBoolean(ugr.Cells["CHC"].Text) == true)
  1227. {
  1228. count++;
  1229. proPlanId = ugr.Cells["ProPlanId"].Value.ToString();
  1230. gxPlanNo = ugr.Cells["GxPlanNo"].Value.ToString();
  1231. }
  1232. }
  1233. if (count == 0 || count > 1)
  1234. {
  1235. MessageUtil.ShowTips("请选择一个轧管订单!");
  1236. return;
  1237. }
  1238. if (specCic.Equals("") && countCic == 0)
  1239. {
  1240. MessageUtil.ShowTips("库存CIC在订单炼钢CIC集合里没有,请指定CIC!");
  1241. return;
  1242. }
  1243. string lenFalg = "0";//不分组
  1244. if (chcLen.Checked)
  1245. {
  1246. lenFalg = "1";//分组
  1247. }
  1248. if (MessageUtil.ShowYesNoAndQuestion("是否确认利库?") ==
  1249. DialogResult.No)
  1250. return;
  1251. PlanComm.WaitFromOpen(this.Cursor);
  1252. CoreClientParam ccp = new CoreClientParam();
  1253. ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmEndLibrary";
  1254. ccp.MethodName = "doAddLibrary";
  1255. ccp.ServerParams = new object[] { list, proPlanId, gxPlanNo, this.UserInfo.GetUserName(), "", falg, lenFalg };
  1256. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1257. PlanComm.WaitFromColse(this.Cursor);
  1258. if (ccp.ReturnCode == -1) return;
  1259. MessageUtil.ShowTips(ccp.ReturnInfo);
  1260. if (ccp.ReturnInfo.Equals("利库成功!"))
  1261. {
  1262. QueryAll();
  1263. }
  1264. }
  1265. /// <summary>
  1266. /// 物料改判
  1267. /// </summary>
  1268. /// <param name="materialNo"></param>
  1269. /// <param name="ob"></param>
  1270. public void doSentenceZg(ArrayList list)
  1271. {
  1272. UltraGridRow row = ultraGridZgS.ActiveRow;
  1273. if (row == null) return;
  1274. int count = 0;
  1275. string proPlanId = "";
  1276. string gxPlanNo = "";
  1277. foreach (UltraGridRow ugr in ultraGridZgS.Rows)
  1278. {
  1279. if (Convert.ToBoolean(ugr.Cells["CHC"].Text) == true)
  1280. {
  1281. count++;
  1282. proPlanId = ugr.Cells["ProPlanId"].Value.ToString();
  1283. gxPlanNo = ugr.Cells["GxPlanNo"].Value.ToString();
  1284. }
  1285. }
  1286. if (count == 0 || count > 1)
  1287. {
  1288. MessageUtil.ShowTips("请选择一个轧管订单!");
  1289. return;
  1290. }
  1291. string lenFalg = "0";//不分组
  1292. if (chcLen.Checked)
  1293. {
  1294. lenFalg = "1";//分组
  1295. }
  1296. if (MessageUtil.ShowYesNoAndQuestion("是否确认改判?") ==
  1297. DialogResult.No)
  1298. return;
  1299. PlanComm.WaitFromOpen(this.Cursor);
  1300. CoreClientParam ccp = new CoreClientParam();
  1301. ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmEndLibrary";
  1302. ccp.MethodName = "doSentence";
  1303. ccp.ServerParams = new object[] { list, proPlanId, gxPlanNo, this.UserInfo.GetUserName(), lenFalg };
  1304. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1305. PlanComm.WaitFromColse(this.Cursor);
  1306. if (ccp.ReturnCode == -1) return;
  1307. MessageUtil.ShowTips(ccp.ReturnInfo);
  1308. if (ccp.ReturnInfo.Equals("改判成功!"))
  1309. {
  1310. QueryAll();
  1311. }
  1312. }
  1313. private void ultraGridZgS_AfterRowActivate(object sender, EventArgs e)
  1314. {
  1315. UltraGridRow row1 = ultraGridChoose.ActiveRow;
  1316. if (row1== null) return;
  1317. string gradeName = row1.Cells["Gradename"].Text.ToString();
  1318. UltraGridRow row = ultraGridZgS.ActiveRow;
  1319. if (row == null) return;
  1320. string ordLnDlyPk = row.Cells["OrdLnDlyPk"].Value.ToString();
  1321. string indexSeq = row.Cells["IndexSeq"].Value.ToString();
  1322. string carftSeq = row.Cells["CraftSeq"].Value.ToString();
  1323. QueryCic(ordLnDlyPk, indexSeq, carftSeq,gradeName);
  1324. }
  1325. #endregion
  1326. #region 镦拔扩订单
  1327. /// <summary>
  1328. /// 查询订单信息
  1329. /// </summary>
  1330. public void QueryPlanDbk(string materialNo, string gradecode)
  1331. {
  1332. List<PlnOrderDbkSOEntity> listSource = EntityHelper.GetData<PlnOrderDbkSOEntity>("com.steering.pss.plnsaleord.planStove.FrmEndLibrary.getPlnOrderZgS",
  1333. new object[] { materialNo, gradecode, "E" }, ob);
  1334. plnOrderDbkSOEntityBindingSource.DataSource = listSource;
  1335. GridHelper.RefreshAndAutoSize(ultraGridDbks);
  1336. //plnOrderDbkSOEntityBindingSource.DataSource = listSource.Where(w => w.ReallWt > 0).ToList();
  1337. //if (listSource.Count == 0)
  1338. //{
  1339. // ordLnDlyPk = "";
  1340. //}
  1341. }
  1342. /// <summary>
  1343. /// 利库
  1344. /// </summary>
  1345. /// <param name="materialNo"></param>
  1346. /// <param name="ob"></param>
  1347. public void doAddLibraryDbk(ArrayList list, int countCic, string specCic)
  1348. {
  1349. UltraGridRow row = ultraGridDbks.ActiveRow;
  1350. if (row == null) return;
  1351. int count = 0;
  1352. string proPlanId = "";
  1353. string gxPlanNo = "";
  1354. foreach (UltraGridRow ugr in ultraGridDbks.Rows)
  1355. {
  1356. if (Convert.ToBoolean(ugr.Cells["CHC"].Text) == true)
  1357. {
  1358. count++;
  1359. proPlanId = ugr.Cells["ProPlanId"].Value.ToString();
  1360. gxPlanNo = ugr.Cells["GxPlanNo"].Value.ToString();
  1361. }
  1362. }
  1363. if (count == 0 || count > 1)
  1364. {
  1365. MessageUtil.ShowTips("请选择一个镦拔扩订单!");
  1366. return;
  1367. }
  1368. if (specCic.Equals("") && countCic == 0)
  1369. {
  1370. MessageUtil.ShowTips("库存CIC在订单炼钢CIC集合里没有,请指定CIC!");
  1371. return;
  1372. }
  1373. string lenFalg = "0";//不分组
  1374. if (chcLen.Checked)
  1375. {
  1376. lenFalg = "1";//分组
  1377. }
  1378. if (MessageUtil.ShowYesNoAndQuestion("是否确认利库?") ==
  1379. DialogResult.No)
  1380. return;
  1381. string planstatus = "";
  1382. //var a = MessageUtil.ShowYesNoCancelAndQuestion("是否需要重新镦拔扩?");
  1383. //if (a == DialogResult.Yes) { planstatus = "10"; } else if (a == DialogResult.No) { planstatus = "40"; } else { return; }
  1384. PlanComm.WaitFromOpen(this.Cursor);
  1385. CoreClientParam ccp = new CoreClientParam();
  1386. ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmEndLibrary";
  1387. ccp.MethodName = "doAddLibrary";
  1388. ccp.ServerParams = new object[] { list, proPlanId, gxPlanNo, this.UserInfo.GetUserName(), planstatus, "", lenFalg };
  1389. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1390. PlanComm.WaitFromColse(this.Cursor);
  1391. if (ccp.ReturnCode == -1) return;
  1392. MessageUtil.ShowTips(ccp.ReturnInfo);
  1393. if (ccp.ReturnInfo.Equals("利库成功!"))
  1394. {
  1395. QueryAll();
  1396. }
  1397. }
  1398. /// <summary>
  1399. /// 物料改判
  1400. /// </summary>
  1401. /// <param name="materialNo"></param>
  1402. /// <param name="ob"></param>
  1403. public void doSentenceDbk(ArrayList list)
  1404. {
  1405. UltraGridRow row = ultraGridDbks.ActiveRow;
  1406. if (row == null) return;
  1407. int count = 0;
  1408. string proPlanId = "";
  1409. string gxPlanNo = "";
  1410. foreach (UltraGridRow ugr in ultraGridDbks.Rows)
  1411. {
  1412. if (Convert.ToBoolean(ugr.Cells["CHC"].Text) == true)
  1413. {
  1414. count++;
  1415. proPlanId = ugr.Cells["ProPlanId"].Value.ToString();
  1416. gxPlanNo = ugr.Cells["GxPlanNo"].Value.ToString();
  1417. }
  1418. }
  1419. if (count == 0 || count > 1)
  1420. {
  1421. MessageUtil.ShowTips("请选择一个轧管订单!");
  1422. return;
  1423. }
  1424. string lenFalg = "0";//不分组
  1425. if (chcLen.Checked)
  1426. {
  1427. lenFalg = "1";//分组
  1428. }
  1429. if (MessageUtil.ShowYesNoAndQuestion("是否确认改判?") ==
  1430. DialogResult.No)
  1431. return;
  1432. PlanComm.WaitFromOpen(this.Cursor);
  1433. CoreClientParam ccp = new CoreClientParam();
  1434. ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmEndLibrary";
  1435. ccp.MethodName = "doSentence";
  1436. ccp.ServerParams = new object[] { list, proPlanId, gxPlanNo, this.UserInfo.GetUserName(), lenFalg };
  1437. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1438. PlanComm.WaitFromColse(this.Cursor);
  1439. if (ccp.ReturnCode == -1) return;
  1440. MessageUtil.ShowTips(ccp.ReturnInfo);
  1441. if (ccp.ReturnInfo.Equals("改判成功!"))
  1442. {
  1443. QueryAll();
  1444. }
  1445. }
  1446. private void ultraGridDbks_AfterRowActivate(object sender, EventArgs e)
  1447. {
  1448. UltraGridRow row1 = ultraGridChoose.ActiveRow;
  1449. if (row1 == null) return;
  1450. string gradeName = row1.Cells["Gradename"].Text.ToString();
  1451. UltraGridRow row = ultraGridDbks.ActiveRow;
  1452. if (row == null) return;
  1453. string ordLnDlyPk = row.Cells["OrdLnDlyPk"].Value.ToString();
  1454. string indexSeq = row.Cells["IndexSeq"].Value.ToString();
  1455. string carftSeq = row.Cells["CraftSeq"].Value.ToString();
  1456. QueryCic(ordLnDlyPk, indexSeq, carftSeq, gradeName);
  1457. }
  1458. #endregion
  1459. #region 热处理
  1460. /// <summary>
  1461. /// 查询轧管订单信息
  1462. /// </summary>
  1463. public void QueryPlanRcl(string materialNo, string gradecode)
  1464. {
  1465. List<PlnOrderRclSOEntity> listSource = EntityHelper.GetData<PlnOrderRclSOEntity>("com.steering.pss.plnsaleord.planStove.FrmEndLibrary.getPlnOrderZgS",
  1466. new object[] { materialNo, gradecode, "F" }, ob);
  1467. plnOrderRclSOEntityBindingSource.DataSource = listSource;
  1468. GridHelper.RefreshAndAutoSize(ultraGridRcls);
  1469. //plnOrderRclSOEntityBindingSource.DataSource = listSource.Where(w => w.ReallWt > 0).ToList();
  1470. //if (listSource.Count == 0)
  1471. //{
  1472. // ordLnDlyPk = "";
  1473. //}
  1474. }
  1475. /// <summary>
  1476. /// 利库
  1477. /// </summary>
  1478. /// <param name="materialNo"></param>
  1479. /// <param name="ob"></param>
  1480. public void doAddLibraryRcl(ArrayList list,int countCic, string specCic)
  1481. {
  1482. UltraGridRow row = ultraGridRcls.ActiveRow;
  1483. if (row == null) return;
  1484. int count = 0;
  1485. string proPlanId = "";
  1486. string gxPlanNo = "";
  1487. foreach (UltraGridRow ugr in ultraGridRcls.Rows)
  1488. {
  1489. if (Convert.ToBoolean(ugr.Cells["CHC"].Text) == true)
  1490. {
  1491. count++;
  1492. proPlanId = ugr.Cells["ProPlanId"].Value.ToString();
  1493. gxPlanNo = ugr.Cells["GxPlanNo"].Value.ToString();
  1494. }
  1495. }
  1496. if (count == 0 || count > 1)
  1497. {
  1498. MessageUtil.ShowTips("请选择一个热处理订单!");
  1499. return;
  1500. }
  1501. if (specCic.Equals("") && countCic == 0)
  1502. {
  1503. MessageUtil.ShowTips("库存CIC在订单炼钢CIC集合里没有,请指定CIC!");
  1504. return;
  1505. }
  1506. string lenFalg = "0";//不分组
  1507. if (chcLen.Checked)
  1508. {
  1509. lenFalg = "1";//分组
  1510. }
  1511. //if (MessageUtil.ShowYesNoAndQuestion("是否确认利库?") ==
  1512. // DialogResult.No)
  1513. // return;
  1514. string planstatus = "40";
  1515. //var a = MessageUtil.ShowYesNoCancelAndQuestion("是否需要重新热处理?");
  1516. //if (a == DialogResult.Yes) { planstatus = "10"; } else if (a == DialogResult.No) { planstatus = "40"; } else { return; }
  1517. //
  1518. PlanComm.WaitFromOpen(this.Cursor);
  1519. CoreClientParam ccp = new CoreClientParam();
  1520. ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmEndLibrary";
  1521. ccp.MethodName = "doAddLibrary";
  1522. ccp.ServerParams = new object[] { list, proPlanId, gxPlanNo, this.UserInfo.GetUserName(), planstatus, "", lenFalg };
  1523. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1524. PlanComm.WaitFromColse(this.Cursor);
  1525. if (ccp.ReturnCode == -1) return;
  1526. MessageUtil.ShowTips(ccp.ReturnInfo);
  1527. if (ccp.ReturnInfo.Equals("利库成功!"))
  1528. {
  1529. QueryAll();
  1530. }
  1531. }
  1532. /// <summary>
  1533. /// 物料改判
  1534. /// </summary>
  1535. /// <param name="materialNo"></param>
  1536. /// <param name="ob"></param>
  1537. public void doSentenceRcl(ArrayList list)
  1538. {
  1539. UltraGridRow row = ultraGridRcls.ActiveRow;
  1540. if (row == null) return;
  1541. int count = 0;
  1542. string proPlanId = "";
  1543. string gxPlanNo = "";
  1544. foreach (UltraGridRow ugr in ultraGridRcls.Rows)
  1545. {
  1546. if (Convert.ToBoolean(ugr.Cells["CHC"].Text) == true)
  1547. {
  1548. count++;
  1549. proPlanId = ugr.Cells["ProPlanId"].Value.ToString();
  1550. gxPlanNo = ugr.Cells["GxPlanNo"].Value.ToString();
  1551. }
  1552. }
  1553. if (count == 0 || count > 1)
  1554. {
  1555. MessageUtil.ShowTips("请选择一个轧管订单!");
  1556. return;
  1557. }
  1558. string lenFalg = "0";//不分组
  1559. if (chcLen.Checked)
  1560. {
  1561. lenFalg = "1";//分组
  1562. }
  1563. if (MessageUtil.ShowYesNoAndQuestion("是否确认改判?") ==
  1564. DialogResult.No)
  1565. return;
  1566. PlanComm.WaitFromOpen(this.Cursor);
  1567. CoreClientParam ccp = new CoreClientParam();
  1568. ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmEndLibrary";
  1569. ccp.MethodName = "doSentence";
  1570. ccp.ServerParams = new object[] { list, proPlanId, gxPlanNo, this.UserInfo.GetUserName(), lenFalg };
  1571. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1572. PlanComm.WaitFromColse(this.Cursor);
  1573. if (ccp.ReturnCode == -1) return;
  1574. MessageUtil.ShowTips(ccp.ReturnInfo);
  1575. if (ccp.ReturnInfo.Equals("改判成功!"))
  1576. {
  1577. QueryAll();
  1578. }
  1579. }
  1580. private void ultraGridRcls_AfterRowActivate(object sender, EventArgs e)
  1581. {
  1582. UltraGridRow row1 = ultraGridChoose.ActiveRow;
  1583. if (row1 == null) return;
  1584. string gradeName = row1.Cells["Gradename"].Text.ToString();
  1585. UltraGridRow row = ultraGridRcls.ActiveRow;
  1586. if (row == null) return;
  1587. string ordLnDlyPk = row.Cells["OrdLnDlyPk"].Value.ToString();
  1588. string indexSeq = row.Cells["IndexSeq"].Value.ToString();
  1589. string carftSeq = row.Cells["CraftSeq"].Value.ToString();
  1590. QueryCic(ordLnDlyPk, indexSeq, carftSeq, gradeName);
  1591. }
  1592. #endregion
  1593. #region 加工线
  1594. /// <summary>
  1595. /// 查询轧管订单信息
  1596. /// </summary>
  1597. public void QueryPlanJgx(string materialNo, string gradecode)
  1598. {
  1599. List<PlnOrderJgxSOEntity> listSource = EntityHelper.GetData<PlnOrderJgxSOEntity>("com.steering.pss.plnsaleord.planStove.FrmEndLibrary.getPlnOrderZgS",
  1600. new object[] { materialNo, gradecode, "G" }, ob);
  1601. plnOrderJgxSOEntityBindingSource.DataSource = listSource;
  1602. GridHelper.RefreshAndAutoSize(entityGrid1);
  1603. //plnOrderJgxSOEntityBindingSource.DataSource = listSource.Where(w => w.ReallWt > 0).ToList();
  1604. //if (listSource.Count == 0)
  1605. //{
  1606. // ordLnDlyPk = "";
  1607. //}
  1608. }
  1609. /// <summary>
  1610. /// 利库
  1611. /// </summary>
  1612. /// <param name="materialNo"></param>
  1613. /// <param name="ob"></param>
  1614. public void doAddLibraryJgx(ArrayList list, int countCic, string specCic)
  1615. {
  1616. UltraGridRow row = ultraGridJgxs.ActiveRow;
  1617. UltraGridRow row2 = ultraGridChoose.ActiveRow;
  1618. if (row == null) return;
  1619. int count = 0;
  1620. string proPlanId = "";
  1621. string gxPlanNo = "";
  1622. foreach (UltraGridRow ugr in ultraGridJgxs.Rows)
  1623. {
  1624. if (Convert.ToBoolean(ugr.Cells["CHC"].Text) == true)
  1625. {
  1626. count++;
  1627. proPlanId = ugr.Cells["ProPlanId"].Value.ToString();
  1628. gxPlanNo = ugr.Cells["GxPlanNo"].Value.ToString();
  1629. }
  1630. }
  1631. if (count == 0 || count > 1)
  1632. {
  1633. MessageUtil.ShowTips("请选择一个加工订单!");
  1634. return;
  1635. }
  1636. if (specCic.Equals("") && countCic == 0)
  1637. {
  1638. MessageUtil.ShowTips("库存CIC在订单炼钢CIC集合里没有,请指定CIC!");
  1639. return;
  1640. }
  1641. if (!row.Cells["PlineName"].Value.ToString().Equals(row2.Cells["PlineName"].Value.ToString()))
  1642. {
  1643. MessageUtil.ShowTips("生产产线不一样,不能利库!");
  1644. return;
  1645. }
  1646. string lenFalg = "0";//不分组
  1647. if (chcLen.Checked)
  1648. {
  1649. lenFalg = "1";//分组
  1650. }
  1651. string planstatus = "40";
  1652. //var a = MessageUtil.ShowYesNoCancelAndQuestion("是否需要重新加工?");
  1653. //if (a == DialogResult.Yes) { planstatus = "10"; } else if (a == DialogResult.No) { planstatus = "40"; } else { return; }
  1654. PlanComm.WaitFromOpen(this.Cursor);
  1655. CoreClientParam ccp = new CoreClientParam();
  1656. ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmEndLibrary";
  1657. ccp.MethodName = "doAddLibrary";
  1658. ccp.ServerParams = new object[] { list, proPlanId, gxPlanNo, this.UserInfo.GetUserName(), planstatus, "", lenFalg };
  1659. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1660. PlanComm.WaitFromColse(this.Cursor);
  1661. if (ccp.ReturnCode == -1) return;
  1662. MessageUtil.ShowTips(ccp.ReturnInfo);
  1663. if (ccp.ReturnInfo.Equals("利库成功!"))
  1664. {
  1665. QueryAll();
  1666. }
  1667. }
  1668. /// <summary>
  1669. /// 物料改判
  1670. /// </summary>
  1671. /// <param name="materialNo"></param>
  1672. /// <param name="ob"></param>
  1673. public void doSentenceJgx(ArrayList list)
  1674. {
  1675. UltraGridRow row = ultraGridJgxs.ActiveRow;
  1676. if (row == null) return;
  1677. int count = 0;
  1678. string proPlanId = "";
  1679. string gxPlanNo = "";
  1680. foreach (UltraGridRow ugr in ultraGridJgxs.Rows)
  1681. {
  1682. if (Convert.ToBoolean(ugr.Cells["CHC"].Text) == true)
  1683. {
  1684. count++;
  1685. proPlanId = ugr.Cells["ProPlanId"].Value.ToString();
  1686. gxPlanNo = ugr.Cells["GxPlanNo"].Value.ToString();
  1687. }
  1688. }
  1689. if (count == 0 || count > 1)
  1690. {
  1691. MessageUtil.ShowTips("请选择一个轧管订单!");
  1692. return;
  1693. }
  1694. string lenFalg = "0";//不分组
  1695. if (chcLen.Checked)
  1696. {
  1697. lenFalg = "1";//分组
  1698. }
  1699. if (MessageUtil.ShowYesNoAndQuestion("是否确认改判?") ==
  1700. DialogResult.No)
  1701. return;
  1702. PlanComm.WaitFromOpen(this.Cursor);
  1703. CoreClientParam ccp = new CoreClientParam();
  1704. ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmEndLibrary";
  1705. ccp.MethodName = "doSentence";
  1706. ccp.ServerParams = new object[] { list, proPlanId, gxPlanNo, this.UserInfo.GetUserName(), lenFalg };
  1707. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1708. PlanComm.WaitFromColse(this.Cursor);
  1709. if (ccp.ReturnCode == -1) return;
  1710. MessageUtil.ShowTips(ccp.ReturnInfo);
  1711. if (ccp.ReturnInfo.Equals("改判成功!"))
  1712. {
  1713. QueryAll();
  1714. }
  1715. }
  1716. private void ultraGridJgxs_AfterRowActivate(object sender, EventArgs e)
  1717. {
  1718. UltraGridRow row1 = ultraGridChoose.ActiveRow;
  1719. if (row1 == null) return;
  1720. string gradeName = row1.Cells["Gradename"].Text.ToString();
  1721. UltraGridRow row = ultraGridJgxs.ActiveRow;
  1722. if (row == null) return;
  1723. string ordLnDlyPk = row.Cells["OrdLnDlyPk"].Value.ToString();
  1724. string indexSeq = row.Cells["IndexSeq"].Value.ToString();
  1725. string carftSeq = row.Cells["CraftSeq"].Value.ToString();
  1726. QueryCic(ordLnDlyPk, indexSeq, carftSeq, gradeName);
  1727. }
  1728. #endregion
  1729. private void ultraGridChoose_CellChange(object sender, CellEventArgs e)
  1730. {
  1731. UltraGridRow row = ultraGridChoose.ActiveRow;
  1732. if (row == null) return;
  1733. //利库/脱单支
  1734. if (e.Cell.Column.Key.Equals("TakeCount"))
  1735. {
  1736. if (e.Cell.Row.Cells["TakeCount"].Value == null)
  1737. {
  1738. e.Cell.Row.Cells["TakeCount"].Value = "0";
  1739. }
  1740. else
  1741. {
  1742. ultraGridChoose.UpdateData();
  1743. string hbConNum = e.Cell.Row.Cells["TakeCount"].Value.ToString();
  1744. if (!StringUtil.IsInt(hbConNum) || hbConNum == "0")
  1745. {
  1746. e.Cell.Row.Cells["TakeCount"].Value = "0";
  1747. }
  1748. if (int.Parse(e.Cell.Row.Cells["TakeCount"].Value.ToString()) > int.Parse(e.Cell.Row.Cells["ActCount"].Value.ToString()))
  1749. {
  1750. e.Cell.Row.Cells["TakeCount"].Value = e.Cell.Row.Cells["ActCount"].Value.ToString();
  1751. }
  1752. }
  1753. }
  1754. }
  1755. private void cmbMatBc_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  1756. {
  1757. this.ultraGridChoose.UpdateData();
  1758. UltraGridRow row = this.ultraGridChoose.ActiveRow;
  1759. if (row == null)
  1760. {
  1761. return;
  1762. }
  1763. FrmMatNo frm = new FrmMatNo(row, ob);
  1764. frm.ShowDialog();
  1765. if (frm.flag.Equals("1"))
  1766. {
  1767. row.Cells["MatNo"].Value = frm.matNo.TrimEnd(new char[] { ',' }).ToString();
  1768. row.Cells["ActCount"].Value = frm.count.ToString();
  1769. }
  1770. else
  1771. {
  1772. return;
  1773. }
  1774. }
  1775. private void cheGaiPan_CheckedChanged(object sender, EventArgs e)
  1776. {
  1777. if (cheGaiPan.Checked) {
  1778. CoreClientParam ccp = new CoreClientParam();
  1779. ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmEndLibrary";
  1780. ccp.MethodName = "CheckGaiPan";
  1781. ccp.ServerParams = new object[] { this.CustomInfo };
  1782. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1783. if (ccp.ReturnCode == -1) return;
  1784. MessageUtil.ShowTips(ccp.ReturnInfo);
  1785. }
  1786. }
  1787. }
  1788. }