using NFine.Application.SRM;
using NFine.Code;
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 BicDoc_SellerController : ControllerBase
{
private BicDoc_SellerApp App = new BicDoc_SellerApp();
//
// GET: /SRM/BicDoc_Seller/
public ActionResult ICSBidding_Seller()
{
return View();
}
public ActionResult ICSBiddingAdd_Seller()
{
return View();
}
public ActionResult GetGridJson(Pagination pagination, string queryJson)
{
DataTable ListData = App.GetGridJson(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 GetSubGridJson(string STNO, Pagination pagination,string WorkPoint)
{
DataTable ListData = App.GetSubGridJson(STNO, ref pagination, WorkPoint);
var JsonData = new
{
total = pagination.total,
page = pagination.page,
records = pagination.records,
rows = ListData,
};
return Content(JsonData.ToJson());
}
//public ActionResult GetICSBidDoc(string BidCode, string WorkPoint, Pagination pagination)
//{
// DataTable ListData = App.GetICSBidDoc(BidCode, WorkPoint, ref pagination);
// var JsonData = new
// {
// total = pagination.total,
// page = pagination.page,
// records = pagination.records,
// rows = ListData,
// };
// return Content(JsonData.ToJson());
//}
//[HttpGet]
//[HandlerAjaxOnly]
//public ActionResult GetICSBidDoc(Pagination pagination, string BidCode, string WorkPoint)
//{
// DataTable ListData = App.GetICSBidDoc(ref pagination, BidCode, WorkPoint);
// var JsonData = new
// {
// total = pagination.total,
// page = pagination.page,
// records = pagination.records,
// rows = ListData,
// };
// return Content(JsonData.ToJson());
//}
public ActionResult SearchBidDocBDInfoByBidCodeSeller(string BidCode, string WorkPoint, Pagination pagination)
{
DataTable ListData = App.SearchBidDocBDInfoByBidCodeSeller(BidCode, WorkPoint, ref pagination);
var JsonData = new
{
total = pagination.total,
page = pagination.page,
records = pagination.records,
rows = ListData,
};
return Content(JsonData.ToJson());
}
[HttpPost]
public ActionResult SaveForm(ICSBidInfoDetail main)
{
try
{
App.SaveForm(main);
return Success("保存成功");
}
catch (Exception ex)
{
return Error(ex.Message);
}
}
public ActionResult SaveFormTiJiao(string keyValue, string BidCode, string TBCount,string WorkPoint)
{
try
{
App.SaveFormTiJiao(keyValue, BidCode, TBCount, WorkPoint);
return Success("保存成功");
}
catch (Exception ex)
{
return Error(ex.Message);
}
}
public ActionResult SaveFormQTiJiao(string keyValue, string BidCode)
{
try
{
App.SaveFormQTiJiao(keyValue, BidCode);
return Success("取消保存成功");
}
catch (Exception ex)
{
return Error(ex.Message);
}
}
[HttpPost]
public ActionResult UpLoadFileImport(string BidCode, string ID)
{
string FileName = "";
string PathName = "";
string UserName = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName;
//获取上传的文件集合
HttpFileCollection httpFile = System.Web.HttpContext.Current.Request.Files;
for (int i = 0; i < httpFile.Count; i++)
{
//获取送货单号
//string STNO = Request.Form["STNO"].ToString();
string fileName =UserName.Substring(0,4)+"_"+Path.GetFileNameWithoutExtension(httpFile[i].FileName)
+ Path.GetExtension(httpFile[i].FileName);
string Paths = System.Web.HttpContext.Current.Server.MapPath("~\\File\\GYSZTBFile\\" + BidCode);
if (!Directory.Exists(Paths))
{
Directory.CreateDirectory(Paths);
}
string filePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\GYSZTBFile\\" + BidCode + "\\" + fileName);
int iLen = httpFile[0].ContentLength;
byte[] bData = new byte[iLen];
httpFile[0].InputStream.Read(bData, 0, iLen);
FileStream fs = new FileStream(filePath, FileMode.OpenOrCreate);
fs.Write(bData, 0, bData.Length);
fs.Flush();
fs.Close();
fs.Dispose();
FileName += "" + fileName + ";";
PathName += "" + filePath + ";";
}
int count = App.UpLoadFile(FileName, PathName, BidCode);
if (count > 0)
{
return Success("上传成功!");
}
else
{
return Error("上传失败");
}
}
[HttpGet]
[HandlerAjaxOnly]
public ActionResult GetICSBidDocInfoSum(string BidCode, string WorkPoint, string Status)
{
DataTable ListData = App.GetICSBidDocInfoSum(BidCode, WorkPoint, Status);
var JsonData = new
{
rows = ListData,
};
return Content(JsonData.ToJson());
}
[HttpGet]
[HandlerAjaxOnly]
public ActionResult GetCGFile(string BidCode, string WorkPoint)
{
DataTable ListData = App.GetCGFile(BidCode, WorkPoint);
var JsonData = new
{
rows = ListData,
};
return Content(JsonData.ToJson());
}
[HttpGet]
[HandlerAjaxOnly]
public ActionResult GetVenDorFile(string BidCode, string WorkPoint)
{
DataTable ListData = App.GetVenDorFile(BidCode, WorkPoint);
var JsonData = new
{
rows = ListData,
};
return Content(JsonData.ToJson());
}
[HttpGet]
[HandlerAjaxOnly]
public ActionResult GetVenDorFileTB(string BidCode, string WorkPoint)
{
DataTable ListData = App.GetVenDorFileTB(BidCode, WorkPoint);
var JsonData = new
{
rows = ListData,
};
return Content(JsonData.ToJson());
}
///
/// 调用OA接口
///
/// 公司名称
///
[HttpPost]
public ActionResult SellerSubmitOARejict(string BidCode, string WorkPoint)
{
try
{
string msg = App.SellerSubmitOARejict(BidCode, WorkPoint);
var JsonData = new
{
msg = msg,
};
return Content(JsonData.ToJson());
}
catch (Exception ex)
{
return Error("推送失败" + ex.Message);
}
}
}
}