| | |
| | | if (noticeLine != null) { |
| | | line.setSaleOrderItemId(noticeLine.getSaleOrderItemId()); |
| | | } |
| | | fillProductSalesLinePrice(line); |
| | | productSalesLineMapper.insert(line); |
| | | return line.getId(); |
| | | } |
| | | |
| | | /** |
| | | * 按销售订单行单价回填出库行金额,供开票/对账使用 |
| | | */ |
| | | private void fillProductSalesLinePrice(MesWmProductSalesLineDO line) { |
| | | if (line.getSaleOrderItemId() == null) { |
| | | return; |
| | | } |
| | | try { |
| | | var item = saleOrderApi.getSaleOrderItem(line.getSaleOrderItemId()).getData(); |
| | | if (item == null || item.getProductPrice() == null) { |
| | | return; |
| | | } |
| | | line.setPrice(item.getProductPrice()); |
| | | if (line.getQuantity() != null) { |
| | | line.setTotalPrice(item.getProductPrice().multiply(line.getQuantity())); |
| | | } |
| | | } catch (Exception ex) { |
| | | // 价格只是快照,订单行取不到时不阻断开单 |
| | | log.warn("[fillProductSalesLinePrice][销售订单行({}) 价格快照失败]", line.getSaleOrderItemId(), ex); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (noticeLine != null) { |
| | | updateObj.setSaleOrderItemId(noticeLine.getSaleOrderItemId()); |
| | | } |
| | | fillProductSalesLinePrice(updateObj); |
| | | productSalesLineMapper.updateById(updateObj); |
| | | |
| | | // 提交出库单后由质检人员选择已完成的出厂检验单。 |