26 changed files with 4305 additions and 0 deletions
@ -0,0 +1,58 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using System.Runtime.Serialization; |
|||
|
|||
|
|||
#nullable disable |
|||
|
|||
namespace AMESCoreStudio.Web.ViewModels.WHS |
|||
{ |
|||
public partial class WHS025ViewModel |
|||
{ |
|||
public int WorkingStandardID { get; set; } |
|||
|
|||
public string WorkingUnitNo { get; set; } |
|||
|
|||
public List<int> WorkingLineIDs { get; set; } |
|||
public int WorkingLineID { get; set; } |
|||
|
|||
public int WorkingStationID { get; set; } |
|||
|
|||
public string UnitNo { get; set; } |
|||
|
|||
public string ItemNo { get; set; } |
|||
|
|||
public string Side { get; set; } |
|||
|
|||
public int OpCnt { get; set; } |
|||
|
|||
public int Ct { get; set; } |
|||
|
|||
public string StationID { get; set; } |
|||
|
|||
public int MachineCnt { get; set; } |
|||
|
|||
public string Remark { get; set; } |
|||
|
|||
public int CreateUserID { get; set; } |
|||
|
|||
public DateTime CreateDate { get; set; } |
|||
|
|||
public int UpdateUserID { get; set; } |
|||
|
|||
public DateTime UpdateDate { get; set; } |
|||
|
|||
// 顯示用欄位
|
|||
public string WorkingUnitName { get; set; } |
|||
|
|||
public string WorkingLineName { get; set; } |
|||
|
|||
public string WorkingStationName { get; set; } |
|||
|
|||
public string UnitName { get; set; } |
|||
} |
|||
|
|||
} |
@ -0,0 +1,120 @@ |
|||
@{ |
|||
ViewData["Title"] = "報工生產單位維護"; |
|||
Layout = "~/Views/Shared/_AMESLayout.cshtml"; |
|||
} |
|||
|
|||
<div class="layui-card"> |
|||
<div class="layui-card-header"> |
|||
<div class="layui-form"> |
|||
<div class="layui-form-item "> |
|||
<div class="layui-inline"><i class="fa fa-file-text-o fa-fw"></i> @ViewBag.Title</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="layui-card-body"> |
|||
<table class="layui-hide" id="test" lay-filter="test"></table> |
|||
</div> |
|||
</div> |
|||
|
|||
@section Scripts{ |
|||
<script type="text/javascript"> |
|||
//监听表单提交事件 |
|||
hg.form.onsubmit('querysubmit', function (data) { |
|||
table && table.reload(data); |
|||
}); |
|||
var tableCols = [[ |
|||
{ |
|||
field: 'workingUnitID', |
|||
width: 80, |
|||
title: '#' |
|||
}, |
|||
{ |
|||
field: 'workingUnitName', |
|||
width: 300, |
|||
title: '報工生產單位名稱' |
|||
}, |
|||
{ |
|||
field: 'workingUnitNo', |
|||
width: 300, |
|||
title: '報工生產單位代碼' |
|||
}, |
|||
{ |
|||
field: 'unitNo', |
|||
width: 300, |
|||
title: '途程生產單位代碼' |
|||
}, |
|||
{ |
|||
field: 'right', |
|||
width: 300, |
|||
title: '操作', |
|||
fixed: 'right', |
|||
templet: function (d) { |
|||
|
|||
var btns = '<a class="layui-btn layui-btn-normal layui-btn-xs layui-icon layui-icon-edit" lay-event="edit">修改</a>'; |
|||
|
|||
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="edit" |
|||
function edit(obj) { |
|||
if (obj.data.workingUnitID) { |
|||
hg.open('修改報工生產單位', '/WHS/WHS022U/' + obj.data.workingUnitID, 640,480); |
|||
} |
|||
} |
|||
|
|||
function del(obj) { |
|||
if (obj.data.workingUnitID) { |
|||
if (obj.data.statusNo == 'A') |
|||
str = '停用'; |
|||
else |
|||
str = '啟用'; |
|||
hg.confirm("報工生產單位代碼:" + obj.data.workingUnitNo + ",確定要" + str + "嗎?", function () { |
|||
$.ajax({ |
|||
url: '/WHS/WHS022D', |
|||
data: { id: obj.data.workingUnitID }, |
|||
type: 'POST', |
|||
success: function (data) { |
|||
if (data.success) { |
|||
hg.msghide(str + "成功!"); |
|||
} |
|||
else { |
|||
hg.msg(data.msg); |
|||
} |
|||
tt(); |
|||
}, |
|||
error: function () { |
|||
hg.msg("網路請求失!"); |
|||
} |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
var toolbar = [{ |
|||
text: '新增', |
|||
layuiicon: '', |
|||
class: 'layui-btn-normal', |
|||
handler: function () { |
|||
hg.open('新增報工生產單位', '/WHS/WHS022C', 640, 480); |
|||
|
|||
} |
|||
} |
|||
]; |
|||
//基本資料表格 |
|||
// var table = hg.table.datatable('test', '報工生產單位維護', '/WHS/GetWorkingUnits', {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); |
|||
var table; |
|||
$(function () { |
|||
tt(); |
|||
}); |
|||
function tt() { |
|||
table = hg.table.datatable('test', '報工生產單位維護', '/WHS/GetWorkingUnits' |
|||
, {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); |
|||
} |
|||
|
|||
</script> |
|||
} |
@ -0,0 +1,59 @@ |
|||
@model AMESCoreStudio.WebApi.Models.AMES.WorkingUnit |
|||
|
|||
|
|||
@{ ViewData["Title"] = "WHS022C"; |
|||
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="WHS022CSave"> |
|||
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
|||
|
|||
|
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="WorkingUnitName" class="control-label col-sm-3"></label> |
|||
<input asp-for="WorkingUnitName" class="form-control col-sm-9" placeholder="請輸入報工生產單位代碼" /> |
|||
<span asp-validation-for="WorkingUnitName" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="WorkingUnitNo" class="control-label col-sm-3"></label> |
|||
<input asp-for="WorkingUnitNo" class="form-control col-sm-9" placeholder="請輸入報工生產單位名稱" /> |
|||
<span asp-validation-for="WorkingUnitNo" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<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> |
|||
<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,62 @@ |
|||
@model AMESCoreStudio.WebApi.Models.AMES.WorkingUnit |
|||
|
|||
|
|||
@{ ViewData["Title"] = "WHS020U"; |
|||
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="WHS022USave"> |
|||
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
|||
<input type="hidden" asp-for="WorkingUnitID" /> |
|||
<input type="hidden" asp-for="StatusNo" /> |
|||
<input type="hidden" asp-for="CreateDate" /> |
|||
<input type="hidden" asp-for="CreateUserID" /> |
|||
|
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="WorkingUnitName" class="control-label col-sm-3"></label> |
|||
<input asp-for="WorkingUnitName" class="form-control col-sm-9" /> |
|||
<span asp-validation-for="WorkingUnitName" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="WorkingUnitNo" class="control-label col-sm-3"></label> |
|||
<input asp-for="WorkingUnitNo" class="form-control col-sm-9" /> |
|||
<span asp-validation-for="WorkingUnitNo" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<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> |
|||
<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,142 @@ |
|||
@{ |
|||
ViewData["Title"] = "報工線別基本資料"; |
|||
Layout = "~/Views/Shared/_AMESLayout.cshtml"; |
|||
} |
|||
|
|||
<div class="layui-card"> |
|||
<div class="layui-card-header"> |
|||
<div class="layui-form"> |
|||
<div class="layui-form-item "> |
|||
<div class="layui-inline"><i class="fa fa-file-text-o fa-fw"></i> @ViewBag.Title</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="layui-card-body"> |
|||
<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" width:400px;"> |
|||
<select style="width:400px;" lay-filter="unitNo" lay-submit id="unitNo" name="unitNo" asp-items="@ViewBag.WorkingUnitNo"> |
|||
</select> |
|||
</div> |
|||
<input id="unitId" type="hidden" name="unitId" /> |
|||
</div> |
|||
<div class="layui-inline" style="margin-left:0px;"> |
|||
<button id="btnSearch" class="layui-btn layui-btn-sm layui-btn-normal"> |
|||
<i class="layui-icon layui-icon-sm"></i> |
|||
</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<table class="layui-hide" id="test" lay-filter="test"></table> |
|||
</div> |
|||
</div> |
|||
|
|||
@section Scripts{ |
|||
<script type="text/javascript"> |
|||
//监听表单提交事件 |
|||
hg.form.onsubmit('querysubmit', function (data) { |
|||
table && table.reload(data); |
|||
}); |
|||
var tableCols = [[ |
|||
{ |
|||
field: 'workingLineID', |
|||
width: 80, |
|||
title: '#' |
|||
}, |
|||
{ |
|||
field: 'workingUnitNo', |
|||
width: 300, |
|||
title: '報工生產單位名稱' |
|||
}, |
|||
{ |
|||
field: 'workingUnitName', |
|||
width: 300, |
|||
title: '報工生產單位名稱' |
|||
}, |
|||
{ |
|||
field: 'workingLineName', |
|||
title: '報工線別名稱' |
|||
}, |
|||
{ |
|||
field: 'right', |
|||
width: 300, |
|||
title: '操作', |
|||
fixed: 'right', |
|||
templet: function (d) { |
|||
|
|||
var btns = '<a class="layui-btn layui-btn-normal layui-btn-xs layui-icon layui-icon-edit" lay-event="edit">修改</a>'; |
|||
|
|||
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; |
|||
} |
|||
}] |
|||
]; |
|||
$('#btnSearch').click(function () { |
|||
|
|||
hg.msghide("刷新資料!"); |
|||
tt(); |
|||
|
|||
}); |
|||
//通过行tool編輯,lay-event="edit" |
|||
function edit(obj) { |
|||
if (obj.data.workingLineID) { |
|||
hg.open('修改報工線別', '/WHS/WHS023U/' + obj.data.workingLineID, 640, 480); |
|||
} |
|||
} |
|||
|
|||
function del(obj) { |
|||
if (obj.data.workingLineID) { |
|||
if (obj.data.statusNo == 'A') |
|||
str = '停用'; |
|||
else |
|||
str = '啟用'; |
|||
hg.confirm("報工生產單位代碼:" + obj.data.workingLineName + ",確定要" + str + "嗎?", function () { |
|||
$.ajax({ |
|||
url: '/WHS/WHS023D', |
|||
data: { id: obj.data.workingLineID }, |
|||
type: 'POST', |
|||
success: function (data) { |
|||
if (data.success) { |
|||
hg.msghide(str + "成功!"); |
|||
} |
|||
else { |
|||
hg.msg(data.msg); |
|||
} |
|||
tt(); |
|||
}, |
|||
error: function () { |
|||
hg.msg("網路請求失!"); |
|||
} |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
var toolbar = [{ |
|||
text: '新增', |
|||
layuiicon: '', |
|||
class: 'layui-btn-normal', |
|||
handler: function () { |
|||
hg.open('新增報工線別', '/WHS/WHS023C', 640, 480); |
|||
|
|||
} |
|||
} |
|||
]; |
|||
var table; |
|||
$(function () { |
|||
tt(); |
|||
}); |
|||
//基本資料表格 |
|||
function tt() { |
|||
var unit = $("#unitNo").val(); |
|||
table = hg.table.datatable('test', '報工線別維護', '/WHS/GetworkingLines?id=' + unit |
|||
, {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); |
|||
} |
|||
|
|||
</script> |
|||
} |
@ -0,0 +1,52 @@ |
|||
@model AMESCoreStudio.WebApi.Models.AMES.WorkingLine |
|||
|
|||
|
|||
@{ ViewData["Title"] = "WHS023C"; |
|||
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="WHS023CSave"> |
|||
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="WorkingUnitNo" class="control-label col-sm-3"></label> |
|||
<select asp-for="WorkingUnitNo" asp-items="@ViewBag.WorkingUnitNo" class="custom-select col-sm-9"></select> |
|||
<span asp-validation-for="WorkingUnitNo" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="WorkingLineName" class="control-label col-sm-3"></label> |
|||
<input asp-for="WorkingLineName" class="form-control col-sm-9" placeholder="請輸入報工生產線別名稱" /> |
|||
<span asp-validation-for="WorkingLineName" 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,57 @@ |
|||
@model AMESCoreStudio.WebApi.Models.AMES.WorkingLine |
|||
|
|||
|
|||
@{ ViewData["Title"] = "WHS023U"; |
|||
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="WHS023USave"> |
|||
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
|||
<input type="hidden" asp-for="WorkingLineID" /> |
|||
<input type="hidden" asp-for="StatusNo" /> |
|||
<input type="hidden" asp-for="CreateDate" /> |
|||
<input type="hidden" asp-for="CreateUserID" /> |
|||
|
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="WorkingUnitNo" class="control-label col-sm-3"></label> |
|||
<select asp-for="WorkingUnitNo" asp-items="@ViewBag.WorkingUnitNo" class="custom-select col-sm-9"></select> |
|||
<span asp-validation-for="WorkingUnitNo" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="WorkingLineName" class="control-label col-sm-3"></label> |
|||
<input asp-for="WorkingLineName" class="form-control col-sm-9" /> |
|||
<span asp-validation-for="WorkingLineName" 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,150 @@ |
|||
@{ |
|||
ViewData["Title"] = "報工工作站基本資料"; |
|||
Layout = "~/Views/Shared/_AMESLayout.cshtml"; |
|||
} |
|||
|
|||
<div class="layui-card"> |
|||
<div class="layui-card-header"> |
|||
<div class="layui-form"> |
|||
<div class="layui-form-item "> |
|||
<div class="layui-inline"><i class="fa fa-file-text-o fa-fw"></i> @ViewBag.Title</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="layui-card-body"> |
|||
<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" width:400px;"> |
|||
<select style="width:400px;" lay-filter="unitNo" lay-submit id="unitNo" name="unitNo" asp-items="@ViewBag.WorkingUnitNo"> |
|||
</select> |
|||
</div> |
|||
<input id="unitId" type="hidden" name="unitId" /> |
|||
</div> |
|||
<div class="layui-inline" style="margin-left:0px;"> |
|||
<button id="btnSearch" class="layui-btn layui-btn-sm layui-btn-normal"> |
|||
<i class="layui-icon layui-icon-sm"></i> |
|||
</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<table class="layui-hide" id="test" lay-filter="test"></table> |
|||
</div> |
|||
</div> |
|||
|
|||
@section Scripts{ |
|||
<script type="text/javascript"> |
|||
//监听表单提交事件 |
|||
hg.form.onsubmit('querysubmit', function (data) { |
|||
table && table.reload(data); |
|||
}); |
|||
var tableCols = [[ |
|||
{ |
|||
field: 'workingStationID', |
|||
width: 80, |
|||
title: '#' |
|||
}, |
|||
{ |
|||
field: 'workingStationName', |
|||
width: 300, |
|||
title: '報工工作站別名稱' |
|||
}, |
|||
{ |
|||
field: 'workingStationDesc', |
|||
title: '報工工作站敘述', |
|||
}, |
|||
{ |
|||
field: 'typeNo', |
|||
width: 300, |
|||
title: 'SAP工時類別' |
|||
}, |
|||
{ |
|||
field: 'workingUnitName', |
|||
width: 300, |
|||
title: '報工生產單位名稱' |
|||
}, |
|||
{ |
|||
field: 'right', |
|||
width: 200, |
|||
title: '操作', |
|||
fixed: 'right', |
|||
templet: function (d) { |
|||
|
|||
var btns = '<a class="layui-btn layui-btn-normal layui-btn-xs layui-icon layui-icon-edit" lay-event="edit">修改</a>'; |
|||
|
|||
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="edit" |
|||
function edit(obj) { |
|||
if (obj.data.workingStationID) { |
|||
hg.open('修改報工工作站', '/WHS/WHS024U/' + obj.data.workingStationID, 640,480); |
|||
} |
|||
} |
|||
|
|||
function del(obj) { |
|||
if (obj.data.workingStationID) { |
|||
if (obj.data.statusNo == 'A') |
|||
str = '停用'; |
|||
else |
|||
str = '啟用'; |
|||
hg.confirm("報工工作站別名稱:" + obj.data.workingStationName + ",確定要" + str + "嗎?", function () { |
|||
$.ajax({ |
|||
url: '/WHS/WHS024D', |
|||
data: { id: obj.data.workingStationID }, |
|||
type: 'POST', |
|||
success: function (data) { |
|||
if (data.success) { |
|||
hg.msghide(str + "成功!"); |
|||
} |
|||
else { |
|||
hg.msg(data.msg); |
|||
} |
|||
}, |
|||
error: function () { |
|||
hg.msg("網路請求失!"); |
|||
} |
|||
|
|||
}); |
|||
}); |
|||
tt(); |
|||
} |
|||
} |
|||
var toolbar = [{ |
|||
text: '新增', |
|||
layuiicon: '', |
|||
class: 'layui-btn-normal', |
|||
handler: function () { |
|||
hg.open('新增報工工作站別', '/WHS/WHS024C', 640, 480); |
|||
|
|||
} |
|||
} |
|||
]; |
|||
//基本資料表格 |
|||
$('#btnSearch').click(function () { |
|||
|
|||
hg.msghide("刷新資料!"); |
|||
tt(); |
|||
|
|||
}); |
|||
var table; |
|||
$(function () { |
|||
tt(); |
|||
}); |
|||
//基本資料表格 |
|||
function tt() { |
|||
var unit = $("#unitNo").val(); |
|||
table = hg.table.datatable('test', '報工工作站別維護', '/WHS/GetWorkingStations?id=' + unit |
|||
, {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); |
|||
} |
|||
// var table = hg.table.datatable('test', '報工工作站別維護', '/WHS/GetWorkingStations', {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); |
|||
</script> |
|||
} |
@ -0,0 +1,67 @@ |
|||
@model AMESCoreStudio.WebApi.Models.AMES.WorkingStation |
|||
|
|||
|
|||
@{ ViewData["Title"] = "WHS024C"; |
|||
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="WHS024CSave"> |
|||
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
|||
|
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="WorkingStationName" class="control-label col-sm-3"></label> |
|||
<input asp-for="WorkingStationName" class="form-control col-sm-9" placeholder="請輸入站別名稱" /> |
|||
<span asp-validation-for="WorkingStationName" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="WorkingStationDesc" class="control-label col-sm-3"></label> |
|||
<input asp-for="WorkingStationDesc" class="form-control col-sm-9" placeholder="請輸入站別描述" /> |
|||
<span asp-validation-for="WorkingStationDesc" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="TypeNo" class="control-label col-sm-3"></label> |
|||
<select asp-for="TypeNo" class="custom-select col-sm-9"> |
|||
<option value="0010">0010</option> |
|||
<option value="0020">0020</option> |
|||
<option value="0030">0030</option> |
|||
</select> |
|||
<span asp-validation-for="TypeNo" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="WorkingUnitNo" class="control-label col-sm-3"></label> |
|||
<select asp-for="WorkingUnitNo" asp-items="@ViewBag.WorkingUnitNo" class="custom-select col-sm-9"></select> |
|||
<span asp-validation-for="WorkingUnitNo" 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,72 @@ |
|||
@model AMESCoreStudio.WebApi.Models.AMES.WorkingStation |
|||
|
|||
|
|||
@{ ViewData["Title"] = "WHS024U"; |
|||
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="WHS024USave"> |
|||
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
|||
<input type="hidden" asp-for="WorkingStationID" /> |
|||
<input type="hidden" asp-for="StatusNo" /> |
|||
<input type="hidden" asp-for="CreateUserID" /> |
|||
<input type="hidden" asp-for="CreateDate" /> |
|||
|
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="WorkingStationName" class="control-label col-sm-3"></label> |
|||
<input asp-for="WorkingStationName" class="form-control col-sm-9" readonly /> |
|||
<span asp-validation-for="WorkingStationName" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="WorkingStationDesc" class="control-label col-sm-3"></label> |
|||
<input asp-for="WorkingStationDesc" class="form-control col-sm-9" placeholder="請輸入站別描述" /> |
|||
<span asp-validation-for="WorkingStationDesc" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="TypeNo" class="control-label col-sm-3"></label> |
|||
<select asp-for="TypeNo" class="custom-select col-sm-9"> |
|||
<option value="0010">0010</option> |
|||
<option value="0020">0020</option> |
|||
<option value="0030">0030</option> |
|||
</select> |
|||
<span asp-validation-for="TypeNo" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="WorkingUnitNo" class="control-label col-sm-3"></label> |
|||
<select asp-for="WorkingUnitNo" asp-items="@ViewBag.WorkingUnitNo" class="custom-select col-sm-9"></select> |
|||
<span asp-validation-for="WorkingUnitNo" 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,307 @@ |
|||
@{ |
|||
ViewData["Title"] = "標準工時資料維護"; |
|||
Layout = "~/Views/Shared/_AMESLayout.cshtml"; |
|||
} |
|||
|
|||
<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> |
|||
<input id="unitId" type="hidden" name="unitId" /> |
|||
<label class="layui-inline layui-form-label" style="width:80px;">線別</label> |
|||
<div class="layui-input-inline" style="width:120px;"> |
|||
<select name="lineID" id="lineID" lay-filter="lineID" lay-search> |
|||
<option value=""> —請選擇線別— </option> |
|||
</select> |
|||
<input type="hidden" id="line" name="line" /> |
|||
</div> |
|||
</div> |
|||
<div class="layui-inline" style="margin-right:5px;"> |
|||
<label class="layui-inline layui-form-label">工程編號</label> |
|||
<div class="layui-input-inline"> |
|||
<input type="text" name="modelname" id="modelname" placeholder="請輸入工程編號" autocomplete="off" class="layui-input"> |
|||
</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> |
|||
<div class="layui-form-item"> |
|||
<label class="layui-form-label">Excel匯入</label> |
|||
<div style="float:left;"> |
|||
<label class="layui-btn"> |
|||
<input type="file" id="dataFile" accept=".xls,.xlsx"> |
|||
@*<i class="layui-icon"></i>上傳文件*@ |
|||
</label> |
|||
<button type="button" id="attachment" title="Excel匯入" lay-submit lay-filter="attachment" class="layui-btn layui-btn-normal"> |
|||
<i class="layui-icon layui-icon-upload-circle" style="font-size: 20px"></i> |
|||
</button> |
|||
</div> |
|||
</div> |
|||
<table class="layui-hide" id="test" lay-filter="test"></table> |
|||
</div> |
|||
</div> |
|||
@section Scripts{ |
|||
<script type="text/javascript"> |
|||
var tableCols = [[ |
|||
{ |
|||
field: 'workingStandardID', |
|||
title: '#', |
|||
sort: true |
|||
}, |
|||
{ |
|||
field: 'itemNo', |
|||
title: '工程編號', |
|||
}, |
|||
{ |
|||
field: 'workingUnitNo', |
|||
title: '報工生產單位', |
|||
}, |
|||
{ |
|||
field: 'workingLineID', |
|||
title: '報工線別', |
|||
templet: function (d) { |
|||
var line; |
|||
if (d.lineInfo) |
|||
line = d.lineInfo["lineDesc"]; |
|||
else |
|||
line = "N/A"; |
|||
|
|||
return line; |
|||
} |
|||
}, |
|||
{ |
|||
field: 'workingStationID', |
|||
title: '報工站別', |
|||
templet: function (d) { |
|||
var station; |
|||
if (d.stations) |
|||
station = d.stations["stationWHName"]; |
|||
else |
|||
station = "N/A"; |
|||
|
|||
return station; |
|||
|
|||
} |
|||
}, |
|||
|
|||
{ |
|||
field: 'side', |
|||
title: '面別', |
|||
}, |
|||
{ |
|||
field: 'opCnt', |
|||
title: '標準人力', |
|||
}, |
|||
{ |
|||
field: 'ct', |
|||
title: '標準工時(分)', |
|||
}, |
|||
{ |
|||
field: 'unitNo', |
|||
title: '對應途程站別' |
|||
}, |
|||
{ |
|||
field: 'machineCnt', |
|||
title: '作業機台數', |
|||
}, |
|||
{ |
|||
field: 'updateDate', |
|||
title: '修改日', |
|||
}, |
|||
{ |
|||
field: 'updateUserID', |
|||
title: '修改人', |
|||
}, |
|||
{ |
|||
field: 'remark', |
|||
title: '備註', |
|||
}, |
|||
{ |
|||
field: 'center', |
|||
width: 200, |
|||
title: '操作', |
|||
templet: function (item) { |
|||
var btn = '<a class="layui-btn layui-btn-normal layui-btn-xs layui-icon layui-icon-edit" lay-event="edit">修改</a>'; |
|||
btn += ' <a class="layui-btn layui-btn-danger layui-btn-xs layui-icon layui-icon-delete" lay-event="del">刪除</a>'; |
|||
btn += ' <a class="layui-btn layui-btn-danger layui-btn-xs layui-icon layui-icon-view" lay-event="log">歷程</a>'; |
|||
return btn |
|||
} |
|||
} |
|||
]]; |
|||
//通过行tool編輯,lay-event="del" |
|||
function del(obj) { |
|||
if (obj.data.workingStandardID) { |
|||
var str; |
|||
str = "刪除"; |
|||
hg.confirm("系統:" + obj.data.workingStandardID + ",確定要" + str + "嗎?", function () { |
|||
$.ajax({ |
|||
url: '/WHS/WHS025D', |
|||
data: { id: obj.data.workingStandardID }, |
|||
type: 'POST', |
|||
success: function (res) { |
|||
if (res.success) { |
|||
obj.del(); //只删本地資料 |
|||
hg.msghide(str + "成功!", { |
|||
icon: 6 |
|||
}); |
|||
layui.table.reload('test', { page: { curr: $(".layui-laypage-em").next().html() } }) |
|||
} |
|||
else { |
|||
hg.msg(data.msg); |
|||
} |
|||
}, |
|||
error: function () { |
|||
hg.msg("網路請求失敗!"); |
|||
} |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
|
|||
//通过行tool刪除,lay-event="edit" |
|||
function edit(obj) { |
|||
if (obj.data.workingStandardID) { |
|||
hg.open('修改標準工時', '/WHS/WHS025U/' + obj.data.workingStandardID, 640, 480); |
|||
} |
|||
} |
|||
|
|||
////搜索 |
|||
$('#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(); |
|||
getLineInfoes(data); |
|||
}); |
|||
|
|||
}); |
|||
function getLineInfoes(data) { |
|||
$.ajax({ |
|||
url: "/WHS/GetWorkingLinesbyUnit", |
|||
dataType: 'json', |
|||
data: { id: data }, |
|||
contentType: "application/json", |
|||
type: 'get', |
|||
success: function (result) { |
|||
if (result.data) { |
|||
$("#lineID").empty();//清空下拉框的值 |
|||
$('#lineID').append(new Option("全部", "-99"));// 下拉選單裡新增元素 |
|||
console.log(result.data); |
|||
$.each(result.data, function (index, item) { |
|||
if (item.statusNo == "A") { //狀態為啟用才顯示資料 |
|||
$('#lineID').append(new Option(item.workingLineName, item.workingLineID));// 下拉選單裡新增元素 |
|||
} |
|||
}); |
|||
} |
|||
else { |
|||
$("#lineID").empty();//清空下拉框的值 |
|||
$('#lineID').append(new Option("無選項", "-99"));// 下拉選單裡新增元素 |
|||
} |
|||
layui.form.render("select");//重新渲染 固定寫法 |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
|
|||
////搜索 |
|||
$('#querysubmit').click(function () { |
|||
hg.msghide("刷新資料!"); |
|||
tt(); |
|||
}); |
|||
|
|||
|
|||
var toolbar = [{ |
|||
text: '新增', |
|||
layuiicon: '', |
|||
class: 'layui-btn-normal', |
|||
handler: function () { |
|||
hg.open('新增標準工時', '/WHS/WHS025C', 800, 800); |
|||
|
|||
} |
|||
} |
|||
]; |
|||
|
|||
var table; |
|||
$(function () { |
|||
tt(); |
|||
}); |
|||
//基本資料表格 |
|||
function tt() { |
|||
var unit = $("#unitNo").val(); |
|||
var lineID = $('#lineID').val(); |
|||
var keywords = $('#modelname').val(); |
|||
// table = hg.table.datatable('test', '標準工時資料', '/WHS/GetWorkingStandardWorkTimes2?u=' + unit + '&l=' + lineID + '&i=' + keywords |
|||
// , {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); |
|||
|
|||
table = hg.table.datatable('test', '標準工時資料', '/WHS/GetWorkingStandardWorkTimes2?u=' + unit + '&l=' + lineID + '&i=' + keywords |
|||
, {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); |
|||
} |
|||
|
|||
// Excel匯入 |
|||
|
|||
$("#attachment").click(function () { |
|||
var files = $('#dataFile').prop("files"); |
|||
if (files.length == 0) { |
|||
hg.msg("請選擇上傳文件!"); |
|||
return; |
|||
} |
|||
formData = new FormData(); |
|||
formData.append("Uploader", files[0]); |
|||
var index = layer.load(2, { |
|||
shade: [0.4, '#000'], |
|||
content: '匯入中...', |
|||
success: function (layero) { |
|||
layero.find('.layui-layer-content').css({ |
|||
'padding-top': '40px', |
|||
'width': '200px' |
|||
}) |
|||
} |
|||
}); |
|||
$.ajax({ |
|||
type: "POST", |
|||
url: "@Url.Action("WHS025ExcelUpload", "WHS")", |
|||
contentType: false, |
|||
processData: false, |
|||
cache: false, |
|||
data: formData, |
|||
success: function (result) { |
|||
if (result.success) { |
|||
hg.msg(result.msg); |
|||
layer.close(index); |
|||
location.reload(); |
|||
} |
|||
else { |
|||
hg.msg("讀取Excel錯誤:" + result.msg); |
|||
layer.close(index); |
|||
} |
|||
}, |
|||
error: function () { |
|||
hg.msg("上傳文件錯誤!"); |
|||
layer.close(index); |
|||
} |
|||
}); |
|||
}); |
|||
|
|||
|
|||
</script> |
|||
|
|||
} |
@ -0,0 +1,230 @@ |
|||
@model AMESCoreStudio.Web.ViewModels.WHS.WHS025ViewModel |
|||
|
|||
|
|||
@{ ViewData["Title"] = "WHS025C"; |
|||
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="WHS025CSave"> |
|||
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
|||
<input type="hidden" asp-for="WorkingStandardID" value="0" /> |
|||
<input type="hidden" asp-for="CreateUserID" value="0" /> |
|||
<input type="hidden" asp-for="UpdateUserID" value="0" /> |
|||
<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 asp-for="ItemNo" class="control-label col-sm-3"></label> |
|||
<input asp-for="ItemNo" class="form-control col-sm-7" placeholder="請輸入工程編號" /> |
|||
<span asp-validation-for="ItemNo" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="WorkingUnitNo" class="control-label col-sm-3"></label> |
|||
<select id="WorkingUnitNo" asp-for="WorkingUnitNo" 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 asp-for="UnitNo" 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 asp-for="WorkingLineID" class="control-label col-sm-3"></label> |
|||
<div id="lineCheckboxGroup" class="col-sm-7"> |
|||
<!-- 動態產生 checkbox 放這裡 --> |
|||
</div> |
|||
<span asp-validation-for="WorkingLineID" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="WorkingStationID" class="control-label col-sm-3"></label> |
|||
<select id="WorkingStationID" asp-for="WorkingStationID" asp-items="@ViewBag.StationList" class="custom-select col-sm-7"> |
|||
<option value="">請選擇</option> |
|||
<option value="-1">N/A</option> |
|||
</select> |
|||
<span asp-validation-for="WorkingStationID" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="Side" class="control-label col-sm-3"></label> |
|||
<select asp-for="Side" asp-items="@ViewBag.SideList" class="custom-select col-sm-7"></select> |
|||
<span asp-validation-for="Side" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="OpCnt" class="control-label col-sm-3"></label> |
|||
<input asp-for="OpCnt" class="form-control col-sm-7" placeholder="請輸入作業人數" /> |
|||
<span asp-validation-for="OpCnt" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
|
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="Ct" class="control-label col-sm-3"></label> |
|||
<input asp-for="Ct" class="form-control col-sm-7" placeholder="請輸入CT" /> |
|||
<span asp-validation-for="Ct" 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> |
|||
<input asp-for="StationID" class="form-control col-sm-7" /> |
|||
<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="MachineCnt" class="control-label col-sm-3"></label> |
|||
<input asp-for="MachineCnt" class="form-control col-sm-7" value="1" /> |
|||
<span asp-validation-for="MachineCnt" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="Remark" class="control-label col-sm-3"></label> |
|||
<textarea asp-for="Remark" style="min-height:100px;" class="layui-textarea col-sm-7"></textarea> |
|||
<span asp-validation-for="Remark" 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); |
|||
} |
|||
}); |
|||
|
|||
$("#WorkingUnitNo").change(function () { |
|||
var data = $("#WorkingUnitNo").val(); |
|||
|
|||
getLineInfoes_checkBox(data); |
|||
getWorkingStations(data); |
|||
|
|||
}); |
|||
|
|||
function getLineInfoes_checkBox(unitNo) { |
|||
$.ajax({ |
|||
url: "/WHS/GetWorkingLinesbyUnit", |
|||
dataType: 'json', |
|||
data: { id: unitNo }, |
|||
type: 'get', |
|||
success: function (result) { |
|||
const $container = $("#lineCheckboxGroup"); |
|||
$container.empty(); |
|||
if (result.data && result.data.length > 0) { |
|||
let rowHtml = '<div class="form-row">'; |
|||
$.each(result.data, function (index, item) { |
|||
if (item.statusNo == "A") { |
|||
const checkboxId = `line_${item.workingLineID}`; |
|||
const checkboxHtml = ` |
|||
<div class="form-check col-sm-4"> |
|||
<input type="checkbox" class="form-check-input" |
|||
id="${checkboxId}" name="WorkingLineIDs" |
|||
value="${item.workingLineID}" /> |
|||
<label class="form-check-label" for="${checkboxId}"> |
|||
${item.workingLineName} |
|||
</label> |
|||
</div> |
|||
`; |
|||
rowHtml += checkboxHtml; |
|||
|
|||
// 每滿3個,結束當前row並開始新row(但不要立即 append) |
|||
if ((index + 1) % 3 === 0 && index !== result.data.length - 1) { |
|||
rowHtml += '</div><div class="form-row">'; |
|||
} |
|||
} |
|||
}); |
|||
|
|||
rowHtml += '</div>'; // 收尾最後一個row |
|||
$container.append(rowHtml); // 一次性 append 整段 HTML |
|||
} else { |
|||
$container.append('<p>無可用線別</p>'); |
|||
} |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
console.error("載入線別失敗:", error); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
function getLineInfoes(data) { |
|||
$.ajax({ |
|||
url: "/WHS/GetWorkingLinesbyUnit", |
|||
dataType: 'json', |
|||
data: { id: data }, |
|||
contentType: "application/json", |
|||
type: 'get', |
|||
success: function (result) { |
|||
if (result.data) { |
|||
$("#WorkingLineID").empty();//清空下拉框的值 |
|||
$('#WorkingLineID').append(new Option("請選擇", ""));// 下拉選單裡新增元素 |
|||
$.each(result.data, function (index, item) { |
|||
console.log(result); |
|||
if (item.statusNo == "A") { //狀態為啟用才顯示資料 |
|||
$('#WorkingLineID').append(new Option(item.workingLineName, item.workingLineID));// 下拉選單裡新增元素 |
|||
} |
|||
}); |
|||
} |
|||
else { |
|||
$("#WorkingLineID").empty();//清空下拉框的值 |
|||
$('#WorkingLineID').append(new Option("無選項", "-99"));// 下拉選單裡新增元素 |
|||
} |
|||
// layui.form.render("select");//重新渲染 固定寫法 |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
|
|||
function getWorkingStations(data) { |
|||
$.ajax({ |
|||
url: "/WHS/GetWorkingStationsbyUnit", |
|||
dataType: 'json', |
|||
data: { id: data }, |
|||
contentType: "application/json", |
|||
type: 'get', |
|||
success: function (result) { |
|||
if (result.data) { |
|||
$("#WorkingStationID").empty(); |
|||
$('#WorkingStationID').append(new Option("請選擇", "")); |
|||
var count = 0; |
|||
$.each(result.data, function (index, item) { |
|||
console.log(result); |
|||
if (item.statusNo == "A") { //狀態為啟用才顯示資料 |
|||
$('#WorkingStationID').append(new Option(item.workingStationName, item.workingStationID)); |
|||
count = count + 1; |
|||
} |
|||
}); |
|||
if (count == 0) { |
|||
$("#WorkingStationID").empty(); |
|||
$('#WorkingStationID').append(new Option("無選項", "")); |
|||
} |
|||
} |
|||
else { |
|||
$("#WorkingStationID").empty(); |
|||
$('#WorkingStationID').append(new Option("無選項", "")); |
|||
} |
|||
// layui.form.render("select"); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
|
|||
</script> |
|||
|
|||
|
|||
} |
|||
|
@ -0,0 +1,226 @@ |
|||
@model AMESCoreStudio.WebApi.Models.AMES.WorkingStandardWorkTime |
|||
|
|||
@{ ViewData["Title"] = "WHS025U"; |
|||
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="WHS025USave"> |
|||
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
|||
<input type="hidden" asp-for="WorkingStandardID" value="0" /> |
|||
<input type="hidden" asp-for="CreateUserID" /> |
|||
<input type="hidden" asp-for="UpdateUserID" value="0" /> |
|||
<input type="hidden" asp-for="CreateDate" /> |
|||
<input type="hidden" asp-for="UpdateDate" value="@System.DateTime.Now" /> |
|||
|
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="ItemNo" class="control-label col-sm-3"></label> |
|||
<input asp-for="ItemNo" class="form-control col-sm-7" readonly/> |
|||
<span asp-validation-for="ItemNo" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="WorkingUnitNo" class="control-label col-sm-3"></label> |
|||
<select id="WorkingUnitNo" asp-for="WorkingUnitNo" asp-items="@ViewBag.WorkingUnitNo" class="custom-select col-sm-7"> |
|||
</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="UnitNo" class="control-label col-sm-3"></label> |
|||
<select id="UnitNo" asp-for="UnitNo" asp-items="@ViewBag.FactoryUnit" class="custom-select col-sm-7"> |
|||
</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="WorkingLineID" class="control-label col-sm-3"></label> |
|||
<select id="WorkingLineID" asp-for="WorkingLineID" asp-items="@ViewBag.FactoryUnit" class="custom-select col-sm-7"> |
|||
</select> |
|||
<span asp-validation-for="WorkingLineID" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="WorkingStationID" class="control-label col-sm-3"></label> |
|||
<select id="WorkingStationID" asp-for="WorkingStationID" asp-items="@ViewBag.StationList" class="custom-select col-sm-7"> |
|||
<option value="">請選擇</option> |
|||
<option value="-1">N/A</option> |
|||
</select> |
|||
<span asp-validation-for="WorkingStationID" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="Side" class="control-label col-sm-3"></label> |
|||
<select asp-for="Side" asp-items="@ViewBag.SideList" class="custom-select col-sm-7"></select> |
|||
<span asp-validation-for="Side" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="OpCnt" class="control-label col-sm-3"></label> |
|||
<input asp-for="OpCnt" class="form-control col-sm-7" placeholder="請輸入作業人數" /> |
|||
<span asp-validation-for="OpCnt" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
|
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="Ct" class="control-label col-sm-3"></label> |
|||
<input asp-for="Ct" class="form-control col-sm-7" placeholder="請輸入CT" /> |
|||
<span asp-validation-for="Ct" 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> |
|||
<input asp-for="StationID" class="form-control col-sm-7" /> |
|||
<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="MachineCnt" class="control-label col-sm-3"></label> |
|||
<input asp-for="MachineCnt" class="form-control col-sm-7" value="1" /> |
|||
<span asp-validation-for="MachineCnt" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="Remark" class="control-label col-sm-3"></label> |
|||
<textarea asp-for="Remark" style="min-height:100px;" class="layui-textarea col-sm-7"></textarea> |
|||
<span asp-validation-for="Remark" 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); |
|||
} |
|||
}); |
|||
|
|||
$("#WorkingUnitNo").change(function () { |
|||
var data = $("#WorkingUnitNo").val(); |
|||
|
|||
getLineInfoes_checkBox(data); |
|||
getLineInfoes(data); |
|||
|
|||
}); |
|||
|
|||
function getLineInfoes_checkBox(unitNo) { |
|||
$.ajax({ |
|||
url: "/WHS/GetWorkingLinesbyUnit", |
|||
dataType: 'json', |
|||
data: { id: unitNo }, |
|||
type: 'get', |
|||
success: function (result) { |
|||
const $container = $("#lineCheckboxGroup"); |
|||
$container.empty(); |
|||
if (result.data && result.data.length > 0) { |
|||
let rowHtml = '<div class="form-row">'; |
|||
$.each(result.data, function (index, item) { |
|||
if (item.statusNo == "A") { |
|||
const checkboxId = `line_${item.workingLineID}`; |
|||
const checkboxHtml = ` |
|||
<div class="form-check col-sm-4"> |
|||
<input type="checkbox" class="form-check-input" |
|||
id="${checkboxId}" name="WorkingLineIDs" |
|||
value="${item.workingLineID}" /> |
|||
<label class="form-check-label" for="${checkboxId}"> |
|||
${item.workingLineName} |
|||
</label> |
|||
</div> |
|||
`; |
|||
rowHtml += checkboxHtml; |
|||
|
|||
// 每滿3個,結束當前row並開始新row(但不要立即 append) |
|||
if ((index + 1) % 3 === 0 && index !== result.data.length - 1) { |
|||
rowHtml += '</div><div class="form-row">'; |
|||
} |
|||
} |
|||
}); |
|||
|
|||
rowHtml += '</div>'; // 收尾最後一個row |
|||
$container.append(rowHtml); // 一次性 append 整段 HTML |
|||
} else { |
|||
$container.append('<p>無可用線別</p>'); |
|||
} |
|||
}, |
|||
error: function (xhr, status, error) { |
|||
console.error("載入線別失敗:", error); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
function getLineInfoes(data) { |
|||
$.ajax({ |
|||
url: "/WHS/GetWorkingLinesbyUnit", |
|||
dataType: 'json', |
|||
data: { id: data }, |
|||
contentType: "application/json", |
|||
type: 'get', |
|||
success: function (result) { |
|||
if (result.data) { |
|||
$("#WorkingLineID").empty();//清空下拉框的值 |
|||
$('#WorkingLineID').append(new Option("請選擇", ""));// 下拉選單裡新增元素 |
|||
$.each(result.data, function (index, item) { |
|||
console.log(result); |
|||
if (item.statusNo == "A") { //狀態為啟用才顯示資料 |
|||
$('#WorkingLineID').append(new Option(item.workingLineName, item.workingLineID));// 下拉選單裡新增元素 |
|||
} |
|||
}); |
|||
} |
|||
else { |
|||
$("#WorkingLineID").empty();//清空下拉框的值 |
|||
$('#WorkingLineID').append(new Option("無選項", "-99"));// 下拉選單裡新增元素 |
|||
} |
|||
// layui.form.render("select");//重新渲染 固定寫法 |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
|
|||
function getWorkingStations(data) { |
|||
$.ajax({ |
|||
url: "/WHS/GetWorkingStationsbyUnit", |
|||
dataType: 'json', |
|||
data: { id: data }, |
|||
contentType: "application/json", |
|||
type: 'get', |
|||
success: function (result) { |
|||
if (result.data) { |
|||
$("#WorkingStationID").empty(); |
|||
$('#WorkingStationID').append(new Option("請選擇", "")); |
|||
var count = 0; |
|||
$.each(result.data, function (index, item) { |
|||
console.log(result); |
|||
if (item.statusNo == "A") { //狀態為啟用才顯示資料 |
|||
$('#WorkingStationID').append(new Option(item.workingStationName, item.workingStationID)); |
|||
count = count + 1; |
|||
} |
|||
}); |
|||
if (count == 0) { |
|||
$("#WorkingStationID").empty(); |
|||
$('#WorkingStationID').append(new Option("無選項", "")); |
|||
} |
|||
} |
|||
else { |
|||
$("#WorkingStationID").empty(); |
|||
$('#WorkingStationID').append(new Option("無選項", "")); |
|||
} |
|||
// layui.form.render("select"); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
|
|||
</script> |
|||
|
|||
|
|||
} |
|||
|
@ -0,0 +1,269 @@ |
|||
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 WorkingLinesController : ControllerBase |
|||
{ |
|||
private readonly AMESContext _context; |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="context"></param>
|
|||
public WorkingLinesController(AMESContext context) |
|||
{ |
|||
_context = context; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 获取全部報工線別基本資料
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
[HttpGet] |
|||
public async Task<ResultModel<WorkingLine>> GetWorkingLines(int page = 0, int limit = 10) |
|||
{ |
|||
IQueryable<WorkingLine> q = _context.WorkingLines; |
|||
ResultModel<WorkingLine> result = new ResultModel<WorkingLine>(); |
|||
|
|||
// 紀錄筆數
|
|||
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<WorkingLine>>> GetWorkingLine(int id) |
|||
{ |
|||
|
|||
IQueryable<WorkingLine> q = _context.WorkingLines; |
|||
q = q.Where(p => p.WorkingLineID.Equals(id)); |
|||
var WorkingLine = await q.ToListAsync(); |
|||
|
|||
if (WorkingLine == null) |
|||
{ |
|||
return NotFound(); |
|||
} |
|||
|
|||
return WorkingLine; |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 用生產單位获取该報工線別基本資料
|
|||
/// </summary>
|
|||
/// <param name="id">報工生產單位</param>
|
|||
/// <returns></returns>
|
|||
[HttpGet("Unit/{id}")] |
|||
public async Task<ActionResult<IEnumerable<WorkingLine>>> GetWorkingLines(string id) |
|||
{ |
|||
IQueryable<WorkingLine> q = _context.WorkingLines; |
|||
|
|||
//var q = from q1 in _context.WorkingLines
|
|||
// join q2 in _context.WorkingUnits on q1.WorkingUnitNo equals q2.WorkingUnitNo
|
|||
// select new WorkingLine
|
|||
// {
|
|||
// WorkingLineID = q1.WorkingLineID,
|
|||
// WorkingLineName = q1.WorkingLineName,
|
|||
// WorkingUnitNo = q1.WorkingUnitNo,
|
|||
// StatusNo = q1.StatusNo,
|
|||
// CreateUserID = q1.CreateUserID,
|
|||
// CreateDate = q1.CreateDate,
|
|||
// UpdateDate = q1.UpdateDate,
|
|||
// GetWorkingUnit = q2
|
|||
// };
|
|||
|
|||
if (id != "all") |
|||
{ |
|||
q = q.Where(p => p.WorkingUnitNo.Equals(id)); |
|||
} |
|||
var WorkingLine = await q.ToListAsync(); |
|||
|
|||
if (WorkingLine == null) |
|||
{ |
|||
return NotFound(); |
|||
} |
|||
|
|||
return WorkingLine; |
|||
} |
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 用生產單位获取该報工線別基本資料
|
|||
/// </summary>
|
|||
/// <param name="id">報工生產單位</param>
|
|||
/// <returns></returns>
|
|||
[HttpGet("MultiUnit/{id}")] |
|||
public async Task<ActionResult<IEnumerable<dynamic>>> GetWorkingLinesMulti(string id) |
|||
{ |
|||
// IQueryable<WorkingLine> q = _context.WorkingLines;
|
|||
|
|||
var q = from q1 in _context.WorkingLines |
|||
join q2 in _context.WorkingUnits on q1.WorkingUnitNo equals q2.WorkingUnitNo |
|||
select new |
|||
{ |
|||
WorkingLineID = q1.WorkingLineID, |
|||
WorkingLineName = q1.WorkingLineName, |
|||
WorkingUnitNo = q1.WorkingUnitNo, |
|||
StatusNo = q1.StatusNo, |
|||
CreateUserID = q1.CreateUserID, |
|||
CreateDate = q1.CreateDate, |
|||
UpdateDate = q1.UpdateDate, |
|||
WorkingUnitName = q2.WorkingUnitName |
|||
}; |
|||
|
|||
if (id != "all") |
|||
{ |
|||
q = q.Where(p => p.WorkingUnitNo.Equals(id)); |
|||
} |
|||
var WorkingLine = await q.ToListAsync(); |
|||
|
|||
if (WorkingLine == null) |
|||
{ |
|||
return NotFound(); |
|||
} |
|||
|
|||
return WorkingLine; |
|||
} |
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 更新條報工線別基本資料
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <param name="WorkingLine"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPut("{id}")] |
|||
public async Task<ResultModel<WorkingLine>> PutWorkingLines(int id, [FromBody] WorkingLine WorkingLine) |
|||
{ |
|||
ResultModel<WorkingLine> result = new ResultModel<WorkingLine>(); |
|||
if (id != WorkingLine.WorkingLineID) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = "序號錯誤"; |
|||
return result; |
|||
} |
|||
WorkingLine.UpdateDate = DateTime.Now; |
|||
_context.Entry(WorkingLine).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="WorkingLine"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost] |
|||
public async Task<ResultModel<WorkingLine>> PostWorkingLines(WorkingLine WorkingLine) |
|||
{ |
|||
ResultModel<WorkingLine> result = new ResultModel<WorkingLine>(); |
|||
Helper helper = new Helper(_context); |
|||
WorkingLine.WorkingLineID = helper.GetIDKey("WorkingLine_ID").Result; |
|||
WorkingLine.CreateDate = DateTime.Now; |
|||
WorkingLine.UpdateDate = DateTime.Now; |
|||
_context.WorkingLines.Add(WorkingLine); |
|||
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}")] |
|||
public async Task<ResultModel<WorkingLine>> DeleteWorkingLines(int id) |
|||
{ |
|||
ResultModel<WorkingLine> result = new ResultModel<WorkingLine>(); |
|||
var workingunit = await _context.WorkingLines.Where(m => m.WorkingLineID == id).FirstOrDefaultAsync(); |
|||
if (workingunit == null) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = "序號錯誤"; |
|||
return result; |
|||
} |
|||
//////
|
|||
var workingunitNew = new WorkingLine(); |
|||
workingunitNew = workingunit; |
|||
|
|||
_context.Entry(workingunitNew).State = EntityState.Modified; |
|||
|
|||
if (workingunit.StatusNo == "A") |
|||
workingunitNew.StatusNo = "S"; |
|||
else |
|||
workingunitNew.StatusNo = "A"; |
|||
workingunitNew.UpdateDate = DateTime.Now; |
|||
|
|||
|
|||
try |
|||
{ |
|||
await _context.SaveChangesAsync(); |
|||
result.Success = true; |
|||
result.Msg = "OK"; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = ex.InnerException.Message; |
|||
} |
|||
return result; |
|||
|
|||
} |
|||
|
|||
} |
|||
} |
@ -0,0 +1,230 @@ |
|||
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 WorkingStandardWorkTimesController : ControllerBase |
|||
{ |
|||
private readonly AMESContext _context; |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="context"></param>
|
|||
public WorkingStandardWorkTimesController(AMESContext context) |
|||
{ |
|||
_context = context; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 获取全部報工標準工時資料
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
[HttpGet] |
|||
public async Task<ResultModel<WorkingStandardWorkTime>> GetWorkingStandardWorkTimes(int page = 0, int limit = 10) |
|||
{ |
|||
IQueryable<WorkingStandardWorkTime> q = _context.WorkingStandardWorkTimes; |
|||
ResultModel<WorkingStandardWorkTime> result = new ResultModel<WorkingStandardWorkTime>(); |
|||
|
|||
// 紀錄筆數
|
|||
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>
|
|||
/// <returns></returns>
|
|||
[HttpGet("byALL")] |
|||
public async Task<ActionResult<IEnumerable<WorkingStandardWorkTime>>> GetWorkingStationALLs() |
|||
{ |
|||
IQueryable<WorkingStandardWorkTime> q = _context.WorkingStandardWorkTimes; |
|||
q = q.OrderBy(p => p.WorkingStandardID); |
|||
var WorkingStandardWorkTimes = await q.ToListAsync(); |
|||
return WorkingStandardWorkTimes; |
|||
|
|||
} |
|||
/// <summary>
|
|||
/// 用ID获取该報工標準工時資料
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <returns></returns>
|
|||
[HttpGet("{id}")] |
|||
public async Task<ActionResult<IEnumerable<WorkingStandardWorkTime>>> GetWorkingStandardWorkTime(int id) |
|||
{ |
|||
|
|||
IQueryable<WorkingStandardWorkTime> q = _context.WorkingStandardWorkTimes; |
|||
q = q.Where(p => p.WorkingStandardID.Equals(id)); |
|||
var WorkingStandardWorkTime = await q.ToListAsync(); |
|||
|
|||
if (WorkingStandardWorkTime == null) |
|||
{ |
|||
return NotFound(); |
|||
} |
|||
|
|||
return WorkingStandardWorkTime; |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// WHS025
|
|||
/// </summary>
|
|||
/// <param name="u"></param>
|
|||
/// <param name="l"></param>
|
|||
/// <param name="i"></param>
|
|||
/// <returns></returns>
|
|||
// GET: api/StandardWorkTimes/5
|
|||
[HttpGet("WHS025/{u}/{l}/{i}")] |
|||
public async Task<ResultModel<WorkingStandardWorkTime>> GetWorkingStandardWorkTimebyQuery(string u, int l, string i, int page = 0, int limit = 10) |
|||
{ |
|||
IQueryable<WorkingStandardWorkTime> q = _context.WorkingStandardWorkTimes; |
|||
ResultModel<WorkingStandardWorkTime> result = new ResultModel<WorkingStandardWorkTime>(); |
|||
|
|||
|
|||
if (u != "all") |
|||
{ |
|||
q = q.Where(p => p.WorkingUnitNo.Equals(l)); |
|||
} |
|||
if (l > 0) |
|||
{ |
|||
q = q.Where(p => p.WorkingLineID.Equals(l)); |
|||
} |
|||
if (i != "Null") |
|||
{ |
|||
q = q.Where(p => p.ItemNo.Equals(i.ToUpper())); |
|||
} |
|||
|
|||
|
|||
|
|||
// 紀錄筆數
|
|||
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="WorkingStandardWorkTime"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPut("{id}")] |
|||
public async Task<ResultModel<WorkingStandardWorkTime>> PutWorkingStandardWorkTimes(int id, [FromBody] WorkingStandardWorkTime WorkingStandardWorkTime) |
|||
{ |
|||
ResultModel<WorkingStandardWorkTime> result = new ResultModel<WorkingStandardWorkTime>(); |
|||
if (id != WorkingStandardWorkTime.WorkingStandardID) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = "ID錯誤"; |
|||
return result; |
|||
} |
|||
WorkingStandardWorkTime.UpdateDate = DateTime.Now; |
|||
_context.Entry(WorkingStandardWorkTime).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="WorkingStandardWorkTime"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost] |
|||
public async Task<ResultModel<WorkingStandardWorkTime>> PostWorkingStandardWorkTimes(WorkingStandardWorkTime WorkingStandardWorkTime) |
|||
{ |
|||
ResultModel<WorkingStandardWorkTime> result = new ResultModel<WorkingStandardWorkTime>(); |
|||
Helper helper = new Helper(_context); |
|||
WorkingStandardWorkTime.WorkingStandardID = helper.GetIDKey("WorkingST_ID").Result; |
|||
WorkingStandardWorkTime.CreateDate = DateTime.Now; |
|||
WorkingStandardWorkTime.UpdateDate = DateTime.Now; |
|||
_context.WorkingStandardWorkTimes.Add(WorkingStandardWorkTime); |
|||
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}")] |
|||
public async Task<ResultModel<WorkingStandardWorkTime>> DeleteWorkingStandardWorkTimes(int id) |
|||
{ |
|||
ResultModel<WorkingStandardWorkTime> result = new ResultModel<WorkingStandardWorkTime>(); |
|||
|
|||
var workingStandardWorkTime = await _context.WorkingStandardWorkTimes.FindAsync(id); |
|||
if (workingStandardWorkTime == null) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = "ID不存在"; |
|||
return result; |
|||
} |
|||
|
|||
_context.WorkingStandardWorkTimes.Remove(workingStandardWorkTime); |
|||
await _context.SaveChangesAsync(); |
|||
|
|||
result.Success = true; |
|||
result.Msg = "OK"; |
|||
return result; |
|||
} |
|||
|
|||
} |
|||
} |
@ -0,0 +1,194 @@ |
|||
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>
|
|||
/// 報工標準工時資料log维护
|
|||
/// </summary>
|
|||
[Route("api/[controller]")]
|
|||
[ApiController] |
|||
public class WorkingStandardWorkTimeLogsController : ControllerBase |
|||
{ |
|||
private readonly AMESContext _context; |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="context"></param>
|
|||
public WorkingStandardWorkTimeLogsController(AMESContext context) |
|||
{ |
|||
_context = context; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 获取全部報工標準工時資料log
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
[HttpGet] |
|||
public async Task<ResultModel<WorkingStandardWorkTimeLog>> GetWorkingStandardWorkTimeLogs(int page = 0, int limit = 10) |
|||
{ |
|||
IQueryable<WorkingStandardWorkTimeLog> q = _context.WorkingStandardWorkTimeLogs; |
|||
ResultModel<WorkingStandardWorkTimeLog> result = new ResultModel<WorkingStandardWorkTimeLog>(); |
|||
|
|||
// 紀錄筆數
|
|||
result.DataTotal = q.Count(); |
|||
|
|||
// Table 頁數
|
|||
if (page > 0) |
|||
{ |
|||
q = q.Skip((page - 1) * limit).Take(limit); |
|||
} |
|||
result.Data = await q.ToListAsync(); |
|||
return result; |
|||
} |
|||
/// <summary>
|
|||
/// 获取全部報工標準工時資料log
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
[HttpGet("byALL")] |
|||
public async Task<ActionResult<IEnumerable<WorkingStandardWorkTimeLog>>> GetWorkingStationALLs() |
|||
{ |
|||
IQueryable<WorkingStandardWorkTimeLog> q = _context.WorkingStandardWorkTimeLogs; |
|||
q = q.OrderBy(p => p.WorkingStandardID); |
|||
var WorkingStandardWorkTimeLogs = await q.ToListAsync(); |
|||
return WorkingStandardWorkTimeLogs; |
|||
|
|||
} |
|||
/// <summary>
|
|||
/// 用ID获取该報工標準工時資料log
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <returns></returns>
|
|||
[HttpGet("{id}")] |
|||
public async Task<ActionResult<IEnumerable<WorkingStandardWorkTimeLog>>> GetWorkingStandardWorkTimeLog(int id) |
|||
{ |
|||
|
|||
IQueryable<WorkingStandardWorkTimeLog> q = _context.WorkingStandardWorkTimeLogs; |
|||
q = q.Where(p => p.WorkingStandardID.Equals(id)); |
|||
var WorkingStandardWorkTimeLog = await q.ToListAsync(); |
|||
|
|||
if (WorkingStandardWorkTimeLog == null) |
|||
{ |
|||
return NotFound(); |
|||
} |
|||
|
|||
return WorkingStandardWorkTimeLog; |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// WHS025
|
|||
/// </summary>
|
|||
/// <param name="u"></param>
|
|||
/// <param name="l"></param>
|
|||
/// <param name="i"></param>
|
|||
/// <returns></returns>
|
|||
// GET: api/StandardWorkTimes/5
|
|||
[HttpGet("WHS025/{u}/{l}/{i}")] |
|||
public async Task<ResultModel<WorkingStandardWorkTimeLog>> GetWorkingStandardWorkTimeLogbyQuery(string u, int l, string i, int page = 0, int limit = 10) |
|||
{ |
|||
IQueryable<WorkingStandardWorkTimeLog> q = _context.WorkingStandardWorkTimeLogs; |
|||
ResultModel<WorkingStandardWorkTimeLog> result = new ResultModel<WorkingStandardWorkTimeLog>(); |
|||
q = q.Where(p => p.UnitNo.Equals(u)); |
|||
|
|||
if (u != "Null") |
|||
{ |
|||
|
|||
} |
|||
|
|||
if (i != "Null") |
|||
{ |
|||
q = q.Where(p => p.ItemNo.Contains(i.ToUpper())); |
|||
} |
|||
if (l > 0) |
|||
{ |
|||
// q = q.Where(p => p.LineID.Equals(l));
|
|||
} |
|||
|
|||
|
|||
|
|||
var WorkingStandardWorkTimeLog = await q.ToListAsync(); |
|||
|
|||
if (WorkingStandardWorkTimeLog == null) |
|||
{ |
|||
// return NotFound();
|
|||
result.Data = WorkingStandardWorkTimeLog; |
|||
result.DataTotal = 0; |
|||
} |
|||
foreach (var data in WorkingStandardWorkTimeLog) |
|||
{ |
|||
// data.LineInfo = _context.LineInfoes.Find(data.LineID);
|
|||
// data.Stations = _context.StationWorkingHours.Find(data.StationID);
|
|||
} |
|||
|
|||
return result; |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 新增報工標準工時資料log
|
|||
/// </summary>
|
|||
/// <param name="WorkingStandardWorkTimeLog"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost] |
|||
public async Task<ResultModel<WorkingStandardWorkTimeLog>> PostWorkingStandardWorkTimeLogs(WorkingStandardWorkTimeLog WorkingStandardWorkTimeLog) |
|||
{ |
|||
ResultModel<WorkingStandardWorkTimeLog> result = new ResultModel<WorkingStandardWorkTimeLog>(); |
|||
Helper helper = new Helper(_context); |
|||
WorkingStandardWorkTimeLog.WorkingStandardID = helper.GetIDKey("WorkingStandardWorkTimeLog_ID").Result; |
|||
WorkingStandardWorkTimeLog.CreateDate = DateTime.Now; |
|||
_context.WorkingStandardWorkTimeLogs.Add(WorkingStandardWorkTimeLog); |
|||
try |
|||
{ |
|||
await _context.SaveChangesAsync(); |
|||
result.Success = true; |
|||
result.Msg = "OK"; |
|||
} |
|||
catch (DbUpdateException ex) |
|||
{ |
|||
|
|||
result.Success = false; |
|||
result.Msg = ex.InnerException.Message; |
|||
} |
|||
|
|||
return result; |
|||
} |
|||
/// <summary>
|
|||
/// 停用/啟用報工標準工時資料log
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <returns></returns>
|
|||
[HttpDelete("{id}")] |
|||
public async Task<ResultModel<WorkingStandardWorkTimeLog>> DeleteWorkingStandardWorkTimeLogs(int id) |
|||
{ |
|||
ResultModel<WorkingStandardWorkTimeLog> result = new ResultModel<WorkingStandardWorkTimeLog>(); |
|||
|
|||
var standardWorkTime = await _context.StandardWorkTimes.FindAsync(id); |
|||
if (standardWorkTime == null) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = "序號不存在"; |
|||
return result; |
|||
} |
|||
|
|||
_context.StandardWorkTimes.Remove(standardWorkTime); |
|||
await _context.SaveChangesAsync(); |
|||
|
|||
result.Success = true; |
|||
result.Msg = "OK"; |
|||
return result; |
|||
|
|||
} |
|||
|
|||
} |
|||
} |
@ -0,0 +1,281 @@ |
|||
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 WorkingStationsController : ControllerBase |
|||
{ |
|||
private readonly AMESContext _context; |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="context"></param>
|
|||
public WorkingStationsController(AMESContext context) |
|||
{ |
|||
_context = context; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 获取全部報工生產單位別
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
[HttpGet] |
|||
public async Task<ResultModel<WorkingStation>> GetWorkingStations(int page = 0, int limit = 10) |
|||
{ |
|||
IQueryable<WorkingStation> q = _context.WorkingStations; |
|||
ResultModel<WorkingStation> result = new ResultModel<WorkingStation>(); |
|||
|
|||
// 紀錄筆數
|
|||
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>
|
|||
/// <returns></returns>
|
|||
[HttpGet("byALL")] |
|||
public async Task<ActionResult<IEnumerable<WorkingStation>>> GetWorkingStationALLs() |
|||
{ |
|||
IQueryable<WorkingStation> q = _context.WorkingStations; |
|||
q = q.OrderBy(p => p.WorkingStationID); |
|||
var WorkingStations = await q.ToListAsync(); |
|||
return WorkingStations; |
|||
|
|||
} |
|||
/// <summary>
|
|||
/// 用ID获取该報工生產單位別
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <returns></returns>
|
|||
[HttpGet("{id}")] |
|||
public async Task<ActionResult<IEnumerable<WorkingStation>>> GetWorkingStation(int id) |
|||
{ |
|||
|
|||
IQueryable<WorkingStation> q = _context.WorkingStations; |
|||
q = q.Where(p => p.WorkingStationID.Equals(id)); |
|||
var WorkingStation = await q.ToListAsync(); |
|||
|
|||
if (WorkingStation == null) |
|||
{ |
|||
return NotFound(); |
|||
} |
|||
|
|||
return WorkingStation; |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 用生產單位获取该報工線別基本資料
|
|||
/// </summary>
|
|||
/// <param name="id">報工生產單位</param>
|
|||
/// <returns></returns>
|
|||
[HttpGet("Unit/{id}")] |
|||
public async Task<ActionResult<IEnumerable<WorkingStation>>> GetWorkingStations(string id) |
|||
{ |
|||
try |
|||
{ |
|||
IQueryable<WorkingStation> q = _context.WorkingStations; |
|||
if (id != "all") |
|||
{ |
|||
q = q.Where(p => p.WorkingUnitNo.Equals(id)); |
|||
} |
|||
var WorkingStation = await q.ToListAsync(); |
|||
|
|||
if (WorkingStation == null) |
|||
{ |
|||
return NotFound(); |
|||
} |
|||
return WorkingStation; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
var aa= ex.InnerException.Message; |
|||
|
|||
throw; |
|||
|
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 用用生產單位获取该報工線別基本資料
|
|||
/// </summary>
|
|||
/// <param name="id">報工生產單位</param>
|
|||
/// <returns></returns>
|
|||
[HttpGet("MultiUnit/{id}")] |
|||
public async Task<ActionResult<IEnumerable<dynamic>>> GetWorkingStationsMulti(string id) |
|||
{ |
|||
// IQueryable<WorkingLine> q = _context.WorkingLines;
|
|||
|
|||
var q = from q1 in _context.WorkingStations |
|||
join q2 in _context.WorkingUnits on q1.WorkingUnitNo equals q2.WorkingUnitNo |
|||
select new |
|||
{ |
|||
WorkingStationID = q1.WorkingStationID, |
|||
WorkingStationName = q1.WorkingStationName, |
|||
WorkingStationDesc = q1.WorkingStationDesc, |
|||
WorkingUnitNo = q1.WorkingUnitNo, |
|||
TypeNo = q1.TypeNo, |
|||
StatusNo = q1.StatusNo, |
|||
CreateUserID = q1.CreateUserID, |
|||
CreateDate = q1.CreateDate, |
|||
UpdateDate = q1.UpdateDate, |
|||
WorkingUnitName = q2.WorkingUnitName |
|||
}; |
|||
|
|||
if (id != "all") |
|||
{ |
|||
q = q.Where(p => p.WorkingUnitNo.Equals(id)); |
|||
} |
|||
var WorkingLine = await q.ToListAsync(); |
|||
|
|||
if (WorkingLine == null) |
|||
{ |
|||
return NotFound(); |
|||
} |
|||
|
|||
return WorkingLine; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 更新條報工生產單位別
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <param name="WorkingStation"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPut("{id}")] |
|||
public async Task<ResultModel<WorkingStation>> PutWorkingStations(int id, [FromBody] WorkingStation WorkingStation) |
|||
{ |
|||
ResultModel<WorkingStation> result = new ResultModel<WorkingStation>(); |
|||
if (id != WorkingStation.WorkingStationID) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = "序號錯誤"; |
|||
return result; |
|||
} |
|||
WorkingStation.UpdateDate = DateTime.Now; |
|||
_context.Entry(WorkingStation).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="WorkingStation"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost] |
|||
public async Task<ResultModel<WorkingStation>> PostWorkingStations(WorkingStation WorkingStation) |
|||
{ |
|||
ResultModel<WorkingStation> result = new ResultModel<WorkingStation>(); |
|||
Helper helper = new Helper(_context); |
|||
WorkingStation.WorkingStationID = helper.GetIDKey("WorkingStation_ID").Result; |
|||
WorkingStation.CreateDate = DateTime.Now; |
|||
WorkingStation.UpdateDate = DateTime.Now; |
|||
_context.WorkingStations.Add(WorkingStation); |
|||
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}")] |
|||
public async Task<ResultModel<WorkingStation>> DeleteWorkingStations(int id) |
|||
{ |
|||
ResultModel<WorkingStation> result = new ResultModel<WorkingStation>(); |
|||
var WorkingStation = await _context.WorkingStations.Where(m => m.WorkingStationID == id).FirstOrDefaultAsync(); |
|||
if (WorkingStation == null) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = "序號錯誤"; |
|||
return result; |
|||
} |
|||
//////
|
|||
var WorkingStationNew = new WorkingStation(); |
|||
WorkingStationNew = WorkingStation; |
|||
|
|||
_context.Entry(WorkingStationNew).State = EntityState.Modified; |
|||
|
|||
if (WorkingStation.StatusNo == "A") |
|||
WorkingStationNew.StatusNo = "S"; |
|||
else |
|||
WorkingStationNew.StatusNo = "A"; |
|||
WorkingStationNew.UpdateDate = DateTime.Now; |
|||
|
|||
|
|||
try |
|||
{ |
|||
await _context.SaveChangesAsync(); |
|||
result.Success = true; |
|||
result.Msg = "OK"; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = ex.InnerException.Message; |
|||
} |
|||
return result; |
|||
|
|||
} |
|||
|
|||
} |
|||
} |
@ -0,0 +1,201 @@ |
|||
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 WorkingUnitsController : ControllerBase |
|||
{ |
|||
private readonly AMESContext _context; |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="context"></param>
|
|||
public WorkingUnitsController(AMESContext context) |
|||
{ |
|||
_context = context; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 获取全部報工生產單位別
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
[HttpGet] |
|||
public async Task<ResultModel<WorkingUnit>> GetWorkingUnits(int page = 0, int limit = 10) |
|||
{ |
|||
IQueryable<WorkingUnit> q = _context.WorkingUnits; |
|||
ResultModel<WorkingUnit> result = new ResultModel<WorkingUnit>(); |
|||
|
|||
// 紀錄筆數
|
|||
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>
|
|||
/// <returns></returns>
|
|||
[HttpGet("byALL")] |
|||
public async Task<ActionResult<IEnumerable<WorkingUnit>>> GetWorkingStationALLs() |
|||
{ |
|||
IQueryable<WorkingUnit> q = _context.WorkingUnits; |
|||
q = q.OrderBy(p => p.WorkingUnitID); |
|||
var WorkingUnits = await q.ToListAsync(); |
|||
return WorkingUnits; |
|||
|
|||
} |
|||
/// <summary>
|
|||
/// 用ID获取该報工生產單位別
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <returns></returns>
|
|||
[HttpGet("{id}")] |
|||
public async Task<ActionResult<IEnumerable<WorkingUnit>>> GetWorkingUnit(int id) |
|||
{ |
|||
|
|||
IQueryable<WorkingUnit> q = _context.WorkingUnits; |
|||
q = q.Where(p => p.WorkingUnitID.Equals(id)); |
|||
var WorkingUnit = await q.ToListAsync(); |
|||
|
|||
if (WorkingUnit == null) |
|||
{ |
|||
return NotFound(); |
|||
} |
|||
|
|||
return WorkingUnit; |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 更新條報工生產單位別
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <param name="WorkingUnit"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPut("{id}")] |
|||
public async Task<ResultModel<WorkingUnit>> PutWorkingUnits(int id, [FromBody] WorkingUnit WorkingUnit) |
|||
{ |
|||
ResultModel<WorkingUnit> result = new ResultModel<WorkingUnit>(); |
|||
if (id != WorkingUnit.WorkingUnitID) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = "序號錯誤"; |
|||
return result; |
|||
} |
|||
WorkingUnit.UpdateDate = DateTime.Now; |
|||
_context.Entry(WorkingUnit).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="WorkingUnit"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost] |
|||
public async Task<ResultModel<WorkingUnit>> PostWorkingUnits(WorkingUnit WorkingUnit) |
|||
{ |
|||
ResultModel<WorkingUnit> result = new ResultModel<WorkingUnit>(); |
|||
Helper helper = new Helper(_context); |
|||
WorkingUnit.WorkingUnitID = helper.GetIDKey("WorkingUnit_ID").Result; |
|||
WorkingUnit.CreateDate = DateTime.Now; |
|||
WorkingUnit.UpdateDate = DateTime.Now; |
|||
_context.WorkingUnits.Add(WorkingUnit); |
|||
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}")] |
|||
public async Task<ResultModel<WorkingUnit>> DeleteWorkingUnits(int id) |
|||
{ |
|||
ResultModel<WorkingUnit> result = new ResultModel<WorkingUnit>(); |
|||
var workingunit = await _context.WorkingUnits.Where(m => m.WorkingUnitID == id).FirstOrDefaultAsync(); |
|||
if (workingunit == null) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = "序號錯誤"; |
|||
return result; |
|||
} |
|||
//////
|
|||
var workingunitNew = new WorkingUnit(); |
|||
workingunitNew = workingunit; |
|||
|
|||
_context.Entry(workingunitNew).State = EntityState.Modified; |
|||
|
|||
if (workingunit.StatusNo == "A") |
|||
workingunitNew.StatusNo = "S"; |
|||
else |
|||
workingunitNew.StatusNo = "A"; |
|||
workingunitNew.UpdateDate = DateTime.Now; |
|||
|
|||
|
|||
try |
|||
{ |
|||
await _context.SaveChangesAsync(); |
|||
result.Success = true; |
|||
result.Msg = "OK"; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = ex.InnerException.Message; |
|||
} |
|||
return result; |
|||
|
|||
} |
|||
|
|||
} |
|||
} |
@ -0,0 +1,78 @@ |
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
using System.Runtime.Serialization; |
|||
namespace AMESCoreStudio.WebApi.Models.AMES |
|||
{ |
|||
/// <summary>
|
|||
/// 報工線別基本資料
|
|||
/// </summary>
|
|||
[Table("WORKING_LINE", Schema = "JHAMES")] |
|||
public class WorkingLine |
|||
{ |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 報工線別代碼
|
|||
/// </summary>
|
|||
[Key] |
|||
[Column("WORKING_LINE_ID")] |
|||
[DataMember] |
|||
[Display(Name = "報工線別代碼")] |
|||
public int WorkingLineID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 報工線別名稱
|
|||
/// </summary>
|
|||
[Column("WORKING_LINE_NAME")] |
|||
[DataMember] |
|||
[Required(ErrorMessage = "{0} 不能空白")] |
|||
[Display(Name = "報工線別名稱")] |
|||
public string WorkingLineName { get; set; } |
|||
/// <summary>
|
|||
/// 報工生產單位代碼
|
|||
/// </summary>
|
|||
[Column("WORKING_UNIT_NO")] |
|||
[DataMember] |
|||
[Required(ErrorMessage = "{0} 不能空白")] |
|||
[Display(Name = "報工生產單位代碼")] |
|||
public string WorkingUnitNo { get; set; } |
|||
/// <summary>
|
|||
/// 狀態
|
|||
/// </summary>
|
|||
[Column("STATUS_NO")] |
|||
[DataMember] |
|||
[Display(Name = "狀態")] |
|||
public string StatusNo { get; set; } = "A"; |
|||
/// <summary>
|
|||
/// 建立者
|
|||
/// </summary>
|
|||
[Column("CREATE_USERID")] |
|||
[DataMember] |
|||
[Required(ErrorMessage = "{0} 不能空白")] |
|||
[Display(Name = "建立者")] |
|||
public int CreateUserID { get; set; } |
|||
/// <summary>
|
|||
/// 建立日期
|
|||
/// </summary>
|
|||
[Column("CREATE_DATE")] |
|||
[DataMember] |
|||
[Display(Name = "建立日期")] |
|||
public DateTime CreateDate { get; set; } |
|||
/// <summary>
|
|||
/// 修改日期
|
|||
/// </summary>
|
|||
[Column("UPDATE_DATE")] |
|||
[DataMember] |
|||
[Display(Name = "修改日期")] |
|||
public DateTime UpdateDate { get; set; } |
|||
|
|||
///// <summary>
|
|||
///// 生產制程單位
|
|||
///// </summary>
|
|||
//[ForeignKey("WorkingUnitNo")]
|
|||
//[DataMember]
|
|||
//public virtual WorkingUnit GetWorkingUnit { get; set; }
|
|||
|
|||
} |
|||
} |
@ -0,0 +1,150 @@ |
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
using System.Runtime.Serialization; |
|||
|
|||
namespace AMESCoreStudio.WebApi.Models.AMES |
|||
{ |
|||
/// <summary>
|
|||
/// 報工標準工時資料檔
|
|||
/// </summary>
|
|||
[Table("WORKING_STANDARD_WORKTIME", Schema = "JHAMES")] |
|||
public class WorkingStandardWorkTime |
|||
{ |
|||
/// <summary>
|
|||
/// 報工標準工時ID
|
|||
/// </summary>
|
|||
[Key] |
|||
[Column("WORKING_STANDARD_ID")] |
|||
[DataMember] |
|||
[Display(Name = "報工標準工時ID")] |
|||
public int WorkingStandardID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 報工生產單位
|
|||
/// </summary>
|
|||
[Column("WORKING_UNIT_NO")] |
|||
[DataMember] |
|||
[Required(ErrorMessage = "{0} 不能空白")] |
|||
[Display(Name = "報工生產單位")] |
|||
public string WorkingUnitNo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 報工線別ID
|
|||
/// </summary>
|
|||
[Column("WORKING_LINE_ID")] |
|||
[DataMember] |
|||
[Required(ErrorMessage = "{0} 不能空白")] |
|||
[Display(Name = "報工線別ID")] |
|||
public int WorkingLineID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 報工站別ID
|
|||
/// </summary>
|
|||
[Column("WORKING_STATION_ID")] |
|||
[DataMember] |
|||
[Display(Name = "報工站別ID")] |
|||
public int WorkingStationID { get; set; } = -1; |
|||
|
|||
/// <summary>
|
|||
/// 途程生產單位
|
|||
/// </summary>
|
|||
[Column("UNIT_NO")] |
|||
[DataMember] |
|||
[Required(ErrorMessage = "{0} 不能空白")] |
|||
[Display(Name = "途程生產單位")] |
|||
public string UnitNo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 工程編號
|
|||
/// </summary>
|
|||
[Column("ITEM_NO")] |
|||
[DataMember] |
|||
[Required(ErrorMessage = "{0} 不能空白")] |
|||
[Display(Name = "工程編號")] |
|||
public string ItemNo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 正背面
|
|||
/// </summary>
|
|||
[Column("SIDE")] |
|||
[DataMember] |
|||
[Required(ErrorMessage = "{0} 不能空白")] |
|||
[Display(Name = "正背面")] |
|||
public string Side { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 標準人力
|
|||
/// </summary>
|
|||
[Column("OP_CNT")] |
|||
[DataMember] |
|||
[Display(Name = "標準人力")] |
|||
public int OpCnt { get; set; } = 0; |
|||
|
|||
/// <summary>
|
|||
/// 標準工時(分)
|
|||
/// </summary>
|
|||
[Column("CT")] |
|||
[DataMember] |
|||
[Display(Name = "標準工時(分)")] |
|||
public int Ct { get; set; } = 0; |
|||
|
|||
/// <summary>
|
|||
/// 對應途程站別ID
|
|||
/// </summary>
|
|||
[Column("STATION_ID")] |
|||
[DataMember] |
|||
[Display(Name = "對應途程站別ID")] |
|||
public string StationID { get; set; } = "N/A"; |
|||
|
|||
/// <summary>
|
|||
/// 作業機台數
|
|||
/// </summary>
|
|||
[Column("MACHINE_CNT")] |
|||
[DataMember] |
|||
[Display(Name = "作業機台數")] |
|||
public int MachineCnt { get; set; } = 0; |
|||
|
|||
/// <summary>
|
|||
/// 備註
|
|||
/// </summary>
|
|||
[Column("REMARK")] |
|||
[DataMember] |
|||
[Display(Name = "備註")] |
|||
public string Remark { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 創建者
|
|||
/// </summary>
|
|||
[Column("CREATE_USERID")] |
|||
[DataMember] |
|||
[Required(ErrorMessage = "{0} 不能空白")] |
|||
[Display(Name = "創建者")] |
|||
public int CreateUserID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 創建日期
|
|||
/// </summary>
|
|||
[Column("CREATE_DATE")] |
|||
[DataMember] |
|||
[Display(Name = "創建日期")] |
|||
public DateTime CreateDate { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 更新者
|
|||
/// </summary>
|
|||
[Column("UPDATE_USERID")] |
|||
[DataMember] |
|||
[Required(ErrorMessage = "{0} 不能空白")] |
|||
[Display(Name = "更新者")] |
|||
public int UpdateUserID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 更新日期
|
|||
/// </summary>
|
|||
[Column("UPDATE_DATE")] |
|||
[DataMember] |
|||
[Display(Name = "更新日期")] |
|||
public DateTime UpdateDate { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,152 @@ |
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
using System.Runtime.Serialization; |
|||
|
|||
namespace AMESCoreStudio.WebApi.Models.AMES |
|||
{ |
|||
/// <summary>
|
|||
/// 報工標準工時資料檔
|
|||
/// </summary>
|
|||
[Table("WORKING_STANDARD_WORKTIME_LOG", Schema = "JHAMES")] |
|||
public class WorkingStandardWorkTimeLog |
|||
{ |
|||
/// <summary>
|
|||
/// 報工標準工時 LOG ID
|
|||
/// </summary>
|
|||
[Key] |
|||
[Column("WORKING_STANDARD_LOG_ID")] |
|||
[DataMember] |
|||
[Display(Name = "報工標準工時 LOG ID")] |
|||
public int WorkingStandardLogID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 報工標準工時ID
|
|||
/// </summary>
|
|||
[Column("WORKING_STANDARD_ID")] |
|||
[DataMember] |
|||
[Display(Name = "報工標準工時ID")] |
|||
public int WorkingStandardID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 報工生產單位
|
|||
/// </summary>
|
|||
[Column("WORKING_UNIT_NO")] |
|||
[DataMember] |
|||
[Required(ErrorMessage = "{0} 不能空白")] |
|||
[Display(Name = "報工生產單位")] |
|||
public string WorkingUnitNo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 報工線別ID
|
|||
/// </summary>
|
|||
[Column("WORKING_LINE_ID")] |
|||
[DataMember] |
|||
[Required(ErrorMessage = "{0} 不能空白")] |
|||
[Display(Name = "報工線別ID")] |
|||
public int WorkingLineID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 報工站別ID
|
|||
/// </summary>
|
|||
[Column("WORKING_STATION_ID")] |
|||
[DataMember] |
|||
[Display(Name = "報工站別ID")] |
|||
public int WorkingStationID { get; set; } = -1; |
|||
|
|||
/// <summary>
|
|||
/// 途程生產單位
|
|||
/// </summary>
|
|||
[Column("UNIT_NO")] |
|||
[DataMember] |
|||
[Required(ErrorMessage = "{0} 不能空白")] |
|||
[Display(Name = "途程生產單位")] |
|||
public string UnitNo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 工程編號
|
|||
/// </summary>
|
|||
[Column("ITEM_NO")] |
|||
[DataMember] |
|||
[Required(ErrorMessage = "{0} 不能空白")] |
|||
[Display(Name = "工程編號")] |
|||
public string ItemNo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 正背面
|
|||
/// </summary>
|
|||
[Column("SIDE")] |
|||
[DataMember] |
|||
[Required(ErrorMessage = "{0} 不能空白")] |
|||
[Display(Name = "正背面")] |
|||
public string Side { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 標準人力
|
|||
/// </summary>
|
|||
[Column("OP_CNT")] |
|||
[DataMember] |
|||
[Display(Name = "標準人力")] |
|||
public int OpCnt { get; set; } = 0; |
|||
|
|||
/// <summary>
|
|||
/// 標準工時(分)
|
|||
/// </summary>
|
|||
[Column("CT")] |
|||
[DataMember] |
|||
[Display(Name = "標準工時(分)")] |
|||
public int Ct { get; set; } = 0; |
|||
|
|||
/// <summary>
|
|||
/// 對應途程站別ID
|
|||
/// </summary>
|
|||
[Column("STATION_ID")] |
|||
[DataMember] |
|||
[Display(Name = "對應途程站別ID")] |
|||
public string StationID { get; set; } = "N/A"; |
|||
|
|||
/// <summary>
|
|||
/// 作業機台數
|
|||
/// </summary>
|
|||
[Column("MACHINE_CNT")] |
|||
[DataMember] |
|||
[Display(Name = "作業機台數")] |
|||
public int MachineCnt { get; set; } = 0; |
|||
|
|||
/// <summary>
|
|||
/// 備註
|
|||
/// </summary>
|
|||
[Column("REMARK")] |
|||
[DataMember] |
|||
[Display(Name = "備註")] |
|||
public string Remark { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 創建者
|
|||
/// </summary>
|
|||
[Column("CREATE_USERID")] |
|||
[DataMember] |
|||
[Required(ErrorMessage = "{0} 不能空白")] |
|||
[Display(Name = "創建者")] |
|||
public int CreateUserID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 創建日期
|
|||
/// </summary>
|
|||
[Column("CREATE_DATE")] |
|||
[DataMember] |
|||
[Display(Name = "創建日期")] |
|||
public DateTime CreateDate { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// A:新增 U:刪除 D:修改
|
|||
/// </summary>
|
|||
[Column("ACTION")] |
|||
[DataMember] |
|||
[Display(Name = "動作")] |
|||
public string Action { get; set; } |
|||
|
|||
|
|||
} |
|||
} |
@ -0,0 +1,92 @@ |
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
using System.Runtime.Serialization; |
|||
namespace AMESCoreStudio.WebApi.Models.AMES |
|||
{ |
|||
/// <summary>
|
|||
/// 報工工作站基本資料
|
|||
/// </summary>
|
|||
[Table("WORKING_STATIONS", Schema = "JHAMES")] |
|||
public class WorkingStation |
|||
{ |
|||
/// <summary>
|
|||
/// 報工工作站ID
|
|||
/// </summary>
|
|||
[Key] |
|||
[Column("WORKING_STATION_ID")] |
|||
[DataMember] |
|||
[Display(Name = "報工工作站ID")] |
|||
public int WorkingStationID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 報工工作站名稱
|
|||
/// </summary>
|
|||
[Column("WORKING_STATION_NAME")] |
|||
[DataMember] |
|||
[Required(ErrorMessage = "{0} 不能空白")] |
|||
[Display(Name = "報工工作站名稱")] |
|||
public string WorkingStationName { get; set; } |
|||
/// <summary>
|
|||
/// 報工工作站敘述
|
|||
/// </summary>
|
|||
[Column("WORKING_STATION_DESC")] |
|||
[DataMember] |
|||
[Required(ErrorMessage = "{0} 不能空白")] |
|||
[Display(Name = "報工工作站敘述")] |
|||
public string WorkingStationDesc { get; set; } |
|||
/// <summary>
|
|||
/// 報工生產單位代碼
|
|||
/// </summary>
|
|||
[Column("WORKING_UNIT_NO")] |
|||
[DataMember] |
|||
[Required(ErrorMessage = "{0} 不能空白")] |
|||
[Display(Name = "報工生產單位代碼")] |
|||
public string WorkingUnitNo { get; set; } |
|||
/// <summary>
|
|||
/// SAP工時類別
|
|||
/// </summary>
|
|||
[Column("TYPE_NO")] |
|||
[DataMember] |
|||
[Display(Name = "SAP工時類別")] |
|||
public string TypeNo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 狀態
|
|||
/// </summary>
|
|||
[Column("STATUS_NO")] |
|||
[DataMember] |
|||
[Display(Name = "狀態")] |
|||
public string StatusNo { get; set; } = "A"; |
|||
/// <summary>
|
|||
/// 建立者
|
|||
/// </summary>
|
|||
[Column("CREATE_USERID")] |
|||
[DataMember] |
|||
[Required(ErrorMessage = "{0} 不能空白")] |
|||
[Display(Name = "建立者")] |
|||
public int CreateUserID { get; set; } |
|||
/// <summary>
|
|||
/// 建立日期
|
|||
/// </summary>
|
|||
[Column("CREATE_DATE")] |
|||
[DataMember] |
|||
[Display(Name = "建立日期")] |
|||
public DateTime CreateDate { get; set; } |
|||
/// <summary>
|
|||
/// 修改日期
|
|||
/// </summary>
|
|||
[Column("UPDATE_DATE")] |
|||
[DataMember] |
|||
[Display(Name = "修改日期")] |
|||
public DateTime UpdateDate { get; set; } |
|||
|
|||
///// <summary>
|
|||
///// 生產制程單位
|
|||
///// </summary>
|
|||
//[ForeignKey("WorkingUnitNo")]
|
|||
//[DataMember]
|
|||
//public virtual WorkingUnit GetWorkingUnit { get; set; }
|
|||
|
|||
} |
|||
} |
@ -0,0 +1,75 @@ |
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
using System.Runtime.Serialization; |
|||
namespace AMESCoreStudio.WebApi.Models.AMES |
|||
{/// <summary>
|
|||
/// 報工生產單位別
|
|||
/// </summary>
|
|||
[Table("WORKING_UNIT", Schema = "JHAMES")] |
|||
public class WorkingUnit |
|||
{ |
|||
/// <summary>
|
|||
/// 報工生產單位ID
|
|||
/// </summary>
|
|||
[Key] |
|||
[Column("WORKING_UNIT_ID")] |
|||
[DataMember] |
|||
[Display(Name = "報工生產單位ID")] |
|||
public int WorkingUnitID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 報工生產單位代碼
|
|||
/// </summary>
|
|||
[Column("WORKING_UNIT_NO")] |
|||
[DataMember] |
|||
[Display(Name = "報工生產單位代碼")] |
|||
public string WorkingUnitNo { get; set; } |
|||
/// <summary>
|
|||
/// 途程生產單位代碼
|
|||
/// </summary>
|
|||
[Column("UNIT_NO")] |
|||
[DataMember] |
|||
[Required(ErrorMessage = "{0} 不能空白")] |
|||
[Display(Name = "途程生產單位代碼")] |
|||
public string UnitNo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 報工生產單位名稱
|
|||
/// </summary>
|
|||
[Column("WORKING_UNIT_NAME")] |
|||
[DataMember] |
|||
[Required(ErrorMessage = "{0} 不能空白")] |
|||
[Display(Name = "報工生產單位名稱")] |
|||
public string WorkingUnitName { get; set; } |
|||
/// <summary>
|
|||
/// 狀態
|
|||
/// </summary>
|
|||
[Column("STATUS_NO")] |
|||
[DataMember] |
|||
[Display(Name = "狀態")] |
|||
public string StatusNo { get; set; } = "A"; |
|||
/// <summary>
|
|||
/// 建立者
|
|||
/// </summary>
|
|||
[Column("CREATE_USERID")] |
|||
[DataMember] |
|||
[Required(ErrorMessage = "{0} 不能空白")] |
|||
[Display(Name = "建立者")] |
|||
public int CreateUserID { get; set; } |
|||
/// <summary>
|
|||
/// 建立日期
|
|||
/// </summary>
|
|||
[Column("CREATE_DATE")] |
|||
[DataMember] |
|||
[Display(Name = "建立日期")] |
|||
public DateTime CreateDate { get; set; } |
|||
/// <summary>
|
|||
/// 修改日期
|
|||
/// </summary>
|
|||
[Column("UPDATE_DATE")] |
|||
[DataMember] |
|||
[Display(Name = "修改日期")] |
|||
public DateTime UpdateDate { get; set; } |
|||
} |
|||
} |
Loading…
Reference in new issue