| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using CoreFS.CA06;using Pur.Entity;
- using Core.Mes.Client.Comm.Control;
- using Pur.Entity.configureEntity;
- using Infragistics.Win.UltraWinGrid;
- using System.Collections;
- using com.hnshituo.pur.vo;
- using Pur.Entity.require_planEntiy;
- using Core.Mes.Client.Comm.Tool;
- using Pur.configure;
- using Pur.Pop_upWindow;
- namespace Pur.ck
- {
- public partial class FrmPurOutPlan : FrmPmsBase
- {
- public FrmPurOutPlan()
- {
- InitializeComponent();
- }
- private void FrmPurOutPlan_Load(object sender, EventArgs e)
- {
- Init();
- }
- DateTime? NullTime = null;
- double? NullDouble = null;
- #region toolbar菜单
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- Get_PurUsePlan();
- break;
- case "OutWithUse":
- doOutWithUse();
- break;
- case "OutWithoutUse":
- doOutWithoutUse();
- break;
- }
- }
- #endregion
- #region toolbar事件
- /// <summary>
- /// 非领用出库
- /// </summary>
- private void doOutWithoutUse()
- {
- MessageBox.Show("开发中,暂无数据", "提示");
- return;
- }
- /// <summary>
- /// 领用出库
- /// </summary>
- private void doOutWithUse()
- {
- //DataTable dt=new DataTable();
- //DataSet ds=new DataSet();
- //ultraGrid2.UpdateData();
- ////扫描grid2,获取选择的数据
- //DataTable table;
- //IQueryable<UltraGridRow> checkRows = ultraGrid2.Rows.AsQueryable().Where("isSelect = 'True' ");
- //foreach (UltraGridRow row1 in checkRows)
- //{
- // DataRow row;
- // row = table.NewRow();
- // string strMrLineID = row1.Cells["mrLineId"].Value.ToString().Trim();
- // row = dataTable2.Select("mrLineId=strMrLineId")[0];
- // table.Rows.Add(row);
- //}
- //IQueryable<DataRow> checkRows = ultraGrid2.Rows.AsQueryable().Where("isSelect = 'True' ");
- // DataRow[] rows = dataTable3.Select("Songqty<>'' or Songqty is not null or Songqty <>'0'");
-
- //foreach (DataRow row in rows)
- //{
- // dt_b.ImportRow(row);//复制行数据
- //}
- try
- {
- if (ultraGrid1.ActiveRow != null)
- {
- ultraGrid2.UpdateData();
- ArrayList list = new ArrayList();
- IQueryable<UltraGridRow> checkRows = ultraGrid2.Rows.AsQueryable().Where("isSelect = 'True' ");
- if (checkRows == null || checkRows.Count() < 1)
- {
- MessageBox.Show("请选择需要生成送货单的领用单明细", "提示");
- return;
- }
- foreach (UltraGridRow row in checkRows)
- {
- string strMrLineID = row.Cells["mrLineId"].Value.ToString().Trim();
- list.Add(strMrLineID);
- }
- FrmPurOutBill bfrm = new FrmPurOutBill(this.ob);
- bfrm.CheckList = list;
- bfrm.ShowDialog();
- Get_PurUsePlan();
- }
- else
- {
- MessageBox.Show("操作失败:未选择领用计划", "提示");
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show("操作失败:"+ex.Message, "提示");
- }
- }
- /// <summary>
- /// 查询
- /// </summary>
- private void Get_PurUsePlan()
- {
- try
- {
- dataTable2.Clear();
- dataTable1.Clear();
- UsePlanM Upm = new UsePlanM();
- Upm.Status = Qstatus.Value == null ? null : Qstatus.Value.ToString();
- Upm.Classes = Qclasses.Value == null ? null : Qclasses.Value.ToString();
- Upm.PlanType = QplanType.Value == null ? null : QplanType.Value.ToString();
- Upm.MrId = QusePlanId.Text;
- Upm.CreateName = QmatName.Text;
- Upm.ApplyName = QmatName.Text;
- if (isTodayPlan.Checked == true)
- {
- string start = DateTime.Now.ToString("yyyy-MM-dd ") + "00:00:00";
- string end = DateTime.Now.ToString("yyyy-MM-dd ") + "23:59:59";
- Upm.UpdateTime = Convert.ToDateTime(start);
- Upm.DeleteTime = Convert.ToDateTime(end);
- }
- else
- {
- if (Qtimebegin.Value == null || QtimeEnd.Value == null)
- {
- MessageBox.Show("时间为空,请输入有效的查询时间", "提示");
- }
- DateTime start = (DateTime)Qtimebegin.Value;
- DateTime end = (DateTime)QtimeEnd.Value;
- Upm.UpdateTime = start;
- Upm.DeleteTime = end;
- }
- DataTable dt = this.execute<DataTable>("com.hnshituo.pur.requireplan.service.UsePlanMService", "find_UsePlanM", new object[] { Upm });
- GridHelper.CopyDataToDatatable(dt, dataTable1, true);
- }
- catch (Exception ex)
- {
- MessageUtil.ShowTips("查询失败:"+ex);
- }
- }
- #endregion
- #region 界面事件
- private void ultraGrid1_AfterCellActivate(object sender, EventArgs e)
- {
- dataTable2.Clear();
- UltraGridRow ugr = ultraGrid1.ActiveRow;
- UsePlanD Upd = new UsePlanD();
- Upd.Validflag = "1";
- Upd.MrId = ugr.Cells["MrId"].Value.ToString();
- DataTable dt = this.execute<DataTable>("com.hnshituo.pur.requireplan.service.UsePlanDService", "find_UsePlanD", new object[] { Upd});
- GridHelper.CopyDataToDatatable(dt, dataTable2, true);
- }
- private void Init()
- {
- isTodayPlan.Checked = true;
- Qtimebegin.Enabled = false;
- QtimeEnd.Enabled = false;
- String end = DateTime.Now.ToString("yyyy-MM-dd ") + "23:59:59";
- String start = DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd ") + "00:00:00";
- Qtimebegin.Value = Convert.ToDateTime(start);
- QtimeEnd.Value = Convert.ToDateTime(end);
- }
- private void isTodayPlan_CheckedChanged(object sender, EventArgs e)
- {
- if (isTodayPlan.Checked)
- {
- Qtimebegin.Enabled = false;
- QtimeEnd.Enabled = false;
- }
- else
- {
- Qtimebegin.Enabled = true;
- QtimeEnd.Enabled = true;
- }
- }
- #endregion
- private void ultraPanel1_PaintClient(object sender, PaintEventArgs e)
- {
- }
- }
- }
|