Browse Source

托盘数量

master
han\hanst 2 months ago
parent
commit
9b5a71a3ad
  1. 82
      src/main/java/com/gaotao/modules/dashboard/task/DashboardPushTask.java

82
src/main/java/com/gaotao/modules/dashboard/task/DashboardPushTask.java

@ -75,7 +75,7 @@ public class DashboardPushTask {
* <li>dashboard.push.enabled - 看板推送总开关</li>
* </ul>
*/
@Scheduled(fixedRate = 5000)
@Scheduled(fixedRate = 10000)
public void pushRobotPickingData() {
// 检查总开关
if (!dashboardPushEnabled) {
@ -252,7 +252,7 @@ public class DashboardPushTask {
* <li>view_board_slitting_inbound - 分切入库区数据</li>
* </ul>
*/
@Scheduled(fixedRate = 5000)
@Scheduled(fixedRate = 10000)
public void pushSlittingBoardData() {
// 检查总开关
if (!dashboardPushEnabled) {
@ -358,7 +358,7 @@ public class DashboardPushTask {
* <li>发货统计 - queryWarehouseShipmentStats</li>
* </ul>
*/
@Scheduled(fixedRate = 5000)
@Scheduled(fixedRate = 10000)
public void pushWarehouse3dBoardData() {
// 检查总开关
if (!dashboardPushEnabled) {
@ -517,36 +517,59 @@ public class DashboardPushTask {
return createEmptyStorageData();
}
// 提取各类托盘数量
int flatPallet = materialInventory.has("flatPallet") ?
// 提取物料盘各类托盘数量
int materialFlatPallet = materialInventory.has("flatPallet") ?
materialInventory.get("flatPallet").asInt() : 0;
int framePallet = materialInventory.has("framePallet") ?
int materialFramePallet = materialInventory.has("framePallet") ?
materialInventory.get("framePallet").asInt() : 0;
int steelPallet = materialInventory.has("steelPallet") ?
int materialSteelPallet = materialInventory.has("steelPallet") ?
materialInventory.get("steelPallet").asInt() : 0;
// 提取空容器库存
int emptyContainer = resData.has("emptyContainerInventory") ?
resData.get("emptyContainerInventory").asInt() : 0;
// 提取空容器各类托盘数量
JsonNode emptyContainerInventory = resData.get("emptyContainerInventory");
int emptyFlatPallet = 0;
int emptyFramePallet = 0;
int emptySteelPallet = 0;
// 计算总使用库位和利用率
int usedSlots = flatPallet + framePallet + steelPallet;
if (emptyContainerInventory != null && !emptyContainerInventory.isNull()) {
emptyFlatPallet = emptyContainerInventory.has("flatPallet") ?
emptyContainerInventory.get("flatPallet").asInt() : 0;
emptyFramePallet = emptyContainerInventory.has("framePallet") ?
emptyContainerInventory.get("framePallet").asInt() : 0;
emptySteelPallet = emptyContainerInventory.has("steelPallet") ?
emptyContainerInventory.get("steelPallet").asInt() : 0;
}
// 计算总使用库位和利用率物料盘+空盘
int usedSlots = materialFlatPallet + materialFramePallet + materialSteelPallet
+ emptyFlatPallet + emptyFramePallet + emptySteelPallet;
int totalSlots = 1960; // 固定值
double utilizationRate = totalSlots > 0 ?
Math.round((double) usedSlots / totalSlots * 1000.0) / 10.0 : 0.0;
// 构造物料盘库存数据
Map<String, Object> materialInventoryData = new HashMap<>();
materialInventoryData.put("flatPallet", materialFlatPallet+emptyFlatPallet); // 物料盘-平托
materialInventoryData.put("framePallet", materialFramePallet+emptyFramePallet); // 物料盘-围框托盘
materialInventoryData.put("steelPallet", materialSteelPallet+emptySteelPallet); // 物料盘-钢底托
// 构造空盘库存数据
Map<String, Object> emptyContainerInventoryData = new HashMap<>();
emptyContainerInventoryData.put("flatPallet", emptyFlatPallet); // 空盘-平托
emptyContainerInventoryData.put("framePallet", emptyFramePallet); // 空盘-围框托盘
emptyContainerInventoryData.put("steelPallet", emptySteelPallet); // 空盘-钢底托
// 构造返回数据
Map<String, Object> storageData = new HashMap<>();
storageData.put("totalSlots", totalSlots); // 总库位数
storageData.put("usedSlots", usedSlots); // 已使用库位数
storageData.put("utilizationRate", utilizationRate); // 利用率
storageData.put("flatPallet", flatPallet); // 平托
storageData.put("guardPallet", framePallet); // 围挡托盘对应framePallet
storageData.put("steelPallet", steelPallet); // 钢托盘
storageData.put("otherPallet", emptyContainer); // 其他空容器
storageData.put("materialInventory", materialInventoryData); // 物料盘库存
storageData.put("emptyContainerInventory", emptyContainerInventoryData); // 空盘库存
log.info("库存统计数据获取成功 - 平托:{}, 框架托:{}, 钢托:{}, 空容器:{}, 总使用:{}, 利用率:{}%",
flatPallet, framePallet, steelPallet, emptyContainer, usedSlots, utilizationRate);
log.info("库存统计数据获取成功 - 物料盘[平托:{}, 框架托:{}, 钢托:{}], 空盘[平托:{}, 框架托:{}, 钢托:{}], 总使用:{}, 利用率:{}%",
materialFlatPallet, materialFramePallet, materialSteelPallet,
emptyFlatPallet, emptyFramePallet, emptySteelPallet, usedSlots, utilizationRate);
return storageData;
@ -562,14 +585,25 @@ public class DashboardPushTask {
* @return 空的库存统计数据结构
*/
private Map<String, Object> createEmptyStorageData() {
// 构造空的物料盘库存数据
Map<String, Object> emptyMaterialInventory = new HashMap<>();
emptyMaterialInventory.put("flatPallet", 0);
emptyMaterialInventory.put("framePallet", 0);
emptyMaterialInventory.put("steelPallet", 0);
// 构造空的空盘库存数据
Map<String, Object> emptyContainerInventory = new HashMap<>();
emptyContainerInventory.put("flatPallet", 0);
emptyContainerInventory.put("framePallet", 0);
emptyContainerInventory.put("steelPallet", 0);
// 构造返回数据
Map<String, Object> emptyData = new HashMap<>();
emptyData.put("totalSlots", 1960);
emptyData.put("usedSlots", 0);
emptyData.put("utilizationRate", 0.0);
emptyData.put("flatPallet", 0);
emptyData.put("guardPallet", 0);
emptyData.put("steelPallet", 0);
emptyData.put("otherPallet", 0);
emptyData.put("materialInventory", emptyMaterialInventory);
emptyData.put("emptyContainerInventory", emptyContainerInventory);
return emptyData;
}
@ -747,7 +781,7 @@ public class DashboardPushTask {
* <li>view_board_finish_inbound - 成品入库区数据</li>
* </ul>
*/
@Scheduled(fixedRate = 5000)
@Scheduled(fixedRate = 10000)
public void pushFinishedProductBoardData() {
// 检查总开关
if (!dashboardPushEnabled) {
@ -849,7 +883,7 @@ public class DashboardPushTask {
* <li>view_board_receiving_inbound - 原材入库区数据</li>
* </ul>
*/
@Scheduled(fixedRate = 5000)
@Scheduled(fixedRate = 10000)
public void pushMaterialReceivingBoardData() {
// 检查总开关
if (!dashboardPushEnabled) {

Loading…
Cancel
Save