Commit 9e5d104a LN

Merge remote-tracking branch 'origin/master'

2 个父辈 19775fb0 c889840c
......@@ -175,4 +175,12 @@ public class QueryHelp {
return keyword;
}
public static List<String> getGroupStorageIdList(List<String> storageIdList) {
//增加用户所属分组id
if (storageIdList != null && !storageIdList.isEmpty() && !storageIdList.contains("0")) {
return storageIdList;
} else {
return SecurityUtils.getUserGroupStorageId();
}
}
}
......@@ -166,4 +166,27 @@ public class SecurityUtils {
}
return resultList;
}
/**
* 获取当前用户分组对应料仓cid
*
* @return
*/
public static List<String> getUserGroupCid() {
List<String> resultList = new ArrayList<>();
String username = getLoginUsername();
User user = userManager.findByUserName(username);
List<Storage> storageList = storageManager.findAll();
if (user != null && user.getGroups() != null && !user.getGroups().isEmpty()) {
for (Storage storage : storageList) {
if (user.getGroups().contains(storage.getGroupId())) {
resultList.add(storage.getCid());
}
}
} else {
resultList = storageList.stream().map(item -> item.getCid()).collect(Collectors.toList());
}
return resultList;
}
}
......@@ -50,6 +50,11 @@ public class HumitureController {
Float maxTemperature = msdSettiings.getMaxTemperature();
Float maxHumidity = msdSettiings.getMaxHumidity();
Float minTemperature=msdSettiings.getMinTemperature();
List<String> cids = criteria.getCids();
if (cids == null || cids.isEmpty()){
criteria.setCids(SecurityUtils.getUserGroupCid());
}
Query query = QueryHelp.getQuery(criteria);
query.with(Sort.by(Sort.Direction.ASC, "createDate"));
query.addCriteria(Criteria.where("temperature").ne("0"));
......@@ -80,6 +85,10 @@ public class HumitureController {
}
Float maxTemperature = msdSettiings.getMaxTemperature();
Float maxHumidity = msdSettiings.getMaxHumidity();
List<String> cids = criteria.getCids();
if (cids == null || cids.isEmpty()){
criteria.setCids(SecurityUtils.getUserGroupCid());
}
Query query = QueryHelp.getQuery(criteria);
query.with(Sort.by(Sort.Direction.ASC, "createDate"));
query.addCriteria(Criteria.where("temperature").ne("0"));
......
......@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.neotel.smfcore.common.bean.BetweenData;
import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.inout.service.manager.IInOutDataManager;
......@@ -169,12 +170,7 @@ public class ReportController {
startDate = DateUtil.offsetDay(endDate, -7);
}
//增加用户所属分组id
List<String> storageIdList;
if (query.getStorageIdList() != null && !query.getStorageIdList().isEmpty() && !query.getStorageIdList().contains("0")){
storageIdList = query.getStorageIdList();
} else {
storageIdList = SecurityUtils.getUserGroupStorageId();
}
List<String> storageIdList = QueryHelp.getGroupStorageIdList(query.getStorageIdList());
//判断相差小时数,是否超过48小时
long between = DateUtil.between(startDate, endDate, DateUnit.HOUR);
List<InOutData> inOutDataList = inOutDataManager.findByDate(startDate, endDate, storageIdList);
......
......@@ -80,6 +80,7 @@ public class MaterialController {
@GetMapping(value = "/inventory/download")
@PreAuthorize("@el.check('tacticsOuput')")
public void inventoryDownload(HttpServletResponse response, InventoryQueryCriteria criteria,Pageable pageable, Locale locale)throws IOException {
criteria.setStorageIdList(QueryHelp.getGroupStorageIdList(criteria.getStorageIdList()));
List<InventoryItemDto> list = getInventory(criteria,pageable);
String partNumberStr= MessageUtils.getText("smfcore.inventory.partNumber",locale,"物料编号");
......@@ -149,6 +150,7 @@ public class MaterialController {
@GetMapping(value = "/inventory")
@PreAuthorize("@el.check('tacticsOuput')")
public ResponseEntity<List<InventoryItemDto>> inventory(InventoryQueryCriteria criteria,Pageable pageable, HttpServletRequest request) {
criteria.setStorageIdList(QueryHelp.getGroupStorageIdList(criteria.getStorageIdList()));
List<InventoryItemDto> dtoList = getInventory(criteria,pageable);
return new ResponseEntity<>(dtoList, HttpStatus.OK);
}
......
......@@ -217,6 +217,7 @@ public class MaterialStockController {
if (criteria.getStorageId() != null && criteria.getStorageId().equals("0")) {
criteria.setStorageId(null);
}
criteria.setStorageIdList(QueryHelp.getGroupStorageIdList(criteria.getStorageIdList()));
Query query = QueryHelp.getQuery(criteria);
Criteria baseCriteria = Criteria.where("used").is(true);
......
......@@ -158,13 +158,17 @@ public class StorageController {
User user = userManager.get(userId);
mygroups = user.getGroups();
}
mygroups.add("");
//mygroups.add("");
List<Storage> allStorages = storageManager.findAll();
List<Storage> myStorages = new ArrayList<>();
for (Storage s : allStorages
) {
if (mygroups.contains(s.getGroupId())) {
if (mygroups != null && !mygroups.isEmpty()) {
if (mygroups.contains(s.getGroupId())) {
myStorages.add(s);
}
} else {
myStorages.add(s);
}
}
......
......@@ -93,6 +93,7 @@ public class StoragePosController {
if (criteria.getStorageIdList() != null && criteria.getStorageIdList().contains("0")) {
criteria.setStorageIdList(null);
}
criteria.setStorageIdList(QueryHelp.getGroupStorageIdList(criteria.getStorageIdList()));
String blurry = criteria.getBlurry();
if(!Strings.isNullOrEmpty(blurry)){
//去除库位中的SOxxxx
......@@ -325,6 +326,9 @@ public class StoragePosController {
if (ObjectUtil.isNotEmpty(criteria.getStorageId()) && criteria.getStorageId().equals("0")) {
criteria.setStorageId(null);
}
criteria.setStorageIdList(QueryHelp.getGroupStorageIdList(criteria.getStorageIdList()));
Query query = QueryHelp.getQuery(criteria);
Criteria baseCriteria = Criteria.where("used").is(true);
......
......@@ -9,6 +9,7 @@ import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.language.service.nanager.ILanguageMsgManager;
......@@ -84,7 +85,9 @@ public class TaskController {
criteria.setStatus(null);
finished=true;
}
if (StringUtils.isBlank(criteria.getStorageId())){
criteria.setStorageIdList(SecurityUtils.getUserGroupStorageId());
}
Query query = QueryHelp.getQuery(criteria);
if (unEnd) {
query.addCriteria(Criteria.where("status").nin(OP_STATUS.END.name(), OP_STATUS.FINISHED.name()));
......
......@@ -9,6 +9,7 @@ import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
@Data
@ApiModel("查询条件")
......@@ -37,6 +38,9 @@ public class TaskQueryCondition {
@ApiModelProperty("料仓Id")
private String storageId;
@QueryCondition(type = QueryCondition.Type.IN, propName = "storageId")
private List<String> storageIdList;
@QueryCondition
@ApiModelProperty("出入库类型")
private Integer type;
......
......@@ -1003,9 +1003,13 @@ public class TaskService {
public synchronized void tacticsCheckOut(Set<TacticsOutDto> tacticsOutDtos) {
CHECKOUT_TYPE checkoutType = dataCache.getCheckOutType();
List<String> availableStorageIds = dataCache.getAvailableStorageIds();
List<String> availableStorageIds;
List<String> groupStorageId = SecurityUtils.getUserGroupStorageId();
if (groupStorageId != null && !groupStorageId.isEmpty()){
availableStorageIds = groupStorageId;
} else {
availableStorageIds = dataCache.getAvailableStorageIds();
}
//其他出库模式一次性全部生成任务
for (TacticsOutDto item : tacticsOutDtos) {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!