|
@@ -322,19 +322,28 @@ const EMPTY_BOOK = (() => {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ const getFourCode = (code) => {
|
|
|
+ if (!code) {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ return code.substring(0, 4);
|
|
|
+ }
|
|
|
+
|
|
|
// ai填值
|
|
|
const aiMatch = async () => {
|
|
|
try {
|
|
|
+ debugger;
|
|
|
// 获取信息价总表
|
|
|
const priceInfoSummary = await ajaxPost('/priceInfoSummary/getData', {}, 1000 * 60 * 5);
|
|
|
- const summaryGroupMap = _.groupBy(priceInfoSummary, 'code');
|
|
|
+ const summaryGroupMap = _.groupBy(priceInfoSummary, item => getFourCode(item.code));
|
|
|
const noCodeSummary = priceInfoSummary.filter(item => !item.code);
|
|
|
const totalRows = workBookObj.sheet.getRowCount();
|
|
|
const changedCells = [];
|
|
|
const noMatchRows = []; // 没有匹配、ai没有命中的行,后续需要自动生成别名编码(最大的别名编码+1)
|
|
|
for (let i = 0; i < totalRows; i++) {
|
|
|
const rowData = getRowData(workBookObj.sheet, i, setting.header);
|
|
|
- const code = rowData.code || '';
|
|
|
+ // const code = rowData.code || '';
|
|
|
+ const code = getFourCode(rowData.code);
|
|
|
const toMatchSummary = code ? summaryGroupMap[code] || [] : noCodeSummary;
|
|
|
if (toMatchSummary.length) {
|
|
|
changedCells.push({ row: i });
|
|
@@ -362,7 +371,8 @@ const EMPTY_BOOK = (() => {
|
|
|
chunk.forEach(item => {
|
|
|
const rowData = getRowData(workBookObj.sheet, item.row, setting.header);
|
|
|
listA.push(`${rowData.name || ''} ${rowData.specs}`);
|
|
|
- const code = rowData.code || '';
|
|
|
+ // const code = rowData.code || '';
|
|
|
+ const code = getFourCode(rowData.code);
|
|
|
const toMatchSummary = code ? summaryGroupMap[code] || [] : noCodeSummary;
|
|
|
summaryData.push(toMatchSummary);
|
|
|
const summaryKeys = toMatchSummary.map(summary => `${summary.name || ''} ${summary.specs || ''}`);
|
|
@@ -379,7 +389,7 @@ const EMPTY_BOOK = (() => {
|
|
|
const firstMatch = item[0];
|
|
|
const chunkItem = chunk[index];
|
|
|
// 相似度过低的不命中
|
|
|
- if (firstMatch.similarity < 50) {
|
|
|
+ if (firstMatch.similarity < 70) {
|
|
|
noMatchRows.push(chunkItem.row);
|
|
|
return;
|
|
|
};
|