|
|
|
|
package com.glxp.api.controller.auth;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.glxp.api.annotation.AuthRuleAnnotation;
|
|
|
|
|
import com.glxp.api.annotation.Log;
|
|
|
|
|
import com.glxp.api.common.enums.ResultEnum;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
|
import com.glxp.api.constant.BusinessType;
|
|
|
|
|
import com.glxp.api.controller.BaseController;
|
|
|
|
|
import com.glxp.api.dto.DictDto;
|
|
|
|
|
import com.glxp.api.entity.auth.*;
|
|
|
|
|
import com.glxp.api.entity.basic.BasicBussinessTypeEntity;
|
|
|
|
|
import com.glxp.api.entity.system.CompanyEntity;
|
|
|
|
|
import com.glxp.api.req.auth.*;
|
|
|
|
|
import com.glxp.api.req.basic.FilterBussinessTypeRequest;
|
|
|
|
|
import com.glxp.api.req.system.DeleteRequest;
|
|
|
|
|
import com.glxp.api.req.thrsys.FilterBasicThirdSysRequest;
|
|
|
|
|
import com.glxp.api.res.PageSimpleResponse;
|
|
|
|
|
import com.glxp.api.res.auth.InvSubWarehouseResponse;
|
|
|
|
|
import com.glxp.api.res.auth.InvWarehouseThirdSysResponse;
|
|
|
|
|
import com.glxp.api.res.basic.BasicBussinessTypeResponse;
|
|
|
|
|
import com.glxp.api.service.auth.*;
|
|
|
|
|
import com.glxp.api.service.basic.IBasicBussinessTypeService;
|
|
|
|
|
import com.glxp.api.service.system.CompanyService;
|
|
|
|
|
import com.glxp.api.service.system.SystemParamConfigService;
|
|
|
|
|
import com.glxp.api.util.IntUtil;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.validation.Valid;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
|
public class InvWarehouseController extends BaseController {
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
InvWarehouseService invWarehouseService;
|
|
|
|
|
@Resource
|
|
|
|
|
DeptService deptService;
|
|
|
|
|
@Resource
|
|
|
|
|
CustomerService customerService;
|
|
|
|
|
@Resource
|
|
|
|
|
CompanyService companyService;
|
|
|
|
|
@Resource
|
|
|
|
|
private WarehouseUserService warehouseUserService;
|
|
|
|
|
@Resource
|
|
|
|
|
private SystemParamConfigService systemParamConfigService;
|
|
|
|
|
@Resource
|
|
|
|
|
private WarehouseBussinessTypeService warehouseBussinessTypeService;
|
|
|
|
|
@Resource
|
|
|
|
|
private IBasicBussinessTypeService basicBussinessTypeService;
|
|
|
|
|
@Resource
|
|
|
|
|
private InvSpaceService invSpaceService;
|
|
|
|
|
@Resource
|
|
|
|
|
InvBusUserService invBusUserService;
|
|
|
|
|
@Resource
|
|
|
|
|
AuthWarehouseUnifyService authWarehouseUnifyService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取仓库列表
|
|
|
|
|
*
|
|
|
|
|
* @param filterInvSubWarehouseRequest
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@GetMapping("spms/sub/inv/warehouse/filter")
|
|
|
|
|
public BaseResponse filterInvWarehouse(FilterInvSubWarehouseRequest filterInvSubWarehouseRequest) {
|
|
|
|
|
List<InvSubWarehouseResponse> responses = invWarehouseService.filterInvSubWarehouseResponse(filterInvSubWarehouseRequest);
|
|
|
|
|
return ResultVOUtils.success(responses);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取仓库列表
|
|
|
|
|
*
|
|
|
|
|
* @param filterInvSubWarehouseRequest
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@GetMapping("spms/sub/inv/warehouse/filterOptimize")
|
|
|
|
|
public BaseResponse filterOptimize(FilterInvSubWarehouseRequest filterInvSubWarehouseRequest) {
|
|
|
|
|
List<InvSubWarehouseResponse> responses = invWarehouseService.filterInvSubWarehouseResponse(filterInvSubWarehouseRequest);
|
|
|
|
|
List<DictDto> reList = responses.stream().map(s-> {
|
|
|
|
|
DictDto dictDto = new DictDto(s.getCode(),s.getName());
|
|
|
|
|
return dictDto;
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
return ResultVOUtils.success(reList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取部门底下仓库列表-关联用户
|
|
|
|
|
*
|
|
|
|
|
* @param filterInvWarehouseRequest
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@GetMapping("spms/inv/warehouse/findByDeptUser")
|
|
|
|
|
public BaseResponse findByDept(FilterInvWarehouseRequest filterInvWarehouseRequest) {
|
|
|
|
|
AuthAdmin authAdmin = getUser();
|
|
|
|
|
if (authAdmin.getCustomerId().equals("110")) {
|
|
|
|
|
filterInvWarehouseRequest.setUserId(authAdmin.getId());
|
|
|
|
|
} else {
|
|
|
|
|
if (IntUtil.value(filterInvWarehouseRequest.getType()) == 1) {
|
|
|
|
|
filterInvWarehouseRequest.setSpUse(true);
|
|
|
|
|
}
|
|
|
|
|
filterInvWarehouseRequest.setUserId(null);
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isEmpty(filterInvWarehouseRequest.getDeptCode())) {
|
|
|
|
|
return ResultVOUtils.error(500, "部门不能为空");
|
|
|
|
|
}
|
|
|
|
|
List<InvWarehouseEntity> invSubWarehouseEntities = invWarehouseService.filterGroupInvSub(filterInvWarehouseRequest);
|
|
|
|
|
return ResultVOUtils.success(invSubWarehouseEntities);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取用户所有关联仓库
|
|
|
|
|
*
|
|
|
|
|
* @param filterInvWarehouseRequest
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@GetMapping("spms/inv/warehouse/findByUser")
|
|
|
|
|
public BaseResponse findByUser(FilterInvWarehouseRequest filterInvWarehouseRequest) {
|
|
|
|
|
|
|
|
|
|
if (isHosUser()) {
|
|
|
|
|
filterInvWarehouseRequest.setUserId(getUserId());
|
|
|
|
|
} else {
|
|
|
|
|
filterInvWarehouseRequest.setUserId(null);
|
|
|
|
|
}
|
|
|
|
|
filterInvWarehouseRequest.setSpUse(true);
|
|
|
|
|
List<InvWarehouseEntity> invSubWarehouseEntities = invWarehouseService.filterGroupInvSub(filterInvWarehouseRequest);
|
|
|
|
|
return ResultVOUtils.success(invSubWarehouseEntities);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 前端页面查询参数拉取用户关联所有仓库接口,只返回编码,父ID和名称
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@GetMapping("spms/inv/warehouse/findInvListByUser")
|
|
|
|
|
public BaseResponse findInvListByUser(FilterInvWarehouseRequest filterInvWarehouseRequest) {
|
|
|
|
|
Long userId = getUserId();
|
|
|
|
|
if (null == userId) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.LOGIN_VERIFY_FALL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isHosUser()) {
|
|
|
|
|
filterInvWarehouseRequest.setUserId(userId);
|
|
|
|
|
} else {
|
|
|
|
|
filterInvWarehouseRequest.setUserId(null);
|
|
|
|
|
filterInvWarehouseRequest.setSpUse(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<InvWarehouseEntity> list = invWarehouseService.findInvListByUser(filterInvWarehouseRequest);
|
|
|
|
|
return ResultVOUtils.success(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@GetMapping("spms/inv/warehouse/findInvListByUserOptimize")
|
|
|
|
|
public BaseResponse findInvListByUserOptimize(FilterInvWarehouseRequest filterInvWarehouseRequest) {
|
|
|
|
|
Long userId = getUserId();
|
|
|
|
|
if (null == userId) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.LOGIN_VERIFY_FALL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isHosUser()) {
|
|
|
|
|
filterInvWarehouseRequest.setUserId(userId);
|
|
|
|
|
} else {
|
|
|
|
|
filterInvWarehouseRequest.setUserId(null);
|
|
|
|
|
filterInvWarehouseRequest.setSpUse(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<InvWarehouseEntity> list = invWarehouseService.findInvListByUser(filterInvWarehouseRequest);
|
|
|
|
|
List<DictDto> reList = list.stream().map(s-> {
|
|
|
|
|
DictDto dictDto = new DictDto(s.getCode(),s.getName());
|
|
|
|
|
return dictDto;
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
return ResultVOUtils.success(reList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取往来仓库(除了自己)
|
|
|
|
|
*
|
|
|
|
|
* @param filterInvWarehouseRequest
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@GetMapping("spms/inv/warehouse/findByFrom")
|
|
|
|
|
public BaseResponse findByFrom(FilterInvWarehouseRequest filterInvWarehouseRequest) {
|
|
|
|
|
if (StrUtil.isEmpty(filterInvWarehouseRequest.getLocInvCode())) {
|
|
|
|
|
return ResultVOUtils.error(500, "当前仓库不能为空!");
|
|
|
|
|
}
|
|
|
|
|
FilterInvSubWarehouseRequest filterInvSubWarehouseRequest = new FilterInvSubWarehouseRequest();
|
|
|
|
|
List<InvWarehouseEntity> invWarehouseEntities = invWarehouseService.filterInvSubWarehouse(filterInvSubWarehouseRequest);
|
|
|
|
|
List<InvWarehouseEntity> results = new ArrayList<>();
|
|
|
|
|
if (CollUtil.isNotEmpty(invWarehouseEntities)) {
|
|
|
|
|
invWarehouseEntities.forEach(invWarehouseEntity -> {
|
|
|
|
|
if (!invWarehouseEntity.getCode().equals(filterInvWarehouseRequest.getLocInvCode())) {
|
|
|
|
|
results.add(invWarehouseEntity);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.success(results);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@GetMapping("spms/sub/inv/warehouse/filterSub")
|
|
|
|
|
public BaseResponse filterSub(FilterInvWarehouseRequest filterInvWarehouseRequest) {
|
|
|
|
|
|
|
|
|
|
// if (StrUtil.isEmpty(filterInvWarehouseRequest.getPcode()) || filterInvWarehouseRequest.getUserId() == null) {
|
|
|
|
|
// return ResultVOUtils.error(500, "用户或仓库不能未空!");
|
|
|
|
|
// }
|
|
|
|
|
AuthAdmin authAdmin = customerService.getUserBean();
|
|
|
|
|
InvWarehouseEntity invWarehouseEntity = invWarehouseService.filterGroupInvSubAndcode(filterInvWarehouseRequest.getCode());
|
|
|
|
|
filterInvWarehouseRequest.setSubordinateCode(invWarehouseEntity.getParentId());
|
|
|
|
|
filterInvWarehouseRequest.setCode(null);
|
|
|
|
|
List<InvWarehouseEntity> invSubWarehouseEntities = invWarehouseService.filterGroupInvSubDown(filterInvWarehouseRequest);
|
|
|
|
|
return ResultVOUtils.success(invSubWarehouseEntities);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/spms/sub/inv/warehouse/save")
|
|
|
|
|
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
|
|
|
|
public BaseResponse save(@RequestBody InvWarehouseEntity invWarehouseEntity,
|
|
|
|
|
BindingResult bindingResult) {
|
|
|
|
|
|
|
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
boolean checkResult = invWarehouseService.checkDuplicateName(invWarehouseEntity.getParentId(), invWarehouseEntity.getName());
|
|
|
|
|
if (checkResult) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "仓库名称重复!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FilterInvSubWarehouseRequest filterInvWarehouseRequest = new FilterInvSubWarehouseRequest();
|
|
|
|
|
InvWarehouseEntity codeEntity = invWarehouseService.selectMaxCode(filterInvWarehouseRequest);
|
|
|
|
|
DeptEntity pEntity = deptService.selectByCode(invWarehouseEntity.getParentId());
|
|
|
|
|
if (codeEntity == null) {
|
|
|
|
|
int code = Integer.parseInt(pEntity.getCode()) * 1000;
|
|
|
|
|
invWarehouseEntity.setCode(code + "");
|
|
|
|
|
} else {
|
|
|
|
|
invWarehouseEntity.setCode(Integer.parseInt(codeEntity.getCode()) + 1 + "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DeptEntity updateEntity = new DeptEntity();
|
|
|
|
|
updateEntity.setId(pEntity.getId());
|
|
|
|
|
updateEntity.setUpdateTime(new Date());
|
|
|
|
|
deptService.updateInvWarehouse(updateEntity);
|
|
|
|
|
invWarehouseEntity.setId(IdUtil.getSnowflake(6, 1).nextId());
|
|
|
|
|
invWarehouseEntity.setUpdateTime(new Date());
|
|
|
|
|
boolean b = invWarehouseService.insertInvSubWarehouse(invWarehouseEntity);
|
|
|
|
|
if (!b) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.success("添加成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/spms/sub/inv/warehouse/edit")
|
|
|
|
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
|
|
|
|
public BaseResponse edit(@RequestBody @Valid InvWarehouseEntity invWarehouseEntity,
|
|
|
|
|
BindingResult bindingResult, FilterInvSubWarehouseRequest filterInvSubWarehouseRequest) {
|
|
|
|
|
|
|
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
}
|
|
|
|
|
if (invWarehouseEntity.getId() == null) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
|
|
|
|
}
|
|
|
|
|
InvWarehouseEntity originEntity = invWarehouseService.findByInvSubByCode(invWarehouseEntity.getCode());
|
|
|
|
|
|
|
|
|
|
if (!originEntity.getParentId().equals(invWarehouseEntity.getParentId()) || (originEntity.getParentCode() != null && !originEntity.getParentCode().equals(invWarehouseEntity.getParentCode()))) {
|
|
|
|
|
Integer userCount = warehouseUserService.countUserBySubInvCode(invWarehouseEntity.getCode());
|
|
|
|
|
if (userCount > 0) {
|
|
|
|
|
return ResultVOUtils.error(500, "修改部门或上级仓库时,请先移除该仓库关联用户!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 先判断是否有相同名字的仓库
|
|
|
|
|
boolean checkResult = invWarehouseService.updateCheckExit(invWarehouseEntity);
|
|
|
|
|
if (checkResult) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "仓库名称重复!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//更新仓库信息
|
|
|
|
|
invWarehouseEntity.setUpdateTime(new Date());
|
|
|
|
|
boolean b = invWarehouseService.updateInvSubWarehouse(invWarehouseEntity);
|
|
|
|
|
|
|
|
|
|
// //如果要是一级仓库就吧全部子集都刷成一样的寄售仓库
|
|
|
|
|
// if (StrUtil.isBlank(invWarehouseEntity.getParentCode())) {
|
|
|
|
|
// List<InvWarehouseEntity> invWarehouseEntityList = invWarehouseService.selectLowWarehouseAll(invWarehouseEntity.getCode());
|
|
|
|
|
// for (InvWarehouseEntity obj : invWarehouseEntityList) {
|
|
|
|
|
// obj.setAdvanceType(invWarehouseEntity.getAdvanceType());
|
|
|
|
|
// obj.setUpdateTime(new Date());
|
|
|
|
|
// invWarehouseService.updateInvSubWarehouse(obj);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//更新部门信息
|
|
|
|
|
DeptEntity pEntity = deptService.selectByCode(invWarehouseEntity.getParentId());
|
|
|
|
|
pEntity.setUpdateTime(new Date());
|
|
|
|
|
deptService.updateInvWarehouse(pEntity);
|
|
|
|
|
|
|
|
|
|
//更新货位信息
|
|
|
|
|
//查询此仓库绑定的所有货位
|
|
|
|
|
List<InvSpace> spaceList = invSpaceService.findBySubWarehouseCode(invWarehouseEntity.getCode());
|
|
|
|
|
if (CollUtil.isNotEmpty(spaceList)) {
|
|
|
|
|
for (InvSpace invSpace : spaceList) {
|
|
|
|
|
invSpace.setInvStorageCode(invWarehouseEntity.getParentId());
|
|
|
|
|
invSpace.setUpdateTime(new Date());
|
|
|
|
|
}
|
|
|
|
|
invSpaceService.batchUpdate(spaceList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!b) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ResultVOUtils.success("修改成功!");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/spms/sub/inv/warehouse/delete")
|
|
|
|
|
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
|
|
|
|
public BaseResponse delete(@RequestBody DeleteRequest deleteRequest) {
|
|
|
|
|
|
|
|
|
|
if (deleteRequest.getId() == null) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InvWarehouseEntity invWarehouseEntity = invWarehouseService.findById(deleteRequest.getId());
|
|
|
|
|
|
|
|
|
|
//todo 代码未迁移完,记得回来修改
|
|
|
|
|
|
|
|
|
|
Integer userCount = warehouseUserService.countUserBySubInvCode(invWarehouseEntity.getCode());
|
|
|
|
|
if (userCount > 0) {
|
|
|
|
|
return ResultVOUtils.error(500, "请先移除该仓库关联用户!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<WarehouseBussinessTypeEntity> warehouseBussinessTypeEntities = warehouseBussinessTypeService.getListByCode(invWarehouseEntity.getCode());
|
|
|
|
|
if (!warehouseBussinessTypeEntities.isEmpty()) {
|
|
|
|
|
return ResultVOUtils.error(500, "请先移除该仓库关联用户和单据类型!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// //判断此分库中是否还有库存
|
|
|
|
|
// InvWarehouseEntity invSubWarehouse = invWarehouseService.findById(deleteRequest.getId());
|
|
|
|
|
// Integer count = invProductService.countByWarehouseCode(null, invSubWarehouse.getCode());
|
|
|
|
|
// if (count > 0) {
|
|
|
|
|
// return ResultVOUtils.error(500, "此分库存在库存,不能删除!");
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// 判断此分库中是否还有库存
|
|
|
|
|
InvWarehouseEntity byWareId = invWarehouseService.getByWareId(deleteRequest.getId());
|
|
|
|
|
List<InvWarehouseEntity> byWarePcode = invWarehouseService.getByWarePcode(byWareId.getCode());
|
|
|
|
|
if (byWarePcode.size() > 0) {
|
|
|
|
|
return ResultVOUtils.error(500, "此仓库下存在仓库无法删除!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//判断此分库下是否有货位
|
|
|
|
|
List<InvSpace> spaceList = invSpaceService.findBySubWarehouseCode(invWarehouseEntity.getCode());
|
|
|
|
|
if (CollUtil.isNotEmpty(spaceList)) {
|
|
|
|
|
return ResultVOUtils.error(500, "请先移除此分库下的货位!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
boolean b = invWarehouseService.deleteById(deleteRequest.getId());
|
|
|
|
|
|
|
|
|
|
if (!b) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@GetMapping("/spms/sub/inv/warehouse/thridSys/detail")
|
|
|
|
|
public BaseResponse getThirdSysDetail(FilterInvSubWarehouseRequest request) {
|
|
|
|
|
if (null == request || null == request.getId()) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
|
|
|
|
}
|
|
|
|
|
FilterBasicThirdSysRequest sysRequest = new FilterBasicThirdSysRequest();
|
|
|
|
|
sysRequest.setEnabled(true);
|
|
|
|
|
List<InvWarehouseThirdSysResponse> list = invWarehouseService.getThirdSysDetail(request.getId());
|
|
|
|
|
PageInfo<InvWarehouseThirdSysResponse> pageInfo;
|
|
|
|
|
pageInfo = new PageInfo<>(list);
|
|
|
|
|
PageSimpleResponse<InvWarehouseThirdSysResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
|
pageSimpleResponse.setList(list);
|
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/spms/sub/inv/warehouse/bindThrWarehouse")
|
|
|
|
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
|
|
|
|
public BaseResponse bindThrWarehouse(String id, String thridWarehouseId, String sysId) {
|
|
|
|
|
if (null == id || null == thridWarehouseId || StrUtil.isBlank(sysId)) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
|
|
|
|
}
|
|
|
|
|
invWarehouseService.bindThrWarehouse(id, thridWarehouseId, sysId);
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 解绑第三方仓库ID
|
|
|
|
|
*
|
|
|
|
|
* @param id
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/spms/sub/inv/warehouse/unbindThrWarehouse")
|
|
|
|
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
|
|
|
|
public BaseResponse unbindThrWarehouse(String id, String sysId) {
|
|
|
|
|
if (null == id || StrUtil.isBlank(sysId)) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
|
|
|
|
}
|
|
|
|
|
invWarehouseService.unbindThrWarehouse(id, sysId);
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询分仓列表
|
|
|
|
|
*
|
|
|
|
|
* @param filterInvWarehouseRequest
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@GetMapping("/spms/sub/inv/warehouse/filterSubInvList")
|
|
|
|
|
public BaseResponse filterSubInvList(FilterInvWarehouseRequest filterInvWarehouseRequest) {
|
|
|
|
|
List<InvSubWarehouseResponse> responses = invWarehouseService.filterSubInvList(filterInvWarehouseRequest);
|
|
|
|
|
return ResultVOUtils.success(responses);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据仓位码获取关联用户数据
|
|
|
|
|
*/
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/warehouse/inout/warehouseUserList")
|
|
|
|
|
public BaseResponse getWarehouseUserList(@RequestBody @Valid FilterInvLinkDataRequest filterInvLinkDataRequest, BindingResult bindingResult) {
|
|
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
}
|
|
|
|
|
List<WarehouseUserEntity> warehouseUserList = warehouseUserService.getWarehouseUserList(filterInvLinkDataRequest);
|
|
|
|
|
PageInfo<WarehouseUserEntity> pageInfo = new PageInfo<>(warehouseUserList);
|
|
|
|
|
PageSimpleResponse<WarehouseUserEntity> response = new PageSimpleResponse<>();
|
|
|
|
|
response.setList(pageInfo.getList());
|
|
|
|
|
response.setTotal(pageInfo.getTotal());
|
|
|
|
|
return ResultVOUtils.success(response);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/warehouse/inout/warehouseBussniessTypeList")
|
|
|
|
|
public BaseResponse getWarehouseBussniessTypeList(@RequestBody @Valid FilterInvLinkDataRequest filterInvLinkDataRequest, BindingResult bindingResult) {
|
|
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
}
|
|
|
|
|
List<WarehouseBussinessTypeEntity> warehouseBussniessTypeList = warehouseBussinessTypeService.getWarehouseBussniessTypeList(filterInvLinkDataRequest);
|
|
|
|
|
PageInfo<WarehouseBussinessTypeEntity> pageInfo = new PageInfo<>(warehouseBussniessTypeList);
|
|
|
|
|
PageSimpleResponse<WarehouseBussinessTypeEntity> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
|
pageSimpleResponse.setList(pageInfo.getList());
|
|
|
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//仓库关联单据类型管理页面数据
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/warehouse/invRelBusType/manageList")
|
|
|
|
|
public BaseResponse getManageList(@RequestBody @Valid FilterInvLinkDataRequest filterInvLinkDataRequest, BindingResult bindingResult) {
|
|
|
|
|
|
|
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
}
|
|
|
|
|
InvWarehouseEntity invWarehouseEntity = invWarehouseService.findByInvSubByCode(filterInvLinkDataRequest.getCode());
|
|
|
|
|
|
|
|
|
|
//1.获取所有单据类型
|
|
|
|
|
FilterBussinessTypeRequest filterBussinessTypeRequest = new FilterBussinessTypeRequest();
|
|
|
|
|
filterBussinessTypeRequest.setEnable(true);
|
|
|
|
|
filterBussinessTypeRequest.setActionType(invWarehouseEntity.getAdvanceType());
|
|
|
|
|
List<BasicBussinessTypeEntity> basicBussinessTypeEntities = basicBussinessTypeService.findList(filterBussinessTypeRequest);
|
|
|
|
|
|
|
|
|
|
//获取仓库关联单据类型
|
|
|
|
|
if (StrUtil.isEmpty(filterInvLinkDataRequest.getCode()))
|
|
|
|
|
return ResultVOUtils.error(500, "仓库编码不能为空!");
|
|
|
|
|
List<WarehouseBussinessTypeEntity> warehouseBussniessTypeList = warehouseBussinessTypeService.getWarehouseBussniessTypeList(filterInvLinkDataRequest);
|
|
|
|
|
basicBussinessTypeEntities.forEach(basicBussinessTypeEntity ->
|
|
|
|
|
{
|
|
|
|
|
for (WarehouseBussinessTypeEntity warehouseBussinessTypeEntity : warehouseBussniessTypeList) {
|
|
|
|
|
if (warehouseBussinessTypeEntity.getAction().equals(basicBussinessTypeEntity.getAction())) {
|
|
|
|
|
basicBussinessTypeEntity.setSelect(true);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return ResultVOUtils.success(basicBussinessTypeEntities);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/spms/invRelBusType/warehouse/post")
|
|
|
|
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
|
|
|
|
public BaseResponse postRes(@RequestBody UpdateInvRelBusRequest relBusRequset) {
|
|
|
|
|
if (StrUtil.isEmpty(relBusRequset.getInvCode()))
|
|
|
|
|
return ResultVOUtils.error(500, "仓库编码不能为空!");
|
|
|
|
|
|
|
|
|
|
//1.先查出已存在关联单据类型
|
|
|
|
|
List<WarehouseBussinessTypeEntity> exitEntitys = warehouseBussinessTypeService.getListByCode(relBusRequset.getInvCode());
|
|
|
|
|
List<WarehouseBussinessTypeEntity> removeLists = new ArrayList<>();
|
|
|
|
|
for (WarehouseBussinessTypeEntity warehouseBussinessTypeEntity : exitEntitys) {
|
|
|
|
|
//2.过滤出被移除单据类型
|
|
|
|
|
if (!isExitBusType(relBusRequset.getSelectActions(), warehouseBussinessTypeEntity)) {
|
|
|
|
|
removeLists.add(warehouseBussinessTypeEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<String> removeList = new ArrayList<>();
|
|
|
|
|
for (WarehouseBussinessTypeEntity warehouseBussinessTypeEntity : removeLists) {
|
|
|
|
|
removeList.add(warehouseBussinessTypeEntity.getAction());
|
|
|
|
|
}
|
|
|
|
|
// if (CollUtil.isNotEmpty(removeList)) {
|
|
|
|
|
// FilterInvBusUserRequest filterInvBusUserRequest = new FilterInvBusUserRequest();
|
|
|
|
|
// filterInvBusUserRequest.setSubInvCode(relBusRequset.getInvCode());
|
|
|
|
|
// filterInvBusUserRequest.setSelectedCodes(relBusRequset.getSelectActions());
|
|
|
|
|
// List<InvBusUserEntity> invBusUserEntities = invBusUserService.filterInvBusUser(filterInvBusUserRequest);
|
|
|
|
|
// if (CollUtil.isNotEmpty(invBusUserEntities))
|
|
|
|
|
// return ResultVOUtils.error(999, "请先移除用户关联单据类型!");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean b = warehouseBussinessTypeService.deleteByCode(relBusRequset.getInvCode());
|
|
|
|
|
if (CollUtil.isNotEmpty(relBusRequset.getSelectActions())) {
|
|
|
|
|
List<BasicBussinessTypeResponse> basicBussinessTypeResponses = new ArrayList<>();
|
|
|
|
|
relBusRequset.getSelectActions().forEach(action ->
|
|
|
|
|
{
|
|
|
|
|
BasicBussinessTypeResponse basicBussinessTypeResponse = new BasicBussinessTypeResponse();
|
|
|
|
|
basicBussinessTypeResponse.setAction(action);
|
|
|
|
|
basicBussinessTypeResponses.add(basicBussinessTypeResponse);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
warehouseBussinessTypeService.saveWarehouseBussinessType(relBusRequset.getInvCode(), basicBussinessTypeResponses);
|
|
|
|
|
}
|
|
|
|
|
//更新仓库修改时间
|
|
|
|
|
InvWarehouseEntity invWarehouseEntity = invWarehouseService.findByInvSubByCode(relBusRequset.getInvCode());
|
|
|
|
|
DeptEntity pEntity = deptService.selectByCode(invWarehouseEntity.getParentId());
|
|
|
|
|
pEntity.setUpdateTime(new Date());
|
|
|
|
|
deptService.updateInvWarehouse(pEntity);
|
|
|
|
|
return ResultVOUtils.success("修改成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isExitBusType(List<String> selects, WarehouseBussinessTypeEntity warehouseBussinessTypeEntity) {
|
|
|
|
|
for (String busAction : selects) {
|
|
|
|
|
if (warehouseBussinessTypeEntity.getAction().equals(busAction)) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@GetMapping("/udiwms/bussinessType/joinFilter")
|
|
|
|
|
public BaseResponse filterJoinBussinessType(BussinessTypeFilterRequest bussinessTypeFilterRequest,
|
|
|
|
|
BindingResult bindingResult) {
|
|
|
|
|
|
|
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isNotEmpty(bussinessTypeFilterRequest.getIds())) {
|
|
|
|
|
List<String> idList = new ArrayList<>(Arrays.asList(bussinessTypeFilterRequest.getIds().split(",")));
|
|
|
|
|
bussinessTypeFilterRequest.setActionList(idList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if (!StrUtil.isEmpty(bussinessTypeFilterRequest.getFilterAction())) {
|
|
|
|
|
// BussinessLocalTypeEntity bussinessLocalTypeEntity = bussinessLocalTypeService.findBTByAction(bussinessTypeFilterRequest.getFilterAction());
|
|
|
|
|
// if (bussinessLocalTypeEntity.getMainAction().equals(ConstantType.TYPE_PUT)) {
|
|
|
|
|
// bussinessTypeFilterRequest.setMainAction(ConstantType.TYPE_OUT);
|
|
|
|
|
// } else {
|
|
|
|
|
// bussinessTypeFilterRequest.setMainAction(ConstantType.TYPE_PUT);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// bussinessTypeFilterRequest.setAdvanceType(bussinessLocalTypeEntity.isAdvanceType());
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// //查询该仓库绑定的单据
|
|
|
|
|
// List<WarehouseBussinessTypeEntity> warehouseBussinessTypeEntityList = warehouseBussinessTypeService.getListByCode(bussinessTypeFilterRequest.getCode());
|
|
|
|
|
// List<BussinessTypResponse> bussinessTypeEntities;
|
|
|
|
|
// bussinessTypeEntities = bussinessTypeService.filterJoinList(bussinessTypeFilterRequest);
|
|
|
|
|
// for (BussinessTypResponse w1 : bussinessTypeEntities) {
|
|
|
|
|
// for (WarehouseBussinessTypeEntity w2 : warehouseBussinessTypeEntityList) {
|
|
|
|
|
// if (w1.getAction().equals(w2.getAction())) {
|
|
|
|
|
// w1.setCheckSelect(true);
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// PageInfo<BussinessTypResponse> pageInfo;
|
|
|
|
|
// pageInfo = new PageInfo<>(bussinessTypeEntities);
|
|
|
|
|
// PageSimpleResponse<BussinessTypResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
|
// pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
|
// pageSimpleResponse.setList(bussinessTypeEntities);
|
|
|
|
|
// return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/warehouse/inout/delWarehouseUser")
|
|
|
|
|
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
|
|
|
|
public BaseResponse deleteWarehouseUser(Long id) {
|
|
|
|
|
if (null == id)
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
|
|
|
|
WarehouseUserEntity warehouseUserEntity = warehouseUserService.selectById(id);
|
|
|
|
|
|
|
|
|
|
List<InvBusUserEntity> invBusUserEntities = invBusUserService.selectByUnion(warehouseUserEntity.getUserid() + "", warehouseUserEntity.getCode());
|
|
|
|
|
if (CollUtil.isNotEmpty(invBusUserEntities)) {
|
|
|
|
|
return ResultVOUtils.error(500, "已存在该用户关联单据类型,无法删除!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InvWarehouseEntity invSubWarehouseEntity =
|
|
|
|
|
invWarehouseService.findByInvSubByCode(warehouseUserEntity.getCode());
|
|
|
|
|
deptService.updateTime(invSubWarehouseEntity.getParentId(), new Date());
|
|
|
|
|
warehouseUserService.deleteWarehouseUser(id);
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/warehouse/inout/addWarehouseUser")
|
|
|
|
|
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
|
|
|
|
public BaseResponse addWarehouseUser(@RequestBody Map<String, Object> params) {
|
|
|
|
|
String code = String.valueOf(params.get("code"));
|
|
|
|
|
String userListJson = String.valueOf(params.get("userList"));
|
|
|
|
|
if (StrUtil.isBlank(code) || StrUtil.isBlank(userListJson))
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
|
|
|
|
List<AuthAdmin> userList = JSONUtil.toList(userListJson, AuthAdmin.class);
|
|
|
|
|
warehouseUserService.saveWarehouseUser(code, userList);
|
|
|
|
|
InvWarehouseEntity invSubWarehouseEntity =
|
|
|
|
|
invWarehouseService.findByInvSubByCode(code);
|
|
|
|
|
deptService.updateTime(invSubWarehouseEntity.getParentId(), new Date());
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/warehouse/inout/getDeptById")
|
|
|
|
|
public BaseResponse getDeptById(@RequestBody List<Integer> deptIds) {
|
|
|
|
|
List<DeptEntity> list = deptService.getDeptById(deptIds);
|
|
|
|
|
return ResultVOUtils.success(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("spms/sub/inv/unifyWarehouseList")
|
|
|
|
|
public BaseResponse unifyWarehouseList() {
|
|
|
|
|
FilterInvSubWarehouseRequest filterInvSubWarehouseRequest = new FilterInvSubWarehouseRequest();
|
|
|
|
|
filterInvSubWarehouseRequest.setUnifyUse(true);
|
|
|
|
|
filterInvSubWarehouseRequest.setSpUse(true);
|
|
|
|
|
List<InvWarehouseEntity> responses = invWarehouseService.unifyWarehouseList(filterInvSubWarehouseRequest);
|
|
|
|
|
return ResultVOUtils.success(responses);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据仓位码获取关联用户数据
|
|
|
|
|
*/
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/warehouse/inout/warehouseListByCode")
|
|
|
|
|
public BaseResponse warehouseListByCode(@RequestBody @Valid FilterInvLinkDataRequest filterInvLinkDataRequest, BindingResult bindingResult) {
|
|
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
}
|
|
|
|
|
List<CompanyEntity> warehouseUserList = warehouseUserService.warehouseListByCode(filterInvLinkDataRequest);
|
|
|
|
|
PageInfo<CompanyEntity> pageInfo = new PageInfo<>(warehouseUserList);
|
|
|
|
|
PageSimpleResponse<CompanyEntity> response = new PageSimpleResponse<>();
|
|
|
|
|
response.setList(pageInfo.getList());
|
|
|
|
|
response.setTotal(pageInfo.getTotal());
|
|
|
|
|
return ResultVOUtils.success(response);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取医院用户列表
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@GetMapping("/warehouse/inout/selectNotSelectCustomer")
|
|
|
|
|
public BaseResponse selectNotSelectCustomer(FilterInvLinkDataRequest filterInvLinkDataRequest) {
|
|
|
|
|
//获取当前仓库已关联用户
|
|
|
|
|
FilterInvLinkDataRequest temRequest = new FilterInvLinkDataRequest();
|
|
|
|
|
temRequest.setCode(filterInvLinkDataRequest.getCode());
|
|
|
|
|
List<CompanyEntity> companyEntities = warehouseUserService.warehouseListByCode(temRequest);
|
|
|
|
|
List<String> customerIds = new ArrayList<>();
|
|
|
|
|
for (CompanyEntity item : companyEntities) {
|
|
|
|
|
customerIds.add(item.getCustomerId());
|
|
|
|
|
}
|
|
|
|
|
FilterCompanyRequest companyRequest = new FilterCompanyRequest();
|
|
|
|
|
companyRequest.setNotSelectCustomers(customerIds);
|
|
|
|
|
List<CompanyEntity> companyEntities1 = companyService.filterCompany(companyRequest);
|
|
|
|
|
|
|
|
|
|
PageInfo<CompanyEntity> pageInfo = new PageInfo<>(companyEntities1);
|
|
|
|
|
PageSimpleResponse<CompanyEntity> response = new PageSimpleResponse<>();
|
|
|
|
|
response.setTotal(pageInfo.getTotal());
|
|
|
|
|
response.setList(companyEntities1);
|
|
|
|
|
return ResultVOUtils.success(response);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/warehouse/inout/addWarehouseCustomer")
|
|
|
|
|
public BaseResponse addWarehouseCustomer(@RequestBody FilterInvLinkDataRequest filterInvLinkDataRequest) {
|
|
|
|
|
warehouseUserService.addWarehouseCustomer(filterInvLinkDataRequest);
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/warehouse/inout/deleteWarehouseCustomer")
|
|
|
|
|
public BaseResponse deleteWarehouseCustomer(@RequestBody AuthWarehouseUnify authWarehouseUnify) {
|
|
|
|
|
authWarehouseUnifyService.deleteWarehouseCustomer(authWarehouseUnify);
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
}
|
|
|
|
|
}
|