|
|
|
@ -3,9 +3,11 @@ package com.gaotao.modules.warehouse.controller; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.gaotao.common.utils.PageUtils; |
|
|
|
import com.gaotao.common.utils.R; |
|
|
|
import com.gaotao.modules.sys.entity.SysUserEntity; |
|
|
|
import com.gaotao.modules.warehouse.entity.*; |
|
|
|
import com.gaotao.modules.warehouse.service.WarehouseService; |
|
|
|
import io.lettuce.core.ScriptOutputType; |
|
|
|
import org.apache.shiro.SecurityUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
@ -13,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
@RequestMapping("/warehouse") |
|
|
|
@RestController |
|
|
|
@ -251,4 +254,27 @@ public class WarehouseController { |
|
|
|
R r = warehouseService.transferInventoryStock(data); |
|
|
|
return r; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据用户名和工厂获取授权的仓库列表 |
|
|
|
* @param params 包含site的参数 |
|
|
|
* @return 仓库列表 |
|
|
|
*/ |
|
|
|
@PostMapping("getUserAuthorizedWarehouses") |
|
|
|
public R getUserAuthorizedWarehouses(@RequestBody Map<String, Object> params) { |
|
|
|
try { |
|
|
|
SysUserEntity sysUserEntity = (SysUserEntity) SecurityUtils.getSubject().getPrincipal(); |
|
|
|
String userName = sysUserEntity.getUsername(); |
|
|
|
String site = (String) params.get("site"); |
|
|
|
|
|
|
|
if (site == null || site.trim().isEmpty()) { |
|
|
|
return R.error("工厂参数不能为空"); |
|
|
|
} |
|
|
|
|
|
|
|
List<Map<String, Object>> warehouseList = warehouseService.getUserAuthorizedWarehouses(userName, site.trim()); |
|
|
|
return R.ok().put("data", warehouseList); |
|
|
|
} catch (Exception e) { |
|
|
|
return R.error("获取仓库列表失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |