This commit is contained in:
15066119699 2025-03-06 09:20:23 +08:00
parent ed6e9a7729
commit f4fdf66897
9 changed files with 122 additions and 43 deletions

View File

@ -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<AppGoods> 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<AppGoods> list = appGoodsService.selectAppGoodsList(appGoods);
ExcelUtil<AppGoods> util = new ExcelUtil<AppGoods>(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("修改状态成功");
}
}

View File

@ -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:
# 从数据源开关/默认关闭

View File

@ -74,7 +74,7 @@ spring:
# 数据库索引
database: 0
# 密码
password:
password: 123456
# 连接超时时间
timeout: 10s
lettuce:

View File

@ -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;
//
}

View File

@ -59,4 +59,13 @@ public interface AppGoodsMapper
* @return 结果
*/
public int deleteAppGoodsByGoodsIds(String[] goodsIds);
/**
* 根据id查询物料数据
*
* @param goodsIds
* @return
*/
List<AppGoods> selectAppGoodsListByGoodsIds(String[] goodsIds);
}

View File

@ -60,4 +60,6 @@ public interface AppPmsOrderOutMapper
*/
public int deleteAppPmsOrderOutByListIds(String[] recordIds);
public int deleteAppPmsOrderOutByOrderId(AppPmsOrderOut appPmsOrderOut);
int updatePickNum(AppPmsOrderOut appPmsOrderOut);
}

View File

@ -59,4 +59,10 @@ public interface IAppGoodsService
* @return 结果
*/
public int deleteAppGoodsByGoodsId(String goodsId);
/**
* 批量修改物料启用禁用状态
* @param goodsIds
*/
void changeGoodsIsEnableStatus(String[] goodsIds);
}

View File

@ -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<AppGoods> 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);
});
}
}
}

View File

