From f4fdf66897254e9b2f4619faa023a67512508ed8 Mon Sep 17 00:00:00 2001 From: 15066119699 Date: Thu, 6 Mar 2025 09:20:23 +0800 Subject: [PATCH] 1 --- .../controller/app/AppGoodsController.java | 32 ++++---- .../src/main/resources/application-druid.yml | 12 +-- .../src/main/resources/application.yml | 2 +- .../ruoyi/common/constant/AppConstants.java | 2 + .../com/ruoyi/app/mapper/AppGoodsMapper.java | 9 ++ .../app/mapper/AppPmsOrderOutMapper.java | 2 + .../ruoyi/app/service/IAppGoodsService.java | 6 ++ .../app/service/impl/AppGoodsServiceImpl.java | 18 ++++ .../mapper/system/AppPmsOrderOutMapper.xml | 82 ++++++++++++++----- 9 files changed, 122 insertions(+), 43 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppGoodsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppGoodsController.java index 57879901..795a2844 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppGoodsController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/app/AppGoodsController.java @@ -31,8 +31,7 @@ import com.ruoyi.common.core.page.TableDataInfo; */ @RestController @RequestMapping("/app/goods") -public class AppGoodsController extends BaseController -{ +public class AppGoodsController extends BaseController { @Autowired private IAppGoodsService appGoodsService; @@ -42,8 +41,7 @@ public class AppGoodsController extends BaseController @PreAuthorize("@ss.hasPermi('system:goods:list')") @GetMapping("/list") @EnhanceDataList(entityType = AppGoods.class) - public TableDataInfo list(AppGoods appGoods) - { + public TableDataInfo list(AppGoods appGoods) { startPage(); List list = appGoodsService.selectAppGoodsList(appGoods); return getDataTable(list); @@ -55,8 +53,7 @@ public class AppGoodsController extends BaseController @PreAuthorize("@ss.hasPermi('system:goods:export')") @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT) @PostMapping("/export") - public void export(HttpServletResponse response, AppGoods appGoods) - { + public void export(HttpServletResponse response, AppGoods appGoods) { List list = appGoodsService.selectAppGoodsList(appGoods); ExcelUtil util = new ExcelUtil(AppGoods.class); util.exportExcel(response, list, "【请填写功能名称】数据"); @@ -67,8 +64,7 @@ public class AppGoodsController extends BaseController */ @PreAuthorize("@ss.hasPermi('system:goods:query')") @GetMapping(value = "/{goodsId}") - public AjaxResult getInfo(@PathVariable("goodsId") String goodsId) - { + public AjaxResult getInfo(@PathVariable("goodsId") String goodsId) { return success(appGoodsService.selectAppGoodsByGoodsId(goodsId)); } @@ -78,8 +74,7 @@ public class AppGoodsController extends BaseController @PreAuthorize("@ss.hasPermi('system:goods:add')") @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody AppGoods appGoods) - { + public AjaxResult add(@RequestBody AppGoods appGoods) { return toAjax(appGoodsService.insertAppGoods(appGoods)); } @@ -89,8 +84,7 @@ public class AppGoodsController extends BaseController @PreAuthorize("@ss.hasPermi('system:goods:edit')") @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@RequestBody AppGoods appGoods) - { + public AjaxResult edit(@RequestBody AppGoods appGoods) { return toAjax(appGoodsService.updateAppGoods(appGoods)); } @@ -100,8 +94,18 @@ public class AppGoodsController extends BaseController @PreAuthorize("@ss.hasPermi('system:goods:remove')") @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE) @DeleteMapping("/{goodsIds}") - public AjaxResult remove(@PathVariable String[] goodsIds) - { + public AjaxResult remove(@PathVariable String[] goodsIds) { return toAjax(appGoodsService.deleteAppGoodsByGoodsIds(goodsIds)); } + + /** + * 禁用启用状态 + */ + @PreAuthorize("@ss.hasPermi('system:location:edit')") + @Log(title = "禁用启用状态", businessType = BusinessType.UPDATE) + @PostMapping("/changeGoodsIsEnableStatus/{goodsIds}") + public AjaxResult changeGoodsIsEnableStatus(@PathVariable String[] goodsIds) { + appGoodsService.changeGoodsIsEnableStatus(goodsIds); + return success("修改状态成功"); + } } diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index 8817724f..4997d97c 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -6,12 +6,12 @@ spring: druid: # 主库数据源 master: -# url: jdbc:mysql://112.4.208.194:3001/wms_xugongteji?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 -# username: developer -# password: developer - url: jdbc:mysql://10.24.0.62:3306/wms_tp?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 - username: wcs - password: Wcs123 + url: jdbc:mysql://112.4.208.194:3001/wms_xugongteji?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: developer + password: developer +# url: jdbc:mysql://10.24.0.62:3306/wms_tp?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 +# username: wcs +# password: Wcs123 # 从库数据源 slave: # 从数据源开关/默认关闭 diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 4159e330..d5c2c584 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -74,7 +74,7 @@ spring: # 数据库索引 database: 0 # 密码 - password: + password: 123456 # 连接超时时间 timeout: 10s lettuce: diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/AppConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/AppConstants.java index 5fd8550a..b33a3e0c 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/AppConstants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/AppConstants.java @@ -27,6 +27,8 @@ public class AppConstants { public static final Integer TASK_TYPE_OUT = 2; public static final Integer TASK_TYPE_IN = 1; public static final Integer TASK_TYPE_TRANSFER = 3; + public static final Long GOODS_STATUS_ENABLE = 0L; + public static final Long GOODS_STATUS_DISABLE = 1L; // } diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppGoodsMapper.java b/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppGoodsMapper.java index 1a4f2104..cf288f7d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppGoodsMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppGoodsMapper.java @@ -59,4 +59,13 @@ public interface AppGoodsMapper * @return 结果 */ public int deleteAppGoodsByGoodsIds(String[] goodsIds); + + + /** + * 根据id查询物料数据 + * + * @param goodsIds + * @return + */ + List selectAppGoodsListByGoodsIds(String[] goodsIds); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppPmsOrderOutMapper.java b/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppPmsOrderOutMapper.java index a74c08ea..4ee3036b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppPmsOrderOutMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/mapper/AppPmsOrderOutMapper.java @@ -60,4 +60,6 @@ public interface AppPmsOrderOutMapper */ public int deleteAppPmsOrderOutByListIds(String[] recordIds); public int deleteAppPmsOrderOutByOrderId(AppPmsOrderOut appPmsOrderOut); + + int updatePickNum(AppPmsOrderOut appPmsOrderOut); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/service/IAppGoodsService.java b/ruoyi-system/src/main/java/com/ruoyi/app/service/IAppGoodsService.java index 4cbc3d37..9b0ed272 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/service/IAppGoodsService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/service/IAppGoodsService.java @@ -59,4 +59,10 @@ public interface IAppGoodsService * @return 结果 */ public int deleteAppGoodsByGoodsId(String goodsId); + + /** + * 批量修改物料启用禁用状态 + * @param goodsIds + */ + void changeGoodsIsEnableStatus(String[] goodsIds); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/app/service/impl/AppGoodsServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/app/service/impl/AppGoodsServiceImpl.java index a14f6851..aab9e38c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/app/service/impl/AppGoodsServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/app/service/impl/AppGoodsServiceImpl.java @@ -2,9 +2,11 @@ package com.ruoyi.app.service.impl; import java.util.List; +import cn.hutool.core.collection.CollectionUtil; import com.ruoyi.app.domain.AppGoods; import com.ruoyi.app.mapper.AppGoodsMapper; import com.ruoyi.app.service.IAppGoodsService; +import com.ruoyi.common.constant.AppConstants; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -91,4 +93,20 @@ public class AppGoodsServiceImpl implements IAppGoodsService { return appGoodsMapper.deleteAppGoodsByGoodsId(goodsId); } + + @Override + public void changeGoodsIsEnableStatus(String[] goodsIds) { + List appGoodsList = appGoodsMapper.selectAppGoodsListByGoodsIds(goodsIds); + if (CollectionUtil.isNotEmpty(appGoodsList)) { + appGoodsList.forEach(appGoods -> { + Long oldIsEnabled = appGoods.getGoodsStatus(); + if (AppConstants.GOODS_STATUS_ENABLE.equals(oldIsEnabled)) { + appGoods.setGoodsStatus(AppConstants.GOODS_STATUS_DISABLE); + } else if (AppConstants.GOODS_STATUS_DISABLE.equals(oldIsEnabled)) { + appGoods.setGoodsStatus(AppConstants.GOODS_STATUS_ENABLE); + } + appGoodsMapper.updateAppGoods(appGoods); + }); + } + } } diff --git a/ruoyi-system/src/main/resources/mapper/system/AppPmsOrderOutMapper.xml b/ruoyi-system/src/main/resources/mapper/system/AppPmsOrderOutMapper.xml index 89bcc1ec..9cf291cd 100644 --- a/ruoyi-system/src/main/resources/mapper/system/AppPmsOrderOutMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/AppPmsOrderOutMapper.xml @@ -1,47 +1,55 @@ - - + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> + + + + + + + + + - select list_id, order_type, customer_id, goods_id, goods_num, goods_desc, spare1, spare2, order_status from app_pms_order_out + select record_id, list_id, order_type, customer_id, goods_id, goods_num, goods_desc, spare1, spare2,pick_num,tr_num,shelves_num,stock_num,order_status,is_lock,order_id from app_pms_order_out - + insert into app_pms_order_out + record_id, list_id, order_type, customer_id, @@ -50,9 +58,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" goods_desc, spare1, spare2, + pick_num, + tr_num, + shelves_num, + stock_num, order_status, - + is_lock, + order_id, + + #{recordId}, #{listId}, #{orderType}, #{customerId}, @@ -61,13 +76,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{goodsDesc}, #{spare1}, #{spare2}, + #{pickNum}, + #{trNum}, + #{shelvesNum}, + #{stockNum}, #{orderStatus}, - + #{isLock}, + #{orderId}, + update app_pms_order_out + list_id = #{listId}, order_type = #{orderType}, customer_id = #{customerId}, goods_id = #{goodsId}, @@ -75,19 +97,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" goods_desc = #{goodsDesc}, spare1 = #{spare1}, spare2 = #{spare2}, - order_status = #{orderStatus}, + pick_num = #{pickNum}, + tr_num = #{trNum}, + shelves_num = #{shelvesNum}, + stock_num = #{stockNum}, + is_lock = #{isLock}, - where list_id = #{listId} + where record_id = #{recordId} + + + + update app_pms_order_out + + pick_num = #{pickNum}, + is_lock = #{isLock}, + + where record_id = #{recordId} - delete from app_pms_order_out where list_id = #{listId} + delete from app_pms_order_out where record_id = #{recordId} + + delete from app_pms_order_out where order_id = #{orderId} + - delete from app_pms_order_out where list_id in - - #{listId} + delete from app_pms_order_out where record_id in + + #{recordId} - \ No newline at end of file +