no message
parent
e1af3bea78
commit
2214bdfbc5
|
|
@ -34,4 +34,41 @@ public interface PointRepository extends JpaRepository<Point, Long>, JpaSpecific
|
||||||
@Query(value = "SELECT p FROM Point p WHERE p.code=?1", nativeQuery = false)
|
@Query(value = "SELECT p FROM Point p WHERE p.code=?1", nativeQuery = false)
|
||||||
Point findByCode(String code);
|
Point findByCode(String code);
|
||||||
|
|
||||||
|
/** 库位信息化看板*/
|
||||||
|
@Query(value = " select p.`code` 'pointCode',i.`code` 'itemCode' from base_point p "
|
||||||
|
+" left join base_area a on p.area_id=a.id "
|
||||||
|
+" left join data_inventory inv on inv.point_id=p.id "
|
||||||
|
+" left join data_item_key ik on ik.id=inv.item_key_id "
|
||||||
|
+" left join base_item i on i.id=ik.item_id "
|
||||||
|
+" where a.`code`='存储区' and p.type='STORAGE' ", nativeQuery = true)
|
||||||
|
List<Point> getDataPoint();
|
||||||
|
|
||||||
|
/** 库位信息化看板 查询货位组*/
|
||||||
|
@Query(value =" select p.pos_x,p.pos_y from base_point p "
|
||||||
|
+" left join base_area a on p.area_id=a.id "
|
||||||
|
+" left join data_inventory inv on inv.point_id=p.id "
|
||||||
|
+" left join data_item_key ik on ik.id=inv.item_key_id "
|
||||||
|
+" left join base_item i on i.id=ik.item_id "
|
||||||
|
+" where a.`code`='存储区' and p.type='STORAGE' "
|
||||||
|
+" group by p.pos_x,p.pos_y " , nativeQuery = true)
|
||||||
|
List<Map<String, Object>> getDataPointTotal();
|
||||||
|
/** 库位信息化看板 查询货架信息*/
|
||||||
|
@Query(value =" select p.pos_x,p.pos_y from base_point p "
|
||||||
|
+" left join base_area a on p.area_id=a.id "
|
||||||
|
+" left join data_inventory inv on inv.point_id=p.id "
|
||||||
|
+" left join data_item_key ik on ik.id=inv.item_key_id "
|
||||||
|
+" left join base_item i on i.id=ik.item_id "
|
||||||
|
+" where a.`code`='存储区' and p.type='STORAGE' "
|
||||||
|
+" group by p.pos_x,p.pos_y "
|
||||||
|
+" order by p.pos_x,p.pos_y asc "
|
||||||
|
+" LIMIT ?1,?2 ", nativeQuery = true)
|
||||||
|
List<Map<String, Object>> getDataPointLimit(int currentPage, int pageSize);
|
||||||
|
@Query(value =" select p.`code` 'pointCode',i.`code` 'itemCode' from base_point p "
|
||||||
|
+" left join base_area a on p.area_id=a.id "
|
||||||
|
+" left join data_inventory inv on inv.point_id=p.id "
|
||||||
|
+" left join data_item_key ik on ik.id=inv.item_key_id "
|
||||||
|
+" left join base_item i on i.id=ik.item_id "
|
||||||
|
+" where a.`code`='存储区' and p.type='STORAGE' "
|
||||||
|
+" and p.pos_x=?1 and p.pos_y=?2 ", nativeQuery = true)
|
||||||
|
List<Map<String, Object>> getDataPointList(double x, double y);
|
||||||
}
|
}
|
||||||
|
|
@ -18,12 +18,14 @@ package com.youchain.basicdata.rest;
|
||||||
import cn.hutool.poi.excel.ExcelReader;
|
import cn.hutool.poi.excel.ExcelReader;
|
||||||
import cn.hutool.poi.excel.ExcelUtil;
|
import cn.hutool.poi.excel.ExcelUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.youchain.annotation.AnonymousAccess;
|
import com.youchain.annotation.AnonymousAccess;
|
||||||
import com.youchain.annotation.Log;
|
import com.youchain.annotation.Log;
|
||||||
import com.youchain.appupdate.inputJson.CurrentPage;
|
import com.youchain.appupdate.inputJson.CurrentPage;
|
||||||
import com.youchain.basicdata.domain.Area;
|
import com.youchain.basicdata.domain.Area;
|
||||||
import com.youchain.basicdata.domain.Point;
|
import com.youchain.basicdata.domain.Point;
|
||||||
|
import com.youchain.basicdata.repository.PointRepository;
|
||||||
import com.youchain.basicdata.service.AreaService;
|
import com.youchain.basicdata.service.AreaService;
|
||||||
import com.youchain.basicdata.service.PointService;
|
import com.youchain.basicdata.service.PointService;
|
||||||
import com.youchain.basicdata.service.dto.AreaDto;
|
import com.youchain.basicdata.service.dto.AreaDto;
|
||||||
|
|
@ -68,6 +70,7 @@ import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||||
public class PointController {
|
public class PointController {
|
||||||
|
|
||||||
private final PointService pointService;
|
private final PointService pointService;
|
||||||
|
private final PointRepository pointRepository;
|
||||||
|
|
||||||
private final AreaService areaService;
|
private final AreaService areaService;
|
||||||
|
|
||||||
|
|
@ -110,6 +113,7 @@ public class PointController {
|
||||||
String enabled = readAll.get(i).get("是否启用").toString().trim();
|
String enabled = readAll.get(i).get("是否启用").toString().trim();
|
||||||
Double x = readAll.get(i).get("坐标X") == null ? 0 : Double.parseDouble(readAll.get(i).get("坐标X").toString());
|
Double x = readAll.get(i).get("坐标X") == null ? 0 : Double.parseDouble(readAll.get(i).get("坐标X").toString());
|
||||||
Double y = readAll.get(i).get("坐标Y") == null ? 0 : Double.parseDouble(readAll.get(i).get("坐标Y").toString());
|
Double y = readAll.get(i).get("坐标Y") == null ? 0 : Double.parseDouble(readAll.get(i).get("坐标Y").toString());
|
||||||
|
Double z = readAll.get(i).get("坐标Z") == null ? 0 : Double.parseDouble(readAll.get(i).get("坐标Z").toString());
|
||||||
Area area = areaService.findByCode(areaCode);
|
Area area = areaService.findByCode(areaCode);
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(), "找不到库区" + areaCode);
|
ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(), "找不到库区" + areaCode);
|
||||||
|
|
@ -132,6 +136,7 @@ public class PointController {
|
||||||
point.setDept(dept);
|
point.setDept(dept);
|
||||||
point.setPosX(x);
|
point.setPosX(x);
|
||||||
point.setPosY(y);
|
point.setPosY(y);
|
||||||
|
point.setPosZ(z);
|
||||||
point.setEnabled(true);
|
point.setEnabled(true);
|
||||||
point.setStatus(BaseStatus.FREE);
|
point.setStatus(BaseStatus.FREE);
|
||||||
pointService.create(point);
|
pointService.create(point);
|
||||||
|
|
@ -140,7 +145,7 @@ public class PointController {
|
||||||
point.setCode(code);
|
point.setCode(code);
|
||||||
point.setName(code);
|
point.setName(code);
|
||||||
String lx = "";
|
String lx = "";
|
||||||
if (types.equals("缓存点")) {
|
if (types.equals("存储点")) {
|
||||||
lx = BaseStatus.STORAGE;
|
lx = BaseStatus.STORAGE;
|
||||||
|
|
||||||
} else if (types.equals("线边点位")) {
|
} else if (types.equals("线边点位")) {
|
||||||
|
|
@ -154,6 +159,7 @@ public class PointController {
|
||||||
point.setEnabled(Boolean.valueOf(enabled));
|
point.setEnabled(Boolean.valueOf(enabled));
|
||||||
}
|
}
|
||||||
point.setPosY(y);
|
point.setPosY(y);
|
||||||
|
point.setPosZ(z);
|
||||||
pointService.update(point);
|
pointService.update(point);
|
||||||
edit_len++;
|
edit_len++;
|
||||||
}
|
}
|
||||||
|
|
@ -295,11 +301,27 @@ public class PointController {
|
||||||
@PostMapping("/queryPointInfo")
|
@PostMapping("/queryPointInfo")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> queryPointInfo(@RequestBody CurrentPage currentPage) {
|
public ResponseEntity<Object> queryPointInfo(@RequestBody CurrentPage currentPage) {
|
||||||
List<Point> pointList= pointService.getPoint(BaseStatus.STORAGE,"存储区",currentPage.getCurrentPage(),currentPage.getPageSize());
|
// List<Point> pointList= pointService.getPoint(BaseStatus.STORAGE,"存储区",currentPage.getCurrentPage(),currentPage.getPageSize());
|
||||||
int total=pointService.getPoint(BaseStatus.STORAGE,"存储区").size();
|
int total=pointRepository.getDataPointTotal().size();
|
||||||
|
JSONArray dataArray=new JSONArray();
|
||||||
|
List<Map<String,Object>> pointList= pointRepository.getDataPointLimit((currentPage.getCurrentPage()-1)*currentPage.getPageSize(),currentPage.getPageSize());
|
||||||
|
for (int i = 0; i < pointList.size(); i++) {
|
||||||
|
double x=Double.valueOf(pointList.get(i).get("pos_x")+"");
|
||||||
|
double y=Double.valueOf(pointList.get(i).get("pos_y")+"");
|
||||||
|
dataArray.add(pointRepository.getDataPointList(x,y));
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
|
||||||
|
JSONArray pointArray=new JSONArray();
|
||||||
|
JSONArray jsonArray=new JSONArray();
|
||||||
|
for (int i = 0; i < 5; i++) {
|
||||||
|
jsonArray.add(pointList.get(i));
|
||||||
|
}
|
||||||
|
pointArray.add(jsonArray);*/
|
||||||
JSONObject object=new JSONObject();
|
JSONObject object=new JSONObject();
|
||||||
object.put("total",total);
|
object.put("total",total);
|
||||||
object.put("data",pointList);
|
object.put("pageSize",12);
|
||||||
|
object.put("data",dataArray);
|
||||||
return new ResponseEntity<>(ApiResult.success(HttpStatus.OK.value(), "", object), HttpStatus.OK);
|
return new ResponseEntity<>(ApiResult.success(HttpStatus.OK.value(), "", object), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -181,12 +181,12 @@ public class PointServiceImpl implements PointService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Point> getPoint(String type, String areaCode) {
|
public List<Point> getPoint(String type, String areaCode) {
|
||||||
String hql = " from Point p where p.enabled=true and p.status='FREE' and p.type='" + type + "' ";
|
/*String hql = " from Point p where p.enabled=true and p.status='FREE' and p.type='" + type + "' ";
|
||||||
if (areaCode != null) {
|
if (areaCode != null) {
|
||||||
hql += " and p.area.code='" + areaCode + "'";
|
hql += " and p.area.code='" + areaCode + "'";
|
||||||
}
|
}
|
||||||
Query query = entityMapper.createQuery(hql);
|
Query query = entityMapper.createQuery(hql);*/
|
||||||
List<Point> pointList = query.getResultList();
|
List<Point> pointList = pointRepository.getDataPoint();
|
||||||
return pointList;
|
return pointList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue