|
|
using Newtonsoft.Json; using NFine.Application; using NFine.Application.SRM; using NFine.Code; using NFine.Domain._03_Entity; using NFine.Domain._03_Entity.SRM; using System; using System.Collections.Generic; using System.Data; using System.IO; using System.Linq; using System.Web; using System.Web.Mvc;
namespace NFine.Web.Areas.SRM.Controllers { public class RFQAddController : ControllerBase { // GET: SRM/RFQAdd
RFQManagerApp APP = new RFQManagerApp(); public ActionResult Index() { return View(); } public ActionResult ICSSORRFQByPU() { return View(); } public ActionResult ICSSORRFQByPO() { return View(); }
public ActionResult ICSBicDoc_AddFCS() { return View(); }
public ActionResult GetPUROrganize(string workpoint) { DataTable table = APP.GetPUROrganize(workpoint); return Content(JsonConvert.SerializeObject(table)); } public ActionResult GetPurTeam(string code) { DataTable table = APP.GetPURTeam(code); return Content(JsonConvert.SerializeObject(table)); }
public ActionResult GetSercode(string workpoint) {
string sercode = APP.GetSercode(workpoint); return Content(sercode);
} //public ActionResult AddRFQ(string queryjson)
//{
// try
// {
// APP.AddRFQ(queryjson);
// return Success("创建成功!");
// }
// catch (Exception ex)
// {
// return Error(ex.Message);
// }
//}
[HttpPost] public ActionResult AddRFQ(ICSSORRFQ details) { try { APP.AddRFQ(details); return Success("询报价创建成功!"); } catch (Exception ex) { return Error(ex.Message); } }
public void updateS(string ID, string paymentcondition) { APP.updateS(ID, paymentcondition);
}
public void updateiss(string ID, string isshowprice) { APP.updateiss(ID, isshowprice);
}
public ActionResult GetInvType() { return Content(JsonConvert.SerializeObject(APP.GetInvType())); }
//[HttpPost]
//public ActionResult UpLoadFileImport(string RFQNO)
//{
// try
// {
// string msg = "";
// string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
// string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(',');
// //获取上传的文件集合
// HttpFileCollection httpFile = System.Web.HttpContext.Current.Request.Files;
// string FileName = Path.GetFileNameWithoutExtension(httpFile[0].FileName) + Path.GetExtension(httpFile[0].FileName);
// string Paths = System.Web.HttpContext.Current.Server.MapPath("~\\File\\SORRFQFile\\" + RFQNO + "\\");
// if (!Directory.Exists(Paths))
// {
// Directory.CreateDirectory(Paths);
// }
// string PathName = System.Web.HttpContext.Current.Server.MapPath("~\\File\\SORRFQFile\\" + RFQNO + "\\" + FileName);
// int iLen = httpFile[0].ContentLength;
// byte[] bData = new byte[iLen];
// httpFile[0].InputStream.Read(bData, 0, iLen);
// FileStream fs = new FileStream(PathName, FileMode.OpenOrCreate);
// fs.Write(bData, 0, bData.Length);
// fs.Flush();
// fs.Close();
// fs.Dispose();
// //int count = App.UpLoadFile(FileName);
// //if (count > 0)
// //{
// msg = "上传成功!";
// var JsonData = new
// {
// Flag = true,
// msg = msg,
// FileName = FileName,
// PathName = PathName,
// };
// return Content(JsonData.ToJson());
// }
// catch (Exception ex)
// {
// return Error(ex.Message);
// }
//}
[HttpPost] public ActionResult UpLoadFileImport(string RFQNO) { string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode; string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(','); string FileName = ""; string Name = ""; //获取上传的文件集合
HttpFileCollection httpFile = System.Web.HttpContext.Current.Request.Files; try { for (int i = 0; i < httpFile.Count; i++) { FileName = Path.GetFileNameWithoutExtension(httpFile[i].FileName) + Path.GetExtension(httpFile[i].FileName); string Paths = System.Web.HttpContext.Current.Server.MapPath("~\\File\\SORRFQFile\\" + RFQNO + "\\"); if (!Directory.Exists(Paths)) { Directory.CreateDirectory(Paths); } string PathName = System.Web.HttpContext.Current.Server.MapPath("~\\File\\SORRFQFile\\" + RFQNO + "\\" + FileName);
int iLen = httpFile[0].ContentLength; byte[] bData = new byte[iLen]; httpFile[0].InputStream.Read(bData, 0, iLen); FileStream fs = new FileStream(PathName, FileMode.OpenOrCreate); fs.Write(bData, 0, bData.Length); fs.Flush(); fs.Close(); fs.Dispose(); Name = "" + FileName + ";"; } } catch (Exception ex) { return Error(ex.Message); } return Success("上传成功!"); } [HttpGet] [HandlerAjaxOnly] public ActionResult GetSORRVenDorFile(string rfqcode) { DataTable ListData = APP.GetSORRVenDorFile(rfqcode); var JsonData = new { rows = ListData, }; return Content(JsonData.ToJson()); } /// <summary>
/// 采购订单信息
/// </summary>
/// <param name="STNO"></param>
/// <param name="pagination"></param>
/// <param name="WorkPoint"></param>GetItemDocByPO
/// <returns></returns>
public ActionResult GetItemDocByPO(string queryJson, Pagination pagination, string WorkPoint) { WorkPoint = WorkPoint.Substring(1, WorkPoint.Length - 2); DataTable ListData = APP.GetItemDocByPO(queryJson, ref pagination, WorkPoint); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } /// <summary>
/// 请购单信息
/// </summary>
/// <param name="STNO"></param>
/// <param name="pagination"></param>
/// <param name="WorkPoint"></param>GetItemDocByPO
/// <returns></returns>
public ActionResult GetRFByPU(string queryJson, Pagination pagination, string WorkPoint) { WorkPoint = WorkPoint.Substring(1, WorkPoint.Length - 2); DataTable ListData = APP.GetRFByPU(queryJson, ref pagination, WorkPoint); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } [HttpGet] [HandlerAjaxOnly] public ActionResult GetBidItemCode(string WorkPoint, string Vendor) { try { string BidItemCode = APP.GetBidItemCode(WorkPoint, Vendor); var JsonData = new { BidItemCode = BidItemCode, }; return Content(JsonData.ToJson()); } catch (Exception ex) { return Error(ex.Message); } } } }
|