NativeMethodNew.cs 42 KB

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