mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 07:46:40 +08:00
feat: 单据供应商
This commit is contained in:
@@ -79,10 +79,17 @@ public class WarehouseGoodsService
|
||||
|
||||
public Integer goodsCount(GoodsCountRequest request) {
|
||||
|
||||
return commonMapper.toInt((em.createQuery(
|
||||
"select sum(case when receiptType = '0' then number when receiptType = '1' then number * -1 end ) from WarehouseReceiptDetailEntity where warehouse.id = :warehouseId and goods.id = :goodsIds")
|
||||
.setParameter("warehouseId", request.getWarehouseId())
|
||||
.setParameter("goodsIds", request.getGoodsId())
|
||||
.getSingleResult() + ""));
|
||||
Double result =
|
||||
em.createQuery(
|
||||
"select sum(case when receiptType = '0' then number when receiptType = '1' then number * -1 end ) from WarehouseReceiptDetailEntity where warehouse.id = :warehouseId and goods.id = :goodsIds",
|
||||
Double.class)
|
||||
.setParameter("warehouseId", request.getWarehouseId())
|
||||
.setParameter("goodsIds", request.getGoodsId())
|
||||
.getSingleResult();
|
||||
if (request == null){
|
||||
return 0;
|
||||
}
|
||||
return result.intValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import lombok.Data;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class CreateWarehouseReceiptDetailDto extends OrgCommonDto {
|
||||
|
||||
@@ -23,6 +25,8 @@ public class CreateWarehouseReceiptDetailDto extends OrgCommonDto {
|
||||
|
||||
private String receipt;
|
||||
|
||||
private String supplier;
|
||||
|
||||
@Comment("数量")
|
||||
private Double number;
|
||||
|
||||
@@ -34,4 +38,14 @@ public class CreateWarehouseReceiptDetailDto extends OrgCommonDto {
|
||||
@Comment("总价")
|
||||
private Double amount;
|
||||
|
||||
@Comment("保质期 天")
|
||||
private Integer shelfLife;
|
||||
|
||||
|
||||
@Comment("生产日期")
|
||||
private LocalDateTime productionDate;
|
||||
|
||||
@Comment("过期日期")
|
||||
private LocalDateTime expirationDate;
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import lombok.Data;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class UpdateWarehouseReceiptDetailDto extends OrgCommonDto {
|
||||
|
||||
@@ -25,6 +27,8 @@ public class UpdateWarehouseReceiptDetailDto extends OrgCommonDto {
|
||||
|
||||
private String receipt;
|
||||
|
||||
private String supplier;
|
||||
|
||||
@Comment("数量")
|
||||
private Double number;
|
||||
|
||||
@@ -34,4 +38,14 @@ public class UpdateWarehouseReceiptDetailDto extends OrgCommonDto {
|
||||
|
||||
@Comment("总价")
|
||||
private Double amount;
|
||||
|
||||
@Comment("保质期 天")
|
||||
private Integer shelfLife;
|
||||
|
||||
|
||||
@Comment("生产日期")
|
||||
private LocalDateTime productionDate;
|
||||
|
||||
@Comment("过期日期")
|
||||
private LocalDateTime expirationDate;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import cn.lihongjie.coal.base.dto.SimpleDto;
|
||||
import cn.lihongjie.coal.warehouse.dto.WarehouseDto;
|
||||
import cn.lihongjie.coal.warehouseGoods.dto.WarehouseGoodsDto;
|
||||
import cn.lihongjie.coal.warehouseShelve.dto.WarehouseShelveDto;
|
||||
import cn.lihongjie.coal.warehouseSupplier.dto.WarehouseSupplierDto;
|
||||
|
||||
import jakarta.persistence.ManyToOne;
|
||||
|
||||
@@ -12,6 +13,8 @@ import lombok.Data;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class WarehouseReceiptDetailDto extends OrgCommonDto {
|
||||
|
||||
@@ -30,7 +33,7 @@ public class WarehouseReceiptDetailDto extends OrgCommonDto {
|
||||
@ManyToOne
|
||||
private WarehouseShelveDto shelve1;
|
||||
|
||||
|
||||
private WarehouseSupplierDto supplier;
|
||||
|
||||
@ManyToOne
|
||||
private SimpleDto receipt;
|
||||
@@ -44,4 +47,14 @@ public class WarehouseReceiptDetailDto extends OrgCommonDto {
|
||||
|
||||
|
||||
private Double amount;
|
||||
|
||||
@Comment("保质期 天")
|
||||
private Integer shelfLife;
|
||||
|
||||
|
||||
@Comment("生产日期")
|
||||
private LocalDateTime productionDate;
|
||||
|
||||
@Comment("过期日期")
|
||||
private LocalDateTime expirationDate;
|
||||
}
|
||||
|
||||
@@ -5,22 +5,31 @@ import cn.lihongjie.coal.warehouse.entity.WarehouseEntity;
|
||||
import cn.lihongjie.coal.warehouseGoods.entity.WarehouseGoodsEntity;
|
||||
import cn.lihongjie.coal.warehouseReceipt.entity.WarehouseReceiptEntity;
|
||||
import cn.lihongjie.coal.warehouseShelve.entity.WarehouseShelveEntity;
|
||||
import cn.lihongjie.coal.warehouseSupplier.entity.WarehouseSupplierEntity;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Index;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@jakarta.persistence.Table(
|
||||
indexes = {
|
||||
@jakarta.persistence.Index(
|
||||
name = "idx_warehouse_receipt_detail_org_id",
|
||||
columnList = "organization_id"),
|
||||
|
||||
@jakarta.persistence.Table(indexes = @jakarta.persistence.Index(name ="idx_warehouse_receipt_detail_org_id", columnList = "organization_id"))
|
||||
|
||||
@Index(name = "idx_warehouse_receipt_detail_goods_id", columnList = "goods_id, receipt_id, warehouse_id"),
|
||||
})
|
||||
public class WarehouseReceiptDetailEntity extends OrgCommonEntity {
|
||||
|
||||
|
||||
@ManyToOne
|
||||
private WarehouseGoodsEntity goods;
|
||||
|
||||
@@ -43,6 +52,8 @@ public class WarehouseReceiptDetailEntity extends OrgCommonEntity {
|
||||
@ManyToOne
|
||||
private WarehouseReceiptEntity receipt;
|
||||
|
||||
@ManyToOne private WarehouseSupplierEntity supplier;
|
||||
|
||||
@Comment("现有库存")
|
||||
private Double stock;
|
||||
|
||||
@@ -62,4 +73,17 @@ public class WarehouseReceiptDetailEntity extends OrgCommonEntity {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Comment("保质期 天")
|
||||
private Integer shelfLife;
|
||||
|
||||
|
||||
@Comment("生产日期")
|
||||
private LocalDateTime productionDate;
|
||||
|
||||
@Comment("过期日期")
|
||||
private LocalDateTime expirationDate;
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user