#
Junjie
2024-08-08 faa10625350a681f7720733724081b76f34ccd4a
#
11个文件已添加
1309 ■■■■■ 已修改文件
zy-asrs-admin/src/components/mat/selectMat/index.vue 356 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-admin/src/views/strategy/suggestLocRule/edit.vue 196 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-admin/src/views/strategy/suggestLocRule/index.vue 265 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/SuggestLocRuleController.java 117 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/SuggestLocRule.java 270 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/param/CreateSuggestLocRuleParam.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/mapper/SuggestLocRuleMapper.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/SuggestLocRuleService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/SuggestLocRuleServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wms/src/main/resources/mapper/asrs/SuggestLocRuleMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wms/src/main/resources/sql/menu/suggestLocRule.sql 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-admin/src/components/mat/selectMat/index.vue
New file
@@ -0,0 +1,356 @@
<script setup>
import { getCurrentInstance, ref, watch, reactive } from 'vue';
import { useRouter } from "vue-router";
import { get, post, postForm } from '@/utils/request.js'
import { message, Modal } from 'ant-design-vue';
import { logout } from '@/config.js';
import { formatMessage } from '@/utils/localeUtils.js';
import useTableSearch from '@/utils/tableUtils.jsx';
const context = getCurrentInstance()?.appContext.config.globalProperties;
const router = useRouter();
const emit = defineEmits(['handleOk'])
const TABLE_KEY = 'table-mat';
let currentPage = 1;
let pageSize = 10;
let tableData = ref([]);
let selectedData = ref([]);
let open = ref(false);
const searchInput = ref("")
const showWidth = ref("60%")
const {
    getColumnSearchProps,
} = useTableSearch();
const state = reactive({
    selectedRowKeys: [],
    loading: false,
    columns: [],
});
const onSelectChange = (selectedRowKeys) => {
  // console.log('selectedRowKeys changed: ', selectedRowKeys);
  state.selectedRowKeys = selectedRowKeys;
  selectedData.value = selectedRowKeys;
};
getColumns();
getPage();
state.columns = [
    {
        title: '#ID',
        dataIndex: 'id',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('id'),
    },
    {
        title: formatMessage('db.man_mat.tag_id', '所属归类'),
        dataIndex: 'tagId$',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('tagId$'),
    },
    {
        title: formatMessage('db.man_mat.matnr', '商品编号'),
        dataIndex: 'matnr',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('matnr'),
    },
    {
        title: formatMessage('db.man_mat.maktx', '商品名称'),
        dataIndex: 'maktx',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('maktx'),
    },
    {
        title: formatMessage('db.man_mat.name', '别名'),
        dataIndex: 'name',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('name'),
    },
    {
        title: formatMessage('db.man_mat.specs', '规格'),
        dataIndex: 'specs',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('specs'),
    },
    {
        title: formatMessage('db.man_mat.model', '型号'),
        dataIndex: 'model',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('model'),
    },
    {
        title: formatMessage('db.man_mat.color', '颜色'),
        dataIndex: 'color',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('color'),
    },
    {
        title: formatMessage('db.man_mat.brand', '品牌'),
        dataIndex: 'brand',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('brand'),
    },
    {
        title: formatMessage('db.man_mat.unit', '单位'),
        dataIndex: 'unit',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('unit'),
    },
    {
        title: formatMessage('db.man_mat.price', '单价'),
        dataIndex: 'price',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('price'),
    },
    {
        title: formatMessage('db.man_mat.sku', 'sku'),
        dataIndex: 'sku',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('sku'),
    },
    {
        title: formatMessage('db.man_mat.units', '单位量'),
        dataIndex: 'units',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('units'),
    },
    {
        title: formatMessage('db.man_mat.barcode', '条码'),
        dataIndex: 'barcode',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('barcode'),
    },
    {
        title: formatMessage('db.man_mat.origin', '产地'),
        dataIndex: 'origin',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('origin'),
    },
    {
        title: formatMessage('db.man_mat.manu', '厂家'),
        dataIndex: 'manu',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('manu'),
    },
    {
        title: formatMessage('db.man_mat.manu_date', '生产日期'),
        dataIndex: 'manuDate',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('manuDate'),
    },
    {
        title: formatMessage('db.man_mat.item_num', '品项数'),
        dataIndex: 'itemNum',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('itemNum'),
    },
    {
        title: formatMessage('db.man_mat.weight', '重量'),
        dataIndex: 'weight',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('weight'),
    },
    {
        title: formatMessage('db.man_mat.length', '长度'),
        dataIndex: 'length',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('length'),
    },
    {
        title: formatMessage('db.man_mat.volume', '体积'),
        dataIndex: 'volume',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('volume'),
    },
    {
        title: formatMessage('db.man_mat.three_code', '三方编码'),
        dataIndex: 'threeCode',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('threeCode'),
    },
    {
        title: formatMessage('db.man_mat.supp', '供应商'),
        dataIndex: 'supp',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('supp'),
    },
    {
        title: formatMessage('db.man_mat.supp_code', '供应商编码'),
        dataIndex: 'suppCode',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('suppCode'),
    },
    {
        title: formatMessage('db.man_mat.dead_time', '保质期'),
        dataIndex: 'deadTime',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('deadTime'),
    },
    {
        title: formatMessage('db.man_mat.uuid', '编号'),
        dataIndex: 'uuid',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('uuid'),
    },
    {
        title: formatMessage('db.man_mat.flag', '标识'),
        dataIndex: 'flag',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('flag'),
    },
    {
        title: formatMessage('db.man_mat.sort', '排序'),
        dataIndex: 'sort',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('sort'),
    },
    {
        title: formatMessage('db.man_mat.status', '状态'),
        dataIndex: 'status$',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('status$'),
    },
    {
        title: formatMessage('db.man_mat.memo', '备注'),
        dataIndex: 'memo',
        width: 140,
        ellipsis: true,
        ...getColumnSearchProps('memo'),
    },
];
//加载扩展字段
async function getColumns() {
    let fieldResp = await post('/api/matField/list', {
        fieldType: 0
    })
    let fieldResult = fieldResp.data;
    let tmp = state.columns;
    if (fieldResult.code == 200) {
        let data = fieldResult.data;
        data.forEach((item) => {
            tmp.push({
                title: formatMessage(item.language, item.describe),
                name: item.name,
                dataIndex: item.name,
                key: item.name,
                width: 140,
            })
        })
        // tmp.push({
        //   title: formatMessage('common.operation', '操作'),
        //   name: 'oper',
        //   dataIndex: 'oper',
        //   key: 'oper',
        //   width: 140,
        // })
        state.columns = tmp;
    } else if (result.code === 401) {
        message.error(result.msg);
        logout()
    } else {
        message.error(result.msg);
    }
}
function getPage() {
    post('/api/mat/page', {
        current: currentPage,
        pageSize: pageSize,
        condition: searchInput.value
    }).then((resp) => {
        let result = resp.data;
        if (result.code == 200) {
            let data = result.data;
            tableData.value = data.records;
        } else if (result.code === 401) {
            message.error(result.msg);
            logout()
        } else {
            message.error(result.msg);
        }
    })
}
const handleOk = () => {
    open.value = false;
    emit('handleOk', selectedData.value)
    state.selectedRowKeys = []
    selectedData.value = []
}
const handleCancel = () => {
    open.value = false;
}
const onSearch = () => {
  getPage()
}
defineExpose({
    tableData,
    open,
    showWidth,
})
</script>
<script>
export default {
    name: 'selectMatComponent'
}
</script>
<template>
    <div>
        <a-modal v-model:open="open" :width="showWidth" @ok="handleOk" @cancel="handleCancel">
            <div class="table-header">
                <a-input-search v-model:value="searchInput" :placeholder="formatMessage('page.input', '请输入')" style="width: 200px;" @search="onSearch" />
            </div>
            <a-table :row-selection="{ selectedRowKeys: state.selectedRowKeys, onChange: onSelectChange }" :data-source="tableData" :defaultExpandAllRows="false" :key="TABLE_KEY" rowKey="id"
                :scroll="{ y: 768 }" :columns="state.columns">
            </a-table>
        </a-modal>
    </div>
