refactor(warehouse): 优化库位编码生成逻辑
- 移除列编号的前导零补位逻辑,列直接显示数字 - 保留行编号的前导零补位逻辑,确保两位数格式 - 添加编码拼接逻辑的注释说明 - 优化代码可读性和维护性
This commit is contained in:
@@ -74,9 +74,13 @@ public class WmsActualWarehouseServiceImpl implements IWmsActualWarehouseService
|
|||||||
for (int l = 1; l <= layers; l++) {
|
for (int l = 1; l <= layers; l++) {
|
||||||
int rowsForLayer = (l == 2) ? Math.max(rows - 1, 1) : rows;
|
int rowsForLayer = (l == 2) ? Math.max(rows - 1, 1) : rows;
|
||||||
for (int c = 1; c <= cols; c++) {
|
for (int c = 1; c <= cols; c++) {
|
||||||
|
// 列直接显示数字(1→1,10→10,无需补0)
|
||||||
|
String cStr = String.valueOf(c);
|
||||||
for (int r = 1; r <= rowsForLayer; r++) {
|
for (int r = 1; r <= rowsForLayer; r++) {
|
||||||
|
// 行的逻辑(1→01,10→10)
|
||||||
String rStr = r < 10 ? ("0" + r) : String.valueOf(r);
|
String rStr = r < 10 ? ("0" + r) : String.valueOf(r);
|
||||||
String code = prefix + c + '-' + rStr + '-' + l;
|
// 拼接编码:前缀 + 列 + - + 行 + - + 层
|
||||||
|
String code = prefix + cStr + '-' + rStr + '-' + l;
|
||||||
codes.add(code);
|
codes.add(code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user