@ -1,47 +1,55 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.AppPmsOrderOutMapper">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.app.mapper.AppPmsOrderOutMapper">
<resultMap type="AppPmsOrderOut" id="AppPmsOrderOutResult">
<id property="recordId" column="record_id" />
<result property="listId" column="list_id" />
<result property="orderType" column="order_type" />
<result property="customerId" column="customer_id" />
<result property="goodsId" column="goods_id" />
<result property="goodsNum" column="goods_num" />
<result property="pickNum" column="pick_num" />
<result property="trNum" column="tr_num" />
<result property="shelvesNum" column="shelves_num" />
<result property="stockNum" column="stock_num" />
<result property="goodsDesc" column="goods_desc" />
<result property="spare1" column="spare1" />
<result property="spare2" column="spare2" />
<result property="orderStatus" column="order_status" />
<result property="isLock" column="is_lock" />
<result property="orderId" column="order_id" />
</resultMap>
<sql id="selectAppPmsOrderOutVo">
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
</sql>
<select id="selectAppPmsOrderOutList" parameterType="AppPmsOrderOut" resultMap="AppPmsOrderOutResult">
<include refid="selectAppPmsOrderOutVo"/>
<where>
<where>
<if test="listId != null "> and list_id = #{listId}</if>
<if test="orderType != null "> and order_type = #{orderType}</if>
<if test="customerId != null and customerId != ''"> and customer_id = #{customerId}</if>
<if test="goodsId != null and goodsId != ''"> and goods_id = #{goodsId}</if>
<if test="goodsNum != null "> and goods_num = #{goodsNum}</if>
<if test="goodsDesc != null and goodsDesc != ''"> and goods_desc = #{goodsDesc}</if>
<if test="spare1 != null and spare1 != ''"> and spare1 = #{spare1}</if>
<if test="spare2 != null and spare2 != ''"> and spare2 = #{spare2}</if>
<if test="orderStatus != null "> and order_status = #{orderStatus}</if>
<if test="goodsId != null and goodsId != ''"> and goods_id = #{goodsId}</if>
<if test="orderStatus != null and orderStatus != ''"> and order_status = #{orderStatus}</if>
<if test="isLock != null and isLock != ''"> and is_lock = #{isLock}</if>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
</where>
</select>
<select id="selectAppPmsOrderOutByListId" parameterType="String" resultMap="AppPmsOrderOutResult">
<include refid="selectAppPmsOrderOutVo"/>
where list_id = #{listId}
where record_id = #{recordId}
</select>
<insert id="insertAppPmsOrderOut" parameterType="AppPmsOrderOut">
insert into app_pms_order_out
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="recordId != null">record_id,</if>
<if test="listId != null">list_id,</if>
<if test="orderType != null">order_type,</if>
<if test="customerId != null and customerId != ''">customer_id,</if>
@ -50,9 +58,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="goodsDesc != null and goodsDesc != ''">goods_desc,</if>
<if test="spare1 != null and spare1 != ''">spare1,</if>
<if test="spare2 != null">spare2,</if>
<if test="pickNum != null">pick_num,</if>
<if test="trNum != null">tr_num,</if>
<if test="shelvesNum != null">shelves_num,</if>
<if test="stockNum != null">stock_num,</if>
<if test="orderStatus != null">order_status,</if>
</trim>
<if test="isLock != null">is_lock,</if>
<if test="orderId != null">order_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="recordId != null">#{recordId},</if>
<if test="listId != null">#{listId},</if>
<if test="orderType != null">#{orderType},</if>
<if test="customerId != null and customerId != ''">#{customerId},</if>
@ -61,13 +76,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="goodsDesc != null and goodsDesc != ''">#{goodsDesc},</if>
<if test="spare1 != null and spare1 != ''">#{spare1},</if>
<if test="spare2 != null">#{spare2},</if>
<if test="pickNum != null">#{pickNum},</if>
<if test="trNum != null">#{trNum},</if>
<if test="shelvesNum != null">#{shelvesNum},</if>
<if test="stockNum != null">#{stockNum},</if>
<if test="orderStatus != null">#{orderStatus},</if>
</trim>
<if test="isLock != null">#{isLock},</if>
<if test="orderId != null">#{orderId},</if>
</trim>
</insert>
<update id="updateAppPmsOrderOut" parameterType="AppPmsOrderOut">
update app_pms_order_out
<trim prefix="SET" suffixOverrides=",">
<if test="listId != null">list_id = #{listId},</if>
<if test="orderType != null">order_type = #{orderType},</if>
<if test="customerId != null and customerId != ''">customer_id = #{customerId},</if>
<if test="goodsId != null and goodsId != ''">goods_id = #{goodsId},</if>
@ -75,19 +97,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="goodsDesc != null and goodsDesc != ''">goods_desc = #{goodsDesc},</if>
<if test="spare1 != null and spare1 != ''">spare1 = #{spare1},</if>
<if test="spare2 != null">spare2 = #{spare2},</if>
<if test="orderStatus != null">order_status = #{orderStatus},</if>
<if test="pickNum != null">pick_num = #{pickNum},</if>
<if test="trNum != null">tr_num = #{trNum},</if>
<if test="shelvesNum != null">shelves_num = #{shelvesNum},</if>
<if test="stockNum != null">stock_num = #{stockNum},</if>
<if test="isLock != null">is_lock = #{isLock},</if>
</trim>
where list_id = #{listId}
where record_id = #{recordId}
</update>
<update id="updatePickNum" parameterType="AppPmsOrderOut">
update app_pms_order_out
<trim prefix="SET" suffixOverrides=",">
<if test="pickNum != null">pick_num = #{pickNum},</if>
<if test="isLock != null">is_lock = #{isLock},</if>
</trim>
where record_id = #{recordId}
</update>
<delete id="deleteAppPmsOrderOutByListId" parameterType="String">
delete from app_pms_order_out where list_id = #{listId}
delete from app_pms_order_out where record_id = #{recordId}
</delete>
<delete id="deleteAppPmsOrderOutByOrderId" parameterType="AppPmsOrderOut">
delete from app_pms_order_out where order_id = #{orderId}
</delete>
<delete id="deleteAppPmsOrderOutByListIds" parameterType="String">
delete from app_pms_order_out where list_id in
<foreach item="listId" collection="array" open="(" separator="," close=")">
#{listId}
delete from app_pms_order_out where record_id in
<foreach item="record_id" collection="array" open="(" separator="," close=")">
#{recordId}
</foreach>
</delete>
</mapper>
</mapper>