|
|
|
|
@ -1,12 +1,11 @@
|
|
|
|
|
package org.dromara.wms.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.github.yulichang.toolkit.JoinWrappers;
|
|
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.dromara.common.core.exception.ServiceException;
|
|
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
|
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
|
|
@ -14,22 +13,17 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
|
|
import org.dromara.common.satoken.utils.LoginHelper;
|
|
|
|
|
import org.dromara.wms.domain.BaseMaterialCategory;
|
|
|
|
|
import org.dromara.wms.domain.WmsBaseWarehouse;
|
|
|
|
|
import org.dromara.wms.domain.WmsConfiguration;
|
|
|
|
|
import org.dromara.wms.domain.WmsInstockOrder;
|
|
|
|
|
import org.dromara.wms.domain.bo.WmsInstockOrderBo;
|
|
|
|
|
import org.dromara.wms.domain.bo.*;
|
|
|
|
|
import org.dromara.wms.domain.vo.WmsBaseLocationVo;
|
|
|
|
|
import org.dromara.wms.domain.vo.WmsInstockOrderVo;
|
|
|
|
|
import org.dromara.wms.mapper.WmsInstockOrderMapper;
|
|
|
|
|
import org.dromara.wms.service.IWmsInstockDetailService;
|
|
|
|
|
import org.dromara.wms.service.IWmsInstockOrderService;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.dromara.wms.service.*;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.Collection;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -44,14 +38,22 @@ public class WmsInstockOrderServiceImpl implements IWmsInstockOrderService {
|
|
|
|
|
private static final AtomicInteger sequence = new AtomicInteger(999);
|
|
|
|
|
private static final String auditPass = "1";
|
|
|
|
|
private final WmsInstockOrderMapper baseMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private IWmsInstockDetailService wmsInstockDetailService;
|
|
|
|
|
private final IWmsInstockDetailService wmsInstockDetailService;
|
|
|
|
|
|
|
|
|
|
private final IWmsOutstockRecordService wmsOutstockRecordService;
|
|
|
|
|
private final IWmsInstockPrintService wmsInstockPrintService;
|
|
|
|
|
private final IWmsBaseLocationService baseLocationService;
|
|
|
|
|
private final IWmsInventoryService inventoryService;
|
|
|
|
|
|
|
|
|
|
private final IWmsInstockRecordService wmsInstockRecordService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static Integer nextSequence() {
|
|
|
|
|
return sequence.incrementAndGet();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询入库单
|
|
|
|
|
*
|
|
|
|
|
@ -169,6 +171,7 @@ public class WmsInstockOrderServiceImpl implements IWmsInstockOrderService {
|
|
|
|
|
* @return 是否新增成功
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public WmsInstockOrderVo insertByBo(WmsInstockOrderBo bo) {
|
|
|
|
|
String username = LoginHelper.getUsername();
|
|
|
|
|
Date date = new Date();
|
|
|
|
|
@ -183,36 +186,72 @@ public class WmsInstockOrderServiceImpl implements IWmsInstockOrderService {
|
|
|
|
|
}else {
|
|
|
|
|
orderLast = generateOrder(value);
|
|
|
|
|
}
|
|
|
|
|
// "即入即出" 逻辑:在子表保存完成后处理
|
|
|
|
|
if ("6".equals(bo.getInstockType())) {
|
|
|
|
|
bo.setAuditStatus("1");//即入即出直接通过
|
|
|
|
|
bo.setAuditBy(username);
|
|
|
|
|
bo.setAuditTime(date);
|
|
|
|
|
bo.setAuditComments("即入即出自动通过");
|
|
|
|
|
}
|
|
|
|
|
String inStockOrder = order + orderDate + orderLast;
|
|
|
|
|
WmsInstockOrder add = MapstructUtils.convert(bo, WmsInstockOrder.class);
|
|
|
|
|
List<WmsConfiguration> allConfigurationList = baseMapper.selectAllConfiguration(bo.getWarehouseId());
|
|
|
|
|
if (CollectionUtils.isNotEmpty(allConfigurationList)){
|
|
|
|
|
//查询入库单不用审批的配置
|
|
|
|
|
List<WmsConfiguration> unAuditConfigurationList = baseMapper.selectUnAuditByConfiguration(bo.getWarehouseId());
|
|
|
|
|
if (CollectionUtils.isNotEmpty(unAuditConfigurationList)){
|
|
|
|
|
add.setAuditStatus(auditPass);
|
|
|
|
|
}else {
|
|
|
|
|
//查询入库单是否有对应审批配置
|
|
|
|
|
List<WmsConfiguration> configurationList = baseMapper.selectAuditByConfiguration(bo.getWarehouseId());
|
|
|
|
|
if (CollectionUtils.isNotEmpty(configurationList)){
|
|
|
|
|
add.setAuditBy(configurationList.get(0).getAuditBy());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
add.setAuditStatus(auditPass);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
validEntityBeforeSave(add);
|
|
|
|
|
|
|
|
|
|
add.setInstockCode(inStockOrder);
|
|
|
|
|
add.setCreateBy(username);
|
|
|
|
|
|
|
|
|
|
// 保存入库单主表
|
|
|
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
|
|
|
if (flag) {
|
|
|
|
|
bo.setInstockId(add.getInstockId());
|
|
|
|
|
if (!flag) {
|
|
|
|
|
throw new ServiceException("入库单主表保存失败");
|
|
|
|
|
}
|
|
|
|
|
LambdaQueryWrapper<WmsInstockOrder> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
wrapper.eq(WmsInstockOrder::getInstockCode,inStockOrder);
|
|
|
|
|
WmsInstockOrderVo instockOrderVo = baseMapper.selectVoOne(wrapper);
|
|
|
|
|
return instockOrderVo;
|
|
|
|
|
MPJLambdaWrapper<WmsInstockOrder> addOne = buildQueryWrapper(bo);
|
|
|
|
|
WmsInstockOrderVo orderVo = baseMapper.selectVoOne(addOne);
|
|
|
|
|
// 设置生成的主键ID
|
|
|
|
|
bo.setInstockId(orderVo.getInstockId());
|
|
|
|
|
bo.setInstockCode(inStockOrder);
|
|
|
|
|
|
|
|
|
|
// 处理入库单子表
|
|
|
|
|
if (bo.getDetailListBo() != null && !bo.getDetailListBo().isEmpty()) {
|
|
|
|
|
// 为每个明细设置入库单信息
|
|
|
|
|
for (WmsInstockDetailBo detail : bo.getDetailListBo()) {
|
|
|
|
|
detail.setInstockId(orderVo.getInstockId());
|
|
|
|
|
detail.setInstockCode(inStockOrder);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 批量保存入库单子表
|
|
|
|
|
boolean detailFlag = wmsInstockDetailService.insertByBo(bo.getDetailListBo());
|
|
|
|
|
if (!detailFlag) {
|
|
|
|
|
throw new ServiceException("入库单子表保存失败");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// "即入即出" 逻辑:在子表保存完成后处理
|
|
|
|
|
if ("6".equals(bo.getInstockType())) {
|
|
|
|
|
if (!inAndOut(bo)) {
|
|
|
|
|
throw new ServiceException("即入即出入库单生成失败");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// List<WmsConfiguration> allConfigurationList = baseMapper.selectAllConfiguration(bo.getWarehouseId());
|
|
|
|
|
// if (CollectionUtils.isNotEmpty(allConfigurationList)){
|
|
|
|
|
// //查询入库单不用审批的配置
|
|
|
|
|
// List<WmsConfiguration> unAuditConfigurationList = baseMapper.selectUnAuditByConfiguration(bo.getWarehouseId());
|
|
|
|
|
// if (CollectionUtils.isNotEmpty(unAuditConfigurationList)){
|
|
|
|
|
// add.setAuditStatus(auditPass);
|
|
|
|
|
// }else {
|
|
|
|
|
// //查询入库单是否有对应审批配置
|
|
|
|
|
// List<WmsConfiguration> configurationList = baseMapper.selectAuditByConfiguration(bo.getWarehouseId());
|
|
|
|
|
// if (CollectionUtils.isNotEmpty(configurationList)){
|
|
|
|
|
// add.setAuditBy(configurationList.get(0).getAuditBy());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }else {
|
|
|
|
|
// add.setAuditStatus(auditPass);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return orderVo;
|
|
|
|
|
}
|
|
|
|
|
public String generateOrder(Integer value){
|
|
|
|
|
if (value.toString().length()<3){
|
|
|
|
|
@ -224,6 +263,165 @@ public class WmsInstockOrderServiceImpl implements IWmsInstockOrderService {
|
|
|
|
|
return value.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 即入即出的入库单类型
|
|
|
|
|
* 处理即入即出业务逻辑:
|
|
|
|
|
* 1. 为每个入库明细生成批次码
|
|
|
|
|
* 2. 生成入库记录
|
|
|
|
|
* 3. 生成对应的出库记录
|
|
|
|
|
* 4. 使用默认库位
|
|
|
|
|
* 5. 库存实时进出,最终库存量为0
|
|
|
|
|
*
|
|
|
|
|
* @param bo 入库单(已包含保存后的明细数据)
|
|
|
|
|
* @return 是否处理成功
|
|
|
|
|
*/
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
private boolean inAndOut(WmsInstockOrderBo bo) {
|
|
|
|
|
try {
|
|
|
|
|
// 获取默认库位,直接为第一个
|
|
|
|
|
List<WmsBaseLocationVo> locationList = baseLocationService.queryVoList(new WmsBaseLocationBo());
|
|
|
|
|
if (locationList == null || locationList.isEmpty()) {
|
|
|
|
|
throw new ServiceException("即入即出:默认库位不存在");
|
|
|
|
|
}
|
|
|
|
|
WmsBaseLocationVo defaultLocation = locationList.get(0);
|
|
|
|
|
String defaultLocationCode = defaultLocation.getLocationCode();
|
|
|
|
|
|
|
|
|
|
// 获取当前登录用户
|
|
|
|
|
String username = LoginHelper.getUsername();
|
|
|
|
|
Date currentTime = new Date();
|
|
|
|
|
|
|
|
|
|
// 处理每个入库明细 - 注意:此时明细已经保存到数据库
|
|
|
|
|
if (bo.getDetailListBo() != null && !bo.getDetailListBo().isEmpty()) {
|
|
|
|
|
for (WmsInstockDetailBo detail : bo.getDetailListBo()) {
|
|
|
|
|
// 1. 生成唯一批次码(入库单号 + 物料编码 + 序列号)
|
|
|
|
|
String batchCode = generateBatchCodeForInOut(bo.getInstockCode(), detail.getMaterialCode());
|
|
|
|
|
|
|
|
|
|
// 2. 创建入库记录
|
|
|
|
|
WmsInstockRecordBo instockRecord = new WmsInstockRecordBo();
|
|
|
|
|
instockRecord.setInstockCode(bo.getInstockCode());
|
|
|
|
|
instockRecord.setBatchCode(batchCode);
|
|
|
|
|
instockRecord.setMaterialId(detail.getMaterialId());
|
|
|
|
|
instockRecord.setWarehouseId(bo.getWarehouseId());
|
|
|
|
|
instockRecord.setLocationCode(defaultLocationCode);
|
|
|
|
|
instockRecord.setMaterialCode(detail.getMaterialCode());
|
|
|
|
|
instockRecord.setMaterialName(detail.getMaterialName());
|
|
|
|
|
instockRecord.setInstockQty(detail.getInstockQty().doubleValue());
|
|
|
|
|
instockRecord.setMaterialCategoryId(detail.getMaterialCategoryId());
|
|
|
|
|
instockRecord.setErpSynchronousStatus("0"); // 默认未同步
|
|
|
|
|
instockRecord.setErpSynchronousQty(0.0);
|
|
|
|
|
|
|
|
|
|
// 保存入库记录
|
|
|
|
|
boolean inRecordResult = wmsInstockRecordService.insertByBo(instockRecord);
|
|
|
|
|
if (!inRecordResult) {
|
|
|
|
|
throw new ServiceException("即入即出:入库记录保存失败 - " + detail.getMaterialCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 3. 创建出库记录(即入即出:入库后立即出库)
|
|
|
|
|
WmsOutstockRecordBo outstockRecord = new WmsOutstockRecordBo();
|
|
|
|
|
outstockRecord.setOutstockCode(generateOutstockCodeForInOut(bo.getInstockCode())); // 基于入库单号生成关联出库单号
|
|
|
|
|
outstockRecord.setOutstockId(null); // 即入即出模式没有正式出库单ID
|
|
|
|
|
outstockRecord.setBatchCode(batchCode); // 使用同一批次码
|
|
|
|
|
outstockRecord.setMaterialId(detail.getMaterialId());
|
|
|
|
|
outstockRecord.setLocationCode(defaultLocationCode);
|
|
|
|
|
outstockRecord.setOutstockQty(detail.getInstockQty());
|
|
|
|
|
outstockRecord.setMaterialCategoryId(detail.getMaterialCategoryId());
|
|
|
|
|
// outstockRecord.setErpSynchronousStatus("0"); // 默认未同步
|
|
|
|
|
// outstockRecord.setErpSynchronousQty(BigDecimal.ZERO);// 默认未同步
|
|
|
|
|
|
|
|
|
|
// 保存出库记录
|
|
|
|
|
boolean outRecordResult = wmsOutstockRecordService.insertByBo(outstockRecord);
|
|
|
|
|
if (!outRecordResult) {
|
|
|
|
|
throw new ServiceException("即入即出:出库记录保存失败 - " + detail.getMaterialCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 4. 库存处理:即入即出模式下,理论上不产生库存积压
|
|
|
|
|
// 但可以选择性地记录库存流水用于追溯
|
|
|
|
|
// TODO: 根据业务需求决定是否需要记录库存变动流水
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
throw new ServiceException("即入即出:入库明细为空,无法处理");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new ServiceException("即入即出处理失败:" + e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生成批次码
|
|
|
|
|
* 格式:BC + 年月日 + 6位序列号
|
|
|
|
|
*
|
|
|
|
|
* @return 批次码
|
|
|
|
|
*/
|
|
|
|
|
private String generateBatchCode() {
|
|
|
|
|
Date date = new Date();
|
|
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
|
|
|
|
|
String dateStr = format.format(date);
|
|
|
|
|
Integer sequence = nextSequence();
|
|
|
|
|
String sequenceStr = String.format("%06d", sequence);
|
|
|
|
|
return "BC" + dateStr + sequenceStr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生成出库单号
|
|
|
|
|
* 格式:OUT + 年月日 + 3位序列号
|
|
|
|
|
*
|
|
|
|
|
* @return 出库单号
|
|
|
|
|
*/
|
|
|
|
|
private String generateOutstockCode() {
|
|
|
|
|
Date date = new Date();
|
|
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
|
|
|
|
|
String dateStr = format.format(date);
|
|
|
|
|
Integer sequence = nextSequence();
|
|
|
|
|
String sequenceStr = String.format("%03d", sequence);
|
|
|
|
|
return "OUT" + dateStr + sequenceStr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 为即入即出生成批次码
|
|
|
|
|
* 格式:BC + 入库单号后8位 + 物料编码后6位 + 3位序列号
|
|
|
|
|
*
|
|
|
|
|
* @param instockCode 入库单号
|
|
|
|
|
* @param materialCode 物料编码
|
|
|
|
|
* @return 批次码
|
|
|
|
|
*/
|
|
|
|
|
private String generateBatchCodeForInOut(String instockCode, String materialCode) {
|
|
|
|
|
String prefix = "BC";
|
|
|
|
|
|
|
|
|
|
// 获取入库单号后8位(去除前缀IN)
|
|
|
|
|
String instockSuffix = instockCode.length() >= 8 ?
|
|
|
|
|
instockCode.substring(instockCode.length() - 8) : instockCode;
|
|
|
|
|
|
|
|
|
|
// 获取物料编码后6位,不足时前补0
|
|
|
|
|
String materialSuffix = materialCode.length() >= 6 ?
|
|
|
|
|
materialCode.substring(materialCode.length() - 6) :
|
|
|
|
|
String.format("%06d", Integer.parseInt(materialCode.replaceAll("[^0-9]", "0")));
|
|
|
|
|
|
|
|
|
|
// 生成3位序列号
|
|
|
|
|
Integer sequence = nextSequence();
|
|
|
|
|
String sequenceStr = String.format("%03d", sequence % 1000);
|
|
|
|
|
|
|
|
|
|
return prefix + instockSuffix + materialSuffix + sequenceStr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 为即入即出生成关联出库单号
|
|
|
|
|
* 格式:OUT + 入库单号后10位
|
|
|
|
|
*
|
|
|
|
|
* @param instockCode 入库单号
|
|
|
|
|
* @return 出库单号
|
|
|
|
|
*/
|
|
|
|
|
private String generateOutstockCodeForInOut(String instockCode) {
|
|
|
|
|
String prefix = "OUT";
|
|
|
|
|
|
|
|
|
|
// 获取入库单号后10位(去除前缀IN),确保唯一性
|
|
|
|
|
String instockSuffix = instockCode.length() >= 10 ?
|
|
|
|
|
instockCode.substring(instockCode.length() - 10) : instockCode;
|
|
|
|
|
|
|
|
|
|
return prefix + instockSuffix;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 修改入库单
|
|
|
|
|
*
|
|
|
|
|
@ -282,4 +480,86 @@ public class WmsInstockOrderServiceImpl implements IWmsInstockOrderService {
|
|
|
|
|
int count = wmsInstockDetailService.deleteByInstockId(ids);
|
|
|
|
|
return delete>0;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 创建外协入库单
|
|
|
|
|
* 1. 生成入库单号
|
|
|
|
|
* 2. 转换并保存入库单主表信息
|
|
|
|
|
* 3. 保存明细信息
|
|
|
|
|
* 4. 若明细中有批次号,则生成打印记录
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 创建外协入库单
|
|
|
|
|
* 1. 生成入库单号
|
|
|
|
|
* 2. 转换并保存入库单主表信息
|
|
|
|
|
* 3. 保存明细信息
|
|
|
|
|
* 4. 若明细中有批次号,则生成打印记录
|
|
|
|
|
*
|
|
|
|
|
* @param bo 入库单业务对象,包含入库单主表和明细信息
|
|
|
|
|
* @return 是否创建成功
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public Boolean createOutsourceInstockOrder(WmsInstockOrderBo bo) {
|
|
|
|
|
// 1. 获取当前登录用户名
|
|
|
|
|
String username = LoginHelper.getUsername();
|
|
|
|
|
|
|
|
|
|
// 2. 生成入库单号:格式为 IN + 年月日 + 3位序列号
|
|
|
|
|
Date date = new Date();
|
|
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
|
|
|
|
|
String orderDate = format.format(date);
|
|
|
|
|
String order = "IN";
|
|
|
|
|
String orderLast = "";
|
|
|
|
|
Integer value = nextSequence();
|
|
|
|
|
if (value.toString().length() == 4) {
|
|
|
|
|
sequence.set(1);
|
|
|
|
|
orderLast = generateOrder(sequence.get());
|
|
|
|
|
} else {
|
|
|
|
|
orderLast = generateOrder(value);
|
|
|
|
|
}
|
|
|
|
|
String inStockOrder = order + orderDate + orderLast;
|
|
|
|
|
|
|
|
|
|
// 3. 转换并设置入库单主表信息
|
|
|
|
|
WmsInstockOrder add = MapstructUtils.convert(bo, WmsInstockOrder.class);
|
|
|
|
|
add.setInstockCode(inStockOrder);
|
|
|
|
|
add.setCreateBy(username);
|
|
|
|
|
// add.setAuditStatus("1"); // 外协入库默认审核通过
|
|
|
|
|
|
|
|
|
|
// 4. 保存入库单主表
|
|
|
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
|
|
|
|
|
|
|
|
if (flag) {
|
|
|
|
|
// 5. 处理入库单子表
|
|
|
|
|
bo.getDetailListBo().forEach(detail -> {
|
|
|
|
|
// 设置明细关联的入库单ID和单号
|
|
|
|
|
detail.setInstockId(add.getInstockId());
|
|
|
|
|
detail.setInstockCode(inStockOrder);
|
|
|
|
|
|
|
|
|
|
// 6. 保存入库单子表(单个保存)
|
|
|
|
|
wmsInstockDetailService.insertByBo(Collections.singletonList(detail));
|
|
|
|
|
|
|
|
|
|
// 7. 如果明细中有批次号,则生成打印记录
|
|
|
|
|
if (StringUtils.isNotBlank(detail.getBatchCode())) {
|
|
|
|
|
WmsInstockPrintBo printBo = new WmsInstockPrintBo();
|
|
|
|
|
// 设置打印记录信息
|
|
|
|
|
printBo.setInstockCode(inStockOrder);
|
|
|
|
|
printBo.setBatchCode(detail.getBatchCode());
|
|
|
|
|
printBo.setMaterialQty(detail.getInstockQty().longValue());
|
|
|
|
|
printBo.setApportionQty(detail.getApportionQty());
|
|
|
|
|
printBo.setMaterialId(detail.getMaterialId());
|
|
|
|
|
printBo.setMaterialCode(detail.getMaterialCode());
|
|
|
|
|
printBo.setMaterialName(detail.getMaterialName());
|
|
|
|
|
printBo.setMaterialSpe(detail.getMaterialSpe());
|
|
|
|
|
printBo.setUnitName(detail.getUnitName());
|
|
|
|
|
printBo.setCodeYesNo(detail.getCodeYesNo());
|
|
|
|
|
printBo.setMaterialCategoryId(detail.getMaterialCategoryId());
|
|
|
|
|
|
|
|
|
|
// 8. 保存打印记录
|
|
|
|
|
wmsInstockPrintService.insertByBo(printBo);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return flag;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|