d952b491d9c68c7101329ecdd7826c9650e0da3b.svn-base 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6. using Core.Mes.ClientFrameWork;
  7. using Core.Mes.IBaseInterface;
  8. using System.Data;
  9. namespace Core.XgMes.Client.JGKC.RollManager
  10. {
  11. public partial class FrmJBCB : Mes.ClientFrameWork.FrmBase
  12. {
  13. public FrmJBCB()
  14. {
  15. InitializeComponent();
  16. }
  17. private void gb_Plan_AfterRowActivate(object sender, EventArgs e)
  18. {
  19. if (this.gb_Plan.ActiveRow == null) return;
  20. if (gb_Plan.ActiveRow != null)
  21. {
  22. this.txt_old_bh.Text = gb_Plan.ActiveRow.Cells["COIL_NO_ID"].Value.ToString();
  23. this.txt_old_Count.Text = gb_Plan.ActiveRow.Cells["ZSLAB_NUM"].Value.ToString();
  24. this.txt_old_WEIGHT.Text = gb_Plan.ActiveRow.Cells["ZSLAB_WEIGHT"].Value.ToString();
  25. this.txt_old_XJZL.Text = gb_Plan.ActiveRow.Cells["XJJL_WEIGHT"].Value.ToString();
  26. txt_Length.Text = gb_Plan.ActiveRow.Cells["ZSLAB_LENGTH"].Value.ToString();
  27. txt_Ply.Text = gb_Plan.ActiveRow.Cells["ZSLAB_PLY"].Value.ToString();
  28. txt_Width.Text = gb_Plan.ActiveRow.Cells["ZSLAB_WIDTH"].Value.ToString();
  29. this.txt_nes_bh.Text = gb_Plan.ActiveRow.Cells["COIL_NO_ID"].Value.ToString();
  30. }
  31. }
  32. private void doQuery()
  33. {
  34. string where = " ";
  35. if (chk_CollectTime.Checked)
  36. {
  37. if (ultSJ.Value.ToString() == "0")
  38. {
  39. where += " AND TO_CHAR(A.CREATETIME,'YYYY-MM-DD') >='" + Convert.ToDateTime(this.dte_BeginTime.Value).ToString("yyyy-MM-dd") + "' "
  40. + " AND TO_CHAR(A.CREATETIME,'YYYY-MM-DD') <='" + Convert.ToDateTime(this.dte_EndTime.Value).ToString("yyyy-MM-dd") + "' ";
  41. }
  42. else
  43. {
  44. where += " AND TO_CHAR(A.TIME_,'YYYY-MM-DD') >='" + Convert.ToDateTime(this.dte_BeginTime.Value).ToString("yyyy-MM-dd") + "' "
  45. + " AND TO_CHAR(A.TIME_,'YYYY-MM-DD') <='" + Convert.ToDateTime(this.dte_EndTime.Value).ToString("yyyy-MM-dd") + "' ";
  46. }
  47. }
  48. if (chk_RollHao.Checked)
  49. {
  50. where += " AND A.COIL_NO_ID LIKE '" + txt_RollHao .Text.Trim().ToString()+ "%'";
  51. }
  52. string strOut = "";
  53. DataSet ds = new DataSet();
  54. if (ultSJ.Value.ToString() == "0")
  55. {
  56. ds = (DataSet)Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod("BJZWJBStuff", "Core.XgMes.Server.JGKC.RollManager.TurnoffManage", "Turn_CB_Query", new object[] { where }, out strOut);
  57. this.gb_Plan.DataSource = ds;
  58. this.gb_Plan.UpdateData();
  59. Comm.SetGridSumArea(this.gb_Plan);
  60. }
  61. else
  62. {
  63. ds = (DataSet)Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod("BJZWJBStuff", "Core.XgMes.Server.JGKC.RollManager.TurnoffManage", "Turn_CB_JL", new object[] { where }, out strOut);
  64. this.ultraGrid2.DataSource = ds;
  65. this.ultraGrid2.UpdateData();
  66. Comm.SetGridSumArea(this.ultraGrid2);
  67. }
  68. }
  69. private void doAdd()
  70. {
  71. if (!Check_CB())
  72. {
  73. return;
  74. }
  75. try
  76. {
  77. string strOut = "";
  78. ArrayList Other = new ArrayList();
  79. Other.Add(this.txt_old_bh.Text.ToString().Trim());//原包号
  80. Other.Add(this.txt_old_Count.Value.ToString().Trim());//原数量
  81. Other.Add(this.txt_old_WEIGHT.Value.ToString().Trim());//原理论重量
  82. Other.Add(this.txt_old_XJZL.Value.ToString().Trim());//原小件计量
  83. Other.Add(this.txt_nes_bh.Value.ToString());//新包号
  84. Other.Add(this.txt_new_count.Value.ToString());//新数量
  85. Other.Add(this.txt_new_lz.Value.ToString());//新理论重量
  86. Other.Add(this.txt_new_bz.Value.ToString());//新计量重量
  87. Other.Add(this.txt_Remark.Text.ToString());//备注
  88. Other.Add(Core.Mes.ClientFrameWork.ClientCommon._UserInfo.UserName);
  89. object obj = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod("BJZWJBStuff", "Core.XgMes.Server.JGKC.RollManager.ProduceManage", "UnPack_Add", new object[] { Other }, out strOut);
  90. if (obj != null && obj.ToString() == "1")
  91. {
  92. this.doQuery();
  93. Comm.SetGridSumArea(this.gb_Plan);
  94. }
  95. else
  96. {
  97. MessageBox.Show(strOut, "警告", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
  98. }
  99. }
  100. catch (Exception ex)
  101. {
  102. System.Diagnostics.Debug.WriteLine(ex.ToString());
  103. }
  104. }
  105. private bool Check_CB()
  106. {
  107. if (this.txt_nes_bh.Text.Trim().Length == 0)
  108. {
  109. MessageBox.Show("新包号不能为空!", "提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
  110. return false;
  111. }
  112. if (this.txt_new_count.Text.Trim().Length == 0)
  113. {
  114. MessageBox.Show("拆包数量不能为空!", "提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
  115. return false;
  116. }
  117. if (Convert.ToDecimal(this.txt_new_count.Text.Trim()) > Convert.ToDecimal(this.txt_old_Count.Text.Trim()))
  118. {
  119. MessageBox.Show("拆包数量不能大于原始包号的数量!", "提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
  120. return false;
  121. }
  122. if (this.txt_old_bh.Text.Trim()==txt_nes_bh.Text.Trim())
  123. {
  124. MessageBox.Show("新包号不能与原包号一致!", "提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
  125. return false;
  126. }
  127. return true;
  128. }
  129. private void chk_RollHao_CheckedChanged(object sender, EventArgs e)
  130. {
  131. txt_RollHao.Enabled = chk_RollHao.Checked;
  132. }
  133. private void FrmJBCB_Load(object sender, EventArgs e)
  134. {
  135. ultSJ.Value = "0";
  136. dte_BeginTime.Value=DateTime.Now;
  137. dte_EndTime.Value = DateTime.Now;
  138. }
  139. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  140. {
  141. switch (e.Tool.Key)
  142. {
  143. case "query":
  144. doQuery();
  145. break;
  146. case "cbadd":
  147. doAdd();
  148. break;
  149. case "cbjl":
  150. doQuery();
  151. break;
  152. }
  153. }
  154. private void txt_nes_bh_Enter(object sender, EventArgs e)
  155. {
  156. try
  157. {
  158. if (sender.GetType().ToString() == "Infragistics.Win.UltraWinEditors.UltraTextEditor")
  159. {
  160. ((Infragistics.Win.UltraWinEditors.UltraTextEditor)sender).SelectAll();
  161. }
  162. if (sender.GetType().ToString() == "Infragistics.Win.UltraWinEditors.UltraNumericEditor")
  163. {
  164. ((Infragistics.Win.UltraWinEditors.UltraNumericEditor)sender).SelectAll();
  165. }
  166. }
  167. catch (Exception ex)
  168. {
  169. System.Diagnostics.Debug.WriteLine(ex.ToString());
  170. }
  171. }
  172. private void txt_nes_bh_KeyDown(object sender, KeyEventArgs e)
  173. {
  174. try
  175. {
  176. if (e.KeyData == Keys.Return)
  177. {
  178. if (((System.Windows.Forms.Control)sender).Name == "txt_new_count")
  179. {
  180. if (Comm.ObjToInt(this.txt_new_count.Value) == 0)
  181. {
  182. MessageBox.Show("数量不能为空", "提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
  183. return;
  184. }
  185. this.txt_new_lz.Value = ((Comm.ObjToInt(this.txt_Width.Value) * Comm.ObjToDouble(this.txt_Ply.Value) * Comm.ObjToInt(this.txt_Length.Value) * Comm.ObjToInt(this.txt_new_count.Value)) * 0.00000785);
  186. }
  187. System.Windows.Forms.SendKeys.Send("{TAB}");
  188. }
  189. }
  190. catch (Exception ex)
  191. {
  192. System.Diagnostics.Debug.WriteLine(ex.ToString());
  193. }
  194. }
  195. }
  196. }