Commit 32c60d61 by anxiaohe

入库信息表单

parent ac21204b
...@@ -287,7 +287,7 @@ $(document).ready(function() { ...@@ -287,7 +287,7 @@ $(document).ready(function() {
})); }));
} }
function printQr(id) { function printQr_(id) {
try{ try{
if(!LODOP){ if(!LODOP){
initLodop(); initLodop();
...@@ -311,6 +311,17 @@ $(document).ready(function() { ...@@ -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){ function createAllPage(item){
// if(!list){ // 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 @@ ...@@ -25,7 +25,14 @@
if(data.length){ if(data.length){
data = data.map(function(item){ data = data.map(function(item){
item.delFlag = 0; 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; return item;
}) })
} }
...@@ -315,11 +322,15 @@ ...@@ -315,11 +322,15 @@
shelvesNames: '', shelvesNames: '',
warehouseNames: '' warehouseNames: ''
}; };
var warehouseIdMap = {};
nodes.forEach(function (item) { nodes.forEach(function (item) {
obj.shelvesIds += item.id + ','; obj.shelvesIds += item.id + ',';
obj.shelvesNames += item.name + ','; obj.shelvesNames += item.name + ',';
if (!warehouseIdMap[item.warehouse.id]) {
obj.warehouseIds += item.warehouse.id + ','; obj.warehouseIds += item.warehouse.id + ',';
obj.warehouseNames += item.warehouse.name + ',' obj.warehouseNames += item.warehouse.name + ',';
warehouseIdMap[item.warehouse.id] = true;
}
}) })
// var node = nodes[0]; // var node = nodes[0];
// var obj = { // var obj = {
......
...@@ -91,13 +91,13 @@ ...@@ -91,13 +91,13 @@
<%@include file="storageDetail.jsp" %> <%@include file="storageDetail.jsp" %>
</td> </td>
</tr> </tr>
<c:if test="${mode == 'view'}"> <%-- <c:if test="${mode == 'view'}">--%>
<tr> <%-- <tr>--%>
<td colspan="4"> <%-- <td colspan="4">--%>
<%@include file="storageStatistic.jsp" %> <%-- <%@include file="storageStatistic.jsp" %>--%>
</td> <%-- </td>--%>
</tr> <%-- </tr>--%>
</c:if> <%-- </c:if>--%>
</table> </table>
</form:form> </form:form>
</div> </div>
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
initTable(); initTable();
if('${mode}' == 'view'){ if('${mode}' == 'view'){
getDetail(); // getDetail();
initStatisticTable(); initStatisticTable();
} }
......
...@@ -264,17 +264,25 @@ $(document).ready(function() { ...@@ -264,17 +264,25 @@ $(document).ready(function() {
var html = Mustache.render(htmltpl, { var html = Mustache.render(htmltpl, {
idx:row.id 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 storageChild1RowIdx = 0, storageChild1Tpl = $("#storageChild1Tpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
var data1 = storage.countStorageInfoList; var data1 = storage.storageInfoList;
for (var i=0; i<data1.length; i++){ for (var i=0; i<data1.length; i++){
var item = data1[i];
data1[i].dict = {}; data1[i].dict = {};
data1[i].storageId = row.id; data1[i].storageId = row.id;
data1[i].batchNum = row.batchNum; data1[i].batchNum = row.batchNum;
data1[i].jsonStr = JSON.stringify(data1[i]); 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].isStorage = data1[i].state === '2';
data1[i].mainRowIndex = index; 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]); addRow('#storageChild-'+row.id+'-1-List', storageChild1RowIdx, storageChild1Tpl, data1[i]);
storageChild1RowIdx = storageChild1RowIdx + 1; storageChild1RowIdx = storageChild1RowIdx + 1;
} }
...@@ -292,23 +300,22 @@ $(document).ready(function() { ...@@ -292,23 +300,22 @@ $(document).ready(function() {
} }
function onStorage(countStorage, goodsInfoId, rowIndex){ function onStorage(countStorage, goodsInfoId, rowIndex){
debugger
var main = JSON.parse(countStorage); var main = JSON.parse(countStorage);
jp.get("${ctx}/warehouse/storage/storage/findInfoBycountStorage?goodsInfo.id="+goodsInfoId+"&storage.id="+main.storageId, function (res){ var data = [main];
var data = res.body.storageInfoList; // var shelvesIds = data.map(function (item){
if(Array.isArray(data)){ // return item.shelves.id
var shelvesIds = data.map(function (item){ // }).join(',');
return item.shelves.id
}).join(',');
// 构建台账主表 // 构建台账主表
var name$ = $("<input type='hidden' name='name' value='"+main.name+"' />"); var name$ = $("<input type='hidden' name='name' value='"+main.name+"' />");
var typeId$ = $("<input type='hidden' name='type.id' value='"+main.type.id+"' />"); 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 typeName$ = $("<input type='hidden' name='type.name' value='"+main.type.name+"' />");
var model$ = $("<input type='hidden' name='model' value='"+main.model+"' />"); var model$ = $("<input type='hidden' name='model' value='"+main.model+"' />");
var shelvesIds$ = $("<input type='hidden' name='shelvesIds' value='"+shelvesIds+"' />"); // var shelvesIds$ = $("<input type='hidden' name='shelvesIds' value='"+shelvesIds+"' />");
var num$ = $("<input type='hidden' name='num' value="+main.num+" />"); var num$ = $("<input type='hidden' name='num' value="+main.num+" />");
var sum$ = $("<input type='hidden' name='sum' value="+main.sum+" />"); var sum$ = $("<input type='hidden' name='sum' value="+new Big(main.num).times(main.amount).toNumber()+" />");
$("#ledgerForm").empty(); $("#ledgerForm").empty();
$("#ledgerForm").append(name$).append(typeId$).append(typeName$).append(model$).append(shelvesIds$).append(num$).append(sum$); $("#ledgerForm").append(name$).append(typeId$).append(typeName$).append(model$).append(num$).append(sum$);
data.forEach(function (item,index){ data.forEach(function (item,index){
// 构建台账附表 // 构建台账附表
var id$ = $("<input type='hidden' name='ledgerInfoList["+index+"].id' value='' />"); var id$ = $("<input type='hidden' name='ledgerInfoList["+index+"].id' value='' />");
...@@ -319,10 +326,13 @@ $(document).ready(function() { ...@@ -319,10 +326,13 @@ $(document).ready(function() {
var model$ = $("<input type='hidden' name='ledgerInfoList["+index+"].model' value='"+item.model+"' />"); 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 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 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 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 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 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$); 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.loading('入库中...');
jp.post("${ctx}/warehouse/ledger/ledger/save", $("#ledgerForm").serialize(), function (res){ jp.post("${ctx}/warehouse/ledger/ledger/save", $("#ledgerForm").serialize(), function (res){
...@@ -336,8 +346,12 @@ $(document).ready(function() { ...@@ -336,8 +346,12 @@ $(document).ready(function() {
jp.error('入库失败!'); 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> </script>
...@@ -351,13 +365,15 @@ $(document).ready(function() { ...@@ -351,13 +365,15 @@ $(document).ready(function() {
<table class="ani table"> <table class="ani table">
<thead> <thead>
<tr> <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>
<th>数量</th>
<th>操作</th> <th>操作</th>
</tr> </tr>
</thead> </thead>
...@@ -370,26 +386,33 @@ $(document).ready(function() { ...@@ -370,26 +386,33 @@ $(document).ready(function() {
<script type="text/template" id="storageChild1Tpl">//<!-- <script type="text/template" id="storageChild1Tpl">//<!--
<tr> <tr>
<td> <td>
{{row.name}} {{row.type.name}}
</td> </td>
<td> <td>
{{row.type.name}} {{row.type.code}}
</td>
<td>
{{row.amount}}
</td>
<td>
{{row.type.unit}}
</td> </td>
<td> <td>
{{row.model}} {{row.model}}
</td> </td>
<td> <td>
{{row.warehouseNames}} {{row.num}}
</td> </td>
<td> <td>
{{row.shelvesNames}} {{row.infoSum}}
</td> </td>
<td> <td>
{{row.sum}} {{row.warehouseNames}}
</td> </td>
<td> <td>
{{row.num}} {{row.shelvesNames}}
</td> </td>
{{#row.isNotStorage}} {{#row.isNotStorage}}
<td> <td>
<a href="javascript:void(0);" onclick="onStorage('{{row.jsonStr}}','{{row.goodsInfo.id}}',{{row.mainRowIndex}})">入库</a> <a href="javascript:void(0);" onclick="onStorage('{{row.jsonStr}}','{{row.goodsInfo.id}}',{{row.mainRowIndex}})">入库</a>
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
<meta name="decorator" content="ani"/> <meta name="decorator" content="ani"/>
<%@ include file="/webpage/include/bootstraptable.jsp" %> <%@ include file="/webpage/include/bootstraptable.jsp" %>
<%@include file="/webpage/include/treeview.jsp" %> <%@include file="/webpage/include/treeview.jsp" %>
<script type="text/javascript" src="${ctxStatic}/common/js/big.js"></script>
<%@include file="storageList.js" %> <%@include file="storageList.js" %>
</head> </head>
<body> <body>
......
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