|
|
|
|
@ -9,12 +9,11 @@ import org.dromara.common.core.utils.StringUtils;
|
|
|
|
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
|
|
import org.dromara.wms.domain.WmsBaseProduct;
|
|
|
|
|
import org.dromara.wms.domain.WmsInventoryDetails;
|
|
|
|
|
import org.dromara.wms.domain.WmsMaterialTransferRecord;
|
|
|
|
|
import org.dromara.wms.domain.bo.WmsMaterialTransferRecordBo;
|
|
|
|
|
import org.dromara.wms.domain.vo.WmsMaterialTransferRecordVo;
|
|
|
|
|
import org.dromara.wms.mapper.WmsInventoryDetailsMapper;
|
|
|
|
|
import org.dromara.wms.mapper.WmsMaterialTransferRecordMapper;
|
|
|
|
|
import org.dromara.wms.service.IWmsInventoryDetailsService;
|
|
|
|
|
import org.dromara.wms.service.IWmsMaterialTransferRecordService;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
@ -34,7 +33,8 @@ public class WmsMaterialTransferRecordServiceImpl implements IWmsMaterialTransfe
|
|
|
|
|
|
|
|
|
|
private final WmsMaterialTransferRecordMapper baseMapper;
|
|
|
|
|
|
|
|
|
|
private final WmsInventoryDetailsMapper wmsInventoryDetailsMapper;
|
|
|
|
|
// private final WmsInventoryDetailsMapper wmsInventoryDetailsMapper;
|
|
|
|
|
private final IWmsInventoryDetailsService wmsInventoryDetailsService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询物料调拨
|
|
|
|
|
@ -98,13 +98,28 @@ public class WmsMaterialTransferRecordServiceImpl implements IWmsMaterialTransfe
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public Boolean insertByBo(Long transferBillsId, List<WmsMaterialTransferRecord> bo) {
|
|
|
|
|
baseMapper.insert(bo);
|
|
|
|
|
|
|
|
|
|
// 修改库存
|
|
|
|
|
bo.forEach(record -> {
|
|
|
|
|
record.setTransferBillsId(transferBillsId);// 调拨单ID
|
|
|
|
|
Long inventoryDetailsId = record.getInventoryDetailsId(); // 库存ID
|
|
|
|
|
Long inventoryId = record.getInventoryDetailsId(); // 库存ID
|
|
|
|
|
Double transferQty = record.getTransferQty(); // 调拨数量
|
|
|
|
|
// 库存验证
|
|
|
|
|
wmsInventoryDetailsService.outStoreLossInventoryAmount(
|
|
|
|
|
inventoryId,
|
|
|
|
|
transferQty,
|
|
|
|
|
record.getTransferOutStoreId(),
|
|
|
|
|
record.getBatchNumber(),
|
|
|
|
|
record.getMaterielId(), "6");
|
|
|
|
|
wmsInventoryDetailsService.inStoreAddInventoryAmount(
|
|
|
|
|
record.getTransferInStoreId(),
|
|
|
|
|
record.getProjectId(),
|
|
|
|
|
record.getBatchNumber(),
|
|
|
|
|
record.getMaterielId(),
|
|
|
|
|
record.getUnitPrice(),
|
|
|
|
|
record.getUnitName(),
|
|
|
|
|
transferQty, "7");
|
|
|
|
|
|
|
|
|
|
/* // 库存验证
|
|
|
|
|
WmsInventoryDetails inventoryDetails = wmsInventoryDetailsMapper.selectById(inventoryDetailsId);
|
|
|
|
|
double lossQty = inventoryDetails.getInventoryAmount() - transferQty;
|
|
|
|
|
if (lossQty < 0) {
|
|
|
|
|
@ -117,7 +132,9 @@ public class WmsMaterialTransferRecordServiceImpl implements IWmsMaterialTransfe
|
|
|
|
|
if (lossQty == 0) {
|
|
|
|
|
outDetails.setDelFlag("1");
|
|
|
|
|
}
|
|
|
|
|
wmsInventoryDetailsMapper.updateById(outDetails);
|
|
|
|
|
// wmsInventoryDetailsMapper.updateById(outDetails);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 入库库存增加
|
|
|
|
|
WmsInventoryDetails inDetails = new WmsInventoryDetails();
|
|
|
|
|
inDetails.setInventoryAmount(transferQty);// 入库数量
|
|
|
|
|
@ -125,11 +142,11 @@ public class WmsMaterialTransferRecordServiceImpl implements IWmsMaterialTransfe
|
|
|
|
|
inDetails.setMaterielId(inventoryDetails.getMaterielId());
|
|
|
|
|
inDetails.setUnitPrice(inventoryDetails.getUnitPrice());
|
|
|
|
|
inDetails.setBatchNumber(record.getBatchNumber());
|
|
|
|
|
inDetails.setUnitName(record.getUnitName());
|
|
|
|
|
inDetails.setUnitName(record.getUnitName());*/
|
|
|
|
|
// inDetails
|
|
|
|
|
wmsInventoryDetailsMapper.insert(inDetails);
|
|
|
|
|
// wmsInventoryDetailsMapper.insert(inDetails);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
baseMapper.insert(bo);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|