Merge branch 'refs/heads/dev' into test
This commit is contained in:
@@ -2,10 +2,13 @@ package com.zt.plat.module.contractorder.api;
|
|||||||
|
|
||||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||||
import com.zt.plat.module.contractorder.api.dto.order.OrderDTO;
|
import com.zt.plat.module.contractorder.api.dto.order.OrderDTO;
|
||||||
|
import com.zt.plat.module.contractorder.api.dto.order.UpdateOrderLstQtyDTO;
|
||||||
import com.zt.plat.module.contractorder.enums.ApiConstants;
|
import com.zt.plat.module.contractorder.enums.ApiConstants;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
@@ -22,4 +25,8 @@ public interface OrderApi {
|
|||||||
@PostMapping(PREFIX + "/order-by-order-nos")
|
@PostMapping(PREFIX + "/order-by-order-nos")
|
||||||
@Operation(summary = "通过订单号批量获取订单信息", description = "通过订单编号获取订单信息")
|
@Operation(summary = "通过订单号批量获取订单信息", description = "通过订单编号获取订单信息")
|
||||||
CommonResult<List<OrderDTO>> getOrderByOrderNos(@RequestBody List<String> orderNoS);
|
CommonResult<List<OrderDTO>> getOrderByOrderNos(@RequestBody List<String> orderNoS);
|
||||||
|
|
||||||
|
@PostMapping(PREFIX + "/update-lst-qty-by-order-id")
|
||||||
|
@Operation(summary = "根据订单明细id更新累积量", description = "根据订单明细id更新收货量")
|
||||||
|
CommonResult<Boolean> UpdateOrderLstQty(@RequestBody @Validated List<UpdateOrderLstQtyDTO> updateOrderLstQtyDTOS);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -134,4 +134,8 @@ public class SalesOrdDtlDTO {
|
|||||||
|
|
||||||
private BigDecimal taxRte;
|
private BigDecimal taxRte;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已移库量库;存针对该订单产生的移库量
|
||||||
|
*/
|
||||||
|
private BigDecimal trfQty;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.zt.plat.module.contractorder.api.dto.order;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Schema(description = "更新订单已收货数量")
|
||||||
|
@Validated
|
||||||
|
public class UpdateOrderLstQtyDTO {
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@Schema(description = "订单明细id")
|
||||||
|
@NotNull(message = "订单明细id不能为空")
|
||||||
|
private Long orderDetailId;
|
||||||
|
/**
|
||||||
|
* 已收货数量
|
||||||
|
*/
|
||||||
|
@Schema(description = "已收货数量")
|
||||||
|
@NotNull(message = "已收货数量不能为空")
|
||||||
|
private BigDecimal lstQty;
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "订单分类(字典:SPLY_BSN_TP)")
|
||||||
|
@NotEmpty(message = "订单类型不能为空")
|
||||||
|
private String splyBsnTp;
|
||||||
|
}
|
||||||
@@ -3,10 +3,7 @@ package com.zt.plat.module.contractorder.api;
|
|||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||||
import com.zt.plat.module.contractorder.api.dto.order.OrdDtlDTO;
|
import com.zt.plat.module.contractorder.api.dto.order.*;
|
||||||
import com.zt.plat.module.contractorder.api.dto.order.OrderDTO;
|
|
||||||
import com.zt.plat.module.contractorder.api.dto.order.PurchaseOrderWithDetailsDTO;
|
|
||||||
import com.zt.plat.module.contractorder.api.dto.order.SalesOrdDtlDTO;
|
|
||||||
import com.zt.plat.module.contractorder.dal.dataobject.purchaseorder.PrchOrdDtlDO;
|
import com.zt.plat.module.contractorder.dal.dataobject.purchaseorder.PrchOrdDtlDO;
|
||||||
import com.zt.plat.module.contractorder.dal.dataobject.purchaseorder.PurchaseOrderDO;
|
import com.zt.plat.module.contractorder.dal.dataobject.purchaseorder.PurchaseOrderDO;
|
||||||
import com.zt.plat.module.contractorder.dal.dataobject.salesorder.SalesOrderDO;
|
import com.zt.plat.module.contractorder.dal.dataobject.salesorder.SalesOrderDO;
|
||||||
@@ -18,12 +15,15 @@ import com.zt.plat.module.contractorder.dal.mysql.salesorder.SalesOrderMapper;
|
|||||||
import com.zt.plat.module.contractorder.service.purchaseorder.PurchaseOrderService;
|
import com.zt.plat.module.contractorder.service.purchaseorder.PurchaseOrderService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
@@ -92,6 +92,40 @@ public class OrderApiImpl implements OrderApi {
|
|||||||
return success(order);
|
return success(order);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public CommonResult<Boolean> UpdateOrderLstQty(List<UpdateOrderLstQtyDTO> updateOrderLstQtyDTOS) {
|
||||||
|
if (updateOrderLstQtyDTOS == null || updateOrderLstQtyDTOS.isEmpty()) {
|
||||||
|
throw new RuntimeException("请求数据错误");
|
||||||
|
}
|
||||||
|
SalesOrderDetailMapper salesOrderDetailMapper = SpringUtil.getBean(SalesOrderDetailMapper.class);
|
||||||
|
PrchOrdDtlMapper prchOrdDtlMapper = SpringUtil.getBean(PrchOrdDtlMapper.class);
|
||||||
|
updateOrderLstQtyDTOS.forEach(f -> {
|
||||||
|
if ("SALE".equals(f.getSplyBsnTp())) {
|
||||||
|
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.getOrderDetailId()); // 给更新对象设 ID
|
||||||
|
updateDO.setTrfQty(trfQty.add(f.getLstQty())); // 累加(trfQty )
|
||||||
|
salesOrderDetailMapper.updateById(updateDO);
|
||||||
|
} else if ("PUR".equals(f.getSplyBsnTp())) {
|
||||||
|
// 采购
|
||||||
|
PrchOrdDtlDO prchOrdDtlDO = prchOrdDtlMapper.selectById(f.getOrderDetailId());
|
||||||
|
BigDecimal trfQty = Optional.ofNullable(prchOrdDtlDO.getTrfQty())
|
||||||
|
.orElse(BigDecimal.ZERO);
|
||||||
|
PrchOrdDtlDO updateDO = new PrchOrdDtlDO();
|
||||||
|
updateDO.setId(f.getOrderDetailId());
|
||||||
|
updateDO.setTrfQty(trfQty.add(f.getLstQty()));
|
||||||
|
prchOrdDtlMapper.updateById(updateDO);
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("请求数据错误");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
private List<SalesOrderDO> getOrderByIds(List<Long> ids) {
|
private List<SalesOrderDO> getOrderByIds(List<Long> ids) {
|
||||||
return SpringUtil.getBean(SalesOrderMapper.class).selectByIds(ids); // 采购订单与销售订单的
|
return SpringUtil.getBean(SalesOrderMapper.class).selectByIds(ids); // 采购订单与销售订单的
|
||||||
}
|
}
|
||||||
@@ -176,7 +210,7 @@ public class OrderApiImpl implements OrderApi {
|
|||||||
|
|
||||||
|
|
||||||
} else if (
|
} else if (
|
||||||
t instanceof SalesOrdDtlDTO s
|
t instanceof SalesOrderDetailDO s
|
||||||
) {
|
) {
|
||||||
ordDtlDTO.setId(s.getId());
|
ordDtlDTO.setId(s.getId());
|
||||||
ordDtlDTO.setOrderId(s.getOrderId());
|
ordDtlDTO.setOrderId(s.getOrderId());
|
||||||
@@ -187,7 +221,7 @@ public class OrderApiImpl implements OrderApi {
|
|||||||
ordDtlDTO.setFactoryNum(s.getFactoryNumber());
|
ordDtlDTO.setFactoryNum(s.getFactoryNumber());
|
||||||
ordDtlDTO.setWarehouseName(s.getWarehouseName());
|
ordDtlDTO.setWarehouseName(s.getWarehouseName());
|
||||||
ordDtlDTO.setWarehouseNum(s.getWarehouseNumber());
|
ordDtlDTO.setWarehouseNum(s.getWarehouseNumber());
|
||||||
ordDtlDTO.setUnit(s.getUnit());
|
ordDtlDTO.setUnit(s.getUnt());
|
||||||
ordDtlDTO.setQuantity(s.getQuantity());
|
ordDtlDTO.setQuantity(s.getQuantity());
|
||||||
ordDtlDTO.setProjectCategory(s.getProjectCategory());
|
ordDtlDTO.setProjectCategory(s.getProjectCategory());
|
||||||
ordDtlDTO.setAgreementNumber(s.getAgreementNumber());
|
ordDtlDTO.setAgreementNumber(s.getAgreementNumber());
|
||||||
@@ -196,8 +230,7 @@ public class OrderApiImpl implements OrderApi {
|
|||||||
ordDtlDTO.setElementCode(s.getElementNumber());
|
ordDtlDTO.setElementCode(s.getElementNumber());
|
||||||
ordDtlDTO.setIsEnable(s.getIsEnable());
|
ordDtlDTO.setIsEnable(s.getIsEnable());
|
||||||
ordDtlDTO.setTaxNum(s.getTaxAcctasscat());
|
ordDtlDTO.setTaxNum(s.getTaxAcctasscat());
|
||||||
//==============================
|
ordDtlDTO.setTrfQty(s.getTrfQty());
|
||||||
|
|
||||||
}
|
}
|
||||||
return ordDtlDTO;
|
return ordDtlDTO;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,4 +155,6 @@ public class SalesOrderDetailDO extends BusinessBaseDO {
|
|||||||
@TableField("TAX_RTE")
|
@TableField("TAX_RTE")
|
||||||
private BigDecimal taxRte;
|
private BigDecimal taxRte;
|
||||||
|
|
||||||
|
@TableField("TRF_QTY")
|
||||||
|
private BigDecimal trfQty;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,4 +34,8 @@ public class ErpInternalOrderRespVO {
|
|||||||
@ExcelProperty("是否已完成")
|
@ExcelProperty("是否已完成")
|
||||||
private String isFinish;
|
private String isFinish;
|
||||||
|
|
||||||
|
@Schema(description = "companyNumber")
|
||||||
|
@ExcelProperty("companyNumber")
|
||||||
|
private String companyNumber;
|
||||||
|
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user