|
|
|
@ -1,11 +1,18 @@
|
|
|
|
|
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.JSONObject;
|
|
|
|
|
import com.ruoyi.common.core.text.Convert;
|
|
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
|
|
import com.ruoyi.system.domain.BaseLocationInfo;
|
|
|
|
|
import com.ruoyi.system.domain.RecordOutstore;
|
|
|
|
|
import com.ruoyi.system.domain.RecordTask;
|
|
|
|
|
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.EchartsRoot;
|
|
|
|
|
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.IRecordOutstoreService;
|
|
|
|
|
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.Value;
|
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
|
|
|
|
import java.net.InetSocketAddress;
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.*;
|
|
|
|
@ -30,6 +42,7 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 立体库
|
|
|
|
|
*
|
|
|
|
|
* @author WenJY
|
|
|
|
|
* @date 2021年09月22日 16:29
|
|
|
|
|
*/
|
|
|
|
@ -44,33 +57,33 @@ public class NorthWareHouseController {
|
|
|
|
|
|
|
|
|
|
private SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IBaseLocationInfoService baseLocationInfo;
|
|
|
|
|
@Value("${in_id}")
|
|
|
|
|
private int in_id;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IRecordTaskService recordTaskService;
|
|
|
|
|
@Autowired private IBaseLocationInfoService baseLocationInfo;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private BaseLocationInfoRepository baseLocationInfoRepository;
|
|
|
|
|
@Autowired private IRecordTaskService recordTaskService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IRecordOutstoreService recordOutstoreService;
|
|
|
|
|
@Autowired private BaseLocationInfoRepository baseLocationInfoRepository;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMosPrPlanRepository iMosPrPlanRepository;
|
|
|
|
|
@Autowired private IRecordOutstoreService recordOutstoreService;
|
|
|
|
|
|
|
|
|
|
@Autowired private IMosPrPlanRepository iMosPrPlanRepository;
|
|
|
|
|
|
|
|
|
|
@GetMapping()
|
|
|
|
|
public String operlog()
|
|
|
|
|
{
|
|
|
|
|
public String operlog() {
|
|
|
|
|
return prefix;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/getMaterialInfo")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public String getMaterialInfo(){
|
|
|
|
|
public String getMaterialInfo() throws Exception {
|
|
|
|
|
List<List<Object>> materialInfoList = new ArrayList<List<Object>>();
|
|
|
|
|
List<BaseLocationInfo> baseLocationInfoList = baseLocationInfo.selectBaseLocationInfoList(new BaseLocationInfo("A",1L,1L));
|
|
|
|
|
baseLocationInfoList.forEach(x->{
|
|
|
|
|
if (in_id == 1) {
|
|
|
|
|
List<BaseLocationInfo> baseLocationInfoList =
|
|
|
|
|
baseLocationInfo.selectBaseLocationInfoList(new BaseLocationInfo("A", 1L, 1L));
|
|
|
|
|
baseLocationInfoList.forEach(
|
|
|
|
|
x -> {
|
|
|
|
|
x.setLocationName("9002005252");
|
|
|
|
|
x.setRefreshTime(simpleDateFormat.format(x.getRecordTime()));
|
|
|
|
|
materialInfoList.add(
|
|
|
|
@ -90,7 +103,38 @@ 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);
|
|
|
|
|
System.out.println("箱体存放位置信息:" + jsonInfo);
|
|
|
|
|
return jsonInfo;
|
|
|
|
@ -103,10 +147,17 @@ public class NorthWareHouseController {
|
|
|
|
|
EchartsRoot root = new EchartsRoot();
|
|
|
|
|
List<EchartsSeries> seriesList = new ArrayList<>();
|
|
|
|
|
List<String> legendData = new ArrayList<>();
|
|
|
|
|
List<BaseLocationInfo> baseLocationInfoList = baseLocationInfo.selectBaseLocationInfoList(new BaseLocationInfo("A",1L,1L));
|
|
|
|
|
List<String> materialType = baseLocationInfoList.stream().map(BaseLocationInfo::getRemark).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
Map<String,List<BaseLocationInfo>> baselocation = baseLocationInfoList.stream().collect(Collectors.groupingBy(BaseLocationInfo::getLocationArea));
|
|
|
|
|
List<BaseLocationInfo> baseLocationInfoList =
|
|
|
|
|
baseLocationInfo.selectBaseLocationInfoList(new BaseLocationInfo("A", 1L, 1L));
|
|
|
|
|
List<String> materialType =
|
|
|
|
|
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()) {
|
|
|
|
|
EchartsSeries series = new EchartsSeries();
|
|
|
|
@ -116,8 +167,13 @@ public class NorthWareHouseController {
|
|
|
|
|
series.setName(map.getKey() + "#仓库");
|
|
|
|
|
legendData.add(map.getKey() + "#仓库");
|
|
|
|
|
List<BaseLocationInfo> locationInfo = map.getValue();
|
|
|
|
|
materialType.forEach(x->{
|
|
|
|
|
int size = locationInfo.stream().filter(s->s.getRemark().equals(x) ).collect(Collectors.toList()).size();
|
|
|
|
|
materialType.forEach(
|
|
|
|
|
x -> {
|
|
|
|
|
int size =
|
|
|
|
|
locationInfo.stream()
|
|
|
|
|
.filter(s -> s.getRemark().equals(x))
|
|
|
|
|
.collect(Collectors.toList())
|
|
|
|
|
.size();
|
|
|
|
|
materialCount.add(size);
|
|
|
|
|
secondData.add(1);
|
|
|
|
|
});
|
|
|
|
@ -131,12 +187,14 @@ public class NorthWareHouseController {
|
|
|
|
|
root.setSeries(seriesList);
|
|
|
|
|
String info = JSONArray.toJSON(root).toString();
|
|
|
|
|
System.out.println("库存分类统计:" + info);
|
|
|
|
|
|
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/getStoreInfo")
|
|
|
|
|
@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");
|
|
|
|
|
RecordTask recordTaskInfo;
|
|
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
|
@ -144,11 +202,12 @@ public class NorthWareHouseController {
|
|
|
|
|
calendar.setTime(new Date());
|
|
|
|
|
calendar.add(Calendar.HOUR, -12);
|
|
|
|
|
SouthWare southWare = new SouthWare();
|
|
|
|
|
List<BaseLocationInfo> baseLocationInfoList = baseLocationInfo.selectBaseLocationInfoList(new BaseLocationInfo("A",1L,1L));
|
|
|
|
|
Map<String,List<BaseLocationInfo>> baselocation = baseLocationInfoList.stream().collect(Collectors.groupingBy(BaseLocationInfo::getLocationArea));
|
|
|
|
|
List<BaseLocationInfo> baseLocationInfoList =
|
|
|
|
|
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()) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (map.getKey().equals("1")) {
|
|
|
|
|
southWare.setFreeStoreLeftCount(156);
|
|
|
|
|
southWare.setUseStoreLeftCount(map.getValue().size());
|
|
|
|
@ -189,6 +248,31 @@ public class NorthWareHouseController {
|
|
|
|
|
southWare.setInStoreRightCount(recordRightInStore.size());
|
|
|
|
|
southWare.setOutStoreRightCount(recordRightOutStore.size());
|
|
|
|
|
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")
|
|
|
|
@ -198,9 +282,12 @@ public class NorthWareHouseController {
|
|
|
|
|
|
|
|
|
|
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(
|
|
|
|
|
new ArrayList<Object>() {
|
|
|
|
|
{
|
|
|
|
@ -211,7 +298,12 @@ public class NorthWareHouseController {
|
|
|
|
|
if (x.getPlannedProduction() == 0 || x.getActualProduction() == 0) {
|
|
|
|
|
this.add("0%");
|
|
|
|
|
} 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)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
@ -227,16 +319,20 @@ public class NorthWareHouseController {
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public String getOutStoreInfo() {
|
|
|
|
|
List<List<Object>> outPutInfoList = new ArrayList<List<Object>>();
|
|
|
|
|
if(in_id==1){
|
|
|
|
|
RecordOutstore recordOutstore = new RecordOutstore();
|
|
|
|
|
recordOutstore.setStoreCode("A");
|
|
|
|
|
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(
|
|
|
|
|
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.getLocationCode());
|
|
|
|
|
this.add(x.getOperationType().toString().equals("1") ? "自动出库" : "手动出库");
|
|
|
|
@ -244,6 +340,35 @@ public class NorthWareHouseController {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}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);
|
|
|
|
|
|
|
|
|
@ -253,6 +378,7 @@ public class NorthWareHouseController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取总库存
|
|
|
|
|
*
|
|
|
|
|
* @author WenJY
|
|
|
|
|
* @date 2021/11/20 16:26
|
|
|
|
|
* @return java.lang.String
|
|
|
|
@ -262,13 +388,18 @@ public class NorthWareHouseController {
|
|
|
|
|
public String getGather() {
|
|
|
|
|
List<List<Object>> infoList = new ArrayList<List<Object>>();
|
|
|
|
|
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) {
|
|
|
|
|
//
|
|
|
|
|
List<BaseLocationInfo> right = baseLocationInfo.getRight(new BaseLocationInfo(locationInfo.getMaterialType()));
|
|
|
|
|
List<BaseLocationInfo> right =
|
|
|
|
|
baseLocationInfo.getRight(new BaseLocationInfo(locationInfo.getMaterialType()));
|
|
|
|
|
List<Object> loactionInfos = new ArrayList<Object>();
|
|
|
|
|
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.getStoreCode() == "A" ? "北仓库" : "南仓库");
|
|
|
|
|
loactionInfos.add(timeFormat.format(new Date()));
|
|
|
|
@ -280,6 +411,7 @@ public class NorthWareHouseController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取左库库存
|
|
|
|
|
*
|
|
|
|
|
* @author WenJY
|
|
|
|
|
* @date 2021/11/20 16:26
|
|
|
|
|
* @return java.lang.String
|
|
|
|
@ -290,14 +422,21 @@ public class NorthWareHouseController {
|
|
|
|
|
|
|
|
|
|
List<List<Object>> infoList = new ArrayList<List<Object>>();
|
|
|
|
|
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) {
|
|
|
|
|
//
|
|
|
|
|
List<BaseLocationInfo> right = baseLocationInfo.getRight(new BaseLocationInfo(locationInfo.getMaterialType()));
|
|
|
|
|
List<BaseLocationInfo> right =
|
|
|
|
|
baseLocationInfo.getRight(new BaseLocationInfo(locationInfo.getMaterialType()));
|
|
|
|
|
List<Object> loactionInfos = new ArrayList<Object>();
|
|
|
|
|
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.getStoreCode() == "A" ? "北仓库" : "南仓库");
|
|
|
|
|
loactionInfos.add(timeFormat.format(new Date()));
|
|
|
|
@ -311,6 +450,7 @@ public class NorthWareHouseController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取右库库存
|
|
|
|
|
*
|
|
|
|
|
* @author WenJY
|
|
|
|
|
* @date 2021/11/20 16:26
|
|
|
|
|
* @return java.lang.String
|
|
|
|
@ -320,21 +460,116 @@ public class NorthWareHouseController {
|
|
|
|
|
public String getRight() {
|
|
|
|
|
List<List<Object>> infoList = new ArrayList<List<Object>>();
|
|
|
|
|
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) {
|
|
|
|
|
//
|
|
|
|
|
List<BaseLocationInfo> right = baseLocationInfo.getRight(new BaseLocationInfo(locationInfo.getMaterialType()));
|
|
|
|
|
List<BaseLocationInfo> right =
|
|
|
|
|
baseLocationInfo.getRight(new BaseLocationInfo(locationInfo.getMaterialType()));
|
|
|
|
|
List<Object> loactionInfos = new ArrayList<Object>();
|
|
|
|
|
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.getStoreCode() == "A" ? "北仓库" : "南仓库");
|
|
|
|
|
loactionInfos.add(timeFormat.format(new Date()));
|
|
|
|
|
|
|
|
|
|
infoList.add(loactionInfos);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 将xml转换为JSON对象
|
|
|
|
|
*
|
|
|
|
|
* @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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|