wtt
2025-08-05 ebef191888d9d2c2a2e7a7f677189164e4eef0b3
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({
@@ -1429,7 +1437,7 @@
                    url: GetWEBURL() + 'Kf_MateOutBill/Kf_MateOutBillListProjectDetai',
                    async:false,
                    type: "GET",
                    data: { "sqlWhere": "and hmainid=" + linterid },
                    data: { "sqlWhere": " and hmainid=" + linterid },
                    success: function (result) {
                        if (result.count == 1) {
                            option.data = result.list[0];
@@ -1604,7 +1612,7 @@
                                shift: 2,
                                area: ['80%', '80%'],
                                maxmin: true,
                                content: ['../../基础资料/公用基础资料/Gy_Material.html', 'yes'],
                                content: ['../../基础资料/公用基础资料/Gy_Material.html?openType=2', 'yes'],
                                btn: ['确定', '取消']
                                , btn1: function (index, layero) {
@@ -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);
@@ -1659,7 +1669,7 @@
                                },
                                end: function () {
                                     obj.update({
                                     "HMaterID" :OptionData.HMaterID
                                         "HMaterID": OptionData.HItemID
                                        ,"HMaterCode" : OptionData.物料代码
                                       , "HMaterName" :OptionData.物料名称
                                        ,"HMaterSpec" : OptionData.规格型号
@@ -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>