NativeMethodNew.cs 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using CoreFS.CA06;
  6. using Core.Mes.Client.Comm.Server;
  7. using System.Data;
  8. using System.Windows.Forms;
  9. using System.Collections;
  10. using Core.Mes.Client.Comm;
  11. using System.Net;
  12. namespace Core.StlMes.Client.YdmStuffManage.Entity
  13. {
  14. public class NativeMethodNew : FrmBase
  15. {
  16. //public NativeMethodNew()
  17. //{ }
  18. private OpeBase _ob;
  19. public OpeBase Ob
  20. {
  21. get { return _ob; }
  22. set { _ob = value; }
  23. }
  24. /// <summary>
  25. /// 返回信息
  26. /// </summary>
  27. private string returnMessage;
  28. /// <summary>
  29. /// 返回信息
  30. /// </summary>
  31. public string ReturnMessage
  32. {
  33. get
  34. {
  35. return returnMessage;
  36. }
  37. set
  38. {
  39. returnMessage = value;
  40. }
  41. }
  42. /// <summary>
  43. /// 工序选择
  44. /// </summary>
  45. /// <param name="ob"></param>
  46. public NativeMethodNew(OpeBase ob)
  47. {
  48. this.Ob = ob;
  49. }
  50. /// <summary>
  51. /// 工序选择
  52. /// </summary>
  53. public enum ProcessChoose
  54. {
  55. // 摘要:
  56. //上料锯切
  57. Feed = 0,
  58. // 摘要:
  59. // 加热
  60. Fur = 1,
  61. // 摘要:
  62. // 穿孔
  63. Perforration = 2,
  64. // 摘要:
  65. // 连轧
  66. Rolling = 3,
  67. // 摘要:
  68. // 再加热
  69. Refur = 4,
  70. // 摘要:
  71. // 定径
  72. Sizing = 5,
  73. // 摘要:
  74. // 分切
  75. Saw = 6,
  76. // 摘要:
  77. // 矫直
  78. Straing = 7,
  79. // 摘要:
  80. // ET(涡流)探伤
  81. ET = 8,
  82. // 摘要:
  83. // MT(漏磁)探伤
  84. MT = 9,
  85. // 摘要:
  86. // UL(超声波)探伤
  87. UL = 10,
  88. // 摘要:
  89. // 人工质检
  90. Surface = 11
  91. }
  92. /// <summary>
  93. /// 方法选择
  94. /// </summary>
  95. public enum MethodChoose
  96. {
  97. // 摘要:
  98. // 查询
  99. Query = 0,
  100. // 摘要:
  101. // 添加
  102. Add = 1,
  103. // 摘要:
  104. // 更新
  105. Update = 2,
  106. }
  107. /// <summary>
  108. /// 表类型选择
  109. /// </summary>
  110. public enum TableStytleChoose
  111. {
  112. // 摘要:
  113. // 主表
  114. MainPlan = 0,
  115. // 摘要:
  116. // 子表
  117. FeedPlan = 1,
  118. // 摘要:
  119. // 实绩表
  120. Result = 2,
  121. // 摘要:
  122. // 跟踪记录表
  123. Rack = 3,
  124. // 摘要:
  125. // 历史表
  126. History = 4
  127. }
  128. /// <summary>
  129. /// 判断该炉是否进行了该工序
  130. /// </summary>
  131. /// <param name="JUDGE_STOVE_NO">判定炉号</param>
  132. /// <param name="Node">工序号状态( 0-开始锯切 1-入炉 2-开始穿孔 3-开始连轧 4-入再加热炉 5-开始定径 6-开始分切 7-开始矫直 8-涡流探伤 9-漏磁探伤 10-超声波探伤 11-人工质检)</param>
  133. /// <returns></returns>
  134. public bool isBegineNode(string JUDGE_STOVE_NO, int Node)
  135. {
  136. bool isbeginnode = false;
  137. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.isBegineNode", new object[] { JUDGE_STOVE_NO, Node }, this._ob);
  138. if (count > 0)
  139. {
  140. isbeginnode = true;
  141. }
  142. return isbeginnode;
  143. }
  144. /// <summary>
  145. /// 向对应工序的跟踪记录表里的相应记录插入开始时间
  146. /// </summary>
  147. /// <param name="JUDGE_STOVE_NO">判定炉号</param>
  148. /// <param name="Node">工序号状态( 0-开始锯切 1-入炉 2-开始穿孔 3-开始连轧 4-入再加热炉 5-开始定径 6-开始分切 7-开始矫直 8-开始探伤 9-开始质检)</param>
  149. /// <param name="status"> status 0,插入开始时间,1,插入结束时间</param>
  150. public void InsertSTAferDoubleClick(string JUDGE_STOVE_NO, int Node, string status)
  151. {
  152. if (status == "0" || status == "1")
  153. {
  154. // if (isBegineNode(JUDGE_STOVE_NO, Node))
  155. // {
  156. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.InsertSTToRack", new object[] { JUDGE_STOVE_NO, Node, status }, this._ob);
  157. // }
  158. }
  159. else
  160. {
  161. MessageBox.Show("status的值应为0或1");
  162. return;
  163. }
  164. }
  165. /// <summary>
  166. /// 返回IP对应的产线代码信息
  167. /// </summary>
  168. /// <param name="strip">输入IP</param>
  169. /// <param name="resultcode">0-操作台号,1-操作台名称</param>
  170. /// <returns></returns>
  171. public string GetOperateResult(string strip, string resultcode)
  172. {
  173. string strresult = null;
  174. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.GetOperateResult", new object[] { strip }, this._ob);
  175. if (dt.Rows.Count > 0)
  176. {
  177. if (resultcode == "0")
  178. {
  179. strresult = dt.Rows[0]["PLINE_CODE"].ToString();//操作台号
  180. }
  181. else if (resultcode == "1")
  182. {
  183. strresult = dt.Rows[0]["OPERAT_NAME"].ToString();//操作台名称
  184. }
  185. else
  186. {
  187. strresult = "输入返回数据代码错误";
  188. }
  189. }
  190. else
  191. {
  192. strresult = "无匹配数据";
  193. }
  194. return strresult;
  195. }
  196. /// <summary>
  197. /// h获取PCode
  198. /// </summary>
  199. /// <param name="Department">user_depatment</param>
  200. /// <returns></returns>
  201. public string GetPCode(string Department)
  202. {
  203. string Pcode = "";
  204. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.GetPCode", new Object[] { Department }, this._ob);
  205. if (dt.Rows.Count > 0)
  206. {
  207. Pcode = dt.Rows[0]["pline_code"].ToString();
  208. }
  209. return Pcode;
  210. }
  211. /// <summary>
  212. /// 获取产线
  213. /// </summary>
  214. /// <param name="validDataPurviewIds">数据权限</param>
  215. /// <param name="ob"></param>
  216. /// <returns>字符串数组</returns>
  217. public string[] GetPCodePline(string[] arr1)
  218. {
  219. string[] arr = null;
  220. DataTable dt = ServerHelper.GetData("com.steering.mes.signature.FrmTubeRollFileManage.GetPCode", new Object[] { arr1 }, this._ob);
  221. if (dt != null && dt.Rows.Count > 0)
  222. {
  223. arr = new string[dt.Rows.Count];
  224. for (int i = 0; i < dt.Rows.Count; i++)
  225. {
  226. arr[i] = dt.Rows[i][0].ToString();
  227. }
  228. return arr;
  229. }
  230. else
  231. {
  232. return new string[1] { "" };
  233. }
  234. }
  235. public int GetInfo(string methodId, object[] param, OpeBase ob)
  236. {
  237. CoreClientParam ccp = new CoreClientParam();
  238. ccp.ServerName = methodId.Substring(0, methodId.LastIndexOf("."));
  239. ccp.MethodName = methodId.Substring(methodId.LastIndexOf(".") + 1);
  240. ccp.ServerParams = param;
  241. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  242. if (ccp == null)
  243. {
  244. throw new MESException("服务端处理失败!");
  245. }
  246. if (ccp.ReturnCode < 0)
  247. {
  248. throw new MESException("服务端处理失败!", ccp.ReturnCode, ccp.ReturnInfo);
  249. }
  250. int count = 0;
  251. if (!int.TryParse(ccp.ReturnInfo.ToString(), out count))
  252. {
  253. throw new MESException("服务端处理成功,但返回处理数量不是数字!");
  254. }
  255. return count;
  256. }
  257. /// <summary>
  258. /// 剔除回退公用方法
  259. /// </summary>
  260. /// <param name="heatno">炉号</param>
  261. /// <param name="seq">已剔除序号</param>
  262. /// <param name="processno">工序号 0-锯切前 1-锯切后 2-环形加热炉 3-穿孔 4-连轧 5-再加热炉 6-定径 7-分切前 8-分切后
  263. /// 9-矫直1 10-矫直2 11-矫直3 12-ET探伤 13-涡流探伤 14-超声波探伤 15-人工质检</param>
  264. /// <param name="Num">回退支数(锯切后,分切后需要支数,其它工序默认为1)</param>
  265. /// <param name="DBNum">倍尺数或分切数不需要则默认0</param>
  266. public int DeleteSlabSeq(string heatno, string seq, int processno, int Num, int DBNum)
  267. {
  268. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.DeleteSlabSeq", new Object[] { heatno, seq, processno, Num, DBNum, "0" }, this._ob);
  269. return count;
  270. }
  271. public int DeleteFeedSlabSeq(string heatno, string feedrowno, string seq, int processno, int Num, int DBNum)
  272. {
  273. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.DeleteFeedSlabSeq", new Object[] { heatno, feedrowno, seq, processno, Num, DBNum, "0" }, this._ob);
  274. return count;
  275. }
  276. /// <summary>
  277. /// 剔除回退公用方法
  278. /// </summary>
  279. /// <param name="heatno">炉号</param>
  280. /// <param name="seq">已剔除序号</param>
  281. /// <param name="processno">工序号 0-锯切前 1-锯切后 2-环形加热炉 3-穿孔 4-连轧 5-再加热炉 6-定径 7-分切前 8-分切后
  282. /// 9-矫直1 10-矫直2 11-矫直3 12-ET探伤 13-涡流探伤 14-超声波探伤 15-人工质检</param>
  283. /// <param name="Num">回退支数(锯切后,分切后需要支数,其它工序默认为1)</param>
  284. /// <param name="DBNum">倍尺数或分切数不需要则默认0</param>
  285. public int DeleteSlabSeq(string heatno, string seq, int processno, int Num, int DBNum, string Colno)
  286. {
  287. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.DeleteSlabSeq", new Object[] { heatno, seq, processno, Num, DBNum, Colno }, this._ob);
  288. return count;
  289. }
  290. /// <summary>
  291. /// 判断当前机器IP是否与数据库一直
  292. /// </summary>
  293. /// <param name="MilBase"></param>
  294. /// <returns></returns>
  295. public bool CheckIpAddress(string procee, string clono, string plcode)
  296. {
  297. bool result = false;
  298. string hostname = Dns.GetHostName();
  299. IPAddress ip = Dns.GetHostByName(hostname).AddressList[0];
  300. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.CheckIpAddress", new object[] { procee, clono, plcode }, this.ob);
  301. if (dt.Rows.Count > 0)
  302. {
  303. if (!string.IsNullOrEmpty(dt.Rows[0]["IP_ADDRESS1"].ToString()))
  304. {
  305. if (ip.ToString().Equals(dt.Rows[0]["IP_ADDRESS1"].ToString()))
  306. {
  307. result = true;
  308. }
  309. }
  310. if (!string.IsNullOrEmpty(dt.Rows[0]["IP_ADDRESS2"].ToString()))
  311. {
  312. if (ip.ToString().Equals(dt.Rows[0]["IP_ADDRESS2"].ToString()))
  313. {
  314. result = true;
  315. }
  316. }
  317. if (!string.IsNullOrEmpty(dt.Rows[0]["IP_ADDRESS3"].ToString()))
  318. {
  319. if (ip.ToString().Equals(dt.Rows[0]["IP_ADDRESS3"].ToString()))
  320. {
  321. result = true;
  322. }
  323. }
  324. if (!string.IsNullOrEmpty(dt.Rows[0]["IP_ADDRESS4"].ToString()))
  325. {
  326. if (ip.ToString().Equals(dt.Rows[0]["IP_ADDRESS4"].ToString()))
  327. {
  328. result = true;
  329. }
  330. }
  331. }
  332. else
  333. {
  334. result = true;
  335. }
  336. return result;
  337. }
  338. //public int CheckIpAddressisin(MilBaseAddressEntity MilBase)
  339. //{
  340. // int result = 0;
  341. // List<string> list = new List<string>();
  342. // string ip1 = MilBase.IpAddress1.ToString();
  343. // string ip2 = MilBase.IpAddress2.ToString();
  344. // string ip3 = MilBase.IpAddress3.ToString();
  345. // string ip4 = MilBase.IpAddress4.ToString();
  346. // //list.Add(ip1); list.Add(ip2); list.Add(ip3); list.Add(ip4);
  347. // DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.CheckIpAddressisin", new object[] { MilBase }, this._ob);
  348. // if (dt.Rows.Count > 0)
  349. // {
  350. // list.Clear();
  351. // foreach (DataRow dr in dt.Rows)
  352. // {
  353. // if (!string.IsNullOrEmpty(dr["IP_ADDRESS1"].ToString()))
  354. // {
  355. // list.Add(dr["IP_ADDRESS1"].ToString());
  356. // }
  357. // if (!string.IsNullOrEmpty(dr["IP_ADDRESS2"].ToString()))
  358. // {
  359. // list.Add(dr["IP_ADDRESS2"].ToString());
  360. // }
  361. // if (!string.IsNullOrEmpty(dr["IP_ADDRESS3"].ToString()))
  362. // {
  363. // list.Add(dr["IP_ADDRESS3"].ToString());
  364. // }
  365. // if (!string.IsNullOrEmpty(dr["IP_ADDRESS4"].ToString()))
  366. // {
  367. // list.Add(dr["IP_ADDRESS4"].ToString());
  368. // }
  369. // }
  370. // }
  371. // if (list.Count > 0)
  372. // {
  373. // for (int i = 0; i < list.Count; i++)
  374. // {
  375. // if (ip1.Equals(list[i]))
  376. // {
  377. // result = 1;
  378. // }
  379. // if (ip2.Equals(list[i]))
  380. // {
  381. // result = 2;
  382. // }
  383. // if (ip3.Equals(list[i]))
  384. // {
  385. // result = 3;
  386. // }
  387. // if (ip4.Equals(list[i]))
  388. // {
  389. // result = 4;
  390. // }
  391. // }
  392. // }
  393. // return result;
  394. //}
  395. /// <summary>
  396. /// 保存跟踪记录表备注
  397. /// </summary>
  398. /// <param name="process">0-开始分切 1-开始矫直 2-开始探伤</param>
  399. /// <param name="Seq"></param>
  400. /// <param name="hratno"></param>
  401. /// <param name="ramark"></param>
  402. /// <returns></returns>
  403. public int SaveRackRemark(int process, int Seq, string hratno, string ramark)
  404. {
  405. int count = 0;
  406. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.SaveRackRemark", new object[] { process, Seq, hratno, ramark }, this.ob);
  407. return count;
  408. }
  409. public double CountWeight(string heatno, int X)
  410. {
  411. double result = 0.0;
  412. double dbweight = 0.0;
  413. int sawnum = 0;
  414. double BURNNING_RATE1 = 0.0;
  415. double BURNNING_RATE2 = 0.0;
  416. DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetDBWeightfromMILPlan", new object[] { heatno }, this.ob);
  417. if (dt1.Rows.Count > 0)
  418. {
  419. dbweight = Convert.ToDouble(dt1.Rows[0]["db_height"].ToString());
  420. sawnum = Convert.ToInt16(dt1.Rows[0]["SAW_NUM"].ToString());
  421. }
  422. DataTable dt2 = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetBURNNING_RATEfromFur", new object[] { heatno }, this.ob);
  423. if (dt2.Rows.Count > 0)
  424. {
  425. if (!string.IsNullOrEmpty(dt2.Rows[0]["burnning_rate"].ToString()))
  426. {
  427. BURNNING_RATE1 = Convert.ToDouble(dt2.Rows[0]["burnning_rate"].ToString());
  428. }
  429. else
  430. {
  431. BURNNING_RATE1 = 1;
  432. }
  433. }
  434. DataTable dt3 = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetBURNNING_RATEfromReFur", new object[] { heatno }, this.ob);
  435. if (dt3.Rows.Count > 0)
  436. {
  437. if (!string.IsNullOrEmpty(dt3.Rows[0]["BURNINGRATE"].ToString()))
  438. {
  439. BURNNING_RATE2 = Convert.ToDouble(dt3.Rows[0]["BURNINGRATE"].ToString());
  440. }
  441. else
  442. {
  443. BURNNING_RATE2 = 1;
  444. }
  445. }
  446. switch (X)
  447. {
  448. case 1:
  449. result = dbweight;
  450. break;
  451. case 2:
  452. result = (double)sawnum;
  453. break;
  454. case 3:
  455. result = BURNNING_RATE1;
  456. break;
  457. case 4:
  458. result = BURNNING_RATE2;
  459. break;
  460. }
  461. return result;
  462. }
  463. /// <summary>
  464. /// 获取定尺长度占比
  465. /// </summary>
  466. /// <param name="heatno"></param>
  467. /// <returns></returns>
  468. public double GetLengthPercent(string heatno, OpeBase obs, int X)
  469. {
  470. double result = 100.0;
  471. double cuthead = 0;
  472. double cutorder = 0;
  473. double cuttail = 0;
  474. double sawnum = 0;
  475. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetLengthPercent", new object[] { heatno }, obs);
  476. if (dt.Rows.Count > 0)
  477. {
  478. cuthead = Convert.ToDouble(string.IsNullOrEmpty(dt.Rows[0]["cut_head_length"].ToString())?"0" : dt.Rows[0]["cut_head_length"].ToString());
  479. cutorder = Convert.ToDouble(string.IsNullOrEmpty(dt.Rows[0]["order_length"].ToString()) ? "0" : dt.Rows[0]["order_length"].ToString());
  480. cuttail = Convert.ToDouble(string.IsNullOrEmpty(dt.Rows[0]["cut_trail_length"].ToString())?"0":dt.Rows[0]["cut_trail_length"].ToString());
  481. sawnum = Convert.ToDouble(string.IsNullOrEmpty(dt.Rows[0]["saw_num"].ToString()) ? "0" : dt.Rows[0]["saw_num"].ToString());
  482. //double temp1 = cutorder * sawnum;
  483. if (X == 0)
  484. {
  485. double temp1 = cutorder;
  486. double temp2 = (cuthead / 100 + cuttail / 100 + cutorder * sawnum);
  487. if (temp2 > 0 && temp1 > 0)
  488. {
  489. result = temp1 / temp2 * 100;
  490. }
  491. else
  492. {
  493. result = 0.0;
  494. }
  495. }
  496. if (X == 1)
  497. {
  498. //double temp1 = cuthead / 100;
  499. //double temp2 = (cuthead / 100 + cuttail / 100 + cutorder * sawnum);
  500. //if (temp2 > 0 && temp1 > 0)
  501. //{
  502. // result = temp1 / temp2 * 100;
  503. //}
  504. //else
  505. //{
  506. // result = 0.0;
  507. //}
  508. result = cuthead/100;
  509. }
  510. if (X == 2)
  511. {
  512. //double temp1 = cuthead / 100;
  513. //double temp2 = (cuttail / 100 + cuttail / 100 + cutorder * sawnum);
  514. //if (temp2 > 0 && temp1 > 0)
  515. //{
  516. // result = temp1 / temp2 * 100;
  517. //}
  518. //else
  519. //{
  520. // result = 0.0;
  521. //}
  522. result = cuttail/100;
  523. }
  524. }
  525. return result;
  526. }
  527. public int ChangeShift(string JudgeStoveNo, string ResultNo, string Seq, string PLineCode, string Shift, string Group, int process, int flag, string colno)
  528. {
  529. //方法未针对矫直探伤 进行分台, 需要重写
  530. int count = 0;
  531. string seqlast = "";
  532. string seqchanghas = "";
  533. int changnum = 0;
  534. int changnumhas = 0;
  535. int changnumdel = 0;
  536. //找到本台交接班的第一只
  537. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetRackChangeFlag", new object[] { JudgeStoveNo, ResultNo, Seq, process, colno, Shift, Group }, this._ob);
  538. if (dt.Rows.Count > 0)
  539. {
  540. if (!string.IsNullOrEmpty(dt.Rows[0]["SEQ"].ToString()))
  541. {
  542. seqlast = dt.Rows[0]["SEQ"].ToString();
  543. }
  544. else
  545. {
  546. //seqlast = "1";
  547. }
  548. }
  549. else
  550. {
  551. //seqlast = "1";
  552. }
  553. if (int.Parse(seqlast) > int.Parse(Seq))
  554. {
  555. MessageBox.Show("您所选的管号队列交接班支已被上一班操作,不允许进行交接班", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  556. count = 2;
  557. //return count;
  558. }
  559. else
  560. {
  561. //if (process != 0)
  562. //{
  563. //获取本台的交接班支数
  564. DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetRackChangeNum", new object[] { JudgeStoveNo, ResultNo, seqlast, Seq, process, colno }, this._ob);
  565. if (dt1.Rows.Count > 0)
  566. {
  567. changnum = int.Parse(dt1.Rows[0]["COUNTS"].ToString());
  568. }
  569. //}
  570. //else
  571. //{
  572. // changnum = int.Parse(Seq) - int.Parse(seqlast)+1;
  573. //}
  574. DataTable dt2 = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetRackChangeFlag1", new object[] { JudgeStoveNo, ResultNo, Seq, process, colno, Shift, Group }, this._ob);
  575. if (dt2.Rows.Count > 0)
  576. {
  577. if (!string.IsNullOrEmpty(dt2.Rows[0]["SEQ"].ToString()))
  578. {
  579. seqchanghas = dt2.Rows[0]["SEQ"].ToString();
  580. //if (int.Parse(seqchanghas) > int.Parse(Seq))
  581. //{
  582. DataTable dt3 = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetRackChangeNum", new object[] { JudgeStoveNo, ResultNo, seqlast, seqchanghas, process, colno }, this._ob);
  583. {
  584. changnumdel = int.Parse(dt3.Rows[0]["COUNTS"].ToString());
  585. }
  586. //}
  587. //else
  588. //{
  589. // changnumdel = 0;
  590. //}
  591. }
  592. else
  593. {
  594. seqchanghas = "";
  595. }
  596. }
  597. DataTable dt4 = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetRackChangeNumHas", new object[] { JudgeStoveNo, ResultNo, process, colno }, this._ob);
  598. if (dt4.Rows.Count > 0)
  599. {
  600. changnumhas = int.Parse(dt4.Rows[0]["COUNTS"].ToString());
  601. }
  602. string user = this.UserInfo.GetUserName();
  603. //count = ServerHelper.SetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.ChangeShift", new object[] { JudgeStoveNo, ResultNo, seqlast, Seq, PLineCode, Shift, Group, process, flag ,colno}, this.ob);
  604. //count = ServerHelper.SetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.ChangeShiftNEW", new object[] { JudgeStoveNo, ResultNo, seqlast, Seq, changnum, PLineCode, Shift, Group, process, flag, colno, user }, this._ob);
  605. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.ChangeShiftNEWW", new object[] { JudgeStoveNo, ResultNo, seqlast, Seq, seqchanghas, changnum, changnumhas, changnumdel, Shift, Group, user, process, flag, colno }, this._ob);
  606. }
  607. return count;
  608. }
  609. public int UpdateChangeFlag(string heatno, string resultno, int processno, int seq, string colno)
  610. {
  611. int count = 0;
  612. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.UpdateChangeFlag", new object[] { heatno, resultno, processno, seq, colno }, this._ob);
  613. return count;
  614. }
  615. public int GetWaitChangeSeq(string heatno, string resultno, int processno, string colno)
  616. {
  617. int seq = 0;
  618. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetWaitChangeSeq", new object[] { heatno, resultno, processno, colno }, this._ob);
  619. if (dt.Rows.Count > 0)
  620. {
  621. if (!string.IsNullOrEmpty(dt.Rows[0]["SEQ"].ToString()))
  622. {
  623. seq = int.Parse(dt.Rows[0]["SEQ"].ToString());
  624. }
  625. }
  626. return seq;
  627. }
  628. /// <summary>
  629. /// 交班取消验证
  630. /// </summary>
  631. /// <param name="JudgeStoveNo"></param>
  632. /// <param name="ResultNo"></param>
  633. /// <param name="PLineCode"></param>
  634. /// <param name="Shift"></param>
  635. /// <param name="Group"></param>
  636. /// <param name="process"></param>
  637. /// <param name="colno"></param>
  638. /// <returns></returns>
  639. public bool ChangeShiftBackCheck(string JudgeStoveNo, string ResultNo, string PLineCode, string Shift, string Group, int process, string colno)
  640. {
  641. bool result = false;
  642. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.ChangeShiftBackCheck", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, colno }, this._ob);
  643. if (dt.Rows.Count > 0)
  644. {
  645. result = true;
  646. //if (process == 1 || process == 4)
  647. //{
  648. //}
  649. //else
  650. //{
  651. // if (!string.IsNullOrEmpty(dt.Rows[0]["CHANGFLAG"].ToString()))
  652. // {
  653. // if (dt.Rows[0]["CHANGFLAG"].ToString().Equals("1"))
  654. // {
  655. // result = true;
  656. // }
  657. // }
  658. //}
  659. }
  660. return result;
  661. }
  662. public bool ChangeShiftBackCheckelse(string JudgeStoveNo, string ResultNo, string PLineCode, string Shift, string Group, int process, string colno)
  663. {
  664. bool result = false;
  665. DataTable dt = null;
  666. dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.BeforeChangBack", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, colno }, this._ob);
  667. if (dt.Rows.Count > 0)
  668. {
  669. result = true;
  670. }
  671. return result;
  672. }
  673. /// <summary>
  674. ///
  675. /// </summary>
  676. /// <param name="JudgeStoveNo"></param>
  677. /// <param name="ResultNo"></param>
  678. /// <param name="PLineCode"></param>
  679. /// <param name="Shift"></param>
  680. /// <param name="Group"></param>
  681. /// <param name="process">0-开始锯切 1-入炉 2-开始穿孔 3-开始连轧 4-入再加热炉 5-开始定径 6-开始分切 7-开始矫直 8-开始探伤 9-开始质检</param>
  682. /// <param name="colno"></param>
  683. /// <returns></returns>
  684. public int ChangeShiftBack(string JudgeStoveNo, string ResultNo, string PLineCode, string Shift, string Group, int process, string colno)
  685. {
  686. int count = 0;
  687. int changnumhas = 0;
  688. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.BeforeChangBack", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, colno }, this._ob);
  689. if (dt.Rows.Count > 0)
  690. {
  691. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.ChangBackelse", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, colno }, this._ob);
  692. }
  693. else
  694. {
  695. DataTable dtchangnumhas = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetChangeShiftBackNum", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, colno }, this._ob);
  696. if (dtchangnumhas.Rows.Count > 0)
  697. {
  698. changnumhas = int.Parse(dtchangnumhas.Rows[0]["COUNTS"].ToString());
  699. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.ChangeShiftBack", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, changnumhas, 0, colno }, this._ob);
  700. }
  701. }
  702. return count;
  703. }
  704. /// <summary>
  705. ///
  706. /// </summary>
  707. /// <param name="JudgeStoveNo"></param>
  708. /// <param name="ResultNo"></param>
  709. /// <param name="PLineCode"></param>
  710. /// <param name="Shift"></param>
  711. /// <param name="Group"></param>
  712. /// <param name="Flag">加热炉/再加热炉最后一支入炉标识 0-未入炉 1-入炉 最后一支入炉时,交班取消不能取消入炉交班</param>
  713. /// <param name="process">0-开始锯切 1-入炉 2-开始穿孔 3-开始连轧 4-入再加热炉 5-开始定径 6-开始分切 7-开始矫直 8-开始探伤 9-开始质检</param>
  714. /// <returns></returns>
  715. public int ChangeShiftBack(string JudgeStoveNo, string ResultNo, string PLineCode, string Shift, string Group, int process,int Flag = 0)
  716. {
  717. int count = 0;
  718. int changnumhas = 0;
  719. int changnumhasInfur = 0;
  720. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.BeforeChangBack", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, "0" }, this._ob);
  721. if (dt.Rows.Count > 0)
  722. {
  723. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.ChangBackelse", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, "0" }, this._ob);
  724. }
  725. else
  726. {
  727. DataTable dtInfur = null;
  728. if (process == 1 || process == 4)
  729. {
  730. dtInfur = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetChangeShiftBackNuminfur", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, "0" }, this._ob);
  731. if (dtInfur.Rows.Count > 0)
  732. {
  733. changnumhasInfur = int.Parse(dtInfur.Rows[0]["COUNTS"].ToString());
  734. }
  735. }
  736. DataTable dtchangnumhas = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.GetChangeShiftBackNum", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, "0" }, this._ob);
  737. if (dtchangnumhas.Rows.Count > 0)
  738. {
  739. changnumhas = int.Parse(dtchangnumhas.Rows[0]["COUNTS"].ToString());
  740. }
  741. if (dtchangnumhas.Rows.Count > 0 || dtInfur.Rows.Count > 0)
  742. {
  743. if (Flag == 0)
  744. {
  745. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.ChangeShiftBack", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, changnumhas, changnumhasInfur, "0" }, this._ob);
  746. }
  747. else
  748. {
  749. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FeedSawResult.ChangeShiftBackForLastInFur", new object[] { JudgeStoveNo, ResultNo, PLineCode, Shift, Group, process, changnumhas, changnumhasInfur, "0" }, this._ob);
  750. }
  751. }
  752. }
  753. return count;
  754. }
  755. public int NodeBack(string JudgeStoveNo, string ResultNo, string PLineCode, int process, string colno)
  756. {
  757. //适用矫直探伤
  758. int count = 0;
  759. string seq = "";
  760. DataTable dtchangflag = ServerHelper.GetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.NodeBackGetMaxChangFlag", new object[] { JudgeStoveNo, ResultNo, process, colno }, this._ob);
  761. if (dtchangflag.Rows.Count > 0)
  762. {
  763. if (!string.IsNullOrEmpty(dtchangflag.Rows[0]["SEQ"].ToString()))
  764. {
  765. seq = dtchangflag.Rows[0]["SEQ"].ToString();
  766. }
  767. else
  768. {
  769. seq = "0";
  770. }
  771. }
  772. else
  773. {
  774. seq = "0";
  775. }
  776. count = ServerHelper.SetData("com.steering.mes.zgmil.coup.EddyCurrentTestingResult.NodeBack", new object[] { JudgeStoveNo, ResultNo, PLineCode, process, seq, colno,9 }, this._ob);
  777. return count;
  778. }
  779. //public int SetQuNum(string heatno,string resultno ,int pro,int numqu,string colno)
  780. //{
  781. // int count = 0;
  782. // count
  783. // return count;
  784. //}
  785. public bool IsRackOperate(string shift, string group)
  786. {
  787. bool result = false;
  788. string groupcode = UserInfo.GetUserGroup();
  789. string shiftcode = UserInfo.GetUserOrder();
  790. string shiftnow = "";
  791. string groupnow = "";
  792. switch (groupcode)
  793. {
  794. case "1":
  795. groupnow = "甲";
  796. break;
  797. case "2":
  798. groupnow = "乙";
  799. break;
  800. case "3":
  801. groupnow = "丙";
  802. break;
  803. case "4":
  804. groupnow = "丁";
  805. break;
  806. }
  807. switch (shiftcode)
  808. {
  809. case "0":
  810. shiftnow = "常白班";
  811. break;
  812. case "1":
  813. shiftnow = "早班";
  814. break;
  815. case "2":
  816. shiftnow = "中班";
  817. break;
  818. case "3":
  819. shiftnow = "晚班";
  820. break;
  821. }
  822. if ((shift.Equals(shiftnow) || shift.Contains(shiftnow)) && (group.Equals(groupnow) || group.Contains(groupnow)))
  823. {
  824. result = false;
  825. }
  826. else
  827. {
  828. result = true;
  829. }
  830. if (shift.Equals("") && group.Equals(""))
  831. {
  832. result = false;
  833. }
  834. return result;
  835. }
  836. /// <summary>
  837. /// 连轧用判断班次班组
  838. /// </summary>
  839. /// <param name="shift"></param>
  840. /// <param name="group"></param>
  841. /// <returns></returns>
  842. public bool IsRackOperateRolling(string shift, string group)
  843. {
  844. bool result = false;
  845. string groupcode = UserInfo.GetUserGroup();
  846. string shiftcode = UserInfo.GetUserOrder();
  847. string shiftnow = "";
  848. string groupnow = "";
  849. switch (groupcode)
  850. {
  851. case "1":
  852. groupnow = "甲";
  853. break;
  854. case "2":
  855. groupnow = "乙";
  856. break;
  857. case "3":
  858. groupnow = "丙";
  859. break;
  860. case "4":
  861. groupnow = "丁";
  862. break;
  863. }
  864. switch (shiftcode)
  865. {
  866. case "0":
  867. shiftnow = "常白班";
  868. break;
  869. case "1":
  870. shiftnow = "早班";
  871. break;
  872. case "2":
  873. shiftnow = "中班";
  874. break;
  875. case "3":
  876. shiftnow = "夜班";
  877. break;
  878. }
  879. if ((shift.Equals(shiftnow) || shift.Contains(shiftnow)) && (group.Equals(groupnow) || group.Contains(groupnow)))
  880. {
  881. result = false;
  882. }
  883. else
  884. {
  885. result = true;
  886. }
  887. if (shift.Equals("") && group.Equals(""))
  888. {
  889. result = false;
  890. }
  891. return result;
  892. }
  893. /// <summary>
  894. /// 获取当前工序已剔除支数
  895. /// </summary>
  896. /// <param name="heatno">炉号</param>
  897. /// <param name="processno">工序号(0-锯切前 1-锯切后 2-加热炉 3-穿孔 4-连轧 5-再加热炉 6-定径 7-分切前 8-分切后 9矫直 10-探伤 11-人工质检)</param>
  898. /// <returns></returns>
  899. public int GetSlabNum(string heatno, int processno, OpeBase ob)
  900. {
  901. CoreClientParam ccp = new CoreClientParam();
  902. ccp.ServerName = "com.steering.mes.zgmil.coup.EddyCurrentTestingResult";
  903. ccp.MethodName = "scrapMatCheck";
  904. ccp.ServerParams = new Object[] { heatno, processno };
  905. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  906. int ScrapNumBefore = Convert.ToInt32(ccp.ReturnInfo);
  907. return ScrapNumBefore;
  908. }
  909. /// <summary>
  910. /// 获取属性或值
  911. /// </summary>
  912. /// <returns></returns>
  913. public void GetItem()
  914. {
  915. }
  916. /// <summary>
  917. /// 将类中的属性及值存入字典中
  918. /// </summary>
  919. /// <typeparam name="T"></typeparam>
  920. /// <param name="?"></param>
  921. /// <returns></returns>
  922. public Dictionary<string, string> GetItem<T>(T t)
  923. {
  924. Dictionary<string, string> dic = new Dictionary<string, string>();
  925. System.Reflection.PropertyInfo[] pro = t.GetType().GetProperties();
  926. foreach (System.Reflection.PropertyInfo item in pro)
  927. {
  928. dic.Add(item.Name.ToString(), item.GetValue(t, null).ToString());
  929. }
  930. return dic;
  931. }
  932. /// <summary>
  933. /// 获取DataTable中的列名
  934. /// </summary>
  935. /// <param name="dt">DataTable</param>
  936. /// <returns></returns>
  937. public ArrayList[] GetDtItem(DataTable dt)
  938. {
  939. ArrayList[] str = null;
  940. if (dt.Columns.Count > 0)
  941. {
  942. str = new ArrayList[dt.Columns.Count];
  943. for (int i = 0; i < dt.Columns.Count; i++)
  944. {
  945. str[i].Add(dt.Columns[i].ColumnName);
  946. }
  947. }
  948. return str;
  949. }
  950. /// <summary>
  951. /// 调用后台方法
  952. /// </summary>
  953. /// <returns></returns>
  954. public void BackBusiness()
  955. {
  956. }
  957. /// <summary>
  958. /// 得到服务器时间
  959. /// </summary>
  960. public DateTime GetSeverTime()
  961. {
  962. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FeedSawResult.GetSeverTime", new object[] { }, this._ob);
  963. return DateTime.Parse(dt.Rows[0][0].ToString());
  964. }
  965. /// <summary>
  966. /// 获取产线
  967. /// </summary>
  968. /// <param name="arr1"></param>
  969. /// <returns></returns>
  970. public string[] GetPlineCode(string[] arr1)
  971. {
  972. string[] arr = null;
  973. DataTable dt = ServerHelper.GetData("Core.LgMes.Server.Common.ComBaseInfo.getPlineCode", new Object[] { arr1 }, this._ob);
  974. if (dt != null && dt.Rows.Count > 0)
  975. {
  976. arr = new string[dt.Rows.Count];
  977. for (int i = 0; i < dt.Rows.Count; i++)
  978. {
  979. arr[i] = dt.Rows[i][0].ToString();
  980. }
  981. return arr;
  982. }
  983. else
  984. {
  985. return new string[1] { "" };
  986. }
  987. }
  988. /// <summary>
  989. /// 调用后台方法,返回String类型值
  990. /// </summary>
  991. /// <param name="StrResult">需要查询的字段//</param>
  992. /// <param name="QueryCondition">条件</param>
  993. /// <param name="process">工序</param>
  994. /// <param name="process">表类型</param>
  995. /// <param name="method">方法</param>
  996. /// <returns></returns>
  997. //public string BackBusiness(string StrResult, ArrayList[] QueryCondition, ProcessChoose process,TableStytleChoose table, MethodChoose method)
  998. //{
  999. //}
  1000. /// <summary>
  1001. /// 调用后台方法返回表类型结果
  1002. /// </summary>
  1003. /// <param name="DtResult">返回结果</param>
  1004. /// <param name="QueryCondition">条件</param>
  1005. /// <param name="process">工序</param>
  1006. /// <param name="table">表类型</param>
  1007. /// <param name="method">方法</param>
  1008. /// <returns></returns>
  1009. //public DataTable BackBusiness(DataTable DtResult, ArrayList[] QueryCondition, ProcessChoose process, TableStytleChoose table,MethodChoose method)
  1010. //{
  1011. //}
  1012. //public T GetSingleResult<T>()
  1013. }
  1014. }