代码更新

This commit is contained in:
2023-04-14 17:50:11 +08:00
parent 88cc6a56e7
commit e379a9a86d
18 changed files with 1501 additions and 17 deletions

View File

@@ -0,0 +1,28 @@
package org.nl.modules.mnt.service;
import com.alibaba.fastjson.JSONObject;
public interface AutoRiKuService {
/**
* 获取立库一层货位
* */
JSONObject getOnePoint();
/**
* 获取立库二层货位
* */
JSONObject getTwoPoint();
/**
* 获取立库三层货位
* */
JSONObject getThreePoint();
/**
* 获取全部货位
* */
JSONObject getAllPoint();
}

View File

@@ -0,0 +1,173 @@
package org.nl.modules.mnt.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import org.nl.modules.mnt.service.AutoRiKuService;
import org.nl.modules.wql.core.bean.WQLObject;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class AutoRiKuServiceImpl implements AutoRiKuService {
@Override
public JSONObject getOnePoint() {
WQLObject attrTab = WQLObject.getWQLObject("st_ivt_structattr");
JSONObject jsonAll = new JSONObject();
JSONArray dataArr = new JSONArray();
// 获取有货货位
JSONArray haveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01') and IFNULL(storagevehicle_code,'') <> '' and layer_num = '1' and is_delete = '0'").getResultJSONArray(0);
JSONObject jsonHave = new JSONObject();
jsonHave.put("name", "有货");
jsonHave.put("value", haveArr.size());
// 获取无货货位
JSONArray notHaveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01') and IFNULL(storagevehicle_code,'') = '' and layer_num = '1' and is_delete = '0'").getResultJSONArray(0);
JSONObject jsonNotHave = new JSONObject();
jsonNotHave.put("name", "空闲");
jsonNotHave.put("value", notHaveArr.size());
// 获取禁用货位
JSONArray usedArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01') and is_used = '0' and IFNULL(storagevehicle_code,'') = '' and layer_num = '1' and is_delete = '0'").getResultJSONArray(0);
JSONObject jsonUsed = new JSONObject();
jsonUsed.put("name", "禁用");
jsonUsed.put("value", usedArr.size());
dataArr.add(jsonHave);
dataArr.add(jsonNotHave);
dataArr.add(jsonUsed);
int num = haveArr.size() + notHaveArr.size() + usedArr.size();
jsonAll.put("pieSubTest", "总仓位:"+num);
jsonAll.put("data", dataArr);
jsonAll.put("name", "立库1层统计");
return jsonAll;
}
@Override
public JSONObject getTwoPoint() {
WQLObject attrTab = WQLObject.getWQLObject("st_ivt_structattr");
JSONObject jsonAll = new JSONObject();
JSONArray dataArr = new JSONArray();
// 获取有货货位
JSONArray haveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01') and IFNULL(storagevehicle_code,'') <> '' and layer_num = '2' and is_delete = '0'").getResultJSONArray(0);
JSONObject jsonHave = new JSONObject();
jsonHave.put("name", "有货");
jsonHave.put("value", haveArr.size());
// 获取无货货位
JSONArray notHaveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01') and IFNULL(storagevehicle_code,'') = '' and layer_num = '2' and is_delete = '0'").getResultJSONArray(0);
JSONObject jsonNotHave = new JSONObject();
jsonNotHave.put("name", "空闲");
jsonNotHave.put("value", notHaveArr.size());
// 获取禁用货位
JSONArray usedArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01') and is_used = '0' and IFNULL(storagevehicle_code,'') = '' and layer_num = '2' and is_delete = '0'").getResultJSONArray(0);
JSONObject jsonUsed = new JSONObject();
jsonUsed.put("name", "禁用");
jsonUsed.put("value", usedArr.size());
dataArr.add(jsonHave);
dataArr.add(jsonNotHave);
dataArr.add(jsonUsed);
int num = haveArr.size() + notHaveArr.size() + usedArr.size();
jsonAll.put("pieSubTest", "总仓位:"+num);
jsonAll.put("data", dataArr);
jsonAll.put("name", "立库2层统计");
return jsonAll;
}
@Override
public JSONObject getThreePoint() {
WQLObject attrTab = WQLObject.getWQLObject("st_ivt_structattr");
JSONObject jsonAll = new JSONObject();
JSONArray dataArr = new JSONArray();
// 获取有货货位
JSONArray haveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01') and IFNULL(storagevehicle_code,'') <> '' and layer_num = '3' and is_delete = '0'").getResultJSONArray(0);
JSONObject jsonHave = new JSONObject();
jsonHave.put("name", "有货");
jsonHave.put("value", haveArr.size());
// 获取无货货位
JSONArray notHaveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01') and IFNULL(storagevehicle_code,'') = '' and layer_num = '3' and is_delete = '0'").getResultJSONArray(0);
JSONObject jsonNotHave = new JSONObject();
jsonNotHave.put("name", "空闲");
jsonNotHave.put("value", notHaveArr.size());
// 获取禁用货位
JSONArray usedArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01') and is_used = '0' and IFNULL(storagevehicle_code,'') = '' and layer_num = '3' and is_delete = '0'").getResultJSONArray(0);
JSONObject jsonUsed = new JSONObject();
jsonUsed.put("name", "禁用");
jsonUsed.put("value", usedArr.size());
dataArr.add(jsonHave);
dataArr.add(jsonNotHave);
dataArr.add(jsonUsed);
int num = haveArr.size() + notHaveArr.size() + usedArr.size();
jsonAll.put("pieSubTest", "总仓位:"+num);
jsonAll.put("data", dataArr);
jsonAll.put("name", "立库3层统计");
return jsonAll;
}
@Override
public JSONObject getAllPoint() {
WQLObject attrTab = WQLObject.getWQLObject("st_ivt_structattr");
JSONObject jsonAll = new JSONObject();
JSONArray dataArr = new JSONArray();
// 获取有货货位
JSONArray haveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01') and IFNULL(storagevehicle_code,'') <> '' and is_delete = '0'").getResultJSONArray(0);
JSONObject jsonHave = new JSONObject();
jsonHave.put("name", "有货");
jsonHave.put("value", haveArr.size());
// 获取无货货位
JSONArray notHaveArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01') and IFNULL(storagevehicle_code,'') = '' and is_delete = '0'").getResultJSONArray(0);
JSONObject jsonNotHave = new JSONObject();
jsonNotHave.put("name", "空闲");
jsonNotHave.put("value", notHaveArr.size());
// 获取禁用货位
JSONArray usedArr = attrTab.query("sect_code in ('ZC01','KTP01','ZZ01','PD01') and is_used = '0' and IFNULL(storagevehicle_code,'') = '' and is_delete = '0'").getResultJSONArray(0);
JSONObject jsonUsed = new JSONObject();
jsonUsed.put("name", "禁用");
jsonUsed.put("value", usedArr.size());
dataArr.add(jsonHave);
dataArr.add(jsonNotHave);
dataArr.add(jsonUsed);
int num = haveArr.size() + notHaveArr.size() + usedArr.size();
jsonAll.put("pieSubTest", "总仓位:"+num);
jsonAll.put("data", dataArr);
jsonAll.put("name", "立库汇总统计");
return jsonAll;
}
}

View File

@@ -0,0 +1,40 @@
package org.nl.modules.mnt.websocket;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.logging.annotation.Log;
import org.nl.modules.mnt.service.AutoRiKuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.Map;
@RestController
@RequiredArgsConstructor
@Api(tags = "定时任务")
@RequestMapping("/api/autoWeb")
@Slf4j
public class AutoWebSocketRiKu {
@Autowired
private AutoRiKuService autoRiKuService;
@PostMapping("/query")
@Log("查询数据")
@ApiOperation("查询数据")
public ResponseEntity<Object> query(){
JSONObject data = new JSONObject();
data.put("one",autoRiKuService.getOnePoint());
data.put("two",autoRiKuService.getTwoPoint());
data.put("three",autoRiKuService.getThreePoint());
data.put("all",autoRiKuService.getAllPoint());
return new ResponseEntity<>(data, HttpStatus.OK);
}
}