</template>
<style></style>
zy-asrs-admin/src/views/strategy/suggestLocRule/edit.vue
New file
@@ -0,0 +1,196 @@
<script setup>
import { ref, nextTick } from 'vue';
import { get, post, postBlob, postForm } from '@/utils/request.js'
import { formatMessage } from '@/utils/localeUtils.js';
import { message } from 'ant-design-vue';
import SelectMatView from '@/components/mat/selectMat/index.vue'
const formTable = ref(null);
const submitButton = ref(null);
const isSave = ref(true);
const open = ref(false);
const selectMatChild = ref(null)
const initFormData = {}
let formData = ref(initFormData);
const emit = defineEmits(['tableReload'])
const handleOk = (e) => {
    nextTick(() => {
        setTimeout(() => {
            submitButton.value.$el.click();
        }, 100);
    });
};
const onFinish = values => {
    // console.log('Success:', values);
    open.value = false;
    if(isSave.value) {
        formData.value.matIdList = formData.value.matId;
    }
    console.log(formData.value);
    post(isSave.value ? '/api/suggestLocRule/save' : '/api/suggestLocRule/update', formData.value).then((resp) => {
        let result = resp.data;
        if (result.code === 200) {
            message.success(isSave.value ? formatMessage('page.add.success', '新增成功') : formatMessage('page.update.success', '更新成功'));
        } else {
            message.error(result.msg);
        }
        emit('tableReload', 'reload')
        nextTick(() => {
            formTable.value.resetFields()
        })
    })
};
const onFinishFailed = errorInfo => {
    console.log('Failed:', errorInfo);
};
const matQueryList = ref(null);
matQuery();
function matQuery() {
    postForm('/api/mat/query', {}).then(resp => {
        let result = resp.data;
        matQueryList.value = result.data;
    })
}
const userQueryList = ref(null);
userQuery();
function userQuery() {
    postForm('/api/user/query', {}).then(resp => {
        let result = resp.data;
        userQueryList.value = result.data;
    })
}
const handleSelectMatClick = () => {
    selectMatChild.value.open = true;
}
const handleSelectMatOk = (result) => {
    let tmp = [];
    if(formData.value.matId != undefined) {
        tmp = [...formData.value.matId]
    }
    result.forEach((id) => {
        if(tmp.indexOf(id) == -1) {
            tmp.push(id);
        }
    })
    formData.value.matId = tmp;
}
defineExpose({
    open,
    formData,
    initFormData,
    isSave,
})
</script>
<script>
export default {
    name: '推荐区域-edit'
}
</script>
<template>
    <div>
        <a-modal v-model:open="open"
            :title="isSave ? formatMessage('page.add', '添加') : formatMessage('page.edit', '编辑')" @ok="handleOk"
            style="width: 600px;">
            <a-form :model="formData" ref="formTable" name="formTable" :label-col="{ span: 8 }"
                :wrapper-col="{ span: 16 }" style="display: flex;justify-content: space-between;flex-wrap: wrap;"
                autocomplete="off" @finish="onFinish" @finishFailed="onFinishFailed">
                <a-form-item :label="formatMessage('db.strategy_suggest_loc_rule.mat_id', '商品')" name="matId"
                    style="width: 250px;" :rules="[{ required: true }]">
                    <a-select v-model:value="formData.matId" mode="multiple" :placeholder="formatMessage('common.select', '请选择')"
                        style="width: 100%" show-search :options="matQueryList" optionFilterProp="label"
                        optionLabelProp="label" @click="handleSelectMatClick" :open="false">
                    </a-select>
                </a-form-item>
                <a-form-item :label="formatMessage('db.strategy_suggest_loc_rule.batch', '批号')" name="batch"
                    style="width: 250px;">
                    <a-input v-model:value="formData.batch" />
                </a-form-item>
                <a-form-item :label="formatMessage('db.strategy_suggest_loc_rule.start_row', '起始排')" name="startRow"
                    style="width: 250px;" :rules="[{ required: true }]">
                    <a-input v-model:value="formData.startRow" />
                </a-form-item>
                <a-form-item :label="formatMessage('db.strategy_suggest_loc_rule.target_row', '结束排')" name="targetRow"
                    style="width: 250px;" :rules="[{ required: true }]">
                    <a-input v-model:value="formData.targetRow" />
                </a-form-item>
                <a-form-item :label="formatMessage('db.strategy_suggest_loc_rule.start_bay', '起始列')" name="startBay"
                    style="width: 250px;" :rules="[{ required: true }]">
                    <a-input v-model:value="formData.startBay" />
                </a-form-item>
                <a-form-item :label="formatMessage('db.strategy_suggest_loc_rule.target_bay', '结束列')" name="targetBay"
                    style="width: 250px;" :rules="[{ required: true }]">
                    <a-input v-model:value="formData.targetBay" />
                </a-form-item>
                <a-form-item :label="formatMessage('db.strategy_suggest_loc_rule.start_lev', '起始层')" name="startLev"
                    style="width: 250px;" :rules="[{ required: true }]">
                    <a-input v-model:value="formData.startLev" />
                </a-form-item>
                <a-form-item :label="formatMessage('db.strategy_suggest_loc_rule.target_lev', '结束层')" name="targetLev"
                    style="width: 250px;" :rules="[{ required: true }]">
                    <a-input v-model:value="formData.targetLev" />
                </a-form-item>
                <a-form-item :label="formatMessage('db.strategy_suggest_loc_rule.status', '状态')" name="status"
                    style="width: 250px;">
                    <a-select v-model:value="formData.status" :options="[
                        { label: '正常', value: 1 },
                        { label: '禁用', value: 0 },
                    ]">
                    </a-select>
                </a-form-item>
                <!-- <a-form-item :label="formatMessage('db.strategy_suggest_loc_rule.create_time', '添加时间')"
                    name="createTime" style="width: 250px;">
                    <a-date-picker v-model:value="formData.createTime" show-time format="YYYY-MM-DD HH:mm:ss"
                        value-format="YYYY-MM-DD HH:mm:ss" />
                </a-form-item>
                <a-form-item :label="formatMessage('db.strategy_suggest_loc_rule.create_by', '添加人员')" name="createBy"
                    style="width: 250px;">
                    <a-select v-model:value="formData.createBy" :placeholder="formatMessage('common.select', '请选择')"
                        style="width: 100%" show-search :options="userQueryList" optionFilterProp="label"
                        optionLabelProp="label">
                    </a-select>
                </a-form-item>
                <a-form-item :label="formatMessage('db.strategy_suggest_loc_rule.update_time', '修改时间')"
                    name="updateTime" style="width: 250px;">
                    <a-date-picker v-model:value="formData.updateTime" show-time format="YYYY-MM-DD HH:mm:ss"
                        value-format="YYYY-MM-DD HH:mm:ss" />
                </a-form-item>
                <a-form-item :label="formatMessage('db.strategy_suggest_loc_rule.update_by', '修改人员')" name="updateBy"
                    style="width: 250px;">
                    <a-select v-model:value="formData.updateBy" :placeholder="formatMessage('common.select', '请选择')"
                        style="width: 100%" show-search :options="userQueryList" optionFilterProp="label"
                        optionLabelProp="label">
                    </a-select>
                </a-form-item> -->
                <a-form-item :label="formatMessage('db.strategy_suggest_loc_rule.memo', '备注')" name="memo"
                    style="width: 250px;">
                    <a-input v-model:value="formData.memo" />
                </a-form-item>
                <a-form-item>
                    <a-button type="primary" html-type="submit" ref="submitButton"
                        style="visibility: hidden;">Submit</a-button>
                </a-form-item>
            </a-form>
        </a-modal>
        <SelectMatView ref="selectMatChild" @handle-ok="handleSelectMatOk" />
    </div>
