FrmMaterialDialog.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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.StlMes.Client.YdmPipeManage.Entity;
  10. using CoreFS.CA06;
  11. using Infragistics.Win.UltraWinGrid;
  12. using Core.Mes.Client.Comm.Tool;
  13. using Core.StlMes.Client.YdmPipeManage.Tool;
  14. namespace Core.StlMes.Client.YdmPipeManage.Dialog
  15. {
  16. public partial class FrmMaterialDialog : FrmBase
  17. {
  18. private string _materialNo;
  19. private OpeBase _ob;
  20. private SlmBaseMaterialEntity baseEntity = null;
  21. private ComPscEntity pscEntity = null;
  22. private string _productFlag;
  23. public ComPscEntity PscEntity
  24. {
  25. get { return pscEntity; }
  26. set { pscEntity = value; }
  27. }
  28. public SlmBaseMaterialEntity BaseEntity
  29. {
  30. get { return baseEntity; }
  31. set { baseEntity = value; }
  32. }
  33. public FrmMaterialDialog(string materialNo,string productFlag, OpeBase ob)
  34. {
  35. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
  36. InitializeComponent();
  37. _materialNo = materialNo;
  38. _ob = ob;
  39. _productFlag = productFlag;
  40. }
  41. private void FrmMaterialDialog_Load(object sender, EventArgs e)
  42. {
  43. EntityHelper.ShowGridCaption<SlmBaseMaterialEntity>(UltraGridMaterial.DisplayLayout.Bands[0]);
  44. EntityHelper.ShowGridCaption<ComPscEntity>(UltraGridPsc.DisplayLayout.Bands[0]);
  45. BaseMethod.setOtherColumnReadOnly(UltraGridMaterial, new string[] { "Chc" });
  46. BaseMethod.setOtherColumnReadOnly(UltraGridPsc, new string[] { "Chc" });
  47. DoQueryPsc();
  48. }
  49. public void DoQueryMaterial(string producCode, string steelCode, string stdstyle)
  50. {
  51. List<SlmBaseMaterialEntity> listSource = EntityHelper.GetData<SlmBaseMaterialEntity>(
  52. "com.steering.pss.ydm.pipemanage.FrmPipeInventoryIn.getMaterial", new object[] { producCode, steelCode, stdstyle }, _ob);
  53. slmBaseMaterialEntityBindingSource.DataSource = listSource;
  54. }
  55. public void DoQueryMaterial1()
  56. {
  57. List<SlmBaseMaterialEntity> listSource = EntityHelper.GetData<SlmBaseMaterialEntity>(
  58. "com.steering.pss.ydm.pipemanage.FrmPipeInventoryIn.getMaterial1", new object[] { }, _ob);
  59. slmBaseMaterialEntityBindingSource.DataSource = listSource;
  60. }
  61. private void DoQueryPsc()
  62. {
  63. //成品盘盈
  64. if (_productFlag == "0")
  65. {
  66. List<ComPscEntity> listSource = EntityHelper.GetData<ComPscEntity>(
  67. "com.steering.pss.ydm.pipemanage.FrmPipeInventoryIn.getPsc", new object[] { }, _ob);
  68. comPscEntityBindingSource.DataSource = listSource;
  69. }
  70. //半成品
  71. if (_productFlag == "1")
  72. {
  73. List<ComPscEntity> listSource = EntityHelper.GetData<ComPscEntity>(
  74. "com.steering.pss.ydm.pipemanage.FrmPipeInventoryIn.getPsc", new object[] { }, _ob);
  75. comPscEntityBindingSource.DataSource = listSource;
  76. }
  77. }
  78. private void ActiveRow()
  79. {
  80. if (_materialNo.Length == 0)
  81. {
  82. return;
  83. }
  84. foreach (UltraGridRow ugr in UltraGridMaterial.Rows)
  85. {
  86. if (ugr.Cells[""].Value.ToString().Equals(_materialNo))
  87. {
  88. ugr.Activate();
  89. ugr.Appearance.BackColor = Color.GreenYellow;
  90. }
  91. }
  92. }
  93. private void button1_Click(object sender, EventArgs e)
  94. {
  95. UltraGridRow ugrM = UltraGridMaterial.ActiveRow;
  96. if (ugrM == null)
  97. {
  98. MessageUtil.ShowWarning("请选择一组物料信息!");
  99. return;
  100. }
  101. UltraGridRow ugrP = UltraGridPsc.ActiveRow;
  102. if (ugrP == null)
  103. {
  104. return;
  105. }
  106. SlmBaseMaterialEntity slmBaseMaterialEntity = (SlmBaseMaterialEntity)ugrM.ListObject;
  107. baseEntity = slmBaseMaterialEntity;
  108. pscEntity = (ComPscEntity)ugrP.ListObject;
  109. this.Close();
  110. }
  111. private void button2_Click(object sender, EventArgs e)
  112. {
  113. baseEntity = null;
  114. pscEntity = null;
  115. this.Close();
  116. }
  117. private void UltraGridPsc_AfterRowActivate(object sender, EventArgs e)
  118. {
  119. UltraGridRow ugr = UltraGridPsc.ActiveRow;
  120. if (ugr == null)
  121. {
  122. DoQueryMaterial("", "", "");
  123. return;
  124. }
  125. string producCode = ugr.Cells["Produccode"].Text;
  126. string steelCode = ugr.Cells["Steelcode"].Text;
  127. string stdStyle = ugr.Cells["StdStyle"].Text;
  128. if (_productFlag == "0")
  129. {
  130. DoQueryMaterial(producCode, steelCode, stdStyle);
  131. }
  132. if (_productFlag == "1")
  133. {
  134. DoQueryMaterial1();
  135. }
  136. }
  137. }
  138. }