duhe
2024-11-20 3bd2c47598b8c6fca2c2fe5bebc280cb536dbae9
WebTM/views/¼Æ»®¹ÜÀí/¹¤ÒÕ·Ïß/Gy_RoutingBill.html
@@ -98,7 +98,7 @@
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">工艺路线名称<label style="color:red"> * </label></label>
                                            <label class="layui-form-label" style="width: 90px;">工艺路线名称*</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="text" class="layui-input" lay-verify="HName" name="HName" id="HName">
                                            </div>
@@ -109,7 +109,7 @@
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">产品代码*</label>
                                            <div class="layui-input-block" style="margin-left: 77px;">
                                                <input type="text" class="layui-input" lay-verify="HMaterNumber" name="HMaterNumber" id="HMaterNumber" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
                                                <input type="text" class="layui-input" lay-verify="HMaterNumber" name="HMaterNumber" id="HMaterNumber" style="width: 60%;display: inline-block;">
                                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearchMater" id="btnSearchMater" style="padding: 0 10px;float: right;margin-right: 3px;">
                                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                                </button>
@@ -133,7 +133,7 @@
                                    <div class="layui-row">
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">计量单位*</label>
                                            <div class="layui-input-block" style="margin-left: 77px;">
                                            <div class="layui-input-block" style="margin-left: 83px;">
                                                <input type="text" class="layui-input" name="HUnitName" lay-verify="HUnitName" id="HUnitName" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
                                                <input type="hidden" name="HUnitID" id="HUnitID" lay-verify="HUnitID" value="0">
                                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnUnit" id="btnUnit" style="padding: 0 10px;float: right;margin-right: 3px;">
@@ -145,17 +145,25 @@
                                            <label class="layui-form-label" style="width: 85px;">定额类型</label>
                                            <div class="layui-input-inline">
                                                <select name="HProcPriceType" id="HProcPriceType" lay-filter="HProcPriceType" style="width:200px;">
                                                    <option value="临时定额" selected="selected">临时定额</option>
                                                    <option value="永久定额">永久定额</option>
                                                    <option value="临时定额">临时定额</option>
                                                    <option value="永久定额" selected="selected">永久定额</option>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <div class="layui-input-block" style="margin-left: 96px;">
                                            <div class="layui-input-block" style="margin-left: 0px;">
                                                <input type="checkbox" name="checkboxHStandard" id="checkboxHStandard" lay-skin="primary" lay-filter="checkboxHStandard" checked title="是否默认工艺">
                                                <input type="hidden" value="true" name="HStandard" id="HStandard" lay-verify="HStandard">
                                                <!--<input type="checkbox" name="checkboxHUseFlag" id="checkboxHUseFlag" title="是否启用" lay-skin="primary" lay-filter="checkboxHUseFlag">
                                                <input type="hidden" value="false" name="HUseFlag" id="HUseFlag">-->
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">组织*</label>
                                            <div class="layui-input-block" style="margin-left: 120px; width: 501px;">
                                                <select name="HOrgID" id="HOrgID" lay-verify="HOrgID">
                                                    <!--动态渲染组织-->
                                                </select>
                                            </div>
                                        </div>
                                    </div>
@@ -173,13 +181,20 @@
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">开始日期</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="date" class="layui-input" lay-verify="HBeginDate" name="HBeginDate" id="HBeginDate" style="padding-left: 80px;">
                                                <input type="date" class="layui-input" lay-verify="HBeginDate" name="HBeginDate" id="HBeginDate" style="padding-left: 20px;">
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">失效日期</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="date" class="layui-input" lay-verify="HEndDate" name="HEndDate" id="HEndDate" style="padding-left: 80px;">
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">备注</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="hidden" class="layui-input" name="HMaker" id="HMaker" lay-verify="HMaker" value="">
                                                <input type="text" class="layui-input" name="HRemark" id="HRemark" lay-verify="HRemark" placeholder="请输入内容" onmouseover="this.title=this.value" style=" width: 500px;">
                                            </div>
                                        </div>
                                        <!--<div class="layui-inline">
