|
|
|
@ -17,12 +17,8 @@
|
|
|
|
|
package com.logpm.distribution.service.impl; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
|
import com.alibaba.excel.ExcelWriter; |
|
|
|
|
import com.alibaba.excel.write.metadata.WriteSheet; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
@ -30,7 +26,6 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
import com.logpm.basicdata.entity.BasicdataWarehouseEntity; |
|
|
|
|
import com.logpm.basicdata.feign.IBasicdataTrayClient; |
|
|
|
|
import com.logpm.basicdata.feign.IBasicdataWarehouseClient; |
|
|
|
|
import com.logpm.distribution.bean.Resp; |
|
|
|
|
import com.logpm.distribution.config.RedissonConfig; |
|
|
|
@ -39,18 +34,15 @@ import com.logpm.distribution.dto.DistributionStockListDTO;
|
|
|
|
|
import com.logpm.distribution.dto.DistrilbutionBillLadingDTO; |
|
|
|
|
import com.logpm.distribution.dto.app.BillLadingAppDTO; |
|
|
|
|
import com.logpm.distribution.entity.*; |
|
|
|
|
import com.logpm.distribution.excel.DistributionStockArticleExcel; |
|
|
|
|
import com.logpm.distribution.excel.DistrilbutionBillLadingExcel; |
|
|
|
|
import com.logpm.distribution.mapper.DistrilbutionBillLadingMapper; |
|
|
|
|
import com.logpm.distribution.service.*; |
|
|
|
|
import com.logpm.distribution.vo.*; |
|
|
|
|
import com.logpm.distribution.vo.app.*; |
|
|
|
|
import com.logpm.distribution.wrapper.DistributionStockArticleWrapper; |
|
|
|
|
import com.logpm.warehouse.feign.IWarehouseTrayGoodsClient; |
|
|
|
|
import com.logpm.warehouse.feign.IWarehouseUpdownTypeClient; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.extern.log4j.Log4j2; |
|
|
|
|
import org.apache.commons.codec.Charsets; |
|
|
|
|
import org.redisson.api.RLock; |
|
|
|
|
import org.springblade.common.constant.DictBizConstant; |
|
|
|
|
import org.springblade.common.constant.billLading.BillLadingStatusConstant; |
|
|
|
@ -58,20 +50,16 @@ import org.springblade.common.constant.order.OrderReservationStatusConstant;
|
|
|
|
|
import org.springblade.common.constant.order.OrderStatusConstant; |
|
|
|
|
import org.springblade.common.constant.orderpackage.OrderPackageReservationStatusConstant; |
|
|
|
|
import org.springblade.common.constant.orderpackage.OrderPackageStatusConstant; |
|
|
|
|
import org.springblade.common.constant.orderpackage.OrderPackageStockupStatusConstant; |
|
|
|
|
import org.springblade.common.constant.pda.PdaAudioLingoStatus; |
|
|
|
|
import org.springblade.common.constant.stockup.StockAssignStatusConstant; |
|
|
|
|
import org.springblade.common.constant.stockup.StockupStatusConstant; |
|
|
|
|
import org.springblade.common.constant.stockup.StockupTypeConstant; |
|
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
import org.springblade.core.mp.support.Condition; |
|
|
|
|
import org.springblade.core.secure.BladeUser; |
|
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.constant.BladeConstant; |
|
|
|
|
import org.springblade.core.tool.utils.BeanUtil; |
|
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
|
import org.springblade.system.cache.DictBizCache; |
|
|
|
@ -79,21 +67,16 @@ import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.io.Serializable; |
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.net.URLEncoder; |
|
|
|
|
import java.nio.charset.StandardCharsets; |
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
|
import java.util.concurrent.atomic.AtomicBoolean; |
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
|
import java.util.concurrent.atomic.AtomicReference; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
import static org.bouncycastle.math.ec.custom.gm.SM2P256V1Curve.q; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 提货单 服务实现类 |
|
|
|
|
* |
|
|
|
@ -164,6 +147,11 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
|
|
|
|
|
public Boolean ownSaveOrUpdate(DistrilbutionBillLadingDTO distrilbutionBillLading) { |
|
|
|
|
Boolean las = false; |
|
|
|
|
if (ObjectUtils.isNotNull(distrilbutionBillLading.getId())) { |
|
|
|
|
//判断是否已签收
|
|
|
|
|
DistrilbutionBillLadingEntity billLadingEntity = baseMapper.selectById(distrilbutionBillLading.getId()); |
|
|
|
|
if(ObjectUtils.isNotNull(billLadingEntity) && billLadingEntity.getConditions().equals(BillLadingStatusConstant.yiqianshou.getValue())){ |
|
|
|
|
throw new ServiceException("已签收,无法修改计划!!!"); |
|
|
|
|
} |
|
|
|
|
las = true; |
|
|
|
|
//修改
|
|
|
|
|
this.updateById(distrilbutionBillLading); |
|
|
|
@ -1691,17 +1679,29 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
|
|
|
|
|
//修改订单状态
|
|
|
|
|
List<DistrilbutionBillStockEntity> list = distrilbutionBillStockService.list(Wrappers.<DistrilbutionBillStockEntity>query().lambda() |
|
|
|
|
.eq(DistrilbutionBillStockEntity::getBillLadingId, s) |
|
|
|
|
.eq(DistrilbutionBillStockEntity::getOrderStatus, "1") |
|
|
|
|
.or(ew -> ew.eq(DistrilbutionBillStockEntity::getBillLadingId, s).eq(DistrilbutionBillStockEntity::getOrderStatus, "2")) |
|
|
|
|
.apply("order_status in ( 1 , 2)") |
|
|
|
|
// .or(ew -> ew.eq(DistrilbutionBillStockEntity::getBillLadingId, s).apply(DistrilbutionBillStockEntity::getOrderStatus, "2"))
|
|
|
|
|
); |
|
|
|
|
if (!list.isEmpty()) { |
|
|
|
|
list.forEach(li -> { |
|
|
|
|
DistributionStockArticleEntity stockArticleEntity = new DistributionStockArticleEntity(); |
|
|
|
|
stockArticleEntity.setOrderStatus(OrderStatusConstant.qianshou.getValue()); |
|
|
|
|
stockArticleEntity.setId(li.getStockArticleId()); |
|
|
|
|
|
|
|
|
|
List<DistributionParcelListEntity> list2 = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda() |
|
|
|
|
.eq(DistributionParcelListEntity::getStockArticleId, li.getStockArticleId()) |
|
|
|
|
.apply("order_package_status != 70 ") |
|
|
|
|
); |
|
|
|
|
if(list2.isEmpty()){ |
|
|
|
|
stockArticleEntity.setOrderStatus(OrderStatusConstant.qianshou.getValue()); |
|
|
|
|
}else{ |
|
|
|
|
stockArticleEntity.setOrderStatus(OrderStatusConstant.bufenqianshou.getValue()); |
|
|
|
|
} |
|
|
|
|
//回退包件数据
|
|
|
|
|
Integer i1 = updatePack(li.getStockArticleId(), Long.valueOf(s)); |
|
|
|
|
if(i1 > 0){ |
|
|
|
|
stockArticleEntity.setOrderStatus(OrderStatusConstant.bufenqianshou.getValue()); |
|
|
|
|
} |
|
|
|
|
distributionStockArticleService.updateById(stockArticleEntity); |
|
|
|
|
//添加签收包件数据
|
|
|
|
|
updatePack(li.getStockArticleId(), Long.valueOf(s)); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
//处理库存品签收数据
|
|
|
|
@ -1748,13 +1748,14 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
|
|
|
|
|
* 修改包件签收状态 |
|
|
|
|
*/ |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public void updatePack(Long ids,Long billId){ |
|
|
|
|
public Integer updatePack(Long ids,Long billId){ |
|
|
|
|
|
|
|
|
|
List<DistrilbutionBillPackageEntity> list = distrilbutionBillPackageService.list(Wrappers.<DistrilbutionBillPackageEntity>query().lambda() |
|
|
|
|
.eq(DistrilbutionBillPackageEntity::getBillLadingId, billId) |
|
|
|
|
.eq(DistrilbutionBillPackageEntity::getStockArticleId, ids) |
|
|
|
|
); |
|
|
|
|
List<DistributionBillLadingScanEntity> scanEntityList = new ArrayList<>(); |
|
|
|
|
AtomicReference<Integer> num = new AtomicReference<>(0); |
|
|
|
|
if(ObjectUtils.isNotNull(list) && !list.isEmpty()){ |
|
|
|
|
//签收记录
|
|
|
|
|
List<DistributionBillLadingScanEntity> list1 = distributionBillLadingScanService.list(Wrappers.<DistributionBillLadingScanEntity>query().lambda() |
|
|
|
@ -1792,26 +1793,16 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
|
|
|
|
|
parcelListEntity.setId(i.getParceListId()); |
|
|
|
|
parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.daiyuyue.getValue()); |
|
|
|
|
distributionParcelListService.updateById(parcelListEntity); |
|
|
|
|
//修改订单状态
|
|
|
|
|
DistributionStockArticleEntity stockArticleEntity = new DistributionStockArticleEntity(); |
|
|
|
|
stockArticleEntity.setId(i.getStockArticleId()); |
|
|
|
|
stockArticleEntity.setOrderReceiveStatus(OrderReservationStatusConstant.bufenyuyue.getValue()); |
|
|
|
|
distributionStockArticleService.updateById(stockArticleEntity); |
|
|
|
|
// DistributionBillLadingScanEntity billLadingScan = new DistributionBillLadingScanEntity();
|
|
|
|
|
// billLadingScan.setMaterialType("2");
|
|
|
|
|
// billLadingScan.setScanType(2);
|
|
|
|
|
// billLadingScan.setParcelListId(i.getParceListId());
|
|
|
|
|
// billLadingScan.setStockArticleId(i.getStockArticleId());
|
|
|
|
|
// billLadingScan.setBillLadingId(billId);
|
|
|
|
|
// billLadingScan.setPacketBarCode( i.getPacketBarCode());
|
|
|
|
|
// billLadingScan.setQuantity(i.getPacketNumber());
|
|
|
|
|
// scanEntityList.add(billLadingScan);
|
|
|
|
|
num.getAndSet(num.get() + 1); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if(!scanEntityList.isEmpty()){
|
|
|
|
|
// distributionBillLadingScanService.saveBatch(scanEntityList);
|
|
|
|
|
// }
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return num.get(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|