llj
4 天以前 fa6b4555eded285c8917480ab09f519f1f280667
出运单修改
2个文件已修改
482 ■■■■ 已修改文件
WebTM/views/物流管理/运输定位/Add_Edit_WL_YayBill.html 371 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/views/物流管理/运输定位/WL_YayBill.html 111 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/views/ÎïÁ÷¹ÜÀí/ÔËÊ䶨λ/Add_Edit_WL_YayBill.html
@@ -255,6 +255,14 @@
                                            </div>
                                            <div class="layui-inline">
                                                <label class="layui-form-label" style="width: 85px;">
                                                    æ±‡çއ
                                                </label>
                                                <div class="layui-input-block" style="margin-left: 120px;">
                                                    <input class="layui-input" name="HExRate" id="HExRate" autocomplete="off" value="0" style="background-color: #efefef4d;" readonly>
                                                </div>
                                            </div>
                                            <div class="layui-inline">
                                                <label class="layui-form-label" style="width: 85px;">
                                                    è¿è¾“费用
                                                </label>
                                                <div class="layui-input-block" style="margin-left: 120px;">
@@ -305,7 +313,8 @@
                                                <div class="layui-input-block" style="margin-left: 120px; width: 501px;" readonly>
                                                    <select name="HTransType" id="HTransType" lay-verify="HTransType" style="background-color:#efefef4d;">
                                                        <option value="零单">零单 </option>
                                                        <option value="整车">整车</option>
                                                        <option value="单程">单程</option>
                                                        <option value="往返">往返</option>
                                                    </select>
                                                </div>
                                            </div>
