|
|
|
|
@ -1,27 +1,20 @@ |
|
|
|
|
package com.nov.KgLowDurable.service.Impl; |
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
|
import com.nov.KgLowDurable.constant.BatchConstant; |
|
|
|
|
import com.nov.KgLowDurable.exception.CustomerException; |
|
|
|
|
import com.nov.KgLowDurable.mapper.LdInventoryRecordMapper; |
|
|
|
|
import com.nov.KgLowDurable.mapper.LdTwoInventoryRecordMapper; |
|
|
|
|
import com.nov.KgLowDurable.pojo.dto.ApproveDto; |
|
|
|
|
import com.nov.KgLowDurable.pojo.entity.*; |
|
|
|
|
import com.nov.KgLowDurable.service.*; |
|
|
|
|
import com.nov.KgLowDurable.util.Func; |
|
|
|
|
import com.nov.KgLowDurable.util.StringUtils; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.math.RoundingMode; |
|
|
|
|
import java.sql.Wrapper; |
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -137,7 +130,7 @@ public class LdTwoInventoryRecordServiceImpl extends ServiceImpl<LdTwoInventoryR |
|
|
|
|
ldErstockOutService.updateById(ldErstockOut); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<LdErstockOutForm> outFormList = ldErstockOutFromService.listByOutId(approveDto.getTwoOutStorageId()); |
|
|
|
|
List<LdErstockOutForm> outFormList = ldErstockOutFromService.listByOutId(ldErstockOut.getId()); |
|
|
|
|
for (LdErstockOutForm ldErstockOutForm : outFormList) { |
|
|
|
|
// 物资编码
|
|
|
|
|
String code = ""; |
|
|
|
|
@ -148,7 +141,7 @@ public class LdTwoInventoryRecordServiceImpl extends ServiceImpl<LdTwoInventoryR |
|
|
|
|
|
|
|
|
|
if (BatchConstant.CONSUMER.equals(code)) { |
|
|
|
|
// 获取二级库存
|
|
|
|
|
LdConsumerForm consumerForm = consumerFormService.getById(ldErstockOutForm.getStockId()); |
|
|
|
|
LdConsumerForm consumerForm = consumerFormService.getByMaterialCode(ldErstockOutForm.getStockId()); |
|
|
|
|
BigDecimal num = new BigDecimal(ldErstockOutForm.getNum()); |
|
|
|
|
//计算差值
|
|
|
|
|
BigDecimal difference = consumerForm.getNum().subtract(num); |
|
|
|
|
@ -172,7 +165,7 @@ public class LdTwoInventoryRecordServiceImpl extends ServiceImpl<LdTwoInventoryR |
|
|
|
|
throw new CustomerException("出库记录保存失败"); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
LdDurableForm durableForm = durableFormService.getById(ldErstockOutForm.getStockId()); |
|
|
|
|
LdDurableForm durableForm = durableFormService.getByMaterialCode(ldErstockOutForm.getStockId()); |
|
|
|
|
durableForm.setIsBorrow(BatchConstant.LEND); |
|
|
|
|
durableForm.setNum(new BigDecimal(0)); |
|
|
|
|
boolean updateDurableForm = durableFormService.updateById(durableForm); |
|
|
|
|
|