FrmSetHeatid.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. using System;
  2. using System.Data;
  3. using System.Drawing;
  4. using System.Collections;
  5. using System.ComponentModel;
  6. using System.Windows.Forms;
  7. using System.Threading;
  8. using CoreFS.CA06;
  9. using Core.Mes.Client.Common;
  10. using Infragistics.Win.UltraWinGrid;
  11. namespace Core.LgMes.Client.LgJobMgt
  12. {
  13. /// <summary>
  14. /// Form1 的摘要说明。
  15. /// </summary>
  16. public class FrmSetHeatid : frmStyleBase//FrmBase//System.Windows.Forms.Form
  17. {
  18. private System.Windows.Forms.Label label1;
  19. private System.Windows.Forms.Label label5;
  20. private System.Windows.Forms.TextBox txt_setheatno;
  21. private System.Windows.Forms.Button btn_enter;
  22. public string Ccmno="";
  23. public string Heatno="";
  24. private System.Windows.Forms.Label label2;
  25. private System.Windows.Forms.TextBox cbo_ccmno;
  26. /// <summary>
  27. /// 必需的设计器变量。
  28. /// </summary>
  29. private System.ComponentModel.Container components = null;
  30. private System.Windows.Forms.Label label3;
  31. private System.Windows.Forms.Label label4;
  32. private System.Windows.Forms.TextBox txt_weight;
  33. private Infragistics.Win.Misc.UltraGroupBox ultraGroupBox1;
  34. private System.Windows.Forms.TextBox txt_mostate;
  35. //private remotingHelp = null;
  36. // private ClientCommon._RemotingHelp remotingHelp=null;
  37. public FrmSetHeatid(OpeBase oba)
  38. {
  39. //
  40. // Windows 窗体设计器支持所必需的
  41. //
  42. InitializeComponent();
  43. ob = oba;
  44. //
  45. // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
  46. //
  47. //remotingHelp = remoteHelp;
  48. }
  49. /// <summary>
  50. /// 清理所有正在使用的资源。
  51. /// </summary>
  52. protected override void Dispose( bool disposing )
  53. {
  54. if( disposing )
  55. {
  56. if(components != null)
  57. {
  58. components.Dispose();
  59. }
  60. }
  61. base.Dispose( disposing );
  62. }
  63. #region Windows 窗体设计器生成的代码
  64. /// <summary>
  65. /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  66. /// 此方法的内容。
  67. /// </summary>
  68. private void InitializeComponent()
  69. {
  70. this.label1 = new System.Windows.Forms.Label();
  71. this.txt_setheatno = new System.Windows.Forms.TextBox();
  72. this.label5 = new System.Windows.Forms.Label();
  73. this.btn_enter = new System.Windows.Forms.Button();
  74. this.label2 = new System.Windows.Forms.Label();
  75. this.cbo_ccmno = new System.Windows.Forms.TextBox();
  76. this.label3 = new System.Windows.Forms.Label();
  77. this.label4 = new System.Windows.Forms.Label();
  78. this.txt_weight = new System.Windows.Forms.TextBox();
  79. this.txt_mostate = new System.Windows.Forms.TextBox();
  80. this.ultraGroupBox1 = new Infragistics.Win.Misc.UltraGroupBox();
  81. ((System.ComponentModel.ISupportInitialize)(this.ultraGroupBox1)).BeginInit();
  82. this.ultraGroupBox1.SuspendLayout();
  83. this.SuspendLayout();
  84. //
  85. // label1
  86. //
  87. this.label1.Location = new System.Drawing.Point(6, 10);
  88. this.label1.Name = "label1";
  89. this.label1.Size = new System.Drawing.Size(320, 20);
  90. this.label1.TabIndex = 0;
  91. this.label1.Text = "功能:将当前切割炉号设置为手动输入的炉号";
  92. //
  93. // txt_setheatno
  94. //
  95. this.txt_setheatno.BackColor = System.Drawing.Color.LightCyan;
  96. this.txt_setheatno.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
  97. this.txt_setheatno.Location = new System.Drawing.Point(6, 94);
  98. this.txt_setheatno.MaxLength = 9;
  99. this.txt_setheatno.Name = "txt_setheatno";
  100. this.txt_setheatno.Size = new System.Drawing.Size(92, 21);
  101. this.txt_setheatno.TabIndex = 7;
  102. this.txt_setheatno.TextChanged += new System.EventHandler(this.txt_setheatno_TextChanged);
  103. //
  104. // label5
  105. //
  106. this.label5.Location = new System.Drawing.Point(6, 38);
  107. this.label5.Name = "label5";
  108. this.label5.Size = new System.Drawing.Size(320, 48);
  109. this.label5.TabIndex = 6;
  110. this.label5.Text = "手动设置炉号,例如:09100001.在设置炉号前,请检查被设置的炉的坯是否已经置是,如有是,请先将是改为否.并检查该炉浇钢重量";
  111. //
  112. // btn_enter
  113. //
  114. this.btn_enter.Location = new System.Drawing.Point(110, 94);
  115. this.btn_enter.Name = "btn_enter";
  116. this.btn_enter.Size = new System.Drawing.Size(76, 23);
  117. this.btn_enter.TabIndex = 8;
  118. this.btn_enter.Text = "确定";
  119. this.btn_enter.Click += new System.EventHandler(this.btn_enter_Click);
  120. //
  121. // label2
  122. //
  123. this.label2.Location = new System.Drawing.Point(114, 134);
  124. this.label2.Name = "label2";
  125. this.label2.Size = new System.Drawing.Size(64, 20);
  126. this.label2.TabIndex = 10;
  127. this.label2.Text = "铸机号";
  128. //
  129. // cbo_ccmno
  130. //
  131. this.cbo_ccmno.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
  132. this.cbo_ccmno.Location = new System.Drawing.Point(6, 126);
  133. this.cbo_ccmno.MaxLength = 9;
  134. this.cbo_ccmno.Name = "cbo_ccmno";
  135. this.cbo_ccmno.ReadOnly = true;
  136. this.cbo_ccmno.Size = new System.Drawing.Size(92, 21);
  137. this.cbo_ccmno.TabIndex = 11;
  138. //
  139. // label3
  140. //
  141. this.label3.Location = new System.Drawing.Point(190, 98);
  142. this.label3.Name = "label3";
  143. this.label3.Size = new System.Drawing.Size(80, 20);
  144. this.label3.TabIndex = 12;
  145. this.label3.Text = "该炉浇钢重量";
  146. //
  147. // label4
  148. //
  149. this.label4.Location = new System.Drawing.Point(190, 134);
  150. this.label4.Name = "label4";
  151. this.label4.Size = new System.Drawing.Size(80, 20);
  152. this.label4.TabIndex = 13;
  153. this.label4.Text = "末坯状态为";
  154. //
  155. // txt_weight
  156. //
  157. this.txt_weight.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
  158. this.txt_weight.Location = new System.Drawing.Point(266, 94);
  159. this.txt_weight.MaxLength = 9;
  160. this.txt_weight.Name = "txt_weight";
  161. this.txt_weight.ReadOnly = true;
  162. this.txt_weight.Size = new System.Drawing.Size(60, 21);
  163. this.txt_weight.TabIndex = 14;
  164. //
  165. // txt_mostate
  166. //
  167. this.txt_mostate.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
  168. this.txt_mostate.Location = new System.Drawing.Point(266, 130);
  169. this.txt_mostate.MaxLength = 9;
  170. this.txt_mostate.Name = "txt_mostate";
  171. this.txt_mostate.ReadOnly = true;
  172. this.txt_mostate.Size = new System.Drawing.Size(60, 21);
  173. this.txt_mostate.TabIndex = 15;
  174. //
  175. // ultraGroupBox1
  176. //
  177. this.ultraGroupBox1.Controls.Add(this.label1);
  178. this.ultraGroupBox1.Controls.Add(this.txt_mostate);
  179. this.ultraGroupBox1.Controls.Add(this.label5);
  180. this.ultraGroupBox1.Controls.Add(this.txt_weight);
  181. this.ultraGroupBox1.Controls.Add(this.txt_setheatno);
  182. this.ultraGroupBox1.Controls.Add(this.label4);
  183. this.ultraGroupBox1.Controls.Add(this.btn_enter);
  184. this.ultraGroupBox1.Controls.Add(this.label3);
  185. this.ultraGroupBox1.Controls.Add(this.label2);
  186. this.ultraGroupBox1.Controls.Add(this.cbo_ccmno);
  187. this.ultraGroupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
  188. this.ultraGroupBox1.Location = new System.Drawing.Point(0, 0);
  189. this.ultraGroupBox1.Name = "ultraGroupBox1";
  190. this.ultraGroupBox1.Size = new System.Drawing.Size(344, 172);
  191. this.ultraGroupBox1.TabIndex = 16;
  192. //
  193. // FrmSetHeatid
  194. //
  195. this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
  196. this.ClientSize = new System.Drawing.Size(344, 172);
  197. this.Controls.Add(this.ultraGroupBox1);
  198. this.MaximizeBox = false;
  199. this.MinimizeBox = false;
  200. this.Name = "FrmSetHeatid";
  201. this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
  202. this.Text = "切割炉号重置界面";
  203. this.Load += new System.EventHandler(this.FrmSetHeatid_Load);
  204. ((System.ComponentModel.ISupportInitialize)(this.ultraGroupBox1)).EndInit();
  205. this.ultraGroupBox1.ResumeLayout(false);
  206. this.ultraGroupBox1.PerformLayout();
  207. this.ResumeLayout(false);
  208. }
  209. #endregion
  210. private void btn_enter_Click(object sender, System.EventArgs e)
  211. {
  212. if (txt_setheatno.Text.Length<8)
  213. {
  214. MessageBox.Show("炉号输入错误!");
  215. return;
  216. }
  217. if (cbo_ccmno.Text=="")
  218. {
  219. MessageBox.Show("连铸机号错误!");
  220. return;
  221. }
  222. if (txt_mostate.Text=="是")
  223. {
  224. MessageBox.Show("请将此炉的末块置为'否'后再更改炉号!!");
  225. return;
  226. }
  227. UpdateHeatid();
  228. }
  229. private void FrmSetHeatid_Load(object sender, System.EventArgs e)
  230. {
  231. cbo_ccmno.Text = Ccmno == "4" ? "0" : Ccmno;
  232. txt_setheatno.Text=Heatno;
  233. }
  234. public void UpdateHeatid()
  235. {
  236. string strHeatNo = "";
  237. strHeatNo = Convert.ToString(this.txt_setheatno.Text);
  238. //CallingMessage par = new CallingMessage();
  239. //par.ServerName = "Craft";
  240. //par.AssemblyName = "Core.Sglg.CraftBusiness";
  241. //par.ClassName = "Core.Sglg.CraftBusiness.ReadDataClass";
  242. //par.MethodName = "resetheatno";
  243. //par.args = new object[]{strHeatNo,Convert.ToInt32(Ccmno)};
  244. string strOut = "";
  245. //object obj = this.remotingHelp.ExecuteMethod(par, out strOut);
  246. //object obj = null;// ClientCommon._RemotingHelp.ExecuteMethod("lgJobMgt", "Core.LgMes.Server.lgJobMgt.classCutJob", "resetheatno", new object[] { strHeatNo, Convert.ToInt32(Ccmno) }, out strOut);
  247. int nDevNo = Convert.ToInt32(Ccmno);
  248. string ccm1heatno = "G0101" + strHeatNo;
  249. string ccm2heatno = "G0201" + strHeatNo;
  250. string ccm3heatno = "G0301" + strHeatNo;
  251. string ccm4heatno = "G0401" + strHeatNo;
  252. ArrayList arry = new ArrayList();
  253. CommonClientToServer ccs = new CommonClientToServer();
  254. ccs.ob = this.ob;
  255. if (nDevNo == 1)
  256. {
  257. //strWhere = String.Format(" update gtt_cuttrack set HIDCCMNEXT=HIDCCM,HIDCCM='{0}' where devpos='CCM0" + nDevNo + "_CUT'", ccm1heatno);
  258. arry.Add("FrmCutBilletDetails_UPdate1");
  259. arry.Add(ccm1heatno);
  260. arry.Add(nDevNo);
  261. }
  262. if (nDevNo == 2)
  263. {
  264. //strWhere = String.Format(" update gtt_cuttrack set HIDCCMNEXT=HIDCCM,HIDCCM='{0}' where devpos='CCM0" + nDevNo + "_CUT'", ccm2heatno);
  265. arry.Add("FrmCutBilletDetails_UPdate1");
  266. arry.Add(ccm2heatno);
  267. arry.Add(nDevNo);
  268. }
  269. if (nDevNo == 3)
  270. {
  271. //strWhere = String.Format(" update gtt_cuttrack set HIDCCMNEXT=HIDCCM,HIDCCM='{0}' where devpos='CCM0" + nDevNo + "_CUT'", ccm3heatno);
  272. arry.Add("FrmCutBilletDetails_UPdate1");
  273. arry.Add(ccm3heatno);
  274. arry.Add(nDevNo);
  275. }
  276. if (nDevNo == 4)
  277. {
  278. //strWhere = String.Format(" update gtt_cuttrack set HIDCCMNEXT1=HIDCCMNEXT,HIDCCMNEXT=HIDCCM,HIDCCM='{0}' where devpos='CCM0" + nDevNo + "_CUT'", ccm4heatno);
  279. arry.Add("FrmCutBilletDetails_UPdate2");
  280. arry.Add(ccm4heatno);
  281. arry.Add(nDevNo);
  282. }
  283. string strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strOut);
  284. if (strOut != "")
  285. {
  286. MessageBox.Show("数据更新失败! " + strOut);
  287. }
  288. else
  289. {
  290. MessageBox.Show("炉号设置成功!");
  291. }
  292. }
  293. private void txt_setheatno_TextChanged(object sender, System.EventArgs e)
  294. {
  295. if (txt_setheatno.TextLength==9)
  296. {
  297. Hashtable cutHash = new Hashtable();
  298. string strHeatNo = "";
  299. strHeatNo = Convert.ToString(this.txt_setheatno.Text);
  300. try
  301. {
  302. //CallingMessage par = new CallingMessage();
  303. //par.ServerName = "Craft";
  304. //par.AssemblyName = "Core.Sglg.CraftBusiness";
  305. //par.ClassName = "Core.Sglg.CraftBusiness.ReadDataClass";
  306. //par.MethodName = "readweightyn";
  307. //par.args = new object[]{strHeatNo};
  308. string strOut = "";
  309. Hashtable htl = new Hashtable();
  310. //object obj = null;// ClientCommon._RemotingHelp.ExecuteMethod("lgJobMgt", "Core.LgMes.Server.lgJobMgt.classCutJob", "readweightyn", new object[] { strHeatNo }, out strOut);
  311. readweightyn(strHeatNo,out htl, out strOut);
  312. if (strOut == "")
  313. {
  314. cutHash = htl;
  315. }
  316. else
  317. {
  318. cutHash.Clear();
  319. }
  320. txt_weight.Text=cutHash[0].ToString();
  321. txt_mostate.Text=cutHash[1].ToString();
  322. }
  323. catch (Exception ee)
  324. {
  325. Console.WriteLine(ee.Message);
  326. cutHash.Clear();
  327. }
  328. }
  329. }
  330. /// <summary>
  331. /// 大包上台重量/浇铸大包重量/是否最后一坯
  332. /// </summary>
  333. /// <param name="strHeatNo"></param>
  334. /// <param name="hat"></param>
  335. public void readweightyn(string strHeatNo, out Hashtable hat,out string strerr )
  336. {
  337. Hashtable weihash = new Hashtable();
  338. float fltFirstWeight = 0;
  339. float fltMouldWeight = 0;
  340. float fltNetWeight = 0;
  341. string LASTBILLETFLAG = "";
  342. //string strWhere = "";
  343. string err = "";
  344. try
  345. {
  346. if (strHeatNo != "")
  347. {
  348. ArrayList arry = new ArrayList();
  349. CommonClientToServer ccs = new CommonClientToServer();
  350. ccs.ob = this.ob;
  351. arry.Add("FrmCutBilletDetails_Query22");//查询大包上台重量/浇铸大包重量
  352. arry.Add(strHeatNo);
  353. DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out err);
  354. if (err == "" && ds.Tables.Count > 0)
  355. {
  356. DataTable dt = ds.Tables[0];
  357. if (dt.Rows.Count >= 1)
  358. {
  359. fltFirstWeight = Convert.ToSingle(dt.Rows[0]["PFBALEWGT"]);
  360. fltMouldWeight = Convert.ToSingle(dt.Rows[0]["MOULDBALEWGT"]);
  361. fltNetWeight = fltFirstWeight - fltMouldWeight;
  362. }
  363. }
  364. }
  365. if (strHeatNo != "")
  366. {
  367. ArrayList arry = new ArrayList();
  368. CommonClientToServer ccs = new CommonClientToServer();
  369. ccs.ob = this.ob;
  370. arry.Add("FrmCutBilletDetails_Query23");//炉号设置--是否是最后坯次
  371. arry.Add(strHeatNo);
  372. arry.Add(strHeatNo);
  373. DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out err);
  374. if (err == "" && ds.Tables.Count > 0)
  375. {
  376. DataTable dt = ds.Tables[0];
  377. if (dt.Rows.Count >= 1)
  378. {
  379. LASTBILLETFLAG = Convert.ToString(dt.Rows[0][0]);
  380. }
  381. }
  382. }
  383. }
  384. catch
  385. { }
  386. weihash.Add(0, fltNetWeight);
  387. weihash.Add(1, LASTBILLETFLAG);
  388. hat=weihash;
  389. strerr = err;
  390. }
  391. }
  392. }