Browse Source

修改库存明细页面中图标的数据算法

lwx_dev
erdanergou 2 years ago
parent
commit
e387338efa
  1. 10
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java
  2. 3
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  3. 174
      src/main/resources/templates/pages/material/material-view_back.html

10
src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java

@ -2348,7 +2348,7 @@ public class DepositoryRecordController {
List<Long> dayTimeSpaces = ObjectFormatUtil.objToList(monthBeginToNow.get("dayTimeSpace"), Long.class);
dayTimeSpaces.add(Calendar.getInstance().getTimeInMillis());
// 获取当前物料的入库总额与数量
Map<String, Object> seriesForApplicationIn = depositoryRecordService.getApplicationByMaterial(id, dayTimeSpaces, 1,flagForSplitInfo,splitInfo);
Map<String, Object> seriesForApplicationIn = depositoryRecordService.getApplicationByMaterial(id, dayTimeSpaces, 1, flagForSplitInfo, splitInfo);
Object amountItemForIn = seriesForApplicationIn.get("amountItem");
Object countItemForIn = seriesForApplicationIn.get("countItem");
@ -2358,7 +2358,7 @@ public class DepositoryRecordController {
List<Double> amountListForIn = ObjectFormatUtil.objToList(countItemForInMapString.get("data"), Double.class);
// 获取当前物料的出库总额与数量
Map<String, Object> seriesForApplicationOut = depositoryRecordService.getApplicationByMaterial(id, dayTimeSpaces, 2,flagForSplitInfo,splitInfo);
Map<String, Object> seriesForApplicationOut = depositoryRecordService.getApplicationByMaterial(id, dayTimeSpaces, 2, flagForSplitInfo, splitInfo);
Object amountItemForOut = seriesForApplicationOut.get("amountItem");
Object countItemForOut = seriesForApplicationOut.get("countItem");
@ -2370,8 +2370,13 @@ public class DepositoryRecordController {
List<Object> inventoryCountList = new ArrayList<>();
// 定义库存总额列表
int scale = 1;
// 获取当前物料单价
Double price = inventoryById.getPrice();
if (flagForSplitInfo) {
scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1);
price = ObjectFormatUtil.divide(price, scale, 2);
}
// 获取当前物料总额
double amount = ObjectFormatUtil.multiply(inventory, price);
// 添加
@ -2383,6 +2388,7 @@ public class DepositoryRecordController {
inventoryCountList.add(inventory);
inventoryAmountList.add(ObjectFormatUtil.multiply(inventory, price));
}
// 反转
Collections.reverse(inventoryAmountList);
Collections.reverse(inventoryCountList);

3
src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java

@ -2177,6 +2177,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 获取当前物料的单价
double price = ObjectFormatUtil.divide(inventoryById.getPrice(), 100.0, 2);
if(flagForSplit){
price = ObjectFormatUtil.divide(price, scale, 2);
}
// 获取当前物料的总额
amount = ObjectFormatUtil.multiply(price, count);
}

174
src/main/resources/templates/pages/material/material-view_back.html

@ -76,60 +76,6 @@
<div class="panel panel-success">
<div class="panel-heading">库存基本信息</div>
<div class="panel-body">
<!-- <table class="table">
<caption th:text="${record.getDepositoryName()}">所属仓库:</caption>
<caption th:text="'备注:'+${record.getRemark()}">备注:</caption>
<thead>
<tr>
<td>所处库位</td>
<td>计量单位</td>
<td>对应数量</td>
<td th:style="'display:'+${display}">金额</td>
<td>操作</td>
</tr>
</thead>
<tbody>
<tr type="button"
th:each="materialAndPlace,iterStar:${record.getMaterialAndPlaceList()}">
<td>
<button onclick="changePlaceCode(this)"
th:text="${materialAndPlace.getKingdeecode()}"
th:attr="id=${materialAndPlace.getId()}"
class="layui-btn layui-btn-primary layui-btn-sm"></button>
</td>
<td>
<select class="mySelect" onchange="changeUnitForQuantity(this)"
th:attr="id='materialUnit'+${materialAndPlace.getId()}">
<option th:text="${record.getUnit()}" value="-1"
class="myOption"></option>
<option class="myOption"
th:each="splitInfo,iterStar:${record.getSplitInfoList()}"
th:value="${splitInfo.getNewUnit()}"
th:text="${splitInfo.getNewUnit()}"></option>
</select>
</td>
<td>
<span th:attr="id='quantity'+${materialAndPlace.getId()}"
th:text="${materialAndPlace.getInventory()}"></span>
</td>
<td th:style="'display:'+${display}">
<span th:attr="id='amounts'+${materialAndPlace.getId()}"
th:text="${materialAndPlace.getAmount()}"></span>
</td>
<td>
<a class="layui-btn layui-btn-xs"
th:attr="mid=${materialAndPlace.getIid()},depositoryId=${materialAndPlace.getDepository_id()},placeId=${materialAndPlace.getPid()}"
lay-on="applicationIn">入库</a>
<a class="layui-btn layui-btn-xs"
th:attr="code=${materialAndPlace.getMcode()},depositoryId=${materialAndPlace.getDepository_id()}"
lay-on="applicationOut">出库</a>
</td>
</tr>
</tbody>
</table>-->
<table class="layui-hide" id="currentTableId"></table>
</div>
@ -229,6 +175,10 @@
}
function initEchart() {
}
var barCode = [];
var flag = false;
@ -292,6 +242,65 @@
});
// 柱状图
var echartLineChartIn = echarts.init(document.getElementById('echarts-line-in'));
var echartLineChartOut = echarts.init(document.getElementById('echarts-line-out'));
var echartLineChartInventory = echarts.init(document.getElementById('echarts-line-inventory'));
var optionLineChartIn = {
xAxis: {
type: 'category',
boundaryGap: false,
data: []
},
yAxis: {
type: 'value'
},
tooltip: {
trigger: "axis",
},
series: []
};
var optionLineChartOut = {
xAxis: {
type: 'category',
boundaryGap: false,
data: []
},
yAxis: {
type: 'value'
},
tooltip: {
trigger: "axis",
},
series: []
};
var optionLineChartInventory = {
xAxis: {
type: 'category',
boundaryGap: false,
data: []
},
yAxis: {
type: 'value'
},
tooltip: {
trigger: "axis",
},
series: []
};
// 数据行点击事件
table.on('row(currentTableId)', function(obj){
var data = obj.data; // 获取当前行数据
let id = data.id;
let req = {};
req.id = id;
initEchart(req);
});
form.on('select()', function (data) {
var id = data.elem.id; //得到select原始DOM对象id
@ -484,62 +493,15 @@
};
// 柱状图
var echartLineChartIn = echarts.init(document.getElementById('echarts-line-in'));
var echartLineChartOut = echarts.init(document.getElementById('echarts-line-out'));
var echartLineChartInventory = echarts.init(document.getElementById('echarts-line-inventory'));
var optionLineChartIn = {
xAxis: {
type: 'category',
boundaryGap: false,
data: []
},
yAxis: {
type: 'value'
},
tooltip: {
trigger: "axis",
},
series: []
};
var optionLineChartOut = {
xAxis: {
type: 'category',
boundaryGap: false,
data: []
},
yAxis: {
type: 'value'
},
tooltip: {
trigger: "axis",
},
series: []
};
var optionLineChartInventory = {
xAxis: {
type: 'category',
boundaryGap: false,
data: []
},
yAxis: {
type: 'value'
},
tooltip: {
trigger: "axis",
},
series: []
};
/*$.ajax({
initEchart = function(req) {
$.ajax({
url: '/depositoryRecord/getApplicationForMaterial',
type: 'post',
async: true,
dataType: "json",
data: JSON.stringify({"id": id}),
data: JSON.stringify(req),
contentType: "application/json;charset=utf-8",
complete: function (XHR, TS) {
layer.close(this.layerIndex);
@ -583,7 +545,9 @@
echartLineChartOut.setOption(optionLineChartOut);
echartLineChartInventory.setOption(optionLineChartInventory);
}
})*/
})
}
});

Loading…
Cancel
Save