QCM0201RZ.cs 106 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;
  10. using System.Collections;
  11. using Infragistics.Win.UltraWinGrid;
  12. using Infragistics.Win;
  13. using System.Drawing.Printing;
  14. using System.IO;
  15. using System.Drawing.Imaging;
  16. using System.Drawing.Drawing2D;
  17. using ThoughtWorks.QRCode.Codec;
  18. using System.Diagnostics;
  19. namespace Core.LZMes.Client.QCM
  20. {
  21. public partial class QCM0201RZ : FrmBase
  22. {
  23. #region 初始化
  24. //Boolean textboxHasText = false;//判断输入框是否有文本
  25. private String v_line_no = "";//RZ1-热轧 ZB1-中板线 HB1-厚板线 LT1-连退
  26. Image image2;//二维码
  27. private String v_BATCH_NO = "";//轧批号
  28. private String PRINT_SEQV = "";//打印序号
  29. private int lennum = 0;//长度
  30. public QCM0201RZ()
  31. {
  32. InitializeComponent();
  33. }
  34. private void QCM0201RZ_Load(object sender, EventArgs e)
  35. {
  36. //获取自定义参数
  37. if (!this.CustomInfo.Equals(""))
  38. {
  39. v_line_no = this.CustomInfo;
  40. }
  41. // this.ultraGrid1.DisplayLayout.Bands[0].Columns["PHY_NAME_L_bj"].Header.Caption = "检验项目";
  42. // this.ultraGrid4.DisplayLayout.Bands[0].Columns["PHY_NAME_L_bj"].Header.Caption = "检验项目";
  43. //dateTimePicker1.Value = DateTime.Now.Date.AddDays(-1);
  44. dateTimePicker2.Value = DateTime.Now.Date.AddDays(1);
  45. ValueList v = new ValueList();
  46. v.ValueListItems.Add("1", "是");
  47. v.ValueListItems.Add("0", "否");
  48. this.ultraGrid3.DisplayLayout.Bands[0].Columns["ISJUDGE"].ValueList = v.Clone();
  49. ValueList v1 = new ValueList();
  50. v1.ValueListItems.Add("0", "订单");
  51. v1.ValueListItems.Add("1", "人工");
  52. this.ultraGrid3.DisplayLayout.Bands[0].Columns["ITEM_FLAG"].ValueList = v1.Clone();
  53. this.ultraGrid6.DisplayLayout.Bands[0].Columns["ITEM_FLAG"].ValueList = v1.Clone();
  54. v1 = new ValueList();
  55. v1.ValueListItems.Add("0", "订单");
  56. v1.ValueListItems.Add("1", "人工复制");
  57. this.ultraGrid1.DisplayLayout.Bands[0].Columns["ITEM_FLAG"].ValueList = v1.Clone();
  58. this.ultraGrid4.DisplayLayout.Bands[0].Columns["ITEM_FLAG"].ValueList = v1.Clone();
  59. ValueList v2 = new ValueList();
  60. v2.ValueListItems.Add("A", "成分");
  61. v2.ValueListItems.Add("B", "材质");
  62. this.ultraGrid1.DisplayLayout.Bands[0].Columns["smp_catg"].ValueList = v2.Clone();
  63. this.ultraGrid4.DisplayLayout.Bands[0].Columns["smp_catg"].ValueList = v2.Clone();
  64. //ValueList v3 = new ValueList();
  65. //v3.ValueListItems.Add("", "");
  66. //v3.ValueListItems.Add("A", "金相");
  67. //v3.ValueListItems.Add("B", "重量偏差");
  68. //v3.ValueListItems.Add("C", "金相&重量偏差");
  69. //this.ultraGrid1.DisplayLayout.Bands[0].Columns["SEND_MEMO"].ValueList = v3.Clone();
  70. //this.ultraGrid4.DisplayLayout.Bands[0].Columns["SEND_MEMO"].ValueList = v3.Clone();
  71. if (!this.checkBox1.Checked)
  72. {
  73. this.textBox1.Enabled = false;
  74. this.BATCH_NO2.Enabled = false;
  75. }
  76. // this.DoQuery();
  77. }
  78. #endregion
  79. #region 功能
  80. public override void ToolBar_Click(object sender, string ToolbarKey)
  81. {
  82. switch (ToolbarKey)
  83. {
  84. case "Query":
  85. this.DoQuery();
  86. break;
  87. case "Send":
  88. this.DoSend();//发送委托
  89. break;
  90. case "SendRZ":
  91. this.DoSendRZ();//热轧 组批区间 人工抽样
  92. break;
  93. case "Unsend":
  94. this.DoUnsend();//撤销委托
  95. break;
  96. case "Add":
  97. this.AddBasePhy();//新增检验项
  98. break;
  99. case "AddArtificial":
  100. this.AddArtificial();//新增人工委托
  101. break;
  102. case "Update":
  103. this.DoUpdate();//修改取样材料号
  104. break;
  105. case "AddWt":
  106. this.DoAddWt();//新增复制单条委托
  107. break;
  108. case "DelWt":
  109. this.DoDelWt();//撤销复制单条委托
  110. break;
  111. case "DoDelete":
  112. this.DoDelete();//删除委托
  113. break;
  114. case "DoEject":
  115. this.DoEject();//卷板质量异常处理
  116. break;
  117. case "UpBatchNo":
  118. this.DoUpBatchNo();//复样 修改轧批号 (一炉5个轧批 1 2 3 4 5 取1号轧批委托 夹杂不合格 复 2 3轧批)
  119. break;
  120. case "UpRefBatchNo":
  121. this.DoUpRefBatchNo();//初样 修改指定的按炉引用 (一炉5个轧批 1 2 3 4 5 系统默认为 1 但是现场实际取的是3 所以要人工修改)
  122. break;
  123. case "CleanUpMixRoll":
  124. this.CleanUpMixRoll();//清空库存组批区间
  125. break;
  126. case "doPrint":
  127. this.doPrint();//打印
  128. break;
  129. case "SendJG":
  130. this.DoSendJG();//补发激光
  131. break;
  132. case "ForecastRZ":
  133. this.DoForecastRZ();//预测换样
  134. break;
  135. case "InExport":
  136. this.InExcel();//导出
  137. break;
  138. }
  139. }
  140. #region 打印
  141. private void doPrint()
  142. {
  143. RowsCollection rowsCollection = this.ultraGrid1.Rows;
  144. if (this.ultraTabControl1.Tabs[0].Selected) //检验委托
  145. {
  146. rowsCollection = this.ultraGrid1.Rows;
  147. }
  148. else if (this.ultraTabControl1.Tabs[1].Selected)
  149. {
  150. rowsCollection = this.ultraGrid4.Rows;
  151. }
  152. foreach (UltraGridRow ugr in rowsCollection)
  153. {
  154. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  155. {
  156. String specimenNo = ugr.Cells["SPECIMEN_NO"].Value.ToString();//取样编号
  157. String materialNo = ugr.Cells["MATERIAL_NO"].Value.ToString();//子板号
  158. String batchNO = ugr.Cells["BATCH_NO"].Value.ToString();//轧批号
  159. String steelName = ugr.Cells["STEEL_NAME"].Value.ToString();//钢种
  160. String thck = ugr.Cells["THICK"].Value.ToString();//规格
  161. String phyNameLbj = ugr.Cells["PHY_NAME_L_bj"].Value.ToString();//项目
  162. String STATUS = ugr.Cells["STATUS"].Value.ToString();//发送状态
  163. String PRINT_SEQ = ugr.Cells["PRINT_SEQ"].Value.ToString();//打印序号
  164. if (STATUS.Equals("未发送"))
  165. {
  166. this.alert("当前委托还未发送!请先发送委托");
  167. return;
  168. }
  169. if (string.IsNullOrEmpty(specimenNo))
  170. {
  171. this.alert("未找到相应委托数据!请核实!!!");
  172. return;
  173. }
  174. if (string.IsNullOrEmpty(PRINT_SEQ))
  175. {
  176. PRINT_SEQ = "1";
  177. }
  178. v_BATCH_NO = materialNo;//轧批号 batchNO 换成子板号240126
  179. PRINT_SEQV = PRINT_SEQ;
  180. //二维码内容
  181. //" 子板:" + materialNo +"轧批:" + batchNO + " 钢种:" + steelName + " 规格:" + thck + " 项目:" + phyNameLbj+ " 序号:" + PRINT_SEQV
  182. String qrCodeContent = specimenNo;
  183. QRCodeEncoder qrCodeEncoder = new QRCodeEncoder();
  184. qrCodeEncoder.QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE;//二维码编码格式
  185. int num =qrCodeContent.Length;
  186. lennum = num;
  187. if (num<=90)
  188. {
  189. qrCodeEncoder.QRCodeScale = 5;
  190. qrCodeEncoder.QRCodeVersion = 2;//设置二维码的版本,默认7
  191. }
  192. else{
  193. qrCodeEncoder.QRCodeScale = 6;//二维码大小比例4
  194. qrCodeEncoder.QRCodeVersion = 14;//设置二维码的版本,默认7 该值影响二维码最高数据容量 7大致对应40个汉字长度,内容超出择需提升该数值
  195. }
  196. //设置错误校验级别,默认中等,二维码被遮挡住一部分实际上也是能扫出内容的,这个效验级别的意思就是
  197. //当遮挡部分最大占整体多少时仍然可以被扫出来,M大概在20%左右,H为30%,级别越高相应的数据容量会缩小
  198. qrCodeEncoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M;
  199. System.Drawing.Image image = qrCodeEncoder.Encode(qrCodeContent, Encoding.UTF8);//生成二维码图片 第一个参数打印内容
  200. image2 = image;
  201. string FilePath = @"C:\二维码";
  202. if (!Directory.Exists(FilePath))
  203. {
  204. Directory.CreateDirectory(FilePath);//判断是否有相应文件夹
  205. }
  206. PrintDocument printDocument = new PrintDocument();
  207. printDocument.PrinterSettings.PrinterName = "Deli DL-888T";//打印机名
  208. printDocument.PrintPage += new PrintPageEventHandler(pdt_PrintPage);//设置字体
  209. try
  210. {
  211. if (!printDocument.PrinterSettings.IsValid)
  212. {
  213. MessageBox.Show("打印设置无效!", "出错", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  214. return;
  215. }
  216. printDocument.Print();
  217. }
  218. catch (Exception ex)
  219. {
  220. MessageBox.Show("打印过程出现异常!\n" + ex.Message, "出错", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  221. }
  222. finally
  223. {
  224. printDocument.Dispose();
  225. }
  226. //增加打印标识
  227. CoreClientParam ccp = new CoreClientParam();
  228. ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo";
  229. ccp.MethodName = "doPrintLog";
  230. ccp.ServerParams = new object[] { specimenNo };
  231. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  232. //保存二维码
  233. //FilePath = @"C:\二维码\" + batchNO + "二维码.jpg";
  234. //System.IO.FileStream fs = new System.IO.FileStream(FilePath, System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.None);
  235. //image.Save(fs, System.Drawing.Imaging.ImageFormat.Jpeg);
  236. //fs.Close();
  237. image.Dispose();
  238. }
  239. }
  240. }
  241. void pdt_PrintPage(object sender, PrintPageEventArgs e)
  242. {
  243. // e.Graphics.TranslateTransform(135, 255);
  244. //e.Graphics.RotateTransform(90.0F);
  245. Graphics grfx = e.Graphics;
  246. //grfx.DrawString(v_BATCH_NO, new Font("宋体", 20), Brushes.Black, 125, 366);//打印内容、字体、颜色、X、Y
  247. //grfx.DrawImage(image2, 135, 255, 120, 110);//图片、X、Y、宽、高
  248. grfx.DrawString(PRINT_SEQV, new Font("宋体", 15), Brushes.Black, 22, 70);//打印内容、字体、颜色、X、Y
  249. grfx.DrawString(v_BATCH_NO, new Font("宋体", 14), Brushes.Black, 68, 130);//打印内容、字体、颜色、X、Y
  250. grfx.DrawImage(image2, 70, 15, 120, 110);//图片、X、Y、宽、高
  251. //if (lennum <= 90)
  252. //{
  253. //}
  254. //else
  255. //{
  256. // //grfx.DrawString(v_BATCH_NO, new Font("宋体", 16), Brushes.Black, 125, 370);
  257. // //grfx.DrawImage(image2, 120, 250, 140, 120);
  258. //}
  259. }
  260. #endregion
  261. #endregion
  262. #region 功能方法
  263. #region 初样 修改取样轧批号按炉初样比如:夹杂
  264. private void DoUpRefBatchNo()
  265. {
  266. try
  267. {
  268. CoreClientParam ccp = new CoreClientParam();
  269. ArrayList smpNo = new ArrayList();//试样号
  270. ArrayList specimenNo = new ArrayList();//取样编号
  271. ArrayList batchNo = new ArrayList();//轧批号
  272. ArrayList heatnNo = new ArrayList();//炉号
  273. ArrayList materialNo = new ArrayList();//取样材料号
  274. ArrayList send_memo = new ArrayList();//发送备注
  275. ArrayList inspectionLot = new ArrayList();//检验号
  276. ArrayList plineCode = new ArrayList();
  277. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  278. {
  279. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  280. {
  281. if (!ugr.Cells["SMP_TYPE_CODE"].Value.ToString().Equals("0") || !ugr.Cells["FREQ_CODE"].Value.ToString().Equals("D"))
  282. {
  283. this.alert("修改初样取样轧批号按钮是用来修改按炉取样的轧批,请谨慎操作!");
  284. return;
  285. }
  286. smpNo.Add(ugr.Cells["SMP_NO"].Value.ToString());
  287. specimenNo.Add(ugr.Cells["SPECIMEN_NO"].Value.ToString());
  288. batchNo.Add(ugr.Cells["BATCH_NO"].Value.ToString());
  289. heatnNo.Add(ugr.Cells["HEAT_NO"].Value.ToString());
  290. materialNo.Add(ugr.Cells["MATERIAL_NO"].Value.ToString());
  291. send_memo.Add(ugr.Cells["SEND_MEMO"].Value.ToString());
  292. inspectionLot.Add(ugr.Cells["INSPECTION_LOT"].Value.ToString());
  293. plineCode.Add(ugr.Cells["PLINE_CODE"].Value.ToString());
  294. }
  295. }
  296. ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo";
  297. ccp.MethodName = "DoUpRefBatchNo";
  298. ccp.ServerParams = new object[] { smpNo, specimenNo, batchNo, heatnNo, materialNo, send_memo, inspectionLot, plineCode };
  299. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  300. if (ccp.ReturnCode != -1)
  301. {
  302. MessageBox.Show("修改成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);
  303. }
  304. this.DoQuery();
  305. }
  306. catch (Exception ex)
  307. {
  308. System.Diagnostics.Debug.WriteLine(ex.ToString());
  309. MessageBox.Show("系统出错【初样修改轧批号】,请联系管理人员", "警告");
  310. }
  311. }
  312. #endregion
  313. #region 复样 修改轧批号
  314. private void DoUpBatchNo()
  315. {
  316. try
  317. {
  318. CoreClientParam ccp = new CoreClientParam();
  319. ArrayList smpNo = new ArrayList();//试样号
  320. ArrayList specimenNo = new ArrayList();//取样编号
  321. ArrayList batchNo = new ArrayList();//轧批号
  322. ArrayList materialNo = new ArrayList();//取样材料号
  323. ArrayList send_memo = new ArrayList();//发送备注
  324. ArrayList inspectionLot = new ArrayList();//检验号
  325. ArrayList plineCode = new ArrayList();
  326. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  327. {
  328. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  329. {
  330. if ((!ugr.Cells["SMP_TYPE_CODE"].Value.ToString().Equals("1") && !ugr.Cells["SMP_TYPE_CODE"].Value.ToString().Equals("3")) || !ugr.Cells["FREQ_CODE"].Value.ToString().Equals("D"))
  331. {
  332. this.alert("修改复样轧批号按钮是用来修改按炉取样的轧批,请谨慎操作!");
  333. return;
  334. }
  335. smpNo.Add(ugr.Cells["SMP_NO"].Value.ToString());
  336. specimenNo.Add(ugr.Cells["SPECIMEN_NO"].Value.ToString());
  337. batchNo.Add(ugr.Cells["BATCH_NO"].Value.ToString());
  338. materialNo.Add(ugr.Cells["MATERIAL_NO"].Value.ToString());
  339. send_memo.Add(ugr.Cells["SEND_MEMO"].Value.ToString());
  340. inspectionLot.Add(ugr.Cells["INSPECTION_LOT"].Value.ToString());
  341. plineCode.Add(ugr.Cells["PLINE_CODE"].Value.ToString());
  342. }
  343. }
  344. ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo";
  345. ccp.MethodName = "updateBatchNo";
  346. ccp.ServerParams = new object[] { smpNo, specimenNo, batchNo, materialNo, send_memo, inspectionLot, plineCode };
  347. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  348. if (ccp.ReturnCode != -1)
  349. {
  350. MessageBox.Show("修改成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);
  351. }
  352. this.DoQuery();
  353. }
  354. catch (Exception ex)
  355. {
  356. System.Diagnostics.Debug.WriteLine(ex.ToString());
  357. MessageBox.Show("系统出错【复样修改轧批号】,请联系管理人员", "警告");
  358. }
  359. }
  360. #endregion
  361. #region 修改取样材料号
  362. private void DoUpdate()
  363. {
  364. try
  365. {
  366. // String plineCode = this.CustomInfo;
  367. CoreClientParam ccp = new CoreClientParam();
  368. ArrayList smpNo = new ArrayList();//试样号
  369. ArrayList specimenNo = new ArrayList();//取样编号
  370. ArrayList batchNo = new ArrayList();//轧批号
  371. ArrayList materialNo = new ArrayList();//取样材料号
  372. ArrayList send_memo = new ArrayList();//发送备注
  373. ArrayList inspectionLot = new ArrayList();//检验号
  374. ArrayList plineCode = new ArrayList();
  375. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  376. {
  377. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  378. {
  379. smpNo.Add(ugr.Cells["SMP_NO"].Value.ToString());
  380. specimenNo.Add(ugr.Cells["SPECIMEN_NO"].Value.ToString());
  381. batchNo.Add(ugr.Cells["BATCH_NO"].Value.ToString());
  382. materialNo.Add(ugr.Cells["OLD_SAMPL_NO"].Value.ToString());//勾选了那个钢卷号,就代表送的那个样
  383. send_memo.Add(ugr.Cells["SEND_MEMO"].Value.ToString());
  384. inspectionLot.Add(ugr.Cells["INSPECTION_LOT"].Value.ToString());
  385. plineCode.Add(ugr.Cells["PLINE_CODE"].Value.ToString());
  386. }
  387. }
  388. ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo";
  389. ccp.MethodName = "updateMaterialNo";
  390. ccp.ServerParams = new object[] { smpNo, specimenNo, batchNo, materialNo, send_memo, inspectionLot, plineCode };
  391. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  392. }
  393. catch (Exception ex)
  394. {
  395. System.Diagnostics.Debug.WriteLine(ex.ToString());
  396. MessageBox.Show("系统出错【修改取样材料号】,请联系管理人员", "警告");
  397. }
  398. }
  399. #endregion
  400. #region 新增人工委托
  401. private void AddArtificial()
  402. {
  403. try
  404. {
  405. UltraGridRow row = this.ultraGrid1.ActiveRow;
  406. //if (row == null)
  407. //{
  408. // this.alert("检验委托为空!请选择检验委托数据!!!");
  409. // return;
  410. //}
  411. //if (!String.IsNullOrEmpty(row.Cells["MIXROLL"].Text.ToString()))
  412. //{
  413. // this.alert("组批区间不为空!!!");
  414. // return;
  415. //}
  416. Hashtable ht = new Hashtable();
  417. if(row != null){
  418. ht.Add("BATCH_NO", row.Cells["BATCH_NO"].Text.ToString());
  419. }
  420. QCM0205 frmRbp = new QCM0205();
  421. frmRbp.StartPosition = FormStartPosition.CenterScreen;
  422. frmRbp.ob = this.ob;
  423. frmRbp.plineCode = "RZ1";
  424. frmRbp.hashTable = ht;
  425. frmRbp.ShowDialog();
  426. this.DoQuery();
  427. }
  428. catch (Exception ex)
  429. {
  430. MessageBox.Show("操作过程出现异常!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  431. }
  432. }
  433. #endregion
  434. #region 新增检验项
  435. private void AddBasePhy()
  436. {
  437. try
  438. {
  439. UltraGridRow row = this.ultraGrid1.ActiveRow;
  440. if (row == null)
  441. {
  442. this.alert("检验委托为空!请选择检验委托数据!!!");
  443. return;
  444. }
  445. if (!row.Cells["SMP_CATG"].Text.ToString().Equals("材质"))
  446. {
  447. this.alert("只有材质数据才可以新增检验项!!!");
  448. return;
  449. }
  450. if (!row.Cells["STATUS"].Value.ToString().Equals("未发送"))
  451. {
  452. this.alert("请选择状态为未发送的委托!!!");
  453. return;
  454. }
  455. QCM0204 frmRbp = new QCM0204();
  456. frmRbp.StartPosition = FormStartPosition.CenterScreen;
  457. frmRbp.ob = this.ob;
  458. frmRbp.specimenNo = row.Cells["SPECIMEN_NO"].Value.ToString();
  459. frmRbp.smpNo = row.Cells["SMP_NO"].Value.ToString();
  460. frmRbp.plineCode = "RZ1";
  461. frmRbp.ShowDialog();
  462. this.DoQueryPrg(row);//右下角
  463. }
  464. catch (Exception ex)
  465. {
  466. MessageBox.Show("操作过程出现异常!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  467. }
  468. }
  469. #endregion
  470. #region 新增复制单条委托
  471. private void DoAddWt()
  472. {
  473. try
  474. {
  475. int num = 0;
  476. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  477. {
  478. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  479. {
  480. num = num + 1;
  481. }
  482. if (!ugr.Cells["STATUS"].Value.ToString().Equals("未发送"))
  483. {
  484. this.alert("请选择状态为未发送的委托!!!");
  485. return;
  486. }
  487. }
  488. if (num > 1)
  489. {
  490. this.alert("只能单条复制!为防止数据差错谢谢配合【谨慎复制】");
  491. return;
  492. }
  493. UltraGridRow row = this.ultraGrid1.ActiveRow;
  494. if (row == null)
  495. {
  496. this.alert("检验委托为空!请选择检验委托数据!!!");
  497. return;
  498. }
  499. String batchNo = row.Cells["BATCH_NO"].Value.ToString();//轧批号
  500. String designKey = row.Cells["DESIGN_KEY"].Value.ToString();//订单号
  501. String smpNo = row.Cells["SMP_NO"].Value.ToString();//试样号
  502. String specimenNo = row.Cells["SPECIMEN_NO"].Value.ToString();//取样编号
  503. String smpTypeName = row.Cells["SMP_TYPE_NAME"].Value.ToString();//取样类型
  504. if (MessageBox.Show("轧批号【" + batchNo + "】,确认复制当前委托一条?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  505. {
  506. return;
  507. }
  508. CoreClientParam ccp = new CoreClientParam();
  509. ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo";
  510. if (smpTypeName.Equals("初样"))
  511. {
  512. ccp.MethodName = "DoAddWtZy";
  513. }
  514. else if (smpTypeName.Equals("复样"))
  515. {
  516. ccp.MethodName = "DoAddWtFy";
  517. }
  518. ccp.ServerParams = new object[] { batchNo, designKey, smpNo, specimenNo, this.UserInfo.GetUserName() };
  519. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  520. if (ccp.ReturnCode != -1)
  521. {
  522. MessageBox.Show("复制委托成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);
  523. }
  524. this.DoQuery();
  525. }
  526. catch (Exception ex)
  527. {
  528. MessageBox.Show("操作过程出现异常!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  529. }
  530. }
  531. #endregion
  532. #region 撤销复制单条委托
  533. private void DoDelWt()
  534. {
  535. try
  536. {
  537. int num = 0;
  538. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  539. {
  540. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  541. {
  542. num = num + 1;
  543. }
  544. String status = ugr.Cells["STATUS"].Value.ToString();
  545. if (!status.Equals("0") && !status.Equals("未发送") && !String.IsNullOrEmpty(status))
  546. {
  547. this.alert("当前委托状态不为未发送");
  548. return;
  549. }
  550. }
  551. if (num > 1)
  552. {
  553. this.alert("只能单条删除!为防止数据差错谢谢配合【谨慎删除】");
  554. return;
  555. }
  556. UltraGridRow row = this.ultraGrid1.ActiveRow;
  557. if (row == null)
  558. {
  559. this.alert("检验委托为空!请选择检验委托数据!!!");
  560. return;
  561. }
  562. String batchNo = row.Cells["BATCH_NO"].Value.ToString();//轧批号
  563. String designKey = row.Cells["DESIGN_KEY"].Value.ToString();//订单号
  564. String smpNo = row.Cells["SMP_NO"].Value.ToString();//试样号
  565. String specimenNo = row.Cells["SPECIMEN_NO"].Value.ToString();//取样编号
  566. String smpTypeName = row.Cells["SMP_TYPE_NAME"].Value.ToString();//取样类型
  567. String item_flag = row.Cells["ITEM_FLAG"].Value.ToString();//项目来源(0-订单,1-人工)
  568. if (MessageBox.Show("轧批号【" + batchNo + "】,确认撤销当前委托?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  569. {
  570. return;
  571. }
  572. if (!item_flag.Equals("1"))
  573. {
  574. this.alert("只能撤销人工复制委托");
  575. return;
  576. }
  577. CoreClientParam ccp = new CoreClientParam();
  578. ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo";
  579. if (smpTypeName.Equals("初样"))
  580. {
  581. ccp.MethodName = "DoDelWtZy";
  582. }
  583. else if (smpTypeName.Equals("复样"))
  584. {
  585. ccp.MethodName = "DoDelWtFy";
  586. }
  587. ccp.ServerParams = new object[] { batchNo, designKey, smpNo, specimenNo };
  588. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  589. if (ccp.ReturnCode != -1)
  590. {
  591. MessageBox.Show("撤销复制委托成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);//ccp.ReturnInfo "发送成功" ccp.ReturnInfo
  592. }
  593. this.DoQuery();
  594. }
  595. catch (Exception ex)
  596. {
  597. MessageBox.Show("操作过程出现异常!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  598. }
  599. }
  600. #endregion
  601. #region 删除委托
  602. private void DoDelete()
  603. {
  604. try
  605. {
  606. UltraGridRow row = this.ultraGrid1.ActiveRow;
  607. if (row == null)
  608. {
  609. this.alert("检验委托为空!请选择检验委托数据!!!");
  610. return;
  611. }
  612. String batchNoViw = row.Cells["BATCH_NO"].Value.ToString();//轧批号
  613. ArrayList batchNo = new ArrayList();//轧批号
  614. ArrayList designKey = new ArrayList();//订单号
  615. ArrayList smpNo = new ArrayList();//试样号
  616. ArrayList specimenNo = new ArrayList();//取样编号
  617. ArrayList smpTypeName = new ArrayList();//取样类型
  618. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  619. {
  620. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  621. {
  622. if (!ugr.Cells["STATUS"].Value.ToString().Equals("未发送"))
  623. {
  624. this.alert("请选择状态为未发送的委托!!!");
  625. return;
  626. }
  627. batchNo.Add(ugr.Cells["BATCH_NO"].Value.ToString());//轧批号
  628. designKey.Add(ugr.Cells["DESIGN_KEY"].Value.ToString());//订单号
  629. smpNo.Add(ugr.Cells["SMP_NO"].Value.ToString());//试样号
  630. specimenNo.Add(ugr.Cells["SPECIMEN_NO"].Value.ToString());//取样编号
  631. smpTypeName.Add(ugr.Cells["SMP_TYPE_NAME"].Value.ToString());//取样类型
  632. if (ugr.Cells["SMP_TYPE_CODE"].Value.ToString().Equals("3"))
  633. {
  634. this.alert("件件取样暂时不支持删除!!!");
  635. return;
  636. }
  637. }
  638. }
  639. if (MessageBox.Show("确认删除轧批号【" + batchNoViw + "】委托?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  640. {
  641. return;
  642. }
  643. CoreClientParam ccp = new CoreClientParam();
  644. ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo";
  645. ccp.MethodName = "DoDelete";
  646. ccp.ServerParams = new object[] { batchNo, designKey, smpNo, specimenNo, smpTypeName, this.UserInfo.GetUserName() };
  647. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  648. if (ccp.ReturnCode != -1)
  649. {
  650. MessageBox.Show("删除委托成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);
  651. }
  652. this.DoQuery();
  653. }
  654. catch (Exception ex)
  655. {
  656. MessageBox.Show("操作过程出现异常!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  657. }
  658. }
  659. #endregion
  660. #region 查询
  661. private void DoQuery()
  662. {
  663. try
  664. {
  665. if (this.ultraTabControl1.Tabs[2].Selected)
  666. {
  667. DoQueryRZ();//异常取样卷界面
  668. return;
  669. }
  670. String checkboxVal = "";
  671. String STARTTIME = "";
  672. String ENDTIME = "";
  673. if (this.ultraTabControl1.Tabs[1].Selected)
  674. {
  675. STARTTIME = this.dateTimePicker1.Value.ToString("yyyy-MM-dd");
  676. ENDTIME = this.dateTimePicker2.Value.ToString("yyyy-MM-dd");
  677. }
  678. else
  679. {
  680. STARTTIME = this.dateTimePicker1.Value.ToString("yyyyMMdd");
  681. ENDTIME = this.dateTimePicker2.Value.ToString("yyyyMMdd");
  682. }
  683. String BATCH_NO = this.textBox1.Text.Trim();
  684. String BATCH_NO2 = this.BATCH_NO2.Text.Trim();
  685. String VALIDFLAG = "1";
  686. String CERT_INST_NAME = this.textBox2.Text.Trim();//认证机构
  687. String PLINE_NAME = "";
  688. String PLINE_CODE = v_line_no;
  689. String STEEL_NAME = this.txt_steel_name.Text.Trim();
  690. String SMP_CATG = this.cbx_smp_catg.Text.Trim();
  691. String ROLL_MANA_NO = this.ROLL_MANA_NO.Text.Trim();
  692. String heatNo = this.selheatNo.Text.Trim();
  693. if (CERT_INST_NAME.Equals("全部"))
  694. {
  695. CERT_INST_NAME = "";
  696. }
  697. if (SMP_CATG.Equals("全部"))
  698. {
  699. SMP_CATG = "";
  700. }
  701. else if (SMP_CATG.Equals("成分"))
  702. {
  703. SMP_CATG = "A";
  704. }
  705. else
  706. {
  707. SMP_CATG = "B";
  708. }
  709. if (this.CustomInfo == "BC2")
  710. {
  711. PLINE_NAME = "棒二线";
  712. }
  713. else if (this.CustomInfo == "GX")
  714. {
  715. PLINE_NAME = "高线";
  716. }
  717. else if (this.CustomInfo == "GB")
  718. {
  719. PLINE_NAME = "高棒线";
  720. }
  721. else if (this.CustomInfo == "RZ")
  722. {
  723. PLINE_NAME = "热轧";
  724. }
  725. else if (this.CustomInfo == "LT")
  726. {
  727. PLINE_NAME = "连退";
  728. }
  729. else if (this.CustomInfo == "HB")
  730. {
  731. PLINE_NAME = "厚板线";
  732. }
  733. else if (this.CustomInfo == "ZB")
  734. {
  735. PLINE_NAME = "中板线";
  736. }
  737. //轧批号 小框框 是否勾选
  738. if (this.checkBox1.Checked)
  739. {
  740. checkboxVal = "1";
  741. STARTTIME = "";
  742. ENDTIME = "";
  743. }
  744. else
  745. {
  746. BATCH_NO = "";
  747. BATCH_NO2 = "";
  748. }
  749. if (!string.IsNullOrEmpty(BATCH_NO2))
  750. {
  751. if (string.IsNullOrEmpty(BATCH_NO))
  752. {
  753. this.alert("请输入轧批号!!!");
  754. this.textBox1.Focus();
  755. return;
  756. }
  757. }
  758. //炉号 小框框 是否勾选
  759. if (this.checkBox2.Checked)
  760. {
  761. checkboxVal = "1";
  762. STARTTIME = "";
  763. ENDTIME = "";
  764. }
  765. else
  766. {
  767. heatNo = "";
  768. }
  769. //轧辊单元 小框框 是否勾选
  770. if (this.checkBox3.Checked)
  771. {
  772. checkboxVal = "1";
  773. STARTTIME = "";
  774. ENDTIME = "";
  775. }
  776. else
  777. {
  778. ROLL_MANA_NO = "";
  779. }
  780. CoreClientParam ccp = new CoreClientParam();
  781. if (this.ultraTabControl1.Tabs[0].Selected) //检验委托
  782. {
  783. this.dataSet1.Clear();
  784. ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";
  785. ccp.MethodName = "getQltySampleInfoRZ";
  786. ccp.SourceDataTable = this.dataSet1.Tables[0];
  787. }
  788. else if (this.ultraTabControl1.Tabs[1].Selected)
  789. {
  790. this.dataSet5.Clear();
  791. ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";
  792. ccp.MethodName = "getQltySampleInfoRZ2";
  793. ccp.SourceDataTable = this.dataSet5.Tables[0];
  794. }
  795. Hashtable ht = new Hashtable();
  796. ht.Add("BATCH_NO", BATCH_NO);
  797. ht.Add("BATCH_NO2", BATCH_NO2);
  798. ht.Add("STARTTIME", STARTTIME);
  799. ht.Add("ENDTIME", ENDTIME);
  800. ht.Add("VALIDFLAG", VALIDFLAG);
  801. ht.Add("CERT_INST_NAME", CERT_INST_NAME);
  802. ht.Add("PLINE_NAME", PLINE_NAME);
  803. ht.Add("PLINE_CODE", PLINE_CODE);
  804. ht.Add("checkboxVal", checkboxVal);
  805. ht.Add("HEAT_NO", heatNo);
  806. if (this.ultraTabControl1.Tabs[0].Selected)
  807. {
  808. ht.Add("STATUS", "0");
  809. }
  810. if (this.ultraTabControl1.Tabs[1].Selected)
  811. {
  812. ht.Add("TAB_NAME", "1");
  813. }
  814. ht.Add("STEEL_NAME", STEEL_NAME);
  815. ht.Add("SMP_CATG", SMP_CATG);
  816. ht.Add("ROLL_MANA_NO", ROLL_MANA_NO);
  817. ccp.ServerParams = new object[] { ht };
  818. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  819. if (this.ultraTabControl1.Tabs[0].Selected) //检验委托
  820. {
  821. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  822. {
  823. switch (ugr.Cells["STATUS"].Text.ToString())
  824. {
  825. case "0":
  826. ugr.Cells["STATUS"].Value = "未发送";
  827. break;
  828. case "1":
  829. ugr.Cells["STATUS"].Value = "已引用";
  830. break;
  831. case "2":
  832. ugr.Cells["STATUS"].Value = "已发送";
  833. break;
  834. case "3":
  835. ugr.Cells["STATUS"].Value = "已完成";
  836. break;
  837. case "4":
  838. ugr.Cells["STATUS"].Value = "检化验系统退回";
  839. break;
  840. case "5":
  841. ugr.Cells["STATUS"].Value = "重判";
  842. break;
  843. case "7":
  844. ugr.Cells["STATUS"].Value = "确认接收样";
  845. break;
  846. }
  847. if (ugr.Cells["SMP_TYPE_NAME"].Value.ToString() == "复样")
  848. {
  849. ugr.Cells["SMP_TYPE_NAME"].Appearance.ForeColor = Color.Red;
  850. }
  851. if (!ugr.Cells["OLD_SAMPL_NO"].Value.ToString().Equals(ugr.Cells["MATERIAL_NO"].Value.ToString()))
  852. {
  853. ugr.Cells["SAMPL_PICK_RY"].Value = null;
  854. }
  855. }
  856. int num = this.ultraGrid1.Rows.Count();
  857. if (num <= 0)
  858. {
  859. this.dataSet3.Clear();
  860. }
  861. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in ultraGrid1.Rows)
  862. {
  863. if (ugr.Cells["MIXFLAG"].Value.ToString().Equals("1"))
  864. {
  865. ugr.Cells["OLD_SAMPL_NO"].Appearance.BackColor = Color.LightGreen;//钢卷号建议抽样卷
  866. }
  867. }
  868. }
  869. else if (this.ultraTabControl1.Tabs[1].Selected)
  870. {
  871. foreach (UltraGridRow ugr in this.ultraGrid4.Rows)
  872. {
  873. switch (ugr.Cells["STATUS"].Text.ToString())
  874. {
  875. case "0":
  876. ugr.Cells["STATUS"].Value = "未发送";
  877. break;
  878. case "1":
  879. ugr.Cells["STATUS"].Value = "已引用";
  880. break;
  881. case "2":
  882. ugr.Cells["STATUS"].Value = "已发送";
  883. break;
  884. case "3":
  885. ugr.Cells["STATUS"].Value = "已完成";
  886. break;
  887. case "4":
  888. ugr.Cells["STATUS"].Value = "检化验系统退回";
  889. break;
  890. case "5":
  891. ugr.Cells["STATUS"].Value = "重判";
  892. break;
  893. case "7":
  894. ugr.Cells["STATUS"].Value = "确认接收样";
  895. break;
  896. }
  897. if (ugr.Cells["SMP_TYPE_NAME"].Value.ToString() == "复样")
  898. {
  899. ugr.Cells["SMP_TYPE_NAME"].Appearance.ForeColor = Color.Red;
  900. }
  901. }
  902. int num = this.ultraGrid4.Rows.Count();
  903. if (num <= 0)
  904. {
  905. this.dataSet6.Clear();
  906. }
  907. }
  908. //foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in ultraGrid4.Rows)
  909. //{
  910. // if (ugr.Cells["MIXFLAG"].Value.ToString().Equals("1"))
  911. // {
  912. // ugr.Cells["OLD_SAMPL_NO"].Appearance.BackColor = Color.LightGreen;
  913. // }
  914. //}
  915. }
  916. catch (Exception ex)
  917. {
  918. System.Diagnostics.Debug.WriteLine(ex.ToString());
  919. MessageBox.Show("系统出错,请联系管理人员", "警告");
  920. }
  921. }
  922. private void DoQueryRZ()
  923. {
  924. try
  925. {
  926. String checkboxVal = "";
  927. String STARTTIME = "";
  928. String ENDTIME = "";
  929. STARTTIME = this.dateTimePicker1.Value.ToString("yyyyMMdd");
  930. ENDTIME = this.dateTimePicker2.Value.ToString("yyyyMMdd");
  931. String BATCH_NO = this.textBox1.Text.Trim();
  932. String BATCH_NO2 = this.BATCH_NO2.Text.Trim();
  933. String VALIDFLAG = "1";
  934. String CERT_INST_NAME = this.textBox2.Text.Trim();//认证机构
  935. String PLINE_NAME = "热轧";
  936. String PLINE_CODE = v_line_no;
  937. String STEEL_NAME = this.txt_steel_name.Text.Trim();
  938. String SMP_CATG = this.cbx_smp_catg.Text.Trim();
  939. String ROLL_MANA_NO = this.ROLL_MANA_NO.Text.Trim();
  940. String heatNo = this.selheatNo.Text.Trim();
  941. if (CERT_INST_NAME.Equals("全部"))
  942. {
  943. CERT_INST_NAME = "";
  944. }
  945. if (SMP_CATG.Equals("全部"))
  946. {
  947. SMP_CATG = "";
  948. }
  949. else if (SMP_CATG.Equals("成分"))
  950. {
  951. SMP_CATG = "A";
  952. }
  953. else
  954. {
  955. SMP_CATG = "B";
  956. }
  957. //轧批号 小框框 是否勾选
  958. if (this.checkBox1.Checked)
  959. {
  960. checkboxVal = "1";
  961. STARTTIME = "";
  962. ENDTIME = "";
  963. }
  964. else
  965. {
  966. BATCH_NO = "";
  967. BATCH_NO2 = "";
  968. }
  969. if (!string.IsNullOrEmpty(BATCH_NO2))
  970. {
  971. if (string.IsNullOrEmpty(BATCH_NO))
  972. {
  973. this.alert("请输入轧批号!!!");
  974. this.textBox1.Focus();
  975. return;
  976. }
  977. }
  978. //炉号 小框框 是否勾选
  979. if (this.checkBox2.Checked)
  980. {
  981. checkboxVal = "1";
  982. STARTTIME = "";
  983. ENDTIME = "";
  984. }
  985. else
  986. {
  987. heatNo = "";
  988. }
  989. //轧辊单元 小框框 是否勾选
  990. if (this.checkBox3.Checked)
  991. {
  992. checkboxVal = "1";
  993. STARTTIME = "";
  994. ENDTIME = "";
  995. }
  996. else
  997. {
  998. ROLL_MANA_NO = "";
  999. }
  1000. CoreClientParam ccp = new CoreClientParam();
  1001. this.dataSet8.Clear();
  1002. ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";
  1003. ccp.MethodName = "getQCMRZYZ";
  1004. ccp.SourceDataTable = this.dataSet8.Tables[0];
  1005. Hashtable ht = new Hashtable();
  1006. ht.Add("BATCH_NO", BATCH_NO);
  1007. ht.Add("BATCH_NO2", BATCH_NO2);
  1008. ht.Add("STARTTIME", STARTTIME);
  1009. ht.Add("ENDTIME", ENDTIME);
  1010. ht.Add("VALIDFLAG", VALIDFLAG);
  1011. ht.Add("CERT_INST_NAME", CERT_INST_NAME);
  1012. ht.Add("PLINE_NAME", PLINE_NAME);
  1013. ht.Add("PLINE_CODE", PLINE_CODE);
  1014. ht.Add("checkboxVal", checkboxVal);
  1015. ht.Add("HEAT_NO", heatNo);
  1016. ht.Add("STEEL_NAME", STEEL_NAME);
  1017. ht.Add("SMP_CATG", SMP_CATG);
  1018. ht.Add("ROLL_MANA_NO", ROLL_MANA_NO);
  1019. ccp.ServerParams = new object[] { ht };
  1020. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  1021. if (this.ultraTabControl1.Tabs[2].Selected)
  1022. {
  1023. List<UltraGridRow> lists = new List<UltraGridRow>();
  1024. foreach (UltraGridRow ugr in this.ultraGrid2.Rows)
  1025. {
  1026. switch (ugr.Cells["STATUS"].Text.ToString())
  1027. {
  1028. case "0":
  1029. ugr.Cells["STATUS"].Value = "未发送";
  1030. break;
  1031. case "1":
  1032. ugr.Cells["STATUS"].Value = "已引用";
  1033. break;
  1034. case "2":
  1035. ugr.Cells["STATUS"].Value = "已发送";
  1036. break;
  1037. case "3":
  1038. ugr.Cells["STATUS"].Value = "已完成";
  1039. break;
  1040. case "4":
  1041. ugr.Cells["STATUS"].Value = "检化验系统退回";
  1042. break;
  1043. case "5":
  1044. ugr.Cells["STATUS"].Value = "重判";
  1045. break;
  1046. case "7":
  1047. ugr.Cells["STATUS"].Value = "确认接收样";
  1048. break;
  1049. }
  1050. if (ugr.Cells["SMP_TYPE_NAME"].Value.ToString() == "复样")
  1051. {
  1052. ugr.Cells["SMP_TYPE_NAME"].Appearance.ForeColor = Color.Red;
  1053. }
  1054. if (!ugr.Cells["OLD_SAMPL_NO"].Value.ToString().Equals(ugr.Cells["MATERIAL_NO"].Value.ToString()))
  1055. {
  1056. ugr.Cells["SAMPL_PICK_RY"].Value = null;
  1057. }
  1058. //if (ugr.Cells["MIXFLAG"].Value.ToString().Equals("1"))
  1059. //{
  1060. // ugr.Cells["OLD_SAMPL_NO"].Appearance.BackColor = Color.LightGreen;
  1061. //}
  1062. if (!string.IsNullOrEmpty(ugr.Cells["JHQ_STATUS"].Value.ToString()))
  1063. {
  1064. int jhqnum=int.Parse(ugr.Cells["JHQ_STATUS"].Value.ToString());
  1065. if (12 < jhqnum)
  1066. {
  1067. if (jhqnum <= 72)
  1068. {
  1069. ugr.Appearance.BackColor = Color.Yellow;
  1070. }else if (jhqnum > 240)
  1071. {
  1072. lists.Add(ugr);
  1073. }
  1074. }
  1075. else if (jhqnum <= 12)
  1076. {
  1077. ugr.Appearance.BackColor = Color.Red;
  1078. }
  1079. }
  1080. }
  1081. for (int i = 0; i < lists.Count; i++)
  1082. {
  1083. lists[i].Delete(false);
  1084. }
  1085. int num = this.ultraGrid2.Rows.Count();
  1086. if (num <= 0)
  1087. {
  1088. this.dataSet8.Clear();
  1089. }
  1090. }
  1091. }
  1092. catch (Exception ex)
  1093. {
  1094. System.Diagnostics.Debug.WriteLine(ex.ToString());
  1095. MessageBox.Show("系统出错,请联系管理人员", "警告");
  1096. }
  1097. }
  1098. #endregion
  1099. #region 查找检验项目
  1100. private void DoQueryPrg(UltraGridRow ugr)
  1101. {
  1102. try
  1103. {
  1104. this.dataSet3.Clear();
  1105. String specimen_no = ugr.Cells["SPECIMEN_NO"].Value.ToString();
  1106. CoreClientParam ccp = new CoreClientParam();
  1107. ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";
  1108. ccp.MethodName = "getQltySampleItem";
  1109. ccp.ServerParams = new object[] { specimen_no };
  1110. ccp.SourceDataTable = this.dataSet3.Tables[0];
  1111. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  1112. }
  1113. catch (Exception ex)
  1114. {
  1115. System.Diagnostics.Debug.WriteLine(ex.ToString());
  1116. MessageBox.Show("系统出错,请联系管理人员", "警告");
  1117. }
  1118. }
  1119. #endregion
  1120. #region 查询订单信息
  1121. private void DoQueryOrder(UltraGridRow ugr)
  1122. {
  1123. try
  1124. {
  1125. this.dataSet2.Clear();
  1126. CoreClientParam ccp = new CoreClientParam();
  1127. ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";
  1128. ccp.MethodName = "getQltySampleOrd";
  1129. ccp.ServerParams = new object[] { ugr.Cells["SMP_NO"].Text.ToString() };
  1130. ccp.SourceDataTable = this.dataSet2.Tables[0];
  1131. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  1132. //foreach (UltraGridRow ugr2 in this.ultraGrid2.Rows)
  1133. //{
  1134. // ugr2.Cells["Column1"].Value = ugr2.Cells["THICK"].Value + "*" + ugr2.Cells["WIDTH"].Value + "*" + ugr2.Cells["LENGTH"].Value;
  1135. //}
  1136. }
  1137. catch (Exception ex)
  1138. {
  1139. System.Diagnostics.Debug.WriteLine(ex.ToString());
  1140. MessageBox.Show("系统出错,请联系管理人员", "警告");
  1141. }
  1142. }
  1143. #endregion
  1144. #region 发送检验委托
  1145. private void DoSend()
  1146. {
  1147. try
  1148. {
  1149. CoreClientParam ccp = new CoreClientParam();
  1150. string SPECIMEN_NO = "";
  1151. string fh = "";
  1152. int num = 0;
  1153. String mixroll2 = "0";
  1154. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  1155. {
  1156. string specimeNo = "";
  1157. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  1158. {
  1159. if (string.IsNullOrEmpty(ugr.Cells["STATUS"].Value.ToString()))
  1160. {
  1161. this.alert("委托不存在");
  1162. return;
  1163. }
  1164. if (!ugr.Cells["STATUS"].Value.ToString().Equals("未发送"))
  1165. {
  1166. this.alert("请选择状态为未发送的委托!!!");
  1167. return;
  1168. }
  1169. String mixroll = ugr.Cells["MIXROLL"].Value.ToString();
  1170. String smpTypeName = ugr.Cells["SMP_TYPE_NAME"].Value.ToString();
  1171. String txt_DESIGN_KEY = ugr.Cells["DESIGN_KEY"].Value.ToString();
  1172. String txtDK = txt_DESIGN_KEY.Substring(0, 2);
  1173. if (!String.IsNullOrEmpty(mixroll) && smpTypeName.Equals("初样") && !"39".Equals(txtDK) && !"49".Equals(txtDK) && !"59".Equals(txtDK))
  1174. {
  1175. mixroll2 = "1";
  1176. this.alert("预测产品,请进行抽样操作!");
  1177. return;
  1178. }
  1179. specimeNo = ugr.Cells["SPECIMEN_NO"].Value.ToString();
  1180. num = num + 1;
  1181. if (num <= 1)
  1182. {
  1183. SPECIMEN_NO = specimeNo;
  1184. fh = ",";
  1185. }
  1186. else
  1187. {
  1188. SPECIMEN_NO = SPECIMEN_NO + fh + specimeNo;
  1189. }
  1190. }
  1191. }
  1192. DoUpdate();//先修改取样材料号
  1193. //if (mixroll2.Equals("1"))
  1194. //{
  1195. // if (MessageBox.Show("组匹区间不为空!建议使用【预测抽样】按钮,而不是【发送检验委托】按钮,如继续执行【发送检验委托】按钮程序点击【是】,停止则点击【否】", "提示",
  1196. // MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  1197. // {
  1198. // return;
  1199. // }
  1200. //}
  1201. ccp.ServerName = "QCM.JHY01.JHY0102.Send2";
  1202. ccp.MethodName = "SendLIMES";
  1203. ccp.ServerParams = new object[] { SPECIMEN_NO, this.UserInfo.GetUserID(), this.UserInfo.GetUserName(), " " };
  1204. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1205. if (ccp.ReturnCode != -1)
  1206. {
  1207. MessageBox.Show("发送成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);//ccp.ReturnInfo "发送成功" ccp.ReturnInfo
  1208. }
  1209. this.DoQuery();
  1210. int conut = this.ultraGrid1.Rows.Count();
  1211. if (conut <= 0)
  1212. {
  1213. this.dataSet2.Clear();
  1214. this.dataSet3.Clear();
  1215. }
  1216. }
  1217. catch (Exception ex)
  1218. {
  1219. System.Diagnostics.Debug.WriteLine(ex.ToString());
  1220. MessageBox.Show("系统出错,请联系管理人员", "警告");
  1221. }
  1222. }
  1223. #endregion
  1224. #region 热轧 人工抽样 组批区间
  1225. private void DoSendRZ()
  1226. {
  1227. try
  1228. {
  1229. if (this.CustomInfo != "RZ") {
  1230. this.alert("只能热轧产线可使用人工抽样按钮!");
  1231. return;
  1232. }
  1233. CoreClientParam ccp = new CoreClientParam();
  1234. string SPECIMEN_NO = "";
  1235. string fh = "";
  1236. int num = 0;
  1237. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  1238. {
  1239. string specimeNo = "";
  1240. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  1241. {
  1242. String mixroll = ugr.Cells["MIXROLL"].Value.ToString();
  1243. if (mixroll == null || mixroll.Equals(""))
  1244. {
  1245. this.alert("非预测品种,不允许预测抽样");
  1246. return;
  1247. }
  1248. if (!ugr.Cells["STATUS"].Value.ToString().Equals("未发送"))
  1249. {
  1250. this.alert("请选择状态为未发送的委托!!!");
  1251. return;
  1252. }
  1253. specimeNo = ugr.Cells["SPECIMEN_NO"].Value.ToString();
  1254. num = num + 1;
  1255. if (num <= 1)
  1256. {
  1257. SPECIMEN_NO = specimeNo;
  1258. fh = ",";
  1259. }
  1260. else
  1261. {
  1262. SPECIMEN_NO = SPECIMEN_NO + fh + specimeNo;
  1263. }
  1264. }
  1265. }
  1266. if(num>=2){
  1267. this.alert("请勾选一条钢卷号做为预测抽样,预测抽样不可勾选多条数据!!!");
  1268. return;
  1269. }
  1270. DoUpdate();//先修改取样材料号
  1271. String GroupBatch = "1";//组批标识
  1272. ccp.ServerName = "QCM.JHY01.JHY0102.Send2";
  1273. ccp.MethodName = "SendLimesRZ";
  1274. ccp.ServerParams = new object[] { SPECIMEN_NO, this.UserInfo.GetUserID(), this.UserInfo.GetUserName(), GroupBatch,"热轧" };
  1275. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1276. if (ccp.ReturnCode != -1)
  1277. {
  1278. MessageBox.Show("人工抽样成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);//ccp.ReturnInfo "发送成功" ccp.ReturnInfo
  1279. }
  1280. this.DoQuery();
  1281. int conut = this.ultraGrid1.Rows.Count();
  1282. if (conut <= 0)
  1283. {
  1284. this.dataSet2.Clear();
  1285. this.dataSet3.Clear();
  1286. }
  1287. }
  1288. catch (Exception ex)
  1289. {
  1290. System.Diagnostics.Debug.WriteLine(ex.ToString());
  1291. MessageBox.Show("系统出错,请联系管理人员", "警告");
  1292. }
  1293. }
  1294. #endregion
  1295. #region 撤销检验委托
  1296. private void DoUnsend()
  1297. {
  1298. try
  1299. {
  1300. if (MessageBox.Show("确认撤销发送?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  1301. {
  1302. return;
  1303. }
  1304. String zhyy = "MES撤回";
  1305. CoreClientParam ccp = new CoreClientParam();
  1306. string SPECIMEN_NO = "";
  1307. string fh = "";
  1308. int num = 0;
  1309. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  1310. {
  1311. string specimeNo = "";
  1312. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  1313. {
  1314. String rzEntrustNumber = ugr.Cells["RZ_ENTRUST_NUMBER"].Value.ToString();
  1315. //判断是否是热轧 预测抽样
  1316. if (!String.IsNullOrEmpty(rzEntrustNumber))
  1317. {
  1318. this.alert("【预测抽样】的委托只能用【撤销抽样】按钮撤销!");
  1319. return;
  1320. }
  1321. String QRZ_SPECIMEN_NO = ugr.Cells["QRZ_SPECIMEN_NO"].Value.ToString();
  1322. if (!String.IsNullOrEmpty(QRZ_SPECIMEN_NO))
  1323. {
  1324. this.alert("轧批号:" + ugr.Cells["BATCH_NO"].Value.ToString() + "为人工选样不可撤销!");
  1325. return;
  1326. }
  1327. String status = ugr.Cells["STATUS"].Value.ToString();
  1328. if (status.Equals("0") || status.Equals("未发送") || String.IsNullOrEmpty(status))
  1329. {
  1330. this.alert("当前委托未发送、不可撤销");
  1331. return;
  1332. }
  1333. specimeNo = ugr.Cells["SPECIMEN_NO"].Value.ToString();
  1334. num = num + 1;
  1335. if (num <= 1)
  1336. {
  1337. SPECIMEN_NO = specimeNo;
  1338. fh = ",";
  1339. }
  1340. else
  1341. {
  1342. SPECIMEN_NO = SPECIMEN_NO + fh + specimeNo;
  1343. }
  1344. }
  1345. }
  1346. ccp.ServerName = "QCM.JHY01.JHY0102.Send2";
  1347. ccp.MethodName = "CancelLIMES";
  1348. ccp.ServerParams = new object[] { SPECIMEN_NO, this.UserInfo.GetUserName(), zhyy };
  1349. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1350. if (ccp.ReturnCode != -1)
  1351. {
  1352. MessageBox.Show("撤销发送成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);//ccp.ReturnInfo "发送成功" ccp.ReturnInfo
  1353. }
  1354. this.DoQuery();
  1355. int conut = this.ultraGrid1.Rows.Count();
  1356. if (conut <= 0)
  1357. {
  1358. this.dataSet2.Clear();
  1359. this.dataSet3.Clear();
  1360. }
  1361. }
  1362. catch (Exception ex)
  1363. {
  1364. System.Diagnostics.Debug.WriteLine(ex.ToString());
  1365. MessageBox.Show("系统出错,请联系管理人员", "警告");
  1366. }
  1367. }
  1368. #endregion
  1369. #region 热轧 撤销人工抽样
  1370. private void DoUnsendRZ()
  1371. {
  1372. try
  1373. {
  1374. //if (!this.ultraTabControl1.SelectedTab.Text.Equals("委托记录"))
  1375. //{
  1376. // this.alert("请在委托记录中勾选要撤销的人工抽样委托!");
  1377. // return;
  1378. //}
  1379. if (MessageBox.Show("确认撤销人工抽样?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  1380. {
  1381. return;
  1382. }
  1383. UltraGridRow row = ultraGrid1.ActiveRow;
  1384. String oldSamplNo = row.Cells["OLD_SAMPL_NO"].Value.ToString();//钢卷号
  1385. String rzOldSamplNo = row.Cells["RZ_ENTRUST_NUMBER"].Value.ToString();//抽样钢卷号
  1386. if (!oldSamplNo.Equals(rzOldSamplNo) || String.IsNullOrEmpty(rzOldSamplNo))
  1387. {
  1388. this.alert("请选择预测抽样的钢卷号撤销抽样!预测抽样钢卷号【" + rzOldSamplNo + "】");
  1389. return;
  1390. }
  1391. String zhyy = "MES撤回热轧预测抽样";
  1392. CoreClientParam ccp = new CoreClientParam();
  1393. string SPECIMEN_NO = "";
  1394. string fh = "";
  1395. int num = 0;
  1396. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  1397. {
  1398. string specimeNo = "";
  1399. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  1400. {
  1401. String status = ugr.Cells["STATUS"].Value.ToString();
  1402. String QRZ_SPECIMEN_NO = ugr.Cells["QRZ_SPECIMEN_NO"].Value.ToString();
  1403. if (status.Equals("0") || status.Equals("未发送") || String.IsNullOrEmpty(status))
  1404. {
  1405. this.alert("当前委托未发送、不可撤销");
  1406. return;
  1407. }
  1408. else if (!String.IsNullOrEmpty(QRZ_SPECIMEN_NO))
  1409. {
  1410. this.alert("轧批号:" + ugr.Cells["BATCH_NO"].Value.ToString()+"为人工选样不可撤销!");
  1411. return;
  1412. }
  1413. specimeNo = ugr.Cells["SPECIMEN_NO"].Value.ToString();
  1414. num = num + 1;
  1415. if (num <= 1)
  1416. {
  1417. SPECIMEN_NO = specimeNo;
  1418. fh = ",";
  1419. }
  1420. else
  1421. {
  1422. SPECIMEN_NO = SPECIMEN_NO + fh + specimeNo;
  1423. }
  1424. }
  1425. }
  1426. if (num > 1)
  1427. {
  1428. this.alert("撤销预测抽样、只能一条预测抽样撤销");
  1429. return;
  1430. }
  1431. ccp.ServerName = "QCM.JHY01.JHY0102.Send2";
  1432. ccp.MethodName = "CancelLIMESRZ";
  1433. ccp.ServerParams = new object[] { SPECIMEN_NO, this.UserInfo.GetUserName(), zhyy };
  1434. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1435. if (ccp.ReturnCode != -1)
  1436. {
  1437. MessageBox.Show("撤销人工抽样成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);//ccp.ReturnInfo "发送成功" ccp.ReturnInfo
  1438. }
  1439. this.DoQuery();
  1440. int conut = this.ultraGrid1.Rows.Count();
  1441. if (conut <= 0)
  1442. {
  1443. this.dataSet2.Clear();
  1444. this.dataSet3.Clear();
  1445. }
  1446. }
  1447. catch (Exception ex)
  1448. {
  1449. System.Diagnostics.Debug.WriteLine(ex.ToString());
  1450. MessageBox.Show("系统出错,请联系管理人员", "警告");
  1451. }
  1452. }
  1453. #endregion
  1454. #region 卷板质量异常处理
  1455. private void DoEject()
  1456. {
  1457. QCM0307 frmRbp = new QCM0307();
  1458. frmRbp.StartPosition = FormStartPosition.CenterScreen;
  1459. frmRbp.ob = this.ob;
  1460. frmRbp.ShowDialog();
  1461. }
  1462. #endregion
  1463. #region 清空组批区间
  1464. private void CleanUpMixRoll()
  1465. {
  1466. int num = 0;
  1467. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  1468. {
  1469. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  1470. {
  1471. String mixroll = ugr.Cells["MIXROLL"].Value.ToString();
  1472. String smpTypeName = ugr.Cells["SMP_TYPE_NAME"].Value.ToString();
  1473. if (string.IsNullOrEmpty(mixroll))
  1474. {
  1475. this.alert("当前轧批组批区间已为空!");
  1476. return;
  1477. }
  1478. if (string.IsNullOrEmpty(ugr.Cells["STATUS"].Value.ToString()))
  1479. {
  1480. this.alert("委托不存在!");
  1481. return;
  1482. }
  1483. if (!ugr.Cells["STATUS"].Value.ToString().Equals("未发送"))
  1484. {
  1485. this.alert("请选择状态为未发送的委托!!!");
  1486. return;
  1487. }
  1488. num = num + 1;
  1489. }
  1490. }
  1491. if (num != 1)
  1492. {
  1493. this.alert("要勾选委托并且只能勾选一个委托的轧批号!");
  1494. return;
  1495. }
  1496. UltraGridRow row = this.ultraGrid1.ActiveRow;
  1497. if (row == null)
  1498. {
  1499. this.alert("检验委托为空!请选择检验委托数据!!!");
  1500. return;
  1501. }
  1502. if (!row.Cells["SMP_CATG"].Text.ToString().Equals("材质"))
  1503. {
  1504. this.alert("只有材质数据才可以清空!!!");
  1505. return;
  1506. }
  1507. String batchNo = row.Cells["BATCH_NO"].Text.ToString();
  1508. if (MessageBox.Show("确认清除当前轧批号【" + batchNo + "】组批区间?清空组批区间是按批清空", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  1509. {
  1510. return;
  1511. }
  1512. String MATERIAL_NO = row.Cells["MATERIAL_NO"].Value.ToString();
  1513. String BATCH_NO = row.Cells["BATCH_NO"].Value.ToString();
  1514. String PLINE_CODE = row.Cells["PLINE_CODE"].Value.ToString();
  1515. String MIXROLL = row.Cells["MIXROLL"].Value.ToString();
  1516. String OLD_SAMPL_NO = row.Cells["OLD_SAMPL_NO"].Value.ToString();
  1517. Hashtable ht = new Hashtable();
  1518. ht.Add("OLD_SAMPL_NO", OLD_SAMPL_NO);
  1519. ht.Add("MATERIAL_NO", MATERIAL_NO);
  1520. ht.Add("BATCH_NO", BATCH_NO);
  1521. ht.Add("MIXROLL", MIXROLL);
  1522. ht.Add("PLINE_CODE", PLINE_CODE);
  1523. ht.Add("USER_NAME", this.UserInfo.GetUserName().ToString());
  1524. CoreClientParam ccp = new CoreClientParam();
  1525. ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo";
  1526. ccp.MethodName = "DoCleanUpMixRoll";
  1527. ccp.ServerParams = new object[] { ht };
  1528. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1529. if (ccp.ReturnCode == -1)
  1530. {
  1531. return;
  1532. }
  1533. MessageBox.Show("修改成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);
  1534. this.DoQuery();
  1535. }
  1536. #endregion
  1537. #region 补发激光
  1538. private void DoSendJG()
  1539. {
  1540. try
  1541. {
  1542. CoreClientParam ccp = new CoreClientParam();
  1543. string SPECIMEN_NO = "";
  1544. string fh = "";
  1545. int num = 0;
  1546. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  1547. {
  1548. string specimeNo = "";
  1549. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  1550. {
  1551. if (string.IsNullOrEmpty(ugr.Cells["PRINT_SEQ"].Value.ToString()))
  1552. {
  1553. String OLD_SAMPL_NO = ugr.Cells["OLD_SAMPL_NO"].Value.ToString();
  1554. this.alert("钢卷号:" + OLD_SAMPL_NO+"未发送,不能使用补发功能,请核实数据!");
  1555. return;
  1556. }
  1557. specimeNo = ugr.Cells["SPECIMEN_NO"].Value.ToString();
  1558. num = num + 1;
  1559. if (num <= 1)
  1560. {
  1561. SPECIMEN_NO = specimeNo;
  1562. fh = ",";
  1563. }
  1564. else
  1565. {
  1566. SPECIMEN_NO = SPECIMEN_NO + fh + specimeNo;
  1567. }
  1568. }
  1569. }
  1570. if (num==0)
  1571. {
  1572. this.alert("请勾选数据!!!");
  1573. return;
  1574. }
  1575. Hashtable ht = new Hashtable();
  1576. ht.Add("USER_ID", this.UserInfo.GetUserID());
  1577. ht.Add("USER_NAME", this.UserInfo.GetUserName());
  1578. ccp.ServerName = "QCM.JHY01.JHY0102.Send2";
  1579. ccp.MethodName = "SendJG";
  1580. ccp.ServerParams = new object[] { SPECIMEN_NO, this.UserInfo.GetUserID(), this.UserInfo.GetUserName(), ht };
  1581. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1582. if (ccp.ReturnCode != -1)
  1583. {
  1584. MessageBox.Show("补发激光委托成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);//ccp.ReturnInfo "发送成功" ccp.ReturnInfo
  1585. }
  1586. this.DoQuery();
  1587. }
  1588. catch (Exception ex)
  1589. {
  1590. System.Diagnostics.Debug.WriteLine(ex.ToString());
  1591. MessageBox.Show("系统出错,请联系管理人员", "警告");
  1592. }
  1593. }
  1594. #endregion
  1595. #region 预测换样
  1596. private void DoForecastRZ()
  1597. {
  1598. try
  1599. {
  1600. int i = 0;
  1601. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  1602. {
  1603. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  1604. {
  1605. i++;
  1606. }
  1607. }
  1608. if(i==0){
  1609. this.alert("未勾选数据!");
  1610. return;
  1611. }else if (i>=2){
  1612. this.alert("您勾选了多条数据,请勾选一条数据,勾选当前轧辊单元组批区间的抽样钢卷号,红色字体那条!");
  1613. return;
  1614. }
  1615. UltraGridRow row = this.ultraGrid1.ActiveRow;
  1616. String OLD_SAMPL_NO = row.Cells["OLD_SAMPL_NO"].Value.ToString();//钢卷号
  1617. String ROLL_MANA_NO = row.Cells["ROLL_MANA_NO"].Value.ToString();//轧辊单元
  1618. String MIXROLL = row.Cells["MIXROLL"].Value.ToString();//组批区间
  1619. String RZ_ENTRUST_NUMBER = row.Cells["RZ_ENTRUST_NUMBER"].Value.ToString();//抽样钢卷号
  1620. String BATCH_NO = row.Cells["BATCH_NO"].Value.ToString();//轧批号
  1621. String STATUS = row.Cells["STATUS"].Text.ToString();//状态
  1622. String SAMPL_PICK_RY = row.Cells["SAMPL_PICK_RY"].Value.ToString();//有无取样
  1623. String SPECIMEN_NO = row.Cells["SPECIMEN_NO"].Value.ToString();//取样编号
  1624. if (OLD_SAMPL_NO.Equals(RZ_ENTRUST_NUMBER) && SAMPL_PICK_RY.Equals("R") && STATUS.Equals("已完成"))
  1625. {
  1626. if (MessageBox.Show("是否确认轧辊单元【" + ROLL_MANA_NO + "】组批区间【" + MIXROLL + "】轧批号【" + BATCH_NO + "】"+
  1627. "不合格,需从新在组距内钢卷重新挑卷预测抽样",
  1628. "提示",
  1629. MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  1630. {
  1631. return;
  1632. }
  1633. CoreClientParam ccp = new CoreClientParam();
  1634. Hashtable ht = new Hashtable();
  1635. ht.Add("BATCH_NO", BATCH_NO);
  1636. ht.Add("SPECIMEN_NO", SPECIMEN_NO);
  1637. ht.Add("USER_ID", this.UserInfo.GetUserID());
  1638. ht.Add("USER_NAME", this.UserInfo.GetUserName());
  1639. ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo";
  1640. ccp.MethodName = "doForecastRZ";
  1641. ccp.ServerParams = new object[] { ht };
  1642. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1643. if (ccp.ReturnCode != -1)
  1644. {
  1645. MessageBox.Show("操作成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);//ccp.ReturnInfo "发送成功" ccp.ReturnInfo
  1646. }
  1647. this.DoQuery();
  1648. }
  1649. else
  1650. {
  1651. this.alert("操作失败!请核实当前预测抽样数据!轧辊单元【" + ROLL_MANA_NO + "】组批区间【" + MIXROLL + "】");
  1652. return;
  1653. }
  1654. }
  1655. catch (Exception ex)
  1656. {
  1657. System.Diagnostics.Debug.WriteLine(ex.ToString());
  1658. MessageBox.Show("系统出错,请联系管理人员", "警告");
  1659. }
  1660. }
  1661. #endregion
  1662. #endregion
  1663. #region 其它事件
  1664. #region 查询下拉框 取样材料号
  1665. private void ultraGrid1_AfterCellActivate(object sender, EventArgs e)
  1666. {
  1667. this.dataSet4.Clear();
  1668. //String heatNo = this.ultraGrid1.ActiveRow.Cells["HEAT_NO"].Value.ToString();
  1669. //CoreClientParam ccp2 = new CoreClientParam();
  1670. //ccp2.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";//调用java地址
  1671. //ccp2.MethodName = "getBatchNo";//调用的方法
  1672. //ccp2.ServerParams = new object[] { heatNo };
  1673. //ccp2.SourceDataTable = this.dataSet4.Tables[0];
  1674. //this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal);
  1675. //ValueList VDEFECT_DESC2 = new ValueList();
  1676. //for (int i = 0; i < ccp2.SourceDataTable.Rows.Count; i++)
  1677. //{
  1678. // VDEFECT_DESC2.ValueListItems.Add(ccp2.SourceDataTable.Rows[i]["BATCH_NO"].ToString(), ccp2.SourceDataTable.Rows[i]["BATCH_NO"].ToString());
  1679. //}
  1680. //this.ultraGrid1.DisplayLayout.Bands[0].Columns["BATCH_NO"].ValueList = VDEFECT_DESC2;
  1681. String batchNo = this.ultraGrid1.ActiveRow.Cells["BATCH_NO"].Value.ToString();
  1682. String plineCode = this.ultraGrid1.ActiveRow.Cells["PLINE_CODE"].Value.ToString();
  1683. if (string.IsNullOrEmpty(batchNo))
  1684. {
  1685. return;
  1686. }
  1687. if (string.IsNullOrEmpty(plineCode))
  1688. {
  1689. return;
  1690. }
  1691. CoreClientParam ccp = new CoreClientParam();
  1692. ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";//调用java地址
  1693. ccp.MethodName = "getBilletId";//调用的方法
  1694. ccp.ServerParams = new object[] { batchNo, plineCode };
  1695. ccp.SourceDataTable = this.dataSet4.Tables[0];
  1696. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  1697. ValueList VDEFECT_DESC = new ValueList();
  1698. for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  1699. {
  1700. VDEFECT_DESC.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["MATERIAL_NO"].ToString(), ccp.SourceDataTable.Rows[i]["MATERIAL_NO"].ToString());
  1701. }
  1702. this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIAL_NO"].ValueList = VDEFECT_DESC;
  1703. }
  1704. #endregion
  1705. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  1706. {
  1707. int num = this.ultraGrid1.Rows.Count();
  1708. if (num >= 1)
  1709. {
  1710. Infragistics.Win.UltraWinGrid.UltraGrid uGrid = (Infragistics.Win.UltraWinGrid.UltraGrid)sender;
  1711. string specimen_no = uGrid.ActiveRow.Cells["SPECIMEN_NO"].Text.Trim();
  1712. string smp_no = uGrid.ActiveRow.Cells["SMP_NO"].Text.Trim();
  1713. if (String.IsNullOrEmpty(specimen_no) || String.IsNullOrEmpty(smp_no))
  1714. {
  1715. this.dataSet3.Tables[0].Clear();
  1716. return;
  1717. }
  1718. this.dataSet3.Tables[0].Clear();
  1719. this.dataSet2.Tables[0].Clear();
  1720. CoreClientParam ccp = new CoreClientParam();
  1721. ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";
  1722. ccp.MethodName = "getQltySampleItemNew";
  1723. ccp.ServerParams = new object[] { specimen_no };
  1724. ccp.SourceDataTable = this.dataSet3.Tables[0];
  1725. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  1726. //CoreClientParam ccp1 = new CoreClientParam();
  1727. //ccp1.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";
  1728. //ccp1.MethodName = "getQltySampleOrdNew";
  1729. //ccp1.ServerParams = new object[] { smp_no };
  1730. //ccp1.SourceDataTable = this.dataSet2.Tables[0];
  1731. //this.ExecuteQueryToDataTable(ccp1, CoreInvokeType.Internal);
  1732. //右下角ord表删除
  1733. //foreach (UltraGridRow ugr2 in this.ultraGrid2.Rows)
  1734. //{
  1735. // ugr2.Cells["Column1"].Value = ugr2.Cells["THICK"].Value + "*" + ugr2.Cells["WIDTH"].Value + "*" + ugr2.Cells["LENGTH"].Value;
  1736. //}
  1737. }
  1738. else
  1739. {
  1740. this.dataSet2.Clear();
  1741. this.dataSet3.Clear();
  1742. }
  1743. }
  1744. #region 选择tab 显示相应按钮
  1745. private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
  1746. {
  1747. if (this.ultraTabControl1.SelectedTab.Index == 0)
  1748. {
  1749. this.ToolBarItemEnable(this, "Send", true);
  1750. this.ToolBarItemEnable(this, "Add", true);
  1751. this.ToolBarItemEnable(this, "AddArtificial", true);
  1752. this.ToolBarItemEnable(this, "Unsend", true);
  1753. this.ToolBarItemEnable(this, "AddWt", true);
  1754. this.ToolBarItemEnable(this, "DelWt", true);
  1755. this.ToolBarItemEnable(this, "DoDelete", true);
  1756. this.ToolBarItemEnable(this, "SendJG", true);
  1757. this.ToolBarItemEnable(this, "doPrint", true);
  1758. this.ToolBarItemEnable(this, "ForecastRZ", true);
  1759. this.button1.Enabled = true;
  1760. this.button2.Enabled = true;
  1761. this.button3.Enabled = true;
  1762. this.button4.Enabled = true;
  1763. this.button8.Enabled = true;
  1764. }
  1765. if (this.ultraTabControl1.SelectedTab.Index == 1)
  1766. {
  1767. this.ToolBarItemEnable(this, "Send", false);
  1768. this.ToolBarItemEnable(this, "Add", false);
  1769. this.ToolBarItemEnable(this, "AddArtificial", false);
  1770. this.ToolBarItemEnable(this, "Unsend", false);
  1771. this.ToolBarItemEnable(this, "AddWt", false);
  1772. this.ToolBarItemEnable(this, "DelWt", false);
  1773. this.ToolBarItemEnable(this, "DoDelete", false);
  1774. this.ToolBarItemEnable(this, "SendJG", false);
  1775. this.ToolBarItemEnable(this, "doPrint", true);
  1776. this.ToolBarItemEnable(this, "ForecastRZ", false);
  1777. this.button1.Enabled = true;
  1778. this.button2.Enabled = true;
  1779. this.button3.Enabled = true;
  1780. this.button4.Enabled = true;
  1781. this.button8.Enabled = true;
  1782. }
  1783. if (this.ultraTabControl1.SelectedTab.Index == 2)
  1784. {
  1785. this.ToolBarItemEnable(this, "Send", false);
  1786. this.ToolBarItemEnable(this, "Add", false);
  1787. this.ToolBarItemEnable(this, "AddArtificial", false);
  1788. this.ToolBarItemEnable(this, "Unsend", false);
  1789. this.ToolBarItemEnable(this, "AddWt", false);
  1790. this.ToolBarItemEnable(this, "DelWt", false);
  1791. this.ToolBarItemEnable(this, "DoDelete", false);
  1792. this.ToolBarItemEnable(this, "SendJG", false);
  1793. this.ToolBarItemEnable(this, "doPrint", false);
  1794. this.ToolBarItemEnable(this, "ForecastRZ", false);
  1795. this.button1.Enabled = false;
  1796. this.button2.Enabled = false;
  1797. this.button3.Enabled = false;
  1798. this.button4.Enabled = false;
  1799. this.button8.Enabled = false;
  1800. }
  1801. }
  1802. #endregion
  1803. private void ultraGrid4_AfterRowActivate(object sender, EventArgs e)
  1804. {
  1805. // this.DoQueryPrg(this.ultraGrid4.ActiveRow);
  1806. // this.DoQueryOrder(this.ultraGrid4.ActiveRow);
  1807. Infragistics.Win.UltraWinGrid.UltraGrid uGrid = (Infragistics.Win.UltraWinGrid.UltraGrid)sender;
  1808. string specimen_no = uGrid.ActiveRow.Cells["SPECIMEN_NO"].Text.Trim();
  1809. //string smp_no = uGrid.ActiveRow.Cells["SMP_NO"].Text.Trim();
  1810. if (String.IsNullOrEmpty(specimen_no) )
  1811. {
  1812. this.dataSet6.Tables[0].Clear();
  1813. return;
  1814. }
  1815. this.dataSet6.Tables[0].Clear();
  1816. CoreClientParam ccp = new CoreClientParam();
  1817. ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";
  1818. ccp.MethodName = "getQltySampleItemNew";
  1819. ccp.ServerParams = new object[] { specimen_no };
  1820. ccp.SourceDataTable = this.dataSet6.Tables[0];
  1821. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  1822. //右下角ord订单
  1823. //CoreClientParam ccp1 = new CoreClientParam();
  1824. //ccp1.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";
  1825. //ccp1.MethodName = "getQltySampleOrdNew";
  1826. //ccp1.ServerParams = new object[] { smp_no };
  1827. //ccp1.SourceDataTable = this.dataSet2.Tables[0];
  1828. //this.ExecuteQueryToDataTable(ccp1, CoreInvokeType.Internal);
  1829. //foreach (UltraGridRow ugr2 in this.ultraGrid2.Rows)
  1830. //{
  1831. // ugr2.Cells["Column1"].Value = ugr2.Cells["THICK"].Value + "*" + ugr2.Cells["WIDTH"].Value + "*" + ugr2.Cells["LENGTH"].Value;
  1832. //}
  1833. }
  1834. private void ultraGrid1_CellChange(object sender, CellEventArgs e)
  1835. {
  1836. ultraGrid1.UpdateData();
  1837. }
  1838. private void ultraGrid1_AfterHeaderCheckStateChanged(object sender, AfterHeaderCheckStateChangedEventArgs e)
  1839. {
  1840. ultraGrid1.UpdateData();
  1841. }
  1842. private void ultraGrid4_AfterHeaderCheckStateChanged(object sender, AfterHeaderCheckStateChangedEventArgs e)
  1843. {
  1844. ultraGrid4.UpdateData();
  1845. }
  1846. private void ultraGrid4_CellChange(object sender, CellEventArgs e)
  1847. {
  1848. ultraGrid4.UpdateData();
  1849. }
  1850. #endregion
  1851. #region 右下角 删除 名称
  1852. private void ultraGrid3_InitializeRow(object sender, InitializeRowEventArgs e)
  1853. {
  1854. e.Row.Cells["deletebol"].Value = "删除";
  1855. }
  1856. #endregion
  1857. #region 右下角 删除
  1858. private void ultraGrid3_ClickCellButton(object sender, CellEventArgs e)
  1859. {
  1860. ultraGrid3.UpdateData();
  1861. if (e.Cell.Column.Key == "deletebol")
  1862. {
  1863. if (MessageBox.Show("确定要删除这一项目?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.No)
  1864. {
  1865. return;
  1866. }
  1867. try
  1868. {
  1869. CoreClientParam ccp = new CoreClientParam();
  1870. String seq = "";//检验项目流水号
  1871. String specimenNo = "";//取样编号
  1872. UltraGridRow row = ultraGrid3.ActiveRow;
  1873. if (!row.Cells["ITEM_FLAG"].Value.ToString().Equals("1"))
  1874. {
  1875. MessageBox.Show("不能删除系统生成的项目,只能删除人工生成的项目!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  1876. return;
  1877. }
  1878. seq = row.Cells["SEQ"].Value.ToString();
  1879. specimenNo = row.Cells["SPECIMEN_NO"].Value.ToString();
  1880. ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo";
  1881. ccp.MethodName = "deleteInfo";
  1882. ccp.ServerParams = new object[] { seq, specimenNo };
  1883. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1884. if (ccp.ReturnCode != -1)
  1885. {
  1886. MessageBox.Show(ccp.ReturnInfo, "提示", MessageBoxButtons.OK, MessageBoxIcon.None);
  1887. }
  1888. this.DoQueryPrg(this.ultraGrid1.ActiveRow);
  1889. }
  1890. catch (Exception ex)
  1891. {
  1892. System.Diagnostics.Debug.WriteLine(ex.ToString());
  1893. MessageBox.Show("系统出错,请联系管理人员", "警告");
  1894. }
  1895. }
  1896. }
  1897. #endregion
  1898. #region 轧批号框勾选触发
  1899. private void checkBox1_Click(object sender, EventArgs e)
  1900. {
  1901. if (this.checkBox1.Checked)
  1902. {
  1903. this.dateTimePicker1.Enabled = false;
  1904. this.dateTimePicker2.Enabled = false;
  1905. this.textBox1.Enabled = true;
  1906. this.BATCH_NO2.Enabled = true;
  1907. }
  1908. else
  1909. {
  1910. if (!this.checkBox1.Checked && !this.checkBox2.Checked && !this.checkBox3.Checked)
  1911. {
  1912. this.dateTimePicker1.Enabled = true;
  1913. this.dateTimePicker2.Enabled = true;
  1914. }
  1915. this.textBox1.Enabled = false;
  1916. this.BATCH_NO2.Enabled = false;
  1917. }
  1918. }
  1919. private void checkBox2_Click(object sender, EventArgs e)
  1920. {
  1921. if (this.checkBox2.Checked)
  1922. {
  1923. this.dateTimePicker1.Enabled = false;
  1924. this.dateTimePicker2.Enabled = false;
  1925. this.selheatNo.Enabled = true;
  1926. }
  1927. else
  1928. {
  1929. if (!this.checkBox1.Checked && !this.checkBox2.Checked && !this.checkBox3.Checked)
  1930. {
  1931. this.dateTimePicker1.Enabled = true;
  1932. this.dateTimePicker2.Enabled = true;
  1933. }
  1934. this.selheatNo.Enabled = false;
  1935. }
  1936. }
  1937. private void checkBox3_Click(object sender, EventArgs e)
  1938. {
  1939. if (this.checkBox3.Checked)
  1940. {
  1941. this.dateTimePicker1.Enabled = false;
  1942. this.dateTimePicker2.Enabled = false;
  1943. this.ROLL_MANA_NO.Enabled = true;
  1944. }
  1945. else
  1946. {
  1947. if (!this.checkBox1.Checked && !this.checkBox2.Checked && !this.checkBox3.Checked)
  1948. {
  1949. this.dateTimePicker1.Enabled = true;
  1950. this.dateTimePicker2.Enabled = true;
  1951. }
  1952. this.ROLL_MANA_NO.Enabled = false;
  1953. }
  1954. }
  1955. #endregion
  1956. #region 表中的列 值改变触发
  1957. private void ultraGrid1_AfterCellUpdate(object sender, CellEventArgs e)
  1958. {
  1959. Boolean bl = true;
  1960. if (this.CustomInfo == "GX")
  1961. {
  1962. UltraGridRow row = this.ultraGrid1.ActiveRow;
  1963. if (row == null || "".Equals(row))
  1964. {
  1965. return;
  1966. }
  1967. String sendMemoValeu = row.Cells["SEND_MEMO"].Value.ToString();
  1968. if (sendMemoValeu.Equals("A") || sendMemoValeu.Equals("B") || sendMemoValeu.Equals("C"))
  1969. {
  1970. String BATCH_NO = row.Cells["BATCH_NO"].Value.ToString();
  1971. String SPECIMEN_NO = row.Cells["SPECIMEN_NO"].Value.ToString();
  1972. String phyname = row.Cells["PHY_NAME_L_bj"].Value.ToString();
  1973. String sendMemo = row.Cells["SEND_MEMO"].Text.ToString();
  1974. //金相
  1975. if (sendMemoValeu.Equals("A"))
  1976. {
  1977. if (phyname.Contains(sendMemo))
  1978. {
  1979. bl = false;
  1980. }
  1981. if (bl)
  1982. {
  1983. this.alert("轧批号【" + BATCH_NO + "】取样编号【" + SPECIMEN_NO + "】不包含:【" + sendMemo + "】");
  1984. }
  1985. }
  1986. //重量偏差
  1987. if (sendMemoValeu.Equals("B"))
  1988. {
  1989. if (phyname.Contains("其他"))
  1990. {
  1991. bl = false;
  1992. }
  1993. if (bl)
  1994. {
  1995. this.alert("轧批号【" + BATCH_NO + "】取样编号【" + SPECIMEN_NO + "】不包含:【" + sendMemo + "】");
  1996. }
  1997. }
  1998. //金相&重量偏差
  1999. if (sendMemoValeu.Equals("C"))
  2000. {
  2001. if (phyname.Contains("其他") && phyname.Contains("金相"))
  2002. {
  2003. bl = false;
  2004. }
  2005. if (bl)
  2006. {
  2007. this.alert("轧批号【" + BATCH_NO + "】取样编号【" + SPECIMEN_NO + "】需包含:【" + sendMemo + "】两个项目,请检查是否包含!!!");
  2008. }
  2009. }
  2010. }
  2011. }
  2012. }
  2013. #endregion
  2014. #region 抽样按钮
  2015. private void button1_Click(object sender, EventArgs e)
  2016. {
  2017. DoSendRZ();
  2018. }
  2019. private void button2_Click(object sender, EventArgs e)
  2020. {
  2021. DoUnsendRZ();
  2022. }
  2023. #endregion
  2024. #region 发送检验委托按钮
  2025. private void button3_Click(object sender, EventArgs e)
  2026. {
  2027. this.DoSend();//发送委托
  2028. }
  2029. private void button4_Click(object sender, EventArgs e)
  2030. {
  2031. this.DoUnsend();//撤销委托
  2032. }
  2033. #endregion
  2034. #region 人工委托按钮
  2035. private void button8_Click(object sender, EventArgs e)
  2036. {
  2037. this.AddArtificial();//新增人工委托
  2038. }
  2039. #endregion
  2040. #region ultraGrid1 初始化 变色 状态为2 3红色
  2041. private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e)
  2042. {
  2043. String statusl = e.Row.Cells["STATUS"].Value.ToString();
  2044. String OLD_SAMPL_NO = e.Row.Cells["OLD_SAMPL_NO"].Value.ToString();//钢卷号
  2045. String RZ_OLD_SAMPL_NO = e.Row.Cells["RZ_ENTRUST_NUMBER"].Value.ToString();//抽样钢卷号
  2046. String MixRoll =e.Row.Cells["MIXROLL"].Value.ToString();//组批区间
  2047. String SteelName = e.Row.Cells["STEEL_NAME"].Value.ToString();//牌号
  2048. String Hold = OLD_SAMPL_NO.Substring(OLD_SAMPL_NO.Length - 2);//钢卷号后两位
  2049. String MATERIAL_NO = e.Row.Cells["MATERIAL_NO"].Value.ToString();//取样材料号
  2050. String smpTypeName = e.Row.Cells["SMP_TYPE_NAME"].Value.ToString();//初样 复样
  2051. String QRZ_SPECIMEN_NO = e.Row.Cells["QRZ_SPECIMEN_NO"].Value.ToString();//人工选样
  2052. String SPECIMEN_NO = e.Row.Cells["SPECIMEN_NO"].Value.ToString();//人工选样
  2053. String SAMPL_PICK_RY = e.Row.Cells["SAMPL_PICK_RY"].Value.ToString();//人工选样
  2054. String SEND_MEMO = e.Row.Cells["SEND_MEMO"].Value.ToString();//发送备注
  2055. //if ((e.Row.Cells["STATUS"].Value.ToString() != "0" && !String.IsNullOrEmpty(MixRoll)) &&
  2056. // !e.Row.Cells["STATUS"].Value.ToString().Equals("未发送") && !String.IsNullOrEmpty(statusl)
  2057. // && (SteelName.Equals("Q235B") || SteelName.Equals("Q355B"))
  2058. // )
  2059. //{
  2060. // e.Row.Appearance.BackColor = Color.LightGreen;
  2061. //}
  2062. //正常委托 状态不等于0 组指区间为空 抽样钢卷号为空
  2063. if (e.Row.Cells["STATUS"].Value.ToString() != "0" &&
  2064. !e.Row.Cells["STATUS"].Value.ToString().Equals("未发送") && !String.IsNullOrEmpty(statusl) &&
  2065. String.IsNullOrEmpty(MixRoll) && String.IsNullOrEmpty(RZ_OLD_SAMPL_NO)
  2066. )
  2067. {
  2068. e.Row.Appearance.BackColor = Color.LightGreen;//浅绿
  2069. }
  2070. if (e.Row.Cells["STATUS"].Value.ToString() != "0" &&
  2071. !e.Row.Cells["STATUS"].Value.ToString().Equals("未发送") && !String.IsNullOrEmpty(statusl) &&
  2072. !smpTypeName.Equals("初样")
  2073. )
  2074. {
  2075. e.Row.Appearance.BackColor = Color.LightGreen;//浅绿
  2076. }
  2077. //抽样委托 组指区间不为空 抽样钢卷号不为空
  2078. if (!String.IsNullOrEmpty(MixRoll) && !String.IsNullOrEmpty(RZ_OLD_SAMPL_NO))
  2079. {
  2080. e.Row.Appearance.BackColor = Color.LightGreen;//浅绿
  2081. }
  2082. //1、置空变绿色 有委托 再发送
  2083. if(e.Row.Cells["STATUS"].Value.ToString() != "0" &&
  2084. !e.Row.Cells["STATUS"].Value.ToString().Equals("未发送") && !String.IsNullOrEmpty(statusl) &&
  2085. RZ_OLD_SAMPL_NO.Equals(OLD_SAMPL_NO) && MATERIAL_NO.Equals(OLD_SAMPL_NO) && String.IsNullOrEmpty(MixRoll)
  2086. ){
  2087. e.Row.Appearance.BackColor = Color.LightGreen;//浅绿
  2088. }
  2089. //2、置空变绿色 无委托 再发送
  2090. if (e.Row.Cells["STATUS"].Value.ToString() != "0" &&
  2091. !e.Row.Cells["STATUS"].Value.ToString().Equals("未发送") && !String.IsNullOrEmpty(statusl) &&
  2092. !OLD_SAMPL_NO.Equals(RZ_OLD_SAMPL_NO) && OLD_SAMPL_NO.Equals(MATERIAL_NO) && String.IsNullOrEmpty(MixRoll)
  2093. )
  2094. {
  2095. e.Row.Appearance.BackColor = Color.LightGreen;//浅绿
  2096. }
  2097. //组批区间置空 钢卷号后两位不等于10 组批区间为空 抽样钢卷号不为空 取样材料号不等于钢卷号
  2098. if (!Hold.Equals("10") && String.IsNullOrEmpty(MixRoll) && !String.IsNullOrEmpty(RZ_OLD_SAMPL_NO) &&
  2099. !MATERIAL_NO.Equals(OLD_SAMPL_NO))
  2100. {
  2101. e.Row.Appearance.ForeColor = Color.Blue;//置空从新人工委托 蓝色 //除010其它子板清空组批区间变蓝
  2102. e.Row.Cells["STATUS"].Value = "请人工委托";
  2103. }
  2104. //状态为完 抽样卷不为空 钢卷号和抽样钢卷号不一样 钢卷号等于 取样材料号 组批区间为空
  2105. if ((e.Row.Cells["STATUS"].Value.ToString().Equals("3") || e.Row.Cells["STATUS"].Value.ToString().Equals("已完成")) &&
  2106. !String.IsNullOrEmpty(statusl) && !String.IsNullOrEmpty(RZ_OLD_SAMPL_NO) &&
  2107. !OLD_SAMPL_NO.Equals(RZ_OLD_SAMPL_NO) && OLD_SAMPL_NO.Equals(MATERIAL_NO) && String.IsNullOrEmpty(MixRoll)
  2108. )
  2109. {
  2110. e.Row.Appearance.ForeColor = Color.Blue;//010清空组批区间变蓝
  2111. e.Row.Cells["STATUS"].Value = "请人工委托";
  2112. e.Row.Appearance.BackColor = Color.White;//白色
  2113. }
  2114. if (!String.IsNullOrEmpty(statusl) && !"0".Equals(statusl) && !"未发送".Equals(statusl) && String.IsNullOrEmpty(MixRoll)
  2115. && !String.IsNullOrEmpty(RZ_OLD_SAMPL_NO) && !"预测换样".Equals(SEND_MEMO))
  2116. {
  2117. e.Row.Appearance.ForeColor = Color.Blue;
  2118. e.Row.Cells["STATUS"].Value = "请人工委托";
  2119. e.Row.Appearance.BackColor = Color.White;//白色
  2120. }
  2121. if (OLD_SAMPL_NO.Equals(RZ_OLD_SAMPL_NO))
  2122. {
  2123. e.Row.Appearance.ForeColor = Color.Red;//抽样卷 红色
  2124. }
  2125. if (QRZ_SPECIMEN_NO.Equals(SPECIMEN_NO) && "Y".Equals(SAMPL_PICK_RY))
  2126. {
  2127. e.Row.Appearance.ForeColor = Color.DeepPink;//人工选样
  2128. }
  2129. }
  2130. private void ultraGrid4_InitializeRow(object sender, InitializeRowEventArgs e)
  2131. {
  2132. //String statusl = e.Row.Cells["STATUS"].Value.ToString();
  2133. //String OLD_SAMPL_NO = e.Row.Cells["OLD_SAMPL_NO"].Value.ToString();//钢卷号
  2134. //String RZ_OLD_SAMPL_NO = e.Row.Cells["RZ_ENTRUST_NUMBER"].Value.ToString();//抽样钢卷号
  2135. //if (OLD_SAMPL_NO.Equals(RZ_OLD_SAMPL_NO))
  2136. //{
  2137. // e.Row.Appearance.ForeColor = Color.Red;
  2138. //}
  2139. }
  2140. #endregion
  2141. #region 导出
  2142. private void InExcel()
  2143. {
  2144. try
  2145. {
  2146. if (this.ultraGrid1.Rows.Count == 0)
  2147. {
  2148. MessageBox.Show("没有可以导出的数据", "提示");
  2149. return;
  2150. }
  2151. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  2152. {
  2153. string fName = this.saveFileDialog1.FileName;
  2154. this.ultraGridExcelExporter1.Export(this.ultraGrid1, fName);
  2155. Process.Start(fName);
  2156. }
  2157. }
  2158. catch (Exception ex)
  2159. {
  2160. System.Diagnostics.Debug.WriteLine(ex.ToString());
  2161. MessageBox.Show("系统出错,请联系管理人员", "警告");
  2162. }
  2163. }
  2164. #endregion
  2165. private void button10_Click(object sender, EventArgs e)
  2166. {
  2167. var dataSource = new List<string>();
  2168. Double mySalary = 0;
  2169. Double mySalary1 = 0;
  2170. string SPECIMEN_NO = "";
  2171. string fh = "";
  2172. int num = 0;
  2173. string Znum = "0";
  2174. string Fnum = "0";
  2175. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  2176. {
  2177. string specimeNo = "";
  2178. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  2179. {
  2180. if (string.IsNullOrEmpty(ugr.Cells["STATUS"].Value.ToString()))
  2181. {
  2182. this.alert("委托不存在");
  2183. return;
  2184. }
  2185. if (!ugr.Cells["STATUS"].Value.ToString().Equals("未发送"))
  2186. {
  2187. this.alert("请选择状态为未发送的委托!!!");
  2188. return;
  2189. }
  2190. String rollManaNo = ugr.Cells["ROLL_MANA_NO"].Value.ToString();
  2191. dataSource.Add(rollManaNo);
  2192. String mixroll = ugr.Cells["MIXROLL"].Value.ToString();
  2193. String smpTypeName = ugr.Cells["SMP_TYPE_NAME"].Value.ToString();
  2194. String txt_DESIGN_KEY = ugr.Cells["DESIGN_KEY"].Value.ToString();
  2195. String txtDK = txt_DESIGN_KEY.Substring(0, 2);
  2196. if (smpTypeName.Equals("初样"))
  2197. {
  2198. Znum = "1";
  2199. }
  2200. else if (smpTypeName.Equals("复样"))
  2201. {
  2202. Fnum = "1";
  2203. }
  2204. if (!String.IsNullOrEmpty(mixroll) && smpTypeName.Equals("初样") && !"39".Equals(txtDK) && !"49".Equals(txtDK) && !"59".Equals(txtDK))
  2205. {
  2206. this.alert("预测产品,请进行抽样操作!");
  2207. return;
  2208. }
  2209. //拿取最大规格
  2210. String THICK = ugr.Cells["THICK"].Value.ToString();
  2211. mySalary = Double.Parse(THICK);
  2212. if (mySalary > mySalary1)
  2213. {
  2214. mySalary1 = mySalary;
  2215. }
  2216. specimeNo = ugr.Cells["SPECIMEN_NO"].Value.ToString();
  2217. num = num + 1;
  2218. if (num <= 1)
  2219. {
  2220. SPECIMEN_NO = specimeNo;
  2221. fh = ",";
  2222. }
  2223. else
  2224. {
  2225. SPECIMEN_NO = SPECIMEN_NO + fh + specimeNo;
  2226. }
  2227. }
  2228. }
  2229. if (num<=0)
  2230. {
  2231. this.alert("未勾选委托!");
  2232. return;
  2233. }
  2234. if (Znum.Equals("1") && Fnum.Equals("1"))
  2235. {
  2236. this.alert("不能同时勾选初样和复样!");
  2237. return;
  2238. }
  2239. var uniqueData = dataSource.Distinct();
  2240. int unum = 0;
  2241. foreach (var item in uniqueData)
  2242. {
  2243. unum = unum + 1;
  2244. }
  2245. if (unum>=2)
  2246. {
  2247. this.alert("只能勾选同轧辊单元委托!");
  2248. return;
  2249. }
  2250. CoreClientParam ccpSel = new CoreClientParam();
  2251. ccpSel.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";
  2252. ccpSel.MethodName = "getQltyRZHeatNo";
  2253. ccpSel.ServerParams = new object[] { SPECIMEN_NO };
  2254. ccpSel = this.ExecuteNonQuery(ccpSel, CoreInvokeType.Internal);
  2255. if (ccpSel.ReturnCode == -1)
  2256. {
  2257. return;
  2258. }
  2259. QCM0211 frmRbp = new QCM0211();
  2260. frmRbp.StartPosition = FormStartPosition.CenterScreen;
  2261. frmRbp.ob = this.ob;
  2262. frmRbp.specimenNo = SPECIMEN_NO;
  2263. frmRbp.thick = mySalary1.ToString();
  2264. frmRbp.plineCode = "RZ1";
  2265. frmRbp.ShowDialog();
  2266. this.DoQuery();
  2267. }
  2268. private void button9_Click(object sender, EventArgs e)
  2269. {
  2270. try
  2271. {
  2272. if (MessageBox.Show("确认撤销人工选样?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  2273. {
  2274. return;
  2275. }
  2276. String zhyy = "MES撤回热轧选样";
  2277. CoreClientParam ccp = new CoreClientParam();
  2278. string SPECIMEN_NO = "";
  2279. string fh = "";
  2280. int num = 0;
  2281. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  2282. {
  2283. string specimeNo = "";
  2284. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  2285. {
  2286. String spno = ugr.Cells["SPECIMEN_NO"].Value.ToString();
  2287. String QRZ_SPECIMEN_NO = ugr.Cells["QRZ_SPECIMEN_NO"].Value.ToString();
  2288. if (String.IsNullOrEmpty(QRZ_SPECIMEN_NO) || !spno.Equals(QRZ_SPECIMEN_NO))
  2289. {
  2290. this.alert("请勾选正确的人工选样的数据进行撤销选样!");
  2291. return;
  2292. }
  2293. specimeNo = ugr.Cells["SPECIMEN_NO"].Value.ToString();
  2294. num = num + 1;
  2295. if (num <= 1)
  2296. {
  2297. SPECIMEN_NO = specimeNo;
  2298. fh = ",";
  2299. }
  2300. else
  2301. {
  2302. SPECIMEN_NO = SPECIMEN_NO + fh + specimeNo;
  2303. }
  2304. }
  2305. }
  2306. Hashtable ht = new Hashtable();
  2307. ht.Add("ZHYY", zhyy);
  2308. ht.Add("USERID", this.UserInfo.GetUserID().ToString());
  2309. ht.Add("USERNAME", this.UserInfo.GetUserName().ToString());
  2310. ccp.ServerName = "QCM.JHY01.JHY0102.Send2";
  2311. ccp.MethodName = "CancelLimesRZXY";
  2312. ccp.ServerParams = new object[] { SPECIMEN_NO, ht };
  2313. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  2314. if (ccp.ReturnCode != -1)
  2315. {
  2316. MessageBox.Show("撤销人工选样成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);//ccp.ReturnInfo "发送成功" ccp.ReturnInfo
  2317. }
  2318. this.DoQuery();
  2319. }
  2320. catch (Exception ex)
  2321. {
  2322. System.Diagnostics.Debug.WriteLine(ex.ToString());
  2323. MessageBox.Show("系统出错,请联系管理人员", "警告");
  2324. }
  2325. }
  2326. }
  2327. }