feat: 新增地材采集上传材料编码的支持

This commit is contained in:
han0
2025-03-04 10:27:13 +08:00
parent ef9ff78b86
commit ff57ea0441
2 changed files with 46 additions and 10 deletions

View File

@@ -101,15 +101,16 @@ public class LocalMaterial extends Model<LocalMaterial> {
public LocalMaterial (Row row, MaterialTask task) {
var policy = Row.MissingCellPolicy.CREATE_NULL_AS_BLANK;
this.setCity(row.getCell(0, policy).getStringCellValue());
this.setCounty(row.getCell(1, policy).getStringCellValue());
this.setName(row.getCell(2, policy).getStringCellValue().replace(" ", ""));
this.setSpec(row.getCell(3, policy).getStringCellValue().replace(" ", ""));
this.setUnit(row.getCell(4, policy).getStringCellValue());
this.setPrice(BigDecimal.valueOf(row.getCell(5, policy).getNumericCellValue()));
this.setPriceWithoutTax(BigDecimal.valueOf(row.getCell(6, policy).getNumericCellValue()));
this.setPosition(row.getCell(7, policy).getStringCellValue());
this.setRemark(row.getCell(8, policy).getStringCellValue());
this.setMaterialId(row.getCell(0, policy).getStringCellValue());
this.setCity(row.getCell(1, policy).getStringCellValue());
this.setCounty(row.getCell(2, policy).getStringCellValue());
this.setName(row.getCell(3, policy).getStringCellValue().replace(" ", ""));
this.setSpec(row.getCell(4, policy).getStringCellValue().replace(" ", ""));
this.setUnit(row.getCell(5, policy).getStringCellValue());
this.setPrice(BigDecimal.valueOf(row.getCell(6, policy).getNumericCellValue()));
this.setPriceWithoutTax(BigDecimal.valueOf(row.getCell(7, policy).getNumericCellValue()));
this.setPosition(row.getCell(8, policy).getStringCellValue());
this.setRemark(row.getCell(9, policy).getStringCellValue());
this.setDate(LocalDate.of(task.getYear(), task.getMonth(), 1)); // 从任务获取日期
if (this.getName().isEmpty()) {
throw new IllegalArgumentException("名称为空");

View File

@@ -96,3 +96,38 @@ UPDATE MATERIAL SET tax = 9 WHERE tax IS NULL OR tax = 0;
ALTER TABLE MATERIAL MODIFY COLUMN tax int DEFAULT 9 COMMENT '税率(%';
UPDATE MATERIAL SET type = 1 WHERE type IS NULL OR type = 0;
-- 默认地材
INSERT INTO MATERIAL (ID,
NAME,
SPEC,
UNIT,
TYPE,
IS_BUILTIN,
CODE,
CATEGORY1,
CATEGORY2,
CATEGORY3,
TAX,
SORT,
CREATE_TIME)
VALUES ('5503005', '中(粗)砂', '混凝土、砂浆用堆方', 'm3', 2, 1, '5503005', '55', '03', '005', 9, 0, NOW()),
('5503006', '机制砂', NULL, 'm3', 2, 1, '5503006', '55', '03', '006', 9, 0, NOW()),
('5501003', '粘土', '堆方', 'm3', 2, 1, '5501003', '55', '01', '003', 9, 0, NOW()),
('5505003', '砾石', '最大粒径6cm堆方', 'm3', 2, 1, '5505003', '55', '05', '003', 9, 0, NOW()),
('5505005', '片石', '码方', 'm3', 2, 1, '5505005', '55', '05', '005', 9, 0, NOW()),
('5505012', '碎石', '最大粒径2cm堆方', 'm3', 2, 1, '5505012', '55', '05', '012', 9, 0, NOW()),
('5505013', '碎石', '最大粒径4cm堆方', 'm3', 2, 1, '5505013', '55', '05', '013', 9, 0, NOW()),
('5505014', '碎石', '最大粒径6cm堆方', 'm3', 2, 1, '5505014', '55', '05', '014', 9, 0, NOW()),
('5505016', '碎石', '末筛分碎石统料堆方', 'm3', 2, 1, '5505016', '55', '05', '016', 9, 0, NOW()),
('5505017', '路面用碎石', '最大粒径1.5cm堆方', 'm3', 2, 1, '5505017', '55', '05', '017', 9, 0, NOW()),
('5505018', '路面用碎石', '最大粒径2.5cm堆方', 'm3', 2, 1, '5505018', '55', '05', '018', 9, 0, NOW()),
('5505025', '块石', '码方', 'm3', 2, 1, '5505025', '55', '05', '025', 9, 0, NOW()),
('5505029', '粗料石', '码方', 'm3', 2, 1, '5505029', '55', '05', '029', 9, 0, NOW()),
('5505030', '细料石', '码方', 'm3', 2, 1, '5505030', '55', '05', '030', 9, 0, NOW()),
('1511006', '商品混凝土', 'C15', 'm3', 2, 1, '1511006', '15', '11', '006', 9, 0, NOW()),
('1511007', '商品混凝土', 'C20', 'm3', 2, 1, '1511007', '15', '11', '007', 9, 0, NOW()),
('1511008', '商品混凝土', 'C25', 'm3', 2, 1, '1511008', '15', '11', '008', 9, 0, NOW()),
('1511009', '商品混凝土', 'C30', 'm3', 2, 1, '1511009', '15', '11', '009', 9, 0, NOW()),
('1511011', '商品混凝土', 'C35', 'm3', 2, 1, '1511011', '15', '11', '011', 9, 0, NOW()),
('1511013', '商品混凝土', 'C40', 'm3', 2, 1, '1511013', '15', '11', '013', 9, 0, NOW());