@@ -248,26 +263,26 @@
                                        </div>-->
                                    </div>
                                    <div class="layui-row">
                                        <div class="layui-inline">
                                        <!--<div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">备注</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="hidden" class="layui-input" name="HMaker" id="HMaker" lay-verify="HMaker" value="">
                                                <input type="text" class="layui-input" name="HRemark" id="HRemark" lay-verify="HRemark" placeholder="请输入内容" onmouseover="this.title=this.value" style=" width: 500px;">
                                            </div>
                                        </div>
                                        </div>-->
                                    </div>
                                    <div class="layui-row">
                                        <div class="layui-inline">
                                        <!--<div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">组织*</label>
                                            <div class="layui-input-block" style="margin-left: 120px; width: 501px;">
                                                <select name="HOrgID" id="HOrgID" lay-verify="HOrgID">
                                                <select name="HOrgID" id="HOrgID" lay-verify="HOrgID">-->
                                                    <!--动态渲染组织-->
                                                </select>
                                                <!--</select>
                                            </div>
                                        </div>
                                        </div>-->
                                    </div>
                                </div>
                            </div>
@@ -318,7 +333,7 @@
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">关闭人</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="text" class="layui-input" name="" id="" style="background-color:#efefef4d;" readonly>
                                                <input type="text" class="layui-input" name="hcloser" id="hcloser" style="background-color:#efefef4d;" readonly>
                                            </div>
                                        </div>
                                        <div class="layui-inline">
@@ -338,7 +353,7 @@
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">关闭日期</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="text" class="layui-input" name="" id="" style="background-color:#efefef4d;" readonly>
                                                <input type="text" class="layui-input" name="hclosedate" id="hclosedate" style="background-color:#efefef4d;" readonly>
                                            </div>
                                        </div>
                                        <div class="layui-inline">
