From d72f80a66b597a38bb40710f0c3145339afb1ff6 Mon Sep 17 00:00:00 2001 From: zhaoqiaobo <583671871@qq.com> Date: Wed, 15 Jan 2025 15:09:59 +0800 Subject: [PATCH] =?UTF-8?q?feat(all):=20=E4=BB=93=E5=BA=93=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1 增加定时维护仓库库位信息的功能 --- .../com/logpm/basicdata/job/WarehouseJob.java | 33 +++++++++++++++++++ .../mapper/BasicdataWarehouseMapper.java | 1 + .../mapper/BasicdataWarehouseMapper.xml | 15 +++++++++ .../service/IBasicdataWarehouseService.java | 2 ++ .../impl/BasicdataWarehouseServiceImpl.java | 5 +++ 5 files changed, 56 insertions(+) create mode 100644 blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/job/WarehouseJob.java diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/job/WarehouseJob.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/job/WarehouseJob.java new file mode 100644 index 000000000..34d63da8b --- /dev/null +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/job/WarehouseJob.java @@ -0,0 +1,33 @@ +package com.logpm.basicdata.job; + +import com.logpm.basicdata.service.IBasicdataWarehouseService; +import com.xxl.job.core.biz.model.ReturnT; +import com.xxl.job.core.handler.annotation.XxlJob; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Component; + +/** + * @author zhaoqiaobo + * @create 2024-04-02 + */ +@AllArgsConstructor +@Component +public class WarehouseJob { + + private final IBasicdataWarehouseService warehouseService; + + /** + * 定时维护仓库库位 + * + * @param param + * @return + * @throws Exception + */ + @XxlJob("initWarehouseSeating") + public ReturnT initWarehouseSeating(String param) throws Exception { + warehouseService.initWarehouseSeating(param); + return ReturnT.SUCCESS; + } + + +} diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataWarehouseMapper.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataWarehouseMapper.java index 15527f4ac..d9125ca8f 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataWarehouseMapper.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataWarehouseMapper.java @@ -101,4 +101,5 @@ public interface BasicdataWarehouseMapper extends BaseMapper findBusunessLineList(); + void initWarehouseSeating(@Param("warehouseId") String warehouseId); } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataWarehouseMapper.xml b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataWarehouseMapper.xml index 74f598e38..744f7bc32 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataWarehouseMapper.xml +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataWarehouseMapper.xml @@ -188,4 +188,19 @@ group by business_line + + update logpm_warehouse_warehouse tt + join( + select warehouse_id,count(*) total + from logpm_warehouse_goods_allocation + where is_deleted = 0 + and enable_status = 1 + + and warehouse_id = #{warehouseId} + + group by warehouse_id + ) ttt on tt.id = ttt.warehouse_id + set tt.seating = ttt.total, + tt.single_storage_location_area = case when tt.acreage = null then 0 else case when tt.acreage = 0 or ttt.total = 0 then 0 else tt.acreage/ttt.total end end + diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataWarehouseService.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataWarehouseService.java index 375e33659..f1973072d 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataWarehouseService.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataWarehouseService.java @@ -137,4 +137,6 @@ public interface IBasicdataWarehouseService extends BaseService findNamesMapByIds(List warehouseIds); R findBusunessLineList(); + + void initWarehouseSeating(String param); } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataWarehouseServiceImpl.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataWarehouseServiceImpl.java index 5ee6cca56..e0990133d 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataWarehouseServiceImpl.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataWarehouseServiceImpl.java @@ -425,4 +425,9 @@ public class BasicdataWarehouseServiceImpl extends BaseServiceImpl