|
@@ -14,6 +14,7 @@ import com.fjhx.file.service.FileInfoService;
|
|
|
import com.fjhx.file.utils.ObsFileUtil;
|
|
|
import com.ruoyi.common.core.domain.BaseIdPo;
|
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
+import com.sd.business.entity.apply.dto.ApplyBuyDetailSelectDto;
|
|
|
import com.sd.business.entity.apply.dto.ApplyBuyDto;
|
|
|
import com.sd.business.entity.apply.dto.ApplyBuySelectDto;
|
|
|
import com.sd.business.entity.apply.po.ApplyBuy;
|
|
@@ -24,6 +25,8 @@ import com.sd.business.entity.apply.vo.ApplyBuyVo;
|
|
|
import com.sd.business.entity.bom.po.BomSpec;
|
|
|
import com.sd.business.entity.department.constant.DepartmentConstant;
|
|
|
import com.sd.business.entity.inventory.po.Inventory;
|
|
|
+import com.sd.business.entity.purchase.po.PurchaseBom;
|
|
|
+import com.sd.business.entity.warehouse.constant.WarehouseConstant;
|
|
|
import com.sd.business.mapper.apply.ApplyBuyMapper;
|
|
|
import com.sd.business.service.apply.ApplyBuyBomService;
|
|
|
import com.sd.business.service.apply.ApplyBuyService;
|
|
@@ -103,15 +106,15 @@ public class ApplyBuyServiceImpl extends ServiceImpl<ApplyBuyMapper, ApplyBuy> i
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ApplyBuyVo detail(Long id) {
|
|
|
- Assert.notNull(id, "申购单id不能为空");
|
|
|
+ public ApplyBuyVo detail(ApplyBuyDetailSelectDto dto) {
|
|
|
+ Assert.notNull(dto.getId(), "申购单id不能为空");
|
|
|
|
|
|
// 申购单
|
|
|
- ApplyBuy ApplyBuy = this.getById(id);
|
|
|
+ ApplyBuy ApplyBuy = this.getById(dto.getId());
|
|
|
Assert.notNull(ApplyBuy, "没有找到申购单");
|
|
|
|
|
|
// 申购明细
|
|
|
- List<ApplyBuyBom> list = applyBuyBomService.list(q -> q.eq(ApplyBuyBom::getApplyBuyId, id));
|
|
|
+ List<ApplyBuyBom> list = applyBuyBomService.list(q -> q.eq(ApplyBuyBom::getApplyBuyId, dto.getId()));
|
|
|
List<ApplyBuyBomVo> applyBuyBomList = BeanUtil.copyToList(list, ApplyBuyBomVo.class);
|
|
|
|
|
|
// 赋值bom规格
|
|
@@ -125,6 +128,20 @@ public class ApplyBuyServiceImpl extends ServiceImpl<ApplyBuyMapper, ApplyBuy> i
|
|
|
});
|
|
|
|
|
|
// TODO 库存,在途数量,近30天消耗量,近30天入库量,安全库存 未赋值
|
|
|
+ // 赋值到货数量和在途数量
|
|
|
+ if (dto.getPurchaseId() != null) {
|
|
|
+ Map<Long, PurchaseBom> purchaseBomMap = purchaseBomService.mapKEntity(PurchaseBom::getBomSpecId, q -> q
|
|
|
+ .eq(PurchaseBom::getPurchaseId, dto.getPurchaseId()));
|
|
|
+ applyBuyBomList.forEach(item -> {
|
|
|
+ PurchaseBom purchaseBom = purchaseBomMap.get(item.getBomSpecId());
|
|
|
+ if (purchaseBom != null) {
|
|
|
+ item.setInTransitQuantity(purchaseBom.getPurchaseQuantity()
|
|
|
+ .subtract(purchaseBom.getArrivalQuantity())
|
|
|
+ .add(purchaseBom.getReturnQuantity()));
|
|
|
+ item.setArrivalQuantity(item.getArrivalQuantity());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
// 赋值返回值
|
|
|
ApplyBuyVo result = BeanUtil.toBean(ApplyBuy, ApplyBuyVo.class);
|
|
@@ -229,7 +246,8 @@ public class ApplyBuyServiceImpl extends ServiceImpl<ApplyBuyMapper, ApplyBuy> i
|
|
|
BigDecimal beforeLastMonth00Quantity = orderService.getOrderBomSpecOutStorageQuantity(bomSpecId, beforeLastMonthBeginDate, beforeLastMonthEndDate);
|
|
|
List<Inventory> inventoryList = inventoryService.list(q -> q
|
|
|
.eq(Inventory::getBomSpecId, bomSpecId)
|
|
|
- .eq(Inventory::getDepartmentId, DepartmentConstant.SD_SPORTS));
|
|
|
+ .eq(Inventory::getDepartmentId, DepartmentConstant.SD_SPORTS)
|
|
|
+ .in(Inventory::getWarehouseId, WarehouseConstant.SEMI_FINISHED_PRODUCT, WarehouseConstant.PACKAGING_MATERIAL));
|
|
|
// 当前库存数
|
|
|
BigDecimal inventoryQuantity = ObjectUtil.isEmpty(inventoryList) ? BigDecimal.ZERO : StreamUtil.bigDecimalAdd(inventoryList, Inventory::getQuantity);
|
|
|
// 在途数量
|