|
|
|
@ -245,17 +245,20 @@ export default { |
|
|
|
wdrNo: data.labelInfo.wdrNo, |
|
|
|
height: data.labelInfo.height || 0, |
|
|
|
engChgLevel: data.labelInfo.engChgLevel, |
|
|
|
expiredDate: data.labelInfo.expiredDate, |
|
|
|
} |
|
|
|
this.labelList.push(newLabel) |
|
|
|
|
|
|
|
this.$message.success('操作成功') |
|
|
|
|
|
|
|
if (this.isPartial) { |
|
|
|
const newIndex = this.labelList.length - 1 |
|
|
|
this.$nextTick(() => { |
|
|
|
this.handleLabelClick(newLabel, newIndex) |
|
|
|
this.confirmIfHasExpired([newLabel]) |
|
|
|
.then(() => { |
|
|
|
this.labelList.push(newLabel) |
|
|
|
this.$message.success('操作成功') |
|
|
|
if (this.isPartial) { |
|
|
|
const newIndex = this.labelList.length - 1 |
|
|
|
this.$nextTick(() => { |
|
|
|
this.handleLabelClick(newLabel, newIndex) |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
.catch(() => {}) |
|
|
|
} else { |
|
|
|
this.$message.error(data.msg || '该标签与出库单不符,请检查') |
|
|
|
} |
|
|
|
@ -319,6 +322,55 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
parseExpiredTime(expiredDate) { |
|
|
|
if (expiredDate == null || expiredDate === '') return NaN |
|
|
|
if (typeof expiredDate === 'number') return expiredDate |
|
|
|
if (expiredDate instanceof Date) { |
|
|
|
const time = expiredDate.getTime() |
|
|
|
return Number.isNaN(time) ? NaN : time |
|
|
|
} |
|
|
|
if (Array.isArray(expiredDate) && expiredDate.length >= 3) { |
|
|
|
return new Date( |
|
|
|
Number(expiredDate[0]), |
|
|
|
Number(expiredDate[1]) - 1, |
|
|
|
Number(expiredDate[2]), |
|
|
|
Number(expiredDate[3] || 0), |
|
|
|
Number(expiredDate[4] || 0), |
|
|
|
Number(expiredDate[5] || 0) |
|
|
|
).getTime() |
|
|
|
} |
|
|
|
const raw = String(expiredDate).trim() |
|
|
|
const matched = raw.match( |
|
|
|
/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[ T](\d{1,2}):(\d{1,2})(?::(\d{1,2}))?)?/ |
|
|
|
) |
|
|
|
if (matched) { |
|
|
|
return new Date( |
|
|
|
Number(matched[1]), |
|
|
|
Number(matched[2]) - 1, |
|
|
|
Number(matched[3]), |
|
|
|
Number(matched[4] || 0), |
|
|
|
Number(matched[5] || 0), |
|
|
|
Number(matched[6] || 0) |
|
|
|
).getTime() |
|
|
|
} |
|
|
|
return new Date(raw.replace(/-/g, '/')).getTime() |
|
|
|
}, |
|
|
|
isExpiredDate(expiredDate) { |
|
|
|
const expiredTime = this.parseExpiredTime(expiredDate) |
|
|
|
if (Number.isNaN(expiredTime)) return false |
|
|
|
return expiredTime < Date.now() |
|
|
|
}, |
|
|
|
confirmIfHasExpired(list) { |
|
|
|
const hasExpired = (list || []).some((item) => this.isExpiredDate(item.expiredDate)) |
|
|
|
if (!hasExpired) { |
|
|
|
return Promise.resolve() |
|
|
|
} |
|
|
|
return this.$confirm('扫描清单中有已过期物料,是否继续?', '提示', { |
|
|
|
confirmButtonText: '是', |
|
|
|
cancelButtonText: '否', |
|
|
|
type: 'warning', |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 确认出库 |
|
|
|
confirmOutbound() { |
|
|
|
if (this.labelList.length === 0) { |
|
|
|
@ -333,17 +385,21 @@ export default { |
|
|
|
} |
|
|
|
qty += label.quantity |
|
|
|
} |
|
|
|
if (qty > this.outboundInfo.qtyToIssue) { |
|
|
|
this.$confirm('扫描标签总数量超过需求数量确定出库吗?', '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'warning', |
|
|
|
}).then(() => { |
|
|
|
this.confirmProductionPicking() |
|
|
|
this.confirmIfHasExpired(this.labelList) |
|
|
|
.then(() => { |
|
|
|
if (qty > this.outboundInfo.qtyToIssue) { |
|
|
|
this.$confirm('扫描标签总数量超过需求数量确定出库吗?', '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'warning', |
|
|
|
}).then(() => { |
|
|
|
this.confirmProductionPicking() |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.confirmProductionPicking() |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.confirmProductionPicking() |
|
|
|
} |
|
|
|
.catch(() => {}) |
|
|
|
}, |
|
|
|
confirmProductionPicking() { |
|
|
|
const params = { |
|
|
|
|