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/StorageController.java b/productionboard/src/main/java/com/productionboard/controller/StorageController.java index 1078d4e..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; @@ -47,10 +48,16 @@ public class StorageController { return prefix; } - /* @GetMapping("/getProductionPlan") + @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,47 +66,12 @@ 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/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/resources/static/js/common/echarts.common.js b/productionboard/src/main/resources/static/js/common/echarts.common.js index 95169cf..742fff8 100644 --- a/productionboard/src/main/resources/static/js/common/echarts.common.js +++ b/productionboard/src/main/resources/static/js/common/echarts.common.js @@ -1191,16 +1191,6 @@ const multipleThreeDimensionalCylindrical = (res, ids) => { 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%", @@ -1226,7 +1216,7 @@ const multipleThreeDimensionalCylindrical = (res, ids) => { color: "#fff", fontSize: fontSize, }, - data: ["箱壳库", "内胆库"], + data: ["内胆库", "箱壳库"], }, xAxis: [ { @@ -1328,59 +1318,6 @@ const multipleThreeDimensionalCylindrical = (res, ids) => { 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: "", @@ -1396,7 +1333,7 @@ const multipleThreeDimensionalCylindrical = (res, ids) => { }, { type: "bar", - name: "箱壳库", + name: "内胆库", barWidth: "26", barGap: "200%", barCateGoryGap: "10%", @@ -1441,54 +1378,6 @@ const multipleThreeDimensionalCylindrical = (res, ids) => { 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: "", @@ -1504,7 +1393,7 @@ const multipleThreeDimensionalCylindrical = (res, ids) => { }, { 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 f4b81ff..9157a5d 100644 --- a/productionboard/src/main/resources/static/js/storage/index.js +++ b/productionboard/src/main/resources/static/js/storage/index.js @@ -27,24 +27,39 @@ $(()=>{ tableAnimation('#productionPlan') //当前库存统计 - $.getJSON(`/storage/getStoreStatistics?ids=${ids}`, function (result) { - multipleThreeDimensionalCylindrical(result, document.getElementById("theCurrentInventory")); + $.getJSON('/tankShell/getMaterialStoreJson', function (result) { + multipleThreeDimensionalCylindrical(result,document.getElementById("theCurrentInventory")); }); + //库位参数 $.getJSON(`/storage/getParamJson?ids=${ids}`, function (result) { + + console.log(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]); + 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)+"%"; + } + }) \ No newline at end of file diff --git a/productionboard/target/classes/com/productionboard/controller/StorageController.class b/productionboard/target/classes/com/productionboard/controller/StorageController.class index a67def6..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/static/js/common/echarts.common.js b/productionboard/target/classes/static/js/common/echarts.common.js index 95169cf..8eccc44 100644 --- a/productionboard/target/classes/static/js/common/echarts.common.js +++ b/productionboard/target/classes/static/js/common/echarts.common.js @@ -1191,16 +1191,6 @@ const multipleThreeDimensionalCylindrical = (res, ids) => { 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%", @@ -1328,59 +1318,6 @@ const multipleThreeDimensionalCylindrical = (res, ids) => { 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: "", @@ -1396,7 +1333,7 @@ const multipleThreeDimensionalCylindrical = (res, ids) => { }, { type: "bar", - name: "箱壳库", + name: "内胆库", barWidth: "26", barGap: "200%", barCateGoryGap: "10%", @@ -1441,54 +1378,6 @@ const multipleThreeDimensionalCylindrical = (res, ids) => { 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: "", @@ -1504,7 +1393,7 @@ const multipleThreeDimensionalCylindrical = (res, ids) => { }, { 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 f4b81ff..9157a5d 100644 --- a/productionboard/target/classes/static/js/storage/index.js +++ b/productionboard/target/classes/static/js/storage/index.js @@ -27,24 +27,39 @@ $(()=>{ tableAnimation('#productionPlan') //当前库存统计 - $.getJSON(`/storage/getStoreStatistics?ids=${ids}`, function (result) { - multipleThreeDimensionalCylindrical(result, document.getElementById("theCurrentInventory")); + $.getJSON('/tankShell/getMaterialStoreJson', function (result) { + multipleThreeDimensionalCylindrical(result,document.getElementById("theCurrentInventory")); }); + //库位参数 $.getJSON(`/storage/getParamJson?ids=${ids}`, function (result) { + + console.log(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]); + 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)+"%"; + } + }) \ 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