Commit e3b9dcca by zhanglt

Merge branch 'master' of http://gitlab.yqdchina.com/huyi/warehouse into zlt

parents 74aada4d 17be87a3
......@@ -30,7 +30,9 @@
shelves.name AS "shelves.name"
shelves.name AS "shelves.name",
qr.url AS "qr.url"
</sql>
<sql id="ledgerInfoJoins">
......@@ -38,6 +40,7 @@
LEFT JOIN t_wh_material_type type ON type.id = a.type_id
LEFT JOIN t_wh_ledger b ON b.id = a.ledger_id
LEFT JOIN t_wh_shelves shelves ON shelves.id = a.shelves_id
LEFT JOIN t_wh_qr qr ON a.qr_id = qr.id
</sql>
......
......@@ -252,12 +252,12 @@ public class DrawQrcodeUtil {
, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
g2.setRenderingHints(rh);
Font font = new Font("黑体",Font.BOLD,16 * qRcodeSize.getInitfontSize());
Font font = new Font("黑体",Font.BOLD,12 * qRcodeSize.getInitfontSize());
g2.setFont(font); //设置字体:字体、字号、大小
g2.setColor(qRcodeSize.color);//设置背景颜色
// g2.setBackground(c);
int contentX = qRcodeSize.getInitContentX();
int contentY = qRcodeSize.getInitContentY() + 200;
int contentY = qRcodeSize.getInitContentY() + 150;
//写二维码
g2.drawImage(qrcodeImage,qRcodeSize.getQrcodeX(),qRcodeSize.getQrcodeY(),qRcodeSize.getQrcodeWidth(),qRcodeSize.getQrcodeHeight(),null,null);
......@@ -273,26 +273,48 @@ public class DrawQrcodeUtil {
//写入货品类型
String contentTitle2 = "货品类型:";
int contentTitle2Width = g2.getFontMetrics().stringWidth(contentTitle2);
g2.drawString(contentTitle2,contentX,contentY+200);
String typeName = formatContent(goodsInfo.getType().getName(),10);
as = new AttributedString(typeName);
as.addAttribute(TextAttribute.FONT, font);
as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_DASHED, 0, typeName.length());
g2.drawString(as.getIterator(),contentX+contentTitle2Width,contentY+200);
g2.drawString(contentTitle2,contentX,contentY+150);
String typeName = goodsInfo.getType().getName();
if (typeName.length() > 15) {
String str1 = typeName.substring(0, 9);
str1 = formatContent(str1,9);
as = new AttributedString(str1);
as.addAttribute(TextAttribute.FONT, font);
as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_DASHED, 0, str1.length());
g2.drawString(as.getIterator(),contentX+contentTitle2Width,contentY+150);
String str2 = typeName.substring(9, typeName.length());
str2 = formatContent(str2,9);
as = new AttributedString(str2);
as.addAttribute(TextAttribute.FONT, font);
as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_DASHED, 0, str2.length());
g2.drawString(as.getIterator(),contentX+contentTitle2Width,contentY+300);
} else {
typeName = formatContent(goodsInfo.getType().getName(),10);
as = new AttributedString(typeName);
as.addAttribute(TextAttribute.FONT, font);
as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_DASHED, 0, typeName.length());
g2.drawString(as.getIterator(),contentX+contentTitle2Width,contentY+150);
}
//写入物资编码
String contentTitle4 = "物资编码:";
int contentTitle4Width = g2.getFontMetrics().stringWidth(contentTitle4);
g2.drawString(contentTitle4,contentX,contentY+400);
g2.drawString(contentTitle4,contentX,contentY+450);
String code = qrCode.getCode();
if (code.length() > 10) {
String str1 = code.substring(0, 9);
str1 = formatContent(str1,10);
if (code.length() > 15) {
String str1 = code.substring(0, 14);
str1 = formatContent(str1,15);
as = new AttributedString(str1);
as.addAttribute(TextAttribute.FONT, font);
as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_DASHED, 0, str1.length());
g2.drawString(as.getIterator(),contentX+contentTitle4Width,contentY+400);
String str2 = code.substring(9, code.length());
str2 = formatContent(str2,10);
g2.drawString(as.getIterator(),contentX+contentTitle4Width,contentY+450);
String str2 = code.substring(14, code.length());
str2 = formatContent(str2,15);
as = new AttributedString(str2);
as.addAttribute(TextAttribute.FONT, font);
as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_DASHED, 0, str2.length());
......
......@@ -62,6 +62,3 @@
<link rel="stylesheet" id="theme" href="${ctxStatic}/common/css/app-${cookie.theme.value==null?'blue':cookie.theme.value}.css" />
<script src="${ctxStatic}/common/js/jeeplus.js"></script>
<script src="${ctxStatic}/common/js/LodopFuncs.js"></script>
<object id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0 style="display: none;">
<embed id="LODOP_EM" type="application/x-print-lodop" width=0 height=0></embed>
</object>
\ No newline at end of file
......@@ -286,33 +286,26 @@ $(document).ready(function() {
function printQr(id) {
jp.loading('loading...');
jp.get("${ctx}/warehouse/goods/goods/printQr?goodsInfoId="+id, function (res) {
refresh();
jp.success(res.msg);
})
// try{
// if(!LODOP){
// initLodop();
// }
// if(LODOP){
// jp.get("${ctx}/warehouse/goods/goods/printQr?goodsInfoId="+id, function (res) {
// var list = res.body.goodsInfo.qrCodeList;
// LODOP.PRINT_INIT("打印货品");
// LODOP.SET_PRINT_PAGESIZE(1,400,600,0)
// createAllPage(list);
// LODOP.PREVIEW();
// jp.close();
// })
// }else{
// jp.close();
// }
// }catch (e){
// jp.get("${ctx}/warehouse/goods/goods/printQr?goodsInfoId="+id, function (res) {
// var list = res.body.goodsInfo.qrCodeList;
// jp.close();
// })
// }
try{
if(!LODOP){
initLodop();
}
if(LODOP){
jp.get("${ctx}/warehouse/goods/goods/printQr?goodsInfoId="+id, function (res) {
var list = res.body.goodsInfo.qrCodeList;
LODOP.PRINT_INIT("打印货品");
LODOP.SET_PRINT_PAGESIZE(1,400,600,0)
createAllPage(list);
LODOP.PREVIEW();
jp.close();
})
}
}catch (e){
jp.get("${ctx}/warehouse/goods/goods/printQr?goodsInfoId="+id, function (res) {
var list = res.body.goodsInfo.qrCodeList;
jp.close();
})
}
}
function createAllPage(list){
......
......@@ -10,7 +10,7 @@
<table id="detail_table"></table>
<script>
var selector = "#detail_table";
var LODOP;
function initTable() {
var data = [];
$(selector).bootstrapTable({
......@@ -70,15 +70,39 @@
url: '${ctx}/warehouse/ledger/ledger/infoDate?batchNum='+ row.batchNum+'&ledger.id=${ledger.id}',
page: true,
columns: [
{checkbox:true},
{field: 'code', title: '物资编码'},
{field: 'name', title: '物资名称'},
{field: 'type.name', title: '品名代码'},
{field: 'model', title: '型号'},
{field: 'batchNum', title: '批次号'},
{field: 'shelves.name', title: '货架'},
{field: 'code', title: '物资编码'},
{field: 'amount', title: '单价'},
{
field: 'qr.url',
title: '二维码',
sortable: true,
sortName: 'qr.url',
formatter: function (){
return '<a class="view-qrcode">查看</a>&nbsp;&nbsp;<a class="print">打印</a>';
},
events: {
'click .view-qrcode': function (e,value,row){
jp.showPic('${ctxPath}'+row.qr.url)
},
'click .print': function (e,value,row){
onPrint(row);
}
}
}
]
})
});
$('#table').on('check.bs.table uncheck.bs.table load-success.bs.table ' +
'check-all.bs.table uncheck-all.bs.table', function () {
$('#batchPrintBtn').prop('disabled', ! $('#table').bootstrapTable('getSelections').length);
});
},
})
}
......@@ -148,11 +172,39 @@
function getTableData() {
return $(selector).bootstrapTable('getData');
}
function initLodop(){
LODOP = getLodop(document.getElementById('LODOP_OB'),document.getElementById('LODOP_EM'));
}
function onPrint(row) {
if(!LODOP){
initLodop();
}
LODOP.PRINT_INIT("打印货品");
LODOP.SET_PRINT_PAGESIZE(1,400,600,0);
if(!row){
var selections = $("#table").bootstrapTable('getSelections');
selections.forEach(function(item){
LODOP.NewPage();
var imgUrl = "${ctxPath}/" + item.qr.url;
LODOP.ADD_PRINT_IMAGE('0%',"0%","100%","100%","<img width='150' border='0' src='"+imgUrl+"' />");
});
LODOP.PREVIEW();
return;
}
LODOP.NewPage();
var imgUrl = "${ctxPath}/" + row.qr.url;
LODOP.ADD_PRINT_IMAGE('0%',"0%","100%","100%","<img width='150' border='0' src='"+imgUrl+"' />");
LODOP.PREVIEW();
}
</script>
<script id="detailTpl" type="text/html">
<br>
<div class="container-fluid">
<button id="batchPrintBtn" class="btn btn-primary" onclick="onPrint()" disabled>批量打印</button>
<table id="table"></table>
</div>
</script>
\ No newline at end of file
......@@ -147,7 +147,21 @@
searchKeys: "code",
}, function (items) {
if (Array.isArray(items)) {
var data = items.map(function (item) {
/***
* 重复的物资编码去重
*/
var newItems = [];
items.forEach(function(item){
var fined = getTableData().find(function(v){
return v.ledgerInfo.code === item.code
})
if(!fined){
newItems.push(item);
}else{
jp.warning('有物资重复不能领用!');
}
})
var data = newItems.map(function (item) {
item[0] = false;
return {
id: '',
......@@ -282,6 +296,17 @@
var data = res.rows || [];
if (data.length) {
var item = data[0];
/***
* 重复的物资编码去重
*/
var fined = getTableData().find(function(v){
return v.ledgerInfo.code === item.code
})
if(fined){
jp.warning('有物资重复不能领用');
return;
}
$(selector).bootstrapTable('append', [
{
id: '',
......
......@@ -78,6 +78,16 @@
}
},
{
field: 'warehouse.name',
title: '仓库',
formatter: function (value,row,index){
return Mustache.render($("#warehouseTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""),{
row: row,
idx: index
})
}
},
{
field: 'remarks',
title: '备注',
formatter: function (value,row,index){
......@@ -120,7 +130,21 @@
}
jp.openStorageSelectDialog({batchNum:$("#batchNum").val(),state: 0, isMultiSelect: true },function (items){
if(Array.isArray(items)){
var data = items.map(function (item){
/***
* 重复的物资编码去重
*/
var newItems = [];
items.forEach(function(item){
var fined = getTableData().find(function(v){
return v.qrCode.id === item.qrCode.id
});
if(!fined){
newItems.push(item)
}else{
jp.warning('有物资重复不能入库!');
}
})
var data = newItems.map(function (item){
item[0] = false;
if(item.goodsInfo && !item.goodsInfo.amount){
item.goodsInfo.amount = 0;
......@@ -131,7 +155,7 @@
remarks: '',
...item
}
})
});
$(selector).bootstrapTable('append', data)
}
})
......@@ -278,7 +302,14 @@
var qrCodeId = json.code;
var goodsInfoId = json.infoId;
jp.get('${ctx}/warehouse/goods/goods/getGIAndQCByTwoId?goodsInfoId='+goodsInfoId+"&qrCodeId="+qrCodeId, function (res){
var qrCode = res.body.qrCode;
var qrCode = res.body.qrCode;
var fined = getTableData().find(function(v){
return v.qrCode.id === qrCode.id
});
if(fined){
jp.warning('有物资重复不能入库!');
return;
}
$(selector).bootstrapTable('append',[
{
qrCode: qrCode,
......@@ -329,7 +360,9 @@
<script id="remarksTpl" type="text/html">
<textarea id="storageInfoList{{idx}}_remarks" name="storageInfoList[{{idx}}].remarks" rows="2" onchange="onInputChange('{{idx}}', this, 'remarks')" class="form-control ">{{row.remarks}}</textarea>
</script>
<script id="warehouseTpl" type="text/html">
<input id="storageInfoList{{idx}}_warehouseName" name="storageInfoList[{{idx}}].warehouse.name" type="text" value="{{row.warehouse.name}}" readonly class="form-control "/>
</script>
<script id="scanResultTpl" type="text/html">
<br>
<div class="container-fluid">
......
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