From f5ee8e7afb178179c1d1d078cf42fe33dc7607f9 Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期三, 20 五月 2026 16:02:59 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_New_pro' into dev_New_pro
---
src/main/java/com/ruoyi/quality/service/impl/QualityInspectServiceImpl.java | 1
src/main/java/com/ruoyi/stock/dto/StockOutRecordDto.java | 4
src/main/java/com/ruoyi/stock/dto/StockInventoryDto.java | 3
src/main/resources/mapper/stock/StockOutRecordMapper.xml | 6
src/main/java/com/ruoyi/staff/service/impl/StaffOnJobServiceImpl.java | 185 +++++++++++++++-----------
src/main/resources/mapper/stock/StockInventoryMapper.xml | 6
src/main/resources/mapper/stock/StockInRecordMapper.xml | 6
src/main/java/com/ruoyi/stock/dto/StockInRecordDto.java | 5
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java | 3
src/main/java/com/ruoyi/production/service/impl/ProductionBomStructureServiceImpl.java | 79 +++++++++-
src/main/java/com/ruoyi/sales/dto/SalesLedgerImportDto.java | 4
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java | 62 +++++---
src/main/java/com/ruoyi/sales/dto/SalesLedgerProductImportDto.java | 7
src/main/resources/static/销售台账导入模板.xlsx | 0
14 files changed, 255 insertions(+), 116 deletions(-)
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionBomStructureServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionBomStructureServiceImpl.java
index 31cdc79..200e95f 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionBomStructureServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionBomStructureServiceImpl.java
@@ -291,8 +291,15 @@
ProductionOrderBom orderBom,
List<ProductionBomStructure> structureList,
Long rootProductModelId) {
+ // 閲嶆柊鏌ヨBOM缁撴瀯锛屾寜瀛愯妭鐐逛紭鍏堟帓搴�
+ List<ProductionBomStructure> routingStructureList = this.list(
+ Wrappers.<ProductionBomStructure>lambdaQuery()
+ .eq(ProductionBomStructure::getProductionOrderBomId, orderBom.getId())
+ .orderByDesc(ProductionBomStructure::getParentId)
+ .orderByAsc(ProductionBomStructure::getId));
+
ProductionOrderRouting orderRouting = getOrCreateOrderRoutingSnapshot(productionOrderId, productionOrder, orderBom, rootProductModelId);
- List<ProductionOrderRoutingOperation> desiredOperationList = buildDesiredRoutingOperationList(structureList, rootProductModelId);
+ List<ProductionOrderRoutingOperation> desiredOperationList = buildDesiredRoutingOperationList(routingStructureList, rootProductModelId);
List<ProductionOrderRoutingOperation> existingOperationList = productionOrderRoutingOperationMapper.selectList(
Wrappers.<ProductionOrderRoutingOperation>lambdaQuery()
.eq(ProductionOrderRoutingOperation::getOrderRoutingId, orderRouting.getId())
@@ -310,7 +317,7 @@
if (matchedOperation == null) {
matchedOperation = insertRoutingOperationSnapshot(orderRouting.getId(), productionOrderId, desiredOperation);
} else {
- updateRoutingOperationSnapshotIfNecessary(desiredOperation, orderRouting.getId(), productionOrderId, matchedOperation);
+ updateRoutingOperationSnapshotIfNecessary(matchedOperation, orderRouting.getId(), productionOrderId, desiredOperation);
}
finalOperationList.add(matchedOperation);
}
@@ -381,14 +388,14 @@
Map<Long, ProductionBomStructure> structureById = structureList.stream()
.filter(item -> item != null && item.getId() != null)
.collect(Collectors.toMap(ProductionBomStructure::getId, item -> item, (left, right) -> left));
+
+ // 鏋勫缓鐖�-瀛愭槧灏勫叧绯�
+ Map<Long, List<ProductionBomStructure>> treeMap = buildParentChildMap(structureList);
+
+ // 浣跨敤鍚庡簭閬嶅巻鏋勫缓鎿嶄綔鍒楄〃锛堝厛瀛愬悗鐖讹紝纭繚宸ヨ壓璺嚎椤哄簭姝g‘锛�
Map<String, ProductionBomStructure> uniqueOperationMap = new LinkedHashMap<>();
- for (ProductionBomStructure bomStructure : structureList) {
- if (bomStructure == null || bomStructure.getTechnologyOperationId() == null) {
- continue;
- }
- Long outputProductModelId = resolveOutputProductModelId(resolveOperationOutputNode(bomStructure, structureById), rootProductModelId);
- uniqueOperationMap.putIfAbsent(buildBomOperationDedupKey(bomStructure, outputProductModelId), bomStructure);
- }
+ buildOperationListPostOrder(null, treeMap, uniqueOperationMap, structureById, rootProductModelId);
+
List<ProductionOrderRoutingOperation> desiredOperationList = new ArrayList<>();
int dragSort = 1;
for (ProductionBomStructure bomStructure : uniqueOperationMap.values()) {
@@ -405,6 +412,52 @@
desiredOperationList.add(routingOperation);
}
return desiredOperationList;
+ }
+
+ private Map<Long, List<ProductionBomStructure>> buildParentChildMap(List<ProductionBomStructure> structureList) {
+ Map<Long, List<ProductionBomStructure>> treeMap = new LinkedHashMap<>();
+ Map<Long, Integer> childCountMap = new HashMap<>();
+
+ // 绗竴閬嶏細缁熻姣忎釜鑺傜偣鐨勫瓙鑺傜偣鏁伴噺锛屽悓鏃舵瀯寤哄垵濮嬫槧灏�
+ for (ProductionBomStructure structure : structureList) {
+ if (structure == null) continue;
+ Long parentId = structure.getParentId();
+ childCountMap.merge(parentId, 1, Integer::sum); // 缁熻姣忎釜鐖惰妭鐐规湁澶氬皯涓瓙鑺傜偣
+ treeMap.computeIfAbsent(parentId, k -> new ArrayList<>()).add(structure);
+ }
+
+ // 绗簩閬嶏細瀵规瘡涓埗鑺傜偣涓嬬殑瀛愯妭鐐规寜瀛愯妭鐐规暟閲忓�掑簭鎺掑簭锛堟湁瀛愯妭鐐圭殑浼樺厛锛�
+ for (Map.Entry<Long, List<ProductionBomStructure>> entry : treeMap.entrySet()) {
+ List<ProductionBomStructure> children = entry.getValue();
+ children.sort((a, b) -> {
+ int countA = childCountMap.getOrDefault(a.getId(), 0);
+ int countB = childCountMap.getOrDefault(b.getId(), 0);
+ return Integer.compare(countB, countA); // 瀛愯妭鐐瑰鐨勬帓鍓嶉潰
+ });
+ }
+
+ return treeMap;
+ }
+
+ private void buildOperationListPostOrder(Long parentId,
+ Map<Long, List<ProductionBomStructure>> treeMap,
+ Map<String, ProductionBomStructure> uniqueOperationMap,
+ Map<Long, ProductionBomStructure> structureById,
+ Long rootProductModelId) {
+ List<ProductionBomStructure> children = treeMap.get(parentId);
+ if (children == null || children.isEmpty()) {
+ return;
+ }
+ for (ProductionBomStructure child : children) {
+ // 鍏堥�掑綊澶勭悊瀛愯妭鐐�
+ buildOperationListPostOrder(child.getId(), treeMap, uniqueOperationMap, structureById, rootProductModelId);
+
+ // 鍐嶅鐞嗗綋鍓嶈妭鐐�
+ if (child.getTechnologyOperationId() != null) {
+ Long outputProductModelId = resolveOutputProductModelId(resolveOperationOutputNode(child, structureById), rootProductModelId);
+ uniqueOperationMap.putIfAbsent(buildBomOperationDedupKey(child, outputProductModelId), child);
+ }
+ }
}
private Map<String, Deque<ProductionOrderRoutingOperation>> buildExistingRoutingOperationBucketMap(List<ProductionOrderRoutingOperation> existingOperationList) {
@@ -482,6 +535,12 @@
if (!Objects.equals(currentOperation.getIsProduction(), desiredOperation.getIsProduction())) {
update.setIsProduction(desiredOperation.getIsProduction());
currentOperation.setIsProduction(desiredOperation.getIsProduction());
+ changed = true;
+ }
+ // 鏇存柊 dragSort 瀛楁锛岀‘淇濆伐鑹鸿矾绾块『搴忔纭�
+ if (!Objects.equals(currentOperation.getDragSort(), desiredOperation.getDragSort())) {
+ update.setDragSort(desiredOperation.getDragSort());
+ currentOperation.setDragSort(desiredOperation.getDragSort());
changed = true;
}
if (!Objects.equals(currentOperation.getType(), desiredOperation.getType())) {
@@ -744,8 +803,8 @@
return;
}
for (ProductionBomStructureDto node : source) {
+ flattenTree(node.getChildren(), result); // 鍏堥�掑綊娣诲姞瀛愯妭鐐�
result.add(node);
- flattenTree(node.getChildren(), result);
}
}
diff --git a/src/main/java/com/ruoyi/quality/service/impl/QualityInspectServiceImpl.java b/src/main/java/com/ruoyi/quality/service/impl/QualityInspectServiceImpl.java
index 0f410fd..345d49c 100644
--- a/src/main/java/com/ruoyi/quality/service/impl/QualityInspectServiceImpl.java
+++ b/src/main/java/com/ruoyi/quality/service/impl/QualityInspectServiceImpl.java
@@ -126,6 +126,7 @@
String text = inspectParams.stream().map(QualityInspectParam::getParameterItem).collect(Collectors.joining(","));
qualityUnqualified.setDefectivePhenomena(text + "杩欎簺鎸囨爣涓瓨鍦ㄤ笉鍚堟牸");//涓嶅悎鏍肩幇璞�
qualityUnqualified.setInspectId(qualityInspect.getId());
+ qualityUnqualified.setId(null);
qualityUnqualifiedMapper.insert(qualityUnqualified);
}
diff --git a/src/main/java/com/ruoyi/sales/dto/SalesLedgerImportDto.java b/src/main/java/com/ruoyi/sales/dto/SalesLedgerImportDto.java
index 2430d10..0023e17 100644
--- a/src/main/java/com/ruoyi/sales/dto/SalesLedgerImportDto.java
+++ b/src/main/java/com/ruoyi/sales/dto/SalesLedgerImportDto.java
@@ -43,6 +43,10 @@
@Excel(name = "绛捐鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd")
private Date executionDate;
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "浜や粯鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date deliveryDate;
+
@Schema(description = "浠樻鏂瑰紡")
@Excel(name = "浠樻鏂瑰紡")
private String paymentMethod;
diff --git a/src/main/java/com/ruoyi/sales/dto/SalesLedgerProductImportDto.java b/src/main/java/com/ruoyi/sales/dto/SalesLedgerProductImportDto.java
index 2c95909..9f05b60 100644
--- a/src/main/java/com/ruoyi/sales/dto/SalesLedgerProductImportDto.java
+++ b/src/main/java/com/ruoyi/sales/dto/SalesLedgerProductImportDto.java
@@ -73,6 +73,9 @@
@Excel(name = "鏄惁璐ㄦ", readConverterExp = "0=鍚�,1=鏄�")
private Boolean isChecked;
-
-
+ /**
+ * 鏄惁鐢熶骇
+ */
+ @Excel(name = "鏄惁鐢熶骇", readConverterExp = "0=鍚�,1=鏄�")
+ private Integer isProduction;
}
diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java
index 8ce023b..a827cb8 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java
@@ -285,6 +285,9 @@
* 鍒犻櫎鐢熶骇璁″垝
*/
public void deleteProductionData(List<Long> productIds) {
+ if (CollectionUtils.isEmpty(productIds)) {
+ return;
+ }
List<ProductionPlan> productionPlans = productionPlanMapper.selectList(
new LambdaQueryWrapper<ProductionPlan>()
.in(ProductionPlan::getSalesLedgerProductId, productIds.stream().map(Long::intValue).collect(Collectors.toList())));
diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
index 7192707..4b16a95 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -1,6 +1,7 @@
package com.ruoyi.sales.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
@@ -27,8 +28,9 @@
import com.ruoyi.framework.security.LoginUser;
import com.ruoyi.framework.web.domain.R;
import com.ruoyi.other.mapper.TempFileMapper;
-import com.ruoyi.other.pojo.TempFile;
-import com.ruoyi.production.mapper.*;
+import com.ruoyi.production.mapper.ProductionProductInputMapper;
+import com.ruoyi.production.mapper.ProductionProductMainMapper;
+import com.ruoyi.production.mapper.ProductionProductOutputMapper;
import com.ruoyi.production.service.ProductionProductMainService;
import com.ruoyi.project.system.domain.SysDept;
import com.ruoyi.project.system.domain.SysUser;
@@ -44,7 +46,6 @@
import com.ruoyi.sales.vo.SalesLedgerVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.io.FilenameUtils;
import org.jetbrains.annotations.Nullable;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -55,15 +56,10 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
-import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.math.RoundingMode;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.StandardCopyOption;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.YearMonth;
@@ -347,9 +343,17 @@
if (CollectionUtils.isEmpty(salesLedgerImportDtoList)) return R.fail("閿�鍞彴璐︽暟鎹负绌猴紒");
List<SalesLedgerImportDto> salesLedgerProductImportDtoList = stringListMap.get("閿�鍞骇鍝佹暟鎹�");
if (CollectionUtils.isEmpty(salesLedgerProductImportDtoList)) return R.fail("閿�鍞骇鍝佹暟鎹负绌猴紒");
- // 瀹㈡埛鏁版嵁
- List<Customer> customers = customerMapper.selectList(new LambdaQueryWrapper<Customer>().in(Customer::getCustomerName,
- salesLedgerImportDtoList.stream().map(SalesLedgerImportDto::getCustomerName).collect(Collectors.toList())));
+ // 瀹㈡埛鏁版嵁 - 鍙傝�� listPage 鏌ヨ绉佹捣瀹㈡埛锛坱ype = 0锛�
+ // type = 0锛堢娴峰鎴凤級鎴栬�� type = 1锛堝叕娴峰鎴凤級涓斿凡琚垎閰嶏紝骞朵笖鏄嚜宸遍鐢ㄣ�佽嚜宸卞垱寤烘垨鑰呭叡浜粰鑷繁鐨勫鎴�
+ Long loginUserId = loginUser.getUser().getUserId();
+ List<Customer> customers = customerMapper.selectList(new QueryWrapper<Customer>()
+ .in("customer_name", salesLedgerImportDtoList.stream()
+ .map(SalesLedgerImportDto::getCustomerName).collect(Collectors.toList()))
+ .and(wrapper -> wrapper.eq("type", 0)
+ .or(wrapper2 -> wrapper2.eq("type", 1).eq("is_assigned", 1)))
+ .and(wrapper -> wrapper.eq("usage_user", loginUserId)
+ .or(wrapper2 -> wrapper2.eq("create_user", loginUserId)
+ .or(wrapper3 -> wrapper3.exists("select 1 from customer_user cu where cu.customer_id = customer.id and cu.user_id = " + loginUserId)))));
// // 瑙勬牸鍨嬪彿鏁版嵁
// List<ProductModel> productModels = productModelMapper.selectList(new LambdaQueryWrapper<ProductModel>().in(ProductModel::getModel,
// salesLedgerProductImportDtoList.stream().map(SalesLedgerImportDto::getSpecificationModel).collect(Collectors.toList())));
@@ -370,17 +374,16 @@
SalesLedger salesLedger = new SalesLedger();
BeanUtils.copyProperties(salesLedgerImportDto, salesLedger);
salesLedger.setExecutionDate(DateUtils.toLocalDate(salesLedgerImportDto.getExecutionDate()));
+ salesLedger.setDeliveryDate(DateUtils.toLocalDate(salesLedgerImportDto.getDeliveryDate()));
// 閫氳繃瀹㈡埛鍚嶇О鏌ヨ瀹㈡埛ID锛屽鎴峰悎鍚屽彿
- salesLedger.setCustomerId(customers.stream()
+ Optional<Customer> customerOptional = customers.stream()
.filter(customer -> customer.getCustomerName().equals(salesLedger.getCustomerName()))
- .findFirst()
- .map(Customer::getId)
- .orElse(null));
- salesLedger.setCustomerContractNo(customers.stream()
- .filter(customer -> customer.getCustomerName().equals(salesLedger.getCustomerName()))
- .findFirst()
- .map(Customer::getTaxpayerIdentificationNumber)
- .orElse(null));
+ .findFirst();
+ if (customerOptional.isEmpty()) {
+ throw new RuntimeException("瀹㈡埛:" + salesLedger.getCustomerName() + "涓嶅瓨鍦紒鎴栬�呴潪绉佹捣鐢ㄦ埛");
+ }
+ salesLedger.setCustomerId(customerOptional.get().getId());
+ salesLedger.setCustomerContractNo(customerOptional.get().getTaxpayerIdentificationNumber());
Long aLong = sysUsers.stream()
.filter(sysUser -> sysUser.getNickName().equals(salesLedger.getEntryPerson()))
.findFirst()
@@ -410,13 +413,16 @@
salesLedgerProduct.setTaxExclusiveTotalPrice(salesLedgerProduct.getTaxInclusiveTotalPrice().divide(new BigDecimal(1).add(salesLedgerProduct.getTaxRate().divide(new BigDecimal(100))), 2, RoundingMode.HALF_UP));
salesLedgerProduct.setNoInvoiceNum(salesLedgerProduct.getQuantity());
salesLedgerProduct.setNoInvoiceAmount(salesLedgerProduct.getTaxExclusiveTotalPrice());
- list.stream()
- .filter(map -> map.get("productName").equals(salesLedgerProduct.getProductCategory()) && map.get("model").equals(salesLedgerProduct.getSpecificationModel()))
- .findFirst()
- .ifPresent(map -> {
- salesLedgerProduct.setProductModelId(Long.parseLong(map.get("modelId").toString()));
- salesLedgerProduct.setProductId(Long.parseLong(map.get("id").toString()));
- });
+ // 鏍¢獙浜у搧瑙勬牸鏄惁瀛樺湪
+ Optional<Map<String, Object>> productModelOptional = list.stream()
+ .filter(map -> Objects.equals(map.get("productName"), salesLedgerProduct.getProductCategory()) && Objects.equals(map.get("model"), salesLedgerProduct.getSpecificationModel()))
+ .findFirst();
+ if (productModelOptional.isEmpty()) {
+ throw new RuntimeException("浜у搧澶х被:" + salesLedgerProduct.getProductCategory() + ",瑙勬牸鍨嬪彿:" + salesLedgerProduct.getSpecificationModel() + "涓嶅瓨鍦紒");
+ }
+ Map<String, Object> productModelMap = productModelOptional.get();
+ salesLedgerProduct.setProductModelId(Long.parseLong(productModelMap.get("modelId").toString()));
+ salesLedgerProduct.setProductId(Long.parseLong(productModelMap.get("id").toString()));
// salesLedgerProduct.setProductId(productList.stream()
// .filter(product -> product.getProductName().equals(salesLedgerProduct.getProductCategory()))
// .findFirst()
@@ -431,6 +437,7 @@
salesLedgerProduct.setRegisterDate(LocalDateTime.now());
salesLedgerProduct.setApproveStatus(0);
salesLedgerProduct.setPendingInvoiceTotal(salesLedgerProductImportDto.getTaxInclusiveTotalPrice());
+ salesLedgerProduct.setIsProduction(salesLedgerProductImportDto.getIsProduction() == 1);
salesLedgerProductMapper.insert(salesLedgerProduct);
// 娣诲姞鐢熶骇鏁版嵁
salesLedgerProductServiceImpl.addProductionData(salesLedgerProduct);
@@ -440,6 +447,7 @@
return R.ok(null, "瀵煎叆鎴愬姛");
} catch (Exception e) {
e.printStackTrace();
+ return R.fail("瀵煎叆澶辫触锛�" + e.getMessage());
}
return R.ok(null, "瀵煎叆澶辫触");
}
diff --git a/src/main/java/com/ruoyi/staff/service/impl/StaffOnJobServiceImpl.java b/src/main/java/com/ruoyi/staff/service/impl/StaffOnJobServiceImpl.java
index 7c11041..4f1e033 100644
--- a/src/main/java/com/ruoyi/staff/service/impl/StaffOnJobServiceImpl.java
+++ b/src/main/java/com/ruoyi/staff/service/impl/StaffOnJobServiceImpl.java
@@ -1,12 +1,13 @@
package com.ruoyi.staff.service.impl;
-
import com.baomidou.mybatisplus.core.metadata.IPage;
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.common.exception.base.BaseException;
+import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.dto.WordDateDto;
import com.ruoyi.project.system.domain.SysDept;
@@ -46,7 +47,7 @@
@RequiredArgsConstructor
@Service
-public class StaffOnJobServiceImpl extends ServiceImpl<StaffOnJobMapper, StaffOnJob> implements IStaffOnJobService {
+public class StaffOnJobServiceImpl extends ServiceImpl<StaffOnJobMapper, StaffOnJob> implements IStaffOnJobService {
private final StaffOnJobMapper staffOnJobMapper;
private final SysDeptMapper sysDeptMapper;
@@ -64,22 +65,22 @@
private final StaffEmergencyContactMapper staffEmergencyContactMapper;
private final StaffEmergencyContactServiceImpl staffEmergencyContactServiceImpl;
-
- //鍦ㄨ亴鍛樺伐鍙拌处鍒嗛〉鏌ヨ
+ // 鍦ㄨ亴鍛樺伐鍙拌处鍒嗛〉鏌ヨ
@Override
public IPage<StaffOnJobDto> staffOnJobListPage(Page page, StaffOnJob staffOnJob) {
- return staffOnJobMapper.staffOnJobListPage(page,staffOnJob);
+ return staffOnJobMapper.staffOnJobListPage(page, staffOnJob);
}
- //鏂板鍏ヨ亴
+ // 鏂板鍏ヨ亴
@Override
@Transactional(rollbackFor = Exception.class)
public int add(StaffOnJobDto staffOnJobPrams) {
- String[] ignoreProperties = {"id"};//鎺掗櫎id灞炴��
+ String[] ignoreProperties = { "id" };// 鎺掗櫎id灞炴��
// 鍒ゆ柇缂栧彿鏄惁瀛樺湪
- List<StaffOnJob> staffOnJobs = staffOnJobMapper.selectList(Wrappers.<StaffOnJob>lambdaQuery().eq(StaffOnJob::getStaffNo, staffOnJobPrams.getStaffNo()));
- if (staffOnJobs != null && !staffOnJobs.isEmpty()){
- throw new BaseException("缂栧彿涓�"+staffOnJobPrams.getStaffNo()+"鐨勫憳宸ュ凡缁忓瓨鍦�,鏃犳硶鏂板!!!");
+ List<StaffOnJob> staffOnJobs = staffOnJobMapper.selectList(
+ Wrappers.<StaffOnJob>lambdaQuery().eq(StaffOnJob::getStaffNo, staffOnJobPrams.getStaffNo()));
+ if (staffOnJobs != null && !staffOnJobs.isEmpty()) {
+ throw new BaseException("缂栧彿涓�" + staffOnJobPrams.getStaffNo() + "鐨勫憳宸ュ凡缁忓瓨鍦�,鏃犳硶鏂板!!!");
}
// 鍒涘缓鍏ヨ亴鏁版嵁
@@ -88,23 +89,23 @@
staffOnJobMapper.insert(staffOnJobPrams);
// 鏌ヨ鐢ㄦ埛鏄惁宸茬粡鏂板
SysUser sysUser = sysUserService.selectUserById(staffOnJobPrams.getId());
- if(sysUser == null){
+ if (sysUser == null) {
SysUser sysUser1 = new SysUser();
sysUser1.setUserName(staffOnJobPrams.getStaffNo());
sysUser1.setNickName(staffOnJobPrams.getStaffName());
String s = SecurityUtils.encryptPassword("123456");
sysUser1.setPassword(s);
- if(staffOnJobPrams.getSysPostId() != null){
- Long[] posts = new Long[]{staffOnJobPrams.getSysPostId().longValue()};
+ if (staffOnJobPrams.getSysPostId() != null) {
+ Long[] posts = new Long[] { staffOnJobPrams.getSysPostId().longValue() };
sysUser1.setPostIds(posts);
}
- sysUser1.setRoleIds(new Long[]{staffOnJobPrams.getRoleId()});
- sysUser1.setDeptIds(new Long[]{staffOnJobPrams.getSysDeptId()});
+ sysUser1.setRoleIds(new Long[] { staffOnJobPrams.getRoleId() });
+ sysUser1.setDeptIds(new Long[] { staffOnJobPrams.getSysDeptId() });
sysUser1.setStatus("0");
sysUserService.insertUser(sysUser1);
}
// 缁戝畾瀛愯〃鏁版嵁
- bingingStaffOnJobExtra(staffOnJobPrams.getId(),staffOnJobPrams);
+ bingingStaffOnJobExtra(staffOnJobPrams.getId(), staffOnJobPrams);
// 鍒涘缓鍚堝悓璁板綍
StaffContract staffContract = new StaffContract();
staffContract.setStaffOnJobId(staffOnJobPrams.getId());
@@ -114,32 +115,32 @@
return staffContractMapper.insert(staffContract);
}
- //鏇存柊鍏ヨ亴淇℃伅
+ // 鏇存柊鍏ヨ亴淇℃伅
@Override
@Transactional(rollbackFor = Exception.class)
public int update(Long id, StaffOnJobDto staffOnJobParams) {
// 鍒ゆ柇瀵硅薄鏄惁瀛樺湪
StaffOnJob job = staffOnJobMapper.selectById(id);
- if (job == null){
- throw new BaseException("缂栧彿涓�"+staffOnJobParams.getStaffNo()+"鐨勫憳宸ヤ笉瀛樺湪,鏃犳硶鏇存柊!!!");
+ if (job == null) {
+ throw new BaseException("缂栧彿涓�" + staffOnJobParams.getStaffNo() + "鐨勫憳宸ヤ笉瀛樺湪,鏃犳硶鏇存柊!!!");
}
- String[] ignoreProperties = {"id"};//鎺掗櫎鏇存柊灞炴��
+ String[] ignoreProperties = { "id" };// 鎺掗櫎鏇存柊灞炴��
// 鑾峰彇鏈�鏂板悎鍚屾暟鎹紝骞朵笖鏇存柊
StaffContract contract = staffContractMapper.selectOne(Wrappers.<StaffContract>lambdaQuery()
.eq(StaffContract::getStaffOnJobId, id)
.last("limit 1")
.orderByDesc(StaffContract::getId));
- if (contract != null){
- BeanUtils.copyProperties(staffOnJobParams,contract,ignoreProperties);
+ if (contract != null) {
+ BeanUtils.copyProperties(staffOnJobParams, contract, ignoreProperties);
staffContractMapper.updateById(contract);
}
// 鍒犻櫎鎵�鏈夊瓙琛ㄦ暟鎹�
delStaffOnJobExtra(Arrays.asList(id));
// 缁戝畾瀛愯〃鏁版嵁
- bingingStaffOnJobExtra(id,staffOnJobParams);
+ bingingStaffOnJobExtra(id, staffOnJobParams);
// 鏇存柊鍛樺伐鏁版嵁
staffOnJobParams.setContractExpireTime(staffOnJobParams.getContractEndTime());
return staffOnJobMapper.updateById(staffOnJobParams);
@@ -147,26 +148,27 @@
/**
* 缁戝畾鍛樺伐瀛愯〃鏁版嵁
+ *
* @param staffOnJobPrams
* @param id
*/
- public void bingingStaffOnJobExtra(Long id,StaffOnJob staffOnJobPrams) {
+ public void bingingStaffOnJobExtra(Long id, StaffOnJob staffOnJobPrams) {
// 鏂板鏁欒偛缁忓巻
- if(CollectionUtils.isNotEmpty(staffOnJobPrams.getStaffEducationList())){
+ if (CollectionUtils.isNotEmpty(staffOnJobPrams.getStaffEducationList())) {
staffOnJobPrams.getStaffEducationList().stream()
.filter(Objects::nonNull) // 杩囨护null瀵硅薄锛岄伩鍏嶇┖鎸囬拡
.forEach(staff -> staff.setStaffOnJobId(id)); // 璧嬪��
staffEducationService.saveBatch(staffOnJobPrams.getStaffEducationList());
}
// 鏂板宸ヤ綔缁忓巻
- if(CollectionUtils.isNotEmpty(staffOnJobPrams.getStaffWorkExperienceList())){
+ if (CollectionUtils.isNotEmpty(staffOnJobPrams.getStaffWorkExperienceList())) {
staffOnJobPrams.getStaffWorkExperienceList().stream()
.filter(Objects::nonNull) // 杩囨护null瀵硅薄锛岄伩鍏嶇┖鎸囬拡
.forEach(staff -> staff.setStaffOnJobId(id)); // 璧嬪��
staffWorkExperienceServiceImpl.saveBatch(staffOnJobPrams.getStaffWorkExperienceList());
}
// 鏂板绱ф�ヨ仈绯讳汉
- if(CollectionUtils.isNotEmpty(staffOnJobPrams.getStaffEmergencyContactList())){
+ if (CollectionUtils.isNotEmpty(staffOnJobPrams.getStaffEmergencyContactList())) {
staffOnJobPrams.getStaffEmergencyContactList().stream()
.filter(Objects::nonNull) // 杩囨护null瀵硅薄锛岄伩鍏嶇┖鎸囬拡
.forEach(staff -> staff.setStaffOnJobId(id)); // 璧嬪��
@@ -174,27 +176,30 @@
}
}
-
/**
* 閫氳繃鍛樺伐id鍒犻櫎鏁欒偛缁忓巻锛屽伐浣滅粡鍘嗭紝绱ф�ヨ仈绯讳汉
+ *
* @param ids
* @return
*/
public void delStaffOnJobExtra(List<Long> ids) {
// 鍒犻櫎鏁欒偛缁忓巻
- staffEducationService.remove(Wrappers.<StaffEducation>lambdaQuery().in(StaffEducation::getStaffOnJobId,ids));
+ staffEducationService.remove(Wrappers.<StaffEducation>lambdaQuery().in(StaffEducation::getStaffOnJobId, ids));
// 鍒犻櫎宸ヤ綔缁忓巻
- staffWorkExperienceServiceImpl.remove(Wrappers.<StaffWorkExperience>lambdaQuery().in(StaffWorkExperience::getStaffOnJobId,ids));
+ staffWorkExperienceServiceImpl
+ .remove(Wrappers.<StaffWorkExperience>lambdaQuery().in(StaffWorkExperience::getStaffOnJobId, ids));
// 鍒犻櫎绱ф�ヨ仈绯讳汉
- staffEmergencyContactServiceImpl.remove(Wrappers.<StaffEmergencyContact>lambdaQuery().in(StaffEmergencyContact::getStaffOnJobId,ids));
+ staffEmergencyContactServiceImpl
+ .remove(Wrappers.<StaffEmergencyContact>lambdaQuery().in(StaffEmergencyContact::getStaffOnJobId, ids));
}
- //鍒犻櫎鍏ヨ亴
+ // 鍒犻櫎鍏ヨ亴
@Override
@Transactional(rollbackFor = Exception.class)
public int delStaffOnJobs(List<Integer> ids) {
- List<StaffOnJob> staffOnJobs = staffOnJobMapper.selectList(Wrappers.<StaffOnJob>lambdaQuery().in(StaffOnJob::getId, ids));
- if(CollectionUtils.isEmpty(staffOnJobs)){
+ List<StaffOnJob> staffOnJobs = staffOnJobMapper
+ .selectList(Wrappers.<StaffOnJob>lambdaQuery().in(StaffOnJob::getId, ids));
+ if (CollectionUtils.isEmpty(staffOnJobs)) {
throw new BaseException("璇ュ憳宸ヤ笉瀛樺湪,鏃犳硶鍒犻櫎!!!");
}
// 鍒犻櫎鍏ヨ亴鏁版嵁
@@ -202,11 +207,13 @@
// 鍒犻櫎绂昏亴鏁版嵁
staffLeaveMapper.delete(Wrappers.<StaffLeave>lambdaQuery().in(StaffLeave::getStaffOnJobId, ids));
// 鍒犻櫎鎵撳崱璁板綍
- personalAttendanceRecordsMapper.delete(Wrappers.<PersonalAttendanceRecords>lambdaQuery().in(PersonalAttendanceRecords::getStaffOnJobId, ids));
+ personalAttendanceRecordsMapper.delete(
+ Wrappers.<PersonalAttendanceRecords>lambdaQuery().in(PersonalAttendanceRecords::getStaffOnJobId, ids));
// 鍒犻櫎鐢ㄦ埛鏁版嵁
List<SysUser> sysUsers = sysUserMapper.selectList(Wrappers.<SysUser>lambdaQuery()
- .in(SysUser::getUserName, staffOnJobs.stream().map(StaffOnJob::getStaffNo).collect(Collectors.toList())));
- if(CollectionUtils.isNotEmpty(sysUsers)){
+ .in(SysUser::getUserName,
+ staffOnJobs.stream().map(StaffOnJob::getStaffNo).collect(Collectors.toList())));
+ if (CollectionUtils.isNotEmpty(sysUsers)) {
Long[] longs = sysUsers.stream().map(SysUser::getUserId).toArray(Long[]::new);
sysUserService.deleteUserByIds(longs);
}
@@ -214,7 +221,8 @@
delStaffOnJobExtra(ids.stream().map(Integer::longValue).collect(Collectors.toList()));
// 鍒犻櫎鍚堝悓鏁版嵁
- return staffContractMapper.delete(Wrappers.<StaffContract>lambdaQuery().in(StaffContract::getStaffOnJobId, ids));
+ return staffContractMapper
+ .delete(Wrappers.<StaffContract>lambdaQuery().in(StaffContract::getStaffOnJobId, ids));
}
// 缁鍚堝悓
@@ -223,7 +231,7 @@
public int renewContract(Long id, StaffContract staffContract) {
// 鍒ゆ柇瀵硅薄鏄惁瀛樺湪
StaffOnJob job = staffOnJobMapper.selectById(id);
- if (job == null){
+ if (job == null) {
throw new BaseException("璇ュ憳宸ヤ笉瀛樺湪,鏃犳硶鏇存柊!!!");
}
@@ -241,10 +249,10 @@
return 0;
}
- //鍦ㄨ亴鍛樺伐璇︽儏
+ // 鍦ㄨ亴鍛樺伐璇︽儏
@Override
public StaffOnJobDto staffOnJobDetail(Long id) {
- StaffOnJob staffOnJob = staffOnJobMapper.selectById(id);
+ StaffOnJob staffOnJob = staffOnJobMapper.selectById(id);
if (staffOnJob == null) {
throw new IllegalArgumentException("璇ュ憳宸ヤ笉瀛樺湪");
}
@@ -264,7 +272,7 @@
.eq(StaffContract::getStaffOnJobId, staffOnJob.getId())
.last("limit 1")
.orderByDesc(StaffContract::getId));
- if (contract != null){
+ if (contract != null) {
staffOnJobDto.setContractTerm(contract.getContractTerm());
staffOnJobDto.setContractStartTime(contract.getContractStartTime());
staffOnJobDto.setContractEndTime(contract.getContractEndTime());
@@ -272,14 +280,16 @@
// 鑾峰彇瀛愯〃鏁版嵁
staffOnJobDto.setStaffEducationList(staffEducationMapper.selectList(Wrappers.<StaffEducation>lambdaQuery()
.eq(StaffEducation::getStaffOnJobId, staffOnJob.getId())));
- staffOnJobDto.setStaffWorkExperienceList(staffWorkExperienceMapper.selectList(Wrappers.<StaffWorkExperience>lambdaQuery()
- .eq(StaffWorkExperience::getStaffOnJobId, staffOnJob.getId())));
- staffOnJobDto.setStaffEmergencyContactList(staffEmergencyContactMapper.selectList(Wrappers.<StaffEmergencyContact>lambdaQuery()
- .eq(StaffEmergencyContact::getStaffOnJobId, staffOnJob.getId())));
+ staffOnJobDto.setStaffWorkExperienceList(
+ staffWorkExperienceMapper.selectList(Wrappers.<StaffWorkExperience>lambdaQuery()
+ .eq(StaffWorkExperience::getStaffOnJobId, staffOnJob.getId())));
+ staffOnJobDto.setStaffEmergencyContactList(
+ staffEmergencyContactMapper.selectList(Wrappers.<StaffEmergencyContact>lambdaQuery()
+ .eq(StaffEmergencyContact::getStaffOnJobId, staffOnJob.getId())));
return staffOnJobDto;
}
- //鍦ㄨ亴鍛樺伐瀵煎嚭
+ // 鍦ㄨ亴鍛樺伐瀵煎嚭
@Override
public void staffOnJobExport(HttpServletResponse response, StaffOnJob staffOnJob) {
List<StaffOnJobDto> staffOnJobs = staffOnJobMapper.staffOnJobList(staffOnJob);
@@ -298,39 +308,62 @@
try {
ExcelUtil<StaffOnJobExcelDto> util = new ExcelUtil<>(StaffOnJobExcelDto.class);
List<StaffOnJobExcelDto> staffOnJobs = util.importExcel(file.getInputStream());
- if (CollectionUtils.isEmpty(staffOnJobs)){
+ if (CollectionUtils.isEmpty(staffOnJobs)) {
return false;
}
// 鑾峰彇鎵�鏈夐儴闂ㄦ暟鎹�
- List<SysDept> sysDepts = sysDeptMapper.selectList(Wrappers.<SysDept>lambdaQuery().eq(SysDept::getDelFlag, 0));
+ List<SysDept> sysDepts = sysDeptMapper
+ .selectList(Wrappers.<SysDept>lambdaQuery().eq(SysDept::getDelFlag, 0));
// 鑾峰彇鎵�鏈夎鑹叉暟鎹�
List<SysRole> sysRoles = sysRoleMapper.selectRoleAll();
staffOnJobs.forEach(staffOnJob -> {
+ // 澶勭悊鍚堝悓鏈熼檺鏁版嵁鏍煎紡
+ if (staffOnJob.getContractTerm() != null && !staffOnJob.getContractTerm().trim().isEmpty()) {
+ String term = staffOnJob.getContractTerm().trim();
+ try {
+ Integer.parseInt(term);
+ } catch (NumberFormatException e) {
+ throw new ServiceException("鍛樺伐[" + staffOnJob.getStaffName() + "]鐨勫悎鍚屾湡闄怺"
+ + staffOnJob.getContractTerm() + "]鏍煎紡涓嶆纭紝蹇呴』涓虹函鏁板瓧(濡�: 1, 2, 3)");
+ }
+ }
StaffOnJobDto staffOnJobDto = new StaffOnJobDto();
BeanUtils.copyProperties(staffOnJob, staffOnJobDto);
// 閫氳繃鍚嶇О鑾峰彇閮ㄩ棬id
- staffOnJobDto.setSysDeptId(// ... existing code ...
- sysDepts.stream()
- .filter(dept -> dept.getDeptName() != null && dept.getDeptName().equals(staffOnJob.getSysDeptName()))
- .findFirst()
- .map(SysDept::getDeptId)
- .orElse(null)
- );
+ Long deptId = sysDepts.stream()
+ .filter(dept -> dept.getDeptName() != null
+ && dept.getDeptName().equals(staffOnJob.getSysDeptName()))
+ .findFirst()
+ .map(SysDept::getDeptId)
+ .orElse(null);
+ if (deptId == null) {
+ throw new ServiceException(
+ "鍛樺伐[" + staffOnJob.getStaffName() + "]鐨勯儴闂╗" + staffOnJob.getSysDeptName() + "]涓嶅瓨鍦紝璇锋鏌ユ暟鎹�");
+ }
+ staffOnJobDto.setSysDeptId(deptId);
+
// 閫氳繃鍚嶇О鑾峰彇瑙掕壊id
- staffOnJobDto.setRoleId(sysRoles.stream()
- .filter(role -> role.getRoleName() != null && role.getRoleName().equals(staffOnJob.getRoleName()))
+ Long roleId = sysRoles.stream()
+ .filter(role -> role.getRoleName() != null
+ && role.getRoleName().equals(staffOnJob.getRoleName()))
.findFirst()
.map(SysRole::getRoleId)
- .orElse( null));
- add(staffOnJobDto);
+ .orElse(null);
+ if (roleId == null) {
+ throw new ServiceException(
+ "鍛樺伐[" + staffOnJob.getStaffName() + "]鐨勮鑹瞇" + staffOnJob.getRoleName() + "]涓嶅瓨鍦紝璇锋鏌ユ暟鎹�");
+ }
+ staffOnJobDto.setRoleId(roleId);
+ SpringUtils.getAopProxy(this).add(staffOnJobDto);
});
return true;
+ } catch (ServiceException | BaseException e) {
+ throw e;
} catch (Exception e) {
- e.printStackTrace();
- return false;
+ log.error("鍛樺伐鍙拌处瀵煎叆澶辫触 : " + e.getMessage());
+ throw new ServiceException("瀵煎叆澶辫触: " + e.getMessage());
}
}
-
@Override
public String exportCopy(HttpServletResponse response, StaffOnJob staffOnJob) throws Exception {
@@ -339,7 +372,7 @@
// 璁剧疆妯℃澘鏂囦欢鎵�鍦ㄧ洰褰曪紙缁濆璺緞锛屼緥濡傦細/templates/锛�
cfg.setClassForTemplateLoading(StaffOnJobServiceImpl.class, "/static");
cfg.setDefaultEncoding("UTF-8");
- //2.瀹氫箟闇�瑕佸~鍏呯殑鍙橀噷
+ // 2.瀹氫箟闇�瑕佸~鍏呯殑鍙橀噷
// 鈶� 鏋勯�犲憳宸ヤ俊鎭紙瀹為檯椤圭洰涓彲浠庢暟鎹簱/Excel璇诲彇锛�
WordDateDto staff = new WordDateDto();
BeanUtils.copyProperties(staffOnJob, staff);
@@ -349,7 +382,7 @@
Instant instant = staff.getContractExpireTime().toInstant();
// 涔熷彲浠ユ寚瀹氬叿浣撴椂鍖猴紝渚嬪Asia/Shanghai锛�
- LocalDate localDate = instant.atZone(ZoneId.of("Asia/Shanghai")).toLocalDate(); // 鍚堝悓缁撴潫鏃堕棿
+ LocalDate localDate = instant.atZone(ZoneId.of("Asia/Shanghai")).toLocalDate(); // 鍚堝悓缁撴潫鏃堕棿
LocalDate localDate1 = localDate.minusYears(Integer.parseInt(staff.getContractTerm()));// 鍚堝悓寮�濮嬫椂闂�
// 绛捐鏃ユ湡杞崲lcoaldate
@@ -362,7 +395,7 @@
staff.setQyear(localDate2.getYear() + "");
staff.setQmoth(localDate2.getMonthValue() + "");
staff.setQday(localDate2.getDayOfMonth() + "");
- if(staff.getDateSelect().equals("A")){
+ if (staff.getDateSelect().equals("A")) {
staff.setSyear(localDate1.getYear() + "");
staff.setSmoth(localDate1.getMonthValue() + "");
staff.setSday(localDate1.getDayOfMonth() + "");
@@ -376,7 +409,7 @@
staff.setSeyear(localDate4.getYear() + "");
staff.setSemoth(localDate4.getMonthValue() + "");
staff.setSeday(localDate4.getDayOfMonth() + "");
- }else if (staff.getDateSelect().equals("B")){
+ } else if (staff.getDateSelect().equals("B")) {
staff.setBsyear(localDate1.getYear() + "");
staff.setBsmoth(localDate1.getMonthValue() + "");
@@ -388,29 +421,27 @@
staff.setBseyear(localDate4.getYear() + "");
staff.setBsemoth(localDate4.getMonthValue() + "");
staff.setBseday(localDate4.getDayOfMonth() + "");
- }else if (staff.getDateSelect().equals("C")){
+ } else if (staff.getDateSelect().equals("C")) {
staff.setCsyear(localDate1.getYear() + "");
staff.setCsmoth(localDate1.getMonthValue() + "");
staff.setCsday(localDate1.getDayOfMonth() + "");
}
- Map<String,Object> data = new HashMap<>();
- data.put("item",staff);
- //3.鍔犺浇XML 妯℃澘
+ Map<String, Object> data = new HashMap<>();
+ data.put("item", staff);
+ // 3.鍔犺浇XML 妯℃澘
Template template = cfg.getTemplate("鍔冲姩鍚堝悓涔�.xml");
- //4.鐢熸垚濉厖鍚庣殑 XML 鍐呭
+ // 4.鐢熸垚濉厖鍚庣殑 XML 鍐呭
StringWriter out = new StringWriter();
template.process(data, out);
String filledXml = out.toString();
- //5.灏哫ML鍐呭鍐欏叆浜や欢骞舵敼涓�.docx 鏍煎紡
+ // 5.灏哫ML鍐呭鍐欏叆浜や欢骞舵敼涓�.docx 鏍煎紡
File outputFile = new File(url);
- try(FileOutputStream fos = new FileOutputStream(outputFile);
- OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8)) {
+ try (FileOutputStream fos = new FileOutputStream(outputFile);
+ OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8)) {
osw.write(filledXml);
}
return url;
}
-
-
}
diff --git a/src/main/java/com/ruoyi/stock/dto/StockInRecordDto.java b/src/main/java/com/ruoyi/stock/dto/StockInRecordDto.java
index 56ad762..17d7e77 100644
--- a/src/main/java/com/ruoyi/stock/dto/StockInRecordDto.java
+++ b/src/main/java/com/ruoyi/stock/dto/StockInRecordDto.java
@@ -18,6 +18,11 @@
*/
private String model;
/**
+ * 鎵规鍙�
+ */
+ private String batchNo;
+
+ /**
* 浜у搧鍗曚綅
*/
private String unit;
diff --git a/src/main/java/com/ruoyi/stock/dto/StockInventoryDto.java b/src/main/java/com/ruoyi/stock/dto/StockInventoryDto.java
index bc08eee..10a17e9 100644
--- a/src/main/java/com/ruoyi/stock/dto/StockInventoryDto.java
+++ b/src/main/java/com/ruoyi/stock/dto/StockInventoryDto.java
@@ -79,4 +79,7 @@
@Schema(description = "浜у搧id")
private Long productId;
+
+ @Schema(description = "鎵规鍙�")
+ private String batchNo;
}
diff --git a/src/main/java/com/ruoyi/stock/dto/StockOutRecordDto.java b/src/main/java/com/ruoyi/stock/dto/StockOutRecordDto.java
index 022be78..0419f2f 100644
--- a/src/main/java/com/ruoyi/stock/dto/StockOutRecordDto.java
+++ b/src/main/java/com/ruoyi/stock/dto/StockOutRecordDto.java
@@ -21,6 +21,10 @@
*/
private String model;
/**
+ * 鎵规鍙�
+ */
+ private String batchNo;
+ /**
* 浜у搧鍗曚綅
*/
private String unit;
diff --git a/src/main/resources/mapper/stock/StockInRecordMapper.xml b/src/main/resources/mapper/stock/StockInRecordMapper.xml
index 2327375..55e57a3 100644
--- a/src/main/resources/mapper/stock/StockInRecordMapper.xml
+++ b/src/main/resources/mapper/stock/StockInRecordMapper.xml
@@ -31,6 +31,12 @@
<if test="params.productName != null and params.productName != ''">
and p.product_name like concat('%',#{params.productName},'%')
</if>
+ <if test="params.model != null and params.model != ''">
+ and pm.model like concat('%',#{params.model},'%')
+ </if>
+ <if test="params.batchNo != null and params.batchNo != ''">
+ and sir.batch_no like concat('%',#{params.batchNo},'%')
+ </if>
<if test="params.type != null and params.type != ''">
and sir.type = #{params.type}
</if>
diff --git a/src/main/resources/mapper/stock/StockInventoryMapper.xml b/src/main/resources/mapper/stock/StockInventoryMapper.xml
index c71ce31..428e8da 100644
--- a/src/main/resources/mapper/stock/StockInventoryMapper.xml
+++ b/src/main/resources/mapper/stock/StockInventoryMapper.xml
@@ -209,6 +209,12 @@
<if test="ew.topParentProductId != null and ew.topParentProductId > 0">
and combined.product_id in (select id from product_tree)
</if>
+ <if test="ew.model != null and ew.model !=''">
+ and combined.model like concat('%',#{ew.model},'%')
+ </if>
+ <if test="ew.batchNo != null and ew.batchNo !=''">
+ and combined.batch_no like concat('%',#{ew.batchNo},'%')
+ </if>
</where>
group by
product_model_id,
diff --git a/src/main/resources/mapper/stock/StockOutRecordMapper.xml b/src/main/resources/mapper/stock/StockOutRecordMapper.xml
index cf6f0ac..202de6b 100644
--- a/src/main/resources/mapper/stock/StockOutRecordMapper.xml
+++ b/src/main/resources/mapper/stock/StockOutRecordMapper.xml
@@ -46,6 +46,12 @@
<if test="params.productName != null and params.productName != ''">
and p.product_name like concat('%',#{params.productName},'%')
</if>
+ <if test="params.model != null and params.model != ''">
+ and pm.model like concat('%',#{params.model},'%')
+ </if>
+ <if test="params.batchNo != null and params.batchNo != ''">
+ and sor.batch_no like concat('%',#{params.batchNo},'%')
+ </if>
<if test="params.type != null and params.type != ''">
and sor.type = #{params.type}
</if>
diff --git "a/src/main/resources/static/\351\224\200\345\224\256\345\217\260\350\264\246\345\257\274\345\205\245\346\250\241\346\235\277.xlsx" "b/src/main/resources/static/\351\224\200\345\224\256\345\217\260\350\264\246\345\257\274\345\205\245\346\250\241\346\235\277.xlsx"
index 9558711..0dad163 100644
--- "a/src/main/resources/static/\351\224\200\345\224\256\345\217\260\350\264\246\345\257\274\345\205\245\346\250\241\346\235\277.xlsx"
+++ "b/src/main/resources/static/\351\224\200\345\224\256\345\217\260\350\264\246\345\257\274\345\205\245\346\250\241\346\235\277.xlsx"
Binary files differ
--
Gitblit v1.9.3