chenhaozhe
2025-10-11 d02de03ffe76ccb7ebfc777af85b40dd5372cf02
WebTM/views/ÁìÁÏ·¢»õ/ÁìÁϳö¿â/Kf_MateOutBillEdit_YangMao.html
@@ -71,6 +71,8 @@
                                                    id="HBillNo" readonly="readonly" autocomplete="off">
                                                <input id="HInterID" name="HInterID" type="hidden" />
                                                <input id="HMaker" name="HMaker" type="hidden" /><!--制单人-->
                                                <input id="HBillSubType" name="HBillSubType" type="hidden"
                                                    value="羊毛染色" />
                                            </div>
                                        </div>
                                        <div class="layui-inline">
@@ -139,8 +141,7 @@
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label">客户<label style="color:red"> *
                                                </label></label>
                                            <label class="layui-form-label">客户</label>
                                            <div class="layui-input-inline">
                                                <input class="layui-input" name="HCusName" lay-verify="HCusName"
                                                    id="HCusName" readonly="readonly" autocomplete="off">
@@ -176,9 +177,10 @@
                                                </label></label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="HWeight" id="HWeight" class="layui-input"
                                                    value=""style="float: left; width: 150px;">
                                                     <button type="button" lay-submit="" class="layui-btn"
                                                    lay-filter="btnSearchWeight" style="width:40px;">
                                                    value="" style="float: left; width: 150px;">
                                                <button type="button" lay-submit="" class="layui-btn"
                                                    lay-filter="btnSearchWeight" id="btnSearchWeight"
                                                    style="width:40px;">
                                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"
                                                        style="margin-left:-9px;"></i>
                                                </button>
@@ -416,7 +418,8 @@
            //#region ã€åŠ¨æ€èŽ·å–æ¨¡å—åç§°ã€‘
            var HModuleType = "1204";
            //通过单据类型,从数据库动态获取单据模块命名,引用js文件 PageTitle.js
            var HPageTitle = get_PageTitle(HModuleType) == "" ? $("h1").html() : get_PageTitle(HModuleType);
            var HPageTitle = get_PageTitle(HModuleType) || $("h1").html();
            $("h1").html('<b>' + HPageTitle + '</b>');
            //#endregion
