自动化立体仓库 - WMS系统
#
zhou zhou
2025-10-31 2228f5b934eda1a3bf4ea53965662e05c27b6fbd
#
1个文件已添加
435 ■■■■■ 已修改文件
src/main/webapp/views/erpTongbu/tongbu.html 435 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/erpTongbu/tongbu.html
New file
@@ -0,0 +1,435 @@
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../static/evn/index.css">
    <style>
        .text-center {
            text-align: center;
        }
        .text-gray-500 {
            width: 100%;
            color: #6b7280;
        }
    </style>
</head>
<body>
<div id="app">
    <el-card>
        <el-form :inline="true" label-width="auto">
            <el-form-item label="">
                <el-button type="primary" @click="page" circle >
                    <el-icon><Search /></el-icon>
                </el-button>
            </el-form-item>
            <el-form-item label="">
                <el-button type="primary"  @click="tongbu">同步</el-button>
            </el-form-item>
        </el-form>
        <el-table
                :data="tableData"
                border
                style="width: 100%"
                row-key="id"
                @selection-change="handleSelectionChange"
                max-height="650"
                highlight-current-row
                @cell-dblclick="handleCurrentChange"
        >
            <el-table-column type="selection" >
            </el-table-column>
            <el-table-column type="index" width="50" >
            </el-table-column>
            <el-table-column prop="tongbuType" label="同步类型" >
            </el-table-column>
        </el-table>
        <el-dialog v-model="dialogVisible" fullscreen>
            <el-form :inline="true" label-width="auto">
                <el-form-item label="">
                    <el-button type="primary"  @click="tongbuDialog">同步</el-button>
                </el-form-item>
            </el-form>
            <el-table :data="tableDataDialog" border style="width: 100%" @selection-change="handleSelectionChangeDialog" max-height="650">
                <el-table-column type="selection" >
                </el-table-column>
                <el-table-column type="index" width="50" >
                </el-table-column>
                <el-table-column v-if="dblSelect.id === '0'" prop="fdate" label="单据日期" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '0'" prop="fbillno" label="单据号" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '0'" prop="venname" label="供应商" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '0'" prop="biztype" label="业务类型" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '0'" prop="fcommitqty" label="数量" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '0'" prop="fnumber" label="物料编码" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '0'" prop="fname" label="物料名称" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '0'" prop="fmodel" label="规格型号" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '0'" prop="forderbillno" label="订单编号" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '0'" prop="jhdate" label="交货日期" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '1' || dblSelect.id === '2'" prop="fbillno" label="单据号" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '1' || dblSelect.id === '2'" prop="fnumber" label="物料编码" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '1' || dblSelect.id === '2'" prop="fname" label="物料名称" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '1' || dblSelect.id === '2'" prop="fmodel" label="规格型号" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '1' || dblSelect.id === '2'" prop="fcommitqty" label="数量" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '1' || dblSelect.id === '2'" prop="fplancommitdate" label="计划开工日期" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '1' || dblSelect.id === '2'" prop="fplanfinishdate" label="计划完成日期" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '1' || dblSelect.id === '2'" prop="fsourcebillno" label="生产单号" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '3'" prop="fbillno" label="单据号" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '3'" prop="fdate" label="单据日期" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '3'" prop="cusname" label="客户" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '3'" prop="fnumber" label="物料编码" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '3'" prop="fname" label="物料名称" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '3'" prop="fmodel" label="规格型号" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '3'" prop="fcommitqty" label="数量" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '3'" prop="fbarcode" label="条形码" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '3'" prop="ffetchdate" label="交货日期" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '3'" prop="fnote" label="备注" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '4'" prop="fnumber" label="物料编码" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '4'" prop="checkqty" label="数量" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '4'" prop="createtime" label="创建时间" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '4'" prop="vouchtype" label="单据类型" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '4'" prop="fname" label="物料名称" ></el-table-column>
                <el-table-column v-if="dblSelect.id === '4'" prop="fmodel" label="规格型号" ></el-table-column>
            </el-table>
            <template #footer>
                <div class="dialog-footer">
                    <el-button @click="dialogVisible = false">关闭</el-button>
                </div>
            </template>
        </el-dialog>
    </el-card>
