Commit 830ae006 by yyq1988

对接入库功能

parent 216cf482
...@@ -279,6 +279,9 @@ $(document).ready(function() { ...@@ -279,6 +279,9 @@ $(document).ready(function() {
var data1 = storage.countStorageInfoList; var data1 = storage.countStorageInfoList;
for (var i=0; i<data1.length; i++){ for (var i=0; i<data1.length; i++){
data1[i].dict = {}; data1[i].dict = {};
data1[i].storageId = row.id;
data1[i].batchNum = row.batchNum;
data1[i].jsonStr = JSON.stringify(data1[i]);
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;
} }
...@@ -294,6 +297,49 @@ $(document).ready(function() { ...@@ -294,6 +297,49 @@ $(document).ready(function() {
idx: idx, delBtn: true, row: row idx: idx, delBtn: true, row: row
})); }));
} }
function onStorage(countStorage, goodsInfoId){
var main = JSON.parse(countStorage);
jp.get("${ctx}/warehouse/storage/storage/findInfoBycountStorage?goodsInfo.id="+goodsInfoId+"&storage="+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 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+"' />");
$("#ledgerForm").append(delFlag$).append(name$).append(typeId$).append(batchNum$).append(model$).append(goodsInfoId$).append(qrId$).append(shelvesId$).append(code$);
})
jp.loading('入库中...');
jp.post("${ctx}/warehouse/ledger/ledger/save", $("#ledgerForm").serialize(), function (res){
if(res.success){
jp.success(res.msg);
}else {
jp.error(res.msg);
}
})
}
})
}
</script> </script>
<script type="text/template" id="storageChildrenTpl">//<!-- <script type="text/template" id="storageChildrenTpl">//<!--
...@@ -313,6 +359,7 @@ $(document).ready(function() { ...@@ -313,6 +359,7 @@ $(document).ready(function() {
<th>货架</th> <th>货架</th>
<th>总价</th> <th>总价</th>
<th>数量</th> <th>数量</th>
<th>操作</th>
</tr> </tr>
</thead> </thead>
<tbody id="storageChild-{{idx}}-1-List"> <tbody id="storageChild-{{idx}}-1-List">
...@@ -344,5 +391,8 @@ $(document).ready(function() { ...@@ -344,5 +391,8 @@ $(document).ready(function() {
<td> <td>
{{row.num}} {{row.num}}
</td> </td>
<td>
<a href="javascript:void(0);" onclick="onStorage('{{row.jsonStr}}','{{row.goodsInfo.id}}')">入库</a>
</td>
</tr>//--> </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