|
|
using NFine.Application.SRM; using NFine.Code; 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 PerFormanceController : ControllerBase { PerFormanceApp App = new PerFormanceApp(); //
// GET: /SRM/PerFormance/
public ActionResult PerFormanceMark() { return View(); } public ActionResult PerFormanceType() { return View(); } public ActionResult PerFormanceTypeAdd() { return View(); } public ActionResult PerFormanceTypeRel() { return View(); } public ActionResult PerFormanceMarkSearch() { return View(); } public ActionResult PerFormanceTargetAdd() { return View(); } public ActionResult PerFormanceTarget() { return View(); } /// <summary>
/// 打分界面
/// </summary>
/// <returns></returns>
public ActionResult PerFormanceMarkAdd() { return View(); }
public ActionResult PerFormanceMarkAddInv() { return View(); } //供应商维护界面
public ActionResult PerFormanceMarkByVendor() { return View(); } //维护详情页面
public ActionResult PerFormanceMarkMaintenance() { return View(); } /// <summary>
/// 获取绩效类型管理
/// </summary>
/// <param name="pagination"></param>
/// <param name="queryJson"></param>
/// <returns></returns>
[HttpGet] [HandlerAjaxOnly] 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()); } /// <summary>
/// 获取绩效打分
/// </summary>
/// <param name="pagination"></param>
/// <param name="queryJson"></param>
/// <returns></returns>
//[HttpGet]
//[HandlerAjaxOnly]
//public ActionResult GetPerFormanceMark(Pagination pagination, string queryJson)
//{
// DataTable ListData = App.GetPerFormanceMark(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 GetPerFormanceMark(Pagination pagination, string BidCode) { DataTable ListData = App.GetPerFormanceMark(BidCode, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } [HttpGet] [HandlerAjaxOnly] public ActionResult GetPerFormanceMarkByMain(Pagination pagination, string objArr,string WorkPoint) { DataTable ListData = App.GetPerFormanceMarkByMain( ref pagination, objArr, WorkPoint); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); }
[HttpGet] [HandlerAjaxOnly] public ActionResult GetPerFormanceMarkByMainUpdate(Pagination pagination, string objArr, string WorkPoint) { DataTable ListData = App.GetPerFormanceMarkByMainUpdate(ref pagination, objArr, WorkPoint); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } [HttpGet] [HandlerAjaxOnly] public ActionResult GetPerFormanceMarkGrid(Pagination pagination, string queryJson) { DataTable ListData = App.GetPerFormanceMarkGrid(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 GetPerFormanceMarkGridByVendor(Pagination pagination, string queryJson) { DataTable ListData = App.GetPerFormanceMarkGridByVendor(queryJson, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); }
public ActionResult GetPerFormanceMarkBYColumn(string BidCode) { var data = App.GetPerFormanceMarkBYColumn(BidCode); return Content(data.ToJson()); } [HttpGet] [HandlerAjaxOnly] public ActionResult GetEMSCORE() { try { DataRow dr = App.GetEMSCORE(); var JsonData = new { MITEMSCORE = dr["MITEMSCORE"].ToString(), }; return Content(JsonData.ToJson()); } catch (Exception ex) { return Error(ex.Message); } } [HttpGet] [HandlerAjaxOnly] public ActionResult GetList(string MITEMCODE, string WorkPoint) { try { DataRow dr = App.GetList(MITEMCODE, WorkPoint); var JsonData = new { //CERTIFICATEITEMNAME = dr["CERTIFICATEITEMNAME"].ToString(),
WorkPoint = dr["WorkPoint"].ToString(), MITEMCODE = dr["MITEMCODE"].ToString(), //CERTIFICATEITEMCODE = dr["CERTIFICATEITEMCODE"].ToString(),
MITEMNAME = dr["MITEMNAME"].ToString(), MITEMDESCRIPTION = dr["MITEMDESCRIPTION"].ToString(), MITEMSCORE = dr["MITEMSCORE"].ToString(), }; return Content(JsonData.ToJson()); } catch (Exception ex) { return Error(ex.Message); } } /// <summary>
/// 保存绩效类型
/// </summary>
/// <param name="keyValue"></param>
/// <param name="ID"></param>
/// <returns></returns>
[HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult SubmitPERFTEMPLATEMItem(string keyValue, string ID) { try { App.SubmitPERFTEMPLATEMItem(keyValue, ID); return Success("保存成功!"); } catch (Exception ex) { return Error(ex.Message); } } [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult SavePerFormance(string keyValue) { try { App.SavePerFormance(keyValue); return Success("保存成功!"); } catch (Exception ex) { return Error(ex.Message); } } [HttpGet] //[HandlerAjaxOnly]
public ActionResult GetICSPERFTEMPLATEMITEM(string queryJson) { DataTable dt = App.GetICSPERFTEMPLATEMITEM(queryJson); return Content(dt.ToJson()); } /// <summary>
/// 绩效类别和供应商绑定
/// </summary>
/// <param name="keyValue"></param>
/// <param name="keyValue2"></param>
/// <returns></returns>
[HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult SubmitICSPERFTEMPLATEMITEM(string keyValue, string keyValue2) { try { App.SubmitICSPERFTEMPLATEMITEM(keyValue, keyValue2); return Success("保存成功!"); } catch (Exception ex) { return Error(ex.Message); } } /// <summary>
/// 删除认绩效类别
/// </summary>
/// <param name="keyValue"></param>
/// <returns></returns>
[HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeletePerFormanceType(string keyValue) { string msg = App.DeletePerFormanceType(keyValue); if (string.IsNullOrWhiteSpace(msg)) { return Success("删除成功!"); } else { return Error("删除失败"); } } /// <summary>
/// 绩效查询
/// </summary>
/// <param name="pagination"></param>
/// <param name="queryJson"></param>
/// <returns></returns>
[HttpGet] [HandlerAjaxOnly] public ActionResult GetPerFormanceMarkSearch(Pagination pagination, string queryJson) { DataTable ListData = App.GetPerFormanceMarkSearch(queryJson, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } /// 绩效查询
/// </summary>
/// <param name="pagination"></param>
/// <param name="queryJson"></param>
/// <returns></returns>
[HttpGet] [HandlerAjaxOnly] public ActionResult GetPerFormanceTarget(Pagination pagination, string queryJson) { DataTable ListData = App.GetPerFormanceTarget(queryJson, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } /// <summary>
/// 绩效指标维护
/// </summary>
/// <param name="MITEMCODE"></param>
/// <param name="WorkPoint"></param>
/// <returns></returns>
[HttpGet] [HandlerAjaxOnly] public ActionResult GetPerFormanceTargetAdd(string ID) { try { DataRow dr = App.GetPerFormanceTargetAdd(ID); var JsonData = new { NORMALTARGETCATEGORY = dr["NORMALTARGETCATEGORY"].ToString(), NORMALTARGETValue = dr["NORMALTARGETValue"].ToString(), TARGETSCORE = dr["TARGETSCORE"].ToString(), EffDate = dr["EffDate"].ToString(), DisDate = dr["DisDate"].ToString(), }; return Content(JsonData.ToJson()); } catch (Exception ex) { return Error(ex.Message); } } /// <summary>
/// 保存绩效权值
/// </summary>
/// <param name="keyValue"></param>
/// <returns></returns>
[HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult SubmitPerFormanceTarget(string keyValue,string ID) { try { App.SubmitPerFormanceTarget(keyValue, ID); return Success("保存成功!"); } catch (Exception ex) { return Error(ex.Message); } } [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeletePerFormance(string keyValue) { string msg = App.DeletePerFormance(keyValue); if (string.IsNullOrWhiteSpace(msg)) { return Success("删除成功!"); } else { return Error("删除失败"); } }
[HttpGet] [HandlerAjaxOnly] public ActionResult GetScore(string WorkPoint) { try { decimal msg = App.GetScore(WorkPoint); var JsonData = new { SumScore = msg, }; return Content(JsonData.ToJson()); } catch (Exception ex) { return Error(ex.Message); } } public ActionResult GetScoreByTarget(string EffDate, string DisDate) { try { string msg = App.GetScoreByTarget(EffDate, DisDate); var JsonData = new { SumScore = msg, }; return Content(JsonData.ToJson()); } catch (Exception ex) { return Error(ex.Message); } } [HttpGet] [HandlerAjaxOnly] public ActionResult GetEMSCOREByTarget(string EffDate, string DisDate) { try { DataRow dr = App.GetEMSCOREByTarget(EffDate, DisDate); var JsonData = new { MITEMSCORE = dr["MITEMSCORE"].ToString(), }; return Content(JsonData.ToJson()); } catch (Exception ex) { return Error(ex.Message); } } /// <summary>
/// 删除打分明细
/// </summary>
/// <param name="keyValue"></param>
/// <param name="WorkPoint"></param>
/// <returns></returns>
[HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeleteICSPERFCHECKRESULT(string keyValue) { string msg = App.DeleteICSPERFCHECKRESULT(keyValue); if (string.IsNullOrEmpty(msg)) { return Success("删除成功!"); } else { return Error(msg); } }
public ActionResult SaveFormTiJiaoZB(string arrayShellFabricDetail,string Type) { try { App.SaveFormTiJiaoZB(arrayShellFabricDetail, Type); return Success("保存成功"); } catch (Exception ex) { return Error(ex.Message); }
}
public ActionResult SaveFormMarkMaintenance(string queryJson) { try { App.SaveFormMarkMaintenance(queryJson); return Success("保存成功"); } catch (Exception ex) { return Error(ex.Message); }
}
public ActionResult SaveFormOK(string json) { try { App.SaveFormOK(json); return Success("保存成功"); } catch (Exception ex) { return Error(ex.Message); }
} public ActionResult SaveFormNG(string json) { try { App.SaveFormOK(json); return Success("保存成功"); } catch (Exception ex) { return Error(ex.Message); }
}
public ActionResult PERFPublish(string json) { return Content(App.PERFPublish(json));
}
public ActionResult PERFClose(string json) { return Content(App.PERFClose(json));
} public ActionResult PERFDELETE(string json) {
string msg = App.PERFdelete(json); if (string.IsNullOrEmpty(msg)) { return Success("删除成功!"); } else { return Error(msg); }
}
//[HttpGet]
//[HandlerAjaxOnly]
public ActionResult GetPerFormanceMarkInfo(string objArr, string WorkPoint) { DataTable ListData = App.GetPerFormanceMarkInfo(objArr, WorkPoint); var JsonData = new { rows = ListData, }; return Content(JsonData.ToJson()); }
/// <summary>
/// 上传完文件
/// </summary>
/// <param name="BidCode"></param>
/// <param name="ID"></param>
/// <returns></returns>
[HttpPost] public ActionResult UpLoadFileImport(string VENDORCODE, string CERTIFICATEITEMCODE) { string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode;
string FileName = ""; string PathName = ""; //获取上传的文件集合
try { HttpFileCollection httpFile = System.Web.HttpContext.Current.Request.Files; for (int i = 0; i < httpFile.Count; i++) { //获取送货单号
//string STNO = Request.Form["STNO"].ToString();
string fileName = Path.GetFileNameWithoutExtension(httpFile[i].FileName) + CERTIFICATEITEMCODE + Path.GetExtension(httpFile[i].FileName); string Paths = System.Web.HttpContext.Current.Server.MapPath("~\\File\\PerFormanceFile\\" + VENDORCODE + "\\"); if (!Directory.Exists(Paths)) { Directory.CreateDirectory(Paths); } string filePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\PerFormanceFile\\" + VENDORCODE + "\\" + 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 + ";"; } return Success("上传成功!"); } catch (Exception ex) {
return Error(ex.Message); } }
[HttpPost] /// <summary>
/// 文件上传到本地
/// </summary>
public ActionResult UploadFile() { string mess = ""; try { HttpFileCollection hpFiles = System.Web.HttpContext.Current.Request.Files; if (hpFiles != null && hpFiles.Count > 0) {
string IsXls = System.IO.Path.GetExtension(hpFiles[0].FileName).ToString().ToLower();//System.IO.Path.GetExtension获得文件的扩展名
if (IsXls != ".xls" && IsXls != ".xlsx") {
mess = "只可以选择Excel(.xls .xlsx)文件";//当选择的不是Excel文件时,返回
} string filename = DateTime.Now.ToString("yyyyMMddhhmmss") + Guid.NewGuid() + IsXls; //获取Execle文件名 DateTime日期函数
string savePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\UPLoadFile\\" + filename);//Server.MapPath 获得虚拟服务器相对路径
int iLen = hpFiles[0].ContentLength; if (Directory.Exists(savePath)) mess = "文件已存在"; byte[] bData = new byte[iLen]; hpFiles[0].InputStream.Read(bData, 0, iLen);
FileStream newFile = new FileStream(savePath, FileMode.OpenOrCreate); newFile.Write(bData, 0, bData.Length); newFile.Flush(); int _FileSizeTemp = hpFiles[0].ContentLength;
newFile.Close(); newFile.Dispose(); //bool del = false;
mess = App.SetData_PR(savePath); if (System.IO.File.Exists(savePath))//删除文件
{
System.IO.File.Delete(savePath); }
} else { mess = "获取文件失败"; } } catch (Exception ex) {
mess = ex.Message; } var JsonData = new { mass = mess, }; return Content(JsonData.ToJson()); }
[HttpGet] [HandlerAjaxOnly] public ActionResult GetVendorList(Pagination pagination, string queryJson, string WorkPoint,string year,string Moth,string Day) { DataTable ListData = App.GetVendorList(queryJson, ref pagination, WorkPoint, year, Moth, Day); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); }
} }
|