FrmJxjh.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using Core.Mes.Client.Comm.Server;
  10. using Core.Mes.Client.Comm.Tool;
  11. using CoreFS.CA06;
  12. using Core.StlMes.Client.PlnSaleOrd.工序排产;
  13. namespace Core.StlMes.Client.PlnSaleOrd
  14. {
  15. public partial class FrmJxjh : FrmBase
  16. {
  17. private string _plineCode = "";
  18. private string _processCode = "";
  19. public FrmJxjh(OpeBase ob,string plineCode,string processCode)
  20. {
  21. //窗体居中
  22. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
  23. //取消窗体默认关闭按钮
  24. this.ControlBox = false;
  25. this.ob = ob;
  26. _plineCode = plineCode;
  27. _processCode = processCode;
  28. InitializeComponent();
  29. }
  30. private void FrmJxjh_Load(object sender, EventArgs e)
  31. {
  32. InitRepairType();
  33. InitPline();
  34. GetMaxTimeByPlineCode();
  35. }
  36. private void InitPline()
  37. {
  38. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.processOrder.base.BaseHelper.initPline", new object[] { _processCode, "", "" }, this.ob);
  39. if (dt != null && dt.Rows.Count > 0)
  40. {
  41. comPline.DataSource = dt;
  42. comPline.ValueMember = "PLINE_CODE";
  43. comPline.DisplayMember = "PLINE_NAME";
  44. comPline.Value = _plineCode;
  45. }
  46. }
  47. private void InitRepairType()
  48. {
  49. DataTable dt = new DataTable();
  50. dt.Columns.Add("RepairType");
  51. DataRow dr1 = dt.NewRow();
  52. dr1["RepairType"] = "检修";
  53. dt.Rows.Add(dr1);
  54. DataRow dr2 = dt.NewRow();
  55. dr2["RepairType"] = "停机";
  56. dt.Rows.Add(dr2);
  57. comStyle.DataSource = dt;
  58. comStyle.DisplayMember = "RepairType";
  59. comStyle.ValueMember = "RepairType";
  60. }
  61. private void GetMaxTimeByPlineCode()
  62. {
  63. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.getMaxTime", new object[] { _plineCode,_processCode }, this.ob);
  64. if (dt != null && dt.Rows.Count > 0)
  65. {
  66. timeBeign.Value = dt.Rows[0]["PLAN_TIME_E"].ToString();
  67. timeEnd.Value = dt.Rows[0]["PLAN_TIME_E"].ToString();
  68. }
  69. }
  70. private void txtTime_ValueChanged(object sender, EventArgs e)
  71. {
  72. string planUseTime = txtTime.Value == null ? "0" : txtTime.Value.ToString().Trim();
  73. timeEnd.Value = DateTime.Parse(timeBeign.Value.ToString()).AddHours(Double.Parse(planUseTime)).ToString("yyyy-MM-dd HH:mm:ss");
  74. }
  75. private void buttonCancel_Click(object sender, EventArgs e)
  76. {
  77. this.Close();
  78. }
  79. private void buttonAdd_Click(object sender, EventArgs e)
  80. {
  81. if (_plineCode.Equals(""))
  82. {
  83. MessageUtil.ShowTips("数据异常,请重新打开界面!");
  84. return;
  85. }
  86. string plineCode = _plineCode;
  87. string plineName = comPline.Text;
  88. if (comStyle.Value == null)
  89. {
  90. MessageUtil.ShowTips("请选择检修类型!");
  91. return;
  92. }
  93. string repairPlan = comStyle.Value.ToString();
  94. if (txtTime.Value == null)
  95. {
  96. MessageUtil.ShowTips("请选择输入检修时间!");
  97. return;
  98. }
  99. string useTime = txtTime.Value.ToString().Trim();
  100. if (MessageUtil.ShowYesNoAndQuestion("是否新增检修计划?") == DialogResult.No)
  101. {
  102. return;
  103. }
  104. string[] param = PlanHelper.SetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.addRepairPlan", new object[] { plineCode, plineName,
  105. repairPlan, useTime, _processCode }, ob);
  106. if (param == null) { MessageUtil.ShowTips("服务端处理失败!"); return ; }
  107. else
  108. {
  109. MessageUtil.ShowTips(param[1]);
  110. if ((bool.Parse(param[0])))
  111. {
  112. }
  113. }
  114. }
  115. }
  116. }