rev:master更新
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
package org.nl.wms.bigScreen.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.bigScreen.service.BigScreenService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author Gengby
|
||||
* @Date 2024/8/2
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/bigScreen")
|
||||
@SaIgnore
|
||||
public class BigScreenController {
|
||||
|
||||
@Autowired
|
||||
private BigScreenService bigScreenService;
|
||||
|
||||
@PostMapping("/inventoryAnalysis")
|
||||
@Log("原料库存统计")
|
||||
public ResponseEntity<Object> inventoryAnalysis() {
|
||||
return new ResponseEntity<>(bigScreenService.inventoryAnalysis(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/agvInfo")
|
||||
@Log("获取AGV信息")
|
||||
public ResponseEntity<Object> agvInfo() {
|
||||
return new ResponseEntity<>(bigScreenService.agvInfo(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/rgvInfo")
|
||||
@Log("获取RGV信息")
|
||||
public ResponseEntity<Object> rgvInfo() {
|
||||
return new ResponseEntity<>(bigScreenService.rgvInfo(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/todayProduceStatistic")
|
||||
@Log("当日生产统计")
|
||||
public ResponseEntity<Object> todayProduceStatistic() {
|
||||
return new ResponseEntity<>(bigScreenService.todayProduceStatistic(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/inventoryIOAnalysis")
|
||||
@Log("当日出入库分析")
|
||||
public ResponseEntity<Object> inventoryIOAnalysis() {
|
||||
return new ResponseEntity<>(bigScreenService.inventoryIOAnalysis(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/historyInventoryIOAnalysis")
|
||||
@Log("历史出入库分析")
|
||||
public ResponseEntity<Object> historyInventoryIOAnalysis() {
|
||||
return new ResponseEntity<>(bigScreenService.historyInventoryIOAnalysis(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/todayTask")
|
||||
@Log("当日任务")
|
||||
public ResponseEntity<Object> todayTask() {
|
||||
return new ResponseEntity<>(bigScreenService.todayTask(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/todayLoadingAndUnloadingStatistics")
|
||||
@Log("当日车间上下料根据区域统计")
|
||||
public ResponseEntity<Object> todayLoadingAndUnloadingStatistics() {
|
||||
return new ResponseEntity<>(bigScreenService.todayLoadingAndUnloadingStatistics(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package org.nl.wms.bigScreen.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author Gengby
|
||||
* @Date 2024/8/2
|
||||
*/
|
||||
public interface BigScreenService {
|
||||
/**
|
||||
* 原料库存统计
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> inventoryAnalysis();
|
||||
|
||||
/**
|
||||
* 获取AGV信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
JSONArray agvInfo();
|
||||
|
||||
/**
|
||||
* 获取RGV信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
JSONArray rgvInfo();
|
||||
|
||||
/**
|
||||
* 当日生产统计
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> todayProduceStatistic();
|
||||
|
||||
/**
|
||||
* 当日上下料统计
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Map<String,Object>> todayLoadingAndUnloadingStatistics();
|
||||
|
||||
/**
|
||||
* 当日任务
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
JSONArray todayTask();
|
||||
|
||||
/**
|
||||
* 历史分析(出库和入库近半个月的)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> historyInventoryIOAnalysis();
|
||||
|
||||
/**
|
||||
* 当日出入库统计
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> inventoryIOAnalysis();
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package org.nl.wms.bigScreen.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.nl.wms.bigScreen.service.BigScreenService;
|
||||
import org.nl.wms.bigScreen.service.mapper.BigScreenMapper;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.ext.acs.service.dto.to.wms.AcsResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author Gengby
|
||||
* @Date 2024/8/2
|
||||
*/
|
||||
@Service
|
||||
public class BigScreenServiceImpl implements BigScreenService {
|
||||
|
||||
@Autowired(required = false)
|
||||
private BigScreenMapper bigScreenMapper;
|
||||
@Autowired
|
||||
private WmsToAcsService wmsToAcsService;
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> inventoryAnalysis() {
|
||||
List<Map<String, Object>> res = bigScreenMapper.inventoryAnalysis();
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray agvInfo() {
|
||||
AcsResponse acsResponse = wmsToAcsService.agvInfo();
|
||||
JSONArray data = acsResponse.getData();
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray rgvInfo() {
|
||||
AcsResponse acsResponse = wmsToAcsService.rgvInfo();
|
||||
JSONArray data = acsResponse.getData();
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> todayProduceStatistic() {
|
||||
List<Map<String, Object>> res = bigScreenMapper.todayProduceStatistic();
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> todayLoadingAndUnloadingStatistics() {
|
||||
List<Map<String, Object>> res = bigScreenMapper.todayLoadingAndUnloadingStatistics();
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray todayTask() {
|
||||
AcsResponse acsResponse = wmsToAcsService.todayTask();
|
||||
JSONArray data = acsResponse.getData();
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> historyInventoryIOAnalysis() {
|
||||
List<Map<String, Object>> res = bigScreenMapper.historyInventoryIOAnalysis();
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> inventoryIOAnalysis() {
|
||||
List<Map<String, Object>> res = bigScreenMapper.inventoryIOAnalysis();
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.nl.wms.bigScreen.service.mapper;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author Gengby
|
||||
* @Date 2024/8/2
|
||||
*/
|
||||
public interface BigScreenMapper {
|
||||
|
||||
List<Map<String, Object>> inventoryAnalysis();
|
||||
|
||||
List<Map<String, Object>> todayProduceStatistic();
|
||||
|
||||
List<Map<String, Object>> inventoryIOAnalysis();
|
||||
|
||||
List<Map<String, Object>> historyInventoryIOAnalysis();
|
||||
|
||||
List<Map<String, Object>> todayLoadingAndUnloadingStatistics();
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.bigScreen.service.mapper.BigScreenMapper">
|
||||
|
||||
<!--原料库存物料分析 物料、数量、百分比-->
|
||||
<select id="inventoryAnalysis" resultType="java.util.Map">
|
||||
SELECT vm.material_id,
|
||||
material.material_code,
|
||||
material.material_name,
|
||||
SUM(vm.material_qty) AS total_material_qty,
|
||||
CONCAT(FORMAT((SUM(vm.material_qty) / total.total_qty) * 100, 2), '%') AS percentage
|
||||
FROM sch_base_point `point`
|
||||
LEFT JOIN sch_base_vehiclematerialgroup vm ON `point`.vehicle_code = vm.vehicle_code
|
||||
LEFT JOIN md_base_material material ON vm.material_id = material.material_id
|
||||
CROSS JOIN (
|
||||
SELECT SUM(vm.material_qty) AS total_qty
|
||||
FROM sch_base_point `point`
|
||||
LEFT JOIN sch_base_vehiclematerialgroup vm ON `point`.vehicle_code = vm.vehicle_code
|
||||
WHERE `point`.region_code = 'YCL'
|
||||
AND vm.group_bind_material_status = '2'
|
||||
AND vm.group_status = '2'
|
||||
AND vm.link_status = '1'
|
||||
) total
|
||||
WHERE `point`.region_code = 'YCL'
|
||||
AND vm.group_bind_material_status = '2'
|
||||
AND vm.group_status = '2'
|
||||
AND vm.link_status = '1'
|
||||
GROUP BY vm.material_id,
|
||||
material.material_code,
|
||||
material.material_name,
|
||||
total.total_qty;
|
||||
</select>
|
||||
|
||||
<!--根据任务流转统计当日搬运托数-->
|
||||
<select id="todayProduceStatistic" resultType="java.util.Map">
|
||||
SELECT
|
||||
region.region_name,
|
||||
region.region_code,
|
||||
COALESCE(task_counts.count, 0) AS count
|
||||
FROM (
|
||||
SELECT
|
||||
region.region_code,
|
||||
region.region_name
|
||||
FROM
|
||||
sch_base_region region
|
||||
LEFT JOIN sch_base_point `point` ON region.region_code = `point`.region_code
|
||||
WHERE
|
||||
`point`.point_code IN ('XKBSKT', 'ZQTLKT1', 'BCXZKKT')
|
||||
GROUP BY
|
||||
region.region_code
|
||||
) AS region
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
`point`.region_code,
|
||||
COUNT(task.task_id) AS count
|
||||
FROM
|
||||
sch_base_task task
|
||||
LEFT JOIN sch_base_point `point` ON task.point_code1 = `point`.point_code
|
||||
WHERE
|
||||
task.point_code1 IN ('XKBSKT', 'ZQTLKT1', 'BCXZKKT')
|
||||
AND task.task_status = '5'
|
||||
AND task.create_time = CURDATE()
|
||||
GROUP BY
|
||||
`point`.region_code
|
||||
) AS task_counts ON region.region_code = task_counts.region_code
|
||||
ORDER BY
|
||||
region.region_code;
|
||||
</select>
|
||||
|
||||
<!--查询当天物料的出入库数量-->
|
||||
<select id="inventoryIOAnalysis" resultType="java.util.Map">
|
||||
SELECT COALESCE
|
||||
( instorage.material_id, outstorage.material_id ) AS material_id,
|
||||
material.material_code,
|
||||
material.material_name,
|
||||
COALESCE ( instorage.total_material_qty, 0 ) AS total_instorage_qty,
|
||||
COALESCE ( outstorage.total_material_qty, 0 ) AS total_outstorage_qty
|
||||
FROM
|
||||
md_base_material material
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
vm.material_id,
|
||||
SUM( vm.material_qty ) AS total_material_qty
|
||||
FROM
|
||||
sch_base_vehiclematerialgroup vm
|
||||
WHERE
|
||||
DATE ( vm.instorage_time ) = CURDATE()
|
||||
AND (vm.group_bind_material_status = '2' or vm.group_bind_material_status = '3')
|
||||
AND vm.group_status = '2'
|
||||
AND vm.link_status = '1'
|
||||
GROUP BY
|
||||
vm.material_id
|
||||
) AS instorage ON material.material_id = instorage.material_id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
vm.material_id,
|
||||
SUM( vm.material_qty ) AS total_material_qty
|
||||
FROM
|
||||
sch_base_vehiclematerialgroup vm
|
||||
WHERE
|
||||
DATE ( vm.update_time ) = CURDATE()
|
||||
AND vm.group_bind_material_status = '3'
|
||||
AND vm.group_status = '2'
|
||||
AND vm.link_status = '1'
|
||||
GROUP BY
|
||||
vm.material_id
|
||||
) AS outstorage ON material.material_id = outstorage.material_id
|
||||
WHERE
|
||||
instorage.material_id IS NOT NULL
|
||||
OR outstorage.material_id IS NOT NULL;
|
||||
</select>
|
||||
|
||||
<!--查询历史出入库数量-->
|
||||
<select id="historyInventoryIOAnalysis" resultType="java.util.Map">
|
||||
SELECT
|
||||
DATE_FORMAT( date_table.DATE, '%m-%d' ) AS `data`,
|
||||
SUM(
|
||||
CASE
|
||||
|
||||
WHEN (vm.group_bind_material_status = '2' or vm.group_bind_material_status = '3')
|
||||
AND vm.group_status = '2'
|
||||
AND vm.link_status = '1'
|
||||
AND DATE ( vm.instorage_time ) = date_table.DATE THEN
|
||||
vm.material_qty ELSE 0
|
||||
END
|
||||
) AS total_instorage_qty,
|
||||
SUM(
|
||||
CASE
|
||||
|
||||
WHEN vm.group_bind_material_status = '3'
|
||||
AND vm.group_status = '2'
|
||||
AND vm.link_status = '1'
|
||||
AND DATE ( vm.update_time ) = date_table.DATE THEN
|
||||
vm.material_qty ELSE 0
|
||||
END
|
||||
) AS total_outstorage_qty
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
CURDATE() - INTERVAL seq DAY AS DATE
|
||||
FROM
|
||||
( SELECT 0 AS seq UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 ) AS seq_table
|
||||
) AS date_table
|
||||
LEFT JOIN sch_base_vehiclematerialgroup vm ON DATE ( vm.instorage_time ) = date_table.DATE
|
||||
OR DATE ( vm.update_time ) = date_table.DATE
|
||||
GROUP BY
|
||||
date_table.DATE
|
||||
ORDER BY
|
||||
date_table.DATE;
|
||||
</select>
|
||||
|
||||
<!--当日车间上下料根据区域统计-->
|
||||
<select id="todayLoadingAndUnloadingStatistics" resultType="java.util.Map">
|
||||
SELECT
|
||||
region.region_code,
|
||||
region.region_name,
|
||||
COALESCE(loading.material_loading_count, 0) AS material_loading_count,
|
||||
COALESCE(unloading.material_unloading_count, 0) AS material_unloading_count
|
||||
FROM sch_base_region region
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
`point`.region_code,
|
||||
SUM(CASE WHEN point.point_type = '1' THEN 1 ELSE 0 END) AS material_loading_count
|
||||
FROM sch_base_task task
|
||||
LEFT JOIN sch_base_point `point` ON task.point_code2 = `point`.point_code
|
||||
WHERE task.task_status = '5'
|
||||
AND `point`.region_code NOT IN ('YCL', 'JLHC', 'ZP', 'KTPHC1', 'KTPHC2')
|
||||
AND DATE(task.create_time) = CURDATE()
|
||||
GROUP BY `point`.region_code
|
||||
) AS loading ON region.region_code = loading.region_code
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
`point`.region_code,
|
||||
SUM(CASE WHEN point.point_type = '2' THEN 1 ELSE 0 END) AS material_unloading_count
|
||||
FROM sch_base_task task
|
||||
LEFT JOIN sch_base_point `point` ON task.point_code1 = `point`.point_code
|
||||
WHERE task.task_status = '5'
|
||||
AND `point`.region_code NOT IN ('YCL', 'JLHC', 'ZP', 'KTPHC1', 'KTPHC2')
|
||||
AND DATE(task.create_time) = CURDATE()
|
||||
GROUP BY `point`.region_code
|
||||
) AS unloading ON region.region_code = unloading.region_code
|
||||
WHERE region.region_code NOT IN ('YCL', 'JLHC', 'ZP', 'KTPHC1', 'KTPHC2')
|
||||
ORDER BY region.region_code;
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.ext.acs.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.ext.acs.service.dto.ResultForAcs;
|
||||
import org.nl.wms.ext.acs.service.dto.to.acs.DeviceInfoDto;
|
||||
import org.nl.wms.ext.acs.service.dto.to.acs.PutActionRequest;
|
||||
@@ -48,4 +49,10 @@ public interface WmsToAcsService {
|
||||
* @return
|
||||
*/
|
||||
AcsResponse getDeviceStatusByCode(List<DeviceInfoDto> list);
|
||||
|
||||
AcsResponse agvInfo();
|
||||
|
||||
AcsResponse rgvInfo();
|
||||
|
||||
AcsResponse todayTask();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.wms.ext.acs.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.ext.acs.service.dto.ResultForAcs;
|
||||
@@ -65,4 +66,22 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
interactRecordService.saveRecord("获取设备信息", list, resultForAcs, GeneralDefinition.LMS_ACS);
|
||||
return resultForAcs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AcsResponse agvInfo() {
|
||||
String api = "/api/wms/agvInfo";
|
||||
return AcsUtil.notifyAcs2(api, new JSONObject());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AcsResponse rgvInfo() {
|
||||
String api = "/api/wms/rgvInfo";
|
||||
return AcsUtil.notifyAcs2(api, new JSONObject());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AcsResponse todayTask() {
|
||||
String api = "/api/wms/todayTask";
|
||||
return AcsUtil.notifyAcs2(api, new JSONObject());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user