FrmCL.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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 FrmCL : FrmBase
  16. {
  17. /// <summary>
  18. /// 产线
  19. /// </summary>
  20. private string _plineCode;
  21. /// <summary>
  22. /// 工序
  23. /// </summary>
  24. private string _processCode;
  25. private string _jsonStr;
  26. private string _username;
  27. public FrmCL(string plineCode, string processCode, String jsonStr,string username,OpeBase ob)
  28. {
  29. //窗体居中
  30. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
  31. //取消窗体默认关闭按钮
  32. this.ControlBox = false;
  33. this.ob = ob;
  34. _plineCode = plineCode;
  35. _processCode = processCode;
  36. _jsonStr = jsonStr;
  37. _username = username;
  38. InitializeComponent();
  39. }
  40. private void FrmCL_Load(object sender, EventArgs e)
  41. {
  42. InitRepairType();
  43. InitPline();
  44. GetMaxTimeByPlineCode();
  45. comStyle.ValueMember = "承揽";
  46. }
  47. private void InitPline()
  48. {
  49. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.processOrder.base.BaseHelper.initPline", new object[] { _processCode, "", "" }, this.ob);
  50. if (dt != null && dt.Rows.Count > 0)
  51. {
  52. comPline.DataSource = dt;
  53. comPline.ValueMember = "PLINE_CODE";
  54. comPline.DisplayMember = "PLINE_NAME";
  55. comPline.Value = _plineCode;
  56. }
  57. }
  58. private void InitRepairType()
  59. {
  60. DataTable dt = new DataTable();
  61. dt.Columns.Add("RepairType");
  62. DataRow dr1 = dt.NewRow();
  63. dr1["RepairType"] = "承揽";
  64. dt.Rows.Add(dr1);
  65. comStyle.DataSource = dt;
  66. comStyle.DisplayMember = "RepairType";
  67. comStyle.ValueMember = "RepairType";
  68. }
  69. private void GetMaxTimeByPlineCode()
  70. {
  71. DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.getMaxTime", new object[] { _plineCode, _processCode }, this.ob);
  72. if (dt != null && dt.Rows.Count > 0)
  73. {
  74. timeBeign.Value = dt.Rows[0]["PLAN_TIME_E"].ToString();
  75. timeEnd.Value = dt.Rows[0]["PLAN_TIME_E"].ToString();
  76. }
  77. }
  78. private void buttonAdd_Click(object sender, EventArgs e)
  79. {
  80. string plineCode = comPline.Value == null ? "" : comPline.Value.ToString();
  81. string plineName = comPline.Text;
  82. if (plineCode.Equals(""))
  83. {
  84. MessageUtil.ShowWarning("请选择承揽产线!");
  85. return;
  86. }
  87. if (plineCode.Equals(_plineCode))
  88. {
  89. MessageUtil.ShowWarning("不能承揽给本产线!");
  90. return;
  91. }
  92. if (comStyle.Value == null)
  93. {
  94. MessageUtil.ShowTips("请选择检修类型!");
  95. return;
  96. }
  97. string repairType = comStyle.Value.ToString();
  98. if (txtTime.Value == null)
  99. {
  100. MessageUtil.ShowTips("请输入承揽耗时!");
  101. return;
  102. }
  103. string useHour = txtTime.Value.ToString().Trim();
  104. string memo = txtMemo.Text.Trim();
  105. if (memo.Equals(""))
  106. {
  107. MessageUtil.ShowTips("请输入备注!");
  108. return;
  109. }
  110. if (MessageUtil.ShowYesNoAndQuestion("是否新增承揽?") == DialogResult.No)
  111. {
  112. return;
  113. }
  114. string[] param = PlanHelper.SetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.addCL", new object[] { _jsonStr, plineCode,
  115. plineName, repairType, useHour,
  116. _username, memo, _processCode }, ob);
  117. if (param == null) { MessageUtil.ShowTips("服务端处理失败!"); return; }
  118. else
  119. {
  120. MessageUtil.ShowTips(param[1]);
  121. if ((bool.Parse(param[0])))
  122. {
  123. }
  124. }
  125. }
  126. private void buttonCancel_Click(object sender, EventArgs e)
  127. {
  128. this.Close();
  129. }
  130. }
  131. }