@@ -645,7 +648,7 @@
            //#region é€‰æ‹©å¸ƒé‡
            form.on("submit(btnSearchWeight)", function () {
                  layer.open({
                layer.open({
                    type: 2,
                    skin: 'layui-layer-rim', //加上边框
                    title: '物料列表',
@@ -663,7 +666,7 @@
                        if (checkStatus.data.length !== 1) {
                            return layer.msg('请选择一条数据');
                        }
                        $("#HWeight").val(checkStatus.data[0]['克重'])
                        $("#HWeight").val(checkStatus.data[0]['克重']).trigger('change');
                        layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
@@ -744,7 +747,6 @@
                        if (checkStatus.data.length !== 1) {
                            return layer.msg('请选择一条数据');
                        }
                        debugger
                        $("#HMaterID").val(checkStatus.data[0]['HItemID'])
                        $("#HMaterName").val(checkStatus.data[0]['物料名称'])
                        $("#HModel").val(checkStatus.data[0]['规格型号'])
@@ -994,15 +996,16 @@
                    for (var i = 0; i < option.data.length; i++) {
                        var HMaterRuleType = option.data[i].HMaterRuleType;
                        var HMaterRuleExternType = option.data[i].HMaterRuleExternType;
                        if (HMaterRuleType == "染料") {
                            option.data[i].HQty = dealDoubleToFixed(option.data[i].HRate * HWeight);
                        } else if (HMaterRuleType == "助剂") {
                            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);
                        } else if (HMaterRuleExternType == '羊毛') {
                            option.data[i].HQty = dealDoubleToFixed(option.data[i].HRate * HWeight * 0.001);
                        if (HMaterRuleExternType == "染料") {
                            option.data[i].HQty = roundNumber(dealDoubleToFixed(option.data[i].HRate * HWeight), 3).toFixed(3);
                        } else if (HMaterRuleExternType == "助剂") {
                            option.data[i].HQty = roundNumber(dealDoubleToFixed(option.data[i].HRate * HWaterQty * 0.001), 3).toFixed(3);
                        } else if (HMaterRuleExternType == "助剂(按布算)") {
                            option.data[i].HQty = roundNumber(dealDoubleToFixed(option.data[i].HRate * HWeight * 0.001), 3).toFixed(3);
                        }
                        //if (HMaterRuleExternType == '羊毛') {
                        //     option.data[i].HQty = dealDoubleToFixed(option.data[i].HRate * HWeight * 0.001);
                        // }
                    }
                    table.render(option);
                });
@@ -1017,16 +1020,17 @@
                    for (var i = 0; i < option.data.length; i++) {
                        var HMaterRuleType = option.data[i].HMaterRuleType;
                         var HMaterRuleExternType = option.data[i].HMaterRuleExternType;
                        if (HMaterRuleType == "染料") {
                            option.data[i].HQty = dealDoubleToFixed(option.data[i].HRate * HWeight);
                        } else if (HMaterRuleType == "助剂") {
                            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);
                        } else if (HMaterRuleExternType == '羊毛') {
                            option.data[i].HQty = dealDoubleToFixed(option.data[i].HRate * HWeight * 0.001);
                        var HMaterRuleExternType = option.data[i].HMaterRuleExternType;
                        if (HMaterRuleExternType == "染料") {
                            option.data[i].HQty = roundNumber(dealDoubleToFixed(option.data[i].HRate * HWeight), 3).toFixed(3);
                        } else if (HMaterRuleExternType == "助剂") {
                            option.data[i].HQty = roundNumber(dealDoubleToFixed(option.data[i].HRate * HWaterQty * 0.001), 3).toFixed(3);
                        } else if (HMaterRuleExternType == "助剂(按布算)") {
                            option.data[i].HQty = roundNumber(dealDoubleToFixed(option.data[i].HRate * HWeight * 0.001), 3).toFixed(3);
                        }
                        //if (HMaterRuleExternType == '羊毛') {
                        //    option.data[i].HQty = dealDoubleToFixed(option.data[i].HRate * HWeight * 0.001);
                        //}
                    }
                    table.render(option);
                });
@@ -1228,15 +1232,16 @@
                        var HQty = 0;
                        var HMaterRuleType = obj.data.HMaterRuleType;
                        var HMaterRuleExternType = obj.data.HMaterRuleExternType;
                        if (HMaterRuleType == "染料") {
                            HQty = dealDoubleToFixed(HRate * HWeight);
                        } else if (HMaterRuleType == "助剂") {
                            HQty = dealDoubleToFixed(HRate * HWaterQty * 0.001);
                        } else if (HMaterRuleType == "助剂(按布算)") {
                            HQty = dealDoubleToFixed(HRate * HWeight * 0.001);
                        } else if (HMaterRuleExternType == '羊毛') {
                            HQty = dealDoubleToFixed(HRate * HWeight * 0.001);
                        if (HMaterRuleExternType == "染料") {
                            HQty = roundNumber(dealDoubleToFixed(HRate * HWeight), 3).toFixed(3);
                        } else if (HMaterRuleExternType == "助剂") {
                            HQty = roundNumber(dealDoubleToFixed(HRate * HWaterQty * 0.001), 3).toFixed(3);
                        } else if (HMaterRuleExternType == "助剂(按布算)") {
                            HQty = roundNumber(dealDoubleToFixed(HRate * HWeight * 0.001), 3).toFixed(3);
                        }
                        //if (HMaterRuleExternType == '羊毛') {
                        //    HQty = dealDoubleToFixed(HRate * HWeight * 0.001);
                        //}
                        //同步更新表格和缓存对应的值
                        obj.update({
                            HRate: value,
@@ -1251,11 +1256,11 @@
                        var HQty = 0;
                        var HMaterRuleType = value;
                        if (HMaterRuleType == "染料") {
                            HQty = dealDoubleToFixed(HRate * HWeight);
                            HQty = roundNumber(dealDoubleToFixed(HRate * HWeight), 3).toFixed(3);
                        } else if (HMaterRuleType == "助剂") {
                            HQty = dealDoubleToFixed(HRate * HWaterQty * 0.001);
                            HQty = roundNumber(dealDoubleToFixed(HRate * HWaterQty * 0.001), 3).toFixed(3);
                        } else if (HMaterRuleType == "助剂(按布算)") {
                            HQty = dealDoubleToFixed(HRate * HWeight * 0.001);
                            HQty = roundNumber(dealDoubleToFixed(HRate * HWeight * 0.001), 3).toFixed(3);
                        }
                        //同步更新表格和缓存对应的值
                        obj.update({
@@ -1425,21 +1430,21 @@
                    , { field: 'HMaterID', title: 'HMaterID', width: 100, hide: true }
                    , { field: 'HMaterCode', title: '物料代码', edit: 'text', event: 'HMaterCode', width: 100 }
                    , { field: 'HMaterName', title: '物料名称', width: 100 }
                    , { field: 'HMaterRuleType', title: '物料公式', width: 100 }
                    , { field: 'HMaterRuleExternType', title: '物料公式2', width: 100 }
                    // , { field: 'HMaterRuleType', title: '物料公式', width: 100 }
                    , { field: 'HMaterRuleExternType', title: '物料公式', width: 100 }
                    , { field: 'HMaterSpec', title: '规格型号', width: 100 }
                    , { field: 'HUnitID', title: 'HUnitID', width: 100, hide: true }
                    , { field: 'HUnitCode', title: '计量单位代码', edit: 'text', event: 'HUnitCode', width: 100, hide: true }
                    , { field: 'HUnitName', title: '计量单位', width: 100 }
                    , { field: 'HQtyMust', title: '应发数量', width: 100, hide: true }
                    , { field: 'HRate', title: '用量‰', edit: 'text', width: 100 }
                    , { field: 'HQty', title: '重量', edit: 'text', width: 100 }
                    , { field: 'HQty', title: '重量', edit: 'text', width: 100, }
                    , { field: 'HWeight', title: '实际称重', width: 100 }
                    , { field: 'HPrice', title: '单价', width: 100, hide: true }
                    , { field: 'HMoney', title: '金额', width: 100, hide: true }
                    , { field: 'HWHID', title: 'HWHID', width: 100, hide: true, hide: true }
                    , { field: 'HWHCode', title: '发料仓库代码', edit: 'text', event: 'HWHCode', width: 120, hide: true }
                    , { field: 'HWHName', title: '发料仓库名称', width: 120, hide: true }
                    , { field: 'HWHCode', title: '发料仓库代码', edit: 'text', event: 'HWHCode', width: 120, hide: false }
                    , { field: 'HWHName', title: '发料仓库名称', width: 120, hide: false }
                    , { field: 'HRemark', title: '备注', edit: 'text', width: 100 }
                    , { fixed: 'right', title: '操作', toolbar: '#barDemo' }
                ];
@@ -1622,6 +1627,7 @@
                            option.data = result.list[0];
                            for (var i = 0; i < option.data.length; i++) {
                                option.data[i]["HRate"] = (option.data[i]["HRate"] * 1).toFixed(6);
                                option.data[i]["HQty"] = roundNumber((option.data[i]["HQty"] * 1), 3).toFixed(3);
                            }
                            table.render(option);
                            //option1.data = result.list[1];
@@ -1792,7 +1798,7 @@
                                shift: 2,
                                area: ['80%', '80%'],
                                maxmin: true,
                                content: ['../../基础资料/公用基础资料/Gy_Material.html?openType=2', 'yes'],
                                content: ['../../基础资料/公用基础资料/Gy_Material.html', 'yes'],
                                btn: ['确定', '取消']
                                , btn1: function (index, layero) {
@@ -1832,15 +1838,16 @@
                                        //根据物料的 ç‰©æ–™å…¬å¼ è®¡ç®— é‡é‡
                                        var HWeight = $("#HWeight").val();
                                        var HWaterQty = $("#HWaterQty").val();
                                        if (option.data[rowIndex + i].HMaterRuleType == "染料") {
                                            option.data[rowIndex + i].HQty = dealDoubleToFixed(option.data[rowIndex + i].HRate * HWeight);
                                        } else if (option.data[rowIndex + i].HMaterRuleType == "助剂") {
                                            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);
                                        } else if (option.data[rowIndex + i].HMaterRuleExternType == "羊毛") {
                                            option.data[rowIndex + i].HQty = dealDoubleToFixed(option.data[rowIndex + i].HRate * HWeight * 0.001);
                                        if (option.data[rowIndex + i].HMaterRuleExternType == "染料") {
                                            option.data[rowIndex + i].HQty = roundNumber(dealDoubleToFixed(option.data[rowIndex + i].HRate * HWeight), 3).toFixed(3);
                                        } else if (option.data[rowIndex + i].HMaterRuleExternType == "助剂") {
                                            option.data[rowIndex + i].HQty = roundNumber(dealDoubleToFixed(option.data[rowIndex + i].HRate * HWaterQty * 0.001), 3).toFixed(3);
                                        } else if (option.data[rowIndex + i].HMaterRuleExternType == "助剂(按布算)") {
                                            option.data[rowIndex + i].HQty = roundNumber(dealDoubleToFixed(option.data[rowIndex + i].HRate * HWeight * 0.001), 3).toFixed(3);
                                        }
                                        //if (option.data[rowIndex + i].HMaterRuleExternType == "羊毛") {
                                        //    option.data[rowIndex + i].HQty = dealDoubleToFixed(option.data[rowIndex + i].HRate * HWeight * 0.001);
                                        //}
                                    }
                                    table.render(option);
                                    layer.closeAll();
@@ -1866,16 +1873,16 @@
                                            HMaterRuleType: resultData.HMaterRuleType,
                                            HMaterRuleExternType: resultData.HMaterRuleExternType,
                                            HMaterID: resultData.HMaterID,
                                            HMaterCode : resultData.HMaterNumber,
                                            HMaterName : resultData.HMaterName,
                                            HMaterSpec : resultData.HMaterModel,
                                            HUnitID : resultData.HUnitID,
                                            HUnitCode : resultData.HUnitNumber,
                                            HUnitName : resultData.HUnitName,
                                            HMaterCode: resultData.HMaterNumber,
                                            HMaterName: resultData.HMaterName,
                                            HMaterSpec: resultData.HMaterModel,
                                            HUnitID: resultData.HUnitID,
                                            HUnitCode: resultData.HUnitNumber,
                                            HUnitName: resultData.HUnitName,
                                            HDesignLife : 0,
                                            HLeaveLife : 0,
                                            HMoney : 0,
                                            HDesignLife: 0,
                                            HLeaveLife: 0,
                                            HMoney: 0,
                                        })
@@ -2277,22 +2284,28 @@
                //#region å­è¡¨å…³é”®å­—段重复检验
                var num = [];
                for (var i = 0; i < option.data.length; i++) {
                    temp = option.data[i]["HMaterID"];
                    if ($.inArray(temp, num) != -1) {
                        layer.msg("第" + (i + 1) + "行:物料重复,请重新选择!");
                        console.log(option);
                        return Result = false;
                    }
                    num.push(temp);
                }
                // var num = [];
                // for (var i = 0; i < option.data.length; i++) {
                //     temp = option.data[i]["HMaterID"];
                //     if ($.inArray(temp, num) != -1) {
                //         layer.msg("第" + (i + 1) + "行:物料重复,请重新选择!");
                //         console.log(option);
                //         return Result = false;
                //     }
                //     num.push(temp);
                // }
                //#endregion
                return Result;
            }
            //#endregion
            // å››èˆäº”入方法
            function roundNumber(num, decimalPlaces) {
                var factor = Math.pow(10, decimalPlaces);
                return Math.round((num + Math.pow(2, -52)) * factor) / factor;
            }
            //#region æ ¹æ®å·¥è‰ºå•号获取表头信息
            function getMainInfoByHProcExchBillNo() {
                var HProcExchBillNo = $("#HProcExchBillNo").val();