|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.glxp.api.controller.basic;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
@ -13,7 +14,9 @@ import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
|
import com.glxp.api.constant.BusinessType;
|
|
|
|
|
import com.glxp.api.constant.ConstantType;
|
|
|
|
|
import com.glxp.api.controller.BaseController;
|
|
|
|
|
import com.glxp.api.entity.auth.WarehouseBussinessTypeEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.BasicBussinessTypeEntity;
|
|
|
|
|
import com.glxp.api.req.auth.FilterInvBusTypeRequest;
|
|
|
|
|
import com.glxp.api.req.basic.BusNoUserRequest;
|
|
|
|
|
import com.glxp.api.req.basic.BussinessTypeSaveRequest;
|
|
|
|
|
import com.glxp.api.req.basic.FilterBussinessTypeRequest;
|
|
|
|
@ -23,7 +26,10 @@ import com.glxp.api.res.basic.BasicBussinessTypeResponse;
|
|
|
|
|
import com.glxp.api.res.basic.BussinessTypExportResponse;
|
|
|
|
|
import com.glxp.api.res.basic.CandidateRequest;
|
|
|
|
|
import com.glxp.api.service.auth.CustomerService;
|
|
|
|
|
import com.glxp.api.service.auth.InvBusUserService;
|
|
|
|
|
import com.glxp.api.service.auth.WarehouseBussinessTypeService;
|
|
|
|
|
import com.glxp.api.service.basic.IBasicBussinessTypeService;
|
|
|
|
|
import com.glxp.api.service.inout.IoOrderService;
|
|
|
|
|
import com.glxp.api.util.CustomUtil;
|
|
|
|
|
import com.glxp.api.util.FileUtils;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
@ -54,6 +60,8 @@ public class BasicBussinessTypeController extends BaseController {
|
|
|
|
|
private IBasicBussinessTypeService basicBussinessTypeService;
|
|
|
|
|
@Resource
|
|
|
|
|
private CustomerService customerService;
|
|
|
|
|
@Resource
|
|
|
|
|
WarehouseBussinessTypeService warehouseBussinessTypeService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询单据类型列表
|
|
|
|
@ -185,12 +193,33 @@ public class BasicBussinessTypeController extends BaseController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(bussinessTypeFilterRequest.getVueType())) {
|
|
|
|
|
List<BasicBussinessTypeEntity> result = new ArrayList<>();
|
|
|
|
|
List<BasicBussinessTypeEntity> bussinessTypeEntities = basicBussinessTypeService.findByVueType(bussinessTypeFilterRequest.getVueType());
|
|
|
|
|
if (StrUtil.isNotEmpty(bussinessTypeFilterRequest.getInvCode()) || StrUtil.isNotEmpty(bussinessTypeFilterRequest.getCode())) {
|
|
|
|
|
//过滤是否是当前仓库底下单据类型
|
|
|
|
|
FilterBussinessTypeRequest tempRequest = new FilterBussinessTypeRequest();
|
|
|
|
|
tempRequest.setCode(bussinessTypeFilterRequest.getCode());
|
|
|
|
|
tempRequest.setInvCode(bussinessTypeFilterRequest.getInvCode());
|
|
|
|
|
List<BasicBussinessTypeResponse> bussinessTypeResponses = basicBussinessTypeService.filterJoinByInv(tempRequest);
|
|
|
|
|
if (CollUtil.isNotEmpty(bussinessTypeResponses)) {
|
|
|
|
|
for (BasicBussinessTypeResponse bussinessTypExportResponse : bussinessTypeResponses) {
|
|
|
|
|
for (BasicBussinessTypeEntity basicBussinessTypeEntity : bussinessTypeEntities) {
|
|
|
|
|
if (bussinessTypExportResponse.getAction().equals(basicBussinessTypeEntity.getAction())) {
|
|
|
|
|
result.add(basicBussinessTypeEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
result.addAll(bussinessTypeEntities);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PageInfo<BasicBussinessTypeEntity> pageInfo;
|
|
|
|
|
pageInfo = new PageInfo<>(bussinessTypeEntities);
|
|
|
|
|
pageInfo = new PageInfo<>(result);
|
|
|
|
|
PageSimpleResponse<BasicBussinessTypeEntity> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
|
pageSimpleResponse.setList(bussinessTypeEntities);
|
|
|
|
|
pageSimpleResponse.setList(result);
|
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
@ -202,10 +231,10 @@ public class BasicBussinessTypeController extends BaseController {
|
|
|
|
|
bussinessTypeFilterRequest);
|
|
|
|
|
} else {
|
|
|
|
|
//当前用户为供应商,查询单据类型添加允许供应商使用参数
|
|
|
|
|
if (bussinessTypeFilterRequest.getSpUse() == null)
|
|
|
|
|
if (bussinessTypeFilterRequest.getSpUse() == null) {
|
|
|
|
|
bussinessTypeFilterRequest.setSpUse(3);
|
|
|
|
|
bussinessTypeEntities = basicBussinessTypeService.filterJoinByInv(
|
|
|
|
|
bussinessTypeFilterRequest);
|
|
|
|
|
}
|
|
|
|
|
bussinessTypeEntities = basicBussinessTypeService.filterJoinByInv(bussinessTypeFilterRequest);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -220,6 +249,10 @@ public class BasicBussinessTypeController extends BaseController {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
IoOrderService orderService;
|
|
|
|
|
@Resource
|
|
|
|
|
InvBusUserService invBusUserService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除单据类型
|
|
|
|
@ -238,21 +271,24 @@ public class BasicBussinessTypeController extends BaseController {
|
|
|
|
|
String id = deleteRequest.getId();
|
|
|
|
|
BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.selectById(id);
|
|
|
|
|
|
|
|
|
|
//TODO 单据使用绑定和仓库绑定校验未做,等其他模块功能做完之后进行完善
|
|
|
|
|
/*OrderFilterRequest orderFilterRequest = new OrderFilterRequest();
|
|
|
|
|
orderFilterRequest.setAction(bussinessTypeEntity.getAction());
|
|
|
|
|
OrderEntity orderEntity = orderService.findOne(orderFilterRequest);
|
|
|
|
|
if (orderEntity != null) {
|
|
|
|
|
//判断是否存在该单据类型单据
|
|
|
|
|
boolean isExitOrder = orderService.isExitByAction(bussinessTypeEntity.getAction());
|
|
|
|
|
if (isExitOrder) {
|
|
|
|
|
return ResultVOUtils.error(500, "已存在该类型扫码单据,无法删除!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//判断是否被仓库绑定
|
|
|
|
|
boolean isExitUser = invBusUserService.isExitByAction(bussinessTypeEntity.getAction());
|
|
|
|
|
if (isExitUser) {
|
|
|
|
|
return ResultVOUtils.error(500, "该单据类型已被用户绑定,请先移除后删除!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//判断是否被用户绑定
|
|
|
|
|
boolean isExitInv = warehouseBussinessTypeService.isExitByAction(bussinessTypeEntity.getAction());
|
|
|
|
|
if (isExitInv) {
|
|
|
|
|
return ResultVOUtils.error(500, "该单据类型已被仓库绑定,请先移除后删除!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FilterInvBusTypeRequest filterInvBusTypeRequest = new FilterInvBusTypeRequest();
|
|
|
|
|
filterInvBusTypeRequest.setAction(bussinessTypeEntity.getAction());
|
|
|
|
|
List<WarehouseBussinessTypeEntity> warehouseBussinessTypeEntities = warehouseBussinessTypeService.filterList(filterInvBusTypeRequest);
|
|
|
|
|
if (CollUtil.isNotEmpty(warehouseBussinessTypeEntities)) {
|
|
|
|
|
return ResultVOUtils.error(500, "单据类型已被仓库分库绑定,无法删除");
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
return basicBussinessTypeService.deleteBussinessType(id) == true ? ResultVOUtils.success("删除成功") : ResultVOUtils.error(500, "删除失败,系统繁忙");
|
|
|
|
|
}
|
|
|
|
|