FrmPurOutPlan.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  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 CoreFS.CA06;using Pur.Entity;
  10. using Core.Mes.Client.Comm.Control;
  11. using Pur.Entity.configureEntity;
  12. using Infragistics.Win.UltraWinGrid;
  13. using System.Collections;
  14. using com.hnshituo.pur.vo;
  15. using Pur.Entity.require_planEntiy;
  16. using Core.Mes.Client.Comm.Tool;
  17. using Pur.configure;
  18. using Pur.Pop_upWindow;
  19. namespace Pur.ck
  20. {
  21. public partial class FrmPurOutPlan : FrmPmsBase
  22. {
  23. public FrmPurOutPlan()
  24. {
  25. InitializeComponent();
  26. }
  27. private void FrmPurOutPlan_Load(object sender, EventArgs e)
  28. {
  29. Init();
  30. }
  31. DateTime? NullTime = null;
  32. double? NullDouble = null;
  33. #region toolbar菜单
  34. public override void ToolBar_Click(object sender, string ToolbarKey)
  35. {
  36. switch (ToolbarKey)
  37. {
  38. case "Query":
  39. Get_PurUsePlan();
  40. break;
  41. case "OutWithUse":
  42. doOutWithUse();
  43. break;
  44. case "OutWithoutUse":
  45. doOutWithoutUse();
  46. break;
  47. }
  48. }
  49. #endregion
  50. #region toolbar事件
  51. /// <summary>
  52. /// 非领用出库
  53. /// </summary>
  54. private void doOutWithoutUse()
  55. {
  56. MessageBox.Show("开发中,暂无数据", "提示");
  57. return;
  58. }
  59. /// <summary>
  60. /// 领用出库
  61. /// </summary>
  62. private void doOutWithUse()
  63. {
  64. //DataTable dt=new DataTable();
  65. //DataSet ds=new DataSet();
  66. //ultraGrid2.UpdateData();
  67. ////扫描grid2,获取选择的数据
  68. //DataTable table;
  69. //IQueryable<UltraGridRow> checkRows = ultraGrid2.Rows.AsQueryable().Where("isSelect = 'True' ");
  70. //foreach (UltraGridRow row1 in checkRows)
  71. //{
  72. // DataRow row;
  73. // row = table.NewRow();
  74. // string strMrLineID = row1.Cells["mrLineId"].Value.ToString().Trim();
  75. // row = dataTable2.Select("mrLineId=strMrLineId")[0];
  76. // table.Rows.Add(row);
  77. //}
  78. //IQueryable<DataRow> checkRows = ultraGrid2.Rows.AsQueryable().Where("isSelect = 'True' ");
  79. // DataRow[] rows = dataTable3.Select("Songqty<>'' or Songqty is not null or Songqty <>'0'");
  80. //foreach (DataRow row in rows)
  81. //{
  82. // dt_b.ImportRow(row);//复制行数据
  83. //}
  84. try
  85. {
  86. if (ultraGrid1.ActiveRow != null)
  87. {
  88. ultraGrid2.UpdateData();
  89. ArrayList list = new ArrayList();
  90. IQueryable<UltraGridRow> checkRows = ultraGrid2.Rows.AsQueryable().Where("isSelect = 'True' ");
  91. if (checkRows == null || checkRows.Count() < 1)
  92. {
  93. MessageBox.Show("请选择需要生成送货单的领用单明细", "提示");
  94. return;
  95. }
  96. foreach (UltraGridRow row in checkRows)
  97. {
  98. string strMrLineID = row.Cells["mrLineId"].Value.ToString().Trim();
  99. list.Add(strMrLineID);
  100. }
  101. FrmPurOutBill bfrm = new FrmPurOutBill(this.ob);
  102. bfrm.CheckList = list;
  103. bfrm.ShowDialog();
  104. Get_PurUsePlan();
  105. }
  106. else
  107. {
  108. MessageBox.Show("操作失败:未选择领用计划", "提示");
  109. }
  110. }
  111. catch (Exception ex)
  112. {
  113. MessageBox.Show("操作失败:"+ex.Message, "提示");
  114. }
  115. }
  116. /// <summary>
  117. /// 查询
  118. /// </summary>
  119. private void Get_PurUsePlan()
  120. {
  121. try
  122. {
  123. dataTable2.Clear();
  124. dataTable1.Clear();
  125. UsePlanM Upm = new UsePlanM();
  126. Upm.Status = Qstatus.Value == null ? null : Qstatus.Value.ToString();
  127. Upm.Classes = Qclasses.Value == null ? null : Qclasses.Value.ToString();
  128. Upm.PlanType = QplanType.Value == null ? null : QplanType.Value.ToString();
  129. Upm.MrId = QusePlanId.Text;
  130. Upm.CreateName = QmatName.Text;
  131. Upm.ApplyName = QmatName.Text;
  132. if (isTodayPlan.Checked == true)
  133. {
  134. string start = DateTime.Now.ToString("yyyy-MM-dd ") + "00:00:00";
  135. string end = DateTime.Now.ToString("yyyy-MM-dd ") + "23:59:59";
  136. Upm.UpdateTime = Convert.ToDateTime(start);
  137. Upm.DeleteTime = Convert.ToDateTime(end);
  138. }
  139. else
  140. {
  141. if (Qtimebegin.Value == null || QtimeEnd.Value == null)
  142. {
  143. MessageBox.Show("时间为空,请输入有效的查询时间", "提示");
  144. }
  145. DateTime start = (DateTime)Qtimebegin.Value;
  146. DateTime end = (DateTime)QtimeEnd.Value;
  147. Upm.UpdateTime = start;
  148. Upm.DeleteTime = end;
  149. }
  150. DataTable dt = this.execute<DataTable>("com.hnshituo.pur.requireplan.service.UsePlanMService", "find_UsePlanM", new object[] { Upm });
  151. GridHelper.CopyDataToDatatable(dt, dataTable1, true);
  152. }
  153. catch (Exception ex)
  154. {
  155. MessageUtil.ShowTips("查询失败:"+ex);
  156. }
  157. }
  158. #endregion
  159. #region 界面事件
  160. private void ultraGrid1_AfterCellActivate(object sender, EventArgs e)
  161. {
  162. dataTable2.Clear();
  163. UltraGridRow ugr = ultraGrid1.ActiveRow;
  164. UsePlanD Upd = new UsePlanD();
  165. Upd.Validflag = "1";
  166. Upd.MrId = ugr.Cells["MrId"].Value.ToString();
  167. DataTable dt = this.execute<DataTable>("com.hnshituo.pur.requireplan.service.UsePlanDService", "find_UsePlanD", new object[] { Upd});
  168. GridHelper.CopyDataToDatatable(dt, dataTable2, true);
  169. }
  170. private void Init()
  171. {
  172. isTodayPlan.Checked = true;
  173. Qtimebegin.Enabled = false;
  174. QtimeEnd.Enabled = false;
  175. String end = DateTime.Now.ToString("yyyy-MM-dd ") + "23:59:59";
  176. String start = DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd ") + "00:00:00";
  177. Qtimebegin.Value = Convert.ToDateTime(start);
  178. QtimeEnd.Value = Convert.ToDateTime(end);
  179. }
  180. private void isTodayPlan_CheckedChanged(object sender, EventArgs e)
  181. {
  182. if (isTodayPlan.Checked)
  183. {
  184. Qtimebegin.Enabled = false;
  185. QtimeEnd.Enabled = false;
  186. }
  187. else
  188. {
  189. Qtimebegin.Enabled = true;
  190. QtimeEnd.Enabled = true;
  191. }
  192. }
  193. #endregion
  194. private void ultraPanel1_PaintClient(object sender, PaintEventArgs e)
  195. {
  196. }
  197. }
  198. }