From ff57ea0441d22e1cceb3d1812b1d08e241d96a47 Mon Sep 17 00:00:00 2001 From: han0 Date: Tue, 4 Mar 2025 10:27:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=9C=B0=E6=9D=90?= =?UTF-8?q?=E9=87=87=E9=9B=86=E4=B8=8A=E4=BC=A0=E6=9D=90=E6=96=99=E7=BC=96?= =?UTF-8?q?=E7=A0=81=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xinke/main/model/db/LocalMaterial.java | 19 +++++----- src/main/resources/_sql/init/mysql/v0.8.sql | 37 ++++++++++++++++++- 2 files changed, 46 insertions(+), 10 deletions(-) diff --git a/src/main/java/mjkf/xinke/main/model/db/LocalMaterial.java b/src/main/java/mjkf/xinke/main/model/db/LocalMaterial.java index a22d25a..3f1663b 100644 --- a/src/main/java/mjkf/xinke/main/model/db/LocalMaterial.java +++ b/src/main/java/mjkf/xinke/main/model/db/LocalMaterial.java @@ -101,15 +101,16 @@ public class LocalMaterial extends Model { 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("名称为空"); diff --git a/src/main/resources/_sql/init/mysql/v0.8.sql b/src/main/resources/_sql/init/mysql/v0.8.sql index eef9814..18f743d 100644 --- a/src/main/resources/_sql/init/mysql/v0.8.sql +++ b/src/main/resources/_sql/init/mysql/v0.8.sql @@ -95,4 +95,39 @@ UPDATE MATERIAL SET tax = 9 WHERE tax IS NULL OR tax = 0; -- 修改表结构,设置tax字段默认值为9 ALTER TABLE MATERIAL MODIFY COLUMN tax int DEFAULT 9 COMMENT '税率(%)'; -UPDATE MATERIAL SET type = 1 WHERE type IS NULL OR type = 0; \ No newline at end of file +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()); \ No newline at end of file