wtt
2024-10-28 07cf94734c36d4eae6ddbc4dd338bf5af81a2193
WebTM/views/Éú²ú¹ÜÀí/¼ðÁÏÅäË͵¥/JIT_ComplementGoodsBill.html
@@ -46,13 +46,10 @@
                                    </div>
                                    <div class="layui-row">
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 80px;">拣料配送单号</label>
                                            <label class="layui-form-label" style="width: 85px; margin-left: -5px;">拣料配送单号</label>
                                            <div class="layui-input-block">
                                                <input type="text" class="layui-input" lay-verify="HRemark" name="HRemark" id="HRemark" style="display: inline-block;">
                                            </div>
                                            <label class="layui-form-label"></label>
                                            <div class="layui-input-block">
                                                <input type="text" class="layui-input" name="HInterID" lay-verify="HInterID" id="HInterID" style="display: inline-block;">
                                                <input type="text" class="layui-input" lay-verify="HRemark" name="HRemark" id="HRemark" style="display: inline-block;" readonly>
                                                <input type="text" class="layui-input" name="HInterID" lay-verify="HInterID" id="HInterID" style="display: inline-block;display:none">
                                            </div>
                                        </div>
                                        <button class="layui-btn layui-btn-normal" type="button" lay-submit="" lay-filter="Ppkc" id="Ppkc">匹配库存</button>
