mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 07:46:40 +08:00
仓库管理商品库存汇总
This commit is contained in:
@@ -10,7 +10,7 @@ import lombok.Data;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@@ -34,7 +34,7 @@ public class CreateWarehouseReceiptDto extends OrgCommonDto {
|
||||
private String warehouse;
|
||||
|
||||
@Comment("单据日期")
|
||||
private LocalDate receiptDate;
|
||||
private LocalDateTime receiptDate;
|
||||
|
||||
|
||||
@OneToMany
|
||||
|
||||
@@ -10,7 +10,7 @@ import lombok.Data;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@@ -34,7 +34,7 @@ public class UpdateWarehouseReceiptDto extends OrgCommonDto {
|
||||
private String warehouse;
|
||||
|
||||
@Comment("单据日期")
|
||||
private LocalDate receiptDate;
|
||||
private LocalDateTime receiptDate;
|
||||
|
||||
|
||||
@OneToMany
|
||||
|
||||
@@ -12,7 +12,7 @@ import lombok.Data;
|
||||
import org.hibernate.annotations.Comment;
|
||||
import org.hibernate.annotations.Formula;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@@ -44,7 +44,7 @@ public class WarehouseReceiptDto extends OrgCommonDto {
|
||||
private WarehouseDto warehouse;
|
||||
|
||||
@Comment("单据日期")
|
||||
private LocalDate receiptDate;
|
||||
private LocalDateTime receiptDate;
|
||||
|
||||
|
||||
@OneToMany
|
||||
|
||||
@@ -13,7 +13,7 @@ import lombok.Data;
|
||||
import org.hibernate.annotations.Comment;
|
||||
import org.hibernate.annotations.Formula;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@@ -44,10 +44,10 @@ public class WarehouseReceiptEntity extends OrgCommonEntity {
|
||||
@ManyToOne private WarehouseEntity warehouse;
|
||||
|
||||
@Comment("单据日期")
|
||||
private LocalDate receiptDate;
|
||||
private LocalDateTime receiptDate;
|
||||
|
||||
|
||||
@OneToMany
|
||||
@OneToMany(mappedBy = "receipt")
|
||||
private List<WarehouseReceiptDetailEntity> detail;
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,16 @@ package cn.lihongjie.coal.warehouseReceipt.repository;
|
||||
import cn.lihongjie.coal.base.dao.BaseRepository;
|
||||
import cn.lihongjie.coal.warehouseReceipt.entity.WarehouseReceiptEntity;
|
||||
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Repository
|
||||
public interface WarehouseReceiptRepository extends BaseRepository<WarehouseReceiptEntity> {}
|
||||
public interface WarehouseReceiptRepository extends BaseRepository<WarehouseReceiptEntity> {
|
||||
|
||||
@Query("select w from WarehouseReceiptEntity w join w.detail d where w.warehouse.id in ?1 and d.shelve.id in ?2 and d.goods.id in ?3 order by w.receiptDate asc ")
|
||||
List<WarehouseReceiptEntity> findAllByWarehouseIdInAndShelveIdInAndGoodsIdIn(Set<String> warehouseIds, Set<String> shelveIds, Set<String> goodsIds);
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package cn.lihongjie.coal.warehouseReceipt.service;
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery;
|
||||
import cn.lihongjie.coal.base.dto.IdRequest;
|
||||
import cn.lihongjie.coal.base.service.BaseService;
|
||||
import cn.lihongjie.coal.warehouseGoodsSummary.service.WarehouseGoodsSummaryService;
|
||||
import cn.lihongjie.coal.warehouseReceipt.dto.CreateWarehouseReceiptDto;
|
||||
import cn.lihongjie.coal.warehouseReceipt.dto.UpdateWarehouseReceiptDto;
|
||||
import cn.lihongjie.coal.warehouseReceipt.dto.WarehouseReceiptDto;
|
||||
@@ -20,6 +21,8 @@ import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional
|
||||
@@ -31,10 +34,13 @@ public class WarehouseReceiptService
|
||||
|
||||
@Autowired private ConversionService conversionService;
|
||||
|
||||
@Autowired WarehouseGoodsSummaryService warehouseGoodsSummaryService;
|
||||
|
||||
public WarehouseReceiptDto create(CreateWarehouseReceiptDto request) {
|
||||
WarehouseReceiptEntity entity = mapper.toEntity(request);
|
||||
|
||||
this.repository.save(entity);
|
||||
warehouseGoodsSummaryService.refresh(List.of(entity));
|
||||
return getById(entity.getId());
|
||||
}
|
||||
|
||||
@@ -44,11 +50,16 @@ public class WarehouseReceiptService
|
||||
|
||||
this.repository.save(entity);
|
||||
|
||||
warehouseGoodsSummaryService.refresh(List.of(entity));
|
||||
|
||||
return getById(entity.getId());
|
||||
}
|
||||
|
||||
public void delete(IdRequest request) {
|
||||
List<WarehouseReceiptEntity> allById = this.repository.findAllById(request.getIds());
|
||||
this.repository.deleteAllById(request.getIds());
|
||||
|
||||
warehouseGoodsSummaryService.refresh(allById);
|
||||
}
|
||||
|
||||
public WarehouseReceiptDto getById(String id) {
|
||||
|
||||
@@ -1957,6 +1957,10 @@
|
||||
{
|
||||
"code": "1",
|
||||
"name": "出库单"
|
||||
},
|
||||
{
|
||||
"code": "2",
|
||||
"name": "盘库单"
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user