7 changed files with 1694 additions and 2 deletions
@ -0,0 +1,392 @@ |
|||||
|
@{ |
||||
|
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="unit" lay-submit id="unit" name="unit" asp-items="@ViewBag.FactoryUnit"> |
||||
|
<option value="">全部</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
<input id="unitNo" type="hidden" name="unitNo" value="*" /> |
||||
|
</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="line" lay-filter="line" lay-submit asp-items="@ViewBag.LineList"> |
||||
|
<option value="">全部</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
<input id="lineID" type="hidden" name="lineID" value="0" /> |
||||
|
</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="station" id="station" lay-filter="station" lay-submit asp-items="@ViewBag.StationList"> |
||||
|
<option value="">全部</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
<input id="stationID" type="hidden" name="stationID" value="0" /> |
||||
|
</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"> |
||||
|
function getLineInfoList(data) |
||||
|
{ |
||||
|
$.ajax( |
||||
|
{ |
||||
|
url: '@Url.Action("GetUnitLineJson", "REP")', |
||||
|
dataType: 'json', |
||||
|
data: { "unit_no": $("#unit").val() }, |
||||
|
type: 'post', |
||||
|
success: function (result) { |
||||
|
console.info(result.data); |
||||
|
$("#line").empty();//清空下拉框的值 |
||||
|
$.each(result.data, function (index, item) { |
||||
|
$("#line").append($("<option>").text(item.text).val(item.value)) |
||||
|
}); |
||||
|
$("#line option:eq(1)").attr("selected", 'selected'); //默认选择第一个选项 |
||||
|
layui.form.render("select");//重新渲染 固定写法 |
||||
|
}, |
||||
|
error: function (result) { |
||||
|
alert(result); |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
function getStationList(data) |
||||
|
{ |
||||
|
$.ajax( |
||||
|
{ |
||||
|
url: '@Url.Action("GetUnitStationJson", "REP")', |
||||
|
dataType: 'json', |
||||
|
data: { "unit_no": $("#unit").val() }, |
||||
|
type: 'post', |
||||
|
success: function (result) { |
||||
|
console.info(result.data); |
||||
|
$("#station").empty();//清空下拉框的值 |
||||
|
$.each(result.data, function (index, item) { |
||||
|
$("#station").append($("<option>").text(item.text).val(item.value)) |
||||
|
}); |
||||
|
$("#station option:eq(1)").attr("selected", 'selected'); //默认选择第一个选项 |
||||
|
layui.form.render("select");//重新渲染 固定写法 |
||||
|
}, |
||||
|
error: function (result) { |
||||
|
alert(result); |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
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' |
||||
|
}); |
||||
|
|
||||
|
form.on('select(unit)', function (data) { |
||||
|
$("#unitNo").val(data.value); |
||||
|
|
||||
|
getLineInfoList(data.value); |
||||
|
|
||||
|
getStationList(data.value); |
||||
|
}); |
||||
|
|
||||
|
form.on('select(line)', function (data) { |
||||
|
$("#lineID").val(data.value); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
form.on('select(station)', function (data) { |
||||
|
$("#stationID").val(data.value); |
||||
|
|
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
////搜索 |
||||
|
$('#querysubmit').click(function () { |
||||
|
console.log('#btnSearch'); |
||||
|
hg.msghide("刷新数据!"); |
||||
|
loaddata(); |
||||
|
return false; |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
|
||||
|
var tableCols = [[ |
||||
|
{ |
||||
|
field: 'timeSheetID', |
||||
|
title: '#', |
||||
|
sort: true |
||||
|
}, |
||||
|
{ |
||||
|
field: 'wipNo', |
||||
|
title: '工單號碼', |
||||
|
sort: true |
||||
|
}, |
||||
|
{ |
||||
|
field: 'itemNo', |
||||
|
title: '料號', |
||||
|
sort: true |
||||
|
}, |
||||
|
{ |
||||
|
field: 'unitName', |
||||
|
title: '製程名稱' |
||||
|
}, |
||||
|
{ |
||||
|
field: 'lineName', |
||||
|
title: '線別名稱' |
||||
|
}, |
||||
|
{ |
||||
|
field: 'stationName', |
||||
|
title: '站別名稱', |
||||
|
}, |
||||
|
{ |
||||
|
field: 'opcnt', |
||||
|
title: '作業人數', |
||||
|
}, |
||||
|
{ |
||||
|
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: 160, |
||||
|
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/WHS019U/' + obj.data.timeSheetID, 800,720); |
||||
|
} |
||||
|
} |
||||
|
//通过行tool编辑,lay-event="finish" |
||||
|
function finish(obj) { |
||||
|
if (obj.data.timeSheetID) { |
||||
|
hg.open('完工', '/WHS/WHS019E/' + obj.data.timeSheetID, 800, 800); |
||||
|
} |
||||
|
} |
||||
|
//通过行tool删除,lay-event="del" |
||||
|
function del(obj) { |
||||
|
if (obj.data.timeSheetID) { |
||||
|
hg.confirm("生產工時:" + obj.data.timeSheetID + ",確定要删除嗎?", function () { |
||||
|
$.ajax({ |
||||
|
url: '/WHS/WHS019D', |
||||
|
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/WHS019C', 800, 720); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
]; |
||||
|
//基本数据表格 |
||||
|
|
||||
|
var table; |
||||
|
$(function () { |
||||
|
loaddata(); |
||||
|
}); |
||||
|
function loaddata() { |
||||
|
//基本数据表格 |
||||
|
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/GetWorkingHoursCollectionDtoByQuery4WHS019?' |
||||
|
+ '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-3"></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 id="Side" asp-for="Side" class="custom-select col-sm-9"> |
||||
|
<option value="A面">A面</option> |
||||
|
<option value="B面">B面</option> |
||||
|
</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="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" 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" 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-3"></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 id="Side" asp-for="Side" class="custom-select col-sm-9" disabled> |
||||
|
<option value="A面">A面</option> |
||||
|
<option value="B面">B面</option> |
||||
|
</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="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-3"></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 id="Side" asp-for="Side" class="custom-select col-sm-9"> |
||||
|
<option value="A面">A面</option> |
||||
|
<option value="B面">B面</option> |
||||
|
</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="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" 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" 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> |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
Loading…
Reference in new issue