|
@@ -440,32 +440,52 @@ const handleScanValueChange = (val) => {
|
|
|
if (val) {
|
|
|
let value = val;
|
|
|
let arr = [];
|
|
|
- if (value.includes("sn")) {
|
|
|
+ if (value.includes("sn") || value.includes("materialId")) {
|
|
|
arr = value.split("=");
|
|
|
}
|
|
|
scanValue.value = "";
|
|
|
timer.value && clearTimeout(timer.value);
|
|
|
timer.value = setTimeout(() => {
|
|
|
if (arr.length > 1) {
|
|
|
- return proxy
|
|
|
- .post("/productionTaskDetail/snInfo", {
|
|
|
- productSn: arr[arr.length - 1],
|
|
|
- })
|
|
|
- .then(
|
|
|
- (res) => {
|
|
|
- formData.data.list.push({
|
|
|
- isScan: "1",
|
|
|
- productCode: res.productCode,
|
|
|
- productId: res.productId,
|
|
|
- productName: res.productName,
|
|
|
- productSpec: res.productSpec,
|
|
|
- productUnit: res.productUnit,
|
|
|
- quantity: 1,
|
|
|
- purchaseDetailId: "",
|
|
|
- });
|
|
|
- },
|
|
|
- (err) => {}
|
|
|
- );
|
|
|
+ if (value.includes("sn")) {
|
|
|
+ return proxy
|
|
|
+ .post("/productionTaskDetail/snInfo", {
|
|
|
+ productSn: arr[arr.length - 1],
|
|
|
+ })
|
|
|
+ .then(
|
|
|
+ (res) => {
|
|
|
+ formData.data.list.push({
|
|
|
+ isScan: "1",
|
|
|
+ productCode: res.productCode,
|
|
|
+ productId: res.productId,
|
|
|
+ productName: res.productName,
|
|
|
+ productSpec: res.productSpec,
|
|
|
+ productUnit: res.productUnit,
|
|
|
+ quantity: 1,
|
|
|
+ purchaseDetailId: "",
|
|
|
+ });
|
|
|
+ },
|
|
|
+ (err) => {}
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ return proxy
|
|
|
+ .post("/productInfo/detail", { id: arr[arr.length - 1] })
|
|
|
+ .then(
|
|
|
+ (res) => {
|
|
|
+ formData.data.list.push({
|
|
|
+ isScan: "1",
|
|
|
+ productCode: res.code,
|
|
|
+ productId: res.id,
|
|
|
+ productName: res.name,
|
|
|
+ productSpec: res.spec,
|
|
|
+ productUnit: res.unit,
|
|
|
+ quantity: 1,
|
|
|
+ purchaseDetailId: "",
|
|
|
+ });
|
|
|
+ },
|
|
|
+ (err) => {}
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
proxy.post("/purchaseDetail/detail", { id: value }).then(
|