feat: 🚀 生成条码拼接id
This commit is contained in:
@@ -8,5 +8,6 @@ export const getBoxMarkListApi = (params: Record<string, any>) => {
|
||||
};
|
||||
//生成箱唛
|
||||
export const getMaterialListApi = (speci: any) => {
|
||||
console.log(speci, "=speci=");
|
||||
return http.get<any>(`SysConfig/GetMaterialList?speci=${encodeURIComponent(speci)}`);
|
||||
};
|
||||
|
||||
@@ -100,7 +100,7 @@ function AddPrintContent(obj) {
|
||||
if (specifications.length > 15) {
|
||||
LODOP.ADD_PRINT_TEXT(8, 8, "20mm", 10, "产品型号:");
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
LODOP.ADD_PRINT_TEXT(8, 64, "45mm", 20, `${specifications}`);
|
||||
LODOP.ADD_PRINT_TEXT(8, 64, "42mm", 20, `${specifications}`);
|
||||
LODOP.SET_PRINT_STYLEA(0, "TextOverflow", 2);
|
||||
LODOP.SET_PRINT_STYLE("FontName", "黑体");
|
||||
//防止文字未满进行换行
|
||||
@@ -109,7 +109,7 @@ function AddPrintContent(obj) {
|
||||
} else {
|
||||
LODOP.ADD_PRINT_TEXT(8, 8, "20mm", "10mm", "产品型号:");
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
LODOP.ADD_PRINT_TEXT(8, 64, "45mm", "100%", `${specifications}`);
|
||||
LODOP.ADD_PRINT_TEXT(8, 64, "42mm", "100%", `${specifications}`);
|
||||
LODOP.SET_PRINT_STYLEA(0, "LineSpacing", -5);
|
||||
//防止文字未满进行换行
|
||||
LODOP.SET_PRINT_STYLEA(0, "TextNeatRow", 1);
|
||||
@@ -119,7 +119,7 @@ function AddPrintContent(obj) {
|
||||
if (specifications.length > 25) {
|
||||
LODOP.ADD_PRINT_TEXT(8, 8, "20mm", 10, "产品型号:");
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
LODOP.ADD_PRINT_TEXT(8, 64, "45mm", 20, `${specifications}`);
|
||||
LODOP.ADD_PRINT_TEXT(8, 64, "42mm", 20, `${specifications}`);
|
||||
LODOP.SET_PRINT_STYLEA(0, "TextOverflow", 2);
|
||||
//防止文字未满进行换行
|
||||
LODOP.SET_PRINT_STYLEA(0, "TextNeatRow", 1);
|
||||
@@ -128,7 +128,7 @@ function AddPrintContent(obj) {
|
||||
} else {
|
||||
LODOP.ADD_PRINT_TEXT(8, 8, "20mm", "10mm", "产品型号:");
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
LODOP.ADD_PRINT_TEXT(8, 64, "45mm", "100%", `${specifications}`);
|
||||
LODOP.ADD_PRINT_TEXT(8, 64, "42mm", "100%", `${specifications}`);
|
||||
//防止文字未满进行换行
|
||||
LODOP.SET_PRINT_STYLEA(0, "TextNeatRow", 1);
|
||||
LODOP.SET_PRINT_STYLEA(0, "LineSpacing", -5);
|
||||
@@ -191,11 +191,12 @@ function AddPrintContent(obj) {
|
||||
//产品名称
|
||||
if (materialName) {
|
||||
LODOP.ADD_PRINT_TEXT(37, 8, "20mm", "10mm", "产品名称:");
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
// LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
LODOP.ADD_PRINT_TEXT(37, 64, "45mm", 20, `${materialName}`);
|
||||
LODOP.SET_PRINT_STYLEA(0, "TextOverflow", 2);
|
||||
LODOP.SET_PRINT_STYLEA(0, "LineSpacing", -4);
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
// LODOP.SET_PRINT_STYLEA(1, "FontName", "Times New Roman");
|
||||
}
|
||||
|
||||
//二维码
|
||||
@@ -236,39 +237,39 @@ function AddPrintContent(obj) {
|
||||
}
|
||||
//订单号
|
||||
if (beginNumber) {
|
||||
LODOP.ADD_PRINT_TEXT(64, 8, "78mm", 10, `订单号:${orderBillNo}`);
|
||||
LODOP.ADD_PRINT_TEXT(64, 8, "72mm", 10, `订单号:${orderBillNo}`);
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
LODOP.SET_PRINT_STYLEA(0, "Overflow", 2);
|
||||
// LODOP.SET_PRINT_STYLEA(0, "TextOverflow", 2);
|
||||
} else {
|
||||
LODOP.ADD_PRINT_TEXT(65, 8, "78mm", 10, `订单号:${orderBillNo}`);
|
||||
LODOP.ADD_PRINT_TEXT(65, 8, "72mm", 10, `订单号:${orderBillNo}`);
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
LODOP.SET_PRINT_STYLEA(0, "Overflow", 2);
|
||||
// LODOP.SET_PRINT_STYLEA(0, "TextOverflow", 2);
|
||||
}
|
||||
|
||||
if (beginNumber) {
|
||||
//装箱序号
|
||||
if (isTail) {
|
||||
LODOP.ADD_PRINT_TEXT(79, 8, "50mm", "10mm", `装箱序号:${boxSortCount + "/" + boxSortCount}`);
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
} else {
|
||||
LODOP.ADD_PRINT_TEXT(79, 8, "50mm", "10mm", `装箱序号:${sort + "/" + boxSortCount}`);
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
}
|
||||
} else {
|
||||
if (isTail) {
|
||||
LODOP.ADD_PRINT_TEXT(85, 8, "50mm", "10mm", `装箱序号:${boxSortCount + "/" + boxSortCount}`);
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
} else {
|
||||
LODOP.ADD_PRINT_TEXT(85, 8, "50mm", "10mm", `装箱序号:${sort + "/" + boxSortCount}`);
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
}
|
||||
}
|
||||
if (beginNumber) {
|
||||
LODOP.ADD_PRINT_TEXT(79, 107, "30mm", "10mm", `净重:${isTail ? tailboxNetWeightQty : cratingNetWeightQty} KG`);
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
} else {
|
||||
LODOP.ADD_PRINT_TEXT(85, 107, "30mm", "10mm", `净重:${isTail ? tailboxNetWeightQty : cratingNetWeightQty} KG`);
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
}
|
||||
//净重
|
||||
|
||||
@@ -277,39 +278,39 @@ function AddPrintContent(obj) {
|
||||
if (beginNumber) {
|
||||
if (cratingQty > productQty) {
|
||||
LODOP.ADD_PRINT_TEXT(95, 8, "50mm", "10mm", `装箱数量:${productQty} PCS`);
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
} else {
|
||||
LODOP.ADD_PRINT_TEXT(95, 8, "50mm", "10mm", `装箱数量:${isTail ? tailboxQty : cratingQty} PCS`);
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
}
|
||||
} else {
|
||||
if (cratingQty > productQty) {
|
||||
LODOP.ADD_PRINT_TEXT(107, 8, "50mm", "10mm", `装箱数量:${productQty} PCS`);
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
} else {
|
||||
LODOP.ADD_PRINT_TEXT(107, 8, "50mm", "10mm", `装箱数量:${isTail ? tailboxQty : cratingQty} PCS`);
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
}
|
||||
}
|
||||
|
||||
//毛重
|
||||
if (beginNumber) {
|
||||
LODOP.ADD_PRINT_TEXT(96, 107, "30mm", "10mm", `毛重:${isTail ? tailboxGrossWeightQty : cratingGrossWeightQty} KG`);
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
} else {
|
||||
LODOP.ADD_PRINT_TEXT(102, 107, "30mm", "10mm", `毛重:${isTail ? tailboxGrossWeightQty : cratingGrossWeightQty} KG`);
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
}
|
||||
|
||||
//日期
|
||||
let createTimeClone = createTime.substring(0, 10);
|
||||
if (beginNumber) {
|
||||
LODOP.ADD_PRINT_TEXT(111, 8, "50mm", "10mm", `日期:${createTimeClone}`);
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
//流水号
|
||||
} else {
|
||||
LODOP.ADD_PRINT_TEXT(129, 8, "50mm", "10mm", `日期:${createTimeClone}`);
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
}
|
||||
|
||||
if (beginNumber) {
|
||||
@@ -317,14 +318,14 @@ function AddPrintContent(obj) {
|
||||
流水号:${beginNumber}
|
||||
</div>`;
|
||||
//LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
LODOP.ADD_PRINT_HTM(126, 8, "50mm", "100%", beginNumberStr);
|
||||
}
|
||||
if (endNumber) {
|
||||
let endNumberStr = `<div style="font-size:12px;color:#000;font-weight:bold;font-family:'黑体';"><span>${endNumber}</span></div>
|
||||
</div>`;
|
||||
// LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
|
||||
LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
|
||||
LODOP.ADD_PRINT_HTM(138, 51, "50mm", "100%", endNumberStr);
|
||||
}
|
||||
logStr = `规格型号:【${specifications}】->订单:【${orderBillNo}】->条码:【${barCodeClone}】->条码图片路径:【${image64}】->序号:【${
|
||||
|
||||
@@ -11,38 +11,32 @@ export const PRINT_CODE_BTNS = [
|
||||
"两件装序列号(40*28)"
|
||||
];
|
||||
export const ALL_PRINT_BTN = [
|
||||
{
|
||||
value: 1,
|
||||
label: "序列条码(40*20)"
|
||||
},
|
||||
// {
|
||||
// value: 1,
|
||||
// label: "序列条码(40*20)"
|
||||
// },
|
||||
|
||||
// {
|
||||
// value: 2,
|
||||
// label: "数字序列条码(40*20)"
|
||||
// },
|
||||
// {
|
||||
// value: 11,
|
||||
// label: "序列条码(60*40)"
|
||||
// },
|
||||
{
|
||||
value: 2,
|
||||
label: "数字序列条码(40*20)"
|
||||
},
|
||||
{
|
||||
value: 11,
|
||||
label: "序列条码(60*40)"
|
||||
},
|
||||
{
|
||||
value: 13,
|
||||
label: "数字序列条码(60*40)"
|
||||
},
|
||||
// {
|
||||
// value: 13,
|
||||
// label: "数字序列条码(60*40)"
|
||||
// },
|
||||
{
|
||||
value: 3,
|
||||
label: "序列号(20*10)"
|
||||
},
|
||||
{
|
||||
value: 4,
|
||||
label: "数字序列号(20*10)"
|
||||
},
|
||||
|
||||
// {
|
||||
// value: 3,
|
||||
// label: "序列号(20*10)"
|
||||
// },
|
||||
// {
|
||||
// value: 4,
|
||||
// label: "数字序列号(20*10)"
|
||||
// },
|
||||
|
||||
{
|
||||
value: 9,
|
||||
@@ -79,31 +73,31 @@ export const ALL_PRINT_BTN1 = [
|
||||
];
|
||||
|
||||
export const SELECT_PRINT_BTN = [
|
||||
{
|
||||
value: 5,
|
||||
label: "序列条码(40*20)"
|
||||
},
|
||||
// {
|
||||
// value: 5,
|
||||
// label: "序列条码(40*20)"
|
||||
// },
|
||||
|
||||
{
|
||||
value: 6,
|
||||
label: "数字序列条码(40*20)"
|
||||
},
|
||||
{
|
||||
value: 12,
|
||||
label: "序列条码(60*40)"
|
||||
},
|
||||
{
|
||||
value: 14,
|
||||
label: "数字序列条码(60*40)"
|
||||
},
|
||||
{
|
||||
value: 7,
|
||||
label: "序列号(20*10)"
|
||||
},
|
||||
{
|
||||
value: 8,
|
||||
label: "数字序列号(20*10)"
|
||||
},
|
||||
// {
|
||||
// value: 6,
|
||||
// label: "数字序列条码(40*20)"
|
||||
// },
|
||||
// {
|
||||
// value: 12,
|
||||
// label: "序列条码(60*40)"
|
||||
// },
|
||||
// {
|
||||
// value: 14,
|
||||
// label: "数字序列条码(60*40)"
|
||||
// },
|
||||
// {
|
||||
// value: 7,
|
||||
// label: "序列号(20*10)"
|
||||
// },
|
||||
// {
|
||||
// value: 8,
|
||||
// label: "数字序列号(20*10)"
|
||||
// },
|
||||
|
||||
{
|
||||
value: 10,
|
||||
|
||||
@@ -158,6 +158,7 @@
|
||||
remoteMethod(query)
|
||||
}"
|
||||
>
|
||||
<!-- idConvertBar -->
|
||||
<el-option
|
||||
v-for="option in datas.specificationList"
|
||||
:key="option.materialNumber"
|
||||
@@ -695,12 +696,18 @@ const getRemoteData = async (query: any) => {
|
||||
const { data } = result;
|
||||
//规格型号下拉框设置数据
|
||||
datas.generateCodeColumns[0].options[index] = data;
|
||||
if (datas.generateCodeColumns[0].options[index].length) {
|
||||
datas.generateCodeColumns[0].options[index].forEach((item: any) => {
|
||||
item.idConvertBar = item.idConvertBar + "&" + item.specifications;
|
||||
});
|
||||
}
|
||||
}
|
||||
datas.loading = false;
|
||||
};
|
||||
|
||||
// 规格型号转换option点击事件
|
||||
const handleRemoteClick = (item: any) => {
|
||||
console.log(item, "======item===========");
|
||||
datas.remoteSelectItem = item;
|
||||
};
|
||||
|
||||
|
||||
@@ -2,15 +2,46 @@ import { useMsg } from "@/hooks/useMsg";
|
||||
import { ElMessageBox } from "element-plus";
|
||||
import { generateBarCodeApi } from "@/api/modules/barCode";
|
||||
import { getCodeListApi } from "@/api/modules/barCode";
|
||||
|
||||
/**
|
||||
* 提取字符串中&符号前面的部分,无&则返回空字符串,包含完善的容错处理
|
||||
* @param {string} str - 待处理的原始字符串
|
||||
* @returns {string} 有&返回前面部分,无&/输入异常返回空字符串
|
||||
*/
|
||||
const getStrBeforeAmpersand = (str: any) => {
|
||||
// 容错处理1:非字符串转字符串,null/undefined转空字符串
|
||||
const inputStr = String(str ?? "");
|
||||
|
||||
// 容错处理2:去除首尾空格
|
||||
const trimmedStr = inputStr.trim();
|
||||
|
||||
// 容错处理3:空字符串直接返回''
|
||||
if (!trimmedStr) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// 找到&符号的位置
|
||||
const ampersandIndex = trimmedStr.indexOf("&");
|
||||
|
||||
// 核心修正:无&符号直接返回'',而非原字符串
|
||||
if (ampersandIndex === -1) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// 提取&前部分并去空格(即使&在开头,也会返回'')
|
||||
return trimmedStr.substring(0, ampersandIndex).trim();
|
||||
};
|
||||
|
||||
//生成条码接口
|
||||
const generateBarCode = async (datas: any, proTable: any) => {
|
||||
let params: any = {
|
||||
details: [],
|
||||
orgCode: datas.ruleForm.orgCode
|
||||
};
|
||||
|
||||
datas.generateCodeTableData.forEach((item: any) => {
|
||||
params.details.push({
|
||||
idConvertBar: item.idConvertBar,
|
||||
idConvertBar: getStrBeforeAmpersand(item.idConvertBar),
|
||||
materialNumber: item.materialNumber,
|
||||
number: item.number,
|
||||
purchaseBillNo: item.purchaseBillNo,
|
||||
|
||||
366
vite.config.ts.timestamp-1771900631912-4d10ea015efa6.mjs
Normal file
366
vite.config.ts.timestamp-1771900631912-4d10ea015efa6.mjs
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user