FrmOLUseDetailOperation.cs 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using System.Collections;
  9. using System.Diagnostics;
  10. using CoreFS.CA06;
  11. using Core.Mes.Client.Common;
  12. namespace Core.LgMes.Client.LgDeviceManager
  13. {
  14. public partial class FrmOLUseDetailOperation : FrmLgDevFunctions
  15. {
  16. private string strStatus = "";
  17. private string strOxygenlanceID = "";
  18. private string strOAge = ""; //要更换的氧枪枪龄
  19. private string strRecrodid ="";//氧枪使用唯一标示
  20. public FrmOLUseDetailOperation(OpeBase oba)
  21. {
  22. InitializeComponent();
  23. this.cmbLanceID.SelectionChangeCommitted += new System.EventHandler(this.comboBox1_SelectionChangeCommitted);
  24. this.chkQStartTime.CheckedChanged += new System.EventHandler(this.chkQStartTime_CheckedChanged);
  25. this.chkQEndTime.CheckedChanged += new System.EventHandler(this.chkQEndTime_CheckedChanged);
  26. this.chkQOxygenLanceID.CheckedChanged += new System.EventHandler(this.chkQOxygenLanceID_CheckedChanged);
  27. this.chkPos.CheckedChanged += new System.EventHandler(this.cbPos_CheckedChanged);
  28. ob = oba;
  29. }
  30. private void FrmOLUseDetailOperation_Load(object sender, EventArgs e)
  31. {
  32. ucmeOxygenLanceID.Enabled = false;
  33. udteStartTime.Enabled = false;
  34. udteEndTime.Enabled = false;
  35. ucmePos.Enabled = false;
  36. udteStartTime.Text = System.DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00";
  37. udteEndTime.Text = System.DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59";
  38. FrmOxygenLanceManage FrmOLM = (FrmOxygenLanceManage)this.Tag;
  39. for (int i = 0; i < FrmOLM.ulgridBaseInfo.Rows.Count; i++)
  40. {
  41. cmbLanceID.Items.Add(FrmOLM.ulgridBaseInfo.Rows[i].Cells["OXYGENLANCEID"].Value.ToString());
  42. ucmeOxygenLanceID.Items.Add(FrmOLM.ulgridBaseInfo.Rows[i].Cells["OXYGENLANCEID"].Value.ToString());
  43. }
  44. cmbLanceID.Items.Add("");
  45. cmbLanceID.Text = cmbLanceID.Items[0].ToString();
  46. GetSpoutFactory();//初始化喷头厂家信息
  47. refreshgrid("");
  48. }
  49. ///// <喷头厂家>
  50. ///// 喷头厂家
  51. ///// </summary>
  52. //private void GetSpoutFactory()
  53. //{
  54. // try
  55. // {
  56. // ArrayList ar = new ArrayList();
  57. // ar.Add(LadleCommonClass.strSpoutHeadFactoryCode);
  58. // ar.Add("");
  59. // ar.Add("order by BASENAME");
  60. // DataSet ds = QueryArrayFunions("Core.LgMes.Server.LgDeviceManager.LadleManager", "GetFactory", new object[] { ar }, ob);
  61. // if (ds != null)
  62. // {
  63. // for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
  64. // {
  65. // this.ucmePtcj.Items.Add(ds.Tables[0].Rows[i]["BASENAME"]);
  66. // }
  67. // }
  68. // }
  69. // catch { }
  70. //}
  71. /// <喷头厂家>
  72. /// 喷头厂家
  73. /// </喷头厂家>
  74. private void GetSpoutFactory()
  75. {
  76. try
  77. {
  78. string strErr = "";
  79. ArrayList arry = new ArrayList();
  80. arry.Add("LoadGetYQ.Query");
  81. CommonClientToServer ccs = new CommonClientToServer();
  82. ccs.ob = this.ob;
  83. DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  84. if (strErr != "" || !(ds != null && ds.Tables.Count > 0))
  85. {
  86. MessageBox.Show("喷头厂家加载失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  87. if (MessageBox.Show("是否重新加载喷头厂家?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
  88. GetSpoutFactory();
  89. return;
  90. }
  91. this.ucmePtcj.DataSource = ds.Tables[0].DefaultView;
  92. this.ucmePtcj.DisplayMember = "BASENAME";
  93. this.ucmePtcj.ValueMember = "BASECODE";
  94. }
  95. catch (Exception ex)
  96. {
  97. MessageBox.Show(ex.Message);
  98. }
  99. }
  100. private void ucmePtcj_ValueChanged(object sender, EventArgs e)
  101. {
  102. try
  103. {
  104. string strErr = "";
  105. string strByid = this.ucmePtcj.Value.ToString();
  106. ArrayList arry = new ArrayList();
  107. arry.Add("LoadGetYQBy_ID.Query");
  108. arry.Add(strByid);
  109. CommonClientToServer ccs = new CommonClientToServer();
  110. ccs.ob = this.ob;
  111. DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery",
  112. "doSimpleQuery", arry, out strErr);
  113. if( ds.Tables[0].Rows.Count>0)
  114. {
  115. this.txt_Memo.Text = ds.Tables[0].Rows[0]["MEMO"].ToString();
  116. }
  117. }
  118. catch { }
  119. }
  120. private void proc_UpdateBaseInfoAge(string strRecordID, string strAge)
  121. {
  122. try
  123. {
  124. string strErr = "";
  125. string strSql = "select case when ENDTIME is null then '0' else '1' end Finished from DEV_yq_use_detail where RECRODID='" + strRecordID + "'";
  126. //CallingMessage par = new CallingMessage();
  127. //par.ServerName = "LgDeviceManager";
  128. //par.AssemblyName = "Core.LgMes.Server.LgDeviceManager";
  129. //par.ClassName = "Core.LgMes.Server.LgDeviceManager.OxygenLanceManager";
  130. //par.MethodName = "OxygenLance_Return";
  131. //par.args = new object[] { strSql };
  132. DataSet ds = null;// (DataSet)ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr);
  133. if (!((strErr == null || strErr == "") && ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
  134. return;
  135. string strFinished = Convert.ToString(ds.Tables[0].Rows[0]["Finished"]);
  136. if (strFinished == "1")
  137. return;
  138. strErr = "";
  139. strSql = "update DEV_YQ_BASE_INFO set USEMAXTIME = '" + strAge + "' where OXYGENLANCEID = (select OXYGENLANCEID from DEV_YQ_USE_DETAIL where RECRODID = '" + strRecordID + "')";
  140. //par.MethodName = "OxygenLance_NonReturn";
  141. //par.args = new object[] { strSql };
  142. //ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr);
  143. }
  144. catch (Exception ex)
  145. {
  146. MessageBox.Show(ex.Message, "出错");
  147. }
  148. }
  149. /// <新增>
  150. /// 新增
  151. /// </summary>
  152. private void AddUseDetail()
  153. {
  154. try
  155. {
  156. //if (comboBox1.SelectedIndex < 0)
  157. //{
  158. // MessageBox.Show("氧枪编号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  159. // comboBox1.Focus();
  160. // return;
  161. //}
  162. //if (comboBox6.SelectedIndex < 0)
  163. //{
  164. // MessageBox.Show("炉座号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  165. // comboBox6.Focus();
  166. // return;
  167. //}
  168. //if (comboBox3.SelectedIndex < 0)
  169. //{
  170. // MessageBox.Show("使用类型不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  171. // comboBox3.Focus();
  172. // return;
  173. //}
  174. if (!CheckIsNumberByASCII(txtQL.Text.Trim()))
  175. {
  176. MessageBox.Show("枪龄输入不正确!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  177. txtQL.Text = "0";
  178. txtQL.SelectAll();
  179. txtQL.Focus();
  180. return;
  181. }
  182. if (!CheckIsNumberByASCII(txtSLL.Text.Trim()))
  183. {
  184. MessageBox.Show("高压水流量输入不正确!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  185. txtSLL.SelectAll();
  186. txtSLL.Focus();
  187. return;
  188. }
  189. if (dtpQEndTime.Value != null && Convert.ToDateTime(dtpQStartTime.Value) > Convert.ToDateTime(dtpQEndTime.Value))
  190. {
  191. MessageBox.Show("上线时间不能大于下线时间!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  192. dtpQStartTime.Focus();
  193. return;
  194. }
  195. string strOLID = cmbLanceID.Text.Trim();
  196. //string strCurrStatus = "";
  197. //if (this.GetYQCurrStatus(strOLID, out strCurrStatus))
  198. //{
  199. // MessageBox.Show("氧枪[" + strOLID + "]当前状态为[" + strCurrStatus + "],不能再使用,请选择其它氧枪!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  200. // return;
  201. //}
  202. if (this.GetYQUserInfo(comboBox6.Text.Trim(), cmbType.Text.Trim()))
  203. {
  204. if (MessageBox.Show("炉座号[" + comboBox6.Text.Trim() + "]有[" + this.strOxygenlanceID + "]号氧枪正在工作!是否更换为新的氧枪号[" + cmbLanceID.Text.Trim() + "]?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  205. return;
  206. else
  207. {
  208. string strErr = "";
  209. if (strErr == null || strErr == "")
  210. {
  211. dtpQEndTime.Value = DateTime.Now;
  212. BaseInfoStateUpdate("下线", strOxygenlanceID, strOAge, ""); //更新基础表状态
  213. }
  214. else
  215. {
  216. MessageBox.Show("氧枪更换下线失败,重试!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  217. return;
  218. }
  219. }
  220. }
  221. string classstr = ClassTransCode();
  222. if (txtQL.Text.Trim() == "")
  223. {
  224. txtQL.Text = "0";
  225. }
  226. if (txtSLL.Text.Trim() == "")
  227. {
  228. txtSLL.Text = "0";
  229. }
  230. dtpQEndTime.Value = null;
  231. string strSql = "insert into DEV_YQ_USE_DETAIL "
  232. + "(RECRODID, OXYGENLANCEID, CLASS, NOWPOSITION, OVENID,"
  233. + " NOWSTATUS, USETIMES, BEGINTIME, ENDTIME, REASON,"
  234. + " MEMO, HEATNO, SPOUTFACTORY, FLUX) values "
  235. + "((select to_char(nvl(max(to_number(recrodid)),0)+1) from DEV_yq_use_detail),"
  236. + "'" + cmbLanceID.Text.Trim() + "',"
  237. + "'" + classstr + "',"
  238. + "'" + cmbType.Text.Trim() + "',"
  239. + "'" + comboBox6.Text.Trim() + "',"
  240. + "'" + comboBox4.Text.Trim() + "',"
  241. + "'" + txtQL.Text.Trim() + "',"
  242. + "to_date('" + dtpQStartTime.Value + "','yyyy-mm-dd hh24:mi:ss'),"
  243. + "null,"
  244. + "'" + txtReason.Text.Trim() + "',"
  245. + "'" + txtmemo.Text.Trim() + "',"
  246. + "'',"
  247. + "'" + ucmePtcj.Text.Trim() + "', "
  248. + txtSLL.Text.Trim() + " )";
  249. CoreClientParam ccp = new CoreClientParam();
  250. ccp.ServerName = "Core.LgMes.Server.DEV.Methods.DEVPublicMethods";
  251. ccp.MethodName = "UpdateMethods";
  252. ccp.ServerParams = new Object[] { strSql };
  253. ob.ExecuteQueryToDataTable(ccp,CoreInvokeType.Internal);
  254. //CallingMessage par = new CallingMessage();
  255. //par.ServerName = "LgDeviceManager";
  256. //par.AssemblyName = "Core.LgMes.Server.LgDeviceManager";
  257. //par.ClassName = "Core.LgMes.Server.LgDeviceManager.OxygenLanceManager";
  258. //par.MethodName = "OxygenLance_NonReturn";
  259. //par.args = new object[] { strSql };
  260. string strErr1 = "";
  261. //ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr1);
  262. if (strErr1 == null || strErr1 == "")
  263. {
  264. BaseInfoStateUpdate("使用", cmbLanceID.Text.Trim(), txtQL.Text.Trim(), cmbType.Text.Trim());
  265. refreshgrid("");
  266. QueryDataselect();
  267. MessageBox.Show("炉座号[" + comboBox6.Text.Trim() + "]氧枪[" + cmbLanceID.Text.Trim() + "]设置成功 !", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  268. }
  269. else
  270. {
  271. MessageBox.Show("炉座号[" + comboBox6.Text.Trim() + "]氧枪[" + cmbLanceID.Text.Trim() + "]设置失败 !", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
  272. }
  273. }
  274. catch (Exception ex)
  275. {
  276. MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
  277. }
  278. }
  279. /// <修改氧枪使用信息>
  280. /// 修改氧枪使用信息
  281. /// </summary>
  282. private void ModifyUseDetail()
  283. {
  284. try
  285. {
  286. if (ulgridBaseInfo.ActiveRow == null) return;
  287. //if (this.comboBox1.SelectedIndex == 0 || this.comboBox1.SelectedItem.ToString().Trim().Length == 0 || this.textBox1.Text.Trim().Length == 0)
  288. //{
  289. // MessageBox.Show("请选择需要修改的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  290. // comboBox1.Focus();
  291. // return;
  292. //}
  293. if (dtpQEndTime.Value != null && Convert.ToDateTime(dtpQStartTime.Value) > Convert.ToDateTime(dtpQEndTime.Value))
  294. {
  295. MessageBox.Show("上线时间不能大于下线时间!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  296. dtpQStartTime.Focus();
  297. return;
  298. }
  299. if (!CheckIsNumberByASCII(txtQL.Text.Trim()) || txtQL.Text.Trim().Length == 0)
  300. {
  301. MessageBox.Show("请输入正确的枪龄!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  302. txtQL.Text = "0";
  303. txtQL.SelectAll();
  304. txtQL.Focus();
  305. return;
  306. }
  307. if (txtSLL.Text == "")
  308. {
  309. txtSLL.Text = "0";
  310. }
  311. string classstr = ClassTransCode();
  312. string strSql = "update DEV_yq_use_detail set "
  313. + "USETIMES=" + Convert.ToInt32(txtQL.Text.Trim()) + ","
  314. + "REASON='" + txtReason.Text.Trim() + "',"
  315. + "MEMO='" + txtmemo.Text.Trim() + "',"
  316. + "SPOUTFACTORY='" + ucmePtcj.Text.Trim() + "',"
  317. + "FLUX=" + Convert.ToInt32(txtSLL.Text.Trim()) + ","
  318. + "BEGINTIME=to_date('" + dtpQStartTime.Value.ToString() + "','yyyy-mm-dd hh24:mi:ss'),"
  319. + "OVENID='"+comboBox6.Text.ToString().Trim()+"',"
  320. + "CLASS='" + classstr + "' "
  321. + "where RECRODID='" + txtJLBH.Text.Trim() + "'";
  322. string strErr = "";
  323. CoreClientParam ccp = new CoreClientParam();
  324. ccp.ServerParams = new Object[] { strSql };
  325. ccp.ServerName = "Core.LgMes.Server.DEV.Methods.DEVPublicMethods";
  326. ccp.MethodName = "UpdateMethods";
  327. ob.ExecuteQueryToDataTable(ccp,CoreInvokeType.Internal);
  328. if (strErr == null || strErr == "")
  329. {
  330. string tt = txtQL.Text.Trim();
  331. int qq = Convert.ToInt32(txtQL.Text.Trim());
  332. string ww = cmbType.Text.Trim();
  333. string rr = cmbLanceID.Text.Trim();
  334. string Sqlstr = "update dev_yq_base_info t set t.usemaxtime='" + Convert.ToInt32(txtQL.Text.Trim()) + "'"
  335. + ", t.usetype='" + cmbType.Text.Trim()+ "' where t.oxygenlanceid='" + cmbLanceID.Text.Trim() + "'";
  336. strErr = "";
  337. CoreClientParam ccp_str = new CoreClientParam();
  338. ccp_str.ServerParams = new Object[] { Sqlstr };
  339. ccp_str.ServerName = "Core.LgMes.Server.DEV.Methods.DEVPublicMethods";
  340. ccp_str.MethodName = "UpdateMethods";
  341. ob.ExecuteQueryToDataTable(ccp_str, CoreInvokeType.Internal);
  342. proc_UpdateBaseInfoAge(txtJLBH.Text.Trim(), txtQL.Text.Trim());
  343. refreshgrid("");
  344. FrmOxygenLanceManage FrmOLM = (FrmOxygenLanceManage)this.Tag;
  345. MessageBox.Show("记录修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  346. FrmOLM.OLInfoToShow();
  347. QueryDataselect();
  348. }
  349. else
  350. {
  351. MessageBox.Show("记录修改失败!\r\n" + strErr, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
  352. }
  353. }
  354. catch (Exception ex)
  355. {
  356. MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
  357. }
  358. }
  359. /// <删除氧枪使用信息>
  360. /// 删除氧枪使用信息
  361. /// </summary>
  362. private void DelUseDetail()
  363. {
  364. try
  365. {
  366. if (ulgridBaseInfo.ActiveRow == null) return;
  367. //if (this.comboBox1.SelectedIndex == 0 || this.comboBox1.SelectedItem.ToString().Trim().Length == 0 || this.textBox1.Text.Trim().Length == 0)
  368. //{
  369. // MessageBox.Show("请选择需要删除的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  370. // comboBox1.Focus();
  371. // return;
  372. //}
  373. if (MessageBox.Show("确定要删除当前记录吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  374. return;
  375. string strErr = "";
  376. string strSql = "select case when ENDTIME is null then '0' else '1' end Finished from DEV_yq_use_detail where RECRODID='" + txtJLBH.Text.Trim() + "'";
  377. CoreClientParam ccp = new CoreClientParam();
  378. ccp.ServerName = "Core.LgMes.Server.DEV.Methods.DEVPublicMethods";//
  379. ccp.MethodName = "QueryMethods";
  380. ccp.ServerParams = new Object[] { strSql };//查询条件
  381. DataTable dt = new DataTable();
  382. ccp.SourceDataTable = dt;
  383. this.ob.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);//
  384. DataSet ds = new DataSet();
  385. ds.Tables.Add(dt);
  386. if ((strErr == null || strErr == "") && ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
  387. {
  388. string strFinished = Convert.ToString(ds.Tables[0].Rows[0]["Finished"]);
  389. if (strFinished == "1")
  390. {
  391. MessageBox.Show("该记录氧枪使用已经结束,不能删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  392. return;
  393. }
  394. }
  395. else
  396. {
  397. MessageBox.Show("记录删除失败!\r\n" + strErr, "错误", MessageBoxButtons.OK, MessageBoxIcon.Information);
  398. return;
  399. }
  400. strErr = "";
  401. strSql = "update DEV_YQ_BASE_INFO set STATUS = '备用',USETYPE = '' where OXYGENLANCEID = (select OXYGENLANCEID from DEV_YQ_USE_DETAIL where RECRODID = '" + txtJLBH.Text.Trim() + "')";
  402. CoreClientParam ccpqu = new CoreClientParam();
  403. ccpqu.ServerName = "Core.LgMes.Server.DEV.Methods.DEVPublicMethods";
  404. ccpqu.MethodName = "UpdateMethods";
  405. ccpqu.ServerParams = new Object[] { strSql };
  406. ob.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  407. string Sqlstr = "delete from DEV_YQ_USE_DETAIL where RECRODID='" + txtJLBH.Text.Trim() + "'";
  408. CoreClientParam ccpdel = new CoreClientParam();
  409. ccpdel.ServerName ="Core.LgMes.Server.DEV.Methods.DEVPublicMethods";
  410. ccpdel.MethodName ="UpdateMethods";
  411. ccpdel.ServerParams = new Object[] { Sqlstr };
  412. ob.ExecuteQueryToDataTable(ccpdel,CoreInvokeType.Internal);
  413. if (strErr == null || strErr == "")
  414. {
  415. refreshgrid("");
  416. FrmOxygenLanceManage FrmOLM = (FrmOxygenLanceManage)this.Tag;
  417. FrmOLM.OLInfoToShow();
  418. MessageBox.Show("记录删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  419. QueryDataselect();
  420. }
  421. else
  422. {
  423. MessageBox.Show("记录删除失败!\r\n" + strErr, "错误", MessageBoxButtons.OK, MessageBoxIcon.Information);
  424. return;
  425. }
  426. }
  427. catch (Exception ex)
  428. {
  429. MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
  430. }
  431. }
  432. //新增和修改氧枪使用状态时,同时更新氧枪基本信息中氧枪的使用状态
  433. private void BaseInfoStateUpdate(string strNowStatus, string strYQID, string strYQAge, string strAB)
  434. {
  435. string sql = "update DEV_yq_base_info set STATUS='" + strNowStatus + "',USEMAXTIME='" + strYQAge + "',USETYPE = '" + strAB + "' where OXYGENLANCEID = '" + strYQID + "'";
  436. CoreClientParam ccp = new CoreClientParam();
  437. ccp.ServerName = "Core.LgMes.Server.DEV.Methods.DEVPublicMethods";
  438. ccp.MethodName = "UpdateMethods";
  439. ccp.ServerParams = new Object[] { sql};
  440. ob.ExecuteQueryToDataTable(ccp,CoreInvokeType.Internal);
  441. UserInfoEidt();
  442. FrmOxygenLanceManage FrmOLM = (FrmOxygenLanceManage)this.Tag;
  443. FrmOLM.OLInfoToShow();
  444. }
  445. //修改氧枪使用信息
  446. private void UserInfoEidt()
  447. {
  448. string sql = "update DEV_yq_use_detail t set t.endtime=sysdate where t.recrodid = "+strRecrodid+"";
  449. CoreClientParam ccp = new CoreClientParam();
  450. ccp.ServerName = "Core.LgMes.Server.DEV.Methods.DEVPublicMethods";
  451. ccp.MethodName = "UpdateMethods";
  452. ccp.ServerParams = new Object[] { sql };
  453. ob.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  454. }
  455. /// <summary>
  456. /// 获取班别
  457. /// </summary>
  458. /// <returns></returns>
  459. private string ClassTransCode()
  460. {
  461. DateTime TimeNow = new DateTime();
  462. TimeNow = System.DateTime.Now;
  463. string str1 = "";
  464. string str2 = "";
  465. //string str;
  466. if (TimeNow >= Convert.ToDateTime("8:00:00") && TimeNow <= Convert.ToDateTime("15:59:59"))
  467. {
  468. str1 = "1";
  469. }
  470. else if (TimeNow >= Convert.ToDateTime("16:00:00") && TimeNow <= Convert.ToDateTime("23:59:59"))
  471. {
  472. str1 = "2";
  473. }
  474. else
  475. {
  476. str1 = "3";
  477. }
  478. switch (ucmeClass.Text)
  479. {
  480. case "甲":
  481. {
  482. str2 = "1";
  483. break;
  484. }
  485. case "乙":
  486. {
  487. str2 = "2";
  488. break;
  489. }
  490. case "丙":
  491. {
  492. str2 = "3";
  493. break;
  494. }
  495. case "丁":
  496. {
  497. str2 = "4";
  498. break;
  499. }
  500. }
  501. return (str1 + str2);
  502. }
  503. private string ClassTransChar(string code)
  504. {
  505. string str = "";
  506. switch (code)
  507. {
  508. case "1":
  509. {
  510. str = "甲";
  511. break;
  512. }
  513. case "2":
  514. {
  515. str = "乙";
  516. break;
  517. }
  518. case "3":
  519. {
  520. str = "丙";
  521. break;
  522. }
  523. case "4":
  524. {
  525. str = "丁";
  526. break;
  527. }
  528. }
  529. return str;
  530. }
  531. private bool CheckIsNumberByASCII(string sSrc)
  532. {
  533. bool bRet = true;
  534. ASCIIEncoding AE = new ASCIIEncoding();
  535. byte[] bArray = AE.GetBytes(sSrc);
  536. for (int i = 0; i < bArray.Length; i++)
  537. {
  538. if (bArray[i] < 47 || bArray[i] > 57)
  539. {
  540. bRet = false;
  541. break;
  542. }
  543. }
  544. return bRet;
  545. }
  546. /// <获取氧枪使用信息>
  547. /// 获取氧枪使用信息
  548. /// </summary>
  549. /// <param name="sqlwhere"></param>
  550. private void refreshgrid(string sqlwhere)
  551. {
  552. string sql = "select RECRODID,OXYGENLANCEID,CLASS,"
  553. +"NOWPOSITION,OVENID,NOWSTATUS,USETIMES,BEGINTIME,ENDTIME,REASON,MEMO,"
  554. +"SPOUTFACTORY,FLUX from DEV_yq_use_detail where 1=1 and (RECRODID,OXYGENLANCEID) "
  555. +"in (select recrodid, OXYGENLANCEID from (select t.*,row_number() over(partition by "
  556. +"t.OXYGENLANCEID order by to_number(t.recrodid) desc) xh from DEV_yq_use_detail t) where xh <= 2) " + sqlwhere + " "
  557. +"order by case when endtime is null then '0' else '1' end,oxygenlanceid,to_char(endtime,'yyyy-MM-dd') desc,ovenid,nowposition";
  558. //string err = "";
  559. DataSet ds = null;// (DataSet)ClientCommon._RemotingHelp.ExecuteMethod(par, out err);
  560. if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
  561. {
  562. ultdsUseDetail.Rows.Clear();
  563. for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
  564. {
  565. object[] RowValue = new object[ds.Tables[0].Columns.Count];
  566. for (int j = 0; j < ds.Tables[0].Columns.Count; j++)
  567. {
  568. RowValue[j] = ds.Tables[0].Rows[i][j].ToString();
  569. }
  570. RowValue[2] = ClassTransChar(RowValue[2].ToString().Substring(1));
  571. ultdsUseDetail.Rows.Add(RowValue);
  572. }
  573. Hashtable htOperate = new Hashtable();
  574. htOperate.Add("", Color.LightGreen);
  575. Core.LgMes.Client.LgDeviceManager.LadleCommonClass.SetGridBackColor(ulgridBaseInfo, htOperate, "ENDTIME", true);
  576. }
  577. else
  578. {
  579. ultdsUseDetail.Rows.Clear();
  580. dtpQStartTime.Text = System.DateTime.Now.ToString();
  581. dtpQEndTime.Text = null;
  582. comboBox4.SelectedIndex = -1;
  583. ucmeClass.SelectedIndex = -1;
  584. cmbType.SelectedIndex = -1;
  585. ucmePtcj.SelectedIndex = -1;
  586. txtQL.Clear();
  587. txtSLL.Clear();
  588. comboBox6.SelectedIndex = -1;
  589. txtReason.Clear();
  590. txtmemo.Clear();
  591. txtJLBH.Clear();
  592. }
  593. }
  594. /// <按条件查询>
  595. /// //按条件查询
  596. /// </summary>
  597. private void QueryDataselect()
  598. {
  599. string sqlSelect = "select RECRODID,OXYGENLANCEID,"
  600. +"case substr(CLASS,1,1) when '1' then '白' when '2' then '中' when '3' then '夜' end"
  601. +"||case substr(CLASS,2,1) when '1' then '甲' when '2' then '乙' when '3' then '丙' when '4' then '丁' end CLASS,"
  602. + "NOWPOSITION,OVENID,NOWSTATUS,USETIMES,to_char(BEGINTIME,'yyyy-mm-dd HH:mm:ss')BEGINTIME,to_char(ENDTIME,'yyyy-mm-dd HH:mm:ss')ENDTIME,"
  603. +"REASON,MEMO,SPOUTFACTORY,FLUX from DEV_yq_use_detail where 1=1 ";
  604. string sqlWhere = "";
  605. //string err = "";
  606. string YQbianhao = ucmeOxygenLanceID.Text;
  607. string startTime = udteStartTime.Value.ToString();
  608. string endTime = udteEndTime.Value.ToString();
  609. if (chkQStartTime.Checked && chkQEndTime.Checked)
  610. {
  611. if (Convert.ToDateTime(startTime) > Convert.ToDateTime(endTime))
  612. {
  613. MessageBox.Show("上线时间不能大于下线时间!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  614. return;
  615. }
  616. }
  617. bool bDone = false;
  618. if (chkQOxygenLanceID.Checked)
  619. {
  620. sqlWhere += " and OxygenLanceID= '" + YQbianhao + "'";
  621. }
  622. if (chkPos.Checked && ucmePos.Text.Trim().Length > 0)
  623. {
  624. sqlWhere += " and OVENID= '" + ucmePos.Text.Trim() + "'";
  625. }
  626. if (chkQStartTime.Checked)
  627. {
  628. sqlWhere += " and BeginTime >= to_date('" + startTime + "','yyyy-mm-dd hh24:mi:ss')";
  629. bDone = true;
  630. }
  631. if (chkQEndTime.Checked)
  632. {
  633. sqlWhere += " and EndTime <= to_date( '" + endTime + "','yyyy-mm-dd hh24:mi:ss')";
  634. bDone = true;
  635. }
  636. if (!bDone)
  637. sqlWhere += " and (RECRODID,OXYGENLANCEID) in (select recrodid, OXYGENLANCEID from (select t.*,row_number() over(partition by t.OXYGENLANCEID order by to_number(t.recrodid) desc) xh from DEV_yq_use_detail t) where xh <= 1)";
  638. string strsql = sqlSelect + sqlWhere + " order by BEGINTIME desc";//case when endtime is null then '0' else '1' end,oxygenlanceid,to_char(endtime,'yyyy-MM-dd') desc,ovenid,nowposition
  639. CoreClientParam ccp = new CoreClientParam();
  640. ccp.ServerName = "Core.LgMes.Server.DEV.Methods.DEVPublicMethods";
  641. ccp.MethodName = "QueryMethods";
  642. ccp.ServerParams = new Object[] {strsql};//查询条件
  643. DataTable dt = new DataTable();
  644. ccp.SourceDataTable = dt;
  645. try
  646. {
  647. ob.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);//
  648. }
  649. catch (Exception ad)
  650. {
  651. string dd = ad.Message.ToString().Trim();
  652. }
  653. DataSet ds = new DataSet();
  654. ds.Tables.Add(dt);
  655. try
  656. {
  657. ((DataSet)ulgridBaseInfo.DataSource).Tables[0].Rows.Clear();
  658. }
  659. catch (Exception)
  660. {
  661. }
  662. if (ds.Tables[0].Rows.Count > 0)
  663. {
  664. ulgridBaseInfo.DataSource = ds;
  665. }
  666. if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
  667. {
  668. ultdsUseDetail.Rows.Clear();//清空原有行
  669. for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
  670. {
  671. object[] RowValue = new object[ds.Tables[0].Columns.Count];
  672. for (int j = 0; j < ds.Tables[0].Columns.Count; j++)
  673. {
  674. RowValue[j] = ds.Tables[0].Rows[i][j];
  675. }
  676. //RowValue[2] = ClassTransChar(RowValue[2].ToString().Substring(1));
  677. ultdsUseDetail.Rows.Add(RowValue);
  678. }
  679. Hashtable htOperate = new Hashtable();
  680. htOperate.Add("", Color.LightGreen);
  681. //Core.LgMes.Client.LgDeviceManager.LadleCommonClass.SetGridBackColor(ulgridBaseInfo, htOperate, "ENDTIME", true);
  682. }
  683. else
  684. {
  685. ultdsUseDetail.Rows.Clear();
  686. cmbLanceID.SelectedIndex = -1;
  687. dtpQStartTime.Text = System.DateTime.Now.ToString();
  688. dtpQEndTime.Text = null;
  689. comboBox4.SelectedIndex = 1;
  690. ucmeClass.SelectedIndex = 1;
  691. cmbType.SelectedIndex = 1;
  692. ucmePtcj.SelectedIndex = 1;
  693. txtQL.Clear();
  694. txtSLL.Clear();
  695. comboBox6.SelectedIndex = 1;
  696. txtReason.Clear();
  697. txtmemo.Clear();
  698. txtJLBH.Clear();
  699. }
  700. }
  701. /// <氧枪下线>
  702. /// 氧枪下线
  703. /// </summary>
  704. private void proc_OffLine()
  705. {
  706. try
  707. {
  708. if (ulgridBaseInfo.ActiveRow == null) return;
  709. //if (this.comboBox1.SelectedIndex == 0 || this.comboBox1.SelectedItem.SelectedItem.ToString().Trim().Length == 0||this.textBox1.Text.Trim().Length == 0)
  710. //{
  711. // MessageBox.Show("请选择需要下线的枪号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  712. // comboBox1.Focus();
  713. // return;
  714. //}
  715. string strOLID = cmbLanceID.Text.Trim();
  716. string strRDID = txtJLBH.Text.Trim();
  717. string strErr = "";
  718. string strSql = "select case when ENDTIME is null then '0' else '1' end Finished from DEV_yq_use_detail where RECRODID='" + strRDID + "'";
  719. DataSet ds = QueryFixedFunions(strSql,ob);
  720. #region
  721. //CallingMessage par = new CallingMessage();
  722. //par.ServerName = "LgDeviceManager";
  723. //par.AssemblyName = "Core.LgMes.Server.LgDeviceManager";
  724. //par.ClassName = "Core.LgMes.Server.LgDeviceManager.OxygenLanceManager";
  725. //par.MethodName = "OxygenLance_Return";
  726. //par.args = new object[] { strSql };
  727. //DataSet ds = null;// (DataSet)ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr);
  728. #endregion
  729. if (!((strErr == null || strErr == "") && ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
  730. {
  731. MessageBox.Show("[" + strOLID + "]号氧枪下线失败!\r\n" + strErr, "错误", MessageBoxButtons.OK, MessageBoxIcon.Information);
  732. return;
  733. }
  734. string strFinished = Convert.ToString(ds.Tables[0].Rows[0]["Finished"]);
  735. //if (strFinished == "1")
  736. // return;
  737. if (MessageBox.Show("确定[" + strOLID + "]号氧枪下线吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  738. return;
  739. strErr = "";
  740. string Sqlstr = "update DEV_YQ_USE_DETAIL set ENDTIME = sysdate where OXYGENLANCEID = '" + strOLID + "' and ENDTIME is null";
  741. strErr = NoQueryExecutive(Sqlstr,ob);
  742. //par.MethodName = "OxygenLance_NonReturn";
  743. //par.args = new object[] { strSql };
  744. //ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr);
  745. if (strErr != "")
  746. {
  747. MessageBox.Show("[" + strOLID + "]号氧枪下线失败!\r\n" + strErr, "错误", MessageBoxButtons.OK, MessageBoxIcon.Information);
  748. return;
  749. }
  750. strErr = "";
  751. string strSql1 = "update DEV_YQ_BASE_INFO set STATUS = '下线' where OXYGENLANCEID = '" + strOLID + "'";
  752. //par.args = new object[] { strSql };
  753. //ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr);
  754. strErr = NoQueryExecutive(strSql1, ob);
  755. if (strErr != "")
  756. {
  757. MessageBox.Show("[" + strOLID + "]号氧枪下线失败!\r\n" + strErr, "错误", MessageBoxButtons.OK, MessageBoxIcon.Information);
  758. return;
  759. }
  760. refreshgrid("");
  761. FrmOxygenLanceManage FrmOLM = (FrmOxygenLanceManage)this.Tag;
  762. FrmOLM.OLInfoToShow();
  763. MessageBox.Show("[" + strOLID + "]号氧枪下线成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  764. QueryDataselect();
  765. }
  766. catch (Exception ex)
  767. {
  768. MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
  769. }
  770. }
  771. /// <导出>
  772. /// 导出
  773. /// </summary>
  774. private void proc_Export()
  775. {
  776. try
  777. {
  778. if (ulgridBaseInfo.Rows.Count == 0) return;
  779. Core.Mes.Client.Common.Globals.ulGridToExcel(ulgridBaseInfo, Text);
  780. //string strFileName = string.Format(Application.StartupPath + "\\Report\\氧枪使用记录.xls");
  781. //ultraGridExcelExporter1.Export(ulgridBaseInfo, strFileName);
  782. //ProcessStartInfo p = new ProcessStartInfo(strFileName);
  783. //p.WorkingDirectory = System.IO.Path.GetDirectoryName(strFileName);
  784. //Process.Start(p);
  785. }
  786. catch (Exception ex)
  787. {
  788. MessageBox.Show(ex.Message);
  789. }
  790. }
  791. private void chkQOxygenLanceID_CheckedChanged(object sender, EventArgs e)
  792. {
  793. ucmeOxygenLanceID.Enabled = chkQOxygenLanceID.Checked;
  794. }
  795. private void cbPos_CheckedChanged(object sender, EventArgs e)
  796. {
  797. ucmePos.Enabled = chkPos.Checked;
  798. }
  799. private void chkQStartTime_CheckedChanged(object sender, EventArgs e)
  800. {
  801. udteStartTime.Enabled = chkQStartTime.Checked;
  802. }
  803. private void chkQEndTime_CheckedChanged(object sender, EventArgs e)
  804. {
  805. udteEndTime.Enabled = chkQEndTime.Checked;
  806. }
  807. //public override void ToolBar_Click(object sender, string ToolbarKey)
  808. //{
  809. // switch (ToolbarKey)
  810. // {
  811. // case "query":
  812. // this.QueryDataselect();
  813. // break;
  814. // //<Button Key="Basicinfo" Caption="基本信息" Image="044" />
  815. // //<Button Key="Recordinfo" Caption="使用记录信息" Image="023" />
  816. // //<Button Key="query" Caption="查询" Image="Query" />
  817. // //<Button Key="exit" Caption="退出" Image="Exit" />
  818. // }
  819. //}
  820. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  821. {
  822. switch (e.Tool.Key)
  823. {
  824. case "Add":
  825. AddUseDetail();
  826. break;
  827. case "Modify":
  828. ModifyUseDetail();
  829. break;
  830. DelUseDetail();
  831. break;
  832. case "Select":
  833. this.QueryDataselect();
  834. break;
  835. case "OffLine":
  836. this.proc_OffLine();
  837. break;
  838. case "Export":
  839. this.proc_Export();
  840. break;
  841. case "Delete":
  842. this.proc_Delete();
  843. break;
  844. case "Close":
  845. this.Close();
  846. break;
  847. default:
  848. break;
  849. }
  850. }
  851. private void proc_Delete()
  852. {
  853. try
  854. {
  855. if (MessageBox.Show("确定要删除当前记录吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  856. return;
  857. // string classstr = ClassTransCode();
  858. string strSql = "delete from DEV_yq_use_detail where RECRODID='" + txtJLBH.Text.Trim() + "'";
  859. //string strErr = "";
  860. //CoreClientParam ccp = new CoreClientParam();
  861. //ccp.ServerParams = new Object[] { strSql };
  862. //ccp.ServerName = "Core.LgMes.Server.DEV.Methods.DEVPublicMethods";
  863. //ccp.MethodName = "UpdateMethods";
  864. //ob.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  865. //string Sqlstr = "delete from DEV_YQ_USE_DETAIL where RECRODID='" + txtJLBH.Text.Trim() + "'";
  866. CoreClientParam ccpdel = new CoreClientParam();
  867. ccpdel.ServerName = "Core.LgMes.Server.DEV.Methods.DEVPublicMethods";
  868. ccpdel.MethodName = "UpdateMethods";
  869. ccpdel.ServerParams = new Object[] { strSql };
  870. ob.ExecuteQueryToDataTable(ccpdel, CoreInvokeType.Internal);
  871. }
  872. catch { }
  873. this.QueryDataselect();
  874. }
  875. /// <summary>
  876. /// 判断当前炉座号是否有氧枪使用信息
  877. /// </summary>
  878. /// <param name="strOvenID">炉座号</param>
  879. /// <returns></returns>
  880. private bool GetYQUserInfo(string strOvenID, string strA_B)
  881. {
  882. bool blYQ = false; //false 是不存在,true 存在
  883. string err = "";
  884. //DataSet dsYQBaseInfo = null;// (DataSet)ClientCommon._RemotingHelp.ExecuteMethod("LgDeviceManager",
  885. //"Core.LgMes.Server.LgDeviceManager.OxygenLanceManager",
  886. //"GetOxygenLanceUserInfo", new object[] { strOvenID, strA_B }, out err);
  887. string strsql = "select RECRODID,oxygenlanceid,usetimes from DEV_yq_use_detail where ovenid='" + strOvenID + "' and nowposition='" + strA_B + "' and endtime is null";
  888. DataSet dsYQBaseInfo = QueryFixedFunions(strsql, ob);
  889. if (err == "" && dsYQBaseInfo != null)
  890. {
  891. if (dsYQBaseInfo.Tables[0].Rows.Count > 0)
  892. {
  893. strRecrodid = dsYQBaseInfo.Tables[0].Rows[0]["RECRODID"].ToString();
  894. strOxygenlanceID = dsYQBaseInfo.Tables[0].Rows[0]["oxygenlanceid"].ToString();
  895. strOAge = dsYQBaseInfo.Tables[0].Rows[0]["usetimes"].ToString();
  896. blYQ = true;
  897. }
  898. else
  899. blYQ = false;
  900. }
  901. else
  902. blYQ = true;
  903. return blYQ;
  904. }
  905. /// <summary>
  906. /// 判断当前氧枪是否正在使用或者下线
  907. /// </summary>
  908. /// <param name="strOLID">氧枪编号</param>
  909. /// <param name="strCurrStatus">当前状态</param>
  910. /// <returns>strCurrStatus为"使用"、"下线"或查询出错则返回true,否则返回false</returns>
  911. private bool GetYQCurrStatus(string strOLID, out string strCurrStatus)
  912. {
  913. try
  914. {
  915. string strErr = "";
  916. //DataSet ds = null;// (DataSet)ClientCommon._RemotingHelp.ExecuteMethod("LgDeviceManager",
  917. //"Core.LgMes.Server.LgDeviceManager.OxygenLanceManager",
  918. //"GetOxygenLanceBaseInfo", new object[] { strOLID }, out strErr);
  919. string strSQL = "select a.oxygenlanceid,a.usetype,a.status,a.yqtype,a.usemaxtime from DEV_yq_base_info a where a.oxygenlanceid='" + strOLID + "'";
  920. DataSet ds = QueryFixedFunions(strSQL, ob);
  921. if (strErr == "" && ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
  922. {
  923. strCurrStatus = Convert.ToString(ds.Tables[0].Rows[0]["status"]);
  924. if (strCurrStatus == "使用" || strCurrStatus == "下线")
  925. return true;
  926. else
  927. return false;
  928. }
  929. else
  930. {
  931. strCurrStatus = "未知";
  932. return true;
  933. }
  934. }
  935. catch
  936. {
  937. strCurrStatus = "未知";
  938. return true;
  939. }
  940. }
  941. /// <summary>
  942. /// 使用信息赋值
  943. /// </summary>
  944. private void proc_ulgridBaseInfoRowActived()
  945. {
  946. try
  947. {
  948. if (ulgridBaseInfo.ActiveRow == null)
  949. {
  950. dtpQStartTime.Text = System.DateTime.Now.ToString();
  951. dtpQEndTime.Text = null;
  952. comboBox4.SelectedIndex = -1;
  953. ucmeClass.SelectedIndex = -1;
  954. cmbType.SelectedIndex = -1;
  955. ucmePtcj.SelectedIndex = -1;
  956. txtQL.Clear();
  957. txtSLL.Clear();
  958. comboBox6.SelectedIndex = -1;
  959. txtReason.Clear();
  960. txtmemo.Clear();
  961. txtJLBH.Clear();
  962. }
  963. else
  964. {
  965. cmbLanceID.Text = ulgridBaseInfo.ActiveRow.Cells["OXYGENLANCEID"].Value.ToString();
  966. dtpQStartTime.Value = Convert.ToDateTime(ulgridBaseInfo.ActiveRow.Cells["BEGINTIME"].Value);
  967. dtpQEndTime.Text = ulgridBaseInfo.ActiveRow.Cells["ENDTIME"].Value.ToString();
  968. comboBox4.Text = ulgridBaseInfo.ActiveRow.Cells["NOWSTATUS"].Value.ToString();
  969. ucmeClass.Text = ulgridBaseInfo.ActiveRow.Cells["CLASS"].Value.ToString().Substring(1).Trim();
  970. cmbType.Text = ulgridBaseInfo.ActiveRow.Cells["NOWPOSITION"].Value.ToString();
  971. txtQL.Text = ulgridBaseInfo.ActiveRow.Cells["USETIMES"].Value.ToString();
  972. comboBox6.Text = ulgridBaseInfo.ActiveRow.Cells["OVENID"].Value.ToString();
  973. txtReason.Text = ulgridBaseInfo.ActiveRow.Cells["REASON"].Value.ToString(); ;
  974. txtmemo.Text = ulgridBaseInfo.ActiveRow.Cells["MEMO"].Value.ToString();
  975. txtJLBH.Text = ulgridBaseInfo.ActiveRow.Cells["RECRODID"].Value.ToString();
  976. txtSLL.Text = ulgridBaseInfo.ActiveRow.Cells["FLUX"].Value.ToString();
  977. ucmePtcj.SelectedIndex = 1;
  978. //comboBox7.Text = ulgridBaseInfo.ActiveRow.Cells["SPOUTFACTORY"].Value.ToString();
  979. ucmePtcj.Items.Add(ulgridBaseInfo.ActiveRow.Cells["SPOUTFACTORY"].Value.ToString());
  980. }
  981. }
  982. catch { }
  983. }
  984. private void ulgridBaseInfo_Click(object sender, EventArgs e)
  985. {
  986. this.proc_ulgridBaseInfoRowActived();
  987. }
  988. private void ulgridBaseInfo_AfterRowActivate(object sender, EventArgs e)
  989. {
  990. this.proc_ulgridBaseInfoRowActived();
  991. }
  992. private void textBox4_TextChanged(object sender, EventArgs e)
  993. {
  994. if (!CheckIsNumberByASCII(txtQL.Text))
  995. {
  996. MessageBox.Show("错误的数据输入!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
  997. txtQL.Clear();
  998. }
  999. }
  1000. private void textBox5_TextChanged(object sender, EventArgs e)
  1001. {
  1002. if (!CheckIsNumberByASCII(txtSLL.Text))
  1003. {
  1004. MessageBox.Show("错误的数据输入!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1005. txtSLL.Clear();
  1006. }
  1007. }
  1008. private void proc_NotifyComboBox1()
  1009. {
  1010. try
  1011. {
  1012. dtpQStartTime.Text = System.DateTime.Now.ToString();
  1013. dtpQEndTime.Text = null;
  1014. comboBox4.SelectedIndex = -1;
  1015. ucmeClass.SelectedIndex = -1;
  1016. cmbType.SelectedIndex = -1;
  1017. ucmePtcj.SelectedIndex = -1;
  1018. txtQL.Clear();
  1019. txtSLL.Clear();
  1020. comboBox6.SelectedIndex = -1;
  1021. txtReason.Clear();
  1022. txtmemo.Clear();
  1023. txtJLBH.Clear();
  1024. if (cmbLanceID.SelectedIndex == -1) return;
  1025. string sqlwhere = "";
  1026. if (cmbLanceID.SelectedIndex > 0)
  1027. sqlwhere = " and OXYGENLANCEID = '" + cmbLanceID.SelectedItem.ToString() + "'";
  1028. refreshgrid(sqlwhere);
  1029. string err = "";
  1030. //DataSet dsYQBaseInfo = null;// (DataSet)ClientCommon._RemotingHelp.ExecuteMethod("LgDeviceManager",
  1031. //"Core.LgMes.Server.LgDeviceManager.OxygenLanceManager",
  1032. //"GetOxygenLanceBaseInfo", new object[] { comboBox1.SelectedItem.ToString().Trim() }, out err);
  1033. string strSQL = "select a.oxygenlanceid,a.usetype,a.status,a.yqtype,a.usemaxtime from DEV_yq_base_info a where a.oxygenlanceid='" + cmbLanceID.SelectedItem.ToString().Trim() + "'";
  1034. DataSet dsYQBaseInfo = QueryFixedFunions(strSQL, ob);
  1035. if (err == "" && dsYQBaseInfo != null && dsYQBaseInfo.Tables.Count > 0 && dsYQBaseInfo.Tables[0].Rows.Count > 0)
  1036. {
  1037. strStatus = dsYQBaseInfo.Tables[0].Rows[0]["status"].ToString();
  1038. cmbType.Text = dsYQBaseInfo.Tables[0].Rows[0]["usetype"].ToString();
  1039. txtQL.Text = dsYQBaseInfo.Tables[0].Rows[0]["usemaxtime"].ToString();
  1040. }
  1041. }
  1042. catch { }
  1043. }
  1044. private void comboBox1_SelectionChangeCommitted(object sender, EventArgs e)
  1045. {
  1046. this.proc_NotifyComboBox1();
  1047. }
  1048. }
  1049. }