diff --git a/.idea/libraries/Maven__cn_hutool_hutool_all_5_8_0_M4.xml b/.idea/libraries/Maven__cn_hutool_hutool_all_5_8_0_M4.xml new file mode 100644 index 0000000..5c7d413 --- /dev/null +++ b/.idea/libraries/Maven__cn_hutool_hutool_all_5_8_0_M4.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/deviceboard/deviceboard.iml b/deviceboard/deviceboard.iml index bafa983..8e1c90e 100644 --- a/deviceboard/deviceboard.iml +++ b/deviceboard/deviceboard.iml @@ -115,5 +115,6 @@ + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 9160f6d..dc74c8c 100644 --- a/pom.xml +++ b/pom.xml @@ -95,6 +95,12 @@ 12.1.0.2.0 + + cn.hutool + hutool-all + 5.8.0.M4 + + diff --git a/productionboard/productionboard.iml b/productionboard/productionboard.iml index bafa983..8e1c90e 100644 --- a/productionboard/productionboard.iml +++ b/productionboard/productionboard.iml @@ -115,5 +115,6 @@ + \ No newline at end of file diff --git a/productionboard/src/main/java/com/productionboard/controller/FoamBoxController.java b/productionboard/src/main/java/com/productionboard/controller/FoamBoxController.java index 2285227..2b691ff 100644 --- a/productionboard/src/main/java/com/productionboard/controller/FoamBoxController.java +++ b/productionboard/src/main/java/com/productionboard/controller/FoamBoxController.java @@ -183,57 +183,57 @@ public class FoamBoxController { return JSONArray.toJSONString(mesMaterialStoreStatisticsList); } - /** - * 根据型号统计产量 - * - * @author WenJY - * @date 2022/4/20 10:15 - * @return java.lang.String - */ - @GetMapping("/getStatisticalOutputByModel") - @ResponseBody - public String getStatisticalOutputByModel() { - String info = - "{\n" - + "\t\"datas\":[\n" - + " {\"ranking\": 1,\"station\":\"SC227\",\"value\": 199999},\n" - + " {\"ranking\": 2,\"station\":\"SC228\",\"value\": 104970},\n" - + " {\"ranking\": 3,\"station\":\"SC229\",\"value\": 29034},\n" - + " {\"ranking\": 4,\"station\":\"SC223\",\"value\": 23489},\n" - + " {\"ranking\": 5,\"station\":\"SC224\",\"value\": 18203}\n" - + " ],\n" - + "\t\"plan\":[290000, 290000, 290000, 290000, 290000, 290000]\n" - + "}"; - return info; - } - - /** - * 库存 统计 - * - * @author WenJY - * @date 2022/4/20 10:16 - * @return java.lang.String - */ - @GetMapping("/getInventoryStatistics") - @ResponseBody - public String getInventoryStatistics() { - String info = - "{\n" - + "\t\"datas\":[\n" - + " {\n" - + " \"name\": \"SC528\",\n" - + " \"value\": 175.17\n" - + " },\n" - + " {\n" - + " \"name\": \"SC529\",\n" - + " \"value\": 148.35\n" - + " },\n" - + " {\n" - + " \"name\": \"SC327\",\n" - + " \"value\": 95.36\n" - + " }\n" - + " ]\n" - + "}"; - return info; - } +// /** +// * 根据型号统计产量 +// * +// * @author WenJY +// * @date 2022/4/20 10:15 +// * @return java.lang.String +// */ +// @GetMapping("/getStatisticalOutputByModel") +// @ResponseBody +// public String getStatisticalOutputByModel() { +// String info = +// "{\n" +// + "\t\"datas\":[\n" +// + " {\"ranking\": 1,\"station\":\"SC227\",\"value\": 199999},\n" +// + " {\"ranking\": 2,\"station\":\"SC228\",\"value\": 104970},\n" +// + " {\"ranking\": 3,\"station\":\"SC229\",\"value\": 29034},\n" +// + " {\"ranking\": 4,\"station\":\"SC223\",\"value\": 23489},\n" +// + " {\"ranking\": 5,\"station\":\"SC224\",\"value\": 18203}\n" +// + " ],\n" +// + "\t\"plan\":[290000, 290000, 290000, 290000, 290000, 290000]\n" +// + "}"; +// return info; +// } + +// /** +// * 库存 统计 +// * +// * @author WenJY +// * @date 2022/4/20 10:16 +// * @return java.lang.String +// */ +// @GetMapping("/getInventoryStatistics") +// @ResponseBody +// public String getInventoryStatistics() { +// String info = +// "{\n" +// + "\t\"datas\":[\n" +// + " {\n" +// + " \"name\": \"SC528\",\n" +// + " \"value\": 175.17\n" +// + " },\n" +// + " {\n" +// + " \"name\": \"SC529\",\n" +// + " \"value\": 148.35\n" +// + " },\n" +// + " {\n" +// + " \"name\": \"SC327\",\n" +// + " \"value\": 95.36\n" +// + " }\n" +// + " ]\n" +// + "}"; +// return info; +// } } diff --git a/productionboard/src/main/java/com/productionboard/controller/PreassembleController.java b/productionboard/src/main/java/com/productionboard/controller/PreassembleController.java index 878cb92..d51eb31 100644 --- a/productionboard/src/main/java/com/productionboard/controller/PreassembleController.java +++ b/productionboard/src/main/java/com/productionboard/controller/PreassembleController.java @@ -99,17 +99,18 @@ public class PreassembleController { @GetMapping("/getMaterialStoreJson") @ResponseBody public String getMesMaterialStoreStatisticsJson(){ - List mesMaterialStoreStatisticsList = iMesProductionDataService.getMesMaterialStoreStatisticsList("1004"); + List mesMaterialStoreStatisticsList = + iMesProductionDataService.getMesMaterialStoreStatisticsList("1004"); return JSONArray.toJSONString(mesMaterialStoreStatisticsList); } - /** + /* *//** * 根据型号统计产量 * * @author WenJY * @date 2022/4/20 10:15 * @return java.lang.String - */ + *//* @GetMapping("/getStatisticalOutputByModel") @ResponseBody public String getStatisticalOutputByModel() { @@ -127,13 +128,13 @@ public class PreassembleController { return info; } - /** + *//** * 库存 统计 * * @author WenJY * @date 2022/4/20 10:16 * @return java.lang.String - */ + *//* @GetMapping("/getInventoryStatistics") @ResponseBody public String getInventoryStatistics() { @@ -155,5 +156,5 @@ public class PreassembleController { + " ]\n" + "}"; return info; - } + }*/ } diff --git a/productionboard/src/main/java/com/productionboard/controller/StorageController.java b/productionboard/src/main/java/com/productionboard/controller/StorageController.java index 558bd48..e9ab4ef 100644 --- a/productionboard/src/main/java/com/productionboard/controller/StorageController.java +++ b/productionboard/src/main/java/com/productionboard/controller/StorageController.java @@ -1,5 +1,6 @@ package com.productionboard.controller; +import cn.hutool.http.HttpUtil; import com.productionboard.service.IBaseLocationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -50,7 +51,13 @@ public class StorageController { @GetMapping("/getProductionPlan") @ResponseBody() public String productionPlan(){ - String info = + + String urlStr = "http://10.100.71.119:8012/system/NorthWareHouse/getPlanInfo"; + + String param = "{\"StartTime\":\"2018-10-10 09:42:02\",\"EndTime\":\"2018-10-29 09:42:02\",\"StartIndex\":\"0\",\"PageSize\":\"30\"}"; + String response = HttpUtil.post(urlStr,param); + + String info = "{\n" + " \"header\":[\n" + " \"计划型号\",\n" @@ -59,45 +66,10 @@ public class StorageController { + " \"差异值\",\n" + " \"计划进度\"\n" + " ],\n" - + " \"data\":[\n" - + " [\n" - + " \"20210\",\n" - + " \"50\",\n" - + " \"25\",\n" - + " \"25\",\n" - + " \"50%\"\n" - + " ],\n" - + " [\n" - + " \"20210\",\n" - + " \"50\",\n" - + " \"25\",\n" - + " \"25\",\n" - + " \"50%\"\n" - + " ],\n" - + " [\n" - + " \"20210\",\n" - + " \"50\",\n" - + " \"25\",\n" - + " \"25\",\n" - + " \"50%\"\n" - + " ],\n" - + " [\n" - + " \"20210\",\n" - + " \"50\",\n" - + " \"25\",\n" - + " \"25\",\n" - + " \"50%\"\n" - + " ],\n" - + " [\n" - + " \"20210\",\n" - + " \"50\",\n" - + " \"25\",\n" - + " \"25\",\n" - + " \"50%\"\n" - + " ]\n" - + " ]\n" + + " \"data\":\n" + +response + "}"; - + System.out.println(info); return info; } diff --git a/productionboard/src/main/java/com/productionboard/mapper/BaseLocationInfoMapper.java b/productionboard/src/main/java/com/productionboard/mapper/BaseLocationInfoMapper.java index 422c9eb..7c1523a 100644 --- a/productionboard/src/main/java/com/productionboard/mapper/BaseLocationInfoMapper.java +++ b/productionboard/src/main/java/com/productionboard/mapper/BaseLocationInfoMapper.java @@ -3,6 +3,11 @@ package com.productionboard.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.productionboard.entity.BaseLocationInfo; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Service; + +import java.util.List; /** *

@@ -15,4 +20,37 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface BaseLocationInfoMapper extends BaseMapper { + @Select( + "select t1.objid, t1.location_code, t1.location_name,\n" + + " NVL(substr(t2.DETIAL_MATERIAL_NAME,instr(t2.DETIAL_MATERIAL_NAME,',',1,1)+1,instr(t2.DETIAL_MATERIAL_NAME,',',1,2)-1-instr(t2.DETIAL_MATERIAL_NAME,',',1,1)),'--') as material_type,\n" + + " t1.store_code, t1.location_area, t1.location_row, t1.location_line,\n" + + " t1.location_tier, t1.location_status, t1.efficiency,\n" + + " t1.delete_flag, t1.record_time\n" + + " from base_location_info t1\n" + + " left join IMOS_TE_BOM @SCADA_DBLINK t2 on t1.MATERIAL_TYPE = t2.DETIAL_MATERIAL_CODE\n" + + "where t1.STORE_CODE = #{STORE_CODE}") + List SelectLocationInfo(@Param("STORE_CODE") String STORE_CODE); + + @Select( + "select * from BASE_LOCATION_INFO where STORE_CODE = #{STORE_CODE} and LOCATION_STATUS = 1") + List SelectInUseLocationInfo(@Param("STORE_CODE") String STORE_CODE); + + @Select( + "select *\n" + + "from (select t1.objid, t1.location_code, t1.location_name,\n" + + " NVL(substr(t2.DETIAL_MATERIAL_NAME,instr(t2.DETIAL_MATERIAL_NAME,',',1,1)+1,instr(t2.DETIAL_MATERIAL_NAME,',',1,2)-1-instr(t2.DETIAL_MATERIAL_NAME,',',1,1)),'--') as material_type,\n" + + " t1.store_code, t1.location_area, t1.location_row, t1.location_line,\n" + + " t1.location_tier, t1.location_status, t1.efficiency,\n" + + " t1.delete_flag, t1.record_time\n" + + " from base_location_info t1\n" + + " left join IMOS_TE_BOM @SCADA_DBLINK t2 on t1.MATERIAL_TYPE = t2.DETIAL_MATERIAL_CODE\n" + + "where t1.LOCATION_STATUS = 1 and t1.DELETE_FLAG = 1) a\n" + + "where a.STORE_CODE = #{STORE_CODE} and a.material_type = #{MATERIAL_TYPE} and a.LOCATION_AREA = #{LOCATION_AREA}") + List SelectLocationInfoByArea( + @Param("STORE_CODE") String STORE_CODE, + @Param("LOCATION_AREA") String LOCATION_AREA, + @Param("MATERIAL_TYPE") String MATERIAL_TYPE); + + @Select("select * from BASE_LOCATION_INFO where STORE_CODE = #{STORE_CODE} and LOCATION_AREA = #{LOCATION_AREA} and LOCATION_STATUS = 1") + List SelectInUseLocationInfoByArea(@Param("STORE_CODE") String STORE_CODE,@Param("LOCATION_AREA") String LOCATION_AREA); } diff --git a/productionboard/src/main/java/com/productionboard/mapper/MesMaterialStoreStatisticsMapper.java b/productionboard/src/main/java/com/productionboard/mapper/MesMaterialStoreStatisticsMapper.java index 461c242..2052afa 100644 --- a/productionboard/src/main/java/com/productionboard/mapper/MesMaterialStoreStatisticsMapper.java +++ b/productionboard/src/main/java/com/productionboard/mapper/MesMaterialStoreStatisticsMapper.java @@ -68,7 +68,6 @@ public interface MesMaterialStoreStatisticsMapper extends BaseMapper getAdsorptionTankStoreStatistics4(@Param("in_id") Integer in_id); @Select("select * from table ( scada_adsorb_fault(#{in_id}) )") List selectDeviceFaultByType1005(int in_id); diff --git a/productionboard/src/main/java/com/productionboard/mapper/RecordTaskMapper.java b/productionboard/src/main/java/com/productionboard/mapper/RecordTaskMapper.java index 087a74e..2657066 100644 --- a/productionboard/src/main/java/com/productionboard/mapper/RecordTaskMapper.java +++ b/productionboard/src/main/java/com/productionboard/mapper/RecordTaskMapper.java @@ -1,8 +1,13 @@ package com.productionboard.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.productionboard.entity.MesProduction.PlanInfo; import com.productionboard.entity.RecordTask; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; /** *

@@ -15,4 +20,13 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface RecordTaskMapper extends BaseMapper { + @Select( + "select * from RECORD_TASK where to_char(RECORD_TIME, 'yyyy-MM-dd') = to_char(sysdate, 'yyyy-MM-dd') And STORE_CODE = #{STORE_CODE}") + List getRecordTasks(@Param("STORE_CODE") String STORE_CODE); + + @Select("select *\n" + + "from RECORD_TASK\n" + + "where to_char(RECORD_TIME, 'yyyy-MM-dd') = to_char(sysdate, 'yyyy-MM-dd')\n" + + " and STORE_CODE = #{STORE_CODE} and LOCATION_AREA = #{LOCATION_AREA} and TASK_TYPE = #{TASK_TYPE}") + List SelectRecordTaskByTaskType(@Param("STORE_CODE") String STORE_CODE,@Param("LOCATION_AREA") String LOCATION_AREA,@Param("TASK_TYPE") String TASK_TYPE); } diff --git a/productionboard/src/main/java/com/productionboard/service/impl/BaseLocationServiceImpl.java b/productionboard/src/main/java/com/productionboard/service/impl/BaseLocationServiceImpl.java index 9eadae4..9344be8 100644 --- a/productionboard/src/main/java/com/productionboard/service/impl/BaseLocationServiceImpl.java +++ b/productionboard/src/main/java/com/productionboard/service/impl/BaseLocationServiceImpl.java @@ -1,5 +1,8 @@ package com.productionboard.service.impl; +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpResponse; +import cn.hutool.http.HttpUtil; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -26,123 +29,146 @@ import java.util.stream.Collectors; @Service public class BaseLocationServiceImpl implements IBaseLocationService { - @Autowired - private BaseLocationInfoMapper lcoationMapper; + @Autowired private BaseLocationInfoMapper lcoationMapper; + + @Autowired private RecordTaskMapper recordTaskMapper; + + private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); + + @Override + public String getStoreStatistics(String ids) { + String STORE_CODE = "A"; + QueryWrapper wrapper = new QueryWrapper<>(); + switch (ids) { + case "0": + wrapper.eq("STORE_CODE", "B"); + STORE_CODE = "B"; + break; + case "1": + wrapper.eq("STORE_CODE", "A"); + STORE_CODE = "A"; + break; + default: + break; + } + + List baseLocationInfos = lcoationMapper.SelectLocationInfo(STORE_CODE); + List materialType = + baseLocationInfos.stream() + .map(BaseLocationInfo::getMaterialType) + .distinct() + .collect(Collectors.toList()); + + Map> collect = + baseLocationInfos.stream() + .collect(Collectors.groupingBy(BaseLocationInfo::getMaterialType)); + List result = new ArrayList<>(); + + for (String item : materialType) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("materialName",item); + jsonObject.put("lineStoreAmount",lcoationMapper.SelectLocationInfoByArea(STORE_CODE,"1",item).size()); + jsonObject.put("hullStoreAmount",lcoationMapper.SelectLocationInfoByArea(STORE_CODE,"2",item).size()); + result.add(jsonObject); + } + + + String s = JSONArray.toJSONString(result); + System.out.println("物料库存统计:" + s); + return s; + } + + @Override + public String getParamJson(String ids) { - @Autowired - private RecordTaskMapper recordTaskMapper; + String urlStr = "http://10.100.71.119:8012/system/NorthWareHouse/getStoreInfo"; - private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); + switch (ids) { + case "0": + urlStr = "http://10.100.71.119:8012/system/NorthWareHouse/getStoreInfo"; + break; + case "1": + urlStr = "http://10.100.71.119:8012/system/SouthWareHouse/getStoreInfo"; + break; + default: + break; + } + + String param = + "{\"StartTime\":\"2018-10-10 09:42:02\",\"EndTime\":\"2018-10-29 09:42:02\",\"StartIndex\":\"0\",\"PageSize\":\"30\"}"; + String response = HttpUtil.post(urlStr, param); + return response; - @Override - public String getStoreStatistics(String ids) { - QueryWrapper wrapper = new QueryWrapper<>(); + /*String[] result =new String[12]; + String STORE_CODE = "A"; + try{ + QueryWrapper locationWrapper = new QueryWrapper(); + QueryWrapper taskWrapper = new QueryWrapper<>(); switch (ids) { case"0": - wrapper.eq("STORE_CODE","B"); + locationWrapper.eq("STORE_CODE","B"); + STORE_CODE = "B"; break; case"1": - wrapper.eq("STORE_CODE","A"); + locationWrapper.eq("STORE_CODE","A"); + STORE_CODE = "A"; break; default: break; } - List baseLocationInfos = lcoationMapper.selectList(wrapper); - Map> collect = baseLocationInfos.stream().collect(Collectors.groupingBy(BaseLocationInfo::getMaterialType)); - List result = new ArrayList<>(); - - for (String item : collect.keySet()) { - JSONObject jsonObject = new JSONObject(); - jsonObject.put("materialName",item); - jsonObject.put("lineStoreAmount",collect.get(item).stream().filter(x->x.getLocationArea().equals("1")).collect(Collectors.toList()).size()); - jsonObject.put("hullStoreAmount",collect.get(item).stream().filter(x->x.getLocationArea().equals("2")).collect(Collectors.toList()).size()); - result.add(jsonObject); + int inAmount1 = recordTaskMapper.SelectRecordTaskByTaskType("A", "1", "1").size(); + int outAmount1 = recordTaskMapper.SelectRecordTaskByTaskType("A", "1", "2").size(); + //2号库入库数量、出库数量:1入库2出库 + int inAmount2 = recordTaskMapper.SelectRecordTaskByTaskType("A", "2", "1").size(); + int outAmount2 = recordTaskMapper.SelectRecordTaskByTaskType("A", "2", "2").size(); + result[0] = inAmount1+""; + result[1] = outAmount1+""; + result[2] = inAmount2+""; + result[3] = outAmount2+""; + + List baseLocationInfos = lcoationMapper.selectList(locationWrapper); + if(baseLocationInfos.size() > 0){ + + //正在使用 + int inUse = lcoationMapper.SelectInUseLocationInfo(STORE_CODE).size(); + System.out.println("正在使用:"+inUse); + //未使用 + int unUse = baseLocationInfos.size() - inUse; + + //1#正在使用 + int size1 = baseLocationInfos.stream().filter(x -> x.getLocationArea().equals("1")).collect(Collectors.toList()).size(); + int size2 = baseLocationInfos.stream().filter(x -> x.getLocationArea().equals("2")).collect(Collectors.toList()).size(); + int inUse1 = lcoationMapper.SelectInUseLocationInfoByArea(STORE_CODE,"1").size(); + int inUse2 = lcoationMapper.SelectInUseLocationInfoByArea(STORE_CODE,"2").size(); + int unUse1 = size1 - inUse1; + int unUse2 = size2 - inUse2; + + result[4] = inUse1+""; + result[5] = unUse1+""; + result[6] = inUse2+""; + result[7] = unUse2+""; + result[8] = unUse+""; + + // 创建一个数值格式化对象 + NumberFormat numberFormat = NumberFormat.getInstance(); + // 设置精确到小数点后2位 + numberFormat.setMaximumFractionDigits(2); + String unUsePercentage = numberFormat.format((float)unUse/(float)baseLocationInfos.size()*100); + System.out.println("diliverNum和queryMailNum的百分比为:" + result + "%"); + result[9] = unUsePercentage+"%"; + result[10] = inUse+""; + String inUsePercentage = numberFormat.format((float)inUse/(float)baseLocationInfos.size()*100); + result[11] = inUsePercentage+"%"; } - String s = JSONArray.toJSONString(result); - System.out.println("物料库存统计:"+s); - return s; + }catch (Exception e){ + System.out.println("门体库参数统计getParamJson异常:"+e.getMessage()); + for (int i = 0; i < 12; i++) { + // + result[i] = i+""; + } } - @Override - public String getParamJson(String ids) { - String[] result =new String[12]; - - try{ - QueryWrapper locationWrapper = new QueryWrapper(); - QueryWrapper taskWrapper = new QueryWrapper<>(); - switch (ids) { - case"0": - locationWrapper.eq("STORE_CODE","B"); - taskWrapper.eq("STORE_CODE","B"); - break; - case"1": - locationWrapper.eq("STORE_CODE","A"); - taskWrapper.eq("STORE_CODE","A"); - break; - default: - break; - } - taskWrapper.like("RECORD_TIME",simpleDateFormat.format(new Date())); - - List recordTasks = recordTaskMapper.selectList(taskWrapper); - - if(recordTasks.size()>0){ - //1号库入库数量、出库数量:1入库2出库 - int inAmount1 = recordTasks.stream().filter(x -> x.getLocationArea().equals("1") && x.getTaskType().equals("1")).collect(Collectors.toList()).size(); - int outAmount1 = recordTasks.stream().filter(x -> x.getLocationArea().equals("1") && x.getTaskType().equals("2")).collect(Collectors.toList()).size(); - //2号库入库数量、出库数量:1入库2出库 - int inAmount2 = recordTasks.stream().filter(x -> x.getLocationArea().equals("2") && x.getTaskType().equals("1")).collect(Collectors.toList()).size(); - int outAmount2 = recordTasks.stream().filter(x -> x.getLocationArea().equals("2") && x.getTaskType().equals("2")).collect(Collectors.toList()).size(); - result[0] = inAmount1+""; - result[1] = outAmount1+""; - result[2] = inAmount2+""; - result[3] = outAmount2+""; - - } - - List baseLocationInfos = lcoationMapper.selectList(locationWrapper); - if(baseLocationInfos.size() > 0){ - - //正在使用 - int inUse = baseLocationInfos.stream().filter(x -> x.getLocationStatus() == 1L).collect(Collectors.toList()).size(); - System.out.println("正在使用:"+inUse); - //未使用 - int unUse = baseLocationInfos.size() - inUse; - - //1#正在使用 - int size1 = baseLocationInfos.stream().filter(x -> x.getLocationArea().equals("1")).collect(Collectors.toList()).size(); - int size2 = baseLocationInfos.stream().filter(x -> x.getLocationArea().equals("2")).collect(Collectors.toList()).size(); - int inUse1 = baseLocationInfos.stream().filter(x -> x.getLocationArea().equals("1") && x.getLocationStatus().equals("1")).collect(Collectors.toList()).size(); - int inUse2 = baseLocationInfos.stream().filter(x -> x.getLocationArea().equals("2") && x.getLocationStatus().equals("1")).collect(Collectors.toList()).size(); - int unUse1 = size1 - inUse1; - int unUse2 = size2 - inUse2; - - result[4] = inUse1+""; - result[5] = unUse1+""; - result[6] = inUse2+""; - result[7] = unUse2+""; - result[8] = unUse+""; - - // 创建一个数值格式化对象 - NumberFormat numberFormat = NumberFormat.getInstance(); - // 设置精确到小数点后2位 - numberFormat.setMaximumFractionDigits(2); - String unUsePercentage = numberFormat.format((float)unUse/(float)baseLocationInfos.size()*100); - System.out.println("diliverNum和queryMailNum的百分比为:" + result + "%"); - result[9] = unUsePercentage+"%"; - result[10] = inUse+""; - String inUsePercentage = numberFormat.format((float)inUse/(float)baseLocationInfos.size()*100); - result[11] = inUsePercentage+"%"; - } - }catch (Exception e){ - System.out.println("门体库参数统计getParamJson异常:"+e.getMessage()); - for (int i = 0; i < 12; i++) { - // - result[i] = i+""; - } - } - - return JSONArray.toJSONString(result); - } + return JSONArray.toJSONString(result);*/ + } } diff --git a/productionboard/src/main/java/com/productionboard/service/impl/MesProductionDataServiceImpl.java b/productionboard/src/main/java/com/productionboard/service/impl/MesProductionDataServiceImpl.java index 81e6b97..22648bb 100644 --- a/productionboard/src/main/java/com/productionboard/service/impl/MesProductionDataServiceImpl.java +++ b/productionboard/src/main/java/com/productionboard/service/impl/MesProductionDataServiceImpl.java @@ -165,7 +165,7 @@ public class MesProductionDataServiceImpl implements IMesProductionDataService { public List getMesMaterialStoreStatisticsList(String locationNumber) { List mesMaterialStoreStatistics = new ArrayList<>(); - + System.out.println("数据切换标志: "+this.in_id); switch (locationNumber) { case "1001": mesMaterialStoreStatistics = materialStoreStatisticsMapper.getAdsorptionTankStoreStatistics(this.in_id); diff --git a/productionboard/src/main/resources/static/js/common/echarts.common.js b/productionboard/src/main/resources/static/js/common/echarts.common.js index 0b95697..b214ccc 100644 --- a/productionboard/src/main/resources/static/js/common/echarts.common.js +++ b/productionboard/src/main/resources/static/js/common/echarts.common.js @@ -364,10 +364,10 @@ const threeDimensionalCylindrical = (res, ids) => { }, axisLabel: { show: true, + rotate:-30, margin: 25, - align: "center", textStyle: { - fontSize: 14, + fontSize: 10, color: "#A8A6AB", rich: { a: { @@ -1201,16 +1201,6 @@ const multipleThreeDimensionalCylindrical = (res, ids, type = 1) => { let lineWidth = 1; let isDataZoom = xValue.length > 3 let stepSize = 1 / (xValue.length / 3) * 100 - // hullStoreAmount.forEach((val, index) => { - // if (val == 0) { - // hullStoreAmount[index] = 0 - // } - // }) - // lineStoreAmount.forEach((val, index) => { - // if (val == 0) { - // lineStoreAmount[index] = 0 - // } - // }) let option = { grid: { left: "0%", @@ -1236,7 +1226,7 @@ const multipleThreeDimensionalCylindrical = (res, ids, type = 1) => { color: "#fff", fontSize: fontSize, }, - data: ["箱壳库", "内胆库"], + data: ["内胆库", "箱壳库"], }, xAxis: [ { @@ -1338,59 +1328,6 @@ const multipleThreeDimensionalCylindrical = (res, ids, type = 1) => { color: "#26B2E8", data: hullStoreAmount, }, - // { - // // 左侧下内圈 - // name: "", - // type: "pictorialBar", - // tooltip: { - // show: false, - // }, - // symbolSize: function (val) { - // if (val == 0) { - // return [0, 0] - // }else{ - // return [37, 20] - // } - // }, - // symbolOffset: [-39, 20], - // z: 10, - // itemStyle: { - // normal: { - // color: "transparent", - // borderColor: "#2EA9E5", - // borderType: "solid", - // borderWidth: 20, - // }, - // }, - // - // data: hullStoreAmount, - // }, - // { - // // 左侧下外圈 - // name: "", - // type: "pictorialBar", - // tooltip: { - // show: false, - // }, - // symbolSize: function (val) { - // if (val == 0) { - // return [0, 0] - // }else{ - // return [50, 25] - // } - // }, - // symbolOffset: [-39, 25], - // z: 10, - // itemStyle: { - // normal: { - // color: "transparent", - // borderColor: "#26B2E8", - // borderType: "solid", - // borderWidth: 20, - // }, - // }, - // data: hullStoreAmount, - // }, { // 左侧下圆片 name: "", @@ -1406,7 +1343,7 @@ const multipleThreeDimensionalCylindrical = (res, ids, type = 1) => { }, { type: "bar", - name: "箱壳库", + name: "内胆库", barWidth: "26", barGap: "200%", barCateGoryGap: "10%", @@ -1451,54 +1388,6 @@ const multipleThreeDimensionalCylindrical = (res, ids, type = 1) => { color: "#20D3AB", data: lineStoreAmount, }, - // { - // // 右柱下内圈 - // name: "", - // type: "pictorialBar", - // tooltip: { - // show: false, - // }, - // symbolPosition:'start', - // symbolSize: function (val,data) { - // console.log(val) - // if (!lineStoreAmount[data.dataIndex] > 0) return [0, 0] - // return [37, 20] - // }, - // symbolOffset: [39, 20], - // z: 10, - // itemStyle: { - // normal: { - // color: "transparent", - // borderColor: "#20D3AB", - // borderType: "solid", - // borderWidth: 20, - // }, - // }, - // data: hullStoreAmount, - // }, - // { - // // 右柱下外圈 - // name: "", - // type: "pictorialBar", - // tooltip: { - // show: false, - // }, - // symbolSize: function (val,data) { - // if (!lineStoreAmount[data.dataIndex] > 0) return [0, 0] - // return [50, 25] - // }, - // symbolOffset: [39, 25], - // z: 10, - // itemStyle: { - // normal: { - // color: "transparent", - // borderColor: "#20D3AB", - // borderType: "solid", - // borderWidth: 20, - // }, - // }, - // data: hullStoreAmount, - // }, { // 右柱下圆片 name: "", @@ -1514,7 +1403,7 @@ const multipleThreeDimensionalCylindrical = (res, ids, type = 1) => { }, { type: "bar", - name: "内胆库", + name: "箱壳库", barWidth: "26", barGap: "200%", barCateGoryGap: "10%", diff --git a/productionboard/src/main/resources/static/js/storage/index.js b/productionboard/src/main/resources/static/js/storage/index.js index 5251455..7cc374e 100644 --- a/productionboard/src/main/resources/static/js/storage/index.js +++ b/productionboard/src/main/resources/static/js/storage/index.js @@ -40,20 +40,55 @@ $(() => { $.getJSON(`/storage/getParamJson?ids=${ids}`, function (result) { //单日出入库统计 storageStatistics(result[0] == null ? 0 : result[0], result[1] == null ? 0 : result[1], result[2] == null ? 0 : result[2], result[3] == null ? 0 : result[3]); + //当前库存统计 + $.getJSON('/tankShell/getMaterialStoreJson', function (result) { + multipleThreeDimensionalCylindrical(result, document.getElementById("theCurrentInventory")); + }); - //库存统计 - $("#emptyLocation-left").text(result[4] == null ? 0 : result[4]); - $("#haveUsedLocation-left").text(result[6] == null ? 0 : result[5]); - $("#emptyLocation-right").text(result[5] == null ? 0 : result[6]); - $("#haveUsedLocation-right").text(result[7] == null ? 0 : result[7]); - - //库位占比 - $("#emptyLocationNumber").text(result[8] == null ? 0 : result[8]); - $("#emptyLocationRatio").text(result[9] == null ? 0 : result[9]); - $("#haveUsedLocationNumber").text(result[10] == null ? 0 : result[10]); - $("#haveUsedLocationRatio").text(result[11] == null ? 0 : result[11]); - }); + //库位参数 + $.getJSON(`/storage/getParamJson?ids=${ids}`, function (result) { + + console.log(result); + + //单日出入库统计 + storageStatistics(result.inStoreLeftCount, result.outStoreLeftCount, result.inStoreRightCount, result.outStoreRightCount); + + //库存统计 + // $("#emptyLocation-left").text(result[4] == null ? 0 : result[4]); + // $("#haveUsedLocation-left").text(result[6] == null ? 0 : result[5]); + // $("#emptyLocation-right").text(result[5] == null ? 0 : result[6]); + // $("#haveUsedLocation-right").text(result[7] == null ? 0 : result[7]); + //库存统计 + $("#emptyLocation-left").text(result.freeStoreLeftCount); + $("#haveUsedLocation-left").text(result.useStoreLeftCount); + $("#emptyLocation-right").text(result.freeStoreRightCount); + $("#haveUsedLocation-right").text(result.useStoreRightCount); + + //库位占比 + // $("#emptyLocationNumber").text(result[8] == null ? 0 : result[8]); + // $("#emptyLocationRatio").text(result[9] == null ? 0 : result[9]); + // $("#haveUsedLocationNumber").text(result[10] == null ? 0 : result[10]); + // $("#haveUsedLocationRatio").text(result[11] == null ? 0 : result[11]); + //库位占比 + $("#emptyLocationNumber").text(result.freeStoreCount); + $("#emptyLocationRatio").text(GetPercent(result.freeStoreCount, 312)); + $("#haveUsedLocationNumber").text(result.useStoreCount); + $("#haveUsedLocationRatio").text(GetPercent(result.useStoreCount, 312)); + +//百分比 + function GetPercent(num, total) { + num = parseFloat(num); + total = parseFloat(total); + if (isNaN(num) || isNaN(total)) { + return "-"; + } + return total <= 0 ? "0%" : (Math.round(num / total * 10000) / 100.00) + "%"; + } + }); + }) setTimeout(fun, 10000) } fun() + + }) \ No newline at end of file diff --git a/productionboard/target/classes/com/productionboard/controller/FoamBoxController.class b/productionboard/target/classes/com/productionboard/controller/FoamBoxController.class index 33f4f17..d02c0a2 100644 Binary files a/productionboard/target/classes/com/productionboard/controller/FoamBoxController.class and b/productionboard/target/classes/com/productionboard/controller/FoamBoxController.class differ diff --git a/productionboard/target/classes/com/productionboard/controller/PreassembleController.class b/productionboard/target/classes/com/productionboard/controller/PreassembleController.class index 848fb81..f8a09d9 100644 Binary files a/productionboard/target/classes/com/productionboard/controller/PreassembleController.class and b/productionboard/target/classes/com/productionboard/controller/PreassembleController.class differ diff --git a/productionboard/target/classes/com/productionboard/controller/StorageController.class b/productionboard/target/classes/com/productionboard/controller/StorageController.class index ca48389..0e45128 100644 Binary files a/productionboard/target/classes/com/productionboard/controller/StorageController.class and b/productionboard/target/classes/com/productionboard/controller/StorageController.class differ diff --git a/productionboard/target/classes/com/productionboard/mapper/BaseLocationInfoMapper.class b/productionboard/target/classes/com/productionboard/mapper/BaseLocationInfoMapper.class index 7a4ee26..495f6eb 100644 Binary files a/productionboard/target/classes/com/productionboard/mapper/BaseLocationInfoMapper.class and b/productionboard/target/classes/com/productionboard/mapper/BaseLocationInfoMapper.class differ diff --git a/productionboard/target/classes/com/productionboard/mapper/RecordTaskMapper.class b/productionboard/target/classes/com/productionboard/mapper/RecordTaskMapper.class index 148585d..dd6fad5 100644 Binary files a/productionboard/target/classes/com/productionboard/mapper/RecordTaskMapper.class and b/productionboard/target/classes/com/productionboard/mapper/RecordTaskMapper.class differ diff --git a/productionboard/target/classes/com/productionboard/service/impl/BaseLocationServiceImpl.class b/productionboard/target/classes/com/productionboard/service/impl/BaseLocationServiceImpl.class index 384c723..ddaef38 100644 Binary files a/productionboard/target/classes/com/productionboard/service/impl/BaseLocationServiceImpl.class and b/productionboard/target/classes/com/productionboard/service/impl/BaseLocationServiceImpl.class differ diff --git a/productionboard/target/classes/com/productionboard/service/impl/MesProductionDataServiceImpl.class b/productionboard/target/classes/com/productionboard/service/impl/MesProductionDataServiceImpl.class index d1c8388..52c4ede 100644 Binary files a/productionboard/target/classes/com/productionboard/service/impl/MesProductionDataServiceImpl.class and b/productionboard/target/classes/com/productionboard/service/impl/MesProductionDataServiceImpl.class differ diff --git a/productionboard/target/classes/static/js/common/echarts.common.js b/productionboard/target/classes/static/js/common/echarts.common.js index 0b95697..08e24c3 100644 --- a/productionboard/target/classes/static/js/common/echarts.common.js +++ b/productionboard/target/classes/static/js/common/echarts.common.js @@ -364,10 +364,10 @@ const threeDimensionalCylindrical = (res, ids) => { }, axisLabel: { show: true, + rotate:-30, margin: 25, - align: "center", textStyle: { - fontSize: 14, + fontSize: 10, color: "#A8A6AB", rich: { a: { @@ -1201,16 +1201,6 @@ const multipleThreeDimensionalCylindrical = (res, ids, type = 1) => { let lineWidth = 1; let isDataZoom = xValue.length > 3 let stepSize = 1 / (xValue.length / 3) * 100 - // hullStoreAmount.forEach((val, index) => { - // if (val == 0) { - // hullStoreAmount[index] = 0 - // } - // }) - // lineStoreAmount.forEach((val, index) => { - // if (val == 0) { - // lineStoreAmount[index] = 0 - // } - // }) let option = { grid: { left: "0%", @@ -1338,59 +1328,6 @@ const multipleThreeDimensionalCylindrical = (res, ids, type = 1) => { color: "#26B2E8", data: hullStoreAmount, }, - // { - // // 左侧下内圈 - // name: "", - // type: "pictorialBar", - // tooltip: { - // show: false, - // }, - // symbolSize: function (val) { - // if (val == 0) { - // return [0, 0] - // }else{ - // return [37, 20] - // } - // }, - // symbolOffset: [-39, 20], - // z: 10, - // itemStyle: { - // normal: { - // color: "transparent", - // borderColor: "#2EA9E5", - // borderType: "solid", - // borderWidth: 20, - // }, - // }, - // - // data: hullStoreAmount, - // }, - // { - // // 左侧下外圈 - // name: "", - // type: "pictorialBar", - // tooltip: { - // show: false, - // }, - // symbolSize: function (val) { - // if (val == 0) { - // return [0, 0] - // }else{ - // return [50, 25] - // } - // }, - // symbolOffset: [-39, 25], - // z: 10, - // itemStyle: { - // normal: { - // color: "transparent", - // borderColor: "#26B2E8", - // borderType: "solid", - // borderWidth: 20, - // }, - // }, - // data: hullStoreAmount, - // }, { // 左侧下圆片 name: "", @@ -1406,7 +1343,7 @@ const multipleThreeDimensionalCylindrical = (res, ids, type = 1) => { }, { type: "bar", - name: "箱壳库", + name: "内胆库", barWidth: "26", barGap: "200%", barCateGoryGap: "10%", @@ -1451,54 +1388,6 @@ const multipleThreeDimensionalCylindrical = (res, ids, type = 1) => { color: "#20D3AB", data: lineStoreAmount, }, - // { - // // 右柱下内圈 - // name: "", - // type: "pictorialBar", - // tooltip: { - // show: false, - // }, - // symbolPosition:'start', - // symbolSize: function (val,data) { - // console.log(val) - // if (!lineStoreAmount[data.dataIndex] > 0) return [0, 0] - // return [37, 20] - // }, - // symbolOffset: [39, 20], - // z: 10, - // itemStyle: { - // normal: { - // color: "transparent", - // borderColor: "#20D3AB", - // borderType: "solid", - // borderWidth: 20, - // }, - // }, - // data: hullStoreAmount, - // }, - // { - // // 右柱下外圈 - // name: "", - // type: "pictorialBar", - // tooltip: { - // show: false, - // }, - // symbolSize: function (val,data) { - // if (!lineStoreAmount[data.dataIndex] > 0) return [0, 0] - // return [50, 25] - // }, - // symbolOffset: [39, 25], - // z: 10, - // itemStyle: { - // normal: { - // color: "transparent", - // borderColor: "#20D3AB", - // borderType: "solid", - // borderWidth: 20, - // }, - // }, - // data: hullStoreAmount, - // }, { // 右柱下圆片 name: "", @@ -1514,7 +1403,7 @@ const multipleThreeDimensionalCylindrical = (res, ids, type = 1) => { }, { type: "bar", - name: "内胆库", + name: "箱壳库", barWidth: "26", barGap: "200%", barCateGoryGap: "10%", diff --git a/productionboard/target/classes/static/js/storage/index.js b/productionboard/target/classes/static/js/storage/index.js index 5251455..1ea15cb 100644 --- a/productionboard/target/classes/static/js/storage/index.js +++ b/productionboard/target/classes/static/js/storage/index.js @@ -38,22 +38,43 @@ $(() => { }); //库位参数 $.getJSON(`/storage/getParamJson?ids=${ids}`, function (result) { - //单日出入库统计 - storageStatistics(result[0] == null ? 0 : result[0], result[1] == null ? 0 : result[1], result[2] == null ? 0 : result[2], result[3] == null ? 0 : result[3]); - - //库存统计 - $("#emptyLocation-left").text(result[4] == null ? 0 : result[4]); - $("#haveUsedLocation-left").text(result[6] == null ? 0 : result[5]); - $("#emptyLocation-right").text(result[5] == null ? 0 : result[6]); - $("#haveUsedLocation-right").text(result[7] == null ? 0 : result[7]); - - //库位占比 - $("#emptyLocationNumber").text(result[8] == null ? 0 : result[8]); - $("#emptyLocationRatio").text(result[9] == null ? 0 : result[9]); - $("#haveUsedLocationNumber").text(result[10] == null ? 0 : result[10]); - $("#haveUsedLocationRatio").text(result[11] == null ? 0 : result[11]); - }); - setTimeout(fun, 10000) - } - fun() -}) \ No newline at end of file + //单日出入库统计 + storageStatistics(result[0] == null ? 0 : result[0], result[1] == null ? 0 : result[1], result[2] == null ? 0 : result[2], result[3] == null ? 0 : result[3]); + //当前库存统计 + $.getJSON('/tankShell/getMaterialStoreJson', function (result) { + multipleThreeDimensionalCylindrical(result, document.getElementById("theCurrentInventory")); + }); + + //库位参数 + $.getJSON(`/storage/getParamJson?ids=${ids}`, function (result) { + + console.log(result); + + //单日出入库统计 + storageStatistics(result.inStoreLeftCount, result.outStoreLeftCount, result.inStoreRightCount, result.outStoreRightCount); + + //库存统计 + $("#emptyLocation-left").text(result.freeStoreLeftCount); + $("#haveUsedLocation-left").text(result.useStoreLeftCount); + $("#emptyLocation-right").text(result.freeStoreRightCount); + $("#haveUsedLocation-right").text(result.useStoreRightCount); + + //库位占比 + $("#emptyLocationNumber").text(result.freeStoreCount); + $("#emptyLocationRatio").text(GetPercent(result.freeStoreCount, 312)); + $("#haveUsedLocationNumber").text(result.useStoreCount); + $("#haveUsedLocationRatio").text(GetPercent(result.useStoreCount, 312)); + }); + + //百分比 + function GetPercent(num, total) { + num = parseFloat(num); + total = parseFloat(total); + if (isNaN(num) || isNaN(total)) { + return "-"; + } + return total <= 0 ? "0%" : (Math.round(num / total * 10000) / 100.00) + "%"; + } + + } + ) \ No newline at end of file diff --git a/visualboard.iml b/visualboard.iml index 3aaa796..db0ef63 100644 --- a/visualboard.iml +++ b/visualboard.iml @@ -115,5 +115,6 @@ + \ No newline at end of file