@@ -782,11 +791,11 @@
            //行内事件
            table.on('edit(mainTable)', function (obj) {
                var field = obj.field; // å¾—到字段
                var data = obj.data; // å¾—到所在行所有键值
                // å¦‚果编辑的是容器尺寸相关的字段,重新计算总体积
                var field = obj.field;
                var data = obj.data;
                if (field === 'HMouldLength' || field === 'HMouldWidth' || field === 'HMouldHeight' ||
                    field === 'HMouldFoldHeight') {
                    field === 'HMouldFoldHeight' || field ==='HMouldQty') {
                    var newVolume = calculateRowVolume(data);
                    obj.update({
                        HVolume: newVolume
@@ -794,7 +803,7 @@
                    calculateTotalVolume();
                }
                if (field === 'HQty') {
                    // ç¡®ä¿è¾“入的是数字
                    var newValue = parseFloat(obj.value);
                    if (isNaN(newValue)) {
                        newValue = 0;
@@ -802,7 +811,7 @@
                            HQty: 0
                        });
                    }
                    // æ£€æŸ¥æ˜¯å¦è¶…出源单数量
                    checkTotalQtyExceed();
                    var mouldQty = calculateMouldQty(data);
@@ -811,16 +820,16 @@
                    });
                }
                if (field === 'HSNP') {
                    // ç¡®ä¿è¾“入的是数字
                    var newValue = parseFloat(obj.value);
                    if (isNaN(newValue) || newValue <= 0) {
                        newValue = 1; // é»˜è®¤å€¼è®¾ä¸º1,避免除零错误
                        newValue = 1;
                        obj.update({
                            HSNP: 1
                        });
                    }
                    // è‡ªåŠ¨è®¡ç®—åŒ…è£…å®¹å™¨æ•°é‡
                    var mouldQty = calculateMouldQty(data);
                    obj.update({
                        HMouldQty: mouldQty
@@ -837,11 +846,11 @@
                    var field = $(this).data('field');
                    laydate.render({
                        elem: this.firstChild
                        , show: true //直接显示
                        , show: true
                        , closeStop: this
                        , done: function (nowDate) {
                            var index = obj.tr.data('index');
                            //时间选择完成,行数据更新
                            data[field] = nowDate;
                            obj.update(data);
                            $('#HHCalibrationStatus' + (index + 1)).find("option[value='" + data.HHCalibrationStatus + "']").attr("selected", true);
@@ -855,11 +864,11 @@
                    var field = $(this).data('field');
                    laydate.render({
                        elem: this.firstChild
                        , show: true //直接显示
                        , show: true
                        , closeStop: this
                        , done: function (nowDate) {
                            var index = obj.tr.data('index');
                            //时间选择完成,行数据更新
                            data[field] = nowDate;
                            obj.update(data);
                            $('#HHCalibrationStatus' + (index + 1)).find("option[value='" + data.HHCalibrationStatus + "']").attr("selected", true);
@@ -877,7 +886,7 @@
                layer.open({
                    type: 2,
                    skin: 'layui-layer-rim', //加上边框
                    title: '部门列表',
                    title: '承运商列表',
                    closeBtn: 1,
                    shift: 2,
                    area: ['80%', '80%'],
@@ -1025,16 +1034,17 @@
            //车型弹窗
            form.on('submit(HCarTypeList)', function () {
                var HTotalVolume = $("#HTotalVolume").val()
                //页面层-自定义
                layer.open({
                    type: 2,
                    skin: 'layui-layer-rim', //加上边框
                    title: 'che列表',
                    title: '车型列表',
                    closeBtn: 1,
                    shift: 2,
                    area: ['80%', '80%'],
                    maxmin: true,
                    content: ['../../基础资料/基础资料/Gy_CarTypeList.html?', 'yes'],
                    content: ['../../基础资料/基础资料/Gy_CarTypeList.html?openType=' + HTotalVolume+'&HOrgName=' + sessionStorage["OrganizationID"], 'yes'],
                    btn: ['确定', '取消']
                    , btn1: function (index, layero) {
@@ -1065,6 +1075,9 @@
            //合同弹窗
            form.on('submit(HContractList)', function () {
                var HEndAddr = $("#HEndAddr").val();
                var HBeginAddr = $("#HBeginAddr").val();
                //页面层-自定义
                layer.open({
                    type: 2,
@@ -1074,7 +1087,7 @@
                    shift: 2,
                    area: ['80%', '80%'],
                    maxmin: true,
                    content: ['../../基础资料/公用基础资料/Cg_ContractTransportBillList.html?', 'yes'],
                    content: ['../../基础资料/公用基础资料/Cg_ContractTransportBillList.html?openType=' + HEndAddr + '&HOrgName=' + sessionStorage["OrganizationID"] + '&HBeginAddr=' + HBeginAddr, 'yes'],
                    btn: ['确定', '取消']
                    , btn1: function (index, layero) {
@@ -1095,6 +1108,9 @@
                        $("#HCurID").val(checkStatus.data[0].币别);
                        $("#HCurName").val(checkStatus.data[0].币别名称);
                        $("#HMoney").val(checkStatus.data[0].运输费用);
                        $("#HExRate").val(checkStatus.data[0].汇率);
                        $("#HCarrierID").val(checkStatus.data[0].HSupID);
                        $("#HCarrierName").val(checkStatus.data[0].供应商名称);
                        layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) {
@@ -1211,6 +1227,8 @@
                        var HCusID = $("#HCusID").val();//判断客户
                        if (HCusID == 0 || HCusID == '') {
                            HCusID = checkStatus.data[0]["HCusID"];
                            $("#HCusID").val(checkStatus.data[0]["HCusID"]);
                            $("#HCusName").val(checkStatus.data[0]["客户"]);
                        }
                        for (var i = 0; i < checkStatus.data.length; i++) {
                            if (checkStatus.data[i]["HCusID"] != HCusID) {
@@ -1227,36 +1245,115 @@
                })
            }
            //#endregion
            //#region é€‰æ‹©æºå•-发货通知单
            function setInitBySeOutStockBill(checkStatus) {
                var dataArray = [];
            //#region é€‰æ‹©æºå•
            function get_checkMainSource() {
                var HOrgID = $("#HOrgID").val();
                var url = "../../销售管理/发货通知单/Xs_SeOutStockBillList.html?openType=2&HOrgID=" + HOrgID;
                layer.open({
                    type: 2//弹窗类型
                    , skin: 'layui-layer-rim' //加上边框
                    , area: ['90%', '90%']//大小
                    , title: '源单列表'//标题
                    , shift: 2//弹出动画
                    , content: [url, 'yes']
                    , btn: ['确定', '取消']
                    , btn1: function (index, layero) {//按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                        var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
                        if (checkStatus.data.length === 0) {
                            return layer.msg('请选择数据');
                        }
                        var HCusID = $("#HCusID").val();//判断客户
                        if (HCusID == 0 || HCusID == '') {
                            HCusID = checkStatus.data[0]["HCusID"];
                            $("#HCusID").val(checkStatus.data[0]["HCusID"]);
                            $("#HCusName").val(checkStatus.data[0]["客户"]);
                        }
                        for (var i = 0; i < checkStatus.data.length; i++) {
                            if (checkStatus.data[i]["HCusID"] != HCusID) {
                                layer.msg("下推失败!已经选中的记录中存在不同客户!");
                                layer.close(index);
                                return;
                            }
                        }
                        // æ£€æŸ¥æ–°é€‰æ‹©çš„æºå•是否已经在子表中存在
                        var isDuplicate = checkDuplicateSource(checkStatus.data);
                        if (isDuplicate) {
                            layer.msg("选择的源单中已存在重复记录,请勿重复选择!", { icon: 5 });
                            layer.close(index);
                            return;
                        }
                        appendInitBySeOutStockBill(checkStatus);
                        layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) { }
                })
            }
            //#endregion
            //#region æ£€æŸ¥æºå•是否已经在子表中存在
            function checkDuplicateSource(newSourceData) {
                var currentTableData = table.cache['mainTable'] || [];
                for (var i = 0; i < newSourceData.length; i++) {
                    var newSourceInterID = newSourceData[i].hmainid;
                    var newSourceEntryID = newSourceData[i].hsubid;
                    for (var j = 0; j < currentTableData.length; j++) {
                        var existingSourceInterID = currentTableData[j].HSourceInterID;
                        var existingSourceEntryID = currentTableData[j].HSourceEntryID;
                        if (existingSourceInterID == newSourceInterID &&
                            existingSourceEntryID == newSourceEntryID) {
                            return true; // å­˜åœ¨é‡å¤
                        }
                    }
                }
                return false; // æ— é‡å¤
            }
            //#endregion
            //#region é€‰æ‹©æºå•-发货通知单
            function appendInitBySeOutStockBill(checkStatus) {
                var dataArray = [];
                for (var i = 0; i < checkStatus.data.length; i++) {
                    var temp = getPushSeOutStockBillInit(checkStatus.data[i].hmainid, checkStatus.data[i].hsubid);
                    if (temp != "none") {
                        dataArray.push(temp);
                        //if (temp.状态 != "已审核") {
                        //    layer.msg("下推失败!单据号【" + temp.单据号 + "】单据状态不为已审核状态!");
                        //    return;
                        //}
                        //if (temp.行状态 == "已关闭") {
                        //    layer.msg("下推失败!单据号【" + temp.单据号 + "】下选中的记录中存在已关闭状态的记录!");
                        //    return;
                        //}
                        //if (temp.关闭人 != "") {
                        //    layer.msg("下推失败!单据号【" + temp.单据号 + "】下选中的记录中存在已关闭状态的记录!");
                        //    return;
                        //}
                    } else {
                        return;
                    }
                }
                var ListMaterial = dataArray[0].HMaterID;
                for (var i = 1; i < dataArray.length; i++) {
                    ListMaterial = ListMaterial + ";" + dataArray[i].HMaterID;
                var existingData = table.cache['mainTable'] || [];
                var orginHQTY = 0;
                var materialMap = {};
                for (var i = 0; i < dataArray.length; i++) {
                    orginHQTY = dataArray[i].数量;
                    var materialId = dataArray[i].HMaterID;
                    if (!materialMap[materialId]) {
                        materialMap[materialId] = [];
                }
                    materialMap[materialId].push({
                        hmainid: dataArray[i].hmainid,
                        hsubid: dataArray[i].hsubid,
                        å•据号: dataArray[i].单据号
                    });
                }
                var ListMaterial = "";
                for (var materialId in materialMap) {
                    if (ListMaterial) ListMaterial += ";";
                    ListMaterial += materialId;
                }
                if (!ListMaterial) {
                    layer.msg("没有找到物料信息!");
                    return;
                }
                $.ajax({
                    url: GetWEBURL() + "/WLYayBillController/GetMesByOrginBill",
                    async: false,
@@ -1265,47 +1362,99 @@
                        "ListMaterial": ListMaterial
                    },
                    success: function (result) {
                        if (result.code == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                        if (result.code == 1) {
                            res = result.data;
                            var rowdata = [];
                            var newRows = [];
                            for (var materialId in materialMap) {
                                var sourceInfos = materialMap[materialId];
                                var materialInfo = null;
                            for (var i = 0; i < res.length; i++) {
                                for (var j = 0; j < dataArray.length; j++) {
                                    var qty = res[i].HSNP || 0;
                                    var snp = res[i].HSNP || 1; // é»˜è®¤æ ‡å‡†åŒ…装数量为1
                                    if (res[i].HMaterID == materialId) {
                                        materialInfo = res[i];
                                        break;
                                    }
                                }
                                if (materialInfo) {
                                    for (var j = 0; j < sourceInfos.length; j++) {
                                        var sourceInfo = sourceInfos[j];
                                        var isExist = false;
                                        for (var k = 0; k < existingData.length; k++) {
                                            if (existingData[k].HSourceInterID == sourceInfo.hmainid &&
                                                existingData[k].HSourceEntryID == sourceInfo.hsubid) {
                                                isExist = true;
                                                break;
                                            }
                                        }
                                        if (isExist) {
                                            layer.msg(`源单${sourceInfo.单据号}已存在,跳过`);
                                            continue;
                                        }
                                        // è®¡ç®—相关数量
                                        var qty = materialInfo.HSNP || 0;
                                        var snp = materialInfo.HSNP || 1;
                                    var mouldQty = snp > 0 ? Math.ceil(qty / snp) : 0;
                                    var length = parseFloat(res[i].长度) || 0;
                                    var width = parseFloat(res[i].宽度) || 0;
                                    var height = parseFloat(res[i].高度) || 0;
                                    var rowVolume = (length * width * height).toFixed(2);
                                    rowdata.push(
                                        {
                                            "HSourceInterID": dataArray[j].hmainid, "HSourceEntryID": dataArray[j].hsubid, "HSourceBillNo": dataArray[j].单据号, "HMaterID": res[i].HMaterID, "HMaterNumber": res[i].物料代码, "HMaterName": res[i].物料名称,
                                            "HUnitID": res[i].HUnitID, "HMouldID": res[i].HMouldID, "HMouldNumber": res[i].HMouldNumber, "HMouldName": res[i].HMouldName,
                                            "HMouldLength": res[i].长度, "HMouldWidth": res[i].宽度, "HMouldHeight": res[i].高度, "HMouldFoldHeight": res[i].折叠高度, "HQty": res[i].HSNP, "HQty_origin": res[i].HSNP, "HMouldQty": mouldQty, "HVolume": rowVolume
                                        var length = parseFloat(materialInfo.长度) || 0;
                                        var width = parseFloat(materialInfo.宽度) || 0;
                                        var height = parseFloat(materialInfo.高度) || 0;
                                        var rowVolume = (length * width * height * mouldQty).toFixed(2);
                                        newRows.push({
                                            "HSourceInterID": sourceInfo.hmainid,
                                            "HSourceEntryID": sourceInfo.hsubid,
                                            "HSourceBillNo": sourceInfo.单据号,
                                            "HMaterID": materialInfo.HMaterID,
                                            "HMaterNumber": materialInfo.物料代码,
                                            "HMaterName": materialInfo.物料名称,
                                            "HUnitID": materialInfo.HUnitID,
                                            "HMouldID": materialInfo.HMouldID,
                                            "HMouldNumber": materialInfo.HMouldNumber,
                                            "HMouldName": materialInfo.HMouldName,
                                            "HMouldLength": materialInfo.长度,
                                            "HMouldWidth": materialInfo.宽度,
                                            "HMouldHeight": materialInfo.高度,
                                            "HMouldFoldHeight": materialInfo.折叠高度,
                                            "HQty": orginHQTY,
                                            "HQty_origin": orginHQTY,
                                            "HMouldQty": mouldQty,
                                            "HVolume": rowVolume,
                                            "HSNP": materialInfo.HSNP
                                        });
                                        }
                                    )
                                }
                                }
                                
                            if (newRows.length === 0) {
                                layer.msg("没有可添加的新记录!");
                                return;
                            }
                            //子表  èµ‹å€¼
                            option.data = rowdata;
                            var allData = existingData.concat(newRows);
                            option.data = allData;
                            table.render(option);
                            setTimeout(function () {
                                calculateTotalVolume();
                            }, 100);
                            layer.msg(`成功添加${newRows.length}条记录`, { icon: 1 });
                        } else {
                            res = result.data;
                            //layer.alert(result.msg, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                            layer.alert(result.msg, { icon: 5 });
                        }
                    }, error: function () {
                        res = "none";
                        layer.alert("发生错误!", { icon: 5 });
                    },
                    error: function () {
                        layer.alert("没有找到对应的包装容器关联信息,请检查是否维护并审核!", { icon: 5 });
                    }
                });
            }
            //#endregion
            //#region æ ¹æ®å‘货通知单的物料信息找包装容器表赋给子表
            function getMesByVolumn() {
                var res = "none";
@@ -1364,11 +1513,11 @@
                var tableData = table.cache['mainTable'];
                if (!tableData || tableData.length === 0) return;
                // æŒ‰æºå•分组计算物料数量之和
                var sourceQtyMap = {}; // å­˜å‚¨æºå•数量
                var currentQtyMap = {}; // å­˜å‚¨å½“前物料数量之和
                // å…ˆæ”¶é›†æºå•数量
                var sourceQtyMap = {};
                var currentQtyMap = {};
                tableData.forEach(function (row) {
                    if (row.HSourceInterID && row.HSourceEntryID) {
                        var key = row.HSourceInterID + '_' + row.HSourceEntryID;
@@ -1378,7 +1527,7 @@
                    }
                });
                // è®¡ç®—当前物料数量之和
                tableData.forEach(function (row) {
                    if (row.HSourceInterID && row.HSourceEntryID) {
                        var key = row.HSourceInterID + '_' + row.HSourceEntryID;
@@ -1398,7 +1547,7 @@
                    var currentTotal = currentQtyMap[key] || 0;
                    if (currentTotal > sourceQty) {
                        // æ‰¾å‡ºå¯¹åº”的源单信息
                        var sourceBillNo = '';
                        tableData.some(function (row) {
                            if (row.HSourceInterID + '_' + row.HSourceEntryID === key) {
@@ -1416,7 +1565,7 @@
                    }
                }
                // å¦‚果有超出,显示提醒
                if (exceedSources.length > 0) {
                    var message = '物料数量之和超过源单数量:<br>';
                    exceedSources.forEach(function (item, index) {
@@ -1463,7 +1612,10 @@
            //保存
            form.on('submit(Saver)', function (data) {
                var loadingRate = data.field.HLoadingRate;
                if (loadingRate && typeof loadingRate === 'string') {
                    data.field.HLoadingRate = parseFloat(loadingRate.replace('%', '')) / 100;
                }
                var sMainStr = JSON.stringify(data.field);
                var sSubStr = JSON.stringify(table.cache['mainTable']);
                var sMainSub = sMainStr + ';' + sSubStr + ";" + sessionStorage["HUserName"];
@@ -1513,22 +1665,23 @@
                    , { templet: '#xuhao', title: '序号', sort: true, fixed: 'left', event: "qwe", style: unEditableColStyle }
                    , { field: 'HSourceInterID', title: 'HSourceInterID', edit: 'text', hide: true }
                    , { field: 'HSourceEntryID', title: 'HSourceEntryID', edit: 'text', hide: true }
                    , { field: 'HSourceBillNo', title: '源单单据号', edit: 'text'  }
                    , { field: 'HSourceBillNo', title: '源单单据号'  }
                    , { field: 'HMaterID', title: 'HMaterID', edit: 'text', hide: true }
                    , { field: 'HMaterNumber', title: '物料代码', edit: 'text', event: "HInspectInstruMentID" }
                    , { field: 'HMaterNumber', title: '物料代码' }
                    , { field: 'HMaterName', title: '物料名称', style: unEditableColStyle }
                    , { field: 'HnitID', title: '单位ID', edit: 'text', hide: true }
                    , { field: 'HMouldID', title: 'HMouldID', hide: true }
                    , { field: 'HMouldNumber', title: '器具代码', event: 'HMouldNumber' }
                    , { field: 'HMouldNumber', title: '器具代码', edit: 'text',event: 'HMouldNumber' }
                    , { field: 'HMouldName', title: '器具名称' }
                    , { field: 'HMouldLength', title: '容器长度', edit: 'text'}
                    , { field: 'HMouldWidth', title: '容器宽度', edit: 'text'}
                    , { field: 'HMouldHeight', title: '容器高度', edit: 'text'}
                    , { field: 'HMouldFoldHeight', title: '折叠高度', edit: 'text'}
                    , { field: 'HSNP', title: '标准包装数量', edit: 'text'}
                    , { field: 'HMouldLength', title: '容器长度'}
                    , { field: 'HMouldWidth', title: '容器宽度'}
                    , { field: 'HMouldHeight', title: '容器高度'}
                    , { field: 'HMouldFoldHeight', title: '折叠高度'}
                    , { field: 'HSNP', title: '标准包装数量'}
                    , { field: 'HMouldQty', title: '包装容器数量', edit: 'text'}
                    , { field: 'HQty', title: '物料数量', edit: 'text'}
                    , { field: 'HVolume', title: '体积'}
                    , { field: 'HScatteredVolume', title: '零单占用体积', edit: 'text'}
                    , { field: 'HQty_origin', title: '源单数量', hide: true}
                    , { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 150 }
                ];
@@ -1551,9 +1704,9 @@
                var length = parseFloat(row.HMouldLength) || 0;
                var width = parseFloat(row.HMouldWidth) || 0;
                var height = parseFloat(row.HMouldHeight) || 0;
                var HMouldQty = (row.HMouldQty) || 0;
                // è®¡ç®—体积:长 * å®½ * é«˜
                var volume = length * width * height;
                var volume = length * width * height * HMouldQty;
                // ä¿ç•™ä¸¤ä½å°æ•°
                return volume.toFixed(2);
@@ -1587,7 +1740,8 @@
                
                //获取最大单据号
                get_MAXNum();
                option.data = [{ "HInspectInstruMentID": 0, "HInspectInstruMentNumber": "", "HInspectInstruMentName": "  ", "HBeginDate": Format(new Date(), 'yyyy-MM-dd'), "HEndDate": Format(new Date(), 'yyyy-MM-dd'), "HHCalibrationStatus": "合格" }];
                //option.data = [{ "HInspectInstruMentID": 0, "HInspectInstruMentNumber": "", "HInspectInstruMentName": "  ", "HBeginDate": Format(new Date(), 'yyyy-MM-dd'), "HEndDate": Format(new Date(), 'yyyy-MM-dd'), "HHCalibrationStatus": "合格" }];
                option.data = [];
                table.render(option);
            }
            //获取最大单据号及默认值赋值
@@ -1709,7 +1863,7 @@
                                    {
                                        "HSourceInterID": tableSub[i].源单主内码, "HSourceEntryID": tableSub[i].源单子内码, "HSourceBillNo": tableSub[i].源单单据,"HMaterID": tableSub[i].HMaterID, "HMaterNumber": tableSub[i].物料代码, "HMaterName": tableSub[i].物料名称,
                                        "HUnitID": tableSub[i].HUnitID, "HMouldID": tableSub[i].HMouldID, "HMouldNumber": tableSub[i].器具号, "HMouldName": tableSub[i].器具名称,
                                        "HMouldLength": tableSub[i].容器长度, "HMouldWidth": tableSub[i].容器宽度, "HMouldHeight": tableSub[i].容器高度, "HMouldFoldHeight": tableSub[i].容器折叠高度, "HSNP": tableSub[i].标准包装数量, "HMouldQty": tableSub[i].包装容器数量, "HQty": tableSub[i].物料数量, "HQty_origin": tableSub[i].HQty, "HVolume": rowVolume
                                        "HMouldLength": tableSub[i].容器长度, "HMouldWidth": tableSub[i].容器宽度, "HMouldHeight": tableSub[i].容器高度, "HMouldFoldHeight": tableSub[i].容器折叠高度, "HSNP": tableSub[i].标准包装数量, "HMouldQty": tableSub[i].包装容器数量, "HQty": tableSub[i].物料数量, "HQty_origin": tableSub[i].HQty, "HVolume": rowVolume, "HScatteredVolume": tableSub[i].零单占用体积
                                    }
                                )
                            }
@@ -1784,9 +1938,10 @@
                        var length = parseFloat(row.HMouldLength) || 0;
                        var width = parseFloat(row.HMouldWidth) || 0;
                        var height = parseFloat(row.HMouldHeight) || 0;
                        var HMouldQty = (row.HMouldQty) || 0;
                        // è®¡ç®—单个物料的体积
                        var volume = length * width * height;
                        var volume = length * width * height * HMouldQty;
                        totalVolume += volume;
                    }
                }
@@ -1804,7 +1959,7 @@
                var maxVolume = parseFloat($('#HCarTypeMaxVolume').val()) || 0;
                if (maxVolume > 0) {
                    var loadingRate = (totalVolume / maxVolume * 100).toFixed(2);
                    $('#HLoadingRate').val(loadingRate);
                    $('#HLoadingRate').val(loadingRate+"%");
                } else {
                    $('#HLoadingRate').val('');
                }
@@ -1814,33 +1969,39 @@
            function set_GridCellCheck(obj) {
                $(document).off('keydown', ".layui-table-edit").on('keydown', '.layui-table-edit', function (e) {
                    if (event.key == "F7") {
                        if (obj.event === 'HInspectInstruMentID')  //
                        if (obj.event === 'HMouldNumber')  //
                        {
                            var currentRowData = obj.data;
                            var MaterID = currentRowData.HMaterID || 0;
                            //页面层-自定义
                            layer.open({
                                type: 2,
                                skin: 'layui-layer-rim', //加上边框
                                title: '物料列表',
                                title: '包装容器列表',
                                closeBtn: 1,
                                shift: 2,
                                area: ['80%', '80%'],
                                maxmin: true,
                                content: ['../../基础资料/公用基础资料/Gy_Material.html?openType=2', 'yes'],
                                content: ['../../基础资料/公用基础资料/Gy_MaterialPackingRelationList.html?openType=' + MaterID + '&OrgID=' + sessionStorage["OrganizationID"], 'yes'],
                                btn: ['确定', '取消'],
                                btn1: function (index, layero) {
                                    //按钮【按钮一】的回调
                                    var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                                    var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
                                    var iframeWindow = window['layui-layer-iframe' + index];
                                    if (!iframeWindow) return layer.msg('无法获取弹窗数据');
                                    var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');
                                    if (checkStatus.data.length === 0) {
                                        return layer.msg('请选择数据');
                                    }
                                    else if (checkStatus.data.length === 1) {
                                        //同步更新表格和缓存对应的值
                                        obj.update({
                                            HMaterID: checkStatus.data[0].HItemID,
                                            HMaterNumber: checkStatus.data[0].物料代码,
                                            HMaterName: checkStatus.data[0].物料名称,
                                            HMouldID: checkStatus.data[0].HMouldID,
                                            HMouldNumber: checkStatus.data[0].容器代码,
                                            HMouldName: checkStatus.data[0].容器名称,
                                            HMouldLength: checkStatus.data[0].长度,
                                            HMouldWidth: checkStatus.data[0].宽度,
                                            HMouldFoldHeight: checkStatus.data[0].折叠高度,
                                        });
                                    } else {
@@ -1850,27 +2011,24 @@
                                        var tableBak = table.cache["mainTable"]; //获取之前编辑过的表格数据
                                        buttonArr = [];//清空数组
                                        for (var i = 0; i < tableBak.length; i++) {
                                            if (tableBak[i]["HInspectInstruMentID"] != 0 && tableBak[i]["HInspectInstruMentID"] != "" && tableBak[i]["HInspectInstruMentID"] != undefined && tableBak[i]["HInspectInstruMentID"] != null) {
                                            if (tableBak[i]["HMouldID"] != 0 && tableBak[i]["HMouldID"] != "" && tableBak[i]["HMouldID"] != undefined && tableBak[i]["HMouldID"] != null) {
                                                buttonArr.push(tableBak[i]);  //如果关键字段不为空,则将之前的数据存储
                                            }
                                        }
                                        //将批量选择的数据写入数组(多选行)
                                        for (var i = 0; i < checkStatus.data.length; i++) {
                                            buttonArr.push({
                                                "HInspectInstruMentID": checkStatus.data[i].hmainid,
                                                "HInspectInstruMentNumber": checkStatus.data[i].模具编号,
                                                "HInspectInstruMentName": checkStatus.data[i].模具名称,
                                                "HBeginDate": Format(new Date(), 'yyyy-MM-dd'),
                                                "HEndDate": Format(new Date(), 'yyyy-MM-dd'),
                                                "HHCalibrationStatus": "合格"
                                                "HMouldID": checkStatus.data[i].HMouldID,
                                                "HMouldNumber": checkStatus.data[i].容器代码,
                                                "HMouldName": checkStatus.data[i].容器名称,
                                                "HMouldHeight": checkStatus.data[i].高度,
                                                "HMouldLength": checkStatus.data[i].长度,
                                                "HMouldWidth": checkStatus.data[i].宽度,
                                                "HMouldFoldHeight": checkStatus.data[i].折叠高度,
                                            });
                                        }
                                        option.data = buttonArr;
                                        table.render(option);
                                        for (var i = 0; i < option.data.length; i++) {
                                            $('#HHCalibrationStatus' + (i + 1)).find("option[value='" + option.data[i].HHCalibrationStatus + "']").attr("selected", true);
                                        }
                                        form.render('select');
                                    }
                                    layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                                }
@@ -1881,9 +2039,12 @@
                                end: function () {
                                    if (isEmpty(optionData) === false) {
                                        obj.update({
                                            HInspectInstruMentID: optionData[0].hmainid,
                                            HInspectInstruMentNumber: optionData[0].模具编号,
                                            HInspectInstruMentName: optionData[0].模具名称,
                                            HMouldID: optionData[0].HMouldID,
                                            HMouldNumber: optionData[0].容器代码,
                                            HMouldName: optionData[0].容器名称,
                                            HMouldLength: checkStatus.data[0].长度,
                                            HMouldWidth: checkStatus.data[0].宽度,
                                            HMouldFoldHeight: checkStatus.data[0].折叠高度,
                                        })
                                        optionData = []
                                    }
WebTM/views/ÎïÁ÷¹ÜÀí/ÔËÊ䶨λ/WL_YayBill.html
@@ -55,7 +55,9 @@
                                    <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 ForFilteringSchemes" name="HBillNo" id="HBillNo">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
@@ -176,6 +178,7 @@
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="set_ConfirmOtherBill_3" id="set_ConfirmOtherBill_3"><i class="layui-icon layui-icon-radio"></i>出厂运输确认</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="set_ConfirmOtherBill_4" id="set_ConfirmOtherBill_4"><i class="layui-icon layui-icon-radio"></i>到货签收确认</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="HDriverList" id="HDriverList"><i class="layui-icon layui-icon-radio"></i>分配司机</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="HScatteredVolumeList" id="HScatteredVolumeList"><i class="layui-icon layui-icon-radio"></i>维护零单占用体积</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Audit" id="btn-Audit"><i class="layui-icon layui-icon-radio"></i>审核</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-DeAudit" id="btn-DeAudit"><i class="layui-icon layui-icon-circle"></i>反审核</button>
@@ -329,6 +332,8 @@
                        break;
                    //到货签收确认
                    case 'HDriverList': set_HDriverList();
                        break;
                    case 'HScatteredVolumeList': set_HScatteredVolumeList();
                        break;
                };
            });
@@ -516,7 +521,11 @@
                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //隐藏id列
                                }
                                else if (data[i].name == '单据号') {
                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200, event: '单据号' });
                                    col.push({
                                        field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200, event: '单据号', templet: function (d) {
                                            return '<span style="color: blue;">' + d.单据号 + '</span>'
                                        }, style: 'cursor: pointer;'
                                    });
                                }
                                else {
                                    switch (data[i].Type) {
@@ -748,7 +757,7 @@
                    layer.open({
                        type: 2
                        , area: ['100%', '100%']
                        , title: '产品防错验证清单-编辑'
                        , title: '编辑'
                        , shift: 0//弹出动画
                        , content: '../../物流管理/运输定位/Add_Edit_WL_YayBill.html?OperationType=3&linterid=' + linterid + '&HSouceBillType='
                        , btn: ['确定'],
@@ -1290,7 +1299,7 @@
                layer.open({
                    type: 2,
                    skin: 'layui-layer-rim', //加上边框
                    title: 'che列表',
                    title: '司机列表',
                    closeBtn: 1,
                    shift: 2,
                    area: ['80%', '80%'],
@@ -1390,6 +1399,102 @@
            }
        }
            function set_HScatteredVolumeList() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1) {
                    var InterID = data[0].HInterID.toString();
                    var HEntryID = data[0].HEntryID.toString();
                    var currentVolume = data[0]["零单占用体积"] || 0; // èŽ·å–å½“å‰é›¶å•å ç”¨ä½“ç§¯ï¼Œå¦‚æžœæ²¡æœ‰åˆ™ä¸º0
                    // å¼¹å‡ºå±‚,包含label和输入框
                    layer.open({
                        type: 1,
                        title: '维护零单占用体积',
                        area: ['400px', '250px'],
                        content:
                            '<div style="padding: 20px;">' +
                            '   <div class="layui-form-item">' +
                            '       <label class="layui-form-label">单据号:</label>' +
                            '       <div class="layui-input-block">' +
                            '           <input type="text" class="layui-input" value="' + (data[0].单据号 || '') + '" readonly style="background-color: #f2f2f2;">' +
                            '       </div>' +
                            '   </div>' +
                            '   <div class="layui-form-item">' +
                            '       <label class="layui-form-label">零单占用体积:</label>' +
                            '       <div class="layui-input-block">' +
                            '           <input type="number" id="scatteredVolume" class="layui-input" value="' + currentVolume + '" placeholder="请输入零单占用体积" step="0.01" min="0">' +
                            '       </div>' +
                            '   </div>' +
                            '   <div class="layui-form-item" style="margin-top: 30px; text-align: center;">' +
                            '       <span style="color: #666; font-size: 12px;">注:请输入数字,支持两位小数</span>' +
                            '   </div>' +
                            '</div>',
                        btn: ['确定', '取消'],
                        yes: function (index, layero) {
                            var volume = $('#scatteredVolume').val();
                            if (!volume || volume === '') {
                                layer.msg('请输入零单占用体积', { icon: 2 });
                                return;
                            }
                            if (isNaN(volume) || parseFloat(volume) < 0) {
                                layer.msg('请输入有效的正数', { icon: 2 });
                                return;
                            }
                            var wait = layer.load();
                            $.ajax({
                                url: GetWEBURL() + '/WLYayBillController/updateBillMEs',
                                type: "GET",
                                data: {
                                    "HInterID": InterID,
                                    "HEntryID": HEntryID,
                                    "ScatteredVolume": volume,
                                    "CurUserName": sessionStorage["HUserName"]
                                },
                                success: function (result) {
                                    layer.close(wait);
                                    if (result.count == 1) {
                                        layer.msg(result.Message, { icon: 1 }, function () {
                                            layer.close(index);
                                            get_FastQuery();
                                        });
                                    } else {
                                        layer.alert(result.code + result.Message, { icon: 5 });
                                    }
                                },
                                error: function (xhr, status, error) {
                                    layer.close(wait);
                                    layer.alert("接口请求失败: " + error, { icon: 5 });
                                }
                            });
                        },
                        btn2: function (index, layero) {
                        },
                        success: function (layero, index) {
                            // å¼¹çª—成功打开后,绑定enter键提交
                            $('#scatteredVolume').on('keypress', function (e) {
                                if (e.keyCode === 13) {
                                    layero.find('.layui-layer-btn0').click();
                                }
                            });
                            $('#scatteredVolume').focus().select();
                        }
                    });
                } else {
                    layer.msg('请选择一行数据!', { icon: 2 });
                }
            }
        }); 
            //#endregion