|
|
@ -169,6 +169,27 @@ |
|
|
|
|
|
|
|
computed() {}, |
|
|
|
methods: { |
|
|
|
filterList(originalList) { |
|
|
|
var resultList = [] |
|
|
|
for (var i = 0; i < originalList.length; i++) { |
|
|
|
let flag = -1 |
|
|
|
for (var j = 0; j < resultList.length; j++) { |
|
|
|
|
|
|
|
if (resultList[j].find(item => item.inventoryStatus == originalList[i]['inventoryStatus'])) { |
|
|
|
flag = j |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
if (flag == -1) { |
|
|
|
resultList.push([originalList[i]]) |
|
|
|
} else { |
|
|
|
resultList[j].push(originalList[i]) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return resultList; |
|
|
|
|
|
|
|
}, |
|
|
|
getManageMode(value) { |
|
|
|
var manageMode = "" |
|
|
|
if (value == 'BY_BATCH') { |
|
|
@ -209,6 +230,220 @@ |
|
|
|
}, |
|
|
|
|
|
|
|
refreshData(returnData) { |
|
|
|
if (returnData.recordList.length == 0) { |
|
|
|
if (this.manageMode == "BY_BATCH") { |
|
|
|
var mainItem = this.dataList.find(r => |
|
|
|
r.itemCode == returnData.itemCode && |
|
|
|
r.batch == returnData.batch && |
|
|
|
r.inventoryStatus == returnData.inventoryStatus) |
|
|
|
if (mainItem) { |
|
|
|
mainItem.recordList = [] |
|
|
|
} else if (this.manageMode == "BY_QUANTITY") { |
|
|
|
var mainItem = this.dataList.find(r => |
|
|
|
r.itemCode == returnData.itemCode && |
|
|
|
r.inventoryStatus == returnData.inventoryStatus) |
|
|
|
|
|
|
|
if (mainItem) { |
|
|
|
mainItem.recordList = [] |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
var filterList = this.filterList(returnData.recordList) |
|
|
|
var addList = [] |
|
|
|
filterList.forEach(main => { |
|
|
|
main.forEach(subItem => { |
|
|
|
if (this.manageMode == "BY_BATCH") { |
|
|
|
var mainItem = this.dataList.find(r => |
|
|
|
r.itemCode == subItem.itemCode && |
|
|
|
r.batch == subItem.batch && |
|
|
|
r.inventoryStatus == subItem.inventoryStatus) |
|
|
|
subItem.toPackingNumber = "" |
|
|
|
if (mainItem) { |
|
|
|
mainItem.scaned = true; |
|
|
|
//如果是编辑的,返回后清除record |
|
|
|
if (this.currentEditItem.itemCode == mainItem.itemCode && |
|
|
|
this.currentEditItem.batch == mainItem.batch && |
|
|
|
this.currentEditItem.inventoryStatus == mainItem.inventoryStatus) { |
|
|
|
mainItem.recordList = [] |
|
|
|
mainItem.recordList = main |
|
|
|
} else { |
|
|
|
//不是编辑进入的, |
|
|
|
var tempRecord = mainItem.recordList.find(r => |
|
|
|
r.itemCode == subItem.itemCode && |
|
|
|
r.batch == subItem.batch && |
|
|
|
r.packingNumber == subItem.packingNumber && |
|
|
|
r.inventoryStatus == subItem.inventoryStatus) |
|
|
|
if (tempRecord) { |
|
|
|
tempRecord.handleQty = subItem.handleQty |
|
|
|
} else { |
|
|
|
mainItem.recordList.push(subItem) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
var detail = this.createBackAddDetailInfo(subItem) |
|
|
|
|
|
|
|
if (!detail.recordList) { |
|
|
|
detail.recordList = [] |
|
|
|
} |
|
|
|
|
|
|
|
var recordItem = { |
|
|
|
scaned: true, |
|
|
|
isNewJobDetail: "true", |
|
|
|
itemCode: subItem.itemCode, |
|
|
|
itemName: subItem.itemName, |
|
|
|
itemDesc1: subItem.itemDesc1, |
|
|
|
itemDesc2: subItem.itemDesc2, |
|
|
|
packingNumber: subItem.packingNumber, |
|
|
|
toPackingNumber: subItem.toPackingNumber, |
|
|
|
toBatch: subItem.toBatch, |
|
|
|
batch: subItem.batch, |
|
|
|
inventoryStatus: subItem.inventoryStatus, |
|
|
|
qty: subItem.qty, |
|
|
|
handleQty: subItem.handleQty, |
|
|
|
uom: subItem.uom, |
|
|
|
packUnit: subItem.packUnit, |
|
|
|
packQty: subItem.packQty, |
|
|
|
balanceQty: subItem.balanceQty, |
|
|
|
locationCode: subItem.locationCode |
|
|
|
} |
|
|
|
detail.recordList.push(recordItem) |
|
|
|
var mainItem = addList.find(r => |
|
|
|
r.itemCode == subItem.itemCode && |
|
|
|
r.batch == subItem.batch && |
|
|
|
r.inventoryStatus == subItem.inventoryStatus) |
|
|
|
|
|
|
|
if (mainItem) { |
|
|
|
if (this.currentEditItem.itemCode == mainItem.itemCode && |
|
|
|
this.currentEditItem.batch == mainItem.batch && |
|
|
|
this.currentEditItem.inventoryStatus == mainItem |
|
|
|
.inventoryStatus) { |
|
|
|
mainItem.recordList = [] |
|
|
|
mainItem.recordList = main |
|
|
|
} else { |
|
|
|
var tempRecord = mainItem.recordList.find(r => |
|
|
|
r.itemCode == subItem.itemCode && |
|
|
|
r.batch == subItem.batch && |
|
|
|
r.packingNumber == subItem.packingNumber && |
|
|
|
r.inventoryStatus == subItem.inventoryStatus) |
|
|
|
if (tempRecord) { |
|
|
|
tempRecord.handleQty = subItem.handleQty |
|
|
|
} else { |
|
|
|
mainItem.recordList.push(subItem) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
//不存在添加 |
|
|
|
addList.push(detail) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (this.manageMode == "BY_QUANTITY") { |
|
|
|
var mainItem = this.dataList.find(r => |
|
|
|
r.itemCode == subItem.itemCode && |
|
|
|
r.inventoryStatus == subItem.inventoryStatus) |
|
|
|
subItem.toPackingNumber = "" |
|
|
|
subItem.toBatch = "" |
|
|
|
|
|
|
|
//主列表存在数据 |
|
|
|
if (mainItem) { |
|
|
|
mainItem.scaned = true; |
|
|
|
//如果是编辑的,返回后清除record |
|
|
|
if (this.currentEditItem.itemCode == mainItem.itemCode && |
|
|
|
this.currentEditItem.inventoryStatus == mainItem.inventoryStatus) { |
|
|
|
mainItem.recordList = [] |
|
|
|
mainItem.recordList = main |
|
|
|
} else { |
|
|
|
var tempRecord = mainItem.recordList.find(r => |
|
|
|
r.itemCode == subItem.itemCode && |
|
|
|
r.batch == subItem.batch && |
|
|
|
r.packingNumber == subItem.packingNumber && |
|
|
|
r.inventoryStatus == subItem.inventoryStatus) |
|
|
|
if (tempRecord) { |
|
|
|
tempRecord.handleQty = subItem.handleQty |
|
|
|
} else { |
|
|
|
mainItem.recordList.push(subItem) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
//主列表不存在数据,添加到主列表 |
|
|
|
var detail = this.createBackAddDetailInfo(subItem) |
|
|
|
detail.batch="" |
|
|
|
if (!detail.recordList) { |
|
|
|
|
|
|
|
detail.recordList = [] |
|
|
|
} |
|
|
|
|
|
|
|
var recordItem = { |
|
|
|
scaned: true, |
|
|
|
isNewJobDetail: "true", |
|
|
|
itemCode: subItem.itemCode, |
|
|
|
itemName: subItem.itemName, |
|
|
|
itemDesc1: subItem.itemDesc1, |
|
|
|
itemDesc2: subItem.itemDesc2, |
|
|
|
packingNumber: subItem.packingNumber, |
|
|
|
toPackingNumber: subItem.toPackingNumber, |
|
|
|
toBatch: subItem.toBatch, |
|
|
|
batch: subItem.batch, |
|
|
|
inventoryStatus: subItem.inventoryStatus, |
|
|
|
qty: subItem.qty, |
|
|
|
handleQty: subItem.handleQty, |
|
|
|
uom: subItem.uom, |
|
|
|
packUnit: subItem.packUnit, |
|
|
|
packQty: subItem.packQty, |
|
|
|
balanceQty: subItem.balanceQty, |
|
|
|
locationCode: subItem.locationCode |
|
|
|
} |
|
|
|
detail.recordList.push(recordItem) |
|
|
|
var mainItem = addList.find(r => |
|
|
|
r.itemCode == subItem.itemCode && |
|
|
|
r.inventoryStatus == subItem.inventoryStatus) |
|
|
|
//判断主列表是否有数据 |
|
|
|
if (mainItem) { |
|
|
|
//主列表有,如果是编辑进入的,清除,然后赋值 |
|
|
|
if (this.currentEditItem.itemCode == mainItem.itemCode && |
|
|
|
this.currentEditItem.inventoryStatus == mainItem |
|
|
|
.inventoryStatus) { |
|
|
|
mainItem.recordList = [] |
|
|
|
mainItem.recordList = main |
|
|
|
} else { |
|
|
|
var tempRecord = mainItem.recordList.find(r => |
|
|
|
r.itemCode == subItem.itemCode && |
|
|
|
r.batch == subItem.batch && |
|
|
|
r.packingNumber == subItem.packingNumber && |
|
|
|
r.inventoryStatus == subItem.inventoryStatus) |
|
|
|
if (tempRecord) { |
|
|
|
tempRecord.handleQty = subItem.handleQty |
|
|
|
} else { |
|
|
|
mainItem.recordList.push(subItem) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
//不存在添加 |
|
|
|
addList.push(detail) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
if (addList.length > 0) { |
|
|
|
this.dataList = this.dataList.concat(addList) |
|
|
|
} |
|
|
|
} |
|
|
|
this.updateList(false); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
refreshData2222(returnData) { |
|
|
|
//记录的数据刷新列表 |
|
|
|
//列表中删除了已经扫描的数据 |
|
|
|
if (returnData.recordList.length == 0) { |
|
|
@ -238,12 +473,25 @@ |
|
|
|
r.itemCode == subItem.itemCode && |
|
|
|
r.batch == subItem.batch && |
|
|
|
r.inventoryStatus == subItem.inventoryStatus) |
|
|
|
subItem.toPackingNumber="" |
|
|
|
subItem.toPackingNumber = "" |
|
|
|
//主列表存在数据 |
|
|
|
if (mainItem) { |
|
|
|
mainItem.scaned = true; |
|
|
|
mainItem.recordList = [] |
|
|
|
mainItem.recordList.push(subItem) |
|
|
|
if (mainItem.recordList && mainItem.recordList.length > 0) { |
|
|
|
mainItem.scaned = true; |
|
|
|
var tempRecord = mainItem.recordList.find(r => |
|
|
|
r.itemCode == subItem.itemCode && |
|
|
|
r.batch == subItem.batch && |
|
|
|
r.inventoryStatus == subItem.inventoryStatus) |
|
|
|
if (tempRecord) { |
|
|
|
tempRecord.handleQty = subItem.handleQty |
|
|
|
} else { |
|
|
|
mainItem.recordList.push(subItem) |
|
|
|
} |
|
|
|
} else { |
|
|
|
mainItem.recordList = [] |
|
|
|
mainItem.recordList.push(subItem) |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
//主列表不存在数据,添加到主列表 |
|
|
|
var detail = this.createBackAddDetailInfo(subItem) |
|
|
@ -278,13 +526,25 @@ |
|
|
|
var mainItem = this.dataList.find(r => |
|
|
|
r.itemCode == subItem.itemCode && |
|
|
|
r.inventoryStatus == subItem.inventoryStatus) |
|
|
|
subItem.toPackingNumber="" |
|
|
|
subItem.toBatch="" |
|
|
|
subItem.toPackingNumber = "" |
|
|
|
subItem.toBatch = "" |
|
|
|
//主列表存在数据 |
|
|
|
if (mainItem) { |
|
|
|
mainItem.scaned = true; |
|
|
|
mainItem.recordList = [] |
|
|
|
mainItem.recordList.push(subItem) |
|
|
|
if (mainItem.recordList && mainItem.recordList.length > 0) { |
|
|
|
mainItem.scaned = true; |
|
|
|
var tempRecord = mainItem.recordList.find(r => |
|
|
|
r.itemCode == subItem.itemCode && |
|
|
|
r.batch == subItem.batch && |
|
|
|
r.inventoryStatus == subItem.inventoryStatus) |
|
|
|
if (tempRecord) { |
|
|
|
tempRecord.handleQty = subItem.handleQty |
|
|
|
} else { |
|
|
|
mainItem.recordList.push(subItem) |
|
|
|
} |
|
|
|
} else { |
|
|
|
mainItem.recordList = [] |
|
|
|
mainItem.recordList.push(subItem) |
|
|
|
} |
|
|
|
} else { |
|
|
|
//主列表不存在数据,添加到主列表 |
|
|
|
var detail = this.createBackAddDetailInfo(subItem) |
|
|
@ -344,7 +604,21 @@ |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
currentCount(recordList) { |
|
|
|
currentCount(currentItem, recordList) { |
|
|
|
if (!recordList) { |
|
|
|
this.showMessage("请先扫描箱码") |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if (this.manageMode == 'BY_BATCH') { |
|
|
|
this.currentEditItem = this.dataList.find(r => r.itemCode == currentItem.itemCode && |
|
|
|
r.batch == currentItem.batch && |
|
|
|
r.inventoryStatus == currentItem.inventoryStatus) |
|
|
|
} else { |
|
|
|
this.currentEditItem = this.dataList.find(r => r.itemCode == currentItem.itemCode && |
|
|
|
r.inventoryStatus == currentItem.inventoryStatus) |
|
|
|
} |
|
|
|
|
|
|
|
if (recordList) { |
|
|
|
uni.navigateTo({ |
|
|
|
url: `/pages/count/job/countRecord?data=${encodeURIComponent(JSON.stringify(recordList))}` |
|
|
@ -431,8 +705,8 @@ |
|
|
|
r.locationCode == scanItem.locationCode && |
|
|
|
r.batch == scanItem.batch && |
|
|
|
r.inventoryStatus == scanItem.inventoryStatus) |
|
|
|
//批次管理,包装赋值为空 |
|
|
|
scanItem.toPackingNumber = "" |
|
|
|
//批次管理,包装赋值为空 |
|
|
|
scanItem.toPackingNumber = "" |
|
|
|
//在任务列表中,添加到对应的recordList |
|
|
|
if (mainItem) { |
|
|
|
if (!mainItem.recordList) { |
|
|
@ -446,7 +720,7 @@ |
|
|
|
res.batch == scanItem.batch && |
|
|
|
res.inventoryStatus == scanItem.inventoryStatus |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//已经存在,数量累加 |
|
|
|
if (subItem) { |
|
|
@ -487,8 +761,8 @@ |
|
|
|
r.itemCode == scanItem.itemCode && |
|
|
|
r.locationCode == scanItem.locationCode && |
|
|
|
r.inventoryStatus == scanItem.inventoryStatus) |
|
|
|
scanItem.toBatch = "" |
|
|
|
scanItem.toPackingNumber = "" |
|
|
|
scanItem.toBatch = "" |
|
|
|
scanItem.toPackingNumber = "" |
|
|
|
//在任务列表中,添加到对应的recordList |
|
|
|
if (item) { |
|
|
|
if (!item.recordList) { |
|
|
@ -513,6 +787,7 @@ |
|
|
|
} else { |
|
|
|
//不在任务列表中,添加到列表中 |
|
|
|
var detail = this.createAddDetailInfo(scanItem) |
|
|
|
detail.batch="" |
|
|
|
|
|
|
|
if (!detail.recordList) { |
|
|
|
detail.recordList = [] |
|
|
|