From 99af0223ae0858c69d1b75106d5f8bb0ab14b129 Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期三, 27 八月 2025 17:04:29 +0800
Subject: [PATCH] art: 移库单回调出库逻辑添加

---
 src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialOutboundServiceImpl.java |   42 +++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 41 insertions(+), 1 deletions(-)

diff --git a/src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialOutboundServiceImpl.java b/src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialOutboundServiceImpl.java
index a9a70ec..bf8c3db 100644
--- a/src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialOutboundServiceImpl.java
+++ b/src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialOutboundServiceImpl.java
@@ -4,23 +4,37 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.apache.commons.lang.StringUtils;
+import org.jeecg.common.constant.CommonConstant;
+import org.jeecg.modules.lsw.entity.LswMaterial;
+import org.jeecg.modules.lsw.entity.LswMaterialInventory;
 import org.jeecg.modules.lsw.entity.LswMaterialOutbound;
+import org.jeecg.modules.lsw.enums.MaterialInventoryStatusEnum;
 import org.jeecg.modules.lsw.mapper.LswMaterialOutboundMapper;
+import org.jeecg.modules.lsw.service.ILswMaterialInboundService;
+import org.jeecg.modules.lsw.service.ILswMaterialInventoryService;
 import org.jeecg.modules.lsw.service.ILswMaterialOutboundService;
+import org.jeecg.modules.lsw.service.ILswMaterialService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
 /**
  * @Description: 鐗╂枡鍑哄簱鍗�
  * @Author: jeecg-boot
- * @Date:   2025-06-30
+ * @Date: 2025-06-30
  * @Version: V1.0
  */
 @Service
 public class LswMaterialOutboundServiceImpl extends ServiceImpl<LswMaterialOutboundMapper, LswMaterialOutbound> implements ILswMaterialOutboundService {
+    @Autowired
+    private ILswMaterialService materialService;
+    @Autowired
+    private ILswMaterialInventoryService materialInventoryService;
 
     @Override
     public IPage<Map<String, Object>> getlswMaterialOutboundListData(Integer pageNo, Integer pageSize, HttpServletRequest req) {
@@ -40,4 +54,30 @@
         }
         return super.getBaseMapper().getlswMaterialOutboundListData(pageData, paramMap);
     }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean outboundMaterial(LswMaterialOutbound outbound) {
+        if (StringUtils.isBlank(outbound.getMaterialNumber())
+                || StringUtils.isBlank(outbound.getFactoryId())
+                || StringUtils.isBlank(outbound.getWarehouseId())
+                || outbound.getQuantity() == null
+                || outbound.getQuantity().intValue() > 0
+                || StringUtils.isBlank(outbound.getBatchNumber())
+        || StringUtils.isBlank(outbound.getInventoryId())) {
+            return false;
+        }
+        LswMaterialInventory inventory = materialInventoryService.getById(outbound.getInventoryId());
+        if(inventory == null) {
+            return false;
+        }
+        //鏇存柊搴撳瓨鐘舵��
+        inventory.setInventoryStatus(MaterialInventoryStatusEnum.OUTBOUND.name());
+        materialInventoryService.updateById(inventory);
+        //淇濆瓨鍑哄簱淇℃伅
+        outbound.setDelFlag(CommonConstant.DEL_FLAG_0);
+        outbound.setOutboundTime(new Date());
+        super.save(outbound);
+        return true;
+    }
 }

--
Gitblit v1.9.3