using FineUIPro; using iWareCommon.Common.Entity; using iWareDataCore.BASE.Service; using iWareDataCore.Check.Service; using iWareExcel.EXCEL.Service; using iWareWms.Code.Excel.Service; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace iWareWms.View.CHECK.Plan { public partial class Plan : PageBase { protected void Page_Load(object sender, EventArgs e) { //设置时间 dpBeginTime.SelectedDate = DateTime.Now.AddDays(-10); dpEndTime.SelectedDate = DateTime.Now.AddDays(20); Query(1); } /// /// 查询未完成盘点的计划,状态 “0”或“1”(0,未盘点,1,未核对,2,已核对) /// /// /// protected void btnSerch_Click(object sender, EventArgs e) { string msg; var plans = PlanService.GetInstance().QueryByParam(new QueryParam { //Geqd = new Dictionary { { "BeginTime", dpBeginTime.SelectedDate }, { "EndTime", dpEndTime.SelectedDate } }, Search = new Dictionary { { "PlanNo", tbPlanNo.Text } }, Lt = new Dictionary { { "Status", 2 } } }, out msg); var res = new List(); plans.ForEach(x => res.Add(x)); PlanGrid.DataSource = res; PlanGrid.DataBind(); } /// /// 保存计划单,状态改为已经盘点 /// /// /// protected void btnSubmit_Click(object sender, EventArgs e) { string planno = lbPlano.Text; int count = PlanViewService.GetInstance().UpdateByPlanNo(planno); if (count >= 0) { Alert.ShowInTop("计划单盘点已完成"); } PlanPlaceMaterialGrid.DataSource = null; PlanPlaceMaterialGrid.DataBind(); PlanGrid.DataSource = null; PlanGrid.DataBind(); } /// /// 绑定查看物料 /// /// /// protected override void GridRowCommand(object sender, GridCommandEventArgs e) { btnSubmit.Enabled = true; var grid = PlanGrid; if (e.CommandName == "Confirm") { var pno = grid.Rows[e.RowIndex].DataKeys[1].ToString(); string msg; var placematerials = PlanViewService.GetInstance().GetPlaceMaterialByPlanNo(pno, out msg); List planno = new List(); placematerials.ForEach(x => planno.Add(x.PlanNo)); lbPlano.Text = planno[0]; PlanPlaceMaterialGrid.DataSource = placematerials; PlanPlaceMaterialGrid.DataBind(); //Tab2.Title = grid.Rows[e.RowIndex].DataKeys[3].ToString() + "的库位明细"; } } protected override void GetPath(object userName) { string msg; string planno = lbPlano.Text; var placematerial = PlanViewService.GetInstance().QueryByParam(new QueryParam { Filter = new Dictionary { {"PlanNo",planno} } },out msg); var placematerials = new List(); placematerial.ForEach(x => placematerials.Add(x)); var workBooks = WorkBookService.GetInstance().QueryByParam(new QueryParam { Filter = new Dictionary { { "Name", "盘点库存明细" } } }, out msg); var path = ExcelService.GetInstance().ToExcelByEPPlus(workBooks[0], new Dictionary> { { "盘点库存明细", placematerials } }, out msg); Session["ExcelPath"] = path; } protected override Window GetWindow() { if (string.IsNullOrEmpty(lbPlano.Text)) { return null; } return Window2; } protected override FineUIPro.Timer GetTimer() { return timer1; } } }