</template>
<style></style>
zy-asrs-admin/src/views/strategy/suggestLocRule/index.vue
New file
@@ -0,0 +1,265 @@
<script setup>
import { getCurrentInstance, ref, computed, reactive } from 'vue';
import { useRouter } from "vue-router";
import { get, post, postBlob } from '@/utils/request.js'
import { message, Modal } from 'ant-design-vue';
import { logout } from '@/config.js';
import EditView from './edit.vue'
import { formatMessage } from '@/utils/localeUtils.js';
import useTableSearch from '@/utils/tableUtils.jsx';
const context = getCurrentInstance()?.appContext.config.globalProperties;
const router = useRouter();
const TABLE_KEY = 'table-suggestLocRule';
let currentPage = 1;
let pageSize = 10;
const searchInput = ref("")
const editChild = ref(null)
let tableData = ref([]);
getPage();
const {
  getColumnSearchProps,
  handleResizeColumn,
} = useTableSearch();
const columns = [
  {
    title: formatMessage('db.strategy_suggest_loc_rule.mat_id', '商品'),
    dataIndex: ['mat$','matnr'],
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('matId$'),
  },
  {
    title: formatMessage('db.strategy_suggest_loc_rule.batch', '批号'),
    dataIndex: 'batch',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('batch'),
  },
  {
    title: formatMessage('db.strategy_suggest_loc_rule.start_row', '起始排'),
    dataIndex: 'startRow',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('startRow'),
  },
  {
    title: formatMessage('db.strategy_suggest_loc_rule.target_row', '结束排'),
    dataIndex: 'targetRow',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('targetRow'),
  },
  {
    title: formatMessage('db.strategy_suggest_loc_rule.start_bay', '起始列'),
    dataIndex: 'startBay',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('startBay'),
  },
  {
    title: formatMessage('db.strategy_suggest_loc_rule.target_bay', '结束列'),
    dataIndex: 'targetBay',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('targetBay'),
  },
  {
    title: formatMessage('db.strategy_suggest_loc_rule.start_lev', '起始层'),
    dataIndex: 'startLev',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('startLev'),
  },
  {
    title: formatMessage('db.strategy_suggest_loc_rule.target_lev', '结束层'),
    dataIndex: 'targetLev',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('targetLev'),
  },
  {
    title: formatMessage('db.strategy_suggest_loc_rule.status', '状态'),
    dataIndex: 'status$',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('status$'),
  },
  {
    title: formatMessage('db.strategy_suggest_loc_rule.create_time', '添加时间'),
    dataIndex: 'createTime$',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('createTime$'),
  },
  {
    title: formatMessage('db.strategy_suggest_loc_rule.create_by', '添加人员'),
    dataIndex: 'createBy$',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('createBy$'),
  },
  {
    title: formatMessage('db.strategy_suggest_loc_rule.update_time', '修改时间'),
    dataIndex: 'updateTime$',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('updateTime$'),
  },
  {
    title: formatMessage('db.strategy_suggest_loc_rule.update_by', '修改人员'),
    dataIndex: 'updateBy$',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('updateBy$'),
  },
  {
    title: formatMessage('db.strategy_suggest_loc_rule.memo', '备注'),
    dataIndex: 'memo',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('memo'),
  },
  {
    title: formatMessage('common.operation', '操作'),
    name: 'oper',
    dataIndex: 'oper',
    key: 'oper',
    width: 140,
    fixed: 'right',
  },
];
const state = reactive({
  selectedRowKeys: [],
  loading: false,
});
const hasSelected = computed(() => state.selectedRowKeys.length > 0);
const start = () => {
  state.loading = true;
  // ajax request after empty completing
  setTimeout(() => {
    state.loading = false;
    state.selectedRowKeys = [];
  }, 1000);
};
const onSelectChange = selectedRowKeys => {
  // console.log('selectedRowKeys changed: ', selectedRowKeys);
  state.selectedRowKeys = selectedRowKeys;
};
function getPage() {
  post('/api/suggestLocRule/page', {
    current: currentPage,
    pageSize: pageSize,
    condition: searchInput.value
  }).then((resp) => {
    let result = resp.data;
    if (result.code == 200) {
      let data = result.data;
      tableData.value = data;
    } else if (result.code === 401) {
      message.error(result.msg);
      logout()
    } else {
      message.error(result.msg);
    }
  })
}
const handleEdit = (item) => {
  editChild.value.open = true;
  editChild.value.formData = item == null ? editChild.value.initFormData : JSON.parse(JSON.stringify(item));
  editChild.value.isSave = item == null;
}
const handleDel = (rows) => {
  Modal.confirm({
    title: formatMessage('page.delete', '删除'),
    content: formatMessage('page.delete.confirm', '确定删除该项吗?'),
    maskClosable: true,
    onOk: async () => {
      const hide = message.loading(formatMessage('common.loading', '请求中'));
      try {
        post('/api/suggestLocRule/remove/' + rows.map((row) => row.id).join(','), {}).then(resp => {
          let result = resp.data;
          if (result.code === 200) {
            message.success(result.msg);
          } else {
            message.error(result.msg);
          }
          getPage()
          hide()
        })
      } catch (error) {
        message.error(formatMessage('common.fail', '请求失败'));
      }
    },
  });
}
const handleExport = async (intl) => {
  postBlob('/api/suggestLocRule/export', {}).then(result => {
    const blob = new Blob([result.data], { type: 'application/vnd.ms-excel' });
    window.location.href = window.URL.createObjectURL(blob);
    return true;
  })
};
const onSearch = () => {
  // console.log('search');
  getPage()
}
const onPageChange = (page, size) => {
  currentPage = page;
  pageSize = size;
  getPage();
}
function handleTableReload(value) {
  getPage()
}
</script>
<script>
export default {
  name: '推荐区域'
}
</script>
<template>
  <div>
    <EditView ref="editChild" @tableReload="handleTableReload" />
    <div class="table-header">
      <a-input-search v-model:value="searchInput" :placeholder="formatMessage('page.input', '请输入')"
        style="width: 200px;" @search="onSearch" />
      <div class="table-header-right">
        <a-button @click="handleEdit(null)" type="primary">{{ formatMessage('page.add', '添加') }}</a-button>
        <a-button @click="handleExport">{{ formatMessage('page.export', '导出') }}</a-button>
      </div>
    </div>
    <a-table :row-selection="{ selectedRowKeys: state.selectedRowKeys, onChange: onSelectChange }"
      :data-source="tableData.records" :defaultExpandAllRows="false" :key="TABLE_KEY" rowKey="id"
      :pagination="{ total: tableData.total, onChange: onPageChange }"
      :scroll="{ y: 768, scrollToFirstRowOnChange: true }" :columns="columns" @resizeColumn="handleResizeColumn">
      <template #bodyCell="{ column, text, record }">
        <template v-if="column.dataIndex === 'oper'">
          <div style="display: flex;justify-content: space-evenly;">
            <a-button type="link" primary @click="handleEdit(record)">{{ formatMessage('page.edit', '编辑') }}</a-button>
            <a-button type="link" danger @click="handleDel([record])">{{ formatMessage('page.delete', '删除')
              }}</a-button>
          </div>
        </template>
      </template>
    </a-table>
  </div>
