|
|
|
@ -441,20 +441,26 @@ public class InvWarehouseController extends BaseController {
|
|
|
|
|
|
|
|
|
|
//1.先查出已存在关联单据类型
|
|
|
|
|
List<WarehouseBussinessTypeEntity> exitEntitys = warehouseBussinessTypeService.getListByCode(relBusRequset.getInvCode());
|
|
|
|
|
List<WarehouseBussinessTypeEntity> actionList =new ArrayList<>();
|
|
|
|
|
actionList.addAll(exitEntitys);
|
|
|
|
|
//获取关联单据在选入单据的差集
|
|
|
|
|
for (WarehouseBussinessTypeEntity obj:actionList){
|
|
|
|
|
for(String str:relBusRequset.getSelectActions()){
|
|
|
|
|
if(str.equals(obj.getAction())){
|
|
|
|
|
exitEntitys.remove(obj);
|
|
|
|
|
}
|
|
|
|
|
List<WarehouseBussinessTypeEntity> removeLists = new ArrayList<>();
|
|
|
|
|
for (WarehouseBussinessTypeEntity warehouseBussinessTypeEntity : exitEntitys) {
|
|
|
|
|
//2.过滤出被移除单据类型
|
|
|
|
|
if (!isExitBusType(relBusRequset.getSelectActions(), warehouseBussinessTypeEntity)) {
|
|
|
|
|
removeLists.add(warehouseBussinessTypeEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(exitEntitys.size()>0){
|
|
|
|
|
return ResultVOUtils.error(999,"存在用户关联单据!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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<>();
|
|
|
|
|