Commit d08b3718 sunke

温湿度设置不生效问题修正

获取看板和库存接口开放
1 个父辈 090d75a6
......@@ -82,14 +82,14 @@ public class DefaultSmfApiListener extends BaseSmfApiListener {
}
}
private String getData(Map<String,Object> dataMap, String dataKey){
Object data = dataMap.get(dataKey);
if(data == null){
return "";
}else{
return data.toString();
}
}
// protected String getData(Map<String,Object> dataMap, String dataKey){
// Object data = dataMap.get(dataKey);
// if(data == null){
// return "";
// }else{
// return data.toString();
// }
// }
@Override
public Barcode canPutIn(String inCheckUrl, Barcode barcode) throws ValidateException {
......
......@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.ReelLockPosUtil;
import com.neotel.smfcore.core.api.SmfApi;
import com.neotel.smfcore.core.api.bean.CodeValidateParam;
......@@ -22,6 +23,7 @@ import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.device.handler.IDeviceHandler;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.message.util.DeviceMessageUtil;
import com.neotel.smfcore.core.msd.bean.MSDSettiings;
import com.neotel.smfcore.core.order.LiteOrderCache;
import com.neotel.smfcore.core.order.service.po.LiteOrder;
import com.neotel.smfcore.core.order.service.po.LiteOrderItem;
......@@ -102,16 +104,26 @@ public class BaseDeviceHandler implements IDeviceHandler {
*/
protected StatusBean handleHumidity(StatusBean statusBean){
if (statusBean.getOp() == OP.ALARM_DATA) {
log.info("获取温湿度报警值");
statusBean.setTemperature(dataCache.getSettings().getMaxTemperature());
statusBean.setHumidity(dataCache.getSettings().getMaxHumidity());
//resultStatus = statusBean;
MSDSettiings msdSettiings = dataCache.getCache(Constants.CACHE_msdSetting);
if (msdSettiings == null){
msdSettiings = new MSDSettiings();
}
Float maxTemperature = msdSettiings.getMaxTemperature();
Float maxHumidity = msdSettiings.getMaxHumidity();
log.info("获取温湿度报警值 maxTemperature["+maxTemperature+"]maxHumidity["+maxHumidity+"]");
statusBean.setTemperature(maxTemperature);
statusBean.setHumidity(maxHumidity);
return statusBean;
} else if (dataCache.needUpdateHumidiy(statusBean.getCid())) {
log.info("发送温湿度报警值");
statusBean.setTemperature(dataCache.getSettings().getMaxTemperature());
statusBean.setHumidity(dataCache.getSettings().getMaxHumidity());
//resultStatus = statusBean;
MSDSettiings msdSettiings = dataCache.getCache(Constants.CACHE_msdSetting);
if (msdSettiings == null){
msdSettiings = new MSDSettiings();
}
Float maxTemperature = msdSettiings.getMaxTemperature();
Float maxHumidity = msdSettiings.getMaxHumidity();
log.info("发送温湿度报警值 maxTemperature["+maxTemperature+"]maxHumidity["+maxHumidity+"]");
statusBean.setTemperature(maxTemperature);
statusBean.setHumidity(maxHumidity);
return statusBean;
}
return null;
......
......@@ -26,6 +26,7 @@ import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.service.po.Humiture;
import com.neotel.smfcore.core.system.util.DevicesStatusUtil;
import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import com.neotel.smfcore.security.annotation.AnonymousPutMapping;
import com.neotel.smfcore.security.service.manager.IGroupManager;
import com.neotel.smfcore.security.service.manager.impl.GroupManagerImpl;
......@@ -56,7 +57,6 @@ import java.util.regex.Pattern;
@RestController
@RequiredArgsConstructor
@Api(tags = "BOX看板")
@RequestMapping("api/boxkanban")
public class BoxKanbanController {
@Autowired
......@@ -75,38 +75,30 @@ public class BoxKanbanController {
IStoragePosManager storagePosManager;
@ApiOperation("获取看板数据")
@GetMapping
@PreAuthorize("@el.check('boxkanban:info')")
public BoxKanbanDto info(HttpServletRequest servletRequest) {
@RequestMapping(value = "/rest/api/mes/boxInfo")
@ResponseBody
@AnonymousAccess
public BoxKanbanDto boxInfo(HttpServletRequest servletRequest){
List<Group> allGroup = groupManager.findAll();
allGroup.add(Group.defaulGroup());
Locale locale = servletRequest.getLocale();
return getGroupDto(allGroup,locale);
}
private BoxKanbanDto getGroupDto(List<Group> groupList,Locale locale){
List<DataLog> allTasks=taskService.getAllTasks();
BoxKanbanDto boxKanbanDto = getKanBan(allTasks,servletRequest.getLocale());
String userId = SecurityUtils.getCurrentUserId();
User user = userManager.get(userId);
Set<String> mygroups = user.getGroups();
mygroups.add("");
BoxKanbanDto boxKanbanDto = getKanBan(allTasks,locale);
ArrayList<GroupStatusDto> groupStatusDtos = new ArrayList<>();
for (String groupid : mygroups) {
Group group = groupManager.get(groupid);
if (group == null) {
if(groupid.equals("")){
group=Group.defaulGroup();
}else
{
continue;
}
}
for (Group group : groupList) {
List<BoxStatusDto> boxStatusDtos = new ArrayList<>();
List<String> cidList =dataCache. getCidsByGroupId(groupid, false);
List<String> cidList =dataCache. getCidsByGroupId(group.getId(), false);
int groupType=0;
for (String cid : cidList) {
Storage storage=dataCache.getStorage(cid);
if(storage==null){
continue;
}
boxStatusDtos.add(getBoxDto(storage,allTasks,servletRequest.getLocale()));
boxStatusDtos.add(getBoxDto(storage,allTasks,locale));
if(storage.isNLPShelf()){
groupType=1;
}
......@@ -120,8 +112,29 @@ public class BoxKanbanController {
return boxKanbanDto;
}
@ApiOperation("获取看板数据")
@GetMapping("api/boxkanban")
@PreAuthorize("@el.check('boxkanban:info')")
public BoxKanbanDto info(HttpServletRequest servletRequest) {
List<Group> groupList = new ArrayList<>();
groupList.add(Group.defaulGroup());
Locale locale = servletRequest.getLocale();
String userId = SecurityUtils.getCurrentUserId();
User user = userManager.get(userId);
if(user != null){
for (String groupid : user.getGroups()) {
Group group = groupManager.get(groupid);
if(group != null){
groupList.add(group);
}
}
}
return getGroupDto(groupList,locale);
}
@ApiOperation("查询看板任务列表")
@GetMapping("/task")
@GetMapping("api/boxkanban/task")
@PreAuthorize("@el.check('boxkanban:list')")
public PageData<BoxTaskDto> info(BoxTaskQueryCriter criteria, Pageable pageable) {
if(criteria.getType()!=null &&criteria.getType().equals(0) ){
......@@ -246,7 +259,7 @@ public class BoxKanbanController {
}
@ApiOperation("料仓详情")
@GetMapping("/boxView")
@GetMapping("api/boxkanban/boxView")
@PreAuthorize("@el.check('boxkanban:boxView')")
public BoxStatusDto boxView(String id,HttpServletRequest servletRequest) {
List<DataLog> allTasks=taskService.getAllTasks();
......@@ -259,7 +272,7 @@ public class BoxKanbanController {
}
@ApiOperation("保存界面的一些操作")
@AnonymousPutMapping("/saveOp")
@AnonymousPutMapping("api/boxkanban/saveOp")
public ResultBean saveOp(@RequestBody Map<String,String> params) {
String cid = params.get("cid");
if(!Strings.isNullOrEmpty(cid)){
......@@ -273,7 +286,7 @@ public class BoxKanbanController {
}
@ApiOperation("获取料架库位报警列表")
@GetMapping("/shelfPosErrors")
@GetMapping("api/boxkanban/shelfPosErrors")
@PreAuthorize("@el.check('boxkanban:list')")
public List<ShelfPosErrorDto> shelfPosErrors(String storageId,String groupId) {
// String storageId=map.get("storageId");
......@@ -362,7 +375,7 @@ public class BoxKanbanController {
@ApiOperation("清除报警库位物料")
@PutMapping("/clearPos")
@PutMapping("api/boxkanban/clearPos")
@PreAuthorize("@el.check('storagePos:edit')")
public ResultBean clearPos(@RequestBody String posName) {
......
......@@ -3,6 +3,7 @@ package com.neotel.smfcore.core.report;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.kanban.rest.bean.dto.BoxKanbanDto;
import com.neotel.smfcore.core.report.bean.ChartItem;
import com.neotel.smfcore.core.report.rest.dto.InoutDataDto;
import com.neotel.smfcore.core.report.rest.dto.InventoryBoxDto;
......@@ -12,6 +13,7 @@ import com.neotel.smfcore.core.report.rest.query.ReportQuery;
import com.neotel.smfcore.core.storage.bean.UsageItem;
import com.neotel.smfcore.core.storage.service.manager.IStorageManager;
import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import com.neotel.smfcore.security.service.manager.IGroupManager;
import com.neotel.smfcore.security.service.manager.IUserManager;
import com.neotel.smfcore.security.service.po.Group;
......@@ -24,23 +26,21 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
@Slf4j
@RestController
@RequiredArgsConstructor
@Api(tags = "报表:出入库、库存")
@RequestMapping("api/report")
public class ReportController {
@Autowired
private IStorageManager storageManager;
@Autowired
private ChartItemMapper chartItemMapper;
@Autowired
private IUserManager userManager;
@Autowired
......@@ -49,14 +49,28 @@ public class ReportController {
@Autowired
DataCache dataCache;
@RequestMapping(value = "/rest/api/mes/inOutData")
@ResponseBody
@AnonymousAccess
public InoutDataDto mesInOutData(ReportQuery query){
return inOutData(query);
}
@RequestMapping(value = "/rest/api/mes/inventory")
@ResponseBody
@AnonymousAccess
public List<InventoryGroupDto> mesInventory(ReportQuery query){
return inventory();
}
@ApiOperation("获取出入库数据")
@GetMapping(value = "/inOutData")
@GetMapping(value = "api/report/inOutData")
@PreAuthorize("@el.check('inOutData')")
public InoutDataDto inOutData(ReportQuery query) {
Date startDay = query.getUpdateDate().getFrom();
Date endDay = query.getUpdateDate().getTo();
if (startDay == null) {
Calendar c = Calendar.getInstance();
//过去七天
......@@ -68,12 +82,13 @@ public class ReportController {
endDay = new Date();
}
String pn = query.getPn();
List<ChartItem> chartItemList = storageManager.getRunStatusData(startDay, endDay, pn);
InoutDataDto dto = new InoutDataDto();
for (ChartItem item :
chartItemList) {
for (ChartItem item :chartItemList) {
dto.getLabelList().add(item.getLabel());
dto.getPutInValueList().add(item.getPutInValue());
dto.getCheckOutValueList().add(item.getCheckOutValue());
......@@ -82,26 +97,17 @@ public class ReportController {
}
@ApiOperation("获取库存数据")
@GetMapping(value = "/inventory")
@GetMapping(value = "api/report/inventory")
@PreAuthorize("@el.check('inventory')")
public List<InventoryGroupDto> inventory() {
String userId = SecurityUtils.getCurrentUserId();
User user = userManager.get(userId);
Set<String> mygroups = user.getGroups();
mygroups.add("");
ArrayList<InventoryGroupDto> groupDtos = new ArrayList<>();
for (String groupid : mygroups) {
Group group = groupManager.get(groupid);
if (group == null) {
if (groupid.equals("")) {
group = Group.defaulGroup();
} else {
continue;
}
}
List<InventoryGroupDto> groupDtos = new ArrayList<>();
List<Group> allGroup = groupManager.findAll();
allGroup.add(Group.defaulGroup());
for (Group group : allGroup) {
List<InventoryBoxDto> boxDtos = new ArrayList<>();
List<String> cidList = dataCache.getCidsByGroupId(groupid, false);
List<String> cidList = dataCache.getCidsByGroupId(group.getId(), false);
for (String cid : cidList) {
Storage storage = dataCache.getStorage(cid);
if (storage == null) {
......
......@@ -124,14 +124,14 @@ public class NeotelApi extends BaseSmfApiListener {
}
}
private static String getData(Map<String, Object> dataMap, String dataKey) {
Object data = dataMap.get(dataKey);
if (data == null) {
return "";
} else {
return data.toString();
}
}
// private static String getData(Map<String, Object> dataMap, String dataKey) {
// Object data = dataMap.get(dataKey);
// if (data == null) {
// return "";
// } else {
// return data.toString();
// }
// }
// public static void main(String[] args) {
// CodeValidateParam param = new CodeValidateParam("","","","=7x8=SU300PH51CM","");
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!