From b06233aa71b70f7a30ff382ae1ba19c29b134d7c Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期五, 28 十一月 2025 15:41:51 +0800
Subject: [PATCH] #库存调整完成
---
src/main/java/com/zy/asrs/service/impl/CheckOrderServiceImpl.java | 41 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/zy/asrs/service/impl/CheckOrderServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/CheckOrderServiceImpl.java
index 28004d3..23754df 100644
--- a/src/main/java/com/zy/asrs/service/impl/CheckOrderServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/CheckOrderServiceImpl.java
@@ -7,6 +7,7 @@
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.CheckTaskListParam;
+import com.zy.asrs.enums.CheckStatusEnum;
import com.zy.asrs.mapper.CheckOrderMapper;
import com.zy.asrs.service.*;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
@@ -15,8 +16,10 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Date;
import java.util.List;
@Service("checkOrderService")
@@ -148,4 +151,42 @@
return R.ok();
}
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void adjustOrderComplete(Long orderId, Long userId) {
+ CheckOrder checkOrder = this.selectById(orderId);
+ if (Cools.isEmpty(checkOrder)) {
+ throw new CoolException("鏁版嵁閿欒");
+ }
+ List<CheckOrderDetl> selectList = checkOrderDetlService.selectList(new EntityWrapper<CheckOrderDetl>().eq("order_id", orderId));
+ for (CheckOrderDetl checkOrderDetl : selectList) {
+
+ LocDetl locDetl = locDetlService.selectById(checkOrderDetl.getLocDetlId());
+ if (Cools.isEmpty(locDetl)) {
+ throw new CoolException("鏈壘鍒板簱瀛樻暟鎹�,鏁版嵁閿欒");
+ }
+ if (checkOrderDetl.getStatus().equals(CheckStatusEnum.ALLOW.type)) {
+ BigDecimal decimal = locDetl.getBookQty().add(checkOrderDetl.getDiffQty());
+ locDetl.setAnfme(decimal.doubleValue());
+ }else if (checkOrderDetl.getStatus().equals(CheckStatusEnum.FORBID.type)) {
+ if (locDetl.getDiffQty().compareTo(BigDecimal.ZERO) < 0) {
+ BigDecimal subtract = new BigDecimal(locDetl.getAnfme().toString()).subtract(locDetl.getDiffQty());
+ locDetl.setAnfme(subtract.doubleValue());
+ }
+ }
+
+ locDetl.setDiffQty(BigDecimal.ZERO);
+ locDetl.setModiTime(new Date());
+ if (!locDetlService.updateById(locDetl)){
+ throw new CoolException("鏇存柊搴撳瓨鏁版嵁澶辫触");
+ }
+ }
+
+ checkOrder.setSettle(4L);
+ checkOrder.setUpdateTime(new Date());
+ if (!this.updateById(checkOrder)){
+ throw new CoolException("鏇存柊璋冩暣鍗曠姸鎬佸け璐�");
+ }
+ }
}
--
Gitblit v1.9.1