using NFine.Application.SRM; using NFine.Code; using NPOI.HPSF; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Web; using System.Web.Mvc; namespace NFine.Web.Areas.SRM.Controllers { public class RFQMesController : ControllerBase { // GET: SRM/RFQMes RFQManagerApp app = new RFQManagerApp(); public ActionResult Index() { return View(); } public ActionResult WatchBJ() { return View(); } public ActionResult WatchBJByDJ() { return View(); } public ActionResult WatchBJByDJBack() { return View(); } public ActionResult CloseRFQss() { return View(); } public ActionResult GetRfqrow(string rfqcode) { return Content(app.GetRFQ(rfqcode).ToJson()); } public ActionResult GetRfqAndBJ(string rfqno, Pagination pagination) { DataTable table = app.GetRfqAndBJ(rfqno); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = table }; return Content(JsonData.ToJson()); } public ActionResult GetRfqSup(string rfqno, Pagination pagination) { DataTable table = app.GetRfqSup(rfqno); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = table }; return Content(JsonData.ToJson()); } public ActionResult GetRfqSup1(string rfqno, string invcode, string workpoint, string queryJson, Pagination pagination) { DataTable table = app.GetRfqSup(rfqno, invcode, workpoint, queryJson, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = table }; return Content(JsonData.ToJson()); } //public ActionResult UpLoadFile() { // HttpFileCollection httpFile = System.Web.HttpContext.Current.Request.Files; // string STNO = Request.Form["STNO"].ToString(); //} public ActionResult UpdatePrice(string json) { return Content(app.SaveSCprice(json)); } [HttpPost] [HandlerAjaxOnly] public ActionResult Agree(string json) { return Content(app.AgreeCS(json)); } /// /// 上传到OA /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult AgreeByOA(string json) { try { string msg = app.AgreeByOA(json); if (string.IsNullOrWhiteSpace(msg)) { return Success("OA推送成功!"); } else { return Error("OA推送失败!"); } } catch (Exception ex) { return Error("退回失败!失败原因:" + ex.Message); } } /// /// 撤销OA流程 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult CleanAgreeByOA(string json) { try { string msg = app.CleanAgreeByOA(json); if (string.IsNullOrWhiteSpace(msg)) { return Success("OA撤销成功!"); } else { return Error("OA撤销失败!"); } } catch (Exception ex) { return Error("撤销失败!失败原因:" + ex.Message); } } public ActionResult Reject(string json) { return Content(app.RejectCS(json)); } public ActionResult CreateBJ(string json) { return Content(app.CreateBJ(json)); } [HttpPost] [HandlerAjaxOnly] public ActionResult CloseRFQPrice(string VenCode, string RFQNO, string ReturnRemark) { int result = app.CloseRFQPrice(VenCode, RFQNO,ReturnRemark); if (result > 0) { return Success("操作成功!"); } else { return Error("操作失败!"); } } [HttpGet] [HandlerAjaxOnly] public ActionResult GetMinPice(string RFQCODE, string ITEMCODE) { DataTable ListData = app.GetMinPice(RFQCODE, ITEMCODE); var JsonData = new { rows = ListData, }; return Content(JsonData.ToJson()); } [HttpPost] public void Export(string rfqno, string workpoint) { DataTable dt = app.GetPOListExport(rfqno, workpoint); AsposeCell.Export(dt); } /// /// 总查询 /// /// /// /// [HttpGet] public ActionResult GetListSORRFQ(Pagination pagination, string rfqno, string workpoint) { DataTable ListData = app.GetListSORRFQ(rfqno, workpoint, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } /// /// 总查询 /// /// /// /// [HttpGet] public ActionResult GetListSORRFQByDJ(Pagination pagination, string rfqno, string workpoint) { DataTable ListData = app.GetListSORRFQByDJ(rfqno, workpoint, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } [HttpGet] public ActionResult GetListSORRFQbyRemark(string rfqno, string workpoint) { DataTable ListData = app.GetListSORRFQbyRemark(rfqno, workpoint); var JsonData = new { rows = ListData, }; return Content(JsonData.ToJson()); } [HttpGet] [HandlerAjaxOnly] public ActionResult GetVendor(string rfqno,string workpoint) { DataTable dt = app.GetVendor(rfqno, workpoint); return Content(dt.ToJson()); } [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult WatchBJByDJBack(string rfqno,string Vendor,string workpoint) { try { int i = app.WatchBJByDJBack(rfqno, Vendor, workpoint); if (i > 0) { return Success("退回成功!"); } else { return Error("退回失败!"); } } catch (Exception ex) { return Error("退回失败!失败原因:" + ex.Message); } } } }