Commit 32c60d61 by anxiaohe

入库信息表单

parent ac21204b
......@@ -287,7 +287,7 @@ $(document).ready(function() {
}));
}
function printQr(id) {
function printQr_(id) {
try{
if(!LODOP){
initLodop();
......@@ -311,6 +311,17 @@ $(document).ready(function() {
}
}
function printQr (id) {
jp.loading('loading...');
jp.get("${ctx}/warehouse/goods/goods/printQr?goodsInfoId="+id, function (res) {
if (res.success) {
var row = res.body.goodsInfo.qrCode;
console.log(row)
}
jp.close();
})
}
function createAllPage(item){
// if(!list){
......
<%@ page contentType="text/html;charset=UTF-8" %>
<script>
var defPrintOption = {
// post ws
linkDeviceType: 'post',
// usb tcp
protocol: 'usb'
}
const __io_lnk = function() {
return 'localhost:8008'
}
const __io_url = function() {
return 'http://' + __io_lnk() + '/thermal.io?data='
}
const __ws_url = function() {
return 'ws://' + __io_lnk() + '/thermal.ws'
}
/**
* 枚举设备 获取设备
* @private
*/
function _thermal_enum_printer_ () {
var onBack = function onBack (isOk, res) {
if (!isOk) {
output_control('通讯失败:' + JSON.stringify(res));
return
}
if (res.code !== 0) {
output_control(res.msg);
return
}
let enum_list = document.getElementById('enum_list')
if (enum_list.length > 0) { enum_list.clear() }
if (res.device.length > 0) {
// for (let i = 0; i < res.device.length; i++) {
// let opt = document.createElement('option')
// opt.text = res.device[i]
// enum_list.options.add(opt)
// }
console.log(res);
} else {
output_control(res.message)
}
}
let pack = {
command: '_thermal_enum_printer_',
require: require_type(),
}
on_link_device(pack, onBack);
}
function require_type () {
return defPrintOption.protocol;
}
function on_link_device (pack, onBack) {
let radio = document.getElementsByName('req_model')
if (radio != null) {
if (radio.length > 0) {
if (radio[0].checked) { jqpost(__io_url(), pack, onback) }
}
if (radio.length > 1) {
if (radio[1].checked) { jqlink(__ws_url(), pack, onback) }
}
}
}
// 输出信息
function output_control (text) {
console.log(text);
}
</script>
......@@ -25,7 +25,14 @@
if(data.length){
data = data.map(function(item){
item.delFlag = 0;
item.readonly = item.qrCode && item.qrCode.state === '2'
item.readonly = item.qrCode && item.qrCode.state === '2';
item.infoSum = new Big(item.num).times(item.amount).toNumber();
item.shelvesNames = item.shelvesList.map(function (e) {
return e.name;
}).join(',');
item.warehouseNames = item.warehouseList.map(function (e) {
return e.name;
}).join(',');
return item;
})
}
......@@ -315,11 +322,15 @@
shelvesNames: '',
warehouseNames: ''
};
var warehouseIdMap = {};
nodes.forEach(function (item) {
obj.shelvesIds += item.id + ',';
obj.shelvesNames += item.name + ',';
obj.warehouseIds += item.warehouse.id + ',';
obj.warehouseNames += item.warehouse.name + ','
if (!warehouseIdMap[item.warehouse.id]) {
obj.warehouseIds += item.warehouse.id + ',';
obj.warehouseNames += item.warehouse.name + ',';
warehouseIdMap[item.warehouse.id] = true;
}
})
// var node = nodes[0];
// var obj = {
......
......@@ -91,13 +91,13 @@
<%@include file="storageDetail.jsp" %>
</td>
</tr>
<c:if test="${mode == 'view'}">
<tr>
<td colspan="4">
<%@include file="storageStatistic.jsp" %>
</td>
</tr>
</c:if>
<%-- <c:if test="${mode == 'view'}">--%>
<%-- <tr>--%>
<%-- <td colspan="4">--%>
<%-- <%@include file="storageStatistic.jsp" %>--%>
<%-- </td>--%>
<%-- </tr>--%>
<%-- </c:if>--%>
</table>
</form:form>
</div>
......@@ -111,7 +111,7 @@
initTable();
if('${mode}' == 'view'){
getDetail();
// getDetail();
initStatisticTable();
}
......
......@@ -264,17 +264,25 @@ $(document).ready(function() {
var html = Mustache.render(htmltpl, {
idx:row.id
});
$.get("${ctx}/warehouse/storage/storage/countStorage?id="+row.id, function(storage){
$.get("${ctx}/warehouse/storage/storage/detail?id="+row.id, function(storage){
var storageChild1RowIdx = 0, storageChild1Tpl = $("#storageChild1Tpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
var data1 = storage.countStorageInfoList;
var data1 = storage.storageInfoList;
for (var i=0; i<data1.length; i++){
var item = data1[i];
data1[i].dict = {};
data1[i].storageId = row.id;
data1[i].batchNum = row.batchNum;
data1[i].jsonStr = JSON.stringify(data1[i]);
data1[i].isNotStorage = data1[i].state === '1';
data1[i].isNotStorage = data1[i].state !== '2';
data1[i].isStorage = data1[i].state === '2';
data1[i].mainRowIndex = index;
item.infoSum = new Big(item.num).times(item.amount).toNumber();
item.shelvesNames = item.shelvesList.map(function (e) {
return e.name
}).join(',');
item.warehouseNames = item.warehouseList.map(function (e) {
return e.name
}).join(',');
addRow('#storageChild-'+row.id+'-1-List', storageChild1RowIdx, storageChild1Tpl, data1[i]);
storageChild1RowIdx = storageChild1RowIdx + 1;
}
......@@ -292,52 +300,58 @@ $(document).ready(function() {
}
function onStorage(countStorage, goodsInfoId, rowIndex){
debugger
var main = JSON.parse(countStorage);
jp.get("${ctx}/warehouse/storage/storage/findInfoBycountStorage?goodsInfo.id="+goodsInfoId+"&storage.id="+main.storageId, function (res){
var data = res.body.storageInfoList;
if(Array.isArray(data)){
var shelvesIds = data.map(function (item){
return item.shelves.id
}).join(',');
// 构建台账主表
var name$ = $("<input type='hidden' name='name' value='"+main.name+"' />");
var typeId$ = $("<input type='hidden' name='type.id' value='"+main.type.id+"' />");
var typeName$ = $("<input type='hidden' name='type.name' value='"+main.type.name+"' />");
var model$ = $("<input type='hidden' name='model' value='"+main.model+"' />");
var shelvesIds$ = $("<input type='hidden' name='shelvesIds' value='"+shelvesIds+"' />");
var num$ = $("<input type='hidden' name='num' value="+main.num+" />");
var sum$ = $("<input type='hidden' name='sum' value="+main.sum+" />");
$("#ledgerForm").empty();
$("#ledgerForm").append(name$).append(typeId$).append(typeName$).append(model$).append(shelvesIds$).append(num$).append(sum$);
data.forEach(function (item,index){
// 构建台账附表
var id$ = $("<input type='hidden' name='ledgerInfoList["+index+"].id' value='' />");
var delFlag$ = $("<input type='hidden' name='ledgerInfoList["+index+"].delFlag' value='0' />");
var name$ = $("<input type='hidden' name='ledgerInfoList["+index+"].name' value='"+item.name+"' />");
var typeId$ = $("<input type='hidden' name='ledgerInfoList["+index+"].type.id' value='"+item.type.id+"' />");
var batchNum$ = $("<input type='hidden' name='ledgerInfoList["+index+"].batchNum' value='"+main.batchNum+"' />");
var model$ = $("<input type='hidden' name='ledgerInfoList["+index+"].model' value='"+item.model+"' />");
var goodsInfoId$ = $("<input type='hidden' name='ledgerInfoList["+index+"].goodsInfo.id' value='"+item.goodsInfo.id+"' />");
var qrId$ = $("<input type='hidden' name='ledgerInfoList["+index+"].qr.id' value='"+item.qrCode.id+"' />");
var shelvesId$ = $("<input type='hidden' name='ledgerInfoList["+index+"].shelves.id' value='"+item.shelves.id+"' />");
var code$ = $("<input type='hidden' name='ledgerInfoList["+index+"].code' value='"+item.qrCode.code+"' />");
var amount$ = $("<input type='hidden' name='ledgerInfoList["+index+"].amount' value='"+item.amount+"' />");
$("#ledgerForm").append(id$).append(delFlag$).append(name$).append(typeId$).append(batchNum$).append(model$).append(goodsInfoId$).append(qrId$).append(shelvesId$).append(code$).append(amount$);
})
jp.loading('入库中...');
jp.post("${ctx}/warehouse/ledger/ledger/save", $("#ledgerForm").serialize(), function (res){
if(res.success){
jp.success('入库成功!');
$('#storageTable').bootstrapTable('collapseRow', rowIndex);
setTimeout(function (){
$('#storageTable').bootstrapTable('expandRow', rowIndex);
},0)
}else {
jp.error('入库失败!');
}
})
}
})
var data = [main];
// var shelvesIds = data.map(function (item){
// return item.shelves.id
// }).join(',');
// 构建台账主表
var name$ = $("<input type='hidden' name='name' value='"+main.name+"' />");
var typeId$ = $("<input type='hidden' name='type.id' value='"+main.type.id+"' />");
var typeName$ = $("<input type='hidden' name='type.name' value='"+main.type.name+"' />");
var model$ = $("<input type='hidden' name='model' value='"+main.model+"' />");
// var shelvesIds$ = $("<input type='hidden' name='shelvesIds' value='"+shelvesIds+"' />");
var num$ = $("<input type='hidden' name='num' value="+main.num+" />");
var sum$ = $("<input type='hidden' name='sum' value="+new Big(main.num).times(main.amount).toNumber()+" />");
$("#ledgerForm").empty();
$("#ledgerForm").append(name$).append(typeId$).append(typeName$).append(model$).append(num$).append(sum$);
data.forEach(function (item,index){
// 构建台账附表
var id$ = $("<input type='hidden' name='ledgerInfoList["+index+"].id' value='' />");
var delFlag$ = $("<input type='hidden' name='ledgerInfoList["+index+"].delFlag' value='0' />");
var name$ = $("<input type='hidden' name='ledgerInfoList["+index+"].name' value='"+item.name+"' />");
var typeId$ = $("<input type='hidden' name='ledgerInfoList["+index+"].type.id' value='"+item.type.id+"' />");
var batchNum$ = $("<input type='hidden' name='ledgerInfoList["+index+"].batchNum' value='"+main.batchNum+"' />");
var model$ = $("<input type='hidden' name='ledgerInfoList["+index+"].model' value='"+item.model+"' />");
var goodsInfoId$ = $("<input type='hidden' name='ledgerInfoList["+index+"].goodsInfo.id' value='"+item.goodsInfo.id+"' />");
var qrId$ = $("<input type='hidden' name='ledgerInfoList["+index+"].qr.id' value='"+item.qrCode.id+"' />");
// var shelvesId$ = $("<input type='hidden' name='ledgerInfoList["+index+"].shelves.id' value='"+item.shelves.id+"' />");
var code$ = $("<input type='hidden' name='ledgerInfoList["+index+"].code' value='"+item.qrCode.code+"' />");
var amount$ = $("<input type='hidden' name='ledgerInfoList["+index+"].amount' value='"+item.amount+"' />");
var shelvesIds$ = $("<input type='hidden' name='ledgerInfoList["+index+"].shelvesIds' value='"+item.shelvesIds+"' />");
var warehouseIds$ = $("<input type='hidden' name='ledgerInfoList["+index+"].warehouseIds' value='"+item.warehouseIds+"' />");
$("#ledgerForm").append(id$).append(delFlag$).append(name$).append(typeId$).append(batchNum$).append(model$)
.append(goodsInfoId$).append(qrId$).append(code$).append(amount$).append(shelvesIds$).append(warehouseIds$);
})
jp.loading('入库中...');
jp.post("${ctx}/warehouse/ledger/ledger/save", $("#ledgerForm").serialize(), function (res){
if(res.success){
jp.success('入库成功!');
$('#storageTable').bootstrapTable('collapseRow', rowIndex);
setTimeout(function (){
$('#storageTable').bootstrapTable('expandRow', rowIndex);
},0)
}else {
jp.error('入库失败!');
}
})
// jp.get("${ctx}/warehouse/storage/storage/findInfoBycountStorage?goodsInfo.id="+goodsInfoId+"&storage.id="+main.storageId, function (res){
// var data = res.body.storageInfoList;
// if(Array.isArray(data)){
//
// }
// })
}
</script>
......@@ -351,13 +365,15 @@ $(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>
......@@ -370,26 +386,33 @@ $(document).ready(function() {
<script type="text/template" id="storageChild1Tpl">//<!--
<tr>
<td>
{{row.name}}
{{row.type.name}}
</td>
<td>
{{row.type.name}}
{{row.type.code}}
</td>
<td>
{{row.amount}}
</td>
<td>
{{row.type.unit}}
</td>
<td>
{{row.model}}
</td>
<td>
{{row.warehouseNames}}
{{row.num}}
</td>
<td>
{{row.shelvesNames}}
{{row.infoSum}}
</td>
<td>
{{row.sum}}
{{row.warehouseNames}}
</td>
<td>
{{row.num}}
{{row.shelvesNames}}
</td>
{{#row.isNotStorage}}
<td>
<a href="javascript:void(0);" onclick="onStorage('{{row.jsonStr}}','{{row.goodsInfo.id}}',{{row.mainRowIndex}})">入库</a>
......
......@@ -7,6 +7,7 @@
<meta name="decorator" content="ani"/>
<%@ include file="/webpage/include/bootstraptable.jsp" %>
<%@include file="/webpage/include/treeview.jsp" %>
<script type="text/javascript" src="${ctxStatic}/common/js/big.js"></script>
<%@include file="storageList.js" %>
</head>
<body>
......@@ -128,4 +129,4 @@
<form id="ledgerForm"></form>
</div>
</body>
</html>
\ No newline at end of file
</html>
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