|
|
|
|
@ -5,6 +5,7 @@ import com.github.yulichang.toolkit.JoinWrappers;
|
|
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
|
|
import org.dromara.common.core.exception.ServiceException;
|
|
|
|
|
import org.dromara.common.core.utils.DateUtils;
|
|
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
|
|
@ -12,10 +13,7 @@ import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
|
|
import org.dromara.common.satoken.utils.LoginHelper;
|
|
|
|
|
import org.dromara.system.api.RemoteCodeRuleService;
|
|
|
|
|
import org.dromara.wms.domain.WmsInventoryDetails;
|
|
|
|
|
import org.dromara.wms.domain.WmsInventoryLedger;
|
|
|
|
|
import org.dromara.wms.domain.WmsOutStockBill;
|
|
|
|
|
import org.dromara.wms.domain.WmsOutStockDetails;
|
|
|
|
|
import org.dromara.wms.domain.*;
|
|
|
|
|
import org.dromara.wms.domain.bo.WmsOutStockBillBo;
|
|
|
|
|
import org.dromara.wms.domain.vo.WmsOutStockBillVo;
|
|
|
|
|
import org.dromara.wms.mapper.WmsInventoryDetailsMapper;
|
|
|
|
|
@ -113,18 +111,18 @@ public class WmsOutStockBillServiceImpl implements IWmsOutStockBillService {
|
|
|
|
|
public Boolean insertByBo(WmsOutStockBillBo bo) {
|
|
|
|
|
WmsOutStockBill add = MapstructUtils.convert(bo, WmsOutStockBill.class);
|
|
|
|
|
add.setOutStockCode(remoteCodeRuleService.selectCodeRuleCode("1006"));
|
|
|
|
|
add.setOutStockBillStatus("3");
|
|
|
|
|
add.setOutStockBillStatus("0");//备货
|
|
|
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
|
|
|
if (flag) {
|
|
|
|
|
Long outStockBillId = add.getOutStockBillId();
|
|
|
|
|
List<WmsOutStockDetails> outStockDetailsList = bo.getOutStockDetailsList();
|
|
|
|
|
List<WmsInventoryLedger> wmsInventoryLedgers = new ArrayList<>();
|
|
|
|
|
// List<WmsInventoryLedger> wmsInventoryLedgers = new ArrayList<>();
|
|
|
|
|
outStockDetailsList.forEach(item -> {
|
|
|
|
|
item.setOutStockBillId(outStockBillId);
|
|
|
|
|
// 从出库明细中获取库存ID
|
|
|
|
|
Long inventoryId = item.getInventoryDetailsId();
|
|
|
|
|
inventoryDetailsService.outStoreLossInventoryAmount(inventoryId,
|
|
|
|
|
item.getOutStockAmount(),item.getWarehouseId(),item.getBatchNumber(),item.getMaterielId(),"3");
|
|
|
|
|
// // 从出库明细中获取库存ID
|
|
|
|
|
// Long inventoryId = item.getInventoryDetailsId();
|
|
|
|
|
// inventoryDetailsService.outStoreLossInventoryAmount(inventoryId,
|
|
|
|
|
// item.getOutStockAmount(),item.getWarehouseId(),item.getBatchNumber(),item.getMaterielId(),"3");
|
|
|
|
|
});
|
|
|
|
|
//插入出库明细
|
|
|
|
|
wmsOutStockDetailsMapper.insert(outStockDetailsList);
|
|
|
|
|
@ -159,4 +157,25 @@ public class WmsOutStockBillServiceImpl implements IWmsOutStockBillService {
|
|
|
|
|
|
|
|
|
|
return baseMapper.deleteByIds(ids) > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Boolean deliver(Long outStockBillId) {
|
|
|
|
|
|
|
|
|
|
MPJLambdaWrapper<WmsOutStockDetails> lqw = JoinWrappers.lambda(WmsOutStockDetails.class)
|
|
|
|
|
.selectAll(WmsOutStockDetails.class)
|
|
|
|
|
.eq(WmsOutStockDetails::getOutStockBillId, outStockBillId);
|
|
|
|
|
// 校验出库单是否存在
|
|
|
|
|
List<WmsOutStockDetails> outStockDetailsList = wmsOutStockDetailsMapper.selectList(lqw);
|
|
|
|
|
if (outStockDetailsList == null || outStockDetailsList.isEmpty()) {
|
|
|
|
|
throw new ServiceException("出库单不存在");
|
|
|
|
|
}
|
|
|
|
|
outStockDetailsList.forEach(item -> {
|
|
|
|
|
item.setOutStockBillId(outStockBillId);
|
|
|
|
|
// 从出库明细中获取库存ID
|
|
|
|
|
Long inventoryId = item.getInventoryDetailsId();
|
|
|
|
|
inventoryDetailsService.outStoreLossInventoryAmount(inventoryId,
|
|
|
|
|
item.getOutStockAmount(),item.getWarehouseId(),item.getBatchNumber(),item.getMaterielId(),"3");
|
|
|
|
|
});
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|