fix:库区删除增加校验,解决删除报错问题
This commit is contained in:
parent
ccdc77f67e
commit
dde4bbbb1d
@ -118,12 +118,12 @@ public class WmStorageLocationController extends BaseController
|
|||||||
@DeleteMapping("/{locationIds}")
|
@DeleteMapping("/{locationIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] locationIds)
|
public AjaxResult remove(@PathVariable Long[] locationIds)
|
||||||
{
|
{
|
||||||
//TODO:库区删除之前的逻辑校验
|
// //TODO:库区删除之前的逻辑校验
|
||||||
|
//
|
||||||
for (Long locationId: locationIds
|
// for (Long locationId: locationIds
|
||||||
) {
|
// ) {
|
||||||
wmStorageAreaService.deleteByLocationId(locationId);
|
// wmStorageAreaService.deleteByLocationId(locationId);
|
||||||
}
|
// }
|
||||||
return toAjax(wmStorageLocationService.deleteWmStorageLocationByLocationIds(locationIds));
|
return wmStorageLocationService.deleteWmStorageLocationByLocationIds(locationIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.ktg.mes.wm.mapper;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.ktg.mes.wm.domain.WmStorageLocation;
|
import com.ktg.mes.wm.domain.WmStorageLocation;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 库区设置Mapper接口
|
* 库区设置Mapper接口
|
||||||
@ -78,4 +79,11 @@ public interface WmStorageLocationMapper
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public int deleteByWarehouseId(Long warehouseId);
|
public int deleteByWarehouseId(Long warehouseId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据locationIds查询库区数据
|
||||||
|
* @param locationIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<WmStorageLocation> selectByLocationIds(@Param("ids") Long[] locationIds);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.ktg.mes.wm.service;
|
package com.ktg.mes.wm.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ktg.common.core.domain.AjaxResult;
|
||||||
import com.ktg.mes.wm.domain.WmStorageLocation;
|
import com.ktg.mes.wm.domain.WmStorageLocation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -69,11 +71,11 @@ public interface IWmStorageLocationService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除库区设置
|
* 批量删除库区设置
|
||||||
*
|
*
|
||||||
* @param locationIds 需要删除的库区设置主键集合
|
* @param locationIds 需要删除的库区设置主键集合
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteWmStorageLocationByLocationIds(Long[] locationIds);
|
public AjaxResult deleteWmStorageLocationByLocationIds(Long[] locationIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除库区设置信息
|
* 删除库区设置信息
|
||||||
|
@ -3,9 +3,10 @@ package com.ktg.mes.wm.service.impl;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.ktg.common.constant.UserConstants;
|
import com.ktg.common.constant.UserConstants;
|
||||||
|
import com.ktg.common.core.domain.AjaxResult;
|
||||||
import com.ktg.common.utils.DateUtils;
|
import com.ktg.common.utils.DateUtils;
|
||||||
import com.ktg.common.utils.StringUtils;
|
import com.ktg.common.utils.StringUtils;
|
||||||
import org.apache.catalina.User;
|
import com.ktg.mes.wm.service.IWmStorageAreaService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ktg.mes.wm.mapper.WmStorageLocationMapper;
|
import com.ktg.mes.wm.mapper.WmStorageLocationMapper;
|
||||||
@ -24,6 +25,9 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
|
|||||||
@Autowired
|
@Autowired
|
||||||
private WmStorageLocationMapper wmStorageLocationMapper;
|
private WmStorageLocationMapper wmStorageLocationMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IWmStorageAreaService wmStorageAreaService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询库区设置
|
* 查询库区设置
|
||||||
*
|
*
|
||||||
@ -101,14 +105,28 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除库区设置
|
* 批量删除库区设置
|
||||||
*
|
*
|
||||||
* @param locationIds 需要删除的库区设置主键
|
* @param locationIds 需要删除的库区设置主键
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteWmStorageLocationByLocationIds(Long[] locationIds)
|
public AjaxResult deleteWmStorageLocationByLocationIds(Long[] locationIds)
|
||||||
{
|
{
|
||||||
return wmStorageLocationMapper.deleteWmStorageLocationByLocationIds(locationIds);
|
// 查询所有需要删除的数据
|
||||||
|
List<WmStorageLocation> list = wmStorageLocationMapper.selectByLocationIds(locationIds);
|
||||||
|
for (WmStorageLocation item : list) {
|
||||||
|
String locationCode = item.getLocationCode();
|
||||||
|
if (locationCode.contains("VIRTUAL")) {
|
||||||
|
return AjaxResult.error("线边库库区不能被删除");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Long locationId: locationIds
|
||||||
|
) {
|
||||||
|
wmStorageAreaService.deleteByLocationId(locationId);
|
||||||
|
}
|
||||||
|
wmStorageLocationMapper.deleteWmStorageLocationByLocationIds(locationIds);
|
||||||
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -144,7 +144,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteByLocationId" parameterType="Long">
|
<delete id="deleteByLocationId" parameterType="Long">
|
||||||
delete form wm_storage_area where location_id = #{locationId}
|
delete from wm_storage_area where location_id = #{locationId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -57,6 +57,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<include refid="selectWmStorageLocationVo"/>
|
<include refid="selectWmStorageLocationVo"/>
|
||||||
where location_name = #{locationName} and warehouse_id = #{warehouseId} limit 1
|
where location_name = #{locationName} and warehouse_id = #{warehouseId} limit 1
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectByLocationIds" resultType="com.ktg.mes.wm.domain.WmStorageLocation">
|
||||||
|
<include refid="selectWmStorageLocationVo"/>
|
||||||
|
where location_id in
|
||||||
|
<foreach collection="ids" item="item" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertWmStorageLocation" parameterType="WmStorageLocation" useGeneratedKeys="true" keyProperty="locationId">
|
<insert id="insertWmStorageLocation" parameterType="WmStorageLocation" useGeneratedKeys="true" keyProperty="locationId">
|
||||||
insert into wm_storage_location
|
insert into wm_storage_location
|
||||||
|
Loading…
Reference in New Issue
Block a user