29 changed files with 2123 additions and 66 deletions
@ -0,0 +1,90 @@ |
|||
@{ |
|||
ViewData["Title"] = "不良現象群組維護"; |
|||
Layout = "~/Views/Shared/_AMESLayout.cshtml"; |
|||
} |
|||
|
|||
<div class="layui-card"> |
|||
<div class="layui-card-header"> |
|||
<div class="layui-form"> |
|||
<div class="layui-form-item "> |
|||
<div class="layui-inline"><i class="fa fa-file-text-o fa-fw"></i> @ViewBag.Title</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="layui-card-body"> |
|||
<table class="layui-hide" id="test" lay-filter="test"></table> |
|||
</div> |
|||
</div> |
|||
|
|||
@section Scripts{ |
|||
<script type="text/javascript"> |
|||
//监听表单提交事件 |
|||
hg.form.onsubmit('querysubmit', function (data) { |
|||
table && table.reload(data); |
|||
}); |
|||
var tableCols = [[ |
|||
{ |
|||
field: 'ngGroupNo', |
|||
width: 200, |
|||
title: '不良現象群組代碼' |
|||
}, |
|||
{ |
|||
field: 'ngGroupName', |
|||
title: '不良現象群組名稱' |
|||
}, |
|||
{ |
|||
field: 'right', |
|||
width: 200, |
|||
title: '操作', |
|||
fixed: 'right', |
|||
templet: function (d) { |
|||
return '<a class="layui-btn layui-btn-normal layui-btn-xs layui-icon layui-icon-edit" lay-event="edit">修改</a> <a class="layui-btn layui-btn-danger layui-btn-xs layui-icon layui-icon-delete" lay-event="del">删除</a>' |
|||
} |
|||
}] |
|||
]; |
|||
|
|||
//通过行tool编辑,lay-event="edit" |
|||
function edit(obj) { |
|||
if (obj.data.ngGroupNo) { |
|||
hg.open('修改不良現象群組', '/PPS/PPS008U/' + obj.data.ngGroupNo, 800,320); |
|||
} |
|||
} |
|||
|
|||
//通过行tool删除,lay-event="del" |
|||
function del(obj) { |
|||
if (obj.data.ngGroupNo) { |
|||
hg.confirm("不良現象群組:" + obj.data.ngGroupName + ",确定要删除吗?", function () { |
|||
$.ajax({ |
|||
url: '/PPS/PPS008D', |
|||
data: { id: obj.data.ngGroupNo }, |
|||
type: 'POST', |
|||
success: function (data) { |
|||
if (data.success) { |
|||
obj.del(); //只删本地数据 |
|||
hg.msghide("删除成功!"); |
|||
} |
|||
else { |
|||
hg.msg(data.msg); |
|||
} |
|||
}, |
|||
error: function () { |
|||
hg.msg("网络请求失败!"); |
|||
} |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
var toolbar = [{ |
|||
text: '新增', |
|||
layuiicon: '', |
|||
class: 'layui-btn-normal', |
|||
handler: function () { |
|||
hg.open('新增不良現象群組', '/PPS/PPS008C', 800, 320); |
|||
|
|||
} |
|||
} |
|||
]; |
|||
//基本数据表格 |
|||
var table = hg.table.datatable('test', '不良現象群組維護', '/PPS/GetNGGroups', {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); |
|||
</script> |
|||
} |
@ -0,0 +1,53 @@ |
|||
@model AMESCoreStudio.WebApi.Models.AMES.NGGroup |
|||
|
|||
|
|||
@{ ViewData["Title"] = "PPS008C"; |
|||
Layout = "~/Views/Shared/_FormLayout.cshtml"; } |
|||
|
|||
|
|||
<style> |
|||
.control-label { |
|||
justify-content: flex-end !important; |
|||
} |
|||
</style> |
|||
|
|||
<div class="row"> |
|||
<div class="col-sm-12"> |
|||
<form enctype="multipart/form-data" method="post" asp-action="PPS008CSave"> |
|||
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
|||
|
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="NGGroupNo" class="control-label col-sm-3"></label> |
|||
<input asp-for="NGGroupNo" class="form-control col-sm-9" placeholder="請輸入不良現象群組代碼" /> |
|||
<span asp-validation-for="NGGroupNo" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="NGGroupName" class="control-label col-sm-3"></label> |
|||
<input asp-for="NGGroupName" class="form-control col-sm-9" placeholder="請輸入不良現象群組名稱" /> |
|||
<span asp-validation-for="NGGroupName" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<span style="color: firebrick;word-break: break-all;" class="text-danger offset-sm-3">@Html.ValidationMessage("error")</span> |
|||
<div class="form-group"> |
|||
<input type="submit" value="保存" class="btn btn-primary offset-sm-3" /> |
|||
</div> |
|||
|
|||
</form> |
|||
</div> |
|||
</div> |
|||
|
|||
@section Scripts { |
|||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); |
|||
await Html.RenderPartialAsync("_FileinputScriptsPartial"); } |
|||
|
|||
<script type="text/javascript"> |
|||
$(document).ready(function () { |
|||
var error = '@Html.ValidationMessage("error")'; |
|||
if ($(error).text() != '') { |
|||
parent.hg.msg(error); |
|||
} |
|||
}); |
|||
</script> |
|||
|
|||
|
|||
} |
|||
|
@ -0,0 +1,53 @@ |
|||
@model AMESCoreStudio.WebApi.Models.AMES.NGGroup |
|||
|
|||
|
|||
@{ ViewData["Title"] = "PPS008U"; |
|||
Layout = "~/Views/Shared/_FormLayout.cshtml"; } |
|||
|
|||
|
|||
<style> |
|||
.control-label { |
|||
justify-content: flex-end !important; |
|||
} |
|||
</style> |
|||
|
|||
<div class="row"> |
|||
<div class="col-sm-12"> |
|||
<form enctype="multipart/form-data" method="post" asp-action="PPS008USave"> |
|||
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
|||
|
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="NGGroupNo" class="control-label col-sm-3"></label> |
|||
<input asp-for="NGGroupNo" class="form-control col-sm-9" readonly="readonly" /> |
|||
<span asp-validation-for="NGGroupNo" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="NGGroupName" class="control-label col-sm-3"></label> |
|||
<input asp-for="NGGroupName" class="form-control col-sm-9" placeholder="請輸入不良現象群組名稱" /> |
|||
<span asp-validation-for="NGGroupName" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<span style="color: firebrick;word-break: break-all;" class="text-danger offset-sm-3">@Html.ValidationMessage("error")</span> |
|||
<div class="form-group"> |
|||
<input type="submit" value="保存" class="btn btn-primary offset-sm-3" /> |
|||
</div> |
|||
|
|||
</form> |
|||
</div> |
|||
</div> |
|||
|
|||
@section Scripts { |
|||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); |
|||
await Html.RenderPartialAsync("_FileinputScriptsPartial"); } |
|||
|
|||
<script type="text/javascript"> |
|||
$(document).ready(function () { |
|||
var error = '@Html.ValidationMessage("error")'; |
|||
if ($(error).text() != '') { |
|||
parent.hg.msg(error); |
|||
} |
|||
}); |
|||
</script> |
|||
|
|||
|
|||
} |
|||
|
@ -0,0 +1,124 @@ |
|||
@{ |
|||
ViewData["Title"] = "不良現象類別維護"; |
|||
Layout = "~/Views/Shared/_AMESLayout.cshtml"; |
|||
} |
|||
|
|||
<div class="layui-card"> |
|||
<div class="layui-card-header"> |
|||
<div class="layui-form"> |
|||
<div class="layui-form-item "> |
|||
<div class="layui-inline"><i class="fa fa-file-text-o fa-fw"></i> @ViewBag.Title</div> |
|||
</div> |
|||
<div class="layui-form-item layui-layout-left"> |
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">請選擇群組</label> |
|||
<div class="layui-input-inline"> |
|||
<select id="ngGroup" lay-filter="ngGroup" lay-verify="required" lay-submit asp-items="@ViewBag.NGGroupList"> |
|||
<option value="*">全部</option> |
|||
</select> |
|||
</div> |
|||
<input id="ngGroupNo" type="hidden" name="ngGroupNo" value="*" /> |
|||
</div> |
|||
<div class="layui-inline layui-show-xs-block"> |
|||
<button class="layui-btn layui-btn-sm layui-btn-normal" lay-submit lay-filter="querysubmit"> |
|||
<i class="layui-icon layui-icon-sm"></i> |
|||
</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="layui-card-body"> |
|||
<table class="layui-hide" id="test" lay-filter="test"></table> |
|||
</div> |
|||
</div> |
|||
|
|||
@section Scripts{ |
|||
<script type="text/javascript"> |
|||
|
|||
layui.use(['form', 'layer'], function () { |
|||
form = layui.form; |
|||
|
|||
form.on('select(ngGroup)', function (data) { |
|||
$("#ngGroupNo").val(data.value); |
|||
|
|||
var qs = $('button[lay-filter="querysubmit"]'); |
|||
qs.click(); |
|||
}); |
|||
}); |
|||
|
|||
//监听表单提交事件 |
|||
hg.form.onsubmit('querysubmit', function (data) { |
|||
table && table.reload(data); |
|||
}); |
|||
var tableCols = [[ |
|||
{ |
|||
field: 'ngClassNo', |
|||
width: 200, |
|||
title: '不良現象類別代碼' |
|||
}, |
|||
{ |
|||
field: 'ngGroupNo', |
|||
width: 200, |
|||
title: '不良現象群組代碼' |
|||
}, |
|||
{ |
|||
field: 'ngClassName', |
|||
title: '不良現象類別名稱' |
|||
}, |
|||
{ |
|||
field: 'right', |
|||
width: 200, |
|||
title: '操作', |
|||
fixed: 'right', |
|||
templet: function (d) { |
|||
return '<a class="layui-btn layui-btn-normal layui-btn-xs layui-icon layui-icon-edit" lay-event="edit">修改</a> <a class="layui-btn layui-btn-danger layui-btn-xs layui-icon layui-icon-delete" lay-event="del">删除</a>' |
|||
} |
|||
}] |
|||
]; |
|||
|
|||
//通过行tool编辑,lay-event="edit" |
|||
function edit(obj) { |
|||
if (obj.data.ngClassNo) { |
|||
hg.open('修改不良現象類別', '/PPS/PPS009U/' + obj.data.ngClassNo, 800,320); |
|||
} |
|||
} |
|||
|
|||
//通过行tool删除,lay-event="del" |
|||
function del(obj) { |
|||
if (obj.data.ngClassNo) { |
|||
hg.confirm("不良現象類別:" + obj.data.ngClassName + ",确定要删除吗?", function () { |
|||
$.ajax({ |
|||
url: '/PPS/PPS009D', |
|||
data: { id: obj.data.ngClassNo }, |
|||
type: 'POST', |
|||
success: function (data) { |
|||
if (data.success) { |
|||
obj.del(); //只删本地数据 |
|||
hg.msghide("删除成功!"); |
|||
} |
|||
else { |
|||
hg.msg(data.msg); |
|||
} |
|||
}, |
|||
error: function () { |
|||
hg.msg("网络请求失败!"); |
|||
} |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
var toolbar = [{ |
|||
text: '新增', |
|||
layuiicon: '', |
|||
class: 'layui-btn-normal', |
|||
handler: function () { |
|||
var id = ngGroupNo.value; |
|||
hg.open('新增不良現象類別', '/PPS/PPS009C/' + id, 800, 320); |
|||
|
|||
} |
|||
} |
|||
]; |
|||
//基本数据表格 |
|||
var table = hg.table.datatable('test', '不良現象類別維護', '/PPS/GetNGClassesByGroup/' + ngGroupNo.value, {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); |
|||
</script> |
|||
} |
@ -0,0 +1,58 @@ |
|||
@model AMESCoreStudio.WebApi.Models.AMES.NGClass |
|||
|
|||
|
|||
@{ ViewData["Title"] = "PPS009C"; |
|||
Layout = "~/Views/Shared/_FormLayout.cshtml"; } |
|||
|
|||
|
|||
<style> |
|||
.control-label { |
|||
justify-content: flex-end !important; |
|||
} |
|||
</style> |
|||
|
|||
<div class="row"> |
|||
<div class="col-sm-12"> |
|||
<form enctype="multipart/form-data" method="post" asp-action="PPS009CSave"> |
|||
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
|||
|
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="NGClassNo" class="control-label col-sm-3"></label> |
|||
<input asp-for="NGClassNo" class="form-control col-sm-9" placeholder="請輸入不良現象類別代碼" /> |
|||
<span asp-validation-for="NGClassNo" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="NGGroupNo" class="control-label col-sm-3"></label> |
|||
<select asp-for="NGGroupNo" asp-items="@ViewBag.NGGroupList" class="custom-select col-sm-9"></select> |
|||
<span asp-validation-for="NGGroupNo" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="NGClassName" class="control-label col-sm-3"></label> |
|||
<input asp-for="NGClassName" class="form-control col-sm-9" placeholder="請輸入不良現象類別名稱" /> |
|||
<span asp-validation-for="NGClassName" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<span style="color: firebrick;word-break: break-all;" class="text-danger offset-sm-3">@Html.ValidationMessage("error")</span> |
|||
<div class="form-group"> |
|||
<input type="submit" value="保存" class="btn btn-primary offset-sm-3" /> |
|||
</div> |
|||
|
|||
</form> |
|||
</div> |
|||
</div> |
|||
|
|||
@section Scripts { |
|||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); |
|||
await Html.RenderPartialAsync("_FileinputScriptsPartial"); } |
|||
|
|||
<script type="text/javascript"> |
|||
$(document).ready(function () { |
|||
var error = '@Html.ValidationMessage("error")'; |
|||
if ($(error).text() != '') { |
|||
parent.hg.msg(error); |
|||
} |
|||
}); |
|||
</script> |
|||
|
|||
|
|||
} |
|||
|
@ -0,0 +1,58 @@ |
|||
@model AMESCoreStudio.WebApi.Models.AMES.NGClass |
|||
|
|||
|
|||
@{ ViewData["Title"] = "PPS009U"; |
|||
Layout = "~/Views/Shared/_FormLayout.cshtml"; } |
|||
|
|||
|
|||
<style> |
|||
.control-label { |
|||
justify-content: flex-end !important; |
|||
} |
|||
</style> |
|||
|
|||
<div class="row"> |
|||
<div class="col-sm-12"> |
|||
<form enctype="multipart/form-data" method="post" asp-action="PPS009USave"> |
|||
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
|||
|
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="NGClassNo" class="control-label col-sm-3"></label> |
|||
<input asp-for="NGClassNo" class="form-control col-sm-9" placeholder="請輸入不良現象類別代碼" readonly="readonly" /> |
|||
<span asp-validation-for="NGClassNo" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="NGGroupNo" class="control-label col-sm-3"></label> |
|||
<select asp-for="NGGroupNo" asp-items="@ViewBag.NGGroupList" class="custom-select col-sm-9"></select> |
|||
<span asp-validation-for="NGGroupNo" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="NGClassName" class="control-label col-sm-3"></label> |
|||
<input asp-for="NGClassName" class="form-control col-sm-9" placeholder="請輸入不良現象類別名稱" /> |
|||
<span asp-validation-for="NGClassName" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<span style="color: firebrick;word-break: break-all;" class="text-danger offset-sm-3">@Html.ValidationMessage("error")</span> |
|||
<div class="form-group"> |
|||
<input type="submit" value="保存" class="btn btn-primary offset-sm-3" /> |
|||
</div> |
|||
|
|||
</form> |
|||
</div> |
|||
</div> |
|||
|
|||
@section Scripts { |
|||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); |
|||
await Html.RenderPartialAsync("_FileinputScriptsPartial"); } |
|||
|
|||
<script type="text/javascript"> |
|||
$(document).ready(function () { |
|||
var error = '@Html.ValidationMessage("error")'; |
|||
if ($(error).text() != '') { |
|||
parent.hg.msg(error); |
|||
} |
|||
}); |
|||
</script> |
|||
|
|||
|
|||
} |
|||
|
@ -0,0 +1,169 @@ |
|||
@{ |
|||
ViewData["Title"] = "不良現象原因維護"; |
|||
Layout = "~/Views/Shared/_AMESLayout.cshtml"; |
|||
} |
|||
|
|||
<div class="layui-card"> |
|||
<div class="layui-card-header"> |
|||
<div class="layui-form"> |
|||
<div class="layui-form-item "> |
|||
<div class="layui-inline"><i class="fa fa-file-text-o fa-fw"></i> @ViewBag.Title</div> |
|||
</div> |
|||
<div class="layui-form-item layui-layout-left"> |
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">請選擇群組</label> |
|||
<div class="layui-input-inline"> |
|||
<select id="ngGroup" lay-filter="ngGroup" lay-verify="required" lay-submit asp-items="@ViewBag.NGGroupList"> |
|||
<option value="*">全部</option> |
|||
</select> |
|||
</div> |
|||
<input id="ngGroupNo" type="hidden" name="ngGroupNo" value="*" /> |
|||
<label class="layui-form-label">請選擇類別</label> |
|||
<div class="layui-input-inline"> |
|||
<select id="ngClass" lay-filter="ngClass" lay-verify="required" lay-submit asp-items="@ViewBag.NGClassList" > |
|||
<option value="*">全部</option> |
|||
</select> |
|||
</div> |
|||
<input id="ngClassNo" type="hidden" name="ngClassNo" value="*" /> |
|||
</div> |
|||
<div class="layui-inline layui-show-xs-block"> |
|||
<button class="layui-btn layui-btn-sm layui-btn-normal" lay-submit lay-filter="querysubmit"> |
|||
<i class="layui-icon layui-icon-sm"></i> |
|||
</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="layui-card-body"> |
|||
<table class="layui-hide" id="test" lay-filter="test"></table> |
|||
</div> |
|||
</div> |
|||
|
|||
@section Scripts{ |
|||
<script type="text/javascript"> |
|||
|
|||
function getNGClassList(data) |
|||
{ |
|||
$.ajax( |
|||
{ |
|||
url: "@Url.Action("GetNGClassJson", "PPS")", |
|||
dataType: 'json', |
|||
data: { "group_no": $("#ngGroupNo").val()}, |
|||
//contentType: "application/json", |
|||
type: 'post', |
|||
success: function (result) |
|||
{ |
|||
console.info(result.data); |
|||
$("#ngClass").empty();//清空下拉框的值 |
|||
$.each(result.data, function (index, item) { |
|||
$("#ngClass").append(new Option(item.text, item.value));// 下拉菜单里添加元素 |
|||
//$("#errorClass").append($("<option>").text(item.text).val(item.value)) |
|||
}); |
|||
|
|||
layui.form.render("select");//重新渲染 固定写法 |
|||
}, |
|||
error: function (result) |
|||
{ |
|||
alert(result); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
layui.use(['form', 'layer'], function () { |
|||
form = layui.form; |
|||
|
|||
form.on('select(ngGroup)', function (data) { |
|||
$("#ngGroupNo").val(data.value); |
|||
|
|||
getNGClassList(data.value); |
|||
|
|||
var qs = $('button[lay-filter="querysubmit"]'); |
|||
qs.click(); |
|||
}); |
|||
|
|||
form.on('select(ngClass)', function (data) { |
|||
$("#ngClassNo").val(data.value); |
|||
|
|||
var qs = $('button[lay-filter="querysubmit"]'); |
|||
qs.click(); |
|||
}); |
|||
}); |
|||
|
|||
//监听表单提交事件 |
|||
hg.form.onsubmit('querysubmit', function (data) { |
|||
table && table.reload(data); |
|||
}); |
|||
var tableCols = [[ |
|||
{ |
|||
field: 'ngReasonNo', |
|||
width: 200, |
|||
title: '不良現象原因代碼' |
|||
}, |
|||
{ |
|||
field: 'ngReasonDesc', |
|||
width: 400, |
|||
title: '不良現象原因描述' |
|||
}, |
|||
{ |
|||
field: 'ngReasonDescEn', |
|||
title: '不良現象原因英文描述' |
|||
}, |
|||
{ |
|||
field: 'right', |
|||
width: 200, |
|||
title: '操作', |
|||
fixed: 'right', |
|||
templet: function (d) { |
|||
return '<a class="layui-btn layui-btn-normal layui-btn-xs layui-icon layui-icon-edit" lay-event="edit">修改</a> <a class="layui-btn layui-btn-danger layui-btn-xs layui-icon layui-icon-delete" lay-event="del">删除</a>' |
|||
} |
|||
}] |
|||
]; |
|||
|
|||
//通过行tool编辑,lay-event="edit" |
|||
function edit(obj) { |
|||
if (obj.data.ngReasonNo) { |
|||
var no = ngGroupNo.value; |
|||
hg.open('修改不良現象原因', '/PPS/PPS010U/' + obj.data.ngReasonNo + ',' + no, 800, 640); |
|||
} |
|||
} |
|||
|
|||
//通过行tool删除,lay-event="del" |
|||
function del(obj) { |
|||
if (obj.data.ngReasonNo) { |
|||
hg.confirm("不良現象原因:" + obj.data.ngReasonDesc + ",确定要删除吗?", function () { |
|||
$.ajax({ |
|||
url: '/PPS/PPS010D', |
|||
data: { id: obj.data.ngReasonNo }, |
|||
type: 'POST', |
|||
success: function (data) { |
|||
if (data.success) { |
|||
obj.del(); //只删本地数据 |
|||
hg.msghide("删除成功!"); |
|||
} |
|||
else { |
|||
hg.msg(data.msg); |
|||
} |
|||
}, |
|||
error: function () { |
|||
hg.msg("网络请求失败!"); |
|||
} |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
var toolbar = [{ |
|||
text: '新增', |
|||
layuiicon: '', |
|||
class: 'layui-btn-normal', |
|||
handler: function () { |
|||
var id = ngClassNo.value; |
|||
var no = ngGroupNo.value; |
|||
hg.open('新增不良現象原因', '/PPS/PPS010C/' + id + ',' + no, 800, 640); |
|||
|
|||
} |
|||
} |
|||
]; |
|||
//基本数据表格 |
|||
var table = hg.table.datatable('test', '不良現象原因維護', '/PPS/GetNGReasonsByClass/' + ngClassNo.value, {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); |
|||
</script> |
|||
} |
@ -0,0 +1,68 @@ |
|||
@model AMESCoreStudio.WebApi.Models.AMES.NGReason |
|||
|
|||
|
|||
@{ ViewData["Title"] = "PPS010C"; |
|||
Layout = "~/Views/Shared/_FormLayout.cshtml"; } |
|||
|
|||
|
|||
<style> |
|||
.control-label { |
|||
justify-content: flex-end !important; |
|||
} |
|||
</style> |
|||
|
|||
<div class="row"> |
|||
<div class="col-sm-12"> |
|||
<form enctype="multipart/form-data" method="post" asp-action="PPS010CSave"> |
|||
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
|||
|
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="NGReasonNo" class="control-label col-sm-3"></label> |
|||
<input asp-for="NGReasonNo" class="form-control col-sm-9" placeholder="請輸入不良現象原因代碼" /> |
|||
<span asp-validation-for="NGReasonNo" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="NGClassNo" class="control-label col-sm-3"></label> |
|||
<select asp-for="NGClassNo" asp-items="@ViewBag.NGClassList" class="custom-select col-sm-9"></select> |
|||
<span asp-validation-for="NGClassNo" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="NGReasonDesc" class="control-label col-sm-3"></label> |
|||
<input asp-for="NGReasonDesc" class="form-control col-sm-9" placeholder="請輸入不良現象原因描述" /> |
|||
<span asp-validation-for="NGReasonDesc" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="NGReasonDescEn" class="control-label col-sm-3"></label> |
|||
<input asp-for="NGReasonDescEn" class="form-control col-sm-9" placeholder="請輸入不良現象原因英文描述" /> |
|||
<span asp-validation-for="NGReasonDescEn" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="ResponseDept" class="control-label col-sm-3"></label> |
|||
<select asp-for="ResponseDept" asp-items="@ViewBag.ResponseDeptList" class="custom-select col-sm-9"></select> |
|||
<span asp-validation-for="ResponseDept" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<span style="color: firebrick;word-break: break-all;" class="text-danger offset-sm-3">@Html.ValidationMessage("error")</span> |
|||
<div class="form-group"> |
|||
<input type="submit" value="保存" class="btn btn-primary offset-sm-3" /> |
|||
</div> |
|||
|
|||
</form> |
|||
</div> |
|||
</div> |
|||
|
|||
@section Scripts { |
|||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); |
|||
await Html.RenderPartialAsync("_FileinputScriptsPartial"); } |
|||
|
|||
<script type="text/javascript"> |
|||
$(document).ready(function () { |
|||
var error = '@Html.ValidationMessage("error")'; |
|||
if ($(error).text() != '') { |
|||
parent.hg.msg(error); |
|||
} |
|||
}); |
|||
</script> |
|||
|
|||
|
|||
} |
|||
|
@ -0,0 +1,68 @@ |
|||
@model AMESCoreStudio.WebApi.Models.AMES.NGReason |
|||
|
|||
|
|||
@{ ViewData["Title"] = "PPS007U"; |
|||
Layout = "~/Views/Shared/_FormLayout.cshtml"; } |
|||
|
|||
|
|||
<style> |
|||
.control-label { |
|||
justify-content: flex-end !important; |
|||
} |
|||
</style> |
|||
|
|||
<div class="row"> |
|||
<div class="col-sm-12"> |
|||
<form enctype="multipart/form-data" method="post" asp-action="PPS010USave"> |
|||
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
|||
|
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="NGReasonNo" class="control-label col-sm-3"></label> |
|||
<input asp-for="NGReasonNo" class="form-control col-sm-9" placeholder="請輸入不良現象原因代碼" readonly="readonly" /> |
|||
<span asp-validation-for="NGReasonNo" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="NGClassNo" class="control-label col-sm-3"></label> |
|||
<select asp-for="NGClassNo" asp-items="@ViewBag.NGClassList" class="custom-select col-sm-9"></select> |
|||
<span asp-validation-for="NGClassNo" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="NGReasonDesc" class="control-label col-sm-3"></label> |
|||
<input asp-for="NGReasonDesc" class="form-control col-sm-9" placeholder="請輸入不良現象原因描述" /> |
|||
<span asp-validation-for="NGReasonDesc" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="NGReasonDescEn" class="control-label col-sm-3"></label> |
|||
<input asp-for="NGReasonDescEn" class="form-control col-sm-9" placeholder="請輸入不良現象原因英文描述" /> |
|||
<span asp-validation-for="NGReasonDescEn" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="ResponseDept" class="control-label col-sm-3"></label> |
|||
<select asp-for="ResponseDept" asp-items="@ViewBag.ResponseDeptList" class="custom-select col-sm-9"></select> |
|||
<span asp-validation-for="ResponseDept" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<span style="color: firebrick;word-break: break-all;" class="text-danger offset-sm-3">@Html.ValidationMessage("error")</span> |
|||
<div class="form-group"> |
|||
<input type="submit" value="保存" class="btn btn-primary offset-sm-3" /> |
|||
</div> |
|||
|
|||
</form> |
|||
</div> |
|||
</div> |
|||
|
|||
@section Scripts { |
|||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); |
|||
await Html.RenderPartialAsync("_FileinputScriptsPartial"); } |
|||
|
|||
<script type="text/javascript"> |
|||
$(document).ready(function () { |
|||
var error = '@Html.ValidationMessage("error")'; |
|||
if ($(error).text() != '') { |
|||
parent.hg.msg(error); |
|||
} |
|||
}); |
|||
</script> |
|||
|
|||
|
|||
} |
|||
|
@ -0,0 +1,225 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Http; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using AMESCoreStudio.WebApi; |
|||
using AMESCoreStudio.WebApi.Models.AMES; |
|||
using AMESCoreStudio.CommonTools.Result; |
|||
|
|||
namespace AMESCoreStudio.WebApi.Controllers.AMES |
|||
{ |
|||
/// <summary>
|
|||
/// 不良現象類別維護
|
|||
/// </summary>
|
|||
[Route("api/[controller]")]
|
|||
[ApiController] |
|||
public class NGClassesController : ControllerBase |
|||
{ |
|||
private readonly AMESContext _context; |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="context"></param>
|
|||
public NGClassesController(AMESContext context) |
|||
{ |
|||
_context = context; |
|||
} |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
// GET: api/NGClasses
|
|||
[HttpGet] |
|||
public async Task<ActionResult<IEnumerable<NGClass>>> GetNGClass() |
|||
{ |
|||
IQueryable<NGClass> q = _context.NGClasses; |
|||
q = q.OrderBy(p => p.NGClassNo); |
|||
|
|||
var ngClass = await q.ToListAsync(); |
|||
|
|||
return ngClass; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 根据不良現象群組代碼NO獲取該群組不良現象類別資料
|
|||
/// </summary>
|
|||
/// <param name="no"></param>
|
|||
/// <param name="page"></param>
|
|||
/// <param name="limit"></param>
|
|||
/// <returns></returns>
|
|||
// GET: api/NGClasses/Group/S
|
|||
[HttpGet("Group/{no}")] |
|||
public async Task<ActionResult<IEnumerable<NGClass>>> GetNGClassByGroup(string no, int page = 1, int limit = 10) |
|||
{ |
|||
IQueryable<NGClass> q = _context.NGClasses; |
|||
|
|||
if (no != null) |
|||
{ |
|||
if (no != "*") |
|||
{ |
|||
q = q.Where(p => p.NGGroupNo.Equals(no)); |
|||
} |
|||
} |
|||
|
|||
if (page > 0) |
|||
{ |
|||
q = q.OrderBy(p => p.NGGroupNo + p.NGClassNo).Skip((page - 1) * limit).Take(limit); |
|||
} |
|||
else |
|||
{ |
|||
q = q.OrderBy(p => p.NGGroupNo + p.NGClassNo); |
|||
} |
|||
|
|||
var ngClass = await q.ToListAsync(); |
|||
|
|||
if (ngClass == null) |
|||
{ |
|||
return NotFound(); |
|||
} |
|||
|
|||
return ngClass; |
|||
} |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <returns></returns>
|
|||
// GET: api/NGClasses/5
|
|||
[HttpGet("{id}")] |
|||
public async Task<ActionResult<IEnumerable<NGClass>>> GetNGClass(string id) |
|||
{ |
|||
IQueryable<NGClass> q = _context.NGClasses; |
|||
q = q.Where(p => p.NGClassNo.Equals(id)); |
|||
|
|||
var ngClass = await q.ToListAsync(); |
|||
|
|||
if (ngClass == null) |
|||
{ |
|||
return NotFound(); |
|||
} |
|||
|
|||
return ngClass; |
|||
} |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <param name="nGClass"></param>
|
|||
/// <returns></returns>
|
|||
// PUT: api/NGClasses/5
|
|||
// To protect from overposting attacks, enable the specific properties you want to bind to, for
|
|||
// more details, see https://go.microsoft.com/fwlink/?linkid=2123754.
|
|||
[HttpPut("{id}")] |
|||
public async Task<ResultModel<NGClass>> PutNGClass(string id, [FromBody] NGClass nGClass) |
|||
{ |
|||
ResultModel<NGClass> result = new ResultModel<NGClass>(); |
|||
|
|||
if (id != nGClass.NGClassNo) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = "类别代碼錯誤"; |
|||
return result; |
|||
} |
|||
|
|||
_context.Entry(nGClass).State = EntityState.Modified; |
|||
|
|||
try |
|||
{ |
|||
await _context.SaveChangesAsync(); |
|||
} |
|||
catch (DbUpdateConcurrencyException) |
|||
{ |
|||
if (!NGClassExists(id)) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = "类别代碼不存在"; |
|||
return result; |
|||
} |
|||
else |
|||
{ |
|||
throw; |
|||
} |
|||
} |
|||
|
|||
result.Success = true; |
|||
result.Msg = "OK"; |
|||
return result; |
|||
} |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="nGClass"></param>
|
|||
/// <returns></returns>
|
|||
// POST: api/NGClasses
|
|||
// To protect from overposting attacks, enable the specific properties you want to bind to, for
|
|||
// more details, see https://go.microsoft.com/fwlink/?linkid=2123754.
|
|||
[HttpPost] |
|||
public async Task<ResultModel<NGClass>> PostNGClass([FromBody] NGClass nGClass) |
|||
{ |
|||
ResultModel<NGClass> result = new ResultModel<NGClass>(); |
|||
|
|||
_context.NGClasses.Add(nGClass); |
|||
try |
|||
{ |
|||
await _context.SaveChangesAsync(); |
|||
} |
|||
catch (DbUpdateException) |
|||
{ |
|||
if (NGClassExists(nGClass.NGClassNo)) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = "类别代碼重複"; |
|||
return result; |
|||
} |
|||
else |
|||
{ |
|||
throw; |
|||
} |
|||
} |
|||
|
|||
result.Success = true; |
|||
result.Msg = "OK"; |
|||
return result; |
|||
} |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <returns></returns>
|
|||
// DELETE: api/NGClasses/5
|
|||
[HttpDelete("{id}")] |
|||
public async Task<ResultModel<NGClass>> DeleteNGClass(string id) |
|||
{ |
|||
ResultModel<NGClass> result = new ResultModel<NGClass>(); |
|||
|
|||
var nGClass = await _context.NGClasses.FindAsync(id); |
|||
if (nGClass == null) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = "类别代碼不存在"; |
|||
return result; |
|||
} |
|||
|
|||
_context.NGClasses.Remove(nGClass); |
|||
await _context.SaveChangesAsync(); |
|||
|
|||
result.Success = true; |
|||
result.Msg = "OK"; |
|||
return result; |
|||
} |
|||
|
|||
private bool NGClassExists(string id) |
|||
{ |
|||
return _context.NGClasses.Any(e => e.NGClassNo == id); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,195 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Http; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using AMESCoreStudio.WebApi; |
|||
using AMESCoreStudio.WebApi.Models.AMES; |
|||
using AMESCoreStudio.CommonTools.Result; |
|||
|
|||
namespace AMESCoreStudio.WebApi.Controllers.AMES |
|||
{ |
|||
/// <summary>
|
|||
/// 不良現象群組維護
|
|||
/// </summary>
|
|||
[Route("api/[controller]")]
|
|||
[ApiController] |
|||
public class NGGroupsController : ControllerBase |
|||
{ |
|||
private readonly AMESContext _context; |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="context"></param>
|
|||
public NGGroupsController(AMESContext context) |
|||
{ |
|||
_context = context; |
|||
} |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="page"></param>
|
|||
/// <param name="limit"></param>
|
|||
/// <returns></returns>
|
|||
// GET: api/NGGroups
|
|||
[HttpGet] |
|||
public async Task<ActionResult<IEnumerable<NGGroup>>> GetNGGroup(int page = 1, int limit = 10) |
|||
{ |
|||
IQueryable<NGGroup> q = _context.NGGroups; |
|||
if (page > 0) |
|||
{ |
|||
q = q.OrderBy(p => p.NGGroupNo).Skip((page - 1) * limit).Take(limit); |
|||
} |
|||
else |
|||
{ |
|||
q = q.OrderBy(p => p.NGGroupNo); |
|||
} |
|||
|
|||
var ngGroup = await q.ToListAsync(); |
|||
return ngGroup; |
|||
} |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <returns></returns>
|
|||
// GET: api/NGGroups/5
|
|||
[HttpGet("{id}")] |
|||
public async Task<ActionResult<IEnumerable<NGGroup>>> GetNGGroup(string id) |
|||
{ |
|||
IQueryable<NGGroup> q = _context.NGGroups; |
|||
q = q.Where(p => p.NGGroupNo.Equals(id)); |
|||
|
|||
var ngGroup = await q.ToListAsync(); |
|||
|
|||
if (ngGroup == null) |
|||
{ |
|||
return NotFound(); |
|||
} |
|||
|
|||
return ngGroup; |
|||
} |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <param name="nGGroup"></param>
|
|||
/// <returns></returns>
|
|||
// PUT: api/NGGroups/5
|
|||
// To protect from overposting attacks, enable the specific properties you want to bind to, for
|
|||
// more details, see https://go.microsoft.com/fwlink/?linkid=2123754.
|
|||
[HttpPut("{id}")] |
|||
public async Task<ResultModel<NGGroup>> PutNGGroup(string id, [FromBody] NGGroup nGGroup) |
|||
{ |
|||
ResultModel<NGGroup> result = new ResultModel<NGGroup>(); |
|||
|
|||
if (id != nGGroup.NGGroupNo) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = "群組代碼錯誤"; |
|||
return result; |
|||
} |
|||
|
|||
_context.Entry(nGGroup).State = EntityState.Modified; |
|||
|
|||
try |
|||
{ |
|||
await _context.SaveChangesAsync(); |
|||
} |
|||
catch (DbUpdateConcurrencyException) |
|||
{ |
|||
if (!NGGroupExists(id)) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = "群組代碼不存在"; |
|||
return result; |
|||
} |
|||
else |
|||
{ |
|||
throw; |
|||
} |
|||
} |
|||
|
|||
result.Success = true; |
|||
result.Msg = "OK"; |
|||
return result; |
|||
} |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="nGGroup"></param>
|
|||
/// <returns></returns>
|
|||
// POST: api/NGGroups
|
|||
// To protect from overposting attacks, enable the specific properties you want to bind to, for
|
|||
// more details, see https://go.microsoft.com/fwlink/?linkid=2123754.
|
|||
[HttpPost] |
|||
public async Task<ResultModel<NGGroup>> PostNGGroup([FromBody] NGGroup nGGroup) |
|||
{ |
|||
ResultModel<NGGroup> result = new ResultModel<NGGroup>(); |
|||
|
|||
_context.NGGroups.Add(nGGroup); |
|||
try |
|||
{ |
|||
await _context.SaveChangesAsync(); |
|||
} |
|||
catch (DbUpdateException) |
|||
{ |
|||
if (NGGroupExists(nGGroup.NGGroupNo)) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = "群組代碼重複"; |
|||
return result; |
|||
} |
|||
else |
|||
{ |
|||
throw; |
|||
} |
|||
} |
|||
|
|||
result.Success = true; |
|||
result.Msg = "OK"; |
|||
|
|||
return result; |
|||
} |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <returns></returns>
|
|||
// DELETE: api/NGGroups/5
|
|||
[HttpDelete("{id}")] |
|||
public async Task<ResultModel<NGGroup>> DeleteNGGroup(string id) |
|||
{ |
|||
ResultModel<NGGroup> result = new ResultModel<NGGroup>(); |
|||
|
|||
var nGGroup = await _context.NGGroups.FindAsync(id); |
|||
if (nGGroup == null) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = "群組代碼不存在"; |
|||
return result; |
|||
} |
|||
|
|||
_context.NGGroups.Remove(nGGroup); |
|||
await _context.SaveChangesAsync(); |
|||
|
|||
result.Success = true; |
|||
result.Msg = "OK"; |
|||
|
|||
return result; |
|||
} |
|||
|
|||
private bool NGGroupExists(string id) |
|||
{ |
|||
return _context.NGGroups.Any(e => e.NGGroupNo == id); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,225 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Http; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using AMESCoreStudio.WebApi; |
|||
using AMESCoreStudio.WebApi.Models.AMES; |
|||
using AMESCoreStudio.CommonTools.Result; |
|||
|
|||
namespace AMESCoreStudio.WebApi.Controllers.AMES |
|||
{ |
|||
/// <summary>
|
|||
/// 不良現象原因代碼維護
|
|||
/// </summary>
|
|||
[Route("api/[controller]")]
|
|||
[ApiController] |
|||
public class NGReasonsController : ControllerBase |
|||
{ |
|||
private readonly AMESContext _context; |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="context"></param>
|
|||
public NGReasonsController(AMESContext context) |
|||
{ |
|||
_context = context; |
|||
} |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
// GET: api/NGReasons
|
|||
[HttpGet] |
|||
public async Task<ActionResult<IEnumerable<NGReason>>> GetNGReason() |
|||
{ |
|||
IQueryable<NGReason> q = _context.NGReasons; |
|||
q = q.OrderBy(p => p.NGClassNo + p.NGReasonNo); |
|||
|
|||
var ngReason = await q.ToListAsync(); |
|||
|
|||
return ngReason; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 根据不良現象類別代碼NO獲取該類別不良現象原因代碼資料
|
|||
/// </summary>
|
|||
/// <param name="no"></param>
|
|||
/// <param name="page"></param>
|
|||
/// <param name="limit"></param>
|
|||
/// <returns></returns>
|
|||
// GET: api/NGReasons/Class/S
|
|||
[HttpGet("Class/{no}")] |
|||
public async Task<ActionResult<IEnumerable<NGReason>>> GetNGReasonByClass(string no, int page = 1, int limit = 10) |
|||
{ |
|||
IQueryable<NGReason> q = _context.NGReasons; |
|||
|
|||
if (no != null) |
|||
{ |
|||
if (no != "*") |
|||
{ |
|||
q = q.Where(p => p.NGClassNo.Equals(no)); |
|||
} |
|||
} |
|||
|
|||
if (page > 0) |
|||
{ |
|||
q = q.OrderBy(p => p.NGClassNo + p.NGReasonNo).Skip((page - 1) * limit).Take(limit); |
|||
} |
|||
else |
|||
{ |
|||
q = q.OrderBy(p => p.NGClassNo + p.NGReasonNo); |
|||
} |
|||
|
|||
var ngReason = await q.ToListAsync(); |
|||
|
|||
if (ngReason == null) |
|||
{ |
|||
return NotFound(); |
|||
} |
|||
|
|||
return ngReason; |
|||
} |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <returns></returns>
|
|||
// GET: api/NGReasons/5
|
|||
[HttpGet("{id}")] |
|||
public async Task<ActionResult<IEnumerable<NGReason>>> GetNGReason(string id) |
|||
{ |
|||
IQueryable<NGReason> q = _context.NGReasons; |
|||
q = q.Where(p => p.NGReasonNo.Equals(id)); |
|||
|
|||
var ngReason = await q.ToListAsync(); |
|||
|
|||
if (ngReason == null) |
|||
{ |
|||
return NotFound(); |
|||
} |
|||
|
|||
return ngReason; |
|||
} |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <param name="nGReason"></param>
|
|||
/// <returns></returns>
|
|||
// PUT: api/NGReasons/5
|
|||
// To protect from overposting attacks, enable the specific properties you want to bind to, for
|
|||
// more details, see https://go.microsoft.com/fwlink/?linkid=2123754.
|
|||
[HttpPut("{id}")] |
|||
public async Task<ResultModel<NGReason>> PutNGReason(string id, [FromBody] NGReason nGReason) |
|||
{ |
|||
ResultModel<NGReason> result = new ResultModel<NGReason>(); |
|||
|
|||
if (id != nGReason.NGReasonNo) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = "原因代碼錯誤"; |
|||
return result; |
|||
} |
|||
|
|||
_context.Entry(nGReason).State = EntityState.Modified; |
|||
|
|||
try |
|||
{ |
|||
await _context.SaveChangesAsync(); |
|||
} |
|||
catch (DbUpdateConcurrencyException) |
|||
{ |
|||
if (!NGReasonExists(id)) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = "原因代碼不存在"; |
|||
return result; |
|||
} |
|||
else |
|||
{ |
|||
throw; |
|||
} |
|||
} |
|||
|
|||
result.Success = true; |
|||
result.Msg = "OK"; |
|||
return result; |
|||
} |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="nGReason"></param>
|
|||
/// <returns></returns>
|
|||
// POST: api/NGReasons
|
|||
// To protect from overposting attacks, enable the specific properties you want to bind to, for
|
|||
// more details, see https://go.microsoft.com/fwlink/?linkid=2123754.
|
|||
[HttpPost] |
|||
public async Task<ResultModel<NGReason>> PostNGReason([FromBody] NGReason nGReason) |
|||
{ |
|||
ResultModel<NGReason> result = new ResultModel<NGReason>(); |
|||
|
|||
_context.NGReasons.Add(nGReason); |
|||
try |
|||
{ |
|||
await _context.SaveChangesAsync(); |
|||
} |
|||
catch (DbUpdateException) |
|||
{ |
|||
if (NGReasonExists(nGReason.NGReasonNo)) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = "原因代碼重複"; |
|||
return result; |
|||
} |
|||
else |
|||
{ |
|||
throw; |
|||
} |
|||
} |
|||
|
|||
result.Success = true; |
|||
result.Msg = "OK"; |
|||
return result; |
|||
} |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <returns></returns>
|
|||
// DELETE: api/NGReasons/5
|
|||
[HttpDelete("{id}")] |
|||
public async Task<ResultModel<NGReason>> DeleteNGReason(string id) |
|||
{ |
|||
ResultModel<NGReason> result = new ResultModel<NGReason>(); |
|||
|
|||
var nGReason = await _context.NGReasons.FindAsync(id); |
|||
if (nGReason == null) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = "原因代碼不存在"; |
|||
return result; |
|||
} |
|||
|
|||
_context.NGReasons.Remove(nGReason); |
|||
await _context.SaveChangesAsync(); |
|||
|
|||
result.Success = true; |
|||
result.Msg = "OK"; |
|||
return result; |
|||
} |
|||
|
|||
private bool NGReasonExists(string id) |
|||
{ |
|||
return _context.NGReasons.Any(e => e.NGReasonNo == id); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,48 @@ |
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
using System.Runtime.Serialization; |
|||
|
|||
namespace AMESCoreStudio.WebApi.Models.AMES |
|||
{ |
|||
/// <summary>
|
|||
/// 不良現象类别资料表
|
|||
/// </summary>
|
|||
[Table("NG_CLASS", Schema = "JHAMES")] |
|||
[DataContract] |
|||
public class NGClass |
|||
{ |
|||
/// <summary>
|
|||
/// 不良現象類別代碼
|
|||
/// </summary>
|
|||
[Key] |
|||
[Column("NG_CLASS_NO")] |
|||
[Required(ErrorMessage = "{0},不能空白")] |
|||
[Display(Name = "不良類別代碼")] |
|||
[StringLength(6, ErrorMessage = "{0},不能大于{1}")] |
|||
[DataMember] |
|||
public string NGClassNo { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 不良現象群組代碼
|
|||
/// </summary>
|
|||
[Column("NG_GROUP_NO")] |
|||
[Required(ErrorMessage = "{0},不能空白")] |
|||
[Display(Name = "不良群組代碼")] |
|||
[StringLength(6, ErrorMessage = "{0},不能大于{1}")] |
|||
[DataMember] |
|||
public string NGGroupNo { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 不良現象類別名稱
|
|||
/// </summary>
|
|||
[Column("NG_CLASS_NAME")] |
|||
[DataMember] |
|||
[Required(ErrorMessage = "{0},不能空白")] |
|||
[Display(Name = "不良類別名稱")] |
|||
[StringLength(50, ErrorMessage = "{0},不能大于{1}")] |
|||
public string NGClassName { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,37 @@ |
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
using System.Runtime.Serialization; |
|||
|
|||
namespace AMESCoreStudio.WebApi.Models.AMES |
|||
{ |
|||
/// <summary>
|
|||
/// 不良現象群组资料表
|
|||
/// </summary>
|
|||
[Table("NG_GROUP", Schema = "JHAMES")] |
|||
[DataContract] |
|||
public class NGGroup |
|||
{ |
|||
/// <summary>
|
|||
/// 不良現象代碼
|
|||
/// </summary>
|
|||
[Key] |
|||
[Column("NG_GROUP_NO")] |
|||
[Required(ErrorMessage = "{0},不能空白")] |
|||
[Display(Name = "不良群组代碼")] |
|||
[StringLength(10, ErrorMessage = "{0},不能大于{1}")] |
|||
[DataMember] |
|||
public string NGGroupNo { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 不良現象名稱
|
|||
/// </summary>
|
|||
[Column("NG_GROUP_NAME")] |
|||
[DataMember] |
|||
[Required(ErrorMessage = "{0},不能空白")] |
|||
[Display(Name = "不良群组名稱")] |
|||
[StringLength(50, ErrorMessage = "{0},不能大于{1}")] |
|||
public string NGGroupName { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,66 @@ |
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
using System.Runtime.Serialization; |
|||
|
|||
namespace AMESCoreStudio.WebApi.Models.AMES |
|||
{ |
|||
/// <summary>
|
|||
/// 不良代码资料表
|
|||
/// </summary>
|
|||
[Table("NG_REASON", Schema = "JHAMES")] |
|||
[DataContract] |
|||
public class NGReason |
|||
{ |
|||
/// <summary>
|
|||
/// 不良現象原因代碼
|
|||
/// </summary>
|
|||
[Key] |
|||
[Column("NG_REASON_NO")] |
|||
[Required(ErrorMessage = "{0},不能空白")] |
|||
[Display(Name = "不良原因代碼")] |
|||
[StringLength(6, ErrorMessage = "{0},不能大于{1}")] |
|||
[DataMember] |
|||
public string NGReasonNo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 不良現象類別代碼
|
|||
/// </summary>
|
|||
[Column("NG_CLASS_NO")] |
|||
[Required(ErrorMessage = "{0},不能空白")] |
|||
[Display(Name = "不良類別代碼")] |
|||
[StringLength(6, ErrorMessage = "{0},不能大于{1}")] |
|||
[DataMember] |
|||
public string NGClassNo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 不良現象原因描述
|
|||
/// </summary>
|
|||
[Column("NG_REASON_DESC")] |
|||
[Required(ErrorMessage = "{0},不能空白")] |
|||
[Display(Name = "不良原因描述")] |
|||
[StringLength(100, ErrorMessage = "{0},不能大于{1}")] |
|||
[DataMember] |
|||
public string NGReasonDesc { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 不良現象原因英文描述
|
|||
/// </summary>
|
|||
[Column("NG_REASON_DESC_EN")] |
|||
[Required(ErrorMessage = "{0},不能空白")] |
|||
[Display(Name = "不良原因英文描述")] |
|||
[StringLength(100, ErrorMessage = "{0},不能大于{1}")] |
|||
[DataMember] |
|||
public string NGReasonDescEn { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 責任單位
|
|||
/// </summary>
|
|||
[Column("RESPONSE_DEPT")] |
|||
[DataMember] |
|||
[Required] |
|||
[Display(Name = "責任單位")] |
|||
public int ResponseDept { get; set; } |
|||
|
|||
} |
|||
} |
Loading…
Reference in new issue