yxj
2024-08-26 de7931bdf73d57ca79eeb0cd48ea3a0ea5453e0e
WebTM/views/²Ö´æ¹ÜÀí/·Ö²½Ê½µ÷Èëµ¥/Fb_StepFoldinBillEdit.html
@@ -96,7 +96,7 @@
                                            </div>
                                        </div>
                                        <div class="layui-col-xs4 layui-inline">
                                            <label class="layui-form-label">供应商</label>
                                            <label class="layui-form-label">供应商<label style="color:red"> * </label></label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="HSupName" id="HSupName" class="layui-input" value="" style="float:left;width:150px;">
                                                <input type="hidden" name="HSupID" id="HSupID" class="layui-input" value="0" style="float:left;width:150px;">
@@ -106,7 +106,7 @@
                                            </div>
                                        </div>
                                        <div class="layui-col-xs4 layui-inline">
                                            <label class="layui-form-label">仓管员</label>
                                            <label class="layui-form-label">仓管员<label style="color:red"> * </label></label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="HEmpName" id="HEmpName" class="layui-input" value="" style="float:left;width:150px;">
                                                <input type="hidden" name="HEmpID" id="HEmpID" class="layui-input" value="0" style="float:left;width:150px;">
@@ -118,7 +118,7 @@
                                    </div>
                                    <div class="layui-row">
                                        <div class="layui-col-xs4 layui-inline">
                                            <label class="layui-form-label">负责人</label>
                                            <label class="layui-form-label">负责人<label style="color:red"> * </label></label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="HManagerName" id="HManagerName" class="layui-input" value="" style="float:left;width:150px;">
                                                <input type="hidden" name="HManagerID" id="HManagerID" class="layui-input" value="0" style="float:left;width:150px;">
@@ -128,7 +128,7 @@
                                            </div>
                                        </div>
                                        <div class="layui-col-xs4 layui-inline">
                                            <label class="layui-form-label">调入仓库</label>
                                            <label class="layui-form-label">调入仓库<label style="color:red"> * </label></label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="HWHName" id="HWHName" class="layui-input" value="" style="float:left;width:150px;">
                                                <input type="hidden" name="HWHID" id="HWHID" class="layui-input" value="0" style="float:left;width:150px;">
@@ -138,7 +138,7 @@
                                            </div>
                                        </div>
                                        <div class="layui-col-xs4 layui-inline">
                                            <label class="layui-form-label">调出仓库</label>
                                            <label class="layui-form-label">调出仓库<label style="color:red"> * </label></label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="HSCWHName" id="HSCWHName" class="layui-input" value="" style="float:left;width:150px;">
                                                <input type="hidden" name="HSCWHID" id="HSCWHID" class="layui-input" value="0" style="float:left;width:150px;">
@@ -150,7 +150,7 @@
                                    </div>
                                    <div class="layui-row">
                                        <div class="layui-col-xs4 layui-inline">
                                            <label class="layui-form-label">验收</label>
                                            <label class="layui-form-label">验收<label style="color:red"> * </label></label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="HSecManagerName" id="HSecManagerName" class="layui-input" value="" style="float:left;width:150px;">
                                                <input type="hidden" name="HSecManagerID" id="HSecManagerID" class="layui-input" value="0" style="float:left;width:150px;">
@@ -160,7 +160,7 @@
                                            </div>
                                        </div>
                                        <div class="layui-col-xs4 layui-inline">
                                            <label class="layui-form-label">保管员</label>
                                            <label class="layui-form-label">保管员<label style="color:red"> * </label></label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="HKeeperName" id="HKeeperName" class="layui-input" value="" style="float:left;width:150px;">
                                                <input type="hidden" name="HKeeperID" id="HKeeperID" class="layui-input" value="0" style="float:left;width:150px;">
@@ -170,7 +170,7 @@
                                            </div>
                                        </div>
                                        <div class="layui-col-xs4 layui-inline">
                                            <label class="layui-form-label">部门</label>
                                            <label class="layui-form-label">部门<label style="color:red"> * </label></label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="HDeptName" id="HDeptName" class="layui-input" value="" style="float:left;width:150px;">
                                                <input type="hidden" name="HDeptID" id="HDeptID" class="layui-input" value="0" style="float:left;width:150px;">
