yusijie
2026-03-09 43542a9ba09b4103c82c46f088cb7566a69acf58
WebTM/views/ÁìÁÏ·¢»õ/ÆäËû³ö¿â/Add_Edit_Kf_OtherOutBill.html
@@ -79,6 +79,15 @@
                                            </div>
                                        </div>
                                        <div class="layui-col-xs4 layui-inline">
                                            <label class="layui-form-label">子单据类型</label>
                                            <div class="layui-input-inline">
                                                <select name="HBillSubType" lay-filter="HBillSubType" id="HBillSubType">
                                                    <option value="白坯领料" selected="selected">白坯领料</option>
                                                    <option value="白坯领料调整">白坯领料调整</option>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="layui-col-xs4 layui-inline">
                                            <label class="layui-form-label">业务员</label>
                                            <div class="layui-input-inline">
                                                <input type="hidden" name="HEmpID" id="HEmpID" class="layui-input" value=0 style="float:left;width:150px;">
@@ -361,6 +370,7 @@
            var params = get_UrlVars();
            var OperationType = params[params[0]]; //从参数中获取 æ•°æ®ç±»åž‹  1添加 ä¿å­˜  2复制  3 ç¼–辑
            var linterid = params[params[1]]; //从参数中获取 å•据内码
            var HEntryID = params[params[4]]; //获取单据子id
            if (typeof (params[params[0]]) == "undefined") {
                OperationType = 1;//操作类型
            } else {
@@ -407,10 +417,10 @@
            //#region æ˜Žç»†è¡Œåˆå§‹åŒ–
            var rowdata = [{
                "HMaterID": 0, "物料代码": "", "物料名称": "", "规格型号": "", "HPropertyID": "0", "辅助属性": "", "HSecUnitRate": "0", "HUnitID": 0, "计量单位": "", "HRemark": "",
                "HQtyMust": "0", "HQty": "0","HPieceQty": "0", "HPrice": "0", "HMoney": "0", "HWHID": 0, "收料仓库": "",
                "HQtyMust": "0", "HQty": "0","HPieceQty": "0", "HPrice": "0", "HMoney": "0", "HWHID": 0, "发料仓库": "",
                "HSPID": 0, "HSPGroupID": 0, "仓位名称": "", "HBatchNo": "", "HPOOrderInterID": 0, "HPOOrderEntryID": 0,
                "HPOOrderBillNo": "", "HSeOrderInterID": 0, "HSeOrderEntryID": 0, "HSeOrderBillNo": "",
                "HSourceBillNo": 0, "HSourceBillType": 0, "HSourceInterID": 0, "HSourceEntryID": 0,
                "源单号": 0, "HSourceBillType": 0, "HSourceInterID": 0, "HSourceEntryID": 0,
            }];
            // åˆå§‹åŒ–界
            set_InitGrid();
@@ -425,7 +435,12 @@
            else if (OperationType == 3) {//编辑
                $("#HItemID").val(linterid);//修改时主表ID
                //编辑状态时,根据内码,获取信息并写入界面
                console.log('执行编辑');
                RoadBillMain(linterid);
            }
            else if (OperationType == 4) {      //下推
                console.log('执行下推');
                setInit_PushBill(linterid);
            }
            else {
                layer.alert("未知操作类型!", { icon: 5 });
@@ -449,10 +464,11 @@
                    }
                });
            }
            else {//如果修改则走下面 new
                $("#HInterID").val(linterid);
                RoadBillMain(linterid);
            }
            //else {//如果修改则走下面 new
            //    $("#HInterID").val(linterid);
            //    console.log(1)
            //    RoadBillMain(linterid);
            //}
            //#endregion
            //#endregion
