You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
712 lines
21 KiB
712 lines
21 KiB
using log4net.Repository.Hierarchy;
|
|
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 PriceInquiryController : ControllerBase
|
|
{
|
|
PriceInquiryApp APP = new PriceInquiryApp();
|
|
// GET: SRM/PriceInquiry
|
|
public ActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
/// <summary>
|
|
/// 条件非标物料
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ActionResult NoProductionMaterialAdd()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 新增询价单
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ActionResult PriceInquiryAdd()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 分配采购
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ActionResult PurchaserAllocation()
|
|
{
|
|
return View();
|
|
}
|
|
/// <summary>
|
|
/// 供应商分配
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ActionResult VendorPersAllocation()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 报价管理
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ActionResult QuotedPriceIndex()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 报价明细
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ActionResult QuotedPriceDetail()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 审核报价
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ActionResult ReviewPrice()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 生效报价
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ActionResult CompPrice()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 报价过程查询
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ActionResult ComPricelistByPN()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 技术需求单发起
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ActionResult TechnicalRequirementsForm()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 技术需求单(新增界面)
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ActionResult TechnicalRequirementsFormAdd()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 需求单详情页
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ActionResult TechnicalRequirementsFormLook()
|
|
{
|
|
return View();
|
|
}
|
|
/// <summary>
|
|
/// 选择需求物料
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ActionResult VendorPersAddItem()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 获取列表
|
|
/// </summary>
|
|
/// <param name="rfqno"></param>
|
|
/// <param name="pagination"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public ActionResult GetInvTabByPN(string rfqno, Pagination pagination)
|
|
{
|
|
|
|
DataTable table = APP.GetInvTabByPN(rfqno);
|
|
var JsonData = new
|
|
{
|
|
total = pagination.total,
|
|
page = pagination.page,
|
|
records = pagination.records,
|
|
rows = table
|
|
};
|
|
return Content(JsonData.ToJson());
|
|
}
|
|
|
|
//初次加载页面数据
|
|
[HttpGet]
|
|
[HandlerAjaxOnly]
|
|
public ActionResult GetGridJsonByPN(Pagination pagination, string queryJson)
|
|
{
|
|
DataTable ListData = APP.GetGridJsonByPN(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="rfqno"></param>
|
|
/// <param name="pagination"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public ActionResult GetInvTabByPNForVendor(string rfqno, Pagination pagination)
|
|
{
|
|
|
|
DataTable table = APP.GetInvTabByPNForVendor(rfqno);
|
|
var JsonData = new
|
|
{
|
|
total = pagination.total,
|
|
page = pagination.page,
|
|
records = pagination.records,
|
|
rows = table
|
|
};
|
|
return Content(JsonData.ToJson());
|
|
}
|
|
|
|
/// <summary>
|
|
/// 新增询价单
|
|
/// </summary>
|
|
/// <param name="details"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public ActionResult AddRFQByPN(ICSSORRFQ details)
|
|
{
|
|
try
|
|
{
|
|
APP.AddRFQByPN(details);
|
|
return Success("询报价创建成功!");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return Error(ex.Message);
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 分配采购人员
|
|
/// </summary>
|
|
/// <param name="details"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public ActionResult AddRFQByPNPurchasing(ICSSORRFQ details)
|
|
{
|
|
try
|
|
{
|
|
APP.AddRFQByPNPurchasing(details);
|
|
return Success("询报价创建成功!");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return Error(ex.Message);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 分配供应商
|
|
/// </summary>
|
|
/// <param name="details"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public ActionResult AddRFQByPNVendorsing(ICSSORRFQ details)
|
|
{
|
|
try
|
|
{
|
|
APP.AddRFQByPNVendorsing(details);
|
|
return Success("询报价创建成功!");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return Error(ex.Message);
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取采购人员
|
|
/// </summary>
|
|
/// <param name="rfqno"></param>
|
|
/// <param name="workpoint"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
[HandlerAjaxOnly]
|
|
public ActionResult GetSelectBuiess(string WorkPoint)
|
|
{
|
|
DataTable dt = APP.GetSelectBuiess(WorkPoint);
|
|
return Content(dt.ToJson());
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取供应商
|
|
/// </summary>
|
|
/// <param name="rfqno"></param>
|
|
/// <param name="workpoint"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
[HandlerAjaxOnly]
|
|
public ActionResult GetSelectVendor(string WorkPoint)
|
|
{
|
|
DataTable dt = APP.GetSelectVendor(WorkPoint);
|
|
return Content(dt.ToJson());
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 无聊行退回
|
|
/// </summary>
|
|
/// <param name="keyValue"></param>
|
|
/// <returns></returns>
|
|
public ActionResult InvCodeBack(string keyValue,string RFQNO)
|
|
{
|
|
string msg = APP.InvCodeBack(keyValue, RFQNO);
|
|
if (string.IsNullOrEmpty(msg))
|
|
{
|
|
return Success("退回成功!");
|
|
}
|
|
else
|
|
{
|
|
return Error(msg);
|
|
}
|
|
//return Content(app.DeleteInvTab(json));
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取物料名称、单位、规格型号
|
|
/// </summary>
|
|
/// <param name="WorkPoint"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
[HandlerAjaxOnly]
|
|
public ActionResult GetTxtInfoByPN(string RFQCODE)
|
|
{
|
|
DataTable ListData = APP.GetTxtInfoByPN(RFQCODE);
|
|
var JsonData = new
|
|
{
|
|
RFQCODE = ListData.Rows[0][0].ToString(),
|
|
RFQNAME = ListData.Rows[0][1].ToString(),
|
|
PURCHUGCODE = ListData.Rows[0][2].ToString(),
|
|
ITEMTYPE = ListData.Rows[0][3].ToString(),
|
|
PURCHUGNAME = ListData.Rows[0][4].ToString(),
|
|
PURCHUGCONECT = ListData.Rows[0][5].ToString(),
|
|
VENDORCODE = ListData.Rows[0][6].ToString(),
|
|
cVenName = ListData.Rows[0][7].ToString(),
|
|
VENDORTYPE = ListData.Rows[0][8].ToString(),
|
|
CURRENCY = ListData.Rows[0][9].ToString(),
|
|
TAXRATE = ListData.Rows[0][10].ToString(),
|
|
PAYMENTCONDITION = ListData.Rows[0][11].ToString(),
|
|
MEMO = ListData.Rows[0][12].ToString(),
|
|
COMPANYCODE = ListData.Rows[0][13].ToString(),
|
|
HASCOSTDETAILS = ListData.Rows[0][14].ToString(),
|
|
FileName = ListData.Rows[0][15].ToString(),
|
|
//AccountPeriod = ListData.Rows[0][16].ToString(),
|
|
};
|
|
return Content(JsonData.ToJson());
|
|
}
|
|
|
|
|
|
|
|
[HttpGet]
|
|
[HandlerAjaxOnly]
|
|
public ActionResult SelectOfferByPN(string RFQCODE, Pagination pagination, string WorkPoint)
|
|
{
|
|
DataTable ListData = APP.SelectOfferByPN(RFQCODE, 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 SecondGetTxtInfoByPN(string RFQCODE, string QUOTATIONCODE)
|
|
{
|
|
DataTable ListData = APP.SecondGetTxtInfoByPN(RFQCODE, QUOTATIONCODE);
|
|
var JsonData = new
|
|
{
|
|
rows = ListData,
|
|
};
|
|
return Content(JsonData.ToJson());
|
|
}
|
|
|
|
[HttpGet]
|
|
[HandlerAjaxOnly]
|
|
public ActionResult SecondSelectOfferByPN(string RFQCODE, string QUOTATIONCODE, Pagination pagination)
|
|
{
|
|
DataTable ListData = APP.SecondSelectOfferByPN(RFQCODE, QUOTATIONCODE, ref pagination);
|
|
var JsonData = new
|
|
{
|
|
total = pagination.total,
|
|
page = pagination.page,
|
|
records = pagination.records,
|
|
rows = ListData,
|
|
};
|
|
return Content(JsonData.ToJson());
|
|
}
|
|
|
|
public ActionResult GetGridJson(Pagination pagination, String JSON)
|
|
{
|
|
DataTable table = APP.GetGridJson(JSON, ref pagination);
|
|
var JsonData = new
|
|
{
|
|
total = pagination.total,
|
|
page = pagination.page,
|
|
records = pagination.records,
|
|
rows = table
|
|
};
|
|
return Content(JsonData.ToJson());
|
|
|
|
}
|
|
|
|
#region 查询技术部需求单列表
|
|
public ActionResult GetGridJsonICSSORRFQRequestFrom(Pagination pagination, String JSON)
|
|
{
|
|
DataTable table = APP.GetGridJsonICSSORRFQRequestFrom(JSON, ref pagination);
|
|
var JsonData = new
|
|
{
|
|
total = pagination.total,
|
|
page = pagination.page,
|
|
records = pagination.records,
|
|
rows = table
|
|
};
|
|
return Content(JsonData.ToJson());
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 查询技术部需求单列表(子表)
|
|
[HttpGet]
|
|
[HandlerAjaxOnly]
|
|
public ActionResult GetSubGridJsonICSSORRFQRequestFrom(string RFQCODE, Pagination pagination, string WorkPoint)
|
|
{
|
|
DataTable ListData = APP.GetSubGridJsonICSSORRFQRequestFrom(RFQCODE, ref pagination, WorkPoint);
|
|
var JsonData = new
|
|
{
|
|
total = pagination.total,
|
|
page = pagination.page,
|
|
records = pagination.records,
|
|
rows = ListData,
|
|
};
|
|
return Content(JsonData.ToJson());
|
|
}
|
|
#endregion
|
|
|
|
#region 技术部发布申请单
|
|
public ActionResult JSPublish(string json)
|
|
{
|
|
return Content(APP.JSPublish(json));
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 删除技术申请单
|
|
public ActionResult DELETEICSSORRFQRequestFrom(string json)
|
|
{
|
|
return Content(APP.DELETEICSSORRFQRequestFrom(json));
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 生成申请单号
|
|
public ActionResult GetSercodeICSSORRFQRequestFrom(string workpoint)
|
|
{
|
|
|
|
string sercode = APP.GetSercodeICSSORRFQRequestFrom(workpoint);
|
|
return Content(sercode);
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 查询申请物料信息
|
|
public ActionResult GetInvTabICSSORRFQRequestFrom(string rfqno, Pagination pagination)
|
|
{
|
|
|
|
DataTable table = APP.GetInvTabICSSORRFQRequestFrom(rfqno);
|
|
var JsonData = new
|
|
{
|
|
total = pagination.total,
|
|
page = pagination.page,
|
|
records = pagination.records,
|
|
rows = table
|
|
};
|
|
return Content(JsonData.ToJson());
|
|
}
|
|
#endregion
|
|
|
|
#region 查询申请单主表信息,修改
|
|
public ActionResult GetICSSORRFQRequestFromrow(string rfqcode)
|
|
{
|
|
return Content(APP.GetICSSORRFQRequestFromrow(rfqcode).ToJson());
|
|
}
|
|
#endregion
|
|
|
|
#region 获取申请单附件信息
|
|
|
|
[HttpGet]
|
|
[HandlerAjaxOnly]
|
|
public ActionResult GetICSSORRFQRequestFromVenDorFile(string rfqcode)
|
|
{
|
|
DataTable ListData = APP.GetICSSORRFQRequestFromVenDorFile(rfqcode);
|
|
var JsonData = new
|
|
{
|
|
rows = ListData,
|
|
};
|
|
return Content(JsonData.ToJson());
|
|
}
|
|
#endregion
|
|
|
|
#region 删除申请的物料信息
|
|
public ActionResult DeleteInvRowICSSORRFQRequestFrom(string keyValue)
|
|
{
|
|
string msg = APP.DeleteInvRowICSSORRFQRequestFrom(keyValue);
|
|
if (string.IsNullOrEmpty(msg))
|
|
{
|
|
return Success("删除成功!");
|
|
}
|
|
else
|
|
{
|
|
return Error(msg);
|
|
}
|
|
//return Content(app.DeleteInvTab(json));
|
|
}
|
|
#endregion
|
|
|
|
#region 保存技术申请单方法
|
|
[HttpPost]
|
|
public ActionResult AddICSSORRFQRequestFromByPN(ICSSORRFQ details)
|
|
{
|
|
try
|
|
{
|
|
APP.AddICSSORRFQRequestFromByPN(details);
|
|
return Success("询报价创建成功!");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return Error(ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
public ActionResult GetInvTab(string rfqno, Pagination pagination)
|
|
{
|
|
|
|
DataTable table = APP.GetInvTable(rfqno);
|
|
var JsonData = new
|
|
{
|
|
total = pagination.total,
|
|
page = pagination.page,
|
|
records = pagination.records,
|
|
rows = table
|
|
};
|
|
return Content(JsonData.ToJson());
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取生效价格查询
|
|
/// </summary>
|
|
/// <param name="pagination">分页</param>
|
|
/// <param name="queryJson">传入过滤参数</param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
[HandlerAjaxOnly]
|
|
public ActionResult GetGridPriceByPN(Pagination pagination, string queryJson)
|
|
{
|
|
DataTable ListData = APP.GetGridPriceByPN(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 AgreeByPN(string json)
|
|
{
|
|
return Content(APP.AgreeByPN(json));
|
|
|
|
}
|
|
|
|
[HttpPost]
|
|
/// <summary>
|
|
/// 文件上传到本地
|
|
/// </summary>
|
|
public ActionResult UploadFile(string ID, string BidCode, string WorkPoint)
|
|
{
|
|
try
|
|
{
|
|
// 检查是否有文件上传
|
|
if (Request.Files.Count == 0 || Request.Files[0]?.ContentLength == 0)
|
|
{
|
|
return Json(new { error = "请选择要上传的文件" }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
var file = Request.Files[0];
|
|
var fileExtension = Path.GetExtension(file.FileName)?.ToLower();
|
|
|
|
// 验证文件类型
|
|
if (fileExtension != ".xls" && fileExtension != ".xlsx")
|
|
{
|
|
return Json(new { error = "只支持上传Excel(.xls, .xlsx)文件" }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
// 生成唯一文件名并创建保存路径
|
|
var fileName = $"{DateTime.Now:yyyyMMddHHmmss}{Guid.NewGuid()}{fileExtension}";
|
|
var uploadDirectory = Server.MapPath("~/File/UPLoadFile/");
|
|
|
|
// 确保上传目录存在
|
|
if (!Directory.Exists(uploadDirectory))
|
|
{
|
|
Directory.CreateDirectory(uploadDirectory);
|
|
}
|
|
|
|
var savePath = Path.Combine(uploadDirectory, fileName);
|
|
|
|
// 保存文件
|
|
using (var stream = new FileStream(savePath, FileMode.Create))
|
|
{
|
|
file.InputStream.CopyTo(stream);
|
|
}
|
|
|
|
// 处理上传的Excel文件
|
|
var listData = APP.SetData_PR(savePath, ID, BidCode, WorkPoint);
|
|
return Content(listData.ToJson());
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
return Error(ex.Message);
|
|
}
|
|
}
|
|
|
|
|
|
public ActionResult GetPurchasing(string VenCode)
|
|
{
|
|
string msg = APP.GetPurchasing(VenCode);
|
|
var JsonData = new
|
|
{
|
|
mass = msg,
|
|
};
|
|
return Content(JsonData.ToJson());
|
|
}
|
|
|
|
[HttpGet]
|
|
[HandlerAjaxOnly]
|
|
public ActionResult GetVenDorFileSSORByPN(string FPRFQCODE)
|
|
{
|
|
DataTable ListData = APP.GetVenDorFileSSORByPN(FPRFQCODE);
|
|
var JsonData = new
|
|
{
|
|
rows = ListData,
|
|
};
|
|
return Content(JsonData.ToJson());
|
|
}
|
|
|
|
[HttpGet]
|
|
[HandlerAjaxOnly]
|
|
public ActionResult SORRFQCourseHistoryInfoCahrsByPN(string FPRFQCODE, string workpoint, string ITEMCODE)
|
|
{
|
|
DataTable ListData = APP.SORRFQCourseHistoryInfoCahrsByPN(FPRFQCODE, workpoint, ITEMCODE);
|
|
string ss = ListData.ToJson();
|
|
return Content(ListData.ToJson());
|
|
|
|
}
|
|
|
|
[HttpGet]
|
|
[HandlerAjaxOnly]
|
|
public ActionResult GetGridMaterialByPN(Pagination pagination, string ITEMCODE, string VenCode, string FPRFQCODE)
|
|
{
|
|
DataTable ListData = APP.GetGridMaterialByPN(ref pagination, ITEMCODE, VenCode, FPRFQCODE);
|
|
var JsonData = new
|
|
{
|
|
total = pagination.total,
|
|
page = pagination.page,
|
|
records = pagination.records,
|
|
rows = ListData,
|
|
};
|
|
return Content(JsonData.ToJson());
|
|
}
|
|
|
|
|
|
[HttpPost]
|
|
[HandlerAjaxOnly]
|
|
//[ValidateAntiForgeryToken]
|
|
public ActionResult SaveQuotationByPN(string keyValue)
|
|
{
|
|
string msg = "";
|
|
|
|
msg = APP.SaveQuotationByPN(keyValue);
|
|
|
|
if (string.IsNullOrWhiteSpace(msg))
|
|
{
|
|
return Success("信息保存成功!");
|
|
}
|
|
else
|
|
{
|
|
return Error("" + msg + "");
|
|
}
|
|
}
|
|
|
|
|
|
[HttpGet]
|
|
public ActionResult GetPriceInquiryItem(string invcode, Pagination pagination, string workpoint, string InvName,string sfqcode)
|
|
{
|
|
DataTable ListData = APP.GetPriceInquiryItem(invcode, ref pagination, workpoint, InvName, sfqcode);
|
|
var JsonData = new
|
|
{
|
|
total = pagination.total,
|
|
page = pagination.page,
|
|
records = pagination.records,
|
|
rows = ListData,
|
|
};
|
|
return Content(JsonData.ToJson());
|
|
}
|
|
}
|
|
}
|