</template>
<style></style>
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/SuggestLocRuleController.java
New file
@@ -0,0 +1,117 @@
package com.zy.asrs.wms.asrs.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zy.asrs.framework.common.Cools;
import com.zy.asrs.framework.common.R;
import com.zy.asrs.framework.exception.CoolException;
import com.zy.asrs.wms.asrs.entity.param.CreateSuggestLocRuleParam;
import com.zy.asrs.wms.common.annotation.OperationLog;
import com.zy.asrs.wms.common.domain.BaseParam;
import com.zy.asrs.wms.common.domain.KeyValVo;
import com.zy.asrs.wms.common.domain.PageParam;
import com.zy.asrs.wms.asrs.entity.SuggestLocRule;
import com.zy.asrs.wms.asrs.service.SuggestLocRuleService;
import com.zy.asrs.wms.system.controller.BaseController;
import com.zy.asrs.wms.utils.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/api")
public class SuggestLocRuleController extends BaseController {
    @Autowired
    private SuggestLocRuleService suggestLocRuleService;
    @PreAuthorize("hasAuthority('asrs:suggestLocRule:list')")
    @PostMapping("/suggestLocRule/page")
    public R page(@RequestBody Map<String, Object> map) {
        BaseParam baseParam = buildParam(map, BaseParam.class);
        PageParam<SuggestLocRule, BaseParam> pageParam = new PageParam<>(baseParam, SuggestLocRule.class);
        return R.ok().add(suggestLocRuleService.page(pageParam, pageParam.buildWrapper(true)));
    }
    @PreAuthorize("hasAuthority('asrs:suggestLocRule:list')")
    @PostMapping("/suggestLocRule/list")
    public R list(@RequestBody Map<String, Object> map) {
        return R.ok().add(suggestLocRuleService.list());
    }
    @PreAuthorize("hasAuthority('asrs:suggestLocRule:list')")
    @GetMapping("/suggestLocRule/{id}")
    public R get(@PathVariable("id") Long id) {
        return R.ok().add(suggestLocRuleService.getById(id));
    }
    @PreAuthorize("hasAuthority('asrs:suggestLocRule:save')")
    @OperationLog("添加推荐区域")
    @PostMapping("/suggestLocRule/save")
    @Transactional
    public R save(@RequestBody CreateSuggestLocRuleParam param) {
        List<Long> matIdList = param.getMatIdList();
        if (matIdList.isEmpty()) {
            return R.error("请选择商品信息");
        }
        for (Long mat : matIdList) {
            SuggestLocRule suggestLocRule = new SuggestLocRule();
            suggestLocRule.sync(param);
            suggestLocRule.setMatId(mat);
            if (!suggestLocRuleService.save(suggestLocRule)) {
                throw new CoolException("添加推荐区域失败");
            }
        }
        return R.ok("添加成功");
    }
    @PreAuthorize("hasAuthority('asrs:suggestLocRule:update')")
    @OperationLog("修改推荐区域")
    @PostMapping("/suggestLocRule/update")
    public R update(@RequestBody SuggestLocRule suggestLocRule) {
        if (!suggestLocRuleService.updateById(suggestLocRule)) {
            return R.error("修改失败");
        }
        return R.ok("修改成功");
    }
    @PreAuthorize("hasAuthority('asrs:suggestLocRule:remove')")
    @OperationLog("删除推荐区域")
    @PostMapping("/suggestLocRule/remove/{ids}")
    public R remove(@PathVariable Long[] ids) {
        if (!suggestLocRuleService.removeByIds(Arrays.asList(ids))) {
            return R.error("删除失败");
        }
        return R.ok("删除成功");
    }
    @PreAuthorize("hasAuthority('asrs:suggestLocRule:list')")
    @PostMapping("/suggestLocRule/query")
    public R query(@RequestParam(required = false) String condition) {
        List<KeyValVo> vos = new ArrayList<>();
        LambdaQueryWrapper<SuggestLocRule> wrapper = new LambdaQueryWrapper<>();
        if (!Cools.isEmpty(condition)) {
            wrapper.like(SuggestLocRule::getId, condition);
        }
        suggestLocRuleService.page(new Page<>(1, 30), wrapper).getRecords().forEach(
                item -> vos.add(new KeyValVo(item.getId(), item.getId()))
        );
        return R.ok().add(vos);
    }
    @PreAuthorize("hasAuthority('asrs:suggestLocRule:list')")
    @PostMapping("/suggestLocRule/export")
    public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception {
        ExcelUtil.build(ExcelUtil.create(suggestLocRuleService.list(), SuggestLocRule.class), response);
    }
}
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/SuggestLocRule.java
New file
@@ -0,0 +1,270 @@
package com.zy.asrs.wms.asrs.entity;
import com.baomidou.mybatisplus.annotation.TableLogic;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.zy.asrs.wms.asrs.service.MatService;
import com.zy.asrs.wms.system.entity.Host;
import com.zy.asrs.wms.system.entity.User;
import org.springframework.format.annotation.DateTimeFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import com.zy.asrs.framework.common.Cools;
import com.zy.asrs.framework.common.SpringUtils;
import com.zy.asrs.wms.system.service.UserService;
import com.zy.asrs.wms.system.service.HostService;
import com.zy.asrs.common.utils.Synchro;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName("strategy_suggest_loc_rule")
public class SuggestLocRule implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * ID
     */
    @ApiModelProperty(value= "ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 商品
     */
    @ApiModelProperty(value= "商品")
    private Long matId;
    /**
     * 批号
     */
    @ApiModelProperty(value= "批号")
    private String batch;
    /**
     * 起始排
     */
    @ApiModelProperty(value= "起始排")
    private Integer startRow;
    /**
     * 结束排
     */
    @ApiModelProperty(value= "结束排")
    private Integer targetRow;
    /**
     * 起始列
     */
    @ApiModelProperty(value= "起始列")
    private Integer startBay;
    /**
     * 结束列
     */
    @ApiModelProperty(value= "结束列")
    private Integer targetBay;
    /**
     * 起始层
     */
    @ApiModelProperty(value= "起始层")
    private Integer startLev;
    /**
     * 结束层
     */
    @ApiModelProperty(value= "结束层")
    private Integer targetLev;
    /**
     * 所属机构
     */
    @ApiModelProperty(value= "所属机构")
    private Long hostId;
    /**
     * 状态 1: 正常  0: 禁用
     */
    @ApiModelProperty(value= "状态 1: 正常  0: 禁用  ")
    private Integer status;
    /**
     * 是否删除 1: 是  0: 否
     */
    @ApiModelProperty(value= "是否删除 1: 是  0: 否  ")
    @TableLogic
    private Integer deleted;
    /**
     * 添加时间
     */
    @ApiModelProperty(value= "添加时间")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    /**
     * 添加人员
     */
    @ApiModelProperty(value= "添加人员")
    private Long createBy;
    /**
     * 修改时间
     */
    @ApiModelProperty(value= "修改时间")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
    /**
     * 修改人员
     */
    @ApiModelProperty(value= "修改人员")
    private Long updateBy;
    /**
     * 备注
     */
    @ApiModelProperty(value= "备注")
    private String memo;
    public SuggestLocRule() {}
    public SuggestLocRule(Long matId,String batch,Integer startRow,Integer targetRow,Integer startBay,Integer targetBay,Integer startLev,Integer targetLev,Long hostId,Integer status,Integer deleted,Date createTime,Long createBy,Date updateTime,Long updateBy,String memo) {
        this.matId = matId;
        this.batch = batch;
        this.startRow = startRow;
        this.targetRow = targetRow;
        this.startBay = startBay;
        this.targetBay = targetBay;
        this.startLev = startLev;
        this.targetLev = targetLev;
        this.hostId = hostId;
        this.status = status;
        this.deleted = deleted;
        this.createTime = createTime;
        this.createBy = createBy;
        this.updateTime = updateTime;
        this.updateBy = updateBy;
        this.memo = memo;
    }
//    SuggestLocRule suggestLocRule = new SuggestLocRule(
//            null,    // 商品
//            null,    // 批号
//            null,    // 起始排
//            null,    // 结束排
//            null,    // 起始列
//            null,    // 结束列
//            null,    // 起始层
//            null,    // 结束层
//            null,    // 所属机构
//            null,    // 状态
//            null,    // 是否删除
//            null,    // 添加时间
//            null,    // 添加人员
//            null,    // 修改时间
//            null,    // 修改人员
//            null    // 备注
//    );
    public Mat getMat$(){
        MatService service = SpringUtils.getBean(MatService.class);
        Mat mat = service.getById(this.matId);
        if (!Cools.isEmpty(mat)){
            return mat;
        }
        return null;
    }
    public String getMatId$(){
        MatService service = SpringUtils.getBean(MatService.class);
        Mat mat = service.getById(this.matId);
        if (!Cools.isEmpty(mat)){
            return String.valueOf(mat.getId());
        }
        return null;
    }
    public String getHostId$(){
        HostService service = SpringUtils.getBean(HostService.class);
        Host host = service.getById(this.hostId);
        if (!Cools.isEmpty(host)){
            return String.valueOf(host.getName());
        }
        return null;
    }
    public String getStatus$(){
        if (null == this.status){ return null; }
        switch (this.status){
            case 1:
                return "正常";
            case 0:
                return "禁用";
            default:
                return String.valueOf(this.status);
        }
    }
    public String getDeleted$(){
        if (null == this.deleted){ return null; }
        switch (this.deleted){
            case 1:
                return "是";
            case 0:
                return "否";
            default:
                return String.valueOf(this.deleted);
        }
    }
    public String getCreateTime$(){
        if (Cools.isEmpty(this.createTime)){
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime);
    }
    public String getCreateBy$(){
        UserService service = SpringUtils.getBean(UserService.class);
        User user = service.getById(this.createBy);
        if (!Cools.isEmpty(user)){
            return String.valueOf(user.getNickname());
        }
        return null;
    }
    public String getUpdateTime$(){
        if (Cools.isEmpty(this.updateTime)){
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime);
    }
    public String getUpdateBy$(){
        UserService service = SpringUtils.getBean(UserService.class);
        User user = service.getById(this.updateBy);
        if (!Cools.isEmpty(user)){
            return String.valueOf(user.getNickname());
        }
        return null;
    }
    public void sync(Object source) {
        Synchro.Copy(source, this);
    }
}
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/param/CreateSuggestLocRuleParam.java
New file
@@ -0,0 +1,59 @@
package com.zy.asrs.wms.asrs.entity.param;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class CreateSuggestLocRuleParam {
    /**
     * 商品
     */
    @ApiModelProperty(value= "商品")
    private List<Long> matIdList;
    /**
     * 批号
     */
    @ApiModelProperty(value= "批号")
    private String batch;
    /**
     * 起始排
     */
    @ApiModelProperty(value= "起始排")
    private Integer startRow;
    /**
     * 结束排
     */
    @ApiModelProperty(value= "结束排")
    private Integer targetRow;
    /**
     * 起始列
     */
    @ApiModelProperty(value= "起始列")
    private Integer startBay;
    /**
     * 结束列
     */
    @ApiModelProperty(value= "结束列")
    private Integer targetBay;
    /**
     * 起始层
     */
    @ApiModelProperty(value= "起始层")
    private Integer startLev;
    /**
     * 结束层
     */
    @ApiModelProperty(value= "结束层")
    private Integer targetLev;
}
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/mapper/SuggestLocRuleMapper.java
New file
@@ -0,0 +1,12 @@
package com.zy.asrs.wms.asrs.mapper;
import com.zy.asrs.wms.asrs.entity.SuggestLocRule;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
@Mapper
@Repository
public interface SuggestLocRuleMapper extends BaseMapper<SuggestLocRule> {
}
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/SuggestLocRuleService.java
New file
@@ -0,0 +1,8 @@
package com.zy.asrs.wms.asrs.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zy.asrs.wms.asrs.entity.SuggestLocRule;
public interface SuggestLocRuleService extends IService<SuggestLocRule> {
}
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/SuggestLocRuleServiceImpl.java
New file
@@ -0,0 +1,12 @@
package com.zy.asrs.wms.asrs.service.impl;
import com.zy.asrs.wms.asrs.mapper.SuggestLocRuleMapper;
import com.zy.asrs.wms.asrs.entity.SuggestLocRule;
import com.zy.asrs.wms.asrs.service.SuggestLocRuleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
@Service("suggestLocRuleService")
public class SuggestLocRuleServiceImpl extends ServiceImpl<SuggestLocRuleMapper, SuggestLocRule> implements SuggestLocRuleService {
}
zy-asrs-wms/src/main/resources/mapper/asrs/SuggestLocRuleMapper.xml
New file
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zy.asrs.wms.asrs.mapper.SuggestLocRuleMapper">
</mapper>
zy-asrs-wms/src/main/resources/sql/menu/suggestLocRule.sql
New file
@@ -0,0 +1,9 @@
-- save suggestLocRule record
-- mysql
insert into `sys_menu` ( `name`, `parent_id`, `route`, `component`, `type`, `sort`, `host_id`, `status`) values ( '推荐区域管理', '0', '/asrs/suggestLocRule', '/asrs/suggestLocRule', '0' , '0', '1' , '1');
insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '查询推荐区域', '', '1', 'asrs:suggestLocRule:list', '0', '1', '1');
insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '添加推荐区域', '', '1', 'asrs:suggestLocRule:save', '1', '1', '1');
insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '修改推荐区域', '', '1', 'asrs:suggestLocRule:update', '2', '1', '1');
insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `host_id`, `status`) values ( '删除推荐区域', '', '1', 'asrs:suggestLocRule:remove', '3', '1', '1');