仓库、库区、库位删除功能完善

This commit is contained in:
JinLu.Yin 2022-08-24 22:35:35 +08:00
parent 2e5ba5bc25
commit f2176a83d9
11 changed files with 97 additions and 0 deletions

View File

@ -4,8 +4,10 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ktg.common.constant.UserConstants;
import com.ktg.mes.wm.service.IWmStorageAreaService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
@ -36,6 +38,9 @@ public class WmStorageLocationController extends BaseController
@Autowired
private IWmStorageLocationService wmStorageLocationService;
@Autowired
private IWmStorageAreaService wmStorageAreaService;
/**
* 查询库区设置列表
*/
@ -104,9 +109,14 @@ public class WmStorageLocationController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('mes:wm:location:remove')")
@Log(title = "库区设置", businessType = BusinessType.DELETE)
@Transactional
@DeleteMapping("/{locationIds}")
public AjaxResult remove(@PathVariable Long[] locationIds)
{
for (Long locationId: locationIds
) {
wmStorageAreaService.deleteByLocationId(locationId);
}
return toAjax(wmStorageLocationService.deleteWmStorageLocationByLocationIds(locationIds));
}
}

View File

@ -4,8 +4,11 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ktg.common.constant.UserConstants;
import com.ktg.mes.wm.service.IWmStorageAreaService;
import com.ktg.mes.wm.service.IWmStorageLocationService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
@ -36,6 +39,12 @@ public class WmWarehouseController extends BaseController
@Autowired
private IWmWarehouseService wmWarehouseService;
@Autowired
private IWmStorageLocationService wmStorageLocationService;
@Autowired
private IWmStorageAreaService wmStorageAreaService;
/**
* 查询仓库设置列表
*/
@ -114,9 +123,16 @@ public class WmWarehouseController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('mes:wm:warehouse:remove')")
@Log(title = "仓库设置", businessType = BusinessType.DELETE)
@Transactional
@DeleteMapping("/{warehouseIds}")
public AjaxResult remove(@PathVariable Long[] warehouseIds)
{
for (Long wahouseId: warehouseIds
) {
wmStorageLocationService.deleteByWarehouseId(wahouseId);
wmStorageAreaService.deleteByWarehouseId(wahouseId);
}
return toAjax(wmWarehouseService.deleteWmWarehouseByWarehouseIds(warehouseIds));
}
}

View File

@ -58,4 +58,18 @@ public interface WmStorageAreaMapper
* @return 结果
*/
public int deleteWmStorageAreaByAreaIds(Long[] areaIds);
/**
* 根据仓库删除对应的库位
* @param warehouseId
* @return
*/
public int deleteByWarehouseId(Long warehouseId);
/**
* 根据库区删除对应的库位
* @param locationId
* @return
*/
public int deleteByLocationId(Long locationId);
}

View File

@ -64,4 +64,11 @@ public interface WmStorageLocationMapper
* @return 结果
*/
public int deleteWmStorageLocationByLocationIds(Long[] locationIds);
/**
* 根据仓库删除对应的库区
* @param warehouseId
* @return
*/
public int deleteByWarehouseId(Long warehouseId);
}

View File

@ -63,4 +63,5 @@ public interface WmWarehouseMapper
* @return 结果
*/
public int deleteWmWarehouseByWarehouseIds(Long[] warehouseIds);
}

View File

@ -58,4 +58,18 @@ public interface IWmStorageAreaService
* @return 结果
*/
public int deleteWmStorageAreaByAreaId(Long areaId);
/**
* 根据仓库删除对应的库位
* @param warehouseId
* @return
*/
public int deleteByWarehouseId(Long warehouseId);
/**
* 根据库区删除对应的库位
* @param locationId
* @return
*/
public int deleteByLocationId(Long locationId);
}

View File

@ -73,4 +73,11 @@ public interface IWmStorageLocationService
* @return 结果
*/
public int deleteWmStorageLocationByLocationId(Long locationId);
/**
* 根据仓库删除对应的库区
* @param warehouseId
* @return
*/
public int deleteByWarehouseId(Long warehouseId);
}

View File

@ -93,4 +93,14 @@ public class WmStorageAreaServiceImpl implements IWmStorageAreaService
{
return wmStorageAreaMapper.deleteWmStorageAreaByAreaId(areaId);
}
@Override
public int deleteByWarehouseId(Long warehouseId) {
return wmStorageAreaMapper.deleteByWarehouseId(warehouseId);
}
@Override
public int deleteByLocationId(Long locationId) {
return wmStorageAreaMapper.deleteByLocationId(locationId);
}
}

View File

@ -117,4 +117,9 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
{
return wmStorageLocationMapper.deleteWmStorageLocationByLocationId(locationId);
}
@Override
public int deleteByWarehouseId(Long warehouseId) {
return wmStorageLocationMapper.deleteByWarehouseId(warehouseId);
}
}

View File

@ -129,4 +129,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{areaId}
</foreach>
</delete>
<delete id="deleteByWarehouseId" parameterType="Long">
delete from wm_storage_area where warehouse_id = #{warehouseId}
</delete>
<delete id="deleteByLocationId" parameterType="Long">
delete form wm_storage_area where location_id = #{locationId}
</delete>
</mapper>

View File

@ -119,4 +119,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{locationId}
</foreach>
</delete>
<delete id="deleteByWarehouseId" parameterType="Long">
delete from wm_storage_location where warehouse_id = #{warehouseId}
</delete>
</mapper>