diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquPlanEquSpare.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquPlanEquSpare.java index a222e0ad..f53e4e8d 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/EquPlanEquSpare.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquPlanEquSpare.java @@ -65,6 +65,16 @@ public class EquPlanEquSpare extends BaseEntity { /** 删除标识 */ private String delFlag; + private BigDecimal amount; + + public BigDecimal getAmount() { + return amount; + } + + public void setAmount(BigDecimal amount) { + this.amount = amount; + } + public void setId(String id) { this.id = id; } diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/SparePartsLedgerMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/SparePartsLedgerMapper.java index 01568182..70d7de07 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/SparePartsLedgerMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/SparePartsLedgerMapper.java @@ -1,5 +1,6 @@ package com.op.device.mapper; +import java.math.BigDecimal; import java.util.List; import com.op.device.domain.SparePartsLedger; @@ -58,4 +59,12 @@ public interface SparePartsLedgerMapper { * @return 结果 */ public int deleteSparePartsLedgerByStorageIds(String[] storageIds); + + /** + * 通过备件编码获取备件真实库存(总数量-冻结数量) + * @param materialCode + * @return + */ + BigDecimal selectRealAmountByMaterialCode(String materialCode); + } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquPlanServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquPlanServiceImpl.java index 3ec0f2e7..850cb8f0 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquPlanServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquPlanServiceImpl.java @@ -1,5 +1,6 @@ package com.op.device.service.impl; +import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; @@ -53,6 +54,9 @@ public class EquPlanServiceImpl implements IEquPlanService { private EquPlanEquMapper equPlanEquMapper; @Autowired private EquPlanEquSpareMapper equPlanEquSpareMapper; + // 备件mapper + @Autowired + private SparePartsLedgerMapper sparePartsLedgerMapper; /** * 查询计划 @@ -362,8 +366,13 @@ public class EquPlanServiceImpl implements IEquPlanService { EquPlanEquSpare spare = new EquPlanEquSpare(); spare.setParentCode(equipment.getCode()); + // 备件信息 List spareList = equPlanEquSpareMapper.selectEquPlanEquSpareList(spare); if (spareList.size() > 0) { + for (EquPlanEquSpare equSpare : spareList) { + // 通过备件编码查询备件库存信息(总量-冻结) + equSpare.setAmount(sparePartsLedgerMapper.selectRealAmountByMaterialCode(equSpare.getMaterialCode())); + } equipment.setSpareList(spareList); } diff --git a/op-modules/op-device/src/main/resources/mapper/device/SparePartsLedgerMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/SparePartsLedgerMapper.xml index 08d5b972..336af1e0 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/SparePartsLedgerMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/SparePartsLedgerMapper.xml @@ -123,7 +123,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and del_flag = '0' and storage_tpye = 'SP' - + + + insert into wms_ods_mate_storage_news