kpi分析
This commit is contained in:
@@ -193,7 +193,7 @@ public class CheckDifferenceRecordController extends BaseController {
|
||||
//查询是否存在空料箱库存数
|
||||
BasStock queryStock = new BasStock();
|
||||
queryStock.setTrayCode(record.getTrayCode());
|
||||
queryStock.setProductId("KTP000001");
|
||||
queryStock.setProductId("KTP0001");
|
||||
List<BasStock> stocks = basStockService.selectBasStockList(queryStock);
|
||||
if (!stocks.isEmpty()){
|
||||
basStockService.deleteBasStockByStockId(stocks.get(0).getStockId());
|
||||
@@ -221,8 +221,8 @@ public class CheckDifferenceRecordController extends BaseController {
|
||||
BasWarehouse basWarehouse = basWarehouseService.selectBasWarehouseByWarehouseId(record.getWarehouseId());
|
||||
if (stocks2.isEmpty() && ("1".equals(basWarehouse.getWarehouseType()) || "2".equals(basWarehouse.getWarehouseType()))) {
|
||||
BasStock basStock = stocks.get(0);
|
||||
basStock.setProductId("KTP000001");
|
||||
basStock.setProductGuid("KTP000001");
|
||||
basStock.setProductId("KTP0001");
|
||||
basStock.setProductGuid("KTP0001");
|
||||
basStock.setQuantity("1");
|
||||
basStock.setStockStatus("1");
|
||||
basStock.setOutQuantity("0");
|
||||
|
||||
@@ -131,6 +131,26 @@ public class MydoJob extends BaseEntity
|
||||
|
||||
private List<String> inOutIds;
|
||||
|
||||
private String createLeftTime;
|
||||
private String createRightTime;
|
||||
|
||||
|
||||
public String getCreateLeftTime() {
|
||||
return createLeftTime;
|
||||
}
|
||||
|
||||
public void setCreateLeftTime(String createLeftTime) {
|
||||
this.createLeftTime = createLeftTime;
|
||||
}
|
||||
|
||||
public String getCreateRightTime() {
|
||||
return createRightTime;
|
||||
}
|
||||
|
||||
public void setCreateRightTime(String createRightTime) {
|
||||
this.createRightTime = createRightTime;
|
||||
}
|
||||
|
||||
public List<String> getInOutIds() {
|
||||
return inOutIds;
|
||||
}
|
||||
|
||||
@@ -6,9 +6,11 @@ import com.ruoyi.kpi.service.KpiService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* KPI 统计分析
|
||||
*
|
||||
*
|
||||
* @author gw
|
||||
* @date 2025-05-21
|
||||
*/
|
||||
@@ -20,7 +22,7 @@ public class KpiController extends BaseController {
|
||||
|
||||
/**
|
||||
* 获取入库均匀分析数据
|
||||
*
|
||||
*
|
||||
* @param warehouseId 仓库ID
|
||||
* @param yearMonth 年月,格式:yyyy-MM
|
||||
* @return 入库均匀分析数据
|
||||
@@ -31,6 +33,19 @@ public class KpiController extends BaseController {
|
||||
return success(kpiService.getInAnalysis(warehouseId, yearMonth));
|
||||
}
|
||||
|
||||
/**
|
||||
* 按时间维度获取入库均匀分析数据
|
||||
* @param warehouseId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/inAnalysisByData")
|
||||
public AjaxResult getInAnalysisByData(@RequestParam(required = false) String warehouseId,
|
||||
@RequestParam String startTime,
|
||||
@RequestParam String endTime,
|
||||
@RequestParam String inOut) {
|
||||
return kpiService.getInAnalysisByData(warehouseId, startTime,endTime,inOut);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取出库均匀分析数据
|
||||
*
|
||||
@@ -126,4 +141,4 @@ public class KpiController extends BaseController {
|
||||
return success(kpiService.getChartMag(warehouseId,theColumn,theFloor,thePlatoon));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
package com.ruoyi.kpi.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* KPI 统计分析服务
|
||||
*
|
||||
*
|
||||
* @author gw
|
||||
* @date 2025-05-21
|
||||
*/
|
||||
public interface KpiService {
|
||||
/**
|
||||
* 获取入库均匀分析数据
|
||||
*
|
||||
*
|
||||
* @param warehouseId 仓库ID
|
||||
* @param yearMonth 年月,格式:yyyy-MM
|
||||
* @return 入库均匀分析数据,包含每个巷道的入库数量
|
||||
@@ -22,7 +25,7 @@ public interface KpiService {
|
||||
|
||||
/**
|
||||
* 获取巷道均匀分析数据
|
||||
*
|
||||
*
|
||||
* @param warehouseId 仓库ID
|
||||
* @param startTime 开始时间,格式:yyyy-MM-dd HH:mm:ss
|
||||
* @param endTime 结束时间,格式:yyyy-MM-dd HH:mm:ss
|
||||
@@ -44,4 +47,5 @@ public interface KpiService {
|
||||
Map<String,Object> getChartMag(String warehouseId, String theColumn, String theFloor, String thePlatoon);
|
||||
|
||||
|
||||
}
|
||||
AjaxResult getInAnalysisByData(String warehouseId, String startTime, String endTime,String inOut);
|
||||
}
|
||||
|
||||
@@ -2,8 +2,14 @@ package com.ruoyi.kpi.service.impl;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.ruoyi.bas.cargoSpace.domain.BasCargoSpace;
|
||||
import com.ruoyi.bas.cargoSpace.mapper.BasCargoSpaceMapper;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.job.mydojob.domain.MydoJob;
|
||||
import com.ruoyi.job.mydojobfinish.domain.MydoJobFinish;
|
||||
import com.ruoyi.job.mydojobfinish.mapper.MydoJobFinishMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -35,13 +41,13 @@ public class KpiServiceImpl implements KpiService
|
||||
@Override
|
||||
public Map<String, Object> getInAnalysis(String warehouseId, String yearMonth)
|
||||
{
|
||||
MydoJobFinish mydoJobFinish = new MydoJobFinish();
|
||||
MydoJob mydoJob = new MydoJob();
|
||||
|
||||
List<MydoJobFinish> list = mydoJobFinishMapper.selectMydoJobFinishList(mydoJobFinish);
|
||||
List<MydoJob> list = mydoJobFinishMapper.selectMydoJobFinishListByMydoJob(mydoJob);
|
||||
|
||||
Map<String, Integer> roadwayCount = new HashMap<>();
|
||||
|
||||
for (MydoJobFinish job : list) {
|
||||
for (MydoJob job : list) {
|
||||
// 检查入库作业标识是否小于10
|
||||
if (job.getInOrOut() == null || Integer.parseInt(job.getInOrOut()) >= 20) {
|
||||
continue;
|
||||
@@ -281,12 +287,12 @@ public class KpiServiceImpl implements KpiService
|
||||
@Override
|
||||
public Map<String, Object> getRoadways(String warehouseId){
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
|
||||
|
||||
// 查询指定仓库的巷道信息
|
||||
BasCargoSpace queryParams = new BasCargoSpace();
|
||||
queryParams.setWarehouseId(warehouseId);
|
||||
List<BasCargoSpace> list = basCargoSpaceMapper.selectBasCargoSpaceList(queryParams);
|
||||
|
||||
|
||||
// 使用Set去重并排序巷道ID
|
||||
Set<String> roadwaySet = new TreeSet<>();
|
||||
for (BasCargoSpace space : list) {
|
||||
@@ -294,7 +300,7 @@ public class KpiServiceImpl implements KpiService
|
||||
roadwaySet.add(space.getRoadwayId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 转换为前端下拉框所需的格式
|
||||
List<Map<String, String>> roadways = new ArrayList<>();
|
||||
for (String roadwayId : roadwaySet) {
|
||||
@@ -303,7 +309,7 @@ public class KpiServiceImpl implements KpiService
|
||||
roadway.put("label", "巷道" + roadwayId);
|
||||
roadways.add(roadway);
|
||||
}
|
||||
|
||||
|
||||
response.put("data", roadways);
|
||||
return response;
|
||||
}
|
||||
@@ -311,13 +317,13 @@ public class KpiServiceImpl implements KpiService
|
||||
@Override
|
||||
public Map<String,Object> getPlatoons(String warehouseId, String roadwayId){
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
|
||||
|
||||
// 查询指定仓库和巷道的排号信息
|
||||
BasCargoSpace queryParams = new BasCargoSpace();
|
||||
queryParams.setWarehouseId(warehouseId);
|
||||
queryParams.setRoadwayId(roadwayId);
|
||||
List<BasCargoSpace> list = basCargoSpaceMapper.selectBasCargoSpaceList(queryParams);
|
||||
|
||||
|
||||
// 使用TreeSet去重并排序排号
|
||||
Set<Long> platoonSet = new TreeSet<>();
|
||||
for (BasCargoSpace space : list) {
|
||||
@@ -325,7 +331,7 @@ public class KpiServiceImpl implements KpiService
|
||||
platoonSet.add(space.getThePlatoon());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 转换为前端下拉框所需的格式
|
||||
List<Map<String, String>> platoons = new ArrayList<>();
|
||||
for (Long platoon : platoonSet) {
|
||||
@@ -334,7 +340,7 @@ public class KpiServiceImpl implements KpiService
|
||||
platoonMap.put("label", platoon + "排");
|
||||
platoons.add(platoonMap);
|
||||
}
|
||||
|
||||
|
||||
response.put("data", platoons);
|
||||
return response;
|
||||
}
|
||||
@@ -349,7 +355,7 @@ public class KpiServiceImpl implements KpiService
|
||||
queryParams.setThePlatoon(Long.parseLong(thePlatoon));
|
||||
}
|
||||
List<BasCargoSpace> list = basCargoSpaceMapper.selectBasCargoSpaceList(queryParams);
|
||||
|
||||
|
||||
// 用于存储不同状态的货位坐标
|
||||
String empty = "";
|
||||
String full = "";
|
||||
@@ -357,17 +363,17 @@ public class KpiServiceImpl implements KpiService
|
||||
String outAllot = "";
|
||||
String inCheck = "";
|
||||
String outCheck = "";
|
||||
|
||||
|
||||
// 用于存储列和层的集合
|
||||
Set<Long> columnSet = new TreeSet<>();
|
||||
Set<Long> floorSet = new TreeSet<>();
|
||||
|
||||
|
||||
// 处理每个货位的状态
|
||||
for (BasCargoSpace space : list) {
|
||||
// 收集列和层信息
|
||||
columnSet.add(space.getTheColumn());
|
||||
floorSet.add(space.getTheFloor());
|
||||
|
||||
|
||||
// 根据状态分类处理
|
||||
if (space.getStatus() != null) {
|
||||
String coordinate = "[" + space.getTheColumn() + "," + space.getTheFloor() + "," + space.getStatus() + "],";
|
||||
@@ -381,20 +387,20 @@ public class KpiServiceImpl implements KpiService
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 构建列和层的标签
|
||||
StringBuilder columnLabels = new StringBuilder();
|
||||
for (Long col : columnSet) {
|
||||
columnLabels.append("'").append(col).append("列',");
|
||||
}
|
||||
String column = "[" + columnLabels.toString() + "]";
|
||||
|
||||
|
||||
StringBuilder floorLabels = new StringBuilder();
|
||||
for (Long floor : floorSet) {
|
||||
floorLabels.append("'").append(floor).append("层',");
|
||||
}
|
||||
String floor = "[" + floorLabels.toString() + "]";
|
||||
|
||||
|
||||
// 返回结果
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("empty", "[" + empty + "]");
|
||||
@@ -412,20 +418,20 @@ public class KpiServiceImpl implements KpiService
|
||||
@Override
|
||||
public Map<String,Object> getChartMag(String warehouseId,String theColumn,String theFloor,String thePlatoon){
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
|
||||
|
||||
// 查询指定货位信息
|
||||
BasCargoSpace queryParams = new BasCargoSpace();
|
||||
queryParams.setWarehouseId(warehouseId);
|
||||
queryParams.setTheColumn(Long.parseLong(theColumn));
|
||||
queryParams.setTheFloor(Long.parseLong(theFloor));
|
||||
queryParams.setThePlatoon(Long.parseLong(thePlatoon));
|
||||
|
||||
|
||||
List<BasCargoSpace> list = basCargoSpaceMapper.selectBasCargoSpaceList(queryParams);
|
||||
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
BasCargoSpace space = list.get(0);
|
||||
StringBuilder info = new StringBuilder();
|
||||
|
||||
|
||||
// 拼接货位信息
|
||||
info.append("货位名称:").append(space.getCargoSpaceName()).append("<br>");
|
||||
info.append("货位类型:").append(space.getTheTypeName()).append("<br>");
|
||||
@@ -433,14 +439,36 @@ public class KpiServiceImpl implements KpiService
|
||||
info.append("托盘条码:").append(space.getTrayCode() != null ? space.getTrayCode() : "无").append("<br>");
|
||||
info.append("货位高度:").append(space.getCargoHight() != null ? space.getCargoHight() : "无").append("<br>");
|
||||
info.append("是否双伸:").append("Y".equals(space.getIssDouble()) ? "是" : "否").append("<br>");
|
||||
|
||||
|
||||
response.put("msg", info.toString());
|
||||
} else {
|
||||
response.put("msg", "未找到货位信息");
|
||||
}
|
||||
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getInAnalysisByData(String warehouseId, String startTime, String endTime,String inOut) {
|
||||
Map<String,Object> res = new HashMap<>();
|
||||
MydoJob mydoJobParam = new MydoJob();
|
||||
mydoJobParam.setWarehouseId(warehouseId);
|
||||
mydoJobParam.setCreateLeftTime(startTime);
|
||||
mydoJobParam.setCreateRightTime(endTime);
|
||||
mydoJobParam.setInOut(inOut);
|
||||
List<DateTime> datesBetween = DateUtil.rangeToList(DateUtil.parseDate(mydoJobParam.getCreateLeftTime()), DateUtil.parseDate(mydoJobParam.getCreateRightTime()), DateField.DAY_OF_MONTH);
|
||||
List<MydoJob> list = mydoJobFinishMapper.selectMydoJobFinishListByMydoJob(mydoJobParam);
|
||||
List<String> x = new ArrayList<>();
|
||||
List<Long> y = new ArrayList<>();
|
||||
for (DateTime dateTime : datesBetween) {
|
||||
//筛选每一日的数量
|
||||
x.add(DateUtil.format(dateTime, "yyyy-MM-dd"));
|
||||
y.add(list.stream().filter(mydoJob -> DateUtil.isIn(mydoJob.getCreateTime(), DateUtil.beginOfDay(dateTime),DateUtil.endOfDay(dateTime))).count());
|
||||
}
|
||||
res.put("xAxis",x);
|
||||
res.put("series",y);
|
||||
return AjaxResult.success(res);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -415,6 +415,7 @@ public class PdaServiceImp implements PdaService {
|
||||
checkCommitRecord.setStockId(mydoJobDetail.getStockId());
|
||||
checkCommitRecord.setSpare1(mydoJobDetail.getInOrOutDId());
|
||||
checkCommitRecord.setSpare2(mydoJobDetail.getProductId());
|
||||
checkCommitRecord.setSpare3(mydoJobDetail.getOutQuantity());
|
||||
checkCommitRecordService.insertCheckCommitRecord(checkCommitRecord);
|
||||
|
||||
mydoJobDetail.setSpare3("1");
|
||||
|
||||
Reference in New Issue
Block a user