using NFine.Code;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using NFine.Application.SRM;
namespace NFine.Web.Areas.SRM.Controllers
{
public class PriceArticleController : ControllerBase
{
PriceArticleApp App = new PriceArticleApp();
//
// GET: /SRM/PriceArticle/
public ActionResult Index()
{
return View();
}
public ActionResult PriceArtList()
{
return View();
}
public ActionResult PriceArtStage(){
return View();
}
public ActionResult PriceArticComit()
{
return View();
}
///
/// 获取组名称
///
///
///
///
[HttpGet]
[HandlerAjaxOnly]
public ActionResult GetGridJson(Pagination pagination, string queryJson)
{
DataTable ListData = App.GetGridPurchug(queryJson, ref pagination);
var JsonData = new
{
total = pagination.total,
page = pagination.page,
records = pagination.records,
rows = ListData,
};
return Content(JsonData.ToJson());
}
///
/// 获取组名称
///
///
///
///
[HttpGet]
[HandlerAjaxOnly]
public ActionResult GetCompareCodeMaterial(Pagination pagination, string queryJson)
{
DataTable ListData = App.GetCompareCodeMaterial(queryJson, ref pagination);
var JsonData = new
{
total = pagination.total,
page = pagination.page,
records = pagination.records,
rows = ListData,
};
return Content(JsonData.ToJson());
}
///
/// 询报价报表
///
///
///
///
[HttpGet]
[HandlerAjaxOnly]
public ActionResult GetCompareCodeMateriaList(Pagination pagination, string queryJson)
{
DataTable ListData = App.GetCompareCodeMateriaList(queryJson, ref pagination);
var JsonData = new
{
total = pagination.total,
page = pagination.page,
records = pagination.records,
rows = ListData,
};
return Content(JsonData.ToJson());
}
///
/// 获取组名称
///
///
///
///
[HttpGet]
[HandlerAjaxOnly]
public ActionResult GetCompareCodeMaterials(Pagination pagination, string queryJson)
{
DataTable ListData = App.GetCompareCodeMaterials(queryJson, ref pagination);
var JsonData = new
{
total = pagination.total,
page = pagination.page,
records = pagination.records,
rows = ListData,
};
return Content(JsonData.ToJson());
}
///
/// 比价物资设定
///
///
///
///
[HttpPost]
[HandlerAjaxOnly]
public ActionResult SaveItemCode(string queryJson, string PURCHUG, string PURCHUGName)
{
queryJson = queryJson.Substring(1, queryJson.Length - 2);
string msg = App.CheckSTNO_ItemCode(queryJson, PURCHUG, PURCHUGName);
if (!string.IsNullOrEmpty(msg))
{
return Error(msg);
}
else
{
return Success("添加成功!");
}
}
///
/// 取消比价物资设定
///
///
///
///
[HttpPost]
[HandlerAjaxOnly]
public ActionResult UpdateItemCode(string queryJson, string PURCHUG, string PURCHUGName)
{
queryJson = queryJson.Substring(1, queryJson.Length - 2);
string msg = App.UpdateItemCode(queryJson, PURCHUG, PURCHUGName);
if (!string.IsNullOrEmpty(msg))
{
return Error(msg);
}
else
{
return Success("添加成功!");
}
}
[HttpPost]
public void Export(string keyValue)
{
keyValue = keyValue.TrimEnd(',');
//var data = maintainApp.GetList2(ids); //preselldetailApp.GetList2(keyValue, keyword);
DataTable dt = App.GetPOListExport(keyValue);
AsposeCell.Export(dt);
//NPOIExcel helper = new NPOIExcel();
//string title= DateTime.Now.ToString("yyyyMMddHHmmss");
//string path= Server.MapPath("/File/");
//helper.ToExcel(dt, title, "sheet1", path);
}
[HttpPost]
public void ExportAll(string keyValue, string PURCHUG, string InvType, string PURCHUGCODE, string ITEMCODE, string ITEMName, string INVSTD, string VENCode, string VENName, string CREATETIME)
{
DataTable dt = App.GetPOListExport(PURCHUG, InvType, PURCHUGCODE, ITEMCODE, ITEMName, VENCode, VENName, CREATETIME, INVSTD);
AsposeCell.Export(dt);
}
}
}