From 2b7759bdc740fa59d705c934f8875b5685a64020 Mon Sep 17 00:00:00 2001 From: Jzow Date: Thu, 1 Aug 2024 20:45:32 +0800 Subject: [PATCH 1/4] Move to a new module --- .../bo/{ => warehouse}/AllotStockDataExportBO.java | 2 +- .../{ => warehouse}/AssembleStockDataExportBO.java | 2 +- .../StorageShipmentStockExportBO.java | 14 +++++++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) rename core/domain/src/main/java/com/wansenai/bo/{ => warehouse}/AllotStockDataExportBO.java (98%) rename core/domain/src/main/java/com/wansenai/bo/{ => warehouse}/AssembleStockDataExportBO.java (98%) rename core/domain/src/main/java/com/wansenai/bo/{ => warehouse}/StorageShipmentStockExportBO.java (71%) diff --git a/core/domain/src/main/java/com/wansenai/bo/AllotStockDataExportBO.java b/core/domain/src/main/java/com/wansenai/bo/warehouse/AllotStockDataExportBO.java similarity index 98% rename from core/domain/src/main/java/com/wansenai/bo/AllotStockDataExportBO.java rename to core/domain/src/main/java/com/wansenai/bo/warehouse/AllotStockDataExportBO.java index e9bdf003..616ed984 100644 --- a/core/domain/src/main/java/com/wansenai/bo/AllotStockDataExportBO.java +++ b/core/domain/src/main/java/com/wansenai/bo/warehouse/AllotStockDataExportBO.java @@ -10,7 +10,7 @@ * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package com.wansenai.bo; +package com.wansenai.bo.warehouse; import com.wansenai.utils.excel.ExcelExport; import lombok.AllArgsConstructor; diff --git a/core/domain/src/main/java/com/wansenai/bo/AssembleStockDataExportBO.java b/core/domain/src/main/java/com/wansenai/bo/warehouse/AssembleStockDataExportBO.java similarity index 98% rename from core/domain/src/main/java/com/wansenai/bo/AssembleStockDataExportBO.java rename to core/domain/src/main/java/com/wansenai/bo/warehouse/AssembleStockDataExportBO.java index 7c5178dc..61ef6aae 100644 --- a/core/domain/src/main/java/com/wansenai/bo/AssembleStockDataExportBO.java +++ b/core/domain/src/main/java/com/wansenai/bo/warehouse/AssembleStockDataExportBO.java @@ -10,7 +10,7 @@ * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package com.wansenai.bo; +package com.wansenai.bo.warehouse; import com.wansenai.utils.excel.ExcelExport; import lombok.AllArgsConstructor; diff --git a/core/domain/src/main/java/com/wansenai/bo/StorageShipmentStockExportBO.java b/core/domain/src/main/java/com/wansenai/bo/warehouse/StorageShipmentStockExportBO.java similarity index 71% rename from core/domain/src/main/java/com/wansenai/bo/StorageShipmentStockExportBO.java rename to core/domain/src/main/java/com/wansenai/bo/warehouse/StorageShipmentStockExportBO.java index a9689e98..bf12c449 100644 --- a/core/domain/src/main/java/com/wansenai/bo/StorageShipmentStockExportBO.java +++ b/core/domain/src/main/java/com/wansenai/bo/warehouse/StorageShipmentStockExportBO.java @@ -1,4 +1,16 @@ -package com.wansenai.bo; +/* + * Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance + * with the License. A copy of the License is located at + * + * http://opensource.wansenai.com/apache2.0/ + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES + * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ +package com.wansenai.bo.warehouse; import com.wansenai.utils.excel.ExcelExport; import lombok.AllArgsConstructor; From 92b4e4c549ca8ccaa1a23434cdbc52199aa7433e Mon Sep 17 00:00:00 2001 From: Jzow Date: Thu, 1 Aug 2024 20:46:51 +0800 Subject: [PATCH 2/4] Add export objects to the warehouse module --- .../bo/warehouse/AllotReceiptExportBO.java | 48 ++++++++++++ .../bo/warehouse/AllotReceiptExportEnBO.java | 48 ++++++++++++ .../warehouse/AllotStockDataExportEnBO.java | 67 +++++++++++++++++ .../bo/warehouse/AssembleReceiptExportBO.java | 48 ++++++++++++ .../warehouse/AssembleReceiptExportEnBO.java | 48 ++++++++++++ .../AssembleStockDataExportEnBO.java | 67 +++++++++++++++++ .../warehouse/DisassembleReceiptExportBO.java | 48 ++++++++++++ .../DisassembleReceiptExportEnBO.java | 48 ++++++++++++ .../bo/warehouse/OtherShipmentExportBO.java | 51 +++++++++++++ .../bo/warehouse/OtherShipmentExportEnBO.java | 51 +++++++++++++ .../bo/warehouse/OtherStorageExportBO.java | 51 +++++++++++++ .../bo/warehouse/OtherStorageExportEnBO.java | 51 +++++++++++++ .../StorageShipmentStockExportEnBO.java | 73 +++++++++++++++++++ 13 files changed, 699 insertions(+) create mode 100644 core/domain/src/main/java/com/wansenai/bo/warehouse/AllotReceiptExportBO.java create mode 100644 core/domain/src/main/java/com/wansenai/bo/warehouse/AllotReceiptExportEnBO.java create mode 100644 core/domain/src/main/java/com/wansenai/bo/warehouse/AllotStockDataExportEnBO.java create mode 100644 core/domain/src/main/java/com/wansenai/bo/warehouse/AssembleReceiptExportBO.java create mode 100644 core/domain/src/main/java/com/wansenai/bo/warehouse/AssembleReceiptExportEnBO.java create mode 100644 core/domain/src/main/java/com/wansenai/bo/warehouse/AssembleStockDataExportEnBO.java create mode 100644 core/domain/src/main/java/com/wansenai/bo/warehouse/DisassembleReceiptExportBO.java create mode 100644 core/domain/src/main/java/com/wansenai/bo/warehouse/DisassembleReceiptExportEnBO.java create mode 100644 core/domain/src/main/java/com/wansenai/bo/warehouse/OtherShipmentExportBO.java create mode 100644 core/domain/src/main/java/com/wansenai/bo/warehouse/OtherShipmentExportEnBO.java create mode 100644 core/domain/src/main/java/com/wansenai/bo/warehouse/OtherStorageExportBO.java create mode 100644 core/domain/src/main/java/com/wansenai/bo/warehouse/OtherStorageExportEnBO.java create mode 100644 core/domain/src/main/java/com/wansenai/bo/warehouse/StorageShipmentStockExportEnBO.java diff --git a/core/domain/src/main/java/com/wansenai/bo/warehouse/AllotReceiptExportBO.java b/core/domain/src/main/java/com/wansenai/bo/warehouse/AllotReceiptExportBO.java new file mode 100644 index 00000000..d4ab0b76 --- /dev/null +++ b/core/domain/src/main/java/com/wansenai/bo/warehouse/AllotReceiptExportBO.java @@ -0,0 +1,48 @@ +/* + * Copyright 2024-2033 WanSen AI Team, Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance + * with the License. A copy of the License is located at + * + * http://opensource.wansenai.com/apache2.0/ + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES + * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ +package com.wansenai.bo.warehouse; + +import com.wansenai.utils.excel.ExcelExport; +import lombok.Builder; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +@Builder +public class AllotReceiptExportBO { + + private Long id; + + @ExcelExport(value = "单据编号") + private String receiptNumber; + + @ExcelExport(value = "商品信息") + private String productInfo; + + @ExcelExport(value = "单据日期") + private LocalDateTime receiptDate; + + @ExcelExport(value = "商品数量") + private Integer productNumber; + + @ExcelExport(value = "金额合计") + private BigDecimal totalAmount; + + @ExcelExport(value = "操作员") + private String operator; + + @ExcelExport(value = "状态", kv = "0-未审核;1-已审核") + private Integer status; +} diff --git a/core/domain/src/main/java/com/wansenai/bo/warehouse/AllotReceiptExportEnBO.java b/core/domain/src/main/java/com/wansenai/bo/warehouse/AllotReceiptExportEnBO.java new file mode 100644 index 00000000..fee4cd56 --- /dev/null +++ b/core/domain/src/main/java/com/wansenai/bo/warehouse/AllotReceiptExportEnBO.java @@ -0,0 +1,48 @@ +/* + * Copyright 2024-2033 WanSen AI Team, Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance + * with the License. A copy of the License is located at + * + * http://opensource.wansenai.com/apache2.0/ + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES + * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ +package com.wansenai.bo.warehouse; + +import com.wansenai.utils.excel.ExcelExport; +import lombok.Builder; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +@Builder +public class AllotReceiptExportEnBO { + + private Long id; + + @ExcelExport(value = "Receipt Number") + private String receiptNumber; + + @ExcelExport(value = "Product Info") + private String productInfo; + + @ExcelExport(value = "Receipt Date") + private LocalDateTime receiptDate; + + @ExcelExport(value = "Quantity") + private Integer productNumber; + + @ExcelExport(value = "Total Amount") + private BigDecimal totalAmount; + + @ExcelExport(value = "Operator") + private String operator; + + @ExcelExport(value = "Status", kv = "0-Unaudited;1-Audited;") + private Integer status; +} diff --git a/core/domain/src/main/java/com/wansenai/bo/warehouse/AllotStockDataExportEnBO.java b/core/domain/src/main/java/com/wansenai/bo/warehouse/AllotStockDataExportEnBO.java new file mode 100644 index 00000000..cd32989b --- /dev/null +++ b/core/domain/src/main/java/com/wansenai/bo/warehouse/AllotStockDataExportEnBO.java @@ -0,0 +1,67 @@ +/* + * Copyright 2024-2033 WanSen AI Team, Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance + * with the License. A copy of the License is located at + * + * http://opensource.wansenai.com/apache2.0/ + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES + * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ +package com.wansenai.bo.warehouse; + +import com.wansenai.utils.excel.ExcelExport; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class AllotStockDataExportEnBO { + + @ExcelExport(value = "Receipt Number") + private String receiptNumber; + + @ExcelExport(value = "Transfer Out Warehouse") + private String warehouseName; + + @ExcelExport(value = "Transfer In Warehouse") + private String otherWarehouseName; + + @ExcelExport(value = "BarCode") + private String barCode; + + @ExcelExport(value = "Product Name") + private String productName; + + @ExcelExport(value = "Standard") + private String productStandard; + + @ExcelExport(value = "Model") + private String productModel; + + @ExcelExport(value = "Unit") + private String productUnit; + + @ExcelExport(value = "Stock") + private Integer stock; + + @ExcelExport(value = "Quantity") + private Integer productNumber; + + @ExcelExport(value = "Unit Price") + private BigDecimal unitPrice; + + @ExcelExport(value = "Amount") + private BigDecimal amount; + + @ExcelExport(value = "Remark") + private String remark; +} diff --git a/core/domain/src/main/java/com/wansenai/bo/warehouse/AssembleReceiptExportBO.java b/core/domain/src/main/java/com/wansenai/bo/warehouse/AssembleReceiptExportBO.java new file mode 100644 index 00000000..6b285c6f --- /dev/null +++ b/core/domain/src/main/java/com/wansenai/bo/warehouse/AssembleReceiptExportBO.java @@ -0,0 +1,48 @@ +/* + * Copyright 2024-2033 WanSen AI Team, Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance + * with the License. A copy of the License is located at + * + * http://opensource.wansenai.com/apache2.0/ + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES + * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ +package com.wansenai.bo.warehouse; + +import com.wansenai.utils.excel.ExcelExport; +import lombok.Builder; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +@Builder +public class AssembleReceiptExportBO { + + private Long id; + + @ExcelExport(value = "单据编号") + private String receiptNumber; + + @ExcelExport(value = "商品信息") + private String productInfo; + + @ExcelExport(value = "单据日期") + private LocalDateTime receiptDate; + + @ExcelExport(value = "商品数量") + private Integer productNumber; + + @ExcelExport(value = "金额合计") + private BigDecimal totalAmount; + + @ExcelExport(value = "操作员") + private String operator; + + @ExcelExport(value = "状态", kv = "0-未审核;1-已审核") + private Integer status; +} diff --git a/core/domain/src/main/java/com/wansenai/bo/warehouse/AssembleReceiptExportEnBO.java b/core/domain/src/main/java/com/wansenai/bo/warehouse/AssembleReceiptExportEnBO.java new file mode 100644 index 00000000..2d23e368 --- /dev/null +++ b/core/domain/src/main/java/com/wansenai/bo/warehouse/AssembleReceiptExportEnBO.java @@ -0,0 +1,48 @@ +/* + * Copyright 2024-2033 WanSen AI Team, Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance + * with the License. A copy of the License is located at + * + * http://opensource.wansenai.com/apache2.0/ + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES + * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ +package com.wansenai.bo.warehouse; + +import com.wansenai.utils.excel.ExcelExport; +import lombok.Builder; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +@Builder +public class AssembleReceiptExportEnBO { + + private Long id; + + @ExcelExport(value = "Receipt Number") + private String receiptNumber; + + @ExcelExport(value = "Product Info") + private String productInfo; + + @ExcelExport(value = "Receipt Date") + private LocalDateTime receiptDate; + + @ExcelExport(value = "Quantity") + private Integer productNumber; + + @ExcelExport(value = "Total Amount") + private BigDecimal totalAmount; + + @ExcelExport(value = "Operator") + private String operator; + + @ExcelExport(value = "Status", kv = "0-Unaudited;1-Audited;") + private Integer status; +} diff --git a/core/domain/src/main/java/com/wansenai/bo/warehouse/AssembleStockDataExportEnBO.java b/core/domain/src/main/java/com/wansenai/bo/warehouse/AssembleStockDataExportEnBO.java new file mode 100644 index 00000000..dcfd64ba --- /dev/null +++ b/core/domain/src/main/java/com/wansenai/bo/warehouse/AssembleStockDataExportEnBO.java @@ -0,0 +1,67 @@ +/* + * Copyright 2024-2033 WanSen AI Team, Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance + * with the License. A copy of the License is located at + * + * http://opensource.wansenai.com/apache2.0/ + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES + * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ +package com.wansenai.bo.warehouse; + +import com.wansenai.utils.excel.ExcelExport; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class AssembleStockDataExportEnBO { + + @ExcelExport("Receipt Number") + private String receiptNumber; + + @ExcelExport("Product Type") + private String type; + + @ExcelExport("Warehouse") + private String warehouseName; + + @ExcelExport("BarCode") + private String barCode; + + @ExcelExport("Product Name") + private String productName; + + @ExcelExport("Standard") + private String productStandard; + + @ExcelExport("Model") + private String productModel; + + @ExcelExport("Unit") + private String productUnit; + + @ExcelExport("Stock") + private Integer stock; + + @ExcelExport("Quantity") + private Integer productNumber; + + @ExcelExport("Unit Price") + private BigDecimal unitPrice; + + @ExcelExport("Amount") + private BigDecimal amount; + + @ExcelExport("Remark") + private String remark; +} diff --git a/core/domain/src/main/java/com/wansenai/bo/warehouse/DisassembleReceiptExportBO.java b/core/domain/src/main/java/com/wansenai/bo/warehouse/DisassembleReceiptExportBO.java new file mode 100644 index 00000000..bc8a36f8 --- /dev/null +++ b/core/domain/src/main/java/com/wansenai/bo/warehouse/DisassembleReceiptExportBO.java @@ -0,0 +1,48 @@ +/* + * Copyright 2024-2033 WanSen AI Team, Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance + * with the License. A copy of the License is located at + * + * http://opensource.wansenai.com/apache2.0/ + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES + * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ +package com.wansenai.bo.warehouse; + +import com.wansenai.utils.excel.ExcelExport; +import lombok.Builder; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +@Builder +public class DisassembleReceiptExportBO { + + private Long id; + + @ExcelExport(value = "单据编号") + private String receiptNumber; + + @ExcelExport(value = "商品信息") + private String productInfo; + + @ExcelExport(value = "单据日期") + private LocalDateTime receiptDate; + + @ExcelExport(value = "商品数量") + private Integer productNumber; + + @ExcelExport(value = "金额合计") + private BigDecimal totalAmount; + + @ExcelExport(value = "操作员") + private String operator; + + @ExcelExport(value = "状态", kv = "0-未审核;1-已审核") + private Integer status; +} diff --git a/core/domain/src/main/java/com/wansenai/bo/warehouse/DisassembleReceiptExportEnBO.java b/core/domain/src/main/java/com/wansenai/bo/warehouse/DisassembleReceiptExportEnBO.java new file mode 100644 index 00000000..c1884ed4 --- /dev/null +++ b/core/domain/src/main/java/com/wansenai/bo/warehouse/DisassembleReceiptExportEnBO.java @@ -0,0 +1,48 @@ +/* + * Copyright 2024-2033 WanSen AI Team, Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance + * with the License. A copy of the License is located at + * + * http://opensource.wansenai.com/apache2.0/ + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES + * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ +package com.wansenai.bo.warehouse; + +import com.wansenai.utils.excel.ExcelExport; +import lombok.Builder; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +@Builder +public class DisassembleReceiptExportEnBO { + + private Long id; + + @ExcelExport(value = "Receipt Number") + private String receiptNumber; + + @ExcelExport(value = "Product Info") + private String productInfo; + + @ExcelExport(value = "Receipt Date") + private LocalDateTime receiptDate; + + @ExcelExport(value = "Product Number") + private Integer productNumber; + + @ExcelExport(value = "Total Amount") + private BigDecimal totalAmount; + + @ExcelExport(value = "Operator") + private String operator; + + @ExcelExport(value = "Status", kv = "0-Unaudited;1-Audited;") + private Integer status; +} diff --git a/core/domain/src/main/java/com/wansenai/bo/warehouse/OtherShipmentExportBO.java b/core/domain/src/main/java/com/wansenai/bo/warehouse/OtherShipmentExportBO.java new file mode 100644 index 00000000..2d0de4c6 --- /dev/null +++ b/core/domain/src/main/java/com/wansenai/bo/warehouse/OtherShipmentExportBO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2024-2033 WanSen AI Team, Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance + * with the License. A copy of the License is located at + * + * http://opensource.wansenai.com/apache2.0/ + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES + * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ +package com.wansenai.bo.warehouse; + +import com.wansenai.utils.excel.ExcelExport; +import lombok.Builder; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +@Builder +public class OtherShipmentExportBO { + + private Long id; + + @ExcelExport(value = "客户") + private String customerName; + + @ExcelExport(value = "单据编号") + private String receiptNumber; + + @ExcelExport(value = "商品信息") + private String productInfo; + + @ExcelExport(value = "单据日期") + private LocalDateTime receiptDate; + + @ExcelExport(value = "商品数量") + private Integer productNumber; + + @ExcelExport(value = "金额合计") + private BigDecimal totalAmount; + + @ExcelExport(value = "操作员") + private String operator; + + @ExcelExport(value = "状态", kv = "0-未审核;1-已审核") + private Integer status; +} diff --git a/core/domain/src/main/java/com/wansenai/bo/warehouse/OtherShipmentExportEnBO.java b/core/domain/src/main/java/com/wansenai/bo/warehouse/OtherShipmentExportEnBO.java new file mode 100644 index 00000000..7de5bd50 --- /dev/null +++ b/core/domain/src/main/java/com/wansenai/bo/warehouse/OtherShipmentExportEnBO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2024-2033 WanSen AI Team, Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance + * with the License. A copy of the License is located at + * + * http://opensource.wansenai.com/apache2.0/ + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES + * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ +package com.wansenai.bo.warehouse; + +import com.wansenai.utils.excel.ExcelExport; +import lombok.Builder; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +@Builder +public class OtherShipmentExportEnBO { + + private Long id; + + @ExcelExport(value = "Customer") + private String customerName; + + @ExcelExport(value = "Receipt Number") + private String receiptNumber; + + @ExcelExport(value = "Product Info") + private String productInfo; + + @ExcelExport(value = "Receipt Date") + private LocalDateTime receiptDate; + + @ExcelExport(value = "Quantity") + private Integer productNumber; + + @ExcelExport(value = "Total Amount") + private BigDecimal totalAmount; + + @ExcelExport(value = "Operator") + private String operator; + + @ExcelExport(value = "Status", kv = "0-Unaudited;1-Audited;") + private Integer status; +} diff --git a/core/domain/src/main/java/com/wansenai/bo/warehouse/OtherStorageExportBO.java b/core/domain/src/main/java/com/wansenai/bo/warehouse/OtherStorageExportBO.java new file mode 100644 index 00000000..00f898e8 --- /dev/null +++ b/core/domain/src/main/java/com/wansenai/bo/warehouse/OtherStorageExportBO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2024-2033 WanSen AI Team, Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance + * with the License. A copy of the License is located at + * + * http://opensource.wansenai.com/apache2.0/ + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES + * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ +package com.wansenai.bo.warehouse; + +import com.wansenai.utils.excel.ExcelExport; +import lombok.Builder; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +@Builder +public class OtherStorageExportBO { + + private Long id; + + @ExcelExport(value = "供应商") + private String supplierName; + + @ExcelExport(value = "单据编号") + private String receiptNumber; + + @ExcelExport(value = "商品信息") + private String productInfo; + + @ExcelExport(value = "单据日期") + private LocalDateTime receiptDate; + + @ExcelExport(value = "商品数量") + private Integer productNumber; + + @ExcelExport(value = "金额合计") + private BigDecimal totalAmount; + + @ExcelExport(value = "操作员") + private String operator; + + @ExcelExport(value = "状态", kv = "0-未审核;1-已审核") + private Integer status; +} diff --git a/core/domain/src/main/java/com/wansenai/bo/warehouse/OtherStorageExportEnBO.java b/core/domain/src/main/java/com/wansenai/bo/warehouse/OtherStorageExportEnBO.java new file mode 100644 index 00000000..765927bc --- /dev/null +++ b/core/domain/src/main/java/com/wansenai/bo/warehouse/OtherStorageExportEnBO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2024-2033 WanSen AI Team, Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance + * with the License. A copy of the License is located at + * + * http://opensource.wansenai.com/apache2.0/ + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES + * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ +package com.wansenai.bo.warehouse; + +import com.wansenai.utils.excel.ExcelExport; +import lombok.Builder; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +@Builder +public class OtherStorageExportEnBO { + + private Long id; + + @ExcelExport(value = "Supplier") + private String supplierName; + + @ExcelExport(value = "Receipt Number") + private String receiptNumber; + + @ExcelExport(value = "Product Info") + private String productInfo; + + @ExcelExport(value = "Receipt Date") + private LocalDateTime receiptDate; + + @ExcelExport(value = "Quantity") + private Integer productNumber; + + @ExcelExport(value = "Total Amount") + private BigDecimal totalAmount; + + @ExcelExport(value = "Operator") + private String operator; + + @ExcelExport(value = "Status", kv = "0-Unaudited;1-Audited;") + private Integer status; +} diff --git a/core/domain/src/main/java/com/wansenai/bo/warehouse/StorageShipmentStockExportEnBO.java b/core/domain/src/main/java/com/wansenai/bo/warehouse/StorageShipmentStockExportEnBO.java new file mode 100644 index 00000000..ca5925e0 --- /dev/null +++ b/core/domain/src/main/java/com/wansenai/bo/warehouse/StorageShipmentStockExportEnBO.java @@ -0,0 +1,73 @@ +/* + * Copyright 2024-2033 WanSen AI Team, Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance + * with the License. A copy of the License is located at + * + * http://opensource.wansenai.com/apache2.0/ + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES + * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ +package com.wansenai.bo.warehouse; + +import com.wansenai.utils.excel.ExcelExport; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class StorageShipmentStockExportEnBO { + + @ExcelExport(value = "Receipt Number") + private String receiptNumber; + + @ExcelExport(value = "Related Person Type") + private String relatedPersonType; + + @ExcelExport(value = "Related Person") + private String relatedPerson; + + @ExcelExport(value = "Warehouse") + private String warehouseName; + + @ExcelExport(value = "BarCode") + private String barCode; + + @ExcelExport(value = "Product Name") + private String productName; + + @ExcelExport(value = "Standard") + private String productStandard; + + @ExcelExport(value = "Model") + private String productModel; + + @ExcelExport(value = "Extend Info") + private String productExtendInfo; + + @ExcelExport(value = "Stock") + private Integer stock; + + @ExcelExport(value = "Unit") + private String productUnit; + + @ExcelExport(value = "Quantity") + private Integer productNumber; + + @ExcelExport(value = "Unit Price") + private BigDecimal unitPrice; + + @ExcelExport(value = "Amount") + private BigDecimal amount; + + @ExcelExport(value = "Remark") + private String remark; +} From 0dae5aa9a0ca7a16a3498633b42fa6eceb7146b4 Mon Sep 17 00:00:00 2001 From: Jzow Date: Thu, 1 Aug 2024 20:48:36 +0800 Subject: [PATCH 3/4] Add English message return support for the warehouse module --- .../wansenai/vo/warehouse/AllotReceiptVO.java | 7 - .../vo/warehouse/AssembleReceiptVO.java | 7 - .../vo/warehouse/DisassembleReceiptVO.java | 7 - .../vo/warehouse/OtherShipmentVO.java | 8 - .../wansenai/vo/warehouse/OtherStorageVO.java | 8 - .../com/wansenai/service/BaseService.java | 10 +- .../product/impl/ProductServiceImpl.java | 85 ++++-- .../impl/AllotShipmentsServiceImpl.java | 219 ++++++++++++---- .../impl/AssembleReceiptServiceImpl.java | 229 +++++++++++++---- .../impl/DisassembleReceiptServiceImpl.java | 228 +++++++++++++---- .../impl/OtherShipmentsServiceImpl.java | 241 ++++++++++++----- .../impl/OtherStorageServiceImpl.java | 242 +++++++++++++----- .../impl/ProductAttributeServiceImpl.kt | 48 +++- .../impl/ProductCategoryServiceImpl.kt | 42 ++- .../product/impl/ProductUnitServiceImpl.kt | 54 +++- .../utils/enums/AllotShipmentCodeEnum.java | 24 +- .../utils/enums/AssembleReceiptCodeEnum.java | 24 +- .../enums/DisassembleReceiptCodeEnum.java | 24 +- .../utils/enums/OtherShipmentCodeEnum.java | 24 +- .../utils/enums/OtherStorageCodeEnum.java | 24 +- .../wansenai/utils/enums/ProdcutCodeEnum.java | 134 +++++++--- 21 files changed, 1266 insertions(+), 423 deletions(-) diff --git a/core/domain/src/main/java/com/wansenai/vo/warehouse/AllotReceiptVO.java b/core/domain/src/main/java/com/wansenai/vo/warehouse/AllotReceiptVO.java index bbdc49d5..522a2e6f 100644 --- a/core/domain/src/main/java/com/wansenai/vo/warehouse/AllotReceiptVO.java +++ b/core/domain/src/main/java/com/wansenai/vo/warehouse/AllotReceiptVO.java @@ -29,26 +29,19 @@ public class AllotReceiptVO { @JsonFormat(shape = JsonFormat.Shape.STRING) private Long id; - @ExcelExport(value = "单据编号") private String receiptNumber; - @ExcelExport(value = "商品信息") private String productInfo; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @ExcelExport(value = "单据日期") private LocalDateTime receiptDate; - @ExcelExport(value = "商品数量") private Integer productNumber; @JsonSerialize(using = BigDecimalSerializerBO.class) - @ExcelExport(value = "金额合计") private BigDecimal totalAmount; - @ExcelExport(value = "操作员") private String operator; - @ExcelExport(value = "状态", kv = "0-未审核;1-已审核") private Integer status; } diff --git a/core/domain/src/main/java/com/wansenai/vo/warehouse/AssembleReceiptVO.java b/core/domain/src/main/java/com/wansenai/vo/warehouse/AssembleReceiptVO.java index 768e07b5..cd81e210 100644 --- a/core/domain/src/main/java/com/wansenai/vo/warehouse/AssembleReceiptVO.java +++ b/core/domain/src/main/java/com/wansenai/vo/warehouse/AssembleReceiptVO.java @@ -29,26 +29,19 @@ public class AssembleReceiptVO { @JsonFormat(shape = JsonFormat.Shape.STRING) private Long id; - @ExcelExport(value = "单据编号") private String receiptNumber; - @ExcelExport(value = "商品信息") private String productInfo; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @ExcelExport(value = "单据日期") private LocalDateTime receiptDate; - @ExcelExport(value = "商品数量") private Integer productNumber; @JsonSerialize(using = BigDecimalSerializerBO.class) - @ExcelExport(value = "金额合计") private BigDecimal totalAmount; - @ExcelExport(value = "操作员") private String operator; - @ExcelExport(value = "状态", kv = "0-未审核;1-已审核") private Integer status; } diff --git a/core/domain/src/main/java/com/wansenai/vo/warehouse/DisassembleReceiptVO.java b/core/domain/src/main/java/com/wansenai/vo/warehouse/DisassembleReceiptVO.java index 34b4cf36..8dfab76d 100644 --- a/core/domain/src/main/java/com/wansenai/vo/warehouse/DisassembleReceiptVO.java +++ b/core/domain/src/main/java/com/wansenai/vo/warehouse/DisassembleReceiptVO.java @@ -29,26 +29,19 @@ public class DisassembleReceiptVO { @JsonFormat(shape = JsonFormat.Shape.STRING) private Long id; - @ExcelExport(value = "单据编号") private String receiptNumber; - @ExcelExport(value = "商品信息") private String productInfo; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @ExcelExport(value = "单据日期") private LocalDateTime receiptDate; - @ExcelExport(value = "商品数量") private Integer productNumber; @JsonSerialize(using = BigDecimalSerializerBO.class) - @ExcelExport(value = "金额合计") private BigDecimal totalAmount; - @ExcelExport(value = "操作员") private String operator; - @ExcelExport(value = "状态", kv = "0-未审核;1-已审核") private Integer status; } diff --git a/core/domain/src/main/java/com/wansenai/vo/warehouse/OtherShipmentVO.java b/core/domain/src/main/java/com/wansenai/vo/warehouse/OtherShipmentVO.java index 226bbc90..fbfbeeb7 100644 --- a/core/domain/src/main/java/com/wansenai/vo/warehouse/OtherShipmentVO.java +++ b/core/domain/src/main/java/com/wansenai/vo/warehouse/OtherShipmentVO.java @@ -29,29 +29,21 @@ public class OtherShipmentVO { @JsonFormat(shape = JsonFormat.Shape.STRING) private Long id; - @ExcelExport(value = "客户") private String customerName; - @ExcelExport(value = "单据编号") private String receiptNumber; - @ExcelExport(value = "商品信息") private String productInfo; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @ExcelExport(value = "单据日期") private LocalDateTime receiptDate; - @ExcelExport(value = "商品数量") private Integer productNumber; @JsonSerialize(using = BigDecimalSerializerBO.class) - @ExcelExport(value = "金额合计") private BigDecimal totalAmount; - @ExcelExport(value = "操作员") private String operator; - @ExcelExport(value = "状态", kv = "0-未审核;1-已审核") private Integer status; } diff --git a/core/domain/src/main/java/com/wansenai/vo/warehouse/OtherStorageVO.java b/core/domain/src/main/java/com/wansenai/vo/warehouse/OtherStorageVO.java index 86828450..2bf9340e 100644 --- a/core/domain/src/main/java/com/wansenai/vo/warehouse/OtherStorageVO.java +++ b/core/domain/src/main/java/com/wansenai/vo/warehouse/OtherStorageVO.java @@ -29,29 +29,21 @@ public class OtherStorageVO { @JsonFormat(shape = JsonFormat.Shape.STRING) private Long id; - @ExcelExport(value = "供应商") private String supplierName; - @ExcelExport(value = "单据编号") private String receiptNumber; - @ExcelExport(value = "商品信息") private String productInfo; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @ExcelExport(value = "单据日期") private LocalDateTime receiptDate; - @ExcelExport(value = "商品数量") private Integer productNumber; @JsonSerialize(using = BigDecimalSerializerBO.class) - @ExcelExport(value = "金额合计") private BigDecimal totalAmount; - @ExcelExport(value = "操作员") private String operator; - @ExcelExport(value = "状态", kv = "0-未审核;1-已审核") private Integer status; } diff --git a/core/service/src/main/java/com/wansenai/service/BaseService.java b/core/service/src/main/java/com/wansenai/service/BaseService.java index fb6ae255..312280bc 100644 --- a/core/service/src/main/java/com/wansenai/service/BaseService.java +++ b/core/service/src/main/java/com/wansenai/service/BaseService.java @@ -1,5 +1,6 @@ package com.wansenai.service; +import com.wansenai.service.user.ISysUserService; import com.wansenai.utils.redis.RedisUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -14,8 +15,11 @@ public class BaseService { private final RedisUtil redisUtil; - public BaseService(RedisUtil redisUtil) { + private final ISysUserService userService; + + public BaseService(RedisUtil redisUtil, ISysUserService userService) { this.redisUtil = redisUtil; + this.userService = userService; } public Long getCurrentUserId() { @@ -38,6 +42,10 @@ public String getCurrentUserAccount() { return redisUtil.getString(token + ":userAccount"); } + public String getCurrentUserSystemLanguage() { + return userService.getUserSystemLanguage(getCurrentUserId()); + } + private String httpServletRequestContextToken() { var sra = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); if (sra == null) { diff --git a/core/service/src/main/java/com/wansenai/service/product/impl/ProductServiceImpl.java b/core/service/src/main/java/com/wansenai/service/product/impl/ProductServiceImpl.java index e15fdd78..899138cf 100644 --- a/core/service/src/main/java/com/wansenai/service/product/impl/ProductServiceImpl.java +++ b/core/service/src/main/java/com/wansenai/service/product/impl/ProductServiceImpl.java @@ -14,7 +14,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.wansenai.mappers.product.ProductStockMapper; import com.wansenai.service.BaseService; import com.wansenai.utils.SnowflakeIdUtil; import com.wansenai.dto.product.*; @@ -62,9 +61,7 @@ public class ProductServiceImpl extends ServiceImpl impl private final BaseService baseService; - private final ProductStockMapper productStockMapper; - - public ProductServiceImpl(ProductMapper productMapper, ProductStockKeepUnitService productStockKeepUnitService, ProductStockService productStockService, ProductCategoryService productCategoryService, ProductImageService productImageService, ProductUnitService productUnitService, BaseService baseService, ProductStockMapper productStockMapper) { + public ProductServiceImpl(ProductMapper productMapper, ProductStockKeepUnitService productStockKeepUnitService, ProductStockService productStockService, ProductCategoryService productCategoryService, ProductImageService productImageService, ProductUnitService productUnitService, BaseService baseService) { this.productMapper = productMapper; this.productStockKeepUnitService = productStockKeepUnitService; this.productStockService = productStockService; @@ -72,7 +69,6 @@ public ProductServiceImpl(ProductMapper productMapper, ProductStockKeepUnitServi this.productImageService = productImageService; this.productUnitService = productUnitService; this.baseService = baseService; - this.productStockMapper = productStockMapper; } public String getStringValue(String str) { @@ -102,6 +98,7 @@ public Response addOrUpdateProduct(AddOrUpdateProductDTO productDTO) { return Response.responseMsg(BaseCodeEnum.PARAMETER_NULL); } + var systemLanguage = baseService.getCurrentUserSystemLanguage(); if (!productDTO.getPriceList().isEmpty()) { var barCodeList = productDTO.getPriceList().stream() .map(ProductStockKeepUnitDTO::getBarCode) @@ -116,12 +113,22 @@ public Response addOrUpdateProduct(AddOrUpdateProductDTO productDTO) { boolean theSameBarCode = barCodeList.stream() .distinct() .count() != barCodeList.size(); - if (theSameBarCode) { - return Response.responseMsg(ProdcutCodeEnum.PRODUCT_BAR_CODE_EXIST.getCode(), "商品条码不能重复"); - } + if ("zh_CN".equals(systemLanguage)) { + if (theSameBarCode) { + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_BAR_CODE_NOT_DUPLICATED); + } - if (existBarCode) { - return Response.responseMsg(ProdcutCodeEnum.PRODUCT_BAR_CODE_EXIST); + if (existBarCode) { + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_BAR_CODE_EXIST); + } + } else { + if (theSameBarCode) { + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_BAR_CODE_NOT_DUPLICATED_EN); + } + + if (existBarCode) { + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_BAR_CODE_EXIST_EN); + } } } } @@ -257,15 +264,29 @@ public Response addOrUpdateProduct(AddOrUpdateProductDTO productDTO) { if (productDTO.getProductId() == null) { if (addOrUpdateResult && addPriceResult && addStockResult) { - return Response.responseMsg(ProdcutCodeEnum.PRODUCT_ADD_SUCCESS); + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_ADD_SUCCESS); + } + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_ADD_SUCCESS_EN); + } else { + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_ADD_ERROR); + } + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_ADD_ERROR_EN); } - return Response.responseMsg(ProdcutCodeEnum.PRODUCT_ADD_ERROR); } if (addOrUpdateResult && addPriceResult && addStockResult) { - return Response.responseMsg(ProdcutCodeEnum.PRODUCT_UPDATE_SUCCESS); + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_UPDATE_SUCCESS); + } + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_UPDATE_SUCCESS_EN); + } else { + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_UPDATE_ERROR); + } + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_UPDATE_ERROR_EN); } - return Response.responseMsg(ProdcutCodeEnum.PRODUCT_UPDATE_ERROR); } @Override @@ -458,10 +479,18 @@ public Response deleteProduct(List productIds) { // 物理删除商品信息 var deleteProductResult = removeByIds(productIds); + var systemLanguage = baseService.getCurrentUserSystemLanguage(); if (deleteProductResult) { - return Response.responseMsg(ProdcutCodeEnum.PRODUCT_DELETE_SUCCESS); + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_DELETE_SUCCESS); + } + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_DELETE_SUCCESS_EN); + } else { + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_DELETE_ERROR); + } + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_DELETE_ERROR_EN); } - return Response.responseMsg(ProdcutCodeEnum.PRODUCT_DELETE_ERROR); } @Override @@ -476,10 +505,18 @@ public Response updateProductStatus(List productIds, Integer statu .in(Product::getId, productIds) .eq(Product::getDeleteFlag, CommonConstants.NOT_DELETED) .update(); + var systemLanguage = baseService.getCurrentUserSystemLanguage(); if (updateResult) { - return Response.responseMsg(ProdcutCodeEnum.PRODUCT_STATUS_UPDATE_SUCCESS); + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_STATUS_UPDATE_SUCCESS); + } + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_STATUS_UPDATE_SUCCESS_EN); + } else { + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_STATUS_UPDATE_ERROR); + } + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_STATUS_UPDATE_ERROR_EN); } - return Response.responseMsg(ProdcutCodeEnum.PRODUCT_STATUS_UPDATE_ERROR); } @Override @@ -505,10 +542,18 @@ public Response updateBatchProductInfo(UpdateBatchProductDTO productDTO) .in(Product::getId, productDTO.getProductIds()) .eq(Product::getDeleteFlag, CommonConstants.NOT_DELETED) .update(); + var systemLanguage = baseService.getCurrentUserSystemLanguage(); if (updateResult) { - return Response.responseMsg(ProdcutCodeEnum.PRODUCT_BATCH_UPDATE_SUCCESS); + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_BATCH_UPDATE_SUCCESS); + } + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_BATCH_UPDATE_SUCCESS_EN); + } else { + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_BATCH_UPDATE_ERROR); + } + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_BATCH_UPDATE_ERROR_EN); } - return Response.responseMsg(ProdcutCodeEnum.PRODUCT_BATCH_UPDATE_ERROR); } @Override diff --git a/core/service/src/main/java/com/wansenai/service/warehouse/impl/AllotShipmentsServiceImpl.java b/core/service/src/main/java/com/wansenai/service/warehouse/impl/AllotShipmentsServiceImpl.java index ac9ae42b..7e250b0d 100644 --- a/core/service/src/main/java/com/wansenai/service/warehouse/impl/AllotShipmentsServiceImpl.java +++ b/core/service/src/main/java/com/wansenai/service/warehouse/impl/AllotShipmentsServiceImpl.java @@ -16,9 +16,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.wansenai.bo.AllotStockBO; -import com.wansenai.bo.AllotStockDataExportBO; +import com.wansenai.bo.warehouse.AllotStockDataExportBO; import com.wansenai.bo.FileDataBO; -import com.wansenai.bo.StorageShipmentStockBO; +import com.wansenai.bo.warehouse.AllotReceiptExportBO; +import com.wansenai.bo.warehouse.AllotReceiptExportEnBO; +import com.wansenai.bo.warehouse.AllotStockDataExportEnBO; import com.wansenai.dto.warehouse.AllotReceiptDTO; import com.wansenai.dto.warehouse.QueryAllotReceiptDTO; import com.wansenai.entities.product.ProductStock; @@ -39,7 +41,6 @@ import com.wansenai.utils.constants.CommonConstants; import com.wansenai.utils.enums.AllotShipmentCodeEnum; import com.wansenai.utils.enums.BaseCodeEnum; -import com.wansenai.utils.enums.OtherShipmentCodeEnum; import com.wansenai.utils.excel.ExcelUtils; import com.wansenai.utils.response.Response; import com.wansenai.vo.warehouse.AllotReceiptDetailVO; @@ -185,7 +186,7 @@ public Response> getAllotReceiptPageList(QueryAllotReceiptD return Response.responseData(result); } - private List getAllotReceiptList(QueryAllotReceiptDTO queryAllotReceiptDTO) { + private List getAllotReceiptList(QueryAllotReceiptDTO queryAllotReceiptDTO) { var wrapperMainMapper = lambdaQuery() .eq(queryAllotReceiptDTO.getOperatorId() != null, WarehouseReceiptMain::getCreateBy, queryAllotReceiptDTO.getOperatorId()) .eq(queryAllotReceiptDTO.getStatus() != null, WarehouseReceiptMain::getStatus, queryAllotReceiptDTO.getStatus()) @@ -197,7 +198,7 @@ private List getAllotReceiptList(QueryAllotReceiptDTO queryAllot .eq(WarehouseReceiptMain::getDeleteFlag, CommonConstants.NOT_DELETED) .list(); - var allotReceiptVOList = new ArrayList(wrapperMainMapper.size() + 1); + var allotReceiptExportBOList = new ArrayList(wrapperMainMapper.size() + 1); wrapperMainMapper.forEach(item -> { var product = productService.getById(item.getProductId()); @@ -207,7 +208,7 @@ private List getAllotReceiptList(QueryAllotReceiptDTO queryAllot } var operator = userService.getById(item.getCreateBy()); - var allotReceiptVO = AllotReceiptVO.builder() + var allotReceiptExportBO = AllotReceiptExportBO.builder() .id(item.getId()) .receiptNumber(item.getReceiptNumber()) .productInfo(productInfo) @@ -218,9 +219,47 @@ private List getAllotReceiptList(QueryAllotReceiptDTO queryAllot .status(item.getStatus()) .build(); - allotReceiptVOList.add(allotReceiptVO); + allotReceiptExportBOList.add(allotReceiptExportBO); }); - return allotReceiptVOList; + return allotReceiptExportBOList; + } + + private List getAllotReceiptEnList(QueryAllotReceiptDTO queryAllotReceiptDTO) { + var wrapperMainMapper = lambdaQuery() + .eq(queryAllotReceiptDTO.getOperatorId() != null, WarehouseReceiptMain::getCreateBy, queryAllotReceiptDTO.getOperatorId()) + .eq(queryAllotReceiptDTO.getStatus() != null, WarehouseReceiptMain::getStatus, queryAllotReceiptDTO.getStatus()) + .eq(StringUtils.hasLength(queryAllotReceiptDTO.getReceiptNumber()), WarehouseReceiptMain::getReceiptNumber, queryAllotReceiptDTO.getReceiptNumber()) + .like(StringUtils.hasLength(queryAllotReceiptDTO.getRemark()), WarehouseReceiptMain::getRemark, queryAllotReceiptDTO.getRemark()) + .ge(StringUtils.hasLength(queryAllotReceiptDTO.getStartDate()), WarehouseReceiptMain::getCreateTime, queryAllotReceiptDTO.getStartDate()) + .le(StringUtils.hasLength(queryAllotReceiptDTO.getEndDate()), WarehouseReceiptMain::getCreateTime, queryAllotReceiptDTO.getEndDate()) + .eq(WarehouseReceiptMain::getType, "调拨出库") + .eq(WarehouseReceiptMain::getDeleteFlag, CommonConstants.NOT_DELETED) + .list(); + + var allotReceiptExportBOEnList = new ArrayList(wrapperMainMapper.size() + 1); + wrapperMainMapper.forEach(item -> { + + var product = productService.getById(item.getProductId()); + var productInfo = ""; + if(product != null) { + productInfo = product.getProductName() + "|" + product.getProductStandard() + "|" + product.getProductModel() + "|" + product.getProductUnit(); + } + + var operator = userService.getById(item.getCreateBy()); + var allotReceiptExportEnBO = AllotReceiptExportEnBO.builder() + .id(item.getId()) + .receiptNumber(item.getReceiptNumber()) + .productInfo(productInfo) + .receiptDate(item.getReceiptDate()) + .operator(Optional.ofNullable(operator).map(SysUser::getName).orElse("")) + .productNumber(item.getTotalProductNumber()) + .totalAmount(item.getTotalAmount()) + .status(item.getStatus()) + .build(); + + allotReceiptExportBOEnList.add(allotReceiptExportEnBO); + }); + return allotReceiptExportBOEnList; } @Override @@ -281,6 +320,7 @@ public Response getAllotReceiptDetail(Long id) { @Transactional public Response addOrUpdateAllotReceipt(AllotReceiptDTO allotReceiptDTO) { var userId = userService.getCurrentUserId(); + var systemLanguage = userService.getUserSystemLanguage(userService.getCurrentUserId()); var fid = processFiles(allotReceiptDTO.getFiles(), allotReceiptDTO.getId()); var fileIds = StringUtils.collectionToCommaDelimitedString(fid); var isUpdate = allotReceiptDTO.getId() != null; @@ -369,9 +409,16 @@ public Response addOrUpdateAllotReceipt(AllotReceiptDTO allotReceiptDTO) } if (updateSubResult && warehouseReceiptMain) { - return Response.responseMsg(AllotShipmentCodeEnum.UPDATE_ALLOT_SHIPMENT_STOCK_RECEIPT_SUCCESS); + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(AllotShipmentCodeEnum.UPDATE_ALLOT_SHIPMENT_STOCK_RECEIPT_SUCCESS); + } + return Response.responseMsg(AllotShipmentCodeEnum.UPDATE_ALLOT_SHIPMENT_STOCK_RECEIPT_SUCCESS_EN); + } else { + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(AllotShipmentCodeEnum.UPDATE_ALLOT_SHIPMENT_STOCK_RECEIPT_ERROR); + } + return Response.responseMsg(AllotShipmentCodeEnum.UPDATE_ALLOT_SHIPMENT_STOCK_RECEIPT_ERROR_EN); } - return Response.responseMsg(AllotShipmentCodeEnum.UPDATE_ALLOT_SHIPMENT_STOCK_RECEIPT_ERROR); } else { var receiptMainId = SnowflakeIdUtil.nextId(); @@ -424,9 +471,16 @@ public Response addOrUpdateAllotReceipt(AllotReceiptDTO allotReceiptDTO) updateProductStock(otherSubtractWarehouseReceipts, 1); } if (saveSubResult && saveMainResult) { - return Response.responseMsg(AllotShipmentCodeEnum.ADD_ALLOT_SHIPMENT_STOCK_RECEIPT_SUCCESS); + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(AllotShipmentCodeEnum.ADD_ALLOT_SHIPMENT_STOCK_RECEIPT_SUCCESS); + } + return Response.responseMsg(AllotShipmentCodeEnum.ADD_ALLOT_SHIPMENT_STOCK_RECEIPT_SUCCESS_EN); + } else { + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(AllotShipmentCodeEnum.ADD_ALLOT_SHIPMENT_STOCK_RECEIPT_ERROR); + } + return Response.responseMsg(AllotShipmentCodeEnum.ADD_ALLOT_SHIPMENT_STOCK_RECEIPT_ERROR_EN); } - return Response.responseMsg(AllotShipmentCodeEnum.ADD_ALLOT_SHIPMENT_STOCK_RECEIPT_ERROR); } } @@ -445,10 +499,18 @@ public Response deleteBatchAllotReceipt(List ids) { .in(WarehouseReceiptSub::getWarehouseReceiptMainId, ids) .update(); + var systemLanguage = userService.getUserSystemLanguage(userService.getCurrentUserId()); if(!deleteResult) { - return Response.responseMsg(AllotShipmentCodeEnum.DELETE_ALLOT_SHIPMENT_STOCK_RECEIPT_ERROR); + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(AllotShipmentCodeEnum.DELETE_ALLOT_SHIPMENT_STOCK_RECEIPT_ERROR); + } + return Response.responseMsg(AllotShipmentCodeEnum.DELETE_ALLOT_SHIPMENT_STOCK_RECEIPT_ERROR_EN); + } else { + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(AllotShipmentCodeEnum.DELETE_ALLOT_SHIPMENT_STOCK_RECEIPT_SUCCESS); + } + return Response.responseMsg(AllotShipmentCodeEnum.DELETE_ALLOT_SHIPMENT_STOCK_RECEIPT_SUCCESS_EN); } - return Response.responseMsg(AllotShipmentCodeEnum.DELETE_ALLOT_SHIPMENT_STOCK_RECEIPT_SUCCESS); } @Override @@ -460,44 +522,86 @@ public Response updateAllotReceiptStatus(List ids, Integer status) .set(WarehouseReceiptMain::getStatus, status) .in(WarehouseReceiptMain::getId, ids) .update(); + var systemLanguage = userService.getUserSystemLanguage(userService.getCurrentUserId()); if(!updateResult) { - return Response.responseMsg(AllotShipmentCodeEnum.UPDATE_ALLOT_SHIPMENT_STOCK_RECEIPT_ERROR); + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(AllotShipmentCodeEnum.UPDATE_ALLOT_SHIPMENT_STOCK_RECEIPT_ERROR); + } + return Response.responseMsg(AllotShipmentCodeEnum.UPDATE_ALLOT_SHIPMENT_STOCK_RECEIPT_ERROR_EN); + } else { + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(AllotShipmentCodeEnum.UPDATE_ALLOT_SHIPMENT_STOCK_RECEIPT_SUCCESS); + } + return Response.responseMsg(AllotShipmentCodeEnum.UPDATE_ALLOT_SHIPMENT_STOCK_RECEIPT_SUCCESS_EN); } - return Response.responseMsg(AllotShipmentCodeEnum.UPDATE_ALLOT_SHIPMENT_STOCK_RECEIPT_SUCCESS); } @Override public void exportAllotReceipt(QueryAllotReceiptDTO queryAllotReceiptDTO, HttpServletResponse response) { var exportMap = new ConcurrentHashMap>>(); - var mainData = getAllotReceiptList(queryAllotReceiptDTO); - if (!mainData.isEmpty()) { - exportMap.put("调拨出库", ExcelUtils.getSheetData(mainData)); - if (queryAllotReceiptDTO.getIsExportDetail()) { - var subData = new ArrayList(); - for (AllotReceiptVO allotReceiptVO : mainData) { - var detail = getAllotReceiptDetail(allotReceiptVO.getId()).getData().getTableData(); - if (!detail.isEmpty()) { - detail.forEach(item -> { - var allotStockBo = AllotStockDataExportBO.builder() - .receiptNumber(allotReceiptVO.getReceiptNumber()) - .warehouseName(item.getWarehouseName()) - .otherWarehouseName(item.getOtherWarehouseName()) - .barCode(item.getBarCode()) - .productName(item.getProductName()) - .productStandard(item.getProductStandard()) - .productModel(item.getProductModel()) - .productUnit(item.getProductUnit()) - .stock(item.getStock()) - .productNumber(item.getProductNumber()) - .remark(item.getRemark()) - .build(); - subData.add(allotStockBo); - }); + var systemLanguage = userService.getUserSystemLanguage(userService.getCurrentUserId()); + if ("zh_CN".equals(systemLanguage)) { + var mainData = getAllotReceiptList(queryAllotReceiptDTO); + if (!mainData.isEmpty()) { + exportMap.put("调拨出库", ExcelUtils.getSheetData(mainData)); + if (queryAllotReceiptDTO.getIsExportDetail()) { + var subData = new ArrayList(); + for (AllotReceiptExportBO allotReceiptExportBO : mainData) { + var detail = getAllotReceiptDetail(allotReceiptExportBO.getId()).getData().getTableData(); + if (!detail.isEmpty()) { + detail.forEach(item -> { + var allotStockBo = AllotStockDataExportBO.builder() + .receiptNumber(allotReceiptExportBO.getReceiptNumber()) + .warehouseName(item.getWarehouseName()) + .otherWarehouseName(item.getOtherWarehouseName()) + .barCode(item.getBarCode()) + .productName(item.getProductName()) + .productStandard(item.getProductStandard()) + .productModel(item.getProductModel()) + .productUnit(item.getProductUnit()) + .stock(item.getStock()) + .productNumber(item.getProductNumber()) + .remark(item.getRemark()) + .build(); + subData.add(allotStockBo); + }); + } } + exportMap.put("调拨出库明细", ExcelUtils.getSheetData(subData)); } - exportMap.put("调拨出库明细", ExcelUtils.getSheetData(subData)); + ExcelUtils.exportManySheet(response, "调拨出库", exportMap); + } + } else { + var mainEnData = getAllotReceiptEnList(queryAllotReceiptDTO); + if (!mainEnData.isEmpty()) { + exportMap.put("Transfer Outbound", ExcelUtils.getSheetData(mainEnData)); + if (queryAllotReceiptDTO.getIsExportDetail()) { + var subEnData = new ArrayList(); + for (AllotReceiptExportEnBO allotReceiptExportEnBO : mainEnData) { + var detail = getAllotReceiptDetail(allotReceiptExportEnBO.getId()).getData().getTableData(); + if (!detail.isEmpty()) { + detail.forEach(item -> { + var allotStockEnBo = AllotStockDataExportEnBO.builder() + .receiptNumber(allotReceiptExportEnBO.getReceiptNumber()) + .warehouseName(item.getWarehouseName()) + .otherWarehouseName(item.getOtherWarehouseName()) + .barCode(item.getBarCode()) + .productName(item.getProductName()) + .productStandard(item.getProductStandard()) + .productModel(item.getProductModel()) + .productUnit(item.getProductUnit()) + .stock(item.getStock()) + .productNumber(item.getProductNumber()) + .remark(item.getRemark()) + .build(); + subEnData.add(allotStockEnBo); + }); + } + } + exportMap.put("Transfer Outbound Details", ExcelUtils.getSheetData(subEnData)); + } + ExcelUtils.exportManySheet(response, "Transfer Outbound", exportMap); } - ExcelUtils.exportManySheet(response, "调拨出库", exportMap); } } @@ -513,15 +617,28 @@ public void exportAllotReceiptDetail(String receiptNumber, HttpServletResponse r if (detail != null) { var data = detail.getData(); var tableData = data.getTableData(); - var exportData = new ArrayList(); - tableData.forEach(item -> { - var allotStockBo = new AllotStockDataExportBO(); - allotStockBo.setReceiptNumber(data.getReceiptNumber()); - BeanUtils.copyProperties(item, allotStockBo); - exportData.add(allotStockBo); - }); - var fileName = data.getReceiptNumber() + "-调拨出库明细"; - ExcelUtils.export(response, fileName, ExcelUtils.getSheetData(exportData)); + var systemLanguage = userService.getUserSystemLanguage(userService.getCurrentUserId()); + if ("zh_CN".equals(systemLanguage)) { + var exportData = new ArrayList(); + tableData.forEach(item -> { + var allotStockBo = new AllotStockDataExportBO(); + allotStockBo.setReceiptNumber(data.getReceiptNumber()); + BeanUtils.copyProperties(item, allotStockBo); + exportData.add(allotStockBo); + }); + var fileName = data.getReceiptNumber() + "-调拨出库明细"; + ExcelUtils.export(response, fileName, ExcelUtils.getSheetData(exportData)); + } else { + var exportEnData = new ArrayList(); + tableData.forEach(item -> { + var allotStockEnBo = new AllotStockDataExportEnBO(); + allotStockEnBo.setReceiptNumber(data.getReceiptNumber()); + BeanUtils.copyProperties(item, allotStockEnBo); + exportEnData.add(allotStockEnBo); + }); + var fileName = data.getReceiptNumber() + "- Transfer Outbound Details"; + ExcelUtils.export(response, fileName, ExcelUtils.getSheetData(exportEnData)); + } } } } diff --git a/core/service/src/main/java/com/wansenai/service/warehouse/impl/AssembleReceiptServiceImpl.java b/core/service/src/main/java/com/wansenai/service/warehouse/impl/AssembleReceiptServiceImpl.java index c108b50b..90e4f5e1 100644 --- a/core/service/src/main/java/com/wansenai/service/warehouse/impl/AssembleReceiptServiceImpl.java +++ b/core/service/src/main/java/com/wansenai/service/warehouse/impl/AssembleReceiptServiceImpl.java @@ -16,8 +16,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.wansenai.bo.AssembleStockBO; -import com.wansenai.bo.AssembleStockDataExportBO; +import com.wansenai.bo.warehouse.AssembleStockDataExportBO; import com.wansenai.bo.FileDataBO; +import com.wansenai.bo.warehouse.AssembleReceiptExportBO; +import com.wansenai.bo.warehouse.AssembleReceiptExportEnBO; +import com.wansenai.bo.warehouse.AssembleStockDataExportEnBO; import com.wansenai.dto.warehouse.AssembleReceiptDTO; import com.wansenai.dto.warehouse.QueryAssembleReceiptDTO; import com.wansenai.entities.product.ProductStock; @@ -182,7 +185,7 @@ public Response> getAssembleReceiptPageList(QueryAssembl return Response.responseData(result); } - private List getAssembleReceiptList(QueryAssembleReceiptDTO queryAssembleReceiptDTO) { + private List getAssembleReceiptList(QueryAssembleReceiptDTO queryAssembleReceiptDTO) { var wrapperMainMapper = lambdaQuery() .eq(queryAssembleReceiptDTO.getOperatorId() != null, WarehouseReceiptMain::getCreateBy, queryAssembleReceiptDTO.getOperatorId()) .eq(queryAssembleReceiptDTO.getStatus() != null, WarehouseReceiptMain::getStatus, queryAssembleReceiptDTO.getStatus()) @@ -194,7 +197,7 @@ private List getAssembleReceiptList(QueryAssembleReceiptDTO q .eq(WarehouseReceiptMain::getDeleteFlag, CommonConstants.NOT_DELETED) .list(); - var assembleReceiptVOList = new ArrayList(wrapperMainMapper.size() + 1); + var assembleReceiptExportBOList = new ArrayList(wrapperMainMapper.size() + 1); wrapperMainMapper.forEach(item -> { var product = productService.getById(item.getProductId()); @@ -204,7 +207,7 @@ private List getAssembleReceiptList(QueryAssembleReceiptDTO q } var operator = userService.getById(item.getCreateBy()); - var assembleReceiptVO = AssembleReceiptVO.builder() + var assembleReceiptExportBO = AssembleReceiptExportBO.builder() .id(item.getId()) .receiptNumber(item.getReceiptNumber()) .productInfo(productInfo) @@ -215,13 +218,51 @@ private List getAssembleReceiptList(QueryAssembleReceiptDTO q .status(item.getStatus()) .build(); - assembleReceiptVOList.add(assembleReceiptVO); + assembleReceiptExportBOList.add(assembleReceiptExportBO); }); - return assembleReceiptVOList; + return assembleReceiptExportBOList; } + private List getAssembleReceiptEnList(QueryAssembleReceiptDTO queryAssembleReceiptDTO) { + var wrapperMainMapper = lambdaQuery() + .eq(queryAssembleReceiptDTO.getOperatorId() != null, WarehouseReceiptMain::getCreateBy, queryAssembleReceiptDTO.getOperatorId()) + .eq(queryAssembleReceiptDTO.getStatus() != null, WarehouseReceiptMain::getStatus, queryAssembleReceiptDTO.getStatus()) + .eq(StringUtils.hasLength(queryAssembleReceiptDTO.getReceiptNumber()), WarehouseReceiptMain::getReceiptNumber, queryAssembleReceiptDTO.getReceiptNumber()) + .like(StringUtils.hasLength(queryAssembleReceiptDTO.getRemark()), WarehouseReceiptMain::getRemark, queryAssembleReceiptDTO.getRemark()) + .ge(StringUtils.hasLength(queryAssembleReceiptDTO.getStartDate()), WarehouseReceiptMain::getCreateTime, queryAssembleReceiptDTO.getStartDate()) + .le(StringUtils.hasLength(queryAssembleReceiptDTO.getEndDate()), WarehouseReceiptMain::getCreateTime, queryAssembleReceiptDTO.getEndDate()) + .eq(WarehouseReceiptMain::getType, "组装单") + .eq(WarehouseReceiptMain::getDeleteFlag, CommonConstants.NOT_DELETED) + .list(); - @Override + var assembleReceiptExportEnBOList = new ArrayList(wrapperMainMapper.size() + 1); + wrapperMainMapper.forEach(item -> { + + var product = productService.getById(item.getProductId()); + var productInfo = ""; + if(product != null) { + productInfo = product.getProductName() + "|" + product.getProductStandard() + "|" + product.getProductModel() + "|" + product.getProductUnit(); + } + + var operator = userService.getById(item.getCreateBy()); + var assembleReceiptExportEnBO = AssembleReceiptExportEnBO.builder() + .id(item.getId()) + .receiptNumber(item.getReceiptNumber()) + .productInfo(productInfo) + .receiptDate(item.getReceiptDate()) + .operator(Optional.ofNullable(operator).map(SysUser::getName).orElse("")) + .productNumber(item.getTotalProductNumber()) + .totalAmount(item.getTotalAmount()) + .status(item.getStatus()) + .build(); + + assembleReceiptExportEnBOList.add(assembleReceiptExportEnBO); + }); + return assembleReceiptExportEnBOList; + } + + + @Override public Response getAssembleReceiptDetail(Long id) { if (id == null) { return Response.responseMsg(BaseCodeEnum.PARAMETER_NULL); @@ -280,6 +321,7 @@ public Response getAssembleReceiptDetail(Long id) { @Transactional public Response addOrUpdateAssembleReceipt(AssembleReceiptDTO assembleReceiptDTO) { var userId = userService.getCurrentUserId(); + var systemLanguage = userService.getUserSystemLanguage(userId); var fid = processFiles(assembleReceiptDTO.getFiles(), assembleReceiptDTO.getId()); var fileIds = StringUtils.collectionToCommaDelimitedString(fid); var isUpdate = assembleReceiptDTO.getId() != null; @@ -373,10 +415,16 @@ public Response addOrUpdateAssembleReceipt(AssembleReceiptDTO assembleRe } if (updateSubResult && warehouseReceiptMain) { - return Response.responseMsg(AssembleReceiptCodeEnum.UPDATE_ASSEMBLE_RECEIPT_SUCCESS); + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(AssembleReceiptCodeEnum.UPDATE_ASSEMBLE_RECEIPT_SUCCESS); + } + return Response.responseMsg(AssembleReceiptCodeEnum.UPDATE_ASSEMBLE_RECEIPT_SUCCESS_EN); + } else { + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(AssembleReceiptCodeEnum.UPDATE_ASSEMBLE_RECEIPT_ERROR); + } + return Response.responseMsg(AssembleReceiptCodeEnum.UPDATE_ASSEMBLE_RECEIPT_ERROR_EN); } - return Response.responseMsg(AssembleReceiptCodeEnum.UPDATE_ASSEMBLE_RECEIPT_ERROR); - } else { var receiptMainId = SnowflakeIdUtil.nextId(); var mainStockList = assembleReceiptDTO.getTableData(); @@ -430,9 +478,16 @@ public Response addOrUpdateAssembleReceipt(AssembleReceiptDTO assembleRe updateProductStock(subStocks, 2); } if (saveSubResult && saveMainResult) { - return Response.responseMsg(AssembleReceiptCodeEnum.ADD_ASSEMBLE_RECEIPT_SUCCESS); + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(AssembleReceiptCodeEnum.ADD_ASSEMBLE_RECEIPT_SUCCESS); + } + return Response.responseMsg(AssembleReceiptCodeEnum.ADD_ASSEMBLE_RECEIPT_SUCCESS_EN); + } else { + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(AssembleReceiptCodeEnum.ADD_ASSEMBLE_RECEIPT_ERROR); + } + return Response.responseMsg(AssembleReceiptCodeEnum.ADD_ASSEMBLE_RECEIPT_ERROR_EN); } - return Response.responseMsg(AssembleReceiptCodeEnum.ADD_ASSEMBLE_RECEIPT_ERROR); } } @@ -450,11 +505,19 @@ public Response deleteBatchAssembleReceipt(List ids) { .set(WarehouseReceiptSub::getDeleteFlag, CommonConstants.DELETED) .in(WarehouseReceiptSub::getWarehouseReceiptMainId, ids) .update(); + var systemLanguage = userService.getUserSystemLanguage(userService.getCurrentUserId()); if(!deleteResult) { - return Response.responseMsg(AssembleReceiptCodeEnum.DELETE_ASSEMBLE_RECEIPT_ERROR); + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(AssembleReceiptCodeEnum.DELETE_ASSEMBLE_RECEIPT_ERROR); + } + return Response.responseMsg(AssembleReceiptCodeEnum.DELETE_ASSEMBLE_RECEIPT_ERROR_EN); + } else { + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(AssembleReceiptCodeEnum.DELETE_ASSEMBLE_RECEIPT_SUCCESS); + } + return Response.responseMsg(AssembleReceiptCodeEnum.DELETE_ASSEMBLE_RECEIPT_SUCCESS_EN); } - return Response.responseMsg(AssembleReceiptCodeEnum.DELETE_ASSEMBLE_RECEIPT_SUCCESS); } @Override @@ -466,47 +529,92 @@ public Response updateAssembleReceiptStatus(List ids, Integer stat .set(WarehouseReceiptMain::getStatus, status) .in(WarehouseReceiptMain::getId, ids) .update(); + var systemLanguage = userService.getUserSystemLanguage(userService.getCurrentUserId()); if(!updateResult) { - return Response.responseMsg(AssembleReceiptCodeEnum.UPDATE_ASSEMBLE_RECEIPT_ERROR); + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(AssembleReceiptCodeEnum.UPDATE_ASSEMBLE_RECEIPT_ERROR); + } + return Response.responseMsg(AssembleReceiptCodeEnum.UPDATE_ASSEMBLE_RECEIPT_ERROR_EN); + } else { + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(AssembleReceiptCodeEnum.UPDATE_ASSEMBLE_RECEIPT_SUCCESS); + } + return Response.responseMsg(AssembleReceiptCodeEnum.UPDATE_ASSEMBLE_RECEIPT_SUCCESS_EN); } - return Response.responseMsg(AssembleReceiptCodeEnum.UPDATE_ASSEMBLE_RECEIPT_SUCCESS); } @Override public void exportAssembleReceipt(QueryAssembleReceiptDTO queryAssembleReceiptDTO, HttpServletResponse response) { var exportMap = new ConcurrentHashMap>>(); - var mainData = getAssembleReceiptList(queryAssembleReceiptDTO); - if (!mainData.isEmpty()) { - exportMap.put("组装单", ExcelUtils.getSheetData(mainData)); - if (queryAssembleReceiptDTO.getIsExportDetail()) { - var subData = new ArrayList(); - for (AssembleReceiptVO assembleReceiptVO : mainData) { - var detail = getAssembleReceiptDetail(assembleReceiptVO.getId()).getData().getTableData(); - if(!detail.isEmpty()) { - detail.forEach(item -> { - var assembleStockBO = AssembleStockDataExportBO.builder() - .receiptNumber(assembleReceiptVO.getReceiptNumber()) - .type(item.getType()) - .warehouseName(item.getWarehouseName()) - .barCode(item.getBarCode()) - .productName(item.getProductName()) - .productUnit(item.getProductUnit()) - .productStandard(item.getProductStandard()) - .productModel(item.getProductModel()) - .stock(item.getStock()) - .type(item.getType()) - .unitPrice(item.getUnitPrice()) - .amount(item.getAmount()) - .productNumber(item.getProductNumber()) - .remark(item.getRemark()) - .build(); - subData.add(assembleStockBO); - }); + var systemLanguage = userService.getUserSystemLanguage(userService.getCurrentUserId()); + if ("zh_CN".equals(systemLanguage)) { + var mainData = getAssembleReceiptList(queryAssembleReceiptDTO); + if (!mainData.isEmpty()) { + exportMap.put("组装单", ExcelUtils.getSheetData(mainData)); + if (queryAssembleReceiptDTO.getIsExportDetail()) { + var subData = new ArrayList(); + for (AssembleReceiptExportBO assembleReceiptExportBO : mainData) { + var detail = getAssembleReceiptDetail(assembleReceiptExportBO.getId()).getData().getTableData(); + if(!detail.isEmpty()) { + detail.forEach(item -> { + var assembleStockBO = AssembleStockDataExportBO.builder() + .receiptNumber(assembleReceiptExportBO.getReceiptNumber()) + .type(item.getType()) + .warehouseName(item.getWarehouseName()) + .barCode(item.getBarCode()) + .productName(item.getProductName()) + .productUnit(item.getProductUnit()) + .productStandard(item.getProductStandard()) + .productModel(item.getProductModel()) + .stock(item.getStock()) + .type(item.getType()) + .unitPrice(item.getUnitPrice()) + .amount(item.getAmount()) + .productNumber(item.getProductNumber()) + .remark(item.getRemark()) + .build(); + subData.add(assembleStockBO); + }); + } + } + exportMap.put("组装单明细", ExcelUtils.getSheetData(subData)); + } + ExcelUtils.exportManySheet(response, "组装单", exportMap); + } + } else { + var mainEnData = getAssembleReceiptEnList(queryAssembleReceiptDTO); + if (!mainEnData.isEmpty()) { + exportMap.put("Assembly Documents", ExcelUtils.getSheetData(mainEnData)); + if (queryAssembleReceiptDTO.getIsExportDetail()) { + var subEnData = new ArrayList(); + for (AssembleReceiptExportEnBO assembleReceiptExportEnBO : mainEnData) { + var detail = getAssembleReceiptDetail(assembleReceiptExportEnBO.getId()).getData().getTableData(); + if(!detail.isEmpty()) { + detail.forEach(item -> { + var assembleStockEnBO = AssembleStockDataExportEnBO.builder() + .receiptNumber(assembleReceiptExportEnBO.getReceiptNumber()) + .type(item.getType()) + .warehouseName(item.getWarehouseName()) + .barCode(item.getBarCode()) + .productName(item.getProductName()) + .productUnit(item.getProductUnit()) + .productStandard(item.getProductStandard()) + .productModel(item.getProductModel()) + .stock(item.getStock()) + .type(item.getType()) + .unitPrice(item.getUnitPrice()) + .amount(item.getAmount()) + .productNumber(item.getProductNumber()) + .remark(item.getRemark()) + .build(); + subEnData.add(assembleStockEnBO); + }); + } } + exportMap.put("Assembly Document Details", ExcelUtils.getSheetData(subEnData)); } - exportMap.put("组装单明细", ExcelUtils.getSheetData(subData)); + ExcelUtils.exportManySheet(response, "Assembly Documents", exportMap); } - ExcelUtils.exportManySheet(response, "组装单", exportMap); } } @@ -522,15 +630,28 @@ public void exportAssembleReceiptDetail(String receiptNumber, HttpServletRespons if (detail != null) { var data = detail.getData(); var tableData = data.getTableData(); - var exportData = new ArrayList(); - tableData.forEach(item -> { - var assembleStockBO = new AssembleStockDataExportBO(); - assembleStockBO.setReceiptNumber(data.getReceiptNumber()); - BeanUtils.copyProperties(item, assembleStockBO); - exportData.add(assembleStockBO); - }); - var fileName = data.getReceiptNumber() + "-组装单明细"; - ExcelUtils.export(response, fileName, ExcelUtils.getSheetData(exportData)); + var systemLanguage = userService.getUserSystemLanguage(userService.getCurrentUserId()); + if ("zh_CN".equals(systemLanguage)) { + var exportData = new ArrayList(); + tableData.forEach(item -> { + var assembleStockBO = new AssembleStockDataExportBO(); + assembleStockBO.setReceiptNumber(data.getReceiptNumber()); + BeanUtils.copyProperties(item, assembleStockBO); + exportData.add(assembleStockBO); + }); + var fileName = data.getReceiptNumber() + "-组装单明细"; + ExcelUtils.export(response, fileName, ExcelUtils.getSheetData(exportData)); + } else { + var exportEnData = new ArrayList(); + tableData.forEach(item -> { + var assembleStockEnBO = new AssembleStockDataExportEnBO(); + assembleStockEnBO.setReceiptNumber(data.getReceiptNumber()); + BeanUtils.copyProperties(item, assembleStockEnBO); + exportEnData.add(assembleStockEnBO); + }); + var fileName = data.getReceiptNumber() + "- Assembly Document Details"; + ExcelUtils.export(response, fileName, ExcelUtils.getSheetData(exportEnData)); + } } } } diff --git a/core/service/src/main/java/com/wansenai/service/warehouse/impl/DisassembleReceiptServiceImpl.java b/core/service/src/main/java/com/wansenai/service/warehouse/impl/DisassembleReceiptServiceImpl.java index f41ed6a6..449a32ef 100644 --- a/core/service/src/main/java/com/wansenai/service/warehouse/impl/DisassembleReceiptServiceImpl.java +++ b/core/service/src/main/java/com/wansenai/service/warehouse/impl/DisassembleReceiptServiceImpl.java @@ -16,8 +16,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.wansenai.bo.AssembleStockBO; -import com.wansenai.bo.AssembleStockDataExportBO; +import com.wansenai.bo.warehouse.AssembleStockDataExportBO; import com.wansenai.bo.FileDataBO; +import com.wansenai.bo.warehouse.AssembleStockDataExportEnBO; +import com.wansenai.bo.warehouse.DisassembleReceiptExportBO; +import com.wansenai.bo.warehouse.DisassembleReceiptExportEnBO; import com.wansenai.dto.warehouse.DisassembleReceiptDTO; import com.wansenai.dto.warehouse.QueryDisassembleReceiptDTO; import com.wansenai.entities.product.ProductStock; @@ -36,13 +39,10 @@ import com.wansenai.utils.SnowflakeIdUtil; import com.wansenai.utils.TimeUtil; import com.wansenai.utils.constants.CommonConstants; -import com.wansenai.utils.enums.AssembleReceiptCodeEnum; import com.wansenai.utils.enums.BaseCodeEnum; import com.wansenai.utils.enums.DisassembleReceiptCodeEnum; import com.wansenai.utils.excel.ExcelUtils; import com.wansenai.utils.response.Response; -import com.wansenai.vo.warehouse.AssembleReceiptDetailVO; -import com.wansenai.vo.warehouse.AssembleReceiptVO; import com.wansenai.vo.warehouse.DisassembleReceiptDetailVO; import com.wansenai.vo.warehouse.DisassembleReceiptVO; import jakarta.servlet.http.HttpServletResponse; @@ -186,7 +186,7 @@ public Response> getDisassembleReceiptPageList(QueryD return Response.responseData(result); } - public List getDisassembleReceiptList(QueryDisassembleReceiptDTO queryDisassembleReceiptDTO) { + private List getDisassembleReceiptList(QueryDisassembleReceiptDTO queryDisassembleReceiptDTO) { var wrapperMainMapper = lambdaQuery() .eq(queryDisassembleReceiptDTO.getOperatorId() != null, WarehouseReceiptMain::getCreateBy, queryDisassembleReceiptDTO.getOperatorId()) .eq(queryDisassembleReceiptDTO.getStatus() != null, WarehouseReceiptMain::getStatus, queryDisassembleReceiptDTO.getStatus()) @@ -198,7 +198,7 @@ public List getDisassembleReceiptList(QueryDisassembleRece .eq(WarehouseReceiptMain::getDeleteFlag, CommonConstants.NOT_DELETED) .list(); - var disAssembleReceiptVOList = new ArrayList(wrapperMainMapper.size() + 1); + var disassembleReceiptExportBOList = new ArrayList(wrapperMainMapper.size() + 1); wrapperMainMapper.forEach(item -> { var product = productService.getById(item.getProductId()); @@ -208,7 +208,7 @@ public List getDisassembleReceiptList(QueryDisassembleRece } var operator = userService.getById(item.getCreateBy()); - var disAssembleReceiptVO = DisassembleReceiptVO.builder() + var disassembleReceiptExportBO = DisassembleReceiptExportBO.builder() .id(item.getId()) .receiptNumber(item.getReceiptNumber()) .productInfo(productInfo) @@ -219,9 +219,47 @@ public List getDisassembleReceiptList(QueryDisassembleRece .status(item.getStatus()) .build(); - disAssembleReceiptVOList.add(disAssembleReceiptVO); + disassembleReceiptExportBOList.add(disassembleReceiptExportBO); }); - return disAssembleReceiptVOList; + return disassembleReceiptExportBOList; + } + + private List getDisassembleReceiptEnList(QueryDisassembleReceiptDTO queryDisassembleReceiptDTO) { + var wrapperMainMapper = lambdaQuery() + .eq(queryDisassembleReceiptDTO.getOperatorId() != null, WarehouseReceiptMain::getCreateBy, queryDisassembleReceiptDTO.getOperatorId()) + .eq(queryDisassembleReceiptDTO.getStatus() != null, WarehouseReceiptMain::getStatus, queryDisassembleReceiptDTO.getStatus()) + .eq(StringUtils.hasLength(queryDisassembleReceiptDTO.getReceiptNumber()), WarehouseReceiptMain::getReceiptNumber, queryDisassembleReceiptDTO.getReceiptNumber()) + .like(StringUtils.hasLength(queryDisassembleReceiptDTO.getRemark()), WarehouseReceiptMain::getRemark, queryDisassembleReceiptDTO.getRemark()) + .ge(StringUtils.hasLength(queryDisassembleReceiptDTO.getStartDate()), WarehouseReceiptMain::getCreateTime, queryDisassembleReceiptDTO.getStartDate()) + .le(StringUtils.hasLength(queryDisassembleReceiptDTO.getEndDate()), WarehouseReceiptMain::getCreateTime, queryDisassembleReceiptDTO.getEndDate()) + .eq(WarehouseReceiptMain::getType, "拆卸单") + .eq(WarehouseReceiptMain::getDeleteFlag, CommonConstants.NOT_DELETED) + .list(); + + var disassembleReceiptExportEnBOList = new ArrayList(wrapperMainMapper.size() + 1); + wrapperMainMapper.forEach(item -> { + + var product = productService.getById(item.getProductId()); + var productInfo = ""; + if (product != null) { + productInfo = product.getProductName() + "|" + product.getProductStandard() + "|" + product.getProductModel() + "|" + product.getProductUnit(); + } + + var operator = userService.getById(item.getCreateBy()); + var disassembleReceiptExportEnBO = DisassembleReceiptExportEnBO.builder() + .id(item.getId()) + .receiptNumber(item.getReceiptNumber()) + .productInfo(productInfo) + .receiptDate(item.getReceiptDate()) + .operator(Optional.ofNullable(operator).map(SysUser::getName).orElse("")) + .productNumber(item.getTotalProductNumber()) + .totalAmount(item.getTotalAmount()) + .status(item.getStatus()) + .build(); + + disassembleReceiptExportEnBOList.add(disassembleReceiptExportEnBO); + }); + return disassembleReceiptExportEnBOList; } @Override @@ -283,6 +321,7 @@ public Response getDisassembleReceiptDetail(Long id) @Transactional public Response addOrUpdateDisassembleReceipt(DisassembleReceiptDTO disassembleReceiptDTO) { var userId = userService.getCurrentUserId(); + var systemLanguage = userService.getUserSystemLanguage(userId); var fid = processFiles(disassembleReceiptDTO.getFiles(), disassembleReceiptDTO.getId()); var fileIds = StringUtils.collectionToCommaDelimitedString(fid); var isUpdate = disassembleReceiptDTO.getId() != null; @@ -377,10 +416,16 @@ public Response addOrUpdateDisassembleReceipt(DisassembleReceiptDTO disa } if (updateSubResult && warehouseReceiptMain) { - return Response.responseMsg(DisassembleReceiptCodeEnum.UPDATE_DISASSEMBLE_RECEIPT_SUCCESS); + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(DisassembleReceiptCodeEnum.UPDATE_DISASSEMBLE_RECEIPT_SUCCESS); + } + return Response.responseMsg(DisassembleReceiptCodeEnum.UPDATE_DISASSEMBLE_RECEIPT_SUCCESS_EN); + } else { + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(DisassembleReceiptCodeEnum.UPDATE_DISASSEMBLE_RECEIPT_ERROR); + } + return Response.responseMsg(DisassembleReceiptCodeEnum.UPDATE_DISASSEMBLE_RECEIPT_ERROR_EN); } - return Response.responseMsg(DisassembleReceiptCodeEnum.UPDATE_DISASSEMBLE_RECEIPT_ERROR); - } else { var receiptMainId = SnowflakeIdUtil.nextId(); var mainStockList = disassembleReceiptDTO.getTableData(); @@ -434,9 +479,16 @@ public Response addOrUpdateDisassembleReceipt(DisassembleReceiptDTO disa updateProductStock(subStocks, 1); } if (saveSubResult && saveMainResult) { - return Response.responseMsg(DisassembleReceiptCodeEnum.ADD_DISASSEMBLE_RECEIPT_SUCCESS); + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(DisassembleReceiptCodeEnum.ADD_DISASSEMBLE_RECEIPT_SUCCESS); + } + return Response.responseMsg(DisassembleReceiptCodeEnum.ADD_DISASSEMBLE_RECEIPT_SUCCESS_EN); + } else { + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(DisassembleReceiptCodeEnum.ADD_DISASSEMBLE_RECEIPT_ERROR); + } + return Response.responseMsg(DisassembleReceiptCodeEnum.ADD_DISASSEMBLE_RECEIPT_ERROR_EN); } - return Response.responseMsg(DisassembleReceiptCodeEnum.ADD_DISASSEMBLE_RECEIPT_ERROR); } } @@ -454,11 +506,19 @@ public Response deleteBatchDisassembleReceipt(List ids) { .set(WarehouseReceiptSub::getDeleteFlag, CommonConstants.DELETED) .in(WarehouseReceiptSub::getWarehouseReceiptMainId, ids) .update(); + var systemLanguage = userService.getUserSystemLanguage(userService.getCurrentUserId()); if (!deleteResult) { - return Response.responseMsg(DisassembleReceiptCodeEnum.DELETE_DISASSEMBLE_RECEIPT_ERROR); + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(DisassembleReceiptCodeEnum.DELETE_DISASSEMBLE_RECEIPT_ERROR); + } + return Response.responseMsg(DisassembleReceiptCodeEnum.DELETE_DISASSEMBLE_RECEIPT_ERROR_EN); + } else { + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(DisassembleReceiptCodeEnum.DELETE_DISASSEMBLE_RECEIPT_SUCCESS); + } + return Response.responseMsg(DisassembleReceiptCodeEnum.DELETE_DISASSEMBLE_RECEIPT_SUCCESS_EN); } - return Response.responseMsg(DisassembleReceiptCodeEnum.DELETE_DISASSEMBLE_RECEIPT_SUCCESS); } @Override @@ -470,46 +530,91 @@ public Response updateDisassembleReceiptStatus(List ids, Integer s .set(WarehouseReceiptMain::getStatus, status) .in(WarehouseReceiptMain::getId, ids) .update(); + + var systemLanguage = userService.getUserSystemLanguage(userService.getCurrentUserId()); if (!updateResult) { - return Response.responseMsg(DisassembleReceiptCodeEnum.UPDATE_DISASSEMBLE_RECEIPT_ERROR); + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(DisassembleReceiptCodeEnum.UPDATE_DISASSEMBLE_RECEIPT_ERROR); + } + return Response.responseMsg(DisassembleReceiptCodeEnum.UPDATE_DISASSEMBLE_RECEIPT_ERROR_EN); + } else { + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(DisassembleReceiptCodeEnum.UPDATE_DISASSEMBLE_RECEIPT_SUCCESS); + } + return Response.responseMsg(DisassembleReceiptCodeEnum.UPDATE_DISASSEMBLE_RECEIPT_SUCCESS_EN); } - return Response.responseMsg(DisassembleReceiptCodeEnum.UPDATE_DISASSEMBLE_RECEIPT_SUCCESS); } @Override public void exportDisAssembleReceipt(QueryDisassembleReceiptDTO queryDisassembleReceiptDTO, HttpServletResponse response) { var exportMap = new ConcurrentHashMap>>(); - var mainData = getDisassembleReceiptList(queryDisassembleReceiptDTO); - if (!mainData.isEmpty()) { - exportMap.put("拆卸单", ExcelUtils.getSheetData(mainData)); - if (queryDisassembleReceiptDTO.getIsExportDetail()) { - var subData = new ArrayList(); - for (DisassembleReceiptVO disassembleReceiptVO : mainData) { - var detail = getDisassembleReceiptDetail(disassembleReceiptVO.getId()).getData().getTableData(); - if(!detail.isEmpty()) { - detail.forEach(item -> { - var assembleStockBO = AssembleStockDataExportBO.builder() - .receiptNumber(disassembleReceiptVO.getReceiptNumber()) - .type(item.getType()) - .warehouseName(item.getWarehouseName()) - .barCode(item.getBarCode()) - .productName(item.getProductName()) - .productModel(item.getProductModel()) - .productUnit(item.getProductUnit()) - .productStandard(item.getProductStandard()) - .stock(item.getStock()) - .productNumber(item.getProductNumber()) - .unitPrice(item.getUnitPrice()) - .amount(item.getAmount()) - .remark(item.getRemark()) - .build(); - subData.add(assembleStockBO); - }); + var systemLanguage = userService.getUserSystemLanguage(userService.getCurrentUserId()); + if ("zh_CN".equals(systemLanguage)) { + var mainData = getDisassembleReceiptList(queryDisassembleReceiptDTO); + if (!mainData.isEmpty()) { + exportMap.put("拆卸单", ExcelUtils.getSheetData(mainData)); + if (queryDisassembleReceiptDTO.getIsExportDetail()) { + var subData = new ArrayList(); + for (DisassembleReceiptExportBO disassembleReceiptExportBO : mainData) { + var detail = getDisassembleReceiptDetail(disassembleReceiptExportBO.getId()).getData().getTableData(); + if(!detail.isEmpty()) { + detail.forEach(item -> { + var assembleStockBO = AssembleStockDataExportBO.builder() + .receiptNumber(disassembleReceiptExportBO.getReceiptNumber()) + .type(item.getType()) + .warehouseName(item.getWarehouseName()) + .barCode(item.getBarCode()) + .productName(item.getProductName()) + .productModel(item.getProductModel()) + .productUnit(item.getProductUnit()) + .productStandard(item.getProductStandard()) + .stock(item.getStock()) + .productNumber(item.getProductNumber()) + .unitPrice(item.getUnitPrice()) + .amount(item.getAmount()) + .remark(item.getRemark()) + .build(); + subData.add(assembleStockBO); + }); + } + } + exportMap.put("拆卸单明细", ExcelUtils.getSheetData(subData)); + } + ExcelUtils.exportManySheet(response, "拆卸单", exportMap); + } + } else { + var mainEnData = getDisassembleReceiptEnList(queryDisassembleReceiptDTO); + if (!mainEnData.isEmpty()) { + exportMap.put("Disassembly Documents", ExcelUtils.getSheetData(mainEnData)); + if (queryDisassembleReceiptDTO.getIsExportDetail()) { + var subEnData = new ArrayList(); + for (DisassembleReceiptExportEnBO disassembleReceiptExportEnBO : mainEnData) { + var detail = getDisassembleReceiptDetail(disassembleReceiptExportEnBO.getId()).getData().getTableData(); + if(!detail.isEmpty()) { + detail.forEach(item -> { + var assembleStockEnBO = AssembleStockDataExportEnBO.builder() + .receiptNumber(disassembleReceiptExportEnBO.getReceiptNumber()) + .type(item.getType()) + .warehouseName(item.getWarehouseName()) + .barCode(item.getBarCode()) + .productName(item.getProductName()) + .productModel(item.getProductModel()) + .productUnit(item.getProductUnit()) + .productStandard(item.getProductStandard()) + .stock(item.getStock()) + .productNumber(item.getProductNumber()) + .unitPrice(item.getUnitPrice()) + .amount(item.getAmount()) + .remark(item.getRemark()) + .build(); + subEnData.add(assembleStockEnBO); + }); + } } + exportMap.put("Disassembly Document Details", ExcelUtils.getSheetData(subEnData)); } - exportMap.put("拆卸单明细", ExcelUtils.getSheetData(subData)); + ExcelUtils.exportManySheet(response, "Disassembly Documents", exportMap); } - ExcelUtils.exportManySheet(response, "拆卸单", exportMap); } } @@ -525,15 +630,28 @@ public void exportDisAssembleReceiptDetail(String receiptNumber, HttpServletResp if (detail != null) { var data = detail.getData(); var tableData = data.getTableData(); - var exportData = new ArrayList(); - tableData.forEach(item -> { - var assembleStockBO = new AssembleStockDataExportBO(); - assembleStockBO.setReceiptNumber(data.getReceiptNumber()); - BeanUtils.copyProperties(item, assembleStockBO); - exportData.add(assembleStockBO); - }); - var fileName = data.getReceiptNumber() + "-拆卸单明细"; - ExcelUtils.export(response, fileName, ExcelUtils.getSheetData(exportData)); + var systemLanguage = userService.getUserSystemLanguage(userService.getCurrentUserId()); + if ("zh_CN".equals(systemLanguage)) { + var exportData = new ArrayList(); + tableData.forEach(item -> { + var assembleStockBO = new AssembleStockDataExportBO(); + assembleStockBO.setReceiptNumber(data.getReceiptNumber()); + BeanUtils.copyProperties(item, assembleStockBO); + exportData.add(assembleStockBO); + }); + var fileName = data.getReceiptNumber() + "-拆卸单明细"; + ExcelUtils.export(response, fileName, ExcelUtils.getSheetData(exportData)); + } else { + var exportEnData = new ArrayList(); + tableData.forEach(item -> { + var assembleStockEnBO = new AssembleStockDataExportEnBO(); + assembleStockEnBO.setReceiptNumber(data.getReceiptNumber()); + BeanUtils.copyProperties(item, assembleStockEnBO); + exportEnData.add(assembleStockEnBO); + }); + var fileName = data.getReceiptNumber() + "- Disassembly Document Details"; + ExcelUtils.export(response, fileName, ExcelUtils.getSheetData(exportEnData)); + } } } } diff --git a/core/service/src/main/java/com/wansenai/service/warehouse/impl/OtherShipmentsServiceImpl.java b/core/service/src/main/java/com/wansenai/service/warehouse/impl/OtherShipmentsServiceImpl.java index eeb66b3f..f202292d 100644 --- a/core/service/src/main/java/com/wansenai/service/warehouse/impl/OtherShipmentsServiceImpl.java +++ b/core/service/src/main/java/com/wansenai/service/warehouse/impl/OtherShipmentsServiceImpl.java @@ -15,9 +15,11 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.wansenai.bo.FileDataBO; -import com.wansenai.bo.StorageShipmentStockBO; -import com.wansenai.bo.StorageShipmentStockExportBO; +import com.wansenai.bo.*; +import com.wansenai.bo.warehouse.OtherShipmentExportBO; +import com.wansenai.bo.warehouse.OtherShipmentExportEnBO; +import com.wansenai.bo.warehouse.StorageShipmentStockExportBO; +import com.wansenai.bo.warehouse.StorageShipmentStockExportEnBO; import com.wansenai.dto.warehouse.OtherShipmentDTO; import com.wansenai.dto.warehouse.QueryOtherShipmentDTO; import com.wansenai.entities.product.ProductStock; @@ -184,7 +186,7 @@ public Response> getOtherShipmentsPageList(QueryOtherShipm return Response.responseData(result); } - private List getOtherShipmentsList(QueryOtherShipmentDTO queryOtherShipmentDTO) { + private List getOtherShipmentsList(QueryOtherShipmentDTO queryOtherShipmentDTO) { var wrapperMainMapper = lambdaQuery() .eq(queryOtherShipmentDTO.getCustomerId() != null, WarehouseReceiptMain::getRelatedPersonId, queryOtherShipmentDTO.getCustomerId()) .eq(queryOtherShipmentDTO.getOperatorId() != null, WarehouseReceiptMain::getCreateBy, queryOtherShipmentDTO.getOperatorId()) @@ -198,7 +200,7 @@ private List getOtherShipmentsList(QueryOtherShipmentDTO queryO .eq(WarehouseReceiptMain::getDeleteFlag, CommonConstants.NOT_DELETED) .list(); - var otherShipmentVOList = new ArrayList(wrapperMainMapper.size() + 1); + var otherShipmentExportBOList = new ArrayList(wrapperMainMapper.size() + 1); wrapperMainMapper.forEach(item -> { var product = productService.getById(item.getProductId()); @@ -208,7 +210,7 @@ private List getOtherShipmentsList(QueryOtherShipmentDTO queryO } var operator = userService.getById(item.getCreateBy()); - var otherShipmentVO = OtherShipmentVO.builder() + var otherShipmentExportBO = OtherShipmentExportBO.builder() .id(item.getId()) .receiptNumber(item.getReceiptNumber()) .productInfo(productInfo) @@ -220,9 +222,50 @@ private List getOtherShipmentsList(QueryOtherShipmentDTO queryO .status(item.getStatus()) .build(); - otherShipmentVOList.add(otherShipmentVO); + otherShipmentExportBOList.add(otherShipmentExportBO); + }); + return otherShipmentExportBOList; + } + + private List getOtherShipmentsEnList(QueryOtherShipmentDTO queryOtherShipmentDTO) { + var wrapperMainMapper = lambdaQuery() + .eq(queryOtherShipmentDTO.getCustomerId() != null, WarehouseReceiptMain::getRelatedPersonId, queryOtherShipmentDTO.getCustomerId()) + .eq(queryOtherShipmentDTO.getOperatorId() != null, WarehouseReceiptMain::getCreateBy, queryOtherShipmentDTO.getOperatorId()) + .eq(queryOtherShipmentDTO.getStatus() != null, WarehouseReceiptMain::getStatus, queryOtherShipmentDTO.getStatus()) + .eq(StringUtils.hasLength(queryOtherShipmentDTO.getReceiptNumber()), WarehouseReceiptMain::getReceiptNumber, queryOtherShipmentDTO.getReceiptNumber()) + .eq(StringUtils.hasLength(queryOtherShipmentDTO.getOtherReceipt()), WarehouseReceiptMain::getReceiptNumber, queryOtherShipmentDTO.getOtherReceipt()) + .like(StringUtils.hasLength(queryOtherShipmentDTO.getRemark()), WarehouseReceiptMain::getRemark, queryOtherShipmentDTO.getRemark()) + .ge(StringUtils.hasLength(queryOtherShipmentDTO.getStartDate()), WarehouseReceiptMain::getCreateTime, queryOtherShipmentDTO.getStartDate()) + .le(StringUtils.hasLength(queryOtherShipmentDTO.getEndDate()), WarehouseReceiptMain::getCreateTime, queryOtherShipmentDTO.getEndDate()) + .eq(WarehouseReceiptMain::getType, "其他出库") + .eq(WarehouseReceiptMain::getDeleteFlag, CommonConstants.NOT_DELETED) + .list(); + + var otherShipmentExportBOEnList = new ArrayList(wrapperMainMapper.size() + 1); + wrapperMainMapper.forEach(item -> { + + var product = productService.getById(item.getProductId()); + var productInfo = ""; + if(product != null) { + productInfo = product.getProductName() + "|" + product.getProductStandard() + "|" + product.getProductModel() + "|" + product.getProductUnit(); + } + + var operator = userService.getById(item.getCreateBy()); + var otherShipmentExportEnBO = OtherShipmentExportEnBO.builder() + .id(item.getId()) + .receiptNumber(item.getReceiptNumber()) + .productInfo(productInfo) + .customerName(commonService.getCustomerName(item.getRelatedPersonId())) + .receiptDate(item.getReceiptDate()) + .operator(Optional.ofNullable(operator).map(SysUser::getName).orElse("")) + .productNumber(item.getTotalProductNumber()) + .totalAmount(item.getTotalAmount()) + .status(item.getStatus()) + .build(); + + otherShipmentExportBOEnList.add(otherShipmentExportEnBO); }); - return otherShipmentVOList; + return otherShipmentExportBOEnList; } @Override @@ -285,6 +328,7 @@ public Response getOtherShipmentsDetail(Long id) { @Override public Response addOrUpdateOtherShipments(OtherShipmentDTO otherShipmentsDTO) { var userId = userService.getCurrentUserId(); + var systemLanguage = userService.getUserSystemLanguage(userId); var fid = processFiles(otherShipmentsDTO.getFiles(), otherShipmentsDTO.getId()); var fileIds = StringUtils.collectionToCommaDelimitedString(fid); var isUpdate = otherShipmentsDTO.getId() != null; @@ -345,9 +389,16 @@ public Response addOrUpdateOtherShipments(OtherShipmentDTO otherShipment updateProductStock(shipmentStock, 2); if (updateSubResult && warehouseReceiptMain) { - return Response.responseMsg(OtherShipmentCodeEnum.UPDATE_OTHER_SHIPMENT_STOCK_SUCCESS); + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(OtherShipmentCodeEnum.UPDATE_OTHER_SHIPMENT_STOCK_SUCCESS); + } + return Response.responseMsg(OtherShipmentCodeEnum.UPDATE_OTHER_SHIPMENT_STOCK_SUCCESS_EN); + } else { + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(OtherShipmentCodeEnum.UPDATE_OTHER_SHIPMENT_STOCK_ERROR); + } + return Response.responseMsg(OtherShipmentCodeEnum.UPDATE_OTHER_SHIPMENT_STOCK_ERROR_EN); } - return Response.responseMsg(OtherShipmentCodeEnum.UPDATE_OTHER_SHIPMENT_STOCK_ERROR); } else { var receiptMainId = SnowflakeIdUtil.nextId(); @@ -388,14 +439,22 @@ public Response addOrUpdateOtherShipments(OtherShipmentDTO otherShipment var saveMainResult = save(warehouseReceiptMain); updateProductStock(shipmentStock, 2); if (saveSubResult && saveMainResult) { - return Response.responseMsg(OtherShipmentCodeEnum.ADD_OTHER_SHIPMENT_STOCK_SUCCESS); + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(OtherShipmentCodeEnum.ADD_OTHER_SHIPMENT_STOCK_SUCCESS); + } + return Response.responseMsg(OtherShipmentCodeEnum.ADD_OTHER_SHIPMENT_STOCK_SUCCESS_EN); + } else { + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(OtherShipmentCodeEnum.ADD_OTHER_SHIPMENT_STOCK_ERROR); + } + return Response.responseMsg(OtherShipmentCodeEnum.ADD_OTHER_SHIPMENT_STOCK_ERROR_EN); } - return Response.responseMsg(OtherShipmentCodeEnum.ADD_OTHER_SHIPMENT_STOCK_ERROR); } } @Override public Response deleteBatchOtherShipments(List ids) { + var systemLanguage = userService.getUserSystemLanguage(userService.getCurrentUserId()); if (ids == null || ids.isEmpty()) { return Response.responseMsg(BaseCodeEnum.PARAMETER_NULL); } @@ -410,9 +469,16 @@ public Response deleteBatchOtherShipments(List ids) { .update(); if(!deleteResult) { - return Response.responseMsg(OtherShipmentCodeEnum.DELETE_OTHER_SHIPMENT_STOCK_ERROR); + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(OtherShipmentCodeEnum.DELETE_OTHER_SHIPMENT_STOCK_ERROR); + } + return Response.responseMsg(OtherShipmentCodeEnum.DELETE_OTHER_SHIPMENT_STOCK_ERROR_EN); + } else { + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(OtherShipmentCodeEnum.DELETE_OTHER_SHIPMENT_STOCK_SUCCESS); + } + return Response.responseMsg(OtherShipmentCodeEnum.DELETE_OTHER_SHIPMENT_STOCK_SUCCESS_EN); } - return Response.responseMsg(OtherShipmentCodeEnum.DELETE_OTHER_SHIPMENT_STOCK_SUCCESS); } @Override @@ -420,52 +486,98 @@ public Response updateOtherShipmentsStatus(List ids, Integer statu if (ids == null || ids.isEmpty()) { return Response.responseMsg(BaseCodeEnum.PARAMETER_NULL); } + var systemLanguage = userService.getUserSystemLanguage(userService.getCurrentUserId()); var updateResult = lambdaUpdate() .set(WarehouseReceiptMain::getStatus, status) .in(WarehouseReceiptMain::getId, ids) .update(); if(!updateResult) { - return Response.responseMsg(OtherShipmentCodeEnum.UPDATE_OTHER_SHIPMENT_STOCK_ERROR); + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(OtherShipmentCodeEnum.UPDATE_OTHER_SHIPMENT_STOCK_ERROR); + } + return Response.responseMsg(OtherShipmentCodeEnum.UPDATE_OTHER_SHIPMENT_STOCK_ERROR_EN); + } else { + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(OtherShipmentCodeEnum.UPDATE_OTHER_SHIPMENT_STOCK_SUCCESS); + } + return Response.responseMsg(OtherShipmentCodeEnum.UPDATE_OTHER_SHIPMENT_STOCK_SUCCESS_EN); } - return Response.responseMsg(OtherShipmentCodeEnum.UPDATE_OTHER_SHIPMENT_STOCK_SUCCESS); } @Override public void exportOtherShipments(QueryOtherShipmentDTO queryOtherShipmentDTO, HttpServletResponse response) { var exportMap = new ConcurrentHashMap>>(); - var mainData = getOtherShipmentsList(queryOtherShipmentDTO); - if (!mainData.isEmpty()) { - exportMap.put("其他出库", ExcelUtils.getSheetData(mainData)); - if (queryOtherShipmentDTO.getIsExportDetail()) { - var subData = new ArrayList(); - for (OtherShipmentVO otherShipmentVO : mainData) { - var detail = getOtherShipmentsDetail(otherShipmentVO.getId()).getData().getTableData(); - if(!detail.isEmpty()) { - detail.forEach(item -> { - var storageShipmentStockBO = StorageShipmentStockExportBO.builder() - .receiptNumber(otherShipmentVO.getReceiptNumber()) - .relatedPersonType("客户") - .relatedPerson(otherShipmentVO.getCustomerName()) - .warehouseName(item.getWarehouseName()) - .barCode(item.getBarCode()) - .productName(item.getProductName()) - .productStandard(item.getProductStandard()) - .productModel(item.getProductModel()) - .productExtendInfo(item.getProductExtendInfo()) - .stock(item.getStock()) - .productUnit(item.getProductUnit()) - .productNumber(item.getProductNumber()) - .unitPrice(item.getUnitPrice()) - .amount(item.getAmount()) - .remark(item.getRemark()) - .build(); - subData.add(storageShipmentStockBO); - }); + var systemLanguage = userService.getUserSystemLanguage(userService.getCurrentUserId()); + if ("zh_CN".equals(systemLanguage)) { + var mainData = getOtherShipmentsList(queryOtherShipmentDTO); + if (!mainData.isEmpty()) { + exportMap.put("其他出库", ExcelUtils.getSheetData(mainData)); + if (queryOtherShipmentDTO.getIsExportDetail()) { + var subData = new ArrayList(); + for (OtherShipmentExportBO otherShipmentExportBO : mainData) { + var detail = getOtherShipmentsDetail(otherShipmentExportBO.getId()).getData().getTableData(); + if(!detail.isEmpty()) { + detail.forEach(item -> { + var storageShipmentStockBO = StorageShipmentStockExportBO.builder() + .receiptNumber(otherShipmentExportBO.getReceiptNumber()) + .relatedPersonType("客户") + .relatedPerson(otherShipmentExportBO.getCustomerName()) + .warehouseName(item.getWarehouseName()) + .barCode(item.getBarCode()) + .productName(item.getProductName()) + .productStandard(item.getProductStandard()) + .productModel(item.getProductModel()) + .productExtendInfo(item.getProductExtendInfo()) + .stock(item.getStock()) + .productUnit(item.getProductUnit()) + .productNumber(item.getProductNumber()) + .unitPrice(item.getUnitPrice()) + .amount(item.getAmount()) + .remark(item.getRemark()) + .build(); + subData.add(storageShipmentStockBO); + }); + } + } + exportMap.put("其他出库明细", ExcelUtils.getSheetData(subData)); + } + ExcelUtils.exportManySheet(response, "其他出库", exportMap); + } + } else { + var mainEnData = getOtherShipmentsEnList(queryOtherShipmentDTO); + if (!mainEnData.isEmpty()) { + exportMap.put("Other Outbound", ExcelUtils.getSheetData(mainEnData)); + if (queryOtherShipmentDTO.getIsExportDetail()) { + var subEnData = new ArrayList(); + for (OtherShipmentExportEnBO otherShipmentExportEnBO : mainEnData) { + var detail = getOtherShipmentsDetail(otherShipmentExportEnBO.getId()).getData().getTableData(); + if(!detail.isEmpty()) { + detail.forEach(item -> { + var storageShipmentStockEnBO = StorageShipmentStockExportEnBO.builder() + .receiptNumber(otherShipmentExportEnBO.getReceiptNumber()) + .relatedPersonType("Customer") + .relatedPerson(otherShipmentExportEnBO.getCustomerName()) + .warehouseName(item.getWarehouseName()) + .barCode(item.getBarCode()) + .productName(item.getProductName()) + .productStandard(item.getProductStandard()) + .productModel(item.getProductModel()) + .productExtendInfo(item.getProductExtendInfo()) + .stock(item.getStock()) + .productUnit(item.getProductUnit()) + .productNumber(item.getProductNumber()) + .unitPrice(item.getUnitPrice()) + .amount(item.getAmount()) + .remark(item.getRemark()) + .build(); + subEnData.add(storageShipmentStockEnBO); + }); + } } + exportMap.put("Other Outbound Detail", ExcelUtils.getSheetData(subEnData)); } - exportMap.put("其他出库明细", ExcelUtils.getSheetData(subData)); + ExcelUtils.exportManySheet(response, "Other Outbound", exportMap); } - ExcelUtils.exportManySheet(response, "其他出库", exportMap); } } @@ -481,17 +593,32 @@ public void exportOtherShipmentsDetail(String receiptNumber, HttpServletResponse if (detail != null) { var data = detail.getData(); var tableData = data.getTableData(); - var exportData = new ArrayList(); - tableData.forEach(item -> { - var storageShipmentStockBO = new StorageShipmentStockExportBO(); - storageShipmentStockBO.setReceiptNumber(data.getReceiptNumber()); - storageShipmentStockBO.setRelatedPersonType("客户"); - storageShipmentStockBO.setRelatedPerson(data.getCustomerName()); - BeanUtils.copyProperties(item, storageShipmentStockBO); - exportData.add(storageShipmentStockBO); - }); - var fileName = data.getReceiptNumber() + "-其他出库单明细"; - ExcelUtils.export(response, fileName, ExcelUtils.getSheetData(exportData)); + var systemLanguage = userService.getUserSystemLanguage(userService.getCurrentUserId()); + if ("zh_CN".equals(systemLanguage)) { + var exportData = new ArrayList(); + tableData.forEach(item -> { + var storageShipmentStockBO = new StorageShipmentStockExportBO(); + storageShipmentStockBO.setReceiptNumber(data.getReceiptNumber()); + storageShipmentStockBO.setRelatedPersonType("客户"); + storageShipmentStockBO.setRelatedPerson(data.getCustomerName()); + BeanUtils.copyProperties(item, storageShipmentStockBO); + exportData.add(storageShipmentStockBO); + }); + var fileName = data.getReceiptNumber() + "-其他出库单明细"; + ExcelUtils.export(response, fileName, ExcelUtils.getSheetData(exportData)); + } else { + var exportEnData = new ArrayList(); + tableData.forEach(item -> { + var storageShipmentStockEnBO = new StorageShipmentStockExportEnBO(); + storageShipmentStockEnBO.setReceiptNumber(data.getReceiptNumber()); + storageShipmentStockEnBO.setRelatedPersonType("Customer"); + storageShipmentStockEnBO.setRelatedPerson(data.getCustomerName()); + BeanUtils.copyProperties(item, storageShipmentStockEnBO); + exportEnData.add(storageShipmentStockEnBO); + }); + var fileName = data.getReceiptNumber() + "- Other Outbound Detail"; + ExcelUtils.export(response, fileName, ExcelUtils.getSheetData(exportEnData)); + } } } } diff --git a/core/service/src/main/java/com/wansenai/service/warehouse/impl/OtherStorageServiceImpl.java b/core/service/src/main/java/com/wansenai/service/warehouse/impl/OtherStorageServiceImpl.java index 033ff8ec..bb3a8de4 100644 --- a/core/service/src/main/java/com/wansenai/service/warehouse/impl/OtherStorageServiceImpl.java +++ b/core/service/src/main/java/com/wansenai/service/warehouse/impl/OtherStorageServiceImpl.java @@ -15,13 +15,14 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.wansenai.bo.FileDataBO; -import com.wansenai.bo.StorageShipmentStockBO; -import com.wansenai.bo.StorageShipmentStockExportBO; +import com.wansenai.bo.*; +import com.wansenai.bo.warehouse.OtherStorageExportBO; +import com.wansenai.bo.warehouse.OtherStorageExportEnBO; +import com.wansenai.bo.warehouse.StorageShipmentStockExportBO; +import com.wansenai.bo.warehouse.StorageShipmentStockExportEnBO; import com.wansenai.dto.warehouse.OtherStorageDTO; import com.wansenai.dto.warehouse.QueryOtherStorageDTO; import com.wansenai.entities.product.ProductStock; -import com.wansenai.entities.receipt.ReceiptPurchaseSub; import com.wansenai.entities.system.SysFile; import com.wansenai.entities.user.SysUser; import com.wansenai.entities.warehouse.WarehouseReceiptMain; @@ -41,7 +42,6 @@ import com.wansenai.utils.enums.OtherStorageCodeEnum; import com.wansenai.utils.excel.ExcelUtils; import com.wansenai.utils.response.Response; -import com.wansenai.vo.warehouse.OtherShipmentVO; import com.wansenai.vo.warehouse.OtherStorageDetailVO; import com.wansenai.vo.warehouse.OtherStorageVO; import jakarta.servlet.http.HttpServletResponse; @@ -186,7 +186,7 @@ public Response> getOtherStoragePageList(QueryOtherStorageD return Response.responseData(result); } - private List getOtherStorageList(QueryOtherStorageDTO queryOtherStorageDTO) { + private List getOtherStorageList(QueryOtherStorageDTO queryOtherStorageDTO) { var wrapperMainMapper = lambdaQuery() .eq(queryOtherStorageDTO.getSupplierId() != null, WarehouseReceiptMain::getRelatedPersonId, queryOtherStorageDTO.getSupplierId()) .eq(queryOtherStorageDTO.getOperatorId() != null, WarehouseReceiptMain::getCreateBy, queryOtherStorageDTO.getOperatorId()) @@ -200,7 +200,7 @@ private List getOtherStorageList(QueryOtherStorageDTO queryOther .eq(WarehouseReceiptMain::getDeleteFlag, CommonConstants.NOT_DELETED) .list(); - var otherStorageVOList = new ArrayList(wrapperMainMapper.size() + 1); + var otherStorageExportBOList = new ArrayList(wrapperMainMapper.size() + 1); wrapperMainMapper.forEach(item -> { var product = productService.getById(item.getProductId()); @@ -210,7 +210,7 @@ private List getOtherStorageList(QueryOtherStorageDTO queryOther } var operator = userService.getById(item.getCreateBy()); - var otherStorageVO = OtherStorageVO.builder() + var otherStorageExportBO = OtherStorageExportBO.builder() .id(item.getId()) .receiptNumber(item.getReceiptNumber()) .productInfo(productInfo) @@ -222,11 +222,51 @@ private List getOtherStorageList(QueryOtherStorageDTO queryOther .status(item.getStatus()) .build(); - otherStorageVOList.add(otherStorageVO); + otherStorageExportBOList.add(otherStorageExportBO); }); - return otherStorageVOList; + return otherStorageExportBOList; } + private List getOtherStorageEnList(QueryOtherStorageDTO queryOtherStorageDTO) { + var wrapperMainMapper = lambdaQuery() + .eq(queryOtherStorageDTO.getSupplierId() != null, WarehouseReceiptMain::getRelatedPersonId, queryOtherStorageDTO.getSupplierId()) + .eq(queryOtherStorageDTO.getOperatorId() != null, WarehouseReceiptMain::getCreateBy, queryOtherStorageDTO.getOperatorId()) + .eq(queryOtherStorageDTO.getStatus() != null, WarehouseReceiptMain::getStatus, queryOtherStorageDTO.getStatus()) + .eq(StringUtils.hasLength(queryOtherStorageDTO.getReceiptNumber()), WarehouseReceiptMain::getReceiptNumber, queryOtherStorageDTO.getReceiptNumber()) + .eq(StringUtils.hasLength(queryOtherStorageDTO.getOtherReceipt()), WarehouseReceiptMain::getReceiptNumber, queryOtherStorageDTO.getOtherReceipt()) + .like(StringUtils.hasLength(queryOtherStorageDTO.getRemark()), WarehouseReceiptMain::getRemark, queryOtherStorageDTO.getRemark()) + .ge(StringUtils.hasLength(queryOtherStorageDTO.getStartDate()), WarehouseReceiptMain::getCreateTime, queryOtherStorageDTO.getStartDate()) + .le(StringUtils.hasLength(queryOtherStorageDTO.getEndDate()), WarehouseReceiptMain::getCreateTime, queryOtherStorageDTO.getEndDate()) + .eq(WarehouseReceiptMain::getType, "其他入库") + .eq(WarehouseReceiptMain::getDeleteFlag, CommonConstants.NOT_DELETED) + .list(); + + var otherStorageExportEnBOList = new ArrayList(wrapperMainMapper.size() + 1); + wrapperMainMapper.forEach(item -> { + + var product = productService.getById(item.getProductId()); + var productInfo = ""; + if(product != null) { + productInfo = product.getProductName() + "|" + product.getProductStandard() + "|" + product.getProductModel() + "|" + product.getProductUnit(); + } + + var operator = userService.getById(item.getCreateBy()); + var otherStorageExportEnBO = OtherStorageExportEnBO.builder() + .id(item.getId()) + .receiptNumber(item.getReceiptNumber()) + .productInfo(productInfo) + .supplierName(commonService.getSupplierName(item.getRelatedPersonId())) + .receiptDate(item.getReceiptDate()) + .operator(Optional.ofNullable(operator).map(SysUser::getName).orElse("")) + .productNumber(item.getTotalProductNumber()) + .totalAmount(item.getTotalAmount()) + .status(item.getStatus()) + .build(); + + otherStorageExportEnBOList.add(otherStorageExportEnBO); + }); + return otherStorageExportEnBOList; + } @Override public Response getOtherStorageDetail(Long id) { @@ -288,6 +328,7 @@ public Response getOtherStorageDetail(Long id) { @Override public Response addOrUpdateOtherStorage(OtherStorageDTO otherStorageDTO) { var userId = userService.getCurrentUserId(); + var systemLanguage = userService.getUserSystemLanguage(userId); var fid = processFiles(otherStorageDTO.getFiles(), otherStorageDTO.getId()); var fileIds = StringUtils.collectionToCommaDelimitedString(fid); var isUpdate = otherStorageDTO.getId() != null; @@ -348,9 +389,16 @@ public Response addOrUpdateOtherStorage(OtherStorageDTO otherStorageDTO) updateProductStock(storageShipmentStock, 1); if (updateSubResult && warehouseReceiptMain) { - return Response.responseMsg(OtherStorageCodeEnum.UPDATE_OTHER_STORAGE_STOCK_SUCCESS); + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(OtherStorageCodeEnum.UPDATE_OTHER_STORAGE_STOCK_SUCCESS); + } + return Response.responseMsg(OtherStorageCodeEnum.UPDATE_OTHER_STORAGE_STOCK_SUCCESS_EN); + } else { + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(OtherStorageCodeEnum.UPDATE_OTHER_STORAGE_STOCK_ERROR); + } + return Response.responseMsg(OtherStorageCodeEnum.UPDATE_OTHER_STORAGE_STOCK_ERROR_EN); } - return Response.responseMsg(OtherStorageCodeEnum.UPDATE_OTHER_STORAGE_STOCK_ERROR); } else { var receiptMainId = SnowflakeIdUtil.nextId(); @@ -391,14 +439,22 @@ public Response addOrUpdateOtherStorage(OtherStorageDTO otherStorageDTO) var saveMainResult = save(warehouseReceiptMain); updateProductStock(storageShipmentStock, 1); if (saveSubResult && saveMainResult) { - return Response.responseMsg(OtherStorageCodeEnum.ADD_OTHER_STORAGE_STOCK_SUCCESS); + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(OtherStorageCodeEnum.ADD_OTHER_STORAGE_STOCK_SUCCESS); + } + return Response.responseMsg(OtherStorageCodeEnum.ADD_OTHER_STORAGE_STOCK_SUCCESS_EN); + } else { + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(OtherStorageCodeEnum.ADD_OTHER_STORAGE_STOCK_ERROR); + } + return Response.responseMsg(OtherStorageCodeEnum.ADD_OTHER_STORAGE_STOCK_ERROR_EN); } - return Response.responseMsg(OtherStorageCodeEnum.ADD_OTHER_STORAGE_STOCK_ERROR); } } @Override public Response deleteBatchOtherStorage(List ids) { + var systemLanguage = userService.getUserSystemLanguage(userService.getCurrentUserId()); if (ids == null || ids.isEmpty()) { return Response.responseMsg(BaseCodeEnum.PARAMETER_NULL); } @@ -413,9 +469,16 @@ public Response deleteBatchOtherStorage(List ids) { .update(); if(!deleteResult) { - return Response.responseMsg(OtherStorageCodeEnum.DELETE_OTHER_STORAGE_STOCK_ERROR); + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(OtherStorageCodeEnum.DELETE_OTHER_STORAGE_STOCK_ERROR); + } + return Response.responseMsg(OtherStorageCodeEnum.DELETE_OTHER_STORAGE_STOCK_ERROR_EN); + } else { + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(OtherStorageCodeEnum.DELETE_OTHER_STORAGE_STOCK_SUCCESS); + } + return Response.responseMsg(OtherStorageCodeEnum.DELETE_OTHER_STORAGE_STOCK_SUCCESS_EN); } - return Response.responseMsg(OtherStorageCodeEnum.DELETE_OTHER_STORAGE_STOCK_SUCCESS); } @Override @@ -427,48 +490,94 @@ public Response updateOtherStorageStatus(List ids, Integer status) .set(WarehouseReceiptMain::getStatus, status) .in(WarehouseReceiptMain::getId, ids) .update(); + var systemLanguage = userService.getUserSystemLanguage(userService.getCurrentUserId()); if(!updateResult) { - return Response.responseMsg(OtherStorageCodeEnum.UPDATE_OTHER_STORAGE_STOCK_ERROR); + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(OtherStorageCodeEnum.UPDATE_OTHER_STORAGE_STOCK_ERROR); + } + return Response.responseMsg(OtherStorageCodeEnum.UPDATE_OTHER_STORAGE_STOCK_ERROR_EN); + } else { + if ("zh_CN".equals(systemLanguage)) { + return Response.responseMsg(OtherStorageCodeEnum.UPDATE_OTHER_STORAGE_STOCK_SUCCESS); + } + return Response.responseMsg(OtherStorageCodeEnum.UPDATE_OTHER_STORAGE_STOCK_SUCCESS_EN); } - return Response.responseMsg(OtherStorageCodeEnum.UPDATE_OTHER_STORAGE_STOCK_SUCCESS); } @Override public void exportOtherStorage(QueryOtherStorageDTO queryOtherStorageDTO, HttpServletResponse response) { var exportMap = new ConcurrentHashMap>>(); - var mainData = getOtherStorageList(queryOtherStorageDTO); - if (!mainData.isEmpty()) { - exportMap.put("其他入库", ExcelUtils.getSheetData(mainData)); - if (queryOtherStorageDTO.getIsExportDetail()) { - var subData = new ArrayList(); - for (OtherStorageVO otherStorageVO : mainData) { - var detail = getOtherStorageDetail(otherStorageVO.getId()).getData().getTableData(); - if(!detail.isEmpty()) { - detail.forEach(item -> { - var storageShipmentStockBO = StorageShipmentStockExportBO.builder() - .receiptNumber(otherStorageVO.getReceiptNumber()) - .relatedPersonType("供应商") - .relatedPerson(otherStorageVO.getSupplierName()) - .warehouseName(item.getWarehouseName()) - .barCode(item.getBarCode()) - .productName(item.getProductName()) - .productStandard(item.getProductStandard()) - .productModel(item.getProductModel()) - .productExtendInfo(item.getProductExtendInfo()) - .stock(item.getStock()) - .productUnit(item.getProductUnit()) - .productNumber(item.getProductNumber()) - .unitPrice(item.getUnitPrice()) - .amount(item.getAmount()) - .remark(item.getRemark()) - .build(); - subData.add(storageShipmentStockBO); - }); + var systemLanguage = userService.getUserSystemLanguage(userService.getCurrentUserId()); + if ("zh_CN".equals(systemLanguage)) { + var mainData = getOtherStorageList(queryOtherStorageDTO); + if (!mainData.isEmpty()) { + exportMap.put("其他入库", ExcelUtils.getSheetData(mainData)); + if (queryOtherStorageDTO.getIsExportDetail()) { + var subData = new ArrayList(); + for (OtherStorageExportBO otherStorageExportBO : mainData) { + var detail = getOtherStorageDetail(otherStorageExportBO.getId()).getData().getTableData(); + if(!detail.isEmpty()) { + detail.forEach(item -> { + var storageShipmentStockBO = StorageShipmentStockExportBO.builder() + .receiptNumber(otherStorageExportBO.getReceiptNumber()) + .relatedPersonType("供应商") + .relatedPerson(otherStorageExportBO.getSupplierName()) + .warehouseName(item.getWarehouseName()) + .barCode(item.getBarCode()) + .productName(item.getProductName()) + .productStandard(item.getProductStandard()) + .productModel(item.getProductModel()) + .productExtendInfo(item.getProductExtendInfo()) + .stock(item.getStock()) + .productUnit(item.getProductUnit()) + .productNumber(item.getProductNumber()) + .unitPrice(item.getUnitPrice()) + .amount(item.getAmount()) + .remark(item.getRemark()) + .build(); + subData.add(storageShipmentStockBO); + }); + } + } + exportMap.put("其他入库明细", ExcelUtils.getSheetData(subData)); + } + ExcelUtils.exportManySheet(response, "其他入库", exportMap); + } + } else { + var mainEnData = getOtherStorageEnList(queryOtherStorageDTO); + exportMap.put("Other Warehousing", ExcelUtils.getSheetData(mainEnData)); + if (!mainEnData.isEmpty()) { + if (queryOtherStorageDTO.getIsExportDetail()) { + var subEnData = new ArrayList(); + for (OtherStorageExportEnBO otherStorageExportEnBO : mainEnData) { + var detail = getOtherStorageDetail(otherStorageExportEnBO.getId()).getData().getTableData(); + if(!detail.isEmpty()) { + detail.forEach(item -> { + var storageShipmentStockEnBO = StorageShipmentStockExportEnBO.builder() + .receiptNumber(otherStorageExportEnBO.getReceiptNumber()) + .relatedPersonType("Supplier") + .relatedPerson(otherStorageExportEnBO.getSupplierName()) + .warehouseName(item.getWarehouseName()) + .barCode(item.getBarCode()) + .productName(item.getProductName()) + .productStandard(item.getProductStandard()) + .productModel(item.getProductModel()) + .productExtendInfo(item.getProductExtendInfo()) + .stock(item.getStock()) + .productUnit(item.getProductUnit()) + .productNumber(item.getProductNumber()) + .unitPrice(item.getUnitPrice()) + .amount(item.getAmount()) + .remark(item.getRemark()) + .build(); + subEnData.add(storageShipmentStockEnBO); + }); + } } + exportMap.put("Other Warehousing Detail", ExcelUtils.getSheetData(subEnData)); } - exportMap.put("其他入库明细", ExcelUtils.getSheetData(subData)); + ExcelUtils.exportManySheet(response, "Other Warehousing", exportMap); } - ExcelUtils.exportManySheet(response, "其他入库", exportMap); } } @@ -484,17 +593,32 @@ public void exportOtherStorageDetail(String receiptNumber, HttpServletResponse r if (detail != null) { var data = detail.getData(); var tableData = data.getTableData(); - var exportData = new ArrayList(); - tableData.forEach(item -> { - var storageShipmentStockBO = new StorageShipmentStockExportBO(); - storageShipmentStockBO.setReceiptNumber(data.getReceiptNumber()); - storageShipmentStockBO.setRelatedPersonType("供应商"); - storageShipmentStockBO.setRelatedPerson(data.getSupplierName()); - BeanUtils.copyProperties(item, storageShipmentStockBO); - exportData.add(storageShipmentStockBO); - }); - var fileName = data.getReceiptNumber() + "-其他入库单明细"; - ExcelUtils.export(response, fileName, ExcelUtils.getSheetData(exportData)); + var systemLanguage = userService.getUserSystemLanguage(userService.getCurrentUserId()); + if ("zh_CN".equals(systemLanguage)) { + var exportData = new ArrayList(); + tableData.forEach(item -> { + var storageShipmentStockBO = new StorageShipmentStockExportBO(); + storageShipmentStockBO.setReceiptNumber(data.getReceiptNumber()); + storageShipmentStockBO.setRelatedPersonType("供应商"); + storageShipmentStockBO.setRelatedPerson(data.getSupplierName()); + BeanUtils.copyProperties(item, storageShipmentStockBO); + exportData.add(storageShipmentStockBO); + }); + var fileName = data.getReceiptNumber() + "-其他入库单明细"; + ExcelUtils.export(response, fileName, ExcelUtils.getSheetData(exportData)); + } else { + var exportEnData = new ArrayList(); + tableData.forEach(item -> { + var storageShipmentStockEnBO = new StorageShipmentStockExportEnBO(); + storageShipmentStockEnBO.setReceiptNumber(data.getReceiptNumber()); + storageShipmentStockEnBO.setRelatedPersonType("Supplier"); + storageShipmentStockEnBO.setRelatedPerson(data.getSupplierName()); + BeanUtils.copyProperties(item, storageShipmentStockEnBO); + exportEnData.add(storageShipmentStockEnBO); + }); + var fileName = data.getReceiptNumber() + "- Other Warehousing Detail"; + ExcelUtils.export(response, fileName, ExcelUtils.getSheetData(exportEnData)); + } } } } diff --git a/core/service/src/main/kotlin/com/wansenai/service/product/impl/ProductAttributeServiceImpl.kt b/core/service/src/main/kotlin/com/wansenai/service/product/impl/ProductAttributeServiceImpl.kt index 9e891e09..a138bd29 100644 --- a/core/service/src/main/kotlin/com/wansenai/service/product/impl/ProductAttributeServiceImpl.kt +++ b/core/service/src/main/kotlin/com/wansenai/service/product/impl/ProductAttributeServiceImpl.kt @@ -19,6 +19,7 @@ import com.wansenai.dto.product.AddOrUpdateProductAttributeDTO import com.wansenai.dto.product.ProductAttributeQueryDTO import com.wansenai.entities.product.ProductAttribute import com.wansenai.mappers.product.ProductAttributeMapper +import com.wansenai.service.BaseService import com.wansenai.service.product.ProductAttributeService import com.wansenai.service.user.ISysUserService import com.wansenai.utils.SnowflakeIdUtil @@ -35,7 +36,8 @@ import java.time.LocalDateTime @Service open class ProductAttributeServiceImpl( private val productAttributeMapper: ProductAttributeMapper, - private val userService: ISysUserService + private val userService: ISysUserService, + private val baseService: BaseService, ):ServiceImpl(), ProductAttributeService { override fun productAttributeList(productAttributeQuery : ProductAttributeQueryDTO?): Response> { @@ -69,36 +71,57 @@ open class ProductAttributeServiceImpl( val attribute = ProductAttribute().apply { BeanUtils.copyProperties(this@run, this) } + val systemLanguage = baseService.currentUserSystemLanguage val userId = userService.currentUserId when (attribute.id) { null -> { val wrapper = createWrapper(attribute) val count = getCount(wrapper) if (count > 0) { - return Response.responseMsg(ProdcutCodeEnum.PRODUCT_ATTRIBUTE_NAME_EXIST) + if (systemLanguage == "zh_CN") { + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_ATTRIBUTE_NAME_EXIST) + } + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_ATTRIBUTE_NAME_EXIST_EN) } attribute.id = SnowflakeIdUtil.nextId() attribute.createTime = LocalDateTime.now() attribute.createBy = userId val saveResult = saveAttribute(attribute) if (saveResult == 0) { - return Response.responseMsg(ProdcutCodeEnum.ADD_PRODUCT_ATTRIBUTE_ERROR) + if (systemLanguage == "zh_CN") { + return Response.responseMsg(ProdcutCodeEnum.ADD_PRODUCT_ATTRIBUTE_ERROR) + } + return Response.responseMsg(ProdcutCodeEnum.ADD_PRODUCT_ATTRIBUTE_ERROR_EN) + } else { + if (systemLanguage == "zh_CN") { + return Response.responseMsg(ProdcutCodeEnum.ADD_PRODUCT_ATTRIBUTE_SUCCESS) + } + return Response.responseMsg(ProdcutCodeEnum.ADD_PRODUCT_ATTRIBUTE_SUCCESS_EN) } - return Response.responseMsg(ProdcutCodeEnum.ADD_PRODUCT_ATTRIBUTE_SUCCESS) } else -> { val wrapper = createWrapper(attribute).ne(ProductAttribute::getId, attribute.id) val count = getCount(wrapper) if (count > 0) { - return Response.responseMsg(ProdcutCodeEnum.PRODUCT_ATTRIBUTE_NAME_EXIST) + if (systemLanguage == "zh_CN") { + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_ATTRIBUTE_NAME_EXIST) + } + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_ATTRIBUTE_NAME_EXIST_EN) } attribute.updateBy = userId attribute.updateTime = LocalDateTime.now() val updateResult = updateAttribute(attribute) if (updateResult == 0) { - return Response.responseMsg(ProdcutCodeEnum.UPDATE_PRODUCT_ATTRIBUTE_ERROR) + if (systemLanguage == "zh_CN") { + return Response.responseMsg(ProdcutCodeEnum.UPDATE_PRODUCT_ATTRIBUTE_ERROR) + } + return Response.responseMsg(ProdcutCodeEnum.UPDATE_PRODUCT_ATTRIBUTE_ERROR_EN) + } else { + if (systemLanguage == "zh_CN") { + return Response.responseMsg(ProdcutCodeEnum.UPDATE_PRODUCT_ATTRIBUTE_SUCCESS) + } + return Response.responseMsg(ProdcutCodeEnum.UPDATE_PRODUCT_ATTRIBUTE_SUCCESS_EN) } - return Response.responseMsg(ProdcutCodeEnum.UPDATE_PRODUCT_ATTRIBUTE_SUCCESS) } } } ?: return Response.responseMsg(BaseCodeEnum.PARAMETER_NULL) @@ -119,10 +142,17 @@ open class ProductAttributeServiceImpl( // Change the status from unmodified to physically deleted data ids?.let { val deleteResult = productAttributeMapper.deleteBatchIds(ids) + val systemLanguage = baseService.currentUserSystemLanguage if(deleteResult == 0) { - return Response.responseMsg(ProdcutCodeEnum.DELETE_PRODUCT_ATTRIBUTE_ERROR) + if (systemLanguage == "zh_CN") { + return Response.responseMsg(ProdcutCodeEnum.DELETE_PRODUCT_ATTRIBUTE_ERROR) + } + return Response.responseMsg(ProdcutCodeEnum.DELETE_PRODUCT_ATTRIBUTE_ERROR_EN) + } + if (systemLanguage == "zh_CN") { + return Response.responseMsg(ProdcutCodeEnum.DELETE_PRODUCT_ATTRIBUTE_SUCCESS) } - return Response.responseMsg(ProdcutCodeEnum.DELETE_PRODUCT_ATTRIBUTE_SUCCESS) + return Response.responseMsg(ProdcutCodeEnum.DELETE_PRODUCT_ATTRIBUTE_SUCCESS_EN) }?: return Response.responseMsg(BaseCodeEnum.PARAMETER_NULL) } diff --git a/core/service/src/main/kotlin/com/wansenai/service/product/impl/ProductCategoryServiceImpl.kt b/core/service/src/main/kotlin/com/wansenai/service/product/impl/ProductCategoryServiceImpl.kt index a9432547..c1a46b3c 100644 --- a/core/service/src/main/kotlin/com/wansenai/service/product/impl/ProductCategoryServiceImpl.kt +++ b/core/service/src/main/kotlin/com/wansenai/service/product/impl/ProductCategoryServiceImpl.kt @@ -58,6 +58,7 @@ open class ProductCategoryServiceImpl( } override fun addOrUpdateProductCategory(productCategory: AddOrUpdateProductCategoryDTO): Response { + val systemLanguage = userService.getUserSystemLanguage(userService.currentUserId) productCategory.let { dto -> val userId = userService.getCurrentTenantId().toLong() if (dto.id == null) { @@ -75,10 +76,17 @@ open class ProductCategoryServiceImpl( .createBy(userId) .build() ) - if (!savaResult) { - return Response.responseMsg(ProdcutCodeEnum.ADD_PRODUCT_CATEGORY_ERROR) + if (systemLanguage == "zh_CN") { + if (!savaResult) { + return Response.responseMsg(ProdcutCodeEnum.ADD_PRODUCT_CATEGORY_ERROR) + } + return Response.responseMsg(ProdcutCodeEnum.ADD_PRODUCT_CATEGORY_SUCCESS) + } else { + if (!savaResult) { + return Response.responseMsg(ProdcutCodeEnum.ADD_PRODUCT_CATEGORY_ERROR_EN) + } + return Response.responseMsg(ProdcutCodeEnum.ADD_PRODUCT_CATEGORY_SUCCESS_EN) } - return Response.responseMsg(ProdcutCodeEnum.ADD_PRODUCT_CATEGORY_SUCCESS) } else { val updateResult = lambdaUpdate() @@ -94,10 +102,17 @@ open class ProductCategoryServiceImpl( } .update() - if (!updateResult) { - return Response.responseMsg(ProdcutCodeEnum.UPDATE_PRODUCT_CATEGORY_ERROR) + if (systemLanguage == "zh_CN") { + if (!updateResult) { + return Response.responseMsg(ProdcutCodeEnum.UPDATE_PRODUCT_CATEGORY_ERROR) + } + return Response.responseMsg(ProdcutCodeEnum.UPDATE_PRODUCT_CATEGORY_SUCCESS) + } else { + if (!updateResult) { + return Response.responseMsg(ProdcutCodeEnum.UPDATE_PRODUCT_CATEGORY_ERROR_EN) + } + return Response.responseMsg(ProdcutCodeEnum.UPDATE_PRODUCT_CATEGORY_SUCCESS_EN) } - return Response.responseMsg(ProdcutCodeEnum.UPDATE_PRODUCT_CATEGORY_SUCCESS) } } } @@ -112,11 +127,18 @@ open class ProductCategoryServiceImpl( .set(ProductCategory::getDeleteFlag, CommonConstants.DELETED) .update() - if(!deleteResult){ - return Response.responseMsg(ProdcutCodeEnum.DELETE_PRODUCT_CATEGORY_ERROR) + val systemLanguage = userService.getUserSystemLanguage(userService.currentUserId) + if (systemLanguage == "zh_CN") { + if(!deleteResult){ + return Response.responseMsg(ProdcutCodeEnum.DELETE_PRODUCT_CATEGORY_ERROR) + } + return Response.responseMsg(ProdcutCodeEnum.DELETE_PRODUCT_CATEGORY_SUCCESS) + } else { + if(!deleteResult){ + return Response.responseMsg(ProdcutCodeEnum.DELETE_PRODUCT_CATEGORY_ERROR_EN) + } + return Response.responseMsg(ProdcutCodeEnum.DELETE_PRODUCT_CATEGORY_SUCCESS_EN) } - - return Response.responseMsg(ProdcutCodeEnum.DELETE_PRODUCT_CATEGORY_SUCCESS) } override fun getProductCategoryByName(name: String?): ProductCategory { diff --git a/core/service/src/main/kotlin/com/wansenai/service/product/impl/ProductUnitServiceImpl.kt b/core/service/src/main/kotlin/com/wansenai/service/product/impl/ProductUnitServiceImpl.kt index 93c217ca..d834c94e 100644 --- a/core/service/src/main/kotlin/com/wansenai/service/product/impl/ProductUnitServiceImpl.kt +++ b/core/service/src/main/kotlin/com/wansenai/service/product/impl/ProductUnitServiceImpl.kt @@ -99,8 +99,12 @@ open class ProductUnitServiceImpl( unit.id?.let { ne(ProductUnit::getId, it) } } val unitExists = productUnitMapper.exists(unitWrapper) + val systemLanguage = baseService.currentUserSystemLanguage if (unitExists) { - return Response.responseMsg(ProdcutCodeEnum.PRODUCT_COMPUTE_UNIT_EXIST) + if (systemLanguage == "zh_CN") { + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_COMPUTE_UNIT_EXIST) + } + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_COMPUTE_UNIT_EXIST_EN) } val result = if (unit.id == null) { @@ -111,15 +115,31 @@ open class ProductUnitServiceImpl( return if (result) { if (unit.id == null) { - Response.responseMsg(ProdcutCodeEnum.PRODUCT_UNIT_ADD_SUCCESS) + if (systemLanguage == "zh_CN") { + Response.responseMsg(ProdcutCodeEnum.PRODUCT_UNIT_ADD_SUCCESS) + } else{ + Response.responseMsg(ProdcutCodeEnum.PRODUCT_UNIT_ADD_SUCCESS_EN) + } } else { - Response.responseMsg(ProdcutCodeEnum.PRODUCT_UNIT_UPDATE_SUCCESS) + if (systemLanguage == "zh_CN") { + Response.responseMsg(ProdcutCodeEnum.PRODUCT_UNIT_UPDATE_SUCCESS) + } else { + Response.responseMsg(ProdcutCodeEnum.PRODUCT_UNIT_UPDATE_SUCCESS_EN) + } } } else { if (unit.id == null) { - Response.responseMsg(ProdcutCodeEnum.PRODUCT_UNIT_ADD_ERROR) + if (systemLanguage == "zh_CN") { + Response.responseMsg(ProdcutCodeEnum.PRODUCT_UNIT_ADD_ERROR) + } else { + Response.responseMsg(ProdcutCodeEnum.PRODUCT_UNIT_ADD_ERROR_EN) + } } else { - Response.responseMsg(ProdcutCodeEnum.PRODUCT_UNIT_UPDATE_ERROR) + if (systemLanguage == "zh_CN") { + Response.responseMsg(ProdcutCodeEnum.PRODUCT_UNIT_UPDATE_ERROR) + } else { + Response.responseMsg(ProdcutCodeEnum.PRODUCT_UNIT_UPDATE_ERROR_EN) + } } } } ?: return Response.responseMsg(BaseCodeEnum.PARAMETER_NULL) @@ -160,10 +180,17 @@ open class ProductUnitServiceImpl( override fun deleteProductUnit(ids: List?): Response { ids?.let { val deleteResult = productUnitMapper.deleteBatchIds(ids) + val systemLanguage = baseService.currentUserSystemLanguage if(deleteResult == 0) { - return Response.responseMsg(ProdcutCodeEnum.PRODUCT_UNIT_DELETE_ERROR) + if (systemLanguage == "zh_CN") { + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_UNIT_DELETE_ERROR) + } + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_UNIT_DELETE_ERROR_EN) } - return Response.responseMsg(ProdcutCodeEnum.PRODUCT_UNIT_DELETE_SUCCESS) + if (systemLanguage == "zh_CN") { + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_UNIT_DELETE_SUCCESS) + } + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_UNIT_DELETE_SUCCESS_EN) }?: return Response.responseMsg(BaseCodeEnum.PARAMETER_NULL) } @@ -174,10 +201,19 @@ open class ProductUnitServiceImpl( status = item.status } val updateResult = productUnitMapper.updateById(unit) + val systemLanguage = baseService.currentUserSystemLanguage if (updateResult == 0) { - Response.responseMsg(ProdcutCodeEnum.UPDATE_PRODUCT_UNIT_STATUS_ERROR) + if (systemLanguage == "zh_CN") { + Response.responseMsg(ProdcutCodeEnum.UPDATE_PRODUCT_UNIT_STATUS_ERROR) + } else { + Response.responseMsg(ProdcutCodeEnum.UPDATE_PRODUCT_UNIT_STATUS_ERROR_EN) + } } else { - Response.responseMsg(ProdcutCodeEnum.UPDATE_PRODUCT_UNIT_STATUS_SUCCESS) + if (systemLanguage == "zh_CN") { + Response.responseMsg(ProdcutCodeEnum.UPDATE_PRODUCT_UNIT_STATUS_SUCCESS) + } else { + Response.responseMsg(ProdcutCodeEnum.UPDATE_PRODUCT_UNIT_STATUS_SUCCESS_EN) + } } } ?: Response.responseMsg(BaseCodeEnum.PARAMETER_NULL) } diff --git a/core/utils/src/main/java/com/wansenai/utils/enums/AllotShipmentCodeEnum.java b/core/utils/src/main/java/com/wansenai/utils/enums/AllotShipmentCodeEnum.java index 6619ae4c..e2d9ef4b 100644 --- a/core/utils/src/main/java/com/wansenai/utils/enums/AllotShipmentCodeEnum.java +++ b/core/utils/src/main/java/com/wansenai/utils/enums/AllotShipmentCodeEnum.java @@ -17,17 +17,29 @@ @Getter public enum AllotShipmentCodeEnum { - ADD_ALLOT_SHIPMENT_STOCK_RECEIPT_SUCCESS("S0010", "添加调拨出库单据成功"), + ADD_ALLOT_SHIPMENT_STOCK_RECEIPT_SUCCESS("S0010", "成功添加调拨出库单据"), - ADD_ALLOT_SHIPMENT_STOCK_RECEIPT_ERROR("S0509", "添加调拨出库单据失败"), + ADD_ALLOT_SHIPMENT_STOCK_RECEIPT_SUCCESS_EN("S0010", "Successfully add transfer outbound document"), - UPDATE_ALLOT_SHIPMENT_STOCK_RECEIPT_SUCCESS("S0011", "修改调拨出库单据成功"), + ADD_ALLOT_SHIPMENT_STOCK_RECEIPT_ERROR("S0509", "系统异常,添加调拨出库单据失败"), - UPDATE_ALLOT_SHIPMENT_STOCK_RECEIPT_ERROR("S0510", "修改调拨出库单据失败"), + ADD_ALLOT_SHIPMENT_STOCK_RECEIPT_ERROR_EN("S0509", "System exception, failed to add transfer outbound document"), - DELETE_ALLOT_SHIPMENT_STOCK_RECEIPT_SUCCESS("S0012", "删除调拨出库单据成功"), + UPDATE_ALLOT_SHIPMENT_STOCK_RECEIPT_SUCCESS("S0011", "成功修改调拨出库单据"), - DELETE_ALLOT_SHIPMENT_STOCK_RECEIPT_ERROR("S0511", "删除调拨出库单据失败"); + UPDATE_ALLOT_SHIPMENT_STOCK_RECEIPT_SUCCESS_EN("S0011", "Successfully modify transfer outbound document"), + + UPDATE_ALLOT_SHIPMENT_STOCK_RECEIPT_ERROR("S0510", "系统异常,修改调拨出库单据失败"), + + UPDATE_ALLOT_SHIPMENT_STOCK_RECEIPT_ERROR_EN("S0510", "System exception, failed to modify transfer outbound document"), + + DELETE_ALLOT_SHIPMENT_STOCK_RECEIPT_SUCCESS("S0012", "成功删除调拨出库单据"), + + DELETE_ALLOT_SHIPMENT_STOCK_RECEIPT_SUCCESS_EN("S0012", "Successfully delete transfer outbound document"), + + DELETE_ALLOT_SHIPMENT_STOCK_RECEIPT_ERROR("S0511", "系统异常,删除调拨出库单据失败"), + + DELETE_ALLOT_SHIPMENT_STOCK_RECEIPT_ERROR_EN("S0511", "System exception, failed to delete transfer outbound document"); /** * 响应状态码 diff --git a/core/utils/src/main/java/com/wansenai/utils/enums/AssembleReceiptCodeEnum.java b/core/utils/src/main/java/com/wansenai/utils/enums/AssembleReceiptCodeEnum.java index e0bd0be6..2898711d 100644 --- a/core/utils/src/main/java/com/wansenai/utils/enums/AssembleReceiptCodeEnum.java +++ b/core/utils/src/main/java/com/wansenai/utils/enums/AssembleReceiptCodeEnum.java @@ -17,17 +17,29 @@ @Getter public enum AssembleReceiptCodeEnum { - ADD_ASSEMBLE_RECEIPT_SUCCESS("A0020", "添加组装单据成功"), + ADD_ASSEMBLE_RECEIPT_SUCCESS("A0020", "成功添加组装单据"), - ADD_ASSEMBLE_RECEIPT_ERROR("A0520", "添加组装单据失败"), + ADD_ASSEMBLE_RECEIPT_SUCCESS_EN("A0020", "Successfully add assembly documents"), - UPDATE_ASSEMBLE_RECEIPT_SUCCESS("A0021", "修改组装单据成功"), + ADD_ASSEMBLE_RECEIPT_ERROR("A0520", "系统异常,添加组装单据失败"), - UPDATE_ASSEMBLE_RECEIPT_ERROR("A0521", "修改组装单据失败"), + ADD_ASSEMBLE_RECEIPT_ERROR_EN("A0520", "System exception, failed to add assembly documents"), - DELETE_ASSEMBLE_RECEIPT_SUCCESS("A0022", "删除组装单据成功"), + UPDATE_ASSEMBLE_RECEIPT_SUCCESS("A0021", "成功修改组装单据"), - DELETE_ASSEMBLE_RECEIPT_ERROR("A0522", "删除组装单据失败"); + UPDATE_ASSEMBLE_RECEIPT_SUCCESS_EN("A0021", "Successfully modify assembly documents"), + + UPDATE_ASSEMBLE_RECEIPT_ERROR("A0521", "系统异常,修改组装单据失败"), + + UPDATE_ASSEMBLE_RECEIPT_ERROR_EN("A0521", "System exception, failed to modify assembly documents"), + + DELETE_ASSEMBLE_RECEIPT_SUCCESS("A0022", "成功删除组装单据"), + + DELETE_ASSEMBLE_RECEIPT_SUCCESS_EN("A0022", "Successfully delete assembly documents"), + + DELETE_ASSEMBLE_RECEIPT_ERROR("A0522", "系统异常,删除组装单据失败"), + + DELETE_ASSEMBLE_RECEIPT_ERROR_EN("A0522", "System exception, failed to delete assembly documents"); /** * 响应状态码 diff --git a/core/utils/src/main/java/com/wansenai/utils/enums/DisassembleReceiptCodeEnum.java b/core/utils/src/main/java/com/wansenai/utils/enums/DisassembleReceiptCodeEnum.java index 6f8a1efd..0386d0ef 100644 --- a/core/utils/src/main/java/com/wansenai/utils/enums/DisassembleReceiptCodeEnum.java +++ b/core/utils/src/main/java/com/wansenai/utils/enums/DisassembleReceiptCodeEnum.java @@ -17,17 +17,29 @@ @Getter public enum DisassembleReceiptCodeEnum { - ADD_DISASSEMBLE_RECEIPT_SUCCESS("D0001", "添加拆卸单据成功"), + ADD_DISASSEMBLE_RECEIPT_SUCCESS("D0001", "成功添加拆卸单据"), - ADD_DISASSEMBLE_RECEIPT_ERROR("D0500", "添加拆卸单据失败"), + ADD_DISASSEMBLE_RECEIPT_SUCCESS_EN("D0001", "Successfully add disassembly documents"), - UPDATE_DISASSEMBLE_RECEIPT_SUCCESS("D0002", "修改拆卸单据成功"), + ADD_DISASSEMBLE_RECEIPT_ERROR("D0500", "系统异常,添加拆卸单据失败"), - UPDATE_DISASSEMBLE_RECEIPT_ERROR("D0501", "修改拆卸单据失败"), + ADD_DISASSEMBLE_RECEIPT_ERROR_EN("D0500", "System exception, failed to add disassembly documents"), - DELETE_DISASSEMBLE_RECEIPT_SUCCESS("D0003", "删除拆卸单据成功"), + UPDATE_DISASSEMBLE_RECEIPT_SUCCESS("D0002", "成功修改拆卸单据"), - DELETE_DISASSEMBLE_RECEIPT_ERROR("D0502", "删除拆卸单据失败"); + UPDATE_DISASSEMBLE_RECEIPT_SUCCESS_EN("D0002", "Successfully modify disassembly documents"), + + UPDATE_DISASSEMBLE_RECEIPT_ERROR("D0501", "系统异常,修改拆卸单据失败"), + + UPDATE_DISASSEMBLE_RECEIPT_ERROR_EN("D0501", "System exception, failed to modify disassembly documents"), + + DELETE_DISASSEMBLE_RECEIPT_SUCCESS("D0003", "成功删除拆卸单据"), + + DELETE_DISASSEMBLE_RECEIPT_SUCCESS_EN("D0003", "Successfully delete disassembly documents"), + + DELETE_DISASSEMBLE_RECEIPT_ERROR("D0502", "系统异常,删除拆卸单据失败"), + + DELETE_DISASSEMBLE_RECEIPT_ERROR_EN("D0502", "System exception, failed to delete disassembly documents"); /** * 响应状态码 diff --git a/core/utils/src/main/java/com/wansenai/utils/enums/OtherShipmentCodeEnum.java b/core/utils/src/main/java/com/wansenai/utils/enums/OtherShipmentCodeEnum.java index 67fac2a8..fb14983c 100644 --- a/core/utils/src/main/java/com/wansenai/utils/enums/OtherShipmentCodeEnum.java +++ b/core/utils/src/main/java/com/wansenai/utils/enums/OtherShipmentCodeEnum.java @@ -17,17 +17,29 @@ @Getter public enum OtherShipmentCodeEnum { - ADD_OTHER_SHIPMENT_STOCK_SUCCESS("S0013", "添加其他出库单据成功"), + ADD_OTHER_SHIPMENT_STOCK_SUCCESS("S0013", "成功添加其他出库单据"), - ADD_OTHER_SHIPMENT_STOCK_ERROR("S0512", "添加其他出库单据失败"), + ADD_OTHER_SHIPMENT_STOCK_SUCCESS_EN("S0013", "Successfully add other outbound documents"), - UPDATE_OTHER_SHIPMENT_STOCK_SUCCESS("S0014", "修改其他出库单据成功"), + ADD_OTHER_SHIPMENT_STOCK_ERROR("S0512", "系统异常,添加其他出库单据失败"), - UPDATE_OTHER_SHIPMENT_STOCK_ERROR("S0513", "修改其他出库单据失败"), + ADD_OTHER_SHIPMENT_STOCK_ERROR_EN("S0512", "System exception, failed to add other outbound documents"), - DELETE_OTHER_SHIPMENT_STOCK_SUCCESS("S0015", "删除其他出库单据成功"), + UPDATE_OTHER_SHIPMENT_STOCK_SUCCESS("S0014", "成功修改其他出库单据"), - DELETE_OTHER_SHIPMENT_STOCK_ERROR("S0514", "删除其他出库单据失败"); + UPDATE_OTHER_SHIPMENT_STOCK_SUCCESS_EN("S0014", "Successfully modify other outbound documents"), + + UPDATE_OTHER_SHIPMENT_STOCK_ERROR("S0513", "系统异常,修改其他出库单据失败"), + + UPDATE_OTHER_SHIPMENT_STOCK_ERROR_EN("S0513", "System exception, failed to modify other outbound documents"), + + DELETE_OTHER_SHIPMENT_STOCK_SUCCESS("S0015", "成功删除其他出库单据"), + + DELETE_OTHER_SHIPMENT_STOCK_SUCCESS_EN("S0015", "Successfully delete other outbound documents"), + + DELETE_OTHER_SHIPMENT_STOCK_ERROR("S0514", "系统异常,删除其他出库单据失败"), + + DELETE_OTHER_SHIPMENT_STOCK_ERROR_EN("S0514", "System exception, failed to delete other outbound documents"); /** * 响应状态码 diff --git a/core/utils/src/main/java/com/wansenai/utils/enums/OtherStorageCodeEnum.java b/core/utils/src/main/java/com/wansenai/utils/enums/OtherStorageCodeEnum.java index 5b1bf9ad..fcca9e58 100644 --- a/core/utils/src/main/java/com/wansenai/utils/enums/OtherStorageCodeEnum.java +++ b/core/utils/src/main/java/com/wansenai/utils/enums/OtherStorageCodeEnum.java @@ -17,17 +17,29 @@ @Getter public enum OtherStorageCodeEnum { - ADD_OTHER_STORAGE_STOCK_SUCCESS("S0016", "添加其他入库单据成功"), + ADD_OTHER_STORAGE_STOCK_SUCCESS("S0016", "成功添加入库单据"), - ADD_OTHER_STORAGE_STOCK_ERROR("S0515", "添加其他入库单据失败"), + ADD_OTHER_STORAGE_STOCK_SUCCESS_EN("S0016", "Successfully add warehousing document"), - UPDATE_OTHER_STORAGE_STOCK_SUCCESS("S0017", "修改其他入库单据成功"), + ADD_OTHER_STORAGE_STOCK_ERROR("S0515", "系统异常,添加入库单据失败"), - UPDATE_OTHER_STORAGE_STOCK_ERROR("S0516", "修改其他入库单据失败"), + ADD_OTHER_STORAGE_STOCK_ERROR_EN("S0515", "System exception, failed to add warehousing document"), - DELETE_OTHER_STORAGE_STOCK_SUCCESS("S0018", "删除其他入库单据成功"), + UPDATE_OTHER_STORAGE_STOCK_SUCCESS("S0017", "成功修改入库单据"), - DELETE_OTHER_STORAGE_STOCK_ERROR("S0517", "删除其他入库单据失败"); + UPDATE_OTHER_STORAGE_STOCK_SUCCESS_EN("S0017", "Successfully modify warehousing document"), + + UPDATE_OTHER_STORAGE_STOCK_ERROR("S0516", "系统异常,修改入库单据失败"), + + UPDATE_OTHER_STORAGE_STOCK_ERROR_EN("S0516", "System exception, failed to modify warehousing document"), + + DELETE_OTHER_STORAGE_STOCK_SUCCESS("S0018", "成功删除入库单据"), + + DELETE_OTHER_STORAGE_STOCK_SUCCESS_EN("S0018", "Successfully delete warehousing document"), + + DELETE_OTHER_STORAGE_STOCK_ERROR("S0517", "系统异常,删除入库单据失败"), + + DELETE_OTHER_STORAGE_STOCK_ERROR_EN("S0517", "System exception, failed to delete warehousing document"); /** * 响应状态码 diff --git a/core/utils/src/main/java/com/wansenai/utils/enums/ProdcutCodeEnum.java b/core/utils/src/main/java/com/wansenai/utils/enums/ProdcutCodeEnum.java index 671c15fe..5b9bb7a0 100644 --- a/core/utils/src/main/java/com/wansenai/utils/enums/ProdcutCodeEnum.java +++ b/core/utils/src/main/java/com/wansenai/utils/enums/ProdcutCodeEnum.java @@ -5,76 +5,148 @@ @Getter public enum ProdcutCodeEnum { - ADD_PRODUCT_CATEGORY_SUCCESS("P0000", "添加商品分类成功"), + ADD_PRODUCT_CATEGORY_SUCCESS("P0000", "成功添加商品分类"), - ADD_PRODUCT_CATEGORY_ERROR("P0500", "添加商品分类失败"), + ADD_PRODUCT_CATEGORY_SUCCESS_EN("P0000", "Successfully add product category"), + + ADD_PRODUCT_CATEGORY_ERROR("P0500", "系统异常,添加商品分类失败"), + + ADD_PRODUCT_CATEGORY_ERROR_EN("P0500", "System exception, adding product category failed"), UPDATE_PRODUCT_CATEGORY_SUCCESS("P0001", "修改商品分类成功"), - UPDATE_PRODUCT_CATEGORY_ERROR("P0501", "修改商品分类失败"), + UPDATE_PRODUCT_CATEGORY_SUCCESS_EN("P0001", "Successfully modify product category"), + + UPDATE_PRODUCT_CATEGORY_ERROR("P0501", "系统异常,修改商品分类失败"), + + UPDATE_PRODUCT_CATEGORY_ERROR_EN("P0501", "System exception, failed to modify product category"), + + DELETE_PRODUCT_CATEGORY_SUCCESS("P0002", "成功删除商品分类"), - DELETE_PRODUCT_CATEGORY_SUCCESS("P0002", "删除商品分类成功"), + DELETE_PRODUCT_CATEGORY_SUCCESS_EN("P0002", "Successfully delete product category"), - DELETE_PRODUCT_CATEGORY_ERROR("P0502", "删除商品分类失败"), + DELETE_PRODUCT_CATEGORY_ERROR("P0502", "系统异常,删除商品分类失败"), + + DELETE_PRODUCT_CATEGORY_ERROR_EN("P0502", "System exception, failed to delete product category"), // Product Attribute Code PRODUCT_ATTRIBUTE_NAME_EXIST("P0506", "商品属性名称已存在"), - ADD_PRODUCT_ATTRIBUTE_SUCCESS("P0003", "添加商品属性成功"), + PRODUCT_ATTRIBUTE_NAME_EXIST_EN("P0506", "Product attribute name already exists"), + + ADD_PRODUCT_ATTRIBUTE_SUCCESS("P0003", "成功添加商品属性"), + + ADD_PRODUCT_ATTRIBUTE_SUCCESS_EN("P0003", "Successfully add product attributes"), + + ADD_PRODUCT_ATTRIBUTE_ERROR("P0503", "系统异常,添加商品属性失败"), - ADD_PRODUCT_ATTRIBUTE_ERROR("P0503", "添加商品属性失败"), + ADD_PRODUCT_ATTRIBUTE_ERROR_EN("P0503", "System exception, failed to add product attributes"), - UPDATE_PRODUCT_ATTRIBUTE_SUCCESS("P0004", "修改商品属性成功"), + UPDATE_PRODUCT_ATTRIBUTE_SUCCESS("P0004", "成功修改商品属性"), - UPDATE_PRODUCT_ATTRIBUTE_ERROR("P0504", "修改商品属性失败"), + UPDATE_PRODUCT_ATTRIBUTE_SUCCESS_EN("P0004", "Successfully modify product attributes"), - DELETE_PRODUCT_ATTRIBUTE_SUCCESS("P0005", "删除商品属性成功"), + UPDATE_PRODUCT_ATTRIBUTE_ERROR("P0504", "系统异常,修改商品属性失败"), - DELETE_PRODUCT_ATTRIBUTE_ERROR("P0505", "删除商品属性失败"), + UPDATE_PRODUCT_ATTRIBUTE_ERROR_EN("P0504", "System exception, failed to modify product attributes"), + + DELETE_PRODUCT_ATTRIBUTE_SUCCESS("P0005", "成功删除商品属性"), + + DELETE_PRODUCT_ATTRIBUTE_SUCCESS_EN("P0005", "Successfully delete product attributes"), + + DELETE_PRODUCT_ATTRIBUTE_ERROR("P0505", "系统异常,删除商品属性失败"), + + DELETE_PRODUCT_ATTRIBUTE_ERROR_EN("P0505", "System exception, failed to delete product attributes"), // Product Unit Code PRODUCT_COMPUTE_UNIT_EXIST("P0507", "商品计量单位已存在"), - PRODUCT_UNIT_ADD_SUCCESS("P0006", "添加商品单位成功"), + PRODUCT_COMPUTE_UNIT_EXIST_EN("P0507", "Product measurement unit already exists"), + + PRODUCT_UNIT_ADD_SUCCESS("P0006", "成功添加商品计量单位"), + + PRODUCT_UNIT_ADD_SUCCESS_EN("P0006", "Successfully add product measurement unit"), + + PRODUCT_UNIT_ADD_ERROR("P0506", "系统异常,添加商品计量单位失败"), + + PRODUCT_UNIT_ADD_ERROR_EN("P0506", "System exception, failed to add product measurement unit"), + + PRODUCT_UNIT_UPDATE_SUCCESS("P0007", "成功修改商品计量单位"), - PRODUCT_UNIT_ADD_ERROR("P0506", "添加商品单位失败"), + PRODUCT_UNIT_UPDATE_SUCCESS_EN("P0007", "Successfully modify product measurement unit"), - PRODUCT_UNIT_UPDATE_SUCCESS("P0007", "修改商品单位成功"), + PRODUCT_UNIT_UPDATE_ERROR("P0507", "系统异常,修改商品计量单位失败"), - PRODUCT_UNIT_UPDATE_ERROR("P0507", "修改商品单位失败"), + PRODUCT_UNIT_UPDATE_ERROR_EN("P0507", "System exception, failed to modify product measurement unit"), - PRODUCT_UNIT_DELETE_SUCCESS("P0008", "删除商品单位成功"), + PRODUCT_UNIT_DELETE_SUCCESS("P0008", "成功删除商品计量单位"), - PRODUCT_UNIT_DELETE_ERROR("P0508", "删除商品单位失败"), + PRODUCT_UNIT_DELETE_SUCCESS_EN("P0008", "Successfully delete product measurement unit"), - UPDATE_PRODUCT_UNIT_STATUS_SUCCESS("P0009", "修改商品单位状态成功"), + PRODUCT_UNIT_DELETE_ERROR("P0508", "系统异常,删除商品计量单位失败"), - UPDATE_PRODUCT_UNIT_STATUS_ERROR("P0509", "修改商品单位状态失败"), + PRODUCT_UNIT_DELETE_ERROR_EN("P0508", "System exception, failed to delete product measurement unit"), + + UPDATE_PRODUCT_UNIT_STATUS_SUCCESS("P0009", "成功修改商品计量单位状态"), + + UPDATE_PRODUCT_UNIT_STATUS_SUCCESS_EN("P0009", "Successfully modify product measurement unit status"), + + UPDATE_PRODUCT_UNIT_STATUS_ERROR("P0509", "系统异常,修改商品计量单位状态失败"), + + UPDATE_PRODUCT_UNIT_STATUS_ERROR_EN("P0509", "System exception, failed to modify product measurement unit status"), // Product code - PRODUCT_NAME_EXIST("P0510", "商品名称已存在"), + PRODUCT_NAME_EXIST("P0510", "商品名称已存在,请重新输入"), + + PRODUCT_NAME_EXIST_EN("P0510", "Product name already exists, please reenter"), + + PRODUCT_BAR_CODE_EXIST("P0511", "商品条码已存在,请重新输入"), + + PRODUCT_BAR_CODE_EXIST_EN("P0511", "Product barcode already exists, please reenter"), + + PRODUCT_ADD_SUCCESS("P0010", "成功添加商品"), + + PRODUCT_ADD_SUCCESS_EN("P0010", "Successfully add product"), + + PRODUCT_ADD_ERROR("P0512", "系统异常,添加商品信息失败"), + + PRODUCT_ADD_ERROR_EN("P0512", "System exception, failed to add product information"), + + PRODUCT_UPDATE_SUCCESS("P0011", "成功修改商品信息"), + + PRODUCT_UPDATE_SUCCESS_EN("P0011", "Successfully modify product information"), + + PRODUCT_UPDATE_ERROR("P0513", "系统异常,修改商品失败"), + + PRODUCT_UPDATE_ERROR_EN("P0513", "System exception, failed to modify product information"), + + PRODUCT_DELETE_SUCCESS("P0012", "成功删除商品"), + + PRODUCT_DELETE_SUCCESS_EN("P0012", "Successfully delete product"), + + PRODUCT_DELETE_ERROR("P0514", "系统异常,删除商品失败"), - PRODUCT_BAR_CODE_EXIST("P0511", "商品条码已存在"), + PRODUCT_DELETE_ERROR_EN("P0514", "System exception, failed to delete product"), - PRODUCT_ADD_SUCCESS("P0010", "添加商品成功"), + PRODUCT_STATUS_UPDATE_SUCCESS("P0013", "成功修改商品状态"), - PRODUCT_ADD_ERROR("P0512", "添加商品失败"), + PRODUCT_STATUS_UPDATE_SUCCESS_EN("P0013", "Successfully modify product status"), - PRODUCT_UPDATE_SUCCESS("P0011", "修改商品成功"), + PRODUCT_STATUS_UPDATE_ERROR("P0515", "系统异常,修改商品状态失败"), - PRODUCT_UPDATE_ERROR("P0513", "修改商品失败"), + PRODUCT_STATUS_UPDATE_ERROR_EN("P0515", "System exception, failed to modify product status"), - PRODUCT_DELETE_SUCCESS("P0012", "删除商品成功"), + PRODUCT_BATCH_UPDATE_SUCCESS("P0014", "成功批量修改商品信息"), - PRODUCT_DELETE_ERROR("P0514", "删除商品失败"), + PRODUCT_BATCH_UPDATE_SUCCESS_EN("P0014", "Successfully batch modify product information"), - PRODUCT_STATUS_UPDATE_SUCCESS("P0013", "修改商品状态成功"), + PRODUCT_BATCH_UPDATE_ERROR("P0516", "系统异常,批量修改商品信息失败"), - PRODUCT_STATUS_UPDATE_ERROR("P0515", "修改商品状态失败"), + PRODUCT_BATCH_UPDATE_ERROR_EN("P0516", "System exception, failed to batch modify product information"), - PRODUCT_BATCH_UPDATE_SUCCESS("P0014", "批量修改商品成功"), + PRODUCT_BAR_CODE_NOT_DUPLICATED("P0517", "商品条码不能重复,请重新输入"), - PRODUCT_BATCH_UPDATE_ERROR("P0516", "批量修改商品失败"); + PRODUCT_BAR_CODE_NOT_DUPLICATED_EN("P0517", "Product barcode cannot be repeated, please reenter"); private final String code; From d05888523b04272f484207fa1958941a6292ec98 Mon Sep 17 00:00:00 2001 From: Jzow Date: Thu, 1 Aug 2024 20:49:38 +0800 Subject: [PATCH 4/4] Fix the syntax error in the import module, change the response object returned from message to notification --- web/src/api/product/product.ts | 2 +- web/src/api/purchase/order.ts | 8 ++++---- web/src/api/purchase/refund.ts | 8 ++++---- web/src/api/purchase/storage.ts | 8 ++++---- web/src/utils/http/axios/index.ts | 6 +++--- .../views/product/info/components/ProductInfoModal.vue | 8 ++++---- web/src/views/purchase/refund/index.vue | 3 --- web/src/views/purchase/storage/index.vue | 3 --- 8 files changed, 20 insertions(+), 26 deletions(-) diff --git a/web/src/api/product/product.ts b/web/src/api/product/product.ts index a37bdb61..f4cc46f8 100644 --- a/web/src/api/product/product.ts +++ b/web/src/api/product/product.ts @@ -1,4 +1,4 @@ -import {defHttp} from '/@/utils/http/axios'; +import {defHttp} from '@/utils/http/axios'; import {BaseDataResp, BaseResp} from "@/api/model/baseModel"; import { AddProductReq, diff --git a/web/src/api/purchase/order.ts b/web/src/api/purchase/order.ts index 4520c092..b85ad5de 100644 --- a/web/src/api/purchase/order.ts +++ b/web/src/api/purchase/order.ts @@ -1,4 +1,4 @@ -import {defHttp} from '/@/utils/http/axios'; +import {defHttp} from '@/utils/http/axios'; import {BaseDataResp, BaseResp} from "@/api/model/baseModel"; import { QueryPurchaseOrderReq, @@ -27,7 +27,7 @@ export function getPurchaseOrderPageList(params: QueryPurchaseOrderReq) { ); } -export function addOrUpdatePurchaseOrder(params: AddOrUpdateReceiptReq, successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'message') { +export function addOrUpdatePurchaseOrder(params: AddOrUpdateReceiptReq, successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'notice') { return defHttp.post( { url: API.AddOrUpdate, @@ -55,7 +55,7 @@ export function getLinkOrderDetail(receiptNumber: string) { ); } -export function updatePurchaseOrderStatus(ids: number[], status: number, successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'message') { +export function updatePurchaseOrderStatus(ids: number[], status: number, successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'notice') { return defHttp.put( { url: `${API.UpdateStatus}/${ids}/${status}`, @@ -66,7 +66,7 @@ export function updatePurchaseOrderStatus(ids: number[], status: number, success ); } -export function deletePurchaseOrder(ids: number[], successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'message') { +export function deletePurchaseOrder(ids: number[], successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'notice') { return defHttp.put( { url: `${API.Delete}/${ids}`, diff --git a/web/src/api/purchase/refund.ts b/web/src/api/purchase/refund.ts index 0e62740d..81b82e8e 100644 --- a/web/src/api/purchase/refund.ts +++ b/web/src/api/purchase/refund.ts @@ -1,4 +1,4 @@ -import {defHttp} from '/@/utils/http/axios'; +import {defHttp} from '@/utils/http/axios'; import {BaseDataResp, BaseResp} from "@/api/model/baseModel"; import { QueryPurchaseRefundReq, @@ -27,7 +27,7 @@ export function getPurchaseRefundPageList(params: QueryPurchaseRefundReq) { ); } -export function addOrUpdatePurchaseRefund(params: AddOrUpdatePurchaseRefundReq, successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'message') { +export function addOrUpdatePurchaseRefund(params: AddOrUpdatePurchaseRefundReq, successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'notice') { return defHttp.post( { url: API.AddOrUpdate, @@ -47,7 +47,7 @@ export function getPurchaseRefundDetail(id: string) { ); } -export function updatePurchaseRefundStatus(ids: number[], status: number, successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'message') { +export function updatePurchaseRefundStatus(ids: number[], status: number, successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'notice') { return defHttp.put( { url: `${API.UpdateStatus}/${ids}/${status}`, @@ -58,7 +58,7 @@ export function updatePurchaseRefundStatus(ids: number[], status: number, succes ); } -export function deletePurchaseRefund(ids: number[], successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'message') { +export function deletePurchaseRefund(ids: number[], successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'notice') { return defHttp.put( { url: `${API.Delete}/${ids}`, diff --git a/web/src/api/purchase/storage.ts b/web/src/api/purchase/storage.ts index 56c3f0d5..4b24ae16 100644 --- a/web/src/api/purchase/storage.ts +++ b/web/src/api/purchase/storage.ts @@ -1,4 +1,4 @@ -import {defHttp} from '/@/utils/http/axios'; +import {defHttp} from '@/utils/http/axios'; import {BaseDataResp, BaseResp} from "@/api/model/baseModel"; import { QueryPurchaseStorageReq, @@ -27,7 +27,7 @@ export function getPurchaseStoragePageList(params: QueryPurchaseStorageReq) { ); } -export function addOrUpdatePurchaseStorage(params: AddOrUpdatePurchaseStorageReq, successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'message') { +export function addOrUpdatePurchaseStorage(params: AddOrUpdatePurchaseStorageReq, successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'notice') { return defHttp.post( { url: API.AddOrUpdate, @@ -47,7 +47,7 @@ export function getPurchaseStorageDetail(id: string) { ); } -export function updatePurchaseStorageStatus(ids: number[], status: number, successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'message') { +export function updatePurchaseStorageStatus(ids: number[], status: number, successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'notice') { return defHttp.put( { url: `${API.UpdateStatus}/${ids}/${status}`, @@ -58,7 +58,7 @@ export function updatePurchaseStorageStatus(ids: number[], status: number, succe ); } -export function deletePurchaseStorage(ids: number[], successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'message') { +export function deletePurchaseStorage(ids: number[], successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'notice') { return defHttp.put( { url: `${API.Delete}/${ids}`, diff --git a/web/src/utils/http/axios/index.ts b/web/src/utils/http/axios/index.ts index 7649249b..fc673585 100644 --- a/web/src/utils/http/axios/index.ts +++ b/web/src/utils/http/axios/index.ts @@ -63,11 +63,11 @@ const transform: AxiosTransform = { 'S0016', 'S0017', 'S0018', 'S0013', 'S0014', 'S0015', 'S0010', 'S0011', 'S0012', 'A0020', 'A0021', 'A0022', 'D0001', 'D0002', 'D0003', 'F0000', 'F0002', 'F0003', 'F0004', 'F0005', 'F0006', 'F0007', 'I0001', 'I0002', 'I0003', 'I0004', 'I0005', 'I0006', 'E0004', 'E0005', 'E0006', 'T0001', 'T0002', 'T0003', 'C0001', 'C0003', 'C0004', 'P0024', 'P0025', 'P0026', 'P0001', 'P0000', - 'P0002', 'P0003', 'P0004', 'P0005', 'P0006', 'P0007', 'P0008', 'P0009', 'P0010', 'P0011', 'P 0012', 'P0013', 'P0014', 'U0001', + 'P0002', 'P0003', 'P0004', 'P0005', 'P0006', 'P0007', 'P0008', 'P0009', 'P0010', 'P0011', 'P0012', 'P0013', 'P0014', 'U0001', 'U0002', 'U0003', 'U0004', 'M0001', 'M0002', 'M0003', 'M0004', 'W0001', 'W0002', 'W0003', 'W0004', 'O0001', 'O0002', 'O0003', 'O0004', 'A0012', 'A0016', 'A0100', 'A0101', 'A0017', 'A0300', 'A0301', 'A0304','A0307']; // 定义包含可能值的数组 - const warningCodes = ['A0404', 'A0113', 'A0502', 'B0010', 'B0020']; + const infoCodes = ['A0404', 'A0113', 'A0502', 'B0010', 'B0020', 'P0517', 'P0511']; if (validCodes.includes(res.data.code) || res.data.code === undefined) { if (options.successMessageMode === 'message') { @@ -83,7 +83,7 @@ const transform: AxiosTransform = { } return res.data; // add info here to handle warning codes - } else if (warningCodes.includes(res.data.code)) { + } else if (infoCodes.includes(res.data.code)) { if (options.errorMessageMode === 'message') { createMessage.info(res.data.msg); } else if (options.errorMessageMode === 'modal') { diff --git a/web/src/views/product/info/components/ProductInfoModal.vue b/web/src/views/product/info/components/ProductInfoModal.vue index 79c72f00..80fae44f 100644 --- a/web/src/views/product/info/components/ProductInfoModal.vue +++ b/web/src/views/product/info/components/ProductInfoModal.vue @@ -370,9 +370,9 @@ import { UploadChangeParam, } from "ant-design-vue"; import {cloneDeep} from 'lodash-es'; -import {getUnitList} from "/@/api/product/productUnit"; -import {getCategoryList} from "/@/api/product/productCategory"; -import {ProductUnitQueryReq} from "/@/api/product/model/productUnitModel"; +import {getUnitList} from "@/api/product/productUnit"; +import {getCategoryList} from "@/api/product/productCategory"; +import {ProductUnitQueryReq} from "@/api/product/model/productUnitModel"; import {DefaultOptionType} from "ant-design-vue/es/vc-tree-select/TreeSelect"; import {getProductInfoDetail, addOrUpdateProduct} from "@/api/product/product"; import {getAttributeById, getAttributeList} from "@/api/product/productAttribute"; @@ -385,7 +385,7 @@ import UnitModal from "@/views/product/units/components/UnitModal.vue"; import {useModal} from "@/components/Modal"; import {AddProductImageReq, AddProductReq} from "@/api/product/model/productModel"; -import {ProductCategoryResp} from '/@/api/product/model/productCategoryModel'; +import {ProductCategoryResp} from '@/api/product/model/productCategoryModel'; import {ProductAttributeListReq} from "@/api/product/model/productAttributeModel"; import {ProductAttributeModel, ProductStockModel, Unit} from "@/views/product/info/model/productInfoModel"; import {meTable, stock, productInfo, formState} from "@/views/product/info/info.data"; diff --git a/web/src/views/purchase/refund/index.vue b/web/src/views/purchase/refund/index.vue index f0445485..4cbe4cb5 100644 --- a/web/src/views/purchase/refund/index.vue +++ b/web/src/views/purchase/refund/index.vue @@ -118,7 +118,6 @@ export default defineComponent({ } const result = await deletePurchaseRefund(data.map((item) => item.id)); if (result.code === 'P0023') { - createMessage.success('删除成功'); await reload(); } } @@ -134,7 +133,6 @@ export default defineComponent({ async function handleDelete(record: Recordable) { const result = await deletePurchaseRefund([record.id]); if (result.code === 'P0023') { - createMessage.success('删除成功'); await reload(); } } @@ -178,7 +176,6 @@ export default defineComponent({ const ids = data.map((item) => item.id); const {code} = await updatePurchaseRefundStatus(ids, newStatus); if (code === 'P0022') { - createMessage.success('修改状态成功'); await reload(); } } diff --git a/web/src/views/purchase/storage/index.vue b/web/src/views/purchase/storage/index.vue index e1365e26..e3632c9c 100644 --- a/web/src/views/purchase/storage/index.vue +++ b/web/src/views/purchase/storage/index.vue @@ -117,7 +117,6 @@ export default defineComponent({ } const result = await deletePurchaseStorage(data.map((item) => item.id)); if (result.code === 'P0020') { - createMessage.success('删除成功'); await reload(); } } @@ -133,7 +132,6 @@ export default defineComponent({ async function handleDelete(record: Recordable) { const result = await deletePurchaseStorage([record.id]); if (result.code === 'P0020') { - createMessage.success('删除成功'); await reload(); } } @@ -180,7 +178,6 @@ export default defineComponent({ const ids = data.map((item) => item.id); const {code} = await updatePurchaseStorageStatus(ids, newStatus); if (code === 'P0019') { - createMessage.success('修改状态成功'); await reload(); } }