Browse Source

1. Post傳送長度與筆數放大

PTD
Ray 2 years ago
parent
commit
6a14b6ea1c
  1. 14
      AMESCoreStudio.Web/Startup.cs
  2. 6
      AMESCoreStudio.Web/Views/PCS/PCS003.cshtml
  3. 14
      AMESCoreStudio.WebApi/Startup.cs

14
AMESCoreStudio.Web/Startup.cs

@ -15,6 +15,7 @@ using System.Globalization;
using Microsoft.AspNetCore.Mvc.Razor; using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.Localization; using Microsoft.AspNetCore.Localization;
using AMESCoreStudio.Web.Code; using AMESCoreStudio.Web.Code;
using Microsoft.AspNetCore.Http.Features;
namespace AMESCoreStudio.Web namespace AMESCoreStudio.Web
{ {
@ -33,6 +34,19 @@ namespace AMESCoreStudio.Web
// ÂX¥RJSON // ÂX¥RJSON
services.AddControllers().AddNewtonsoftJson(); services.AddControllers().AddNewtonsoftJson();
// FormPost數量上限
services.Configure<FormOptions>(options =>
{
options.ValueLengthLimit = 209715200;
options.ValueCountLimit = int.MaxValue;
});
// ModelBinding筆數上限
services.AddMvc(options =>
{
options.MaxModelBindingCollectionSize = int.MaxValue;
});
// Àɮץؿý // Àɮץؿý
//Add our IFileServerProvider implementation as a singleton //Add our IFileServerProvider implementation as a singleton
//services.AddSingleton<IFileServerProvider>(new FileServerProvider( //services.AddSingleton<IFileServerProvider>(new FileServerProvider(

6
AMESCoreStudio.Web/Views/PCS/PCS003.cshtml

@ -1230,7 +1230,6 @@
return; return;
} }
console.log(wipShcDate);
if (lotNo == '' || !lotNo) { if (lotNo == '' || !lotNo) {
lotNo = getLotNo(); lotNo = getLotNo();
@ -1431,7 +1430,6 @@
var Path = $(obj).closest("TR").find('span[id*=Filepath]').text(); var Path = $(obj).closest("TR").find('span[id*=Filepath]').text();
var FileName = $(obj).closest("TR").find('span[id*=FileName]').text(); var FileName = $(obj).closest("TR").find('span[id*=FileName]').text();
filePath = `/PCS/FileDownload?Path=${Path}&FileName=${FileName}`; filePath = `/PCS/FileDownload?Path=${Path}&FileName=${FileName}`;
console.log(filePath);
$(obj).attr("href", filePath); $(obj).attr("href", filePath);
}; };
@ -1823,7 +1821,7 @@
if (result.success) { if (result.success) {
let No = 0; let No = 0;
var Unit = getFactoryUnitByWipNoList(); var Unit = getFactoryUnitByWipNoList();
var item = getItemsList(); var Kpitem = getItemsList();
$("#KPTable").find("tr:not(:first)").remove(); $("#KPTable").find("tr:not(:first)").remove();
$.each(result.data, function (index, item) { $.each(result.data, function (index, item) {
var FactoryUnit = Unit; var FactoryUnit = Unit;
@ -1834,7 +1832,7 @@
} }
}); });
Select += '</select>'; Select += '</select>';
var Items = item; var Items = Kpitem;
var SelectKPNo = "<select id=WipKps[" + No + "].KpNo name=WipKps[" + No + "].KpNo>"; var SelectKPNo = "<select id=WipKps[" + No + "].KpNo name=WipKps[" + No + "].KpNo>";
$.each(Items, function (index, item2) { $.each(Items, function (index, item2) {
if (item2.value == item.kpNo) { if (item2.value == item.kpNo) {

14
AMESCoreStudio.WebApi/Startup.cs

@ -17,6 +17,7 @@ using Swashbuckle.AspNetCore.Swagger;
using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Serialization;
using Microsoft.AspNetCore.Http.Features;
namespace AMESCoreStudio.WebApi namespace AMESCoreStudio.WebApi
{ {
@ -99,6 +100,19 @@ namespace AMESCoreStudio.WebApi
options.SerializerSettings.ContractResolver = CustomContractResolver.Instance; options.SerializerSettings.ContractResolver = CustomContractResolver.Instance;
}); });
// FormPost數量上限
services.Configure<FormOptions>(options =>
{
options.ValueLengthLimit = 209715200;
options.ValueCountLimit = int.MaxValue;
});
// ModelBinding筆數上限
services.AddMvc(options =>
{
options.MaxModelBindingCollectionSize = int.MaxValue;
});
//services.AddControllers().AddJsonOptions(x => //services.AddControllers().AddJsonOptions(x =>
// x.JsonSerializerOptions..ReferenceHandler = ReferenceHandler.Preserve.Ignore); // x.JsonSerializerOptions..ReferenceHandler = ReferenceHandler.Preserve.Ignore);
//services.AddControllers().AddNewtonsoftJson(x => //services.AddControllers().AddNewtonsoftJson(x =>

Loading…
Cancel
Save