WorkOrder.js 44.8 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946
let action = null,
    app = null;
layui.config({
    base: "/js/",
    version: 1
}).use(['system', 'JsBarcode', 'jqprint', "vue"], function () {
    var form = layui.form,
        $ = layui.jquery,
        element = layui.element,
        table = layui.table,
        system = layui.system,
        sysU = new system.u(),
        sendData = null,
        areaName = "wo",
        tableName = "WorkOrder",
        vueApp = null,
        app = null,
        selectStationCodeVal = null,
        rowData = null,
        rowDataDetail = null;
    action = {
        addOptions: function () {
            var options = {
                fromId: "#modifyForm form",
                url: `/${areaName}/${tableName}/Ins`,
                submit: "submit(fromAdd)"
            }
            return options;
        },

        addOptionsDesc: function () {
            var options = {
                fromId: "#modifyFormDesc form",
                url: `/${areaName}/${tableName}/InsDesc`,
                content: $('#modifyFormDesc'),
                submit: "submit(fromAddDesc)"
            }

            return options;
        },

        editOptions: function () {
            var options = {
                fromId: "#modifyForm form",
                url: `/${areaName}/${tableName}/Upd`,
                submit: "submit(fromUpdate)"
            }
            return options;
        },

        editOptionsDesc: function () {
            var options = {
                fromId: "#modifyFormDesc form",
                url: `/${areaName}/${tableName}/UpdDesc`,
                content: $('#modifyFormDesc'),
                submit: "submit(fromUpdateDesc)"
            }
            return options;
        },

        deleteOptions: function () {
            var options = {
                url: `/${areaName}/${tableName}/DelByKeys`,
                keyId: "keys",
                titleConfirmDelete: "确定要删除所选信息吗(对应的明细数据也会删除)?"
            }
            return options;
        },

        deleteOptionsDesc: function () {
            var options = {
                url: `/${areaName}/${tableName}/DelByKeys`,
                keyId: "keys"
            }
            return options;
        },

        exportOptions: function () {
            var options = {
                fromId: "listForm",
                url: `/${areaName}/${tableName}/Export`,
                isDefault: true,
                excelCols: {
                    head: app.data.cols,
                    body: app.data.colsDesc
                }
            }
            return options;
        },

        queryOptions: function () {
            var options = {
                resetFrom: "form[lay-filter=listForm]",
                fromId: "listForm",
                urlExport: `/${areaName}/${tableName}/Export`,
                urlQuery: `/${areaName}/${tableName}/Load`,
                mainTable: app.data.tableIns
            }
            return options;
        },

        uploadOptions: function () {
            var options = {
                url: `/${areaName}/${tableName}/Import`
            }
            return options;
        },

        rowClickOptions: function () {
            var options = {
                isDefault: true,
                targetTableId: app.data.tableElem,
                tabfilter: "tableTabBody",
                tabId: 2,
                customFn: app.methods.initTableDesc
            }
            return options;
        },

        editBefore: function (data, callBack) {
            form.val("modifyForm", data);
            //callBack是回调函数,如果editBefore有ajax 放在成功之后
            if (callBack != null) callBack();
        },

        editSaveBefore: function (data, callBack) {
            if (callBack != null) callBack();
        },

        editBeforeDesc: function (data, callBack) {
            form.val("modifyFormDesc", data);
            //callBack是回调函数,如果editBefore有ajax 放在成功之后
            if (callBack != null) callBack();
        },
        editSaveBeforeDesc: function (data, callBack) {
            if (callBack != null) callBack();
        },

        addBefore: function (callBack) {
            //callBack是回调函数,如果editBefore有ajax 放在成功之后
            if (callBack != null) callBack();
        },

        addBeforeDesc: function (callBack) {
            //callBack是回调函数,如果editBefore有ajax 放在成功之后
            if (callBack != null) callBack();
        },

        addSaveBefore: function (data, callBack) {
            if (callBack != null) callBack();
        },


        //当前行表格双击事件处理
        customTableRowClick: function (obj, tableId) {
            if (tableId == app.data.tableElem) {
                rowData = obj.data;
            }
        },

        //时间线
        btnOprTimeLine: function (sU, toolbarId, obj) {
            var checkStatus = table.checkStatus(toolbarId);
            if (checkStatus.data.length != 1) {
                layer.alert(sysU.config.titleSelectOne, { icon: sysU.config.iconoError, shadeClose: true, title: sysU.config.titleSelectOne });
                return;
            }
            var ajaxConfig = {
                data: { headKeys: checkStatus.data[0].keys },
                url: `/${areaName}/${tableName}/LoadDesc`,
                success: function (data) {
                    vueApp.noProductiontime = [];
                    if (sU.successBefore(data)) return;
                    vueApp.oprTimeLineList = data.Result;
                    layer.open({
                        type: 1,
                        title: `信息【${checkStatus.data[0].productHeaderCode}】`,
                        content: $("#timeline"),
                        area: ['1000px', '580px']
                    });
                }
            };
            sU.ajax(ajaxConfig);
        },
        //工序任务明细物料
        btnMater: function (sU, detailId, obj) {
            var checkStatus = table.checkStatus(detailId);
            if (checkStatus.data.length != 1) {
                layer.alert(sysU.config.titleSelectOne, { icon: sysU.config.iconoError, shadeClose: true, title: sysU.config.titleSelectOne });
                return;
            }
            var data = checkStatus.data[0];
            console.log(`MaterDetail?headkey='${data.headKeys}'&bodyKey='${data.bodyKeys}'`);
            layer.open({
                type: 2,
                title: `${data.oprSequenceName} - ${data.materialName}`,
                content: `MaterDetail?headKey=${data.headKeys}&bodyKey=${data.bodyKeys}`,
                area: ['1000px', '580px']
            });
        },

        //报工MOM
        btnWorkReport: function (sysU, toolbarId, obj) {
            var checkStatus = table.checkStatus(toolbarId);
            if (checkStatus.data.length != 1) {
                layer.alert(sysU.config.titleSelectOne, { icon: sysU.config.iconoError, shadeClose: true, title: sysU.config.titleSelectOne });
                return;
            }
            var sendData = checkStatus.data[0].keys;
            //弹出框提示报工作业信息数据,后提交报工数据到MOM
            var ajaxConfig = {
                data: { headKey: sendData },
                url: `/${areaName}/${tableName}/WorkReport`,
                success: function (data) {
                    console.info(data);
                    if (sysU.successBefore(data)) return false;

                    layer.confirm(data.Message, { icon: 3, title: '提示' }, function (index) {
                        var ajaxConfig = {
                            data: { headKey: sendData, IsValdate: false },
                            url: `/${areaName}/${tableName}/WorkReport`,
                            success: function (result) {
                                if (sysU.successBefore(result)) return;
                                layer.msg(sysU.config.titleActionSuccess, { icon: sysU.config.iconoOk, shade: 0.4, time: sysU.config.msgOpenTime });
                                if (action["actionSuccess"] !== undefined) action["actionSuccess"].call(null, "Desc");
                                table.reload("mainList");
                            }
                        };
                        sysU.ajax(ajaxConfig);
                        layer.close(index);
                    });
                }
            };
            sysU.ajax(ajaxConfig);
        },

        //质检报告
        btnReworkCheck: function (sysU, toolbarId, obj) {
            var checkStatus = table.checkStatus(toolbarId),
                data = checkStatus.data;
            if (data.length !== 1) {
                layer.msg(sysU.config.titleSelectOne);
                return false;
            }
            layer.open({
                title: "质检报告-工单编码【" + data[0].workOrderCode + "】",
                type: 2,
                area: ['1000px', '600px'],
                content: "/quality/ReworkCheck/Index?page=WorkOrder&headCode=" + data[0].workOrderCode
            });
        },

        //收货
        btnReceipt: function (sysU, toolbarId, obj) {
            var checkStatus = table.checkStatus(toolbarId),
                data = checkStatus.data;
            if (data.length !== 1) {
                layer.msg(sysU.config.titleSelectOne);
                return false;
            }
            layer.open({
                title: "收货-工单编码【" + data[0].workOrderCode + "】,注意:切换页码之前请先保存当前页已修改的数据",
                type: 2,
                area: ['1000px', '600px'],
                content: `Receipt?headKey=${data[0].keys}`
            });
        },

        //收货统计
        btnReceiptStatistics: function (sysU, toolbarId, obj) {
            var checkStatus = table.checkStatus(toolbarId),
                data = checkStatus.data;
            if (data.length !== 1) {
                layer.msg(sysU.config.titleSelectOne);
                return false;
            }

            layer.open({
                title: "收货统计-工单编码【" + data[0].workOrderCode + "】,注意:“合计”只统计当前页码的数据",
                type: 2,
                area: ['1000px', '600px'],
                content: `ReceiptStatistics?headKey=${data[0].keys}`
            });
        },

        //工序数据录入和开工
        btnEnteringWorkReport: function (sU, toolbarId, obj) {
            debugger
            $("#complete form")[0].reset();

            var checkStatus = table.checkStatus(toolbarId);
            if (checkStatus.data.length != 1) {
                layer.alert(sysU.config.titleSelectOne, { icon: sysU.config.iconoError, shadeClose: true, title: sysU.config.titleSelectOne });
                return;
            }
            if (checkStatus.data[0].workReportStatus > window.top.EnumWorkReportStatus["开工已报工"]) {
                layer.alert("当前工序已开工并报工!", { icon: 2, shadeClose: true, title: "错误提示" });
                return;
            }
            var checkData = checkStatus.data[0];
            var id = checkData.id;
            var headKeys = checkData.headKeys;
            var bodyKeys = checkData.bodyKeys;
            if (checkData.actualStartTime == null) {
                $("#actualStartTime").val(new Date().format("yyyy-MM-dd hh:mm:ss"));
            } else {
                $("#actualStartTime").val(checkData.actualStartTime);
            }

            rowDataDetail = checkData;
            //加载工位
            app.data.selectOption.stationCode.SelFrom = `/configure/Station/LoadStationCodeByworkCenterCode?workCenterCode=${checkData.workCenterCode}&lineCode=${rowData.lineCode}`;
            sysU.initSelect(app.data.selectOption, function () {
                //给表单赋值
                form.val("complete", {
                    stationCode: checkData.stationCode
                });
                // 模拟select点击事件
                setTimeout(() => {
                    //$("#stationCode").next().find('.layui-select-title input').click();
                    $("#stationCode").next().find('.layui-anim').children(`dd[lay-value="${checkData.stationCode}"]`).click();
                }, 1000);
            });

            //加载 工序物料消耗、设备工艺参数 文本下拉框表格
            app.methods.initSelect();
            //加载物料表格
            app.methods.initGetMaterialInfo(checkData);

            layer.open({
                type: 1,
                title: "工序数据录入和开工,工序任务头表ID:【" + rowData.id + "】",
                content: $("#complete"),
                btn: ['保存', "关闭"],
                area: ['800px', '580px'],
                yes: function (index, layero) {
                    debugger
                    var Material = sysU.getTableAllData("WorkOrderMaterialUseLog");
                    var Equipment = sysU.getTableAllData("mainListEquipmentProcessTemplate");
                    var actualStartTime = document.getElementById("actualStartTime").value;
                    if (actualStartTime == "") {
                        layer.alert(`请选择开始时间!`, { icon: sysU.config.iconoError, shadeClose: true, title: sysU.config.titleOpen });
                        return;
                    }
                    //if (selectStationCodeVal == null || selectStationCodeVal == "") {
                    //    layer.alert(`请选择工位!`, { icon: sysU.config.iconoError, shadeClose: true, title: sysU.config.titleOpen });
                    //    return;
                    //}
                    var ajaxConfig = {
                        data: {
                            headKeys: headKeys,
                            bodyKeys: bodyKeys,
                            id: id,
                            actualStartTime: actualStartTime,
                            Material: Material,
                            Equipment: Equipment,
                            stationCode: rowDataDetail.stationCode
                        },
                        url: `/${areaName}/${tableName}/UpdateProcess`,
                        success: function (result) {
                            if (sysU.successBefore(result)) return;
                            layer.msg(result.Message, { icon: 6, shade: 0.4, time: sysU.config.msgOpenTimeLong });
                            layer.confirm(sysU.config.titleWorkReport, { icon: 3, title: '提示' }, function (idnex) {
                                var ajaxConfig = {
                                    data: { headKey: rowData.keys },
                                    url: `/${areaName}/${tableName}/WorkReport`,
                                    success: function (data) {
                                        console.info(data);
                                        if (sysU.successBefore(data)) return false;

                                        layer.confirm(data.Message, { icon: 3, title: '提示' }, function (index) {
                                            var ajaxConfig = {
                                                data: { headKey: rowData.keys, IsValdate: false },
                                                url: `/${areaName}/${tableName}/WorkReport`,
                                                success: function (result) {
                                                    if (sysU.successBefore(result)) return;
                                                    layer.msg(sysU.config.titleActionSuccess, { icon: sysU.config.iconoOk, shade: 0.4, time: sysU.config.msgOpenTime });
                                                    if (action["actionSuccess"] !== undefined) action["actionSuccess"].call(null, "Desc");
                                                }
                                            };
                                            sysU.ajax(ajaxConfig);
                                            layer.close(index);
                                        });
                                    }
                                };
                                sysU.ajax(ajaxConfig);
                            });
                            sysU.refreshTable(app, sysU, sendData, "btnCompletionDesc");
                        }
                    };
                    sysU.ajax(ajaxConfig);
                    layer.close(index);
                }
            });
        },


        //完工
        btnCompletion: function (sU, toolbarId, obj) {
            debugger
            $("#CompletionOfProcess form")[0].reset();

            var checkStatus = table.checkStatus(toolbarId);
            if (checkStatus.data.length != 1) {
                layer.alert(sysU.config.titleSelectOne, { icon: sysU.config.iconoError, shadeClose: true, title: sysU.config.titleSelectOne });
                return;
            }
            if (checkStatus.data[0].workReportStatus > window.top.EnumWorkReportStatus["开工已报工"]) {
                layer.alert("当前工序已完工或者无需处理", { icon: 2, shadeClose: true, title: "错误提示" });
                return;
            }
            if (checkStatus.data[0].state < window.top.EnumOrderBodyStatus.生产中) {
                layer.alert("必须先开工在完工", { icon: 2, shadeClose: true, title: "错误提示" });
                return;
            }
            var checkData = checkStatus.data[0];
            var id = checkData.id;
            var headKeys = checkData.headKeys;
            if (checkData.actualEndTime == null) {
                $("#actualEndTime").val(new Date().format("yyyy-MM-dd hh:mm:ss"));
            } else {
                $("#actualEndTime").val(checkData.actualStartTime);
            }
            layer.open({
                type: 1,
                title: "完工,工序任务头表ID:【" + rowData.id + "】",
                content: $("#CompletionOfProcess"),
                btn: ['保存', '关闭'],
                area: ['400px', '300px'],
                yes: function (index, layero) {
                    var actualEndTime = document.getElementById("actualEndTime").value;
                    var ajaxConfig = {
                        data: {
                            headKeys: headKeys,
                            id: id,
                            actualEndTime: actualEndTime
                        },
                        url: `/${areaName}/${tableName}/WorkComplete`,
                        success: function (result) {
                            if (sysU.successBefore(result)) return;
                            layer.msg(result.Message, { icon: 6, shade: 0.4, time: sysU.config.msgOpenTimeLong });
                            layer.confirm(sysU.config.titleWorkReport, { icon: 3, title: '提示' }, function (idnex) {
                                var ajaxConfig = {
                                    data: { headKey: rowData.keys },
                                    url: `/${areaName}/${tableName}/WorkReport`,
                                    success: function (data) {
                                        console.info(data);
                                        if (sysU.successBefore(data)) return false;

                                        layer.confirm(data.Message, { icon: 3, title: '提示' }, function (index) {
                                            var ajaxConfig = {
                                                data: { headKey: rowData.keys, IsValdate: false },
                                                url: `/${areaName}/${tableName}/WorkReport`,
                                                success: function (result) {
                                                    if (sysU.successBefore(result)) return;
                                                    layer.msg(sysU.config.titleActionSuccess, { icon: sysU.config.iconoOk, shade: 0.4, time: sysU.config.msgOpenTime });
                                                    if (action["actionSuccess"] !== undefined) action["actionSuccess"].call(null, "Desc");
                                                }
                                            };
                                            sysU.ajax(ajaxConfig);
                                            layer.close(index);
                                        });
                                    }
                                };
                                sysU.ajax(ajaxConfig);
                            });
                            sysU.refreshTable(app, sysU, sendData, "btnCompletionDesc");
                        }
                    };
                    if (document.getElementById("actualEndTime").value == "") {
                        layer.alert(`请选择结束时间!`, { icon: sysU.config.iconoError, shadeClose: true, title: sysU.config.titleOpen });
                        return;
                    }

                    sysU.ajax(ajaxConfig);
                    layer.close(index);
                }
            });
        },

        //点击下拉框获取工位编码
        stationCodeFromEvent: function (data) {
            debugger
            if (data.value == "") {
                layer.msg("请选择工位");
                return false;
            }
            selectStationCodeVal = data.value;
            rowDataDetail["stationCode"] = selectStationCodeVal;
            app.methods.initGetEquipmentInfo(rowDataDetail);
        },

        qcCodePrintOptions: () => {
            var options = {
                qrCodeValueKey: "productHeaderCode",
                //【qrcodeElem】 是要修改的内容其他的不要变 id 的变量值不需要变 
                customFn: (sysU, parameter, selectData) => {
                    //qcCodeValue:产品编码#供应商编码#生产计划号#3位流水号
                    var supplierCode = "EZ8100";
                    for (var i = 0; i < selectData.length; i++) {
                        var qcCodeValue = `${selectData[i]["productHeaderCode"]}#${supplierCode}#${selectData[i]["planCode"]}#001`,
                            qrcodeId = "qrcode" + i,
                            qrcodeHeadId = "qrcodeHead" + i,
                            qrCodeElem = `<div  id="${qrcodeHeadId}"  class="qcCode"  style="width: 227px; height: 151px;">
                                              <div class="qr-head">
                                                 <div class="qr-head-log">
                                                    <label class="lal-padingLeft qr-font12">${supplierCode}</label>
                                                    <img src="../../../images/qr/leishaLogQr.png" style="width:70px; height: 23px;padding-right: 4px;"/>
                                                 </div>
                                                   <div class="qr-head-content">
                                                     <label class="lal-padingLeft qr-font12">${selectData[i]["productName"]}</label>
                                                     <label style="padding-right: 4px;">自制</label>
                                                 </div>
                                               </div>
                                                <div class="qr-body qrCode-flex" style="justify-content: space-between;">
                                                 <div class="qr-body-left qr-font12">
                                                    <label class="lal-padingLeft"  style="display: inline-block;padding-top:8px">${selectData[i]["productHeaderCode"]}</label>
                                                    <div class="qrCode-flex" style='margin-top: 20px;'>
                                                         <label style="display: inline-block;padding-top:8px" class="lal-padingLeft">${selectData[i]["planCode"]}</label> 
                                                         <label style="display: inline-block;padding-top:8px ;padding-left: 20px;">001</label>
                                                    </div>
                                                 </div>
                                                   <div class="qr-body-right">
                                                        <div id="${qrcodeId}" ></div>
                                                   </div>
                                               </div>
                                          </div>`;
                        parameter["width"] = 400;
                        parameter["height"] = 400;
                        sysU.qRCodeWirtDom(parameter, qrCodeElem, qrcodeId, qcCodeValue);
                        $(".qr-body-right img").css("height", 71);
                    }
                    return true;
                }
            }
            return options;
        },

        //操作记录
        btnOperationRecord: function (data, toolbarId) {
            var checkStatus = table.checkStatus(toolbarId);
            if (checkStatus.data.length != 1) {
                layer.alert(sysU.config.titleSelectOne, { icon: sysU.config.iconoError, shadeClose: true, title: sysU.config.titleSelectOne });
                return;
            }
            var workOrderHeadKeys = checkStatus.data[0].keys;
            var url = `/wo/BusWorkorderDetailOperation/Index?headKey=${workOrderHeadKeys}`;
            var index = layer.open({
                title: "操作记录-工单编码【" + checkStatus.data[0].workOrderCode + "】",
                type: 2,
                area: ['1000px', '600px'],
                content: url
            });
        },

        //所有动作成功之后
        actionSuccess: (falg, curr = 1) => {
            sysU.refreshTable(app, sysU, sendData, falg);
        }
    }

    app = {
        data: {
            cols: [[
                { checkbox: true, fixed: true },
                { field: "id", width: 80, hide: true, title: " id" },
                { field: "keys", width: 150, hide: true, title: "keys" },
                { field: "processHeadKeys", width: 150, hide: true, title: "工艺路线keys" },
                { field: "plmeId", width: 150, hide: true, title: "plmeId" },

                
                { field: "workOrderCode", width: 180, title: "工单编码", hide: true, },
                { field: 'planCode', width: 150, title: '生产计划号' },

                { field: 'projectCode', width: 150, title: '项目编码', hide: true, },
                { field: 'projectName', width: 150, title: '项目名称' },
                { field: "productHeaderCode", width: 150, title: "产品编码", hide: true },
                { field: "productName", width: 150, title: "产品名称" },
                { field: "lineCode", width: 150, hide: true, title: "产线编码", hide: true },

                { field: "lineName", width: 180, title: "线体", hide: true },
                { field: 'state', width: 100, title: '任务状态', templet: function (obj) { return "".GetState(window.top.EnumOrderHeadStatus, obj.state) } },
                { field: 'nowOprSequenceCode', width: 150, title: '当前工序', hide: true },
                { field: 'oprSequenceName', width: 150, title: '工序名称' },
                { field: 'nowStationCode', width: 100, title: '当前工位' },

                { field: 'nextOprSequenceCode', width: 150, title: '下个工序', hide: true },
                { field: 'nextStationCode', width: 100, title: '下个工位', hide: true },
                { field: 'isScrap', width: 100, title: '是否报废', templet: function (obj) { return obj.isScrap == true ? "是" : "否" } },
                { field: 'line_no', width: 100, title: '管线号' },
               


                { field: "planStartTime", width: 150, title: "计划开始时间" },
                { field: "planEndTime", width: 150, title: "计划结束时间" },
                { field: "actualStartTime", width: 150, title: "实际开始时间" },
                { field: "actualEndTime", width: 150, title: "实际结束时间" },
                { field: "otherOrderCode", width: 150, hide: true, title: "外部编码" },

                { field: "plmeId", width: 150, hide: true, title: "plmeId" },
                { field: "createTime", width: 150, title: "创建时间" },
                { field: "createBy", width: 150, title: "创建用户" },
                { field: "updateTime", width: 150, title: "更新时间" },
                { field: "updateBy", width: 150, title: "更新用户" }
            ]],
            colsDesc: [[
                { checkbox: true, fixed: true },
                { field: "id", width: 80, title: "id", hide: true },
                { field: "bodyKeys", width: 150, hide: true, title: "工单明细标识" },
                { field: "headKeys", width: 150, hide: true, title: "工单头标识" },
                { field: "serialNumber", width: 80, hide: true, title: "序号" },
                { field: "serialNumberName", width: 80, title: "序号" },
                
                { field: "workCenterCode", width: 100, title: "工作中心" },
                { field: "stationCode", width: 150, title: "工位编码" },
                { field: "oprSequenceCode", width: 150, hide: true, title: "工序编码" },
                { field: "oprSequenceName", width: 150, title: "工序名称" },

                { field: "equipmentCode", width: 150, title: "设备编码" },
                { field: "state", width: 100, title: "状态", templet: function (obj) { return "".GetState(window.top.EnumOrderBodyStatus, obj.state) } },
                { field: "workReportStatus", width: 100, title: "报工状态", templet: function (obj) { return "".GetState(window.top.EnumWorkReportStatus, obj.workReportStatus) } },

                { field: "weldNo", width: 100, title: "焊口号" },
                {
                    field: "materialCode", width: 250, title: "物料编码", templet: function (obj) {
                        if (obj.oprSequenceCode == "FitUp" || 
                            obj.oprSequenceCode == "Weld" || 
                            obj.oprSequenceCode == "FitUpAndWeld") {
                            return `管段:${obj.cutMaterCode}${obj.oprSequenceName}焊口:${obj.weldMaterCode}`;
                        }
                        return obj.cutMaterCode;
                    }
                },
                { field: "materialName", width: 150, title: "物料名称" },
                { field: "weldType", width: 100, title: "焊口形式" },
                { field: "cuttingLength", width: 120, title: "管段切割长度" },
                { field: "barCode", width: 100, title: "管段条码" },

                { field: "partCode", width: 100, hide: true, title: "管段号" },
                { field: "batchNo", width: 120, title: "批次号" },
                {
                    field: 'designUrl', width: 150, title: '图纸URL', event: "openBlank", templet: function (d) {
                        return `<a target="blank" href="#" data-href="${d.designUrl}" style="color: cornflowerblue;text-decoration: underline;cursor:pointer">${d.designUrl}</a>`;
                    }
                },
                { field: "designNo", width: 120, title: "图纸页码" },

                { field: "planStartTime", width: 150, title: "计划开始时间" },
                { field: "planEndTime", width: 150, title: "计划结束时间" },
                { field: "actualStartTime", width: 150, title: "实际开始时间" },
                { field: "actualEndTime", width: 150, title: "实际结束时间" },
                { field: "isRework", width: 100, title: "是否返工", templet: function (obj) { return obj.isRework == true ? "是" : "否" } },

                { field: "createTime", width: 150, title: "创建时间" },
                { field: "createBy", width: 150, title: "创建用户" },
                { field: "updateTime", width: 150, title: "更新时间" },
                { field: "updateBy", width: 150, title: "更新用户" }
            ]],
            urlTable: `/${areaName}/${tableName}/Load`,
            tableIns: null,
            tableInsDesc: null,
            tableElem: "mainList",
            tableElemDesc: "mainListDesc",

            tableInsComplete: null,
            tableElemComplete: "WorkOrderMaterialUseLog",
            colsComplete: [[
                { field: "id", width: 80, title: "id", hide: true },
                { field: "key", width: 80, title: "Keys", hide: true },
                { field: "materialCode", width: 150, title: "物料编码" },
                { field: "materialName", width: 150, title: "物料名称" },
                { field: "qyt", width: 80, title: "数量" },
                { field: "crux", width: 100, title: "精追件标识", templet: '#cruxLabel' },
                { field: "createTime", width: 170, title: "创建时间" },
                { field: "createBy", width: 150, title: "创建用户" },
                { field: "remarks", width: 150, title: "备注" },
                { fixed: 'right', title: '操作', width: 70, minWidth: 70, toolbar: '#MaterialUseLog' }
            ]],
            dataElemComplete: [],

            tableInsEquipmentProcessTemplate: null,
            tableElemEquipmentProcessTemplate: "mainListEquipmentProcessTemplate",
            colsEquipmentProcessTemplate: [[
                { field: "id", width: 80, title: "id", hide: true },
                { field: "key", width: 80, title: "key", hide: true },
                { field: "device_information", width: 150, title: "设备信息" },
                { field: "processing_steps", width: 150, title: "加工步骤" },
                { field: "processing_parameters", width: 150, title: "加工参数名称" },
                { field: "processing_results", width: 150, title: "加工参数执行结果" },

                { field: "createTime", width: 170, title: "创建时间" },
                { field: "createBy", width: 150, title: "创建用户" },
                { field: "remarks", width: 150, title: "备注" },
                { fixed: 'right', title: '操作', width: 70, minWidth: 70, toolbar: '#EquipmentProcessTemplate' }
            ]],
            dataElemEquipmentProcessTemplate: [],

            selectOption: {
                stationCode: {
                    SelType: "FromUrl",
                    SelFrom: "/configure/Station/LoadStationCodeByworkCenterCode",
                    SelLabel: "workStationName",
                    SelValue: "workStationCode",
                    Dom: [$("[name='stationCode']")]
                },
                //返回的数据 用于后续操作
                selectData: {

                }
            }
        },
        methods: {
            initTable: function (options) {
                var config = {};
                if (options != undefined) $.extend(config, options);
                let opt = {
                    cols: sysU.columnRecord(app.data.tableElem, app.data.cols),
                    elem: "#" + app.data.tableElem,
                    url: `/${areaName}/${tableName}/Load`,
                    toolbar: '#toolbarTable',
                    height: 'full-55',
                    where: config
                }
                app.data.tableIns = sysU.initTable(opt);
            },
            initTableDesc: function (obj) {
                sendData = { headKeys: obj.data.keys }
                let opt = {
                    cols: sysU.columnRecord(app.data.tableElemDesc, app.data.colsDesc),
                    elem: "#" + app.data.tableElemDesc,
                    url: `/${areaName}/${tableName}/LoadDesc`,
                    height: 'full-55',
                    toolbar: '#toolbarTableDesc',
                    limit: 0,
                    page: false,
                    where: sendData
                }
                app.data.tableInsDesc = sysU.initTable(opt);
            },
            initFrom: function () {

            },

            initVue: function () {
                vueApp = new Vue({
                    el: '#timeline',
                    data: {
                        oprTimeLineList: []
                    },
                    methods: {

                    }
                });
            },

            //工序物料消耗、设备工艺参数 文本下拉框表格
            initSelect() {
                var opt = {
                    elem: ".stationCodeTemp",
                    checkedKey: "keys",
                    doneKey: {
                        key: "keys",
                        lableValue: ""
                    },
                    searchKey: "materialCode",
                    searchName: "物料编码",
                    doneExtend: function (elem, data, $nowElem) {
                        for (var i = 0; i < data.data.length; i++) {
                            var selectData = {
                                id: data.data[i].id,
                                keys: data.data[i].keys,
                                materialCode: data.data[i].materialCode,

                                materialName: data.data[i].materialName,
                                qyt: data.data[i].qyt,
                                remarks: data.data[i].remarks,

                                createTime: data.data[i].createTime,
                                createBy: data.data[i].createBy
                            };
                            if (app.data.dataElemComplete.length > 0) {
                                var isExt = app.data.dataElemComplete.contains(selectData.materialCode, "materialCode");
                                if (isExt) {
                                    layer.alert(`工序任务物料消耗列表已存在相同的物料编码【${selectData.materialCode}】请不要重复添加!`, { icon: sysU.config.iconoError, shadeClose: true, title: sysU.config.titleOpen });
                                    return false;
                                }
                            }
                            app.data.dataElemComplete.push(selectData);
                        }

                        app.methods.initTableLocalMaterialUseLog(app.data.dataElemComplete);
                        element.tabChange("tabComplete", "1");
                    }
                };
                sysU.initMaterialUseLogSelect(opt);

                var opt1 = {
                    elem: ".device_information",
                    checkedKey: "keys",
                    doneKey: {
                        key: "keys",
                        lableValue: ""
                    },
                    searchKey: "device_information",
                    searchName: "设备编码",
                    doneExtend: function (elem, data, $nowElem) {
                        for (var i = 0; i < data.data.length; i++) {
                            var selectData = {
                                id: data.data[i].id,
                                keys: data.data[i].keys,
                                device_information: data.data[i].device_information,

                                processing_steps: data.data[i].processing_steps,
                                processing_parameters: data.data[i].processing_parameters,
                                processing_results: data.data[i].processing_results,

                                remarks: data.data[i].remarks,
                                createTime: data.data[i].createTime,
                                createBy: data.data[i].createBy
                            };
                            if (app.data.dataElemEquipmentProcessTemplate.length > 0) {
                                var isExt = app.data.dataElemEquipmentProcessTemplate.contains(selectData.device_information, "device_information");
                                if (isExt) {
                                    layer.alert(`设备工艺参数列表已存在相同的设备信息【${selectData.device_information}】请不要重复添加!`, { icon: sysU.config.iconoError, shadeClose: true, title: sysU.config.titleOpen });
                                    return false;
                                }
                            }
                            app.data.dataElemEquipmentProcessTemplate.push(selectData);
                        }
                        app.methods.initTableLocalEquipmentProcessTemplate(app.data.dataElemEquipmentProcessTemplate);
                        element.tabChange("tabComplete", "2");
                    }
                };
                sysU.initEquipmentProcessTemplateSelect(opt1);

            },


            //动态获取设备参数
            initGetEquipmentInfo: function (checkData) {
                var ajaxConfig = {
                    data: {
                        entity: checkData
                    },
                    url: `/${areaName}/${tableName}/GetEquipmentInfo`,
                    success: function (result) {
                        if (sysU.successBefore(result)) return;
                        if (result.Result[0] == null) {
                            app.data.dataElemEquipmentProcessTemplate = [];
                            app.methods.initTableLocalEquipmentProcessTemplate(app.data.dataElemEquipmentProcessTemplate);
                            return false;
                        }
                        app.data.dataElemEquipmentProcessTemplate = [];
                        for (var i = 0; i < result.Result.length; i++) {
                            app.data.dataElemEquipmentProcessTemplate.push(result.Result[0]);
                        }
                        app.methods.initTableLocalEquipmentProcessTemplate(app.data.dataElemEquipmentProcessTemplate);
                    }
                };
                sysU.ajax(ajaxConfig);
            },

            //动态获取物料消耗
            initGetMaterialInfo: function (checkData) {
                var ajaxConfig = {
                    data: {
                        entity: checkData
                    },
                    url: `/${areaName}/${tableName}/GetMaterialInfo`,
                    success: function (result) {
                        if (sysU.successBefore(result)) return;
                        if (result.Result[0] == null) {
                            app.data.dataElemComplete = [];
                            app.methods.initTableLocalMaterialUseLog(app.data.dataElemComplete);
                            return false;
                        }
                        app.data.dataElemComplete = [];
                        for (var i = 0; i < result.Result.length; i++) {
                            app.data.dataElemComplete.push(result.Result[i]);
                        }
                        app.methods.initTableLocalMaterialUseLog(app.data.dataElemComplete);
                    }
                };
                sysU.ajax(ajaxConfig);
            },

            initTableLocalMaterialUseLog: function (data, options) {
                var config = {};
                if (options != undefined) $.extend(config, options);
                let opt = {
                    cols: sysU.columnRecord(app.data.tableElemComplete, app.data.colsComplete),
                    elem: "#" + app.data.tableElemComplete,
                    data: data,
                    height: '356',
                    where: config
                }

                app.data.tableInsComplete = sysU.initTableLocal(opt);
                table.on(`tool(${app.data.tableElemComplete})`, function (obj) {
                    if (obj.event === "del") {
                        layer.confirm(`你确定删除【${obj.data.materialCode}】行么?`, function (index) {
                            app.data.dataElemComplete.removeByVal("id", obj.data.id);
                            obj.del();
                            layer.close(index);
                        });
                    }
                });
            },

            initTableLocalEquipmentProcessTemplate: function (data, options) {
                var config = {};
                if (options != undefined) $.extend(config, options);
                let opt = {
                    cols: sysU.columnRecord(app.data.tableElemEquipmentProcessTemplate, app.data.colsEquipmentProcessTemplate),
                    elem: "#" + app.data.tableElemEquipmentProcessTemplate,
                    data: data,
                    height: '356',
                    where: config
                }
                app.data.tableInsEquipmentProcessTemplate = sysU.initTableLocal(opt);
                table.on(`tool(${app.data.tableElemEquipmentProcessTemplate})`, function (obj) {
                    if (obj.event === "del") {
                        layer.confirm(`你确定删除【${obj.data.device_information}】行么?`, function (index) {
                            app.data.dataElemEquipmentProcessTemplate.removeByVal("id", obj.data.id);
                            obj.del();
                            layer.close(index);
                        });
                    }
                });
            }
        },
        registerEvent: function () {

        },

        init: function () {
            var sendDataWhere = form.val("listForm")
            app.methods.initTable(sendDataWhere);
            app.registerEvent();
            app.methods.initFrom();
            app.methods.initVue();

        }
    };
    app.init();
});