From d6b13df30e16678f03505f2f0a3b1136b6a5068b Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期四, 27 三月 2025 14:22:00 +0800
Subject: [PATCH] #新增 1. 新增收货通知单主表,明细表修改接口

---
 rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/AsnOrderServiceImpl.java |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/AsnOrderServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/AsnOrderServiceImpl.java
index c77fa5f..27e33ef 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/AsnOrderServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/AsnOrderServiceImpl.java
@@ -1,5 +1,6 @@
 package com.vincent.rsf.server.manager.service.impl;
 
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.vincent.rsf.framework.common.R;
 import com.vincent.rsf.framework.exception.CoolException;
@@ -21,6 +22,7 @@
 import com.vincent.rsf.server.system.utils.SerialRuleUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.util.*;
@@ -114,4 +116,32 @@
         });
         return R.ok("淇濆瓨鎴愬姛!!");
     }
+
+    /**
+     * 琛ㄥ崟鏄庣粏淇敼
+     * @param params
+     * @return
+     */
+    @Override
+    @Transactional
+    public R updateOrderItem(AsnOrderAndItemsParams params) {
+        if (Objects.isNull(params.getOrders())) {
+            throw new CoolException("涓诲崟淇℃伅涓嶈兘涓虹┖锛侊紒");
+        }
+        if (Objects.isNull(params.getOrders().getId())) {
+            throw new CoolException("鏁版嵁閿欒锛氬崟鎹甀D涓嶈兘涓虹┖锛侊紒");
+        }
+        if (this.updateById(params.getOrders())) {
+            throw new CoolException("涓诲崟淇敼澶辫触锛侊紒");
+        }
+        if (Objects.isNull(params.getItems()) || params.getItems().isEmpty()) {
+            return R.ok("淇敼瀹屾垚锛侊紒");
+        }
+        List<Map<String, Object>> items = params.getItems();
+        List<AsnOrderItem> asnOrderItems = JSONArray.parseArray(JSONArray.toJSONString(items), AsnOrderItem.class);
+        if (asnOrderItemService.saveOrUpdateBatch(asnOrderItems)) {
+            throw new CoolException("鏄庣粏淇敼澶辫触锛侊紒");
+        }
+        return R.ok("淇敼瀹屾垚锛侊紒");
+    }
 }

--
Gitblit v1.9.1