|
|
|
@ -1,11 +1,14 @@
|
|
|
|
|
package org.dromara.wms.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
import com.github.yulichang.toolkit.JoinWrappers;
|
|
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.dromara.common.core.utils.DateUtils;
|
|
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
|
|
import org.dromara.common.satoken.utils.LoginHelper;
|
|
|
|
|
import org.dromara.common.translation.annotation.Translation;
|
|
|
|
|
import org.dromara.wms.domain.*;
|
|
|
|
@ -15,6 +18,7 @@ import org.dromara.wms.service.IWmsPdaApiService;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
@ -182,10 +186,21 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService {
|
|
|
|
|
WmsInstockRecord wmsInstockRecord = new WmsInstockRecord();
|
|
|
|
|
BeanUtils.copyProperties(vo, wmsInstockRecord);
|
|
|
|
|
wmsInstockRecordMapper.insert(wmsInstockRecord);
|
|
|
|
|
// 插入库存
|
|
|
|
|
WmsInventory inventory = new WmsInventory();
|
|
|
|
|
BeanUtils.copyProperties(vo, inventory);
|
|
|
|
|
wmsInventoryMapper.insert(inventory);
|
|
|
|
|
// 查询
|
|
|
|
|
WmsInventoryVo wmsInventoryVo = selectInVentoryByBatchCode(vo.getBatchCode(), vo.getLocationCode());
|
|
|
|
|
if (wmsInventoryVo == null) {
|
|
|
|
|
// 插入库存
|
|
|
|
|
WmsInventory inventory = new WmsInventory();
|
|
|
|
|
BeanUtils.copyProperties(vo, inventory);
|
|
|
|
|
inventory.setInventoryQty(BigDecimal.valueOf(vo.getInstockQty()));
|
|
|
|
|
wmsInventoryMapper.insert(inventory);
|
|
|
|
|
}else {
|
|
|
|
|
WmsInventory inventory = new WmsInventory();
|
|
|
|
|
inventory.setInventoryId(wmsInventoryVo.getInventoryId());
|
|
|
|
|
inventory.setInventoryQty(wmsInventoryVo.getInventoryQty().add(BigDecimal.valueOf(wmsInstockRecord.getInstockQty())) );
|
|
|
|
|
wmsInventoryMapper.updateById(inventory);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -200,4 +215,13 @@ public class WmsPdaApiServiceImpl implements IWmsPdaApiService {
|
|
|
|
|
.eq(WmsOutstockDetail::getOutstockCode, orderCode);
|
|
|
|
|
return wmsOutstockDetailMapper.selectVoList(lqw);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public WmsInventoryVo selectInVentoryByBatchCode(String bacthCode, String locationCode) {
|
|
|
|
|
LambdaQueryWrapper<WmsInventory> lqw = Wrappers.lambdaQuery();
|
|
|
|
|
lqw.eq(WmsInventory::getBatchCode, bacthCode)
|
|
|
|
|
.eq(WmsInventory::getLocationCode, locationCode);
|
|
|
|
|
return wmsInventoryMapper.selectVoOne(lqw);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|