Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
潘荣晟
2025-11-25 15:50:32 +08:00
3 changed files with 8 additions and 7 deletions

View File

@@ -6,6 +6,7 @@ import com.zt.plat.module.contractorder.api.dto.order.UpdateOrderLstQtyDTO;
import com.zt.plat.module.contractorder.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;

View File

@@ -15,9 +15,9 @@ public class UpdateOrderLstQtyDTO {
/**
* 主键
*/
@Schema(description = "主键")
@NotNull(message = "主键不能为空")
private Long id;
@Schema(description = "订单明细id")
@NotNull(message = "订单明细id不能为空")
private Long orderDetailId;
/**
* 已收货数量
*/

View File

@@ -102,21 +102,21 @@ public class OrderApiImpl implements OrderApi {
PrchOrdDtlMapper prchOrdDtlMapper = SpringUtil.getBean(PrchOrdDtlMapper.class);
updateOrderLstQtyDTOS.forEach(f -> {
if ("SALE".equals(f.getSplyBsnTp())) {
SalesOrderDetailDO salesOrderDetailDO = salesOrderDetailMapper.selectById(f.getId());
SalesOrderDetailDO salesOrderDetailDO = salesOrderDetailMapper.selectById(f.getOrderDetailId());
// 处理 trfQty 可能为 null 的情况,默认值 0
BigDecimal trfQty = Optional.ofNullable(salesOrderDetailDO.getTrfQty())
.orElse(BigDecimal.ZERO);
SalesOrderDetailDO updateDO = new SalesOrderDetailDO();
updateDO.setId(f.getId()); // 给更新对象设 ID
updateDO.setId(f.getOrderDetailId()); // 给更新对象设 ID
updateDO.setTrfQty(trfQty.add(f.getLstQty())); // 累加trfQty
salesOrderDetailMapper.updateById(updateDO);
} else if ("PUR".equals(f.getSplyBsnTp())) {
// 采购
PrchOrdDtlDO prchOrdDtlDO = prchOrdDtlMapper.selectById(f.getId());
PrchOrdDtlDO prchOrdDtlDO = prchOrdDtlMapper.selectById(f.getOrderDetailId());
BigDecimal trfQty = Optional.ofNullable(prchOrdDtlDO.getTrfQty())
.orElse(BigDecimal.ZERO);
PrchOrdDtlDO updateDO = new PrchOrdDtlDO();
updateDO.setId(f.getId());
updateDO.setId(f.getOrderDetailId());
updateDO.setTrfQty(trfQty.add(f.getLstQty()));
prchOrdDtlMapper.updateById(updateDO);
} else {