frmpotrepaire.cs 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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 Core.Mes.Client.Common;
  8. using CoreFS.CA06;
  9. namespace Core.LgMes.Client.LgDeviceManager
  10. {
  11. public partial class frmpotrepaire : FrmLgDevFunctions
  12. {
  13. public string _strPotNo = "";
  14. private bool _IsInsert = true;
  15. private string _strWorkNo = "";
  16. public frmpotrepaire(OpeBase oba)
  17. {
  18. InitializeComponent();
  19. this.udteStart.DateTime = DateTime.Now;
  20. this.udteEnd.DateTime = DateTime.Now;
  21. this.btnWithTime.Click += new System.EventHandler(this.button3_Click);
  22. this.chkStart.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
  23. this.chkEnd.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);
  24. ob = oba;
  25. }
  26. private void frmpotrepaire_Load(object sender, EventArgs e)
  27. {
  28. InitComboBox();
  29. GetData();
  30. }
  31. /// <summary>
  32. /// 加载维修信息
  33. /// </summary>
  34. private void GetData()
  35. {
  36. try
  37. {
  38. string strErr = "";
  39. ArrayList arry = new ArrayList();
  40. arry.Add("frmpotrepaire_Query1");
  41. CommonClientToServer ccs = new CommonClientToServer();
  42. ccs.ob = this.ob;
  43. arry.Add(_strPotNo);
  44. DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  45. if (strErr == "" && ds.Tables[0].Rows.Count > 0)
  46. {
  47. DataRow dr = ds.Tables[0].Rows[0];
  48. this.cmbLocation.Text = ds.Tables[0].Rows[0]["REPAIRPART"].ToString();// dr[0].ToString();位置
  49. this.cmbReason.Text = ds.Tables[0].Rows[0]["REASON"].ToString();//dr[1].ToString();原因
  50. this.cmbCategory.Text = ds.Tables[0].Rows[0]["REPAIRTYPE"].ToString();//dr[2].ToString();类别
  51. this.udteStart.Text = ds.Tables[0].Rows[0]["REPAIRTIME"].ToString();//dr[3].ToString();开始时间
  52. this.txtWithTime.Text = ds.Tables[0].Rows[0]["duration"].ToString();//dr[4].ToString();用时
  53. this.cmbRefr.Text = ds.Tables[0].Rows[0]["MATERIALREPLACING"].ToString();//dr[5].ToString();耐材
  54. this.chkStart.Checked = true;
  55. this.chkStart.BackColor = Color.Pink;
  56. _strWorkNo = dr[1].ToString();
  57. _IsInsert = false;
  58. }
  59. }
  60. catch { }
  61. }
  62. /// <summary>
  63. /// 加载耐材厂家
  64. /// </summary>
  65. private void InitComboBox()
  66. {
  67. try
  68. {
  69. string strErr = "";
  70. ArrayList ar = new ArrayList();
  71. ar.Add(LadleCommonClass.strRefractoryMatterFactoryCode);
  72. ar.Add("");
  73. ar.Add("order by inputtime");
  74. DataSet ds = QueryArray("Core.LgMes.Server.LgDeviceManager.LadleManager", "GetFactory", new object[] { ar });
  75. if (strErr == "" && ds.Tables[0].Rows.Count > 0)
  76. {
  77. cmbRefr.Items.Clear();
  78. for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
  79. {
  80. cmbRefr.Items.Add(ds.Tables[0].Rows[i][1].ToString());
  81. }
  82. }
  83. }
  84. catch { }
  85. }
  86. /// <summary>
  87. /// 维修开始
  88. /// </summary>
  89. /// <param name="sender"></param>
  90. /// <param name="e"></param>
  91. private void checkBox1_CheckedChanged(object sender, System.EventArgs e)
  92. {
  93. if (this.chkStart.Checked)
  94. {
  95. this.chkStart.BackColor = Color.Pink;
  96. }
  97. else
  98. {
  99. this.chkStart.BackColor = Color.Transparent;
  100. }
  101. }
  102. /// <summary>
  103. /// 维修结束
  104. /// </summary>
  105. /// <param name="sender"></param>
  106. /// <param name="e"></param>
  107. private void checkBox2_CheckedChanged(object sender, System.EventArgs e)
  108. {
  109. if (this.chkEnd.Checked)
  110. {
  111. this.chkEnd.BackColor = Color.Pink;
  112. this.udteEnd.DateTime = System.DateTime.Now;
  113. GetDuration();
  114. }
  115. else
  116. {
  117. this.chkEnd.BackColor = Color.Transparent;
  118. }
  119. }
  120. private void button3_Click(object sender, System.EventArgs e)
  121. {
  122. GetDuration();
  123. }
  124. /// <summary>
  125. /// 用时
  126. /// </summary>
  127. private void GetDuration()
  128. {
  129. try
  130. {
  131. string sqlstr = "select round((sysdate-to_date('" + udteStart.DateTime.ToString("yyyy-MM-dd HH:mm:ss") + "','yyyy-MM-dd hh24:mi:ss'))*24*60) from dual";
  132. string strOut = "";
  133. DataSet ds = QueryFixedFunions(sqlstr,ob);
  134. if (strOut != "")
  135. {
  136. MessageBox.Show(strOut, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
  137. return;
  138. }
  139. this.txtWithTime.Text = ds.Tables[0].Rows[0][0].ToString();
  140. }
  141. catch (Exception ex)
  142. {
  143. MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
  144. }
  145. }
  146. /// <summary>
  147. /// 维修
  148. /// </summary>
  149. private void proc_OK()
  150. {
  151. if (this.cmbLocation.Text.Trim().Length == 0)
  152. {
  153. MessageBox.Show("请选择维修位置!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  154. return;
  155. }
  156. try
  157. {
  158. ArrayList ar = new ArrayList();
  159. string v10 = Convert.ToString(_IsInsert);
  160. string v0 =_strPotNo;
  161. string v1 =_strWorkNo;
  162. string v2 =cmbLocation.Text.Trim();
  163. string v3 =cmbReason.Text.Trim();
  164. string v4 =cmbCategory.Text.Trim();
  165. string v5 =cmbRefr.Text.Trim();
  166. string v6 = Convert.ToString(chkStart.Checked);
  167. string v7 =Convert.ToString(chkEnd.Checked);
  168. string v8 =udteStart.DateTime.ToString("yyyy-MM-dd HH:mm:ss");
  169. string v9 = udteEnd.DateTime.ToString("yyyy-MM-dd HH:mm:ss");
  170. string[] strParams = new string[11] { v10,v0,v1,v2,v3,v4,v5,v6,v7,v8,v9};
  171. string strErr = "";
  172. string msg = "";
  173. ProcedureZ("Core.LgMes.Server.DEV.Methods.DEVPublicMethods", "procedure", new object[] { "lgmes_dev_info.lg_gbinfo_edit", strParams }, ob, out strErr, out msg);
  174. if (Convert.ToInt32(strErr) > 0)
  175. {
  176. MessageBox.Show(msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  177. }
  178. else
  179. MessageBox.Show(msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  180. FrmPotMgt frm = new FrmPotMgt();
  181. frm.Tag = this.Tag;
  182. frm.Getpotbasedata();
  183. this.Close();
  184. }
  185. catch (Exception ex)
  186. {
  187. MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
  188. }
  189. }
  190. private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
  191. {
  192. switch (e.ClickedItem.Name)
  193. {
  194. case "OK":
  195. this.proc_OK();
  196. break;
  197. case "CANCEL":
  198. this.Close();
  199. break;
  200. default:
  201. break;
  202. }
  203. }
  204. private void button2_Click(object sender, EventArgs e)
  205. {
  206. this.proc_OK();
  207. }
  208. private void button1_Click(object sender, EventArgs e)
  209. {
  210. this.Close();
  211. }
  212. }
  213. }