FrmSetHeatid.cs 16 KB

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