From 18cfe1dfbe035089d1f132850004a74641f253b5 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期四, 16 四月 2026 15:17:48 +0800
Subject: [PATCH] feat: 部件已产品绑定
---
src/main/java/com/ruoyi/production/controller/ProductProcessController.java | 4
src/main/resources/mapper/production/ProductProcessMapper.xml | 25 ++++-
src/main/java/com/ruoyi/production/service/impl/ProductProcessServiceImpl.java | 150 ++++++++++++++++++++++++-----
src/main/java/com/ruoyi/production/dto/ProductProcessDto.java | 4
src/main/java/com/ruoyi/production/dto/ProductProcessImportDto.java | 62 ++++++++++++
src/main/java/com/ruoyi/production/mapper/ProductProcessMapper.java | 3
doc/君歌化工.sql | 15 ++
src/main/java/com/ruoyi/production/pojo/ProductProcess.java | 23 ++--
src/main/java/com/ruoyi/production/service/ProductProcessService.java | 1
9 files changed, 239 insertions(+), 48 deletions(-)
diff --git "a/doc/\345\220\233\346\255\214\345\214\226\345\267\245.sql" "b/doc/\345\220\233\346\255\214\345\214\226\345\267\245.sql"
index 74e2723..446d326 100644
--- "a/doc/\345\220\233\346\255\214\345\214\226\345\267\245.sql"
+++ "b/doc/\345\220\233\346\255\214\345\214\226\345\267\245.sql"
@@ -3,4 +3,17 @@
MODIFY COLUMN `no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '宸ュ簭缂栧彿' AFTER `name`,
MODIFY COLUMN `type` int NULL DEFAULT NULL COMMENT '绫诲瀷1-鍔犲伐锛�2-鍒澘鍐疯姱鍒朵綔銆�3-绠¤矾缁勫銆�4-缃愪綋杩炴帴鍙婅皟璇曪紝5-娴嬭瘯鎵撳帇锛�6-鍏朵粬' AFTER `is_quality`;
ALTER TABLE `product-inventory-management-jghg`.`product_process`
- COMMENT = '宸ュ簭琛�';
\ No newline at end of file
+ COMMENT = '宸ュ簭琛�';
+
+ALTER TABLE `product-inventory-management-jghg`.`product_process`
+ MODIFY COLUMN `salary_quota` decimal(16, 3) NULL DEFAULT NULL COMMENT '璁″垝宸ユ椂' AFTER `tenant_id`;
+
+ALTER TABLE `product_process`
+ ADD COLUMN `planner_id` bigint NULL COMMENT '璁″垝浜哄憳ID' AFTER `device_ledger_id`,
+ ADD COLUMN `planner_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '璁″垝浜哄憳濮撳悕' AFTER `planner_id`;
+
+ALTER TABLE `product-inventory-management-jghg`.`product_process`
+ ADD COLUMN `product_model_id` bigint NULL COMMENT '浜у搧ID' AFTER `id`,
+ MODIFY COLUMN `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '宸ュ簭鍚嶇О' AFTER `no`,
+ MODIFY COLUMN `create_time` datetime NULL DEFAULT NULL COMMENT '褰曞叆鏃堕棿' AFTER `dept_id`,
+ MODIFY COLUMN `update_time` datetime NULL DEFAULT NULL COMMENT '鏇存柊鏃堕棿' AFTER `create_time`;
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/production/controller/ProductProcessController.java b/src/main/java/com/ruoyi/production/controller/ProductProcessController.java
index 1c73956..ea01b69 100644
--- a/src/main/java/com/ruoyi/production/controller/ProductProcessController.java
+++ b/src/main/java/com/ruoyi/production/controller/ProductProcessController.java
@@ -8,7 +8,7 @@
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.production.dto.ProductProcessDto;
-import com.ruoyi.production.pojo.ProductProcess;
+import com.ruoyi.production.dto.ProductProcessImportDto;
import com.ruoyi.production.service.ProductProcessService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -78,7 +78,7 @@
@PostMapping("/downloadTemplate")
@Log(title = "宸ュ簭-涓嬭浇妯℃澘", businessType = BusinessType.EXPORT)
public void downloadTemplate(HttpServletResponse response) {
- ExcelUtil<ProductProcess> util = new ExcelUtil<>(ProductProcess.class);
+ ExcelUtil<ProductProcessImportDto> util = new ExcelUtil<>(ProductProcessImportDto.class);
util.importTemplateExcel(response, "宸ュ簭妯℃澘");
}
}
diff --git a/src/main/java/com/ruoyi/production/dto/ProductProcessDto.java b/src/main/java/com/ruoyi/production/dto/ProductProcessDto.java
index 7383a82..c48ee9f 100644
--- a/src/main/java/com/ruoyi/production/dto/ProductProcessDto.java
+++ b/src/main/java/com/ruoyi/production/dto/ProductProcessDto.java
@@ -10,4 +10,8 @@
@Data
@ApiModel
public class ProductProcessDto extends ProductProcess {
+
+ @ApiModelProperty("浜у搧瑙勬牸")
+ private String productModel;
+
}
diff --git a/src/main/java/com/ruoyi/production/dto/ProductProcessImportDto.java b/src/main/java/com/ruoyi/production/dto/ProductProcessImportDto.java
new file mode 100644
index 0000000..10dc2b2
--- /dev/null
+++ b/src/main/java/com/ruoyi/production/dto/ProductProcessImportDto.java
@@ -0,0 +1,62 @@
+package com.ruoyi.production.dto;
+
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * <br>
+ * 閮ㄤ欢瀵煎叆瀵硅薄
+ * </br>
+ *
+ * @author deslrey
+ * @version 1.0
+ * @since 2026/4/16 13:26
+ */
+@Data
+public class ProductProcessImportDto {
+
+ /**
+ * 閮ㄤ欢鍚嶇О
+ */
+ @Excel(name = "閮ㄤ欢鍚嶇О")
+ private String name;
+
+ /**
+ * 閮ㄤ欢瑙勬牸
+ */
+ @Excel(name = "閮ㄤ欢瑙勬牸")
+ private String productModel;
+
+ /**
+ * 宸ュ簭缂栧彿
+ */
+ @Excel(name = "閮ㄤ欢缂栧彿")
+ private String no;
+
+ /**
+ * 璁″垝宸ユ椂
+ */
+ @Excel(name = "璁″垝宸ユ椂")
+ private BigDecimal salaryQuota;
+
+ /**
+ * 閮ㄤ欢绫诲瀷
+ */
+ @Excel(name = "閮ㄤ欢绫诲瀷")
+ private String productProcessType;
+
+ /**
+ * 璁″垝浜哄憳濮撳悕
+ */
+ @Excel(name = "璁″垝浜哄憳濮撳悕")
+ private String plannerName;
+
+ /**
+ * 澶囨敞
+ */
+ @Excel(name = "澶囨敞")
+ private String remark;
+
+}
diff --git a/src/main/java/com/ruoyi/production/mapper/ProductProcessMapper.java b/src/main/java/com/ruoyi/production/mapper/ProductProcessMapper.java
index b2168c3..7f8aadd 100644
--- a/src/main/java/com/ruoyi/production/mapper/ProductProcessMapper.java
+++ b/src/main/java/com/ruoyi/production/mapper/ProductProcessMapper.java
@@ -14,7 +14,8 @@
@Mapper
public interface ProductProcessMapper extends BaseMapper<ProductProcess> {
- IPage<ProductProcessDto> listPage(Page page,@Param("productProcessDto") ProductProcessDto productProcessDto);
+
+ IPage<ProductProcessDto> listPage(Page page, @Param("productProcessDto") ProductProcessDto productProcessDto);
List<processDataProductionStatisticsDto> calculateProductionStatistics(LocalDateTime startDateTime, LocalDateTime endDateTime, Long userId, List<Long> processIds);
}
diff --git a/src/main/java/com/ruoyi/production/pojo/ProductProcess.java b/src/main/java/com/ruoyi/production/pojo/ProductProcess.java
index f3a19a3..207890b 100644
--- a/src/main/java/com/ruoyi/production/pojo/ProductProcess.java
+++ b/src/main/java/com/ruoyi/production/pojo/ProductProcess.java
@@ -1,9 +1,7 @@
package com.ruoyi.production.pojo;
-import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -15,7 +13,6 @@
@TableName("product_process")
@Data
-@ExcelIgnoreUnannotated
@ApiModel(value = "productProcess", description = "宸ュ簭琛�")
public class ProductProcess implements Serializable {
@@ -24,23 +21,26 @@
@TableId(value = "id", type = IdType.AUTO)
private Long id;
+
+ /**
+ * 浜у搧瑙勬牸ID
+ */
+ private Long productModelId;
+
/**
* 宸ュ簭鍚嶇О
*/
- @Excel(name = "閮ㄤ欢鍚嶇О")
private String name;
/**
* 宸ュ簭缂栧彿
*/
- @Excel(name = "閮ㄤ欢缂栧彿")
private String no;
/**
* 宸ヨ祫瀹氶
*/
- @Excel(name = "宸ヨ祫瀹氶")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private BigDecimal salaryQuota;
@@ -48,14 +48,9 @@
@ApiModelProperty("绫诲瀷1-鍔犲伐锛�2-鍒澘鍐疯姱鍒朵綔銆�3-绠¤矾缁勫銆�4-缃愪綋杩炴帴鍙婅皟璇曪紝5-娴嬭瘯鎵撳帇锛�6-鍏朵粬")
private Integer type;
- @TableField(exist = false)
- @Excel(name = "閮ㄤ欢绫诲瀷")
- private String ProductProcessType;
-
/**
* 澶囨敞
*/
- @Excel(name = "澶囨敞")
private String remark;
/**
@@ -91,4 +86,10 @@
@TableField(fill = FieldFill.INSERT)
private Long deptId;
+ @ApiModelProperty("璁″垝浜哄憳ID")
+ private Long plannerId;
+
+ @ApiModelProperty("璁″垝浜哄憳濮撳悕")
+ private String plannerName;
+
}
diff --git a/src/main/java/com/ruoyi/production/service/ProductProcessService.java b/src/main/java/com/ruoyi/production/service/ProductProcessService.java
index f893f63..c2d179d 100644
--- a/src/main/java/com/ruoyi/production/service/ProductProcessService.java
+++ b/src/main/java/com/ruoyi/production/service/ProductProcessService.java
@@ -14,6 +14,7 @@
* @date : 2025/7/21 14:39
*/
public interface ProductProcessService extends IService<ProductProcess> {
+
IPage<ProductProcessDto> listPage(Page page, ProductProcessDto productProcessDto);
void add(ProductProcessDto productProcessDto);
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductProcessServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductProcessServiceImpl.java
index 65e3392..5e26bdd 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductProcessServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductProcessServiceImpl.java
@@ -1,13 +1,20 @@
package com.ruoyi.production.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.basic.pojo.Product;
+import com.ruoyi.basic.pojo.ProductModel;
+import com.ruoyi.basic.service.IProductModelService;
+import com.ruoyi.basic.service.IProductService;
import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.production.dto.ProductProcessDto;
+import com.ruoyi.production.dto.ProductProcessImportDto;
import com.ruoyi.production.enums.ProductProcessEnum;
import com.ruoyi.production.mapper.ProcessRouteItemMapper;
import com.ruoyi.production.mapper.ProductProcessMapper;
@@ -16,6 +23,9 @@
import com.ruoyi.production.pojo.ProductProcess;
import com.ruoyi.production.pojo.ProductProcessRouteItem;
import com.ruoyi.production.service.ProductProcessService;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.mapper.SysUserMapper;
+import com.ruoyi.project.system.service.ISysUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -24,11 +34,14 @@
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
+import java.math.BigDecimal;
+import java.util.ArrayList;
import java.util.List;
@Slf4j
@Service
-public class ProductProcessServiceImpl extends ServiceImpl<ProductProcessMapper, ProductProcess> implements ProductProcessService {
+public class ProductProcessServiceImpl extends ServiceImpl<ProductProcessMapper, ProductProcess>
+ implements ProductProcessService {
@Autowired
private ProductProcessMapper productProcessMapper;
@@ -38,6 +51,15 @@
@Autowired
private ProductProcessRouteItemMapper productProcessRouteItemMapper;
+
+ @Autowired
+ private IProductModelService productModelService;
+
+ @Autowired
+ private IProductService productService;
+
+ @Autowired
+ private SysUserMapper sysUserMapper;
@Override
public IPage<ProductProcessDto> listPage(Page page, ProductProcessDto productProcessDto) {
@@ -50,10 +72,6 @@
if (ObjectUtils.isEmpty(productProcessDto.getName())) {
throw new ServiceException("閮ㄤ欢鍚嶇О涓嶈兘涓虹┖");
}
- long count = this.count(Wrappers.<ProductProcess>lambdaQuery().eq(ProductProcess::getName, productProcessDto.getName()));
- if (count > 0) {
- throw new ServiceException("閮ㄤ欢鍚嶇О宸插瓨鍦紝涓嶈兘閲嶅");
- }
if (ObjectUtils.isNotEmpty(productProcessDto.getNo())) {
long noCount = this.count(Wrappers.<ProductProcess>lambdaQuery().eq(ProductProcess::getNo, productProcessDto.getNo()));
@@ -61,13 +79,28 @@
throw new ServiceException("宸ュ簭缂栧彿宸插瓨鍦紝涓嶈兘閲嶅");
}
}
+ // 鍒ゆ柇璁″垝宸ユ椂鏄惁涓虹┖
+ if (ObjectUtils.isEmpty(productProcessDto.getSalaryQuota())) {
+ throw new ServiceException("鏂板澶辫触,璁″垝宸ユ椂涓嶈兘涓虹┖");
+ }
+ // 鍒ゆ柇浜у搧鏄惁瀛樺湪
+ if (ObjectUtils.isEmpty(productProcessDto.getProductModelId())) {
+ throw new ServiceException("鏂板澶辫触,閮ㄤ欢涓嶈兘涓虹┖");
+ }
+ ProductModel productModel = productModelService.getById(productProcessDto.getProductModelId());
+ if (productModel == null) {
+ throw new ServiceException("鏂板澶辫触,璇ラ儴浠朵笉瀛樺湪");
+ }
ProductProcess productProcess = new ProductProcess();
BeanUtils.copyProperties(productProcessDto, productProcess);
+ productProcess.setProductModelId(productModel.getId());
+
+ validatePlanner(productProcessDto.getPlannerId(), productProcessDto.getPlannerName(), null);
+
boolean save = productProcessMapper.insert(productProcess) > 0;
if (save && ObjectUtils.isEmpty(productProcess.getNo())) {
String no = "GX" + String.format("%08d", productProcess.getId());
- // 娉ㄦ剰锛氳繖閲岀敱浜庢槸鑷姩鐢熸垚鐨� ID 琛ュ叏锛岄�氬父涓嶄細閲嶅锛屼絾寤鸿 set 涔嬪悗鏇存柊
productProcess.setNo(no);
productProcessMapper.updateById(productProcess);
}
@@ -79,13 +112,6 @@
if (ObjectUtils.isEmpty(productProcessDto.getName())) {
throw new ServiceException("閮ㄤ欢鍚嶇О涓嶈兘涓虹┖");
}
-
- long nameCount = this.count(Wrappers.<ProductProcess>lambdaQuery()
- .eq(ProductProcess::getName, productProcessDto.getName())
- .ne(ProductProcess::getId, productProcessDto.getId()));
- if (nameCount > 0) {
- throw new ServiceException("閮ㄤ欢鍚嶇О宸插瓨鍦紝涓嶈兘閲嶅");
- }
if (ObjectUtils.isNotEmpty(productProcessDto.getNo())) {
long noCount = this.count(Wrappers.<ProductProcess>lambdaQuery()
.eq(ProductProcess::getNo, productProcessDto.getNo())
@@ -94,6 +120,17 @@
throw new ServiceException("宸ュ簭缂栧彿宸插瓨鍦紝涓嶈兘閲嶅");
}
}
+
+ // 鍒ゆ柇鍏宠仈浜у搧鏄惁瀛樺湪
+ if (ObjectUtils.isNotEmpty(productProcessDto.getProductModelId())) {
+ ProductModel productModel = productModelService.getById(productProcessDto.getProductModelId());
+ if (productModel == null) {
+ throw new ServiceException("淇敼澶辫触锛屽叧鑱旈儴浠朵笉瀛樺湪");
+ }
+ }
+
+ // 鏍¢獙璁″垝浜哄憳
+ validatePlanner(productProcessDto.getPlannerId(), productProcessDto.getPlannerName(), null);
ProductProcess productProcess = new ProductProcess();
BeanUtils.copyProperties(productProcessDto, productProcess);
@@ -104,31 +141,66 @@
@Transactional(rollbackFor = Exception.class)
public void importData(MultipartFile file) {
try {
- ExcelUtil<ProductProcess> util = new ExcelUtil<>(ProductProcess.class);
- List<ProductProcess> productProcessList = util.importExcel(file.getInputStream());
- if (CollectionUtils.isEmpty(productProcessList)) {
+ ExcelUtil<ProductProcessImportDto> util = new ExcelUtil<>(ProductProcessImportDto.class);
+ List<ProductProcessImportDto> importList = util.importExcel(file.getInputStream());
+ if (CollectionUtils.isEmpty(importList)) {
throw new ServiceException("妯℃澘閿欒鎴栧鍏ユ暟鎹负绌�");
}
- for (int i = 0; i < productProcessList.size(); i++) {
- ProductProcess productProcess = productProcessList.get(i);
+ List<ProductProcess> productProcessList = new ArrayList<>();
+ for (int i = 0; i < importList.size(); i++) {
+ ProductProcessImportDto importDto = importList.get(i);
int rowNum = i + 2;
+ SysUser sysUser = null;
- if (ObjectUtils.isEmpty(productProcess)) {
+ if (ObjectUtils.isEmpty(importDto)) {
throw new ServiceException("绗�" + rowNum + "琛屾暟鎹负绌猴紝璇蜂娇鐢ㄦ纭殑妯℃澘杩涜瀵煎叆");
}
- if (ObjectUtils.isEmpty(productProcess.getName())) {
+ if (ObjectUtils.isEmpty(importDto.getName())) {
throw new ServiceException("绗�" + rowNum + "琛岋細閮ㄤ欢鍚嶇О涓嶈兘涓虹┖");
}
- if (ObjectUtils.isEmpty(productProcess.getProductProcessType())) {
- throw new ServiceException("绗�" + rowNum + "琛岋細閮ㄤ欢銆�" + productProcess.getName() + "銆戠殑绫诲瀷涓嶈兘涓虹┖");
+ if (ObjectUtils.isEmpty(importDto.getProductModel())) {
+ throw new ServiceException("绗�" + rowNum + "琛岋細閮ㄤ欢瑙勬牸涓嶈兘涓虹┖");
}
- ProductProcessEnum enumByInfo = ProductProcessEnum.getEnumByInfo(productProcess.getProductProcessType());
+ // 妫�楠屼骇鍝佷笌绫诲瀷鏄惁瀛樺湪
+ Product product = productService.getOne(new LambdaQueryWrapper<Product>().eq(Product::getProductName, importDto.getName()));
+ if (product == null) {
+ throw new ServiceException("绗�" + rowNum + "琛�: 閮ㄤ欢銆�" + importDto.getName() + "銆戜笉瀛樺湪");
+ }
+ ProductModel productModel = productModelService.getOne(new LambdaQueryWrapper<ProductModel>().eq(ProductModel::getProductId, product.getId()).eq(ProductModel::getModel, importDto.getProductModel()));
+ if (ObjectUtils.isEmpty(productModel)) {
+ throw new ServiceException("绗�" + rowNum + "琛岋細閮ㄤ欢瑙勬牸銆�" + importDto.getProductModel() + "銆戜笉瀛樺湪");
+ }
+
+ if (ObjectUtils.isEmpty(importDto.getProductProcessType())) {
+ throw new ServiceException("绗�" + rowNum + "琛岋細閮ㄤ欢銆�" + importDto.getName() + "銆戠殑绫诲瀷涓嶈兘涓虹┖");
+ }
+ ProductProcessEnum enumByInfo = ProductProcessEnum.getEnumByInfo(importDto.getProductProcessType());
if (ObjectUtils.isEmpty(enumByInfo)) {
- throw new ServiceException("绗�" + rowNum + "琛岋細閮ㄤ欢銆�" + productProcess.getName() + "銆戠殑绫诲瀷銆�" + productProcess.getProductProcessType() + "銆戜笉瀛樺湪锛岃濉啓姝g‘鐨勭被鍨嬶細鍔犲伐銆佸埉鏉垮喎鑺埗浣溿�佺璺粍瀵广�佺綈浣撹繛鎺ュ強璋冭瘯銆佹祴璇曟墦鍘嬨�佸叾浠�");
- }else {
- productProcess.setType(enumByInfo.getCode());
+ throw new ServiceException("绗�" + rowNum + "琛岋細閮ㄤ欢銆�" + importDto.getName() + "銆戠殑绫诲瀷銆�"
+ + importDto.getProductProcessType() + "銆戜笉瀛樺湪锛岃濉啓姝g‘鐨勭被鍨嬶細鍔犲伐銆佸埉鏉垮喎鑺埗浣溿�佺璺粍瀵广�佺綈浣撹繛鎺ュ強璋冭瘯銆佹祴璇曟墦鍘嬨�佸叾浠�");
}
+ // 妫�楠岃鍒掑伐鏃�
+ if (importDto.getSalaryQuota() == null || importDto.getSalaryQuota().compareTo(BigDecimal.ZERO) < 0) {
+ throw new ServiceException("绗�" + rowNum + "琛岋細璁″垝宸ユ椂涓嶈兘涓虹┖涓庤礋鏁�");
+ }
+ // 妫�楠岃鍒掍汉鍛�
+ if (StringUtils.isNotEmpty(importDto.getPlannerName())) {
+ sysUser = sysUserMapper.selectUserByNickName(importDto.getPlannerName());
+ if (ObjectUtils.isEmpty(sysUser)) {
+ throw new ServiceException("绗�" + rowNum + "琛岋細璁″垝浜哄憳銆�" + importDto.getPlannerName() + "銆戜笉瀛樺湪");
+ }
+ }
+
+ ProductProcess productProcess = new ProductProcess();
+ BeanUtils.copyProperties(importDto, productProcess);
+ productProcess.setProductModelId(productModel.getId());
+ productProcess.setType(enumByInfo.getCode());
+ if (sysUser != null) {
+ productProcess.setPlannerId(sysUser.getUserId());
+ productProcess.setPlannerName(sysUser.getUserName());
+ }
+ productProcessList.add(productProcess);
}
saveOrUpdateBatch(productProcessList);
@@ -140,12 +212,34 @@
}
}
+ /**
+ * 鏍¢獙璁″垝浜哄憳鏄惁瀛樺湪
+ *
+ * @param plannerId 璁″垝浜哄憳ID
+ * @param plannerName 璁″垝浜哄憳濮撳悕
+ * @param rowNum 琛屽彿
+ */
+ private void validatePlanner(Long plannerId, String plannerName, Integer rowNum) {
+ String prefix = rowNum != null ? "绗�" + rowNum + "琛岋細" : "";
+ if (plannerId != null) {
+ if (sysUserMapper.selectUserById(plannerId) == null) {
+ throw new ServiceException(prefix + "璁″垝浜哄憳ID銆�" + plannerId + "銆戜笉瀛樺湪");
+ }
+ } else if (ObjectUtils.isNotEmpty(plannerName)) {
+ if (sysUserMapper.selectUserByNickName(plannerName) == null) {
+ throw new ServiceException(prefix + "璁″垝浜哄憳濮撳悕銆�" + plannerName + "銆戜笉瀛樺湪");
+ }
+ }
+ }
+
@Override
@Transactional(rollbackFor = Exception.class)
public void batchDelete(List<Integer> ids) {
// 鏌ヨ鏄惁鐢熶骇涓凡缁忓紩鐢ㄤ簡杩欎簺宸ュ簭
- List<ProcessRouteItem> processRouteItems = processRouteItemMapper.selectList(Wrappers.<ProcessRouteItem>lambdaQuery().in(ProcessRouteItem::getProcessId, ids));
- List<ProductProcessRouteItem> productProcessRouteItems = productProcessRouteItemMapper.selectList(Wrappers.<ProductProcessRouteItem>lambdaQuery().in(ProductProcessRouteItem::getProcessId, ids));
+ List<ProcessRouteItem> processRouteItems = processRouteItemMapper
+ .selectList(Wrappers.<ProcessRouteItem>lambdaQuery().in(ProcessRouteItem::getProcessId, ids));
+ List<ProductProcessRouteItem> productProcessRouteItems = productProcessRouteItemMapper.selectList(
+ Wrappers.<ProductProcessRouteItem>lambdaQuery().in(ProductProcessRouteItem::getProcessId, ids));
if (!CollectionUtils.isEmpty(processRouteItems) || !CollectionUtils.isEmpty(productProcessRouteItems)) {
throw new ServiceException("璇ュ伐搴忓凡缁忚浣跨敤锛屾棤娉曞垹闄�");
}
diff --git a/src/main/resources/mapper/production/ProductProcessMapper.xml b/src/main/resources/mapper/production/ProductProcessMapper.xml
index 5b1ac18..0ab44e7 100644
--- a/src/main/resources/mapper/production/ProductProcessMapper.xml
+++ b/src/main/resources/mapper/production/ProductProcessMapper.xml
@@ -4,18 +4,33 @@
<select id="listPage" resultType="com.ruoyi.production.dto.ProductProcessDto">
SELECT
- *
+ pp.id,
+ pp.no,
+ pp.remark,
+ pp.salary_quota,
+ pp.is_quality,
+ pp.planner_id,
+ pp.planner_name,
+ pp.update_time,
+ pp.type,
+ p.product_name AS name,
+ pm.model AS productModel
FROM
- product_process p
+ product_process pp
+ left join product_model pm ON pm.id = pp.product_model_id
+ left join product p ON p.id = pm.product_id
<where>
<if test="productProcessDto.name != null and productProcessDto.name != '' ">
- AND p.name LIKE CONCAT('%',#{productProcessDto.name},'%')
+ AND p.product_name LIKE CONCAT('%',#{productProcessDto.name},'%')
</if>
<if test="productProcessDto.no != null and productProcessDto.no != '' ">
- AND p.no LIKE CONCAT('%',#{productProcessDto.no},'%')
+ AND pp.no LIKE CONCAT('%',#{productProcessDto.no},'%')
+ </if>
+ <if test="productProcessDto.type != null">
+ AND pp.type = #{productProcessDto.type}
</if>
</where>
- order by p.id asc
+ order by pp.id asc
</select>
<select id="calculateProductionStatistics" resultType="com.ruoyi.home.dto.processDataProductionStatisticsDto">
--
Gitblit v1.9.3