using BLL.DAL;
|
using Common;
|
using Json;
|
using Lib;
|
using Model;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.Mvc;
|
using System.Web.Script.Serialization;
|
|
namespace wms.Areas.Data.Controllers
|
{
|
public class DeliveryOutDetailController : MasterPage
|
{
|
// GET: Data/DeliveryOutDetail
|
|
[LoginFilter]
|
public ActionResult Index()
|
{
|
ViewBag.Title = "出入库明细";
|
ViewBag.MatType = LocalHelper.GetDictionaryHtml("MatType");
|
ViewBag.OrdNoType = LocalHelper.GetOrdNoTypeHtml();
|
ViewBag.Certificate = LocalHelper.GetCertificateHtml();
|
|
return View();
|
}
|
|
public ActionResult EditCertificates(string ordNo,string matNo)
|
{
|
DALDeliveryOutDetail provider = new DALDeliveryOutDetail();
|
DeliveryOutDetail entity = provider.GetCertificate(ordNo, matNo);
|
ViewBag.Certificate = entity.Certificate;
|
ViewBag.Demo = entity.Demo;
|
|
return View();
|
}
|
}
|
|
public class DeliveryOutAjaxController : AjaxPage
|
{
|
public ActionResult GetList()
|
{
|
try
|
{
|
var dd = Request["aaa"];
|
var modelItems = new JavaScriptSerializer().Deserialize<AjaxOutDetail>(dd);
|
if (modelItems != null)
|
{
|
// 实例化分页信息
|
PageInfo pageInfo = new PageInfo()
|
{
|
PageIndex = modelItems.pageIndex,
|
PageSize = modelItems.pageSize
|
};
|
modelItems.DepartGuid = this.LoginDepartNum;
|
|
// 数据库交互,获取库区集合and分页信息。
|
DALDeliveryOutDetail provider = new DALDeliveryOutDetail();
|
List<DeliveryOutDetail> entity = provider.GetList(modelItems, ref pageInfo).ToList();
|
|
// Data =》json
|
string json = JsonHelper.IListToJson<DeliveryOutDetail>(entity, "List");
|
string pjson = ConvertJson.Serializer(pageInfo);
|
|
// controller => view
|
ReturnJson.AddProperty("Result", new JsonObject(json));
|
ReturnJson.AddProperty("PageInfo", new JsonObject(pjson));
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "出库明细加载成功!");
|
|
return Content(this.ReturnJson.ToString());
|
}
|
|
return Content(null);
|
}
|
catch (System.Exception)
|
{
|
return Content(null);
|
}
|
}
|
|
public ActionResult SetCertificates()
|
{
|
string dd = Request["aaa"];
|
if (dd != null)
|
{
|
var models = new JavaScriptSerializer().Deserialize<DeliveryOutDetail>(dd);
|
|
DALDeliveryOutDetail provider = new DALDeliveryOutDetail();
|
|
if (provider.SetCertificates(models))
|
{
|
ReturnJson.AddProperty("Code", 1);
|
ReturnJson.AddProperty("Message", "数据更新成功!");
|
}
|
else
|
{
|
ReturnJson.AddProperty("Code", 0);
|
ReturnJson.AddProperty("Message", "数据更新失败!");
|
}
|
|
return Content(this.ReturnJson.ToString());
|
}
|
|
return Content(null);
|
}
|
}
|
}
|