From d96cb8a176a2cd7406de97b9a6e321f8ecd4c707 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期一, 31 三月 2025 07:59:54 +0800 Subject: [PATCH] Merge branch 'devlop' of http://47.97.1.152:5880/r/wms-master into devlop --- rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/AsnOrderServiceImpl.java | 55 +++++++++++++++++++++++++++++++++---------------------- 1 files changed, 33 insertions(+), 22 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 098d817..1e7709d 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.*; @@ -42,10 +44,8 @@ private ReportMsgService reportMsgService; @Resource private PurchaseMapper purchaseMapper; - @Autowired private AsnOrderItemService asnOrderItemService; - @Resource private SerialRuleMapper serialRuleMapper; @@ -64,23 +64,6 @@ } else { return false; } - } - - @Override - public R generateBarcode(List<AsnOrder> orders) { - orders.forEach(order -> { - List<AsnOrderItem> items = asnOrderItemService.list(new LambdaQueryWrapper<AsnOrderItem>().eq(AsnOrderItem::getAsnId, order.getId())); - if (!items.isEmpty()) { - items.forEach(item -> { - String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_LABEL_CODE, item); - item.setTrackCode(ruleCode); - }); - if (!asnOrderItemService.saveOrUpdateBatch(items)) { - throw new CoolException("鐢熸垚鏉$爜澶辫触锛侊紒"); - } - } - }); - return R.ok(); } @Override @@ -106,7 +89,9 @@ throw new CoolException("涓诲崟淇℃伅涓嶈兘涓虹┖"); } AsnOrder orders = params.getOrders(); - + if (Objects.isNull(orders)) { + throw new CoolException("鍗曟嵁涓嶈兘涓虹┖锛侊紒"); + } String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_ASN_ORDER, orders); if (Objects.isNull(ruleCode)) { throw new CoolException("鏀惰揣閫氱煡鍗曠紪鐮佺敓鎴愬け璐ワ紒锛�"); @@ -122,12 +107,38 @@ item.put("asnId", orders.getId()); item.put("asnCode", orders.getCode()); item.put("poCode", orders.getPoCode()); - if (!asnOrderItemService.fieldsSave(item)) { throw new CoolException("鏄庣粏淇濆瓨澶辫触锛侊紒"); } - }); 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