@@ -272,6 +272,8 @@
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-AddLine"><i class="layui-icon layui-icon-form"></i>增加一行</button>
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-CopyLine"><i class="layui-icon layui-icon-form"></i>复制一行</button>
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="set_HideColumn"><i class="layui-icon layui-icon-form"></i>列设置</button>
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="get_Inventory" id="get_Inventory"><i class="layui-icon layui-icon-form"></i>库存查询</button>
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="get_InOutSum" id="get_InOutSum"><i class="layui-icon layui-icon-form"></i>出入库记录查询</button>
                        </div>
                    </script>
@@ -311,7 +313,7 @@
            var shijian = year + "-" + month + "-" + day;
            var allVal;
            //双击返回全局变量
            window.OptionData = {};
            window.OptionData = [];
            //#endregion
@@ -373,6 +375,12 @@
                    "HOrderPrice": "0", "HWHID": "0", "调入仓库": "", "HSCWHID": "0", "调出仓库": "", "HBatchNo": "", "HRemark": ""
                };
                switch (obj.event) {
                    //库存查询
                    case 'get_Inventory': get_Inventory();
                        break;
                    //出入库记录查询
                    case 'get_InOutSum': get_InOutSum();
                        break;
                    case 'btn-AddLine':
                        table.cache["mainTable"].push(NewRow);
                        option.data = table.cache["mainTable"];
@@ -479,7 +487,55 @@
            //#endregion
            //#region åº“存查询
            function get_Inventory() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1 && data[0].HMaterID != 0) {
                    var HMaterID = data[0].HMaterID.toString();
                    //弹窗方法
                    layer.open({
                        type: 2//弹窗类型
                        , skin: 'layui-layer-rim' //加上边框
                        , area: ['90%', '90%']//大小
                        , title: '库存查询列表'//标题
                        , shift: 2//弹出动画
                        , content: ['../../仓存管理/条码报表/Kf_ICinventoryQueryReport.html?Type=1&HMaterID=' + HMaterID, 'yes']
                        , btn: ['取消']
                        , btn1: function (index, layero) {
                            layer.close(index);
                        }
                    })
                }
                else {
                    layer.msg('请选择一行有物料数据查询!');
                }
            }
            //#endregion
            //#region å‡ºå…¥åº“记录查询
            function get_InOutSum() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1 && data[0].HMaterID != 0) {
                    var HMaterID = data[0].HMaterID.toString();
                    layer.open({
                        type: 2//弹窗类型
                        , skin: 'layui-layer-rim' //加上边框
                        , area: ['90%', '90%']//大小
                        , title: '出入库记录列表'//标题
                        , shift: 2//弹出动画
                        , content: ['../../仓存管理/条码报表/Kf_StockInOutSumQueryReport.html?Type=1&HMaterID=' + HMaterID, 'yes']
                        , btn: ['取消']
                        , btn1: function (index, layero) {
                            layer.close(index);
                        }
                    })
                }
                else {
                    layer.msg('请选择一行有物料数据查询!');
                }
            }
            //#endregion
            //#region æœ¬é¡µé¢æ‰€æœ‰è¢«è°ƒç”¨çš„æ–¹æ³•
            //#region åˆ¤æ–­æ˜¯å¦ç™»å½• æœªç™»å½•则跳到登录页
