Commit d08b3718 sunke

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

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