@@ -523,6 +538,12 @@
    </script>
    <script>
        //#region æ–‡æœ¬æ¡†è¾“入搜索相关数据-变量
        var childPage = null;                       //获取子窗口对象,用于操作子窗口的变量和方法
        var currRowIndex = 0;                       //用于定位子窗口当前选中的行
        var childData = null;                       //用于获取子窗口返回的数据
        //#endregion
        var OptionData = [];
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
@@ -545,7 +566,7 @@
            //初始表格数据
            var rowdata = [{
                "HProcNo": "10", "HProcID_S": 0, "HProcType": "主工序", "HCenterID_S": 0, "HCenterID_SName": ""
                "HProcNo": "10", "HProcID_S": 0, "HProcType": "主工序", "HCenterID_S": 0, "HCenterID_SName": "","工序代码":""
                , "HWorkQty_S": 0, "HSubStdEmpQty_S": 0, "HMouldNo": "", "HChangeMould": 0, "HPackStd": ""
                , "HPack": "", "HPutArea": "", "HMyWorkDays": 0, "HMyFixWorkDays": 0, "工序": "","工段":""
                , "HProcID": 0, "工作中心代码": "", "HCenterID": 0, "工作中心": "", "HSupID": 0
@@ -573,12 +594,13 @@
                , limit: 500 //每页默认显示的数量
                , totalRow: true
                //, cellMinWidth: 120
                , height: 400
                , height: 450
                , cols: [[ //表头
                    { type: 'checkbox', totalRowText: '合计行' }
                    , { type: 'numbers', field: '序号', title: '序号', totalRow: true }
                    , { field: 'HProcNo', title: '流水号', edit: 'text' }
                     , { field: 'HProcID', title: '工序ID', hide: true }//, hide: true
                    , { field: 'HProcID', title: '工序ID', hide: true }//, hide: true
                    , { field: '工序代码', title: '工序代码'}
                    , { field: '工序', title: '工序', edit: 'text', event: "CheckHProcID" }//f7
                    , { field: 'HProcID_S', title: '工段ID', hide: true }//, hide: true
                    , { field: '工段', title: '工段', edit: 'text', event: "CheckHProcMulID" }//f7
@@ -783,6 +805,120 @@
            //#endregion
            //#region è§¦å‘事件:包括form.on(){}格式的所有点击事件、选择事件等
            //#region è¡¨å¤´åŸºç¡€èµ„料选择弹窗
            //#region æ–‡æœ¬æ¡†ç›‘听
            $(document).ready(function () {
                //#region æ ¹æ®ç‰©æ–™ä»£ç èŽ·å–ç‰©æ–™åŸºç¡€èµ„æ–™ç­›é€‰å¼¹çª—
                //根据元素ID对元素进行监听=============================================================================
                $("#HMaterNumber").on('keydown', function (data) {
                    //================================================================================================
                    var errKeys = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Enter"];
                    if ($.inArray(event.key, errKeys) == -1) {              //如果按下的键位不是 æ–¹å‘键,则刷新弹窗中的数据
                        if (childPage == null) {                            //判断当前子窗口是否已经打开,若未打卡,则打开页面,并获取子窗口的对象
                            var offset = $(this).offset();                  //获取触发事件的元素的位置,用于定位子窗口打开的位置
                            var innerHeight = window.innerHeight;
                            var top = offset.top + 0.05 * innerHeight;
                            var left = offset.left;
                            if (top + 0.05 * innerHeight + 0.3 * innerHeight > innerHeight) {
                                top = top - 0.3 * innerHeight - 0.05 * innerHeight;
                            }
                            layer.open({
                                type: 2                                                                                     //弹窗类型
                                , skin: 'layui-layer-rim'                                                                   //加上边框
                                , area: ['25%', '30%']                                                                      //大小
                                , shadeClose: true                                                                          //点击遮罩时关闭弹窗
                                , offset: [top, left]
                                , title: false                                                                              //不显示标题栏
                                //, title: '项目费用列表'                                                                     //标题
                                , shift: 2                                                                                  //弹出动画
                                , closeBtn: 0                                                                               //禁用关闭按钮
                                , content: ["../../基础资料/通用基础资料/Gy_CommonBaseData.html?OperationType=2", "yes"]
                                , success: function (layero, index) {
                                    setTimeout(function () {
                                        //修改,根据文本框数据,编写查询语句================================================================================================
                                        var value = $("#HMaterNumber").val().replace(/'/g, "");                                  //获取文本框最新值
                                        currRowIndex = 0;
                                        var tableView = "h_v_Gy_MaterialList";
                                        var childSWhere = "select top(10) HItemID,物料代码,物料名称,规格型号,HUnitID,计量单位名称 from " + tableView + " where 1=1 and ç»„织名称 = '" + sessionStorage["Organization"] + "' and (物料代码 like '%" + value + "%' or ç‰©æ–™åç§° like '%" + value + "%') order by ç‰©æ–™ä»£ç  desc";
                                        childPage.getData(childSWhere, tableView);
                                        //===================================================================================================================================
                                    }, 200);
                                }
                                , end: function () {
                                    childPage = null;
                                    currRowIndex = 0;
                                    if (childData != null) {
                                        //根据弹窗返回数据设置文本框数据=================================================================================================
                                        //获取数据
                                        $("#HMaterID").val(childData.HItemID);//物料id
                                        $("#HMaterName").val(childData.物料名称);//物料名称
                                        $("#HMaterNumber").val(childData.物料代码);//物料代码
                                        $("#HMaterModel").val(childData.规格型号);//规格型号
                                        $("#HUnitID").val(childData.HUnitID);//计量单位id
                                        $("#HUnitName").val(childData.计量单位名称);//计量单位名称
                                        if ($("#HName").val() == "") {
                                            $("#HName").val(childData.物料代码);
                                        }
                                        //===============================================================================================================================
                                        childData = null;
                                    }
                                }
                            });
                        } else {
                            setTimeout(function () {
                                //修改,根据文本框数据,编写查询语句================================================================================================
                                var value = $("#HMaterNumber").val().replace(/'/g, "");                                  //获取文本框最新值
                                currRowIndex = 0;
                                var tableView = "h_v_Gy_MaterialList";
                                var childSWhere = "select top(10) HItemID,物料代码,物料名称,规格型号,HUnitID,计量单位名称 from " + tableView + " where 1=1 and ç»„织名称 = '" + sessionStorage["Organization"] + "' and (物料代码 like '%" + value + "%' or ç‰©æ–™åç§° like '%" + value + "%') order by ç‰©æ–™ä»£ç  desc";
                                childPage.getData(childSWhere, tableView);
                                //=================================================================================================================================
                            }, 200);
                        }
                    } else {                                                    //如果按下的键位是 æ–¹å‘键,则调整窗口中 é€‰ä¸­è¡Œ çš„位置
                        if (event.key == "ArrowUp") {
                            currRowIndex--;
                            childPage.setSelectedRow(currRowIndex);
                        } else if (event.key == "ArrowDown") {
                            currRowIndex++;
                            childPage.setSelectedRow(currRowIndex);
                        } else if (event.key == "Enter") {
                            //手动失焦
                            var element = document.getElementById("HMaterNumber");
                            element.blur();
                            childPage.getSelectedData(currRowIndex);
                            if (childData != null) {
                                //根据弹窗返回数据设置文本框数据=================================================================================================
                                //获取数据
                                $("#HMaterID").val(childData.HItemID);//物料id
                                $("#HMaterName").val(childData.物料名称);//物料名称
                                $("#HMaterNumber").val(childData.物料代码);//物料代码
                                $("#HMaterModel").val(childData.规格型号);//规格型号
                                $("#HUnitID").val(childData.HUnitID);//计量单位id
                                $("#HUnitName").val(childData.计量单位名称);//计量单位名称
                                if ($("#HName").val() == "") {
                                    $("#HName").val(childData.物料代码);
                                }
                                //===============================================================================================================================
                                childData = null;
                            }
                            childPage = null;
                            currRowIndex = 0;
                            childData = null;
                        }
                    }
                });
                //#endregion
            });
            //#endregion
            //#endregion
            //选择产品代码按钮
            form.on('submit(btnSearchMater)', function () {
@@ -824,7 +960,12 @@
            });
            //禁用其它
            form.on('submit(set_closeOtherRoute)', function (data) {
                set_closeOtherRoute(data);
                if ($("#hcloser").val() != '') {
                    layer.alert("单据已被关闭无法关闭其它!", { icon: 5 });
                } else {
                    set_closeOtherRoute(data);
                }
            });
            //审核
@@ -1440,6 +1581,8 @@
                    layer.confirm('真的删除行吗?', function (index) {
                        if (rowIndex === '0') {
                            layer.msg('首行无法删除!!!');
                        } else if (table.cache["mainTable"][obj.tr.data('index')].HProcNo == "9999") {
                            layer.msg('系统转工序,不允许删除!!!');
                        } else {
                            var oldData = table.cache["mainTable"];
                            oldData.splice(obj.tr.data('index'), 1)
@@ -1822,6 +1965,7 @@
                                        var j = 0;
                                        for (var i = (NowNum - 1); i < option.data.length; i++) {
                                            option.data[i]["工序"] = WorkCente[j]["工序名称"];
                                            option.data[i]["工序代码"] = ProcessNumber[j].substring(1, ProcessNumber[j].length - 1);
                                            option.data[i]["HProcID"] = WorkCente[j]["HProcID"];
                                            option.data[i]["工作中心"] = WorkCente[j]["工作中心名称"];
                                            option.data[i]["HCenterID"] = WorkCente[j]["HCenterID"];
@@ -1834,7 +1978,7 @@
                                        //在下方添加新的表格数据
                                        for (var i = 0; i < num; i++) {
                                            option.data.push({
                                                "HProcNo": (table.cache["mainTable"].length + i + 1) * 10, "HProcID_S": 0, "HProcType": "主工序", "HCenterID_S": 0, "HCenterID_SName": ""
                                                "HProcNo": (table.cache["mainTable"].length + i + 1) * 10, "HProcID_S": 0, "HProcType": "主工序", "HCenterID_S": 0, "HCenterID_SName": "", "工序代码": ProcessNumber[j].substring(1, ProcessNumber[j].length - 1)
                                                , "HWorkQty_S": 0, "HSubStdEmpQty_S": 0, "HMouldNo": "", "HChangeMould": 0, "HPackStd": ""
                                                , "HPack": "", "HPutArea": "", "HMyWorkDays": 0, "HMyFixWorkDays": 0, "工序": WorkCente[j]["工序名称"]
                                                , "HProcID": WorkCente[j]["HProcID"], "工作中心代码": WorkCente[j]["工作中心代码"], "HCenterID": WorkCente[j]["HCenterID"], "工作中心": WorkCente[j]["工作中心名称"], "HSupID": 0
@@ -1858,6 +2002,7 @@
                                        var j = 0;
                                        for (var i = (NowNum - 1); i < (NowNum - 1) + ProcessNumber.length; i++) {
                                            option.data[i]["工序"] = WorkCente[j]["工序名称"];
                                            option.data[i]["工序代码"] = ProcessNumber[j].substring(1, ProcessNumber[j].length - 1);
                                            option.data[i]["HProcID"] = WorkCente[j]["HProcID"];
                                            option.data[i]["工作中心"] = WorkCente[j]["工作中心名称"];
                                            option.data[i]["HCenterID"] = WorkCente[j]["HCenterID"];
@@ -1889,6 +2034,7 @@
                                        //更新表格缓存的数据
                                        obj.update({
                                            "工序": OptionData[0].工序名称
                                            , "工序代码": OptionData[0].工序代码
                                            , "HProcID": OptionData[0].HItemID
                                            , "工作中心": OptionData[0].工作中心
                                            , "HCenterID": OptionData[0].HWorkCenterID
@@ -2230,7 +2376,7 @@
                            , "HDate": Format(new Date(d.data[0].日期), "yyyy-MM-dd")
                            , "HBeginDate": Format(new Date(d.data[0].生效时间), "yyyy-MM-dd")
                            , "HEndDate": Format(new Date(d.data[0].失效时间), "yyyy-MM-dd")
                            , "HName": d.data[0].工艺名称
                            , "HName": OperationType == 2 ? "" : d.data[0].工艺名称
                            , "HMaterNumber": OperationType == 2 ? "" : d.data[0].物料代码
                            , "HMaterName": OperationType == 2 ? "" : d.data[0].物料名称
                            , "HMaterID": OperationType == 2 ? "" : d.data[0].HMaterID
@@ -2268,6 +2414,8 @@
                            , "hupdatedate": d.data[0].修改日期 == null ? "" : Format(new Date(d.data[0].修改日期), "yyyy-MM-dd")
                            , "hdeleteman": d.data[0].作废人
                            , "hdeletedate": d.data[0].作废日期 == null ? "" : Format(new Date(d.data[0].作废日期), "yyyy-MM-dd")
                            , "hcloser": d.data[0].关闭人
                            , "hclosedate": d.data[0].关闭日期 == null ? "" : Format(new Date(d.data[0].关闭日期), "yyyy-MM-dd")
                        });
                        //子表  èµ‹å€¼
@@ -2276,7 +2424,7 @@
                        for (var i = 0; i < d.data.length; i++) {
                            rowdata.push(
                                {
                                    "HProcNo": d.data[i].工序号, "HProcID_S": d.data[i].工段, "HProcType": d.data[i].工序类型, "HCenterID_S": d.data[i].HCenterID_S, "HCenterID_SName": d.data[i].产线中心
                                    "HProcNo": d.data[i].工序号, "HProcID_S": d.data[i].工段, "HProcType": d.data[i].工序类型, "HCenterID_S": d.data[i].HCenterID_S, "HCenterID_SName": d.data[i].产线中心, "工序代码": d.data[i].工序代码
                                    , "HWorkQty_S": d.data[i].产线产能, "HSubStdEmpQty_S": d.data[i].产线人数, "HMouldNo": d.data[i].模具编号, "HChangeMould": d.data[i].换模时间, "HPackStd": d.data[i].周转箱标准
                                    , "HPack": d.data[i].周转箱, "HPutArea": d.data[i].暂放区, "HMyWorkDays": d.data[i].生产周期, "HMyFixWorkDays": d.data[i].固定生产天数, "工序": d.data[i].工序, "工段": d.data[i].工段名称
                                    , "HProcID": d.data[i].HProcID, "工作中心代码": d.data[i].工作中心代码, "HCenterID": d.data[i].HCenterID, "工作中心": d.data[i].工作中心名称, "HSupID": d.data[i].HSupID
@@ -2343,12 +2491,15 @@
            //保存HMaker
            function set_AddNew(data) {
                data.field.HMaterModel = data.field.HMaterModel.replace("\"", "”").replace(";", ";");
                data.field.HMaterName = data.field.HMaterName.replace("\"", "”").replace(";", ";");
                var num = [];
                for (var i = 0; i < table.cache["mainTable"].length; i++) {
                    if (table.cache["mainTable"][i] != "") {
                        table.cache["mainTable"][i].LAY_TABLE_INDEX = i;
                        num.push(table.cache["mainTable"][i])
                    }
                    }
                }
                data.field.HPRDORGID = sessionStorage["OrganizationID"];//组织
@@ -2612,6 +2763,10 @@
                            dataCol = data1.data[0].HGridString.split(',');
                            for (var i = 0; i < option.cols[0].length - 2; i++) {
                                if (i >= dataCol.length) {
                                    continue;
                                }
                                var dataCols = dataCol[i].split('|');
                                //隐藏列
                                if (dataCols[1] == 1) {