15 changed files with 2436 additions and 12 deletions
@ -0,0 +1,150 @@ |
|||||
|
@{ |
||||
|
ViewData["Title"] = "除外站別維護"; |
||||
|
Layout = "~/Views/Shared/_AMESLayout.cshtml"; |
||||
|
} |
||||
|
@model AMESCoreStudio.WebApi.Models.AMES.ExceptStations |
||||
|
|
||||
|
<div class="layui-card"> |
||||
|
<div class="layui-card-header"> |
||||
|
<div class="layui-inline"><i class="fa fa-file-text-o fa-fw"></i> @ViewBag.Title</div> |
||||
|
</div> |
||||
|
<div class="layui-card-body"> |
||||
|
<div class="layui-form"> |
||||
|
<div class="layui-form-item"> |
||||
|
<div class="layui-inline" style="margin-right:0px;"> |
||||
|
<label class="layui-inline layui-form-label" style="width:80px;">途程生產單位</label> |
||||
|
<div class="layui-input-inline" style="width: 90px; margin-right: 5px;"> |
||||
|
<select style="width:90px;" lay-filter="unitNo" lay-submit id="unitNo" name="unitNo" asp-items="@ViewBag.FactoryUnit"> |
||||
|
</select> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-inline" style="margin-left:0px;"> |
||||
|
<button id="btnSearch" class="layui-btn tt"> |
||||
|
<i class="layui-icon"></i>搜索 |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<input type="hidden" asp-for="UpdateUserID" value="@ViewBag.UserID" /> |
||||
|
<table class="layui-hide" id="test" lay-filter="test"></table> |
||||
|
</div> |
||||
|
</div> |
||||
|
@section Scripts{ |
||||
|
<script type="text/javascript"> |
||||
|
var tableCols = [[ |
||||
|
{ |
||||
|
field: 'exceptStationsID', |
||||
|
width: 100, |
||||
|
title: '#', |
||||
|
sort: true |
||||
|
}, |
||||
|
{ |
||||
|
field: 'stationID', |
||||
|
width: 200, |
||||
|
title: '需排除途程站點', |
||||
|
}, |
||||
|
{ |
||||
|
field: 'exceptStationsName', |
||||
|
title: '站點名稱', |
||||
|
}, |
||||
|
{ |
||||
|
field: 'center', |
||||
|
width: 200, |
||||
|
title: '操作', |
||||
|
templet: function (d) { |
||||
|
var btns = ''; |
||||
|
if (d.statusNo == "A") |
||||
|
btns = btns + ' <a class="layui-btn layui-btn-danger layui-btn-xs layui-icon layui-icon-delete" lay-event="del">停用</a>'; |
||||
|
else if (d.statusNo == "S") |
||||
|
btns = btns + ' <a class="layui-btn layui-btn-normal layui-btn-xs layui-icon layui-icon-edit" lay-event="del">啟用</a>'; |
||||
|
return btns; |
||||
|
} |
||||
|
} |
||||
|
]]; |
||||
|
//通过行tool編輯,lay-event="del" |
||||
|
|
||||
|
function del(obj) { |
||||
|
if (obj.data.exceptStationsID) { |
||||
|
if (obj.data.statusNo == 'A') |
||||
|
str = '停用'; |
||||
|
else |
||||
|
str = '啟用'; |
||||
|
hg.confirm("除外站點:" + obj.data.exceptStationsName + ",確定要" + str + "嗎?", function () { |
||||
|
$.ajax({ |
||||
|
url: '/WHS/WHS026D', |
||||
|
data: { id: obj.data.exceptStationsID }, |
||||
|
type: 'POST', |
||||
|
success: function (data) { |
||||
|
if (data.success) { |
||||
|
hg.msghide(str + "成功!"); |
||||
|
} |
||||
|
else { |
||||
|
hg.msg(data.msg); |
||||
|
} |
||||
|
tt(); |
||||
|
}, |
||||
|
error: function () { |
||||
|
hg.msg("網路請求失!"); |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
////搜索 |
||||
|
$('#btnSearch').click(function () { |
||||
|
|
||||
|
hg.msghide("刷新資料!"); |
||||
|
tt(); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
layui.use(['form', 'layer', 'laydate'], function () { |
||||
|
form = layui.form; |
||||
|
form.on('select(unitNo)', function (data) { |
||||
|
var data = $("#unitNo").val(); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
|
||||
|
|
||||
|
////搜索 |
||||
|
$('#querysubmit').click(function () { |
||||
|
hg.msghide("刷新資料!"); |
||||
|
tt(); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
var toolbar = [{ |
||||
|
text: '新增', |
||||
|
layuiicon: '', |
||||
|
class: 'layui-btn-normal', |
||||
|
handler: function () { |
||||
|
hg.open('新增除外站別', '/WHS/WHS026C', 800, 400); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
]; |
||||
|
|
||||
|
var table; |
||||
|
$(function () { |
||||
|
tt(); |
||||
|
}); |
||||
|
//基本資料表格 |
||||
|
function tt() { |
||||
|
var unit = $("#unitNo").val(); |
||||
|
|
||||
|
table = hg.table.datatable('test', '除外站別維護', '/WHS/GetExceptStation?unit=' + unit |
||||
|
, {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,118 @@ |
|||||
|
@model AMESCoreStudio.WebApi.Models.AMES.ExceptStations |
||||
|
|
||||
|
@{ |
||||
|
ViewData["Title"] = "WHS026C"; |
||||
|
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="WHS026CSave"> |
||||
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
||||
|
<input type="hidden" asp-for="ExceptStationsID" value="0" /> |
||||
|
<input type="hidden" asp-for="CreateUserID" value="@ViewBag.UserID" /> |
||||
|
<input type="hidden" asp-for="UpdateUserID" value="@ViewBag.UserID" /> |
||||
|
<input type="hidden" asp-for="CreateDate" value="@System.DateTime.Now" /> |
||||
|
<input type="hidden" asp-for="UpdateDate" value="@System.DateTime.Now" /> |
||||
|
|
||||
|
|
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label class="control-label col-sm-3">途程生產單位</label> |
||||
|
<select id="UnitNo" asp-for="UnitNo" asp-items="@ViewBag.FactoryUnit" class="custom-select col-sm-7"> |
||||
|
<option value="">請選擇</option> |
||||
|
</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 class="control-label col-sm-3">途程生產站別</label> |
||||
|
<select id="StationID" asp-for="StationID" class="custom-select col-sm-7"> |
||||
|
<option value="">請選擇</option> |
||||
|
<option value="-1">N/A</option> |
||||
|
</select> |
||||
|
<span asp-validation-for="StationID" 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 () { |
||||
|
|
||||
|
$("#UnitNo").on("change", function () { |
||||
|
var unitNo = $(this).val(); |
||||
|
|
||||
|
// 若沒選擇,清空 Station |
||||
|
if (!unitNo) { |
||||
|
$("#StationID").empty() |
||||
|
.append(new Option("請選擇", "")); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
getStations(unitNo); |
||||
|
}); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
function getStations(unitNo) { |
||||
|
$.ajax({ |
||||
|
url: "/WHS/GetStationListByUnit", |
||||
|
type: "GET", |
||||
|
data: { id: unitNo }, |
||||
|
success: function (result) { |
||||
|
|
||||
|
$("#StationID").empty(); |
||||
|
$("#StationID").append(new Option("請選擇", "")); |
||||
|
|
||||
|
if (result && result.data && result.data.length > 0) { |
||||
|
|
||||
|
let hasData = false; |
||||
|
|
||||
|
$.each(result.data, function (index, item) { |
||||
|
if (item.statusNo === "A") { // 只顯示啟用 |
||||
|
$("#StationID").append( |
||||
|
new Option(item.stationName, item.stationID) |
||||
|
); |
||||
|
hasData = true; |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
if (!hasData) { |
||||
|
$("#StationID").empty() |
||||
|
.append(new Option("無選項", "")); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
$("#StationID").append(new Option("無選項", "")); |
||||
|
} |
||||
|
}, |
||||
|
error: function () { |
||||
|
hg.msg("取得站別資料失敗"); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
@ -0,0 +1,159 @@ |
|||||
|
@{ |
||||
|
ViewData["Title"] = "報工對應途程站點資料檔"; |
||||
|
Layout = "~/Views/Shared/_AMESLayout.cshtml"; |
||||
|
} |
||||
|
@model AMESCoreStudio.WebApi.Models.AMES.WorkingFlowStations |
||||
|
|
||||
|
<div class="layui-card"> |
||||
|
<div class="layui-card-header"> |
||||
|
<div class="layui-inline"><i class="fa fa-file-text-o fa-fw"></i> @ViewBag.Title</div> |
||||
|
</div> |
||||
|
<div class="layui-card-body"> |
||||
|
<div class="layui-form"> |
||||
|
<div class="layui-form-item"> |
||||
|
<div class="layui-inline" style="margin-right:0px;"> |
||||
|
<label class="layui-inline layui-form-label" style="width:80px;">報工生產單位</label> |
||||
|
<div class="layui-input-inline" style="width: 90px; margin-right: 5px;"> |
||||
|
<select style="width:90px;" lay-filter="unitNo" lay-submit id="unitNo" name="unitNo" asp-items="@ViewBag.WorkingUnitNo"> |
||||
|
</select> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-inline" style="margin-left:0px;"> |
||||
|
<button id="btnSearch" class="layui-btn tt"> |
||||
|
<i class="layui-icon"></i>搜索 |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<input type="hidden" asp-for="UpdateUserID" value="@ViewBag.UserID" /> |
||||
|
<table class="layui-hide" id="test" lay-filter="test"></table> |
||||
|
</div> |
||||
|
</div> |
||||
|
@section Scripts{ |
||||
|
<script type="text/javascript"> |
||||
|
var tableCols = [[ |
||||
|
{ |
||||
|
field: 'workingFlowStationsID', |
||||
|
width: 100, |
||||
|
title: '#', |
||||
|
sort: true |
||||
|
}, |
||||
|
{ |
||||
|
field: 'workingStationID', |
||||
|
width: 200, |
||||
|
title: '報工站點ID', |
||||
|
}, |
||||
|
{ |
||||
|
field: 'workingStationName', |
||||
|
title: '報工站點名稱', |
||||
|
}, |
||||
|
{ |
||||
|
field: 'stationID', |
||||
|
width: 200, |
||||
|
title: '途程站點ID', |
||||
|
}, |
||||
|
{ |
||||
|
field: 'stationName', |
||||
|
title: '途程站點名稱', |
||||
|
}, |
||||
|
{ |
||||
|
field: 'center', |
||||
|
width: 200, |
||||
|
title: '操作', |
||||
|
templet: function (d) { |
||||
|
var btns = ''; |
||||
|
if (d.statusNo == "A") |
||||
|
btns = btns + ' <a class="layui-btn layui-btn-danger layui-btn-xs layui-icon layui-icon-delete" lay-event="del">停用</a>'; |
||||
|
else if (d.statusNo == "S") |
||||
|
btns = btns + ' <a class="layui-btn layui-btn-normal layui-btn-xs layui-icon layui-icon-edit" lay-event="del">啟用</a>'; |
||||
|
return btns; |
||||
|
} |
||||
|
} |
||||
|
]]; |
||||
|
//通过行tool編輯,lay-event="del" |
||||
|
|
||||
|
function del(obj) { |
||||
|
if (obj.data.workingFlowStationsID) { |
||||
|
if (obj.data.statusNo == 'A') |
||||
|
str = '停用'; |
||||
|
else |
||||
|
str = '啟用'; |
||||
|
hg.confirm("報工站點:" + obj.data.workingStationName + ",確定要" + str + "嗎?", function () { |
||||
|
$.ajax({ |
||||
|
url: '/WHS/WHS027D', |
||||
|
data: { id: obj.data.workingFlowStationsID }, |
||||
|
type: 'POST', |
||||
|
success: function (data) { |
||||
|
if (data.success) { |
||||
|
hg.msghide(str + "成功!"); |
||||
|
} |
||||
|
else { |
||||
|
hg.msg(data.msg); |
||||
|
} |
||||
|
tt(); |
||||
|
}, |
||||
|
error: function () { |
||||
|
hg.msg("網路請求失!"); |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
////搜索 |
||||
|
$('#btnSearch').click(function () { |
||||
|
|
||||
|
hg.msghide("刷新資料!"); |
||||
|
tt(); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
layui.use(['form', 'layer', 'laydate'], function () { |
||||
|
form = layui.form; |
||||
|
form.on('select(unitNo)', function (data) { |
||||
|
var data = $("#unitNo").val(); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
|
||||
|
|
||||
|
////搜索 |
||||
|
$('#querysubmit').click(function () { |
||||
|
hg.msghide("刷新資料!"); |
||||
|
tt(); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
var toolbar = [{ |
||||
|
text: '新增', |
||||
|
layuiicon: '', |
||||
|
class: 'layui-btn-normal', |
||||
|
handler: function () { |
||||
|
hg.open('新增除外站別', '/WHS/WHS027C', 800, 400); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
]; |
||||
|
|
||||
|
var table; |
||||
|
$(function () { |
||||
|
tt(); |
||||
|
}); |
||||
|
//基本資料表格 |
||||
|
function tt() { |
||||
|
var unit = $("#unitNo").val(); |
||||
|
|
||||
|
table = hg.table.datatable('test', '除外站別維護', '/WHS/GetWorkingFlowStations?workingunit=' + unit |
||||
|
, {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,188 @@ |
|||||
|
@model AMESCoreStudio.WebApi.Models.AMES.WorkingFlowStations |
||||
|
|
||||
|
@{ |
||||
|
ViewData["Title"] = "WHS027C"; |
||||
|
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="WHS027CSave"> |
||||
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
||||
|
<input type="hidden" asp-for="WorkingFlowStationsID" value="0" /> |
||||
|
<input type="hidden" asp-for="CreateUserID" value="@ViewBag.UserID" /> |
||||
|
<input type="hidden" asp-for="UpdateUserID" value="@ViewBag.UserID" /> |
||||
|
<input type="hidden" asp-for="CreateDate" value="@System.DateTime.Now" /> |
||||
|
<input type="hidden" asp-for="UpdateDate" value="@System.DateTime.Now" /> |
||||
|
|
||||
|
|
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label class="control-label col-sm-3">報工生產單位</label> |
||||
|
<select id="WorkingUnitID" asp-for="WorkingUnitID" asp-items="@ViewBag.WorkingUnitNo" class="custom-select col-sm-7"> |
||||
|
<option value="">請選擇</option> |
||||
|
</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 class="control-label col-sm-3">報工生產站別</label> |
||||
|
<select id="WorkingStationID" asp-for="WorkingStationID" class="custom-select col-sm-7"> |
||||
|
<option value="">請選擇</option> |
||||
|
<option value="-1">N/A</option> |
||||
|
</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 class="control-label col-sm-3">途程生產單位</label> |
||||
|
<select id="UnitNo" asp-for="UnitNo" asp-items="@ViewBag.FactoryUnit" class="custom-select col-sm-7"> |
||||
|
<option value="">請選擇</option> |
||||
|
</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 class="control-label col-sm-3">途程生產站別</label> |
||||
|
<select id="StationID" asp-for="StationID" class="custom-select col-sm-7"> |
||||
|
<option value="">請選擇</option> |
||||
|
<option value="-1">N/A</option> |
||||
|
</select> |
||||
|
<span asp-validation-for="StationID" 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 () { |
||||
|
|
||||
|
$("#UnitNo").on("change", function () { |
||||
|
var unitNo = $(this).val(); |
||||
|
|
||||
|
// 若沒選擇,清空 Station |
||||
|
if (!unitNo) { |
||||
|
$("#StationID").empty() |
||||
|
.append(new Option("請選擇", "")); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
getStations(unitNo); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
$("#WorkingUnitID").on("change", function () { |
||||
|
var workingUnitID = $(this).val(); |
||||
|
|
||||
|
// 若沒選擇,清空 Station |
||||
|
if (!workingUnitID) { |
||||
|
$("#WorkingStationID").empty() |
||||
|
.append(new Option("請選擇", "")); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
getWorkingStations(workingUnitID); |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
function getStations(unitNo) { |
||||
|
$.ajax({ |
||||
|
url: "/WHS/GetStationListByUnit", |
||||
|
type: "GET", |
||||
|
data: { id: unitNo }, |
||||
|
success: function (result) { |
||||
|
|
||||
|
$("#StationID").empty(); |
||||
|
$("#StationID").append(new Option("請選擇", "")); |
||||
|
|
||||
|
if (result && result.data && result.data.length > 0) { |
||||
|
|
||||
|
let hasData = false; |
||||
|
|
||||
|
$.each(result.data, function (index, item) { |
||||
|
if (item.statusNo === "A") { // 只顯示啟用 |
||||
|
$("#StationID").append( |
||||
|
new Option(item.stationName, item.stationID) |
||||
|
); |
||||
|
hasData = true; |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
if (!hasData) { |
||||
|
$("#StationID").empty() |
||||
|
.append(new Option("無選項", "")); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
$("#StationID").append(new Option("無選項", "")); |
||||
|
} |
||||
|
}, |
||||
|
error: function () { |
||||
|
hg.msg("取得站別資料失敗"); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
function getWorkingStations(workingunitID) { |
||||
|
$.ajax({ |
||||
|
url: "/WHS/GetWorkingStationListByUnit", |
||||
|
type: "GET", |
||||
|
data: { id: workingunitID }, |
||||
|
success: function (result) { |
||||
|
|
||||
|
$("#WorkingStationID").empty(); |
||||
|
$("#WorkingStationID").append(new Option("請選擇", "")); |
||||
|
|
||||
|
if (result && result.data && result.data.length > 0) { |
||||
|
|
||||
|
let hasData = false; |
||||
|
|
||||
|
$.each(result.data, function (index, item) { |
||||
|
if (item.statusNo === "A") { // 只顯示啟用 |
||||
|
$("#WorkingStationID").append( |
||||
|
new Option(item.stationName, item.stationID) |
||||
|
); |
||||
|
hasData = true; |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
if (!hasData) { |
||||
|
$("#WorkingStationID").empty() |
||||
|
.append(new Option("無選項", "")); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
$("#WorkingStationID").append(new Option("無選項", "")); |
||||
|
} |
||||
|
}, |
||||
|
error: function () { |
||||
|
hg.msg("取得站別資料失敗"); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
@ -0,0 +1,159 @@ |
|||||
|
@{ |
||||
|
ViewData["Title"] = "前置加工入途程站點資料檔"; |
||||
|
Layout = "~/Views/Shared/_AMESLayout.cshtml"; |
||||
|
} |
||||
|
@model AMESCoreStudio.WebApi.Models.AMES.PreWorking |
||||
|
|
||||
|
<div class="layui-card"> |
||||
|
<div class="layui-card-header"> |
||||
|
<div class="layui-inline"><i class="fa fa-file-text-o fa-fw"></i> @ViewBag.Title</div> |
||||
|
</div> |
||||
|
<div class="layui-card-body"> |
||||
|
<div class="layui-form"> |
||||
|
<div class="layui-form-item"> |
||||
|
<div class="layui-inline" style="margin-right:0px;"> |
||||
|
<label class="layui-inline layui-form-label" style="width:80px;">報工生產單位</label> |
||||
|
<div class="layui-input-inline" style="width: 90px; margin-right: 5px;"> |
||||
|
<select style="width:90px;" lay-filter="unitNo" lay-submit id="unitNo" name="unitNo" asp-items="@ViewBag.WorkingUnitNo"> |
||||
|
</select> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-inline" style="margin-left:0px;"> |
||||
|
<button id="btnSearch" class="layui-btn tt"> |
||||
|
<i class="layui-icon"></i>搜索 |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<input type="hidden" asp-for="UpdateUserID" value="@ViewBag.UserID" /> |
||||
|
<table class="layui-hide" id="test" lay-filter="test"></table> |
||||
|
</div> |
||||
|
</div> |
||||
|
@section Scripts{ |
||||
|
<script type="text/javascript"> |
||||
|
var tableCols = [[ |
||||
|
{ |
||||
|
field: 'preWorkingID', |
||||
|
width: 100, |
||||
|
title: '#', |
||||
|
sort: true |
||||
|
}, |
||||
|
{ |
||||
|
field: 'stationID', |
||||
|
width: 200, |
||||
|
title: '途程站點ID', |
||||
|
}, |
||||
|
{ |
||||
|
field: 'stationName', |
||||
|
title: '途程站點名稱', |
||||
|
}, |
||||
|
{ |
||||
|
field: 'workingStationID', |
||||
|
width: 200, |
||||
|
title: '報工站點ID', |
||||
|
}, |
||||
|
{ |
||||
|
field: 'workingStationName', |
||||
|
title: '報工站點名稱', |
||||
|
}, |
||||
|
{ |
||||
|
field: 'center', |
||||
|
width: 200, |
||||
|
title: '操作', |
||||
|
templet: function (d) { |
||||
|
var btns = ''; |
||||
|
if (d.statusNo == "A") |
||||
|
btns = btns + ' <a class="layui-btn layui-btn-danger layui-btn-xs layui-icon layui-icon-delete" lay-event="del">停用</a>'; |
||||
|
else if (d.statusNo == "S") |
||||
|
btns = btns + ' <a class="layui-btn layui-btn-normal layui-btn-xs layui-icon layui-icon-edit" lay-event="del">啟用</a>'; |
||||
|
return btns; |
||||
|
} |
||||
|
} |
||||
|
]]; |
||||
|
//通过行tool編輯,lay-event="del" |
||||
|
|
||||
|
function del(obj) { |
||||
|
if (obj.data.preWorkingID) { |
||||
|
if (obj.data.statusNo == 'A') |
||||
|
str = '停用'; |
||||
|
else |
||||
|
str = '啟用'; |
||||
|
hg.confirm("途程站點:" + obj.data.stationName + ",確定要" + str + "嗎?", function () { |
||||
|
$.ajax({ |
||||
|
url: '/WHS/WHS028D', |
||||
|
data: { id: obj.data.preWorkingID, uid: $('#UpdateUserID').val() }, |
||||
|
type: 'POST', |
||||
|
success: function (data) { |
||||
|
if (data.success) { |
||||
|
hg.msghide(str + "成功!"); |
||||
|
} |
||||
|
else { |
||||
|
hg.msg(data.msg); |
||||
|
} |
||||
|
tt(); |
||||
|
}, |
||||
|
error: function () { |
||||
|
hg.msg("網路請求失!"); |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
////搜索 |
||||
|
$('#btnSearch').click(function () { |
||||
|
|
||||
|
hg.msghide("刷新資料!"); |
||||
|
tt(); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
layui.use(['form', 'layer', 'laydate'], function () { |
||||
|
form = layui.form; |
||||
|
form.on('select(unitNo)', function (data) { |
||||
|
var data = $("#unitNo").val(); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
|
||||
|
|
||||
|
////搜索 |
||||
|
$('#querysubmit').click(function () { |
||||
|
hg.msghide("刷新資料!"); |
||||
|
tt(); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
var toolbar = [{ |
||||
|
text: '新增', |
||||
|
layuiicon: '', |
||||
|
class: 'layui-btn-normal', |
||||
|
handler: function () { |
||||
|
hg.open('新增前置加工入途程站點', '/WHS/WHS028C', 800, 400); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
]; |
||||
|
|
||||
|
var table; |
||||
|
$(function () { |
||||
|
tt(); |
||||
|
}); |
||||
|
//基本資料表格 |
||||
|
function tt() { |
||||
|
var unit = $("#unitNo").val(); |
||||
|
|
||||
|
table = hg.table.datatable('test', '前置加工站別加入途程站點維護', '/WHS/GetPreWorking?workingunit=' + unit |
||||
|
, {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,185 @@ |
|||||
|
@model AMESCoreStudio.WebApi.Models.AMES.PreWorking |
||||
|
|
||||
|
@{ |
||||
|
ViewData["Title"] = "WHS028C"; |
||||
|
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="WHS028CSave"> |
||||
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
||||
|
<input type="hidden" asp-for="PreWorkingID" value="0" /> |
||||
|
<input type="hidden" asp-for="CreateUserID" value="@ViewBag.UserID" /> |
||||
|
<input type="hidden" asp-for="UpdateUserID" value="@ViewBag.UserID" /> |
||||
|
<input type="hidden" asp-for="CreateDate" value="@System.DateTime.Now" /> |
||||
|
<input type="hidden" asp-for="UpdateDate" value="@System.DateTime.Now" /> |
||||
|
<div class="form-group form-inline my-sm-1"> |
||||
|
<label class="control-label col-sm-3">途程生產單位</label> |
||||
|
<select id="UnitNo" asp-for="UnitNo" asp-items="@ViewBag.FactoryUnit" class="custom-select col-sm-7"> |
||||
|
<option value="">請選擇</option> |
||||
|
</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 class="control-label col-sm-3">途程生產站別</label> |
||||
|
<select id="StationID" asp-for="StationID" class="custom-select col-sm-7"> |
||||
|
<option value="">請選擇</option> |
||||
|
<option value="-1">N/A</option> |
||||
|
</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 class="control-label col-sm-3">報工生產單位</label> |
||||
|
<select id="WorkingUnitID" asp-for="WorkingUnitID" asp-items="@ViewBag.WorkingUnitNo" class="custom-select col-sm-7"> |
||||
|
<option value="">請選擇</option> |
||||
|
</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 class="control-label col-sm-3">報工生產站別</label> |
||||
|
<select id="WorkingStationID" asp-for="WorkingStationID" class="custom-select col-sm-7"> |
||||
|
<option value="">請選擇</option> |
||||
|
<option value="-1">N/A</option> |
||||
|
</select> |
||||
|
<span asp-validation-for="StationID" 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 () { |
||||
|
|
||||
|
$("#UnitNo").on("change", function () { |
||||
|
var unitNo = $(this).val(); |
||||
|
|
||||
|
// 若沒選擇,清空 Station |
||||
|
if (!unitNo) { |
||||
|
$("#StationID").empty() |
||||
|
.append(new Option("請選擇", "")); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
getStations(unitNo); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
$("#WorkingUnitID").on("change", function () { |
||||
|
var workingUnitID = $(this).val(); |
||||
|
|
||||
|
// 若沒選擇,清空 Station |
||||
|
if (!workingUnitID) { |
||||
|
$("#WorkingStationID").empty() |
||||
|
.append(new Option("請選擇", "")); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
getWorkingStations(workingUnitID); |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
function getStations(unitNo) { |
||||
|
$.ajax({ |
||||
|
url: "/WHS/GetStationListByUnit", |
||||
|
type: "GET", |
||||
|
data: { id: unitNo }, |
||||
|
success: function (result) { |
||||
|
|
||||
|
$("#StationID").empty(); |
||||
|
$("#StationID").append(new Option("請選擇", "")); |
||||
|
|
||||
|
if (result && result.data && result.data.length > 0) { |
||||
|
|
||||
|
let hasData = false; |
||||
|
|
||||
|
$.each(result.data, function (index, item) { |
||||
|
if (item.statusNo === "A") { // 只顯示啟用 |
||||
|
$("#StationID").append( |
||||
|
new Option(item.stationName, item.stationID) |
||||
|
); |
||||
|
hasData = true; |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
if (!hasData) { |
||||
|
$("#StationID").empty() |
||||
|
.append(new Option("無選項", "")); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
$("#StationID").append(new Option("無選項", "")); |
||||
|
} |
||||
|
}, |
||||
|
error: function () { |
||||
|
hg.msg("取得站別資料失敗"); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
function getWorkingStations(workingunitID) { |
||||
|
$.ajax({ |
||||
|
url: "/WHS/GetWorkingStationListByUnit", |
||||
|
type: "GET", |
||||
|
data: { id: workingunitID }, |
||||
|
success: function (result) { |
||||
|
|
||||
|
$("#WorkingStationID").empty(); |
||||
|
$("#WorkingStationID").append(new Option("請選擇", "")); |
||||
|
|
||||
|
if (result && result.data && result.data.length > 0) { |
||||
|
|
||||
|
let hasData = false; |
||||
|
|
||||
|
$.each(result.data, function (index, item) { |
||||
|
if (item.statusNo === "A") { // 只顯示啟用 |
||||
|
$("#WorkingStationID").append( |
||||
|
new Option(item.stationName, item.stationID) |
||||
|
); |
||||
|
hasData = true; |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
if (!hasData) { |
||||
|
$("#WorkingStationID").empty() |
||||
|
.append(new Option("無選項", "")); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
$("#WorkingStationID").append(new Option("無選項", "")); |
||||
|
} |
||||
|
}, |
||||
|
error: function () { |
||||
|
hg.msg("取得站別資料失敗"); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
@ -0,0 +1,280 @@ |
|||||
|
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 ExceptStationsController : ControllerBase |
||||
|
{ |
||||
|
private readonly AMESContext _context; |
||||
|
|
||||
|
/// <summary>
|
||||
|
///
|
||||
|
/// </summary>
|
||||
|
/// <param name="context"></param>
|
||||
|
public ExceptStationsController(AMESContext context) |
||||
|
{ |
||||
|
_context = context; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取全部途程除外站點
|
||||
|
/// </summary>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpGet] |
||||
|
public async Task<ResultModel<ExceptStations>> GetExceptStations(int page = 0, int limit = 10) |
||||
|
{ |
||||
|
IQueryable<ExceptStations> q = _context.ExceptStations; |
||||
|
ResultModel<ExceptStations> result = new ResultModel<ExceptStations>(); |
||||
|
|
||||
|
// 紀錄筆數
|
||||
|
result.DataTotal = q.Count(); |
||||
|
|
||||
|
// Table 頁數
|
||||
|
if (page > 0) |
||||
|
{ |
||||
|
q = q.Skip((page - 1) * limit).Take(limit); |
||||
|
} |
||||
|
result.Data = await q.ToListAsync(); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 用ID获取该途程除外站點
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpGet("{id}")] |
||||
|
public async Task<ActionResult<IEnumerable<ExceptStations>>> GetExceptStations(int id) |
||||
|
{ |
||||
|
|
||||
|
IQueryable<ExceptStations> q = _context.ExceptStations; |
||||
|
q = q.Where(p => p.ExceptStationsID.Equals(id)); |
||||
|
var ExceptStations = await q.ToListAsync(); |
||||
|
|
||||
|
if (ExceptStations == null) |
||||
|
{ |
||||
|
return NotFound(); |
||||
|
} |
||||
|
|
||||
|
return ExceptStations; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 用生產單位获取该途程除外站點
|
||||
|
/// </summary>
|
||||
|
/// <param name="id">報工生產單位</param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpGet("Unit/{id}")] |
||||
|
public async Task<ActionResult<IEnumerable<ExceptStations>>> GetExceptStationsbyUnit(int id) |
||||
|
{ |
||||
|
IQueryable<ExceptStations> q = _context.ExceptStations; |
||||
|
|
||||
|
|
||||
|
if (id != -99) |
||||
|
{ |
||||
|
q = q.Where(p => p.UnitNo.Equals(id)); |
||||
|
} |
||||
|
var ExceptStations = await q.ToListAsync(); |
||||
|
|
||||
|
if (ExceptStations == null) |
||||
|
{ |
||||
|
return NotFound(); |
||||
|
} |
||||
|
|
||||
|
return ExceptStations; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 用生產單位获取该途程除外站點
|
||||
|
/// </summary>
|
||||
|
/// <param name="id">報工生產單位</param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpGet("MultiUnit/{id}")] |
||||
|
public async Task<ResultModel<dynamic>> GetExceptStationsMulti(string id,int page = 0, int limit = 10) |
||||
|
{ |
||||
|
|
||||
|
|
||||
|
var q = from q1 in _context.ExceptStations |
||||
|
join q3 in _context.Stationses on q1.StationID equals q3.StationID |
||||
|
join q2 in _context.FactoryUnits on q1.UnitNo equals q2.UnitNo |
||||
|
select new |
||||
|
{ |
||||
|
ExceptStationsID = q1.ExceptStationsID, |
||||
|
StationID = q1.StationID, |
||||
|
ExceptStationsName = q3.StationName, |
||||
|
UnitNo = q1.UnitNo, |
||||
|
UnitName = q2.UnitName, |
||||
|
CreateUserID = q1.CreateUserID, |
||||
|
CreateDate = q1.CreateDate, |
||||
|
UpdateDate = q1.UpdateDate, |
||||
|
statusNo = q1.StatusNo |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
if (id != "0") |
||||
|
{ |
||||
|
q = q.Where(p => p.UnitNo.Equals(id)); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
ResultModel<dynamic> result = new ResultModel<dynamic>(); |
||||
|
|
||||
|
// 紀錄筆數
|
||||
|
result.DataTotal = q.Count(); |
||||
|
|
||||
|
// Table 頁數
|
||||
|
if (page > 0) |
||||
|
{ |
||||
|
q = q.Skip((page - 1) * limit).Take(limit); |
||||
|
} |
||||
|
result.Data = await q.ToListAsync(); |
||||
|
return result; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 更新條途程除外站點
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <param name="ExceptStations"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPut("{id}")] |
||||
|
public async Task<ResultModel<ExceptStations>> PutExceptStations(int id, [FromBody] ExceptStations ExceptStations) |
||||
|
{ |
||||
|
ResultModel<ExceptStations> result = new ResultModel<ExceptStations>(); |
||||
|
if (id != ExceptStations.ExceptStationsID) |
||||
|
{ |
||||
|
result.Success = false; |
||||
|
result.Msg = "序號錯誤"; |
||||
|
return result; |
||||
|
} |
||||
|
ExceptStations.UpdateDate = DateTime.Now; |
||||
|
_context.Entry(ExceptStations).State = EntityState.Modified; |
||||
|
|
||||
|
try |
||||
|
{ |
||||
|
|
||||
|
await _context.SaveChangesAsync(); |
||||
|
result.Success = true; |
||||
|
result.Msg = "OK"; |
||||
|
return result; |
||||
|
|
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
result.Success = false; |
||||
|
result.Msg = ex.InnerException.Message; |
||||
|
return result; |
||||
|
//throw;
|
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 新增途程除外站點
|
||||
|
/// </summary>
|
||||
|
/// <param name="ExceptStations"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost] |
||||
|
public async Task<ResultModel<ExceptStations>> PostExceptStations(ExceptStations ExceptStations) |
||||
|
{ |
||||
|
ResultModel<ExceptStations> result = new ResultModel<ExceptStations>(); |
||||
|
if (ExceptStationExists(ExceptStations)) |
||||
|
{ |
||||
|
|
||||
|
result.Success = false; |
||||
|
result.Msg = "途程站別重覆!!"; |
||||
|
return result; |
||||
|
} |
||||
|
Helper helper = new Helper(_context); |
||||
|
ExceptStations.ExceptStationsID = helper.GetIDKey("ExceptStations_ID").Result; |
||||
|
ExceptStations.CreateDate = DateTime.Now; |
||||
|
ExceptStations.UpdateDate = DateTime.Now; |
||||
|
_context.ExceptStations.Add(ExceptStations); |
||||
|
try |
||||
|
{ |
||||
|
await _context.SaveChangesAsync(); |
||||
|
result.Success = true; |
||||
|
result.Msg = "OK"; |
||||
|
} |
||||
|
catch (DbUpdateException ex) |
||||
|
{ |
||||
|
|
||||
|
result.Success = false; |
||||
|
result.Msg = ex.InnerException.Message; |
||||
|
} |
||||
|
|
||||
|
return result; |
||||
|
} |
||||
|
/// <summary>
|
||||
|
/// 停用/啟用途程除外站點
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpDelete("{id}/{uid}")] |
||||
|
public async Task<ResultModel<ExceptStations>> DeleteExceptStations(int id,int uid) |
||||
|
{ |
||||
|
ResultModel<ExceptStations> result = new ResultModel<ExceptStations>(); |
||||
|
var workingunit = await _context.ExceptStations.Where(m => m.ExceptStationsID == id).FirstOrDefaultAsync(); |
||||
|
if (workingunit == null) |
||||
|
{ |
||||
|
result.Success = false; |
||||
|
result.Msg = "序號錯誤"; |
||||
|
return result; |
||||
|
} |
||||
|
//////
|
||||
|
var workingunitNew = new ExceptStations(); |
||||
|
workingunitNew = workingunit; |
||||
|
|
||||
|
_context.Entry(workingunitNew).State = EntityState.Modified; |
||||
|
|
||||
|
if (workingunit.StatusNo == "A") |
||||
|
workingunitNew.StatusNo = "S"; |
||||
|
else |
||||
|
workingunitNew.StatusNo = "A"; |
||||
|
workingunitNew.UpdateDate = DateTime.Now; |
||||
|
workingunitNew.UpdateUserID = uid; |
||||
|
|
||||
|
try |
||||
|
{ |
||||
|
await _context.SaveChangesAsync(); |
||||
|
result.Success = true; |
||||
|
result.Msg = "OK"; |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
result.Success = false; |
||||
|
result.Msg = ex.InnerException.Message; |
||||
|
} |
||||
|
return result; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
private bool ExceptStationExists(ExceptStations model) |
||||
|
{ |
||||
|
return _context.ExceptStations.Any(e => |
||||
|
e.StationID == model.StationID); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,294 @@ |
|||||
|
using AMESCoreStudio.CommonTools.Result; |
||||
|
using AMESCoreStudio.WebApi.Models.AMES; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
|
||||
|
namespace AMESCoreStudio.WebApi.Controllers.AMES |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 前置加工入途程站點维护
|
||||
|
/// </summary>
|
||||
|
[Route("api/[controller]")]
|
||||
|
[ApiController] |
||||
|
public class PreWorkingController : ControllerBase |
||||
|
{ |
||||
|
private readonly AMESContext _context; |
||||
|
|
||||
|
/// <summary>
|
||||
|
///
|
||||
|
/// </summary>
|
||||
|
/// <param name="context"></param>
|
||||
|
public PreWorkingController(AMESContext context) |
||||
|
{ |
||||
|
_context = context; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取全部前置加工入途程站點
|
||||
|
/// </summary>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpGet] |
||||
|
public async Task<ResultModel<PreWorking>> GetPreWorking(int page = 0, int limit = 10) |
||||
|
{ |
||||
|
IQueryable<PreWorking> q = _context.PreWorkings; |
||||
|
ResultModel<PreWorking> result = new ResultModel<PreWorking>(); |
||||
|
|
||||
|
// 紀錄筆數
|
||||
|
result.DataTotal = q.Count(); |
||||
|
|
||||
|
// Table 頁數
|
||||
|
if (page > 0) |
||||
|
{ |
||||
|
q = q.Skip((page - 1) * limit).Take(limit); |
||||
|
} |
||||
|
result.Data = await q.ToListAsync(); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 用ID获取该前置加工入途程站點
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpGet("{id}")] |
||||
|
public async Task<ActionResult<IEnumerable<PreWorking>>> GetPreWorking(int id) |
||||
|
{ |
||||
|
|
||||
|
IQueryable<PreWorking> q = _context.PreWorkings; |
||||
|
q = q.Where(p => p.PreWorkingID.Equals(id)); |
||||
|
var PreWorking = await q.ToListAsync(); |
||||
|
|
||||
|
if (PreWorking == null) |
||||
|
{ |
||||
|
return NotFound(); |
||||
|
} |
||||
|
|
||||
|
return PreWorking; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 用生產單位获取该前置加工入途程站點
|
||||
|
/// </summary>
|
||||
|
/// <param name="id">報工生產單位</param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpGet("Unit/{id}")] |
||||
|
public async Task<ActionResult<IEnumerable<PreWorking>>> GetPreWorkingbyUnit(int id) |
||||
|
{ |
||||
|
IQueryable<PreWorking> q = _context.PreWorkings; |
||||
|
|
||||
|
|
||||
|
if (id != -99) |
||||
|
{ |
||||
|
q = q.Where(p => p.UnitNo.Equals(id)); |
||||
|
} |
||||
|
var PreWorking = await q.ToListAsync(); |
||||
|
|
||||
|
if (PreWorking == null) |
||||
|
{ |
||||
|
return NotFound(); |
||||
|
} |
||||
|
|
||||
|
return PreWorking; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 用生產單位获取该前置加工入途程站點
|
||||
|
/// </summary>
|
||||
|
/// <param name="id">報工生產單位</param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpGet("MultiUnit/{id}")] |
||||
|
public async Task<ResultModel<dynamic>> GetPreWorkingMulti(int id, int page = 0, int limit = 10) |
||||
|
{ |
||||
|
|
||||
|
|
||||
|
var q = from q1 in _context.PreWorkings |
||||
|
join q3 in _context.Stationses on q1.StationID equals q3.StationID |
||||
|
join q2 in _context.FactoryUnits on q1.UnitNo equals q2.UnitNo |
||||
|
join q4 in _context.WorkingUnits on q1.WorkingUnitID equals q4.WorkingUnitID |
||||
|
join q5 in _context.WorkingStations on q1.WorkingStationID equals q5.WorkingStationID |
||||
|
select new |
||||
|
{ |
||||
|
PreWorkingID = q1.PreWorkingID, |
||||
|
UnitNo = q1.UnitNo, |
||||
|
UnitName = q2.UnitName, |
||||
|
StationID = q1.StationID, |
||||
|
StationName = q3.StationName, |
||||
|
WorkingUnitID = q1.WorkingUnitID, |
||||
|
WorkingUnionNo = q4.WorkingUnitNo, |
||||
|
WorkingUnitName = q4.WorkingUnitName, |
||||
|
WorkingStationID = q5.WorkingStationID, |
||||
|
WorkingStationName = q5.WorkingStationName, |
||||
|
CreateUserID = q1.CreateUserID, |
||||
|
CreateDate = q1.CreateDate, |
||||
|
UpdateDate = q1.UpdateDate, |
||||
|
StatusNo = q1.StatusNo, |
||||
|
Seq = q1.Seq |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
if (id != -99) |
||||
|
{ |
||||
|
q = q.Where(p => p.WorkingUnitID.Equals(id)); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
ResultModel<dynamic> result = new ResultModel<dynamic>(); |
||||
|
|
||||
|
// 紀錄筆數
|
||||
|
result.DataTotal = q.Count(); |
||||
|
|
||||
|
// Table 頁數
|
||||
|
if (page > 0) |
||||
|
{ |
||||
|
q = q.Skip((page - 1) * limit).Take(limit); |
||||
|
} |
||||
|
result.Data = await q.ToListAsync(); |
||||
|
return result; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 更新條前置加工入途程站點
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <param name="PreWorking"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPut("{id}")] |
||||
|
public async Task<ResultModel<PreWorking>> PutPreWorking(int id, [FromBody] PreWorking PreWorking) |
||||
|
{ |
||||
|
ResultModel<PreWorking> result = new ResultModel<PreWorking>(); |
||||
|
if (id != PreWorking.PreWorkingID) |
||||
|
{ |
||||
|
result.Success = false; |
||||
|
result.Msg = "序號錯誤"; |
||||
|
return result; |
||||
|
} |
||||
|
PreWorking.UpdateDate = DateTime.Now; |
||||
|
_context.Entry(PreWorking).State = EntityState.Modified; |
||||
|
|
||||
|
try |
||||
|
{ |
||||
|
|
||||
|
await _context.SaveChangesAsync(); |
||||
|
result.Success = true; |
||||
|
result.Msg = "OK"; |
||||
|
return result; |
||||
|
|
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
result.Success = false; |
||||
|
result.Msg = ex.InnerException.Message; |
||||
|
return result; |
||||
|
//throw;
|
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 新增前置加工入途程站點
|
||||
|
/// </summary>
|
||||
|
/// <param name="PreWorking"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost] |
||||
|
public async Task<ResultModel<PreWorking>> PostPreWorking([FromBody] PreWorking PreWorking) |
||||
|
{ |
||||
|
ResultModel<PreWorking> result = new ResultModel<PreWorking>(); |
||||
|
|
||||
|
if (PreWorkingExists(PreWorking)) |
||||
|
{ |
||||
|
|
||||
|
result.Success = false; |
||||
|
result.Msg = "途程站別對應報工站別重覆!!"; |
||||
|
return result; |
||||
|
} |
||||
|
int maxSeq = await _context.PreWorkings.Where(w => w.StationID == PreWorking.StationID).Select(w => (int?)w.Seq).MaxAsync() ?? 0; |
||||
|
Helper helper = new Helper(_context); |
||||
|
PreWorking.PreWorkingID = helper.GetIDKey("PreWorking_ID").Result; |
||||
|
PreWorking.CreateDate = DateTime.Now; |
||||
|
PreWorking.UpdateDate = DateTime.Now; |
||||
|
PreWorking.Seq = maxSeq + 1; |
||||
|
_context.PreWorkings.Add(PreWorking); |
||||
|
try |
||||
|
{ |
||||
|
await _context.SaveChangesAsync(); |
||||
|
result.Success = true; |
||||
|
result.Msg = "OK"; |
||||
|
} |
||||
|
catch (DbUpdateException ex) |
||||
|
{ |
||||
|
|
||||
|
result.Success = false; |
||||
|
result.Msg = ex.InnerException.Message; |
||||
|
} |
||||
|
|
||||
|
return result; |
||||
|
} |
||||
|
/// <summary>
|
||||
|
/// 停用/啟用前置加工入途程站點
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpDelete("{id}/{uid}")] |
||||
|
public async Task<ResultModel<PreWorking>> DeletePreWorking(int id, int uid) |
||||
|
{ |
||||
|
ResultModel<PreWorking> result = new ResultModel<PreWorking>(); |
||||
|
var workingunit = await _context.PreWorkings.Where(m => m.PreWorkingID == id).FirstOrDefaultAsync(); |
||||
|
if (workingunit == null) |
||||
|
{ |
||||
|
result.Success = false; |
||||
|
result.Msg = "序號錯誤"; |
||||
|
return result; |
||||
|
} |
||||
|
//////
|
||||
|
var workingunitNew = new PreWorking(); |
||||
|
workingunitNew = workingunit; |
||||
|
|
||||
|
_context.Entry(workingunitNew).State = EntityState.Modified; |
||||
|
|
||||
|
if (workingunit.StatusNo == "A") |
||||
|
workingunitNew.StatusNo = "S"; |
||||
|
else |
||||
|
workingunitNew.StatusNo = "A"; |
||||
|
workingunitNew.UpdateDate = DateTime.Now; |
||||
|
workingunitNew.UpdateUserID = uid; |
||||
|
|
||||
|
|
||||
|
|
||||
|
try |
||||
|
{ |
||||
|
await _context.SaveChangesAsync(); |
||||
|
result.Success = true; |
||||
|
result.Msg = "OK"; |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
result.Success = false; |
||||
|
result.Msg = ex.InnerException.Message; |
||||
|
} |
||||
|
return result; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
private bool PreWorkingExists(PreWorking model) |
||||
|
{ |
||||
|
return _context.PreWorkings.Any(e => |
||||
|
e.WorkingStationID == model.WorkingStationID && |
||||
|
e.StationID == model.StationID ); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,289 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using AMESCoreStudio.WebApi.Models.AMES; |
||||
|
using AMESCoreStudio.CommonTools.Result; |
||||
|
|
||||
|
|
||||
|
namespace AMESCoreStudio.WebApi.Controllers.AMES |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 報工對應途程站點维护
|
||||
|
/// </summary>
|
||||
|
[Route("api/[controller]")]
|
||||
|
[ApiController] |
||||
|
public class WorkingFlowStationsController : ControllerBase |
||||
|
{ |
||||
|
private readonly AMESContext _context; |
||||
|
|
||||
|
/// <summary>
|
||||
|
///
|
||||
|
/// </summary>
|
||||
|
/// <param name="context"></param>
|
||||
|
public WorkingFlowStationsController(AMESContext context) |
||||
|
{ |
||||
|
_context = context; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 获取全部報工對應途程站點
|
||||
|
/// </summary>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpGet] |
||||
|
public async Task<ResultModel<WorkingFlowStations>> GetWorkingFlowStations(int page = 0, int limit = 10) |
||||
|
{ |
||||
|
IQueryable<WorkingFlowStations> q = _context.WorkingFlowStations; |
||||
|
ResultModel<WorkingFlowStations> result = new ResultModel<WorkingFlowStations>(); |
||||
|
|
||||
|
// 紀錄筆數
|
||||
|
result.DataTotal = q.Count(); |
||||
|
|
||||
|
// Table 頁數
|
||||
|
if (page > 0) |
||||
|
{ |
||||
|
q = q.Skip((page - 1) * limit).Take(limit); |
||||
|
} |
||||
|
result.Data = await q.ToListAsync(); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 用ID获取该報工對應途程站點
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpGet("{id}")] |
||||
|
public async Task<ActionResult<IEnumerable<WorkingFlowStations>>> GetWorkingFlowStations(int id) |
||||
|
{ |
||||
|
|
||||
|
IQueryable<WorkingFlowStations> q = _context.WorkingFlowStations; |
||||
|
q = q.Where(p => p.WorkingFlowStationsID.Equals(id)); |
||||
|
var WorkingFlowStations = await q.ToListAsync(); |
||||
|
|
||||
|
if (WorkingFlowStations == null) |
||||
|
{ |
||||
|
return NotFound(); |
||||
|
} |
||||
|
|
||||
|
return WorkingFlowStations; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 用生產單位获取该報工對應途程站點
|
||||
|
/// </summary>
|
||||
|
/// <param name="id">報工生產單位</param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpGet("Unit/{id}")] |
||||
|
public async Task<ActionResult<IEnumerable<WorkingFlowStations>>> GetWorkingFlowStationsbyUnit(int id) |
||||
|
{ |
||||
|
IQueryable<WorkingFlowStations> q = _context.WorkingFlowStations; |
||||
|
|
||||
|
|
||||
|
if (id != -99) |
||||
|
{ |
||||
|
q = q.Where(p => p.UnitNo.Equals(id)); |
||||
|
} |
||||
|
var WorkingFlowStations = await q.ToListAsync(); |
||||
|
|
||||
|
if (WorkingFlowStations == null) |
||||
|
{ |
||||
|
return NotFound(); |
||||
|
} |
||||
|
|
||||
|
return WorkingFlowStations; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 用生產單位获取该報工對應途程站點
|
||||
|
/// </summary>
|
||||
|
/// <param name="id">報工生產單位</param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpGet("MultiUnit/{id}")] |
||||
|
public async Task<ResultModel<dynamic>> GetWorkingFlowStationsMulti(int id,int page = 0, int limit = 10) |
||||
|
{ |
||||
|
|
||||
|
|
||||
|
var q = from q1 in _context.WorkingFlowStations |
||||
|
join q3 in _context.Stationses on q1.StationID equals q3.StationID |
||||
|
join q2 in _context.FactoryUnits on q1.UnitNo equals q2.UnitNo |
||||
|
join q4 in _context.WorkingUnits on q1.WorkingUnitID equals q4.WorkingUnitID |
||||
|
join q5 in _context.WorkingStations on q1.WorkingStationID equals q5.WorkingStationID |
||||
|
select new |
||||
|
{ |
||||
|
WorkingFlowStationsID = q1.WorkingFlowStationsID, |
||||
|
UnitNo = q1.UnitNo, |
||||
|
UnitName = q2.UnitName, |
||||
|
StationID = q1.StationID, |
||||
|
StationName = q3.StationName, |
||||
|
WorkingUnitID = q1.WorkingUnitID, |
||||
|
WorkingUnionNo = q4.WorkingUnitNo, |
||||
|
WorkingUnitName = q4.WorkingUnitName, |
||||
|
WorkingStationID = q5.WorkingStationID, |
||||
|
WorkingStationName = q5.WorkingStationName, |
||||
|
CreateUserID = q1.CreateUserID, |
||||
|
CreateDate = q1.CreateDate, |
||||
|
UpdateDate = q1.UpdateDate, |
||||
|
StatusNo = q1.StatusNo |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
if (id != -99) |
||||
|
{ |
||||
|
q = q.Where(p => p.WorkingUnitID.Equals(id)); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
ResultModel<dynamic> result = new ResultModel<dynamic>(); |
||||
|
|
||||
|
// 紀錄筆數
|
||||
|
result.DataTotal = q.Count(); |
||||
|
|
||||
|
// Table 頁數
|
||||
|
if (page > 0) |
||||
|
{ |
||||
|
q = q.Skip((page - 1) * limit).Take(limit); |
||||
|
} |
||||
|
result.Data = await q.ToListAsync(); |
||||
|
return result; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 更新條報工對應途程站點
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <param name="WorkingFlowStations"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPut("{id}")] |
||||
|
public async Task<ResultModel<WorkingFlowStations>> PutWorkingFlowStations(int id, [FromBody] WorkingFlowStations WorkingFlowStations) |
||||
|
{ |
||||
|
ResultModel<WorkingFlowStations> result = new ResultModel<WorkingFlowStations>(); |
||||
|
if (id != WorkingFlowStations.WorkingFlowStationsID) |
||||
|
{ |
||||
|
result.Success = false; |
||||
|
result.Msg = "序號錯誤"; |
||||
|
return result; |
||||
|
} |
||||
|
WorkingFlowStations.UpdateDate = DateTime.Now; |
||||
|
_context.Entry(WorkingFlowStations).State = EntityState.Modified; |
||||
|
|
||||
|
try |
||||
|
{ |
||||
|
|
||||
|
await _context.SaveChangesAsync(); |
||||
|
result.Success = true; |
||||
|
result.Msg = "OK"; |
||||
|
return result; |
||||
|
|
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
result.Success = false; |
||||
|
result.Msg = ex.InnerException.Message; |
||||
|
return result; |
||||
|
//throw;
|
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 新增報工對應途程站點
|
||||
|
/// </summary>
|
||||
|
/// <param name="WorkingFlowStations"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost] |
||||
|
public async Task<ResultModel<WorkingFlowStations>> PostWorkingFlowStations([FromBody] WorkingFlowStations WorkingFlowStations) |
||||
|
{ |
||||
|
ResultModel<WorkingFlowStations> result = new ResultModel<WorkingFlowStations>(); |
||||
|
|
||||
|
if (WorkingFlowStationExists(WorkingFlowStations)) |
||||
|
{ |
||||
|
result.Success = false; |
||||
|
result.Msg = "途程站別對應報工站別重覆!!"; |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
Helper helper = new Helper(_context); |
||||
|
WorkingFlowStations.WorkingFlowStationsID = helper.GetIDKey("WorkingFlowStationID").Result; |
||||
|
WorkingFlowStations.CreateDate = DateTime.Now; |
||||
|
WorkingFlowStations.UpdateDate = DateTime.Now; |
||||
|
_context.WorkingFlowStations.Add(WorkingFlowStations); |
||||
|
try |
||||
|
{ |
||||
|
await _context.SaveChangesAsync(); |
||||
|
result.Success = true; |
||||
|
result.Msg = "OK"; |
||||
|
} |
||||
|
catch (DbUpdateException ex) |
||||
|
{ |
||||
|
|
||||
|
result.Success = false; |
||||
|
result.Msg = ex.InnerException.Message; |
||||
|
} |
||||
|
|
||||
|
return result; |
||||
|
} |
||||
|
/// <summary>
|
||||
|
/// 停用/啟用報工對應途程站點
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpDelete("{id}/{uid}")] |
||||
|
public async Task<ResultModel<WorkingFlowStations>> DeleteWorkingFlowStations(int id,int uid) |
||||
|
{ |
||||
|
ResultModel<WorkingFlowStations> result = new ResultModel<WorkingFlowStations>(); |
||||
|
var workingunit = await _context.WorkingFlowStations.Where(m => m.WorkingFlowStationsID == id).FirstOrDefaultAsync(); |
||||
|
if (workingunit == null) |
||||
|
{ |
||||
|
result.Success = false; |
||||
|
result.Msg = "序號錯誤"; |
||||
|
return result; |
||||
|
} |
||||
|
//////
|
||||
|
var workingunitNew = new WorkingFlowStations(); |
||||
|
workingunitNew = workingunit; |
||||
|
|
||||
|
_context.Entry(workingunitNew).State = EntityState.Modified; |
||||
|
|
||||
|
if (workingunit.StatusNo == "A") |
||||
|
workingunitNew.StatusNo = "S"; |
||||
|
else |
||||
|
workingunitNew.StatusNo = "A"; |
||||
|
workingunitNew.UpdateDate = DateTime.Now; |
||||
|
workingunitNew.UpdateUserID = uid; |
||||
|
|
||||
|
|
||||
|
try |
||||
|
{ |
||||
|
await _context.SaveChangesAsync(); |
||||
|
result.Success = true; |
||||
|
result.Msg = "OK"; |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
result.Success = false; |
||||
|
result.Msg = ex.InnerException.Message; |
||||
|
} |
||||
|
return result; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
private bool WorkingFlowStationExists(WorkingFlowStations model) |
||||
|
{ |
||||
|
return _context.WorkingFlowStations.Any(e => |
||||
|
e.WorkingStationID == model.WorkingStationID && |
||||
|
e.StationID == model.StationID); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,59 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.ComponentModel.DataAnnotations.Schema; |
||||
|
using System.Runtime.Serialization; |
||||
|
namespace AMESCoreStudio.WebApi.Models.AMES |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 途程除外站點資料檔
|
||||
|
/// </summary>
|
||||
|
[Table("EXCEPT_STATIONS", Schema = "JHAMES")] |
||||
|
public class ExceptStations |
||||
|
{ |
||||
|
|
||||
|
[Key] |
||||
|
[Column("EXCEPT_STATIONS_ID")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "途程除外站點ID")] |
||||
|
public int ExceptStationsID { get; set; } |
||||
|
|
||||
|
[Column("STATION_ID")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "途程站點ID")] |
||||
|
public int StationID { get; set; } |
||||
|
|
||||
|
[Column("UNIT_NO")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "途程生產單位代碼")] |
||||
|
[StringLength(2)] |
||||
|
public string UnitNo { get; set; } |
||||
|
|
||||
|
[Column("CREATE_USERID")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "創建者")] |
||||
|
public int CreateUserID { get; set; } |
||||
|
|
||||
|
|
||||
|
[Column("CREATE_DATE")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "創建日期")] |
||||
|
public DateTime CreateDate { get; set; } |
||||
|
|
||||
|
[Column("UPDATE_USERID")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "更新者")] |
||||
|
public int UpdateUserID { get; set; } |
||||
|
|
||||
|
[Column("UPDATE_DATE")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "更新日期")] |
||||
|
public DateTime UpdateDate { get; set; } |
||||
|
|
||||
|
|
||||
|
[Column("STATUS_NO")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "狀態")] |
||||
|
public string StatusNo { get; set; } = "A"; |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,70 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.ComponentModel.DataAnnotations.Schema; |
||||
|
using System.Runtime.Serialization; |
||||
|
namespace AMESCoreStudio.WebApi.Models.AMES |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 前置加工入途程站點資料檔
|
||||
|
/// </summary>
|
||||
|
[Table("PRE_WORKING")] |
||||
|
public class PreWorking |
||||
|
{ |
||||
|
[Key] |
||||
|
[Column("PRE_WORKING_ID")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "前置加工ID")] |
||||
|
public int PreWorkingID { get; set; } |
||||
|
|
||||
|
[Column("STATION_ID")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "途程站點ID")] |
||||
|
public int StationID { get; set; } |
||||
|
|
||||
|
[Column("UNIT_NO")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "途程生產單位代碼")] |
||||
|
[StringLength(2)] |
||||
|
public string UnitNo { get; set; } |
||||
|
|
||||
|
[Column("WORKING_STATION_ID")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "報工站別ID")] |
||||
|
public int WorkingStationID { get; set; } |
||||
|
|
||||
|
[Column("WORKING_UNIT_ID")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "報工生產單位ID")] |
||||
|
public int WorkingUnitID { get; set; } |
||||
|
|
||||
|
[Column("CREATE_USERID")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "創建者")] |
||||
|
public int CreateUserID { get; set; } |
||||
|
|
||||
|
[Column("CREATE_DATE")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "創建日期")] |
||||
|
public DateTime CreateDate { get; set; } |
||||
|
|
||||
|
[Column("UPDATE_USERID")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "更新者")] |
||||
|
public int UpdateUserID { get; set; } |
||||
|
|
||||
|
[Column("UPDATE_DATE")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "更新日期")] |
||||
|
public DateTime UpdateDate { get; set; } |
||||
|
|
||||
|
[Column("SEQ")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "優先排序")] |
||||
|
public int Seq { get; set; } |
||||
|
|
||||
|
[Column("STATUS_NO")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "狀態")] |
||||
|
public string StatusNo { get; set; } = "A"; |
||||
|
} |
||||
|
} |
||||
@ -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("WORKING_FLOW_STATIONS")] |
||||
|
public class WorkingFlowStations |
||||
|
{ |
||||
|
[Key] |
||||
|
[Column("WORKING_FLOW_STATIONS_ID")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "報工對應途程站點ID")] |
||||
|
public int WorkingFlowStationsID { get; set; } |
||||
|
|
||||
|
[Column("WORKING_STATION_ID")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "報工站別ID")] |
||||
|
public int WorkingStationID { get; set; } |
||||
|
|
||||
|
[Column("WORKING_UNIT_ID")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "報工生產單位ID")] |
||||
|
public int WorkingUnitID { get; set; } |
||||
|
|
||||
|
[Column("STATION_ID")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "途程站點ID")] |
||||
|
public int StationID { get; set; } |
||||
|
|
||||
|
[Column("UNIT_NO")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "途程生產單位代碼")] |
||||
|
[StringLength(2)] |
||||
|
public string UnitNo { get; set; } |
||||
|
|
||||
|
[Column("CREATE_USERID")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "創建者")] |
||||
|
public int CreateUserID { get; set; } |
||||
|
|
||||
|
[Column("CREATE_DATE")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "創建日期")] |
||||
|
public DateTime CreateDate { get; set; } |
||||
|
|
||||
|
[Column("UPDATE_USERID")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "更新者")] |
||||
|
public int UpdateUserID { get; set; } |
||||
|
|
||||
|
[Column("UPDATE_DATE")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "更新日期")] |
||||
|
public DateTime UpdateDate { get; set; } |
||||
|
|
||||
|
|
||||
|
[Column("STATUS_NO")] |
||||
|
[DataMember] |
||||
|
[Display(Name = "狀態")] |
||||
|
public string StatusNo { get; set; } = "A"; |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue