Commit 17be87a3 by yyq1988

优化过滤重复的物资

parent 697ebca9
......@@ -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: '',
......
......@@ -136,10 +136,12 @@
var newItems = [];
items.forEach(function(item){
var fined = getTableData().find(function(v){
return v.qrCode.id !== item.qrCode.id
})
return v.qrCode.id === item.qrCode.id
});
if(!fined){
newItems.push(item)
}else{
jp.warning('有物资重复不能入库!');
}
})
var data = newItems.map(function (item){
......@@ -301,6 +303,13 @@
var goodsInfoId = json.infoId;
jp.get('${ctx}/warehouse/goods/goods/getGIAndQCByTwoId?goodsInfoId='+goodsInfoId+"&qrCodeId="+qrCodeId, function (res){
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,
......
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