|
|
@ -5,7 +5,7 @@ |
|
|
|
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
|
|
|
<view class=""> |
|
|
|
<comInventoryDetailCard :dataContent="item" :settingParam="jobContent" @remove="updateData" |
|
|
|
@updateData='updateData'> |
|
|
|
@updateData='updateData' @openDetail="openDetail"> |
|
|
|
</comInventoryDetailCard> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -25,6 +25,7 @@ |
|
|
|
|
|
|
|
<win-scan-button @goScan='openScanPopup'></win-scan-button> |
|
|
|
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult'></win-scan-pack-and-location> |
|
|
|
<detailInfoPopup ref="jobDetailPopup"></detailInfoPopup> |
|
|
|
<com-message ref="comMessage"></com-message> |
|
|
|
</view> |
|
|
|
</template> |
|
|
@ -40,6 +41,12 @@ |
|
|
|
import { |
|
|
|
getManagementPrecisions |
|
|
|
} from '@/common/balance.js'; |
|
|
|
|
|
|
|
import { |
|
|
|
getDataSource, |
|
|
|
getScanCount, |
|
|
|
calcHandleQty |
|
|
|
} from '@/common/detail.js'; |
|
|
|
import { |
|
|
|
goHome, |
|
|
|
updateTitle, |
|
|
@ -54,6 +61,9 @@ |
|
|
|
import comInventoryDetailCard from '@/pages/inventoryMove/coms/comInventoryDetailCard.vue' |
|
|
|
import comMessage from '@/mycomponents/common/comMessage.vue' |
|
|
|
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" |
|
|
|
import detailInfoPopup from '@/pages/inventoryMove/coms/detailInfoPopup.vue' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
name: 'returnDetail', |
|
|
@ -63,7 +73,8 @@ |
|
|
|
comInventoryDetailCard, |
|
|
|
requiredLocation, |
|
|
|
comMessage, |
|
|
|
winScanPackAndLocation |
|
|
|
winScanPackAndLocation, |
|
|
|
detailInfoPopup |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
@ -161,7 +172,7 @@ |
|
|
|
if (res.data.subList.length > 0) { |
|
|
|
that.jobContent = res.data; |
|
|
|
that.subList = res.data.subList; |
|
|
|
that.detailSource = that.getDataSource(that.subList) |
|
|
|
that.detailSource = getDataSource(that.subList) |
|
|
|
} else { |
|
|
|
that.showMessage('列表数据为0'); |
|
|
|
} |
|
|
@ -173,96 +184,31 @@ |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
getDataSource(subList) { |
|
|
|
let items = []; |
|
|
|
subList.forEach(detail => { |
|
|
|
var item = items.find(r => |
|
|
|
r.itemCode == detail.itemCode) |
|
|
|
if (item == undefined) { |
|
|
|
item = this.createItemInfo(detail); |
|
|
|
let newDetail = this.createDetailInfo(detail); // |
|
|
|
item.subList.push(newDetail); |
|
|
|
items.push(item) |
|
|
|
} else { |
|
|
|
item.qty += detail.qty |
|
|
|
let newDetail = this.createDetailInfo(detail); // |
|
|
|
item.subList.push(newDetail); |
|
|
|
} |
|
|
|
}) |
|
|
|
return items; |
|
|
|
}, |
|
|
|
|
|
|
|
createItemInfo(res) { |
|
|
|
let item = { |
|
|
|
itemCode: res.itemCode, |
|
|
|
itemName: res.itemName, |
|
|
|
stdPackQty: res.stdPackQty, |
|
|
|
stdPackUnit: res.stdPackUnit, |
|
|
|
qty: res.qty, |
|
|
|
handleQty: 0, |
|
|
|
uom: res.uom, |
|
|
|
subList: [] |
|
|
|
} |
|
|
|
return item; |
|
|
|
}, |
|
|
|
|
|
|
|
createDetailInfo(data) { |
|
|
|
data.scaned = false; |
|
|
|
// data.record = {}; |
|
|
|
let detail = data; |
|
|
|
return detail; |
|
|
|
}, |
|
|
|
|
|
|
|
calcScanCount(closeScan) { |
|
|
|
let items = this.subList.filter(r => { |
|
|
|
if (r.scaned) { |
|
|
|
return r; |
|
|
|
} |
|
|
|
}) |
|
|
|
this.scanCount = items != null ? items.length : 0; |
|
|
|
if (this.scanCount == this.subList.length) { |
|
|
|
this.closeScanPopup(); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
calcHandleQty() { |
|
|
|
for (let item of this.detailSource) { |
|
|
|
item.handleQty = 0; |
|
|
|
for (let detail of item.subList) { |
|
|
|
if (detail.record != undefined) { |
|
|
|
item.handleQty += Number(detail.record.qty) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.continueScan() |
|
|
|
this.$forceUpdate(); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//继续扫描 |
|
|
|
continueScan() { |
|
|
|
this.scanCount = this.getScanCount(); |
|
|
|
this.scanCount = getScanCount(this.subList); |
|
|
|
if (this.scanCount == this.subList.length) { |
|
|
|
this.closeScanPopup(); |
|
|
|
} else { |
|
|
|
this.scanPopupGetFocus(); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
getScanCount(closeScan) { |
|
|
|
let items = this.subList.filter(r => { |
|
|
|
if (r.scaned) { |
|
|
|
return r; |
|
|
|
} |
|
|
|
}) |
|
|
|
let scanCount = items != null ? items.length : 0; |
|
|
|
return scanCount; |
|
|
|
|
|
|
|
openDetail(item) { |
|
|
|
this.$refs.jobDetailPopup.openPopup(item) |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
updateData() { |
|
|
|
this.calcHandleQty(); |
|
|
|
}, |
|
|
|
|
|
|
|
calcHandleQty() { |
|
|
|
calcHandleQty(this.detailSource) |
|
|
|
this.continueScan() |
|
|
|
this.$forceUpdate(); |
|
|
|
}, |
|
|
|
|
|
|
|
openScanPopup() { |
|
|
|
let fromlocationCode = ''; |
|
|
|
let fromlocationList = []; |
|
|
@ -313,7 +259,12 @@ |
|
|
|
']不一致,是否继续上架?', res => { |
|
|
|
if (res) { |
|
|
|
itemDetail.scaned = true; |
|
|
|
itemDetail.record = this.createRecordInfo(itemDetail, result.balance); |
|
|
|
itemDetail.handleQty = Number(result.label.qty) > Number(result.balance |
|
|
|
.qty) ? Number(result.balance.qty) : Number(result.label.qty); |
|
|
|
itemDetail.balance = result.balance; |
|
|
|
itemDetail.balance.balanceQty = result.balance.qty; |
|
|
|
itemDetail.balance.stdPackQty = result.package.stdPackQty |
|
|
|
itemDetail.balance.stdPackUnit = result.package.stdPackUnit |
|
|
|
this.calcHandleQty(); |
|
|
|
} else { |
|
|
|
this.scanPopupGetFocus(); |
|
|
@ -321,7 +272,12 @@ |
|
|
|
}); |
|
|
|
} else { |
|
|
|
itemDetail.scaned = true; |
|
|
|
itemDetail.record = this.createRecordInfo(itemDetail, result.balance); |
|
|
|
itemDetail.handleQty = Number(result.label.qty) > Number(result.balance |
|
|
|
.qty) ? Number(result.balance.qty) : Number(result.label.qty); |
|
|
|
itemDetail.balance = result.balance; |
|
|
|
itemDetail.balance.balanceQty = result.balance.qty; |
|
|
|
itemDetail.balance.stdPackQty = result.package.stdPackQty |
|
|
|
itemDetail.balance.stdPackUnit = result.package.stdPackUnit |
|
|
|
this.calcHandleQty(); |
|
|
|
} |
|
|
|
} |
|
|
@ -333,20 +289,14 @@ |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
createRecordInfo(detail, balance) { |
|
|
|
var record = {} |
|
|
|
detail.scaned = true; |
|
|
|
detail.balance = balance; |
|
|
|
detail.recommendInventoryStatus = detail.inventoryStatus; |
|
|
|
detail.inventoryStatus = balance.inventoryStatus; |
|
|
|
// let record = JSON.parse(JSON.stringify(detail)); |
|
|
|
//克隆对象,深度克隆,防止双向绑定同一个变量 |
|
|
|
Object.assign(record, detail) |
|
|
|
record.qty = Number(balance.qty); |
|
|
|
return record; |
|
|
|
}, |
|
|
|
|
|
|
|
async commit() { |
|
|
|
commit() { |
|
|
|
this.scanCount = getScanCount(this.subList); |
|
|
|
if (this.scanCount == 0) { |
|
|
|
this.showErrorMessage("扫描数为0,请先扫描") |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
//允许部分提交 |
|
|
|
//扫描数量和任务数量相等,直接提交 |
|
|
|
if (this.scanCount == this.subList.length) { |
|
|
@ -369,109 +319,46 @@ |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
async submitJob() { |
|
|
|
submitJob() { |
|
|
|
uni.showLoading({ |
|
|
|
title: "提交中....", |
|
|
|
mask: true |
|
|
|
}); |
|
|
|
|
|
|
|
var itemCodes = [] |
|
|
|
this.detailSource.forEach(item => { |
|
|
|
itemCodes.push(item.itemCode) |
|
|
|
}) |
|
|
|
|
|
|
|
var param = { |
|
|
|
itemCode: itemCodes, |
|
|
|
locationCode: this.toLocationCode |
|
|
|
} |
|
|
|
|
|
|
|
var params = this.setParams(); |
|
|
|
console.log("提交" + JSON.stringify(params)) |
|
|
|
inventoryMoveSubmit(this.id, params).then(res => { |
|
|
|
uni.hideLoading() |
|
|
|
if (res.data) { |
|
|
|
var hint = res.data.Number; |
|
|
|
this.showCommitSuccessMessage("提交成功" + hint, ) |
|
|
|
|
|
|
|
} else { |
|
|
|
this.showErrorMessage("提交失败") |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
uni.hideLoading() |
|
|
|
this.showErrorMessage(error) |
|
|
|
}) |
|
|
|
// inventoryMoveSubmit(params).then(res => { |
|
|
|
// uni.hideLoading() |
|
|
|
// if (res.data) { |
|
|
|
// this.showCommitSuccessMessage("提交成功<br>生成库存转移记录" + res.data) |
|
|
|
// } else { |
|
|
|
// this.showErrorMessage("提交失败"+res.msg) |
|
|
|
// } |
|
|
|
// }).catch(error => { |
|
|
|
// uni.hideLoading() |
|
|
|
// this.showErrorMessage(error) |
|
|
|
// }) |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
setParams() { |
|
|
|
var params = { |
|
|
|
requestNumber: this.jobContent.requestNumber, |
|
|
|
jobNumber: '', |
|
|
|
asnNumber: this.jobContent.asnNumber, |
|
|
|
ppNumber: this.jobContent.ppNumber, |
|
|
|
supplierCode: this.jobContent.supplierCode, |
|
|
|
carrierCode: this.jobContent.carrierCode, |
|
|
|
transferMode: this.jobContent.transferMode, |
|
|
|
vehiclePlateNumber: this.jobContent.vehiclePlateNumber, |
|
|
|
fromWarehouseCode: this.jobContent.fromWarehouseCode, |
|
|
|
fromLocationTypes: this.jobContent.fromLocationTypes, |
|
|
|
fromAreaCodes: this.jobContent.fromAreaCodes, |
|
|
|
toWarehouseCode: this.jobContent.toWarehouseCode, |
|
|
|
toLocationTypes: this.jobContent.toLocationTypes, |
|
|
|
status: this.jobContent.status, |
|
|
|
toAreaCodes: this.jobContent.toAreaCodes, |
|
|
|
executeTime: getCurrDateTime(), |
|
|
|
activeDate: getCurrDateTime(), |
|
|
|
available: 1, //是否可用 0不可用,1可用 |
|
|
|
requestTime: this.jobContent.requestTime, |
|
|
|
dueTime: getCurrDateTime(), |
|
|
|
expiredTime: this.jobContent.expiredTime, |
|
|
|
departmentCode: this.jobContent.departmentCode, |
|
|
|
interfaceType: "jklxPURCHASE_RETURN", //接口类型 |
|
|
|
Number: this.jobContent.Number, |
|
|
|
businessType: this.jobContent.businessType, |
|
|
|
remark: this.jobContent.remark, |
|
|
|
creationTime: this.jobContent.creationTime, |
|
|
|
creatorId: this.jobContent.creatorId, |
|
|
|
creatorName: this.jobContent.creatorName, |
|
|
|
extraProperties: this.jobContent.extraProperties, |
|
|
|
siteId: this.jobContent.siteId, |
|
|
|
Code: "", |
|
|
|
subList: [], |
|
|
|
|
|
|
|
} |
|
|
|
var subList = [] |
|
|
|
var creator = this.$store.state.user.id |
|
|
|
|
|
|
|
this.detailSource.forEach(item => { |
|
|
|
item.subList.forEach(detail => { |
|
|
|
if (detail.scaned) { |
|
|
|
detail.record.fromPackingNumber = detail.record.packingNumber |
|
|
|
detail.record.toPackingNumber = detail.record.packingNumber |
|
|
|
detail.record.fromBatch = detail.record.batch |
|
|
|
detail.record.ToBatch = detail.record.batch; |
|
|
|
detail.record.FromContainerNumber = detail.record.ContainerNumber |
|
|
|
detail.record.ToContainerNumber = "" |
|
|
|
detail.record.FromLocationGroupCode = "" |
|
|
|
detail.record.FromAreaCode = "" |
|
|
|
detail.record.ToLocationGroupCode = ""; |
|
|
|
detail.record.ToAreaCode = ""; |
|
|
|
detail.record.VisualInspectResult = "", |
|
|
|
detail.record.VisualInspectPhotos = "", |
|
|
|
detail.record.FailedReason = "" |
|
|
|
detail.record.SinglePrice = "", |
|
|
|
detail.record.Amount = "", |
|
|
|
detail.record.JobDetailID = detail.record.id, |
|
|
|
detail.record.masterID = this.jobContent.id, |
|
|
|
detail.record.projectCode = "", |
|
|
|
detail.record.Code = "" |
|
|
|
detail.record.interfaceType = "jklxPURCHASE_RETURN" |
|
|
|
params.subList.push(detail.record) |
|
|
|
subList.push(detail) |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
return params; |
|
|
|
this.jobContent.subList = subList |
|
|
|
this.jobContent.creator = creator; |
|
|
|
return this.jobContent; |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getLocationInfo(locationCode) { |
|
|
|
getBasicLocationByCode(locationCode).then(res => { |
|
|
|
if (res.data.list.length > 0) { |
|
|
@ -530,7 +417,7 @@ |
|
|
|
closeCommitMessage() { |
|
|
|
setTimeout(() => { |
|
|
|
uni.navigateTo({ |
|
|
|
url: './receipt' |
|
|
|
url: './inventoryMoveJob' |
|
|
|
}) |
|
|
|
}) |
|
|
|
//点关闭直接返回列表 |
|
|
@ -540,13 +427,10 @@ |
|
|
|
|
|
|
|
showCommitSuccessMessage(hint) { |
|
|
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
|
|
|
|
|
|
|
}) |
|
|
|
setTimeout(() => { |
|
|
|
uni.navigateTo({ |
|
|
|
url: './receiptJob' |
|
|
|
url: './inventoryMoveJob' |
|
|
|
}) |
|
|
|
}, 3000) |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
} |
|
|
|