优化商品的库存明细
This commit is contained in:
@@ -66,9 +66,16 @@
|
|||||||
<table id="tableData" style="top:300px;border-bottom-color:#FFFFFF"></table>
|
<table id="tableData" style="top:300px;border-bottom-color:#FFFFFF"></table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="materialDetailListDlg" class="easyui-dialog" style="width:900px;height:500px;padding:10px 20px" closed="true"
|
<div id="materialDetailListDlg" class="easyui-dialog" style="padding:10px 20px" fit="true" closed="true"
|
||||||
modal="true" collapsible="false" closable="true">
|
modal="true" collapsible="false" closable="true">
|
||||||
<table id="materialTableData" style="top:50px;border-bottom-color:#FFFFFF"></table>
|
<div id="cc" class="easyui-layout" data-options="fit:true">
|
||||||
|
<div data-options="region:'west',title:'库存详情'" style="width:400px;">
|
||||||
|
<div id="initDepotShow"></div>
|
||||||
|
</div>
|
||||||
|
<div data-options="region:'center',title:'出入库明细'">
|
||||||
|
<table id="materialTableData" style="top:50px;border-bottom-color:#FFFFFF" data-options="fit:true"></table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="materialDlg" class="easyui-dialog" style="padding:10px 20px" fit="true"
|
<div id="materialDlg" class="easyui-dialog" style="padding:10px 20px" fit="true"
|
||||||
@@ -431,7 +438,7 @@
|
|||||||
{
|
{
|
||||||
title: '库存', field: 'stock', width: 70, formatter: function (value, rec) {
|
title: '库存', field: 'stock', width: 70, formatter: function (value, rec) {
|
||||||
var str = '';
|
var str = '';
|
||||||
str += '<span title="查看出入库明细" class="n-link" onclick="findStockList(' + rec.id + ');">' + rec.stock + '</span>';
|
str += '<span title="查看库存及明细" class="n-link" onclick="findStockList(' + rec.id + ');">' + rec.stock + '</span>';
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -518,7 +525,7 @@
|
|||||||
//初始化表格数据
|
//初始化表格数据
|
||||||
function initMaterialDetailData(mId) {
|
function initMaterialDetailData(mId) {
|
||||||
$('#materialTableData').datagrid({
|
$('#materialTableData').datagrid({
|
||||||
height: 435,
|
height: heightInfo,
|
||||||
nowrap: false,
|
nowrap: false,
|
||||||
rownumbers: false,
|
rownumbers: false,
|
||||||
//动画效果
|
//动画效果
|
||||||
@@ -641,8 +648,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function findStockList(mId) {
|
function findStockList(mId) {
|
||||||
$('#materialDetailListDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui/themes/icons/pencil.png"/> 查看出入库明细');
|
$('#materialDetailListDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui/themes/icons/pencil.png"/> 查看库存及明细');
|
||||||
$(".window-mask").css({width: webW, height: webH});
|
$(".window-mask").css({width: webW, height: webH});
|
||||||
|
initDepotList(mId, "show"); //加载仓库及库存数量
|
||||||
initMaterialDetailData(mId);
|
initMaterialDetailData(mId);
|
||||||
getMaterialInOutList(mId, 1, initPageSize);
|
getMaterialInOutList(mId, 1, initPageSize);
|
||||||
ininMaterialDetailPager(mId);
|
ininMaterialDetailPager(mId);
|
||||||
@@ -988,7 +996,7 @@
|
|||||||
oldManyUnit = "";
|
oldManyUnit = "";
|
||||||
materialID = 0;
|
materialID = 0;
|
||||||
url = '/material/add';
|
url = '/material/add';
|
||||||
initDepotList(materialID); //加载仓库列表页面
|
initDepotList(materialID, "edit"); //加载仓库列表页面
|
||||||
}
|
}
|
||||||
|
|
||||||
//商品价格扩展
|
//商品价格扩展
|
||||||
@@ -1288,10 +1296,10 @@
|
|||||||
//选中基本资料tab
|
//选中基本资料tab
|
||||||
$("#materialFM #tt .tabs li").first().click();
|
$("#materialFM #tt .tabs li").first().click();
|
||||||
url = '/material/update?id=' + rowsdata.id;
|
url = '/material/update?id=' + rowsdata.id;
|
||||||
initDepotList(rowsdata.id); //加载仓库列表页面
|
initDepotList(rowsdata.id, "edit"); //加载仓库列表页面
|
||||||
}
|
}
|
||||||
|
|
||||||
function initDepotList(mId) {
|
function initDepotList(mId, type) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "get",
|
type: "get",
|
||||||
url: "/depot/getAllListWithStock?mId=" + mId,
|
url: "/depot/getAllListWithStock?mId=" + mId,
|
||||||
@@ -1301,6 +1309,7 @@
|
|||||||
if (res && res.code == 200) {
|
if (res && res.code == 200) {
|
||||||
var json = {};
|
var json = {};
|
||||||
json.depotList = res.data;
|
json.depotList = res.data;
|
||||||
|
if(type == "edit"){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "get",
|
type: "get",
|
||||||
url: "../../../pages/template/init_depot_list.html?2121",
|
url: "../../../pages/template/init_depot_list.html?2121",
|
||||||
@@ -1313,6 +1322,20 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else if(type == "show"){
|
||||||
|
$.ajax({
|
||||||
|
type: "get",
|
||||||
|
url: "../../../pages/template/init_depot_show_list.html?888",
|
||||||
|
async: false,
|
||||||
|
success: function (tem) {
|
||||||
|
if (tem) {
|
||||||
|
var template = Handlebars.compile(tem);
|
||||||
|
var htmlValue = template(json);
|
||||||
|
$("#initDepotShow").html(htmlValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1585,7 +1608,7 @@
|
|||||||
if(!unit) {
|
if(!unit) {
|
||||||
//此时为多单位
|
//此时为多单位
|
||||||
if (meList.length<2){
|
if (meList.length<2){
|
||||||
$.messager.alert('提示',"多单位商品的条码数量应该大于2!",'warning');
|
$.messager.alert('提示',"多单位的商品条码行数至少要有两行,请再新增一行条码信息!",'warning');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
11
erp_web/pages/template/init_depot_show_list.html
Normal file
11
erp_web/pages/template/init_depot_show_list.html
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<table>
|
||||||
|
{{#depotList}}
|
||||||
|
<tr>
|
||||||
|
<td style="width:130px;height:30px;line-height:30px;padding:8px;float:left;" title="{{name}}">
|
||||||
|
<p style="width:110px;overflow: hidden;white-space:nowrap;text-overflow: ellipsis;">{{name}}</p>
|
||||||
|
</td>
|
||||||
|
<td style="width:120px;height:30px;line-height:30px;padding:8px;float:left;">初始库存:{{stock}}</td>
|
||||||
|
<td style="width:120px;height:30px;line-height:30px;padding:8px;float:left;">总计库存:{{allStock}}</td>
|
||||||
|
</tr>
|
||||||
|
{{/depotList}}
|
||||||
|
</table>
|
||||||
@@ -199,9 +199,12 @@ public class DepotController {
|
|||||||
DepotEx de = new DepotEx();
|
DepotEx de = new DepotEx();
|
||||||
if(mId!=0) {
|
if(mId!=0) {
|
||||||
BigDecimal stock = materialService.getInitStock(mId, depot.getId());
|
BigDecimal stock = materialService.getInitStock(mId, depot.getId());
|
||||||
|
BigDecimal currentStock = materialService.getCurrentStock(mId, depot.getId());
|
||||||
de.setStock(stock);
|
de.setStock(stock);
|
||||||
|
de.setAllStock(stock.add(currentStock));
|
||||||
} else {
|
} else {
|
||||||
de.setStock(BigDecimal.ZERO);
|
de.setStock(BigDecimal.ZERO);
|
||||||
|
de.setAllStock(BigDecimal.ZERO);
|
||||||
}
|
}
|
||||||
de.setId(depot.getId());
|
de.setId(depot.getId());
|
||||||
de.setName(depot.getName());
|
de.setName(depot.getName());
|
||||||
|
|||||||
@@ -17,4 +17,6 @@ public class DepotEx extends Depot{
|
|||||||
|
|
||||||
private BigDecimal stock;
|
private BigDecimal stock;
|
||||||
|
|
||||||
|
private BigDecimal allStock;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ public class MaterialService {
|
|||||||
@Resource
|
@Resource
|
||||||
private MaterialInitialStockMapper materialInitialStockMapper;
|
private MaterialInitialStockMapper materialInitialStockMapper;
|
||||||
@Resource
|
@Resource
|
||||||
|
private MaterialCurrentStockMapper materialCurrentStockMapper;
|
||||||
|
@Resource
|
||||||
private DepotService depotService;
|
private DepotService depotService;
|
||||||
@Resource
|
@Resource
|
||||||
private MaterialExtendService materialExtendService;
|
private MaterialExtendService materialExtendService;
|
||||||
@@ -704,7 +706,7 @@ public class MaterialService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据产品和仓库获取初始库存
|
* 根据商品和仓库获取初始库存
|
||||||
* @param materialId
|
* @param materialId
|
||||||
* @param depotId
|
* @param depotId
|
||||||
* @return
|
* @return
|
||||||
@@ -722,7 +724,7 @@ public class MaterialService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据产品获取初始库存
|
* 根据商品获取初始库存
|
||||||
* @param materialId
|
* @param materialId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -747,6 +749,24 @@ public class MaterialService {
|
|||||||
return stock;
|
return stock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据商品和仓库获取当前库存
|
||||||
|
* @param materialId
|
||||||
|
* @param depotId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public BigDecimal getCurrentStock(Long materialId, Long depotId) {
|
||||||
|
BigDecimal stock = BigDecimal.ZERO;
|
||||||
|
MaterialCurrentStockExample example = new MaterialCurrentStockExample();
|
||||||
|
example.createCriteria().andMaterialIdEqualTo(materialId).andDepotIdEqualTo(depotId)
|
||||||
|
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
|
List<MaterialCurrentStock> list = materialCurrentStockMapper.selectByExample(example);
|
||||||
|
if(list!=null && list.size()>0) {
|
||||||
|
stock = list.get(0).getCurrentNumber();
|
||||||
|
}
|
||||||
|
return stock;
|
||||||
|
}
|
||||||
|
|
||||||
public List<MaterialVo4Unit> getMaterialByMeId(Long meId) {
|
public List<MaterialVo4Unit> getMaterialByMeId(Long meId) {
|
||||||
List<MaterialVo4Unit> result = new ArrayList<MaterialVo4Unit>();
|
List<MaterialVo4Unit> result = new ArrayList<MaterialVo4Unit>();
|
||||||
try{
|
try{
|
||||||
|
|||||||
Reference in New Issue
Block a user