</div>
<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
<script src="../../static/evn/vue.global.js"></script>
<script src="../../static/evn/element-plus.js"></script>
<script src="../../static/evn/icons-vue.js"></script>
<script src='../../static/js/erp/LodopFuncs.js'></script>
<script type="module">
    // 导入中文语言包
    import zhCn from '../../static/js/erp/zh-cn.js';
    const { createApp, ref, onMounted, onBeforeMount ,watchEffect} = Vue;
    const app = createApp({
        setup() {
            const currentPage = ref(1)
            const pageSizes = ref([15,20, 30, 50, 100, 200])
            const pageSize = ref(15)
            const pageTotal = ref(0)
            const tableSearchParam = ref({
                izJb:"否",
                dateStart:new Date(),
                dateEnd: new Date(),
                venId:null,
                izJs:"否"
            })
            const tableSearchParamDialog = ref({
                dateStart:new Date(),
                dateEnd: new Date(),
                izSync: null
            })
            const tableData = ref([])
            const tableDataDialog = ref([])
            const defaultTime = ref(new Date())
            const fullscreenLoading = ref(false)
            const selectData = ref([
            ])
            const dialogVisible = ref(false)
            const selectList = ref([])
            const selectListDialog = ref([])
            const dblSelect = ref()
            function page(){
                const loading = ElementPlus.ElLoading.service({
                    lock: true,
                    text: 'Loading',
                    background: 'rgba(0, 0, 0, 0.7)',
                })
                $.ajax({
                    url: "http://127.0.0.1:9090/mo/tongbu/getList",
                    dataType: 'json',
                    contentType: 'application/json;charset=UTF-8',
                    method: 'GET',
                    success: function(res) {
                        loading.close()
                        if (res.code == 200) {
                            tableData.value = res.data
                            ElementPlus.ElMessage({
                                message: "拉取数据完成",
                                type: 'success'
                            });
                        } else if (res.code === 403) {
                            top.location.href = baseUrl + "/";
                        } else {
                            ElementPlus.ElMessage({
                                message: res.msg,
                                type: 'error'
                            });
                        }
                    }
                });
            }
            function dialogPage(){
                let method = '';
                let izSrcVouch = '';
                switch (dblSelect.value.id) {
                    case "0":
                        method = 'getpulist'
                        break;
                    case "1":
                        method = 'getfinishedlist'
                        izSrcVouch = '1'
                        break;
                    case "2":
                        method = 'getfinishedlist'
                        izSrcVouch = '0'
                        break;
                    case "3":
                        method = 'getsalelist'
                        break;
                    case "4":
                        method = 'getchecklist'
                        break;
                }
                const loading = ElementPlus.ElLoading.service({
                    lock: true,
                    text: 'Loading',
                    background: 'rgba(0, 0, 0, 0.7)',
                })
                $.ajax({
                    url: "http://127.0.0.1:9090/mo/tongbu/"+method,
                    data: {
                        izSrcVouch:izSrcVouch
                    },
                    contentType: 'application/json;charset=UTF-8',
                    method: 'GET',
                    success: function(res) {
                        loading.close()
                        if (res.code == 200) {
                            tableDataDialog.value = res.data
                            ElementPlus.ElMessage({
                                message: "拉取数据完成",
                                type: 'success'
                            });
                        } else if (res.code === 403) {
                            top.location.href = baseUrl + "/";
                        } else {
                            ElementPlus.ElMessage({
                                message: res.msg,
                                type: 'error'
                            });
                        }
                    }
                });
            }
            function tongbu(){
                ElementPlus.ElMessageBox.confirm('确定同步吗?')
                    .then(() => {
                        fnTongBu()
                    })
                    .catch(() => {
                        // catch error
                    })
            }
            function fnTongBu(){
                if (selectList.value.length === 0){
                    ElementPlus.ElMessage({
                        message: "请先选择",
                        type: 'error'
                    });
                    return ;
                }
                const loading = ElementPlus.ElLoading.service({
                    lock: true,
                    text: 'Loading',
                    background: 'rgba(0, 0, 0, 0.7)',
                })
                $.ajax({
                    url:"http://127.0.0.1:9090/mo/tongbu/tongbu",
                    data: JSON.stringify(selectList.value),
                    dataType: 'json',
                    contentType: 'application/json;charset=UTF-8',
                    method: 'POST',
                    success: function(res) {
                        loading.close();
                        if (res.code == 200) {
                            ElementPlus.ElMessage({
                                message: "同步成功",
                                type: 'success'
                            });
                        } else if (res.code === 403) {
                            top.location.href = baseUrl + "/";
                        } else {
                            ElementPlus.ElMessage({
                                message: res.msg,
                                type: 'error'
                            });
                        }
                    }
                });
            }
            function tongbuDialog(){
                ElementPlus.ElMessageBox.confirm('确定同步吗?')
                    .then(() => {
                        fnDialogTongBu()
                    })
                    .catch(() => {
                        // catch error
                    })
            }
            function fnDialogTongBu(){
                if (selectListDialog.value.length === 0){
                    ElementPlus.ElMessage({
                        message: "请先选择",
                        type: 'error'
                    });
                    return ;
                }
                let method = '';
                let izSrcVouch = '';
                switch (dblSelect.value.id) {
                    case "0":
                        method = 'savepu'
                        break;
                    case "1":
                        method = 'savefinished'
                        izSrcVouch = '1'
                        break;
                    case "2":
                        method = 'savefinished'
                        izSrcVouch = '0'
                        break;
                    case "3":
                        method = 'savesale'
                        break;
                    case "4":
                        method = 'savecheck'
                        break;
                }
                const loading = ElementPlus.ElLoading.service({
                    lock: true,
                    text: 'Loading',
                    background: 'rgba(0, 0, 0, 0.7)',
                })
                $.ajax({
                    url:"http://127.0.0.1:9090/mo/tongbu/"+method,
                    data: JSON.stringify({
                        list : JSON.stringify(selectListDialog.value),
                        izSrcVouch : izSrcVouch
                    }),
                    dataType: 'json',
                    contentType: 'application/json;charset=UTF-8',
                    method: 'POST',
                    success: function(res) {
                        loading.close();
                        if (res.code == 200) {
                            ElementPlus.ElMessage({
                                message: "同步成功",
                                type: 'success'
                            });
                        } else if (res.code === 403) {
                            top.location.href = baseUrl + "/";
                        } else {
                            ElementPlus.ElMessage({
                                message: res.msg,
                                type: 'error'
                            });
                        }
                    },
                    complete: function() {
                        dialogPage();
                    }
                });
            }
            function handleSizeChange(val) {
                pageSize.value = val
                currentPage.value = 1 // 重置到第一页
                page()
            }
            function handleCurrentChange(val) {
                dblSelect.value = val
                tableDataDialog.value = []
                dialogPage()
                dialogVisible.value = true
            }
            function handleSelectionChange(val) {
                selectList.value = val
                console.log(selectList.value)
            }
            function handleSelectionChangeDialog(val) {
                selectListDialog.value = val
            }
            onMounted(() => {
                page()
            })
            return {
                tableData,
                tableDataDialog,
                currentPage,
                pageSizes,
                pageSize,
                pageTotal,
                tableSearchParam,
                tableSearchParamDialog,
                defaultTime,
                selectData,
                dialogVisible,
                dblSelect,
                page,
                dialogPage,
                tongbu,
                tongbuDialog,
                handleSizeChange,
                handleCurrentChange,
                handleSelectionChange,
                handleSelectionChangeDialog
            }
        }
    });
    app.use(ElementPlus, {
        locale: zhCn.default || zhCn
    });
    for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
        app.component(key, component)
    }
    app.mount('#app');
</script>
</body>
</html>