@@ -127,6 +124,31 @@
            get_FastQuery();
        })
        //退出
        form.on('submit(Edit)', function () {
            Pub_Close(1);
        })
        //匹配库存
        form.on('submit(Ppkc)', function () {
            layer.confirm("确定要匹配库存?", {
                btn: ['确定', '取消']
                , btn1: function (index) {
                    layer.close(index)
                    sWhere = $("#HInterID").val();
                    get_Display1(sWhere);
                    set_InitGrid1();
                    $('#Ppkc').addClass("layui-btn-disabled").attr("disabled", true);//按钮禁用
                    $('#Ckfl').removeClass("layui-btn-disabled").attr("disabled", false); //按钮恢复
                }
            })
        })
        //仓库发料
        form.on('submit(Ckfl)', function () {
            get_Ckfl();
        })
        //行内事件
        table.on('tool(mainTable)', function (obj) {
            set_GridCellCheck(obj); //行内快捷键筛选
@@ -142,60 +164,43 @@
            set_InitGrid();
            get_Display(sWhere);
            //set_InitGrid1();
            //get_Display1(sWhere);
            //禁用按钮
            $('#Ckfl').addClass("layui-btn-disabled").attr("disabled", true);//按钮禁用
        }
        //#region æ‹£æ–™ä¿¡æ¯
        function set_InitGrid() {
            option = {
                elem: '#mainTable'
                //, toolbar: '#toolbarDemo'
                , height: 350
                , height: 420
                , page: true
                , cellMinWidth: 90
                , limit: 50
                , limits: [50, 500, 5000, 20000]
                , cols: [[
                    //{ type: 'checkbox', fixed: 'left' }
                     { field: '销售订单号', title: '销售订单号',width: 150 }
                    , { field: '生产订单号', title: '生产订单号', width: 170}
                    , { field: '产品代码', title: '产品代码', width: 170 }
                    , { field: '产品名称', title: '产品名称', width: 260, }
                    , { field: '产品规格型号', title: '产品规格型号', width: 160 }
                    , { field: '生产车间', title: '生产车间', width: 160 }
                    , { field: '计划开工日期', title: '计划开工日期', width: 160, templet: "<div>{{d.计划开工日期 ==null ?'':layui.util.toDateString(d.计划开工日期, 'yyyy-MM-dd')}}</div>" }
                    , { field: '物料代码', title: '物料代码', width: 160 }
                    { field: '单据号', title: '单据号',width: 150 }
                    , { field: '单据类型', title: '单据类型', width: 170}
                    , { field: '日期', title: '日期', width: 170, templet: "<div>{{d.日期 ==null ?'':layui.util.toDateString(d.日期, 'yyyy-MM-dd')}}</div>" }
                    , { field: '单据状态', title: '单据状态', width: 260, }
                    , { field: '表头备注', title: '表头备注', width: 160 }
                    , { field: '制单人', title: '制单人', width: 160 }
                    , { field: '制单日期', title: '制单日期', width: 160, templet: "<div>{{d.制单日期 ==null ?'':layui.util.toDateString(d.制单日期, 'yyyy-MM-dd')}}</div>" }
                    , { field: '部门', title: '部门', width: 160 }
                    , { field: '物料名称', title: '物料名称', width: 160 }
                    , { field: '规格型号', title: '规格型号', width: 160 }
                    , { field: '子项单位', title: '子项单位', width: 160 }
                    , { field: '单位用量', title: '单位用量', width: 160}
                    , { field: '计划发料数量', title: '计划发料数量', width: 160 }
                    , { field: '叫料数量', title: '叫料数量', width: 160, edit: 'text'}
                    , { field: '退料数量', title: '退料数量', width: 160, edit: 'text'}
                    , { field: '退料原因', title: '退料原因', width: 160, edit: 'text'}
                    , { field: '已叫料数量', title: '已叫料数量', width: 160}
                    , { field: '已配送数量', title: '已配送数量', width: 160 }
                    , { field: '调出仓库', title: '调出仓库', width: 160, edit: 'text', event: 'Warehouse' }
                    , { field: '调出仓库id', title: '调出仓库id', width: 160, hide: true }
                    , { field: '库存数量', title: '库存数量', width: 160 }
                    , { field: '调出仓库库存数量', title: '调出仓库库存数量', width: 160 }
                    , { field: '调出仓库可用库存数量', title: '调出仓库可用库存数量', width: 160 }
                    , { field: '可用库存', title: '可用库存', width: 160 }
                    , { field: '库存组织', title: '库存组织', width: 160}
                    , { field: 'HICMOBillNo', title: 'HICMOBillNo', width: 160 }
                    , { field: '源单主内码', title: '源单主内码', width: 160 }
                    , { field: '源单子内码', title: '源单子内码', width: 160 }
                    , { field: 'HDeptID', title: 'HDeptID', hide: true }
                    , { field: 'HDeptNumber', title: 'HDeptNumber', hide: true }
                    , { field: 'HMaterialID', title: 'HMaterialID', hide: true }
                    , { field: 'HWHID', title: 'HWHID', hide: true }
                    , { field: 'HOutOrgID', title: 'HOutOrgID', hide: true }
                    , { field: 'HSouceInterID', title: 'HSouceInterID', hide: true }
                    , { field: 'HSourceEntryID', title: 'HSourceEntryID', hide: true }
                    , { field: 'HSourceBillNo', title: 'HSourceBillNo', hide: true }
                    , { field: 'HICMOInterID', title: 'HICMOInterID', hide: true }
                    , { field: 'HICMOEntryID', title: 'HICMOEntryID', hide: true }
                    , { field: 'HSTOCKID', title: 'HSTOCKID', hide: true }
                    , { field: '数量', title: '数量', width: 160 }
                    , { field: '工序', title: '工序', width: 160 }
                    , { field: '仓库', title: '仓库', width: 160}
                    , { field: '仓位', title: '仓位', width: 160 }
                    , { field: '退回人', title: '退回人', width: 160 }
                    , { field: '退回日期', title: '退回日期', width: 160, templet: "<div>{{d.退回日期 ==null ?'':layui.util.toDateString(d.退回日期, 'yyyy-MM-dd')}}</div>" }
                    , { field: '退回原因', title: '退回原因', width: 160 }
                    , { field: '修改人', title: '修改人', width: 160 }
                    , { field: '修改日期', title: '修改日期', width: 160, templet: "<div>{{d.修改日期 ==null ?'':layui.util.toDateString(d.修改日期, 'yyyy-MM-dd')}}</div>" }
                    , { field: '关闭人', title: '关闭人', width: 160 }
                    , { field: '关闭日期', title: '关闭日期', width: 160, templet: "<div>{{d.关闭日期 ==null ?'':layui.util.toDateString(d.关闭日期, 'yyyy-MM-dd')}}</div>" }
                    , { field: '作废人', title: '作废人', width: 160 }
                    , { field: '作废日期', title: '作废日期', width: 160, templet: "<div>{{d.作废日期 ==null ?'':layui.util.toDateString(d.作废日期, 'yyyy-MM-dd')}}</div>" }
                ]]
            };
        }
@@ -207,9 +212,11 @@
            $.ajax({
                url: GetWEBURL() + '/Sc_ComplementGoods/ComplementGoodsBill',
                type: "GET",
                data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
                data: { "sWhere": sWhere},
                success: function (data1) {
                    if (data1.count == 1) {
                        $("#HRemark").val(data1.data[0].单据号);
                        $("#HInterID").val(data1.data[0].hmainid);
                        option.data = data1.data;
                        table.render(option);
                        layer.close(ajaxLoad);
@@ -231,7 +238,7 @@
            var ajaxLoad = layer.load();
            $.ajax({
                url: GetWEBURL() + '/Sc_ComplementGoodBill/ComplementGoodBillList',
                url: GetWEBURL() + '/Sc_ComplementGoods/ComplementGoodsBill_C',
                type: "GET",
                data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
                success: function (data1) {
@@ -255,87 +262,29 @@
            option1 = {
                elem: '#mainTable1'
                //, toolbar: '#toolbarDemo'
                , height: 350
                , height: 420
                , page: true
                , cellMinWidth: 90
                , limit: 50
                , limits: [50, 500, 5000, 20000]
                , cols: [[
                    //{ type: 'checkbox', fixed: 'left' }
                    { field: '销售订单号', title: '销售订单号', width: 150 }
                    //, { field: '生产订单号', title: '生产订单号', width: 170 }
                    //, { field: '产品代码', title: '产品代码', width: 170 }
                    , { field: '产品名称', title: '产品名称', width: 260, }
                    , { field: '产品规格型号', title: '产品规格型号', width: 160 }
                    , { field: '生产车间', title: '生产车间', width: 160 }
                    , { field: '计划开工日期', title: '计划开工日期', width: 160, templet: "<div>{{d.计划开工日期 ==null ?'':layui.util.toDateString(d.计划开工日期, 'yyyy-MM-dd')}}</div>" }
                    , { field: '物料代码', title: '物料代码', width: 160 }
                    , { field: '物料名称', title: '物料名称', width: 160 }
                    , { field: '规格型号', title: '规格型号', width: 160 }
                    , { field: '子项单位', title: '子项单位', width: 160 }
                    , { field: '单位用量', title: '单位用量', width: 160 }
                    , { field: '计划发料数量', title: '计划发料数量', width: 160 }
                    , { field: '叫料数量', title: '叫料数量', width: 160, edit: 'text' }
                    , { field: '退料数量', title: '退料数量', width: 160, edit: 'text' }
                    , { field: '退料原因', title: '退料原因', width: 160, edit: 'text' }
                    , { field: '已叫料数量', title: '已叫料数量', width: 160 }
                    , { field: '已配送数量', title: '已配送数量', width: 160 }
                    , { field: '调出仓库', title: '调出仓库', width: 160, edit: 'text', event: 'Warehouse' }
                    , { field: '调出仓库id', title: '调出仓库id', width: 160, hide: true }
                    , { field: '库存数量', title: '库存数量', width: 160 }
                    , { field: '调出仓库库存数量', title: '调出仓库库存数量', width: 160 }
                    , { field: '调出仓库可用库存数量', title: '调出仓库可用库存数量', width: 160 }
                    , { field: '可用库存', title: '可用库存', width: 160 }
                    , { field: '库存组织', title: '库存组织', width: 160 }
                    , { field: 'HICMOBillNo', title: 'HICMOBillNo', width: 160 }
                    , { field: '源单主内码', title: '源单主内码', width: 160 }
                    , { field: '源单子内码', title: '源单子内码', width: 160 }
                    , { field: 'HDeptID', title: 'HDeptID', hide: true }
                    , { field: 'HDeptNumber', title: 'HDeptNumber', hide: true }
                    , { field: 'HMaterialID', title: 'HMaterialID', hide: true }
                    , { field: 'HWHID', title: 'HWHID', hide: true }
                    , { field: 'HOutOrgID', title: 'HOutOrgID', hide: true }
                    , { field: 'HSouceInterID', title: 'HSouceInterID', hide: true }
                    , { field: 'HSourceEntryID', title: 'HSourceEntryID', hide: true }
                    , { field: 'HSourceBillNo', title: 'HSourceBillNo', hide: true }
                    , { field: 'HICMOInterID', title: 'HICMOInterID', hide: true }
                    , { field: 'HICMOEntryID', title: 'HICMOEntryID', hide: true }
                    , { field: 'HSTOCKID', title: 'HSTOCKID', hide: true }
                    { field: '生产车间', title: '生产车间', width: 150 }
                    , { field: '物料名称', title: '物料名称', width: 170 }
                    , { field: '物料代码', title: '物料代码', width: 170 }
                    , { field: '规格型号', title: '规格型号', width: 260, }
                    , { field: '汇总叫料数量', title: '汇总叫料数量', width: 160 }
                    , { field: '未拣料数量', title: '未拣料数量', width: 160 }
                    , { field: '本次拣料数量', title: '本次拣料数量', width: 160, edit: "text" }
                    , { field: '最大拣料数量', title: '最大拣料数量', width: 160 }
                    , { field: '当前仓库库存', title: '当前仓库库存', width: 160 }
                    , { field: '计量单位', title: '计量单位', width: 160 }
                    , { field: '工段', title: '工段', width: 160 }
                    , { field: '调出仓库', title: '调出仓库', width: 160 }
                    , { field: '调出仓位', title: '调出仓位', width: 160 }
                ]]
            };
        }
        //#endregion
        //快速过滤
        function get_FastQuery() {
            var MaterialNumber = $("#MaterialNumber").val(); //物料代码
            var MaterialName = $("#MaterialName").val(); //物料名称
            var MaterialModel = $("#MaterialModel").val(); //物料规格型号
            var HGD = $("#HGD").val(); //工段
            var HWHName = $("#HWHName").val(); //仓库
            var Organization = $("#Organization").val(); //组织
            var HBeginDate = $("#HBeginDate").val(); //拣料日期
            var HEndDate = $("#HEndDate").val(); //结束日期
            var HDeptName = $("#HDeptName").val(); //部门
            var HJLStatus = $("#HJLStatus").val(); //拣料状态
            var user = sessionStorage["HUserName"]; //制单人
            sWhere = {
                MaterialNumber: MaterialNumber,
                MaterialName: MaterialName,
                MaterialModel: MaterialModel,
                HGD: HGD,
                HWHName: HWHName,
                Organization: Organization,
                HBeginDate: HBeginDate,
                HEndDate: HEndDate,
                HDeptName: HDeptName,
                HJLStatus: HJLStatus,
                user: user
            };
            get_Display(JSON.stringify(sWhere));
            sWhere = "";
        }
        //行内快捷键
        function set_GridCellCheck(obj) {
@@ -387,6 +336,47 @@
            return vars;
        }
        //仓库发料
        function get_Ckfl() {
            if (table.cache['mainTable1'].length == 0) {
                return layer.msg("无数据,无法发料!");
            }
            else {
                layer.confirm("确定要配送生成调拨单", {
                    btn: ['确定', '取消']
                    , btn1: function (index) {
                        $('#Ckfl').addClass("layui-btn-disabled").attr("disabled", true); //仓库发料按钮禁止
                        layer.close(index);
                        var sMainStr = JSON.stringify(table.cache['mainTable1']) + ";" + sessionStorage["HUserName"] + ";" + $("#HInterID").val() + ";" + $("#HRemark").val();//sessionStorage["HUserName"]
                        $.ajax(
                            {
                                type: "POST",
                                url: GetWEBURL() + "/Sc_ComplementGoods/JIT_SendGoodsBill", //方法所在页面和方法名
                                async: true,
                                data: { "msg": sMainStr },
                                dataType: "json",
                                success: function (data) {
                                    if (data.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                                        layer.msg(data.Message, { icon: 1 });
                                    }
                                    else {
                                        layer.alert(data.Message, { icon: 5 });
                                        console.log("Reason" + sMainStr + "sub:" + JSON.stringify(layui.table.cache.mainTable));
                                    }
                                    layer.closeAll("loading");
                                },
                                error: function (err) {
                                    layer.alert("错误:" + err, { icon: 5 });
                                    console.log("Reason" + sMainStr);
                                }
                            });
                    }
                })
            }
        }
        //#endregion
    });