FrmSteelProcessCard.cs 100 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Format;
  3. using Core.Mes.Client.Comm.Server;
  4. using Core.Mes.Client.Comm.Tool;
  5. using Core.StlMes.Client.PlnSaleOrd.BaseMethod;
  6. using Core.StlMes.Client.PlnSaleOrd.炼钢计划.entity;
  7. using CoreFS.CA06;
  8. using Infragistics.Win;
  9. using Infragistics.Win.UltraWinEditors;
  10. using Infragistics.Win.UltraWinGrid;
  11. using System;
  12. using System.Collections;
  13. using System.Collections.Generic;
  14. using System.ComponentModel;
  15. using System.Data;
  16. using System.Drawing;
  17. using System.Linq;
  18. using System.Text;
  19. using System.Windows.Forms;
  20. using ColumnStyle = Infragistics.Win.UltraWinGrid.ColumnStyle;
  21. namespace Core.StlMes.Client.PlnSaleOrd.炼钢计划
  22. {
  23. public partial class FrmSteelProcessCard : FrmBase
  24. {
  25. private string carftNo;
  26. private OpeBase ob;
  27. private string cic;
  28. private string furnaceNo;
  29. private string plineCodeA;
  30. private string plineNameA;
  31. private string gradCode;
  32. private string gradName;
  33. private string planRoute;//作业路线
  34. private string plineCodeB;
  35. private int count = 0;
  36. public bool Falg = false;
  37. UltraComboEditor uceCic = new UltraComboEditor();
  38. UltraComboEditor uceCicAll = new UltraComboEditor();
  39. UltraComboEditor ucePro = new UltraComboEditor();//品名
  40. UltraComboEditor uceItem = new UltraComboEditor();//合金物料码
  41. UltraCombo uceCcm = new UltraCombo();
  42. UltraComboEditor uceWd = new UltraComboEditor();
  43. private string flag;
  44. private string gxPlanSeq;
  45. public FrmSteelProcessCard(string _carftNo, OpeBase _ob, ArrayList _list,string _flag)
  46. {
  47. carftNo = _carftNo;
  48. ob = _ob;
  49. flag = _flag;
  50. if (_list != null)
  51. {
  52. string[] arrString = (string[])_list.ToArray(typeof(string));
  53. cic = arrString[0].ToString();
  54. furnaceNo = arrString[1].ToString();
  55. plineCodeA = arrString[2].ToString();
  56. plineNameA = arrString[3].ToString();
  57. gradCode = arrString[4].ToString();
  58. gradName = arrString[5].ToString();
  59. planRoute = arrString[6].ToString();
  60. plineCodeB = arrString[7].ToString();
  61. gxPlanSeq = arrString[8].ToString();
  62. }
  63. InitializeComponent();
  64. }
  65. private void FrmSteelProcessCard_Load(object sender, EventArgs e)
  66. {
  67. Controls.Add(uceCcm);
  68. uceCcm.Visible = false;
  69. Controls.Add(uceItem);
  70. uceItem.Visible = false;
  71. Controls.Add(uceWd);
  72. uceWd.Visible = false;
  73. //设置列头名称
  74. EntityHelper.ShowGridCaption<CraftLg2MEntity>(ultraGridLgM.DisplayLayout.Bands[0]);
  75. EntityHelper.ShowGridCaption<CraftLg2CicEntity>(ultraGridLgCic.DisplayLayout.Bands[0]);
  76. EntityHelper.ShowGridCaption<CraftLg2TarCicEntity>(ultraGridLgTarCic.DisplayLayout.Bands[0]);
  77. EntityHelper.ShowGridCaption<CraftLg2CcmEntity>(ultraGridLgCcm.DisplayLayout.Bands[0]);
  78. EntityHelper.ShowGridCaption<CraftLg2TemperatureEntity>(ultraGridLhTem.DisplayLayout.Bands[0]);
  79. EntityHelper.ShowGridCaption<CraftLg2AlloyEntity>(ultraGridhJ.DisplayLayout.Bands[0]);
  80. //PlanComm.setGridActivation(ultraGridLgM.DisplayLayout.Bands[0], "CHC");
  81. //PlanComm.setGridActivation(ultraGridLgCic.DisplayLayout.Bands[0], "CHC");
  82. //PlanComm.setGridActivation(ultraGridLgTarCic.DisplayLayout.Bands[0], "CHC");
  83. //PlanComm.setGridActivation(ultraGridLgCcm.DisplayLayout.Bands[0], "CHC");
  84. //PlanComm.setGridActivation(ultraGridLhTem.DisplayLayout.Bands[0], "CHC");
  85. SteelHelper.InitPline(comAPline, "A", this.ob);
  86. SteelHelper.InitGrade(comGrade, this.ob);
  87. chenCode();
  88. SteelHelper.InitComboEditor(ucePro, "com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryProduName", "PRODUCCODE", ob, true);
  89. SteelHelper.BindColumn(ucePro, "Produccode", this.Controls, this.ultraGridLgM, 0);
  90. queryCraftType();
  91. queryComBaseCcm(cic);
  92. QueryM();
  93. QueryComMscChemCode();
  94. }
  95. /// <summary>
  96. /// 查询基础CIC
  97. /// </summary>
  98. private void QueryComMscChemCode()
  99. {
  100. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryComMscChemCode", new object[] { cic.Split(',') }, ob);
  101. GridHelper.CopyDataToDatatable(dt, dataTable1, true);
  102. }
  103. /// <summary>
  104. /// 绑定元素下拉
  105. /// </summary>
  106. private void chenCode()
  107. {
  108. DataTable dt1 = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryChenName", new object[] { "", "" }, ob);
  109. Controls.Add(uceCic);
  110. uceCic.Visible = false;
  111. uceCic.DropDownListWidth = -1;
  112. uceCic.DropDownStyle = DropDownStyle.DropDownList;
  113. uceCic.DataSource = dt1.AsEnumerable().Where(p => (p["CHEM_TYPE"] is DBNull ? "" : p["CHEM_TYPE"].ToString()) == "A").CopyToDataTable();
  114. uceCic.DisplayMember = "CHEM_NAME";
  115. uceCic.ValueMember = "CHEM_CODE";
  116. Controls.Add(uceCicAll);
  117. uceCicAll.Visible = false;
  118. uceCicAll.DropDownListWidth = -1;
  119. uceCicAll.DropDownStyle = DropDownStyle.DropDownList;
  120. uceCicAll.DataSource = dt1;
  121. uceCicAll.DisplayMember = "CHEM_NAME";
  122. uceCicAll.ValueMember = "CHEM_CODE";
  123. ultraGridLgTarCic.DisplayLayout.Bands[0].Columns["ChemCode"].EditorComponent = uceCic;
  124. ultraGridLgTarCic.DisplayLayout.Bands[0].Columns["ChemCode"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  125. ultraGridLgCic.DisplayLayout.Bands[0].Columns["ChemCode"].EditorComponent = uceCicAll;
  126. ultraGridLgCic.DisplayLayout.Bands[0].Columns["ChemCode"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  127. ultraGridLgCic.DisplayLayout.Bands[0].Columns["EleCode"].EditorComponent = uceCicAll;
  128. ultraGridLgCic.DisplayLayout.Bands[0].Columns["EleCode"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  129. ultraGridLgCic.DisplayLayout.Bands[0].Columns["RepCode"].EditorComponent = uceCicAll;
  130. ultraGridLgCic.DisplayLayout.Bands[0].Columns["RepCode"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  131. SteelHelper.SetComboItemHeight(uceCic);
  132. DataTable dt2 = ServerHelper.GetData("com.steering.pss.plnsaleord.processOrder.base.BaseHelper.initPlinePowerA", new object[] { }, ob);
  133. UltraComboEditor uce2 = new UltraComboEditor();
  134. Controls.Add(uce2);
  135. uce2.Visible = false;
  136. uce2.DropDownListWidth = -1;
  137. uce2.DropDownStyle = DropDownStyle.DropDownList;
  138. uce2.DataSource = dt2;
  139. uce2.DisplayMember = "PLINE_NAME";
  140. uce2.ValueMember = "PLINE_CODE";
  141. ultraGridLgM.DisplayLayout.Bands[0].Columns["PlineCode"].EditorComponent = uce2;
  142. ultraGridLgM.DisplayLayout.Bands[0].Columns["PlineCode"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  143. //下限符号
  144. UltraComboEditor uceMinFh = new UltraComboEditor();
  145. ultraGridLgTarCic.DisplayLayout.Bands[0].Columns["StdminSign"].EditorComponent = uceMinFh;
  146. ultraGridLgTarCic.DisplayLayout.Bands[0].Columns["StdminSign"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  147. ultraGridLgCic.DisplayLayout.Bands[0].Columns["StdminSign"].EditorComponent = uceMinFh;
  148. ultraGridLgCic.DisplayLayout.Bands[0].Columns["StdminSign"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  149. ultraGridLgCic.DisplayLayout.Bands[0].Columns["EleMinSign"].EditorComponent = uceMinFh;
  150. ultraGridLgCic.DisplayLayout.Bands[0].Columns["EleMinSign"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  151. ultraGridLgCic.DisplayLayout.Bands[0].Columns["RepMinSign"].EditorComponent = uceMinFh;
  152. ultraGridLgCic.DisplayLayout.Bands[0].Columns["RepMinSign"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  153. ultraGridLgTarCic.DisplayLayout.Bands[0].Columns["StdminSign"].ValueList = GetMinSignList();
  154. ultraGridLgCic.DisplayLayout.Bands[0].Columns["StdminSign"].ValueList = GetMinSignList();
  155. ultraGridLgCic.DisplayLayout.Bands[0].Columns["EleMinSign"].ValueList = GetMinSignList();
  156. ultraGridLgCic.DisplayLayout.Bands[0].Columns["RepMinSign"].ValueList = GetMinSignList();
  157. SteelHelper.SetComboItemHeight(uceMinFh);
  158. //上限符号
  159. UltraComboEditor uceMaxFh = new UltraComboEditor();
  160. ultraGridLgTarCic.DisplayLayout.Bands[0].Columns["StdmaxSign"].EditorComponent = uceMaxFh;
  161. ultraGridLgTarCic.DisplayLayout.Bands[0].Columns["StdmaxSign"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  162. ultraGridLgCic.DisplayLayout.Bands[0].Columns["StdmaxSign"].EditorComponent = uceMaxFh;
  163. ultraGridLgCic.DisplayLayout.Bands[0].Columns["StdmaxSign"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  164. ultraGridLgCic.DisplayLayout.Bands[0].Columns["EleMaxSign"].EditorComponent = uceMaxFh;
  165. ultraGridLgCic.DisplayLayout.Bands[0].Columns["EleMaxSign"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  166. ultraGridLgCic.DisplayLayout.Bands[0].Columns["RepMaxSign"].EditorComponent = uceMaxFh;
  167. ultraGridLgCic.DisplayLayout.Bands[0].Columns["RepMaxSign"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  168. ultraGridLgTarCic.DisplayLayout.Bands[0].Columns["StdmaxSign"].ValueList = GetMaxSignList();
  169. ultraGridLgCic.DisplayLayout.Bands[0].Columns["StdmaxSign"].ValueList = GetMaxSignList();
  170. ultraGridLgCic.DisplayLayout.Bands[0].Columns["EleMaxSign"].ValueList = GetMaxSignList();
  171. ultraGridLgCic.DisplayLayout.Bands[0].Columns["RepMaxSign"].ValueList = GetMaxSignList();
  172. SteelHelper.SetComboItemHeight(uceMaxFh);
  173. //CCM工序点
  174. UltraComboEditor uceStatGx = new UltraComboEditor();
  175. ultraGridLgTarCic.DisplayLayout.Bands[0].Columns["StationCode"].EditorComponent = uceStatGx;
  176. ultraGridLgTarCic.DisplayLayout.Bands[0].Columns["StationCode"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  177. ValueList vlistSteelGx = new ValueList();
  178. vlistSteelGx.ValueListItems.Insert(0, "", "");
  179. vlistSteelGx.ValueListItems.Insert(1, "EAF", "EAF");
  180. vlistSteelGx.ValueListItems.Insert(2, "LF", "LF");
  181. vlistSteelGx.ValueListItems.Insert(3, "VD", "VD");
  182. vlistSteelGx.ValueListItems.Insert(4, "RH", "RH");
  183. vlistSteelGx.ValueListItems.Insert(5, "CCM", "CCM");
  184. ultraGridLgTarCic.DisplayLayout.Bands[0].Columns["StationCode"].ValueList = vlistSteelGx;
  185. SteelHelper.SetComboItemHeight(uceStatGx);
  186. //温度工序点
  187. UltraComboEditor uceStatGxWd = new UltraComboEditor();
  188. ultraGridLhTem.DisplayLayout.Bands[0].Columns["StationCode"].EditorComponent = uceStatGxWd;
  189. ultraGridLhTem.DisplayLayout.Bands[0].Columns["StationCode"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  190. ValueList vlistSteelGxWd = new ValueList(); ;
  191. vlistSteelGxWd.ValueListItems.Insert(0, "", "");
  192. vlistSteelGxWd.ValueListItems.Insert(1, "EAF", "EAF");
  193. vlistSteelGxWd.ValueListItems.Insert(2, "LF", "LF");
  194. vlistSteelGxWd.ValueListItems.Insert(3, "VD", "VD");
  195. vlistSteelGxWd.ValueListItems.Insert(4, "RH", "RH");
  196. vlistSteelGxWd.ValueListItems.Insert(5, "CCM", "CCM");
  197. ultraGridLhTem.DisplayLayout.Bands[0].Columns["StationCode"].ValueList = vlistSteelGxWd;
  198. SteelHelper.SetComboItemHeight(uceStatGxWd);
  199. }
  200. private static ValueList GetMaxSignList()
  201. {
  202. ValueList vlistSteelMax = new ValueList();
  203. ;
  204. vlistSteelMax.ValueListItems.Insert(0, "=", "=");
  205. vlistSteelMax.ValueListItems.Insert(1, "<", "<");
  206. vlistSteelMax.ValueListItems.Insert(2, "<=", "<=");
  207. vlistSteelMax.ValueListItems.Insert(3, "", "");
  208. return vlistSteelMax;
  209. }
  210. private ValueList GetMinSignList()
  211. {
  212. ValueList vlistSteelMin = new ValueList();
  213. ;
  214. vlistSteelMin.ValueListItems.Insert(0, "=", "=");
  215. vlistSteelMin.ValueListItems.Insert(1, ">", ">");
  216. vlistSteelMin.ValueListItems.Insert(2, ">=", ">=");
  217. vlistSteelMin.ValueListItems.Insert(3, "", "");
  218. return vlistSteelMin;
  219. }
  220. /// <summary>
  221. /// 绑定工艺卡类型下拉
  222. /// </summary>
  223. private void queryCraftType()
  224. {
  225. UltraComboEditor uceType = new UltraComboEditor();
  226. ultraGridLgM.DisplayLayout.Bands[0].Columns["CraftType"].EditorComponent = uceType;
  227. ultraGridLgM.DisplayLayout.Bands[0].Columns["CraftType"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  228. ValueList vlistSteel = new ValueList(); ;
  229. vlistSteel.ValueListItems.Insert(0, "A", "标准卡");
  230. vlistSteel.ValueListItems.Insert(1, "B", "联络卡");
  231. ultraGridLgM.DisplayLayout.Bands[0].Columns["CraftType"].ValueList = vlistSteel;
  232. SteelHelper.SetComboItemHeight(uceType);
  233. }
  234. /// <summary>
  235. /// 获取水表
  236. /// </summary>
  237. private void queryComBaseCcm(string wasetcic)
  238. {
  239. DataTable dtCcm = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryComBaseCcm", new object[] { plineCodeB, gradCode, wasetcic }, ob);
  240. //uceCcm.DropDownListWidth = -1;
  241. //uceCcm.DropDownStyle = DropDownStyle.DropDownList;
  242. uceCcm.DataSource = dtCcm;
  243. uceCcm.ValueMember = "CCM_CODE";
  244. //uceCcm.DisplayMember = "CCM_CODE";
  245. ultraGridLgCcm.DisplayLayout.Bands[0].Columns["CcmCode"].EditorComponent = uceCcm;
  246. //ultraGridLgCcm.DisplayLayout.Bands[0].Columns["CcmCode"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  247. uceWd.DataSource = dtCcm;
  248. uceWd.ValueMember = "液相线温度";
  249. uceWd.DisplayMember = "液相线温度";
  250. ultraGridLhTem.DisplayLayout.Bands[0].Columns["TepVal"].EditorComponent = uceWd;
  251. SteelHelper.SetComboItemHeight(uceWd);
  252. DataTable dthj = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryItemCode", new object[] { "" }, ob);
  253. Object[] obj = new Object[] { "", "" };
  254. DataRow dr = dthj.NewRow();
  255. dr.ItemArray = obj;
  256. dthj.Rows.InsertAt(dr, 0);
  257. uceItem.DataSource = dthj;
  258. uceItem.ValueMember = "ITEM_CODE";
  259. uceItem.DisplayMember = "ITEM_NAME";
  260. SteelHelper.SetComboItemHeight(uceItem);
  261. ultraGridhJ.DisplayLayout.Bands[0].Columns["ItemCode"].EditorComponent = uceItem;
  262. }
  263. private void craftNo()
  264. {
  265. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryCraftNo", new object[] { }, ob);
  266. comCraftNo.DataSource = dt;
  267. comCraftNo.ValueMember = "CRAFT_NO";
  268. comCraftNo.DisplayMember = "CRAFT_NO";
  269. }
  270. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  271. {
  272. switch (e.Tool.Key)
  273. {
  274. case "Query": //查询
  275. QueryLgM();
  276. break;
  277. case "Add": //保存
  278. doSaveUpdate("0");
  279. break;
  280. case "Update": //修改
  281. doSaveUpdate("1");
  282. break;
  283. case "Delete": //删除
  284. doDelete();
  285. break;
  286. case "Confirm": //确认
  287. doConfirm();
  288. break;
  289. case "Calculate": //计算
  290. doCalculate(0);
  291. break;
  292. case "Close":
  293. this.Close();
  294. break;
  295. }
  296. }
  297. private DataSourceList<CraftLg2CicEntity> listCic;
  298. private DataSourceList<CraftLg2TarCicEntity> listTarCic;
  299. private DataSourceList<CraftLg2CcmEntity> listCcm;
  300. private DataSourceList<CraftLg2TemperatureEntity> listTem;
  301. private DataSourceList<CraftLg2AlloyEntity> listHj;
  302. #region 查询
  303. /// <summary>
  304. /// 查询工艺主表
  305. /// </summary>
  306. private void QueryLgM()
  307. {
  308. count = 0;
  309. string carftNo1 = "";
  310. string plineCode = "";
  311. string gradCode = "";
  312. if (chcCraftNo.Checked)
  313. {
  314. if (comCraftNo.Text.Equals(""))
  315. {
  316. MessageUtil.ShowTips("请选择工艺卡号!");
  317. return;
  318. }
  319. else
  320. {
  321. carftNo1 = comCraftNo.Text.ToString();
  322. }
  323. }
  324. if (chcAPline.Checked)
  325. {
  326. if (comAPline.Text.Equals(""))
  327. {
  328. MessageUtil.ShowTips("请选择电炉产线!");
  329. return;
  330. }
  331. else
  332. {
  333. plineCode = comAPline.Value.ToString();
  334. }
  335. }
  336. if (chcGrade.Checked)
  337. {
  338. if (comGrade.Text.Equals(""))
  339. {
  340. MessageUtil.ShowTips("请选择钢种!");
  341. return;
  342. }
  343. else
  344. {
  345. gradCode = comGrade.Value.ToString();
  346. }
  347. }
  348. List<CraftLg2MEntity> listSource = EntityHelper.GetData<CraftLg2MEntity>
  349. ("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryLgM", new object[] { "", carftNo1, plineCode, gradCode, planRoute, flag == "0" || flag == "2" }, ob);
  350. CraftLg2MEntityBindingSource.DataSource = listSource;
  351. UltraGridRow ugr = ultraGridLgM.ActiveRow;
  352. if (ugr == null)
  353. {
  354. CraftLg2TarCicEntityBindingSource.Clear();
  355. CraftLg2CcmEntityBindingSource.Clear();
  356. CraftLg2TemperatureEntitySource.Clear();
  357. if (cic.Split(',').Length > 1)
  358. {
  359. }
  360. else
  361. {
  362. queryOrdDesigStdCic();
  363. }
  364. }
  365. }
  366. private void QueryM()
  367. {
  368. List<CraftLg2MEntity> listSource = EntityHelper.GetData<CraftLg2MEntity>
  369. ("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryLgM", new object[] { cic.Split(','), carftNo, plineCodeA, gradCode, planRoute, flag == "0" || flag == "2" }, ob);
  370. CraftLg2MEntityBindingSource.DataSource = listSource;
  371. UltraGridRow ugr = ultraGridLgM.ActiveRow;
  372. if (ugr == null)
  373. {
  374. ultraTabControl1.Enabled = false;
  375. CraftLg2TarCicEntityBindingSource.Clear();
  376. CraftLg2CcmEntityBindingSource.Clear();
  377. CraftLg2TemperatureEntitySource.Clear();
  378. CraftLg2AlloyEntityBindingSource.Clear();
  379. //if (flag.Equals("1"))
  380. //{
  381. // ultraExpandableGroupBox2.Visible = false;
  382. // if (cic.Split(',').Length > 1)
  383. // {
  384. // queryOrdDesigJJCic();
  385. // }
  386. // else
  387. // {
  388. // queryOrdDesigStdCic();
  389. // }
  390. //}
  391. //else
  392. //{
  393. //ultraExpandableGroupBox2.Visible = true;
  394. queryOrdDesigCic("");
  395. //}
  396. }
  397. foreach (UltraGridRow row in ultraGridLgM.Rows)
  398. {
  399. if (carftNo.Equals(row.Cells["CraftNo"].Text.ToString()))
  400. {
  401. row.Cells["CHC"].Value = true;
  402. }
  403. }
  404. }
  405. /// <summary>
  406. /// 查询工艺评审Cic
  407. /// </summary>
  408. private void queryOrdDesigStdCic()
  409. {
  410. listCic = EntityHelper.GetData<CraftLg2CicEntity>
  411. ("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryOrdDesigStdCic", new object[] { cic, furnaceNo, gxPlanSeq, flag }, ob);
  412. listCic.AcceptChanges();
  413. CraftLg2CicEntityBindingSource.DataSource = listCic;
  414. foreach (UltraGridRow urg in ultraGridLgCic.Rows)
  415. {
  416. urg.Cells["CHC"].Value = true;
  417. }
  418. }
  419. /// <summary>
  420. /// 查询交集CIC
  421. /// </summary>
  422. private void gqueryOrdDesigJJCic()
  423. {
  424. listCic = EntityHelper.GetData<CraftLg2CicEntity>
  425. ("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryOrdDesigJJCic", new object[] { cic, furnaceNo }, ob);
  426. listCic.AcceptChanges();
  427. CraftLg2CicEntityBindingSource.DataSource = listCic;
  428. foreach (UltraGridRow urg in ultraGridLgCic.Rows)
  429. {
  430. urg.Cells["CHC"].Value = true;
  431. }
  432. }
  433. DataTable dtCicAll = new DataTable();
  434. /// <summary>
  435. /// 查询CIC(工艺评审和交集)
  436. /// </summary>
  437. private void queryOrdDesigCic(string cicg)
  438. {
  439. dtCicAll =
  440. ServerHelper.GetData(
  441. "com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryOrdDesigCic",
  442. new object[] { cic, furnaceNo, gxPlanSeq,flag }, ob);
  443. DataTable dt = SteelHelper.GetDistinctTable(dtCicAll, "CIC");
  444. GridHelper.CopyDataToDatatable(dt, dataTable2, true);
  445. foreach (UltraGridRow ugr in ultraGrid2.Rows)
  446. {
  447. if (ugr.Cells["CIC"].Value.ToString().Equals(cicg))
  448. {
  449. ugr.Activate();
  450. }
  451. }
  452. }
  453. /// <summary>
  454. /// 查询工艺成分信息
  455. /// </summary>
  456. private void QueryLgCic(string cicGid)
  457. {
  458. listCic = EntityHelper.GetData<CraftLg2CicEntity>
  459. ("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryLgCic", new object[] { cicGid }, ob);
  460. listCic.AcceptChanges();
  461. CraftLg2CicEntityBindingSource.DataSource = listCic;
  462. foreach (UltraGridRow urg in ultraGridLgCic.Rows)
  463. {
  464. urg.Cells["CHC"].Value = true;
  465. }
  466. }
  467. /// <summary>
  468. /// 查询目标工艺成分信息
  469. /// </summary>
  470. private void QueryLgTarCic(string tarCicGid)
  471. {
  472. listTarCic = EntityHelper.GetData<CraftLg2TarCicEntity>
  473. ("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryLgTarCic", new object[] { tarCicGid }, ob);
  474. listTarCic.AcceptChanges();
  475. CraftLg2TarCicEntityBindingSource.DataSource = listTarCic;
  476. foreach (UltraGridRow urg in ultraGridLgTarCic.Rows)
  477. {
  478. urg.Cells["CHC"].Value = true;
  479. }
  480. }
  481. /// <summary>
  482. /// 查询CCM信息
  483. /// </summary>
  484. private void QueryLgCcm(string ccmGid)
  485. {
  486. listCcm = EntityHelper.GetData<CraftLg2CcmEntity>
  487. ("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryLgCcm", new object[] { ccmGid }, ob);
  488. listCcm.AcceptChanges();
  489. CraftLg2CcmEntityBindingSource.DataSource = listCcm;
  490. foreach (UltraGridRow urg in ultraGridLgCcm.Rows)
  491. {
  492. urg.Cells["CHC"].Value = true;
  493. }
  494. }
  495. /// <summary>
  496. /// 查询温度信息
  497. /// </summary>
  498. private void QueryLgtTem(string tepGid)
  499. {
  500. listTem = EntityHelper.GetData<CraftLg2TemperatureEntity>
  501. ("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryLgtTem", new object[] { tepGid }, ob);
  502. listTem.AcceptChanges();
  503. CraftLg2TemperatureEntitySource.DataSource = listTem;
  504. foreach (UltraGridRow urg in ultraGridLhTem.Rows)
  505. {
  506. urg.Cells["CHC"].Value = true;
  507. if (urg.Cells["StationCode"].Text.Equals("EAF"))
  508. {
  509. urg.Cells["TepVal1Min"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  510. urg.Cells["TepVal1Max"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  511. urg.Cells["TepVal2Min"].Appearance.BackColor = Color.Transparent;
  512. urg.Cells["TepVal2Max"].Appearance.BackColor = Color.Transparent;
  513. urg.Cells["TepVal"].Appearance.BackColor = Color.Transparent;
  514. urg.Cells["TepVal1Min"].Activation = Activation.AllowEdit;
  515. urg.Cells["TepVal1Max"].Activation = Activation.AllowEdit;
  516. urg.Cells["TepVal1Min"].IgnoreRowColActivation = true;
  517. urg.Cells["TepVal1Max"].IgnoreRowColActivation = true;
  518. urg.Cells["TepVal2Min"].Activation = Activation.ActivateOnly;
  519. urg.Cells["TepVal2Max"].Activation = Activation.ActivateOnly;
  520. urg.Cells["TepVal"].Activation = Activation.ActivateOnly;
  521. }
  522. else if (urg.Cells["StationCode"].Text.Equals("CCM"))
  523. {
  524. urg.Cells["TepVal1Min"].Appearance.BackColor = Color.Transparent;
  525. urg.Cells["TepVal1Max"].Appearance.BackColor = Color.Transparent;
  526. urg.Cells["TepVal2Min"].Appearance.BackColor = Color.Transparent;
  527. urg.Cells["TepVal2Max"].Appearance.BackColor = Color.Transparent;
  528. urg.Cells["TepVal"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  529. urg.Cells["TepVal1Min"].Activation = Activation.ActivateOnly;
  530. urg.Cells["TepVal1Max"].Activation = Activation.ActivateOnly;
  531. urg.Cells["TepVal2Min"].Activation = Activation.ActivateOnly;
  532. urg.Cells["TepVal2Max"].Activation = Activation.ActivateOnly;
  533. urg.Cells["TepVal"].Activation = Activation.AllowEdit;
  534. urg.Cells["TepVal"].IgnoreRowColActivation = true;
  535. }
  536. else
  537. {
  538. urg.Cells["TepVal1Min"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  539. urg.Cells["TepVal1Max"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  540. urg.Cells["TepVal2Min"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  541. urg.Cells["TepVal2Max"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  542. urg.Cells["TepVal"].Appearance.BackColor = Color.Transparent;
  543. urg.Cells["TepVal1Min"].Activation = Activation.AllowEdit;
  544. urg.Cells["TepVal1Max"].Activation = Activation.AllowEdit;
  545. urg.Cells["TepVal2Min"].Activation = Activation.AllowEdit;
  546. urg.Cells["TepVal2Max"].Activation = Activation.AllowEdit;
  547. urg.Cells["TepVal1Min"].IgnoreRowColActivation = true;
  548. urg.Cells["TepVal1Max"].IgnoreRowColActivation = true;
  549. urg.Cells["TepVal2Min"].IgnoreRowColActivation = true;
  550. urg.Cells["TepVal2Max"].IgnoreRowColActivation = true;
  551. urg.Cells["TepVal"].Activation = Activation.ActivateOnly;
  552. }
  553. }
  554. }
  555. private void QueryLgHj(string alloyGid)
  556. {
  557. listHj = EntityHelper.GetData<CraftLg2AlloyEntity>
  558. ("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryLgtHj", new object[] { alloyGid}, ob);
  559. listHj.AcceptChanges();
  560. CraftLg2AlloyEntityBindingSource.DataSource = listHj;
  561. foreach (UltraGridRow urg in ultraGridhJ.Rows)
  562. {
  563. urg.Cells["CHC"].Value = true;
  564. }
  565. }
  566. #endregion
  567. /// <summary>
  568. /// 保存
  569. /// </summary>ultraExpandableGroupBox2
  570. private void doSaveUpdate(string isFlag)
  571. {
  572. #region 条件
  573. ultraGridLgM.UpdateData();
  574. ultraGridLgCic.UpdateData();
  575. ultraGridLgTarCic.UpdateData();
  576. ultraGridLgCcm.UpdateData();
  577. ultraGridLhTem.UpdateData();
  578. UltraGridRow row = ultraGrid2.ActiveRow;
  579. if (row == null)
  580. {
  581. //MessageUtil.ShowTips("未找到成分索引码!!");
  582. return;
  583. }
  584. ArrayList listLgM = new ArrayList();
  585. IQueryable<UltraGridRow> ugLgM = ultraGridLgM.Rows.AsQueryable().Where("CHC = 'True'");
  586. if (ugLgM == null || ugLgM.Count() == 0)
  587. {
  588. MessageUtil.ShowTips("未勾选炼钢工艺主信息!");
  589. return;
  590. }
  591. else
  592. {
  593. foreach (UltraGridRow rowLgM in ugLgM)
  594. {
  595. listLgM.Add((CraftLg2MEntity)rowLgM.ListObject);
  596. }
  597. }
  598. ArrayList listTarCic = new ArrayList();
  599. IQueryable<UltraGridRow> ugTarCic = ultraGridLgTarCic.Rows.AsQueryable().Where("CHC = 'True'");
  600. if (ugTarCic == null || ugTarCic.Count() == 0)
  601. {
  602. MessageUtil.ShowTips("未勾选目标工艺成分信息!");
  603. return;
  604. }
  605. else
  606. {
  607. foreach (UltraGridRow rowTarCic in ugTarCic)
  608. {
  609. listTarCic.Add((CraftLg2TarCicEntity)rowTarCic.ListObject);
  610. }
  611. }
  612. ArrayList listLgCic = new ArrayList();
  613. IQueryable<UltraGridRow> ugLgCic = ultraGridLgCic.Rows.AsQueryable();
  614. // if (ugLgCic == null || ugLgCic.Count() == 0)
  615. // {
  616. // MessageUtil.ShowTips("未勾选工艺成分信息!");
  617. // return;
  618. // }
  619. // else
  620. //
  621. List<string> usedCode = new List<string>();
  622. foreach (UltraGridRow rowLgCic in ugLgCic)
  623. {
  624. CraftLg2CicEntity CraftLg2CicEntity = rowLgCic.ListObject as CraftLg2CicEntity;
  625. if (usedCode.Contains(CraftLg2CicEntity.ChemCode))
  626. {
  627. MessageUtil.ShowTips("工艺成分信息有重复元素!");
  628. return;
  629. }
  630. usedCode.Add(CraftLg2CicEntity.ChemCode);
  631. if (CraftLg2CicEntity != null)
  632. {
  633. if (CraftLg2CicEntity.ChemCode.Trim() == "")
  634. {
  635. MessageUtil.ShowTips("请选择工艺成分信息的元素!");
  636. return;
  637. }
  638. }
  639. listLgCic.Add((CraftLg2CicEntity)rowLgCic.ListObject);
  640. }
  641. //}
  642. ArrayList listLgCcm = new ArrayList();
  643. IQueryable<UltraGridRow> ugLgCcm = ultraGridLgCcm.Rows.AsQueryable().Where("CHC = 'True'");
  644. if (ugLgCcm == null || ugLgCcm.Count() == 0)
  645. {
  646. //MessageUtil.ShowTips("未勾选CCM工艺信息!");
  647. //return;
  648. }
  649. else
  650. {
  651. foreach (UltraGridRow rowLgCcm in ugLgCcm)
  652. {
  653. //if (rowLgCcm.Cells[""].Text.ToString())
  654. listLgCcm.Add((CraftLg2CcmEntity)rowLgCcm.ListObject);
  655. }
  656. }
  657. ArrayList listLgTem = new ArrayList();
  658. IQueryable<UltraGridRow> ugLgTem = ultraGridLhTem.Rows.AsQueryable().Where("CHC = 'True'");
  659. if (ugLgTem == null || ugLgTem.Count() == 0)
  660. {
  661. MessageUtil.ShowTips("未勾选温度参数信息!");
  662. return;
  663. }
  664. else
  665. {
  666. foreach (UltraGridRow rowLgTem in ugLgTem)
  667. {
  668. listLgTem.Add((CraftLg2TemperatureEntity)rowLgTem.ListObject);
  669. }
  670. }
  671. ArrayList listLgHj = new ArrayList();
  672. IQueryable<UltraGridRow> ugLgHj = ultraGridhJ.Rows.AsQueryable().Where("CHC = 'True'");
  673. if (ugLgHj == null || ugLgHj.Count() == 0)
  674. {
  675. MessageUtil.ShowTips("未勾选合金配置信息!");
  676. return;
  677. }
  678. else
  679. {
  680. foreach (UltraGridRow rowLgHj in ugLgHj)
  681. {
  682. listLgHj.Add((CraftLg2AlloyEntity)rowLgHj.ListObject);
  683. }
  684. }
  685. ArrayList jsonListM = new ArrayList();
  686. ArrayList jsonListCic = new ArrayList();
  687. ArrayList jsonListTarCic = new ArrayList();
  688. ArrayList jsonListCcm = new ArrayList();
  689. ArrayList jsonListTem = new ArrayList();
  690. ArrayList jsonListHj = new ArrayList();
  691. if (isFlag.Equals("0"))
  692. {
  693. #region 新增
  694. foreach (CraftLg2MEntity entityM in listLgM)
  695. {
  696. if (string.IsNullOrEmpty(entityM.PlineCode))
  697. {
  698. MessageUtil.ShowTips("请选择电炉产线!");
  699. return;
  700. }
  701. if (string.IsNullOrEmpty(entityM.CraftRoute))
  702. {
  703. MessageUtil.ShowTips("请选择工艺路径!");
  704. return;
  705. }
  706. if (entityM.CraftType.Equals(""))
  707. {
  708. MessageUtil.ShowTips("请选择工艺卡类型!");
  709. return;
  710. }
  711. if (entityM.GradeNo.Equals(""))
  712. {
  713. MessageUtil.ShowTips("请输入钢质代码!");
  714. return;
  715. }
  716. if (entityM.Produccode.Equals(""))
  717. {
  718. MessageUtil.ShowTips("请选择品名!");
  719. return;
  720. }
  721. if (entityM.CraftType.Equals("标准卡"))
  722. {
  723. entityM.CraftType = "A";
  724. }
  725. else if (entityM.CraftType.Equals("联络卡")) {
  726. entityM.CraftType = "B";
  727. }
  728. if (flag.Equals("1"))
  729. {
  730. if (ultraGrid2.ActiveRow != null)
  731. {
  732. entityM.Cic= ultraGrid2.ActiveRow.Cells["CIC"].Text;
  733. }
  734. else
  735. entityM.Cic = cic;
  736. }
  737. else {
  738. entityM.Cic = row.Cells["CIC"].Text.ToString();
  739. }
  740. jsonListM.Add(JSONFormat.Format(entityM));
  741. }
  742. foreach (CraftLg2CicEntity entityCic in listLgCic)
  743. { jsonListCic.Add(JSONFormat.Format(entityCic)); }
  744. foreach (CraftLg2TarCicEntity entityTar in listTarCic)
  745. {
  746. if (entityTar.StationCode.Equals(""))
  747. {
  748. MessageUtil.ShowTips("请选择目标成分工序点!");
  749. return;
  750. }
  751. if (entityTar.ChemCode.Equals(""))
  752. {
  753. MessageUtil.ShowTips("请选择目标成分化学元素!");
  754. return;
  755. }
  756. jsonListTarCic.Add(JSONFormat.Format(entityTar));
  757. }
  758. foreach (CraftLg2CcmEntity entityCcm in listLgCcm)
  759. {
  760. if (entityCcm.CcmCode.Equals(""))
  761. {
  762. MessageUtil.ShowTips("请选择CCM水表编码!");
  763. return;
  764. }
  765. jsonListCcm.Add(JSONFormat.Format(entityCcm));
  766. }
  767. string stationC = "";
  768. foreach (CraftLg2TemperatureEntity entityTem in listLgTem)
  769. {
  770. if (entityTem.StationCode.Equals(""))
  771. {
  772. MessageUtil.ShowTips("请选择温度工序点!");
  773. return;
  774. }
  775. //stationC = entityTem.StationCode;
  776. //foreach (CraftLg2TemperatureEntity entity in listLgTem)
  777. //{
  778. // if (entity.StationCode.Equals(stationC))
  779. // {
  780. // MessageUtil.ShowTips("相同的工序点在同一个工艺卡下只能选一个!");
  781. // return;
  782. // }
  783. //}
  784. jsonListTem.Add(JSONFormat.Format(entityTem));
  785. }
  786. string itemcode = "";
  787. foreach (CraftLg2AlloyEntity entityHj in listLgHj)
  788. {
  789. if (entityHj.ItemCode.Equals(""))
  790. {
  791. MessageUtil.ShowTips("物料不能为空!");
  792. return;
  793. }
  794. if (entityHj.InputAmount == 0 || entityHj.InputAmount==null)
  795. {
  796. MessageUtil.ShowTips("方案配置量不能为零或为空!");
  797. return;
  798. }
  799. //itemcode = entityHj.ItemCode;
  800. //foreach (CraftLg2AlloyEntity entity in listLgHj)
  801. //{ if(entity.ItemCode.Equals("")){
  802. //}
  803. jsonListHj.Add(JSONFormat.Format(entityHj));
  804. }
  805. #endregion
  806. }
  807. else
  808. {
  809. #region 修改
  810. foreach (CraftLg2MEntity entityM in listLgM)
  811. {
  812. if (entityM.CraftType.Equals("标准卡"))
  813. {
  814. entityM.CraftType = "A";
  815. }
  816. else
  817. {
  818. entityM.CraftType = "B";
  819. }
  820. jsonListM.Add(JSONFormat.Format(entityM));
  821. }
  822. foreach (CraftLg2CicEntity entityCic in listLgCic)
  823. { jsonListCic.Add(JSONFormat.Format(entityCic)); }
  824. foreach (CraftLg2TarCicEntity entityTar in listTarCic)
  825. {
  826. if (entityTar.TarCicGid.Equals(""))
  827. {
  828. MessageUtil.ShowTips("修改时不能新增目标成分行!");
  829. return;
  830. }
  831. jsonListTarCic.Add(JSONFormat.Format(entityTar));
  832. }
  833. foreach (CraftLg2CcmEntity entityCcm in listLgCcm)
  834. {
  835. if (entityCcm.CcmGid.Equals(""))
  836. {
  837. MessageUtil.ShowTips("修改时不能新增CCM行!");
  838. return;
  839. }
  840. jsonListCcm.Add(JSONFormat.Format(entityCcm));
  841. }
  842. string stationC = "";
  843. foreach (CraftLg2TemperatureEntity entityTem in listLgTem)
  844. {
  845. if (entityTem.TepGid.Equals(""))
  846. {
  847. MessageUtil.ShowTips("修改时不能新增温度行!");
  848. return;
  849. }
  850. //stationC = entityTem.StationCode;
  851. //foreach (CraftLg2TemperatureEntity entity in listLgTem)
  852. //{
  853. // if (entity.StationCode.Equals(stationC))
  854. // {
  855. // MessageUtil.ShowTips("相同的工序点在同一个工艺卡下只能选一个!");
  856. // return;
  857. // }
  858. //}
  859. jsonListTem.Add(JSONFormat.Format(entityTem));
  860. }
  861. foreach (CraftLg2AlloyEntity entityHj in listLgHj)
  862. {
  863. if (entityHj.AlloyGid.Equals(""))
  864. {
  865. MessageUtil.ShowTips("修改时不能新增合金配置行!");
  866. return;
  867. }
  868. jsonListHj.Add(JSONFormat.Format(entityHj));
  869. }
  870. #endregion
  871. }
  872. #endregion
  873. if (MessageUtil.ShowYesNoAndQuestion(isFlag.Equals("0") ? "是否新增?" : "是否修改?") == DialogResult.No)
  874. {
  875. return;
  876. }
  877. PlanComm.WaitFromOpen(this.Cursor);
  878. CoreClientParam ccp = new CoreClientParam();
  879. ccp.ServerName = "com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard";
  880. ccp.MethodName = "doSaveUpdate";
  881. ccp.ServerParams = new object[] { jsonListM, jsonListCic, jsonListTarCic, jsonListCcm, jsonListTem, this.UserInfo.GetUserName(), isFlag, gradCode, jsonListHj };
  882. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  883. PlanComm.WaitFromColse(this.Cursor);
  884. if (ccp.ReturnCode == -1) return;
  885. MessageUtil.ShowTips(ccp.ReturnInfo);
  886. if (ccp.ReturnInfo.Equals("新增成功!") || ccp.ReturnInfo.Equals("修改成功!"))
  887. {
  888. QueryM();
  889. }
  890. }
  891. /// <summary>
  892. /// 删除
  893. /// </summary>
  894. private void doDelete()
  895. {
  896. ultraGridLgM.UpdateData();
  897. ArrayList listLgM = new ArrayList();
  898. IQueryable<UltraGridRow> ugLgM = ultraGridLgM.Rows.AsQueryable().Where("CHC = 'True'");
  899. if (ugLgM == null || ugLgM.Count() == 0)
  900. {
  901. MessageUtil.ShowTips("未勾选炼钢工艺主信息!");
  902. return;
  903. }
  904. else
  905. {
  906. foreach (UltraGridRow rowLgM in ugLgM)
  907. {
  908. listLgM.Add((CraftLg2MEntity)rowLgM.ListObject);
  909. }
  910. }
  911. ArrayList jsonListM = new ArrayList();
  912. foreach (CraftLg2MEntity entityM in listLgM)
  913. {
  914. jsonListM.Add(JSONFormat.Format(entityM));
  915. }
  916. if (MessageUtil.ShowYesNoAndQuestion("是否删除?") == DialogResult.No)
  917. {
  918. return;
  919. }
  920. PlanComm.WaitFromOpen(this.Cursor);
  921. CoreClientParam ccp = new CoreClientParam();
  922. ccp.ServerName = "com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard";
  923. ccp.MethodName = "doDelete";
  924. ccp.ServerParams = new object[] { jsonListM, furnaceNo, gxPlanSeq, flag };
  925. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  926. PlanComm.WaitFromColse(this.Cursor);
  927. if (ccp.ReturnCode == -1) return;
  928. if (ccp.ReturnInfo.Equals("删除成功!"))
  929. {
  930. QueryM();
  931. }
  932. }
  933. /// <summary>
  934. /// 确认
  935. /// </summary>
  936. private void doConfirm()
  937. {
  938. if (flag == "2")
  939. {
  940. Falg = true;
  941. this.Close();
  942. return;
  943. }
  944. UltraGridRow row = ultraGridLgM.ActiveRow;
  945. if (row == null) return;
  946. ultraGridLgM.UpdateData();
  947. ArrayList listLgM = new ArrayList();
  948. IQueryable<UltraGridRow> ugLgM = ultraGridLgM.Rows.AsQueryable().Where("CHC = 'True'");
  949. if (ugLgM == null || ugLgM.Count() == 0)
  950. {
  951. MessageUtil.ShowTips("未勾选炼钢工艺主信息!");
  952. return;
  953. }
  954. if (ugLgM.Count() > 1)
  955. {
  956. MessageUtil.ShowTips("请选择炼钢工艺卡号!");
  957. return;
  958. }
  959. string craftNo = row.Cells["CraftNo"].Text.ToString();
  960. if (craftNo.Equals(""))
  961. {
  962. MessageUtil.ShowTips("您选择炼钢工艺卡号未生成,请先保存!");
  963. return;
  964. }
  965. if (MessageUtil.ShowYesNoAndQuestion("是否确认?") == DialogResult.No)
  966. {
  967. return;
  968. }
  969. PlanComm.WaitFromOpen(this.Cursor);
  970. CoreClientParam ccp = new CoreClientParam();
  971. ccp.ServerName = "com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard";
  972. ccp.MethodName = "doConfirm";
  973. ccp.ServerParams = new object[] { craftNo, furnaceNo, flag, gxPlanSeq };
  974. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  975. PlanComm.WaitFromColse(this.Cursor);
  976. if (ccp.ReturnCode == -1) return;
  977. if (ccp.ReturnInfo.Equals("确认成功!"))
  978. {
  979. Falg = true;
  980. this.Close();
  981. }
  982. }
  983. /// <summary>
  984. /// 计算
  985. /// </summary>
  986. private void doCalculate(int temperature)
  987. {
  988. int count = 0;
  989. foreach (UltraGridRow urg in ultraGridLgM.Rows)
  990. {
  991. if (Convert.ToBoolean(urg.Cells["CHC"].Text) == true)
  992. {
  993. count++;
  994. }
  995. }
  996. if (count == 0)
  997. {
  998. MessageUtil.ShowTips("请先勾选工艺卡主信息!"); return;
  999. }
  1000. if (count > 1)
  1001. {
  1002. MessageUtil.ShowTips("请勾选一个工艺卡主信息!"); return;
  1003. }
  1004. #region 计算液相温度,目标成分EAF C出钢,P出钢
  1005. if (temperature == 0)
  1006. {
  1007. double Ctemp = 0;//碳温度
  1008. double Sitemp = 0;//硅温度
  1009. double Mntemp = 0;//锰温度
  1010. double Crtemp = 0;
  1011. double Motemp = 0;
  1012. double Nitemp = 0;
  1013. double Cutemp = 0;
  1014. double Titemp = 0;
  1015. string Csteel = "";
  1016. string Psteel = "";
  1017. UltraGridRow urgT = ultraGridLgTarCic.ActiveRow;
  1018. List<CraftLg2TarCicEntity> list = new List<CraftLg2TarCicEntity>();
  1019. foreach (UltraGridRow urg in ultraGridLgCic.Rows)
  1020. {
  1021. CraftLg2TarCicEntity CraftLg2TarCicEntity = new entity.CraftLg2TarCicEntity();
  1022. double min = 0;
  1023. if (!urg.Cells["Stdmin"].Text.ToString().Equals(""))
  1024. {
  1025. min = double.Parse(urg.Cells["Stdmin"].Text.ToString());
  1026. }
  1027. double max = 0;
  1028. if (!urg.Cells["Stdmax"].Text.ToString().Equals(""))
  1029. {
  1030. max = double.Parse(urg.Cells["Stdmax"].Text.ToString());
  1031. }
  1032. if (urg.Cells["ChemName"].Text.ToString().Equals("C"))
  1033. {
  1034. Ctemp = (max + min) / 2;
  1035. if (min >= 0.20)
  1036. {
  1037. Csteel = (min - 0.10).ToString();
  1038. }
  1039. else if (0.10 <= min && min < 0.15)
  1040. {
  1041. Csteel = "0.07";
  1042. }
  1043. else if (0.15 <= min && min < 0.20)
  1044. {
  1045. Csteel = "0.09";
  1046. }
  1047. else if (min < 0.1)
  1048. {
  1049. Csteel = "0.06";
  1050. }
  1051. CraftLg2TarCicEntity.StationCode = "EAF";
  1052. CraftLg2TarCicEntity.ChemCode = "C001";
  1053. CraftLg2TarCicEntity.ChemName = "C";
  1054. CraftLg2TarCicEntity.Stdmax = Csteel;
  1055. CraftLg2TarCicEntity.StdmaxSign = "<=";
  1056. list.Add(CraftLg2TarCicEntity);
  1057. }
  1058. if (urg.Cells["ChemName"].Text.ToString().Equals("P"))
  1059. {
  1060. if (max >= 0.015)
  1061. {
  1062. Psteel = (max - 0.005).ToString();
  1063. }
  1064. else if (0.10 <= max && max < 0.015)
  1065. {
  1066. Psteel = "0.007";
  1067. }
  1068. else if (max < 0.010)
  1069. {
  1070. Psteel = "0.006";
  1071. }
  1072. CraftLg2TarCicEntity.StationCode = "EAF";
  1073. CraftLg2TarCicEntity.ChemCode = "C004";
  1074. CraftLg2TarCicEntity.ChemName = "P";
  1075. CraftLg2TarCicEntity.Stdmax = Psteel;
  1076. CraftLg2TarCicEntity.StdmaxSign = "<=";
  1077. list.Add(CraftLg2TarCicEntity);
  1078. }
  1079. if (urg.Cells["ChemName"].Text.ToString().Equals("Si"))
  1080. {
  1081. Sitemp = (max + min) / 2;
  1082. }
  1083. if (urg.Cells["ChemName"].Text.ToString().Equals("Mn"))
  1084. {
  1085. Mntemp = (max + min) / 2;
  1086. }
  1087. if (urg.Cells["ChemName"].Text.ToString().Equals("Cr"))
  1088. {
  1089. if (min != 0)
  1090. {
  1091. Mntemp = (max + min) / 2;
  1092. }
  1093. }
  1094. if (urg.Cells["ChemName"].Text.ToString().Equals("Mo"))
  1095. {
  1096. if (min != 0)
  1097. {
  1098. Motemp = (max + min) / 2;
  1099. }
  1100. }
  1101. if (urg.Cells["ChemName"].Text.ToString().Equals("Ni"))
  1102. {
  1103. if (min != 0)
  1104. {
  1105. Nitemp = (max + min) / 2;
  1106. }
  1107. }
  1108. if (urg.Cells["ChemName"].Text.ToString().Equals("Cu"))
  1109. {
  1110. if (min != 0)
  1111. {
  1112. Cutemp = (max + min) / 2;
  1113. }
  1114. }
  1115. if (urg.Cells["ChemName"].Text.ToString().Equals("Ti"))
  1116. {
  1117. if (min != 0)
  1118. {
  1119. Titemp = (max + min) / 2;
  1120. }
  1121. }
  1122. }
  1123. CraftLg2TarCicEntityBindingSource.DataSource = list;
  1124. foreach (UltraGridRow urg in ultraGridLgTarCic.Rows)
  1125. {
  1126. urg.Cells["CHC"].Value = true;
  1127. }
  1128. temperature = (int)Math.Ceiling(1536 - (88 * Ctemp + 8 * Sitemp + 5 * Mntemp + 1.5 * Crtemp + 5 * Cutemp + 4 * Nitemp + 2 * Motemp + 18 * Titemp + 3));
  1129. }
  1130. UltraGridRow urgM = ultraGridLgM.ActiveRow;
  1131. List<CraftLg2TemperatureEntity> listtep = new List<CraftLg2TemperatureEntity>();
  1132. CraftLg2TemperatureEntity EntityTep = new entity.CraftLg2TemperatureEntity();
  1133. CraftLg2TemperatureEntity EntityTep3 = new entity.CraftLg2TemperatureEntity();
  1134. EntityTep3.StationCode = "EAF";
  1135. EntityTep3.TepVal1Min = "1630";
  1136. EntityTep3.TepVal1Max = "1690";
  1137. listtep.Add(EntityTep3);
  1138. if (string.IsNullOrEmpty(urgM.Cells["PlineCode"].Text) ||
  1139. string.IsNullOrEmpty(urgM.Cells["CraftRoute"].Text))
  1140. {
  1141. MessageUtil.ShowTips("请选择产线和工艺路径!"); return;
  1142. }
  1143. if (urgM.Cells["PlineCode"].Text.ToString().Equals("C001"))//一炼钢
  1144. {
  1145. if (urgM.Cells["CraftRoute"].Text.ToString().Contains("V") || urgM.Cells["CraftRoute"].Text.ToString().Contains("R"))
  1146. { //LF
  1147. int minLF1 = 120;
  1148. int maxLF1 = 140;
  1149. int minLF2 = 100;
  1150. int maxLF2 = 120;
  1151. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryComBaseTep", new object[] { urgM.Cells["PlineCode"].Text.ToString(), urgM.Cells["CraftRoute"].Text.ToString(), gradCode, "LF" }, ob);
  1152. if (dt.Rows.Count > 0)
  1153. {
  1154. minLF1 = int.Parse(dt.Rows[0]["DEVIATION_NO1"].ToString());
  1155. maxLF1 = int.Parse(dt.Rows[0]["DEVIATION_UN1"].ToString());
  1156. minLF2 = int.Parse(dt.Rows[0]["DEVIATION_NO2"].ToString());
  1157. maxLF2 = int.Parse(dt.Rows[0]["DEVIATION_NU2"].ToString());
  1158. }
  1159. EntityTep.StationCode = "LF";
  1160. EntityTep.TepVal1Min = (temperature + minLF1).ToString();
  1161. EntityTep.TepVal1Max = (temperature + maxLF1).ToString();
  1162. EntityTep.TepVal2Min = (temperature + minLF2).ToString();
  1163. EntityTep.TepVal2Max = (temperature + maxLF2).ToString();
  1164. EntityTep.TepVal = "";
  1165. listtep.Add(EntityTep);
  1166. //VD
  1167. int minVD1 = 70;
  1168. int maxVD1 = 95;
  1169. int minVD2 = 50;
  1170. int maxVD2 = 70;
  1171. DataTable dt1 = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryComBaseTep", new object[] { urgM.Cells["PlineCode"].Text.ToString(), urgM.Cells["CraftRoute"].Text.ToString(), gradCode, "VD" }, ob);
  1172. if (dt.Rows.Count > 0)
  1173. {
  1174. minVD1 = int.Parse(dt1.Rows[0]["DEVIATION_NO1"].ToString());
  1175. maxVD1 = int.Parse(dt1.Rows[0]["DEVIATION_UN1"].ToString());
  1176. minVD2 = int.Parse(dt1.Rows[0]["DEVIATION_NO2"].ToString());
  1177. maxVD2 = int.Parse(dt1.Rows[0]["DEVIATION_NU2"].ToString());
  1178. }
  1179. CraftLg2TemperatureEntity EntityTep1 = new entity.CraftLg2TemperatureEntity();
  1180. //CraftLg2TemperatureEntity EntityTepClone = EntityTep.Clone();
  1181. EntityTep1.StationCode = "VD";
  1182. EntityTep1.TepVal1Min = (temperature + minVD1).ToString();
  1183. EntityTep1.TepVal1Max = (temperature + maxVD1).ToString();
  1184. EntityTep1.TepVal2Min = (temperature + minVD2).ToString();
  1185. EntityTep1.TepVal2Max = (temperature + maxVD2).ToString();
  1186. EntityTep1.TepVal = "";
  1187. listtep.Add(EntityTep1);
  1188. }
  1189. else
  1190. {//LF
  1191. int minLF1 = 70;
  1192. int maxLF1 = 95;
  1193. int minLF2 = 50;
  1194. int maxLF2 = 70;
  1195. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryComBaseTep", new object[] { urgM.Cells["PlineCode"].Text.ToString(), urgM.Cells["CraftRoute"].Text.ToString(), gradCode, "LF" }, ob);
  1196. if (dt.Rows.Count > 0)
  1197. {
  1198. minLF1 = int.Parse(dt.Rows[0]["DEVIATION_NO1"].ToString());
  1199. maxLF1 = int.Parse(dt.Rows[0]["DEVIATION_UN1"].ToString());
  1200. minLF2 = int.Parse(dt.Rows[0]["DEVIATION_NO2"].ToString());
  1201. maxLF2 = int.Parse(dt.Rows[0]["DEVIATION_NU2"].ToString());
  1202. }
  1203. EntityTep.StationCode = "LF";
  1204. EntityTep.TepVal1Min = (temperature + minLF1).ToString();
  1205. EntityTep.TepVal1Max = (temperature + maxLF1).ToString();
  1206. EntityTep.TepVal2Min = (temperature + minLF2).ToString();
  1207. EntityTep.TepVal2Max = (temperature + maxLF2).ToString();
  1208. EntityTep.TepVal = "";
  1209. listtep.Add(EntityTep);
  1210. }
  1211. }
  1212. else if (urgM.Cells["PlineCode"].Text.ToString().Equals("C003"))//二炼钢
  1213. {
  1214. if (urgM.Cells["CraftRoute"].Text.ToString().Contains("V") || urgM.Cells["CraftRoute"].Text.ToString().Contains("R"))
  1215. {
  1216. //LF
  1217. int minLF1 = 130;
  1218. int maxLF1 = 150;
  1219. int minLF2 = 110;
  1220. int maxLF2 = 130;
  1221. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryComBaseTep", new object[] { urgM.Cells["PlineCode"].Text.ToString(), urgM.Cells["CraftRoute"].Text.ToString(), gradCode, "LF" }, ob);
  1222. if (dt.Rows.Count > 0)
  1223. {
  1224. minLF1 = int.Parse(dt.Rows[0]["DEVIATION_NO1"].ToString());
  1225. maxLF1 = int.Parse(dt.Rows[0]["DEVIATION_UN1"].ToString());
  1226. minLF2 = int.Parse(dt.Rows[0]["DEVIATION_NO2"].ToString());
  1227. maxLF2 = int.Parse(dt.Rows[0]["DEVIATION_NU2"].ToString());
  1228. }
  1229. EntityTep.StationCode = "LF";
  1230. EntityTep.TepVal1Min = (temperature + minLF1).ToString();
  1231. EntityTep.TepVal1Max = (temperature + maxLF1).ToString();
  1232. EntityTep.TepVal2Min = (temperature + minLF2).ToString();
  1233. EntityTep.TepVal2Max = (temperature + maxLF2).ToString();
  1234. EntityTep.TepVal = "";
  1235. listtep.Add(EntityTep);
  1236. //VD
  1237. int minVD1 = 70;
  1238. int maxVD1 = 95;
  1239. int minVD2 = 60;
  1240. int maxVD2 = 80;
  1241. DataTable dt1 = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryComBaseTep", new object[] { urgM.Cells["PlineCode"].Text.ToString(), urgM.Cells["CraftRoute"].Text.ToString(), gradCode, "VD" }, ob);
  1242. if (dt.Rows.Count > 0)
  1243. {
  1244. minVD1 = int.Parse(dt1.Rows[0]["DEVIATION_NO1"].ToString());
  1245. maxVD1 = int.Parse(dt1.Rows[0]["DEVIATION_UN1"].ToString());
  1246. minVD2 = int.Parse(dt1.Rows[0]["DEVIATION_NO2"].ToString());
  1247. maxVD2 = int.Parse(dt1.Rows[0]["DEVIATION_NU2"].ToString());
  1248. }
  1249. CraftLg2TemperatureEntity EntityTep1 = new entity.CraftLg2TemperatureEntity();
  1250. EntityTep1.StationCode = "VD";
  1251. EntityTep1.TepVal1Min = (temperature + minVD1).ToString();
  1252. EntityTep1.TepVal1Max = (temperature + maxVD1).ToString();
  1253. EntityTep1.TepVal2Min = (temperature + minVD2).ToString();
  1254. EntityTep1.TepVal2Max = (temperature + maxVD2).ToString();
  1255. EntityTep1.TepVal = "";
  1256. listtep.Add(EntityTep1);
  1257. }
  1258. else
  1259. { //LF
  1260. int minLF1 = 70;
  1261. int maxLF1 = 95;
  1262. int minLF2 = 60;
  1263. int maxLF2 = 80;
  1264. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryComBaseTep", new object[] { urgM.Cells["PlineCode"].Text.ToString(), urgM.Cells["CraftRoute"].Text.ToString(), gradCode, "LF" }, ob);
  1265. if (dt.Rows.Count > 0)
  1266. {
  1267. minLF1 = int.Parse(dt.Rows[0]["DEVIATION_NO1"].ToString());
  1268. maxLF1 = int.Parse(dt.Rows[0]["DEVIATION_UN1"].ToString());
  1269. minLF2 = int.Parse(dt.Rows[0]["DEVIATION_NO2"].ToString());
  1270. maxLF2 = int.Parse(dt.Rows[0]["DEVIATION_NU2"].ToString());
  1271. }
  1272. EntityTep.StationCode = "LF";
  1273. EntityTep.TepVal1Min = (temperature + minLF1).ToString();
  1274. EntityTep.TepVal1Max = (temperature + maxLF1).ToString();
  1275. EntityTep.TepVal2Min = (temperature + minLF2).ToString();
  1276. EntityTep.TepVal2Max = (temperature + maxLF2).ToString();
  1277. EntityTep.TepVal = "";
  1278. listtep.Add(EntityTep);
  1279. }
  1280. }
  1281. else if (urgM.Cells["PlineCode"].Text.ToString().Equals("C006"))//三炼钢
  1282. {
  1283. if (urgM.Cells["CraftRoute"].Text.ToString().Contains("V") || urgM.Cells["CraftRoute"].Text.ToString().Contains("R"))
  1284. { //LF
  1285. int minLF1 = 130;
  1286. int maxLF1 = 150;
  1287. int minLF2 = 110;
  1288. int maxLF2 = 130;
  1289. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryComBaseTep", new object[] { urgM.Cells["PlineCode"].Text.ToString(), urgM.Cells["CraftRoute"].Text.ToString(), gradCode, "LF" }, ob);
  1290. if (dt.Rows.Count > 0)
  1291. {
  1292. minLF1 = int.Parse(dt.Rows[0]["DEVIATION_NO1"].ToString());
  1293. maxLF1 = int.Parse(dt.Rows[0]["DEVIATION_UN1"].ToString());
  1294. minLF2 = int.Parse(dt.Rows[0]["DEVIATION_NO2"].ToString());
  1295. maxLF2 = int.Parse(dt.Rows[0]["DEVIATION_NU2"].ToString());
  1296. }
  1297. EntityTep.StationCode = "LF";
  1298. EntityTep.TepVal1Min = (temperature + minLF1).ToString();
  1299. EntityTep.TepVal1Max = (temperature + maxLF1).ToString();
  1300. EntityTep.TepVal2Min = (temperature + minLF2).ToString();
  1301. EntityTep.TepVal2Max = (temperature + maxLF2).ToString();
  1302. EntityTep.TepVal = "";
  1303. listtep.Add(EntityTep);
  1304. //VD
  1305. int minRH1 = 75;
  1306. int maxRH1 = 95;
  1307. int minRH2 = 60;
  1308. int maxRH2 = 80;
  1309. DataTable dt1 = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryComBaseTep", new object[] { urgM.Cells["PlineCode"].Text.ToString(), urgM.Cells["CraftRoute"].Text.ToString(), gradCode, "RH" }, ob);
  1310. if (dt.Rows.Count > 0)
  1311. {
  1312. minRH1 = int.Parse(dt1.Rows[0]["DEVIATION_NO1"].ToString());
  1313. maxRH1 = int.Parse(dt1.Rows[0]["DEVIATION_UN1"].ToString());
  1314. minRH2 = int.Parse(dt1.Rows[0]["DEVIATION_NO2"].ToString());
  1315. maxRH2 = int.Parse(dt1.Rows[0]["DEVIATION_NU2"].ToString());
  1316. }
  1317. CraftLg2TemperatureEntity EntityTep1 = new entity.CraftLg2TemperatureEntity();
  1318. EntityTep1.StationCode = "RH";
  1319. EntityTep1.TepVal1Min = (temperature + minRH1).ToString();
  1320. EntityTep1.TepVal1Max = (temperature + maxRH1).ToString();
  1321. EntityTep1.TepVal2Min = (temperature + minRH2).ToString();
  1322. EntityTep1.TepVal2Max = (temperature + maxRH2).ToString();
  1323. EntityTep1.TepVal = "";
  1324. listtep.Add(EntityTep1);
  1325. }
  1326. else
  1327. {//LF
  1328. int minLF1 = 75;
  1329. int maxLF1 = 95;
  1330. int minLF2 = 60;
  1331. int maxLF2 = 80;
  1332. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryComBaseTep", new object[] { urgM.Cells["PlineCode"].Text.ToString(), urgM.Cells["CraftRoute"].Text.ToString(), gradCode, "LF" }, ob);
  1333. if (dt.Rows.Count > 0)
  1334. {
  1335. minLF1 = int.Parse(dt.Rows[0]["DEVIATION_NO1"].ToString());
  1336. maxLF1 = int.Parse(dt.Rows[0]["DEVIATION_UN1"].ToString());
  1337. minLF2 = int.Parse(dt.Rows[0]["DEVIATION_NO2"].ToString());
  1338. maxLF2 = int.Parse(dt.Rows[0]["DEVIATION_NU2"].ToString());
  1339. }
  1340. EntityTep.StationCode = "LF";
  1341. EntityTep.TepVal1Min = (temperature + minLF1).ToString();
  1342. EntityTep.TepVal1Max = (temperature + maxLF1).ToString();
  1343. EntityTep.TepVal2Min = (temperature + minLF2).ToString();
  1344. EntityTep.TepVal2Max = (temperature + maxLF2).ToString();
  1345. EntityTep.TepVal = "";
  1346. listtep.Add(EntityTep);
  1347. }
  1348. }
  1349. CraftLg2TemperatureEntity EntityTep2 = new entity.CraftLg2TemperatureEntity();
  1350. EntityTep2.StationCode = "CCM";
  1351. EntityTep2.TepVal = temperature.ToString();
  1352. listtep.Add(EntityTep2);
  1353. CraftLg2TemperatureEntitySource.DataSource = listtep;
  1354. foreach (UltraGridRow urg in ultraGridLhTem.Rows)
  1355. {
  1356. urg.Cells["CHC"].Value = true;
  1357. if (urg.Cells["StationCode"].Text.Equals("EAF"))
  1358. {
  1359. urg.Cells["TepVal1Min"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  1360. urg.Cells["TepVal1Max"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  1361. urg.Cells["TepVal2Min"].Appearance.BackColor = Color.Transparent;
  1362. urg.Cells["TepVal2Max"].Appearance.BackColor = Color.Transparent;
  1363. urg.Cells["TepVal"].Appearance.BackColor = Color.Transparent;
  1364. urg.Cells["TepVal1Min"].Activation = Activation.AllowEdit;
  1365. urg.Cells["TepVal1Max"].Activation = Activation.AllowEdit;
  1366. urg.Cells["TepVal1Min"].IgnoreRowColActivation = true;
  1367. urg.Cells["TepVal1Max"].IgnoreRowColActivation = true;
  1368. urg.Cells["TepVal2Min"].Activation = Activation.ActivateOnly;
  1369. urg.Cells["TepVal2Max"].Activation = Activation.ActivateOnly;
  1370. urg.Cells["TepVal"].Activation= Activation.ActivateOnly;
  1371. }
  1372. else if (urg.Cells["StationCode"].Text.Equals("CCM"))
  1373. {
  1374. urg.Cells["TepVal1Min"].Appearance.BackColor = Color.Transparent;
  1375. urg.Cells["TepVal1Max"].Appearance.BackColor = Color.Transparent;
  1376. urg.Cells["TepVal2Min"].Appearance.BackColor = Color.Transparent;
  1377. urg.Cells["TepVal2Max"].Appearance.BackColor = Color.Transparent;
  1378. urg.Cells["TepVal"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  1379. urg.Cells["TepVal1Min"].Activation = Activation.ActivateOnly;
  1380. urg.Cells["TepVal1Max"].Activation = Activation.ActivateOnly;
  1381. urg.Cells["TepVal2Min"].Activation = Activation.ActivateOnly;
  1382. urg.Cells["TepVal2Max"].Activation = Activation.ActivateOnly;
  1383. urg.Cells["TepVal"].Activation = Activation.AllowEdit;
  1384. urg.Cells["TepVal"].IgnoreRowColActivation = true;
  1385. }
  1386. else
  1387. {
  1388. urg.Cells["TepVal1Min"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  1389. urg.Cells["TepVal1Max"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  1390. urg.Cells["TepVal2Min"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  1391. urg.Cells["TepVal2Max"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  1392. urg.Cells["TepVal"].Appearance.BackColor = Color.Transparent;
  1393. urg.Cells["TepVal1Min"].Activation = Activation.AllowEdit;
  1394. urg.Cells["TepVal1Max"].Activation = Activation.AllowEdit;
  1395. urg.Cells["TepVal2Min"].Activation = Activation.AllowEdit;
  1396. urg.Cells["TepVal2Max"].Activation = Activation.AllowEdit;
  1397. urg.Cells["TepVal1Min"].IgnoreRowColActivation = true;
  1398. urg.Cells["TepVal1Max"].IgnoreRowColActivation = true;
  1399. urg.Cells["TepVal2Min"].IgnoreRowColActivation = true;
  1400. urg.Cells["TepVal2Max"].IgnoreRowColActivation = true;
  1401. urg.Cells["TepVal"].Activation = Activation.ActivateOnly;
  1402. }
  1403. }
  1404. #endregion
  1405. }
  1406. private void chcCraftNo_CheckedChanged(object sender, EventArgs e)
  1407. {
  1408. if (chcCraftNo.Checked) { comCraftNo.Enabled = true; } else { comCraftNo.Enabled = false; }
  1409. if (chcAPline.Checked) { comAPline.Enabled = true; } else { comAPline.Enabled = false; }
  1410. if (chcGrade.Checked) { comGrade.Enabled = true; } else { comGrade.Enabled = false; }
  1411. }
  1412. #region 事件
  1413. private void ultraGridLgTarCic_CellChange(object sender, CellEventArgs e)
  1414. {
  1415. int count = 0;
  1416. foreach (UltraGridRow urg in ultraGridLgM.Rows)
  1417. {
  1418. if (Convert.ToBoolean(urg.Cells["CHC"].Text) == true)
  1419. {
  1420. count++;
  1421. }
  1422. }
  1423. if (count == 0)
  1424. {
  1425. MessageUtil.ShowTips("请先勾选工艺卡主信息!"); return;
  1426. }
  1427. if (count >1)
  1428. {
  1429. MessageUtil.ShowTips("请勾选一个工艺卡主信息!"); return;
  1430. }
  1431. UltraGridRow row = ultraGridLgTarCic.ActiveRow;
  1432. if (row == null) return;
  1433. ultraGridLgTarCic.UpdateData();
  1434. #region 获取C,P上限
  1435. string Csteel = "";
  1436. string Psteel = "";
  1437. foreach (UltraGridRow urg in ultraGridLgCic.Rows)
  1438. {
  1439. CraftLg2TarCicEntity CraftLg2TarCicEntity = new entity.CraftLg2TarCicEntity();
  1440. double min = 0;
  1441. if (!urg.Cells["Stdmin"].Text.ToString().Equals(""))
  1442. {
  1443. min = double.Parse(urg.Cells["Stdmin"].Text.ToString());
  1444. }
  1445. double max = 0;
  1446. if (!urg.Cells["Stdmax"].Text.ToString().Equals(""))
  1447. {
  1448. max = double.Parse(urg.Cells["Stdmax"].Text.ToString());
  1449. }
  1450. if (urg.Cells["ChemName"].Text.ToString().Equals("C"))
  1451. {
  1452. if (min >= 0.20)
  1453. {
  1454. Csteel = (min - 0.10).ToString();
  1455. }
  1456. else if (0.10 <= min && min < 0.15)
  1457. {
  1458. Csteel = "0.07";
  1459. }
  1460. else if (0.15 <= min && min < 0.20)
  1461. {
  1462. Csteel = "0.09";
  1463. }
  1464. else if (min < 0.1)
  1465. {
  1466. Csteel = "0.06";
  1467. }
  1468. }
  1469. if (urg.Cells["ChemName"].Text.ToString().Equals("P"))
  1470. {
  1471. if (max >= 0.015)
  1472. {
  1473. Psteel = (max - 0.005).ToString();
  1474. }
  1475. else if (0.10 <= max && max < 0.015)
  1476. {
  1477. Psteel = "0.007";
  1478. }
  1479. else if (max < 0.010)
  1480. {
  1481. Psteel = "0.006";
  1482. }
  1483. }
  1484. }
  1485. #endregion
  1486. if (e.Cell.Column.Key.Equals("ChemCode"))
  1487. {
  1488. e.Cell.Row.Cells["ChemCode"].Value = e.Cell.Value;
  1489. e.Cell.Row.Cells["ChemName"].Value = e.Cell.Text;
  1490. if (e.Cell.Row.Cells["StationCode"].Text.ToString().Equals("EAF"))
  1491. {
  1492. if (e.Cell.Row.Cells["ChemName"].Text.ToString().Equals("C"))
  1493. {
  1494. e.Cell.Row.Cells["Stdmax"].Value = Csteel;
  1495. e.Cell.Row.Cells["StdmaxSign"].Value = "<=";
  1496. }
  1497. else if (e.Cell.Row.Cells["ChemName"].Text.ToString().Equals("C"))
  1498. {
  1499. e.Cell.Row.Cells["Stdmax"].Value = Psteel;
  1500. e.Cell.Row.Cells["StdmaxSign"].Value = "<=";
  1501. }
  1502. }
  1503. }
  1504. listTarCic.Change((CraftLg2TarCicEntity)e.Cell.Row.ListObject);
  1505. }
  1506. /// <summary>
  1507. /// 工艺主信息新增事件
  1508. /// </summary>
  1509. /// <param name="sender"></param>
  1510. /// <param name="e"></param>
  1511. private void ultraGridLgM_AfterRowInsert(object sender, RowEventArgs e)
  1512. {
  1513. UltraGridRow row = ultraGridLgM.ActiveRow;
  1514. ultraGridLgM.UpdateData();
  1515. ////查询最大工艺卡号
  1516. //DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryMaxCraftNo", new object[] { gradCode }, ob);
  1517. DataTable dt1 = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryStdCic", new object[] { cic }, ob);
  1518. //if (dt.Rows.Count > 0)
  1519. //{
  1520. // row.Cells["CraftNo"].Value = dt.Rows[0]["CRAFT_NO"].ToString();
  1521. //}
  1522. if (dt1.Rows.Count > 0)
  1523. {
  1524. row.Cells["StdCodeNk"].Value = dt1.Rows[0]["STD_CODE"].ToString();
  1525. row.Cells["StdNameNk"].Value = dt1.Rows[0]["STD_NAME"].ToString();
  1526. row.Cells["StdVersion"].Value = dt1.Rows[0]["STD_VERSION"].ToString();
  1527. if (dt1.Rows[0]["STD_NAME"].ToString().Contains("NSYK") || cic.Contains(","))
  1528. {
  1529. row.Cells["CraftType"].Value = "B";
  1530. }
  1531. else
  1532. {
  1533. row.Cells["CraftType"].Value = "A";
  1534. }
  1535. }
  1536. //查询品名
  1537. DataTable dt2 = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryProdu", new object[] { furnaceNo ,flag}, ob);
  1538. if (dt2.Rows.Count> 0)
  1539. {
  1540. row.Cells["Produccode"].Value = dt2.Rows[0]["PRODUCCODE"].ToString();
  1541. row.Cells["Producname"].Value = dt2.Rows[0]["PRODUCNAME"].ToString();
  1542. }
  1543. row.Cells["GradeCode"].Value = gradCode;
  1544. row.Cells["GradeName"].Value = gradName;
  1545. row.Cells["PlineCode"].Value = plineCodeA;
  1546. row.Cells["PlineName"].Value = plineNameA;
  1547. row.Cells["CraftRoute"].Value = planRoute;
  1548. //row.Cells["Cic"].Value = row.Cells["CIC"].Text.ToString();
  1549. row.Cells["MarkMan"].Value = this.UserInfo.GetUserName();
  1550. if (flag == "2")
  1551. {
  1552. UltraComboEditor ucePath = new UltraComboEditor();
  1553. e.Row.Cells["CraftRoute"].EditorComponent = ucePath;
  1554. e.Row.Cells["CraftRoute"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  1555. e.Row.Cells["CraftRoute"].IgnoreRowColActivation = true;
  1556. ValueList vlistSteel = new ValueList(); ;
  1557. vlistSteel.ValueListItems.Insert(0, "ELC", "ELC");
  1558. vlistSteel.ValueListItems.Insert(1, "ELVC", "ELVC");
  1559. vlistSteel.ValueListItems.Insert(2, "ELRC", "ELRC");
  1560. vlistSteel.ValueListItems.Insert(3, "ELVI", "ELVI");
  1561. vlistSteel.ValueListItems.Insert(4, "RLRI", "RLRI");
  1562. e.Row.Cells["CraftRoute"].ValueList = vlistSteel;
  1563. e.Row.Cells["CraftRoute"].Activation = Activation.AllowEdit;
  1564. e.Row.Cells["CraftRoute"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  1565. e.Row.Cells["PlineCode"].IgnoreRowColActivation = true;
  1566. e.Row.Cells["PlineCode"].Activation = Activation.AllowEdit;
  1567. e.Row.Cells["PlineCode"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  1568. }
  1569. }
  1570. private void ultraGridLgM_AfterRowActivate(object sender, EventArgs e)
  1571. {
  1572. UltraGridRow row = ultraGridLgM.ActiveRow;
  1573. if (row == null) return;
  1574. if (row.Cells["CicGid"].Text.ToString().Equals(""))
  1575. {
  1576. //if (flag.Equals("1"))
  1577. //{
  1578. // ultraExpandableGroupBox2.Visible = false;
  1579. // if (cic.Split(',').Length > 1)
  1580. // {
  1581. // queryOrdDesigJJCic();
  1582. // }
  1583. // else
  1584. // {
  1585. // queryOrdDesigStdCic();
  1586. // }
  1587. //}
  1588. //else
  1589. //{
  1590. ultraExpandableGroupBox2.Expanded = true;
  1591. queryOrdDesigCic(row.Cells["Cic"].Text.ToString());
  1592. //}
  1593. }
  1594. else {
  1595. queryOrdDesigCic(row.Cells["Cic"].Text.ToString());
  1596. ultraExpandableGroupBox2.Expanded = false;
  1597. QueryLgCic(row.Cells["CicGid"].Text.ToString());
  1598. }
  1599. QueryLgTarCic(row.Cells["TarCicGid"].Text.ToString());
  1600. QueryLgCcm(row.Cells["CcmGid"].Text.ToString());
  1601. QueryLgtTem(row.Cells["TepGid"].Text.ToString());
  1602. if (Convert.ToBoolean(row.Cells["CHC"].Text)==true)
  1603. {
  1604. ultraTabControl1.Enabled = true;
  1605. }
  1606. else
  1607. {
  1608. ultraTabControl1.Enabled = false;
  1609. }
  1610. //合金配置为空是根据钢种获取
  1611. if (row.Cells["AlloyGid"].Text.ToString().Equals(""))
  1612. {
  1613. listHj = EntityHelper.GetData<CraftLg2AlloyEntity>
  1614. ("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryLgtHjGrae", new object[] { gradCode,"" }, ob);
  1615. listHj.AcceptChanges();
  1616. CraftLg2AlloyEntityBindingSource.DataSource = listHj;
  1617. foreach (UltraGridRow urg in ultraGridhJ.Rows)
  1618. {
  1619. urg.Cells["CHC"].Value = true;
  1620. }
  1621. }
  1622. else
  1623. {
  1624. QueryLgHj(row.Cells["AlloyGid"].Text.ToString());
  1625. }
  1626. }
  1627. private void ultraGridLgM_BeforeRowDeactivate(object sender, CancelEventArgs e)
  1628. {
  1629. if (listCic.IsChanged)
  1630. {
  1631. if (MessageUtil.ShowYesNoAndQuestion("是否放弃成分CIC编辑?") == DialogResult.No)
  1632. {
  1633. e.Cancel = true;
  1634. }
  1635. }
  1636. if (listTarCic != null)
  1637. {
  1638. if (listTarCic.IsChanged)
  1639. {
  1640. if (MessageUtil.ShowYesNoAndQuestion("是否放弃目标成分CIC编辑?") == DialogResult.No)
  1641. {
  1642. e.Cancel = true;
  1643. }
  1644. }
  1645. }
  1646. if (listCcm != null)
  1647. {
  1648. if (listCcm.IsChanged)
  1649. {
  1650. if (MessageUtil.ShowYesNoAndQuestion("是否放弃CCM编辑?") == DialogResult.No)
  1651. {
  1652. e.Cancel = true;
  1653. }
  1654. }
  1655. }
  1656. if (listTem != null)
  1657. {
  1658. if (listTem.IsChanged)
  1659. {
  1660. if (MessageUtil.ShowYesNoAndQuestion("是否放弃温度编辑?") == DialogResult.No)
  1661. {
  1662. e.Cancel = true;
  1663. }
  1664. }
  1665. }
  1666. if (listHj != null)
  1667. {
  1668. if (listHj.IsChanged)
  1669. {
  1670. if (MessageUtil.ShowYesNoAndQuestion("是否放弃合金配置编辑?") == DialogResult.No)
  1671. {
  1672. e.Cancel = true;
  1673. }
  1674. }
  1675. }
  1676. }
  1677. private void ultraGridLgCic_CellChange(object sender, CellEventArgs e)
  1678. {
  1679. int count = 0;
  1680. /*foreach (UltraGridRow urg in ultraGridLgM.Rows)
  1681. {
  1682. if (Convert.ToBoolean(urg.Cells["CHC"].Text) == true)
  1683. {
  1684. count++;
  1685. }
  1686. }
  1687. if (count == 0)
  1688. {
  1689. MessageUtil.ShowTips("请先勾选工艺卡主信息!"); return;
  1690. }
  1691. if (count > 1)
  1692. {
  1693. MessageUtil.ShowTips("请勾选一个工艺卡主信息!"); return;
  1694. }*/
  1695. ultraGridLgCic.UpdateData();
  1696. if (e.Cell.Column.Key == "ChemCode")
  1697. {
  1698. DataTable dt1 = uceCicAll.DataSource as DataTable;
  1699. if (dt1 != null)
  1700. {
  1701. DataRow dr = dt1.AsEnumerable().FirstOrDefault(p => p["CHEM_CODE"] == e.Cell.Value);
  1702. if (dr != null)
  1703. {
  1704. e.Cell.Row.Cells["ChemType"].Value = dr["CHEM_TYPE"] is DBNull ? "" : dr["CHEM_TYPE"];
  1705. e.Cell.Row.Cells["ChemFormula"].Value = dr["CHEM_FORMULA"] is DBNull ? "" : dr["CHEM_FORMULA"];
  1706. e.Cell.Row.Cells["ChemName"].Value = dr["CHEM_NAME"] is DBNull ? "" : dr["CHEM_NAME"];
  1707. }
  1708. }
  1709. }
  1710. UltraGridRow row = ultraGridLgCic.ActiveRow;
  1711. if (row == null) return;
  1712. if (listCic!=null)
  1713. {
  1714. listCic.Change((CraftLg2CicEntity)e.Cell.Row.ListObject);
  1715. }
  1716. //string oldStdMax = row.Cells["Stdmax"].Text.ToString();
  1717. //if (e.Cell.Column.Key.Equals("Stdmin"))
  1718. //{
  1719. // string oldStdMin = "";
  1720. // foreach (CraftLg2CicEntity entity in listCic)
  1721. // {
  1722. // if (entity.ChemName.Equals(e.Cell.Row.Cells["ChemName"].Text.ToString()))
  1723. // {
  1724. // oldStdMin = row.Cells["Stdmin"].Text.ToString();
  1725. // break;
  1726. // }
  1727. // }
  1728. // string actCountMin = e.Cell.Row.Cells["Stdmin"].Text.ToString();
  1729. // if (actCountMin != null && !StringUtil.IsFloat(actCountMin))
  1730. // {
  1731. // MessageUtil.ShowTips("请输入数字类型!");
  1732. // row.Cells["Stdmin"].Value = "";
  1733. // return;
  1734. // }
  1735. // else
  1736. // {
  1737. // if (double.Parse(actCountMin) < double.Parse(oldStdMin))
  1738. // {
  1739. // MessageUtil.ShowTips("输入标准下限不能小于原标准下限!");
  1740. // row.Cells["Stdmin"].Value = oldStdMin;
  1741. // return;
  1742. // }
  1743. // else
  1744. // {
  1745. // row.Cells["Stdmin"].Value = actCountMin;
  1746. // }
  1747. // }
  1748. //}
  1749. //if (e.Cell.Column.Key.Equals("Stdmax"))
  1750. //{
  1751. // string actCountMax = e.Cell.Row.Cells["Stdmax"].Text.ToString();
  1752. // if (actCountMax != null && !StringUtil.IsFloat(actCountMax))
  1753. // {
  1754. // MessageUtil.ShowTips("请输入数字类型!");
  1755. // row.Cells["Stdmin"].Value = "";
  1756. // return;
  1757. // }
  1758. // else
  1759. // {
  1760. // if (double.Parse(actCountMax) > double.Parse(oldStdMax))
  1761. // {
  1762. // MessageUtil.ShowTips("输入标准上限不能大于原标准上限!");
  1763. // row.Cells["Stdmax"].Value = oldStdMax;
  1764. // return;
  1765. // }
  1766. // else
  1767. // {
  1768. // row.Cells["Stdmax"].Value = actCountMax;
  1769. // }
  1770. // }
  1771. //}
  1772. }
  1773. private void ultraGridLgCcm_CellChange(object sender, CellEventArgs e)
  1774. {
  1775. int count = 0;
  1776. foreach (UltraGridRow urg in ultraGridLgM.Rows)
  1777. {
  1778. if (Convert.ToBoolean(urg.Cells["CHC"].Text) == true)
  1779. {
  1780. count++;
  1781. }
  1782. }
  1783. if (count == 0)
  1784. {
  1785. MessageUtil.ShowTips("请先勾选工艺卡主信息!"); return;
  1786. }
  1787. if (count > 1)
  1788. {
  1789. MessageUtil.ShowTips("请勾选一个工艺卡主信息!"); return;
  1790. }
  1791. UltraGridRow row = ultraGridLgCcm.ActiveRow;
  1792. if (row == null) return;
  1793. ultraGridLgCcm.UpdateData();
  1794. string ccmName = "";
  1795. if (e.Cell.Column.Key.Equals("CcmCode"))
  1796. {
  1797. if (!e.Cell.Row.Cells["CcmCode"].Text.ToString().Equals(""))
  1798. {
  1799. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryComBaseCcm", new object[] { plineCodeB, gradCode, cic }, ob);
  1800. if (dt.Rows.Count> 0)
  1801. {
  1802. e.Cell.Row.Cells["Diameter"].Value = dt.Rows[0]["直径"].ToString();
  1803. e.Cell.Row.Cells["WaterNo"].Value = dt.Rows[0]["水表号"].ToString();
  1804. e.Cell.Row.Cells["CoolingVal"].Value = dt.Rows[0]["冷却强度"].ToString();
  1805. }
  1806. int counntcm = 0;
  1807. foreach (UltraGridRow rows in ultraGridLgCcm.Rows)
  1808. {
  1809. if (ccmName.Equals(""))
  1810. {
  1811. ccmName = e.Cell.Row.Cells["CcmCode"].Value.ToString();
  1812. }
  1813. if (ccmName.Equals(rows.Cells["CcmCode"].Text.ToString()) && !ccmName.Equals(""))
  1814. {
  1815. counntcm++;
  1816. }
  1817. }
  1818. if (counntcm > 1)
  1819. {
  1820. MessageUtil.ShowTips("存在相同水表数据!");
  1821. e.Cell.Row.Cells["Diameter"].Value = "";
  1822. e.Cell.Row.Cells["WaterNo"].Value = "";
  1823. e.Cell.Row.Cells["CoolingVal"].Value = "";
  1824. e.Cell.Row.Cells["CcmCode"].Value = "";
  1825. return;
  1826. }
  1827. }
  1828. }
  1829. if (listCcm!=null)
  1830. {
  1831. listCcm.Change((CraftLg2CcmEntity)e.Cell.Row.ListObject);
  1832. }
  1833. }
  1834. private void ultraGridLhTem_CellChange(object sender, CellEventArgs e)
  1835. { int count = 0;
  1836. foreach (UltraGridRow urg in ultraGridLgM.Rows)
  1837. {
  1838. if (Convert.ToBoolean(urg.Cells["CHC"].Text) == true)
  1839. {
  1840. count++;
  1841. }
  1842. }
  1843. if (count == 0)
  1844. {
  1845. MessageUtil.ShowTips("请先勾选工艺卡主信息!"); return;
  1846. }
  1847. if (count >1)
  1848. {
  1849. MessageUtil.ShowTips("请勾选一个工艺卡主信息!"); return;
  1850. }
  1851. UltraGridRow row = ultraGridLhTem.ActiveRow;
  1852. if (row == null) return;
  1853. ultraGridLhTem.UpdateData();
  1854. if (e.Cell.Column.Key.Equals("StationCode"))
  1855. {
  1856. if (e.Cell.Row.Cells["StationCode"].Text.Equals("EAF"))
  1857. {
  1858. e.Cell.Row.Cells["TepVal1Min"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  1859. e.Cell.Row.Cells["TepVal1Max"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  1860. e.Cell.Row.Cells["TepVal2Min"].Appearance.BackColor = Color.Transparent;
  1861. e.Cell.Row.Cells["TepVal2Max"].Appearance.BackColor = Color.Transparent;
  1862. e.Cell.Row.Cells["TepVal"].Appearance.BackColor = Color.Transparent;
  1863. e.Cell.Row.Cells["TepVal1Min"].Activation = Activation.AllowEdit;
  1864. e.Cell.Row.Cells["TepVal1Max"].Activation = Activation.AllowEdit;
  1865. e.Cell.Row.Cells["TepVal1Min"].IgnoreRowColActivation = true;
  1866. e.Cell.Row.Cells["TepVal1Max"].IgnoreRowColActivation = true;
  1867. e.Cell.Row.Cells["TepVal2Min"].Activation = Activation.ActivateOnly;
  1868. e.Cell.Row.Cells["TepVal2Max"].Activation = Activation.ActivateOnly;
  1869. e.Cell.Row.Cells["TepVal"].Activation = Activation.ActivateOnly;
  1870. }
  1871. else if (e.Cell.Row.Cells["StationCode"].Text.Equals("CCM"))
  1872. {
  1873. e.Cell.Row.Cells["TepVal1Min"].Appearance.BackColor = Color.Transparent;
  1874. e.Cell.Row.Cells["TepVal1Max"].Appearance.BackColor = Color.Transparent;
  1875. e.Cell.Row.Cells["TepVal2Min"].Appearance.BackColor = Color.Transparent;
  1876. e.Cell.Row.Cells["TepVal2Max"].Appearance.BackColor = Color.Transparent;
  1877. e.Cell.Row.Cells["TepVal"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  1878. e.Cell.Row.Cells["TepVal1Min"].Activation = Activation.ActivateOnly;
  1879. e.Cell.Row.Cells["TepVal1Max"].Activation = Activation.ActivateOnly;
  1880. e.Cell.Row.Cells["TepVal2Min"].Activation = Activation.ActivateOnly;
  1881. e.Cell.Row.Cells["TepVal2Max"].Activation = Activation.ActivateOnly;
  1882. e.Cell.Row.Cells["TepVal"].Activation = Activation.AllowEdit;
  1883. e.Cell.Row.Cells["TepVal"].IgnoreRowColActivation = true;
  1884. }
  1885. else
  1886. {
  1887. e.Cell.Row.Cells["TepVal1Min"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  1888. e.Cell.Row.Cells["TepVal1Max"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  1889. e.Cell.Row.Cells["TepVal2Min"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  1890. e.Cell.Row.Cells["TepVal2Max"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  1891. e.Cell.Row.Cells["TepVal"].Appearance.BackColor = Color.Transparent;
  1892. e.Cell.Row.Cells["TepVal1Min"].Activation = Activation.AllowEdit;
  1893. e.Cell.Row.Cells["TepVal1Max"].Activation = Activation.AllowEdit;
  1894. e.Cell.Row.Cells["TepVal2Min"].Activation = Activation.AllowEdit;
  1895. e.Cell.Row.Cells["TepVal2Max"].Activation = Activation.AllowEdit;
  1896. e.Cell.Row.Cells["TepVal1Min"].IgnoreRowColActivation = true;
  1897. e.Cell.Row.Cells["TepVal1Max"].IgnoreRowColActivation = true;
  1898. e.Cell.Row.Cells["TepVal2Min"].IgnoreRowColActivation = true;
  1899. e.Cell.Row.Cells["TepVal2Max"].IgnoreRowColActivation = true;
  1900. e.Cell.Row.Cells["TepVal"].Activation = Activation.ActivateOnly;
  1901. }
  1902. int count1 = 0;
  1903. foreach (UltraGridRow urg in ultraGridLhTem.Rows)
  1904. {
  1905. if (e.Cell.Row.Cells["StationCode"].Text.Equals(urg.Cells["StationCode"].Text.ToString()))
  1906. {
  1907. count1++;
  1908. if (count1 > 1)
  1909. {
  1910. MessageUtil.ShowTips("一个工艺卡下对应的工序点不能重复!");
  1911. e.Cell.Row.Cells["StationCode"].Value = null;
  1912. return;
  1913. }
  1914. }
  1915. }
  1916. }
  1917. //计算温度
  1918. if (e.Cell.Column.Key.Equals("TepVal"))
  1919. {
  1920. if (e.Cell.Row.Cells["StationCode"].Text.Equals("CCM"))
  1921. {
  1922. doCalculate(int.Parse(e.Cell.Row.Cells["TepVal"].Value.ToString()));
  1923. }
  1924. }
  1925. if (listTem != null && listTem.Count!=0)
  1926. {
  1927. listTem.Change((CraftLg2TemperatureEntity)e.Cell.Row.ListObject);
  1928. }
  1929. }
  1930. private void ultraGridLgM_CellChange(object sender, CellEventArgs e)
  1931. {
  1932. UltraGridRow ugr=ultraGridLgM.ActiveRow;
  1933. if (ugr == null) return;
  1934. ultraGridLgM.UpdateData();
  1935. if (e.Cell.Column.Key.Equals("Produccode"))
  1936. {
  1937. e.Cell.Row.Cells["Produccode"].Value = e.Cell.Value.ToString();
  1938. e.Cell.Row.Cells["Producname"].Value = e.Cell.Text;
  1939. }
  1940. if (Convert.ToBoolean(e.Cell.Row.Cells["CHC"].Text) == true)
  1941. {
  1942. ultraTabControl1.Enabled = true;
  1943. }
  1944. else
  1945. {
  1946. ultraTabControl1.Enabled = false;
  1947. }
  1948. }
  1949. private void ultraGridhJ_CellChange(object sender, CellEventArgs e)
  1950. {
  1951. UltraGridRow row = ultraGridhJ.ActiveRow;
  1952. if (row == null) return;
  1953. ultraGridhJ.UpdateData();
  1954. if (e.Cell.Column.Key.Equals("ItemCode"))
  1955. {
  1956. if (!e.Cell.Row.Cells["ItemCode"].Text.ToString().Equals(""))
  1957. {
  1958. e.Cell.Row.Cells["ItemCode"].Value = e.Cell.Value.ToString();
  1959. e.Cell.Row.Cells["ItemName"].Value = e.Cell.Text.ToString();
  1960. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard.queryLgtHjGrae", new object[] { gradCode, e.Cell.Value.ToString() }, ob);
  1961. if (dt.Rows.Count > 0)
  1962. {
  1963. e.Cell.Row.Cells["InputAmount"].Value = dt.Rows[0]["INPUT_AMOUNT"].ToString();
  1964. }
  1965. else
  1966. {
  1967. e.Cell.Row.Cells["InputAmount"].Value = "0";
  1968. }
  1969. }
  1970. int count = 0;
  1971. foreach (UltraGridRow urg in ultraGridhJ.Rows)
  1972. {
  1973. if (e.Cell.Row.Cells["ItemCode"].Value.Equals(urg.Cells["ItemCode"].Value.ToString()))
  1974. {
  1975. count++;
  1976. if (count > 1)
  1977. {
  1978. MessageUtil.ShowTips("一个工艺卡下对应的合金物料不能重复!");
  1979. e.Cell.Row.Cells["ItemCode"].Value = null;
  1980. e.Cell.Row.Cells["ItemName"].Value = null;
  1981. e.Cell.Row.Cells["InputAmount"].Value = null;
  1982. return;
  1983. }
  1984. }
  1985. }
  1986. }
  1987. if (listHj != null)
  1988. {
  1989. listHj.Change((CraftLg2AlloyEntity)e.Cell.Row.ListObject);
  1990. }
  1991. }
  1992. #endregion
  1993. private DataTable _data1;
  1994. private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
  1995. {
  1996. UltraGridRow row = ultraGrid2.ActiveRow;
  1997. if (row == null) return;
  1998. ultraGrid2.UpdateData();
  1999. _data1 = SteelHelper.GetNewDataTable(dtCicAll, "CIC='" + row.Cells["CIC"].Text.ToString() + "'", "CHEMCODE ASC");
  2000. //_data1 = dataTable2.AsEnumerable().Where(p => p["CIC"] == row.Cells["CIC"].Text.ToString()).ConvertToDataTable();
  2001. listCic =SteelHelper.GetModelByDt<CraftLg2CicEntity>(_data1);
  2002. listCic.AcceptChanges();
  2003. CraftLg2CicEntityBindingSource.DataSource = listCic;
  2004. int count=1;
  2005. foreach (UltraGridRow urg in ultraGridLgCic.Rows)
  2006. {
  2007. urg.Cells["CHC"].Value = true;
  2008. urg.Cells["Xh"].Value = (decimal)count++;
  2009. }
  2010. queryComBaseCcm(row.Cells["CIC"].Text.ToString());
  2011. //ultraGrid2.Refresh();
  2012. //ultraGrid2.Update();
  2013. }
  2014. private void ultraGridLgM_InitializeRow(object sender, InitializeRowEventArgs e)
  2015. {
  2016. CraftLg2MEntity CraftLg2MEntity = e.Row.ListObject as CraftLg2MEntity;
  2017. if (CraftLg2MEntity != null && CraftLg2MEntity.Defaultcraft != "1" && CraftLg2MEntity.Defaultcraft != "默认")
  2018. {
  2019. e.Row.Cells["Defaultcraft"].IgnoreRowColActivation = true;
  2020. e.Row.Cells["Defaultcraft"].EditorComponent = setDefault;
  2021. }
  2022. }
  2023. private void setDefault_EditorButtonClick(object sender, EditorButtonEventArgs e)
  2024. {
  2025. string craftNo = ultraGridLgM.ActiveRow.Cells["CraftNo"].Text.ToString();
  2026. if (craftNo.Equals(""))
  2027. {
  2028. MessageUtil.ShowTips("您选择炼钢工艺卡号未生成,请先保存!");
  2029. return;
  2030. }
  2031. CoreClientParam ccp = new CoreClientParam();
  2032. ccp.ServerName = "com.steering.pss.plnsaleord.steelMarkingPlan.FrmSteelProcessCard";
  2033. ccp.MethodName = "doSetDefault";
  2034. ccp.ServerParams = new object[] { cic, craftNo, plineCodeA, gradCode, planRoute };
  2035. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  2036. if (ccp.ReturnCode == -1) return;
  2037. MessageUtil.ShowTips(ccp.ReturnInfo);
  2038. if (ccp.ReturnInfo.Equals("设置成功!"))
  2039. {
  2040. QueryM();
  2041. }
  2042. }
  2043. private void ultraGridLgCic_AfterRowInsert(object sender, RowEventArgs e)
  2044. {
  2045. e.Row.Cells["Newflag"].Value = "1";
  2046. e.Row.Cells["Xh"].Value = (decimal)(e.Row.Index + 1);
  2047. e.Row.Cells["CicGid"].Value = ultraGridLgM.ActiveRow.Cells["CicGid"].Value;
  2048. }
  2049. private void ultraGridLgCic_InitializeRow(object sender, InitializeRowEventArgs e)
  2050. {
  2051. if (e.Row.Cells["Newflag"].Value.ToString() == "1")
  2052. {
  2053. e.Row.Cells["ChemCode"].Activation = Activation.AllowEdit;
  2054. e.Row.Cells["ChemCode"].IgnoreRowColActivation = true;
  2055. e.Row.Cells["ChemCode"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  2056. e.Row.Cells["BIscheck"].Activation = Activation.AllowEdit;
  2057. e.Row.Cells["BIscheck"].IgnoreRowColActivation = true;
  2058. e.Row.Cells["BIscheck"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  2059. e.Row.Cells["BIsjudge"].Activation = Activation.AllowEdit;
  2060. e.Row.Cells["BIsjudge"].IgnoreRowColActivation = true;
  2061. e.Row.Cells["BIsjudge"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  2062. e.Row.Cells["BIsquote"].Activation = Activation.AllowEdit;
  2063. e.Row.Cells["BIsquote"].IgnoreRowColActivation = true;
  2064. e.Row.Cells["BIsquote"].Appearance.BackColor = Color.FromArgb(255, 255, 128);
  2065. e.Row.Cells["Xh"].Style = ColumnStyle.EditButton;
  2066. }
  2067. }
  2068. private void ultraGridLgCic_ClickCellButton(object sender, CellEventArgs e)
  2069. {
  2070. e.Cell.Row.Delete(false);
  2071. }
  2072. private void utlCopy_EditorButtonClick(object sender, EditorButtonEventArgs e)
  2073. {
  2074. using (FrmSteelProcessSelect FrmSteelProcessSelect = new FrmSteelProcessSelect(ultraGrid2.ActiveRow.Cells[0].Text,ob))
  2075. {
  2076. if (FrmSteelProcessSelect.ShowDialog() == DialogResult.OK)
  2077. {
  2078. QueryLgCic(FrmSteelProcessSelect.CraftLg2MEntity.CicGid);
  2079. }
  2080. }
  2081. }
  2082. private void ultraGrid2_InitializeRow(object sender, InitializeRowEventArgs e)
  2083. {
  2084. if (e.Row.Cells[0].Text != "" && !e.Row.Cells[0].Text.Contains(","))
  2085. {
  2086. e.Row.Cells[0].EditorComponent = utlCopy;
  2087. e.Row.Cells[0].IgnoreRowColActivation = true;
  2088. }
  2089. }
  2090. }
  2091. }