This commit is contained in:
Leo
2026-01-06 01:03:53 +08:00
parent 0556f19e97
commit 23c59a5e52

View File

@@ -1056,6 +1056,7 @@ public class TencentDocController extends BaseController {
// 自动识别列位置(从表头中识别)
Integer orderNoColumn = null; // "单号"列
Integer logisticsLinkColumn = null; // "物流单号"列
Integer remarkColumn = null; // "备注"列
Integer arrangedColumn = null; // "是否安排"列
Integer markColumn = null; // "标记"列
Integer phoneColumn = null; // "下单电话"列
@@ -1085,11 +1086,17 @@ public class TencentDocController extends BaseController {
log.info("✓ 识别到 '物流单号' 列:第 {} 列(索引{}", i + 1, i);
}
// 识别"备注"列(可选)
if (remarkColumn == null && cellValueTrim.contains("备注")) {
remarkColumn = i;
log.info("✓ 识别到 '备注' 列:第 {} 列(索引{}", i + 1, i);
}
// 识别"是否安排"列(可选)
//if (arrangedColumn == null && cellValueTrim.contains("是否安排")) {
// arrangedColumn = i;
// log.info("✓ 识别到 '是否安排' 列:第 {} 列(索引{}", i + 1, i);
//}
if (arrangedColumn == null && (cellValueTrim.contains("是否安排") || cellValueTrim.contains("安排"))) {
arrangedColumn = i;
log.info("✓ 识别到 '是否安排' 列:第 {} 列(索引{}", i + 1, i);
}
// 识别"标记"列(可选)
if (markColumn == null && cellValueTrim.contains("标记")) {
@@ -1115,6 +1122,9 @@ public class TencentDocController extends BaseController {
}
// 提示可选列的识别情况
if (remarkColumn == null) {
log.warn("未找到'备注'列,将跳过该字段的更新");
}
if (arrangedColumn == null) {
log.warn("未找到'是否安排'列,将跳过该字段的更新");
}
@@ -1125,8 +1135,8 @@ public class TencentDocController extends BaseController {
log.warn("未找到'下单电话'列,将跳过该字段的更新");
}
log.info("列位置识别完成 - 单号: {}, 物流单号: {}, 是否安排: {}, 标记: {}, 下单电话: {}",
orderNoColumn, logisticsLinkColumn, arrangedColumn, markColumn, phoneColumn);
log.info("列位置识别完成 - 单号: {}, 物流单号: {}, 备注: {}, 是否安排: {}, 标记: {}, 下单电话: {}",
orderNoColumn, logisticsLinkColumn, remarkColumn, arrangedColumn, markColumn, phoneColumn);
// 读取数据行
// 使用 A1 表示法Excel格式
@@ -1381,12 +1391,19 @@ public class TencentDocController extends BaseController {
log.info("✓ 准备写入手机号码 - 单号: {}, 手机号: {}, 行: {}, 列: {}", expectedOrderNo, phone, row, phoneCol);
}
// 3. 更新"是否安排"列(如果存在)
if (arrangedColumn != null) {
requests.add(buildUpdateCellRequest(sheetId, row - 1, arrangedColumn, "2", false));
// 3. 更新"备注"列(如果存在,固定填写"有货"
if (remarkColumn != null) {
requests.add(buildUpdateCellRequest(sheetId, row - 1, remarkColumn, "有货", false));
log.info("✓ 准备写入备注 - 单号: {}, 备注: 有货, 行: {}, 列: {}", expectedOrderNo, row, remarkColumn);
}
// 4. 更新"标记"列(如果存在)
// 4. 更新"是否安排"列(如果存在,固定填写"2"
if (arrangedColumn != null) {
requests.add(buildUpdateCellRequest(sheetId, row - 1, arrangedColumn, "2", false));
log.info("✓ 准备写入是否安排 - 单号: {}, 是否安排: 2, 行: {}, 列: {}", expectedOrderNo, row, arrangedColumn);
}
// 5. 更新"标记"列(如果存在)
if (markColumn != null) {
requests.add(buildUpdateCellRequest(sheetId, row - 1, markColumn, today, false));
}