From 051b62205f21d7356cb70aa1ae90b96380b7dc68 Mon Sep 17 00:00:00 2001 From: youjie <272855983@qq.com> Date: Sat, 19 Nov 2022 19:21:20 +0800 Subject: [PATCH] 增加库存、库存明细、库存交易、下发任务等 --- jeecg-boot-master/ant-design-vue-jeecg/src/api/api.js | 1 + jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailList.vue | 254 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryHeaderList.vue | 322 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryTransactionList.vue | 325 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryDetailModal.vue | 184 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryHeaderModal.vue | 145 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryTransactionForm.vue | 154 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryTransactionModal.Style#Drawer.vue | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryTransactionModal.vue | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/ApiLogList.vue | 316 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/modules/ApiLogForm.vue | 179 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/modules/ApiLogModal.Style#Drawer.vue | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/modules/ApiLogModal.vue | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerDetailList.vue | 9 ++------- jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerHeaderList.vue | 5 +++++ jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptDetailList.vue | 9 ++------- jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptHeaderList.vue | 5 +++++ jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiptDetailModal.vue | 4 ++-- jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/TaskDetailList.vue | 9 ++------- jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/TaskHeaderList.vue | 21 ++++++++++++++++++++- jeecg-boot-master/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/base/controller/JeecgController.java | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/controller/WcsController.java | 3 ++- jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsService.java | 2 ++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java | 159 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------- jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/address/service/IAddressService.java | 1 + jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/address/service/impl/AddressServiceImpl.java | 10 ++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/service/ILocationService.java | 9 ++++++--- jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java | 26 +++++++++++++++++++------- jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/Convert.java | 1005 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/ServletUtils.java | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/ApiLogAspect.java | 519 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/annotation/ApiLogger.java | 25 +++++++++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/BusinessStatus.java | 19 +++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/BusinessType.java | 29 +++++++++++++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/DataSourceName.java | 19 +++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/OperatorType.java | 22 ++++++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/ProcessCode.java | 39 +++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/datasource/DynamicDataSource.java | 28 ++++++++++++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/datasource/DynamicDataSourceContextHolder.java | 46 ++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/spring/SpringUtils.java | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/controller/InventoryHeaderController.java | 301 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryDetail.java | 137 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryHeader.java | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/mapper/InventoryDetailMapper.java | 20 ++++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/mapper/InventoryHeaderMapper.java | 17 +++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/mapper/xml/InventoryDetailMapper.xml | 18 ++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/mapper/xml/InventoryHeaderMapper.xml | 5 +++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryDetailService.java | 19 +++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryHeaderService.java | 30 ++++++++++++++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryDetailServiceImpl.java | 39 +++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryHeaderServiceImpl.java | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/controller/InventoryTransactionController.java | 174 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/entity/InventoryTransaction.java | 147 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/mapper/InventoryTransactionMapper.java | 17 +++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/mapper/xml/InventoryTransactionMapper.xml | 5 +++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/service/IInventoryTransactionService.java | 14 ++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/service/impl/InventoryTransactionServiceImpl.java | 19 +++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/controller/ApiLogController.java | 171 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/entity/ApiLog.java | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/mapper/ApiLogMapper.java | 17 +++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/mapper/xml/ApiLogMapper.xml | 5 +++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/service/IApiLogService.java | 14 ++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/service/impl/ApiLogServiceImpl.java | 19 +++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/IReceiptContainerHeaderService.java | 3 +++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/impl/ReceiptContainerHeaderServiceImpl.java | 11 +++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiving/service/impl/ReceiveServiceImpl.java | 2 +- jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/controller/TaskHeaderController.java | 46 +++++++++++++++++++++++++++++++++++++++++++++- jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskDetailService.java | 6 ++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskHeaderService.java | 6 +++++- jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskDetailServiceImpl.java | 7 +++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java | 292 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/utils/constant/QuantityConstant.java | 2 +- 72 files changed, 6283 insertions(+), 47 deletions(-) create mode 100644 jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailList.vue create mode 100644 jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryHeaderList.vue create mode 100644 jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryTransactionList.vue create mode 100644 jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryDetailModal.vue create mode 100644 jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryHeaderModal.vue create mode 100644 jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryTransactionForm.vue create mode 100644 jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryTransactionModal.Style#Drawer.vue create mode 100644 jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryTransactionModal.vue create mode 100644 jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/ApiLogList.vue create mode 100644 jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/modules/ApiLogForm.vue create mode 100644 jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/modules/ApiLogModal.Style#Drawer.vue create mode 100644 jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/modules/ApiLogModal.vue create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/Convert.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/ServletUtils.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/ApiLogAspect.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/annotation/ApiLogger.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/BusinessStatus.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/BusinessType.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/DataSourceName.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/OperatorType.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/ProcessCode.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/datasource/DynamicDataSource.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/datasource/DynamicDataSourceContextHolder.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/spring/SpringUtils.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/controller/InventoryHeaderController.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryDetail.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryHeader.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/mapper/InventoryDetailMapper.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/mapper/InventoryHeaderMapper.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/mapper/xml/InventoryDetailMapper.xml create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/mapper/xml/InventoryHeaderMapper.xml create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryDetailService.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryHeaderService.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryDetailServiceImpl.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryHeaderServiceImpl.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/controller/InventoryTransactionController.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/entity/InventoryTransaction.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/mapper/InventoryTransactionMapper.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/mapper/xml/InventoryTransactionMapper.xml create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/service/IInventoryTransactionService.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/service/impl/InventoryTransactionServiceImpl.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/controller/ApiLogController.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/entity/ApiLog.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/mapper/ApiLogMapper.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/mapper/xml/ApiLogMapper.xml create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/service/IApiLogService.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/service/impl/ApiLogServiceImpl.java diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/api/api.js b/jeecg-boot-master/ant-design-vue-jeecg/src/api/api.js index b450fc9..536bdda 100644 --- a/jeecg-boot-master/ant-design-vue-jeecg/src/api/api.js +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/api/api.js @@ -107,6 +107,7 @@ export const getShipmentTypeList = (params)=>getAction('/config/shipmentType/get export const searchMaterialByCode = (params)=>postAction('/config/material/searchMaterialByCode', params); export const listReceiveByReceiptId = (params)=>postAction('/receipt/receiveHeader/listReceiveByReceiptId', params); export const createTask = (params)=>postAction('/receipt/receiptContainerHeader/createTask', params); +export const completeTaskByWMS = (params)=>postAction('/task/taskHeader/completeTaskByWMS', params); // 中转HTTP请求 diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailList.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailList.vue new file mode 100644 index 0000000..b5eda43 --- /dev/null +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailList.vue @@ -0,0 +1,254 @@ +<template> + <a-card :bordered="false" :class="'cust-erp-sub-tab'"> + <!-- 操作按钮区域 --> + <div class="table-operator" v-if="mainId"> + <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> + <a-button type="primary" icon="download" @click="handleExportXls('库存详情')">导出</a-button> + <a-upload + name="file" + :showUploadList="false" + :multiple="false" + :headers="tokenHeader" + :action="importExcelUrl" + @change="handleImportExcel"> + <a-button type="primary" icon="import">导入</a-button> + </a-upload> + <a-dropdown v-if="selectedRowKeys.length > 0"> + <a-menu slot="overlay"> + <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> + </a-menu> + <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> + </a-dropdown> + </div> + + <!-- table区域-begin --> + <div> + <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> + <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 + <a style="margin-left: 24px" @click="onClearSelected">清空</a> + </div> + + <a-table + ref="table" + size="middle" + bordered + rowKey="id" + :scroll="{x:true}" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" + @change="handleTableChange"> + + <template slot="htmlSlot" slot-scope="text"> + <div v-html="text"></div> + </template> + <template slot="imgSlot" slot-scope="text"> + <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> + <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> + </template> + <template slot="fileSlot" slot-scope="text"> + <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> + <a-button + v-else + :ghost="true" + type="primary" + icon="download" + size="small" + @click="downloadFile(text)"> + 下载 + </a-button> + </template> + + <span slot="action" slot-scope="text, record"> + <a @click="handleEdit(record)">编辑</a> + <a-divider type="vertical" /> + <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> + <a>删除</a> + </a-popconfirm> + </span> + + </a-table> + </div> + + <inventoryDetail-modal ref="modalForm" @ok="modalFormOk" :mainId="mainId"></inventoryDetail-modal> + </a-card> +</template> + +<script> + + import { JeecgListMixin } from '@/mixins/JeecgListMixin' + import InventoryDetailModal from './modules/InventoryDetailModal' + + export default { + name: "InventoryDetailList", + mixins:[JeecgListMixin], + components: { InventoryDetailModal }, + props:{ + mainId:{ + type:String, + default:'', + required:false + } + }, + watch:{ + mainId:{ + immediate: true, + handler(val) { + if(!this.mainId){ + this.clearList() + }else{ + this.queryParam['inventoryHeaderId'] = val + this.loadData(1); + } + } + } + }, + data () { + return { + description: '库存表管理页面', + disableMixinCreated:true, + // 表头 + columns: [ + { + title:'库存详情ID', + align:"center", + dataIndex: 'id' + }, + { + title:'货主', + align:"center", + dataIndex: 'companyCode' + }, + { + title:'库区', + align:"center", + dataIndex: 'zoneCode' + }, + { + title:'容器编码', + align:"center", + dataIndex: 'containerCode' + }, + { + title:'库位编码', + align:"center", + dataIndex: 'locationCode' + }, + { + title:'物料编码', + align:"center", + dataIndex: 'materialCode' + }, + { + title:'物料名称', + align:"center", + dataIndex: 'materialName' + }, + { + title:'物料规格', + align:"center", + dataIndex: 'materialSpec' + }, + { + title:'物料单位', + align:"center", + dataIndex: 'materialUnit' + }, + { + title:'数量', + align:"center", + dataIndex: 'qty' + }, + { + title:'任务锁定数量', + align:"center", + dataIndex: 'taskQty' + }, + { + title:'库存状态', + align:"center", + dataIndex: 'inventoryStatus_dictText', + }, + { + title:'批次', + align:"center", + dataIndex: 'batch' + }, + { + title:'唯一号', + align:"center", + dataIndex: 'uniqueCode' + }, + { + title:'入库日期', + align:"center", + dataIndex: 'receiptDate' + }, + { + title:'库龄(天)', + align:"center", + dataIndex: 'inventoryAge' + }, + { + title:'创建人', + align:"center", + dataIndex: 'createBy' + }, + { + title:'创建日期', + align:"center", + dataIndex: 'createTime' + }, + { + title:'更新人', + align:"center", + dataIndex: 'updateBy' + }, + { + title:'更新日期', + align:"center", + dataIndex: 'updateTime' + }, + { + title: '操作', + dataIndex: 'action', + align:"center", + fixed:"right", + width:147, + scopedSlots: { customRender: 'action' }, + } + ], + url: { + list: "/inventory/inventoryHeader/listInventoryDetailByMainId", + delete: "/inventory/inventoryHeader/deleteInventoryDetail", + deleteBatch: "/inventory/inventoryHeader/deleteBatchInventoryDetail", + exportXlsUrl: "/inventory/inventoryHeader/exportInventoryDetail", + importUrl: "/inventory/inventoryHeader/importInventoryDetail", + }, + dictOptions:{ + containerStatus:[], + } + } + }, + created() { + }, + computed: { + importExcelUrl(){ + return `${window._CONFIG['domianURL']}/${this.url.importUrl}/${this.mainId}`; + } + }, + methods: { + clearList(){ + this.dataSource=[] + this.selectedRowKeys=[] + this.ipagination.current = 1 + } + + } + } +</script> +<style scoped> + @import '~@assets/less/common.less' +</style> diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryHeaderList.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryHeaderList.vue new file mode 100644 index 0000000..92fb46e --- /dev/null +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryHeaderList.vue @@ -0,0 +1,322 @@ +<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.companyCode"></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.zoneCode"></a-input> + </a-form-item> + </a-col> + <template v-if="toggleSearchStatus"> + <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.containerStatus" dictCode="container_status"/> + </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.locationCode"></a-input> + </a-form-item> + </a-col> + <a-col :xl="10" :lg="11" :md="12" :sm="24"> + <a-form-item label="创建日期"> + <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.createTime_begin"></j-date> + <span class="query-group-split-cust"></span> + <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.createTime_end"></j-date> + </a-form-item> + </a-col> + </template> + <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> + <a @click="handleToggleSearch" style="margin-left: 8px"> + {{ toggleSearchStatus ? '收起' : '展开' }} + <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/> + </a> + </span> + </a-col> + </a-row> + </a-form> + </div> + <!-- 查询区域-END --> + + <!-- 操作按钮区域 --> + <div class="table-operator"> + <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> + <a-button type="primary" icon="download" @click="handleExportXls('库存表')">导出</a-button> + <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> + <a-button type="primary" icon="import">导入</a-button> + </a-upload> + <!-- 高级查询区域 --> + <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> + </div> + + <!-- table区域-begin --> + <div> + <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> + <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 + <a style="margin-left: 24px" @click="onClearSelected">清空</a> + </div> + + <a-table + ref="table" + size="middle" + bordered + rowKey="id" + class="j-table-force-nowrap" + :scroll="{x:true}" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio'}" + :customRow="clickThenSelect" + @change="handleTableChange"> + + <template slot="htmlSlot" slot-scope="text"> + <div v-html="text"></div> + </template> + <template slot="imgSlot" slot-scope="text"> + <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> + <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> + </template> + <template slot="fileSlot" slot-scope="text"> + <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> + <a-button + v-else + :ghost="true" + type="primary" + icon="download" + size="small" + @click="downloadFile(text)"> + 下载 + </a-button> + </template> + + <span slot="action" slot-scope="text, record"> + <a @click="handleEdit(record)">编辑</a> + + <a-divider type="vertical" /> + <a-dropdown> + <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> + <a-menu slot="overlay"> + <a-menu-item> + <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> + <a>删除</a> + </a-popconfirm> + </a-menu-item> + </a-menu> + </a-dropdown> + </span> + + </a-table> + </div> + + <a-tabs defaultActiveKey="1"> + <a-tab-pane tab="库存详情" key="1" > + <InventoryDetailList :mainId="selectedMainId" /> + </a-tab-pane> + </a-tabs> + + <inventoryHeader-modal ref="modalForm" @ok="modalFormOk"></inventoryHeader-modal> + </a-card> +</template> + +<script> + + import { JeecgListMixin } from '@/mixins/JeecgListMixin' + import InventoryHeaderModal from './modules/InventoryHeaderModal' + import { getAction } from '@/api/manage' + import InventoryDetailList from './InventoryDetailList' + import {initDictOptions,filterMultiDictText} from '@/components/dict/JDictSelectUtil' + import '@/assets/less/TableExpand.less' + + export default { + name: "InventoryHeaderList", + mixins:[JeecgListMixin], + components: { + InventoryDetailList, + InventoryHeaderModal + }, + data () { + return { + description: '库存表管理页面', + // 表头 + columns: [ + { + title:'库存ID', + align:"center", + dataIndex: 'id' + }, + { + title:'库区', + align:"center", + dataIndex: 'zoneCode' + }, + { + title:'容器号', + align:"center", + dataIndex: 'containerCode' + }, + { + title:'容器状态', + align:"center", + dataIndex: 'containerStatus_dictText', + }, + { + title:'库位号', + align:"center", + dataIndex: 'locationCode' + }, + { + title:'总数量', + align:"center", + dataIndex: 'totalQty' + }, + { + title:'总行量', + align:"center", + dataIndex: 'totalLines' + }, + { + title:'创建人', + align:"center", + dataIndex: 'createBy' + }, + { + title:'创建日期', + align:"center", + dataIndex: 'createTime' + }, + { + title:'更新人', + align:"center", + dataIndex: 'updateBy' + }, + { + title:'更新日期', + align:"center", + dataIndex: 'updateTime' + }, + { + title: '操作', + dataIndex: 'action', + align:"center", + fixed:"right", + width:147, + scopedSlots: { customRender: 'action' }, + } + ], + url: { + list: "/inventory/inventoryHeader/list", + delete: "/inventory/inventoryHeader/delete", + deleteBatch: "/inventory/inventoryHeader/deleteBatch", + exportXlsUrl: "/inventory/inventoryHeader/exportXls", + importExcelUrl: "inventory/inventoryHeader/importExcel", + }, + dictOptions:{ + containerStatus:[], + }, + /* 分页参数 */ + 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.id.split(","), [record]); + } + } + } + }, + onClearSelected() { + this.selectedRowKeys = []; + this.selectionRows = []; + this.selectedMainId='' + }, + onSelectChange(selectedRowKeys, selectionRows) { + this.selectedMainId=selectedRowKeys[0] + this.selectedRowKeys = selectedRowKeys; + this.selectionRows = selectionRows; + }, + 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:'companyCode',text:'货主',dictCode:''}) + fieldList.push({type:'string',value:'zoneCode',text:'库区',dictCode:''}) + fieldList.push({type:'string',value:'containerCode',text:'容器号',dictCode:''}) + fieldList.push({type:'string',value:'containerStatus',text:'容器状态',dictCode:'container_status'}) + fieldList.push({type:'string',value:'locationCode',text:'库位号',dictCode:''}) + fieldList.push({type:'BigDecimal',value:'totalQty',text:'总数量',dictCode:''}) + fieldList.push({type:'int',value:'totalLines',text:'总行量',dictCode:''}) + fieldList.push({type:'string',value:'createBy',text:'创建人',dictCode:''}) + fieldList.push({type:'datetime',value:'createTime',text:'创建日期'}) + fieldList.push({type:'string',value:'updateBy',text:'更新人',dictCode:''}) + fieldList.push({type:'datetime',value:'updateTime',text:'更新日期'}) + this.superFieldList = fieldList + } + } + } +</script> +<style scoped> + @import '~@assets/less/common.less' +</style> \ No newline at end of file diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryTransactionList.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryTransactionList.vue new file mode 100644 index 0000000..ed2a8e7 --- /dev/null +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryTransactionList.vue @@ -0,0 +1,325 @@ +<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.companyCode"></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> + <template v-if="toggleSearchStatus"> + <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="交易类型"> + <j-dict-select-tag placeholder="请选择交易类型" v-model="queryParam.type" dictCode="inventory_transaction_type"/> + </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.materialCode"></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.materialName"></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.materialSpec"></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.materialUnit"></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.inventoryStatus"></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.batch"></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.createBy"></a-input> + </a-form-item> + </a-col> + <a-col :xl="10" :lg="11" :md="12" :sm="24"> + <a-form-item label="创建日期"> + <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.createTime_begin"></j-date> + <span class="query-group-split-cust"></span> + <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.createTime_end"></j-date> + </a-form-item> + </a-col> + </template> + <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> + <a @click="handleToggleSearch" style="margin-left: 8px"> + {{ toggleSearchStatus ? '收起' : '展开' }} + <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/> + </a> + </span> + </a-col> + </a-row> + </a-form> + </div> + <!-- 查询区域-END --> + + <!-- 操作按钮区域 --> + <div class="table-operator"> + <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> + <a-button type="primary" icon="download" @click="handleExportXls('库存交易记录')">导出</a-button> + <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> + <a-button type="primary" icon="import">导入</a-button> + </a-upload> + <!-- 高级查询区域 --> + <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> + <a-dropdown v-if="selectedRowKeys.length > 0"> + <a-menu slot="overlay"> + <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> + </a-menu> + <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> + </a-dropdown> + </div> + + <!-- table区域-begin --> + <div> + <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> + <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 + <a style="margin-left: 24px" @click="onClearSelected">清空</a> + </div> + + <a-table + ref="table" + size="middle" + :scroll="{x:true}" + bordered + rowKey="id" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" + class="j-table-force-nowrap" + @change="handleTableChange"> + + <template slot="htmlSlot" slot-scope="text"> + <div v-html="text"></div> + </template> + <template slot="imgSlot" slot-scope="text"> + <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> + <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> + </template> + <template slot="fileSlot" slot-scope="text"> + <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> + <a-button + v-else + :ghost="true" + type="primary" + icon="download" + size="small" + @click="downloadFile(text)"> + 下载 + </a-button> + </template> + + <span slot="action" slot-scope="text, record"> + <a @click="handleEdit(record)">编辑</a> + + <a-divider type="vertical" /> + <a-dropdown> + <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> + <a-menu slot="overlay"> + <a-menu-item> + <a @click="handleDetail(record)">详情</a> + </a-menu-item> + <a-menu-item> + <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> + <a>删除</a> + </a-popconfirm> + </a-menu-item> + </a-menu> + </a-dropdown> + </span> + + </a-table> + </div> + + <inventory-transaction-modal ref="modalForm" @ok="modalFormOk"></inventory-transaction-modal> + </a-card> +</template> + +<script> + + import '@/assets/less/TableExpand.less' + import { mixinDevice } from '@/utils/mixin' + import { JeecgListMixin } from '@/mixins/JeecgListMixin' + import InventoryTransactionModal from './modules/InventoryTransactionModal' + import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' + + export default { + name: 'InventoryTransactionList', + mixins:[JeecgListMixin, mixinDevice], + components: { + InventoryTransactionModal + }, + data () { + return { + description: '库存交易记录管理页面', + // 表头 + columns: [ + { + title:'库存交易ID', + align:"center", + dataIndex: 'id' + }, + { + title:'货主', + align:"center", + dataIndex: 'companyCode' + }, + { + title:'容器编码', + align:"center", + dataIndex: 'containerCode' + }, + { + title:'库位编码', + align:"center", + dataIndex: 'locationCode' + }, + { + title:'交易类型', + align:"center", + dataIndex: 'type_dictText' + }, + { + title:'物料编码', + align:"center", + dataIndex: 'materialCode' + }, + { + title:'物料名称', + align:"center", + dataIndex: 'materialName' + }, + { + title:'物料规格', + align:"center", + dataIndex: 'materialSpec' + }, + { + title:'物料单位', + align:"center", + dataIndex: 'materialUnit' + }, + { + title:'库存状态', + align:"center", + dataIndex: 'inventoryStatus' + }, + { + title:'数量', + align:"center", + dataIndex: 'qty' + }, + { + title:'批次', + align:"center", + dataIndex: 'batch' + }, + { + title:'创建人', + align:"center", + dataIndex: 'createBy' + }, + { + title:'创建日期', + align:"center", + dataIndex: 'createTime' + }, + { + title:'更新人', + align:"center", + dataIndex: 'updateBy' + }, + { + title:'更新日期', + align:"center", + dataIndex: 'updateTime' + }, + { + title: '操作', + dataIndex: 'action', + align:"center", + fixed:"right", + width:147, + scopedSlots: { customRender: 'action' } + } + ], + url: { + list: "/inventory/inventoryTransaction/list", + delete: "/inventory/inventoryTransaction/delete", + deleteBatch: "/inventory/inventoryTransaction/deleteBatch", + exportXlsUrl: "/inventory/inventoryTransaction/exportXls", + importExcelUrl: "inventory/inventoryTransaction/importExcel", + + }, + dictOptions:{}, + superFieldList:[], + } + }, + created() { + this.getSuperFieldList(); + }, + computed: { + importExcelUrl: function(){ + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; + }, + }, + methods: { + initDictConfig(){ + }, + getSuperFieldList(){ + let fieldList=[]; + fieldList.push({type:'string',value:'companyCode',text:'货主',dictCode:''}) + fieldList.push({type:'string',value:'containerCode',text:'容器编码',dictCode:''}) + fieldList.push({type:'string',value:'locationCode',text:'库位编码',dictCode:''}) + fieldList.push({type:'int',value:'type',text:'交易类型',dictCode:'inventory_transaction_type'}) + fieldList.push({type:'string',value:'materialCode',text:'物料编码',dictCode:''}) + fieldList.push({type:'string',value:'materialName',text:'物料名称',dictCode:''}) + fieldList.push({type:'string',value:'materialSpec',text:'物料规格',dictCode:''}) + fieldList.push({type:'string',value:'materialUnit',text:'物料单位',dictCode:''}) + fieldList.push({type:'string',value:'inventoryStatus',text:'库存状态',dictCode:''}) + fieldList.push({type:'BigDecimal',value:'qty',text:'数量',dictCode:''}) + fieldList.push({type:'string',value:'batch',text:'批次',dictCode:''}) + fieldList.push({type:'string',value:'createBy',text:'创建人',dictCode:''}) + fieldList.push({type:'datetime',value:'createTime',text:'创建日期'}) + fieldList.push({type:'string',value:'updateBy',text:'更新人',dictCode:''}) + fieldList.push({type:'datetime',value:'updateTime',text:'更新日期'}) + this.superFieldList = fieldList + } + } + } +</script> +<style scoped> + @import '~@assets/less/common.less'; +</style> \ No newline at end of file diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryDetailModal.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryDetailModal.vue new file mode 100644 index 0000000..baef631 --- /dev/null +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryDetailModal.vue @@ -0,0 +1,184 @@ +<template> + <j-modal + :title="title" + :width="width" + :visible="visible" + :confirmLoading="confirmLoading" + switchFullscreen + @ok="handleOk" + @cancel="handleCancel" + cancelText="关闭"> + <a-spin :spinning="confirmLoading"> + <a-form-model ref="form" :model="model" :rules="validatorRules"> + <a-row> + <a-col :span="24"> + <a-form-model-item label="货主" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="companyCode"> + <a-input v-model="model.companyCode"placeholder="请输入货主" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="库区" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zoneCode"> + <a-input v-model="model.zoneCode"placeholder="请输入库区" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="容器编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="containerCode"> + <a-input v-model="model.containerCode"placeholder="请输入容器编码" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="库位编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="locationCode"> + <a-input v-model="model.locationCode"placeholder="请输入库位编码" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="物料编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialCode"> + <a-input v-model="model.materialCode"placeholder="请输入物料编码" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="物料名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialName"> + <a-input v-model="model.materialName"placeholder="请输入物料名称" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="物料规格" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialSpec"> + <a-input v-model="model.materialSpec"placeholder="请输入物料规格" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="物料单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialUnit"> + <a-input v-model="model.materialUnit"placeholder="请输入物料单位" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="qty"> + <a-input-number v-model="model.qty"placeholder="请输入数量" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="任务锁定数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="taskQty"> + <a-input-number v-model="model.taskQty"placeholder="请输入任务锁定数量" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="库存状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inventoryStatus"> + <j-dict-select-tag type="list" v-model="model.inventoryStatus" dictCode="inventory_status" placeholder="请选择库存状态" /> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="批次" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="batch"> + <a-input v-model="model.batch"placeholder="请输入批次" ></a-input> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + </a-spin> + </j-modal> +</template> + +<script> + + import { httpAction } from '@/api/manage' + import { validateDuplicateValue } from '@/utils/util' + + export default { + name: "InventoryDetailModal", + components: { + }, + props:{ + mainId:{ + type:String, + required:false, + default:'' + } + }, + data () { + return { + title:"操作", + width:800, + visible: false, + model:{ + }, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + + confirmLoading: false, + validatorRules: { + containerCode: [ + { required: true, message: '请输入容器编码!'}, + ], + materialCode: [ + { required: true, message: '请输入物料编码!'}, + ], + }, + url: { + add: "/inventory/inventoryHeader/addInventoryDetail", + edit: "/inventory/inventoryHeader/editInventoryDetail", + } + + } + }, + created () { + //备份model原始值 + this.modelDefault = JSON.parse(JSON.stringify(this.model)); + }, + methods: { + add () { + this.edit(this.modelDefault); + }, + edit (record) { + this.model = Object.assign({}, record); + this.visible = true; + }, + close () { + this.$emit('close'); + this.visible = false; + this.$refs.form.clearValidate(); + }, + handleOk () { + const that = this; + // 触发表单验证 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true; + let httpurl = ''; + let method = ''; + if(!this.model.id){ + httpurl+=this.url.add; + method = 'post'; + }else{ + httpurl+=this.url.edit; + method = 'put'; + } + this.model['inventoryHeaderId'] = this.mainId + httpAction(httpurl,this.model,method).then((res)=>{ + if(res.success){ + that.$message.success(res.message); + that.$emit('ok'); + }else{ + that.$message.warning(res.message); + } + }).finally(() => { + that.confirmLoading = false; + that.close(); + }) + }else{ + return false + } + }) + }, + handleCancel () { + this.close() + }, + + + } + } +</script> diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryHeaderModal.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryHeaderModal.vue new file mode 100644 index 0000000..6d1cac6 --- /dev/null +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryHeaderModal.vue @@ -0,0 +1,145 @@ +<template> + <j-modal + :title="title" + :width="width" + :visible="visible" + :confirmLoading="confirmLoading" + switchFullscreen + @ok="handleOk" + @cancel="handleCancel" + cancelText="关闭"> + <a-spin :spinning="confirmLoading"> + <a-form-model ref="form" :model="model" :rules="validatorRules"> + <a-row> + <a-col :span="24"> + <a-form-model-item label="货主" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="companyCode"> + <a-input v-model="model.companyCode" placeholder="请输入货主" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="库区" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zoneCode"> + <a-input v-model="model.zoneCode" placeholder="请输入库区" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="容器号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="containerCode"> + <a-input v-model="model.containerCode" placeholder="请输入容器号" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="容器状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="containerStatus"> + <j-dict-select-tag type="list" v-model="model.containerStatus" dictCode="container_status" placeholder="请选择容器状态" /> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="库位号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="locationCode"> + <a-input v-model="model.locationCode" placeholder="请输入库位号" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="总数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="totalQty"> + <a-input-number v-model="model.totalQty" placeholder="请输入总数量" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="总行量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="totalLines"> + <a-input-number v-model="model.totalLines" placeholder="请输入总行量" style="width: 100%" /> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + </a-spin> + </j-modal> +</template> + +<script> + + import { httpAction } from '@/api/manage' + import { validateDuplicateValue } from '@/utils/util' + + export default { + name: "InventoryHeaderModal", + components: { + }, + data () { + return { + title:"操作", + width:800, + visible: false, + model:{ + }, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + + confirmLoading: false, + validatorRules: { + }, + url: { + add: "/inventory/inventoryHeader/add", + edit: "/inventory/inventoryHeader/edit", + } + + } + }, + created () { + //备份model原始值 + this.modelDefault = JSON.parse(JSON.stringify(this.model)); + }, + methods: { + add () { + this.edit(this.modelDefault); + }, + edit (record) { + this.model = Object.assign({}, record); + this.visible = true; + }, + close () { + this.$emit('close'); + this.visible = false; + this.$refs.form.clearValidate(); + }, + handleOk () { + const that = this; + // 触发表单验证 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true; + let httpurl = ''; + let method = ''; + if(!this.model.id){ + httpurl+=this.url.add; + method = 'post'; + }else{ + httpurl+=this.url.edit; + method = 'put'; + } + httpAction(httpurl,this.model,method).then((res)=>{ + if(res.success){ + that.$message.success(res.message); + that.$emit('ok'); + }else{ + that.$message.warning(res.message); + } + }).finally(() => { + that.confirmLoading = false; + that.close(); + }) + }else{ + return false + } + }) + }, + handleCancel () { + this.close() + }, + + + } + } +</script> \ No newline at end of file diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryTransactionForm.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryTransactionForm.vue new file mode 100644 index 0000000..da94a34 --- /dev/null +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryTransactionForm.vue @@ -0,0 +1,154 @@ +<template> + <a-spin :spinning="confirmLoading"> + <j-form-container :disabled="formDisabled"> + <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> + <a-row> + <a-col :span="24"> + <a-form-model-item label="货主" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="companyCode"> + <a-input v-model="model.companyCode" placeholder="请输入货主" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="容器编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="containerCode"> + <a-input v-model="model.containerCode" placeholder="请输入容器编码" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="库位编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="locationCode"> + <a-input v-model="model.locationCode" placeholder="请输入库位编码" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="交易类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="type"> + <j-dict-select-tag type="list" v-model="model.type" dictCode="inventory_transaction_type" placeholder="请选择交易类型" /> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="物料编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialCode"> + <a-input v-model="model.materialCode" placeholder="请输入物料编码" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="物料名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialName"> + <a-input v-model="model.materialName" placeholder="请输入物料名称" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="物料规格" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialSpec"> + <a-input v-model="model.materialSpec" placeholder="请输入物料规格" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="物料单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialUnit"> + <a-input v-model="model.materialUnit" placeholder="请输入物料单位" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="库存状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inventoryStatus"> + <a-input v-model="model.inventoryStatus" placeholder="请输入库存状态" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="qty"> + <a-input-number v-model="model.qty" placeholder="请输入数量" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="批次" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="batch"> + <a-input v-model="model.batch" placeholder="请输入批次" ></a-input> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + </j-form-container> + </a-spin> +</template> + +<script> + + import { httpAction, getAction } from '@/api/manage' + import { validateDuplicateValue } from '@/utils/util' + + export default { + name: 'InventoryTransactionForm', + components: { + }, + props: { + //表单禁用 + disabled: { + type: Boolean, + default: false, + required: false + } + }, + data () { + return { + model:{ + }, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + confirmLoading: false, + validatorRules: { + }, + url: { + add: "/inventory/inventoryTransaction/add", + edit: "/inventory/inventoryTransaction/edit", + queryById: "/inventory/inventoryTransaction/queryById" + } + } + }, + computed: { + formDisabled(){ + return this.disabled + }, + }, + created () { + //备份model原始值 + this.modelDefault = JSON.parse(JSON.stringify(this.model)); + }, + methods: { + add () { + this.edit(this.modelDefault); + }, + edit (record) { + this.model = Object.assign({}, record); + this.visible = true; + }, + submitForm () { + const that = this; + // 触发表单验证 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true; + let httpurl = ''; + let method = ''; + if(!this.model.id){ + httpurl+=this.url.add; + method = 'post'; + }else{ + httpurl+=this.url.edit; + method = 'put'; + } + httpAction(httpurl,this.model,method).then((res)=>{ + if(res.success){ + that.$message.success(res.message); + that.$emit('ok'); + }else{ + that.$message.warning(res.message); + } + }).finally(() => { + that.confirmLoading = false; + }) + } + + }) + }, + } + } +</script> \ No newline at end of file diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryTransactionModal.Style#Drawer.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryTransactionModal.Style#Drawer.vue new file mode 100644 index 0000000..6ed0738 --- /dev/null +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryTransactionModal.Style#Drawer.vue @@ -0,0 +1,84 @@ +<template> + <a-drawer + :title="title" + :width="width" + placement="right" + :closable="false" + @close="close" + destroyOnClose + :visible="visible"> + <inventory-transaction-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></inventory-transaction-form> + <div class="drawer-footer"> + <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button> + <a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button> + </div> + </a-drawer> +</template> + +<script> + + import InventoryTransactionForm from './InventoryTransactionForm' + + export default { + name: 'InventoryTransactionModal', + components: { + InventoryTransactionForm + }, + data () { + return { + title:"操作", + width:800, + visible: false, + disableSubmit: false + } + }, + methods: { + add () { + this.visible=true + this.$nextTick(()=>{ + this.$refs.realForm.add(); + }) + }, + edit (record) { + this.visible=true + this.$nextTick(()=>{ + this.$refs.realForm.edit(record); + }); + }, + close () { + this.$emit('close'); + this.visible = false; + }, + submitCallback(){ + this.$emit('ok'); + this.visible = false; + }, + handleOk () { + this.$refs.realForm.submitForm(); + }, + handleCancel () { + this.close() + } + } + } +</script> + +<style lang="less" scoped> +/** Button按钮间距 */ + .ant-btn { + margin-left: 30px; + margin-bottom: 30px; + float: right; + } + .drawer-footer{ + position: absolute; + bottom: -8px; + width: 100%; + border-top: 1px solid #e8e8e8; + padding: 10px 16px; + text-align: right; + left: 0; + background: #fff; + border-radius: 0 0 2px 2px; + } +</style> \ No newline at end of file diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryTransactionModal.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryTransactionModal.vue new file mode 100644 index 0000000..070b852 --- /dev/null +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryTransactionModal.vue @@ -0,0 +1,60 @@ +<template> + <j-modal + :title="title" + :width="width" + :visible="visible" + switchFullscreen + @ok="handleOk" + :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" + @cancel="handleCancel" + cancelText="关闭"> + <inventory-transaction-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></inventory-transaction-form> + </j-modal> +</template> + +<script> + + import InventoryTransactionForm from './InventoryTransactionForm' + export default { + name: 'InventoryTransactionModal', + components: { + InventoryTransactionForm + }, + data () { + return { + title:'', + width:800, + visible: false, + disableSubmit: false + } + }, + methods: { + add () { + this.visible=true + this.$nextTick(()=>{ + this.$refs.realForm.add(); + }) + }, + edit (record) { + this.visible=true + this.$nextTick(()=>{ + this.$refs.realForm.edit(record); + }) + }, + close () { + this.$emit('close'); + this.visible = false; + }, + handleOk () { + this.$refs.realForm.submitForm(); + }, + submitCallback(){ + this.$emit('ok'); + this.visible = false; + }, + handleCancel () { + this.close() + } + } + } +</script> \ No newline at end of file diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/ApiLogList.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/ApiLogList.vue new file mode 100644 index 0000000..85a6779 --- /dev/null +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/ApiLogList.vue @@ -0,0 +1,316 @@ +<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.apiName"></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.apiMethod"></a-input> + </a-form-item> + </a-col> + <template v-if="toggleSearchStatus"> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="请求方地址"> + <a-input placeholder="请输入请求方地址" v-model="queryParam.ip"></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.responseFrom"></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.responseBy"></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.url"></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.duration"></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.retCode"></a-input> + </a-form-item> + </a-col> + <a-col :xl="10" :lg="11" :md="12" :sm="24"> + <a-form-item label="创建日期"> + <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.createTime_begin"></j-date> + <span class="query-group-split-cust"></span> + <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.createTime_end"></j-date> + </a-form-item> + </a-col> + </template> + <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> + <a @click="handleToggleSearch" style="margin-left: 8px"> + {{ toggleSearchStatus ? '收起' : '展开' }} + <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/> + </a> + </span> + </a-col> + </a-row> + </a-form> + </div> + <!-- 查询区域-END --> + + <!-- 操作按钮区域 --> + <div class="table-operator"> + <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> + <a-button type="primary" icon="download" @click="handleExportXls('接口日志')">导出</a-button> + <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> + <a-button type="primary" icon="import">导入</a-button> + </a-upload> + <!-- 高级查询区域 --> + <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> + <a-dropdown v-if="selectedRowKeys.length > 0"> + <a-menu slot="overlay"> + <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> + </a-menu> + <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> + </a-dropdown> + </div> + + <!-- table区域-begin --> + <div> + <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> + <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 + <a style="margin-left: 24px" @click="onClearSelected">清空</a> + </div> + + <a-table + ref="table" + size="middle" + :scroll="{x:true}" + bordered + rowKey="id" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" + class="j-table-force-nowrap" + @change="handleTableChange"> + + <template slot="htmlSlot" slot-scope="text"> + <div v-html="text"></div> + </template> + <template slot="imgSlot" slot-scope="text"> + <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> + <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> + </template> + <template slot="fileSlot" slot-scope="text"> + <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> + <a-button + v-else + :ghost="true" + type="primary" + icon="download" + size="small" + @click="downloadFile(text)"> + 下载 + </a-button> + </template> + + <span slot="action" slot-scope="text, record"> + <a @click="handleEdit(record)">编辑</a> + + <a-divider type="vertical" /> + <a-dropdown> + <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> + <a-menu slot="overlay"> + <a-menu-item> + <a @click="handleDetail(record)">详情</a> + </a-menu-item> + <a-menu-item> + <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> + <a>删除</a> + </a-popconfirm> + </a-menu-item> + </a-menu> + </a-dropdown> + </span> + + </a-table> + </div> + + <api-log-modal ref="modalForm" @ok="modalFormOk"></api-log-modal> + </a-card> +</template> + +<script> + + import '@/assets/less/TableExpand.less' + import { mixinDevice } from '@/utils/mixin' + import { JeecgListMixin } from '@/mixins/JeecgListMixin' + import ApiLogModal from './modules/ApiLogModal' + + export default { + name: 'ApiLogList', + mixins:[JeecgListMixin, mixinDevice], + components: { + ApiLogModal + }, + data () { + return { + description: '接口日志管理页面', + // 表头 + columns: [ + { + title:'接口ID', + align:"center", + dataIndex: 'id' + }, + { + title:'接口名称', + align:"center", + dataIndex: 'apiName' + }, + { + title:'请求类型', + align:"center", + dataIndex: 'apiMethod' + }, + { + title:'请求方地址', + align:"center", + dataIndex: 'ip' + }, + { + title:'响应耗时(毫秒)', + align:"center", + dataIndex: 'duration' + }, + { + title:'请求方名称', + align:"center", + dataIndex: 'responseFrom' + }, + { + title:'响应方名称', + align:"center", + dataIndex: 'responseBy' + }, + { + title:'请求地址', + align:"center", + dataIndex: 'url' + }, + { + title:'请求时间', + align:"center", + dataIndex: 'requestTime' + }, + { + title:'响应时间', + align:"center", + dataIndex: 'responseTime' + }, + { + title:'请求头', + align:"center", + dataIndex: 'requestHeader' + }, + { + title:'请求内容', + align:"center", + dataIndex: 'requestBody' + }, + { + title:'响应头', + align:"center", + dataIndex: 'responseHeader' + }, + { + title:'响应内容', + align:"center", + dataIndex: 'responseBody' + }, + { + title:'httpCode', + align:"center", + dataIndex: 'httpCode' + }, + { + title:'业务响应码', + align:"center", + dataIndex: 'retCode' + }, + { + title:'异常堆栈信息', + align:"center", + dataIndex: 'exception' + }, + { + title: '操作', + dataIndex: 'action', + align:"center", + fixed:"right", + width:147, + scopedSlots: { customRender: 'action' } + } + ], + url: { + list: "/monitor/apiLog/list", + delete: "/monitor/apiLog/delete", + deleteBatch: "/monitor/apiLog/deleteBatch", + exportXlsUrl: "/monitor/apiLog/exportXls", + importExcelUrl: "monitor/apiLog/importExcel", + + }, + dictOptions:{}, + superFieldList:[], + } + }, + created() { + this.getSuperFieldList(); + }, + computed: { + importExcelUrl: function(){ + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; + }, + }, + methods: { + initDictConfig(){ + }, + getSuperFieldList(){ + let fieldList=[]; + fieldList.push({type:'string',value:'apiName',text:'接口名称',dictCode:''}) + fieldList.push({type:'string',value:'apiMethod',text:'请求类型',dictCode:''}) + fieldList.push({type:'string',value:'ip',text:'请求方地址',dictCode:''}) + fieldList.push({type:'string',value:'responseFrom',text:'请求方名称',dictCode:''}) + fieldList.push({type:'string',value:'responseBy',text:'响应方名称',dictCode:''}) + fieldList.push({type:'string',value:'url',text:'请求地址',dictCode:''}) + fieldList.push({type:'datetime',value:'requestTime',text:'请求时间'}) + fieldList.push({type:'datetime',value:'responseTime',text:'响应时间'}) + fieldList.push({type:'Text',value:'requestHeader',text:'请求头',dictCode:''}) + fieldList.push({type:'Text',value:'requestBody',text:'请求内容',dictCode:''}) + fieldList.push({type:'Text',value:'responseHeader',text:'响应头',dictCode:''}) + fieldList.push({type:'Text',value:'responseBody',text:'响应内容',dictCode:''}) + fieldList.push({type:'string',value:'duration',text:'响应耗时(毫秒)',dictCode:''}) + fieldList.push({type:'int',value:'httpCode',text:'httpCode',dictCode:''}) + fieldList.push({type:'int',value:'retCode',text:'业务响应码',dictCode:''}) + fieldList.push({type:'Text',value:'exception',text:'异常堆栈信息',dictCode:''}) + fieldList.push({type:'datetime',value:'createTime',text:'创建日期'}) + this.superFieldList = fieldList + } + } + } +</script> +<style scoped> + @import '~@assets/less/common.less'; +</style> \ No newline at end of file diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/modules/ApiLogForm.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/modules/ApiLogForm.vue new file mode 100644 index 0000000..77fcf16 --- /dev/null +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/modules/ApiLogForm.vue @@ -0,0 +1,179 @@ +<template> + <a-spin :spinning="confirmLoading"> + <j-form-container :disabled="formDisabled"> + <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> + <a-row> + <a-col :span="24"> + <a-form-model-item label="接口名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="apiName"> + <a-input v-model="model.apiName" placeholder="请输入接口名称" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="请求类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="apiMethod"> + <a-input v-model="model.apiMethod" placeholder="请输入请求类型" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="请求方地址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ip"> + <a-input v-model="model.ip" placeholder="请输入请求方地址" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="请求方名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="responseFrom"> + <a-input v-model="model.responseFrom" placeholder="请输入请求方名称" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="响应方名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="responseBy"> + <a-input v-model="model.responseBy" placeholder="请输入响应方名称" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="请求地址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="url"> + <a-input v-model="model.url" placeholder="请输入请求地址" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="请求时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="requestTime"> + <j-date placeholder="请选择请求时间" v-model="model.requestTime" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="响应时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="responseTime"> + <j-date placeholder="请选择响应时间" v-model="model.responseTime" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="请求头" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="requestHeader"> + <a-input v-model="model.requestHeader" placeholder="请输入请求头" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="请求内容" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="requestBody"> + <a-input v-model="model.requestBody" placeholder="请输入请求内容" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="响应头" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="responseHeader"> + <a-input v-model="model.responseHeader" placeholder="请输入响应头" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="响应内容" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="responseBody"> + <a-input v-model="model.responseBody" placeholder="请输入响应内容" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="响应耗时(毫秒)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="duration"> + <a-input v-model="model.duration" placeholder="请输入响应耗时(毫秒)" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="httpCode" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="httpCode"> + <a-input-number v-model="model.httpCode" placeholder="请输入httpCode" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="业务响应码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="retCode"> + <a-input-number v-model="model.retCode" placeholder="请输入业务响应码" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="异常堆栈信息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="exception"> + <a-input v-model="model.exception" placeholder="请输入异常堆栈信息" ></a-input> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + </j-form-container> + </a-spin> +</template> + +<script> + + import { httpAction, getAction } from '@/api/manage' + import { validateDuplicateValue } from '@/utils/util' + + export default { + name: 'ApiLogForm', + components: { + }, + props: { + //表单禁用 + disabled: { + type: Boolean, + default: false, + required: false + } + }, + data () { + return { + model:{ + }, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + confirmLoading: false, + validatorRules: { + }, + url: { + add: "/monitor/apiLog/add", + edit: "/monitor/apiLog/edit", + queryById: "/monitor/apiLog/queryById" + } + } + }, + computed: { + formDisabled(){ + return this.disabled + }, + }, + created () { + //备份model原始值 + this.modelDefault = JSON.parse(JSON.stringify(this.model)); + }, + methods: { + add () { + this.edit(this.modelDefault); + }, + edit (record) { + this.model = Object.assign({}, record); + this.visible = true; + }, + submitForm () { + const that = this; + // 触发表单验证 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true; + let httpurl = ''; + let method = ''; + if(!this.model.id){ + httpurl+=this.url.add; + method = 'post'; + }else{ + httpurl+=this.url.edit; + method = 'put'; + } + httpAction(httpurl,this.model,method).then((res)=>{ + if(res.success){ + that.$message.success(res.message); + that.$emit('ok'); + }else{ + that.$message.warning(res.message); + } + }).finally(() => { + that.confirmLoading = false; + }) + } + + }) + }, + } + } +</script> \ No newline at end of file diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/modules/ApiLogModal.Style#Drawer.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/modules/ApiLogModal.Style#Drawer.vue new file mode 100644 index 0000000..43a6cde --- /dev/null +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/modules/ApiLogModal.Style#Drawer.vue @@ -0,0 +1,84 @@ +<template> + <a-drawer + :title="title" + :width="width" + placement="right" + :closable="false" + @close="close" + destroyOnClose + :visible="visible"> + <api-log-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></api-log-form> + <div class="drawer-footer"> + <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button> + <a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button> + </div> + </a-drawer> +</template> + +<script> + + import ApiLogForm from './ApiLogForm' + + export default { + name: 'ApiLogModal', + components: { + ApiLogForm + }, + data () { + return { + title:"操作", + width:800, + visible: false, + disableSubmit: false + } + }, + methods: { + add () { + this.visible=true + this.$nextTick(()=>{ + this.$refs.realForm.add(); + }) + }, + edit (record) { + this.visible=true + this.$nextTick(()=>{ + this.$refs.realForm.edit(record); + }); + }, + close () { + this.$emit('close'); + this.visible = false; + }, + submitCallback(){ + this.$emit('ok'); + this.visible = false; + }, + handleOk () { + this.$refs.realForm.submitForm(); + }, + handleCancel () { + this.close() + } + } + } +</script> + +<style lang="less" scoped> +/** Button按钮间距 */ + .ant-btn { + margin-left: 30px; + margin-bottom: 30px; + float: right; + } + .drawer-footer{ + position: absolute; + bottom: -8px; + width: 100%; + border-top: 1px solid #e8e8e8; + padding: 10px 16px; + text-align: right; + left: 0; + background: #fff; + border-radius: 0 0 2px 2px; + } +</style> \ No newline at end of file diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/modules/ApiLogModal.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/modules/ApiLogModal.vue new file mode 100644 index 0000000..b2608f8 --- /dev/null +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/modules/ApiLogModal.vue @@ -0,0 +1,60 @@ +<template> + <j-modal + :title="title" + :width="width" + :visible="visible" + switchFullscreen + @ok="handleOk" + :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" + @cancel="handleCancel" + cancelText="关闭"> + <api-log-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></api-log-form> + </j-modal> +</template> + +<script> + + import ApiLogForm from './ApiLogForm' + export default { + name: 'ApiLogModal', + components: { + ApiLogForm + }, + data () { + return { + title:'', + width:800, + visible: false, + disableSubmit: false + } + }, + methods: { + add () { + this.visible=true + this.$nextTick(()=>{ + this.$refs.realForm.add(); + }) + }, + edit (record) { + this.visible=true + this.$nextTick(()=>{ + this.$refs.realForm.edit(record); + }) + }, + close () { + this.$emit('close'); + this.visible = false; + }, + handleOk () { + this.$refs.realForm.submitForm(); + }, + submitCallback(){ + this.$emit('ok'); + this.visible = false; + }, + handleCancel () { + this.close() + } + } + } +</script> \ No newline at end of file diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerDetailList.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerDetailList.vue index 435124b..0c3b018 100644 --- a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerDetailList.vue +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerDetailList.vue @@ -159,14 +159,9 @@ // 表头 columns: [ { - title: '#', - dataIndex: '', - key:'rowIndex', - width:60, + title:'组盘详情ID', align:"center", - customRender:function (t,r,index) { - return parseInt(index)+1; - } + dataIndex: 'id' }, { title:'货主编码', diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerHeaderList.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerHeaderList.vue index c691512..a4285ca 100644 --- a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerHeaderList.vue +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerHeaderList.vue @@ -165,6 +165,11 @@ // 表头 columns: [ { + title:'组盘ID', + align:"center", + dataIndex: 'id' + }, + { title:'容器号', align:"center", dataIndex: 'containerCode' diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptDetailList.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptDetailList.vue index c1fb1fd..5ec8d81 100644 --- a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptDetailList.vue +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptDetailList.vue @@ -112,14 +112,9 @@ // 表头 columns: [ { - title: '#', - dataIndex: '', - key:'rowIndex', - width:60, + title:'单据详情ID', align:"center", - customRender:function (t,r,index) { - return parseInt(index)+1; - } + dataIndex: 'id' }, { title:'物料编码', diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptHeaderList.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptHeaderList.vue index e27342c..f780dd8 100644 --- a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptHeaderList.vue +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptHeaderList.vue @@ -222,6 +222,11 @@ // 表头 columns: [ { + title:'单据ID', + align:"center", + dataIndex: 'id' + }, + { title:'编码', align:"center", dataIndex: 'code' diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiptDetailModal.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiptDetailModal.vue index 5127804..e6ed968 100644 --- a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiptDetailModal.vue +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiptDetailModal.vue @@ -88,8 +88,8 @@ ], }, url: { - add: "/config/receiptHeader/addReceiptDetail", - edit: "/config/receiptHeader/editReceiptDetail", + add: "/receipt/receiptHeader/addReceiptDetail", + edit: "/receipt/receiptHeader/editReceiptDetail", } } diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/TaskDetailList.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/TaskDetailList.vue index b2a85b1..7a4d56f 100644 --- a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/TaskDetailList.vue +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/TaskDetailList.vue @@ -112,14 +112,9 @@ // 表头 columns: [ { - title: '#', - dataIndex: '', - key:'rowIndex', - width:60, + title:'任务详情ID', align:"center", - customRender:function (t,r,index) { - return parseInt(index)+1; - } + dataIndex: 'id' }, { title:'货主', diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/TaskHeaderList.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/TaskHeaderList.vue index 0177d74..d59cdd5 100644 --- a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/TaskHeaderList.vue +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/TaskHeaderList.vue @@ -132,12 +132,15 @@ </template> <span slot="action" slot-scope="text, record"> - <a @click="handleEdit(record)">编辑</a> + <a v-if="record.status < 100" @click="completeTask(record)">完成任务</a> <a-divider type="vertical" /> <a-dropdown> <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> <a-menu slot="overlay"> + <a-menu-item> + <a @click="handleEdit(record)">编辑</a> + </a-menu-item> <a-menu-item> <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> <a>删除</a> @@ -168,6 +171,7 @@ import TaskDetailList from './TaskDetailList' import {initDictOptions,filterMultiDictText} from '@/components/dict/JDictSelectUtil' import '@/assets/less/TableExpand.less' + import {completeTaskByWMS} from '@/api/api' export default { name: "TaskHeaderList", @@ -347,6 +351,21 @@ this.loading = false; }) }, + completeTask(record) { + this.loading = true; + const that = this; + this.model = Object.assign({}, record); + completeTaskByWMS(this.model).then((res) => { + this.loading = false; + if (res.success) { + this.$message.success(res.message); + } + else { + this.$message.error(res.message); + } + this.searchQuery(); + }); + }, getSuperFieldList(){ let fieldList=[]; fieldList.push({type:'int',value:'taskType',text:'任务类型',dictCode:'task_type'}) diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/base/controller/JeecgController.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/base/controller/JeecgController.java index cff9a26..4166d23 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/base/controller/JeecgController.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/base/controller/JeecgController.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.beanutils.PropertyUtils; +import org.apache.commons.collections.MapUtils; import org.apache.shiro.SecurityUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.query.QueryGenerator; @@ -27,6 +28,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.*; +import java.util.concurrent.Semaphore; import java.util.stream.Collectors; /** @@ -199,4 +201,68 @@ public class JeecgController<T, S extends IService<T>> { } return Result.error("文件导入失败!"); } + + + //下发任务并发控制 + Map<String, Boolean> runningTaskMap = new HashMap<>(); + + //并发控制,一次只允许一个请求 + public Result handleQuest(String taskKey, MultiProcessListener multiProcessListener) { + Result result = null; + if(MapUtils.getBoolean(runningTaskMap, taskKey, false)) { + return Result.error("重复请求,清稍后重试"); + } + runningTaskMap.put(taskKey, true); + try { + result = multiProcessListener.doProcess(); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException(e); + } finally { + runningTaskMap.put(taskKey, false); + } + return result; + } + + Semaphore semaphore=new Semaphore(1); + //下发任务并发控制 + Map<String, Boolean> multiProcessMap = new HashMap<>(); + + public Result handleMultiProcess(String taskKey, MultiProcessListener multiProcessListener) { + Result result = null; + int max_time = 30 * 1000; + int now = 0; + boolean avail = true; + while(avail) { + boolean availablePermits = MapUtils.getBoolean(multiProcessMap, taskKey, false); + if(!availablePermits) { + avail = false; + try { + multiProcessMap.put(taskKey, true); + result = multiProcessListener.doProcess(); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException(e); + } finally { + multiProcessMap.put(taskKey, false); + } + } else { + result = Result.error("多线程处理异常, 待处理现场太多,等待时间超出30秒"); + try { + now = now + 200; + Thread.sleep(200); + } catch (InterruptedException e) { + e.printStackTrace(); + } + if(now >= max_time) { + avail = false; + } + } + } + return result; + } + + public interface MultiProcessListener { + Result doProcess(); + } } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/controller/WcsController.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/controller/WcsController.java index 4ca7e16..889aa4a 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/controller/WcsController.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/controller/WcsController.java @@ -6,6 +6,7 @@ import org.jeecg.common.api.vo.Result; import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.modules.wms.api.wcs.entity.WarecellDomain; import org.jeecg.modules.wms.api.wcs.service.WcsService; +import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger; import org.jeecg.modules.wms.framework.controller.BaseController; import org.jeecg.utils.StringUtils; import org.springframework.web.bind.annotation.*; @@ -26,7 +27,7 @@ public class WcsController extends BaseController { @PostMapping("/warecellAllocation") @ApiOperation(value="wcs仓位分配", notes="wcs仓位分配", httpMethod = "POST") @ResponseBody -// @ApiLogger(apiName = "仓位分配", from="WCS") + @ApiLogger(apiName = "仓位分配", from="WCS") public Result warecellAllocation(@RequestBody WarecellDomain warecellDomain) { if (StringUtils.isEmpty(warecellDomain.getTaskNo())) { return Result.error("任务号为空"); diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsService.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsService.java index f50d066..0e65b4a 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsService.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsService.java @@ -2,6 +2,7 @@ package org.jeecg.modules.wms.api.wcs.service; import org.jeecg.common.api.vo.Result; import org.jeecg.modules.wms.api.wcs.entity.WarecellDomain; +import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; /** * @author 游杰 @@ -11,4 +12,5 @@ public interface WcsService { /**仓位分配*/ Result warecellAllocation(WarecellDomain warecellDomain); + Result wcsTaskAssign(TaskHeader taskHeader); } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java index e1537ec..1958bf9 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java @@ -20,6 +20,7 @@ import org.jeecg.modules.wms.config.material.service.IMaterialService; import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService; import org.jeecg.modules.wms.config.zone.entity.Zone; import org.jeecg.modules.wms.config.zone.service.IZoneService; +import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger; import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerDetail; import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerHeader; import org.jeecg.modules.wms.receipt.receiptContainerHeader.service.IReceiptContainerDetailService; @@ -131,6 +132,16 @@ public class WcsServiceImpl implements WcsService { taskDetailLambdaQueryWrapper.eq(TaskDetail::getTaskHeaderId, taskNo); List<TaskDetail> taskDetailList = taskDetailService.list(taskDetailLambdaQueryWrapper); + if(taskDetailList.size() > 0) { + String materialCode = taskDetailList.get(0).getMaterialCode(); + if(StringUtils.isNotEmpty(materialCode)) { + Material material = materialService.getMaterialByCode(materialCode); + if(material != null) { + materialAreaCode = material.getMaterialareaCode(); + } + } + } + locationCode = locationAllocationService.allocation(allocationRule, locationTypeCodeList, high, zoneCode, roadWays, warehouseCode, containerCode, materialAreaCode); if (StringUtils.isEmpty(locationCode)) { @@ -155,12 +166,9 @@ public class WcsServiceImpl implements WcsService { receiptContainerDetailList.add(receiptContainerDetail); } } - receiptContainerDetailList = receiptContainerDetailList.stream().distinct().collect(Collectors.toList()); - if (receiptContainerDetailList != null && receiptContainerDetailList.size() > 0) { - String materialCode = receiptContainerDetailList.get(0).getMaterialCode(); - Material material = materialService.getMaterialByCode(materialCode); - materialAreaCode = material.getMaterialareaCode(); - } + //去重 + receiptContainerDetailList = receiptContainerDetailList.stream(). + distinct().collect(Collectors.toList()); if (receiptContainerDetailList.size() > 0) { //更新库位编码到组盘头表 @@ -198,12 +206,14 @@ public class WcsServiceImpl implements WcsService { } else { Location outSideLocation = locationService.getOutSideNear(location); if(outSideLocation != null) { - TaskHeader outSideTaskHeader = taskHeaderService.getTaskHeaderByLocationCode(outSideLocation.getCode()); + TaskHeader outSideTaskHeader = taskHeaderService. + getUnCompleteTaskByLocationCode(outSideLocation.getCode(), warehouseCode); if (outSideTaskHeader != null) { preTaskNo = outSideTaskHeader.getId(); } } } + taskHeader.setZoneCode(location.getZoneCode()); taskHeader.setPreTaskNo(preTaskNo); taskHeader.setWeight(Integer.parseInt(warecellDomain.getWeight())); @@ -217,4 +227,139 @@ public class WcsServiceImpl implements WcsService { wcsTask.setPreTaskNo(String.valueOf(preTaskNo)); return Result.OK(wcsTask); } + + @Override + @Transactional(rollbackFor = Exception.class) + @ApiLogger(apiName = "任务下发", from="WCS") + public Result wcsTaskAssign(TaskHeader taskHeader) { + if(taskHeader == null){ + return Result.error("wms任务为空"); + } + if(taskHeader.getId() == null){ + return Result.error("wms任务号Id为空"); + } + if(taskHeader.getTaskType() == null){ + return Result.error("wms任务类型为空"); + } + String containerCode = taskHeader.getContainerCode(); + if(StringUtils.isEmpty(containerCode)){ + return Result.error("wms任务中容器为空"); + } + int taskType = taskHeader.getTaskType(); + int preTaskNo = 0; + String warehouseCode = taskHeader.getWarehouseCode(); + if(StringUtils.isEmpty(warehouseCode)){ + return Result.error("wms任务中仓库编码为空"); + } + String fromLocationCode = taskHeader.getFromLocationCode(); + String toLocationCode = taskHeader.getToLocationCode(); + Location fromLocation = locationService.getLocationByCode(fromLocationCode, warehouseCode); + Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode); + boolean direction = true; // true 执行时是入库动作, false 执行时是出库动作 + switch(taskType) { + case QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT: + case QuantityConstant.TASK_TYPE_WHOLESHIPMENT: + case QuantityConstant.TASK_TYPE_SORTINGSHIPMENT: + case QuantityConstant.TASK_TYPE_EMPTYSHIPMENT: + case QuantityConstant.TASK_TYPE_CYCLECOUNT: + case QuantityConstant.TASK_TYPE_TRANSFER: + case QuantityConstant.TASK_TYPE_VIEW: + case QuantityConstant.TASK_TYPE_MANY_EMPTYSHIPMENT: + if(fromLocation == null) { + return Result.error("起始库位为空"); + } + direction = false; + break; + case QuantityConstant.TASK_TYPE_WHOLERECEIPT: + case QuantityConstant.TASK_TYPE_EMPTYRECEIPT: + case QuantityConstant.TASK_TYPE_MANY_EMPTYRECEIPT: + if(toLocation == null) { + return Result.error("终点库位为空"); + } + direction = true; + break; + default: + break; + } + + // 出库动作 + if (!direction) { + // 出库性质的任务圆库位不能为空 + if (StringUtils.isEmpty(fromLocationCode)) { + return Result.error("源库位为空"); + } + int rowFlag = fromLocation.getRowFlag(); + if(rowFlag == QuantityConstant.ROW_OUT) { + //找到对应内侧库位 + Location insideLocation = locationService.getInsideNear(fromLocation); + String insideLocationCode = insideLocation.getCode(); + //如果对应内侧库位有托盘 + if(StringUtils.isNotEmpty(insideLocation.getContainerCode())) { + //如果对应内侧库位有托盘数据,那么不可能会有入库类型的任务,因为正在执行的入库类型的任务 库位是不会有托盘数据的。 + TaskHeader taskHeader1 = taskHeaderService. + getUnCompleteTaskByFromLocationCode(insideLocationCode, warehouseCode); + if(taskHeader1 != null) { + preTaskNo = taskHeader1.getId(); + } else { + //找空闲库位,优先找外侧空闲库位,作为移库目的地 + Location destinationLocation = locationService.getEmptyLocation(insideLocation); + if (destinationLocation == null) { + return Result.error("移库没有剩余库位"); + } + Result result = taskHeaderService.createTransferTask( + insideLocation.getCode(), destinationLocation.getCode(), warehouseCode); + preTaskNo = (Integer) result.getResult(); + if (!result.isSuccess()) { + return Result.error("创建移库任务失败"); + } + //移库任务 + taskHeader.setPreTaskNo(preTaskNo); + taskHeaderService.updateById(taskHeader); + return Result.error("先执行移库任务"); + } + } else { + //如果是有任务,从这个库位入托盘,那么不能生成新的出库任务。必须等这个任务完成以后,重新生成新的移库后,这个任务才能执行。 + TaskHeader taskHeader1 = taskHeaderService. + getUnCompleteTaskByToLocationCode(insideLocationCode, warehouseCode); + if(taskHeader1 != null) { + return Result.error("执行外侧库位出库时,相应的内侧库位有入库类型任务,请先执行完内侧库位任务"); + } + //如果是有任务,从这个库位出托盘,那么等这个任务作为前置任务。 + taskHeader1 = taskHeaderService. + getUnCompleteTaskByFromLocationCode(insideLocationCode, warehouseCode); + if(taskHeader1 != null) { + preTaskNo = taskHeader1.getId(); + } + } + taskHeader.setPreTaskNo(preTaskNo); + taskHeaderService.updateById(taskHeader); + } + } + + WcsTask wcsTask = new WcsTask(); + wcsTask.setTaskNo(taskHeader.getId().toString()); + wcsTask.setWarehouseCode(warehouseCode); + wcsTask.setTaskType(taskType); + wcsTask.setFromPort(taskHeader.getFromPort()); + wcsTask.setToPort(taskHeader.getToPort()); + wcsTask.setContainerCode(taskHeader.getContainerCode()); + if (preTaskNo != 0) { + wcsTask.setPreTaskNo(String.valueOf(preTaskNo)); + } + if (StringUtils.isEmpty(fromLocationCode)) { + wcsTask.setFromLocationCode(QuantityConstant.EMPTY_STRING); + } else { + wcsTask.setFromLocationCode(fromLocationCode); + } + if (StringUtils.isEmpty(toLocationCode)) { + wcsTask.setToLocationCode(QuantityConstant.EMPTY_STRING); + } else { + wcsTask.setToLocationCode(toLocationCode); + } + wcsTask.setPriority(10); + wcsTask.setPlatform(QuantityConstant.PLATFORM_WMS); + + + return null; + } } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/address/service/IAddressService.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/address/service/IAddressService.java index e20211b..eec392d 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/address/service/IAddressService.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/address/service/IAddressService.java @@ -11,4 +11,5 @@ import org.jeecg.modules.wms.config.address.entity.Address; */ public interface IAddressService extends IService<Address> { + Address getAddressByUrl(String url, String warehouseCode); } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/address/service/impl/AddressServiceImpl.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/address/service/impl/AddressServiceImpl.java index 6d5cb7d..07a9dd1 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/address/service/impl/AddressServiceImpl.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/address/service/impl/AddressServiceImpl.java @@ -1,5 +1,7 @@ package org.jeecg.modules.wms.config.address.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import org.jeecg.modules.wms.config.address.entity.Address; import org.jeecg.modules.wms.config.address.mapper.AddressMapper; import org.jeecg.modules.wms.config.address.service.IAddressService; @@ -16,4 +18,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @Service public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements IAddressService { + @Override + public Address getAddressByUrl(String url, String warehouseCode) { + LambdaQueryWrapper<Address> addressLambdaQueryWrapper = Wrappers.lambdaQuery(); + addressLambdaQueryWrapper.eq(Address::getUrl, url) + .eq(Address::getWarehouseCode, warehouseCode); + Address address = getOne(addressLambdaQueryWrapper); + return address; + } } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/service/ILocationService.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/service/ILocationService.java index 949986c..77aeed6 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/service/ILocationService.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/service/ILocationService.java @@ -13,11 +13,14 @@ import java.util.List; */ public interface ILocationService extends IService<Location> { - Location getLocationByCode(String locationCode, String wareohuseCode); + Location getLocationByCode(String locationCode, String warehouseCode); - List<Location> getLocationListByZoneCode(String zoneCode, String wareohuseCode); + List<Location> getLocationListByZoneCode(String zoneCode, String warehouseCode); - boolean updateStatus(String locationCode, String status, String wareohuseCode); + boolean updateStatus(String locationCode, String status, String warehouseCode); + + boolean updateContainerCodeAndStatus(String locationCode + , String containerCode, String status, String warehouseCode); Location getNear(Location location); diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java index 55f9adb..5eec4bf 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java @@ -30,32 +30,44 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i private ITaskHeaderService taskHeaderService; @Override - public Location getLocationByCode(String locationCode, String wareohuseCode) { + public Location getLocationByCode(String locationCode, String warehouseCode) { LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); locationLambdaQueryWrapper.eq(Location::getCode, locationCode) .eq(Location::getEnable, QuantityConstant.STATUS_ENABLE) - .eq(Location::getWarehouseCode, wareohuseCode); + .eq(Location::getWarehouseCode, warehouseCode); Location location = this.getOne(locationLambdaQueryWrapper); return location; } @Override - public List<Location> getLocationListByZoneCode(String zoneCode, String wareohuseCode) { + public List<Location> getLocationListByZoneCode(String zoneCode, String warehouseCode) { LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); locationLambdaQueryWrapper.eq(Location::getZoneCode, zoneCode) .eq(Location::getEnable, QuantityConstant.STATUS_ENABLE) - .eq(Location::getWarehouseCode, wareohuseCode); + .eq(Location::getWarehouseCode, warehouseCode); List<Location> locationList = this.list(locationLambdaQueryWrapper); return locationList; } @Override - public boolean updateStatus(String locationCode, String status, String wareohuseCode) { - Location location = getLocationByCode(locationCode, wareohuseCode); + public boolean updateStatus(String locationCode, String status, String warehouseCode) { + Location location = getLocationByCode(locationCode, warehouseCode); if(location == null) { return false; } - location.setStatus(QuantityConstant.STATUS_LOCATION_LOCK); + location.setStatus(status); + boolean result = updateById(location); + return result; + } + + @Override + public boolean updateContainerCodeAndStatus(String locationCode, String containerCode, String status, String warehouseCode) { + Location location = getLocationByCode(locationCode, warehouseCode); + if(location == null) { + return false; + } + location.setContainerCode(containerCode); + location.setStatus(status); boolean result = updateById(location); return result; } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/Convert.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/Convert.java new file mode 100644 index 0000000..33a7184 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/Convert.java @@ -0,0 +1,1005 @@ +package org.jeecg.modules.wms.framework; + + +import org.jeecg.utils.StringUtils; +import org.jeecg.utils.support.CharsetKit; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.text.NumberFormat; +import java.util.Set; + +/** + * 类型转换器 + * + * @author huaheng + * + */ +public class Convert +{ + /** + * 转换为字符串<br> + * 如果给定的值为null,或者转换失败,返回默认值<br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static String toStr(Object value, String defaultValue) + { + if (null == value) + { + return defaultValue; + } + if (value instanceof String) + { + return (String) value; + } + return value.toString(); + } + + /** + * 转换为字符串<br> + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static String toStr(Object value) + { + return toStr(value, null); + } + + /** + * 转换为字符<br> + * 如果给定的值为null,或者转换失败,返回默认值<br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Character toChar(Object value, Character defaultValue) + { + if (null == value) + { + return defaultValue; + } + if (value instanceof Character) + { + return (Character) value; + } + + final String valueStr = toStr(value, null); + return StringUtils.isEmpty(valueStr) ? defaultValue : valueStr.charAt(0); + } + + /** + * 转换为字符<br> + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Character toChar(Object value) + { + return toChar(value, null); + } + + /** + * 转换为byte<br> + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Byte toByte(Object value, Byte defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Byte) + { + return (Byte) value; + } + if (value instanceof Number) + { + return ((Number) value).byteValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return Byte.parseByte(valueStr); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为byte<br> + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Byte toByte(Object value) + { + return toByte(value, null); + } + + /** + * 转换为Short<br> + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Short toShort(Object value, Short defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Short) + { + return (Short) value; + } + if (value instanceof Number) + { + return ((Number) value).shortValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return Short.parseShort(valueStr.trim()); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为Short<br> + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Short toShort(Object value) + { + return toShort(value, null); + } + + /** + * 转换为Number<br> + * 如果给定的值为空,或者转换失败,返回默认值<br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Number toNumber(Object value, Number defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Number) + { + return (Number) value; + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return NumberFormat.getInstance().parse(valueStr); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为Number<br> + * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Number toNumber(Object value) + { + return toNumber(value, null); + } + + /** + * 转换为int<br> + * 如果给定的值为空,或者转换失败,返回默认值<br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Integer toInt(Object value, Integer defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Integer) + { + return (Integer) value; + } + if (value instanceof Number) + { + return ((Number) value).intValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return Integer.parseInt(valueStr.trim()); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为int<br> + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Integer toInt(Object value) + { + return toInt(value, null); + } + + /** + * 转换为Integer数组<br> + * + * @param str 被转换的值 + * @return 结果 + */ + public static Integer[] toIntArray(String str) + { + return toIntArray(",", str); + } + + /** + * 转换为Long数组<br> + * + * @param str 被转换的值 + * @return 结果 + */ + public static Long[] toLongArray(String str) + { + return toLongArray(",", str); + } + + /** + * 转换为Integer数组<br> + * + * @param split 分隔符 + * @param split 被转换的值 + * @return 结果 + */ + public static Integer[] toIntArray(String split, String str) + { + if (StringUtils.isEmpty(str)) + { + return new Integer[] {}; + } + String[] arr = str.split(split); + final Integer[] ints = new Integer[arr.length]; + for (int i = 0; i < arr.length; i++) + { + final Integer v = toInt(arr[i], 0); + ints[i] = v; + } + return ints; + } + + /** + * 转换为Long数组<br> + * + * @param split 分隔符 + * @param str 被转换的值 + * @return 结果 + */ + public static Long[] toLongArray(String split, String str) + { + if (StringUtils.isEmpty(str)) + { + return new Long[] {}; + } + String[] arr = str.split(split); + final Long[] longs = new Long[arr.length]; + for (int i = 0; i < arr.length; i++) + { + final Long v = toLong(arr[i], null); + longs[i] = v; + } + return longs; + } + + /** + * 转换为String数组<br> + * + * @param str 被转换的值 + * @return 结果 + */ + public static String[] toStrArray(String str) + { + return toStrArray(",", str); + } + + /** + * 转换为String数组<br> + * + * @param split 分隔符 + * @param split 被转换的值 + * @return 结果 + */ + public static String[] toStrArray(String split, String str) + { + return str.split(split); + } + + /** + * 转换为long<br> + * 如果给定的值为空,或者转换失败,返回默认值<br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static long toLong(Object value, Integer defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Integer) + { + return (Integer) value; + } + if (value instanceof Number) + { + return ((Number) value).longValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + // 支持科学计数法 + return new BigDecimal(valueStr.trim()).longValue(); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为long<br> + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Long toLong(Object value) + { + return toLong(value, null); + } + + /** + * 转换为double<br> + * 如果给定的值为空,或者转换失败,返回默认值<br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Double toDouble(Object value, Double defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Double) + { + return (Double) value; + } + if (value instanceof Number) + { + return ((Number) value).doubleValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + // 支持科学计数法 + return new BigDecimal(valueStr.trim()).doubleValue(); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为double<br> + * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Double toDouble(Object value) + { + return toDouble(value, null); + } + + /** + * 转换为Float<br> + * 如果给定的值为空,或者转换失败,返回默认值<br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Float toFloat(Object value, Float defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Float) + { + return (Float) value; + } + if (value instanceof Number) + { + return ((Number) value).floatValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return Float.parseFloat(valueStr.trim()); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为Float<br> + * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Float toFloat(Object value) + { + return toFloat(value, null); + } + + /** + * 转换为boolean<br> + * String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值<br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Boolean toBool(Object value, Boolean defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Boolean) + { + return (Boolean) value; + } + String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + valueStr = valueStr.trim().toLowerCase(); + switch (valueStr) + { + case "true": + return true; + case "false": + return false; + case "yes": + return true; + case "ok": + return true; + case "no": + return false; + case "1": + return true; + case "0": + return false; + default: + return defaultValue; + } + } + + /** + * 转换为boolean<br> + * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Boolean toBool(Object value) + { + return toBool(value, null); + } + + /** + * 转换为Enum对象<br> + * 如果给定的值为空,或者转换失败,返回默认值<br> + * + * @param clazz Enum的Class + * @param value 值 + * @param defaultValue 默认值 + * @return Enum + */ + public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value, E defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (clazz.isAssignableFrom(value.getClass())) + { + @SuppressWarnings("unchecked") + E myE = (E) value; + return myE; + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return Enum.valueOf(clazz, valueStr); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为Enum对象<br> + * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> + * + * @param clazz Enum的Class + * @param value 值 + * @return Enum + */ + public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value) + { + return toEnum(clazz, value, null); + } + + /** + * 转换为BigInteger<br> + * 如果给定的值为空,或者转换失败,返回默认值<br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static BigInteger toBigInteger(Object value, BigInteger defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof BigInteger) + { + return (BigInteger) value; + } + if (value instanceof Integer) + { + return BigInteger.valueOf((Integer) value); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return new BigInteger(valueStr); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为BigInteger<br> + * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static BigInteger toBigInteger(Object value) + { + return toBigInteger(value, null); + } + + /** + * 转换为BigDecimal<br> + * 如果给定的值为空,或者转换失败,返回默认值<br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof BigDecimal) + { + return (BigDecimal) value; + } + if (value instanceof Integer) + { + return new BigDecimal((Integer) value); + } + if (value instanceof Double) + { + return new BigDecimal((Double) value); + } + if (value instanceof Integer) + { + return new BigDecimal((Integer) value); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return new BigDecimal(valueStr); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为BigDecimal<br> + * 如果给定的值为空,或者转换失败,返回默认值<br> + * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static BigDecimal toBigDecimal(Object value) + { + return toBigDecimal(value, null); + } + + /** + * 将对象转为字符串<br> + * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 + * + * @param obj 对象 + * @return 字符串 + */ + public static String utf8Str(Object obj) + { + return str(obj, CharsetKit.CHARSET_UTF_8); + } + + /** + * 将对象转为字符串<br> + * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 + * + * @param obj 对象 + * @param charsetName 字符集 + * @return 字符串 + */ + public static String str(Object obj, String charsetName) + { + return str(obj, Charset.forName(charsetName)); + } + + /** + * 将对象转为字符串<br> + * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 + * + * @param obj 对象 + * @param charset 字符集 + * @return 字符串 + */ + public static String str(Object obj, Charset charset) + { + if (null == obj) + { + return null; + } + + if (obj instanceof String) + { + return (String) obj; + } + else if (obj instanceof byte[] || obj instanceof Byte[]) + { + return str((Byte[]) obj, charset); + } + else if (obj instanceof ByteBuffer) + { + return str((ByteBuffer) obj, charset); + } + return obj.toString(); + } + + /** + * 将byte数组转为字符串 + * + * @param bytes byte数组 + * @param charset 字符集 + * @return 字符串 + */ + public static String str(byte[] bytes, String charset) + { + return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset)); + } + + /** + * 解码字节码 + * + * @param data 字符串 + * @param charset 字符集,如果此字段为空,则解码的结果取决于平台 + * @return 解码后的字符串 + */ + public static String str(byte[] data, Charset charset) + { + if (data == null) + { + return null; + } + + if (null == charset) + { + return new String(data); + } + return new String(data, charset); + } + + /** + * 将编码的byteBuffer数据转换为字符串 + * + * @param data 数据 + * @param charset 字符集,如果为空使用当前系统字符集 + * @return 字符串 + */ + public static String str(ByteBuffer data, String charset) + { + if (data == null) + { + return null; + } + + return str(data, Charset.forName(charset)); + } + + /** + * 将编码的byteBuffer数据转换为字符串 + * + * @param data 数据 + * @param charset 字符集,如果为空使用当前系统字符集 + * @return 字符串 + */ + public static String str(ByteBuffer data, Charset charset) + { + if (null == charset) + { + charset = Charset.defaultCharset(); + } + return charset.decode(data).toString(); + } + + // ----------------------------------------------------------------------- 全角半角转换 + /** + * 半角转全角 + * + * @param input String. + * @return 全角字符串. + */ + public static String toSBC(String input) + { + return toSBC(input, null); + } + + /** + * 半角转全角 + * + * @param input String + * @param notConvertSet 不替换的字符集合 + * @return 全角字符串. + */ + public static String toSBC(String input, Set<Character> notConvertSet) + { + char c[] = input.toCharArray(); + for (int i = 0; i < c.length; i++) + { + if (null != notConvertSet && notConvertSet.contains(c[i])) + { + // 跳过不替换的字符 + continue; + } + + if (c[i] == ' ') + { + c[i] = '\u3000'; + } + else if (c[i] < '\177') + { + c[i] = (char) (c[i] + 65248); + + } + } + return new String(c); + } + + /** + * 全角转半角 + * + * @param input String. + * @return 半角字符串 + */ + public static String toDBC(String input) + { + return toDBC(input, null); + } + + /** + * 替换全角为半角 + * + * @param text 文本 + * @param notConvertSet 不替换的字符集合 + * @return 替换后的字符 + */ + public static String toDBC(String text, Set<Character> notConvertSet) + { + char c[] = text.toCharArray(); + for (int i = 0; i < c.length; i++) + { + if (null != notConvertSet && notConvertSet.contains(c[i])) + { + // 跳过不替换的字符 + continue; + } + + if (c[i] == '\u3000') + { + c[i] = ' '; + } + else if (c[i] > '\uFF00' && c[i] < '\uFF5F') + { + c[i] = (char) (c[i] - 65248); + } + } + String returnString = new String(c); + + return returnString; + } + + /** + * 数字金额大写转换 先写个完整的然后将如零拾替换成零 + * + * @param n 数字 + * @return 中文大写数字 + */ + public static String digitUppercase(double n) + { + String[] fraction = { "角", "分" }; + String[] digit = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" }; + String[][] unit = { { "元", "万", "亿" }, { "", "拾", "佰", "仟" } }; + + String head = n < 0 ? "负" : ""; + n = Math.abs(n); + + String s = ""; + for (int i = 0; i < fraction.length; i++) + { + s += (digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", ""); + } + if (s.length() < 1) + { + s = "整"; + } + int integerPart = (int) Math.floor(n); + + for (int i = 0; i < unit[0].length && integerPart > 0; i++) + { + String p = ""; + for (int j = 0; j < unit[1].length && n > 0; j++) + { + p = digit[integerPart % 10] + unit[1][j] + p; + integerPart = integerPart / 10; + } + s = p.replaceAll("(零.)*零$", "").replaceAll("^$", "零") + unit[0][i] + s; + } + return head + s.replaceAll("(零.)*零元", "元").replaceFirst("(零.)+", "").replaceAll("(零.)+", "零").replaceAll("^整$", + "零元整"); + } + +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/ServletUtils.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/ServletUtils.java new file mode 100644 index 0000000..c510728 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/ServletUtils.java @@ -0,0 +1,144 @@ +package org.jeecg.modules.wms.framework; + +import org.jeecg.utils.StringUtils; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.IOException; + +/** + * 客户端工具类 + * + * @author huaheng + */ +public class ServletUtils +{ + /** + * 获取String参数 + */ + public static String getParameter(String name) + { + return getRequest().getParameter(name); + } + + /** + * 获取String参数 + */ + public static String getParameter(String name, String defaultValue) + { + return Convert.toStr(getRequest().getParameter(name), defaultValue); + } + + /** + * 获取Integer参数 + */ + public static Integer getParameterToInt(String name) + { + return Convert.toInt(getRequest().getParameter(name)); + } + + /** + * 获取Integer参数 + */ + public static Integer getParameterToInt(String name, Integer defaultValue) + { + return Convert.toInt(getRequest().getParameter(name), defaultValue); + } + + /** + * 获取request + */ + public static HttpServletRequest getRequest() + { + return getRequestAttributes().getRequest(); + } + + /** + * 获取response + */ + public static HttpServletResponse getResponse() + { + return getRequestAttributes().getResponse(); + } + + /** + * 获取session + */ + public static HttpSession getSession() + { + return getRequest().getSession(); + } + + public static ServletRequestAttributes getRequestAttributes() + { + RequestAttributes attributes = RequestContextHolder.getRequestAttributes(); + return (ServletRequestAttributes) attributes; + } + + /** + * 将字符串渲染到客户端 + * + * @param response 渲染对象 + * @param string 待渲染的字符串 + * @return null + */ + public static String renderString(HttpServletResponse response, String string) + { + try + { + response.setContentType("application/json"); + response.setCharacterEncoding("utf-8"); + response.getWriter().print(string); + } + catch (IOException e) + { + e.printStackTrace(); + } + return null; + } + + /** + * 是否是Ajax异步请求 + * + * @param request + */ + public static boolean isAjaxRequest(HttpServletRequest request) + { + + String accept = request.getHeader("accept"); + if (accept != null && accept.indexOf("application/json") != -1) + { + return true; + } + + String contentType = request.getHeader("Content-Type"); + if (contentType != null && contentType.indexOf("application/json") != -1) + { + return true; + } + + String xRequestedWith = request.getHeader("X-Requested-With"); + if (xRequestedWith != null && xRequestedWith.indexOf("XMLHttpRequest") != -1) + { + return true; + } + + String uri = request.getRequestURI(); + if (StringUtils.inStringIgnoreCase(uri, ".json", ".xml")) + { + return true; + } + + String ajax = request.getParameter("__ajax"); + if (StringUtils.inStringIgnoreCase(ajax, "json", "xml")) + { + return true; + } + + return false; + } +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/ApiLogAspect.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/ApiLogAspect.java new file mode 100644 index 0000000..d6427f9 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/ApiLogAspect.java @@ -0,0 +1,519 @@ +package org.jeecg.modules.wms.framework.aspectj; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import okhttp3.Request; +import okhttp3.Response; +import org.apache.commons.lang.exception.ExceptionUtils; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +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.framework.ServletUtils; +import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger; +import org.jeecg.modules.wms.framework.spring.SpringUtils; +import org.jeecg.modules.wms.monitor.apiLog.entity.ApiLog; +import org.jeecg.modules.wms.monitor.apiLog.service.IApiLogService; +import org.jeecg.utils.StringUtils; +import org.jeecg.utils.constant.QuantityConstant; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpHeaders; +import org.springframework.scheduling.annotation.Async; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.stereotype.Component; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.*; + +/** + * Api调用日志记录处理 + * + * @author huaheng + */ +@Aspect +@Component +@EnableAsync +public class ApiLogAspect +{ + private static final Logger log = LoggerFactory.getLogger(ApiLogAspect.class); + + private static IApiLogService apiLogService; + + private static IAddressService addressService; + + + @Autowired + public void setApiLogService(IApiLogService apiLogService){ + ApiLogAspect.apiLogService = apiLogService; + } + + @Autowired + public void setAddressService(IAddressService addressService){ + ApiLogAspect.addressService = addressService; + } + + // 配置织入点 + @Pointcut("@annotation(org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger)") + public void logPointCut() + { + } + + @Around("logPointCut() && @annotation(apiLogger)") + public Object around(ProceedingJoinPoint point, ApiLogger apiLogger) throws Throwable + { + if("WMS".equalsIgnoreCase(apiLogger.from())) + //实际上静态方法上的Aop注解无法拦截到 + { + return aroundWms2XXX(point, apiLogger); + } else { + return aroundXXX2Wms(point, apiLogger); + } + } + + /**处理xxx调用wms接口的日志**/ + private Object aroundXXX2Wms(ProceedingJoinPoint point, ApiLogger apiLogger){ + Object ret = null; + ApiLog log = initApiLog(apiLogger, point); + try{ + ret = point.proceed(); + }catch (Exception e){ + setApiLogException(log, e); + ret = Result.error(e.getMessage()); + }finally{ + finishApiLog(log, ret); + return ret; + } + } + + /**处理WMS调用xxx接口的日志**/ + private Object aroundWms2XXX(ProceedingJoinPoint point, ApiLogger apiLogger){ + Object ret = null; + ApiLog log = new ApiLog(); + + HttpURLConnection connection = null; + String body = null; + + try { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + connection = (HttpURLConnection) point.getArgs()[0]; + body = (String) point.getArgs()[1]; + initApiLog(connection, body); + }catch (Exception e){ + + } + + try{ + ret = point.proceed(); + }catch (Exception e){ + setApiLogException(log, e); + throw e; + }finally{ + if(ret != null) { + finishApiLog(log, connection, ret.toString()); + } + return ret; + } + } + + /** + * 记录响应头信息 + **/ + public static void finishApiLog(ApiLog log, HttpURLConnection connection, String body) { + try { + log.setResponseBody(body); + log.setResponseTime(new Date()); + Long duration = log.getResponseTime().getTime() - log.getRequestTime().getTime(); + log.setDuration(duration.intValue()); + log.setHttpCode(connection.getResponseCode()); + + //响应头 + Set<String> keyset = connection.getHeaderFields().keySet(); + ArrayList<String> headerList = new ArrayList<>(); + Iterator<String> it = keyset.iterator(); + while (it.hasNext()) { + String name = it.next(); + String header = connection.getHeaderField(name); + if (name == null || "".equals(name)) { + //第一行没有name + //HTTP/1.1 200 OK + headerList.add(header); + } + else { + headerList.add(name + ": " + header); + } + } + log.setResponseHeader(org.apache.commons.lang3.StringUtils.join(headerList, "\n")); + Result json = JSON.parseObject(body, Result.class); + log.setRetCode(json.getCode()); + } catch (Exception e) { + e.printStackTrace(); + } finally { + SpringUtils.getBean(ApiLogAspect.class).saveApiLog(log); + } + } + + /** + * 根据url,从address表中判断调用的去向 + **/ + public static void parseUrl(ApiLog log, URL url, String warehouseCode) { + try { + String[] spList = url.toString().split("/"); + String apiName = spList[spList.length - 1]; + int index = url.toString().lastIndexOf(apiName); + String addUrl = url.toString().substring(0, index); + + Address address = addressService.getAddressByUrl(url.toString(), warehouseCode); + log.setApiName(apiName); + log.setRequestFrom("WMS"); + log.setResponseBy(address.getCode().toUpperCase()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + + /** + * 记录WMS调用外接口的请求信息 + * 在HttpUtils.bodypost方法中直接调用本类static方法 + **/ + public static ApiLog initApiLog(String Method, String url, String body, HttpHeaders headers, String warehouseCode) { + ApiLog log = new ApiLog(); + try { + URL url1 = new URL(url); + log.setApiMethod(Method); + log.setUrl(url); + log.setRequestTime(new Date()); + parseUrl(log, url1, warehouseCode); + + //请求头 + Set<String> keySet = headers.keySet(); + ArrayList<String> headerList = new ArrayList<>(); + Iterator<String> it = keySet.iterator(); + while (it.hasNext()) { + String name = it.next(); + String header = String.valueOf(headers.getContentType()); + headerList.add(name + ": " + header); + } + + log.setRequestHeader(org.apache.commons.lang3.StringUtils.join(headerList, "\n")); + log.setRequestBody(body); + } catch (Exception e) { + e.printStackTrace(); + } + + return log; + } + + /**记录WMS调用外接口的请求信息 + * 在HttpUtils.bodypost方法中直接调用本类static方法**/ + public static ApiLog initApiLog(HttpURLConnection connection, String body){ + ApiLog log = new ApiLog(); + try { + log.setApiMethod(connection.getRequestMethod()); + log.setUrl(connection.getURL().toString()); + log.setRequestTime(new Date()); + parseUrl(log, connection.getURL()); + + //请求头 + Set<String> keySet = connection.getRequestProperties().keySet(); + ArrayList<String> headerList = new ArrayList<>(); + Iterator<String> it = keySet.iterator(); + while (it.hasNext()) { + String name = it.next(); + String header = connection.getRequestProperty(name); + headerList.add(name + ": " + header); + } + + log.setRequestHeader(org.apache.commons.lang3.StringUtils.join(headerList, "\n")); + log.setRequestBody(body); + }catch (Exception e){ + e.printStackTrace(); + } + + return log; + } + + /**记录WMS调用外接口的请求信息 + * 在HttpUtils.bodypost方法中直接调用本类static方法**/ + public static ApiLog initApiLog(Request request, String body){ + ApiLog log = new ApiLog(); + try { + log.setApiMethod(request.method()); + log.setUrl(request.url().toString()); + log.setRequestTime(new Date()); + parseUrl(log, request.url().url()); + log.setRequestHeader(request.headers().toString()); + log.setRequestBody(body); + }catch (Exception e){ + e.printStackTrace(); + } + return log; + } + + /**记录响应头信息**/ + public static void finishApiLog(ApiLog log, Response response, String body){ + try { + log.setResponseBody(body); + log.setResponseTime(new Date()); + Long duration = log.getResponseTime().getTime() - log.getRequestTime().getTime(); + log.setDuration(duration.intValue()); + log.setHttpCode(response.code()); + + //响应头 + log.setResponseHeader(response.headers().toString()); + Result ajaxResult = null; + try{ + ajaxResult = JSON.parseObject(body, Result.class); + }catch(Exception ex){ + body = JSON.parse(body).toString(); + ajaxResult = JSON.parseObject(body, Result.class); + } + log.setRetCode(ajaxResult.getCode()); + }catch (Exception e){ + e.printStackTrace(); + }finally { + try { + if (StringUtils.isNotEmpty(log.getResponseBody()) && log.getResponseBody().length() > 2001) { + log.setResponseBody(log.getResponseBody().substring(0, 2000) + "\n太长了...后面省略。\n" + log.getResponseBody().length()); + } + }catch (Exception e){ + + } + SpringUtils.getBean(ApiLogAspect.class).saveApiLog(log); + } + } + + + + /**根据url,从address表中判断调用的去向**/ + public static void parseUrl(ApiLog log, URL url){ + try { + String[] spList = url.toString().split("/"); + String apiName = spList[spList.length - 1]; + int index = url.toString().lastIndexOf(apiName); + String addUrl = url.toString().substring(0, index); + + Address address = addressService.getAddressByUrl(url.toString(), QuantityConstant.DEFAULT_WAREHOUSE); + log.setApiName(apiName); + log.setRequestFrom("WMS"); + log.setResponseBy(address.getCode().toUpperCase()); + }catch (Exception e){ + e.printStackTrace(); + } + } + /** + * 记录响应头信息 + **/ + public static void finishApiLog(ApiLog log, HttpHeaders headers, String body) { + try { + log.setResponseBody(body); + log.setResponseTime(new Date()); + Long duration = log.getResponseTime().getTime() - log.getRequestTime().getTime(); + log.setDuration(duration.intValue()); + log.setHttpCode(200); + + //响应头 + Set<String> keyset = headers.keySet(); + ArrayList<String> headerList = new ArrayList<>(); + Iterator<String> it = keyset.iterator(); + while (it.hasNext()) { + String name = it.next(); + String header = String.valueOf(headers.getContentType()); + if (name == null || "".equals(name)) + //第一行没有name + //HTTP/1.1 200 OK + headerList.add(header); + else + headerList.add(name + ": " + header); + } + log.setResponseHeader(org.apache.commons.lang3.StringUtils.join(headerList, "\n")); + Result json = JSON.parseObject(body, Result.class); + log.setRetCode(json.getCode()); + } catch (Exception e) { + e.printStackTrace(); + } finally { + SpringUtils.getBean(ApiLogAspect.class).saveApiLog(log); + } + } + + + private ApiLog initApiLog(ApiLogger apiLogger, ProceedingJoinPoint point){ + ApiLog log = new ApiLog(); + try{ + log.setRequestTime(new Date()); + log.setRequestFrom(apiLogger.from()); + log.setResponseBy(apiLogger.to()); + log.setApiName(apiLogger.apiName()); + + HttpServletRequest request = ServletUtils.getRequest(); + + String qryStr = request.getQueryString(); + String url = request.getRequestURL().toString(); + if(StringUtils.isNotEmpty(qryStr)) { + url = url + "?" + qryStr; + } + log.setUrl(url); + + log.setApiMethod(request.getMethod()); + log.setIp(request.getRemoteAddr()); + + rebuildRequestHeader(log); + + rebuildRequestBody(log, request); + + //如果reqeust中取不到post参数,就从接口方法参数中取json对象 + if(StringUtils.isEmpty(log.getRequestBody())) { + rebuildRequestBody(log, point); + } + + }catch (Exception e){ + e.printStackTrace(); + } + + return log; + } + + private void finishApiLog(ApiLog log, Object ret){ + try { + rebuildResponseHeader(log); + rebuildResponseBody(log, ret); + + log.setResponseTime(new Date()); + Long duration = log.getResponseTime().getTime() - log.getRequestTime().getTime(); + log.setDuration(duration.intValue()); + + HttpServletResponse resp = ServletUtils.getResponse(); + log.setHttpCode(resp.getStatus()); + + if (ret instanceof Result) { + int retCode = ((Result) ret).getCode(); + log.setRetCode(retCode); + } + }catch (Exception e){ + e.printStackTrace(); + }finally { + saveApiLog(log); + } + } + + public static void setApiLogException(ApiLog log, Exception e){ + try { + String exception = ExceptionUtils.getFullStackTrace(e); + String shortExpInfo = e.getMessage() + "\n" + org.apache.commons.lang3.StringUtils.left(exception, 1000); + log.setException(shortExpInfo); + }catch (Exception ex){ + ex.printStackTrace(); + } + } + + private void rebuildRequestHeader(ApiLog log){ + try { + HttpServletRequest req = ServletUtils.getRequest(); + Enumeration names = req.getHeaderNames(); + ArrayList<String> headerList = new ArrayList<>(); + while(names.hasMoreElements()){ + String name = (String)names.nextElement(); + String header = req.getHeader(name); + headerList.add(name + ": " + header); + } + String headers = org.apache.commons.lang3.StringUtils.join(headerList, "\n"); + log.setRequestHeader(headers); + }catch (Exception e){ + e.printStackTrace(); + } + } + + /**先从post参数中构造request body*/ + private void rebuildRequestBody(ApiLog log, HttpServletRequest request){ + try{ + Set<String> keySet = request.getParameterMap().keySet(); + Iterator<String> it = keySet.iterator(); + StringBuffer sbf = new StringBuffer(); + while(it.hasNext()){ + String key = it.next(); + String value = request.getParameter(key); + sbf.append(key).append("=").append(value); + if(it.hasNext()) { + sbf.append("&"); + } + } + log.setRequestBody(sbf.toString()); + }catch (Exception e){ + e.printStackTrace(); + } + } + + /** + * 根据接口中的参数构造request body + */ + private void rebuildRequestBody(ApiLog log, ProceedingJoinPoint point) + { + try { + if (point.getArgs().length == 1) { + log.setRequestBody(JSONObject.toJSONString(point.getArgs()[0])); + return; + } + + MethodSignature m = (MethodSignature) point.getSignature(); + HashMap<String, Object> map = new HashMap<>(); + Object[] args = point.getArgs(); + for (int i = 0; i < m.getParameterNames().length; i++) { + String name = m.getParameterNames()[i]; +// Class type = m.getParameterTypes()[i]; + map.put(name, args[i]); + } + + if(!map.isEmpty()) { + log.setRequestBody(JSONObject.toJSONString(map)); + } + }catch (Exception e){ + e.printStackTrace(); + } + } + + private void rebuildResponseHeader(ApiLog log){ + try { + HttpServletResponse resp = ServletUtils.getResponse(); + Collection names = resp.getHeaderNames(); + ArrayList<String> headerList = new ArrayList<>(); + Iterator<String> it = names.iterator(); + while(it.hasNext()){ + String name = it.next(); + String header = resp.getHeader(name); + headerList.add(name + ": " + header); + } + String headers = org.apache.commons.lang3.StringUtils.join(headerList, "\n"); + log.setResponseHeader(headers); + }catch (Exception e){ + e.printStackTrace(); + } + } + + private void rebuildResponseBody(ApiLog log, Object ret){ + try { + log.setResponseBody(JSONObject.toJSON(ret).toString()); + }catch (Exception e){ + e.printStackTrace(); + } + } + + @Async + public void saveApiLog(ApiLog log){ + try{ + apiLogService.saveOrUpdate(log); + }catch (Exception e){ + e.printStackTrace(); + } + } +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/annotation/ApiLogger.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/annotation/ApiLogger.java new file mode 100644 index 0000000..dc1d2dd --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/annotation/ApiLogger.java @@ -0,0 +1,25 @@ +package org.jeecg.modules.wms.framework.aspectj.lang.annotation; + +import java.lang.annotation.*; + +/** + * 第三方系统API请求调用日志注解 + * + * @author huaheng + * + */ +@Target({ ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface ApiLogger +{ + /** 接口名称 */ + String apiName() default ""; + + /** 接口调用方 */ + String from() default ""; + + /** 接口提供方 */ + String to() default "WMS"; + +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/BusinessStatus.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/BusinessStatus.java new file mode 100644 index 0000000..7e6af54 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/BusinessStatus.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.wms.framework.aspectj.lang.constant; + +/** + * 操作状态 + * + * @author huaheng + * + */ +public class BusinessStatus +{ + /** 其它 */ + public static final String OTHER = "-1"; + + /** 成功 */ + public static final String SUCCESS = "0"; + + /** 失败 */ + public static final String FAIL = "1"; +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/BusinessType.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/BusinessType.java new file mode 100644 index 0000000..0c9fa8e --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/BusinessType.java @@ -0,0 +1,29 @@ +package org.jeecg.modules.wms.framework.aspectj.lang.constant; + +/** + * 业务操作类型 + * + * @author huaheng + * + */ +public class BusinessType +{ + /** 其它 */ + public static final String OTHER = "0"; + /** 新增 */ + public static final String INSERT = "1"; + /** 修改 */ + public static final String UPDATE = "2"; + /** 删除 */ + public static final String DELETE = "3"; + /** 授权 */ + public static final String GRANT = "4"; + /** 导出 */ + public static final String EXPORT = "5"; + /** 导入 */ + public static final String IMPORT = "6"; + /** 强退 */ + public static final String FORCE = "7"; + /** 生成代码 */ + public static final String GENCODE = "8"; +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/DataSourceName.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/DataSourceName.java new file mode 100644 index 0000000..95472d0 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/DataSourceName.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.wms.framework.aspectj.lang.constant; + +/** + * 多数据源别名 + * + * @author huaheng + * + */ +public class DataSourceName +{ + /** 主库 */ + public static final String MASTER = "master"; + + /** 从库 */ + public static final String SLAVE = "slave"; + + /** wcs库*/ + public static final String WCS = "wcs"; +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/OperatorType.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/OperatorType.java new file mode 100644 index 0000000..4f1d95b --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/OperatorType.java @@ -0,0 +1,22 @@ +package org.jeecg.modules.wms.framework.aspectj.lang.constant; + +/** + * 操作人类别 + * + * @author huaheng + * + */ +public class OperatorType +{ + /** 其它 */ + public static final String OTHER = "0"; + + /** 后台用户 */ + public static final String MANAGE = "1"; + + /** 渠道用户 */ + public static final String CHANNEL = "2"; + + /** 手机端用户 */ + public static final String MOBILE = "3"; +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/ProcessCode.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/ProcessCode.java new file mode 100644 index 0000000..eadd207 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/ProcessCode.java @@ -0,0 +1,39 @@ +package org.jeecg.modules.wms.framework.aspectj.lang.constant; + +/** + * 任务流程编码 + * + * @author xcq + */ +public class ProcessCode { + /** 入库任务 */ + public static final String RECEIPT_TASK_CODE = "receipt_task"; + /** 出库任务 */ + public static final String SHIPMENT_TASK_CODE = "shipment_task"; + /** 入库单据 */ + public static final String RECEIPT_BILL_CODE = "receipt_bill"; + /** 出库单据 */ + public static final String SHIPMENT_BILL_CODE = "shipment_bill"; + /** 其他任务 */ + public static final String OTHER_TASK_CODE = "other_task"; + + /** 从头部取值 */ + public static final String METHOD_HEAD = "head"; + /** 从返回结果取值 */ + public static final String METHOD_RESULT = "result"; + /** 通过表查询取值 */ + public static final String METHOD_SELECT = "SELECT"; + + /** 出库单据预约 */ + public static final String MODIFICATION_EDIT = "modificationEdit"; + + /** 出库单据审核 */ + public static final String REVIEW = "review"; + /** 出库单据销售单回传 */ + public static final String PUSH_SALES_DELIVERY = "pushSalesDelivery"; + + /** 入库单据创建 */ + public static final String CREATE_RECEIPT_TASK = "createReceiptTask"; + /** 入库单据回传 */ + public static final String RECEIPT_METHOD = "receiptMethod"; +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/datasource/DynamicDataSource.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/datasource/DynamicDataSource.java new file mode 100644 index 0000000..4b63878 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/datasource/DynamicDataSource.java @@ -0,0 +1,28 @@ +package org.jeecg.modules.wms.framework.datasource; + +import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; + +import javax.sql.DataSource; +import java.util.Map; + +/** + * 动态数据源 + * + * @author huaheng + */ +public class DynamicDataSource extends AbstractRoutingDataSource +{ + public DynamicDataSource(DataSource defaultTargetDataSource, Map<Object, Object> targetDataSources) + { + super.setDefaultTargetDataSource(defaultTargetDataSource); + super.setTargetDataSources(targetDataSources); + super.afterPropertiesSet(); + } + + @Override + protected Object determineCurrentLookupKey() + { + return DynamicDataSourceContextHolder.getDB(); + } + +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/datasource/DynamicDataSourceContextHolder.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/datasource/DynamicDataSourceContextHolder.java new file mode 100644 index 0000000..2edee58 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/datasource/DynamicDataSourceContextHolder.java @@ -0,0 +1,46 @@ +package org.jeecg.modules.wms.framework.datasource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 当前线程数据源 + * + * @author huaheng + */ +public class DynamicDataSourceContextHolder +{ + public static final Logger log = LoggerFactory.getLogger(DynamicDataSourceContextHolder.class); + + /** + * 使用ThreadLocal维护变量,ThreadLocal为每个使用该变量的线程提供独立的变量副本, + * 所以每一个线程都可以独立地改变自己的副本,而不会影响其它线程所对应的副本。 + */ + private static final ThreadLocal<String> CONTEXT_HOLDER = new ThreadLocal<>(); + + /** + * 设置数据源名 + */ + public static void setDB(String dbType) + { + log.info("切换到{}数据源", dbType); + CONTEXT_HOLDER.set(dbType); + } + + /** + * 获取数据源名 + */ + public static String getDB() + { + return CONTEXT_HOLDER.get(); + } + + /** + * 清理数据源名 + */ + public static void clearDB() + { + CONTEXT_HOLDER.remove(); + } + +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/spring/SpringUtils.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/spring/SpringUtils.java new file mode 100644 index 0000000..6223b34 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/spring/SpringUtils.java @@ -0,0 +1,102 @@ +package org.jeecg.modules.wms.framework.spring; + +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.NoSuchBeanDefinitionException; +import org.springframework.beans.factory.config.BeanFactoryPostProcessor; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; +import org.springframework.stereotype.Component; + +/** + * spring工具类 方便在非spring管理环境中获取bean + * + * @author huaheng + */ +@Component +public final class SpringUtils implements BeanFactoryPostProcessor +{ + /** Spring应用上下文环境 */ + private static ConfigurableListableBeanFactory beanFactory; + + @Override + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException + { + SpringUtils.beanFactory = beanFactory; + } + + /** + * 获取对象 + * + * @param name + * @return Object 一个以所给名字注册的bean的实例 + * @throws BeansException + * + */ + @SuppressWarnings("unchecked") + public static <T> T getBean(String name) throws BeansException + { + return (T) beanFactory.getBean(name); + } + + /** + * 获取类型为requiredType的对象 + * + * @param clz + * @return + * @throws BeansException + * + */ + public static <T> T getBean(Class<T> clz) throws BeansException + { + T result = (T) beanFactory.getBean(clz); + return result; + } + + /** + * 如果BeanFactory包含一个与所给名称匹配的bean定义,则返回true + * + * @param name + * @return boolean + */ + public static boolean containsBean(String name) + { + return beanFactory.containsBean(name); + } + + /** + * 判断以给定名字注册的bean定义是一个singleton还是一个prototype。 如果与给定名字相应的bean定义没有被找到,将会抛出一个异常(NoSuchBeanDefinitionException) + * + * @param name + * @return boolean + * @throws NoSuchBeanDefinitionException + * + */ + public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException + { + return beanFactory.isSingleton(name); + } + + /** + * @param name + * @return Class 注册对象的类型 + * @throws NoSuchBeanDefinitionException + * + */ + public static Class<?> getType(String name) throws NoSuchBeanDefinitionException + { + return beanFactory.getType(name); + } + + /** + * 如果给定的bean名字在bean定义中有别名,则返回这些别名 + * + * @param name + * @return + * @throws NoSuchBeanDefinitionException + * + */ + public static String[] getAliases(String name) throws NoSuchBeanDefinitionException + { + return beanFactory.getAliases(name); + } + +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/controller/InventoryHeaderController.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/controller/InventoryHeaderController.java new file mode 100644 index 0000000..abad6be --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/controller/InventoryHeaderController.java @@ -0,0 +1,301 @@ +package org.jeecg.modules.wms.inventory.inventoryHeader.controller; + +import org.jeecg.common.system.query.QueryGenerator; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.util.JwtUtil; +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; +import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; +import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.springframework.web.servlet.ModelAndView; +import java.util.Arrays; +import org.jeecg.common.util.oConvertUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + + /** + * @Description: 库存表 + * @Author: jeecg-boot + * @Date: 2022-11-16 + * @Version: V1.0 + */ +@Api(tags="库存表") +@RestController +@RequestMapping("/inventory/inventoryHeader") +@Slf4j +public class InventoryHeaderController extends JeecgController<InventoryHeader, IInventoryHeaderService> { + + @Autowired + private IInventoryHeaderService inventoryHeaderService; + + @Autowired + private IInventoryDetailService inventoryDetailService; + + + /*---------------------------------主表处理-begin-------------------------------------*/ + + /** + * 分页列表查询 + * @param inventoryHeader + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "库存表-分页列表查询") + @ApiOperation(value="库存表-分页列表查询", notes="库存表-分页列表查询") + @GetMapping(value = "/list") + public Result<IPage<InventoryHeader>> queryPageList(InventoryHeader inventoryHeader, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper<InventoryHeader> queryWrapper = QueryGenerator.initQueryWrapper(inventoryHeader, req.getParameterMap()); + Page<InventoryHeader> page = new Page<InventoryHeader>(pageNo, pageSize); + IPage<InventoryHeader> pageList = inventoryHeaderService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * @param inventoryHeader + * @return + */ + @AutoLog(value = "库存表-添加") + @ApiOperation(value="库存表-添加", notes="库存表-添加") + @PostMapping(value = "/add") + public Result<String> add(@RequestBody InventoryHeader inventoryHeader, HttpServletRequest req) { + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); + inventoryHeader.setWarehouseCode(warehouseCode); + inventoryHeaderService.save(inventoryHeader); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * @param inventoryHeader + * @return + */ + @AutoLog(value = "库存表-编辑") + @ApiOperation(value="库存表-编辑", notes="库存表-编辑") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result<String> edit(@RequestBody InventoryHeader inventoryHeader, HttpServletRequest req) { + inventoryHeaderService.updateById(inventoryHeader); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * @param id + * @return + */ + @AutoLog(value = "库存表-通过id删除") + @ApiOperation(value="库存表-通过id删除", notes="库存表-通过id删除") + @DeleteMapping(value = "/delete") + public Result<String> delete(@RequestParam(name="id",required=true) String id) { + inventoryHeaderService.delMain(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * @param ids + * @return + */ + @AutoLog(value = "库存表-批量删除") + @ApiOperation(value="库存表-批量删除", notes="库存表-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.inventoryHeaderService.delBatchMain(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 导出 + * @return + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, InventoryHeader inventoryHeader) { + return super.exportXls(request, inventoryHeader, InventoryHeader.class, "库存表"); + } + + /** + * 导入 + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, InventoryHeader.class); + } + /*---------------------------------主表处理-end-------------------------------------*/ + + + /*--------------------------------子表处理-库存详情-begin----------------------------------------------*/ + /** + * 通过主表ID查询 + * @return + */ + //@AutoLog(value = "库存详情-通过主表ID查询") + @ApiOperation(value="库存详情-通过主表ID查询", notes="库存详情-通过主表ID查询") + @GetMapping(value = "/listInventoryDetailByMainId") + public Result<IPage<InventoryDetail>> listInventoryDetailByMainId(InventoryDetail inventoryDetail, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper<InventoryDetail> queryWrapper = QueryGenerator.initQueryWrapper(inventoryDetail, req.getParameterMap()); + Page<InventoryDetail> page = new Page<InventoryDetail>(pageNo, pageSize); + IPage<InventoryDetail> pageList = inventoryDetailService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * @param inventoryDetail + * @return + */ + @AutoLog(value = "库存详情-添加") + @ApiOperation(value="库存详情-添加", notes="库存详情-添加") + @PostMapping(value = "/addInventoryDetail") + public Result<String> addInventoryDetail(@RequestBody InventoryDetail inventoryDetail, HttpServletRequest req) { + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); + inventoryDetail.setWarehouseCode(warehouseCode); + inventoryDetailService.save(inventoryDetail); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * @param inventoryDetail + * @return + */ + @AutoLog(value = "库存详情-编辑") + @ApiOperation(value="库存详情-编辑", notes="库存详情-编辑") + @RequestMapping(value = "/editInventoryDetail", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result<String> editInventoryDetail(@RequestBody InventoryDetail inventoryDetail) { + inventoryDetailService.updateById(inventoryDetail); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * @param id + * @return + */ + @AutoLog(value = "库存详情-通过id删除") + @ApiOperation(value="库存详情-通过id删除", notes="库存详情-通过id删除") + @DeleteMapping(value = "/deleteInventoryDetail") + public Result<String> deleteInventoryDetail(@RequestParam(name="id",required=true) String id) { + inventoryDetailService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * @param ids + * @return + */ + @AutoLog(value = "库存详情-批量删除") + @ApiOperation(value="库存详情-批量删除", notes="库存详情-批量删除") + @DeleteMapping(value = "/deleteBatchInventoryDetail") + public Result<String> deleteBatchInventoryDetail(@RequestParam(name="ids",required=true) String ids) { + this.inventoryDetailService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 导出 + * @return + */ + @RequestMapping(value = "/exportInventoryDetail") + public ModelAndView exportInventoryDetail(HttpServletRequest request, InventoryDetail inventoryDetail) { + // Step.1 组装查询条件 + QueryWrapper<InventoryDetail> queryWrapper = QueryGenerator.initQueryWrapper(inventoryDetail, request.getParameterMap()); + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + // Step.2 获取导出数据 + List<InventoryDetail> pageList = inventoryDetailService.list(queryWrapper); + List<InventoryDetail> exportList = null; + + // 过滤选中数据 + String selections = request.getParameter("selections"); + if (oConvertUtils.isNotEmpty(selections)) { + List<String> selectionList = Arrays.asList(selections.split(",")); + exportList = pageList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList()); + } else { + exportList = pageList; + } + + // Step.3 AutoPoi 导出Excel + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + mv.addObject(NormalExcelConstants.FILE_NAME, "库存详情"); //此处设置的filename无效 ,前端会重更新设置一下 + mv.addObject(NormalExcelConstants.CLASS, InventoryDetail.class); + mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("库存详情报表", "导出人:" + sysUser.getRealname(), "库存详情")); + mv.addObject(NormalExcelConstants.DATA_LIST, exportList); + return mv; + } + + /** + * 导入 + * @return + */ + @RequestMapping(value = "/importInventoryDetail/{mainId}") + public Result<?> importInventoryDetail(HttpServletRequest request, HttpServletResponse response, @PathVariable("mainId") Integer mainId) { + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); + for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { + MultipartFile file = entity.getValue();// 获取上传文件对象 + ImportParams params = new ImportParams(); + params.setTitleRows(2); + params.setHeadRows(1); + params.setNeedSave(true); + try { + List<InventoryDetail> list = ExcelImportUtil.importExcel(file.getInputStream(), InventoryDetail.class, params); + for (InventoryDetail temp : list) { + temp.setInventoryHeaderId(mainId); + } + long start = System.currentTimeMillis(); + inventoryDetailService.saveBatch(list); + log.info("消耗时间" + (System.currentTimeMillis() - start) + "毫秒"); + return Result.OK("文件导入成功!数据行数:" + list.size()); + } catch (Exception e) { + log.error(e.getMessage(), e); + return Result.error("文件导入失败:" + e.getMessage()); + } finally { + try { + file.getInputStream().close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return Result.error("文件导入失败!"); + } + + /*--------------------------------子表处理-库存详情-end----------------------------------------------*/ + + + + +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryDetail.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryDetail.java new file mode 100644 index 0000000..246f8dd --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryDetail.java @@ -0,0 +1,137 @@ +package org.jeecg.modules.wms.inventory.inventoryHeader.entity; + +import java.io.Serializable; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import org.jeecg.common.aspect.annotation.Dict; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import java.util.Date; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.UnsupportedEncodingException; + +/** + * @Description: 库存详情 + * @Author: jeecg-boot + * @Date: 2022-11-16 + * @Version: V1.0 + */ +@Data +@TableName("inventory_detail") +@ApiModel(value="inventory_detail对象", description="库存详情") +public class InventoryDetail implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer id; + /**库存头ID*/ + @ApiModelProperty(value = "库存头ID") + private Integer inventoryHeaderId; + /**仓库编码*/ + @Excel(name = "仓库编码", width = 15) + @ApiModelProperty(value = "仓库编码") + private String warehouseCode; + /**货主*/ + @Excel(name = "货主", width = 15) + @ApiModelProperty(value = "货主") + private String companyCode; + /**库区*/ + @Excel(name = "库区", width = 15) + @ApiModelProperty(value = "库区") + private String zoneCode; + /**容器编码*/ + @Excel(name = "容器编码", width = 15) + @ApiModelProperty(value = "容器编码") + private String containerCode; + /**库位编码*/ + @Excel(name = "库位编码", width = 15) + @ApiModelProperty(value = "库位编码") + private String locationCode; + /**物料编码*/ + @Excel(name = "物料编码", width = 15) + @ApiModelProperty(value = "物料编码") + private String materialCode; + /**物料名称*/ + @Excel(name = "物料名称", width = 15) + @ApiModelProperty(value = "物料名称") + private String materialName; + /**物料规格*/ + @Excel(name = "物料规格", width = 15) + @ApiModelProperty(value = "物料规格") + private String materialSpec; + /**物料单位*/ + @Excel(name = "物料单位", width = 15) + @ApiModelProperty(value = "物料单位") + private String materialUnit; + /**数量*/ + @Excel(name = "数量", width = 15) + @ApiModelProperty(value = "数量") + private java.math.BigDecimal qty; + /**任务锁定数量*/ + @Excel(name = "任务锁定数量", width = 15) + @ApiModelProperty(value = "任务锁定数量") + private java.math.BigDecimal taskQty; + /**库存状态*/ + @Excel(name = "库存状态", width = 15) + @Dict(dicCode = "inventory_status") + @ApiModelProperty(value = "库存状态") + private String inventoryStatus; + /**批次*/ + @Excel(name = "批次", width = 15) + @ApiModelProperty(value = "批次") + private String batch; + /**批号*/ + @Excel(name = "批号", width = 15) + @ApiModelProperty(value = "批号") + private String lot; + /**项目号*/ + @Excel(name = "项目号", width = 15) + @ApiModelProperty(value = "项目号") + private String project; + /**唯一号*/ + @Excel(name = "唯一号", width = 15) + @ApiModelProperty(value = "唯一号") + private String uniqueCode; + /**箱码*/ + @Excel(name = "箱码", width = 15) + @ApiModelProperty(value = "箱码") + private String boxCode; + /**入库日期*/ + @Excel(name = "入库日期", width = 15) + @ApiModelProperty(value = "入库日期") + private Date receiptDate; + /**库龄(天)*/ + @Excel(name = "库龄(天)", width = 15) + @ApiModelProperty(value = "库龄(天)") + private Integer inventoryAge; + /**备用字段1*/ + @Excel(name = "备用字段1", width = 15) + @ApiModelProperty(value = "备用字段1") + private String userdef1; + /**备用字段2*/ + @Excel(name = "备用字段2", width = 15) + @ApiModelProperty(value = "备用字段2") + private String userdef2; + /**备用字段3*/ + @Excel(name = "备用字段3", width = 15) + @ApiModelProperty(value = "备用字段3") + private String userdef3; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private String createBy; + /**创建日期*/ + @ApiModelProperty(value = "创建日期") + private Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private String updateBy; + /**更新日期*/ + @ApiModelProperty(value = "更新日期") + private Date updateTime; +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryHeader.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryHeader.java new file mode 100644 index 0000000..742153b --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryHeader.java @@ -0,0 +1,98 @@ +package org.jeecg.modules.wms.inventory.inventoryHeader.entity; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import org.jeecgframework.poi.excel.annotation.Excel; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * @Description: 库存表 + * @Author: jeecg-boot + * @Date: 2022-11-16 + * @Version: V1.0 + */ +@Data +@TableName("inventory_header") +@ApiModel(value="inventory_header对象", description="库存表") +public class InventoryHeader implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer id; + /**仓库编码*/ + @Excel(name = "仓库编码", width = 15) + @ApiModelProperty(value = "仓库编码") + private String warehouseCode; + /**货主*/ + @Excel(name = "货主", width = 15) + @ApiModelProperty(value = "货主") + private String companyCode; + /**库区*/ + @Excel(name = "库区", width = 15) + @ApiModelProperty(value = "库区") + private String zoneCode; + /**容器号*/ + @Excel(name = "容器号", width = 15) + @ApiModelProperty(value = "容器号") + private String containerCode; + /**容器状态*/ + @Excel(name = "容器状态", width = 15, dicCode = "container_status") + @Dict(dicCode = "container_status") + @ApiModelProperty(value = "容器状态") + private String containerStatus; + /**库位号*/ + @Excel(name = "库位号", width = 15) + @ApiModelProperty(value = "库位号") + private String locationCode; + /**状态*/ + @Excel(name = "状态", width = 15, dicCode = "enable_status") + @Dict(dicCode = "enable_status") + @ApiModelProperty(value = "状态") + private Integer enable; + /**总数量*/ + @Excel(name = "总数量", width = 15) + @ApiModelProperty(value = "总数量") + private java.math.BigDecimal totalQty; + /**总行量*/ + @Excel(name = "总行量", width = 15) + @ApiModelProperty(value = "总行量") + private Integer totalLines; + @Excel(name = "总重量", width = 15) + @ApiModelProperty(value = "总重量") + private Integer totalWeight; + /**备用字段1*/ + @Excel(name = "备用字段1", width = 15) + @ApiModelProperty(value = "备用字段1") + private String userdef1; + /**备用字段2*/ + @Excel(name = "备用字段2", width = 15) + @ApiModelProperty(value = "备用字段2") + private String userdef2; + /**备用字段3*/ + @Excel(name = "备用字段3", width = 15) + @ApiModelProperty(value = "备用字段3") + private String userdef3; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private String createBy; + /**创建日期*/ + @ApiModelProperty(value = "创建日期") + private Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private String updateBy; + /**更新日期*/ + @ApiModelProperty(value = "更新日期") + private Date updateTime; +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/mapper/InventoryDetailMapper.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/mapper/InventoryDetailMapper.java new file mode 100644 index 0000000..f76e624 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/mapper/InventoryDetailMapper.java @@ -0,0 +1,20 @@ +package org.jeecg.modules.wms.inventory.inventoryHeader.mapper; + +import java.util.List; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; + +/** + * @Description: 库存详情 + * @Author: jeecg-boot + * @Date: 2022-11-16 + * @Version: V1.0 + */ +public interface InventoryDetailMapper extends BaseMapper<InventoryDetail> { + + public boolean deleteByMainId(@Param("mainId") String mainId); + + public List<InventoryDetail> selectByMainId(@Param("mainId") String mainId); + +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/mapper/InventoryHeaderMapper.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/mapper/InventoryHeaderMapper.java new file mode 100644 index 0000000..ae68819 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/mapper/InventoryHeaderMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.wms.inventory.inventoryHeader.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; + +/** + * @Description: 库存表 + * @Author: jeecg-boot + * @Date: 2022-11-16 + * @Version: V1.0 + */ +public interface InventoryHeaderMapper extends BaseMapper<InventoryHeader> { + +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/mapper/xml/InventoryDetailMapper.xml b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/mapper/xml/InventoryDetailMapper.xml new file mode 100644 index 0000000..ab4ce40 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/mapper/xml/InventoryDetailMapper.xml @@ -0,0 +1,18 @@ +<?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="org.jeecg.modules.wms.inventory.inventoryHeader.mapper.InventoryDetailMapper"> + + <delete id="deleteByMainId" parameterType="java.lang.String"> + DELETE + FROM inventory_detail + WHERE + inventory_header_id = #{mainId} + </delete> + + <select id="selectByMainId" parameterType="java.lang.String" resultType="org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail"> + SELECT * + FROM inventory_detail + WHERE + inventory_header_id = #{mainId} + </select> +</mapper> diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/mapper/xml/InventoryHeaderMapper.xml b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/mapper/xml/InventoryHeaderMapper.xml new file mode 100644 index 0000000..807ee8d --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/mapper/xml/InventoryHeaderMapper.xml @@ -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="org.jeecg.modules.wms.inventory.inventoryHeader.mapper.InventoryHeaderMapper"> + +</mapper> diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryDetailService.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryDetailService.java new file mode 100644 index 0000000..b8f63cd --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryDetailService.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.wms.inventory.inventoryHeader.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; + +import java.util.List; + +/** + * @Description: 库存详情 + * @Author: jeecg-boot + * @Date: 2022-11-16 + * @Version: V1.0 + */ +public interface IInventoryDetailService extends IService<InventoryDetail> { + + public List<InventoryDetail> selectByMainId(String mainId); + + List<InventoryDetail> getInventoryDetailListByInventoryHeaderId(Integer inventoryHeaderId); +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryHeaderService.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryHeaderService.java new file mode 100644 index 0000000..bb5f2cf --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryHeaderService.java @@ -0,0 +1,30 @@ +package org.jeecg.modules.wms.inventory.inventoryHeader.service; + +import com.alipay.api.domain.Inventory; +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; +import org.springframework.beans.factory.annotation.Autowired; +import java.io.Serializable; +import java.util.Collection; +import java.util.List; + +/** + * @Description: 库存表 + * @Author: jeecg-boot + * @Date: 2022-11-16 + * @Version: V1.0 + */ +public interface IInventoryHeaderService extends IService<InventoryHeader> { + + /** + * 删除一对多 + */ + public void delMain (String id); + + /** + * 批量删除一对多 + */ + public void delBatchMain (Collection<? extends Serializable> idList); + + InventoryHeader getInventoryHeaderByContainerCode(String containerCode, String warehouseCode); +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryDetailServiceImpl.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryDetailServiceImpl.java new file mode 100644 index 0000000..37c88d3 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryDetailServiceImpl.java @@ -0,0 +1,39 @@ +package org.jeecg.modules.wms.inventory.inventoryHeader.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; +import org.jeecg.modules.wms.inventory.inventoryHeader.mapper.InventoryDetailMapper; +import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; +import org.springframework.stereotype.Service; + +import java.lang.ref.WeakReference; +import java.util.List; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * @Description: 库存详情 + * @Author: jeecg-boot + * @Date: 2022-11-16 + * @Version: V1.0 + */ +@Service +public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMapper, InventoryDetail> implements IInventoryDetailService { + + @Autowired + private InventoryDetailMapper inventoryDetailMapper; + + @Override + public List<InventoryDetail> selectByMainId(String mainId) { + return inventoryDetailMapper.selectByMainId(mainId); + } + + @Override + public List<InventoryDetail> getInventoryDetailListByInventoryHeaderId(Integer inventoryHeaderId) { + LambdaQueryWrapper<InventoryDetail> inventoryDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); + inventoryDetailLambdaQueryWrapper.eq(InventoryDetail::getInventoryHeaderId, inventoryHeaderId); + List<InventoryDetail> inventoryDetailList = list(inventoryDetailLambdaQueryWrapper); + return inventoryDetailList; + } +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryHeaderServiceImpl.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryHeaderServiceImpl.java new file mode 100644 index 0000000..5886b96 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryHeaderServiceImpl.java @@ -0,0 +1,58 @@ +package org.jeecg.modules.wms.inventory.inventoryHeader.service.impl; + +import com.alipay.api.domain.Inventory; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; +import org.jeecg.modules.wms.inventory.inventoryHeader.mapper.InventoryDetailMapper; +import org.jeecg.modules.wms.inventory.inventoryHeader.mapper.InventoryHeaderMapper; +import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; +import org.springframework.stereotype.Service; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import java.io.Serializable; +import java.lang.ref.WeakReference; +import java.util.List; +import java.util.Collection; + +/** + * @Description: 库存表 + * @Author: jeecg-boot + * @Date: 2022-11-16 + * @Version: V1.0 + */ +@Service +public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMapper, InventoryHeader> implements IInventoryHeaderService { + + @Autowired + private InventoryHeaderMapper inventoryHeaderMapper; + @Autowired + private InventoryDetailMapper inventoryDetailMapper; + + @Override + @Transactional + public void delMain(String id) { + inventoryDetailMapper.deleteByMainId(id); + inventoryHeaderMapper.deleteById(id); + } + + @Override + @Transactional + public void delBatchMain(Collection<? extends Serializable> idList) { + for(Serializable id:idList) { + inventoryDetailMapper.deleteByMainId(id.toString()); + inventoryHeaderMapper.deleteById(id); + } + } + + @Override + public InventoryHeader getInventoryHeaderByContainerCode(String containerCode, String warehouseCode) { + LambdaQueryWrapper<InventoryHeader> inventoryHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); + inventoryHeaderLambdaQueryWrapper.eq(InventoryHeader::getContainerCode, containerCode) + .eq(InventoryHeader::getWarehouseCode, warehouseCode); + InventoryHeader inventoryHeader = getOne(inventoryHeaderLambdaQueryWrapper); + return inventoryHeader; + } + +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/controller/InventoryTransactionController.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/controller/InventoryTransactionController.java new file mode 100644 index 0000000..a0b0e47 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/controller/InventoryTransactionController.java @@ -0,0 +1,174 @@ +package org.jeecg.modules.wms.inventory.inventoryTransaction.controller; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.system.util.JwtUtil; +import org.jeecg.common.util.oConvertUtils; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; + +import org.jeecg.modules.wms.inventory.inventoryTransaction.entity.InventoryTransaction; +import org.jeecg.modules.wms.inventory.inventoryTransaction.service.IInventoryTransactionService; +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; + + /** + * @Description: 库存交易记录 + * @Author: jeecg-boot + * @Date: 2022-11-17 + * @Version: V1.0 + */ +@Api(tags="库存交易记录") +@RestController +@RequestMapping("/inventory/inventoryTransaction") +@Slf4j +public class InventoryTransactionController extends JeecgController<InventoryTransaction, IInventoryTransactionService> { + @Autowired + private IInventoryTransactionService inventoryTransactionService; + + /** + * 分页列表查询 + * + * @param inventoryTransaction + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "库存交易记录-分页列表查询") + @ApiOperation(value="库存交易记录-分页列表查询", notes="库存交易记录-分页列表查询") + @GetMapping(value = "/list") + public Result<IPage<InventoryTransaction>> queryPageList(InventoryTransaction inventoryTransaction, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper<InventoryTransaction> queryWrapper = QueryGenerator.initQueryWrapper(inventoryTransaction, req.getParameterMap()); + Page<InventoryTransaction> page = new Page<InventoryTransaction>(pageNo, pageSize); + IPage<InventoryTransaction> pageList = inventoryTransactionService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param inventoryTransaction + * @return + */ + @AutoLog(value = "库存交易记录-添加") + @ApiOperation(value="库存交易记录-添加", notes="库存交易记录-添加") + @PostMapping(value = "/add") + public Result<String> add(@RequestBody InventoryTransaction inventoryTransaction, HttpServletRequest req) { + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); + inventoryTransaction.setWarehouseCode(warehouseCode); + inventoryTransactionService.save(inventoryTransaction); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param inventoryTransaction + * @return + */ + @AutoLog(value = "库存交易记录-编辑") + @ApiOperation(value="库存交易记录-编辑", notes="库存交易记录-编辑") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result<String> edit(@RequestBody InventoryTransaction inventoryTransaction) { + inventoryTransactionService.updateById(inventoryTransaction); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "库存交易记录-通过id删除") + @ApiOperation(value="库存交易记录-通过id删除", notes="库存交易记录-通过id删除") + @DeleteMapping(value = "/delete") + public Result<String> delete(@RequestParam(name="id",required=true) String id) { + inventoryTransactionService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "库存交易记录-批量删除") + @ApiOperation(value="库存交易记录-批量删除", notes="库存交易记录-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.inventoryTransactionService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + //@AutoLog(value = "库存交易记录-通过id查询") + @ApiOperation(value="库存交易记录-通过id查询", notes="库存交易记录-通过id查询") + @GetMapping(value = "/queryById") + public Result<InventoryTransaction> queryById(@RequestParam(name="id",required=true) String id) { + InventoryTransaction inventoryTransaction = inventoryTransactionService.getById(id); + if(inventoryTransaction==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(inventoryTransaction); + } + + /** + * 导出excel + * + * @param request + * @param inventoryTransaction + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, InventoryTransaction inventoryTransaction) { + return super.exportXls(request, inventoryTransaction, InventoryTransaction.class, "库存交易记录"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, InventoryTransaction.class); + } + +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/entity/InventoryTransaction.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/entity/InventoryTransaction.java new file mode 100644 index 0000000..aabfa90 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/entity/InventoryTransaction.java @@ -0,0 +1,147 @@ +package org.jeecg.modules.wms.inventory.inventoryTransaction.entity; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: 库存交易记录 + * @Author: jeecg-boot + * @Date: 2022-11-17 + * @Version: V1.0 + */ +@Data +@TableName("inventory_transaction") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="inventory_transaction对象", description="库存交易记录") +public class InventoryTransaction implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer id; + /**仓库*/ + @Excel(name = "仓库", width = 15) + @ApiModelProperty(value = "仓库") + private String warehouseCode; + /**货主*/ + @Excel(name = "货主", width = 15) + @ApiModelProperty(value = "货主") + private String companyCode; + /**容器编码*/ + @Excel(name = "容器编码", width = 15) + @ApiModelProperty(value = "容器编码") + private String containerCode; + /**库位编码*/ + @Excel(name = "库位编码", width = 15) + @ApiModelProperty(value = "库位编码") + private String locationCode; + /**交易类型*/ + @Excel(name = "交易类型", width = 15, dicCode = "inventory_transaction_type") + @Dict(dicCode = "inventory_transaction_type") + @ApiModelProperty(value = "交易类型") + private Integer type; + /**出库单id*/ + @Excel(name = "出库单id", width = 15) + @ApiModelProperty(value = "出库单id") + private Integer shipmentId; + /**出库详情id*/ + @Excel(name = "出库详情id", width = 15) + @ApiModelProperty(value = "出库详情id") + private Integer shipmentDetailId; + /**出库组盘详情id*/ + @Excel(name = "出库组盘详情id", width = 15) + @ApiModelProperty(value = "出库组盘详情id") + private Integer shipmentContainerDetailId; + /**入库单id*/ + @Excel(name = "入库单id", width = 15) + @ApiModelProperty(value = "入库单id") + private Integer receiptId; + /**入库单详情id*/ + @Excel(name = "入库单详情id", width = 15) + @ApiModelProperty(value = "入库单详情id") + private Integer receiptDetailId; + /**入库组盘详情Id*/ + @Excel(name = "入库组盘详情Id", width = 15) + @ApiModelProperty(value = "入库组盘详情Id") + private Integer receiptContainerDetailId; + /**物料编码*/ + @Excel(name = "物料编码", width = 15) + @ApiModelProperty(value = "物料编码") + private String materialCode; + /**物料名称*/ + @Excel(name = "物料名称", width = 15) + @ApiModelProperty(value = "物料名称") + private String materialName; + /**物料规格*/ + @Excel(name = "物料规格", width = 15) + @ApiModelProperty(value = "物料规格") + private String materialSpec; + /**物料单位*/ + @Excel(name = "物料单位", width = 15) + @ApiModelProperty(value = "物料单位") + private String materialUnit; + /**库存状态*/ + @Excel(name = "库存状态", width = 15) + @ApiModelProperty(value = "库存状态") + private String inventoryStatus; + /**数量*/ + @Excel(name = "数量", width = 15) + @ApiModelProperty(value = "数量") + private BigDecimal qty; + /**批次*/ + @Excel(name = "批次", width = 15) + @ApiModelProperty(value = "批次") + private String batch; + /**批号*/ + @Excel(name = "批号", width = 15) + @ApiModelProperty(value = "批号") + private String lot; + /**项目号*/ + @Excel(name = "项目号", width = 15) + @ApiModelProperty(value = "项目号") + private String project; + /**唯一号*/ + @Excel(name = "唯一号", width = 15) + @ApiModelProperty(value = "唯一号") + private String uniqueCode; + /**备用字段1*/ + @Excel(name = "备用字段1", width = 15) + @ApiModelProperty(value = "备用字段1") + private String userdef1; + /**备用字段2*/ + @Excel(name = "备用字段2", width = 15) + @ApiModelProperty(value = "备用字段2") + private String userdef2; + /**备用字段3*/ + @Excel(name = "备用字段3", width = 15) + @ApiModelProperty(value = "备用字段3") + private String userdef3; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private String createBy; + /**创建日期*/ + @ApiModelProperty(value = "创建日期") + private Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private String updateBy; + /**更新日期*/ + @ApiModelProperty(value = "更新日期") + private Date updateTime; +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/mapper/InventoryTransactionMapper.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/mapper/InventoryTransactionMapper.java new file mode 100644 index 0000000..33c0eff --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/mapper/InventoryTransactionMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.wms.inventory.inventoryTransaction.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.wms.inventory.inventoryTransaction.entity.InventoryTransaction; + +/** + * @Description: 库存交易记录 + * @Author: jeecg-boot + * @Date: 2022-11-17 + * @Version: V1.0 + */ +public interface InventoryTransactionMapper extends BaseMapper<InventoryTransaction> { + +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/mapper/xml/InventoryTransactionMapper.xml b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/mapper/xml/InventoryTransactionMapper.xml new file mode 100644 index 0000000..bfb2a4d --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/mapper/xml/InventoryTransactionMapper.xml @@ -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="org.jeecg.modules.wms.inventory.inventoryTransaction.mapper.InventoryTransactionMapper"> + +</mapper> diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/service/IInventoryTransactionService.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/service/IInventoryTransactionService.java new file mode 100644 index 0000000..d4c3e72 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/service/IInventoryTransactionService.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.wms.inventory.inventoryTransaction.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.wms.inventory.inventoryTransaction.entity.InventoryTransaction; + +/** + * @Description: 库存交易记录 + * @Author: jeecg-boot + * @Date: 2022-11-17 + * @Version: V1.0 + */ +public interface IInventoryTransactionService extends IService<InventoryTransaction> { + +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/service/impl/InventoryTransactionServiceImpl.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/service/impl/InventoryTransactionServiceImpl.java new file mode 100644 index 0000000..d3d80eb --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/service/impl/InventoryTransactionServiceImpl.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.wms.inventory.inventoryTransaction.service.impl; + +import org.jeecg.modules.wms.inventory.inventoryTransaction.entity.InventoryTransaction; +import org.jeecg.modules.wms.inventory.inventoryTransaction.mapper.InventoryTransactionMapper; +import org.jeecg.modules.wms.inventory.inventoryTransaction.service.IInventoryTransactionService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: 库存交易记录 + * @Author: jeecg-boot + * @Date: 2022-11-17 + * @Version: V1.0 + */ +@Service +public class InventoryTransactionServiceImpl extends ServiceImpl<InventoryTransactionMapper, InventoryTransaction> implements IInventoryTransactionService { + +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/controller/ApiLogController.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/controller/ApiLogController.java new file mode 100644 index 0000000..63e1735 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/controller/ApiLogController.java @@ -0,0 +1,171 @@ +package org.jeecg.modules.wms.monitor.apiLog.controller; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.util.oConvertUtils; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; + +import org.jeecg.modules.wms.monitor.apiLog.entity.ApiLog; +import org.jeecg.modules.wms.monitor.apiLog.service.IApiLogService; +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; + + /** + * @Description: 接口日志 + * @Author: jeecg-boot + * @Date: 2022-11-18 + * @Version: V1.0 + */ +@Api(tags="接口日志") +@RestController +@RequestMapping("/monitor/apiLog") +@Slf4j +public class ApiLogController extends JeecgController<ApiLog, IApiLogService> { + @Autowired + private IApiLogService apiLogService; + + /** + * 分页列表查询 + * + * @param apiLog + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "接口日志-分页列表查询") + @ApiOperation(value="接口日志-分页列表查询", notes="接口日志-分页列表查询") + @GetMapping(value = "/list") + public Result<IPage<ApiLog>> queryPageList(ApiLog apiLog, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper<ApiLog> queryWrapper = QueryGenerator.initQueryWrapper(apiLog, req.getParameterMap()); + Page<ApiLog> page = new Page<ApiLog>(pageNo, pageSize); + IPage<ApiLog> pageList = apiLogService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param apiLog + * @return + */ + @AutoLog(value = "接口日志-添加") + @ApiOperation(value="接口日志-添加", notes="接口日志-添加") + @PostMapping(value = "/add") + public Result<String> add(@RequestBody ApiLog apiLog) { + apiLogService.save(apiLog); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param apiLog + * @return + */ + @AutoLog(value = "接口日志-编辑") + @ApiOperation(value="接口日志-编辑", notes="接口日志-编辑") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result<String> edit(@RequestBody ApiLog apiLog) { + apiLogService.updateById(apiLog); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "接口日志-通过id删除") + @ApiOperation(value="接口日志-通过id删除", notes="接口日志-通过id删除") + @DeleteMapping(value = "/delete") + public Result<String> delete(@RequestParam(name="id",required=true) String id) { + apiLogService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "接口日志-批量删除") + @ApiOperation(value="接口日志-批量删除", notes="接口日志-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.apiLogService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + //@AutoLog(value = "接口日志-通过id查询") + @ApiOperation(value="接口日志-通过id查询", notes="接口日志-通过id查询") + @GetMapping(value = "/queryById") + public Result<ApiLog> queryById(@RequestParam(name="id",required=true) String id) { + ApiLog apiLog = apiLogService.getById(id); + if(apiLog==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(apiLog); + } + + /** + * 导出excel + * + * @param request + * @param apiLog + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, ApiLog apiLog) { + return super.exportXls(request, apiLog, ApiLog.class, "接口日志"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, ApiLog.class); + } + +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/entity/ApiLog.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/entity/ApiLog.java new file mode 100644 index 0000000..e83b722 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/entity/ApiLog.java @@ -0,0 +1,108 @@ +package org.jeecg.modules.wms.monitor.apiLog.entity; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: 接口日志 + * @Author: jeecg-boot + * @Date: 2022-11-18 + * @Version: V1.0 + */ +@Data +@TableName("api_log") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="api_log对象", description="接口日志") +public class ApiLog implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.AUTO) + @ApiModelProperty(value = "主键") + private Integer id; + /**接口名称*/ + @Excel(name = "接口名称", width = 15) + @ApiModelProperty(value = "接口名称") + private String apiName; + /**请求类型*/ + @Excel(name = "请求类型", width = 15) + @ApiModelProperty(value = "请求类型") + private String apiMethod; + /**请求方地址*/ + @Excel(name = "请求方地址", width = 15) + @ApiModelProperty(value = "请求方地址") + private String ip; + /**请求方名称*/ + @Excel(name = "请求方名称", width = 15) + @ApiModelProperty(value = "请求方名称") + private String requestFrom; + /**响应方名称*/ + @Excel(name = "响应方名称", width = 15) + @ApiModelProperty(value = "响应方名称") + private String responseBy; + /**请求地址*/ + @Excel(name = "请求地址", width = 15) + @ApiModelProperty(value = "请求地址") + private String url; + /**请求时间*/ + @Excel(name = "请求时间", width = 15) + @ApiModelProperty(value = "请求时间") + private Date requestTime; + /**响应时间*/ + @Excel(name = "响应时间", width = 15) + @ApiModelProperty(value = "响应时间") + private Date responseTime; + /**请求头*/ + @Excel(name = "请求头", width = 15) + @ApiModelProperty(value = "请求头") + private String requestHeader; + /**请求内容*/ + @Excel(name = "请求内容", width = 15) + @ApiModelProperty(value = "请求内容") + private String requestBody; + /**响应头*/ + @Excel(name = "响应头", width = 15) + @ApiModelProperty(value = "响应头") + private String responseHeader; + /**响应内容*/ + @Excel(name = "响应内容", width = 15) + @ApiModelProperty(value = "响应内容") + private String responseBody; + /**响应耗时(毫秒)*/ + @Excel(name = "响应耗时(毫秒)", width = 15) + @ApiModelProperty(value = "响应耗时(毫秒)") + private Integer duration; + /**httpCode*/ + @Excel(name = "httpCode", width = 15) + @ApiModelProperty(value = "httpCode") + private Integer httpCode; + /**业务响应码*/ + @Excel(name = "业务响应码", width = 15) + @ApiModelProperty(value = "业务响应码") + private Integer retCode; + /**异常堆栈信息*/ + @Excel(name = "异常堆栈信息", width = 15) + @ApiModelProperty(value = "异常堆栈信息") + private String exception; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private String createBy; + /**创建日期*/ + @ApiModelProperty(value = "创建日期") + private Date createTime; +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/mapper/ApiLogMapper.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/mapper/ApiLogMapper.java new file mode 100644 index 0000000..135e5d8 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/mapper/ApiLogMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.wms.monitor.apiLog.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.wms.monitor.apiLog.entity.ApiLog; + +/** + * @Description: 接口日志 + * @Author: jeecg-boot + * @Date: 2022-11-18 + * @Version: V1.0 + */ +public interface ApiLogMapper extends BaseMapper<ApiLog> { + +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/mapper/xml/ApiLogMapper.xml b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/mapper/xml/ApiLogMapper.xml new file mode 100644 index 0000000..7466217 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/mapper/xml/ApiLogMapper.xml @@ -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="org.jeecg.modules.wms.monitor.apiLog.mapper.ApiLogMapper"> + +</mapper> diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/service/IApiLogService.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/service/IApiLogService.java new file mode 100644 index 0000000..496bcdb --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/service/IApiLogService.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.wms.monitor.apiLog.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.wms.monitor.apiLog.entity.ApiLog; + +/** + * @Description: 接口日志 + * @Author: jeecg-boot + * @Date: 2022-11-18 + * @Version: V1.0 + */ +public interface IApiLogService extends IService<ApiLog> { + +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/service/impl/ApiLogServiceImpl.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/service/impl/ApiLogServiceImpl.java new file mode 100644 index 0000000..844ac1b --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/service/impl/ApiLogServiceImpl.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.wms.monitor.apiLog.service.impl; + +import org.jeecg.modules.wms.monitor.apiLog.entity.ApiLog; +import org.jeecg.modules.wms.monitor.apiLog.mapper.ApiLogMapper; +import org.jeecg.modules.wms.monitor.apiLog.service.IApiLogService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: 接口日志 + * @Author: jeecg-boot + * @Date: 2022-11-18 + * @Version: V1.0 + */ +@Service +public class ApiLogServiceImpl extends ServiceImpl<ApiLogMapper, ApiLog> implements IApiLogService { + +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/IReceiptContainerHeaderService.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/IReceiptContainerHeaderService.java index 78f226e..157a5ea 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/IReceiptContainerHeaderService.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/IReceiptContainerHeaderService.java @@ -27,7 +27,10 @@ public interface IReceiptContainerHeaderService extends IService<ReceiptContaine */ public void delBatchMain (Collection<? extends Serializable> idList); + ReceiptContainerHeader getUnCompleteReceiptContainerByCode(String containerCode, String warehouseCode); public Result createTask(ReceiptContainerHeader receiptContainerHeader, String warehouseCode); + + boolean updateStatusById(int status, int id); } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/impl/ReceiptContainerHeaderServiceImpl.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/impl/ReceiptContainerHeaderServiceImpl.java index 3e25ddd..2176053 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/impl/ReceiptContainerHeaderServiceImpl.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/impl/ReceiptContainerHeaderServiceImpl.java @@ -222,4 +222,15 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai return Result.OK("生成入库任务成功"); } + @Override + public boolean updateStatusById(int status, int id) { + ReceiptContainerHeader receiptContainerHeader = getById(id); + if(receiptContainerHeader == null) { + return false; + } + receiptContainerHeader.setStatus(status); + boolean success = updateById(receiptContainerHeader); + return success; + } + } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiving/service/impl/ReceiveServiceImpl.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiving/service/impl/ReceiveServiceImpl.java index 311bbac..19f8ef6 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiving/service/impl/ReceiveServiceImpl.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiving/service/impl/ReceiveServiceImpl.java @@ -145,7 +145,7 @@ public class ReceiveServiceImpl extends ServiceImpl<ReceiveMapper, Receive> imp if(receiptHeader == null) { throw new ServiceException("没有找到入库单,id:" + receiptDetail.getReceiptId()); } - if(receiptHeader.getWarehouseCode().equals(warehouseCode)) { + if(!receiptHeader.getWarehouseCode().equals(warehouseCode)) { throw new ServiceException("仓库编码不一致,不能操作"); } String materialCode = receiptDetail.getMaterialCode(); diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/controller/TaskHeaderController.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/controller/TaskHeaderController.java index 0eb47e1..b33fba8 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/controller/TaskHeaderController.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/controller/TaskHeaderController.java @@ -1,5 +1,6 @@ package org.jeecg.modules.wms.task.taskHeader.controller; +import org.apache.shiro.authz.annotation.RequiresPermissions; import org.jeecg.common.system.query.QueryGenerator; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -7,10 +8,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.extern.slf4j.Slf4j; import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.wms.framework.controller.BaseController; import org.jeecg.modules.wms.task.taskHeader.entity.TaskDetail; import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; import org.jeecg.modules.wms.task.taskHeader.service.ITaskDetailService; import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; +import org.jeecg.utils.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; @@ -291,6 +294,47 @@ public class TaskHeaderController extends JeecgController<TaskHeader, ITaskHeade /*--------------------------------子表处理-任务详情-end----------------------------------------------*/ + /** + * 完成任务 + */ + @AutoLog(value = "任务表-完成任务") + @ApiOperation(value="任务表-完成任务", notes="任务表-完成任务") + @PostMapping( "/completeTaskByWMS") + public Result completeTaskByWMS(@RequestBody TaskHeader taskHeader){ + if(taskHeader == null) { + return Result.error("taskHeader不能为空"); + } + Integer taskId = taskHeader.getId(); + Result result = handleMultiProcess("completeTaskByWMS", new MultiProcessListener() { + @Override + public Result doProcess() { + Result result = taskHeaderService.completeTaskByWMS(taskId); + return result; + } + }); + return result; + } - + /** + * 执行任务 + */ + @AutoLog(value = "任务表-执行任务") + @ApiOperation(value="任务表-执行任务", notes="任务表-执行任务") + @PostMapping( "/execute") + public Result execute(@RequestBody TaskHeader taskHeader) { + { + if (taskHeader == null) { + return Result.error("taskHeader不能为空"); + } + Integer taskId = taskHeader.getId(); + Result result = handleMultiProcess("execute", new MultiProcessListener() { + @Override + public Result doProcess() { + Result result = taskHeaderService.sendTaskToWcs(taskId); + return result; + } + }); + return result; + } + } } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskDetailService.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskDetailService.java index ca05daa..8215b44 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskDetailService.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskDetailService.java @@ -16,4 +16,10 @@ public interface ITaskDetailService extends IService<TaskDetail> { public List<TaskDetail> selectByMainId(String mainId); + /** + * 根据任务头表id查询任务明细 + * @param id + * @return + */ + List<TaskDetail> getTaskDetailListByTaskId(Integer id); } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskHeaderService.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskHeaderService.java index 53e14ae..26aabd7 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskHeaderService.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskHeaderService.java @@ -35,5 +35,9 @@ public interface ITaskHeaderService extends IService<TaskHeader> { TaskHeader getUnCompleteTaskByToLocationCode(String toLocationCode, String warehouseCode); - TaskHeader getTaskHeaderByLocationCode(String locationCode); + TaskHeader getUnCompleteTaskByLocationCode(String locationCode, String warehouseCode); + + Result completeTaskByWMS(Integer taskId); + + Result sendTaskToWcs(Integer taskId); } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskDetailServiceImpl.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskDetailServiceImpl.java index 190f77e..d08679b 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskDetailServiceImpl.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskDetailServiceImpl.java @@ -38,6 +38,13 @@ public class TaskDetailServiceImpl extends ServiceImpl<TaskDetailMapper, TaskDet return taskDetailMapper.selectByMainId(mainId); } + @Override + public List<TaskDetail> getTaskDetailListByTaskId(Integer id) { + LambdaQueryWrapper<TaskDetail> taskDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); + taskDetailLambdaQueryWrapper.eq(TaskDetail::getTaskHeaderId, id); + List<TaskDetail> taskDetailList = list(taskDetailLambdaQueryWrapper); + return taskDetailList; + } } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java index 01a4839..10a7605 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java @@ -9,9 +9,23 @@ import org.jeecg.modules.wms.config.container.entity.Container; import org.jeecg.modules.wms.config.container.service.IContainerService; import org.jeecg.modules.wms.config.location.entity.Location; import org.jeecg.modules.wms.config.location.service.ILocationService; +import org.jeecg.modules.wms.config.material.entity.Material; +import org.jeecg.modules.wms.config.material.service.IMaterialService; +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; +import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; +import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; +import org.jeecg.modules.wms.inventory.inventoryTransaction.entity.InventoryTransaction; +import org.jeecg.modules.wms.inventory.inventoryTransaction.service.IInventoryTransactionService; +import org.jeecg.modules.wms.receipt.receiptContainerHeader.service.IReceiptContainerHeaderService; +import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; +import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptDetailService; +import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptHeaderService; +import org.jeecg.modules.wms.task.taskHeader.entity.TaskDetail; import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; import org.jeecg.modules.wms.task.taskHeader.mapper.TaskDetailMapper; import org.jeecg.modules.wms.task.taskHeader.mapper.TaskHeaderMapper; +import org.jeecg.modules.wms.task.taskHeader.service.ITaskDetailService; import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; import org.jeecg.utils.StringUtils; import org.jeecg.utils.constant.QuantityConstant; @@ -22,8 +36,12 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; import java.util.List; import java.util.Collection; +import java.util.stream.Collectors; /** * @Description: 任务表 @@ -43,7 +61,23 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea @Resource private ITaskHeaderService taskHeaderService; @Resource + private ITaskDetailService taskDetailService; + @Resource private IContainerService containerService; + @Resource + private IInventoryHeaderService inventoryHeaderService; + @Resource + private IInventoryDetailService inventoryDetailService; + @Resource + private IInventoryTransactionService inventoryTransactionService; + @Resource + private IReceiptDetailService receiptDetailService; + @Resource + private IReceiptHeaderService receiptHeaderService; + @Resource + private IReceiptContainerHeaderService receiptContainerHeaderService; + @Resource + private IMaterialService materialService; @Override @Transactional @@ -246,8 +280,264 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea } @Override - public TaskHeader getTaskHeaderByLocationCode(String locationCode) { + public TaskHeader getUnCompleteTaskByLocationCode(String locationCode, String warehouseCode) { + TaskHeader taskHeader = getUnCompleteTaskByFromLocationCode(locationCode, warehouseCode); + if(taskHeader == null) { + taskHeader = getUnCompleteTaskByToLocationCode(locationCode, warehouseCode); + } + return taskHeader; + } + + /** + * WMS完成任务 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Result completeTaskByWMS(Integer taskId) { + TaskHeader taskHeader = getById(taskId); + if(taskHeader == null) { + return Result.error("任务" + taskId + "未找到,执行中止"); + } + if (taskHeader.getStatus().equals(QuantityConstant.TASK_STATUS_COMPLETED)) { + return Result.ok("任务(" +taskId + ")任务已经是完成的!"); + } + if (StringUtils.isEmpty(taskHeader.getFromLocationCode()) + && StringUtils.isEmpty(taskHeader.getToLocationCode())) { + return Result.error("任务" + taskId + "没有库位,执行中止"); + } + Result result = null; + int taskType = taskHeader.getTaskType().intValue(); + switch (taskType) { + //整盘入库、补充入库 + case QuantityConstant.TASK_TYPE_WHOLERECEIPT: + case QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT: + result = completeReceiptTask(taskHeader); + break; + default: + throw new ServiceException("不支持的任务类型" + taskType); + } + return result; + } + + @Override + public Result sendTaskToWcs(Integer taskId) { return null; } + @Transactional(rollbackFor = Exception.class) + public boolean combineInventoryDetail(TaskHeader taskHeader) { + boolean success = false; + String warehouseCode = taskHeader.getWarehouseCode(); + String containerCode = taskHeader.getContainerCode(); + String toLocationCode = taskHeader.getToLocationCode(); + + InventoryHeader inventoryHeader = inventoryHeaderService. + getInventoryHeaderByContainerCode(containerCode, warehouseCode); + if(inventoryHeader == null) { + throw new ServiceException("合并库存时, 没有找到库存头"); + } + List<InventoryDetail> inventoryDetailList = inventoryDetailService. + getInventoryDetailListByInventoryHeaderId(inventoryHeader.getId()); + if(inventoryDetailList.size() == 0) { + throw new ServiceException("合并库存时, 没有找到库存详情"); + } + if(inventoryDetailList.size() == 1) { + return true; + } + for (int i = 0; i < inventoryDetailList.size() - 1; i++) { + for (int j = inventoryDetailList.size() - 1; j > i; j--) { + InventoryDetail inventoryDetail1 = inventoryDetailList.get(i); + InventoryDetail inventoryDetail2 = inventoryDetailList.get(j); + if (inventoryDetail1.getMaterialCode().equals(inventoryDetail2.getMaterialCode()) + && inventoryDetail1.getBatch().equals(inventoryDetail2.getBatch()) + && inventoryDetail1.getLot().equals(inventoryDetail2.getLot()) + && inventoryDetail1.getProject().equals(inventoryDetail2.getProject())) { + BigDecimal totalQty = inventoryDetail1.getQty().add(inventoryDetail2.getQty()); + inventoryDetail1.setQty(totalQty); + success = inventoryDetailService.updateById(inventoryDetail1); + if(!success) { + throw new ServiceException("合并库存时, 更新库存详情失败:" + inventoryDetail1.getId()); + } + success = inventoryDetailService.removeById(inventoryDetail2); + if(!success) { + throw new ServiceException("合并库存时, 删除库存详情失败:" + inventoryDetail2.getId()); + } + inventoryDetailList.remove(j); + } + } + } + BigDecimal totalQty = new BigDecimal(0); + int totalLines = 0; + for (InventoryDetail inventoryDetail : inventoryDetailList) { + totalQty = totalQty.add(inventoryDetail.getQty()); + totalLines++; + } + Container container = containerService.getContainerByCode(containerCode, warehouseCode); + if(container == null) { + throw new ServiceException("合并库存时, 没有找到容器, 容器号为" + containerCode); + } + inventoryHeader.setTotalQty(totalQty); + inventoryHeader.setTotalLines(totalLines); + inventoryHeader.setContainerStatus(container.getStatus()); + success = inventoryHeaderService.updateById(inventoryHeader); + return success; + } + /** + * 完成入库任务 + * @param taskHeader 任务 + * @return AjaxResult 完成入库任务结果 + */ + @Transactional(rollbackFor = Exception.class) + public Result completeReceiptTask(TaskHeader taskHeader) { + String warehouseCode = taskHeader.getWarehouseCode(); + String fromLocationCode = taskHeader.getFromLocationCode(); + String toLocationCode = taskHeader.getToLocationCode(); + String zoneCode = taskHeader.getZoneCode(); + String containerCode = taskHeader.getContainerCode(); + int taskType = taskHeader.getTaskType(); + List<TaskDetail> taskDetailList = taskDetailService.getTaskDetailListByTaskId(taskHeader.getId()); + boolean success = false; + if (taskDetailList.isEmpty()) { + throw new ServiceException("任务明细为空"); + } + Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode); + if(toLocation == null) { + throw new ServiceException("完成任务时,没有找到目的库位"); + } + InventoryHeader inventoryHeader = inventoryHeaderService + .getInventoryHeaderByContainerCode(containerCode, warehouseCode); + if(inventoryHeader != null) { + if (taskType == QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT) { + inventoryHeader.setLocationCode(toLocationCode); + inventoryHeader.setZoneCode(zoneCode); + inventoryHeaderService.updateById(inventoryHeader); + List<InventoryDetail> inventoryDetailList = inventoryDetailService. + getInventoryDetailListByInventoryHeaderId(inventoryHeader.getId()); + for(InventoryDetail inventoryDetail : inventoryDetailList) { + inventoryDetail.setLocationCode(toLocationCode); + inventoryDetail.setZoneCode(zoneCode); + inventoryDetailService.updateById(inventoryDetail); + } + } + } else { + inventoryHeader = new InventoryHeader(); + inventoryHeader.setWarehouseCode(warehouseCode); + inventoryHeader.setCompanyCode(taskHeader.getCompanyCode()); + inventoryHeader.setZoneCode(zoneCode); + inventoryHeader.setContainerCode(containerCode); + inventoryHeader.setLocationCode(toLocationCode); + inventoryHeader.setTotalWeight(taskHeader.getWeight()); + inventoryHeader.setContainerStatus(QuantityConstant.STATUS_CONTAINER_SOME); + inventoryHeader.setEnable(QuantityConstant.STATUS_ENABLE); + if (!inventoryHeaderService.save(inventoryHeader)) { + throw new ServiceException("添加库存头失败"); + } + } + + List<InventoryDetail> inventoryDetailList = new ArrayList<>(); + List<InventoryTransaction> inventoryTransactionList = new ArrayList<>(); + List<ReceiptDetail> receiptDetaiList = new ArrayList<>(); + for(TaskDetail taskDetail : taskDetailList) { + ReceiptDetail receiptDetail = receiptDetailService.getById(taskDetail.getReceiptDetailId()); + if(receiptDetail == null) { + throw new ServiceException("未找到id:" + taskDetail.getReceiptDetailId() + "入库单明细"); + } + BigDecimal taskQty = receiptDetail.getTaskQty(); + BigDecimal qty = receiptDetail.getQty(); + if(taskQty.compareTo(qty) >= 0) { + receiptDetail.setStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); + } else { + receiptDetail.setStatus(QuantityConstant.RECEIPT_HEADER_SHELF); + } + receiptDetaiList.add(receiptDetail); + + BigDecimal receiptQty = taskDetail.getQty(); + InventoryDetail inventoryDetail = new InventoryDetail(); + inventoryDetail.setInventoryHeaderId(inventoryHeader.getId()); + inventoryDetail.setWarehouseCode(warehouseCode); + inventoryDetail.setCompanyCode(taskDetail.getCompanyCode()); + inventoryDetail.setZoneCode(zoneCode); + inventoryDetail.setContainerCode(taskHeader.getContainerCode()); + inventoryDetail.setLocationCode(toLocationCode); + inventoryDetail.setMaterialCode(taskDetail.getMaterialCode()); + inventoryDetail.setMaterialName(taskDetail.getMaterialName()); + inventoryDetail.setMaterialSpec(taskDetail.getMaterialSpec()); + inventoryDetail.setMaterialUnit(taskDetail.getMaterialUnit()); + inventoryDetail.setQty(receiptQty); + inventoryDetail.setInventoryStatus(taskDetail.getInventoryStatus()); + inventoryDetail.setBatch(taskDetail.getBatch()); + inventoryDetail.setLot(taskDetail.getLot()); + inventoryDetail.setProject(taskDetail.getProject()); + inventoryDetail.setReceiptDate(new Date()); + inventoryDetailList.add(inventoryDetail); + + InventoryTransaction inventoryTransaction = new InventoryTransaction(); + inventoryTransaction.setType(QuantityConstant.INVENTORY_TRANSACTION_RECEIPT); + inventoryTransaction.setWarehouseCode(taskDetail.getWarehouseCode()); + inventoryTransaction.setCompanyCode(taskDetail.getCompanyCode()); + inventoryTransaction.setContainerCode(containerCode); + inventoryTransaction.setLocationCode(toLocationCode); + inventoryTransaction.setMaterialCode(taskDetail.getMaterialCode()); + inventoryTransaction.setMaterialName(taskDetail.getMaterialName()); + inventoryTransaction.setMaterialSpec(taskDetail.getMaterialSpec()); + inventoryTransaction.setMaterialUnit(taskDetail.getMaterialUnit()); + inventoryTransaction.setReceiptId(taskDetail.getReceiptId()); + inventoryTransaction.setReceiptDetailId(taskDetail.getReceiptDetailId()); + inventoryTransaction.setReceiptContainerDetailId(taskDetail.getReceiptContainerDetailId()); + inventoryTransaction.setBatch(taskDetail.getBatch()); + inventoryTransaction.setLot(taskDetail.getLot()); + inventoryTransaction.setProject(taskDetail.getProject()); + inventoryTransaction.setInventoryStatus(taskDetail.getInventoryStatus()); + inventoryTransaction.setQty(receiptQty); + inventoryTransactionList.add(inventoryTransaction); + } + if(!receiptDetailService.updateBatchById(receiptDetaiList)) { + throw new ServiceException("完成入库任务时,更新入库单详情失败"); + } + List<Integer> receiptIdList = receiptDetaiList.stream().map(ReceiptDetail::getReceiptId) + .distinct().collect(Collectors.toList()); + for(Integer receiptId : receiptIdList) { + success = receiptHeaderService.updateReceiptHeaderStatus(receiptId); + if(!success) { + throw new ServiceException("完成入库任务时,更新入库单头失败"); + } + } + + success = receiptContainerHeaderService.updateStatusById(QuantityConstant.RECEIPT_CONTAINER_FINISHED, + taskHeader.getReceiptContainerHeaderId()); + if(!success) { + throw new ServiceException("完成入库任务时,更新入库组盘头表状态失败"); + } + + success = inventoryDetailService.saveBatch(inventoryDetailList); + if(!success) { + throw new ServiceException("完成入库任务时,保存库存详情失败"); + } + success = inventoryTransactionService.saveBatch(inventoryTransactionList); + if(!success) { + throw new ServiceException("完成入库任务时,保存库存交易失败"); + } + + success = locationService.updateContainerCodeAndStatus(toLocationCode, + containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); + if(!success) { + throw new ServiceException("完成入库任务时,更新库位失败"); + } + + taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); + success = taskHeaderService.updateById(taskHeader); + if(!success) { + throw new ServiceException("完成入库任务时,更新任务失败"); + } + success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, + QuantityConstant.STATUS_CONTAINER_SOME, warehouseCode); + if(!success) { + throw new ServiceException("完成入库任务时,更新容器失败"); + } + if(!combineInventoryDetail(taskHeader)) { + throw new ServiceException("合并入库库存失败"); + } + return Result.ok("完成入库任务"); + } + } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/utils/constant/QuantityConstant.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/utils/constant/QuantityConstant.java index bde99ee..488316d 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/utils/constant/QuantityConstant.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/utils/constant/QuantityConstant.java @@ -64,7 +64,7 @@ public class QuantityConstant { public static final Integer RECEIPT_HEADER_SHELF = 300; //过账 - public static final Integer RECEIPT_HEADER_POSTING = 800; + public static final Integer RECEIPT_HEADER_COMPLETED = 800; //回传 public static final Integer RECEIPT_HEADER_RETURN = 900; -- libgit2 0.22.2