@model AMESCoreStudio.Web.ViewModels.PCS.PCS009RViewModel
@{
    ViewData["Title"] = "條碼追蹤查詢";
    Layout = "~/Views/Shared/_AMESLayout.cshtml";
}

<style>
    .control-label {
        justify-content: flex-end !important;
    }
</style>


<div class="layui-card">
    <form enctype="multipart/form-data" class="layui-form">
        <div asp-validation-summary="ModelOnly" class="text-danger"></div>
        <div class="layui-card-body">
            <fieldset class="layui-elem-field layui-field-title">
                <legend style="color: #e18917">條碼資料</legend>
            </fieldset>
            <div class="layui-row">
                <div class="layui-col-xs2">
                    <label class="layui-form-label-col" style="text-align:right;">生產序號:</label>
                </div>
                <div class="layui-col-xs2">
                    <div class="layui-form-item">
                        <div class="layui-input-block" style="margin-left:auto;">
                            <label class="layui-form-label" style="text-align: left; width: 150px;">@Model.BarCodeNo</label>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs2">
                    <label class="layui-form-label-col" style="text-align:right;">出貨序號:</label>
                </div>
                <div class="layui-col-xs2">
                    <div class="layui-form-item">
                        <div class="layui-input-block" style="margin-left:auto;">
                            <label class="layui-form-label" style="text-align: left; width: 150px;">@Model.ExtraBarCodeNo</label>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs2">
                    <label class="layui-form-label-col" style="text-align:right;">包裝箱號:</label>
                </div>
                <div class="layui-col-xs2">
                    <div class="layui-form-item">
                        <div class="layui-input-block" style="margin-left:auto;">
                            <label class="layui-form-label" style="text-align: left; width: 150px;">@Model.BoxNo</label>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-row">
                <div class="layui-col-xs2">
                    <label class="layui-form-label-col" style="text-align:right;">狀態描述:</label>
                </div>
                <div class="layui-col-xs2">
                    <div class="layui-form-item">
                        <div class="layui-input-block" style="margin-left:auto;">
                            <label class="layui-form-label" style="text-align: left; width: 150px;">@Model.StatusNo</label>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs2">
                    <label class="layui-form-label-col" style="text-align:right;">入庫單號:</label>
                </div>
                <div class="layui-col-xs2">
                    <div class="layui-form-item">
                        <div class="layui-input-block" style="margin-left:auto;">
                            <label class="layui-form-label" style="text-align: left; width: 150px;">@Model.InhouseNo</label>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs2">
                    <label class="layui-form-label-col" style="text-align:right;">重量(g):</label>
                </div>
                <div class="layui-col-xs2">
                    <div class="layui-form-item">
                        <div class="layui-input-block" style="margin-left:auto;">
                            <label class="layui-form-label" style="text-align: left; width: 150px;">@Model.Wight</label>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-row">
                <fieldset class="layui-elem-field layui-field-title">
                    <legend style="color: #e18917">工單歷程</legend>
                </fieldset>
                <table id="rulestionOld" class="layui-table" lay-skin="nob">
                    <tbody>
                        @foreach (var index in Model.WinInfos)
                        {
                            <tr>
                                <td style="width:70px;">
                                    工單號碼:
                                </td>
                                <td>
                                    @index.WipNo
                                </td>
                                <td>
                                    料號:
                                </td>
                                <td>
                                    @index.ItemNo
                                </td>
                                <td>
                                    BOM版本:
                                </td>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    生產單位:
                                </td>
                                <td>
                                    @index.UnitNo
                                </td>
                                <td>
                                    線別:
                                </td>
                                <td>
                                    @index.Line
                                </td>
                                <td>
                                    ECN:
                                </td>
                                <td>
                                    @index.ECN
                                </td>
                                <td>
                                    EAN:
                                </td>
                                <td>
                                    @index.EAN
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    建置日期:
                                </td>
                                <td>
                                    @DateTime.Parse(index.CreateDate).ToString("yyyy/MM/dd HH:mm:ss")
                                </td>
                                <td>
                                    DATE CODE:
                                </td>
                                <td>
                                    @index.DateCode
                                </td>
                                <td>
                                    客戶料號:
                                </td>
                                <td>
                                    @index.CustomerItemNo
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Remarks:
                                </td>
                                <td colspan="7">
                                    @index.Remarks
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
            <div class="layui-row">
                <fieldset class="layui-elem-field layui-field-title">
                    <legend style="color: #e18917">生產歷程</legend>
                </fieldset>
                <table class="layui-table" lay-even lay-size="sm">
                    <thead>
                        <tr>
                            <th>
                                站別名稱
                            </th>
                            <th>
                                規格描述
                            </th>
                            <th>
                                系統類型
                            </th>
                            <th>
                                使用者
                            </th>
                            <th>
                                過站時間
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var index in Model.BarCodeLogs)
                        {
                            <tr>
                                <td>
                                    @index.Station
                                </td>
                                @if (index.RuleStation == "F")
                                {
                                    <td><span style="color:red">@index.RuleStation</span></td>
                                }
                                else
                                {
                                    <td>
                                        @index.RuleStation
                                    </td>
                                }

                                <td>
                                    @index.SysType
                                </td>
                                <td>
                                    @index.User
                                </td>
                                <td>
                                    @DateTime.Parse(index.InputDate).ToString("yyyy/MM/dd HH:mm:ss")
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
            <div class="layui-row">
                <fieldset class="layui-elem-field layui-field-title">
                    <legend style="color: #e18917">組件清單</legend>
                </fieldset>
                <table class="layui-table" lay-even lay-size="sm">
                    <thead>
                        <tr>
                            <th>
                                站別名稱
                            </th>
                            <th>
                                組件名稱
                            </th>
                            <th>
                                組件條碼
                            </th>
                            <th>
                                組件料號
                            </th>
                            <th>
                                綁入人員
                            </th>
                            <th>
                                綁入時間
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var index in Model.BarCodeKPs)
                        {
                            <tr>
                                <td>
                                    @index.StationName
                                </td>
                                <td>
                                    @index.ItemNoName
                                </td>
                                <td>
                                    @index.PartNo
                                </td>
                                <td>
                                    @index.KpItemNo
                                </td>
                                <td>
                                    @index.CreateUser
                                </td>
                                <td>
                                    @index.CreateDate.ToString("yyyy/MM/dd HH:mm:ss")
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
            <div class="layui-row">
                <fieldset class="layui-elem-field layui-field-title">
                    <legend style="color: #e18917">送修紀錄</legend>
                </fieldset>
                <table class="layui-table" lay-even lay-size="sm">
                    <thead>
                        <tr>
                            <th>
                                站別名稱
                            </th>
                            <th>
                                不良代碼
                            </th>
                            <th>
                                零件位置
                            </th>
                            <th>
                                維修代碼
                            </th>
                            <th>
                                維修狀態
                            </th>
                            <th>
                                回覆人員
                            </th>
                            <th>
                                回覆日期
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var index in Model.nGInfoDtos)
                        {
                            <tr>
                                <td>
                                    @index.StationName
                                </td>
                                <td>
                                    @index.NGNo
                                </td>
                                <td>
                                    @index.LocationNo
                                </td>
                                <td>
                                    @index.RepairNo
                                </td>
                                <td>
                                    @index.Status
                                </td>
                                <td>
                                    @index.ReplyUser
                                </td>
                                <td>
                                    @DateTime.Parse(index.ReplyDate).ToString("yyyy/MM/dd HH:mm:ss")
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
            <div class="layui-row">
                <fieldset class="layui-elem-field layui-field-title">
                    <legend style="color: #e18917">治具清單</legend>
                </fieldset>
                <table class="layui-table" lay-even lay-size="sm">
                    <thead>
                        <tr>
                            <th>
                                站別名稱
                            </th>
                            <th>
                                設備編號
                            </th>
                            <th>
                                過站時間
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var index in Model.Outfits)
                        {
                            <tr>
                                <td>
                                    @index.Station
                                </td>
                                <td>
                                    @index.OutfitNo
                                </td>
                                <td>
                                    @DateTime.Parse(index.InputDate).ToString("yyyy/MM/dd HH:mm:ss")
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
            <div class="layui-row">
                <fieldset class="layui-elem-field layui-field-title">
                    <legend style="color: #e18917">條碼變更</legend>
                </fieldset>
                <table class="layui-table" lay-even lay-size="sm">
                    <thead>
                        <tr>
                            <th>
                                (舊)條碼序號
                            </th>
                            <th>
                                (新)條碼序號
                            </th>
                            <th>
                                變更類型
                            </th>
                            <th>
                                備註
                            </th>
                            <th>
                                變更人員
                            </th>
                            <th>
                                變更時間
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var index in Model.BarCodeChanges)
                        {
                        <tr>
                            <td>
                                @index.BarCodeOld
                            </td>
                            <td>
                                @index.BarCodeNew
                            </td>
                            <td>
                                @index.BarCodeChangeType
                            </td>
                            <td>
                                @index.Memo
                            </td>
                            <td>
                                @index.User
                            </td>
                            <td>
                                @index.Date
                            </td>
                        </tr>
                        }
                    </tbody>
                </table>
            </div>
            <div class="layui-row">
                <fieldset class="layui-elem-field layui-field-title">
                    <legend style="color: #e18917">組件變更</legend>
                </fieldset>
                <table class="layui-table" lay-even lay-size="sm">
                    <thead>
                        <tr>
                            <th>
                                站別名稱
                            </th>
                            <th>
                                組件名稱
                            </th>
                            <th>
                                (舊)組件條碼
                            </th>
                            <th>
                                替換人員
                            </th>
                            <th>
                                替換時間
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var index in Model.KPChanges)
                        {
                            <tr>
                                <td>
                                    @index.StationName
                                </td>
                                <td>
                                    @index.ItemNoName
                                </td>
                                <td>
                                    @index.PartNoOld
                                </td>
                                <td>
                                    @index.CreateUser
                                </td>
                                <td>
                                    @index.CreateDate.ToString("yyyy/MM/dd HH:mm:ss")
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
            <div class="layui-row">
                <fieldset class="layui-elem-field layui-field-title">
                    <legend style="color: #e18917">備料</legend>
                </fieldset>
            </div>
        </div>
    </form>
</div>

@section Scripts {
    @{ await Html.RenderPartialAsync("_ValidationScriptsPartial");
        await Html.RenderPartialAsync("_FileinputScriptsPartial"); }

    <script type="text/javascript">

    </script>
}