FrmQueryProcess.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Format;
  3. using Core.Mes.Client.Comm.Server;
  4. using Core.Mes.Client.Comm.Tool;
  5. using Core.StlMes.Client.ZGMil.Entity;
  6. using CoreFS.CA06;
  7. using Infragistics.Win.UltraWinGrid;
  8. using System;
  9. using System.Collections;
  10. using System.Collections.Generic;
  11. using System.ComponentModel;
  12. using System.Data;
  13. using System.Drawing;
  14. using System.Linq;
  15. using System.Text;
  16. using System.Windows.Forms;
  17. namespace Core.StlMes.Client.ZGMil.Signature
  18. {
  19. public partial class FrmQueryProcess : FrmBase
  20. {
  21. public FrmQueryProcess()
  22. {
  23. InitializeComponent();
  24. }
  25. private void FrmQueryProcess_Load(object sender, EventArgs e)
  26. {
  27. EntityHelper.ShowGridCaption<PortMilBatchSampleResultEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  28. EntityHelper.ShowGridCaption<PortMilBatchSampleResultEntity>(ultraGrid2.DisplayLayout.Bands[0]);
  29. InitCloum();
  30. }
  31. private void InitCloum()
  32. {
  33. this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("0", "合格");
  34. this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("1", "热区剔除");
  35. this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("2", "冷区剔除");
  36. this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("3", "下线");
  37. this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("4", "返线");
  38. this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("5", "留样");
  39. this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("6", "委外废");
  40. this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("0", "合格");
  41. this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("1", "热区剔除");
  42. this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("2", "冷区剔除");
  43. this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("3", "下线");
  44. this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("4", "返线");
  45. this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("5", "留样");
  46. this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("6", "委外废");
  47. }
  48. /// <summary>
  49. /// 重写基类方法
  50. /// </summary>
  51. /// <param name="sender"></param>
  52. /// <param name="ToolbarKey"></param>
  53. public override void ToolBar_Click(object sender, string ToolbarKey)
  54. {
  55. switch (ToolbarKey)
  56. {
  57. case "Query":
  58. QueryJugeNoProcess();
  59. break;
  60. case"updateStatus":
  61. updateStatus();
  62. break;
  63. case"updateStatusBack":
  64. updateStatusBack();
  65. break;
  66. case "updateLen":
  67. updateLen();
  68. break;
  69. case "Close":
  70. this.Close();
  71. break;
  72. }
  73. }
  74. /// <summary>
  75. /// 剔除回退
  76. /// </summary>
  77. private void updateStatusBack()
  78. {
  79. this.ultraGrid1.UpdateData();
  80. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  81. if (uRow == null)
  82. {
  83. MessageUtil.ShowTips("请选择需要剔除回退的信息!");
  84. return;
  85. }
  86. if (uRow.Cells["Status"].Value.ToString() != "2" && uRow.Cells["OpProcess"].Value.ToString() != "交库")
  87. {
  88. MessageUtil.ShowTips("请选择剔除管并且是在交库点剔除的管进行剔除回退!");
  89. return;
  90. }
  91. PortMilBatchSampleResultEntity portMilBatchSlample = (PortMilBatchSampleResultEntity)uRow.ListObject;
  92. string portSlampleEntity = JSONFormat.Format(portMilBatchSlample);
  93. CoreClientParam ccp = new CoreClientParam();
  94. ccp.ServerName = "com.steering.mes.signature.FrmInOnlineStore";
  95. ccp.MethodName = "updateStatusBack";
  96. ccp.ServerParams = new object[] { portSlampleEntity};
  97. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  98. if (ccp.ReturnCode != -1)
  99. {
  100. if (ccp.ReturnInfo.Equals("回退成功!"))
  101. {
  102. QueryJugeNoProcess();
  103. MessageUtil.ShowTips(ccp.ReturnInfo);
  104. }
  105. else
  106. {
  107. MessageUtil.ShowTips(ccp.ReturnInfo);
  108. }
  109. }
  110. }
  111. /// <summary>
  112. /// 剔除
  113. /// </summary>
  114. private void updateStatus()
  115. {
  116. this.ultraGrid1.UpdateData();
  117. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  118. if(uRow == null)
  119. {
  120. MessageUtil.ShowTips("请选择需要剔除的信息!");
  121. return;
  122. }
  123. if (uRow.Cells["Status"].Value.ToString() != "0")
  124. {
  125. MessageUtil.ShowTips("请选择合格管进行剔除!");
  126. return;
  127. }
  128. PortMilBatchSampleResultEntity portMilBatchSlample = (PortMilBatchSampleResultEntity)uRow.ListObject;
  129. string portSlampleEntity = JSONFormat.Format(portMilBatchSlample);
  130. string plnId = this.ultraGrid2.ActiveRow.Cells["PlanId"].Value.ToString();
  131. string jugeNo = this.ultraGrid2.ActiveRow.Cells["JudgeStoveNo"].Value.ToString();
  132. string staus = this.ultraGrid2.ActiveRow.Cells["Status"].Value.ToString();
  133. string colUser = this.UserInfo.GetUserName();
  134. string colGrop = this.UserInfo.GetUserGroup();
  135. string colOrder = this.UserInfo.GetUserOrder();
  136. CoreClientParam ccp = new CoreClientParam();
  137. ccp.ServerName = "com.steering.mes.signature.FrmInOnlineStore";
  138. ccp.MethodName = "updateStatus";
  139. ccp.ServerParams = new object[] { portSlampleEntity, colUser, colGrop, colOrder };
  140. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  141. if (ccp.ReturnCode != -1)
  142. {
  143. if (ccp.ReturnInfo.Equals("剔除成功!"))
  144. {
  145. QueryJugeNoProcess();
  146. MessageUtil.ShowTips(ccp.ReturnInfo);
  147. }
  148. else
  149. {
  150. MessageUtil.ShowTips(ccp.ReturnInfo);
  151. }
  152. }
  153. }
  154. /// <summary>
  155. /// 修改长度
  156. /// </summary>
  157. private void updateLen()
  158. {
  159. this.ultraGrid1.UpdateData();
  160. int m = 0;
  161. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  162. if (checkMagRows.Count() == 0)
  163. {
  164. MessageUtil.ShowTips("请勾选需要修改长度的信息!");
  165. return;
  166. }
  167. ArrayList parm = new ArrayList();
  168. foreach (UltraGridRow uRow in checkMagRows)
  169. {
  170. if (uRow.Cells["InstoreFlag"].Text == "已入库")
  171. {
  172. m = m + 1;
  173. }
  174. PortMilBatchSampleResultEntity portMilBatchSlample = (PortMilBatchSampleResultEntity)uRow.ListObject;
  175. string portSlampleEntity = JSONFormat.Format(portMilBatchSlample);
  176. parm.Add(portSlampleEntity);
  177. }
  178. //if (m > 0)
  179. //{
  180. // MessageUtil.ShowTips("已入库的钢管不允许进行长度修改!");
  181. // return;
  182. //}
  183. //portMilBatchSlample.ActCount = decimal.Parse(this.TxtActCount.Text.Trim());
  184. //portMilBatchSlample.OrderLength = decimal.Parse(this.TxtActLen.Text.Trim());
  185. string plnId = this.ultraGrid2.ActiveRow.Cells["PlanId"].Value.ToString();
  186. string jugeNo = this.ultraGrid2.ActiveRow.Cells["JudgeStoveNo"].Value.ToString();
  187. string staus = this.ultraGrid2.ActiveRow.Cells["Status"].Value.ToString();
  188. string colUser = this.UserInfo.GetUserName();
  189. string colGrop = this.UserInfo.GetUserGroup();
  190. string colOrder = this.UserInfo.GetUserOrder();
  191. CoreClientParam ccp = new CoreClientParam();
  192. ccp.ServerName = "com.steering.mes.signature.FrmInOnlineStore";
  193. ccp.MethodName = "updateLen";
  194. ccp.ServerParams = new object[] { parm, colUser, colGrop, colOrder };
  195. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  196. if (ccp.ReturnCode != -1)
  197. {
  198. if (ccp.ReturnInfo.Equals("修改成功!"))
  199. {
  200. QueryJugeNoProcess();
  201. MessageUtil.ShowTips(ccp.ReturnInfo);
  202. }
  203. else
  204. {
  205. MessageUtil.ShowTips(ccp.ReturnInfo);
  206. }
  207. }
  208. }
  209. /// <summary>
  210. /// 查询炉信息
  211. /// </summary>
  212. private void QueryJugeNoProcess()
  213. {
  214. string jugeNo = "";
  215. string lotNo = "";
  216. NativeMethodNew na = new NativeMethodNew(this.ob);
  217. string plinCode = na.GetPCode(this.UserInfo.GetDepartment());
  218. if (this.txtJugeNo.Text.Trim() == "")
  219. {
  220. MessageUtil.ShowTips("请输入炉号查询!");
  221. return;
  222. }
  223. else
  224. {
  225. jugeNo = this.txtJugeNo.Text.Trim();
  226. }
  227. if (this.chkLotNo.Checked && this.txtLotNo.Text.Trim() != "")
  228. {
  229. lotNo = this.txtLotNo.Text.Trim();
  230. }
  231. ArrayList list = new ArrayList();
  232. list.Add(jugeNo);
  233. list.Add(lotNo);
  234. list.Add(plinCode);
  235. this.PortMilBatchSampleResultEntitybindingSource.Clear();
  236. List<PortMilBatchSampleResultEntity> listSource = EntityHelper.GetData<PortMilBatchSampleResultEntity>(
  237. "com.steering.mes.signature.FrmInOnlineStore.doQueryJugeNoProcess", new object[] { list }, this.ob);
  238. PortMilBatchSampleResultEntity1bindingSource.DataSource = listSource;
  239. }
  240. /// <summary>
  241. /// 查询
  242. /// </summary>
  243. private void QueryProcess(string planId,string jugeNo,string staus)
  244. {
  245. //NativeMethodNew na = new NativeMethodNew(this.ob);
  246. //string plinCode = na.GetPCode(this.UserInfo.GetDepartment());
  247. //if (this.chkJugeHeatNo.Checked && this.txtJugeNo.Text.Trim() != "")
  248. //{
  249. // jugeNo = this.txtJugeNo.Text.Trim();
  250. //}
  251. //else
  252. //{
  253. // MessageUtil.ShowTips("请输入炉号查询!");
  254. // return;
  255. //}
  256. //if (this.chkLotNo.Checked && this.txtLotNo.Text.Trim() != "")
  257. //{
  258. // lotNo = this.txtLotNo.Text.Trim();
  259. //}
  260. ArrayList list = new ArrayList();
  261. list.Add(planId);
  262. list.Add(jugeNo);
  263. list.Add(staus);
  264. this.PortMilBatchSampleResultEntitybindingSource.Clear();
  265. List<PortMilBatchSampleResultEntity> listSource = EntityHelper.GetData<PortMilBatchSampleResultEntity>(
  266. "com.steering.mes.signature.FrmInOnlineStore.doQueryProcess", new object[] { list }, this.ob);
  267. PortMilBatchSampleResultEntitybindingSource.DataSource = listSource;
  268. }
  269. private void chkJugeHeatNo_CheckedChanged(object sender, EventArgs e)
  270. {
  271. this.txtJugeNo.Enabled = this.chkJugeHeatNo.Checked;
  272. }
  273. private void chkLotNo_CheckedChanged(object sender, EventArgs e)
  274. {
  275. this.txtLotNo.Enabled = this.chkLotNo.Checked;
  276. }
  277. private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
  278. {
  279. QueryProcess(this.ultraGrid2.ActiveRow.Cells["PlanId"].Value.ToString(), this.ultraGrid2.ActiveRow.Cells["JudgeStoveNo"].Value.ToString(), this.ultraGrid2.ActiveRow.Cells["Status"].Value.ToString());
  280. }
  281. private void ultraGrid1_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  282. {
  283. foreach (UltraGridRow uRow in ultraGrid1.Selected.Rows)
  284. {
  285. if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
  286. {
  287. uRow.Cells["CHK"].Value = true;
  288. }
  289. }
  290. }
  291. public static void setGridCopyActColumn(UltraGrid ugrid, KeyEventArgs e, params string[] strs)
  292. {
  293. if (e.Control && e.KeyCode == Keys.A)
  294. {
  295. if (ugrid != null && ugrid.ActiveRow != null)
  296. {
  297. UltraGridRow ugr = ugrid.ActiveRow;
  298. foreach (string colName in strs)
  299. {
  300. if (ugrid.ActiveCell.Column.Key == null)
  301. {
  302. return;
  303. }
  304. if (ugrid.ActiveCell.Column.Key.Equals(colName))
  305. {
  306. if (ugr.Cells[colName].Activation != Activation.AllowEdit)
  307. {
  308. return;
  309. }
  310. ugrid.UpdateData();
  311. ArrayList list = new ArrayList();
  312. IQueryable<UltraGridRow> checkRows = ugrid.Rows.AsQueryable().Where("CHK = 'True' ");
  313. if (checkRows.Count() == 0)
  314. {
  315. return;
  316. }
  317. foreach (UltraGridRow uRow in checkRows)
  318. {
  319. if (uRow != ugr && uRow.Cells[colName].Activation == Activation.AllowEdit)
  320. {
  321. uRow.Cells[colName].Value = ugr.Cells[colName].Value;
  322. }
  323. }
  324. }
  325. }
  326. }
  327. }
  328. }
  329. private void ultraGrid1_KeyUp(object sender, KeyEventArgs e)
  330. {
  331. setGridCopyActColumn(ultraGrid1, e, "OrderLength");
  332. }
  333. }
  334. }