| | |
| | | |
| | | @GetMapping("/approve-process-list") |
| | | @Operation(summary = "获取销售订单审批流程列表") |
| | | @PreAuthorize("@ss.hasPermission('erp:sale-order:query')") |
| | | public CommonResult<List<Map<String, Object>>> getApproveProcessList() { |
| | | return success(saleOrderService.getSaleOrderApproveProcessDefinitionList()); |
| | | } |
| | |
| | | @GetMapping("/item/list-by-order-id") |
| | | @Operation(summary = "查询销售订单的物料明细列表(用于发货通知单创建)") |
| | | @Parameter(name = "orderId", description = "销售订单编号", required = true, example = "1") |
| | | @PreAuthorize("@ss.hasPermission('erp:sale-order:query')") |
| | | public CommonResult<List<ErpSaleOrderItemRespVO>> getSaleOrderItemListByOrderId(@RequestParam("orderId") Long orderId) { |
| | | List<ErpSaleOrderItemDO> itemList = saleOrderService.getSaleOrderItemListByOrderId(orderId); |
| | | Map<Long, MdmItemRespDTO> itemMap = mdmItemApi.getItemMap( |
| | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "获得销售订单") |
| | | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('erp:sale-order:query')") |
| | | public CommonResult<ErpSaleOrderRespVO> getSaleOrder(@RequestParam("id") Long id) { |
| | | ErpSaleOrderDO saleOrder = saleOrderService.getSaleOrder(id); |
| | | if (saleOrder == null) { |
| | |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "获得销售订单分页") |
| | | @PreAuthorize("@ss.hasPermission('erp:sale-order:query')") |
| | | public CommonResult<PageResult<ErpSaleOrderRespVO>> getSaleOrderPage(@Valid ErpSaleOrderPageReqVO pageReqVO) { |
| | | PageResult<ErpSaleOrderDO> pageResult = saleOrderService.getSaleOrderPage(pageReqVO); |
| | | return success(buildSaleOrderVOPageResult(pageResult)); |
| | |
| | | /** |
| | | * 填充订单项的金额字段 |
| | | * |
| | | * DO 中 totalPrice 为产品金额(不含税),RespVO 需要补全: |
| | | * - totalProductPrice:产品金额 |
| | | * - totalPrice:含税金额(产品金额 + 税额) |
| | | * DO 中 totalPrice 为含税总价(单价 × 数量),RespVO 需要补全: |
| | | * - totalProductPrice:不含税金额(含税总价 - 税额) |
| | | * - totalPrice:含税总价(保持 DO 原值) |
| | | */ |
| | | private void fillItemPrice(ErpSaleOrderRespVO.Item item) { |
| | | BigDecimal productAmount = item.getTotalPrice() != null ? item.getTotalPrice() : BigDecimal.ZERO; |
| | | BigDecimal totalPriceWithTax = item.getTotalPrice() != null ? item.getTotalPrice() : BigDecimal.ZERO; |
| | | BigDecimal tax = item.getTaxPrice() != null ? item.getTaxPrice() : BigDecimal.ZERO; |
| | | item.setTotalProductPrice(productAmount); |
| | | item.setTotalPrice(productAmount.add(tax)); |
| | | item.setTotalProductPrice(totalPriceWithTax.subtract(tax)); |
| | | item.setTotalPrice(totalPriceWithTax); |
| | | } |
| | | |
| | | } |