28 changed files with 3221 additions and 11 deletions
@ -0,0 +1,347 @@ |
|||
@{ |
|||
ViewData["Title"] = "生產工時資料維護"; |
|||
Layout = "~/Views/Shared/_AMESLayout.cshtml"; |
|||
} |
|||
|
|||
<style type="text/css"> |
|||
.layui-table-main .layui-table-cell { |
|||
/*height: auto !important;*/ |
|||
white-space: normal; |
|||
} |
|||
|
|||
.layui-table img { |
|||
max-width: 60px; |
|||
max-height: 28px; |
|||
} |
|||
|
|||
.layui-tree-main { |
|||
cursor: pointer; |
|||
padding-right: 10px; |
|||
float: left; |
|||
border-width: 1px; |
|||
border-style: solid; |
|||
border-color: #e6e6e6; |
|||
margin: 10px 0; |
|||
} |
|||
</style> |
|||
|
|||
|
|||
<div class="layui-card"> |
|||
<div class="layui-card-header"> |
|||
<div class="layui-form"> |
|||
<div class="layui-form-item"> |
|||
<div class="layui-inline"><i class="fa fa-file-text-o fa-fw"></i> @ViewBag.Title</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="layui-card-body"> |
|||
<div class="layui-form"> |
|||
<div class="layui-row"> |
|||
<div class="layui-form-item"> |
|||
<div class="layui-col-sm4"> |
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">製程:</label> |
|||
<div class="layui-input-inline" style="width:100px"> |
|||
<select style="width:90px;" lay-filter="unitNo" lay-submit id="unitNo" name="unitNo" asp-items="@ViewBag.FactoryUnit"> |
|||
<option value="">全部</option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="layui-col-sm4"> |
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">線別:</label> |
|||
<div class="layui-input-inline" style="width:150px"> |
|||
<select name="lineID" id="lineID" lay-filter="lineID" lay-submit asp-items="@ViewBag.LineList"> |
|||
<option value="">全部</option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="layui-col-sm4"> |
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">站別:</label> |
|||
<div class="layui-input-inline" style="width:150px"> |
|||
<select name="stationID" id="stationID" lay-filter="stationID" lay-submit asp-items="@ViewBag.StationList"> |
|||
<option value="">全部</option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="layui-row"> |
|||
<div class="layui-form-item"> |
|||
<div class="layui-col-sm4"> |
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">工單號碼:</label> |
|||
<div class="layui-input-inline" style="width:150px"> |
|||
<input id="wipNo" name="wipNo" class="layui-input" readonly=""> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="layui-col-sm4"> |
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">料號:</label> |
|||
<div class="layui-input-inline" style="width:150px"> |
|||
<input id="itemNo" name="itemNo" class="layui-input" > |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="layui-col-sm4"> |
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">開工人員:</label> |
|||
<div class="layui-input-inline" style="width:150px"> |
|||
<input id="user" name="user" class="layui-input" > |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="layui-row"> |
|||
<div class="layui-form-item"> |
|||
<div class="layui-col-sm11"> |
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">開工日期:</label> |
|||
<div class="layui-input-inline" style="width:150px"> |
|||
<input id="sdate" name="sdate" autocomplete="off" class="layui-input" readonly=""> |
|||
</div> |
|||
<div class="layui-form-mid">~</div> |
|||
<div class="layui-input-inline" style="width:150px"> |
|||
<input id="edate" name="edate" autocomplete="off" class="layui-input" readonly=""> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="layui-col-sm1"> |
|||
<div class="layui-inline layui-show-xs-block"> |
|||
<button class="layui-btn layui-btn-sm layui-btn-normal " id="querysubmit" lay-filter="querysubmit"> |
|||
<i class="layui-icon layui-icon-sm"></i> |
|||
</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<table class="layui-hide" id="query" lay-filter="query"></table> |
|||
</div> |
|||
</div> |
|||
|
|||
@section Scripts{ |
|||
<script type="text/javascript"> |
|||
layui.use(['form', 'layer', 'laydate'], function () { |
|||
form = layui.form; |
|||
laydate = layui.laydate; |
|||
laydate.render({ |
|||
elem: '#sdate' |
|||
, trigger: 'click' |
|||
, format: 'yyyy-MM-dd' |
|||
, theme: 'grid' |
|||
}); |
|||
laydate.render({ |
|||
elem: '#edate' |
|||
, trigger: 'click' |
|||
, format: 'yyyy-MM-dd' |
|||
, theme: 'grid' |
|||
}); |
|||
}); |
|||
|
|||
////搜索 |
|||
$('#querysubmit').click(function () { |
|||
console.log('#btnSearch'); |
|||
//var factoryNo = $("#factoryNo").val(); |
|||
//if (factoryNo) { |
|||
hg.msghide("刷新数据!"); |
|||
tt(); |
|||
//} |
|||
//else { |
|||
// alert("請選擇廠別!!!!"); |
|||
//} |
|||
return false; |
|||
|
|||
}); |
|||
|
|||
|
|||
var tableCols = [[ |
|||
{ |
|||
field: 'timeSheetID', |
|||
title: '#', |
|||
sort: true |
|||
}, |
|||
{ |
|||
field: 'unitName', |
|||
title: '單位代號' |
|||
//, |
|||
//templet: function (d) { |
|||
// var unit; |
|||
// if (d.unit) |
|||
// line = d.unit["unitName"]; |
|||
// else |
|||
// line = "N/A"; |
|||
// |
|||
// return line; |
|||
//} |
|||
}, |
|||
{ |
|||
field: 'lineName', |
|||
title: '線別' |
|||
//, |
|||
//templet: function (d) { |
|||
// var line; |
|||
// if (d.line) |
|||
// line = d.line["lineDesc"]; |
|||
// else |
|||
// line = "N/A"; |
|||
// |
|||
// return line; |
|||
//} |
|||
}, |
|||
{ |
|||
field: 'stationName', |
|||
title: '站別', |
|||
}, |
|||
{ |
|||
field: 'wipNo', |
|||
title: '歸屬工單', |
|||
sort: true |
|||
}, |
|||
{ |
|||
field: 'itemNo', |
|||
title: '料號', |
|||
sort: true |
|||
}, |
|||
{ |
|||
field: 'openTime', |
|||
title: '異常日期', |
|||
templet: '<div>{{ layui.util.toDateString(d.openTime, "yyyy/MM/dd HH:mm:ss") }}</div>' |
|||
}, |
|||
{ |
|||
field: 'createUser', |
|||
title: '開工人員', |
|||
|
|||
}, |
|||
{ |
|||
field: 'closeTime', |
|||
title: '完工時間', |
|||
templet: '<div>{{ layui.util.toDateString(d.closeTime, "yyyy/MM/dd HH:mm:ss") }}</div>' |
|||
}, |
|||
{ |
|||
field: 'updateUser', |
|||
title: '完工人員', |
|||
|
|||
}, |
|||
{ |
|||
field: 'productionQty', |
|||
title: '生產數量' |
|||
}, |
|||
{ |
|||
field: 'totalCT', |
|||
title: 'CT(分)', |
|||
}, |
|||
{ |
|||
field: 'ruleTime', |
|||
title: '標準工時' |
|||
}, |
|||
{ |
|||
field: 'ruleCNT', |
|||
title: '標工人數(分)', |
|||
}, |
|||
{ |
|||
field: 'effective', |
|||
title: '效率', |
|||
templet: function (d) { |
|||
var effective; |
|||
effective = d.effective*100+'%'; |
|||
|
|||
return effective; |
|||
} |
|||
}, |
|||
{ |
|||
field: 'memo', |
|||
title: '備註' |
|||
}, |
|||
{ |
|||
field: 'closeTime', |
|||
width: 200, |
|||
title: '操作', |
|||
align: 'center', |
|||
fixed: 'right', |
|||
templet: function (d) { |
|||
if (d.closeTime) { |
|||
return '' |
|||
} |
|||
else { |
|||
return '<a class="layui-btn layui-btn-normal layui-btn-xs layui-icon layui-icon-edit" lay-event="edit">修改</a> <a class="layui-btn layui-btn-primary layui-btn-xs layui-icon layui-icon-ok-circle" lay-event="finish">完工</a>' |
|||
} |
|||
} |
|||
}] |
|||
]; |
|||
//通过行tool编辑,lay-event="edit" |
|||
function edit(obj) { |
|||
if (obj.data.timeSheetID) { |
|||
hg.open('修改生產工時', '/WHS/WHS018U/' + obj.data.timeSheetID, 480,480); |
|||
} |
|||
} |
|||
//通过行tool编辑,lay-event="finish" |
|||
function finish(obj) { |
|||
if (obj.data.timeSheetID) { |
|||
hg.open('完工', '/WHS/WHS018F/' + obj.data.timeSheetID, 480, 480); |
|||
} |
|||
} |
|||
//通过行tool删除,lay-event="del" |
|||
function del(obj) { |
|||
if (obj.data.timeSheetID) { |
|||
hg.confirm("異常工時:" + obj.data.timeSheetID + ",確定要删除嗎?", function () { |
|||
$.ajax({ |
|||
url: '/WHS/WHS018D', |
|||
data: { id: obj.data.timeSheetID }, |
|||
type: 'POST', |
|||
success: function (data) { |
|||
if (data.success) { |
|||
obj.del(); //只删本地数据 |
|||
hg.msghide("删除成功!"); |
|||
} |
|||
else { |
|||
hg.msg(data.msg); |
|||
} |
|||
}, |
|||
error: function () { |
|||
hg.msg("網路請求失敗!"); |
|||
} |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
var toolbar = [{ |
|||
text: '新增', |
|||
layuiicon: '', |
|||
class: 'layui-btn-normal', |
|||
handler: function () { |
|||
hg.open('開工', '/WHS/WHS018C', 480, 480); |
|||
|
|||
} |
|||
} |
|||
]; |
|||
//基本数据表格 |
|||
|
|||
var table; |
|||
$(function () { |
|||
tt(); |
|||
}); |
|||
function tt() { |
|||
//基本数据表格 |
|||
var unitNo = "", lineid = "", stationid = "", wipno = "", itemno = "", user = "", sdate = "", edate = ""; |
|||
|
|||
unitNo = $("#unitNo").val(); |
|||
lineid = $("#lineID").val(); |
|||
stationid = $("#stationID").val(); |
|||
user = $("#user").val(); |
|||
itemno = $("#itemNo").val(); |
|||
wipno = $("#wipNo").val(); |
|||
|
|||
|
|||
table = hg.table.datatable('query', '生產工時資料維護', '/WHS/GetWorkingHoursCollectionDtoByQuery?' |
|||
+ 'unitNo=' + unitNo + '&lineid=' + lineid + '&stationid=' + stationid + '&wipno=' + wipno + '&itemno=' + itemno + '&user=' + user + '&sdate=' + $("#sdate").val() + '&edate=' + $("#edate").val() |
|||
, {}, tableCols, toolbar, true, 'full-100', ['filter', 'print', 'exports']); |
|||
}; |
|||
</script> |
|||
} |
@ -0,0 +1,319 @@ |
|||
@model AMESCoreStudio.WebApi.Models.AMES.WorkingHoursCollection |
|||
|
|||
|
|||
@{ ViewData["Title"] = "WHS018C"; |
|||
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="WHS018CSave"> |
|||
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
|||
<input type="hidden" asp-for="TimeSheetID" value="0" /> |
|||
<input type="hidden" asp-for="CreateUserID" value="@ViewBag.UserID" /> |
|||
<input type="hidden" asp-for="UpdateUserID" value="-1" /> |
|||
<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="UnitNo" class="control-label col-sm-2"></label> |
|||
<select id="UnitNo" asp-for="UnitNo" asp-items="@ViewBag.FactoryUnit" class="custom-select col-sm-5"> |
|||
<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="LineID" class="control-label col-sm-3"></label> |
|||
<select id="LineID" asp-for="LineID" asp-items="@ViewBag.LineList" class="custom-select col-sm-9"> |
|||
<option value="">請選擇</option> |
|||
</select> |
|||
<span asp-validation-for="LineID" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="StationID" class="control-label col-sm-3"></label> |
|||
<select id="StationID" asp-for="StationID" asp-items="@ViewBag.StationList" class="custom-select col-sm-9"> |
|||
<option value="">請選擇</option> |
|||
<option value="-1">N/A</option> |
|||
</select> |
|||
<span asp-validation-for="StationID" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="Side" class="control-label col-sm-3"></label> |
|||
<select class="custom-select col-sm-9" disabled> |
|||
<option value="A面">A面</option> |
|||
</select> |
|||
<input asp-for="Side" value="A面" class="form-control col-sm-9" hidden /> |
|||
<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="WipNo" class="control-label col-sm-3"></label> |
|||
<input asp-for="WipNo" class="form-control col-sm-6" /> |
|||
<span asp-validation-for="WipNo" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
@*<input id="searchItemNo" type="button" class="form-control col-sm-3 btn-link" value="檢查機種" />*@ |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="ItemNo" class="control-label col-sm-3"></label> |
|||
<input id="searchItemNo" asp-for="ItemNo" class="form-control col-sm-9" /> |
|||
<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="OPCNT" class="control-label col-sm-3"></label> |
|||
<input asp-for="OPCNT" value="1" class="form-control col-sm-9" /> |
|||
<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="OpenTime" class="control-label col-sm-3"></label> |
|||
<input asp-for="OpenTime" type="datetime" value="@System.DateTime.Now" class="form-control col-sm-9" readonly /> |
|||
<span asp-validation-for="OpenTime" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="InputSensorID" class="control-label col-sm-3"></label> |
|||
<select id="InputSensorID" asp-for="InputSensorID" asp-items="@ViewBag.StationList" class="custom-select col-sm-9"> |
|||
<option value="">請選擇</option> |
|||
</select> |
|||
<span asp-validation-for="InputSensorID" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="OutputSensorID" class="control-label col-sm-3"></label> |
|||
<select id="OutputSensorID" asp-for="OutputSensorID" asp-items="@ViewBag.StationList" class="custom-select col-sm-9"> |
|||
<option value="">請選擇</option> |
|||
</select> |
|||
<span asp-validation-for="StationID" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="Memo" class="control-label col-sm-3"></label> |
|||
<input asp-for="Memo" class="form-control col-sm-9" /> |
|||
<span asp-validation-for="Memo" 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); |
|||
} |
|||
}); |
|||
$('#searchItemNo').click(function () { |
|||
var data = $("#WipNo").val(); |
|||
if (data) { |
|||
$.ajax({ |
|||
url: "/WHS/GetWipAtt", |
|||
dataType: 'json', |
|||
data: { id: data }, |
|||
contentType: "application/json", |
|||
type: 'get', |
|||
success: function (result) { |
|||
if (result.data) { |
|||
//console.info(result.data);//確認itemNO/modelNO |
|||
$("#searchItemNo").val(result.data.modelNO); |
|||
} |
|||
else { |
|||
alert("查無資料,請確認工單是否正確!"); |
|||
} |
|||
} |
|||
}); |
|||
} else { |
|||
alert("請填寫工單!"); |
|||
} |
|||
|
|||
}); |
|||
$('#countTime').click(function () { |
|||
var data = ""; |
|||
var data1 = $("#StartTime").val(); |
|||
var data2 = $("#EndTime").val(); |
|||
console.log(data1 +"countTime" + data2); |
|||
if (data1 && data2) { |
|||
data = data1 + "%" + data2; |
|||
$.ajax({ |
|||
url: "/WHS/GetCountTimes", |
|||
dataType: 'json', |
|||
data: { id: data}, |
|||
contentType: "application/json", |
|||
type: 'get', |
|||
success: function (result) { |
|||
if (result.data) { |
|||
$("#Time").val(result.data); |
|||
} |
|||
else { |
|||
alert(result.msg); |
|||
//alert("請確認時間區間填寫是否正確!"); |
|||
} |
|||
} |
|||
}); |
|||
} else { |
|||
alert("請填寫時間區間!"); |
|||
} |
|||
|
|||
}); |
|||
$("#UnitNo").change(function () { |
|||
var data = $("#UnitNo").val(); |
|||
getLines(data); |
|||
getStations(data); |
|||
getStations2(data); |
|||
}); |
|||
|
|||
function getUserInfoes(data) { |
|||
$.ajax({ |
|||
url: "/SYS/GetUserInfoes", |
|||
dataType: 'json', |
|||
contentType: "application/json", |
|||
type: 'get', |
|||
success: function (result) { |
|||
if (result.data) { |
|||
$("#DecideUser").empty(); |
|||
$('#DecideUser').append(new Option("請選擇", "")); |
|||
var count = 0; |
|||
$.each(result.data, function (index, item) { |
|||
if (item.deptID == data) { |
|||
$('#DecideUser').append(new Option(item.userName, item.userID)); |
|||
count = count + 1; |
|||
} |
|||
}); |
|||
if (count == 0) { |
|||
$("#DecideUser").empty(); |
|||
$('#DecideUser').append(new Option("無選項", "")); |
|||
} |
|||
} |
|||
else { |
|||
$("#DecideUser").empty(); |
|||
$('#DecideUser').append(new Option("無選項", "")); |
|||
} |
|||
layui.form.render("select"); |
|||
} |
|||
}); |
|||
}; |
|||
function getLines(data) { |
|||
$.ajax({ |
|||
url: "/BAS/GetLineInfoes", |
|||
dataType: 'json', |
|||
contentType: "application/json", |
|||
type: 'get', |
|||
success: function (result) { |
|||
if (result.data) { |
|||
$("#LineID").empty(); |
|||
$('#LineID').append(new Option("請選擇", "")); |
|||
var count = 0; |
|||
$.each(result.data, function (index, item) { |
|||
if (item.unitNo == data) { |
|||
$('#LineID').append(new Option(item.lineDesc, item.lineID)); |
|||
count = count + 1; |
|||
} |
|||
}); |
|||
if (count == 0) { |
|||
$("#LineID").empty(); |
|||
$('#LineID').append(new Option("無選項", "")); |
|||
} |
|||
} |
|||
else { |
|||
$("#LineID").empty(); |
|||
$('#LineID').append(new Option("無選項", "")); |
|||
} |
|||
layui.form.render("select"); |
|||
} |
|||
}); |
|||
}; |
|||
function getStations(data) { |
|||
$.ajax({ |
|||
url: "/BAS/GetStationses", |
|||
dataType: 'json', |
|||
contentType: "application/json", |
|||
type: 'get', |
|||
success: function (result) { |
|||
if (result.data) { |
|||
$("#StationID").empty(); |
|||
$('#StationID').append(new Option("請選擇", "")); |
|||
$('#StationID').append(new Option("N/A", "-1")); |
|||
var count = 0; |
|||
$.each(result.data, function (index, item) { |
|||
if (item.unitNo == data) { |
|||
$('#StationID').append(new Option(item.stationName, item.stationID)); |
|||
count = count + 1; |
|||
} |
|||
}); |
|||
if (count == 0) { |
|||
$("#StationID").empty(); |
|||
$('#StationID').append(new Option("無選項", "")); |
|||
} |
|||
} |
|||
else { |
|||
$("#StationID").empty(); |
|||
$('#StationID').append(new Option("無選項", "")); |
|||
} |
|||
layui.form.render("select"); |
|||
} |
|||
}); |
|||
}; |
|||
function getStations2(data) { |
|||
$.ajax({ |
|||
url: "/BAS/GetStationses", |
|||
dataType: 'json', |
|||
contentType: "application/json", |
|||
type: 'get', |
|||
success: function (result) { |
|||
if (result.data) { |
|||
$("#InputSensorID").empty(); |
|||
$('#InputSensorID').append(new Option("請選擇", "")); |
|||
$("#OutputSensorID").empty(); |
|||
$('#OutputSensorID').append(new Option("請選擇", "")); |
|||
var count = 0; |
|||
$.each(result.data, function (index, item) { |
|||
if (item.unitNo == data) { |
|||
$('#InputSensorID').append(new Option(item.stationName, item.stationID)); |
|||
$('#OutputSensorID').append(new Option(item.stationName, item.stationID)); |
|||
count = count + 1; |
|||
} |
|||
}); |
|||
if (count == 0) { |
|||
$("#InputSensorID").empty(); |
|||
$('#InputSensorID').append(new Option("無選項", "")); |
|||
$("#OutputSensorID").empty(); |
|||
$('#OutputSensorID').append(new Option("請選擇", "")); |
|||
} |
|||
} |
|||
else { |
|||
$("#InputSensorID").empty(); |
|||
$('#InputSensorID').append(new Option("無選項", "")); |
|||
$("#OutputSensorID").empty(); |
|||
$('#OutputSensorID').append(new Option("請選擇", "")); |
|||
} |
|||
layui.form.render("select"); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
layui.use(['laydate'], function () { |
|||
//form = layui.form; |
|||
laydate = layui.laydate; |
|||
laydate.render({ |
|||
elem: '#StartTime' |
|||
, trigger: 'click' |
|||
, type: 'datetime' |
|||
, format: 'yyyy-MM-dd HH:mm' |
|||
, theme: 'grid' |
|||
}); |
|||
laydate.render({ |
|||
elem: '#EndTime' |
|||
, trigger: 'click' |
|||
, type: 'datetime' |
|||
, format: 'yyyy-MM-dd HH:mm' |
|||
, theme: 'grid' |
|||
}); |
|||
}); |
|||
</script> |
|||
|
|||
|
|||
} |
|||
|
@ -0,0 +1,355 @@ |
|||
@model AMESCoreStudio.WebApi.Models.AMES.WorkingHoursCollection |
|||
|
|||
|
|||
@{ ViewData["Title"] = "WHS018C"; |
|||
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="WHS018FSave"> |
|||
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
|||
<input type="hidden" asp-for="TimeSheetID" /> |
|||
<input type="hidden" asp-for="CreateUserID" /> |
|||
<input type="hidden" asp-for="UpdateUserID" value="@ViewBag.UserID" /> |
|||
<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="UnitNo" class="control-label col-sm-2"></label> |
|||
<select id="UnitNo" asp-items="@ViewBag.FactoryUnit" class="custom-select col-sm-5" disabled> |
|||
<option value="">請選擇</option> |
|||
</select> |
|||
<input id="UnitNoH" asp-for="UnitNo" class="form-control col-sm-9" hidden /> |
|||
<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="LineID" class="control-label col-sm-3"></label> |
|||
<select id="LineID" asp-items="@ViewBag.LineList" class="custom-select col-sm-9" disabled> |
|||
<option value="">請選擇</option> |
|||
</select> |
|||
<input id="LineIDH" asp-for="LineID" class="form-control col-sm-9" hidden /> |
|||
<span asp-validation-for="LineID" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="StationID" class="control-label col-sm-3"></label> |
|||
<select id="StationID" asp-items="@ViewBag.StationList" class="custom-select col-sm-9" disabled> |
|||
<option value="">請選擇</option> |
|||
<option value="-1">N/A</option> |
|||
</select> |
|||
<input id="StationIDH" asp-for="StationID" class="form-control col-sm-9" hidden /> |
|||
<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="Side" class="control-label col-sm-3"></label> |
|||
<select class="custom-select col-sm-9" disabled> |
|||
<option value="A面">A面</option> |
|||
</select> |
|||
<input asp-for="Side" class="form-control col-sm-9" hidden /> |
|||
<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="WipNo" class="control-label col-sm-3"></label> |
|||
<input asp-for="WipNo" class="form-control col-sm-6" /> |
|||
<span asp-validation-for="WipNo" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
@*<input id="searchItemNo" type="button" class="form-control col-sm-3 btn-link" value="檢查機種" />*@ |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="ItemNo" class="control-label col-sm-3"></label> |
|||
<input id="searchItemNo" asp-for="ItemNo" class="form-control col-sm-9" /> |
|||
<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="OPCNT" class="control-label col-sm-3"></label> |
|||
<input asp-for="OPCNT" value="1" class="form-control col-sm-9" /> |
|||
<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="OpenTime" class="control-label col-sm-3"></label> |
|||
<input asp-for="OpenTime" type="datetime" class="form-control col-sm-9" readonly /> |
|||
<span asp-validation-for="OpenTime" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="InputSensorID" class="control-label col-sm-3"></label> |
|||
<select id="InputSensorID" asp-for="InputSensorID" asp-items="@ViewBag.StationList" class="custom-select col-sm-9"> |
|||
<option value="">請選擇</option> |
|||
</select> |
|||
<span asp-validation-for="InputSensorID" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="OutputSensorID" class="control-label col-sm-3"></label> |
|||
<select id="OutputSensorID" asp-for="OutputSensorID" asp-items="@ViewBag.StationList" class="custom-select col-sm-9"> |
|||
<option value="">請選擇</option> |
|||
</select> |
|||
<span asp-validation-for="StationID" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="DeductionTime" class="control-label col-sm-3"></label> |
|||
<select id="OutputSensorID" asp-for="DeductionTime" class="custom-select col-sm-9"> |
|||
<option value="0">0</option> |
|||
<option value="10">10</option> |
|||
<option value="30">30</option> |
|||
<option value="60">60</option> |
|||
<option value="10">10</option> |
|||
</select> |
|||
<span asp-validation-for="DeductionTime" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="CloseTime" class="control-label col-sm-3"></label> |
|||
<input asp-for="CloseTime" type="datetime" value="@System.DateTime.Now" class="form-control col-sm-9" readonly /> |
|||
<span asp-validation-for="CloseTime" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="MultipleCount" class="control-label col-sm-3"></label> |
|||
<input asp-for="MultipleCount" class="form-control col-sm-9" /> |
|||
<span asp-validation-for="MultipleCount" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="ProductionQty" class="control-label col-sm-3"></label> |
|||
<input asp-for="ProductionQty" class="form-control col-sm-9" /> |
|||
<span asp-validation-for="ProductionQty" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="Memo" class="control-label col-sm-3"></label> |
|||
<input asp-for="Memo" class="form-control col-sm-9" /> |
|||
<span asp-validation-for="Memo" 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); |
|||
} |
|||
|
|||
$("#UnitNo").val($("#UnitNoH").val()); |
|||
$("#LineID").val($("#LineIDH").val()); |
|||
$("#StationID").val($("#StationIDH").val()); |
|||
|
|||
|
|||
}); |
|||
$('#searchItemNo').click(function () { |
|||
var data = $("#WipNo").val(); |
|||
if (data) { |
|||
$.ajax({ |
|||
url: "/WHS/GetWipAtt", |
|||
dataType: 'json', |
|||
data: { id: data }, |
|||
contentType: "application/json", |
|||
type: 'get', |
|||
success: function (result) { |
|||
if (result.data) { |
|||
//console.info(result.data);//確認itemNO/modelNO |
|||
$("#searchItemNo").val(result.data.modelNO); |
|||
} |
|||
else { |
|||
alert("查無資料,請確認工單是否正確!"); |
|||
} |
|||
} |
|||
}); |
|||
} else { |
|||
alert("請填寫工單!"); |
|||
} |
|||
|
|||
}); |
|||
$('#countTime').click(function () { |
|||
var data = ""; |
|||
var data1 = $("#StartTime").val(); |
|||
var data2 = $("#EndTime").val(); |
|||
console.log(data1 +"countTime" + data2); |
|||
if (data1 && data2) { |
|||
data = data1 + "%" + data2; |
|||
$.ajax({ |
|||
url: "/WHS/GetCountTimes", |
|||
dataType: 'json', |
|||
data: { id: data}, |
|||
contentType: "application/json", |
|||
type: 'get', |
|||
success: function (result) { |
|||
if (result.data) { |
|||
$("#Time").val(result.data); |
|||
} |
|||
else { |
|||
alert(result.msg); |
|||
//alert("請確認時間區間填寫是否正確!"); |
|||
} |
|||
} |
|||
}); |
|||
} else { |
|||
alert("請填寫時間區間!"); |
|||
} |
|||
|
|||
}); |
|||
$("#UnitNo").change(function () { |
|||
var data = $("#UnitNo").val(); |
|||
getLines(data); |
|||
getStations(data); |
|||
getStations2(data); |
|||
}); |
|||
|
|||
function getUserInfoes(data) { |
|||
$.ajax({ |
|||
url: "/SYS/GetUserInfoes", |
|||
dataType: 'json', |
|||
contentType: "application/json", |
|||
type: 'get', |
|||
success: function (result) { |
|||
if (result.data) { |
|||
$("#DecideUser").empty(); |
|||
$('#DecideUser').append(new Option("請選擇", "")); |
|||
var count = 0; |
|||
$.each(result.data, function (index, item) { |
|||
if (item.deptID == data) { |
|||
$('#DecideUser').append(new Option(item.userName, item.userID)); |
|||
count = count + 1; |
|||
} |
|||
}); |
|||
if (count == 0) { |
|||
$("#DecideUser").empty(); |
|||
$('#DecideUser').append(new Option("無選項", "")); |
|||
} |
|||
} |
|||
else { |
|||
$("#DecideUser").empty(); |
|||
$('#DecideUser').append(new Option("無選項", "")); |
|||
} |
|||
layui.form.render("select"); |
|||
} |
|||
}); |
|||
}; |
|||
function getLines(data) { |
|||
$.ajax({ |
|||
url: "/BAS/GetLineInfoes", |
|||
dataType: 'json', |
|||
contentType: "application/json", |
|||
type: 'get', |
|||
success: function (result) { |
|||
if (result.data) { |
|||
$("#LineID").empty(); |
|||
$('#LineID').append(new Option("請選擇", "")); |
|||
var count = 0; |
|||
$.each(result.data, function (index, item) { |
|||
if (item.unitNo == data) { |
|||
$('#LineID').append(new Option(item.lineDesc, item.lineID)); |
|||
count = count + 1; |
|||
} |
|||
}); |
|||
if (count == 0) { |
|||
$("#LineID").empty(); |
|||
$('#LineID').append(new Option("無選項", "")); |
|||
} |
|||
} |
|||
else { |
|||
$("#LineID").empty(); |
|||
$('#LineID').append(new Option("無選項", "")); |
|||
} |
|||
layui.form.render("select"); |
|||
} |
|||
}); |
|||
}; |
|||
function getStations(data) { |
|||
$.ajax({ |
|||
url: "/BAS/GetStationses", |
|||
dataType: 'json', |
|||
contentType: "application/json", |
|||
type: 'get', |
|||
success: function (result) { |
|||
if (result.data) { |
|||
$("#StationID").empty(); |
|||
$('#StationID').append(new Option("請選擇", "")); |
|||
$('#StationID').append(new Option("N/A", "-1")); |
|||
var count = 0; |
|||
$.each(result.data, function (index, item) { |
|||
if (item.unitNo == data) { |
|||
$('#StationID').append(new Option(item.stationName, item.stationID)); |
|||
count = count + 1; |
|||
} |
|||
}); |
|||
if (count == 0) { |
|||
$("#StationID").empty(); |
|||
$('#StationID').append(new Option("無選項", "")); |
|||
} |
|||
} |
|||
else { |
|||
$("#StationID").empty(); |
|||
$('#StationID').append(new Option("無選項", "")); |
|||
} |
|||
layui.form.render("select"); |
|||
} |
|||
}); |
|||
}; |
|||
function getStations2(data) { |
|||
$.ajax({ |
|||
url: "/BAS/GetStationses", |
|||
dataType: 'json', |
|||
contentType: "application/json", |
|||
type: 'get', |
|||
success: function (result) { |
|||
if (result.data) { |
|||
$("#InputSensorID").empty(); |
|||
$('#InputSensorID').append(new Option("請選擇", "")); |
|||
$("#OutputSensorID").empty(); |
|||
$('#OutputSensorID').append(new Option("請選擇", "")); |
|||
var count = 0; |
|||
$.each(result.data, function (index, item) { |
|||
if (item.unitNo == data) { |
|||
$('#InputSensorID').append(new Option(item.stationName, item.stationID)); |
|||
$('#OutputSensorID').append(new Option(item.stationName, item.stationID)); |
|||
count = count + 1; |
|||
} |
|||
}); |
|||
if (count == 0) { |
|||
$("#InputSensorID").empty(); |
|||
$('#InputSensorID').append(new Option("無選項", "")); |
|||
$("#OutputSensorID").empty(); |
|||
$('#OutputSensorID').append(new Option("請選擇", "")); |
|||
} |
|||
} |
|||
else { |
|||
$("#InputSensorID").empty(); |
|||
$('#InputSensorID').append(new Option("無選項", "")); |
|||
$("#OutputSensorID").empty(); |
|||
$('#OutputSensorID').append(new Option("請選擇", "")); |
|||
} |
|||
layui.form.render("select"); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
layui.use(['laydate'], function () { |
|||
//form = layui.form; |
|||
laydate = layui.laydate; |
|||
laydate.render({ |
|||
elem: '#StartTime' |
|||
, trigger: 'click' |
|||
, type: 'datetime' |
|||
, format: 'yyyy-MM-dd HH:mm' |
|||
, theme: 'grid' |
|||
}); |
|||
laydate.render({ |
|||
elem: '#EndTime' |
|||
, trigger: 'click' |
|||
, type: 'datetime' |
|||
, format: 'yyyy-MM-dd HH:mm' |
|||
, theme: 'grid' |
|||
}); |
|||
}); |
|||
</script> |
|||
|
|||
|
|||
} |
|||
|
@ -0,0 +1,319 @@ |
|||
@model AMESCoreStudio.WebApi.Models.AMES.WorkingHoursCollection |
|||
|
|||
|
|||
@{ ViewData["Title"] = "WHS018U"; |
|||
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="WHS018USave"> |
|||
<div asp-validation-summary="ModelOnly" class="text-danger"></div> |
|||
<input type="hidden" asp-for="TimeSheetID" /> |
|||
<input type="hidden" asp-for="CreateUserID" /> |
|||
<input type="hidden" asp-for="UpdateUserID" value="-1" /> |
|||
<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="UnitNo" class="control-label col-sm-2"></label> |
|||
<select id="UnitNo" asp-for="UnitNo" asp-items="@ViewBag.FactoryUnit" class="custom-select col-sm-5"> |
|||
<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="LineID" class="control-label col-sm-3"></label> |
|||
<select id="LineID" asp-for="LineID" asp-items="@ViewBag.LineList" class="custom-select col-sm-9"> |
|||
<option value="">請選擇</option> |
|||
</select> |
|||
<span asp-validation-for="LineID" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="StationID" class="control-label col-sm-3"></label> |
|||
<select id="StationID" asp-for="StationID" asp-items="@ViewBag.StationList" class="custom-select col-sm-9"> |
|||
<option value="">請選擇</option> |
|||
<option value="-1">N/A</option> |
|||
</select> |
|||
<span asp-validation-for="StationID" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="Side" class="control-label col-sm-3"></label> |
|||
<select class="custom-select col-sm-9" disabled> |
|||
<option value="A面">A面</option> |
|||
</select> |
|||
<input asp-for="Side" class="form-control col-sm-9" hidden /> |
|||
<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="WipNo" class="control-label col-sm-3"></label> |
|||
<input asp-for="WipNo" class="form-control col-sm-6" /> |
|||
<span asp-validation-for="WipNo" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="ItemNo" class="control-label col-sm-3"></label> |
|||
<input id="searchItemNo" asp-for="ItemNo" class="form-control col-sm-9" /> |
|||
<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="OPCNT" class="control-label col-sm-3"></label> |
|||
<input asp-for="OPCNT" class="form-control col-sm-9" /> |
|||
<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="OpenTime" class="control-label col-sm-3"></label> |
|||
<input asp-for="OpenTime" type="datetime" class="form-control col-sm-9" readonly /> |
|||
<span asp-validation-for="OpenTime" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="InputSensorID" class="control-label col-sm-3"></label> |
|||
<select id="InputSensorID" asp-for="InputSensorID" asp-items="@ViewBag.StationList" class="custom-select col-sm-9"> |
|||
<option value="">請選擇</option> |
|||
</select> |
|||
<span asp-validation-for="InputSensorID" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="OutputSensorID" class="control-label col-sm-3"></label> |
|||
<select id="OutputSensorID" asp-for="OutputSensorID" asp-items="@ViewBag.StationList" class="custom-select col-sm-9"> |
|||
<option value="">請選擇</option> |
|||
</select> |
|||
<span asp-validation-for="StationID" class="text-danger offset-sm-3 my-sm-1"></span> |
|||
</div> |
|||
<div class="form-group form-inline my-sm-1"> |
|||
<label asp-for="Memo" class="control-label col-sm-3"></label> |
|||
<input asp-for="Memo" class="form-control col-sm-9" /> |
|||
<span asp-validation-for="Memo" 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); |
|||
} |
|||
}); |
|||
$('#searchItemNo').focus(function () { |
|||
var data = $("#WipNo").val(); |
|||
if (data) { |
|||
$.ajax({ |
|||
url: "/WHS/GetWipAtt", |
|||
dataType: 'json', |
|||
data: { id: data }, |
|||
contentType: "application/json", |
|||
type: 'get', |
|||
success: function (result) { |
|||
if (result.data) { |
|||
//console.info(result.data);//確認itemNO/modelNO |
|||
$("#searchItemNo").val(result.data.modelNO); |
|||
} |
|||
else { |
|||
alert("查無資料,請確認工單是否正確!"); |
|||
} |
|||
} |
|||
}); |
|||
} else { |
|||
alert("請填寫工單!"); |
|||
} |
|||
|
|||
}); |
|||
$('#countTime').click(function () { |
|||
var data = ""; |
|||
var data1 = $("#StartTime").val(); |
|||
var data2 = $("#EndTime").val(); |
|||
console.log(data1 +"countTime" + data2); |
|||
if (data1 && data2) { |
|||
data = data1 + "%" + data2; |
|||
$.ajax({ |
|||
url: "/WHS/GetCountTimes", |
|||
dataType: 'json', |
|||
data: { id: data}, |
|||
contentType: "application/json", |
|||
type: 'get', |
|||
success: function (result) { |
|||
if (result.data) { |
|||
$("#Time").val(result.data); |
|||
} |
|||
else { |
|||
alert(result.msg); |
|||
//alert("請確認時間區間填寫是否正確!"); |
|||
} |
|||
} |
|||
}); |
|||
} else { |
|||
alert("請填寫時間區間!"); |
|||
} |
|||
|
|||
}); |
|||
$("#UnitNo").change(function () { |
|||
var data = $("#UnitNo").val(); |
|||
getLines(data); |
|||
getStations(data); |
|||
getStations2(data); |
|||
}); |
|||
|
|||
function getUserInfoes(data) { |
|||
$.ajax({ |
|||
url: "/SYS/GetUserInfoes", |
|||
dataType: 'json', |
|||
contentType: "application/json", |
|||
type: 'get', |
|||
success: function (result) { |
|||
if (result.data) { |
|||
$("#DecideUser").empty(); |
|||
$('#DecideUser').append(new Option("請選擇", "")); |
|||
var count = 0; |
|||
$.each(result.data, function (index, item) { |
|||
if (item.deptID == data) { |
|||
$('#DecideUser').append(new Option(item.userName, item.userID)); |
|||
count = count + 1; |
|||
} |
|||
}); |
|||
if (count == 0) { |
|||
$("#DecideUser").empty(); |
|||
$('#DecideUser').append(new Option("無選項", "")); |
|||
} |
|||
} |
|||
else { |
|||
$("#DecideUser").empty(); |
|||
$('#DecideUser').append(new Option("無選項", "")); |
|||
} |
|||
layui.form.render("select"); |
|||
} |
|||
}); |
|||
}; |
|||
function getLines(data) { |
|||
$.ajax({ |
|||
url: "/BAS/GetLineInfoes", |
|||
dataType: 'json', |
|||
contentType: "application/json", |
|||
type: 'get', |
|||
success: function (result) { |
|||
if (result.data) { |
|||
$("#LineID").empty(); |
|||
$('#LineID').append(new Option("請選擇", "")); |
|||
var count = 0; |
|||
$.each(result.data, function (index, item) { |
|||
if (item.unitNo == data) { |
|||
$('#LineID').append(new Option(item.lineDesc, item.lineID)); |
|||
count = count + 1; |
|||
} |
|||
}); |
|||
if (count == 0) { |
|||
$("#LineID").empty(); |
|||
$('#LineID').append(new Option("無選項", "")); |
|||
} |
|||
} |
|||
else { |
|||
$("#LineID").empty(); |
|||
$('#LineID').append(new Option("無選項", "")); |
|||
} |
|||
layui.form.render("select"); |
|||
} |
|||
}); |
|||
}; |
|||
function getStations(data) { |
|||
$.ajax({ |
|||
url: "/BAS/GetStationses", |
|||
dataType: 'json', |
|||
contentType: "application/json", |
|||
type: 'get', |
|||
success: function (result) { |
|||
if (result.data) { |
|||
$("#StationID").empty(); |
|||
$('#StationID').append(new Option("請選擇", "")); |
|||
$('#StationID').append(new Option("N/A", "-1")); |
|||
var count = 0; |
|||
$.each(result.data, function (index, item) { |
|||
if (item.unitNo == data) { |
|||
$('#StationID').append(new Option(item.stationName, item.stationID)); |
|||
count = count + 1; |
|||
} |
|||
}); |
|||
if (count == 0) { |
|||
$("#StationID").empty(); |
|||
$('#StationID').append(new Option("無選項", "")); |
|||
} |
|||
} |
|||
else { |
|||
$("#StationID").empty(); |
|||
$('#StationID').append(new Option("無選項", "")); |
|||
} |
|||
layui.form.render("select"); |
|||
} |
|||
}); |
|||
}; |
|||
function getStations2(data) { |
|||
$.ajax({ |
|||
url: "/BAS/GetStationses", |
|||
dataType: 'json', |
|||
contentType: "application/json", |
|||
type: 'get', |
|||
success: function (result) { |
|||
if (result.data) { |
|||
$("#InputSensorID").empty(); |
|||
$('#InputSensorID').append(new Option("請選擇", "")); |
|||
$("#OutputSensorID").empty(); |
|||
$('#OutputSensorID').append(new Option("請選擇", "")); |
|||
var count = 0; |
|||
$.each(result.data, function (index, item) { |
|||
if (item.unitNo == data) { |
|||
$('#InputSensorID').append(new Option(item.stationName, item.stationID)); |
|||
$('#OutputSensorID').append(new Option(item.stationName, item.stationID)); |
|||
count = count + 1; |
|||
} |
|||
}); |
|||
if (count == 0) { |
|||
$("#InputSensorID").empty(); |
|||
$('#InputSensorID').append(new Option("無選項", "")); |
|||
$("#OutputSensorID").empty(); |
|||
$('#OutputSensorID').append(new Option("請選擇", "")); |
|||
} |
|||
} |
|||
else { |
|||
$("#InputSensorID").empty(); |
|||
$('#InputSensorID').append(new Option("無選項", "")); |
|||
$("#OutputSensorID").empty(); |
|||
$('#OutputSensorID').append(new Option("請選擇", "")); |
|||
} |
|||
layui.form.render("select"); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
layui.use(['laydate'], function () { |
|||
//form = layui.form; |
|||
laydate = layui.laydate; |
|||
laydate.render({ |
|||
elem: '#StartTime' |
|||
, trigger: 'click' |
|||
, type: 'datetime' |
|||
, format: 'yyyy-MM-dd HH:mm' |
|||
, theme: 'grid' |
|||
}); |
|||
laydate.render({ |
|||
elem: '#EndTime' |
|||
, trigger: 'click' |
|||
, type: 'datetime' |
|||
, format: 'yyyy-MM-dd HH:mm' |
|||
, theme: 'grid' |
|||
}); |
|||
}); |
|||
</script> |
|||
|
|||
|
|||
} |
|||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,421 @@ |
|||
using Microsoft.AspNetCore.Http; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using AMESCoreStudio.WebApi.Models.AMES; |
|||
using AMESCoreStudio.CommonTools.Result; |
|||
using AMESCoreStudio.WebApi.DTO.AMES; |
|||
|
|||
namespace AMESCoreStudio.WebApi.Controllers.AMES |
|||
{ |
|||
/// <summary>
|
|||
/// 生產工時資料檔Controller
|
|||
/// </summary>
|
|||
[Route("api/[controller]")]
|
|||
[ApiController] |
|||
public class WorkingHoursCollectionsController : ControllerBase |
|||
{ |
|||
private readonly AMESContext _context; |
|||
|
|||
/// <summary>
|
|||
/// 建構式
|
|||
/// </summary>
|
|||
/// <param name="context"></param>
|
|||
public WorkingHoursCollectionsController(AMESContext context) |
|||
{ |
|||
_context = context; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 查詢生產工時資料檔
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
// GET: api/<WorkingHoursCollectionController>
|
|||
[HttpGet] |
|||
public async Task<ActionResult<IEnumerable<WorkingHoursCollection>>> GetWorkingHoursCollection() |
|||
{ |
|||
IQueryable<WorkingHoursCollection> q = _context.WorkingHoursCollections; |
|||
q = q.OrderBy(p => p.TimeSheetID); |
|||
var WorkingHoursCollection = await q.ToListAsync(); |
|||
return WorkingHoursCollection; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 生產工時資料檔 by ID
|
|||
/// </summary>
|
|||
/// <param name="id">WorkingHoursCollectionID</param>
|
|||
/// <returns></returns>
|
|||
[HttpGet("{id}")] |
|||
public async Task<IEnumerable<WorkingHoursCollection>> GetWorkingHoursCollection(int id) |
|||
{ |
|||
IQueryable<WorkingHoursCollection> q = _context.WorkingHoursCollections; |
|||
var result = await q.Where(p => p.TimeSheetID == id).ToListAsync(); |
|||
return result; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 生產工時查詢
|
|||
/// </summary>
|
|||
/// <param name="unitNo"></param>
|
|||
/// <param name="stationid"></param>
|
|||
/// <param name="lineid"></param>
|
|||
/// <param name="user"></param>
|
|||
/// <param name="sdate"></param>
|
|||
/// <param name="edate"></param>
|
|||
/// <param name="itemno">料號</param>
|
|||
/// <returns></returns>
|
|||
[HttpGet("ByQuery/{unitNo}/{lineid}/{stationid}/{itemno}/{user}/{sdate}/{edate}")] |
|||
public async Task<ActionResult<IEnumerable<WorkingHoursCollection>>> GetWorkingHoursCollectionsByQuery(string unitNo, string lineid, string stationid, string itemno, string user, string sdate, string edate) |
|||
{ |
|||
IQueryable<WorkingHoursCollection> q = _context.WorkingHoursCollections; |
|||
|
|||
if (unitNo != "*") |
|||
q = q.Where(p => p.UnitNo.Equals(unitNo)); |
|||
if (lineid != "*") |
|||
q = q.Where(p => p.LineID.Equals(lineid)); |
|||
if (stationid != "*") |
|||
q = q.Where(p => p.StationID.Equals(stationid)); |
|||
if (itemno != "*") |
|||
q = q.Where(p => p.ItemNo.Equals(itemno)); |
|||
if (user != "*") |
|||
q = q.Where(p => p.CreateUserID.Equals(user)); |
|||
|
|||
DateTime dateValue; |
|||
if (sdate != "*") |
|||
{ |
|||
if (DateTime.TryParse(sdate, out dateValue)) |
|||
{ |
|||
q = q.Where(p => p.OpenTime >= DateTime.Parse(sdate)); |
|||
} |
|||
} |
|||
if (edate != "*") |
|||
{ |
|||
if (DateTime.TryParse(edate, out dateValue)) |
|||
{ |
|||
q = q.Where(p => p.CloseTime <= DateTime.Parse(edate)); |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
var workingHoursCollections = await q.ToListAsync(); |
|||
|
|||
return workingHoursCollections; |
|||
} |
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 生產工時Dto查詢 wipno
|
|||
/// </summary>
|
|||
/// <param name="unitNo"></param>
|
|||
/// <param name="stationid"></param>
|
|||
/// <param name="lineid"></param>
|
|||
/// <param name="user"></param>
|
|||
/// <param name="sdate"></param>
|
|||
/// <param name="edate"></param>
|
|||
/// <param name="itemno">料號</param>
|
|||
/// <param name="wipno">料號</param>
|
|||
/// <returns></returns>
|
|||
[HttpGet("DtoByQuery/{unitNo}/{lineid}/{stationid}/{wipno}/{itemno}/{user}/{sdate}/{edate}")] |
|||
public async Task<ActionResult<IEnumerable<WorkingHoursCollectionDto>>> GetWorkingHoursCollectionDtoByQuery(string unitNo, string lineid, string stationid,string wipno, string itemno, string user, string sdate, string edate) |
|||
{ |
|||
IQueryable<WorkingHoursCollection> q = _context.WorkingHoursCollections; |
|||
|
|||
if (unitNo != "*") |
|||
q = q.Where(p => p.UnitNo.Equals(unitNo)); |
|||
if (lineid != "*") |
|||
q = q.Where(p => p.LineID==int.Parse(lineid)); |
|||
if (stationid != "*") |
|||
q = q.Where(p => p.StationID == int.Parse(stationid)); |
|||
if (itemno != "*") |
|||
q = q.Where(p => p.ItemNo.Equals(itemno)); |
|||
var user1 = _context.UserInfoes.Where(w => w.UserName == user).FirstOrDefault(); |
|||
if (user1 != null) |
|||
q = q.Where(p => p.CreateUserID.Equals(user1.UserID)); |
|||
|
|||
DateTime dateValue; |
|||
if (sdate != "*") |
|||
{ |
|||
if (DateTime.TryParse(sdate, out dateValue)) |
|||
{ |
|||
q = q.Where(p => p.OpenTime >= DateTime.Parse(sdate)); |
|||
} |
|||
} |
|||
if (edate != "*") |
|||
{ |
|||
if (DateTime.TryParse(edate, out dateValue)) |
|||
{ |
|||
q = q.Where(p => p.OpenTime <= DateTime.Parse(edate)); |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
var workingHoursCollectionDtos = await q.Select(s => new WorkingHoursCollectionDto |
|||
{ |
|||
TimeSheetID = s.TimeSheetID, |
|||
UnitNo = s.UnitNo, |
|||
LineID = s.LineID, |
|||
StationID = s.StationID, |
|||
UnitName = s.Unit.UnitName, |
|||
//LineName = s.Line.LineDesc,
|
|||
//StationName = s.Station.StationName,
|
|||
WipNo = s.WipNo, |
|||
ItemNo = s.ItemNo, |
|||
OPCNT = s.OPCNT, |
|||
OpenTime = s.OpenTime, |
|||
CloseTime = s.CloseTime, |
|||
ProductionQty = s.ProductionQty, |
|||
TotalCT = s.TotalCT, |
|||
Memo = s.Memo, |
|||
CreateUserID = s.CreateUserID, |
|||
UpdateUserID = s.UpdateUserID |
|||
}).ToListAsync(); |
|||
|
|||
foreach (var data in workingHoursCollectionDtos) |
|||
{ |
|||
var p1 = _context.UserInfoes.Where(w => w.UserID == data.CreateUserID).FirstOrDefault(); |
|||
data.CreateUser = p1.UserName; |
|||
var dd = _context.StandardWorkTimes.Where(w => w.ItemNo == data.ItemNo); |
|||
var d1 = dd.Where(w => w.UnitNo == data.UnitNo); |
|||
var d2 = d1.Where(w => w.LineID == data.LineID); |
|||
var d3 = d2.Where(w => w.StationID == data.StationID).FirstOrDefault(); |
|||
var l = _context.LineInfoes.Where(w => w.LineID == data.LineID).FirstOrDefault(); |
|||
var s = _context.Stationses.Where(w => w.StationID == data.StationID).FirstOrDefault(); |
|||
if (l != null) |
|||
{ |
|||
data.LineName = l.LineDesc; |
|||
} |
|||
if (s != null) |
|||
{ |
|||
data.StationName = s.StationName; |
|||
} |
|||
if (d3 != null) |
|||
{ |
|||
data.RuleCNT = d3.OPCNT; |
|||
data.RuleTime = d3.TotalCT; |
|||
if (data.TotalCT != null) |
|||
{ |
|||
var tt = (double)((data.RuleCNT * data.RuleTime) / (data.TotalCT * data.OPCNT)); //標準工時 * 人數 / 該筆資料的實際標工(TOTAL_CT) * 人數 * 100 %
|
|||
data.Effective = double.Parse(tt.ToString("0.00")); //標準工時 * 人數 / 該筆資料的實際標工(TOTAL_CT) * 人數 * 100 %
|
|||
} |
|||
} |
|||
else { |
|||
|
|||
data.Effective = 0.0; |
|||
} |
|||
if (data.UpdateUserID != null && data.UpdateUserID !=-1) |
|||
{ |
|||
var p2 = _context.UserInfoes.Where(w => w.UserID == data.UpdateUserID).FirstOrDefault(); |
|||
data.UpdateUser = p2.UserName; |
|||
} |
|||
|
|||
} |
|||
return workingHoursCollectionDtos; |
|||
} |
|||
//public async Task<ActionResult<IEnumerable<WorkingHoursCollectionDto>>> GetWorkingHoursCollectionDtoByQuery(string unitNo, string lineid, string stationid, string wipno, string itemno, string user, string sdate, string edate)
|
|||
//{
|
|||
// IQueryable<WorkingHoursCollection> q = _context.WorkingHoursCollections;
|
|||
//
|
|||
// if (unitNo != "*")
|
|||
// q = q.Where(p => p.UnitNo.Equals(unitNo));
|
|||
// if (lineid != "*")
|
|||
// q = q.Where(p => p.LineID.Equals(lineid));
|
|||
// if (stationid != "*")
|
|||
// q = q.Where(p => p.StationID.Equals(stationid));
|
|||
// if (itemno != "*")
|
|||
// q = q.Where(p => p.ItemNo.Equals(itemno));
|
|||
// if (user != "*")
|
|||
// q = q.Where(p => p.CreateUserID.Equals(user));
|
|||
//
|
|||
// DateTime dateValue;
|
|||
// if (sdate != "*")
|
|||
// {
|
|||
// if (DateTime.TryParse(sdate, out dateValue))
|
|||
// {
|
|||
// q = q.Where(p => p.OpenTime >= DateTime.Parse(sdate));
|
|||
// }
|
|||
// }
|
|||
// if (edate != "*")
|
|||
// {
|
|||
// if (DateTime.TryParse(edate, out dateValue))
|
|||
// {
|
|||
// q = q.Where(p => p.CloseTime <= DateTime.Parse(edate));
|
|||
// }
|
|||
//
|
|||
// }
|
|||
//
|
|||
//
|
|||
// var workingHoursCollectionDtos = await q.Select(s => new WorkingHoursCollectionDto
|
|||
// {
|
|||
// TimeSheetID = s.TimeSheetID,
|
|||
// UnitNo = s.Unit.UnitNo,
|
|||
// LineID = s.Line.LineID,
|
|||
// StationID = s.Station.StationID,
|
|||
// UnitName = s.Unit.UnitName,
|
|||
// LineName = s.Line.LineDesc,
|
|||
// StationName = s.Station.StationName,
|
|||
// WipNo = s.WipNo,
|
|||
// ItemNo = s.ItemNo,
|
|||
// OPCNT = s.OPCNT,
|
|||
// OpenTime = s.OpenTime,
|
|||
// CloseTime = s.CloseTime,
|
|||
// ProductionQty = s.ProductionQty,
|
|||
// TotalCT = s.TotalCT,
|
|||
// Memo = s.Memo,
|
|||
// CreateUserID = s.CreateUserID,
|
|||
// UpdateUserID = s.UpdateUserID
|
|||
// }).ToListAsync();
|
|||
//
|
|||
// foreach (var data in workingHoursCollectionDtos)
|
|||
// {
|
|||
// var p1 = _context.UserInfoes.Where(w => w.UserID == data.CreateUserID).FirstOrDefault();
|
|||
// data.CreateUser = p1.UserName;
|
|||
// var dd = _context.StandardWorkTimes.Where(w => w.ItemNo == data.ItemNo);
|
|||
// var d1 = dd.Where(w => w.UnitNo == data.UnitNo);
|
|||
// var d2 = d1.Where(w => w.LineID == data.LineID);
|
|||
// var d3 = d2.Where(w => w.StationID == data.StationID).FirstOrDefault();
|
|||
// if (d3 != null)
|
|||
// {
|
|||
// data.RuleCNT = d3.OPCNT;
|
|||
// data.RuleTime = d3.TotalCT;
|
|||
// if (data.TotalCT != null)
|
|||
// {
|
|||
// data.Effective = (double)((data.RuleCNT * data.RuleTime) / (data.TotalCT * data.OPCNT)); //標準工時 * 人數 / 該筆資料的實際標工(TOTAL_CT) * 人數 * 100 %
|
|||
// }
|
|||
// }
|
|||
// else
|
|||
// {
|
|||
//
|
|||
// data.Effective = 0.0;
|
|||
// }
|
|||
// if (data.UpdateUserID != null)
|
|||
// {
|
|||
// var p2 = _context.UserInfoes.Where(w => w.UserID == data.UpdateUserID).FirstOrDefault();
|
|||
// data.UpdateUser = p2.UserName;
|
|||
// }
|
|||
//
|
|||
// }
|
|||
// return workingHoursCollectionDtos;
|
|||
//}
|
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 生產工時資料檔 to ItemNo
|
|||
/// </summary>
|
|||
/// <param name="id">料號No</param>
|
|||
/// <returns></returns>
|
|||
[HttpGet("ByItemNo/{id}")] |
|||
public async Task<IEnumerable<WorkingHoursCollection>> GetWorkingHoursCollectionByItemNo(string id) |
|||
{ |
|||
MaterialItemController materialItemController = new MaterialItemController(_context); |
|||
var result_Item = materialItemController.GetMaterialItemByItemNO(id); |
|||
int ItemID = 0; |
|||
|
|||
if (result_Item.Result != null) |
|||
ItemID = result_Item.Result.ItemID; |
|||
|
|||
IQueryable<WorkingHoursCollection> q = _context.WorkingHoursCollections.Where(w => w.ItemNo == id); |
|||
return await q.ToListAsync(); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 新增生產工時資料檔
|
|||
/// </summary>
|
|||
/// <param name="WorkingHoursCollection"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost] |
|||
public async Task<ResultModel<WorkingHoursCollection>> PostWorkingHoursCollection([FromBody] WorkingHoursCollection WorkingHoursCollection) |
|||
{ |
|||
ResultModel<WorkingHoursCollection> result = new ResultModel<WorkingHoursCollection>(); |
|||
Helper helper = new Helper(_context); |
|||
WorkingHoursCollection.TimeSheetID = helper.GetIDKey("TIMESHEET_ID").Result; |
|||
|
|||
_context.WorkingHoursCollections.Add(WorkingHoursCollection); |
|||
try |
|||
{ |
|||
await _context.SaveChangesAsync(); |
|||
result.Success = true; |
|||
result.Msg = "OK"; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = ex.InnerException.Message; |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 修改生產工時資料檔
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
[HttpPut("{id}")] |
|||
public async Task<ResultModel<WorkingHoursCollection>> PutWorkingHoursCollection(int id,[FromBody] WorkingHoursCollection WorkingHoursCollection) |
|||
{ |
|||
ResultModel<WorkingHoursCollection> result = new ResultModel<WorkingHoursCollection>(); |
|||
|
|||
//2020-05-20 BB.Wang Modify 把總工時 - 扣除時間(0.10.30.60)
|
|||
//2021-03-29 Neil.Chyi Modify 組合板數量列入CT計算(Multi_B)
|
|||
//System.DateTime dtOpen = System.DateTime.Parse(model.OpenTime);
|
|||
if (WorkingHoursCollection.CloseTime != null) |
|||
{ |
|||
System.DateTime dtClose = System.DateTime.Parse(WorkingHoursCollection.CloseTime.ToString()); |
|||
System.TimeSpan ts = dtClose.Subtract(WorkingHoursCollection.OpenTime); |
|||
var totalCT = (ts.TotalMinutes - WorkingHoursCollection.DeductionTime) / WorkingHoursCollection.MultipleCount / WorkingHoursCollection.ProductionQty; |
|||
|
|||
WorkingHoursCollection.TotalCT = totalCT; |
|||
} |
|||
|
|||
if (id != WorkingHoursCollection.TimeSheetID) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = "序號錯誤"; |
|||
return result; |
|||
} |
|||
|
|||
_context.Entry(WorkingHoursCollection).State = EntityState.Modified; |
|||
|
|||
try |
|||
{ |
|||
await _context.SaveChangesAsync(); |
|||
result.Success = true; |
|||
result.Msg = "OK"; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = ex.InnerException.Message; |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
|
|||
// DELETE api/<WorkingHoursCollectionController>/5
|
|||
[HttpDelete("{id}")] |
|||
public async Task<ResultModel<WorkingHoursCollection>> DeleteWorkingHoursCollection(int id) |
|||
{ |
|||
ResultModel<WorkingHoursCollection> result = new ResultModel<WorkingHoursCollection>(); |
|||
var WorkingHoursCollection = await _context.WorkingHoursCollections.Where(m => m.TimeSheetID == id).FirstOrDefaultAsync(); |
|||
if (WorkingHoursCollection == null) |
|||
{ |
|||
result.Success = false; |
|||
result.Msg = "序號不存在"; |
|||
return result; |
|||
} |
|||
|
|||
_context.WorkingHoursCollections.Remove(WorkingHoursCollection); |
|||
await _context.SaveChangesAsync(); |
|||
|
|||
result.Success = true; |
|||
result.Msg = "OK"; |
|||
return result; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,170 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace AMESCoreStudio.WebApi.DTO.AMES |
|||
{ |
|||
/// <summary>
|
|||
/// WorkingHoursCollectionDtp Select Dtos
|
|||
/// </summary>
|
|||
public class WorkingHoursCollectionDtos |
|||
{ |
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
public List<WorkingHoursCollectionDto> workingHoursCollectionDtos { get; set; } |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// WorkingHoursCollectionDtp Select Dto
|
|||
/// </summary>
|
|||
public class WorkingHoursCollectionDto |
|||
{ |
|||
/// <summary>
|
|||
/// 料號KP_ID
|
|||
/// </summary>
|
|||
|
|||
public int TimeSheetID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 生產單位
|
|||
/// </summary>
|
|||
|
|||
public string UnitNo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 生產單位
|
|||
/// </summary>
|
|||
|
|||
public string UnitName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 線別
|
|||
/// </summary>
|
|||
|
|||
public int LineID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 線別
|
|||
/// </summary>
|
|||
|
|||
public string LineName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 站別
|
|||
/// </summary>
|
|||
|
|||
public int StationID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 站別
|
|||
/// </summary>
|
|||
|
|||
public string StationName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 板面
|
|||
/// </summary>
|
|||
|
|||
public int Side { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 工單號碼
|
|||
/// </summary>
|
|||
|
|||
public string WipNo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 料號
|
|||
/// </summary>
|
|||
|
|||
public string ItemNo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 作業人數
|
|||
/// </summary>
|
|||
|
|||
public int OPCNT { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 開工時間
|
|||
/// </summary>
|
|||
|
|||
public DateTime OpenTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 完工時間
|
|||
/// </summary>
|
|||
|
|||
public DateTime? CloseTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 生產數量
|
|||
/// </summary>
|
|||
|
|||
public int? ProductionQty { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// CT
|
|||
/// </summary>
|
|||
|
|||
public double? TotalCT { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 標準工時
|
|||
/// </summary>
|
|||
|
|||
public int? RuleTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 標準人數
|
|||
/// </summary>
|
|||
|
|||
public int? RuleCNT { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 效率
|
|||
/// 效率的計算:依據料號所對應的製程別、線別、站別,看標準工時Table內所對應到的
|
|||
/// 標準工時 * 人數 / 該筆資料的實際標工(TOTAL_CT) * 人數 * 100%
|
|||
/// </summary>
|
|||
|
|||
public double? Effective { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 備註
|
|||
/// </summary>
|
|||
|
|||
public string Memo { get; set; } |
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 開工人員
|
|||
/// </summary>
|
|||
|
|||
public int CreateUserID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 完工人員
|
|||
/// </summary>
|
|||
|
|||
public string UpdateUser { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 開工人員
|
|||
/// </summary>
|
|||
|
|||
public string CreateUser { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 完工人員
|
|||
/// </summary>
|
|||
|
|||
public int? UpdateUserID { get; set; } |
|||
|
|||
|
|||
|
|||
} |
|||
} |
@ -0,0 +1,221 @@ |
|||
using System; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
using System.Runtime.Serialization; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace AMESCoreStudio.WebApi.Models.AMES |
|||
{ |
|||
/// <summary>
|
|||
/// 工時收集資料檔
|
|||
/// </summary>
|
|||
[Table("WORKING_HOURS_COLLECTION", Schema = "JHAMES")] |
|||
[DataContract] |
|||
|
|||
public partial class WorkingHoursCollection |
|||
{ |
|||
/// <summary>
|
|||
/// 工時收集ID
|
|||
/// </summary>
|
|||
[Key] |
|||
[Column("TIMESHEET_ID")] |
|||
[Required(ErrorMessage = "{0},不能空白")] |
|||
[DataMember] |
|||
public int TimeSheetID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 生產單位
|
|||
/// </summary>
|
|||
[Column("UNIT_NO")] |
|||
[StringLength(20)] |
|||
[Display(Name = "生產單位")] |
|||
[DataMember] |
|||
[Required(ErrorMessage = "{0},不能空白")] |
|||
public string UnitNo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 線別ID
|
|||
/// </summary>
|
|||
[DataMember] |
|||
[Column("LINE_ID")] |
|||
[Display(Name = "線別")] |
|||
[Required(ErrorMessage = "{0},不能空白")] |
|||
public int LineID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 站別
|
|||
/// </summary>
|
|||
[DataMember] |
|||
[Column("STATION_ID")] |
|||
[Display(Name = "站別")] |
|||
[Required(ErrorMessage = "{0},不能空白")] |
|||
public int StationID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 板面
|
|||
/// </summary>
|
|||
[Column("SIDE")] |
|||
[StringLength(6)] |
|||
[DataMember] |
|||
[Display(Name = "板面")] |
|||
public string Side { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 工單號碼
|
|||
/// </summary>
|
|||
[Column("WIP_NO")] |
|||
[StringLength(30)] |
|||
[DataMember] |
|||
[Display(Name = "工單號碼")] |
|||
public string WipNo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 料號
|
|||
/// </summary>
|
|||
[Column("ITEM_NO")] |
|||
[StringLength(40)] |
|||
[DataMember] |
|||
[Display(Name = "料號")] |
|||
[Required(ErrorMessage = "{0},不能空白")] |
|||
public string ItemNo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 作業人數
|
|||
/// </summary>
|
|||
[DataMember] |
|||
[Display(Name = "作業人數")] |
|||
[Column("OP_CNT")] |
|||
[Required(ErrorMessage = "{0},不能空白")] |
|||
public int OPCNT { get; set; } = 1; |
|||
|
|||
/// <summary>
|
|||
/// 開工時間
|
|||
/// </summary>
|
|||
[Column("OPEN_TIME")] |
|||
[DataMember] |
|||
[Display(Name = "開工時間")] |
|||
[Required(ErrorMessage = "{0},不能空白")] |
|||
public DateTime OpenTime { get; set; } = System.DateTime.Now; |
|||
|
|||
/// <summary>
|
|||
/// 完工時間
|
|||
/// </summary>
|
|||
[Column("CLOSE_TIME")] |
|||
[DataMember] |
|||
[Display(Name = "完工時間")] |
|||
public DateTime? CloseTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 扣除無工作時間
|
|||
/// </summary>
|
|||
[Column("DEDUCTION_TIME")] |
|||
[DataMember] |
|||
[Display(Name = "扣除無工作時間")] |
|||
public int? DeductionTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 合併生產數量
|
|||
/// </summary>
|
|||
[Column("MULTIPLE_COUNT")] |
|||
[DataMember] |
|||
[Display(Name = "合併生產數量")] |
|||
public int? MultipleCount { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 生產數量
|
|||
/// </summary>
|
|||
[Column("PRODUCTION_QTY")] |
|||
[DataMember] |
|||
[Display(Name = "生產數量")] |
|||
public int? ProductionQty { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// CT
|
|||
/// </summary>
|
|||
[Column("TOTAL_CT")] |
|||
[DataMember] |
|||
[Display(Name = "CT")] |
|||
public double? TotalCT { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 起始Sensor ID
|
|||
/// </summary>
|
|||
[Column("INPUT_SENSOR_ID")] |
|||
[StringLength(16)] |
|||
[DataMember] |
|||
[Display(Name = "起始Sensor")] |
|||
public string InputSensorID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 結止Sensor
|
|||
/// </summary>
|
|||
[Column("OUTPUT_SENSOR_ID")] |
|||
[StringLength(16)] |
|||
[DataMember] |
|||
[Display(Name = "結止Sensor")] |
|||
public string OutputSensorID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 備註
|
|||
/// </summary>
|
|||
[Column("MEMO")] |
|||
[StringLength(200)] |
|||
[DataMember] |
|||
[Display(Name = "備註")] |
|||
public string Memo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 創建者ID
|
|||
/// </summary>
|
|||
[Column("CREATE_USERID")] |
|||
[DataMember] |
|||
public int CreateUserID { get; set; } = 0; |
|||
|
|||
/// <summary>
|
|||
/// 創建日期
|
|||
/// </summary>
|
|||
[Column("CREATE_DATE")] |
|||
[DataMember] |
|||
public DateTime CreateDate { get; set; } = System.DateTime.Now; |
|||
|
|||
/// <summary>
|
|||
/// 更新者ID
|
|||
/// </summary>
|
|||
[Column("UPDATE_USERID")] |
|||
[DataMember] |
|||
public int UpdateUserID { get; set; } = 0; |
|||
|
|||
/// <summary>
|
|||
/// 更新日期
|
|||
/// </summary>
|
|||
[Column("UPDATE_DATE", TypeName = "DATE")] |
|||
[DataMember] |
|||
public DateTime UpdateDate { get; set; } = System.DateTime.Now; |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 工單機種資料
|
|||
/// </summary>
|
|||
[ForeignKey("UnitNo")] |
|||
public virtual AMESCoreStudio.WebApi.Models.BAS.FactoryUnit Unit { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 工單機種資料
|
|||
/// </summary>
|
|||
[ForeignKey("LineID")] |
|||
public virtual AMESCoreStudio.WebApi.Models.BAS.LineInfo Line { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 料號StationID主檔
|
|||
/// </summary>
|
|||
[ForeignKey("StationID")] |
|||
public virtual AMESCoreStudio.WebApi.Models.BAS.Stations Station { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// PE工程師姓名 Engineer
|
|||
/// </summary>
|
|||
//[NotMapped]
|
|||
//public string Engineer_Name { get; set; }
|
|||
} |
|||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue