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);
|
}
|
|
|
/// <summary>
|
/// 查询未完成盘点的计划,状态 “0”或“1”(0,未盘点,1,未核对,2,已核对)
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
protected void btnSerch_Click(object sender, EventArgs e)
|
{
|
string msg;
|
var plans = PlanService.GetInstance().QueryByParam(new QueryParam
|
{
|
//Geqd = new Dictionary<string, object> { { "BeginTime", dpBeginTime.SelectedDate }, { "EndTime", dpEndTime.SelectedDate } },
|
Search = new Dictionary<string, object> { { "PlanNo", tbPlanNo.Text } },
|
Lt = new Dictionary<string, object> { { "Status", 2 } }
|
}, out msg);
|
|
var res = new List<object>();
|
|
plans.ForEach(x => res.Add(x));
|
PlanGrid.DataSource = res;
|
PlanGrid.DataBind();
|
|
}
|
|
/// <summary>
|
/// 保存计划单,状态改为已经盘点
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
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();
|
}
|
|
|
/// <summary>
|
/// 绑定查看物料
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
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<string> planno = new List<string>();
|
|
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<string,object> { {"PlanNo",planno} }
|
},out msg);
|
var placematerials = new List<object>();
|
placematerial.ForEach(x => placematerials.Add(x));
|
|
var workBooks = WorkBookService.GetInstance().QueryByParam(new QueryParam { Filter = new Dictionary<string, object> { { "Name", "盘点库存明细" } } }, out msg);
|
|
var path = ExcelService.GetInstance().ToExcelByEPPlus(workBooks[0], new Dictionary<string, List<object>> { { "盘点库存明细", 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;
|
}
|
|
|
}
|
}
|