Browse Source
2.新增流程站别維護頁面BAS010(支持批量刪除) 3.新增流程规则維護頁面BAS011(支持批量刪除) 4.修改Views\Home\Framework.cshtml添加菜单PTD
18 changed files with 2564 additions and 2 deletions
@ -0,0 +1,199 @@ |
|||||
|
@{ |
||||
|
ViewData["Title"] = "流程資料管理"; |
||||
|
Layout = "~/Views/Shared/_AMESLayout.cshtml"; |
||||
|
} |
||||
|
|
||||
|
<style type="text/css"> |
||||
|
.layui-table-main .layui-table-cell { |
||||
|
/*height: auto !important;*/ |
||||
|
white-space: normal; |
||||
|
} |
||||
|
|
||||
|
.layui-table img { |
||||
|
max-width: 60px; |
||||
|
max-height: 28px; |
||||
|
} |
||||
|
|
||||
|
.layui-tree-main { |
||||
|
cursor: pointer; |
||||
|
padding-right: 10px; |
||||
|
float: left; |
||||
|
border-width: 1px; |
||||
|
border-style: solid; |
||||
|
border-color: #e6e6e6; |
||||
|
margin: 10px 0; |
||||
|
} |
||||
|
</style> |
||||
|
|
||||
|
<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-form-item layui-layout-left" style="width:300px;"> |
||||
|
<select id="unit" lay-filter="unit" lay-verify="required" lay-submit asp-items="@ViewBag.FactoryUnit"> |
||||
|
</select> |
||||
|
</div> |
||||
|
<input id="unitNo" type="hidden" name="unitNo" value="0" /> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item layui-layout-right"> |
||||
|
<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(unit)', function (data) { |
||||
|
$("#unitNo").val(data.value); |
||||
|
|
||||
|
var qs = $('button[lay-filter="querysubmit"]'); |
||||
|
qs.click(); |
||||
|
|
||||
|
hg.msghide("刷新数据!"); |
||||
|
table && table.reload(); |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
//监听表单提交事件 |
||||
|
hg.form.onsubmit('querysubmit', function (data) { |
||||
|
hg.msghide("重新加载数据.."); |
||||
|
table && table.reload(data); |
||||
|
}); |
||||
|
|
||||
|
var tableCols = [[ |
||||
|
{ type: 'checkbox' }, |
||||
|
{ |
||||
|
field: 'flowRuleID', |
||||
|
width: 120, |
||||
|
title: '编号', |
||||
|
sort: true |
||||
|
}, |
||||
|
{ |
||||
|
field: 'flowRuleName', |
||||
|
title: '流程名稱', |
||||
|
width: 400, |
||||
|
sort: true |
||||
|
}, |
||||
|
{ |
||||
|
field: 'flowRuleDesc', |
||||
|
title: '流程描述', |
||||
|
sort: true |
||||
|
}, |
||||
|
{ |
||||
|
field: 'flowStatus', |
||||
|
title: '流程状态', |
||||
|
width:160, |
||||
|
sort: true |
||||
|
}, |
||||
|
{ |
||||
|
field: 'right', |
||||
|
width: 160, |
||||
|
title: '操作', |
||||
|
fixed: 'right', |
||||
|
templet: function (d) { |
||||
|
return '<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</a> <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>' |
||||
|
} |
||||
|
}] |
||||
|
]; |
||||
|
//通过行tool编辑,lay-event="edit" |
||||
|
function edit(obj) { |
||||
|
if (obj.data.flowRuleID) { |
||||
|
hg.open('修改流程', '/BAS/BAS009U/' + obj.data.flowRuleID, 600, 400); |
||||
|
} |
||||
|
} |
||||
|
//通过行tool删除,lay-event="del" |
||||
|
function del(obj) { |
||||
|
if (obj.data.flowRuleID) { |
||||
|
hg.confirm("流程:" + obj.data.flowRuleName + ",确定要删除吗?", function () { |
||||
|
$.ajax({ |
||||
|
url: '/BAS/BAS009D', |
||||
|
data: { id: obj.data.flowRuleID }, |
||||
|
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-danger', |
||||
|
handler: function (obj, row) { |
||||
|
if (obj.checkstatus && obj.checkstatus.data.length > 0) |
||||
|
{ |
||||
|
console.log(obj.checkstatus.data.map(function (x) { return x.flowRuleID }).join(',')) |
||||
|
|
||||
|
hg.confirm("批量删除所有选中的数据,确定要删除吗?", function () { |
||||
|
$.ajax({ |
||||
|
url: '/BAS/BAS009DAll', |
||||
|
data: { ids: obj.checkstatus.data.map(function (x) { return x.flowRuleID }) }, |
||||
|
type: 'POST', |
||||
|
success: function (data) { |
||||
|
if (data.success) { |
||||
|
hg.msg('批量删除成功!'); |
||||
|
//重载表格数据 |
||||
|
table && table.reload(); |
||||
|
} |
||||
|
else { |
||||
|
//hg.msg(data.msg); |
||||
|
hg.msg('批量删除失败!'); |
||||
|
} |
||||
|
}, |
||||
|
error: function () { |
||||
|
hg.msg("网络请求失败!"); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
}); |
||||
|
} else { |
||||
|
hg.msg('请选中一个或多个复选框,再操作!'); |
||||
|
} |
||||
|
} |
||||
|
}, { |
||||
|
text: '新增', |
||||
|
layuiicon: '', |
||||
|
class: 'layui-btn-normal', |
||||
|
handler: function () { |
||||
|
var id = unitNo.value; |
||||
|
//alert(unitNo.value); |
||||
|
//alert(id); |
||||
|
hg.open('新增流程', '/BAS/BAS009C/' + id, 600, 400); |
||||
|
} |
||||
|
} |
||||
|
]; |
||||
|
|
||||
|
|
||||
|
//基本数据表格 |
||||
|
var table = hg.table.datatable('test', '流程資料管理', '/BAS/GetFlowRulesByUnit/' + unitNo.value, {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); |
||||
|
|
||||
|
</script> |
||||
|
} |
@ -0,0 +1,71 @@ |
|||||
|
@model AMESCoreStudio.WebApi.Models.BAS.FlowRule |
||||
|
|
||||
|
|
||||
|
@{ ViewData["Title"] = "BAS009C"; |
||||
|
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="BAS009Save"> |
||||
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
||||
|
<input type="hidden" asp-for="SysType" value="U" /> |
||||
|
|
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="UnitNo" class="control-label col-sm-3"></label> |
||||
|
<select asp-for="UnitNo" asp-items="@ViewBag.FactoryUnit" class="custom-select col-sm-9"></select> |
||||
|
<span asp-validation-for="UnitNo" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="FlowRuleName" class="control-label col-sm-3"></label> |
||||
|
<input asp-for="FlowRuleName" class="form-control col-sm-9" placeholder="請輸入流程名稱" /> |
||||
|
<span asp-validation-for="FlowRuleName" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="FlowRuleDesc" class="control-label col-sm-3"></label> |
||||
|
<input id="test1" asp-for="FlowRuleDesc" class="form-control col-sm-9" placeholder="請輸入流程描述" /> |
||||
|
<span asp-validation-for="FlowRuleDesc" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="FlowType" class="control-label col-sm-3"></label> |
||||
|
<div class="col-sm-9"> |
||||
|
<div class="radio icheck-primary form-check-inline"> |
||||
|
<input type="radio" id="S" asp-for="FlowType" value="S" /> |
||||
|
<label for="S"> 正常流程 </label> |
||||
|
</div> |
||||
|
<div class="radio icheck-primary form-check-inline"> |
||||
|
<input type="radio" id="R" asp-for="FlowType" value="R" /> |
||||
|
<label for="R"> 重工流程 </label> |
||||
|
</div> |
||||
|
</div> |
||||
|
<span asp-validation-for="FlowType" 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,73 @@ |
|||||
|
@model AMESCoreStudio.WebApi.Models.BAS.FlowRule |
||||
|
|
||||
|
@{ |
||||
|
ViewData["Title"] = "BAS009U"; |
||||
|
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="BAS009Save"> |
||||
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
||||
|
<input type="hidden" asp-for="FlowRuleID" /> |
||||
|
<input type="hidden" asp-for="SysType" /> |
||||
|
<input type="hidden" asp-for="FlowStatus" /> |
||||
|
|
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="UnitNo" class="control-label col-sm-3"></label> |
||||
|
<select asp-for="UnitNo" asp-items="@ViewBag.FactoryUnit" class="custom-select col-sm-9"></select> |
||||
|
<span asp-validation-for="UnitNo" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="FlowRuleName" class="control-label col-sm-3"></label> |
||||
|
<input asp-for="FlowRuleName" class="form-control col-sm-9" placeholder="請輸入流程名稱" /> |
||||
|
<span asp-validation-for="FlowRuleName" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="FlowRuleDesc" class="control-label col-sm-3"></label> |
||||
|
<input id="test1" asp-for="FlowRuleDesc" class="form-control col-sm-9" placeholder="請輸入流程描述" /> |
||||
|
<span asp-validation-for="FlowRuleDesc" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="FlowType" class="control-label col-sm-3"></label> |
||||
|
<div class="col-sm-9"> |
||||
|
<div class="radio icheck-primary form-check-inline"> |
||||
|
<input type="radio" id="S" asp-for="FlowType" value="S" /> |
||||
|
<label for="S"> 正常流程 </label> |
||||
|
</div> |
||||
|
<div class="radio icheck-primary form-check-inline"> |
||||
|
<input type="radio" id="R" asp-for="FlowType" value="R" /> |
||||
|
<label for="R"> 重工流程 </label> |
||||
|
</div> |
||||
|
</div> |
||||
|
<span asp-validation-for="FlowType" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<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,206 @@ |
|||||
|
@{ |
||||
|
ViewData["Title"] = "流程站別管理"; |
||||
|
Layout = "~/Views/Shared/_AMESLayout.cshtml"; |
||||
|
} |
||||
|
|
||||
|
<style type="text/css"> |
||||
|
.layui-table-main .layui-table-cell { |
||||
|
/*height: auto !important;*/ |
||||
|
white-space: normal; |
||||
|
} |
||||
|
|
||||
|
.layui-table img { |
||||
|
max-width: 60px; |
||||
|
max-height: 28px; |
||||
|
} |
||||
|
|
||||
|
.layui-tree-main { |
||||
|
cursor: pointer; |
||||
|
padding-right: 10px; |
||||
|
float: left; |
||||
|
border-width: 1px; |
||||
|
border-style: solid; |
||||
|
border-color: #e6e6e6; |
||||
|
margin: 10px 0; |
||||
|
} |
||||
|
</style> |
||||
|
|
||||
|
<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-form-item layui-layout-left" style="width:300px;"> |
||||
|
<select id="flow" lay-filter="flow" lay-verify="required" lay-submit asp-items="@ViewBag.FlowRuleList"> |
||||
|
</select> |
||||
|
</div> |
||||
|
<input id="flowId" type="hidden" name="flowId" value="0" /> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item layui-layout-right"> |
||||
|
<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(flow)', function (data) { |
||||
|
$("#flowId").val(data.value); |
||||
|
|
||||
|
var qs = $('button[lay-filter="querysubmit"]'); |
||||
|
qs.click(); |
||||
|
|
||||
|
hg.msghide("刷新数据!"); |
||||
|
table && table.reload(); |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
//监听表单提交事件 |
||||
|
hg.form.onsubmit('querysubmit', function (data) { |
||||
|
hg.msghide("重新加载数据.."); |
||||
|
table && table.reload(data); |
||||
|
}); |
||||
|
|
||||
|
var tableCols = [[ |
||||
|
{ type: 'checkbox' }, |
||||
|
{ |
||||
|
field: 'ruleStationID', |
||||
|
width: 120, |
||||
|
title: '编号', |
||||
|
sort: true |
||||
|
}, |
||||
|
{ |
||||
|
field: 'station', |
||||
|
title: '站別名稱', |
||||
|
width: 300, |
||||
|
sort: true, |
||||
|
templet: function (d) { |
||||
|
return d.station['stationName']; |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'stationDesc', |
||||
|
title: '站別描述', |
||||
|
sort: true |
||||
|
}, |
||||
|
{ |
||||
|
field: 'sequence', |
||||
|
title: '站別順序', |
||||
|
width: 120, |
||||
|
sort: true |
||||
|
}, |
||||
|
{ |
||||
|
field: 'stationType', |
||||
|
title: '主站/副站', |
||||
|
width: 120, |
||||
|
sort: true |
||||
|
}, |
||||
|
{ |
||||
|
field: 'right', |
||||
|
width: 160, |
||||
|
title: '操作', |
||||
|
fixed: 'right', |
||||
|
templet: function (d) { |
||||
|
return '<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</a> <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>' |
||||
|
} |
||||
|
}] |
||||
|
]; |
||||
|
//通过行tool编辑,lay-event="edit" |
||||
|
function edit(obj) { |
||||
|
if (obj.data.ruleStationID) { |
||||
|
hg.open('修改流程站別', '/BAS/BAS010U/' + obj.data.ruleStationID, 600, 400); |
||||
|
} |
||||
|
} |
||||
|
//通过行tool删除,lay-event="del" |
||||
|
function del(obj) { |
||||
|
if (obj.data.ruleStationID) { |
||||
|
hg.confirm("流程站別:" + obj.data.station['stationName'] + ",确定要删除吗?", function () { |
||||
|
$.ajax({ |
||||
|
url: '/BAS/BAS010D', |
||||
|
data: { id: obj.data.ruleStationID }, |
||||
|
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-danger', |
||||
|
handler: function (obj, row) { |
||||
|
if (obj.checkstatus && obj.checkstatus.data.length > 0) |
||||
|
{ |
||||
|
console.log(obj.checkstatus.data.map(function (x) { return x.ruleStationID }).join(',')) |
||||
|
|
||||
|
hg.confirm("批量删除所有选中的数据,确定要删除吗?", function () { |
||||
|
$.ajax({ |
||||
|
url: '/BAS/BAS010DAll', |
||||
|
data: { ids: obj.checkstatus.data.map(function (x) { return x.ruleStationID }) }, |
||||
|
type: 'POST', |
||||
|
success: function (data) { |
||||
|
if (data.success) { |
||||
|
hg.msg('批量删除成功!'); |
||||
|
//重载表格数据 |
||||
|
table && table.reload(); |
||||
|
} |
||||
|
else { |
||||
|
//hg.msg(data.msg); |
||||
|
hg.msg('批量删除失败!'); |
||||
|
} |
||||
|
}, |
||||
|
error: function () { |
||||
|
hg.msg("网络请求失败!"); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
}); |
||||
|
} else { |
||||
|
hg.msg('请选中一个或多个复选框,再操作!'); |
||||
|
} |
||||
|
} |
||||
|
}, { |
||||
|
text: '新增', |
||||
|
layuiicon: '', |
||||
|
class: 'layui-btn-normal', |
||||
|
handler: function () { |
||||
|
var id = flowId.value; |
||||
|
hg.open('新增流程站別', '/BAS/BAS010C/' + id, 600, 400); |
||||
|
} |
||||
|
} |
||||
|
]; |
||||
|
|
||||
|
|
||||
|
//基本数据表格 |
||||
|
var table = hg.table.datatable('test', '流程站別管理', '/BAS/GetRuleStationsByFlow/' + flowId.value, {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); |
||||
|
|
||||
|
</script> |
||||
|
} |
@ -0,0 +1,76 @@ |
|||||
|
@model AMESCoreStudio.WebApi.Models.BAS.RuleStation |
||||
|
|
||||
|
|
||||
|
@{ ViewData["Title"] = "BAS010C"; |
||||
|
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="BAS010Save"> |
||||
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
||||
|
<input type="hidden" asp-for="FlowRuleID" value="@ViewBag.FlowRuleID" /> |
||||
|
|
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="FlowRuleID" class="control-label col-sm-3"></label> |
||||
|
<select asp-for="FlowRuleID" asp-items="@ViewBag.FlowRuleList" class="custom-select col-sm-9" disabled></select> |
||||
|
<span asp-validation-for="FlowRuleID" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="StationID" class="control-label col-sm-3"></label> |
||||
|
<select asp-for="StationID" asp-items="@ViewBag.StationList" class="custom-select col-sm-9"></select> |
||||
|
<span asp-validation-for="StationID" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="Sequence" class="control-label col-sm-3"></label> |
||||
|
<input asp-for="Sequence" class="form-control col-sm-9" placeholder="請輸入站別順序" /> |
||||
|
<span asp-validation-for="Sequence" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="StationType" class="control-label col-sm-3"></label> |
||||
|
<div class="col-sm-9"> |
||||
|
<div class="radio icheck-primary form-check-inline"> |
||||
|
<input type="radio" id="M" asp-for="StationType" value="M" /> |
||||
|
<label for="M"> 主站 </label> |
||||
|
</div> |
||||
|
<div class="radio icheck-primary form-check-inline"> |
||||
|
<input type="radio" id="S" asp-for="StationType" value="S" /> |
||||
|
<label for="S"> 副站 </label> |
||||
|
</div> |
||||
|
</div> |
||||
|
<span asp-validation-for="StationType" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="StationDesc" class="control-label col-sm-3"></label> |
||||
|
<input id="test1" asp-for="StationDesc" class="form-control col-sm-9" placeholder="請輸入站別描述" /> |
||||
|
<span asp-validation-for="StationDesc" 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,77 @@ |
|||||
|
@model AMESCoreStudio.WebApi.Models.BAS.RuleStation |
||||
|
|
||||
|
@{ |
||||
|
ViewData["Title"] = "BAS010U"; |
||||
|
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="BAS010Save"> |
||||
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
||||
|
<input type="hidden" asp-for="RuleStationID" /> |
||||
|
<input type="hidden" asp-for="FlowRuleID" /> |
||||
|
|
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="FlowRuleID" class="control-label col-sm-3"></label> |
||||
|
<select asp-for="FlowRuleID" asp-items="@ViewBag.FlowRuleList" class="custom-select col-sm-9" disabled></select> |
||||
|
<span asp-validation-for="FlowRuleID" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="StationID" class="control-label col-sm-3"></label> |
||||
|
<select asp-for="StationID" asp-items="@ViewBag.StationList" class="custom-select col-sm-9"></select> |
||||
|
<span asp-validation-for="StationID" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="Sequence" class="control-label col-sm-3"></label> |
||||
|
<input asp-for="Sequence" class="form-control col-sm-9" placeholder="請輸入站別順序" /> |
||||
|
<span asp-validation-for="Sequence" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="StationType" class="control-label col-sm-3"></label> |
||||
|
<div class="col-sm-9"> |
||||
|
<div class="radio icheck-primary form-check-inline"> |
||||
|
<input type="radio" id="M" asp-for="StationType" value="M" /> |
||||
|
<label for="M"> 主站 </label> |
||||
|
</div> |
||||
|
<div class="radio icheck-primary form-check-inline"> |
||||
|
<input type="radio" id="S" asp-for="StationType" value="S" /> |
||||
|
<label for="S"> 副站 </label> |
||||
|
</div> |
||||
|
</div> |
||||
|
<span asp-validation-for="StationType" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="StationDesc" class="control-label col-sm-3"></label> |
||||
|
<input id="test1" asp-for="StationDesc" class="form-control col-sm-9" placeholder="請輸入站別描述" /> |
||||
|
<span asp-validation-for="StationDesc" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<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,206 @@ |
|||||
|
@{ |
||||
|
ViewData["Title"] = "流程站別規則管理"; |
||||
|
Layout = "~/Views/Shared/_AMESLayout.cshtml"; |
||||
|
} |
||||
|
|
||||
|
<style type="text/css"> |
||||
|
.layui-table-main .layui-table-cell { |
||||
|
/*height: auto !important;*/ |
||||
|
white-space: normal; |
||||
|
} |
||||
|
|
||||
|
.layui-table img { |
||||
|
max-width: 60px; |
||||
|
max-height: 28px; |
||||
|
} |
||||
|
|
||||
|
.layui-tree-main { |
||||
|
cursor: pointer; |
||||
|
padding-right: 10px; |
||||
|
float: left; |
||||
|
border-width: 1px; |
||||
|
border-style: solid; |
||||
|
border-color: #e6e6e6; |
||||
|
margin: 10px 0; |
||||
|
} |
||||
|
</style> |
||||
|
|
||||
|
<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-form-item layui-layout-left" style="width:300px;"> |
||||
|
<select id="flow" lay-filter="flow" lay-verify="required" lay-submit asp-items="@ViewBag.FlowRuleList"> |
||||
|
</select> |
||||
|
</div> |
||||
|
<input id="flowId" type="hidden" name="flowId" value="0" /> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item layui-layout-right"> |
||||
|
<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(flow)', function (data) { |
||||
|
$("#flowId").val(data.value); |
||||
|
|
||||
|
var qs = $('button[lay-filter="querysubmit"]'); |
||||
|
qs.click(); |
||||
|
|
||||
|
hg.msghide("刷新数据!"); |
||||
|
table && table.reload(); |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
//监听表单提交事件 |
||||
|
hg.form.onsubmit('querysubmit', function (data) { |
||||
|
hg.msghide("重新加载数据.."); |
||||
|
table && table.reload(data); |
||||
|
}); |
||||
|
|
||||
|
var tableCols = [[ |
||||
|
{ type: 'checkbox' }, |
||||
|
{ |
||||
|
field: 'ruleStationID', |
||||
|
width: 120, |
||||
|
title: '编号', |
||||
|
sort: true |
||||
|
}, |
||||
|
{ |
||||
|
field: 'ruleDesc', |
||||
|
title: '當前站名稱', |
||||
|
width: 300, |
||||
|
sort: true |
||||
|
}, |
||||
|
{ |
||||
|
field: 'ruleStatus', |
||||
|
title: '規則狀態', |
||||
|
width:160, |
||||
|
sort: true |
||||
|
}, |
||||
|
{ |
||||
|
field: 'nextStation', |
||||
|
title: '下一站名稱', |
||||
|
sort: true, |
||||
|
templet: function (d) { |
||||
|
return d.nextStation['stationName']; |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
field: 'ruleSeq', |
||||
|
title: '規則順序', |
||||
|
width: 120, |
||||
|
sort: true |
||||
|
}, |
||||
|
{ |
||||
|
field: 'right', |
||||
|
width: 160, |
||||
|
title: '操作', |
||||
|
fixed: 'right', |
||||
|
templet: function (d) { |
||||
|
return '<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</a> <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>' |
||||
|
} |
||||
|
}] |
||||
|
]; |
||||
|
//通过行tool编辑,lay-event="edit" |
||||
|
function edit(obj) { |
||||
|
if (obj.data.ruleStationID) { |
||||
|
hg.open('修改流程規則', '/BAS/BAS011U/' + obj.data.ruleStationID, 600, 400); |
||||
|
} |
||||
|
} |
||||
|
//通过行tool删除,lay-event="del" |
||||
|
function del(obj) { |
||||
|
if (obj.data.ruleStationID) { |
||||
|
hg.confirm("流程規則:" + obj.data.nextStation['stationName'] + ",确定要删除吗?", function () { |
||||
|
$.ajax({ |
||||
|
url: '/BAS/BAS011D', |
||||
|
data: { id: obj.data.ruleStationID }, |
||||
|
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-danger', |
||||
|
handler: function (obj, row) { |
||||
|
if (obj.checkstatus && obj.checkstatus.data.length > 0) |
||||
|
{ |
||||
|
console.log(obj.checkstatus.data.map(function (x) { return x.ruleStationID }).join(',')) |
||||
|
|
||||
|
hg.confirm("批量删除所有选中的数据,确定要删除吗?", function () { |
||||
|
$.ajax({ |
||||
|
url: '/BAS/BAS011DAll', |
||||
|
data: { ids: obj.checkstatus.data.map(function (x) { return x.ruleStationID }) }, |
||||
|
type: 'POST', |
||||
|
success: function (data) { |
||||
|
if (data.success) { |
||||
|
hg.msg('批量删除成功!'); |
||||
|
//重载表格数据 |
||||
|
table && table.reload(); |
||||
|
} |
||||
|
else { |
||||
|
//hg.msg(data.msg); |
||||
|
hg.msg('批量删除失败!'); |
||||
|
} |
||||
|
}, |
||||
|
error: function () { |
||||
|
hg.msg("网络请求失败!"); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
}); |
||||
|
} else { |
||||
|
hg.msg('请选中一个或多个复选框,再操作!'); |
||||
|
} |
||||
|
} |
||||
|
}, { |
||||
|
text: '新增', |
||||
|
layuiicon: '', |
||||
|
class: 'layui-btn-normal', |
||||
|
handler: function () { |
||||
|
var id = flowId.value; |
||||
|
hg.open('新增流程站別', '/BAS/BAS011C/' + id, 600, 400); |
||||
|
} |
||||
|
} |
||||
|
]; |
||||
|
|
||||
|
|
||||
|
//基本数据表格 |
||||
|
var table = hg.table.datatable('test', '流程站別規則管理', '/BAS/GetRulesesByFlow/' + flowId.value, {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); |
||||
|
|
||||
|
</script> |
||||
|
} |
@ -0,0 +1,75 @@ |
|||||
|
@model AMESCoreStudio.WebApi.Models.BAS.Rules |
||||
|
|
||||
|
|
||||
|
@{ ViewData["Title"] = "BAS011C"; |
||||
|
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="BAS011Save"> |
||||
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
||||
|
|
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="RuleStationID" class="control-label col-sm-3"></label> |
||||
|
<select asp-for="RuleStationID" asp-items="@ViewBag.RuleStationList" class="custom-select col-sm-9"></select> |
||||
|
<span asp-validation-for="RuleStationID" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="RuleDesc" class="control-label col-sm-3"></label> |
||||
|
<input asp-for="RuleDesc" class="form-control col-sm-9" placeholder="請輸入規則描述" /> |
||||
|
<span asp-validation-for="RuleDesc" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="RuleStatus" class="control-label col-sm-3"></label> |
||||
|
<div class="col-sm-9"> |
||||
|
<div class="radio icheck-primary form-check-inline"> |
||||
|
<input type="radio" id="P" asp-for="RuleStatus" value="P" /> |
||||
|
<label for="P"> PASS </label> |
||||
|
</div> |
||||
|
<div class="radio icheck-primary form-check-inline"> |
||||
|
<input type="radio" id="F" asp-for="RuleStatus" value="F" /> |
||||
|
<label for="F"> FAIL </label> |
||||
|
</div> |
||||
|
</div> |
||||
|
<span asp-validation-for="RuleStatus" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="NextStationID" class="control-label col-sm-3"></label> |
||||
|
<select asp-for="NextStationID" asp-items="@ViewBag.NextStationList" class="custom-select col-sm-9"></select> |
||||
|
<span asp-validation-for="NextStationID" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="RuleSeq" class="control-label col-sm-3"></label> |
||||
|
<input id="test1" asp-for="RuleSeq" class="form-control col-sm-9" placeholder="請輸入規則順序" /> |
||||
|
<span asp-validation-for="RuleSeq" 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,77 @@ |
|||||
|
@model AMESCoreStudio.WebApi.Models.BAS.Rules |
||||
|
|
||||
|
@{ |
||||
|
ViewData["Title"] = "BAS010U"; |
||||
|
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="BAS011Save"> |
||||
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
||||
|
<input type="hidden" asp-for="RuleStationID" /> |
||||
|
<input type="hidden" asp-for="CreateDate" /> |
||||
|
|
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="RuleStationID" class="control-label col-sm-3"></label> |
||||
|
<select asp-for="RuleStationID" asp-items="@ViewBag.RuleStationList" class="custom-select col-sm-9"></select> |
||||
|
<span asp-validation-for="RuleStationID" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="RuleDesc" class="control-label col-sm-3"></label> |
||||
|
<input asp-for="RuleDesc" class="form-control col-sm-9" placeholder="請輸入規則描述" /> |
||||
|
<span asp-validation-for="RuleDesc" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="RuleStatus" class="control-label col-sm-3"></label> |
||||
|
<div class="col-sm-9"> |
||||
|
<div class="radio icheck-primary form-check-inline"> |
||||
|
<input type="radio" id="P" asp-for="RuleStatus" value="P" /> |
||||
|
<label for="P"> PASS </label> |
||||
|
</div> |
||||
|
<div class="radio icheck-primary form-check-inline"> |
||||
|
<input type="radio" id="F" asp-for="RuleStatus" value="F" /> |
||||
|
<label for="F"> FAIL </label> |
||||
|
</div> |
||||
|
</div> |
||||
|
<span asp-validation-for="RuleStatus" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="NextStationID" class="control-label col-sm-3"></label> |
||||
|
<select asp-for="NextStationID" asp-items="@ViewBag.NextStationList" class="custom-select col-sm-9"></select> |
||||
|
<span asp-validation-for="NextStationID" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label asp-for="RuleSeq" class="control-label col-sm-3"></label> |
||||
|
<input id="test1" asp-for="RuleSeq" class="form-control col-sm-9" placeholder="請輸入規則順序" /> |
||||
|
<span asp-validation-for="RuleSeq" class="text-danger offset-sm-3 my-sm-1"></span> |
||||
|
</div> |
||||
|
<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,191 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using AMESCoreStudio.WebApi.Models.BAS; |
||||
|
|
||||
|
namespace AMESCoreStudio.WebApi.Controllers.BAS |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 流程資料維護
|
||||
|
/// </summary>
|
||||
|
[Route("api/[controller]")]
|
||||
|
[ApiController] |
||||
|
public class FlowRulesController : ControllerBase |
||||
|
{ |
||||
|
private readonly AMESContext _context; |
||||
|
|
||||
|
/// <summary>
|
||||
|
///
|
||||
|
/// </summary>
|
||||
|
/// <param name="context"></param>
|
||||
|
public FlowRulesController(AMESContext context) |
||||
|
{ |
||||
|
_context = context; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
///
|
||||
|
/// </summary>
|
||||
|
/// <returns></returns>
|
||||
|
// GET: api/FlowRules
|
||||
|
[HttpGet] |
||||
|
public async Task<ActionResult<IEnumerable<FlowRule>>> GetFlowRule() |
||||
|
{ |
||||
|
IQueryable<FlowRule> q = _context.FlowRules; |
||||
|
|
||||
|
q.OrderBy(p => p.UnitNo + p.FlowRuleName); |
||||
|
|
||||
|
var flowRule = await q.ToListAsync(); |
||||
|
|
||||
|
if (flowRule == null) |
||||
|
{ |
||||
|
return NotFound(); |
||||
|
} |
||||
|
|
||||
|
return flowRule; |
||||
|
//return await _context.FlowRule.ToListAsync();
|
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 根据製程單位代碼NO獲取該製程流程資料
|
||||
|
/// </summary>
|
||||
|
/// <param name="no"></param>
|
||||
|
/// <returns></returns>
|
||||
|
// GET: api/FlowRules/Unit/S
|
||||
|
[HttpGet("Unit/{no}")] |
||||
|
public async Task<ActionResult<IEnumerable<FlowRule>>> GetFlowRuleByUnit(string no) |
||||
|
{ |
||||
|
IQueryable<FlowRule> q = _context.FlowRules; |
||||
|
|
||||
|
if (no != null) |
||||
|
{ |
||||
|
if (no != "") |
||||
|
{ |
||||
|
q = q.Where(p => p.UnitNo.Equals(no)); |
||||
|
} |
||||
|
} |
||||
|
q.OrderBy(p => p.FlowRuleName); |
||||
|
|
||||
|
var flowRule = await q.ToListAsync(); |
||||
|
|
||||
|
if (flowRule == null) |
||||
|
{ |
||||
|
return NotFound(); |
||||
|
} |
||||
|
|
||||
|
return flowRule; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 根據流程ID獲取指定單一資料
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
// GET: api/FlowRules/5
|
||||
|
[HttpGet("{id}")] |
||||
|
public async Task<ActionResult<IEnumerable<FlowRule>>> GetFlowRule(int id) |
||||
|
{ |
||||
|
IQueryable<FlowRule> q = _context.FlowRules; |
||||
|
|
||||
|
q = q.Where(p => p.FlowRuleID.Equals(id)); |
||||
|
|
||||
|
var flowRule = await q.ToListAsync(); |
||||
|
|
||||
|
if (flowRule == null) |
||||
|
{ |
||||
|
return NotFound(); |
||||
|
} |
||||
|
|
||||
|
return flowRule; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 更新流程資料
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <param name="flowRule"></param>
|
||||
|
/// <returns></returns>
|
||||
|
// PUT: api/FlowRules/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<ActionResult<FlowRule>> PutFlowRule(int id, [FromBody] FlowRule flowRule) |
||||
|
{ |
||||
|
if (id != flowRule.FlowRuleID) |
||||
|
{ |
||||
|
return BadRequest(); |
||||
|
} |
||||
|
|
||||
|
_context.Entry(flowRule).State = EntityState.Modified; |
||||
|
flowRule.UpdateDate = DateTime.Now; |
||||
|
|
||||
|
try |
||||
|
{ |
||||
|
await _context.SaveChangesAsync(); |
||||
|
} |
||||
|
catch (DbUpdateConcurrencyException) |
||||
|
{ |
||||
|
if (!FlowRuleExists(id)) |
||||
|
{ |
||||
|
return NotFound(); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
throw; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return flowRule; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 新增流程資料
|
||||
|
/// </summary>
|
||||
|
/// <param name="flowRule"></param>
|
||||
|
/// <returns></returns>
|
||||
|
// POST: api/FlowRules
|
||||
|
// 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<ActionResult<FlowRule>> PostFlowRule([FromBody] FlowRule flowRule) |
||||
|
{ |
||||
|
Helper helper = new Helper(_context); |
||||
|
flowRule.FlowRuleID = helper.GetIDKey("FLOW_RULE_ID").Result; |
||||
|
flowRule.CreateDate = DateTime.Now; |
||||
|
|
||||
|
_context.FlowRules.Add(flowRule); |
||||
|
await _context.SaveChangesAsync(); |
||||
|
|
||||
|
return CreatedAtAction("GetFlowRule", new { id = flowRule.FlowRuleID }, flowRule); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 刪除流程資料
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
// DELETE: api/FlowRules/5
|
||||
|
[HttpDelete("{id}")] |
||||
|
public async Task<ActionResult<FlowRule>> DeleteFlowRule(int id) |
||||
|
{ |
||||
|
var flowRule = await _context.FlowRules.FindAsync(id); |
||||
|
if (flowRule == null) |
||||
|
{ |
||||
|
return NotFound(); |
||||
|
} |
||||
|
|
||||
|
_context.FlowRules.Remove(flowRule); |
||||
|
await _context.SaveChangesAsync(); |
||||
|
|
||||
|
return flowRule; |
||||
|
} |
||||
|
|
||||
|
private bool FlowRuleExists(int id) |
||||
|
{ |
||||
|
return _context.FlowRules.Any(e => e.FlowRuleID == id); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,211 @@ |
|||||
|
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.BAS; |
||||
|
|
||||
|
namespace AMESCoreStudio.WebApi.Controllers.BAS |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 流程站別資料維護
|
||||
|
/// </summary>
|
||||
|
[Route("api/[controller]")]
|
||||
|
[ApiController] |
||||
|
public class RuleStationsController : ControllerBase |
||||
|
{ |
||||
|
private readonly AMESContext _context; |
||||
|
|
||||
|
/// <summary>
|
||||
|
///
|
||||
|
/// </summary>
|
||||
|
/// <param name="context"></param>
|
||||
|
public RuleStationsController(AMESContext context) |
||||
|
{ |
||||
|
_context = context; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 獲取全部流程站別資料
|
||||
|
/// </summary>
|
||||
|
/// <returns></returns>
|
||||
|
// GET: api/RuleStations
|
||||
|
[HttpGet] |
||||
|
public async Task<ActionResult<IEnumerable<RuleStation>>> GetRuleStation() |
||||
|
{ |
||||
|
IQueryable<RuleStation> q = _context.RuleStations; |
||||
|
|
||||
|
q.OrderBy(p => p.FlowRuleID + p.Sequence); |
||||
|
|
||||
|
var ruleStation = await q.ToListAsync(); |
||||
|
|
||||
|
foreach (var data in ruleStation) |
||||
|
{ |
||||
|
data.Station = _context.Stationses.Where(p1 => p1.StationID.Equals(data.StationID)).FirstOrDefault(); |
||||
|
} |
||||
|
|
||||
|
if (ruleStation == null) |
||||
|
{ |
||||
|
return NotFound(); |
||||
|
} |
||||
|
|
||||
|
return ruleStation; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 根據流程ID獲取該流程站別資料
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
// GET: api/RuleStations/Flow/5
|
||||
|
[HttpGet("Flow/{id}")] |
||||
|
public async Task<ActionResult<IEnumerable<RuleStation>>> GetRuleStationByFlow(int id) |
||||
|
{ |
||||
|
IQueryable<RuleStation> q = _context.RuleStations; |
||||
|
|
||||
|
if (id > 0) |
||||
|
{ |
||||
|
q = q.Where(p => p.FlowRuleID.Equals(id)); |
||||
|
} |
||||
|
q.OrderBy(p => p.Sequence); |
||||
|
|
||||
|
|
||||
|
try |
||||
|
{ |
||||
|
var ruleStation = await q.ToListAsync(); |
||||
|
|
||||
|
foreach (var data in ruleStation) |
||||
|
{ |
||||
|
data.Station = _context.Stationses.Where(p1 => p1.StationID.Equals(data.StationID)).FirstOrDefault(); |
||||
|
} |
||||
|
|
||||
|
if (ruleStation == null) |
||||
|
{ |
||||
|
return NotFound(); |
||||
|
} |
||||
|
|
||||
|
return ruleStation; |
||||
|
} |
||||
|
catch (Exception e1) |
||||
|
{ |
||||
|
string msg = e1.Message; |
||||
|
} |
||||
|
|
||||
|
return NotFound(); |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 根據流程站別ID獲取指定單一資料
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
// GET: api/RuleStations/5
|
||||
|
[HttpGet("{id}")] |
||||
|
public async Task<ActionResult<IEnumerable<RuleStation>>> GetRuleStation(int id) |
||||
|
{ |
||||
|
IQueryable<RuleStation> q = _context.RuleStations; |
||||
|
|
||||
|
q = q.Where(p => p.RuleStationID.Equals(id)); |
||||
|
|
||||
|
var ruleStation = await q.ToListAsync(); |
||||
|
|
||||
|
if (ruleStation == null) |
||||
|
{ |
||||
|
return NotFound(); |
||||
|
} |
||||
|
|
||||
|
return ruleStation; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 更新流程站別資料
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <param name="ruleStation"></param>
|
||||
|
/// <returns></returns>
|
||||
|
// PUT: api/RuleStations/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<ActionResult<RuleStation>> PutRuleStation(int id, [FromBody] RuleStation ruleStation) |
||||
|
{ |
||||
|
if (id != ruleStation.RuleStationID) |
||||
|
{ |
||||
|
return BadRequest(); |
||||
|
} |
||||
|
|
||||
|
_context.Entry(ruleStation).State = EntityState.Modified; |
||||
|
ruleStation.UpdateDate = DateTime.Now; |
||||
|
|
||||
|
try |
||||
|
{ |
||||
|
await _context.SaveChangesAsync(); |
||||
|
} |
||||
|
catch (DbUpdateConcurrencyException) |
||||
|
{ |
||||
|
if (!RuleStationExists(id)) |
||||
|
{ |
||||
|
return NotFound(); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
throw; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return ruleStation; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 新增流程站別資料
|
||||
|
/// </summary>
|
||||
|
/// <param name="ruleStation"></param>
|
||||
|
/// <returns></returns>
|
||||
|
// POST: api/RuleStations
|
||||
|
// 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<ActionResult<RuleStation>> PostRuleStation([FromBody] RuleStation ruleStation) |
||||
|
{ |
||||
|
Helper helper = new Helper(_context); |
||||
|
ruleStation.RuleStationID = helper.GetIDKey("RULE_STATION_ID").Result; |
||||
|
ruleStation.CreateDate = DateTime.Now; |
||||
|
|
||||
|
_context.RuleStations.Add(ruleStation); |
||||
|
await _context.SaveChangesAsync(); |
||||
|
|
||||
|
return CreatedAtAction("GetRuleStation", new { id = ruleStation.RuleStationID }, ruleStation); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 刪除流程站別資料
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
// DELETE: api/RuleStations/5
|
||||
|
[HttpDelete("{id}")] |
||||
|
public async Task<ActionResult<RuleStation>> DeleteRuleStation(int id) |
||||
|
{ |
||||
|
var ruleStation = await _context.RuleStations.FindAsync(id); |
||||
|
if (ruleStation == null) |
||||
|
{ |
||||
|
return NotFound(); |
||||
|
} |
||||
|
|
||||
|
_context.RuleStations.Remove(ruleStation); |
||||
|
await _context.SaveChangesAsync(); |
||||
|
|
||||
|
return ruleStation; |
||||
|
} |
||||
|
|
||||
|
private bool RuleStationExists(int id) |
||||
|
{ |
||||
|
return _context.RuleStations.Any(e => e.RuleStationID == id); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,214 @@ |
|||||
|
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.BAS; |
||||
|
|
||||
|
namespace AMESCoreStudio.WebApi.Controllers.BAS |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 流程規則資料維護
|
||||
|
/// </summary>
|
||||
|
[Route("api/[controller]")]
|
||||
|
[ApiController] |
||||
|
public class RulesController : ControllerBase |
||||
|
{ |
||||
|
private readonly AMESContext _context; |
||||
|
|
||||
|
/// <summary>
|
||||
|
///
|
||||
|
/// </summary>
|
||||
|
/// <param name="context"></param>
|
||||
|
public RulesController(AMESContext context) |
||||
|
{ |
||||
|
_context = context; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 獲取全部流程規則資料
|
||||
|
/// </summary>
|
||||
|
/// <returns></returns>
|
||||
|
// GET: api/Rules
|
||||
|
[HttpGet] |
||||
|
public async Task<ActionResult<IEnumerable<Rules>>> GetRules() |
||||
|
{ |
||||
|
IQueryable<Rules> q = _context.Ruleses; |
||||
|
q.OrderBy(p => p.RuleStationID + p.RuleSeq); |
||||
|
|
||||
|
var rules = await q.ToListAsync(); |
||||
|
|
||||
|
foreach (var data in rules) |
||||
|
{ |
||||
|
data.NextStation = _context.Stationses.Find(data.NextStationID); |
||||
|
} |
||||
|
|
||||
|
if (rules == null) |
||||
|
{ |
||||
|
return NotFound(); |
||||
|
} |
||||
|
|
||||
|
return rules; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 根據流程ID獲取流程規則資料
|
||||
|
/// </summary>
|
||||
|
/// <returns></returns>
|
||||
|
// GET: api/Rules/Flow/5
|
||||
|
[HttpGet("Flow/{id}")] |
||||
|
public async Task<ActionResult<IEnumerable<Rules>>> GetRulesByFlow(int id) |
||||
|
{ |
||||
|
var query = from q1 in _context.Ruleses |
||||
|
join q2 in _context.RuleStations on q1.RuleStationID equals q2.RuleStationID |
||||
|
join q3 in _context.Stationses on q1.NextStationID equals q3.StationID |
||||
|
where q2.FlowRuleID.Equals(id) |
||||
|
select new { |
||||
|
q1.RuleStationID, |
||||
|
q1.RuleSeq, |
||||
|
CurrStationId = q2.StationID, |
||||
|
NextStationId = q3.StationID |
||||
|
}; |
||||
|
query.OrderBy(p => p.RuleStationID + p.RuleSeq); |
||||
|
|
||||
|
var qdata = await query.ToListAsync(); |
||||
|
int[] list = new int[qdata.Count]; |
||||
|
int[] list1 = new int[qdata.Count]; |
||||
|
int[] list2 = new int[qdata.Count]; |
||||
|
for (int i=0;i<list.Length;i++) |
||||
|
{ |
||||
|
list[i] = qdata[i].RuleStationID; |
||||
|
list1[i] = qdata[i].CurrStationId; |
||||
|
list2[i] = qdata[i].NextStationId; |
||||
|
} |
||||
|
|
||||
|
IQueryable<Rules> q = _context.Ruleses; |
||||
|
q = q.Where(p=>list.Contains(p.RuleStationID)); |
||||
|
var rules = await q.ToListAsync(); |
||||
|
|
||||
|
for(int j=0;j<rules.Count;j++) |
||||
|
{ |
||||
|
//rules[j].CurrStation = _context.Stationses.Where(p1 => p1.StationID.Equals(list1[j])).FirstOrDefault();
|
||||
|
rules[j].RuleDesc = _context.Stationses.Where(p1 => p1.StationID.Equals(list1[j])).FirstOrDefault().StationName; |
||||
|
rules[j].NextStation = _context.Stationses.Where(p1 => p1.StationID.Equals(list2[j])).FirstOrDefault(); |
||||
|
} |
||||
|
|
||||
|
if (rules == null) |
||||
|
{ |
||||
|
return NotFound(); |
||||
|
} |
||||
|
|
||||
|
return rules; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 根據流程站別ID查詢指定單一資料
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
// GET: api/Rules/5
|
||||
|
[HttpGet("{id}")] |
||||
|
public async Task<ActionResult<IEnumerable<Rules>>> GetRules(int id) |
||||
|
{ |
||||
|
IQueryable<Rules> q = _context.Ruleses; |
||||
|
|
||||
|
q = q.Where(p => p.RuleStationID.Equals(id)); |
||||
|
|
||||
|
var rules = await q.ToListAsync(); |
||||
|
|
||||
|
if (rules == null) |
||||
|
{ |
||||
|
return NotFound(); |
||||
|
} |
||||
|
|
||||
|
return rules; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 更新流程規則資料
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <param name="rules"></param>
|
||||
|
/// <returns></returns>
|
||||
|
// PUT: api/Rules/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<ActionResult<Rules>> PutRules(int id, [FromBody]Rules rules) |
||||
|
{ |
||||
|
if (id != rules.RuleStationID) |
||||
|
{ |
||||
|
return BadRequest(); |
||||
|
} |
||||
|
|
||||
|
_context.Entry(rules).State = EntityState.Modified; |
||||
|
rules.UpdateDate = DateTime.Now; |
||||
|
|
||||
|
try |
||||
|
{ |
||||
|
await _context.SaveChangesAsync(); |
||||
|
} |
||||
|
catch (DbUpdateConcurrencyException) |
||||
|
{ |
||||
|
if (!RulesExists(id)) |
||||
|
{ |
||||
|
return NotFound(); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
throw; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return rules; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 新增流程規則資料
|
||||
|
/// </summary>
|
||||
|
/// <param name="rules"></param>
|
||||
|
/// <returns></returns>
|
||||
|
// POST: api/Rules
|
||||
|
// 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<ActionResult<Rules>> PostRules([FromBody] Rules rules) |
||||
|
{ |
||||
|
rules.CreateDate = DateTime.Now; |
||||
|
|
||||
|
_context.Ruleses.Add(rules); |
||||
|
await _context.SaveChangesAsync(); |
||||
|
|
||||
|
return CreatedAtAction("GetRules", new { id = rules.RuleStationID }, rules); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 刪除流程規則資料
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
// DELETE: api/Rules/5
|
||||
|
[HttpDelete("{id}")] |
||||
|
public async Task<ActionResult<Rules>> DeleteRules(int id) |
||||
|
{ |
||||
|
var rules = await _context.Ruleses.FindAsync(id); |
||||
|
if (rules == null) |
||||
|
{ |
||||
|
return NotFound(); |
||||
|
} |
||||
|
|
||||
|
_context.Ruleses.Remove(rules); |
||||
|
await _context.SaveChangesAsync(); |
||||
|
|
||||
|
return rules; |
||||
|
} |
||||
|
|
||||
|
private bool RulesExists(int id) |
||||
|
{ |
||||
|
return _context.Ruleses.Any(e => e.RuleStationID == id); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,102 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.ComponentModel.DataAnnotations.Schema; |
||||
|
using System.Runtime.Serialization; |
||||
|
|
||||
|
namespace AMESCoreStudio.WebApi.Models.BAS |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 流程資料
|
||||
|
/// </summary>
|
||||
|
[Table("FLOW_RULE", Schema = "JHAMES")] |
||||
|
public class FlowRule |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 流程編號
|
||||
|
/// </summary>
|
||||
|
[Key] |
||||
|
[Column("FLOW_RULE_ID")] |
||||
|
[DataMember] |
||||
|
public int FlowRuleID { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 流程名稱
|
||||
|
/// </summary>
|
||||
|
[Column("FLOW_RULE_NAME")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "流程名稱")] |
||||
|
[Required(ErrorMessage = "{0},不能空白")] |
||||
|
[StringLength(50, ErrorMessage = "{0},不能大于{1}")] |
||||
|
public string FlowRuleName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 流程描述
|
||||
|
/// </summary>
|
||||
|
[Column("FLOW_RULE_DESC")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "流程描述")] |
||||
|
[Required(ErrorMessage = "{0},不能空白")] |
||||
|
[StringLength(200, ErrorMessage = "{0},不能大于{1}")] |
||||
|
public string FlowRuleDesc { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 流程狀態
|
||||
|
/// </summary>
|
||||
|
[Column("FLOW_STATUS")] |
||||
|
[Display(Name = "流程狀態")] |
||||
|
[DataMember] |
||||
|
[Required(ErrorMessage = "{0},不能空白")] |
||||
|
[StringLength(1, ErrorMessage = "{0},不能大于{1}")] |
||||
|
public string FlowStatus { get; set; } = "A"; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 系統標記
|
||||
|
/// </summary>
|
||||
|
[Column("SYS_TYPE")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "系統標記")] |
||||
|
[Required(ErrorMessage = "{0},不能空白")] |
||||
|
[StringLength(1, ErrorMessage = "{0},不能大于{1}")] |
||||
|
public string SysType { get; set; } = "U"; |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生產單位代碼
|
||||
|
/// </summary>
|
||||
|
[Column("UNIT_NO")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "生產單位代碼")] |
||||
|
[Required(ErrorMessage = "{0},不能空白")] |
||||
|
[StringLength(1, ErrorMessage = "{0},不能大于{1}")] |
||||
|
public string UnitNo { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 流程類型
|
||||
|
/// </summary>
|
||||
|
[Column("FLOW_TYPE")] |
||||
|
[Display(Name = "流程類型")] |
||||
|
[DataMember] |
||||
|
public string FlowType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 建立人員
|
||||
|
/// </summary>
|
||||
|
[Column("CREATE_USERID")] |
||||
|
[DataMember] |
||||
|
public int CreateUserId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 建立時間
|
||||
|
/// </summary>
|
||||
|
[Column("CREATE_DATE")] |
||||
|
[DataMember] |
||||
|
public DateTime CreateDate { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 修改時間
|
||||
|
/// </summary>
|
||||
|
[Column("UPDATE_DATE")] |
||||
|
public DateTime UpdateDate { get; set; } |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,90 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.ComponentModel.DataAnnotations.Schema; |
||||
|
using System.Runtime.Serialization; |
||||
|
|
||||
|
namespace AMESCoreStudio.WebApi.Models.BAS |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 流程站別資料
|
||||
|
/// </summary>
|
||||
|
[Table("RULE_STATION", Schema = "JHAMES")] |
||||
|
public class RuleStation |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 流程站別編號
|
||||
|
/// </summary>
|
||||
|
[Key] |
||||
|
[Column("RULE_STATION_ID")] |
||||
|
[DataMember] |
||||
|
public int RuleStationID { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 流程編號
|
||||
|
/// </summary>
|
||||
|
[Column("FLOW_RULE_ID")] |
||||
|
[Display(Name = "流程編號")] |
||||
|
[DataMember] |
||||
|
public int FlowRuleID { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 站別編號
|
||||
|
/// </summary>
|
||||
|
[Column("STATION_ID")] |
||||
|
[Display(Name = "站別編號")] |
||||
|
[DataMember] |
||||
|
public int StationID { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 站別描述
|
||||
|
/// </summary>
|
||||
|
[Column("STATION_DESC")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "站別描述")] |
||||
|
[Required(ErrorMessage = "{0},不能空白")] |
||||
|
[StringLength(200, ErrorMessage = "{0},不能大于{1}")] |
||||
|
public string StationDesc { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 站別順序
|
||||
|
/// </summary>
|
||||
|
[Column("SEQUENCE")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "站別順序")] |
||||
|
[Required(ErrorMessage = "{0},不能空白")] |
||||
|
public int Sequence { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 站別類型
|
||||
|
/// </summary>
|
||||
|
[Column("STATION_TYPE")] |
||||
|
[Display(Name = "站別類型")] |
||||
|
[DataMember] |
||||
|
public string StationType { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 建立人員
|
||||
|
/// </summary>
|
||||
|
[Column("CREATE_USERID")] |
||||
|
[DataMember] |
||||
|
public int CreateUserId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 建立時間
|
||||
|
/// </summary>
|
||||
|
[Column("CREATE_DATE")] |
||||
|
[DataMember] |
||||
|
public DateTime CreateDate { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 修改時間
|
||||
|
/// </summary>
|
||||
|
[Column("UPDATE_DATE")] |
||||
|
public DateTime UpdateDate { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 站別资料
|
||||
|
/// </summary>
|
||||
|
public virtual Stations Station { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,88 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.ComponentModel.DataAnnotations.Schema; |
||||
|
using System.Runtime.Serialization; |
||||
|
|
||||
|
namespace AMESCoreStudio.WebApi.Models.BAS |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 流程站別規則資料
|
||||
|
/// </summary>
|
||||
|
[Table("RULES", Schema = "JHAMES")] |
||||
|
public class Rules |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 流程站別編號
|
||||
|
/// </summary>
|
||||
|
[Key] |
||||
|
[Column("RULE_STATION_ID")] |
||||
|
[Display(Name = "流程站別編號")] |
||||
|
[DataMember] |
||||
|
public int RuleStationID { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 規則描述
|
||||
|
/// </summary>
|
||||
|
[Column("RULE_DESC")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "規則描述")] |
||||
|
[Required(ErrorMessage = "{0},不能空白")] |
||||
|
[StringLength(200, ErrorMessage = "{0},不能大于{1}")] |
||||
|
public string RuleDesc { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 規則狀態
|
||||
|
/// </summary>
|
||||
|
[Column("RULE_STATUS")] |
||||
|
[Display(Name = "規則狀態")] |
||||
|
[DataMember] |
||||
|
public string RuleStatus { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 下一站別編號
|
||||
|
/// </summary>
|
||||
|
[Column("NEXT_STATION_ID")] |
||||
|
[Display(Name = "下一站別編號")] |
||||
|
[DataMember] |
||||
|
public int NextStationID { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 規則順序
|
||||
|
/// </summary>
|
||||
|
[Column("RULE_SEQ")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "規則順序")] |
||||
|
[Required(ErrorMessage = "{0},不能空白")] |
||||
|
public int RuleSeq { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 建立人員
|
||||
|
/// </summary>
|
||||
|
[Column("CREATE_USERID")] |
||||
|
[DataMember] |
||||
|
public int CreateUserId { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 建立時間
|
||||
|
/// </summary>
|
||||
|
[Column("CREATE_DATE")] |
||||
|
[DataMember] |
||||
|
public DateTime CreateDate { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 修改時間
|
||||
|
/// </summary>
|
||||
|
[Column("UPDATE_DATE")] |
||||
|
public DateTime UpdateDate { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 当前站別资料
|
||||
|
/// </summary>
|
||||
|
//public virtual Stations CurrStation { get; set; }
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 下一站別资料
|
||||
|
/// </summary>
|
||||
|
public virtual Stations NextStation { get; set; } |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue