Commit df05c88c by anxiaohe

出库功能

parent b75fb4fa
......@@ -27,38 +27,49 @@
},
{
field: 'type.name',
title: '品名代码',
align: 'center'
title: '品名',
sortable: true,
sortName: 'type.name',
},
{
field: 'model',
title: '型号',
align: 'center'
field: 'type.code',
title: '代码',
sortable: true,
sortName: 'type.code'
},
{
field: 'code',
title: '入库单'
},
{
field: 'batchNum',
title: '批次号',
align: 'center'
},
{
field: 'shelvesNames',
title: '货架',
align: 'center'
field: 'amount',
title: '单价'
},
{
field: "type.unit",
title: '单位'
},
{
field: 'warehouseNames',
title: '仓库',
align: 'center'
field: 'model',
title: '型号',
sortable: true,
sortName: 'model'
},
{
field: 'num',
title: '数量',
align: 'center'
title: '数量'
},
{
field: 'sum',
title: '总价',
align: 'center'
sortName: 'sum',
formatter (v, row) {
return new Big(row.num).times(row.amount).toNumber()
}
},
{
title: '操作',
......@@ -72,7 +83,7 @@
title: '查看明细',
type: 1,
auto: true,
area: ['800', '600'],
area: ['1000', '600'],
content: $("#detailTpl").html(),
success: function (){
$("#table").bootstrapTable({
......@@ -99,12 +110,49 @@
columns: [
{checkbox:true},
{field: 'code', title: '物资编码'},
{field: 'name', title: '物资名称'},
{field: 'type.name', title: '品名代码'},
{
field: 'type.name',
title: '品名',
},
{
field: 'type.code',
title: '代码',
},
{
field: 'batchNum',
title: '批次号',
},
{
field: 'amount',
title: '单价'
},
{
field: "type.unit",
title: '单位'
},
{
field: 'amount',
title: '单价'
},
{
field: "type.unit",
title: '单位'
},
{field: 'model', title: '型号'},
{field: 'batchNum', title: '批次号'},
{field: 'shelves.name', title: '货架'},
{field: 'amount', title: '单价'},
// {field: 'amount', title: '单价'},
{
field: 'num',
title: '数量'
},
{
field: 'sum',
title: '总价',
sortName: 'sum',
formatter (v, row) {
return new Big(row.num).times(row.amount).toNumber()
}
},
{
field: 'qr.url',
title: '二维码',
......@@ -135,11 +183,14 @@
}
}
}
]
].map(function (e) {
e.align = 'center';
return e;
})
});
jp.get("${ctx}/warehouse/ledger/ledger/countLedger?id=${ledger.id}", function (ledger) {
var data = ledger.countLedgerInfoList || [];
jp.get("${ctx}/warehouse/ledger/ledger/detail?id=${ledger.id}", function (ledger) {
var data = ledger.ledgerInfoList || [];
$(selector).bootstrapTable('append', data);
})
}
......
......@@ -22,17 +22,21 @@
<h3 class="text-center">台账表</h3>
<table class="table table-bordered main-table">
<tr>
<td>物资名称</td>
<td>
<form:input path="name" htmlEscape="false" class="form-control "/>
</td>
<td>品名代码</td>
<td>品名</td>
<td>
<sys:treeselect id="type" name="type.id" value="${ledger.type.id}" labelName="type.name"
labelValue="${ledger.type.name}"
title="品名代码" url="/warehouse/materialtype/materialType/treeData"
extId="${ledger.id}" cssClass="form-control " allowClear="true"/>
</td>
<td>品名代码</td>
<td>
<%-- <sys:treeselect id="type" name="type.id" value="${ledger.type.id}" labelName="type.name"--%>
<%-- labelValue="${ledger.type.name}"--%>
<%-- title="品名代码" url="/warehouse/materialtype/materialType/treeData"--%>
<%-- extId="${ledger.id}" cssClass="form-control " allowClear="true"/>--%>
<form:input path="type.code" htmlEscape="false" class="form-control "/>
</td>
<td>型号</td>
<td>
<form:input path="model" htmlEscape="false" class="form-control "/>
......
......@@ -240,21 +240,21 @@ function refresh(){
$('#ledgerTable').bootstrapTable('refresh');
}
function add(){
jp.openSaveDialog("新增台账","${ctx}/warehouse/ledger/ledger/form/add", '1200', '800');
jp.openSaveDialog("新增台账","${ctx}/warehouse/ledger/ledger/form/add", '1400', '800');
}
function edit(id){
if(id == undefined){
id = getIdSelections();
}
jp.openSaveDialog("编辑台账","${ctx}/warehouse/ledger/ledger/form/edit?id=" + id, '1200', '800');
jp.openSaveDialog("编辑台账","${ctx}/warehouse/ledger/ledger/form/edit?id=" + id, '1400', '800');
}
function view(id){//没有权限时,不显示确定按钮
if(id == undefined){
id = getIdSelections();
}
jp.openViewDialog("查看台账","${ctx}/warehouse/ledger/ledger/form/view?id=" + id,'1200', '800');
jp.openViewDialog("查看台账","${ctx}/warehouse/ledger/ledger/form/view?id=" + id,'1400', '800');
}
......@@ -534,6 +534,7 @@ function scanIptGetFocusStop () {
<tr>
<th>品名</th>
<th>代码</th>
<th>物资编码</th>
<th>数量</th>
<th>单位</th>
<th>型号</th>
......@@ -542,6 +543,7 @@ function scanIptGetFocusStop () {
<th>批次号</th>
<th>货架</th>
<th>仓库</th>
<th>备注</th>
</tr>
</thead>
<tbody id="ledgerChild-{{idx}}-1-List">
......@@ -558,6 +560,7 @@ function scanIptGetFocusStop () {
<td>
{{row.type.code}}
</td>
<td>{{row.code}}</td>
<td>
{{row.num}}
</td>
......@@ -583,6 +586,9 @@ function scanIptGetFocusStop () {
<td>
{{row.warehouseNames}}
</td>
<td>
{{row.remarks}}
</td>
</tr>//-->
</script>
......@@ -26,6 +26,7 @@
if(data.length){
data = data.map(function(item){
item.delFlag = 0;
item.infoSum = new Big(item.num).times(item.amount).toNumber();
return item;
})
}
......@@ -48,30 +49,50 @@
}
},
{
field: 'ledgerInfo.name',
title: '物资名称',
field: 'ledgerInfo.code',
title: '物资编码',
formatter: function (value, row, index) {
return Mustache.render($("#ledgerInfoNameTpl").html(), {
return Mustache.render($("#ledgerInfoCodeTpl").html(), {
row: row,
idx: index
})
}
},
{
field: 'ledgerInfo.code',
title: '物资编码',
field: 'ledgerInfo.type.name',
title: '品名',
formatter: function (value, row, index) {
return Mustache.render($("#ledgerInfoCodeTpl").html(), {
return Mustache.render($("#ledgerInfoTypeTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""), {
row: row,
idx: index
})
}
},
{
field: 'ledgerInfo.type.name',
title: '品名代码',
field: 'ledgerInfo.type.code',
title: '代码',
formatter: function (value, row, index) {
return Mustache.render($("#ledgerInfoTypeTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""), {
return Mustache.render($("#ledgerInfoTypeCodeTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""), {
row: row,
idx: index
})
}
},
{
field: 'ledgerInfo.amount',
title: '单价',
formatter: function (value, row, index) {
return Mustache.render($("#ledgerInfoAmountTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""), {
row: row,
idx: index
})
}
},
{
field: "ledgerInfo.type.unit",
title: '单位',
formatter: function (value, row, index) {
return Mustache.render($("#ledgerInfoTypeUnitTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""), {
row: row,
idx: index
})
......@@ -88,10 +109,21 @@
}
},
{
field: 'ledgerInfo.amount',
title: '单价',
field: 'num',
title: '数量',
formatter: function (value, row, index) {
return Mustache.render($("#ledgerInfoAmountTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""), {
return Mustache.render($("#ledgerInfoNumTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""), {
row: row,
idx: index
})
}
},
{
field: 'infoSum',
title: '总价',
sortName: 'infoSum',
formatter: function (value, row, index) {
return Mustache.render($("#ledgerInfoInfoSumTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""), {
row: row,
idx: index
})
......@@ -170,6 +202,7 @@
})
var data = newItems.map(function (item) {
item[0] = false;
item.infoSum = new Big(item.num).times(item.amount).toNumber();
return {
id: '',
delFlag: 0,
......@@ -377,6 +410,16 @@
<sys:treeselect id="materialRequisitionInfoList{{idx}}_ledgerInfoType" name="materialRequisitionInfoList[{{idx}}].ledgerInfo.type.id" value="{{row.ledgerInfo.type.id}}" labelName="materialRequisitionInfoList{{idx}}.ledgerInfo.type.name" labelValue="{{row.ledgerInfo.type.name}}"
title="品名代码" url="/warehouse/materialtype/materialType/treeData" cssClass="form-control " disabled="disabled" allowClear="true"/>//-->
</script>
<script id="ledgerInfoTypeCodeTpl" type="text/html">
<input id="materialRequisitionInfoList{{idx}}_ledgerInfoTypeCode"
name="materialRequisitionInfoList[{{idx}}].ledgerInfo.type.code" type="text" class="form-control" readonly
value="{{row.ledgerInfo.type.code}}"/>
</script>
<script id="ledgerInfoTypeUnitTpl" type="text/html">
<input id="materialRequisitionInfoList{{idx}}_ledgerInfoTypeUnit
name="materialRequisitionInfoList[{{idx}}].ledgerInfo.type.unit" type="text" class="form-control" readonly
value="{{row.ledgerInfo.type.unit}}"/>
</script>
<script id="ledgerInfoModelTpl" type="text/html">
<input id="materialRequisitionInfoList{{idx}}_ledgerInfoModel"
name="materialRequisitionInfoList[{{idx}}].ledgerInfo.model" type="text" class="form-control" readonly
......@@ -387,6 +430,16 @@
name="materialRequisitionInfoList[{{idx}}].ledgerInfo.amount" type="text" readonly class="form-control"
value="{{row.ledgerInfo.amount}}"/>
</script>
<script id="ledgerInfoNumTpl" type="text/html">
<input id="materialRequisitionInfoList{{idx}}_ledgerInfoNum"
name="materialRequisitionInfoList[{{idx}}].ledgerInfo.num" type="text" readonly class="form-control"
value="{{row.ledgerInfo.num}}"/>
</script>
<script id="ledgerInfoInfoSumTpl" type="text/html">
<input id="materialRequisitionInfoList{{idx}}_ledgerInfoInfoSum"
name="materialRequisitionInfoList[{{idx}}].ledgerInfo.infoSum" type="text" readonly class="form-control"
value="{{row.ledgerInfo.infoSum}}"/>
</script>
<script id="receiverTpl" type="text/html">
<input type="hidden" name="materialRequisitionInfoList[{{idx}}].receiver" value="{{row.receiver}}">
{{#row.receiver}}
......
......@@ -8,6 +8,7 @@
<link rel="stylesheet" href="${ctxStatic}/plugin/bootstrapTable/bootstrap-table.min.css">
<script type="text/javascript" src="${ctxStatic}/plugin/bootstrapTable/bootstrap-table.min.js"></script>
<script type="text/javascript" src="${ctxStatic}/plugin/bootstrapTable/bootstrap-table-zh-CN.js"></script>
<script type="text/javascript" src="${ctxStatic}/common/js/big.js"></script>
<style>
.sign-result{
width: 80px;
......
<%@ page contentType="text/html;charset=UTF-8" %>
<script>
$(document).ready(function() {
<script>
$(document).ready(function() {
$('#materialRequisitionTable').bootstrapTable({
//请求方法
......@@ -119,8 +119,8 @@ $(document).ready(function() {
sortable: true,
sortName: 'time'
}
,{
},
{
field: 'status',
title: '出库状态',
sortable: true,
......@@ -129,13 +129,25 @@ $(document).ready(function() {
return jp.getDictLabel(${fns:toJson(fns:getDictList('wh_delivery_status'))}, value, "-");
}
}
,{
},
{
field: 'remarks',
title: '备注信息',
sortable: true,
sortName: 'remarks'
},
{
title: '操作',
formatter (v, r) {
if (r.status === '1') {
return "<a class='delivery'>出库</a>"
}
},
events: {
'click .delivery': function (e, v, r) {
onDelivery(r.id);
}
}
}
]
......@@ -216,13 +228,13 @@ $(document).ready(function() {
});
function getIdSelections() {
function getIdSelections() {
return $.map($("#materialRequisitionTable").bootstrapTable('getSelections'), function (row) {
return row.id
});
}
}
function deleteAll(){
function deleteAll(){
jp.confirm('确认要删除该物资领用记录吗?', function(){
jp.loading();
......@@ -236,35 +248,35 @@ $(document).ready(function() {
})
})
}
}
//刷新列表
function refresh(){
//刷新列表
function refresh(){
$('#materialRequisitionTable').bootstrapTable('refresh');
}
function add(){
}
function add(){
jp.openSaveDialog("新增物资领用","${ctx}/warehouse/materialrequisition/materialRequisition/form/add",'1200','800');
}
}
function edit(id){
function edit(id){
if(id == undefined){
id = getIdSelections();
}
jp.openSaveDialog("编辑物资领用","${ctx}/warehouse/materialrequisition/materialRequisition/form/edit?id=" + id, '1200','800');
}
}
function view(id){//没有权限时,不显示确定按钮
function view(id){//没有权限时,不显示确定按钮
if(id == undefined){
id = getIdSelections();
}
jp.openViewDialog("查看物资领用","${ctx}/warehouse/materialrequisition/materialRequisition/form/view?id=" + id,'1200','800');
}
}
function detailFormatter(index, row) {
function detailFormatter(index, row) {
var htmltpl = $("#materialRequisitionChildrenTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
var html = Mustache.render(htmltpl, {
idx:row.id
......@@ -282,29 +294,32 @@ $(document).ready(function() {
})
return html;
}
}
function addRow(list, idx, tpl, row){
function addRow(list, idx, tpl, row){
$(list).append(Mustache.render(tpl, {
idx: idx, delBtn: true, row: row
}));
}
}
/**
/**
* 出库
*/
function onDelivery(){
function onDelivery (id) {
if (!id) {
id = getIdSelections();
}
jp.confirm('确认是否出库?', function (){
jp.get('${ctx}/warehouse/materialrequisition/materialRequisition/delivery?id='+getIdSelections(), function (res){
if(res.success){
jp.get('${ctx}/warehouse/materialrequisition/materialRequisition/delivery?id='+ id, function (res){
if (res.success) {
jp.success(res.msg);
refresh();
}else{
} else {
jp.error(res.msg);
}
})
})
}
}
</script>
<script type="text/template" id="materialRequisitionChildrenTpl">//<!--
<div class="tabs-container">
......@@ -317,10 +332,16 @@ $(document).ready(function() {
<thead>
<tr>
<th>物资编码</th>
<th>物资名称</th>
<th>品名</th>
<th>代码</th>
<th>数量</th>
<th>单位</th>
<th>型号</th>
<th>品名代码</th>
<th>单价</th>
<th>总价</th>
<th>批次号</th>
<th>货架</th>
<th>仓库</th>
<th>领用人</th>
<th>备注</th>
</tr>
......@@ -330,29 +351,47 @@ $(document).ready(function() {
</table>
</div>
</div>//-->
</script>
<script type="text/template" id="materialRequisitionChild1Tpl">//<!--
</script>
<script type="text/template" id="materialRequisitionChild1Tpl">//<!--
<tr>
<td>
{{row.ledgerInfo.code}}
</td>
<td>
{{row.ledgerInfo.name}}
{{row.ledgerInfo.type.name}}
</td>
<td>
{{row.ledgerInfo.model}}
{{row.ledgerInfo.type.code}}
</td>
<td>
{{row.ledgerInfo.type.name}}
{{row.ledgerInfo.num}}
</td>
<td>
{{row.ledgerInfo.type.unit}}
</td>
<td>
{{row.ledgerInfo.model}}
</td>
<td>
{{row.ledgerInfo.amount}}
</td>
<td>
{{row.ledgerInfo.infoSum}}
</td>
<td>
{{row.ledgerInfo.batchNum}}
</td>
<td>
{{row.shelvesNames}}
</td>
<td>
{{row.warehouseNames}}
</td>
<td>
<img src="{{row.receiver}}" width="80"/>
</td>
<td>
{{row.remarks}}
</td>
</tr>//-->
</script>
</script>
......@@ -299,11 +299,18 @@ $(document).ready(function() {
<table class="ani table">
<thead>
<tr>
<th>品名</th>
<th>代码</th>
<th>物资编码</th>
<th>物资名称</th>
<th>品名代码</th>
<th>数量</th>
<th>单位</th>
<th>型号</th>
<th>单价</th>
<th>总价</th>
<th>批次号</th>
<th>货架</th>
<th>仓库</th>
<th>备注</th>
</tr>
</thead>
<tbody id="outboundChild-{{idx}}-1-List">
......@@ -315,21 +322,42 @@ $(document).ready(function() {
<script type="text/template" id="outboundChild1Tpl">//<!--
<tr>
<td>
{{row.ledgerInfo.name}}
</td>
<td>
{{row.ledgerInfo.code}}
</td>
<td>
{{row.ledgerInfo.type.name}}
</td>
<td>
{{row.ledgerInfo.type.code}}
</td>
<td>
{{row.ledgerInfo.num}}
</td>
<td>
{{row.ledgerInfo.type.unit}}
</td>
<td>
{{row.ledgerInfo.model}}
</td>
<td>
{{row.ledgerInfo.amount}}
</td>
<td>
{{row.ledgerInfo.infoSum}}
</td>
<td>
{{row.ledgerInfo.batchNum}}
</td>
<td>
{{row.shelvesNames}}
</td>
<td>
{{row.warehouseNames}}
</td>
<td>
<img src="{{row.receiver}}" width="80"/>
</td>
<td>
{{row.remarks}}
</td>
</tr>//-->
......
<%@ page contentType="text/html;charset=UTF-8" %>
<script>
$(document).ready(function() {
<script>
$(document).ready(function() {
$('#storageTable').bootstrapTable({
//请求方法
......@@ -120,13 +120,13 @@ $(document).ready(function() {
sortName: 'batchNum'
}
,{
field: 'remarks',
title: '备注信息',
sortable: true,
sortName: 'remarks'
}
// ,{
// field: 'remarks',
// title: '备注信息',
// sortable: true,
// sortName: 'remarks'
//
// }
]
});
......@@ -211,13 +211,13 @@ $(document).ready(function() {
});
function getIdSelections() {
function getIdSelections() {
return $.map($("#storageTable").bootstrapTable('getSelections'), function (row) {
return row.id
});
}
}
function deleteAll(){
function deleteAll(){
jp.confirm('确认要删除该入库信息记录吗?', function(){
jp.loading();
......@@ -231,35 +231,35 @@ $(document).ready(function() {
})
})
}
}
//刷新列表
function refresh(){
//刷新列表
function refresh(){
$('#storageTable').bootstrapTable('refresh');
}
function add(){
}
function add(){
jp.openSaveDialog("新增入库单","${ctx}/warehouse/storage/storage/form/add", '1400', '800');
}
}
function edit(id){
function edit(id){
if(id == undefined){
id = getIdSelections();
}
jp.openSaveDialog("编辑入库单","${ctx}/warehouse/storage/storage/form/edit?id=" + id, '1400', '800');
}
}
function view(id){//没有权限时,不显示确定按钮
function view(id){//没有权限时,不显示确定按钮
if(id == undefined){
id = getIdSelections();
}
jp.openViewDialog("查看入库单","${ctx}/warehouse/storage/storage/form/view?id=" + id, '1400', '800');
}
}
function detailFormatter(index, row) {
function detailFormatter(index, row) {
var htmltpl = $("#storageChildrenTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
var html = Mustache.render(htmltpl, {
idx:row.id
......@@ -291,15 +291,15 @@ $(document).ready(function() {
})
return html;
}
}
function addRow(list, idx, tpl, row){
function addRow(list, idx, tpl, row){
$(list).append(Mustache.render(tpl, {
idx: idx, delBtn: true, row: row
}));
}
}
function onStorage(countStorage, goodsInfoId, rowIndex){
function onStorage(countStorage, goodsInfoId, rowIndex){
debugger
var main = JSON.parse(countStorage);
var data = [main];
......@@ -332,8 +332,9 @@ $(document).ready(function() {
var num$ = $("<input type='hidden' name='ledgerInfoList["+index+"].num' value='"+item.num+"' />");
var shelvesIds$ = $("<input type='hidden' name='ledgerInfoList["+index+"].shelvesIds' value='"+item.shelvesIds+"' />");
var warehouseIds$ = $("<input type='hidden' name='ledgerInfoList["+index+"].warehouseIds' value='"+item.warehouseIds+"' />");
var remarks$ = $("<input type='hidden' name='ledgerInfoList["+index+"].remarks' value='"+item.remarks+"' />");
$("#ledgerForm").append(id$).append(delFlag$).append(name$).append(typeId$).append(batchNum$).append(model$).append(num$)
.append(goodsInfoId$).append(qrId$).append(code$).append(amount$).append(shelvesIds$).append(warehouseIds$);
.append(goodsInfoId$).append(qrId$).append(code$).append(amount$).append(shelvesIds$).append(warehouseIds$).append(remarks$);
})
jp.loading('入库中...');
jp.post("${ctx}/warehouse/ledger/ledger/save", $("#ledgerForm").serialize(), function (res){
......@@ -353,7 +354,7 @@ $(document).ready(function() {
//
// }
// })
}
}
</script>
<script type="text/template" id="storageChildrenTpl">//<!--
......@@ -375,6 +376,7 @@ $(document).ready(function() {
<th>总价</th>
<th>仓库</th>
<th>货架</th>
<th>备注</th>
<th>操作</th>
</tr>
</thead>
......@@ -383,8 +385,8 @@ $(document).ready(function() {
</table>
</div>
</div>//-->
</script>
<script type="text/template" id="storageChild1Tpl">//<!--
</script>
<script type="text/template" id="storageChild1Tpl">//<!--
<tr>
<td>
{{row.type.name}}
......@@ -413,7 +415,9 @@ $(document).ready(function() {
<td>
{{row.shelvesNames}}
</td>
<td>
{{row.remarks}}
</td>
{{#row.isNotStorage}}
<td>
<a href="javascript:void(0);" onclick="onStorage('{{row.jsonStr}}','{{row.goodsInfo.id}}',{{row.mainRowIndex}})">入库</a>
......@@ -425,4 +429,4 @@ $(document).ready(function() {
</td>
{{/row.isStorage}}
</tr>//-->
</script>
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment