|
|
|
@ -99,6 +99,27 @@ |
|
|
|
style="width: 100%" |
|
|
|
/> |
|
|
|
</el-form-item></el-col> |
|
|
|
<el-col :span="12"><el-form-item label="供应商批次号"> |
|
|
|
<el-input |
|
|
|
v-model.trim="inboundItem.supplierBatchNo" |
|
|
|
placeholder="请扫描标签二维码(自动回车)或输入供应商批次号" |
|
|
|
@keyup.enter.native="querySupplierInfoByLabel" |
|
|
|
/> |
|
|
|
</el-form-item></el-col> |
|
|
|
<el-col :span="12"><el-form-item label="供应商生产日期"> |
|
|
|
<el-date-picker |
|
|
|
v-model="inboundItem.supplierManufactureDate" |
|
|
|
type="date" |
|
|
|
format="yyyy-MM-dd" |
|
|
|
value-format="yyyy-MM-dd" |
|
|
|
placeholder="请选择供应商生产日期" |
|
|
|
style="width: 100%" |
|
|
|
inputmode="none" |
|
|
|
autocomplete="off" |
|
|
|
autocorrect="off" |
|
|
|
spellcheck="false" |
|
|
|
/> |
|
|
|
</el-form-item></el-col> |
|
|
|
<!-- 勾选框 --> |
|
|
|
<el-col :span="12" style="margin-top: 2px"> |
|
|
|
<el-form-item> |
|
|
|
@ -191,6 +212,7 @@ |
|
|
|
|
|
|
|
<script> |
|
|
|
import { getShopOrderFromIfs, getNextSequenceNo, submitShopOrderInbound, validateMaterialIssued, printLabelCommon } from "@/api/production/production-inbound.js"; |
|
|
|
import { getHandlingUnitDetail } from "@/api/handlingunit/handlingunit.js"; |
|
|
|
|
|
|
|
export default { |
|
|
|
data() { |
|
|
|
@ -382,7 +404,9 @@ export default { |
|
|
|
ifsAutoReport: true, // Auto Report of Operation |
|
|
|
ifsSimplifiedMaterial: true, // Simplified Material Check默认选中 |
|
|
|
height: this.parseHeightFromPartNo(row.partNo), // 根据物料编码自动填充高度 |
|
|
|
ifsExpiryDate: '' // 有效期,传给IFS接口 |
|
|
|
ifsExpiryDate: '', // 有效期,传给IFS接口 |
|
|
|
supplierManufactureDate: '', |
|
|
|
supplierBatchNo: '' |
|
|
|
}; |
|
|
|
this.processFlag = 2; |
|
|
|
} catch (error) { |
|
|
|
@ -392,6 +416,92 @@ export default { |
|
|
|
this.fullscreenLoading = false; |
|
|
|
} |
|
|
|
}, |
|
|
|
// 扫描标签二维码(unit_id)后,回填供应商生产日期和供应商批次号 |
|
|
|
async querySupplierInfoByLabel() { |
|
|
|
const unitId = this.extractUnitIdFromScanCode(this.inboundItem.supplierBatchNo); |
|
|
|
if (!unitId) { |
|
|
|
this.$message.warning('请先扫描标签二维码'); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
const previousLoadingText = this.loadingText; |
|
|
|
this.loadingText = '查询标签中...'; |
|
|
|
this.fullscreenLoading = true; |
|
|
|
|
|
|
|
try { |
|
|
|
const { data } = await getHandlingUnitDetail({ |
|
|
|
site: this.site, |
|
|
|
unitId: unitId |
|
|
|
}); |
|
|
|
|
|
|
|
if (!data || data.code !== 0) { |
|
|
|
this.$message.warning((data && data.msg) || '标签查询失败'); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
const labelInfo = data && data.data; |
|
|
|
if (!labelInfo) { |
|
|
|
this.$message.warning(`未查询到标签:${unitId}`); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// 标签值作为供应商字段来源,避免人工二次录入造成误差。 |
|
|
|
this.inboundItem.supplierManufactureDate = this.normalizeDateToYmd(labelInfo.supplierManufactureDate); |
|
|
|
this.inboundItem.supplierBatchNo = labelInfo.supplierBatchNo || ''; |
|
|
|
|
|
|
|
if (!this.inboundItem.supplierManufactureDate && !this.inboundItem.supplierBatchNo) { |
|
|
|
this.$message.warning('标签中未维护供应商生产日期/供应商批次号'); |
|
|
|
return; |
|
|
|
} |
|
|
|
//this.$message.success('已回填供应商信息'); |
|
|
|
} catch (error) { |
|
|
|
console.error('查询标签失败:', error); |
|
|
|
this.$message.error('查询标签失败,请重试'); |
|
|
|
} finally { |
|
|
|
this.loadingText = previousLoadingText; |
|
|
|
this.fullscreenLoading = false; |
|
|
|
} |
|
|
|
}, |
|
|
|
// PDA扫码内容可能是纯unit_id,也可能是带unit_id参数的URL,这里统一提取。 |
|
|
|
extractUnitIdFromScanCode(scanValue) { |
|
|
|
if (!scanValue) return ''; |
|
|
|
const rawText = String(scanValue).trim(); |
|
|
|
if (!rawText) return ''; |
|
|
|
|
|
|
|
const queryMatch = rawText.match(/(?:^|[?&])unit[_-]?id=([^&]+)/i); |
|
|
|
if (queryMatch && queryMatch[1]) { |
|
|
|
try { |
|
|
|
return decodeURIComponent(queryMatch[1]).trim(); |
|
|
|
} catch (error) { |
|
|
|
return queryMatch[1].trim(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const keyValueMatch = rawText.match(/unit[_-]?id[:=]\s*([^\s,;]+)/i); |
|
|
|
if (keyValueMatch && keyValueMatch[1]) { |
|
|
|
return keyValueMatch[1].trim(); |
|
|
|
} |
|
|
|
|
|
|
|
return rawText; |
|
|
|
}, |
|
|
|
// 统一转换为 yyyy-MM-dd,便于直接绑定到日期控件。 |
|
|
|
normalizeDateToYmd(dateValue) { |
|
|
|
if (!dateValue) return ''; |
|
|
|
if (typeof dateValue === 'string') { |
|
|
|
const text = dateValue.trim(); |
|
|
|
if (!text) return ''; |
|
|
|
const datePart = text.slice(0, 10); |
|
|
|
if (/^\d{4}-\d{2}-\d{2}$/.test(datePart)) { |
|
|
|
return datePart; |
|
|
|
} |
|
|
|
} |
|
|
|
const dateObj = new Date(dateValue); |
|
|
|
if (Number.isNaN(dateObj.getTime())) return ''; |
|
|
|
const year = dateObj.getFullYear(); |
|
|
|
const month = String(dateObj.getMonth() + 1).padStart(2, '0'); |
|
|
|
const day = String(dateObj.getDate()).padStart(2, '0'); |
|
|
|
return `${year}-${month}-${day}`; |
|
|
|
}, |
|
|
|
// 检查数量 |
|
|
|
checkQuantity() { |
|
|
|
const transQty = parseFloat(this.inboundItem.transQty) || 0; |
|
|
|
@ -563,6 +673,8 @@ export default { |
|
|
|
qtyComplete: item.qtyComplete, |
|
|
|
height: item.height || null, // 高度(mm) |
|
|
|
ifsExpiryDate: item.ifsExpiryDate || null, // 有效期 |
|
|
|
supplierManufactureDate: item.supplierManufactureDate || null, // 供应商生产日期 |
|
|
|
supplierBatchNo: item.supplierBatchNo || null, // 供应商批次号 |
|
|
|
// IFS参数 |
|
|
|
ifsAutoReport: item.ifsAutoReport ? 'Yes' : 'No', |
|
|
|
ifsSimplifiedMaterial: item.ifsSimplifiedMaterial ? 'Yes' : 'No', |
|
|
|
|