|
|
@ -11,10 +11,12 @@ import com.win.module.wms.controller.transaction.vo.TransactionCreateReqVO; |
|
|
|
import com.win.module.wms.controller.unplannedreceiptRecord.vo.*; |
|
|
|
import com.win.module.wms.convert.unplannedreceiptRecord.UnplannedreceiptRecordDetailConvert; |
|
|
|
import com.win.module.wms.convert.unplannedreceiptRecord.UnplannedreceiptRecordMainConvert; |
|
|
|
import com.win.module.wms.dal.dataobject.balance.BalanceDO; |
|
|
|
import com.win.module.wms.dal.dataobject.businesstype.BusinesstypeDO; |
|
|
|
import com.win.module.wms.dal.dataobject.transactiontype.TransactiontypeDO; |
|
|
|
import com.win.module.wms.dal.dataobject.unplannedreceiptRecord.UnplannedreceiptRecordDetailDO; |
|
|
|
import com.win.module.wms.dal.dataobject.unplannedreceiptRecord.UnplannedreceiptRecordMainDO; |
|
|
|
import com.win.module.wms.dal.mysql.balance.BalanceMapper; |
|
|
|
import com.win.module.wms.dal.mysql.unplannedreceiptRecord.UnplannedreceiptRecordDetailMapper; |
|
|
|
import com.win.module.wms.dal.mysql.unplannedreceiptRecord.UnplannedreceiptRecordMainMapper; |
|
|
|
import com.win.module.wms.service.recordsetting.RecordsettingService; |
|
|
@ -60,6 +62,8 @@ public class UnplannedreceiptRecordMainServiceImpl implements UnplannedreceiptRe |
|
|
|
private TransactionService transactionService; |
|
|
|
@Resource |
|
|
|
private TrendsApi trendsApi; |
|
|
|
@Resource |
|
|
|
private BalanceMapper balanceMapper; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageResult<UnplannedreceiptRecordMainDO> getUnplannedreceiptRecordMainSenior(CustomConditions conditions) { |
|
|
@ -68,7 +72,7 @@ public class UnplannedreceiptRecordMainServiceImpl implements UnplannedreceiptRe |
|
|
|
|
|
|
|
@Transactional |
|
|
|
@Override |
|
|
|
public Long createUnplannedreceiptRecordMain(UnplannedreceiptRecordMainCreateReqVO createReqVO) { |
|
|
|
public String createUnplannedreceiptRecordMain(UnplannedreceiptRecordMainCreateReqVO createReqVO) { |
|
|
|
UnplannedreceiptRecordMainDO unplannedreceiptRecordMainDO = UnplannedreceiptRecordMainConvert.INSTANCE.convert(createReqVO); |
|
|
|
String number = serialNumberApi.generateCode(RuleCodeEnum.UNPLANNED_RECEIPT_RECORD.getCode()); |
|
|
|
unplannedreceiptRecordMainDO.setNumber(number); |
|
|
@ -86,6 +90,7 @@ public class UnplannedreceiptRecordMainServiceImpl implements UnplannedreceiptRe |
|
|
|
unplannedreceiptRecordMainDO.setId(null); |
|
|
|
unplannedreceiptRecordMainDO.setCreator(null); |
|
|
|
unplannedreceiptRecordMainDO.setCreateTime(LocalDateTime.now()); |
|
|
|
unplannedreceiptRecordMainDO.setDepartmentCode(userApi.getUser(getLoginUserId()).getDeptId().toString()); |
|
|
|
unplannedreceiptRecordMainMapper.insert(unplannedreceiptRecordMainDO); |
|
|
|
//库存事务
|
|
|
|
List<TransactionCreateReqVO> transactionCreateReqVOList = new ArrayList<>(); |
|
|
@ -94,9 +99,15 @@ public class UnplannedreceiptRecordMainServiceImpl implements UnplannedreceiptRe |
|
|
|
UnplannedreceiptRecordDetailDO recordDetailDO = UnplannedreceiptRecordDetailConvert.INSTANCE.convert(unplannedreceiptRecordDetailCreateReqVO); |
|
|
|
recordDetailDO.setNumber(number); |
|
|
|
recordDetailDO.setMasterId(unplannedreceiptRecordMainDO.getId()); |
|
|
|
recordDetailDO.setPackingNumber(unplannedreceiptRecordDetailCreateReqVO.getToPackingNumber()); |
|
|
|
recordDetailDO.setToLocationCode(unplannedreceiptRecordDetailCreateReqVO.getToLocationCode()); |
|
|
|
recordDetailDO.setBatch(unplannedreceiptRecordDetailCreateReqVO.getToBatch()); |
|
|
|
recordDetailDO.setId(null); |
|
|
|
unplannedreceiptRecordDetailMapper.insert(recordDetailDO); |
|
|
|
|
|
|
|
//查询库存余额
|
|
|
|
BalanceDO balanceDO = balanceMapper.getBalanceQty(recordDetailDO.getPackingNumber(), recordDetailDO.getItemCode(), recordDetailDO.getBatch(), recordDetailDO.getInventoryStatus(), recordDetailDO.getToLocationCode()); |
|
|
|
|
|
|
|
//添加库存事务list
|
|
|
|
TransactionCreateReqVO transactionCreateReqVO = new TransactionCreateReqVO(); |
|
|
|
BeanUtils.copyProperties(recordDetailDO, transactionCreateReqVO); |
|
|
@ -113,13 +124,17 @@ public class UnplannedreceiptRecordMainServiceImpl implements UnplannedreceiptRe |
|
|
|
transactionCreateReqVO.setBatch(recordDetailDO.getBatch()); |
|
|
|
transactionCreateReqVO.setWarehouseCode(unplannedreceiptRecordMainDO.getToWarehouseCode()); |
|
|
|
transactionCreateReqVO.setRecordNumber(number); |
|
|
|
transactionCreateReqVO.setAmount(balanceDO.getAmount()); |
|
|
|
transactionCreateReqVO.setArriveDate(balanceDO.getArriveDate()); |
|
|
|
transactionCreateReqVO.setProduceDate(balanceDO.getProduceDate()); |
|
|
|
transactionCreateReqVO.setExpireDate(balanceDO.getExpireDate()); |
|
|
|
transactionCreateReqVO.setId(null); |
|
|
|
transactionCreateReqVOList.add(transactionCreateReqVO); |
|
|
|
} |
|
|
|
//增加库存事务
|
|
|
|
transactionService.createTransaction(transactionCreateReqVOList); |
|
|
|
trendsApi.createTrends(unplannedreceiptRecordMainDO.getId(), "UnplannedReceiptRecord", "增加了计划外入库申请记录", TrendsTypeEnum.CREATE); |
|
|
|
return unplannedreceiptRecordMainDO.getId(); |
|
|
|
return number; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|