PipSawFast.cs 93 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821
  1. using com.steering.mes.zgmil.entity;
  2. using Core.Mes.Client.Comm.Control;
  3. using Core.Mes.Client.Comm.Server;
  4. using Core.Mes.Client.Comm.Tool;
  5. using Core.StlMes.Client.ZGMil.Result;
  6. using CoreFS.CA06;
  7. using Infragistics.Win;
  8. using Infragistics.Win.UltraWinGrid;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.ComponentModel;
  12. using System.Data;
  13. using System.Drawing;
  14. using System.Linq;
  15. using System.Text;
  16. using System.Windows.Forms;
  17. namespace Core.StlMes.Client.ZGMil.NodeResultQuery
  18. {
  19. public partial class PipSawFast : FrmBase
  20. {
  21. private OpeBase _ob;
  22. public OpeBase Ob
  23. {
  24. get { return _ob; }
  25. set { _ob = value; }
  26. }
  27. private Infragistics.Win.UltraWinGrid.UltraGrid _grid = null;
  28. public Infragistics.Win.UltraWinGrid.UltraGrid Grid
  29. {
  30. get { return _grid; }
  31. }
  32. private MilSawResultDeatilEntity milsawdeatail = new MilSawResultDeatilEntity();
  33. private string PlinCode = "";
  34. private string HeatNo = "";
  35. private string proPlanId = "";//轧管订单编号
  36. private string gxPlanNo = "";//工序排产序号
  37. private string OrderLength = "";
  38. private string HeadLength = "";
  39. private string TailLengeh = "";
  40. private string lotno = "";
  41. private string stoveno = "";
  42. private int SAW_NUM = 0;
  43. private int checktotalnum = 0;
  44. private int checktotalnumhas = 0;
  45. public bool isRefresh = false;
  46. private string saw11 = "";//锯的选择
  47. private string saw12 = "";
  48. private string saw21 = "";
  49. private string saw22 = "";
  50. private string saw211 = "";
  51. private string saw212 = "";
  52. private string saw221 = "";
  53. private string saw222 = "";
  54. private string colno1 = "";//台号选择
  55. private string colno2 = "";
  56. private string colno3 = "";
  57. private int lastnum = 0;//最后一排支数
  58. private int rowcounts = 0;//拍支数
  59. //public PipSawFast()
  60. //{
  61. // InitializeComponent();
  62. // GridHelper.InitCardGrid(PipeSawDataSource, ultraGrid2);
  63. //}
  64. public PipSawFast(OpeBase ob, string PlinCode, string HeatNo, String ProPlanId, String GxPlanNo, string OrderLength, string HeadLength, string TailLengeh, string lotno, string stoveno, int SAW_NUM, string CUT_HEAD_LENGTHA, string CUT_TRAIL_LENGTHA, string ORDER_LENGTHA)
  65. {
  66. InitializeComponent();
  67. this.ultraGrid2.UpdateData();
  68. GridHelper.InitCardGrid(PipeSawDataSource, ultraGrid2);
  69. _grid = this.ultraGrid2;
  70. this.Ob = ob;
  71. this.PlinCode = PlinCode;
  72. this.HeatNo = HeatNo;
  73. this.proPlanId = ProPlanId;
  74. this.gxPlanNo = GxPlanNo;
  75. this.OrderLength = OrderLength;
  76. this.HeadLength = HeadLength;
  77. this.TailLengeh = TailLengeh;
  78. this.lotno = lotno;
  79. this.stoveno = stoveno;
  80. this.SAW_NUM = SAW_NUM;
  81. // GridHelper.InitCardGrid(PipeSawDataSource, ultraGrid2);
  82. this.ultraGrid2.Rows[0].Cells["btnCUT"].Value = "快速分切";
  83. this.ultraGrid2.Rows[0].Cells["btnCUTHEAD"].Value = "快速切头";
  84. this.ultraGrid2.Rows[0].Cells["btnCUTORDER"].Value = "快速切定尺";
  85. this.ultraGrid2.Rows[0].Cells["btnCUTTAIL"].Value = "快速切尾";
  86. this.ultraGrid2.Rows[0].Cells["btnCUTEND"].Value = "分切结束";
  87. //Infragistics.Win.ValueList valueList1 = new Infragistics.Win.ValueList();
  88. //valueList1.ValueListItems.Add("1");
  89. //valueList1.ValueListItems.Add("2");
  90. //this.ultraGrid2.Rows[0].Cells["SAW_NO"].ValueList = valueList1;
  91. //this.ultraGrid2.Rows[0].Cells["SAW_NO"].Value = "1";
  92. //Infragistics.Win.ValueList valueList2 = new Infragistics.Win.ValueList();
  93. //valueList2.ValueListItems.Add("0");
  94. //valueList2.ValueListItems.Add("3");
  95. //valueList2.ValueListItems.Add("4");
  96. //this.ultraGrid2.Rows[0].Cells["SAW_NO_N"].ValueList = valueList2;
  97. //this.ultraGrid2.Rows[0].Cells["SAW_NO_N"].Value = "3";
  98. //Infragistics.Win.ValueList valueList3 = new Infragistics.Win.ValueList();
  99. //valueList3.ValueListItems.Add("1#台");
  100. //valueList3.ValueListItems.Add("2#台");
  101. //if (PlinCode.Equals("C010"))//168产线三个矫直切台
  102. //{
  103. // valueList3.ValueListItems.Add("3#台");
  104. //}
  105. //this.ultraGrid2.Rows[0].Cells["COL_NO1"].ValueList = valueList3;
  106. //this.ultraGrid2.Rows[0].Cells["COL_NO1"].Value = "1";
  107. if (!PlinCode.Equals("C010"))//168产线三个矫直切台
  108. {
  109. this.ultraGrid2.DisplayLayout.Bands[0].Columns["COL_NO31"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled;
  110. this.ultraGrid2.DisplayLayout.Bands[0].Columns["COL_NO32"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled;
  111. }
  112. //else
  113. //{
  114. // if (SAW_NUM > 5)
  115. // {
  116. // this.ultraGrid2.DisplayLayout.Bands[0].Columns["COL_NO31"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  117. // }
  118. // else
  119. // {
  120. // this.ultraGrid2.DisplayLayout.Bands[0].Columns["COL_NO31"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled;
  121. // }
  122. //}
  123. if (PlinCode.Equals("C010") || PlinCode.Equals("C009") || PlinCode.Equals("C012")||PlinCode.Equals("C008"))//168,258,Assel机组
  124. {
  125. this.ultraGrid2.Rows[0].Cells["SAW2"].Column.Header.Caption = "2#锯";
  126. this.ultraGrid2.Rows[0].Cells["SAW41"].Column.Header.Caption = "4#锯";
  127. }
  128. else
  129. {
  130. this.ultraGrid2.Rows[0].Cells["SAW2"].Column.Header.Caption = "4#锯";
  131. this.ultraGrid2.Rows[0].Cells["SAW41"].Column.Header.Caption = "2#锯";
  132. }
  133. this.ultraGrid2.Rows[0].Cells["COL_NO11"].Value = "True";
  134. this.ultraGrid2.Rows[0].Cells["COL_NO21"].Value = "True";
  135. this.ultraGrid2.Rows[0].Cells["COL_NO31"].Value = "False";
  136. this.ultraGrid2.Rows[0].Cells["SAW1"].Value = "True";
  137. this.saw11 = "1";
  138. this.ultraGrid2.Rows[0].Cells["SAW2"].Value = "False";
  139. this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "True";
  140. this.saw21 = "3";
  141. this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "False";
  142. //this.ultraGrid2.Rows[0].Cells["SAW32"].Value = "False";
  143. //this.ultraGrid2.Rows[0].Cells["SAW42"].Value = "False";
  144. //this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW32"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled;
  145. //this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW42"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled;
  146. this.ultraGrid2.Rows[0].Cells["JUDGE_STOVE_NO"].Value = this.HeatNo;
  147. this.ultraGrid2.Rows[0].Cells["ORDER_LENGTH"].Value = this.OrderLength;
  148. this.ultraGrid2.Rows[0].Cells["CUT_HEAD_LENGTH"].Value = this.HeadLength;
  149. this.ultraGrid2.Rows[0].Cells["CUT_TRAIL_LENGTH"].Value = this.TailLengeh;
  150. this.ultraGrid2.Rows[0].Cells["JUDGE_STOVE_NO"].Value = this.HeatNo;
  151. this.ultraGrid2.Rows[0].Cells["CUT_HEAD_LENGTHA"].Value = CUT_HEAD_LENGTHA;
  152. this.ultraGrid2.Rows[0].Cells["CUT_TRAIL_LENGTHA"].Value = CUT_TRAIL_LENGTHA;
  153. this.ultraGrid2.Rows[0].Cells["ORDER_LENGTHA"].Value = ORDER_LENGTHA;
  154. }
  155. /// <summary>
  156. /// 加载界面初始化
  157. /// </summary>
  158. /// <param name="e"></param>
  159. protected override void OnShown(EventArgs e)
  160. {
  161. base.OnShown(e);
  162. ultraGrid2.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  163. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipSawFast.GetCountWithoutDel", new object[] { HeatNo, proPlanId, gxPlanNo }, this._ob);
  164. if (dt.Rows.Count > 0)
  165. {
  166. checktotalnum = int.Parse(dt.Rows[0]["counts"].ToString());
  167. }
  168. else
  169. {
  170. MessageBox.Show("炉号:【" + HeatNo + "】未开始上料锯切,或未开始分切,请确认后重新进行快速分切操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  171. //return;
  172. }
  173. DataTable dt2 = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipSawFast.GetCountHasSaw", new object[] { HeatNo, proPlanId, gxPlanNo }, this._ob);
  174. if (dt2.Rows.Count > 0)
  175. {
  176. checktotalnumhas = int.Parse(dt2.Rows[0]["counts"].ToString());
  177. }
  178. this.ultraGrid2.Rows[0].Cells["TotalNumHas"].Value = checktotalnumhas;
  179. CoreClientParam ccp = new CoreClientParam();
  180. ccp.ServerName = "com.steering.mes.zgmil.coup.EddyCurrentTestingResult";
  181. ccp.MethodName = "scrapMatCheck";
  182. ccp.ServerParams = new Object[] { HeatNo, 7, proPlanId, gxPlanNo };
  183. ccp = this._ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  184. DataTable dd = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipSawFast.doQuerySlabCount", new object[] { HeatNo, proPlanId, gxPlanNo }, this._ob);
  185. //int ScrapNumBefore = Convert.ToInt32(ccp.ReturnInfo);//前几道工序剔除支数
  186. int ScrapNumBefore = Convert.ToInt32(dd.Rows[0][0].ToString());//前几道工序剔除支数
  187. checktotalnum = checktotalnum - ScrapNumBefore;//当前可切支数
  188. this.ultraGrid2.Rows[0].Cells["TotalNum"].Value = checktotalnum;
  189. if (this.checktotalnumhas > 0)
  190. {
  191. DataTable dtDeatail = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipeSawResult.GetResultDetail", new object[] { HeatNo, proPlanId, gxPlanNo }, this._ob);
  192. if (dtDeatail.Rows.Count > 0)
  193. {
  194. DataRow dr1 = null;
  195. DataRow dr2 = null;
  196. DataRow dr3 = null;
  197. string sawno1 = "";
  198. string sawno2 = "";
  199. string sawnon1 = "";
  200. string sawnon2 = "";
  201. string colno01 = "";
  202. string colno02 = "";
  203. string colno03 = "";
  204. if (dtDeatail.Rows.Count == 1)//小炉号
  205. {
  206. dr1 = dtDeatail.Rows[0];
  207. sawno1 = dr1["SAW_NO"].ToString();
  208. sawnon1 = dr1["SAW_NO_N"].ToString();
  209. colno01 = dr1["COL_NO"].ToString();
  210. this.ultraGrid2.Rows[0].Cells["ROW_COUNT"].Value = dr1["ROW_COUNT"].ToString();
  211. if (!string.IsNullOrEmpty(dr1["CUT_HEAD_LENGTH"].ToString()))
  212. {
  213. this.ultraGrid2.Rows[0].Cells["CUT_HEAD_LENGTHA"].Value = dr1["CUT_HEAD_LENGTH"].ToString();
  214. this.ultraGrid2.Rows[0].Cells["btnCUTHEAD"].Column.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always;
  215. this.ultraGrid2.Rows[0].Cells["btnCUTHEAD"].Column.CellButtonAppearance.BackColor = Color.Yellow;
  216. }
  217. if (!string.IsNullOrEmpty(dr1["ORDER_LENGTH"].ToString()))
  218. {
  219. this.ultraGrid2.Rows[0].Cells["ORDER_LENGTHA"].Value = dr1["ORDER_LENGTH"].ToString();
  220. this.ultraGrid2.Rows[0].Cells["btnCUTORDER"].Column.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always;
  221. this.ultraGrid2.Rows[0].Cells["btnCUTORDER"].Column.CellButtonAppearance.BackColor = Color.Yellow;
  222. }
  223. if (!string.IsNullOrEmpty(dr1["CUT_TRAIL_LENGTH"].ToString()))
  224. {
  225. this.ultraGrid2.Rows[0].Cells["CUT_TRAIL_LENGTHA"].Value = dr1["CUT_TRAIL_LENGTH"].ToString();
  226. this.ultraGrid2.Rows[0].Cells["btnCUTTAIL"].Column.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always;
  227. this.ultraGrid2.Rows[0].Cells["btnCUTTAIL"].Column.CellButtonAppearance.BackColor = Color.Yellow;
  228. }
  229. if (!string.IsNullOrEmpty(dr1["CUT_SPEED"].ToString())) this.ultraGrid2.Rows[0].Cells["CUT_SPEED"].Value = dr1["CUT_SPEED"].ToString();
  230. if (!string.IsNullOrEmpty(dr1["CUT_THICKNESS"].ToString())) this.ultraGrid2.Rows[0].Cells["CUT_THICKNESS"].Value = dr1["CUT_THICKNESS"].ToString();
  231. if (!string.IsNullOrEmpty(colno01))
  232. {
  233. this.ultraGrid2.Rows[0].Cells["btnCUTEND"].Column.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always;
  234. this.ultraGrid2.Rows[0].Cells["btnCUTEND"].Column.CellButtonAppearance.BackColor = Color.Yellow;
  235. switch (colno01)
  236. {
  237. case "1":
  238. this.ultraGrid2.Rows[0].Cells["COL_NO11"].Value = "True";
  239. break;
  240. case "2":
  241. this.ultraGrid2.Rows[0].Cells["COL_NO21"].Value = "True";
  242. break;
  243. case "3":
  244. this.ultraGrid2.Rows[0].Cells["COL_NO31"].Value = "True";
  245. break;
  246. }
  247. }
  248. if (!string.IsNullOrEmpty(sawno1))
  249. {
  250. if (sawno1.Equals("1"))
  251. {
  252. this.ultraGrid2.Rows[0].Cells["SAW1"].Value = "True";
  253. this.ultraGrid2.Rows[0].Cells["SAW2"].Value = "False";
  254. }
  255. else
  256. {
  257. this.ultraGrid2.Rows[0].Cells["SAW1"].Value = "False";
  258. this.ultraGrid2.Rows[0].Cells["SAW2"].Value = "True";
  259. }
  260. }
  261. if (!string.IsNullOrEmpty(sawnon1))
  262. {
  263. if (sawnon1.Equals("3"))
  264. {
  265. this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "True";
  266. this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "False";
  267. }
  268. else
  269. {
  270. this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "False";
  271. this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "True";
  272. }
  273. }
  274. }
  275. else
  276. {
  277. dr1 = dtDeatail.Rows[0];
  278. dr2 = dtDeatail.Rows[1];
  279. if (dtDeatail.Rows.Count>2)
  280. {
  281. dr3 = dtDeatail.Rows[2];
  282. colno03 = dr3["COL_NO"].ToString();
  283. }
  284. sawno1 = dr1["SAW_NO"].ToString();
  285. sawno2 = dr2["SAW_NO"].ToString();
  286. sawnon1 = dr1["SAW_NO_N"].ToString();
  287. sawnon2 = dr2["SAW_NO_N"].ToString();
  288. colno01 = dr1["COL_NO"].ToString();
  289. colno02 = dr2["COL_NO"].ToString();
  290. this.ultraGrid2.Rows[0].Cells["ROW_COUNT"].Value = dr1["ROW_COUNT"].ToString();
  291. if (!string.IsNullOrEmpty(dr1["CUT_HEAD_LENGTH"].ToString()))
  292. {
  293. this.ultraGrid2.Rows[0].Cells["CUT_HEAD_LENGTHA"].Value = dr1["CUT_HEAD_LENGTH"].ToString();
  294. this.ultraGrid2.Rows[0].Cells["btnCUTHEAD"].Column.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always;
  295. this.ultraGrid2.Rows[0].Cells["btnCUTHEAD"].Column.CellButtonAppearance.BackColor = Color.Yellow;
  296. }
  297. if (!string.IsNullOrEmpty(dr1["ORDER_LENGTH"].ToString()))
  298. {
  299. this.ultraGrid2.Rows[0].Cells["ORDER_LENGTHA"].Value = dr1["ORDER_LENGTH"].ToString();
  300. this.ultraGrid2.Rows[0].Cells["btnCUTORDER"].Column.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always;
  301. this.ultraGrid2.Rows[0].Cells["btnCUTORDER"].Column.CellButtonAppearance.BackColor = Color.Yellow;
  302. }
  303. if (!string.IsNullOrEmpty(dr1["CUT_TRAIL_LENGTH"].ToString()))
  304. {
  305. this.ultraGrid2.Rows[0].Cells["CUT_TRAIL_LENGTHA"].Value = dr1["CUT_TRAIL_LENGTH"].ToString();
  306. this.ultraGrid2.Rows[0].Cells["btnCUTTAIL"].Column.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always;
  307. this.ultraGrid2.Rows[0].Cells["btnCUTTAIL"].Column.CellButtonAppearance.BackColor = Color.Yellow;
  308. }
  309. if (!string.IsNullOrEmpty(dr1["CUT_SPEED"].ToString())) this.ultraGrid2.Rows[0].Cells["CUT_SPEED"].Value = dr1["CUT_SPEED"].ToString();
  310. if (!string.IsNullOrEmpty(dr1["CUT_THICKNESS"].ToString())) this.ultraGrid2.Rows[0].Cells["CUT_THICKNESS"].Value = dr1["CUT_THICKNESS"].ToString();
  311. #region
  312. //if (!this.PlinCode.Equals("C010"))
  313. //{
  314. if (!(colno01.Equals("") && colno02.Equals("") && colno03.Equals("")))
  315. {
  316. this.ultraGrid2.Rows[0].Cells["btnCUTEND"].Column.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always;
  317. this.ultraGrid2.Rows[0].Cells["btnCUTEND"].Column.CellButtonAppearance.BackColor = Color.Yellow;
  318. switch (colno01)
  319. {
  320. case "1":
  321. this.ultraGrid2.Rows[0].Cells["COL_NO11"].Value = "True";
  322. break;
  323. case "2":
  324. this.ultraGrid2.Rows[0].Cells["COL_NO21"].Value = "True";
  325. break;
  326. case "3":
  327. this.ultraGrid2.Rows[0].Cells["COL_NO31"].Value = "True";
  328. break;
  329. }
  330. switch (colno02)
  331. {
  332. case "1":
  333. this.ultraGrid2.Rows[0].Cells["COL_NO11"].Value = "True";
  334. break;
  335. case "2":
  336. this.ultraGrid2.Rows[0].Cells["COL_NO21"].Value = "True";
  337. break;
  338. case "3":
  339. this.ultraGrid2.Rows[0].Cells["COL_NO31"].Value = "True";
  340. break;
  341. }
  342. switch (colno03)
  343. {
  344. case "1":
  345. this.ultraGrid2.Rows[0].Cells["COL_NO11"].Value = "True";
  346. break;
  347. case "2":
  348. this.ultraGrid2.Rows[0].Cells["COL_NO21"].Value = "True";
  349. break;
  350. case "3":
  351. this.ultraGrid2.Rows[0].Cells["COL_NO31"].Value = "True";
  352. break;
  353. }
  354. }
  355. if (sawno1.Equals(sawno2))
  356. {
  357. if (sawno1.Equals("1"))
  358. {
  359. this.ultraGrid2.Rows[0].Cells["SAW1"].Value = "True";
  360. this.ultraGrid2.Rows[0].Cells["SAW2"].Value = "False";
  361. //this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW31"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  362. //this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW41"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  363. //this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW32"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled;
  364. //this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW42"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled;
  365. if (sawnon1.Equals(sawnon2))
  366. {
  367. if (sawnon1.Equals("3"))
  368. {
  369. this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "True";
  370. this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "False";
  371. }
  372. else
  373. {
  374. this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "False";
  375. this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "True";
  376. }
  377. }
  378. else
  379. {
  380. this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "True";
  381. this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "True";
  382. }
  383. }
  384. else
  385. {
  386. this.ultraGrid2.Rows[0].Cells["SAW1"].Value = "False";
  387. this.ultraGrid2.Rows[0].Cells["SAW2"].Value = "True";
  388. //this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW31"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled;
  389. //this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW41"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled;
  390. //this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW32"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  391. //this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW42"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  392. if (sawnon1.Equals(sawnon2))
  393. {
  394. if (sawnon1.Equals("3"))
  395. {
  396. //this.ultraGrid2.Rows[0].Cells["SAW32"].Value = "True";
  397. //this.ultraGrid2.Rows[0].Cells["SAW42"].Value = "False";
  398. this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "True";
  399. this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "False";
  400. }
  401. else
  402. {
  403. //this.ultraGrid2.Rows[0].Cells["SAW32"].Value = "False";
  404. //this.ultraGrid2.Rows[0].Cells["SAW42"].Value = "True";
  405. this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "False";
  406. this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "True";
  407. }
  408. }
  409. else
  410. {
  411. //this.ultraGrid2.Rows[0].Cells["SAW32"].Value = "True";
  412. //this.ultraGrid2.Rows[0].Cells["SAW42"].Value = "True";
  413. this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "True";
  414. this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "True";
  415. }
  416. }
  417. }
  418. else
  419. {
  420. this.ultraGrid2.Rows[0].Cells["SAW1"].Value = "True";
  421. this.ultraGrid2.Rows[0].Cells["SAW2"].Value = "True";
  422. #region 原来适应258的代码
  423. //if (sawnon1.Equals("3"))
  424. //{
  425. // this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "True";
  426. // this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "False";
  427. //}
  428. //else
  429. //{
  430. // this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "False";
  431. // this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "True";
  432. //}
  433. //if (sawnon2.Equals("4"))
  434. //{
  435. // this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW32"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  436. // this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW42"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  437. // this.ultraGrid2.Rows[0].Cells["SAW32"].Value = "False";
  438. // this.ultraGrid2.Rows[0].Cells["SAW42"].Value = "True";
  439. //}
  440. //else
  441. //{
  442. // this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW32"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  443. // this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW42"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  444. // this.ultraGrid2.Rows[0].Cells["SAW32"].Value = "True";
  445. // this.ultraGrid2.Rows[0].Cells["SAW42"].Value = "False";
  446. //}
  447. #endregion
  448. if (sawnon1.Equals(sawnon2))
  449. {
  450. if (sawnon1.Equals("3"))
  451. {
  452. this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "True";
  453. }
  454. else
  455. {
  456. this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "True";
  457. }
  458. }
  459. else
  460. {
  461. this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "True";
  462. this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "True";
  463. }
  464. }
  465. //}
  466. #endregion
  467. //if (PlinCode.Equals("C010"))
  468. //{ }
  469. }
  470. }
  471. }
  472. }
  473. /// <summary>
  474. /// 判断是否有值切不为空
  475. /// </summary>
  476. /// <returns></returns>
  477. private bool MaskInputCheck()
  478. {
  479. bool result = true;
  480. if (string.IsNullOrEmpty(ultraGrid2.Rows[0].Cells["ROW_COUNT"].Value.ToString()))
  481. {
  482. result = false;
  483. return result;
  484. }
  485. else
  486. {
  487. if (int.Parse(ultraGrid2.Rows[0].Cells["ROW_COUNT"].Value.ToString()) == 0)
  488. {
  489. result = false;
  490. return result;
  491. }
  492. }
  493. if (string.IsNullOrEmpty(ultraGrid2.Rows[0].Cells["ORDER_LENGTH"].Value.ToString()))
  494. {
  495. result = false;
  496. return result;
  497. }
  498. if (string.IsNullOrEmpty(ultraGrid2.Rows[0].Cells["CUT_HEAD_LENGTH"].Value.ToString()))
  499. {
  500. result = false;
  501. return result;
  502. }
  503. if (string.IsNullOrEmpty(ultraGrid2.Rows[0].Cells["CUT_TRAIL_LENGTH"].Value.ToString()))
  504. {
  505. result = false;
  506. return result;
  507. }
  508. if (string.IsNullOrEmpty(ultraGrid2.Rows[0].Cells["TotalNum"].Value.ToString()))
  509. {
  510. result = false;
  511. return result;
  512. }
  513. return result;
  514. }
  515. /// <summary>
  516. /// 向矫直探伤表跟踪表插入台号
  517. /// </summary>
  518. /// <param name="i">排号</param>
  519. /// <param name="rowcount">拍支数</param>
  520. private void InsertCol(int i, int rowcount)
  521. {
  522. string cl1 = this.ultraGrid2.Rows[0].Cells["COL_NO1"].Value.ToString();
  523. string cl2 = this.ultraGrid2.Rows[0].Cells["COL_NO2"].Value.ToString();
  524. string cl3 = "";
  525. if (PlinCode == "C010")
  526. {
  527. cl3 = this.ultraGrid2.Rows[0].Cells["COL_NO3"].Value.ToString();
  528. }
  529. //逻辑判断,1,2,3号台是否被勾选并赋给管号队列表
  530. if (cl1.Equals("True") && (!cl2.Equals("True")) && (!cl3.Equals("True")))//只勾选1#台
  531. {
  532. int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipeSawResult.UpdteRackCOL_NO", new object[] { HeatNo, "1", rowcount, SAW_NUM, proPlanId, gxPlanNo }, this._ob);
  533. }
  534. if ((!cl1.Equals("True")) && (cl2.Equals("True")) && (!cl3.Equals("True")))//只勾选2#台
  535. {
  536. int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipeSawResult.UpdteRackCOL_NO", new object[] { HeatNo, "2", rowcount, SAW_NUM, proPlanId, gxPlanNo }, this._ob);
  537. }
  538. if ((!cl1.Equals("True")) && (!cl2.Equals("True")) && (cl3.Equals("True")))//只勾选2#台
  539. {
  540. int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipeSawResult.UpdteRackCOL_NO", new object[] { HeatNo, "3", rowcount, SAW_NUM, proPlanId, gxPlanNo }, this._ob);
  541. }
  542. if ((cl1.Equals("True")) && (cl2.Equals("True")) && (!cl3.Equals("True")))//1#台,2#台
  543. {
  544. switch (i % 2)
  545. {
  546. case 1:
  547. int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipeSawResult.UpdteRackCOL_NO", new object[] { HeatNo, "1", rowcount, SAW_NUM, proPlanId, gxPlanNo }, this._ob);
  548. break;
  549. case 0:
  550. int count3 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipeSawResult.UpdteRackCOL_NO", new object[] { HeatNo, "2", rowcount, SAW_NUM, proPlanId, gxPlanNo }, this._ob);
  551. break;
  552. }
  553. }
  554. if ((cl1.Equals("True")) && (!cl2.Equals("True")) && (cl3.Equals("True")))//1#台,3#台
  555. {
  556. switch (i % 2)
  557. {
  558. case 1:
  559. int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipeSawResult.UpdteRackCOL_NO", new object[] { HeatNo, "1", rowcount, SAW_NUM, proPlanId, gxPlanNo }, this._ob);
  560. break;
  561. case 0:
  562. int count3 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipeSawResult.UpdteRackCOL_NO", new object[] { HeatNo, "3", rowcount, SAW_NUM, proPlanId, gxPlanNo }, this._ob);
  563. break;
  564. }
  565. }
  566. if ((!cl1.Equals("True")) && (cl2.Equals("True")) && (cl3.Equals("True")))//2#台,3#台
  567. {
  568. switch (i % 2)
  569. {
  570. case 1:
  571. int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipeSawResult.UpdteRackCOL_NO", new object[] { HeatNo, "2", rowcount, SAW_NUM, proPlanId, gxPlanNo }, this._ob);
  572. break;
  573. case 0:
  574. int count3 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipeSawResult.UpdteRackCOL_NO", new object[] { HeatNo, "3", rowcount, SAW_NUM, proPlanId, gxPlanNo }, this._ob);
  575. break;
  576. }
  577. }
  578. if ((cl1.Equals("True")) && (cl2.Equals("True")) && (cl3.Equals("True")))//1#台,2#台,3#台
  579. {
  580. switch (i % 3)
  581. {
  582. case 1:
  583. int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipeSawResult.UpdteRackCOL_NO", new object[] { HeatNo, "1", rowcount, SAW_NUM, proPlanId, gxPlanNo }, this._ob);
  584. break;
  585. case 2:
  586. int count3 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipeSawResult.UpdteRackCOL_NO", new object[] { HeatNo, "2", rowcount, SAW_NUM, proPlanId, gxPlanNo }, this._ob);
  587. break;
  588. case 0:
  589. int count4 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipeSawResult.UpdteRackCOL_NO", new object[] { HeatNo, "3", rowcount, SAW_NUM, proPlanId, gxPlanNo }, this._ob);
  590. break;
  591. }
  592. }
  593. }
  594. /// <summary>
  595. ///
  596. /// </summary>
  597. /// <param name="nobefore"></param>
  598. /// <param name="rowno"></param>
  599. private void InsertColNEW(int nobefore, int rowno)
  600. {
  601. if (this.ultraGrid2.Rows[0].Cells["COL_NO11"].Value != null)
  602. {
  603. if (this.ultraGrid2.Rows[0].Cells["COL_NO11"].Value.ToString() == "True")
  604. {
  605. this.colno1 = "1";
  606. }
  607. else
  608. {
  609. this.colno1 = "";
  610. }
  611. }
  612. if (this.ultraGrid2.Rows[0].Cells["COL_NO21"].Value != null)
  613. {
  614. if (this.ultraGrid2.Rows[0].Cells["COL_NO21"].Value.ToString() == "True")
  615. {
  616. this.colno2 = "2";
  617. }
  618. else
  619. {
  620. this.colno2 = "";
  621. }
  622. }
  623. if (this.ultraGrid2.Rows[0].Cells["COL_NO31"].Value != null)
  624. {
  625. if (this.ultraGrid2.Rows[0].Cells["COL_NO31"].Value.ToString() == "True")
  626. {
  627. this.colno3 = "3";
  628. }
  629. else
  630. {
  631. this.colno3 = "";
  632. }
  633. }
  634. //int i = nobefore + 1;
  635. int i = 1;
  636. for (; i <= rowno; i++)
  637. {
  638. string colno = "";
  639. //if ((!this.PlinCode.Equals("C010")) || (this.PlinCode.Equals("C010") && this.SAW_NUM < 6))
  640. //{
  641. //逻辑判断,1,2,3号台是否被勾选并赋给管号队列表
  642. //switch (i % 2)
  643. if (this.colno1.Equals("") && this.colno2.Equals("") && this.colno3.Equals(""))
  644. {
  645. MessageUtil.ShowTips("请选择矫直线!");
  646. return;
  647. }
  648. else if ((!this.colno1.Equals("")) && this.colno2.Equals("") && this.colno3.Equals(""))
  649. {
  650. colno = this.colno1;
  651. }
  652. else if (this.colno1.Equals("") && !this.colno2.Equals("") && this.colno3.Equals(""))
  653. {
  654. colno = this.colno2;
  655. }
  656. else if (this.colno1.Equals("") && this.colno2.Equals("") && !this.colno3.Equals(""))
  657. {
  658. colno = this.colno3;
  659. }
  660. else if (!this.colno1.Equals("") && !this.colno2.Equals("") && this.colno3.Equals(""))
  661. {
  662. switch (i % 2)
  663. {
  664. case 1:
  665. colno = this.colno1;
  666. break;
  667. case 0:
  668. colno = this.colno2;
  669. break;
  670. }
  671. }
  672. else if (!this.colno1.Equals("") && this.colno2.Equals("") && !this.colno3.Equals(""))
  673. {
  674. switch (i % 2)
  675. {
  676. case 1:
  677. colno = this.colno1;
  678. break;
  679. case 0:
  680. colno = this.colno3;
  681. break;
  682. }
  683. }
  684. else if (this.colno1.Equals("") && !this.colno2.Equals("") && !this.colno3.Equals(""))
  685. {
  686. switch (i % 2)
  687. {
  688. case 1:
  689. colno = this.colno2;
  690. break;
  691. case 0:
  692. colno = this.colno3;
  693. break;
  694. }
  695. }
  696. else if (!this.colno1.Equals("") && !this.colno2.Equals("") && !this.colno3.Equals(""))
  697. {
  698. switch (i % 3)
  699. {
  700. case 1:
  701. //if ((!this.colno1.Equals("")) && (!this.colno2.Equals("")) && (!this.colno3.Equals("")))
  702. //{
  703. // colno = this.colno1;
  704. //}
  705. //else if ((!this.colno2.Equals("")))
  706. //{
  707. // colno = this.colno2;
  708. //}
  709. //else
  710. //{
  711. // colno = this.colno3;
  712. //}
  713. colno = this.colno1;
  714. break;
  715. case 0:
  716. //if ((!this.colno1.Equals("")) && (!this.colno2.Equals("")) && (!this.colno3.Equals("")))
  717. //{
  718. // colno = this.colno3;
  719. //}
  720. //else if ((!this.colno1.Equals("")))
  721. //{
  722. // colno = this.colno1;
  723. //}
  724. //else
  725. //{
  726. // colno = this.colno2;
  727. //}
  728. colno = this.colno2;
  729. break;
  730. case 2:
  731. //if ((!this.colno1.Equals("")) && (!this.colno2.Equals("")) && (!this.colno3.Equals("")))
  732. //{
  733. // colno = this.colno2;
  734. //}
  735. //else if ((!this.colno1.Equals("")))
  736. //{
  737. // colno = this.colno1;
  738. //}
  739. //else
  740. //{
  741. // colno = this.colno3;
  742. //}
  743. colno = this.colno3;
  744. break;
  745. }
  746. }
  747. // }
  748. //else
  749. //{
  750. // //if (!(this.colno1.Equals("1") && this.colno2.Equals("2") && this.colno3.Equals("3")))
  751. // //{
  752. // // MessageBox.Show("炉号:【" + this.HeatNo + "】的分切数为【" + this.SAW_NUM + "】请全选三条矫直线后重新进行矫直分切结束操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  753. // // return;
  754. // //}
  755. // switch (i % 6)
  756. // {
  757. // case 0:
  758. // colno = "3";
  759. // break;
  760. // case 1:
  761. // colno = "1";
  762. // break;
  763. // case 2:
  764. // colno = "2";
  765. // break;
  766. // case 3:
  767. // colno = "3";
  768. // break;
  769. // case 4:
  770. // colno = "1";
  771. // break;
  772. // case 5:
  773. // colno = "2";
  774. // break;
  775. // }
  776. //}
  777. if (i == rowno)
  778. {
  779. if (this.lastnum > 0)
  780. {
  781. //int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipSawFast.UpdteRackCOL_NONEW", new object[] { HeatNo, colno, this.lastnum, SAW_NUM, i }, this._ob);
  782. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipSawFast.UpdateColno", new object[] { HeatNo, colno, this.lastnum, SAW_NUM, i, proPlanId, gxPlanNo }, this._ob);
  783. }
  784. else
  785. {
  786. //int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipSawFast.UpdteRackCOL_NONEW", new object[] { HeatNo, colno, this.rowcounts, SAW_NUM, i }, this._ob);
  787. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipSawFast.UpdateColno", new object[] { HeatNo, colno, this.rowcounts, SAW_NUM, i, proPlanId, gxPlanNo }, this._ob);
  788. }
  789. }
  790. else
  791. {
  792. //int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipSawFast.UpdteRackCOL_NONEW", new object[] { HeatNo, colno, this.rowcounts, SAW_NUM, i }, this._ob);
  793. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipSawFast.UpdateColno", new object[] { HeatNo, colno, this.rowcounts, SAW_NUM, i, proPlanId, gxPlanNo }, this._ob);
  794. }
  795. }
  796. }
  797. /// <summary>
  798. /// 快速分切
  799. /// </summary>
  800. /// <param name="sender"></param>
  801. /// <param name="e"></param>
  802. private void ultraGrid2_ClickCellButton(object sender, CellEventArgs e)
  803. {
  804. int rownoBefore = 0; //快速分切之前已切的总排数
  805. bool iscontinue = false;//是否可以进行快速分切
  806. if(!lotno.Equals("试轧料"))
  807. {
  808. if (!MaskInputCheck())
  809. {
  810. MessageBox.Show("您未输入分切的参数,请确认后重新输入", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  811. return;
  812. }
  813. }
  814. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipSawFast.GetCountWithoutDel", new object[] { HeatNo, proPlanId, gxPlanNo }, this._ob);
  815. if (dt.Rows.Count > 0)
  816. {
  817. checktotalnum = int.Parse(dt.Rows[0]["counts"].ToString());
  818. }
  819. else
  820. {
  821. MessageBox.Show("炉号:【" + HeatNo + "】未开始上料锯切,或未开始分切,请确认后重新进行快速分切操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  822. return;
  823. }
  824. DataTable dt2 = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipSawFast.GetCountHasSaw", new object[] { HeatNo, proPlanId, gxPlanNo }, this._ob);
  825. if (dt2.Rows.Count > 0)
  826. {
  827. checktotalnumhas = int.Parse(dt2.Rows[0]["counts"].ToString());
  828. }
  829. this.ultraGrid2.Rows[0].Cells["TotalNumHas"].Value = checktotalnumhas;
  830. CoreClientParam ccp = new CoreClientParam();
  831. ccp.ServerName = "com.steering.mes.zgmil.coup.EddyCurrentTestingResult";
  832. ccp.MethodName = "scrapMatCheck";
  833. ccp.ServerParams = new Object[] { HeatNo, 7, proPlanId, gxPlanNo };
  834. ccp = this._ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  835. int ScrapNumBefore = Convert.ToInt32(ccp.ReturnInfo);//前几道工序剔除支数
  836. checktotalnum = checktotalnum - ScrapNumBefore;//当前可切支数
  837. int totalnum = 0;
  838. int rowcount = 0;
  839. totalnum = checktotalnum;
  840. this.ultraGrid2.Rows[0].Cells["TotalNum"].Value = totalnum;
  841. //totalnum = int.Parse(this.ultraGrid2.Rows[0].Cells["TotalNum"].Value.ToString());
  842. rowcount = int.Parse(this.ultraGrid2.Rows[0].Cells["ROW_COUNT"].Value.ToString());
  843. //2016-07-12
  844. totalnum = int.Parse(this.ultraGrid2.Rows[0].Cells["TotalNum"].Value.ToString3()) + int.Parse(this.ultraGrid2.Rows[0].Cells["TotalNumHas"].Value.ToString3());
  845. //2016-07-12注释
  846. //DataTable dtDeatail = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipeSawResult.GetResultDetail", new object[] { HeatNo }, this._ob);
  847. //if (dtDeatail.Rows.Count > 0)
  848. //{
  849. // foreach (DataRow dr in dtDeatail.Rows)
  850. // {
  851. // int s = Int16.Parse(dr["ROW_NO"].ToString());
  852. // rownoBefore = (rownoBefore > s) ? rownoBefore : s;
  853. // if (!dr["SAW_FLAG"].ToString().Equals("3"))
  854. // {
  855. // //MessageBox.Show("排号:" + rownoBefore + "还未分切完成,请确认并分切完后再执行快速分切操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  856. // //return;
  857. // }
  858. // else
  859. // {
  860. // iscontinue = true;
  861. // }
  862. // }
  863. //}
  864. if (this.ultraGrid2.Rows[0].Cells["SAW1"].Value.ToString() == "True")
  865. {
  866. saw11 = "1";
  867. }
  868. else
  869. {
  870. saw11 = "";
  871. }
  872. if (this.ultraGrid2.Rows[0].Cells["SAW2"].Value.ToString() == "True")
  873. {
  874. saw12 = this.ultraGrid2.Rows[0].Cells["SAW2"].Column.Header.Caption.ToString2().Substring(0, 1);
  875. }
  876. else
  877. {
  878. saw12 = "";
  879. }
  880. if (this.ultraGrid2.Rows[0].Cells["SAW31"].Value != null)
  881. {
  882. //2#台选择的锯进行联动
  883. if (this.ultraGrid2.Rows[0].Cells["SAW31"].Value.ToString() == "True")
  884. {
  885. //this.saw211 = "3";
  886. this.saw21 = this.ultraGrid2.Rows[0].Cells["SAW31"].Column.Header.Caption.ToString2().Substring(0, 1);
  887. }
  888. else
  889. {
  890. //this.saw211 = "";
  891. this.saw21 = "";
  892. }
  893. }
  894. //if (this.ultraGrid2.Rows[0].Cells["SAW32"].Value != null)
  895. //{
  896. // if (this.ultraGrid2.Rows[0].Cells["SAW32"].Value.ToString() == "True")
  897. // {
  898. // this.saw221 = "3";
  899. // }
  900. // else
  901. // {
  902. // this.saw221 = "";
  903. // }
  904. //}
  905. if (this.ultraGrid2.Rows[0].Cells["SAW41"].Value != null)
  906. {
  907. if (this.ultraGrid2.Rows[0].Cells["SAW41"].Value.ToString() == "True")
  908. {
  909. //this.saw212 = "4";
  910. this.saw22 = this.ultraGrid2.Rows[0].Cells["SAW41"].Column.Header.Caption.ToString2().Substring(0, 1);
  911. }
  912. else
  913. {
  914. //this.saw212 = "";
  915. this.saw22 = "";
  916. }
  917. }
  918. //if (this.ultraGrid2.Rows[0].Cells["SAW42"].Value != null)
  919. //{
  920. // if (this.ultraGrid2.Rows[0].Cells["SAW42"].Value.ToString() == "True")
  921. // {
  922. // this.saw222 = "4";
  923. // }
  924. // else
  925. // {
  926. // this.saw222 = "";
  927. // }
  928. //}
  929. //if (!string.IsNullOrEmpty(saw11))
  930. //{
  931. // if (saw211.Equals("") && saw212.Equals(""))
  932. // {
  933. // MessageBox.Show("您勾选了1#锯但并未选择1#锯锯切完成后的下一锯号", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  934. // return;
  935. // }
  936. //}
  937. //if (!string.IsNullOrEmpty(saw12))
  938. //{
  939. // if (saw221.Equals("") && saw222.Equals(""))
  940. // {
  941. // MessageBox.Show("您勾选了2#锯但并未选择2#锯锯切完成后的下一锯号", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  942. // return;
  943. // }
  944. //}
  945. //if (string.IsNullOrEmpty(saw12) && string.IsNullOrEmpty(saw11))
  946. //{
  947. // MessageBox.Show("您未在第一个分切台子选择任何锯,请选择后重新开始", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  948. // return;
  949. //}
  950. if (string.IsNullOrEmpty(saw11) && string.IsNullOrEmpty(saw12) && string.IsNullOrEmpty(saw21) && string.IsNullOrEmpty(saw22))
  951. {
  952. MessageBox.Show("您未选择任何锯,请选择后重新开始", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  953. return;
  954. }
  955. milsawdeatail.Clear();
  956. milsawdeatail.LotNo = this.lotno;
  957. milsawdeatail.StoveNo = this.stoveno;
  958. milsawdeatail.JudgeStoveNo = HeatNo;
  959. milsawdeatail.PlineCode = PlinCode;
  960. milsawdeatail.ColGroup = this.UserInfo.GetUserGroup();
  961. milsawdeatail.ColUser = this.UserInfo.GetUserName();
  962. milsawdeatail.ColShift = this.UserInfo.GetUserOrder();
  963. milsawdeatail.ColMode = "1";
  964. milsawdeatail.SawFlag = "1";
  965. milsawdeatail.ProPlanId = proPlanId;
  966. milsawdeatail.GxPlanNo = gxPlanNo;
  967. int checkresult = rownoBefore;
  968. if (e.Cell.Column.Key == "btnCUTHEAD")//快速分切切头
  969. {
  970. #region 来料及切头 默认 偶数排给4#锯奇数排给3(快速切头需重写)
  971. //if (totalnum == 0)
  972. //{
  973. // MessageBox.Show("快速切头已完成。不允许再次进行。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  974. // return;
  975. //}
  976. int last = totalnum % rowcount;//最后一排的支数
  977. this.lastnum = last;
  978. this.rowcounts = rowcount;
  979. int rowno = totalnum / rowcount;//总排数-1
  980. int i = 1;
  981. //if (iscontinue)
  982. //{
  983. rowno = rowno + rownoBefore;
  984. i = rownoBefore + 1;
  985. //}
  986. if (last > 0)
  987. {
  988. rowno = rowno + 1;
  989. }
  990. DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipSawFast.doQueryMilSawDeatil", new object[] { milsawdeatail }, this._ob);
  991. if (int.Parse(ds.Rows[0][0].ToString()) > 0)
  992. {
  993. for (; i <= rowno; i++)
  994. {
  995. milsawdeatail.RowNo = i.ToString();
  996. if (last > 0)
  997. {
  998. if (i == rowno)
  999. {
  1000. milsawdeatail.RowCount = last.ToString();
  1001. }
  1002. else
  1003. {
  1004. milsawdeatail.RowCount = rowcount.ToString();
  1005. }
  1006. }
  1007. else
  1008. {
  1009. milsawdeatail.RowCount = rowcount.ToString();
  1010. }
  1011. if (this.ultraGrid2.Rows[0].Cells["CUT_HEAD_LENGTHA"].Text == "")
  1012. {
  1013. MessageBox.Show("切头长度不能为空,请输入!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1014. return;
  1015. }
  1016. milsawdeatail.CutHeadLength = this.ultraGrid2.Rows[0].Cells["CUT_HEAD_LENGTHA"].Value.ToString();
  1017. milsawdeatail.CutHeadLengthTotal = float.Parse(milsawdeatail.RowCount.ToString()) * float.Parse(milsawdeatail.CutHeadLength.ToString()) / 1000;
  1018. milsawdeatail.CutSpeed = this.ultraGrid2.Rows[0].Cells["CUT_SPEED"].Value.ToString();
  1019. milsawdeatail.CutThickness = this.ultraGrid2.Rows[0].Cells["CUT_THICKNESS"].Value.ToString();
  1020. //if ((!this.PlinCode.Equals("C010")) || (this.PlinCode.Equals("C010") && this.SAW_NUM < 6))
  1021. //{
  1022. switch (i % 2)
  1023. {
  1024. case 0:
  1025. if (saw11.Equals("") && saw12.Equals(""))
  1026. {
  1027. milsawdeatail.SawNo = "";
  1028. }
  1029. else if ((!saw11.Equals("")) && saw12.Equals(""))
  1030. {
  1031. milsawdeatail.SawNo = saw11;
  1032. }
  1033. else if (saw11.Equals("") && (!saw12.Equals("")))
  1034. {
  1035. milsawdeatail.SawNo = saw12;
  1036. }
  1037. else
  1038. {
  1039. milsawdeatail.SawNo = saw12;
  1040. }
  1041. if (PlinCode.Equals("C017"))
  1042. {
  1043. if (milsawdeatail.SawNo.Equals("1"))
  1044. {
  1045. if (this.saw21.Equals("") && this.saw22.Equals(""))
  1046. {
  1047. milsawdeatail.SawNoN = "";
  1048. }
  1049. else if ((!this.saw21.Equals("")) && this.saw22.Equals(""))
  1050. {
  1051. milsawdeatail.SawNoN = saw21;
  1052. }
  1053. else if (this.saw21.Equals("") && (!this.saw22.Equals("")))
  1054. {
  1055. milsawdeatail.SawNoN = saw22;
  1056. }
  1057. else
  1058. {
  1059. milsawdeatail.SawNoN = saw22;
  1060. }
  1061. }
  1062. else if (milsawdeatail.SawNo.Equals("4"))
  1063. {
  1064. if (this.saw21.Equals("") && this.saw22.Equals(""))
  1065. {
  1066. milsawdeatail.SawNoN = "";
  1067. }
  1068. else if ((!this.saw21.Equals("")) && this.saw22.Equals(""))
  1069. {
  1070. milsawdeatail.SawNoN = saw21;
  1071. }
  1072. else if (this.saw21.Equals("") && (!this.saw22.Equals("")))
  1073. {
  1074. milsawdeatail.SawNoN = saw22;
  1075. }
  1076. else
  1077. {
  1078. milsawdeatail.SawNoN = saw21;
  1079. }
  1080. }
  1081. else
  1082. {
  1083. milsawdeatail.SawNoN = "";
  1084. }
  1085. }
  1086. else
  1087. {
  1088. if (this.saw21.Equals("") && this.saw22.Equals(""))
  1089. {
  1090. milsawdeatail.SawNoN = "";
  1091. }
  1092. else if ((!this.saw21.Equals("")) && this.saw22.Equals(""))
  1093. {
  1094. milsawdeatail.SawNoN = saw21;
  1095. }
  1096. else if (this.saw21.Equals("") && (!this.saw22.Equals("")))
  1097. {
  1098. milsawdeatail.SawNoN = saw22;
  1099. }
  1100. else
  1101. {
  1102. milsawdeatail.SawNoN = saw22;
  1103. }
  1104. }
  1105. break;
  1106. case 1:
  1107. if (saw11.Equals("") && saw12.Equals(""))
  1108. {
  1109. milsawdeatail.SawNo = "";
  1110. }
  1111. else if ((!saw11.Equals("")) && saw12.Equals(""))
  1112. {
  1113. milsawdeatail.SawNo = saw11;
  1114. }
  1115. else if (saw11.Equals("") && (!saw12.Equals("")))
  1116. {
  1117. milsawdeatail.SawNo = saw12;
  1118. }
  1119. else
  1120. {
  1121. milsawdeatail.SawNo = saw11;
  1122. }
  1123. if (PlinCode.Equals("C017"))
  1124. {
  1125. if (milsawdeatail.SawNo.Equals("1"))
  1126. {
  1127. if (this.saw21.Equals("") && this.saw22.Equals(""))
  1128. {
  1129. milsawdeatail.SawNoN = "";
  1130. }
  1131. else if ((!this.saw21.Equals("")) && this.saw22.Equals(""))
  1132. {
  1133. milsawdeatail.SawNoN = saw21;
  1134. }
  1135. else if (this.saw21.Equals("") && (!this.saw22.Equals("")))
  1136. {
  1137. milsawdeatail.SawNoN = saw22;
  1138. }
  1139. else
  1140. {
  1141. milsawdeatail.SawNoN = saw22;
  1142. }
  1143. }
  1144. else if (milsawdeatail.SawNo.Equals("4"))
  1145. {
  1146. if (this.saw21.Equals("") && this.saw22.Equals(""))
  1147. {
  1148. milsawdeatail.SawNoN = "";
  1149. }
  1150. else if ((!this.saw21.Equals("")) && this.saw22.Equals(""))
  1151. {
  1152. milsawdeatail.SawNoN = saw21;
  1153. }
  1154. else if (this.saw21.Equals("") && (!this.saw22.Equals("")))
  1155. {
  1156. milsawdeatail.SawNoN = saw22;
  1157. }
  1158. else
  1159. {
  1160. milsawdeatail.SawNoN = saw21;
  1161. }
  1162. }
  1163. else
  1164. {
  1165. milsawdeatail.SawNoN = "";
  1166. }
  1167. }
  1168. else
  1169. {
  1170. if (this.saw21.Equals("") && this.saw22.Equals(""))
  1171. {
  1172. milsawdeatail.SawNoN = "";
  1173. }
  1174. else if ((!this.saw21.Equals("")) && this.saw22.Equals(""))
  1175. {
  1176. milsawdeatail.SawNoN = saw21;
  1177. }
  1178. else if (this.saw21.Equals("") && (!this.saw22.Equals("")))
  1179. {
  1180. milsawdeatail.SawNoN = saw22;
  1181. }
  1182. else
  1183. {
  1184. milsawdeatail.SawNoN = saw21;
  1185. }
  1186. }
  1187. break;
  1188. }
  1189. //}
  1190. //else
  1191. //{
  1192. // switch (i % 3)//168 待添加(168第三条线启动的话,所有的锯都会用到)
  1193. // {
  1194. // case 0://(分给3)
  1195. // break;
  1196. // case 1: //(分给1)
  1197. // break;
  1198. // case 2://(分给2)
  1199. // break;
  1200. // }
  1201. //}
  1202. //1修改实绩表,2.更新管号队列
  1203. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipSawFast.updateSawDetailNEW", new object[] { milsawdeatail }, this._ob);
  1204. checkresult = checkresult + count;
  1205. }
  1206. }
  1207. else
  1208. {
  1209. for (; i <= rowno; i++)
  1210. {
  1211. milsawdeatail.RowNo = i.ToString();
  1212. if (last > 0)
  1213. {
  1214. if (i == rowno)
  1215. {
  1216. milsawdeatail.RowCount = last.ToString();
  1217. }
  1218. else
  1219. {
  1220. milsawdeatail.RowCount = rowcount.ToString();
  1221. }
  1222. }
  1223. else
  1224. {
  1225. milsawdeatail.RowCount = rowcount.ToString();
  1226. }
  1227. if (this.ultraGrid2.Rows[0].Cells["CUT_HEAD_LENGTHA"].Text == "")
  1228. {
  1229. MessageBox.Show("切头长度不能为空,请输入!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1230. return;
  1231. }
  1232. milsawdeatail.CutHeadLength = this.ultraGrid2.Rows[0].Cells["CUT_HEAD_LENGTHA"].Value.ToString();
  1233. milsawdeatail.CutHeadLengthTotal = float.Parse(milsawdeatail.RowCount.ToString()) * float.Parse(milsawdeatail.CutHeadLength.ToString()) / 1000;
  1234. milsawdeatail.CutSpeed = this.ultraGrid2.Rows[0].Cells["CUT_SPEED"].Value.ToString();
  1235. milsawdeatail.CutThickness = this.ultraGrid2.Rows[0].Cells["CUT_THICKNESS"].Value.ToString();
  1236. //if ((!this.PlinCode.Equals("C010")) || (this.PlinCode.Equals("C010") && this.SAW_NUM < 6))
  1237. //{
  1238. switch (i % 2)
  1239. {
  1240. case 0:
  1241. if (saw11.Equals("") && saw12.Equals(""))
  1242. {
  1243. milsawdeatail.SawNo = "";
  1244. }
  1245. else if ((!saw11.Equals("")) && saw12.Equals(""))
  1246. {
  1247. milsawdeatail.SawNo = saw11;
  1248. }
  1249. else if (saw11.Equals("") && (!saw12.Equals("")))
  1250. {
  1251. milsawdeatail.SawNo = saw12;
  1252. }
  1253. else
  1254. {
  1255. milsawdeatail.SawNo = saw12;
  1256. }
  1257. if (PlinCode.Equals("C017"))
  1258. {
  1259. if (milsawdeatail.SawNo.Equals("1"))
  1260. {
  1261. if (this.saw21.Equals("") && this.saw22.Equals(""))
  1262. {
  1263. milsawdeatail.SawNoN = "";
  1264. }
  1265. else if ((!this.saw21.Equals("")) && this.saw22.Equals(""))
  1266. {
  1267. milsawdeatail.SawNoN = saw21;
  1268. }
  1269. else if (this.saw21.Equals("") && (!this.saw22.Equals("")))
  1270. {
  1271. milsawdeatail.SawNoN = saw22;
  1272. }
  1273. else
  1274. {
  1275. milsawdeatail.SawNoN = saw22;
  1276. }
  1277. }
  1278. else if (milsawdeatail.SawNo.Equals("4"))
  1279. {
  1280. if (this.saw21.Equals("") && this.saw22.Equals(""))
  1281. {
  1282. milsawdeatail.SawNoN = "";
  1283. }
  1284. else if ((!this.saw21.Equals("")) && this.saw22.Equals(""))
  1285. {
  1286. milsawdeatail.SawNoN = saw21;
  1287. }
  1288. else if (this.saw21.Equals("") && (!this.saw22.Equals("")))
  1289. {
  1290. milsawdeatail.SawNoN = saw22;
  1291. }
  1292. else
  1293. {
  1294. milsawdeatail.SawNoN = saw21;
  1295. }
  1296. }
  1297. else
  1298. {
  1299. milsawdeatail.SawNoN = "";
  1300. }
  1301. }
  1302. else
  1303. {
  1304. if (this.saw21.Equals("") && this.saw22.Equals(""))
  1305. {
  1306. milsawdeatail.SawNoN = "";
  1307. }
  1308. else if ((!this.saw21.Equals("")) && this.saw22.Equals(""))
  1309. {
  1310. milsawdeatail.SawNoN = saw21;
  1311. }
  1312. else if (this.saw21.Equals("") && (!this.saw22.Equals("")))
  1313. {
  1314. milsawdeatail.SawNoN = saw22;
  1315. }
  1316. else
  1317. {
  1318. milsawdeatail.SawNoN = saw22;
  1319. }
  1320. }
  1321. break;
  1322. case 1:
  1323. if (saw11.Equals("") && saw12.Equals(""))
  1324. {
  1325. milsawdeatail.SawNo = "";
  1326. }
  1327. else if ((!saw11.Equals("")) && saw12.Equals(""))
  1328. {
  1329. milsawdeatail.SawNo = saw11;
  1330. }
  1331. else if (saw11.Equals("") && (!saw12.Equals("")))
  1332. {
  1333. milsawdeatail.SawNo = saw12;
  1334. }
  1335. else
  1336. {
  1337. milsawdeatail.SawNo = saw11;
  1338. }
  1339. if (PlinCode.Equals("C017"))
  1340. {
  1341. if (milsawdeatail.SawNo.Equals("1"))
  1342. {
  1343. if (this.saw21.Equals("") && this.saw22.Equals(""))
  1344. {
  1345. milsawdeatail.SawNoN = "";
  1346. }
  1347. else if ((!this.saw21.Equals("")) && this.saw22.Equals(""))
  1348. {
  1349. milsawdeatail.SawNoN = saw21;
  1350. }
  1351. else if (this.saw21.Equals("") && (!this.saw22.Equals("")))
  1352. {
  1353. milsawdeatail.SawNoN = saw22;
  1354. }
  1355. else
  1356. {
  1357. milsawdeatail.SawNoN = saw22;
  1358. }
  1359. }
  1360. else if (milsawdeatail.SawNo.Equals("4"))
  1361. {
  1362. if (this.saw21.Equals("") && this.saw22.Equals(""))
  1363. {
  1364. milsawdeatail.SawNoN = "";
  1365. }
  1366. else if ((!this.saw21.Equals("")) && this.saw22.Equals(""))
  1367. {
  1368. milsawdeatail.SawNoN = saw21;
  1369. }
  1370. else if (this.saw21.Equals("") && (!this.saw22.Equals("")))
  1371. {
  1372. milsawdeatail.SawNoN = saw22;
  1373. }
  1374. else
  1375. {
  1376. milsawdeatail.SawNoN = saw21;
  1377. }
  1378. }
  1379. else
  1380. {
  1381. milsawdeatail.SawNoN = "";
  1382. }
  1383. }
  1384. else
  1385. {
  1386. if (this.saw21.Equals("") && this.saw22.Equals(""))
  1387. {
  1388. milsawdeatail.SawNoN = "";
  1389. }
  1390. else if ((!this.saw21.Equals("")) && this.saw22.Equals(""))
  1391. {
  1392. milsawdeatail.SawNoN = saw21;
  1393. }
  1394. else if (this.saw21.Equals("") && (!this.saw22.Equals("")))
  1395. {
  1396. milsawdeatail.SawNoN = saw22;
  1397. }
  1398. else
  1399. {
  1400. milsawdeatail.SawNoN = saw22;
  1401. }
  1402. }
  1403. break;
  1404. }
  1405. //}
  1406. //else
  1407. //{
  1408. // switch (i % 3)//168 待添加(168第三条线启动的话,所有的锯都会用到)
  1409. // {
  1410. // case 0://(分给3)
  1411. // break;
  1412. // case 1: //(分给1)
  1413. // break;
  1414. // case 2://(分给2)
  1415. // break;
  1416. // }
  1417. //}
  1418. //1插入实绩表,2.更新管号队列
  1419. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipSawFast.InsertSawDetailNEW", new object[] { milsawdeatail }, this._ob);
  1420. checkresult = checkresult + count;
  1421. }
  1422. }
  1423. if (checkresult != rowno)
  1424. {
  1425. ServerHelper.SetData("com.steering.mes.zgmil.coup.PipSawFast.InsertSawDetailNEWBACK", new object[] { milsawdeatail }, this._ob);
  1426. MessageBox.Show("快速切头未完成。请查找原因后重新执行。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1427. }
  1428. else
  1429. {
  1430. DataTable dthas = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipSawFast.GetCountHasSaw", new object[] { HeatNo, proPlanId, gxPlanNo }, this._ob);
  1431. if (dthas.Rows.Count > 0)
  1432. {
  1433. checktotalnumhas = int.Parse(dthas.Rows[0]["counts"].ToString());
  1434. }
  1435. this.ultraGrid2.Rows[0].Cells["TotalNumHas"].Value = checktotalnumhas;
  1436. this.ultraGrid2.Rows[0].Cells["TotalNum"].Value = "0";
  1437. this.ultraGrid2.Rows[0].Cells["btnCUTHEAD"].Column.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always;
  1438. this.ultraGrid2.Rows[0].Cells["btnCUTHEAD"].Column.CellButtonAppearance.BackColor = Color.Yellow;
  1439. }
  1440. #endregion
  1441. }
  1442. if (e.Cell.Column.Key == "btnCUTORDER")//快速分切切定尺
  1443. {
  1444. if (checktotalnumhas == 0)
  1445. {
  1446. MessageBox.Show("炉号:【" + HeatNo + "】还未开始切头,不允许进行切定尺操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1447. return;
  1448. }
  1449. if (this.ultraGrid2.Rows[0].Cells["ORDER_LENGTHA"].Text == "")
  1450. {
  1451. MessageBox.Show("切定尺长度不能为空,请输入!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1452. return;
  1453. }
  1454. if (double.Parse(this.ultraGrid2.Rows[0].Cells["ORDER_LENGTHA"].Text.ToString2()) > 20 && !PlinCode.Equals("C072"))
  1455. {
  1456. //if (MessageUtil.ShowYesNoAndQuestion("您输入的定尺长度已大于25米,是否继续?") == DialogResult.No) return;
  1457. MessageUtil.ShowTips("输入的定尺长度已大于20米,与实际不符!");
  1458. return;
  1459. }
  1460. milsawdeatail.OrderLength = this.ultraGrid2.Rows[0].Cells["ORDER_LENGTHA"].Value.ToString();
  1461. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipSawFast.UPDATEORDER_LENGTH", new object[] { milsawdeatail }, this._ob);
  1462. if (count < 0)
  1463. {
  1464. MessageBox.Show("快速切定尺失败,请查找原因后重新操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1465. }
  1466. else
  1467. {
  1468. //切定尺就把长度、重量写入进程表
  1469. milsawdeatail.OrderLength = this.ultraGrid2.Rows[0].Cells["ORDER_LENGTHA"].Text;
  1470. ccp.ServerName = "com.steering.mes.zgmil.coup.PipSawFast";
  1471. ccp.MethodName = "updatePortOrderLength";
  1472. ccp.ServerParams = new object[] { milsawdeatail };
  1473. ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1474. if (ccp.ReturnCode != -1)
  1475. {
  1476. if (ccp.ReturnInfo.Equals("修改成功!"))
  1477. {
  1478. }
  1479. else
  1480. {
  1481. MessageUtil.ShowTips(ccp.ReturnInfo);
  1482. }
  1483. }
  1484. DataTable dthas = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipSawFast.GetCountHasSaw", new object[] { HeatNo, proPlanId, gxPlanNo }, this._ob);
  1485. if (dthas.Rows.Count > 0)
  1486. {
  1487. checktotalnumhas = int.Parse(dthas.Rows[0]["counts"].ToString());
  1488. }
  1489. this.ultraGrid2.Rows[0].Cells["TotalNumHas"].Value = checktotalnumhas;
  1490. this.ultraGrid2.Rows[0].Cells["btnCUTORDER"].Column.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always;
  1491. this.ultraGrid2.Rows[0].Cells["btnCUTORDER"].Column.CellButtonAppearance.BackColor = Color.Yellow;
  1492. }
  1493. }
  1494. if (e.Cell.Column.Key == "btnCUTTAIL")//快速分切切尾
  1495. {
  1496. if (checktotalnumhas == 0)
  1497. {
  1498. MessageBox.Show("炉号:【" + HeatNo + "】还未开始切头,不允许进行切尾操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1499. return;
  1500. }
  1501. if (this.ultraGrid2.Rows[0].Cells["CUT_TRAIL_LENGTHA"].Text == "")
  1502. {
  1503. MessageBox.Show("切尾长度不能为空,请输入!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1504. return;
  1505. }
  1506. milsawdeatail.CutTrailLength = this.ultraGrid2.Rows[0].Cells["CUT_TRAIL_LENGTHA"].Value;
  1507. //milsawdeatail.CutTrailLengthTotal = float.Parse(milsawdeatail.RowCount.ToString()) * float.Parse(milsawdeatail.CutTrailLength.ToString());
  1508. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipSawFast.UPDATETAIL", new object[] { milsawdeatail }, this._ob);
  1509. if (count < 0)
  1510. {
  1511. MessageBox.Show("快速切尾失败,请查找原因后重新操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1512. }
  1513. else
  1514. {
  1515. DataTable dthas = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipSawFast.GetCountHasSaw", new object[] { HeatNo, proPlanId, gxPlanNo }, this._ob);
  1516. if (dthas.Rows.Count > 0)
  1517. {
  1518. checktotalnumhas = int.Parse(dthas.Rows[0]["counts"].ToString());
  1519. }
  1520. this.ultraGrid2.Rows[0].Cells["TotalNumHas"].Value = checktotalnumhas;
  1521. this.ultraGrid2.Rows[0].Cells["btnCUTTAIL"].Column.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always;
  1522. this.ultraGrid2.Rows[0].Cells["btnCUTTAIL"].Column.CellButtonAppearance.BackColor = Color.Yellow;
  1523. }
  1524. }
  1525. if (e.Cell.Column.Key == "btnCUTEND")//快速分切结束
  1526. {
  1527. DataTable dtDeatails = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipeSawResult.GetResultDetail", new object[] { HeatNo, proPlanId, gxPlanNo }, this._ob);
  1528. if (dtDeatails.Rows.Count == 0)
  1529. {
  1530. MessageBox.Show("炉号:【" + HeatNo + "】还未开始切头,快速分切还未开始。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1531. return;
  1532. }
  1533. int result = 0;
  1534. foreach (DataRow dr in dtDeatails.Rows)
  1535. {
  1536. if (string.IsNullOrEmpty(dr["CUT_TRAIL_LENGTH"].ToString()))
  1537. {
  1538. result = 1;
  1539. }
  1540. if (string.IsNullOrEmpty(dr["ORDER_LENGTH"].ToString()))
  1541. {
  1542. result = 1;
  1543. }
  1544. }
  1545. if (result == 1)
  1546. {
  1547. MessageBox.Show("炉号:【" + HeatNo + "】还未完成分切,不允许进行分切结束操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1548. return;
  1549. }
  1550. int last = checktotalnumhas % rowcount;//最后一排的支数
  1551. this.lastnum = last;
  1552. this.rowcounts = rowcount;
  1553. int rowno = checktotalnumhas / rowcount;//总排数-1
  1554. if (last > 0)
  1555. {
  1556. rowno = rowno + 1;
  1557. }
  1558. milsawdeatail.SawFlag = "1";
  1559. milsawdeatail.OrderLength = this.ultraGrid2.Rows[0].Cells["ORDER_LENGTHA"].Text;
  1560. ccp.ServerName = "com.steering.mes.zgmil.coup.PipSawFast";
  1561. ccp.MethodName = "updatePortOrderLength";
  1562. ccp.ServerParams = new object[] { milsawdeatail };
  1563. ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1564. if (ccp.ReturnCode != -1)
  1565. {
  1566. if (ccp.ReturnInfo.Equals("修改成功!"))
  1567. {
  1568. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.PipSawFast.UPDATESawFlag", new object[] { milsawdeatail }, this._ob);
  1569. if (count < 0)
  1570. {
  1571. MessageBox.Show("快速切尾失败,请查找原因后重新操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1572. }
  1573. else
  1574. {
  1575. this.InsertColNEW(rownoBefore, rowno);
  1576. this.Dispose();
  1577. this.Close();
  1578. }
  1579. }
  1580. else
  1581. {
  1582. MessageUtil.ShowTips(ccp.ReturnInfo);
  1583. }
  1584. }
  1585. }
  1586. // dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipSawFast.GetCountWithoutDel", new object[] { HeatNo }, this._ob);
  1587. //if (dt.Rows.Count > 0)
  1588. //{
  1589. // checktotalnum = int.Parse(dt.Rows[0]["counts"].ToString());
  1590. //}
  1591. //else
  1592. //{
  1593. // MessageBox.Show("炉号:【" + HeatNo + "】未开始上料锯切,或未开始分切,请确认后重新进行快速分切操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1594. // return;
  1595. //}
  1596. // dt2 = ServerHelper.GetData("com.steering.mes.zgmil.coup.PipSawFast.GetCountHasSaw", new object[] { HeatNo }, this._ob);
  1597. //if (dt2.Rows.Count > 0)
  1598. //{
  1599. // checktotalnumhas = int.Parse(dt2.Rows[0]["counts"].ToString());
  1600. //}
  1601. //this.ultraGrid2.Rows[0].Cells["TotalNumHas"].Value = checktotalnumhas;
  1602. //CoreClientParam ccp1 = new CoreClientParam();
  1603. //ccp1.ServerName = "com.steering.mes.zgmil.coup.EddyCurrentTestingResult";
  1604. //ccp1.MethodName = "scrapMatCheck";
  1605. //ccp1.ServerParams = new Object[] { HeatNo, 7 };
  1606. //ccp1 = this._ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1607. //ScrapNumBefore = Convert.ToInt32(ccp1.ReturnInfo);//前几道工序剔除支数
  1608. //checktotalnum = checktotalnum - ScrapNumBefore;//当前可切支数
  1609. //totalnum = checktotalnum;
  1610. //this.ultraGrid2.Rows[0].Cells["TotalNum"].Value = totalnum;
  1611. }
  1612. /// <summary>
  1613. /// 关闭当前页面,刷新分切页面管号队列
  1614. /// </summary>
  1615. /// <param name="sender"></param>
  1616. /// <param name="e"></param>
  1617. private void PipSawFast_FormClosed(object sender, FormClosedEventArgs e)
  1618. {
  1619. this.isRefresh = true;
  1620. this.DialogResult = DialogResult.OK;
  1621. //GridHelper.CopyDataToDatatable(ref dt, ref f1.dtMat, true);
  1622. }
  1623. private void ultraGrid2_CellChange(object sender, CellEventArgs e)
  1624. {
  1625. this.ultraGrid2.UpdateData();
  1626. if (this.ultraGrid2.Rows[0].Cells["SAW31"].Value != null)
  1627. {
  1628. //2#台选择的锯进行联动
  1629. if (this.ultraGrid2.Rows[0].Cells["SAW31"].Value.ToString() == "True")
  1630. {
  1631. //this.ultraGrid2.Rows[0].Cells["SAW32"].Value = "False";
  1632. //this.saw211 = "3";
  1633. //this.saw211 = this.ultraGrid2.Rows[0].Cells["SAW31"].Column.Header.Caption.ToString2().Substring(0, 1);
  1634. this.saw21 = this.ultraGrid2.Rows[0].Cells["SAW31"].Column.Header.Caption.ToString2().Substring(0, 1);
  1635. }
  1636. else
  1637. {
  1638. //this.saw211 = "";
  1639. this.saw21 = "";
  1640. }
  1641. }
  1642. //if (this.ultraGrid2.Rows[0].Cells["SAW32"].Value != null)
  1643. //{
  1644. // if (this.ultraGrid2.Rows[0].Cells["SAW32"].Value.ToString() == "True")
  1645. // {
  1646. // //this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "False";
  1647. // //this.saw221 = "3";
  1648. // this.saw221 = this.ultraGrid2.Rows[0].Cells["SAW32"].Column.Header.Caption.ToString2().Substring(0, 1);
  1649. // }
  1650. // else
  1651. // {
  1652. // this.saw221 = "";
  1653. // }
  1654. //}
  1655. if (this.ultraGrid2.Rows[0].Cells["SAW41"].Value != null)
  1656. {
  1657. if (this.ultraGrid2.Rows[0].Cells["SAW41"].Value.ToString() == "True")
  1658. {
  1659. //this.ultraGrid2.Rows[0].Cells["SAW42"].Value = "False";
  1660. //this.saw212 = "4";
  1661. //this.saw212 = this.ultraGrid2.Rows[0].Cells["SAW41"].Column.Header.Caption.ToString2().Substring(0, 1);
  1662. this.saw22 = this.ultraGrid2.Rows[0].Cells["SAW41"].Column.Header.Caption.ToString2().Substring(0, 1);
  1663. }
  1664. else
  1665. {
  1666. //this.saw212 = "";
  1667. this.saw22 = "";
  1668. }
  1669. }
  1670. //if (this.ultraGrid2.Rows[0].Cells["SAW42"].Value != null)
  1671. //{
  1672. // if (this.ultraGrid2.Rows[0].Cells["SAW42"].Value.ToString() == "True")
  1673. // {
  1674. // this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "False";
  1675. // // this.saw222 = "4";
  1676. // this.saw222 = this.ultraGrid2.Rows[0].Cells["SAW42"].Column.Header.Caption.ToString2().Substring(0, 1);
  1677. // }
  1678. // else
  1679. // {
  1680. // this.saw222 = "";
  1681. // }
  1682. //}
  1683. if (this.ultraGrid2.Rows[0].Cells["COL_NO11"].Value != null)
  1684. {
  1685. if (this.ultraGrid2.Rows[0].Cells["COL_NO11"].Value.ToString() == "True")
  1686. {
  1687. this.colno1 = "1";
  1688. }
  1689. else
  1690. {
  1691. this.colno1 = "";
  1692. }
  1693. }
  1694. if (this.ultraGrid2.Rows[0].Cells["COL_NO21"].Value != null)
  1695. {
  1696. if (this.ultraGrid2.Rows[0].Cells["COL_NO21"].Value.ToString() == "True")
  1697. {
  1698. this.colno2 = "2";
  1699. }
  1700. else
  1701. {
  1702. this.colno2 = "";
  1703. }
  1704. }
  1705. if (this.ultraGrid2.Rows[0].Cells["COL_NO31"].Value != null)
  1706. {
  1707. if (this.ultraGrid2.Rows[0].Cells["COL_NO31"].Value.ToString() == "True")
  1708. {
  1709. //if (!(this.ultraGrid2.Rows[0].Cells["SAW31"].Value.ToString() == "True" && this.ultraGrid2.Rows[0].Cells["SAW41"].Value.ToString() == "True" && this.ultraGrid2.Rows[0].Cells["SAW1"].Value.ToString() == "True" && this.ultraGrid2.Rows[0].Cells["SAW2"].Value.ToString() == "True"))
  1710. //{
  1711. // MessageBox.Show("您未将所有的锯勾选,不允许选择第三号矫直线", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1712. // this.colno3 = "";
  1713. // return;
  1714. //}
  1715. this.colno3 = "3";
  1716. }
  1717. else
  1718. {
  1719. this.colno3 = "";
  1720. }
  1721. }
  1722. #region 上料台锯号限制 分料台锯号选择(取消)
  1723. //if(this.ultraGrid2.Rows[0].Cells["SAW1"].Value != null)
  1724. //{
  1725. // if (this.ultraGrid2.Rows[0].Cells["SAW1"].Value.ToString() == "True")
  1726. // {
  1727. // this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW31"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  1728. // this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW41"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  1729. // }
  1730. // else
  1731. // {
  1732. // this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW31"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled;
  1733. // this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW41"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled;
  1734. // this.ultraGrid2.Rows[0].Cells["SAW31"].Value = "False";
  1735. // this.ultraGrid2.Rows[0].Cells["SAW41"].Value = "False";
  1736. // }
  1737. //}
  1738. //if (this.ultraGrid2.Rows[0].Cells["SAW2"].Value != null)
  1739. //{
  1740. // if (this.ultraGrid2.Rows[0].Cells["SAW2"].Value.ToString() == "True")
  1741. // {
  1742. // this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW32"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  1743. // this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW42"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  1744. // }
  1745. // else
  1746. // {
  1747. // this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW32"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled;
  1748. // this.ultraGrid2.DisplayLayout.Bands[0].Columns["SAW42"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled;
  1749. // this.ultraGrid2.Rows[0].Cells["SAW32"].Value = "False";
  1750. // this.ultraGrid2.Rows[0].Cells["SAW42"].Value = "False";
  1751. // }
  1752. //}
  1753. #endregion
  1754. }
  1755. }
  1756. }