自动化立体仓库 - WMS系统
pang.jiabao
2024-11-19 5c57b90b29ad3f1a7747dbec1adf1e063f9ceac2
src/main/webapp/static/js/inventoryCheckOrder/inventoryCheckOrder.js
@@ -32,13 +32,14 @@
            {type: 'checkbox'}
            ,{type: 'numbers', title: '#'}
            ,{field: 'orderNo', align: 'center',title: '单据编号', templet: '#orderNoTpl', width: 160}
            ,{field: 'locNo', align: 'center',title: '库位'}
            ,{field: 'matnr', align: 'center',title: '商品编码', width: 160}
            ,{field: 'maktx', align: 'center',title: '商品名称', width: 200}
            ,{field: 'batch', align: 'center',title: '序列码'}
            ,{field: 'specs', align: 'center',title: '规格'}
            // ,{field: 'anfme', align: 'center',title: '数量'}
            ,{field: 'batch', align: 'center',title: '批次'}
            ,{field: 'anfme', align: 'center',title: '数量'}
            ,{field: 'checkAnfme', align: 'center',title: '盘点数量', style: 'font-weight: bold'}
            // ,{field: 'qty', align: 'center',title: '作业数量', style: 'font-weight: bold'}
            ,{field: 'enableQty', align: 'center',title: '待出数量', style: 'font-weight: bold'}
            // ,{field: 'enableQty', align: 'center',title: '待出数量', style: 'font-weight: bold'}
            // ,{field: 'name', align: 'center',title: '名称'}
            // ,{field: 'model', align: 'center',title: '型号'}
            ,{field: 'unit', align: 'center',title: '单位', hide: true}
@@ -48,13 +49,13 @@
            // ,{field: 'itemNum', align: 'center',title: '品项数'}
            // ,{field: 'count', align: 'center',title: '数量'}
            // ,{field: 'weight', align: 'center',title: '重量'}
            // ,{field: 'status$', align: 'center',title: '状态'}
            ,{field: 'status$', align: 'center',title: '状态'}
            // ,{field: 'createBy$', align: 'center',title: '添加人员'}
            // ,{field: 'createTime$', align: 'center',title: '添加时间'}
            // ,{field: 'updateBy$', align: 'center',title: '修改人员'}
            // ,{field: 'updateTime$', align: 'center',title: '修改时间'}
            // ,{field: 'memo', align: 'center',title: '备注'}
            ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width: 160}
            // ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width: 160}
        ]],
        request: {
            pageName: 'curr',
@@ -86,6 +87,86 @@
        return false;
    });
    // 显示弹框
    $('#showFormBtn').on('click', function () {
        // 弹框内容
        var content = `
                <form class="layui-form" id="billForm" style="padding: 20px;">
                    <div class="layui-form-item" style="margin-bottom: 20px;">
                        <label class="layui-form-label" style="width: 80px; font-size: 14px; text-align: left">单据编号:</label>
                        <div class="layui-input-block" style="margin-left: 110px;">
                            <input type="text" id="billNumber" class="layui-input" placeholder="请输入单据编号" style="height: 38px; font-size: 14px; padding: 0 15px; width: 100%;" required>
                        </div>
                    </div>
                    <div class="layui-form-item" style="margin-bottom: 20px;">
                        <label class="layui-form-label" style="width: 80px; font-size: 14px;">库区:</label>
                        <div class="layui-input-block" style="margin-left: 110px;">
                            <select id="warehouseArea" class="layui-input" style="width: 100%;">
                                <option value="堆垛机" selected>堆垛机</option>
                                <option value="四向库">四向库</option>
                                <option value="CTU">CTU</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item" style="text-align: right;">
                        <button type="button" class="layui-btn" id="saveBtn" style="display: inline-block; padding: 0px 20px; font-size: 16px; background-color: #5FB878; border-color: #5FB878; text-align: center;">保存</button>
                    </div>
                </form>
            `;
        // 弹框
        layer.open({
            type: 1,  // 使用 HTML 内容
            title: '添加盘点单',
            content: content,
            area: ['400px', '280px'],  // 弹框大小
            shadeClose: true,  // 点击遮罩关闭
            offset: '100px',
            success: function (layero, index) {
                form.render();
                // 点击保存按钮事件
                $('#saveBtn').on('click', function () {
                    var billNumber = $('#billNumber').val();
                    var warehouseArea = $('#warehouseArea').val();
                    // 表单验证
                    if (!billNumber) {
                        layer.msg('请输入单据编号');
                        return;
                    }
                    // 发送 Ajax 请求到后端
                    $.ajax({
                        url: baseUrl+"/inventoryCheckOrder/add/auth", // 替换为你的后端接口地址
                        headers: {'token': localStorage.getItem('token')},
                        contentType: 'application/json;charset=UTF-8',
                        method: 'POST',
                        data: JSON.stringify({ orderNo: billNumber,area: warehouseArea }),
                        success: function (res) {
                            if (res.code === 200){
                                layer.msg(res.msg, {icon: 1});
                                // 清空输入框
                                $('#billNumber').val('');
                                $('#warehouseArea').val('堆垛机'); // 重置为默认选项
                                form.render('select'); // 重新渲染 select
                                // 关闭弹框
                                layer.close(index);
                            } else if (res.code === 403){
                                top.location.href = baseUrl+"/";
                            }else {
                                layer.msg(res.msg, {icon: 2});
                            }
                        },
                        error: function () {
                            layer.msg('请求失败');
                        }
                    });
                });
            }
        });
    });
    /* 表格2头工具栏点击事件 */
    table.on('toolbar(orderDetlTable)', function (obj) {