yangle
2025-04-24 76824fbc74817dc6a87cef54c2ab18705490356e
WebTM/views/ÁìÁÏ·¢»õ/ÁìÁϳö¿â/Kf_MateOutBillLEdit.html
@@ -825,9 +825,11 @@
                    for (var i = 0; i < option.data.length; i++) {
                        var HMaterRuleType = option.data[i].HMaterRuleType;
                        if (HMaterRuleType == "染料") {
                            option.data[i].HQty = option.data[i].HRate * HWeight;
                            option.data[i].HQty = dealDoubleToFixed(option.data[i].HRate * HWeight);
                        } else if (HMaterRuleType == "助剂") {
                            option.data[i].HQty = option.data[i].HRate * HWaterQty;
                            option.data[i].HQty = dealDoubleToFixed(option.data[i].HRate * HWaterQty * 0.001);
                        } else if (HMaterRuleType == "助剂(按布算)") {
                            option.data[i].HQty = dealDoubleToFixed(option.data[i].HRate * HWeight * 0.001);
                        }
                    }
                    table.render(option);
@@ -844,9 +846,11 @@
                    for (var i = 0; i < option.data.length; i++) {
                        var HMaterRuleType = option.data[i].HMaterRuleType;
                        if (HMaterRuleType == "染料") {
                            option.data[i].HQty = option.data[i].HRate * HWeight;
                            option.data[i].HQty = dealDoubleToFixed(option.data[i].HRate * HWeight);
                        } else if (HMaterRuleType == "助剂") {
                            option.data[i].HQty = option.data[i].HRate * HWaterQty;
                            option.data[i].HQty = dealDoubleToFixed(option.data[i].HRate * HWaterQty * 0.001);
                        } else if (HMaterRuleType == "助剂(按布算)") {
                            option.data[i].HQty = dealDoubleToFixed(option.data[i].HRate * HWeight * 0.001);
                        }
                    }
                    table.render(option);
@@ -1049,9 +1053,11 @@
                        var HQty = 0;
                        var HMaterRuleType = obj.data.HMaterRuleType;
                        if (HMaterRuleType == "染料") {
                            HQty = HRate * HWeight;
                            HQty = dealDoubleToFixed(HRate * HWeight);
                        } else if (HMaterRuleType == "助剂") {
                            HQty = HRate * HWaterQty;
                            HQty = dealDoubleToFixed(HRate * HWaterQty * 0.001);
                        } else if (HMaterRuleType == "助剂(按布算)") {
                            HQty = dealDoubleToFixed(HRate * HWeight * 0.001);
                        }
                        //同步更新表格和缓存对应的值
                        obj.update({
@@ -1067,9 +1073,11 @@
                        var HQty = 0;
                        var HMaterRuleType = value;
                        if (HMaterRuleType == "染料") {
                            HQty = HRate * HWeight;
                            HQty = dealDoubleToFixed(HRate * HWeight);
                        } else if (HMaterRuleType == "助剂") {
                            HQty = HRate * HWaterQty;
                            HQty = dealDoubleToFixed(HRate * HWaterQty * 0.001);
                        } else if (HMaterRuleType == "助剂(按布算)") {
                            HQty = dealDoubleToFixed(HRate * HWeight * 0.001);
                        }
                        //同步更新表格和缓存对应的值
                        obj.update({
@@ -1644,9 +1652,11 @@
                                        var HWeight = $("#HWeight").val();
                                        var HWaterQty = $("#HWaterQty").val();
                                        if (option.data[rowIndex + i].HMaterRuleType == "染料") {
                                            option.data[rowIndex + i].HQty = option.data[rowIndex + i].HRate * HWeight;
                                            option.data[rowIndex + i].HQty = dealDoubleToFixed(option.data[rowIndex + i].HRate * HWeight);
                                        } else if (option.data[rowIndex + i].HMaterRuleType == "助剂") {
                                            option.data[rowIndex + i].HQty = option.data[rowIndex + i].HRate * HWaterQty;
                                            option.data[rowIndex + i].HQty = dealDoubleToFixed(option.data[rowIndex + i].HRate * HWaterQty * 0.001);
                                        } else if (option.data[rowIndex + i].HMaterRuleType == "助剂(按布算)") {
                                            option.data[rowIndex + i].HQty = dealDoubleToFixed(option.data[rowIndex + i].HRate * HWeight * 0.001);
                                        }
                                    }
                                    table.render(option);
@@ -2032,10 +2042,10 @@
                            layer.msg("明细记录第" + (i + 1) + "行,计量单位为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            return Result = false;
                        }
                        //if (sSubStr[i].HMaterRuleType == null || sSubStr[i].HMaterRuleType == "") {
                        //    layer.msg("明细记录第" + (i + 1) + "行,物料公式为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                        //    return Result = false;
                        //}
                        if (sSubStr[i].HMaterRuleType == null || sSubStr[i].HMaterRuleType == "") {
                            layer.msg("明细记录第" + (i + 1) + "行,物料公式为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                            return Result = false;
                        }
                        temp = sSubStr[i].HRate + "";
                        if (temp == "" || temp *1 == "0") {
                            layer.msg("明细记录第" + (i + 1) + "行,用量为空或为0!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
@@ -2194,7 +2204,33 @@
           //双击返回计量单位
         function GetGyUnit(data) {
             OptionData = data
         }
        }
        //#region å¤„理小数显示位数(data:需要处理的数据;num:数据的类型(如1:数量;2:金额;3:单价))
        function dealDoubleToFixed(data) {
            //用于设置小数位数
            var dotLength = 6;
            //判断是否存在小数点及其索引位置
            data = data + "";
            var index = data.indexOf(".");
            //处理数据并返回
            if (index < 0) {
                return data * 1;
            } else {
                //获取小数位数
                var length = data.length - index - 1;
                if (length <= dotLength) {
                    return data * 1;
                } else {
                    data = data * 1;
                    return data.toFixed(dotLength) * 1;
                }
            }
        }
                //#endregion
    </script>
</body>
</html>