From 57cae75a38beea4fe254b4c2829c470920edd6c2 Mon Sep 17 00:00:00 2001 From: TanYibin <5491541@qq.com> Date: Thu, 30 Mar 2023 11:06:02 +0800 Subject: [PATCH] 库位比较功能提交(4) --- ant-design-vue-jeecg/src/views/system/compare/CompareWcsLocation.vue | 238 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ant-design-vue-jeecg/src/views/system/compare/CompareWcsLocationTask.vue | 190 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ant-design-vue-jeecg/src/views/system/config/LocationList.vue | 2 +- huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/address/service/IAddressService.java | 2 +- huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/address/service/impl/AddressServiceImpl.java | 6 +++--- huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/controller/LocationController.java | 8 ++++---- huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/CompareLocationDto.java | 34 +++++++++++++++++++--------------- huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/CompareLocationTaskDto.java | 5 ++++- huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/QueryCompareLocationDto.java | 11 ----------- huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/QueryCompareLocationTaskDto.java | 18 +++++++++--------- huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java | 156 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------- huaheng-wms-core/src/main/java/org/jeecg/utils/PageUtil.java | 38 +++++++++++++++++++++++++++----------- huaheng-wms-core/src/main/java/org/jeecg/utils/aspect/ApiLoggerAspect.java | 6 ++++-- 13 files changed, 576 insertions(+), 138 deletions(-) create mode 100644 ant-design-vue-jeecg/src/views/system/compare/CompareWcsLocation.vue create mode 100644 ant-design-vue-jeecg/src/views/system/compare/CompareWcsLocationTask.vue diff --git a/ant-design-vue-jeecg/src/views/system/compare/CompareWcsLocation.vue b/ant-design-vue-jeecg/src/views/system/compare/CompareWcsLocation.vue new file mode 100644 index 0000000..214e56a --- /dev/null +++ b/ant-design-vue-jeecg/src/views/system/compare/CompareWcsLocation.vue @@ -0,0 +1,238 @@ +<template> + <a-card :bordered="false"> + <!-- 查询区域 --> + <div class="table-page-search-wrapper"> + <a-form layout="inline" @keyup.enter.native="searchQuery"> + <a-row :gutter="24"> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="库位编码"> + <a-input placeholder="请输入库位编码" v-model="queryParam.locationCode"></a-input> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="库位表容器编码"> + <a-input placeholder="请输入库位表容器编码" v-model="queryParam.containerCode"></a-input> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="库位状态"> + <j-dict-select-tag + placeholder="请选择库位状态" + v-model="queryParam.locationStatus" + dictCode="location_status" + /> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> + <a-button type="primary" @click="searchQuery" icon="search">查询</a-button> + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> + </span> + </a-col> + </a-row> + </a-form> + </div> + <!-- 查询区域-END --> + + <!-- table区域-begin --> + <div> + <a-table + ref="table" + size="middle" + :scroll="{ x: true }" + bordered + rowKey="locationCode" + class="j-table-force-nowrap" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: 'radio' }" + :customRow="clickThenSelect" + @change="handleTableChange" + > + </a-table> + </div> + + <a-tabs defaultActiveKey="1"> + <a-tab-pane tab="库位任务详情" key="1"> + <CompareWcsLocationTask :mainId="selectedMainId" /> + </a-tab-pane> + </a-tabs> + </a-card> +</template> + +<script> +import '@/assets/less/TableExpand.less' +import { mixinDevice } from '@/utils/mixin' +import { JeecgListMixin } from '@/mixins/JeecgListMixin' +import { getAction } from '@/api/manage' +import CompareWcsLocationTask from './CompareWcsLocationTask' +import { initDictOptions, filterMultiDictText } from '@/components/dict/JDictSelectUtil' +import { compareWcsLocation } from '@/api/api' + +export default { + name: 'CompareWcsLocation', + mixins: [JeecgListMixin], + components: { + CompareWcsLocationTask + }, + data() { + return { + description: '库位信息比较页面', + querySource: {}, + // 表头 + columns: [ + { + title: '库位编码', + align: 'center', + dataIndex: 'locationCode' + }, + { + title: '库位表容器编码', + align: 'center', + dataIndex: 'locationContainerCode' + }, + { + title: '库位表状态', + align: 'center', + // dataIndex: 'locationStatus_dictText' + dataIndex: 'locationStatus' + }, + { + title: '托盘表容器编码', + align: 'center', + dataIndex: 'containerContainerCode' + }, + { + title: '托盘表状态', + align: 'center', + dataIndex: 'containerStatus' + }, + { + title: '库存表容器编码', + align: 'center', + dataIndex: 'inventoryContainerCode' + }, + { + title: '库存表状态', + align: 'center', + dataIndex: 'inventoryStatus' + }, + { + title: 'WCS库位表容器编码', + align: 'center', + dataIndex: 'wcsContainerCode' + }, + { + title: 'WCS库位表状态', + align: 'center', + dataIndex: 'wcsLocationStatus' + } + ], + url: { + list: '/config/location/compareWcsLocation' + }, + dictOptions: { + locationStatus: [] + }, + /* 分页参数 */ + ipagination: { + current: 1, + pageSize: 5, + pageSizeOptions: ['5', '10', '50'], + showTotal: (total, range) => { + return range[0] + '-' + range[1] + ' 共' + total + '条' + }, + showQuickJumper: true, + showSizeChanger: true, + total: 0 + }, + selectedMainId: '', + superFieldList: [] + } + }, + created() { + this.getSuperFieldList() + }, + computed: { + importExcelUrl: function() { + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}` + } + }, + methods: { + initDictConfig() {}, + clickThenSelect(record) { + return { + on: { + click: () => { + this.onSelectChange(record.locationCode.toString().split(','), [record]) + } + } + } + }, + onClearSelected() { + this.selectedRowKeys = [] + this.selectionRows = [] + this.selectedMainId = '' + }, + onSelectChange(selectedRowKeys, selectionRows) { + this.selectedMainId = selectedRowKeys[0].toString() + this.selectedRowKeys = selectedRowKeys + this.selectionRows = selectionRows + }, + createTask(record) { + this.loading = true + this.model = Object.assign({}, record) + createReceiptTask(this.model).then(res => { + this.loading = false + if (res.success) { + this.$message.success(res.message) + } else { + this.$message.error(res.message) + } + this.searchQuery() + }) + }, + loadData(arg) { + if (!this.url.list) { + this.$message.error('请设置url.list属性!') + return + } + //加载数据 若传入参数1则加载第一页的内容 + if (arg === 1) { + this.ipagination.current = 1 + } + this.onClearSelected() + var params = this.getQueryParams() //查询条件 + this.loading = true + getAction(this.url.list, params).then(res => { + if (res.success) { + this.dataSource = res.result.records + this.ipagination.total = res.result.total + } + if (res.code === 510) { + this.$message.warning(res.message) + } + this.loading = false + }) + }, + getSuperFieldList() { + let fieldList = [] + fieldList.push({ type: 'string', value: 'locationCode', text: '库位编码', dictCode: '' }) + fieldList.push({ type: 'string', value: 'locationContainerCode', text: '库位表容器编码', dictCode: '' }) + fieldList.push({ type: 'string', value: 'locationStatus', text: '库位表状态', dictCode: 'location_status' }) + fieldList.push({ type: 'string', value: 'containerContainerCode', text: '托盘表容器编码', dictCode: '' }) + fieldList.push({ type: 'string', value: 'containerStatus', text: '托盘表状态', dictCode: '' }) + fieldList.push({ type: 'string', value: 'inventoryContainerCode', text: '库存表容器编码', dictCode: '' }) + fieldList.push({ type: 'string', value: 'inventoryStatus', text: '库存表状态', dictCode: '' }) + fieldList.push({ type: 'string', value: 'wcsContainerCode', text: 'WCS库位容器编码' }) + fieldList.push({ type: 'string', value: 'wcsLocationStatus', text: 'WCS库位表状态', dictCode: '' }) + this.superFieldList = fieldList + } + } +} +</script> +<style scoped> +@import '~@assets/less/common.less'; +</style> \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/system/compare/CompareWcsLocationTask.vue b/ant-design-vue-jeecg/src/views/system/compare/CompareWcsLocationTask.vue new file mode 100644 index 0000000..d02a9f9 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/system/compare/CompareWcsLocationTask.vue @@ -0,0 +1,190 @@ +<template> + <a-card :bordered="false" :class="'cust-erp-sub-tab'"> + <!-- 查询区域 --> + <div class="table-page-search-wrapper"> + <a-form layout="inline" @keyup.enter.native="searchQuery"> + <a-row :gutter="24"> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="WMS任务ID"> + <a-input placeholder="请输入WMS任务ID" v-model="queryParam.wmsId"></a-input> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="WCS任务ID"> + <a-input placeholder="请输入WMS任务ID" v-model="queryParam.wcsId"></a-input> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="WMS任务类型"> + <j-dict-select-tag placeholder="请选择WMS任务类型" v-model="queryParam.taskType" dictCode="task_type" /> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> + <a-button type="primary" @click="searchQuery" icon="search">查询</a-button> + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> + </span> + </a-col> + </a-row> + </a-form> + </div> + <!-- 查询区域-END --> + + <!-- table区域-begin --> + <div> + <a-table + ref="table" + size="middle" + bordered + rowKey="wmsId" + :scroll="{ x: true }" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + @change="handleTableChange" + > + </a-table> + </div> + </a-card> +</template> +<script> +import { JeecgListMixin } from '@/mixins/JeecgListMixin' +import { initDictOptions, filterMultiDictText } from '@/components/dict/JDictSelectUtil' + +export default { + name: 'CompareWcsLocationTask', + mixins: [JeecgListMixin], + components: {}, + props: { + mainId: { + type: String, + default: '', + required: false + } + }, + watch: { + mainId: { + immediate: true, + handler(val) { + if (!this.mainId) { + this.clearList() + } else { + this.queryParam['locationCode'] = val + this.loadData(1) + } + } + } + }, + data() { + return { + description: '库位任务信息比较页面', + disableMixinCreated: true, + // 表头 + columns: [ + { + title: 'WMS任务ID', + align: 'center', + dataIndex: 'wmsId' + }, + { + title: 'WCS任务ID', + align: 'center', + dataIndex: 'wcsId' + }, + { + title: 'WMS任务类型', + align: 'center', + dataIndex: 'taskType_dictText' + }, + { + title: '源库位', + align: 'center', + dataIndex: 'fromLocationCode' + }, + { + title: 'WCS源库位', + align: 'center', + dataIndex: 'wcsFromLocationCode' + }, + { + title: '目标库位', + align: 'center', + dataIndex: 'toLocationCode' + }, + { + title: 'WCS目标库位', + align: 'center', + dataIndex: 'wcsToLocationCode' + }, + { + title: '托盘编码', + align: 'center', + dataIndex: 'containerCode' + }, + { + title: 'WCS托盘编码', + align: 'center', + dataIndex: 'wcsContainerCode' + }, + { + title: '任务状态', + align: 'center', + dataIndex: 'taskStatus' + }, + { + title: 'WCS任务状态', + align: 'center', + dataIndex: 'wcsTaskStatus' + }, + { + title: '任务创建时间', + align: 'center', + dataIndex: 'taskCreateTime' + }, + { + title: 'WCS任务创建时间', + align: 'center', + dataIndex: 'wcsTaskCreateTime' + } + ], + url: { + list: '/config/location/compareWcsLocationTask' + }, + dictOptions: { + taskType: [] + } + } + }, + created() { + this.getSuperFieldList() + this.loadFrom() + }, + methods: { + clearList() { + this.dataSource = [] + this.selectedRowKeys = [] + this.ipagination.current = 1 + }, + searchReset() { + var locationCode = this.queryParam['locationCode'] + this.queryParam = {} + this.queryParam['locationCode'] = locationCode + this.loadData(1) + }, + loadFrom() {}, + solutionCompany(value) { + var actions = [] + return actions.join('') + }, + getSuperFieldList() { + let fieldList = [] + fieldList.push({ type: 'int', value: 'taskType', text: 'WMS任务类型', dictCode: 'task_type' }) + this.superFieldList = fieldList + } + } +} +</script> +<style scoped> +@import '~@assets/less/common.less'; +</style> diff --git a/ant-design-vue-jeecg/src/views/system/config/LocationList.vue b/ant-design-vue-jeecg/src/views/system/config/LocationList.vue index 40b47c6..a5985b7 100644 --- a/ant-design-vue-jeecg/src/views/system/config/LocationList.vue +++ b/ant-design-vue-jeecg/src/views/system/config/LocationList.vue @@ -227,7 +227,7 @@ export default { }, data() { return { - description: '库位管理管理页面', + description: '库位管理页面', zoneList: [], locationTypeList: [], // 表头 diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/address/service/IAddressService.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/address/service/IAddressService.java index 87f1d1d..c848aa9 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/address/service/IAddressService.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/address/service/IAddressService.java @@ -11,7 +11,7 @@ import org.jeecg.modules.wms.config.address.entity.Address; */ public interface IAddressService extends IService<Address> { - Address getAddressByUrl(String url, String warehouseCode); + Address getAddressByUrl(String url); String getUrlByParam(String param, String warehouseCode, String zoneCode); diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/address/service/impl/AddressServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/address/service/impl/AddressServiceImpl.java index f4689a7..3307ba1 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/address/service/impl/AddressServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/address/service/impl/AddressServiceImpl.java @@ -21,10 +21,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements IAddressService { @Override - @Cacheable(cacheNames = "getAddressByUrl#300", key = "#root.methodName + '_' + #url + '_' + #warehouseCode") - public Address getAddressByUrl(String url, String warehouseCode) { + @Cacheable(cacheNames = "getAddressByUrl#300", key = "#root.methodName") + public Address getAddressByUrl(String url) { LambdaQueryWrapper<Address> addressLambdaQueryWrapper = Wrappers.lambdaQuery(); - addressLambdaQueryWrapper.eq(Address::getUrl, url).eq(Address::getWarehouseCode, warehouseCode).last(" limit 1"); + addressLambdaQueryWrapper.eq(Address::getUrl, url).last(" limit 1"); Address address = getOne(addressLambdaQueryWrapper); return address; } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/controller/LocationController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/controller/LocationController.java index a7302ab..3e33a59 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/controller/LocationController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/controller/LocationController.java @@ -279,8 +279,8 @@ public class LocationController extends JeecgController<Location, ILocationServi */ @AutoLog(value = "WCS库位信息比较") @ApiOperation(value = "库位管理-WCS库位信息比较", notes = "库位管理-WCS库位信息比较") - @PostMapping(value = "/compareWcsLocation") - public Result compareWcsLocation(@RequestBody @Validated QueryCompareLocationDto queryCompareLocationDto, HttpServletRequest request) { + @GetMapping(value = "/compareWcsLocation") + public Result compareWcsLocation(@Validated QueryCompareLocationDto queryCompareLocationDto, HttpServletRequest request) { HuahengJwtUtil.setWarehouseCode(request, queryCompareLocationDto); PageUtil<CompareLocationDto> compareLocationDtoPage = locationService.compareWcsLocation(queryCompareLocationDto); return Result.OK(compareLocationDtoPage); @@ -292,8 +292,8 @@ public class LocationController extends JeecgController<Location, ILocationServi * @return */ @ApiOperation(value = "库位管理-WCS库位任务信息比较", notes = "库位管理-WCS库位任务信息比较") - @PostMapping(value = "/compareWcsLocationTask") - public Result compareWcsLocationTask(@RequestBody @Validated QueryCompareLocationTaskDto queryCompareLocationTaskDto, HttpServletRequest request) { + @GetMapping(value = "/compareWcsLocationTask") + public Result compareWcsLocationTask(@Validated QueryCompareLocationTaskDto queryCompareLocationTaskDto, HttpServletRequest request) { HuahengJwtUtil.setWarehouseCode(request, queryCompareLocationTaskDto); PageUtil<CompareLocationTaskDto> compareLocationTaskDtoPage = locationService.compareWcsLocationTask(queryCompareLocationTaskDto); return Result.OK(compareLocationTaskDtoPage); diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/CompareLocationDto.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/CompareLocationDto.java index e41eae0..78e8892 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/CompareLocationDto.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/CompareLocationDto.java @@ -1,5 +1,8 @@ package org.jeecg.modules.wms.config.location.dto; +import org.jeecg.common.aspect.annotation.Dict; +import org.jeecgframework.poi.excel.annotation.Excel; + import lombok.Data; /** @@ -9,35 +12,36 @@ import lombok.Data; */ @Data public class CompareLocationDto { - + /** 仓库编码 */ private String warehouseCode; /** 库位编码 */ private String locationCode; - /** 库位表托盘编码 */ + /** 库位表容器编码 */ private String locationContainerCode; + + /** 库位表状态 */ + @Dict(dicCode = "location_status") + private String locationStatus; - /** 托盘表托盘编码 */ + /** 托盘表容器编码 */ private String containerContainerCode; + + /** 托盘表状态 */ + private String containerStatus; - /** 库存表托盘编码 */ + /** 库存表容器编码 */ private String inventoryContainerCode; - - /** WCS库位托盘编码 */ - private String wcsContainerCode; - - /** 库位状态 */ - private String locationStatus; - - /** 托盘状态 */ - private String containerStatus; - /** 库存状态 */ + /** 库存表状态 */ private String inventoryStatus; - /** WCS库位状态 */ + /** WCS库位容器编码 */ + private String wcsContainerCode; + + /** WCS库位表状态 */ private String wcsLocationStatus; } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/CompareLocationTaskDto.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/CompareLocationTaskDto.java index 069775f..c3aff6e 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/CompareLocationTaskDto.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/CompareLocationTaskDto.java @@ -2,6 +2,8 @@ package org.jeecg.modules.wms.config.location.dto; import javax.validation.constraints.NotNull; +import org.jeecg.common.aspect.annotation.Dict; + import lombok.Data; /** @@ -15,7 +17,7 @@ public class CompareLocationTaskDto { /** 仓库编码 */ private String warehouseCode; - /** 任务ID */ + /** WMS任务ID */ private Integer wmsId; /** WCS任务ID */ @@ -25,6 +27,7 @@ public class CompareLocationTaskDto { private String wcsIdString; /** 任务类型 */ + @Dict(dicCode = "task_type") private Integer taskType; /** 源库位 */ diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/QueryCompareLocationDto.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/QueryCompareLocationDto.java index 6c18b3c..1d06741 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/QueryCompareLocationDto.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/QueryCompareLocationDto.java @@ -1,7 +1,5 @@ package org.jeecg.modules.wms.config.location.dto; -import org.springframework.web.bind.annotation.RequestParam; - import lombok.Data; @Data @@ -19,15 +17,6 @@ public class QueryCompareLocationDto { /** 库位状态 */ private String locationStatus; - /** 托盘状态 */ - private String containerStatus; - - /** 库存状态 */ - private String inventoryStatus; - - /** WCS库位状态 */ - private String wcsLocationStatus; - /** 页码 */ private Integer pageNo = 1; diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/QueryCompareLocationTaskDto.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/QueryCompareLocationTaskDto.java index 5663971..753c0b4 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/QueryCompareLocationTaskDto.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/dto/QueryCompareLocationTaskDto.java @@ -1,7 +1,5 @@ package org.jeecg.modules.wms.config.location.dto; -import javax.validation.constraints.NotNull; - import lombok.Data; /** @@ -16,14 +14,16 @@ public class QueryCompareLocationTaskDto { private String warehouseCode; /** 库位编码 */ - @NotNull(message = "locationCode is empty") private String locationCode; - - /** 任务状态 */ - private Integer taskStatus; - - /** WCS任务状态 */ - private String wcsTaskStatus; + + /** WMS任务ID */ + private Integer wmsId; + + /** WCS任务ID */ + private Integer wcsId; + + /** 任务类型 */ + private Integer taskType; /** 页码 */ private Integer pageNo = 1; diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java index 2b64474..e3f26da 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java @@ -15,6 +15,7 @@ import java.util.stream.Collectors; import javax.annotation.Resource; +import org.apache.shiro.util.CollectionUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.exception.JeecgBootException; import org.jeecg.modules.wms.config.address.service.IAddressService; @@ -451,74 +452,68 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i // 初始化数据 Set<String> locationCodes = new HashSet<String>(); Map<String, Location> locationMap = new HashMap<String, Location>(); - Map<String, Container> containerMap = new HashMap<String, Container>(); + Map<String, List<Container>> containerMap = new HashMap<String, List<Container>>(); Map<String, List<InventoryDetail>> inventoryDetailMap = new HashMap<String, List<InventoryDetail>>(); - Map<String, WcsLocationDto> wcsLocationMap = new HashMap<String, WcsLocationDto>(); + Map<String, List<WcsLocationDto>> wcsLocationMap = new HashMap<String, List<WcsLocationDto>>(); // 1.获取WMS库位表库位信息 + Page<Location> page = new Page<Location>(queryCompareLocationDto.getPageNo(), queryCompareLocationDto.getPageSize()); LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); locationLambdaQueryWrapper.select(Location::getWarehouseCode, Location::getCode, Location::getContainerCode, Location::getStatus) .eq(Location::getWarehouseCode, queryCompareLocationDto.getWarehouseCode()) .eq(StringUtils.isNotEmpty(queryCompareLocationDto.getLocationCode()), Location::getCode, queryCompareLocationDto.getLocationCode()) - .eq(StringUtils.isNotEmpty(queryCompareLocationDto.getContainerCode()), Location::getContainerCode, queryCompareLocationDto.getContainerCode()); - List<Location> locationList = list(locationLambdaQueryWrapper); - if (locationList != null && locationList.size() > 0) { - locationMap.putAll(locationList.stream().collect(Collectors.toMap(Location::getCode, Function.identity(), (key1, key2) -> key2))); - locationCodes.addAll(locationList.stream().map(t -> t.getCode()).collect(Collectors.toSet())); + .eq(StringUtils.isNotEmpty(queryCompareLocationDto.getContainerCode()), Location::getContainerCode, queryCompareLocationDto.getContainerCode()) + .eq(StringUtils.isNotEmpty(queryCompareLocationDto.getLocationStatus()), Location::getStatus, queryCompareLocationDto.getLocationStatus()); + Page<Location> locationPage = page(page, locationLambdaQueryWrapper); + if (!CollectionUtils.isEmpty(locationPage.getRecords())) { + locationMap.putAll(locationPage.getRecords().stream().collect(Collectors.toMap(Location::getCode, Function.identity(), (key1, key2) -> key2))); + locationCodes.addAll(locationPage.getRecords().stream().map(t -> t.getCode()).collect(Collectors.toSet())); } // 2.获取WMS托盘表库位信息 LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); containerLambdaQueryWrapper.select(Container::getWarehouseCode, Container::getLocationCode, Container::getCode, Container::getStatus) - .eq(Container::getWarehouseCode, queryCompareLocationDto.getWarehouseCode()) - .eq(StringUtils.isNotEmpty(queryCompareLocationDto.getLocationCode()), Container::getLocationCode, queryCompareLocationDto.getLocationCode()) - .eq(StringUtils.isNotEmpty(queryCompareLocationDto.getContainerCode()), Container::getCode, queryCompareLocationDto.getContainerCode()); + .eq(Container::getWarehouseCode, queryCompareLocationDto.getWarehouseCode()).in(Container::getLocationCode, locationCodes); List<Container> containerList = containerService.list(containerLambdaQueryWrapper); - if (containerList != null && containerList.size() > 0) { - containerMap.putAll(containerList.stream().collect(Collectors.toMap(Container::getLocationCode, Function.identity(), (key1, key2) -> key2))); - locationCodes.addAll(containerList.stream().map(t -> t.getLocationCode()).collect(Collectors.toSet())); + if (!CollectionUtils.isEmpty(containerList)) { + containerMap.putAll(containerList.stream().collect(Collectors.groupingBy(Container::getLocationCode))); } // 3.获取WMS库存表库位信息 LambdaQueryWrapper<InventoryDetail> inventoryDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); inventoryDetailLambdaQueryWrapper .select(InventoryDetail::getWarehouseCode, InventoryDetail::getLocationCode, InventoryDetail::getContainerCode, InventoryDetail::getInventoryStatus) - .eq(InventoryDetail::getWarehouseCode, queryCompareLocationDto.getWarehouseCode()) - .eq(StringUtils.isNotEmpty(queryCompareLocationDto.getLocationCode()), InventoryDetail::getLocationCode, queryCompareLocationDto.getLocationCode()) - .eq(StringUtils.isNotEmpty(queryCompareLocationDto.getContainerCode()), InventoryDetail::getContainerCode, queryCompareLocationDto.getContainerCode()); + .eq(InventoryDetail::getWarehouseCode, queryCompareLocationDto.getWarehouseCode()).in(InventoryDetail::getLocationCode, locationCodes); List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper); - if (inventoryDetailList != null && inventoryDetailList.size() > 0) { + if (!CollectionUtils.isEmpty(inventoryDetailList)) { inventoryDetailMap.putAll(inventoryDetailList.stream().collect(Collectors.groupingBy(InventoryDetail::getLocationCode))); - locationCodes.addAll(inventoryDetailList.stream().map(t -> t.getLocationCode()).collect(Collectors.toSet())); } - + // 4.获取WCS库位信息 - String url = addressService.getUrlByParam(QuantityConstant.ADDRESS_WCS_LOCATION_INFO); - Map<String, Object> queryParamMap = new HashMap<String, Object>(); - if (StringUtils.isNotEmpty(queryCompareLocationDto.getWarehouseCode())) { - queryParamMap.put("warehouseCode", queryCompareLocationDto.getWarehouseCode()); - } - if (StringUtils.isNotEmpty(queryCompareLocationDto.getLocationCode())) { - queryParamMap.put("locations", Collections.singletonList(queryCompareLocationDto.getLocationCode())); - } - String jsonStringResult = OkHttpUtils.sendPostByJsonStr(url, JSON.toJSONString(queryParamMap)); - WcsResultDto<List<WcsLocationDto>> wcsResult = JSON.parseObject(jsonStringResult, new TypeReference<WcsResultDto<List<WcsLocationDto>>>() {}); - if (wcsResult.getCode() != null && wcsResult.getCode().equals(200)) { - List<WcsLocationDto> wcsLocationList = wcsResult.getData(); - if (wcsLocationList != null && wcsLocationList.size() > 0) { - if (StringUtils.isNotEmpty(queryCompareLocationDto.getContainerCode())) { - wcsLocationList = - wcsLocationList.stream().filter(t -> queryCompareLocationDto.getContainerCode().equals(t.getContainerCode())).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(locationCodes)) { + String url = addressService.getUrlByParam(QuantityConstant.ADDRESS_WCS_LOCATION_INFO); + Map<String, Object> queryParamMap = new HashMap<String, Object>(); + if (StringUtils.isNotEmpty(queryCompareLocationDto.getWarehouseCode())) { + queryParamMap.put("warehouseCode", queryCompareLocationDto.getWarehouseCode()); + } + queryParamMap.put("locations", locationCodes); + String jsonStringResult = OkHttpUtils.sendPostByJsonStr(url, JSON.toJSONString(queryParamMap)); + WcsResultDto<List<WcsLocationDto>> wcsResult = JSON.parseObject(jsonStringResult, new TypeReference<WcsResultDto<List<WcsLocationDto>>>() {}); + if (wcsResult.getCode() != null && wcsResult.getCode().equals(200)) { + List<WcsLocationDto> wcsLocationList = wcsResult.getData(); + if (!CollectionUtils.isEmpty(wcsLocationList)) { + if (StringUtils.isNotEmpty(queryCompareLocationDto.getContainerCode())) { + wcsLocationList = wcsLocationList.stream().filter(t -> queryCompareLocationDto.getContainerCode().equals(t.getContainerCode())) + .collect(Collectors.toList()); + } + wcsLocationMap.putAll(wcsLocationList.stream().collect(Collectors.groupingBy(WcsLocationDto::getLocationCode))); } - wcsLocationMap - .putAll(wcsLocationList.stream().collect(Collectors.toMap(WcsLocationDto::getLocationCode, Function.identity(), (key1, key2) -> key2))); - locationCodes.addAll(wcsLocationList.stream().map(t -> t.getLocationCode()).collect(Collectors.toSet())); } } // 对返回数据进行组装 List<CompareLocationDto> compareLocationDtoList = new ArrayList<CompareLocationDto>(); - if (locationCodes.size() > 0) { + if (!CollectionUtils.isEmpty(locationCodes)) { for (String locationCode : locationCodes) { if (StringUtils.isEmpty(locationCode)) { continue; @@ -531,56 +526,46 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i compareLocationDto.setLocationContainerCode(location.getContainerCode()); compareLocationDto.setLocationStatus(location.getStatus()); } - Container container = containerMap.get(locationCode); - if (container != null) { - compareLocationDto.setContainerContainerCode(container.getCode()); - compareLocationDto.setContainerStatus(container.getStatus()); + List<Container> containerGroupList = containerMap.get(locationCode); + if (!CollectionUtils.isEmpty(containerGroupList)) { + Set<String> containerCodes = containerGroupList.stream().map(t -> t.getCode()).collect(Collectors.toSet()); + Set<String> containerStatus = containerGroupList.stream().map(t -> t.getStatus()).collect(Collectors.toSet()); + + compareLocationDto.setContainerContainerCode(StringUtils.join(containerCodes, ",")); + compareLocationDto.setContainerStatus(StringUtils.join(containerStatus, ",")); } - List<InventoryDetail> detailList = inventoryDetailMap.get(locationCode); - if (detailList != null && detailList.size() > 0) { - Set<String> containerCodes = detailList.stream().map(t -> t.getContainerCode()).collect(Collectors.toSet()); - Set<String> inventoryStatus = detailList.stream().map(t -> t.getInventoryStatus()).collect(Collectors.toSet()); - compareLocationDto.setInventoryContainerCode(StringUtils.join(containerCodes, ",")); + List<InventoryDetail> inventoryGroupList = inventoryDetailMap.get(locationCode); + if (!CollectionUtils.isEmpty(inventoryGroupList)) { + Set<String> inventoryContainerCodes = inventoryGroupList.stream().map(t -> t.getContainerCode()).collect(Collectors.toSet()); + Set<String> inventoryStatus = inventoryGroupList.stream().map(t -> t.getInventoryStatus()).collect(Collectors.toSet()); + compareLocationDto.setInventoryContainerCode(StringUtils.join(inventoryContainerCodes, ",")); compareLocationDto.setInventoryStatus(StringUtils.join(inventoryStatus, ",")); } - WcsLocationDto wcsLocationDto = wcsLocationMap.get(locationCode); - if (wcsLocationDto != null) { - compareLocationDto.setWarehouseCode(wcsLocationDto.getWarehouseCode()); - compareLocationDto.setLocationCode(wcsLocationDto.getLocationCode()); - compareLocationDto.setWcsContainerCode(wcsLocationDto.getContainerCode()); - compareLocationDto.setWcsLocationStatus(wcsLocationDto.getStatus() + ""); + List<WcsLocationDto> wcsLocationGroupList = wcsLocationMap.get(locationCode); + if (!CollectionUtils.isEmpty(wcsLocationGroupList)) { + Set<String> wcsContainerCodes = wcsLocationGroupList.stream().map(t -> t.getContainerCode()).collect(Collectors.toSet()); + Set<Integer> wcsContainerStatus = wcsLocationGroupList.stream().map(t -> t.getStatus()).collect(Collectors.toSet()); + compareLocationDto.setWcsContainerCode(StringUtils.join(wcsContainerCodes, ",")); + compareLocationDto.setWcsLocationStatus(StringUtils.join(wcsContainerStatus, ",")); } compareLocationDtoList.add(compareLocationDto); } } - if (StringUtils.isNotEmpty(queryCompareLocationDto.getLocationStatus())) { - compareLocationDtoList = - compareLocationDtoList.stream().filter(t -> queryCompareLocationDto.getLocationStatus().equals(t.getLocationStatus())).collect(Collectors.toList()); - } - if (StringUtils.isNotEmpty(queryCompareLocationDto.getContainerStatus())) { - compareLocationDtoList = compareLocationDtoList.stream().filter(t -> queryCompareLocationDto.getContainerStatus().equals(t.getContainerStatus())) - .collect(Collectors.toList()); - } - if (StringUtils.isNotEmpty(queryCompareLocationDto.getInventoryStatus())) { - compareLocationDtoList = compareLocationDtoList.stream().filter(t -> queryCompareLocationDto.getInventoryStatus().equals(t.getInventoryStatus())) - .collect(Collectors.toList()); - } - if (StringUtils.isNotEmpty(queryCompareLocationDto.getWcsLocationStatus())) { - compareLocationDtoList = compareLocationDtoList.stream().filter(t -> queryCompareLocationDto.getWcsLocationStatus().equals(t.getWcsLocationStatus())) - .collect(Collectors.toList()); - } Collections.sort(compareLocationDtoList, Comparator.comparing(CompareLocationDto::getLocationCode)); - return PageUtil.create(compareLocationDtoList, queryCompareLocationDto.getPageNo(), queryCompareLocationDto.getPageSize()); + return PageUtil.create(compareLocationDtoList, new Long(locationPage.getCurrent()).intValue(), new Long(locationPage.getSize()).intValue(), + new Long(locationPage.getTotal()).intValue()); } @Override public PageUtil<CompareLocationTaskDto> compareWcsLocationTask(QueryCompareLocationTaskDto queryCompareLocationTaskDto) { + List<CompareLocationTaskDto> finalCompareLocationTaskList = new ArrayList<CompareLocationTaskDto>(); + if (queryCompareLocationTaskDto.getLocationCode() == null) { + return PageUtil.create(finalCompareLocationTaskList, queryCompareLocationTaskDto.getPageNo(), queryCompareLocationTaskDto.getPageSize()); + } + String queryCreateTime = DateUtil.format(DateUtil.offsetDay(new Date(), -31), DatePattern.NORM_DATE_PATTERN); // 1.获取WMS任务信息 LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); - // 只查询近一个月的数据 - String queryCreateTime = DateUtil.format(DateUtil.offsetDay(new Date(), -31), DatePattern.NORM_DATE_PATTERN); - taskHeaderLambdaQueryWrapper .select(TaskHeader::getId, TaskHeader::getWarehouseCode, TaskHeader::getTaskType, TaskHeader::getFromLocationCode, TaskHeader::getToLocationCode, TaskHeader::getContainerCode, TaskHeader::getStatus, TaskHeader::getCreateTime) @@ -615,11 +600,10 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i // 对返回数据进行组装 List<CompareLocationTaskDto> wcsCompareLocationTaskList = new ArrayList<CompareLocationTaskDto>(); - List<CompareLocationTaskDto> finalCompareLocationTaskList = new ArrayList<CompareLocationTaskDto>(); - if (taskHeaderList != null && taskHeaderList.size() > 0) { + if (!CollectionUtils.isEmpty(taskHeaderList)) { for (TaskHeader taskHeader : taskHeaderList) { List<WcsTaskDto> wcsTaskDtoList = wcsTaskMap.get(taskHeader.getId()); - if (wcsTaskDtoList != null && wcsTaskDtoList.size() > 0) { + if (!CollectionUtils.isEmpty(wcsTaskDtoList)) { CompareLocationTaskDto compareLocationTaskDto = new CompareLocationTaskDto(); // 组装WMS数据 compareLocationTaskDto.setWmsId(taskHeader.getId()); @@ -660,7 +644,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i } // 组装wcs自己的任务 List<WcsTaskDto> wcsTaskDtoList = wcsTaskMap.get(0); - if (wcsTaskDtoList != null && wcsTaskDtoList.size() > 0) { + if (!CollectionUtils.isEmpty(wcsTaskDtoList)) { for (WcsTaskDto wcsTaskDto : wcsTaskDtoList) { CompareLocationTaskDto compareLocationTaskDto = new CompareLocationTaskDto(); // 组装WCS数据 @@ -674,13 +658,25 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i wcsCompareLocationTaskList.add(compareLocationTaskDto); } } - if (finalCompareLocationTaskList.size() > 0) { + if (!CollectionUtils.isEmpty(finalCompareLocationTaskList)) { Collections.sort(finalCompareLocationTaskList, Comparator.comparing(CompareLocationTaskDto::getWmsId).reversed()); } - if (wcsCompareLocationTaskList.size() > 0) { + if (!CollectionUtils.isEmpty(wcsCompareLocationTaskList)) { Collections.sort(wcsCompareLocationTaskList, Comparator.comparing(CompareLocationTaskDto::getWcsId).reversed()); } finalCompareLocationTaskList.addAll(wcsCompareLocationTaskList); + if (queryCompareLocationTaskDto.getWmsId() != null) { + finalCompareLocationTaskList = + finalCompareLocationTaskList.stream().filter(t -> queryCompareLocationTaskDto.getWmsId().equals(t.getWmsId())).collect(Collectors.toList()); + } + if (queryCompareLocationTaskDto.getWcsId() != null) { + finalCompareLocationTaskList = + finalCompareLocationTaskList.stream().filter(t -> queryCompareLocationTaskDto.getWcsId().equals(t.getWcsId())).collect(Collectors.toList()); + } + if (queryCompareLocationTaskDto.getTaskType() != null) { + finalCompareLocationTaskList = + finalCompareLocationTaskList.stream().filter(t -> queryCompareLocationTaskDto.getTaskType().equals(t.getTaskType())).collect(Collectors.toList()); + } return PageUtil.create(finalCompareLocationTaskList, queryCompareLocationTaskDto.getPageNo(), queryCompareLocationTaskDto.getPageSize()); } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/utils/PageUtil.java b/huaheng-wms-core/src/main/java/org/jeecg/utils/PageUtil.java index 8954298..dfaff9e 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/utils/PageUtil.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/utils/PageUtil.java @@ -19,25 +19,37 @@ public class PageUtil<T> { private int total; /** 集合 */ - private List<T> data; + private List<T> records; - private PageUtil(List<T> data, int current, int size) { - if (data == null || data.isEmpty()) { - throw new IllegalArgumentException("data is empty"); - } + private PageUtil(List<T> records, int current, int size) { this.current = current; this.size = size; - this.total = data.size(); + if (records == null || records.isEmpty()) { + this.records = Collections.emptyList(); + return; + } + this.total = records.size(); int fromIndex = (current - 1) * size; - if (fromIndex >= data.size()) { - this.data = Collections.emptyList(); + if (fromIndex >= records.size()) { + this.records = Collections.emptyList(); return; } int toIndex = current * size; - if (toIndex >= data.size()) { - toIndex = data.size(); + if (toIndex >= records.size()) { + toIndex = records.size(); } - this.data = data.subList(fromIndex, toIndex); + this.records = records.subList(fromIndex, toIndex); + } + + private PageUtil(List<T> records, int current, int size, int total) { + this.current = current; + this.size = size; + this.total = total; + if (records == null || records.isEmpty()) { + this.records = Collections.emptyList(); + return; + } + this.records = records; } /** @@ -50,4 +62,8 @@ public class PageUtil<T> { public static <T> PageUtil<T> create(List<T> data, int current, int size) { return new PageUtil<T>(data, current, size); } + + public static <T> PageUtil<T> create(List<T> data, int current, int size, int total) { + return new PageUtil<T>(data, current, size, total); + } } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/utils/aspect/ApiLoggerAspect.java b/huaheng-wms-core/src/main/java/org/jeecg/utils/aspect/ApiLoggerAspect.java index 0b1463b..a5591a4 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/utils/aspect/ApiLoggerAspect.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/utils/aspect/ApiLoggerAspect.java @@ -22,6 +22,7 @@ import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.reflect.MethodSignature; import org.jeecg.JeecgSystemApplication; import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.wms.config.address.entity.Address; import org.jeecg.modules.wms.config.address.service.IAddressService; import org.jeecg.modules.wms.monitor.apiLog.entity.ApiLog; import org.jeecg.modules.wms.monitor.apiLog.service.IApiLogService; @@ -29,6 +30,7 @@ import org.jeecg.utils.ServletUtils; import org.jeecg.utils.SpringUtils; import org.jeecg.utils.StringUtils; import org.jeecg.utils.config.ApplicationConfig; +import org.jeecg.utils.constant.QuantityConstant; import org.jeecg.utils.support.ApiLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; @@ -300,8 +302,8 @@ public class ApiLoggerAspect { apiLog.setApiName(apiName); apiLog.setRequestFrom(HUAHENG_SYSTEM_NAME); apiLog.setIp(ip); -// Address address = addressService.getAddressByUrl(url.toString(), QuantityConstant.DEFAULT_WAREHOUSE); -// apiLog.setResponseBy(address.getParam().toUpperCase()); + Address address = addressService.getAddressByUrl(url.toString()); + apiLog.setResponseBy(address.getParam().toUpperCase()); } catch (Exception e) { e.printStackTrace(); } -- libgit2 0.22.2