| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | @RequiredArgsConstructor |
| | | public class ShippingInfoServiceImpl extends ServiceImpl<ShippingInfoMapper, ShippingInfo> implements ShippingInfoService { |
| | | |
| | | /** |
| | | * listPage 的行来源标记:shipping=发货单,oilOut=销售类油品出库 |
| | | */ |
| | | private static final String SOURCE_OIL_OUT = "oilOut"; |
| | | |
| | | private final ShippingInfoMapper shippingInfoMapper; |
| | | |
| | |
| | | IPage<ShippingInfoDto> listPage = shippingInfoMapper.listPage(page, req); |
| | | listPage.getRecords().forEach(item -> { |
| | | item.setStorageBlobVOs(fileUtil.getStorageBlobVOsByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum.IMAGE, RecordTypeEnum.SHIPPING_INFO, item.getId())); |
| | | // 油品出库行没有 shipping_product_detail,批号明细只能由出库记录自身字段构造 |
| | | if (SOURCE_OIL_OUT.equals(item.getSource())) { |
| | | item.setBatchNoList(buildOilOutBatchNoList(item)); |
| | | } |
| | | }); |
| | | return listPage; |
| | | } |
| | | |
| | | /** |
| | | * 油品出库行的批号明细,供发货台账详情弹框的「批号」明细表展示 |
| | | */ |
| | | private List<ShippingProductDetailDto> buildOilOutBatchNoList(ShippingInfoDto item) { |
| | | ShippingProductDetailDto detail = new ShippingProductDetailDto(); |
| | | detail.setBatchNo(item.getOutBatchNo()); |
| | | detail.setProductName(item.getProductName()); |
| | | detail.setSpecificationModel(item.getSpecificationModel()); |
| | | detail.setDeliveryQuantity(item.getTotalQuantity()); |
| | | return Collections.singletonList(detail); |
| | | } |
| | | |
| | | @Override |
| | | public boolean deductStock(ShippingInfoDto req) { |
| | | ShippingInfo byId = this.getById(req.getId()); |