@@ -487,10 +503,10 @@
                //    return;
                //}
                //if ($("#HWHName").val() == 0) {
                //    layer.msg("请选择仓库!", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                //    return;
                //}
                if ($("#HWHName").val() == 0) {
                    layer.msg("请选择仓库!", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    return;
                }
                //if ($("#HKeeperID").val() == 0) {
                //    layer.msg("请选择保管员!", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                //    return;
@@ -500,10 +516,10 @@
                //    return;
                //}
                if ($("#HSupID").val() == 0) {
                    layer.msg("请选择往来单位!", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    return;
                }
                //if ($("#HSupID").val() == 0) {
                //    layer.msg("请选择往来单位!", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                //    return;
                //}
                for (var i = 0; i < option.data.length; i++) {
                    if (option.data[i]["HMaterID"] == "0") {
@@ -991,7 +1007,7 @@
                    "HQtyMust": "0", "HQty": "0","HPieceQty": "0", "HPrice": "0", "HMoney": "0", "HWHID": 0, "收料仓库": "",
                    "HSPID": 0, "HSPGroupID": 0, "仓位名称": "", "HBatchNo": "", "HPOOrderInterID": 0, "HPOOrderEntryID": 0,
                    "HPOOrderBillNo": "", "HSeOrderInterID": 0, "HSeOrderEntryID": 0, "HSeOrderBillNo": "",
                    "HSourceBillNo": 0, "HSourceBillType": 0, "HSourceInterID": 0, "HSourceEntryID": 0,
                    "源单号": 0, "HSourceBillType": 0, "HSourceInterID": 0, "HSourceEntryID": 0,
                };
                switch (obj.event) {
                    //新增
@@ -1510,7 +1526,7 @@
                                    obj.update({
                                        "HWHID": checkStatus.data[0].HItemID,
                                        "收料仓库": checkStatus.data[0].仓库名称
                                        "发料仓库": checkStatus.data[0].仓库名称
                                    })
                                    layer.close(index);//关闭弹窗
                                }
@@ -1557,6 +1573,7 @@
                                }
                            })
                        }
                        //采购订单号
                        if (obj.event == "HPOOrderBillNo") {
@@ -1755,6 +1772,22 @@
            }
            //#endregion
            //#region ç”Ÿæˆå•据号
            function createBillNo() {
                $.ajax({
                    url: GetWEBURL() + "/Web/GetMAXNum",
                    type: "GET",
                    data: { "HBillType": '1206' },
                    success: function (d) {
                        $("#HBillNo").val(d.data[0].HBillNo);
                        $("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
                        $("#HInterID").val(d.data[0].HInterID);
                    }
                });
            }
            //#endregion
            //#region æ—¥æœŸæ ¼å¼åŒ–
            function formatDate(date) {
                var d = new Date(date),
@@ -1781,9 +1814,9 @@
                    , cols: [[ //子表
                        { type: 'checkbox', totalRowText: '合计行' }
                        , { type: 'numbers', title: '序号', width: 100 }
                        , { type: 'HSourceBillNo', title: '源单号', width: 100, hide: true }//源单号
                        , { field: 'HSourceBillNo', title: '源单号', width: 100, hide: true }//源单号
                        , { field: 'HSourceBillType', title: '源单类型', width: 100, hide: true }//源单类型
                        , { type: 'HSourceInterID', title: '源单主内码', width: 100, hide: true }//源单主内码
                        , { field: 'HSourceInterID', title: '源单主内码', width: 100, hide: true }//源单主内码
                        , { field: 'HSourceEntryID', title: '源单子内码', width: 100, hide: true }//源单子内码
                        , { field: 'HMaterID', title: 'HMaterID', width: 100, hide: true }
                        , { field: '物料代码', title: '物料代码', width: 150, edit: 'text', event: "HMaterID" }//f7
@@ -1804,10 +1837,10 @@
                        , { field: 'HMoney', title: '金额', width: 100, edit: 'text', totalRow: true }
                     
                        , { field: 'HWHID ', title: 'HWHID ', width: 100, hide: true }
                        , { field: '收料仓库', title: '发料仓库', width: 100, edit: 'text', event: "HWHID" }//f7
                        , { field: '发料仓库', title: '发料仓库', width: 100, edit: 'text', event: "HWHID" }//f7
                        , { field: 'HSPID', title: 'HSPID', width: 100, hide: true }
                        , { field: 'HSPGroupID', title: 'HSPGroupID', width: 100, hide: true }
                        , { field: '仓位名称', title: '仓位名称', width: 100, edit: 'text', event: "HSPID" }//f7
                        , { field: '仓位名称', title: '仓位名称', width: 100, edit: 'text', event: "HSPID"}//f7
                        , { field: 'HBatchNo', title: '批次', width: 150, edit: 'text', hide: true }
                        , { field: 'HPOOrderInterID', title: '采购订单主内码', width: 100, hide: true }//采购订单主内码
                        , { field: 'HPOOrderEntryID', title: '采购订单子内码', width: 100, hide: true }//采购订单子内码
@@ -1851,6 +1884,7 @@
                                , "HSupName": data[0]["往来单位"]
                                , "HWHID": data[0]["HWHID"]
                                , "HWHName": data[0]["仓库"]
                                , "HBillSubType": data[0]["HBillSubType"]
                                , "HSecManagerID": data[0]["HSecManagerID"]
                                , "HSecManagerName": data[0]["验收员"]
                                , "HKeeperID": data[0]["HKeeperID"]
@@ -1862,7 +1896,6 @@
                                , "HEmpID": data[0]["HEmpID"]
                                , "HEmpName": data[0]["业务员"]
                                , "HExplanation": data[0]["HExplanation"]
                                , "HRemark": data[0]["表头备注"]
                                , "HMaker": data[0]["制单人"]
                                , "HMakeDate": data[0]["制单日期"] == null ? "" : Format(new Date(data[0]["制单日期"]), "yyyy-MM-dd")
@@ -1881,7 +1914,6 @@
                            option.data = data1;
                            table.render(option);
                            form.render('select');
                            layer.close(ajaxLoad);
                        } else {
                            layer.close(ajaxLoad);
@@ -1918,7 +1950,127 @@
                return duplicates;
            }
            //#endregion
            //#region ä¸‹æŽ¨é¡µé¢åˆå§‹åŒ–
            function setInit_PushBill(linterid) {
                //生成并设置主表的内码和单据号
                console.log("setInit_PushBill å¼€å§‹æ‰§è¡Œï¼");
                createBillNo();
                //相关文本框信息初始化
                $("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
                $("#HMaker").val(sessionStorage["HUserName"]);
                $("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd"));
                //初始化并列设置:子表1
                //set_InitGrid();
                //DisPlay_HideColumn();
                //查询生产订单是否存在
                var ajaxLoad = layer.load();
                var sWhere = " and HPRDORGID=" + sessionStorage["OrganizationID"] + "  and hmainid='" + linterid + "' and HEntryID=" + HEntryID;
                $.ajax({
                    url: GetWEBURL() + "/LEMS/MES_Sc_ProcessExchangeBillList_Json",
                    type: "GET",
                    async: false,
                    data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
                    success: function (d) {
                        var result = d;
                        if (result.code == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            var data = result.data[0];
                            console.log('权限判断成功')
                            form.val("component-form-group", { //formTest å³ class="layui-form" æ‰€åœ¨å…ƒç´ å±žæ€§ lay-filter="" å¯¹åº”的值
                                "HEmpID": data.HEmpID
                                , "HEmpName": data.业务员
                                , "HDeptID": data.HDeptID
                                , "HDeptName": data.生产车间
                                , "HCusID": data.HEntryCusID
                                , "HCusName": data.客户
                                , "HBillSubType" :data.HBillSubType
                                //, "HDeptID": data.HDeptID
                                //, "HDeptName": data.生产车间
                                //, "HCusID": data.HCusID
                                //, "HCusName": data.客户
                                //, "HMainSourceInterID": linterid
                                //, "HMainSourceEntryID": HEntryID
                                //, "HMainSourceBillNo": data.单据号
/*                                , "HMainSourceBillType": params[params[2]]*/
                                //, "HMaterID": data.HMaterID
                                //, "物料代码": data.产品代码
                                //, "物料名称": data.产品名称
                                //, "源单号": data.单据号
                                //, "源单主内码": data.hmainid
                                //, "源单子内码": data.HEntryID
                            });
                            //组织的值HOrgID变化,重新渲染
                            HOrgIDBar = data.HOrgID;
                            //子表  èµ‹å€¼
                            var rowdata = [];
                            for (var i = 0; i < result.data.length; i++) {
                                rowdata.push(
                                    {
                                        //"HMaterID": result.data[i]["HMaterID"],
                                        //"物料代码": result.data[i]["产品代码"],
                                        //"物料名称": result.data[i]["产品名称"],
                                        //"规格型号": result.data[i]["规格型号"],
                                        //"HUnitID": result.data[i]["HUnitID"],
                                        //"计量单位": result.data[i]["计量单位"],
                                        //"HQty_Old": result.data[i]["生产任务单数量"],
                                        //"HQty_New": result.data[i]["生产任务单数量"],
                                        ////"HDate_Old": formatDate(result.data[i]["原交货日期"]),
                                        ////"HDate_New": formatDate(result.data[i]["新交货日期"]),
                                        //"HRemark": "",
                                        //"HSourceInterID": result.data[i]["hmainid"],
                                        //"HSourceEntryID": result.data[i]["HEntryID"],
                                        //"HSourceBillNo": result.data[i]["单据号"],
                                        //"HSourceBillType": result.data[i]["单据类型"]
                                        "HMaterID": data.HMaterID
                                        , "物料代码": data.产品代码
                                        , "物料名称": data.产品名称
                                        , "HSourceBillNo": data.单据号
                                        , "HSourceInterID": data.hmainid
                                        , "HSourceEntryID": data.HEntryID
                                        , "HSourceBillType": params[params[2]]
                                        , "HWHID": ""
                                        , "发料仓库": ""
                                        , "HSPID": ""
                                        , "仓位名称": ""
                                        , "HPropertyID": ""
                                        , "辅助属性": ""
                                        , "HSecUnitRate": ""
                                        , "HUnitID": ""
                                        , "计量单位": ""
                                        , "HQtyMust": ""
                                        , "HQty": ""
                                        , "HPieceQty": ""
                                        , "HPrice": ""
                                        , "HMoney": ""
                                    }
                                );
                            }
                            option.data = rowdata;
                            table.render(option);
                            layer.close(ajaxLoad);
                        } else {
                            layer.close(ajaxLoad);
                            layer.alert(result.msg, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        }
                    }, error: function () {
                        layer.close(ajaxLoad);
                        layer.alert("发生错误!", { icon: 5 });
                    }
                })
            }
            //#endregion
            //#region èŽ·å–æºå•ç±»åž‹
            function HSourceBillType() {
                var HName = '其他入库单';
@@ -1969,6 +2121,11 @@
            $("#HWHName").val(obj[0].仓库名称);
            $("#HWHID").val(obj[0].HItemID);
        }
        function GetHSPValue(obj)  //返回仓位
        {
            $("#HSPName").val(obj[0].仓位名称);
            $("#HSPID").val(obj[0].HItemID);
        }
        function GetHDeptNameValue(obj)  //返回部门
        {
@@ -1984,7 +2141,7 @@
        //双击返回物料
        function GetGyMaterial(data) {
            OptionData = data
            OptionData  = data
        }
        //双击返回计量单位
        function GetGyUnit(data) {