@@ -551,6 +607,109 @@
                option.data = rowdata;
                table.render(option);
            }
            //#region ç›‘听单元格编辑  å•元格编辑后 å˜æ›´
            table.on('edit(mainTable)', function (obj) {
                //数值格式校验工具
                var ref = /^\d+(\.\d+)?$/;          //非负数正则表达式
                var temp = "";
                // å•元格编辑之前的值
                var oldText = $(this).prev().text();
                var value = obj.value //得到修改后的值
                    , data = obj.data //得到所在行所有键值
                    , field = obj.field; //得到字段
                switch (field) {
                    case "HQty":                                         //数量
                        //数据格式校验
                        temp = value + "";
                        if (!ref.test(temp) || temp == 0) {
                            //恢复数据到编辑前
                            obj.update({
                                HQty: oldText
                            });
                            table.render(option);
                            layer.msg("数量请输入大于0的数字!");
                            return;
                        }
                        //数据校验合格,重算记录
                        var HQty = value * 1;                           //数量
                        var HPrice = obj.data.HPrice * 1;               //单价
                        var HMoney = HQty * HPrice;                     //金额=数量*单价
                        //同步更新表格和缓存对应的值
                        obj.update({
                            HQty: HQty
                            , HPrice: HPrice
                            , HMoney: HMoney
                        });
                        /* table.render(option);*/
                        break;
                    case "HPrice":                                         //单价
                        //数据格式校验
                        temp = value + "";
                        if (!ref.test(temp) || temp == 0) {
                            //恢复数据到编辑前
                            obj.update({
                                HPrice: oldText
                            });
                            /* table.render(option);*/
                            layer.msg("单价请输入大于0的数字!");
                            return;
                        }
                        //数据校验合格,重算记录
                        var HQty = obj.data.HQty * 1;                   //数量
                        var HPrice = value * 1;
                        var HMoney = HQty * HPrice;                     //金额=数量*单价
                        //同步更新表格和缓存对应的值
                        obj.update({
                            HQty: HQty
                            , HPrice: HPrice
                            , HMoney: HMoney
                        });
                        break;
                    case "HMoney":                                         //金额
                        //数据格式校验
                        temp = value + "";
                        if (!ref.test(temp) || temp == 0) {
                            //恢复数据到编辑前
                            obj.update({
                                HMoney: oldText
                            });
                            /* table.render(option);*/
                            layer.msg("金额请输入大于0的数字!");
                            return;
                        }
                        //数据校验合格,重算记录
                        var HQty = obj.data.HQty * 1;                   //数量
                        var HMoney = value * 1;
                        var HPrice = (HMoney / HQty).toFixed(2);       //单价=金额/数量
                        //同步更新表格和缓存对应的值
                        obj.update({
                            HQty: HQty
                            , HPrice: HPrice
                            , HMoney: HMoney
                        });
                        break;
                        table.render(option);
                    default:
                }
            });
            //#endregion
            //#region åŠ è½½è¡¨å¤´
            function RoadBillMain(linterid) {
@@ -693,24 +852,24 @@
                    }
                }
                checkDuplicateData(num);
                const duplicateRows = checkDuplicateData(num);
                if (duplicateRows.length > 0) {
                    let message = '表格中存在重复数据,重复行数为:';
                //checkDuplicateData(num);
                //const duplicateRows = checkDuplicateData(num);
                //if (duplicateRows.length > 0) {
                //    let message = '表格中存在重复数据,重复行数为:';
                    for (let i = 0; i < duplicateRows.length; i++) {
                        const { row1, row2 } = duplicateRows[i];
                        message += `第${row1}行与第${row2}行相同`;
                //    for (let i = 0; i < duplicateRows.length; i++) {
                //        const { row1, row2 } = duplicateRows[i];
                //        message += `第${row1}行与第${row2}行相同`;
                        if (i !== duplicateRows.length - 1) {
                            message += ',';
                        }
                    }
                //        if (i !== duplicateRows.length - 1) {
                //            message += ',';
                //        }
                //    }
                    message += ',请删除其中一行';
                    layer.alert(message);
                    return;
                }
                //    message += ',请删除其中一行';
                //    layer.alert(message);
                //    return;
                //}
                var sMainStr = JSON.stringify(data.field);
                var sSubStr = JSON.stringify(num);
@@ -782,7 +941,7 @@
                                    layer.close(index);//关闭弹窗
                                }
                                , end: function () {
                                    if (OptionData.length > 0) {
                                    if (OptionData != null && OptionData.length == undefined) {
                                        obj.update({
                                            "HMaterID": OptionData.HItemID
                                            , "物料代码": OptionData.物料代码
@@ -904,7 +1063,7 @@
                                    layer.close(index);//关闭弹窗
                                }
                                , end: function () {
                                    if (OptionData.length > 0) {
                                    if (OptionData != null && OptionData.length == undefined) {
                                        obj.update({
                                            "HWHID": OptionData.HItemID
                                            , "调入仓库": OptionData.仓库名称
@@ -944,12 +1103,12 @@
                                    layer.close(index);//关闭弹窗
                                }
                                , end: function () {
                                    if (optiondata.length > 0) {
                                    if (OptionData != null && OptionData.length == undefined) {
                                        obj.update({
                                            "HSCWHID": OptionData.HItemID
                                            , "调出仓库": OptionData.仓库名称
                                        })
                                        optiondata = [];
                                        OptionData = [];
                                    }