feat: 🚀 多重判断提示

This commit is contained in:
2025-08-06 15:58:59 +08:00
parent 22adbc11bc
commit 9d77a609b6
4 changed files with 442 additions and 21 deletions

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="common-btn-box1 font12" @click="handleBtnClick()"> <div class="common-btn-box font12" @click="handleBtnClick()">
<span>转两件装</span> <span>转两件装</span>
</div> </div>
</template> </template>
@@ -28,25 +28,55 @@ const handleBtnClick = () => {
let isSome = props.selectionList.filter((item: any) => { let isSome = props.selectionList.filter((item: any) => {
return item.useNumber; return item.useNumber;
}); });
if (isSome.length) {
let specifications = isSome[0].specifications;
useMsg("warning", `${specifications}(规格型号)序列码存在已使用, 不支持转两件装 `);
return;
}
let isNumber = props.selectionList.filter((item: any) => { let isNumber = props.selectionList.filter((item: any) => {
return item.number % 2 === 1; return item.number % 2 === 1;
}); });
let specificationsArr: any = [];
let specificationsArr1: any = [];
//多种条件
if (isSome.length && isNumber.length) {
//单个
isSome.forEach((item: any) => {
specificationsArr.push(item.specifications);
});
specificationsArr = [...new Set(specificationsArr)];
let specifications = specificationsArr.join(",");
useMsg("warning", `${specifications}序列码存在已使用, 请选择未使用序列码的数据 `);
//单数
isNumber.forEach((item: any) => {
specificationsArr1.push(item.specifications);
});
specificationsArr = [...new Set(specificationsArr1)];
let specifications1 = specificationsArr1.join(",");
useMsg("warning", `${specifications1}条码个数为单数, 不支持转两件装 `);
return;
}
//单个使用
if (isSome.length) {
isSome.forEach((item: any) => {
specificationsArr.push(item.specifications);
});
specificationsArr = [...new Set(specificationsArr)];
let specifications = specificationsArr.join(",");
useMsg("warning", `${specifications}序列码存在已使用, 请选择未使用序列码的数据 `);
return;
}
//单数转换
if (isNumber.length) { if (isNumber.length) {
let specifications = isNumber[0].specifications; isNumber.forEach((item: any) => {
useMsg("warning", `${specifications}(规格型号)条码个数为单数, 不支持转两件装 `); specificationsArr1.push(item.specifications);
});
specificationsArr = [...new Set(specificationsArr1)];
let specifications1 = specificationsArr1.join(",");
useMsg("warning", `${specifications1}条码个数为单数, 不支持转两件装 `);
return; return;
} }
let ids: number[] = []; let ids: number[] = [];
props.selectionList.forEach((item: any) => { props.selectionList.forEach((item: any) => {
//只需要将一件装的id传过去就可以了 //只传一件装数量不为0的
if (item.isTwo === 1) { if (item.isTwo === 1 && item.number) {
ids.push(item.id); ids.push(item.id);
} }
}); });

View File

@@ -95,16 +95,17 @@ function AddPrintContent(obj) {
if (specifications) { if (specifications) {
let chinesePattern = /[\u4e00-\u9fa5]/; // 匹配中文字符的正则表达式 let chinesePattern = /[\u4e00-\u9fa5]/; // 匹配中文字符的正则表达式
if (chinesePattern.test(specifications)) { if (chinesePattern.test(specifications)) {
LODOP.ADD_PRINT_TEXT(8, 8, "20mm", 10, "产品型号:");
//`${specifications} DIP/N-MOS/VS6880AT/T0220/铁封 //`${specifications} DIP/N-MOS/VS6880AT/T0220/铁封
if (specifications.length > 15) { if (specifications.length > 15) {
LODOP.ADD_PRINT_TEXT(8, 8, "20mm", 10, "产品型号:"); // LODOP.ADD_PRINT_TEXT(8, 8, "20mm", 10, "产品型号:");
LODOP.ADD_PRINT_TEXT(8, 64, "45mm", 20, `${specifications}`); LODOP.ADD_PRINT_TEXT(8, 64, "45mm", 20, `${specifications}`);
LODOP.SET_PRINT_STYLEA(0, "TextOverflow", 2); LODOP.SET_PRINT_STYLEA(0, "TextOverflow", 2);
//防止文字未满进行换行 //防止文字未满进行换行
LODOP.SET_PRINT_STYLEA(0, "TextNeatRow", 1); LODOP.SET_PRINT_STYLEA(0, "TextNeatRow", 1);
LODOP.SET_PRINT_STYLEA(0, "LineSpacing", -5); LODOP.SET_PRINT_STYLEA(0, "LineSpacing", -5);
} else { } else {
LODOP.ADD_PRINT_TEXT(8, 8, "20mm", "10mm", "产品型号:"); // LODOP.ADD_PRINT_TEXT(8, 8, "20mm", "10mm", "产品型号:");
LODOP.ADD_PRINT_TEXT(8, 64, "45mm", "100%", `${"ORICO-07000-IN-1TB-GD-BP"}`); LODOP.ADD_PRINT_TEXT(8, 64, "45mm", "100%", `${"ORICO-07000-IN-1TB-GD-BP"}`);
LODOP.SET_PRINT_STYLEA(0, "LineSpacing", -5); LODOP.SET_PRINT_STYLEA(0, "LineSpacing", -5);
//防止文字未满进行换行 //防止文字未满进行换行
@@ -113,7 +114,7 @@ function AddPrintContent(obj) {
} }
} else { } else {
if (specifications.length > 25) { if (specifications.length > 25) {
LODOP.ADD_PRINT_TEXT(8, 8, "20mm", 10, "产品型号:"); // LODOP.ADD_PRINT_TEXT(8, 8, "20mm", 10, "产品型号:");
LODOP.ADD_PRINT_TEXT(8, 64, "45mm", 20, `${"ORICO-07000-IN-1TB-GD-BP"}`); LODOP.ADD_PRINT_TEXT(8, 64, "45mm", 20, `${"ORICO-07000-IN-1TB-GD-BP"}`);
LODOP.SET_PRINT_STYLEA(0, "TextOverflow", 2); LODOP.SET_PRINT_STYLEA(0, "TextOverflow", 2);
//防止文字未满进行换行 //防止文字未满进行换行
@@ -121,7 +122,7 @@ function AddPrintContent(obj) {
LODOP.SET_PRINT_STYLEA(0, "LineSpacing", -5); LODOP.SET_PRINT_STYLEA(0, "LineSpacing", -5);
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman"); LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
} else { } else {
LODOP.ADD_PRINT_TEXT(8, 8, "20mm", "10mm", "产品型号:"); // LODOP.ADD_PRINT_TEXT(8, 8, "20mm", "10mm", "产品型号:");
LODOP.ADD_PRINT_TEXT(8, 64, "45mm", "100%", `${"ORICO-07000-IN-1TB-GD-BP"}`); LODOP.ADD_PRINT_TEXT(8, 64, "45mm", "100%", `${"ORICO-07000-IN-1TB-GD-BP"}`);
//防止文字未满进行换行 //防止文字未满进行换行
LODOP.SET_PRINT_STYLEA(0, "TextNeatRow", 1); LODOP.SET_PRINT_STYLEA(0, "TextNeatRow", 1);
@@ -169,23 +170,27 @@ function AddPrintContent(obj) {
let str3 = str.substring(7, 14); let str3 = str.substring(7, 14);
//224 //224
LODOP.ADD_PRINT_TEXT(130, 231, "10mm", "10mm", `${str1}`); LODOP.ADD_PRINT_TEXT(130, 231, "10mm", "10mm", `${str1}`);
LODOP.SET_PRINT_STYLEA(0, "FontName", ""); // LODOP.SET_PRINT_STYLEA(0, "FontName", "");
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
//238 //238
LODOP.ADD_PRINT_TEXT(130, 245, "15mm", "10mm", `${str2}`); LODOP.ADD_PRINT_TEXT(130, 245, "15mm", "10mm", `${str2}`);
LODOP.SET_PRINT_STYLEA(0, "FontName", ""); // LODOP.SET_PRINT_STYLEA(0, "FontName", "");
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
//283 //283
LODOP.ADD_PRINT_TEXT(130, 290, "15mm", "10mm", `${str3}`); LODOP.ADD_PRINT_TEXT(130, 290, "15mm", "10mm", `${str3}`);
LODOP.SET_PRINT_STYLEA(0, "FontName", ""); // LODOP.SET_PRINT_STYLEA(0, "FontName", "");
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
} }
} }
//产品名称 //产品名称
if (materialName) { if (materialName) {
LODOP.ADD_PRINT_TEXT(37, 8, "20mm", "10mm", "产品名称:"); LODOP.ADD_PRINT_TEXT(37, 8, "20mm", "10mm", "产品名称:");
LODOP.SET_PRINT_STYLEA(0, "FontName", "思源黑体");
LODOP.ADD_PRINT_TEXT(37, 64, "45mm", 20, `${materialName}`); LODOP.ADD_PRINT_TEXT(37, 64, "45mm", 20, `${materialName}`);
LODOP.SET_PRINT_STYLEA(0, "TextOverflow", 2); LODOP.SET_PRINT_STYLEA(0, "TextOverflow", 2);
LODOP.SET_PRINT_STYLEA(0, "LineSpacing", -4); LODOP.SET_PRINT_STYLEA(0, "LineSpacing", -4);
LODOP.SET_PRINT_STYLEA(0, "FontName", "思源黑体"); LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
} }
//二维码 //二维码
@@ -236,20 +241,26 @@ function AddPrintContent(obj) {
//装箱序号 //装箱序号
if (isTail) { if (isTail) {
LODOP.ADD_PRINT_TEXT(79, 8, "50mm", "10mm", `装箱序号:${boxSortCount + "/" + boxSortCount}`); LODOP.ADD_PRINT_TEXT(79, 8, "50mm", "10mm", `装箱序号:${boxSortCount + "/" + boxSortCount}`);
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
} else { } else {
LODOP.ADD_PRINT_TEXT(79, 8, "50mm", "10mm", `装箱序号:${sort + "/" + boxSortCount}`); LODOP.ADD_PRINT_TEXT(79, 8, "50mm", "10mm", `装箱序号:${sort + "/" + boxSortCount}`);
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
} }
} else { } else {
if (isTail) { if (isTail) {
LODOP.ADD_PRINT_TEXT(85, 8, "50mm", "10mm", `装箱序号:${boxSortCount + "/" + boxSortCount}`); LODOP.ADD_PRINT_TEXT(85, 8, "50mm", "10mm", `装箱序号:${boxSortCount + "/" + boxSortCount}`);
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
} else { } else {
LODOP.ADD_PRINT_TEXT(85, 8, "50mm", "10mm", `装箱序号:${sort + "/" + boxSortCount}`); LODOP.ADD_PRINT_TEXT(85, 8, "50mm", "10mm", `装箱序号:${sort + "/" + boxSortCount}`);
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
} }
} }
if (beginNumber) { if (beginNumber) {
LODOP.ADD_PRINT_TEXT(79, 107, "30mm", "10mm", `净重:${isTail ? tailboxNetWeightQty : cratingNetWeightQty} KG`); LODOP.ADD_PRINT_TEXT(79, 107, "30mm", "10mm", `净重:${isTail ? tailboxNetWeightQty : cratingNetWeightQty} KG`);
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
} else { } else {
LODOP.ADD_PRINT_TEXT(85, 107, "30mm", "10mm", `净重:${isTail ? tailboxNetWeightQty : cratingNetWeightQty} KG`); LODOP.ADD_PRINT_TEXT(85, 107, "30mm", "10mm", `净重:${isTail ? tailboxNetWeightQty : cratingNetWeightQty} KG`);
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
} }
//净重 //净重
@@ -258,44 +269,54 @@ function AddPrintContent(obj) {
if (beginNumber) { if (beginNumber) {
if (cratingQty > productQty) { if (cratingQty > productQty) {
LODOP.ADD_PRINT_TEXT(95, 8, "50mm", "10mm", `装箱数量:${productQty} PCS`); LODOP.ADD_PRINT_TEXT(95, 8, "50mm", "10mm", `装箱数量:${productQty} PCS`);
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
} else { } else {
LODOP.ADD_PRINT_TEXT(95, 8, "50mm", "10mm", `装箱数量:${isTail ? tailboxQty : cratingQty} PCS`); LODOP.ADD_PRINT_TEXT(95, 8, "50mm", "10mm", `装箱数量:${isTail ? tailboxQty : cratingQty} PCS`);
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
} }
} else { } else {
if (cratingQty > productQty) { if (cratingQty > productQty) {
LODOP.ADD_PRINT_TEXT(107, 8, "50mm", "10mm", `装箱数量:${productQty} PCS`); LODOP.ADD_PRINT_TEXT(107, 8, "50mm", "10mm", `装箱数量:${productQty} PCS`);
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
} else { } else {
LODOP.ADD_PRINT_TEXT(107, 8, "50mm", "10mm", `装箱数量:${isTail ? tailboxQty : cratingQty} PCS`); LODOP.ADD_PRINT_TEXT(107, 8, "50mm", "10mm", `装箱数量:${isTail ? tailboxQty : cratingQty} PCS`);
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
} }
} }
//毛重 //毛重
if (beginNumber) { if (beginNumber) {
LODOP.ADD_PRINT_TEXT(96, 107, "30mm", "10mm", `毛重:${isTail ? tailboxGrossWeightQty : cratingGrossWeightQty} KG`); LODOP.ADD_PRINT_TEXT(96, 107, "30mm", "10mm", `毛重:${isTail ? tailboxGrossWeightQty : cratingGrossWeightQty} KG`);
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
} else { } else {
LODOP.ADD_PRINT_TEXT(102, 107, "30mm", "10mm", `毛重:${isTail ? tailboxGrossWeightQty : cratingGrossWeightQty} KG`); LODOP.ADD_PRINT_TEXT(102, 107, "30mm", "10mm", `毛重:${isTail ? tailboxGrossWeightQty : cratingGrossWeightQty} KG`);
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
} }
//日期 //日期
let createTimeClone = createTime.substring(0, 10); let createTimeClone = createTime.substring(0, 10);
if (beginNumber) { if (beginNumber) {
LODOP.ADD_PRINT_TEXT(111, 8, "50mm", "10mm", `日期:${createTimeClone}`); LODOP.ADD_PRINT_TEXT(111, 8, "50mm", "10mm", `日期:${createTimeClone}`);
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
//流水号 //流水号
} else { } else {
LODOP.ADD_PRINT_TEXT(129, 8, "50mm", "10mm", `日期:${createTimeClone}`); LODOP.ADD_PRINT_TEXT(129, 8, "50mm", "10mm", `日期:${createTimeClone}`);
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
} }
if (beginNumber) { if (beginNumber) {
let beginNumberStr = `<div style="font-size:12px;color:#000;font-weight:bold;font-family:'思源黑体'"> let beginNumberStr = `<div style="font-size:12px;color:#000;font-weight:bold;font-family:'思源黑体'">
流水号:${beginNumber} 流水号:${beginNumber}
</div>`; </div>`;
LODOP.SET_PRINT_STYLEA(0, "FontName", "思源黑体"); //LODOP.SET_PRINT_STYLEA(0, "FontName", "思源黑体");
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
LODOP.ADD_PRINT_HTM(126, 8, "50mm", "100%", beginNumberStr); LODOP.ADD_PRINT_HTM(126, 8, "50mm", "100%", beginNumberStr);
} }
if (endNumber) { if (endNumber) {
let endNumberStr = `<div style="font-size:12px;color:#000;font-weight:bold;font-family:'思源黑体';"><span>${endNumber}</span></div> let endNumberStr = `<div style="font-size:12px;color:#000;font-weight:bold;font-family:'思源黑体';"><span>${endNumber}</span></div>
</div>`; </div>`;
LODOP.SET_PRINT_STYLEA(0, "FontName", "思源黑体"); // LODOP.SET_PRINT_STYLEA(0, "FontName", "思源黑体");
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
LODOP.ADD_PRINT_HTM(138, 51, "50mm", "100%", endNumberStr); LODOP.ADD_PRINT_HTM(138, 51, "50mm", "100%", endNumberStr);
} }
logStr = `规格型号:【${specifications}】->订单:【${orderBillNo}】->条码:【${barCodeClone}】->条码图片路径:【${image64}】->序号:【${ logStr = `规格型号:【${specifications}】->订单:【${orderBillNo}】->条码:【${barCodeClone}】->条码图片路径:【${image64}】->序号:【${

View File

@@ -717,12 +717,16 @@ const verificationInput = (params: Record<string, any>) => {
if (prop !== "number") { if (prop !== "number") {
return; return;
} }
if (datas.generateCodeTableData[index]["number"] == 0) {
datas.generateCodeTableData[index]["number"] = "";
}
let isTwoClone = datas.generateCodeTableData[index]["isTwoClone"]; let isTwoClone = datas.generateCodeTableData[index]["isTwoClone"];
if (isTwoClone == 2) { if (isTwoClone == 2) {
isTowNumber(index); isTowNumber(index);
} else { } else {
datas.generateCodeTableData[index]["number"] = integerNumber(datas.generateCodeTableData[index]["number"]); datas.generateCodeTableData[index]["number"] = integerNumber(datas.generateCodeTableData[index]["number"]);
} }
if (datas.generateCodeTableData[index]["number"] > 1000) { if (datas.generateCodeTableData[index]["number"] > 1000) {
datas.generateCodeTableData[index]["number"] = 1000; datas.generateCodeTableData[index]["number"] = 1000;
} }

File diff suppressed because one or more lines are too long