using FineUIPro; using iWareCommon.Common.Entity; using iWareCommon.Common.EnumType; using iWareDataCore.BASE.EnumType; using iWareDataCore.BASE.Service; using iWareDataCore.TASK.Service; using iWareExcel.EXCEL.Service; using iWareWms; using iWareWms.Code.Excel.Service; using Newtonsoft.Json; using System; using System.Collections.Generic; namespace iWareWms.View.SL.PlaceMaterial { public partial class PlaceMaterial :PageBase { protected override Grid GetGrid() { return PlaceGrid; } protected override DropDownList GetPageSizeDropDownList() { return ddlPageSize; } protected override List GetDataSource(int pageIndex, int pageSize, out string msg, out int totalNum, out int currentPage) { var places = PlaceMaterialViewService.GetInstance().QueryByParam(new QueryParam { Search = new Dictionary { { "Name", tbName.Text.Trim() }, { "MaterialCode", tbMaterialCode.Text.Trim() }, { "PlaceCode", tbPlaceCode.Text.Trim() },{ "Length", nbLength.Text.Trim() }, { "Wide", nbWind.Text.Trim() }, { "Thick", nbThick.Text.Trim() } }, PageIndex = pageIndex, PageSize = pageSize }, out msg, out totalNum, out currentPage); var res = new List(); places.ForEach(x => res.Add(x)); return res; } /// /// 状态前台显示 /// /// /// protected string GetEYesOrNo(object type) { return ((EYesOrNo)Convert.ToInt32(type)).ToString(); } protected string GetYesOrNo(object type) { return ((EYesOrNo)Convert.ToInt32(type)).ToString(); } protected string GetStatus(object type) { return ((EPlaceStatus)Convert.ToInt32(type)).ToString(); } //批量撤销 protected override void Delete(List ids, out string msg) { PlaceMaterialService.GetInstance().DeletePlaveMateial(ids, out msg); WriteLog("库位物料清除" + msg, "库存管理"); } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //ddlTypeName.Items.Add("全部", ""); //foreach (var type in Enum.GetValues(typeof(EMaterialType))) //{ // ddlTypeName.Items.Add(type.ToString(), ((int)type).ToString()); //} //var placeMaterials = PlaceMaterialViewService.GetInstance().QueryByParam(new QueryParam(), out msg); //ddlPlaceTypeName.Items.Add("全部", ""); //placeMaterials.ForEach(x => ddlPlaceTypeName.Items.Add(x.PlaceTypeName, x.Id.ToString())); string name = GetIdentityName(); if (name=="admin") { btnClar.Hidden = false; }else { btnClar.Hidden = true; } Button1.OnClientClick = Window1.GetShowReference("~/View/SL/PlaceMaterial/PlaceMaterialDetail.aspx", "新增库位类型"); Query(1); } } protected override Window GetWindow() { return Window1; } protected override void GetPath(object userName) { string msg; var places = PlaceMaterialViewService.GetInstance().QueryByParam(new QueryParam { Search = new Dictionary { { "Name", tbName.Text.Trim() }, { "MaterialCode", tbMaterialCode.Text.Trim() }, { "PlaceCode", tbPlaceCode.Text.Trim() },{ "Length", nbLength.Text.Trim() }, { "Wide", nbWind.Text.Trim() }, { "Thick", nbThick.Text.Trim() }}, }, out msg); var datas = new List(); places.ForEach(x => datas.Add(x)); var workBooks = WorkBookService.GetInstance().QueryByParam(new QueryParam { Filter = new Dictionary { { "Name", "库位物料信息" } } }, out msg); var path = ExcelService.GetInstance().ToExcelByEPPlus(workBooks[0], new Dictionary> { { "库位物料信息", datas } }, out msg); Session["ExcelPath"] = path; } protected override FineUIPro.Timer GetTimer() { return timer1; } protected void btnOut_Click(object sender, EventArgs e) { string msg; List ids = GetSelectedDataKeyIDs(PlaceGrid); if (ids.Count > 0) { int count=MainTaskService.GetInstance().SaveOutMainTask(ids, out msg); if (count>0) { msg = "出库任务生成成功"; } else if (count == 0) { msg = "出库任务已在任务队列中"; } else { msg = "出库任务生成失败!"; } } else { msg = "请选择要出库的物料"; } Alert.Show(msg); WriteLog("库位物料出库" + msg, "库存管理"); } } }