|
|
@ -9,16 +9,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
import com.logpm.basic.entity.BasicMaterialEntity; |
|
|
|
import com.logpm.basic.entity.BasicMaterialEntity; |
|
|
|
import com.logpm.basic.feign.IBasicMaterialClient; |
|
|
|
import com.logpm.basic.feign.IBasicMaterialClient; |
|
|
|
import com.logpm.basicdata.entity.BasicdataBrandEntity; |
|
|
|
import com.logpm.basicdata.entity.*; |
|
|
|
import com.logpm.basicdata.entity.BasicdataCategoryEntity; |
|
|
|
import com.logpm.basicdata.feign.*; |
|
|
|
import com.logpm.basicdata.entity.BasicdataClientEntity; |
|
|
|
|
|
|
|
import com.logpm.basicdata.entity.BasicdataStoreBusinessEntity; |
|
|
|
|
|
|
|
import com.logpm.basicdata.entity.BasicdataWarehouseEntity; |
|
|
|
|
|
|
|
import com.logpm.basicdata.feign.IBasicdataBrandClient; |
|
|
|
|
|
|
|
import com.logpm.basicdata.feign.IBasicdataCategoryClient; |
|
|
|
|
|
|
|
import com.logpm.basicdata.feign.IBasicdataClientClient; |
|
|
|
|
|
|
|
import com.logpm.basicdata.feign.IBasicdataStoreBusinessClient; |
|
|
|
|
|
|
|
import com.logpm.basicdata.feign.IBasicdataWarehouseClient; |
|
|
|
|
|
|
|
import com.logpm.distribution.entity.DistributionParcelListEntity; |
|
|
|
import com.logpm.distribution.entity.DistributionParcelListEntity; |
|
|
|
import com.logpm.distribution.entity.DistributionStockArticleEntity; |
|
|
|
import com.logpm.distribution.entity.DistributionStockArticleEntity; |
|
|
|
import com.logpm.distribution.feign.IDistributionParcelListClient; |
|
|
|
import com.logpm.distribution.feign.IDistributionParcelListClient; |
|
|
@ -37,23 +29,8 @@ import com.logpm.factory.snm.bean.Resp; |
|
|
|
import com.logpm.factory.snm.entity.PanFactoryOrder; |
|
|
|
import com.logpm.factory.snm.entity.PanFactoryOrder; |
|
|
|
import com.logpm.factory.snm.entity.PanPackageInfo; |
|
|
|
import com.logpm.factory.snm.entity.PanPackageInfo; |
|
|
|
import com.logpm.factory.snm.entity.PanPackageList; |
|
|
|
import com.logpm.factory.snm.entity.PanPackageList; |
|
|
|
import com.logpm.oldproject.entity.AdvanceDetailEntity; |
|
|
|
import com.logpm.oldproject.entity.*; |
|
|
|
import com.logpm.oldproject.entity.AdvanceEntity; |
|
|
|
import com.logpm.oldproject.feign.*; |
|
|
|
import com.logpm.oldproject.entity.DetailProductEntity; |
|
|
|
|
|
|
|
import com.logpm.oldproject.entity.OrderDetailEntity; |
|
|
|
|
|
|
|
import com.logpm.oldproject.entity.TrayScanDesEntity; |
|
|
|
|
|
|
|
import com.logpm.oldproject.entity.TrayScanEntity; |
|
|
|
|
|
|
|
import com.logpm.oldproject.entity.WayBillEntity; |
|
|
|
|
|
|
|
import com.logpm.oldproject.entity.WaybillDesEntity; |
|
|
|
|
|
|
|
import com.logpm.oldproject.feign.IAdvanceClient; |
|
|
|
|
|
|
|
import com.logpm.oldproject.feign.IAdvanceDetailClient; |
|
|
|
|
|
|
|
import com.logpm.oldproject.feign.IDetailProductClient; |
|
|
|
|
|
|
|
import com.logpm.oldproject.feign.IOrderDetailClient; |
|
|
|
|
|
|
|
import com.logpm.oldproject.feign.ITrayScanClient; |
|
|
|
|
|
|
|
import com.logpm.oldproject.feign.ITrayScanDesClient; |
|
|
|
|
|
|
|
import com.logpm.oldproject.feign.IWarehouseClient; |
|
|
|
|
|
|
|
import com.logpm.oldproject.feign.IWayBillClient; |
|
|
|
|
|
|
|
import com.logpm.oldproject.feign.IWaybillDesClient; |
|
|
|
|
|
|
|
import com.logpm.oldproject.vo.DistributionParcelListEntityVO; |
|
|
|
import com.logpm.oldproject.vo.DistributionParcelListEntityVO; |
|
|
|
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; |
|
|
|
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; |
|
|
|
import com.logpm.trunkline.entity.TrunklineAdvanceEntity; |
|
|
|
import com.logpm.trunkline.entity.TrunklineAdvanceEntity; |
|
|
@ -70,23 +47,13 @@ import com.logpm.warehouse.feign.IWarehouseWaybillClient; |
|
|
|
import com.logpm.warehouse.feign.IWarehouseWaybillDetailClient; |
|
|
|
import com.logpm.warehouse.feign.IWarehouseWaybillDetailClient; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.redisson.api.RLock; |
|
|
|
|
|
|
|
import org.redisson.api.RedissonClient; |
|
|
|
|
|
|
|
import org.springblade.common.constant.TenantNum; |
|
|
|
import org.springblade.common.constant.TenantNum; |
|
|
|
import org.springblade.common.constant.order.OrderFreezeStatusConstant; |
|
|
|
import org.springblade.common.constant.order.*; |
|
|
|
import org.springblade.common.constant.order.OrderGroundingStatusConstant; |
|
|
|
import org.springblade.common.constant.orderpackage.*; |
|
|
|
import org.springblade.common.constant.order.OrderReceiveStatusConstant; |
|
|
|
|
|
|
|
import org.springblade.common.constant.order.OrderReservationStatusConstant; |
|
|
|
|
|
|
|
import org.springblade.common.constant.order.OrderStatusConstant; |
|
|
|
|
|
|
|
import org.springblade.common.constant.order.OrderStockupStatusConstant; |
|
|
|
|
|
|
|
import org.springblade.common.constant.orderpackage.OrderPackageFreezeStatusConstant; |
|
|
|
|
|
|
|
import org.springblade.common.constant.orderpackage.OrderPackageGroundingStatusConstant; |
|
|
|
|
|
|
|
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.exception.CustomerException; |
|
|
|
import org.springblade.common.exception.CustomerException; |
|
|
|
import org.springblade.common.utils.CommonUtil; |
|
|
|
import org.springblade.common.utils.CommonUtil; |
|
|
|
import org.springblade.core.redis.cache.BladeRedis; |
|
|
|
import org.springblade.core.redis.cache.BladeRedis; |
|
|
|
|
|
|
|
import org.springblade.core.redis.lock.LockType; |
|
|
|
import org.springblade.core.redis.lock.RedisLockClient; |
|
|
|
import org.springblade.core.redis.lock.RedisLockClient; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.utils.ObjectUtil; |
|
|
|
import org.springblade.core.tool.utils.ObjectUtil; |
|
|
@ -96,12 +63,8 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.*; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
import java.util.Objects; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Slf4j |
|
|
|
@Slf4j |
|
|
|
@AllArgsConstructor |
|
|
|
@AllArgsConstructor |
|
|
@ -151,7 +114,6 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { |
|
|
|
|
|
|
|
|
|
|
|
private final BladeRedis redis; |
|
|
|
private final BladeRedis redis; |
|
|
|
private final RedisLockClient redisLockClient; |
|
|
|
private final RedisLockClient redisLockClient; |
|
|
|
private final RedissonClient redissonClient; |
|
|
|
|
|
|
|
private final IRegionFeign regionFeign; |
|
|
|
private final IRegionFeign regionFeign; |
|
|
|
private final IBasicdataBrandClient basicdataBrandClient; |
|
|
|
private final IBasicdataBrandClient basicdataBrandClient; |
|
|
|
|
|
|
|
|
|
|
@ -536,7 +498,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { |
|
|
|
String takeCompany= ""; |
|
|
|
String takeCompany= ""; |
|
|
|
if(ObjectUtil.isNotEmpty(supplyData)){ |
|
|
|
if(ObjectUtil.isNotEmpty(supplyData)){ |
|
|
|
destinationWarehouse = supplyData.get("destinationWarehouse");//目的仓名称
|
|
|
|
destinationWarehouse = supplyData.get("destinationWarehouse");//目的仓名称
|
|
|
|
takeCompany = supplyData.get("takeCompany"); |
|
|
|
takeCompany = supplyData.get("takeCompany"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// OrderDetailEntity orderDetailEntity = orderDetailClient.findByUnitNo(unitNo);
|
|
|
|
// OrderDetailEntity orderDetailEntity = orderDetailClient.findByUnitNo(unitNo);
|
|
|
@ -564,7 +526,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { |
|
|
|
if (Objects.isNull(distributionStockArticleEntity)) { |
|
|
|
if (Objects.isNull(distributionStockArticleEntity)) { |
|
|
|
Date date = new Date(); |
|
|
|
Date date = new Date(); |
|
|
|
if(StringUtil.isNoneBlank(operationTime)){ |
|
|
|
if(StringUtil.isNoneBlank(operationTime)){ |
|
|
|
date = CommonUtil.StringToDate(operationTime); |
|
|
|
date = CommonUtil.StringToDate(operationTime); |
|
|
|
} |
|
|
|
} |
|
|
|
log.info("#################handleDataToPlatform.waybillNoNum: {}", waybillNoNum); |
|
|
|
log.info("#################handleDataToPlatform.waybillNoNum: {}", waybillNoNum); |
|
|
|
|
|
|
|
|
|
|
@ -596,9 +558,9 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { |
|
|
|
distributionStockArticleEntity.setCompleteSet(0); |
|
|
|
distributionStockArticleEntity.setCompleteSet(0); |
|
|
|
} |
|
|
|
} |
|
|
|
log.info("############basicdataWarehouseEntity {}", basicdataWarehouseEntity); |
|
|
|
log.info("############basicdataWarehouseEntity {}", basicdataWarehouseEntity); |
|
|
|
distributionStockArticleEntity.setCreateDept(basicdataWarehouseEntity.getDepartment()); |
|
|
|
distributionStockArticleEntity.setCreateDept(basicdataWarehouseEntity.getDepartment()); |
|
|
|
|
|
|
|
|
|
|
|
WayBillEntity wayBillEntity = wayBillClient.getByWaybillNo(waybillNoNum); |
|
|
|
WayBillEntity wayBillEntity = wayBillClient.getByWaybillNo(waybillNoNum); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(Objects.isNull(wayBillEntity)){ |
|
|
|
if(Objects.isNull(wayBillEntity)){ |
|
|
@ -949,187 +911,188 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { |
|
|
|
// log.info("###########saveWaybillEntity: 已有保存数据 waybillNo={}", waybillNo);
|
|
|
|
// log.info("###########saveWaybillEntity: 已有保存数据 waybillNo={}", waybillNo);
|
|
|
|
// return waybillId;
|
|
|
|
// return waybillId;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//通过运单号先去查询新系统是否存在这个运单号
|
|
|
|
|
|
|
|
WarehouseWaybillEntity warehouseWaybill = warehouseWaybillClient.findByWaybillNo(waybillNo); |
|
|
|
String lockKey = "dealwithWaybillNo:" + waybillNo; |
|
|
|
String lockKey = "dealwithWaybillNo:lock:" + waybillNo; |
|
|
|
|
|
|
|
Long aLong = null; |
|
|
|
Long aLong = null; |
|
|
|
boolean flag = false; |
|
|
|
boolean flag = false; |
|
|
|
RLock lock = redissonClient.getLock(lockKey); |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
flag = redisLockClient.tryLock(lockKey, LockType.FAIR, 20000, 30000, TimeUnit.MILLISECONDS); |
|
|
|
|
|
|
|
} catch (InterruptedException e) { |
|
|
|
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
log.info("##############我的flag状态 ================================{}",flag); |
|
|
|
|
|
|
|
if(flag){ |
|
|
|
|
|
|
|
log.info("##############我走的新增运单 ================================1"); |
|
|
|
|
|
|
|
//通过运单号先去查询新系统是否存在这个运单号
|
|
|
|
|
|
|
|
WarehouseWaybillEntity warehouseWaybill = warehouseWaybillClient.findByWaybillNo(waybillNo); |
|
|
|
|
|
|
|
log.info("#################handleDataToPlatform.warehouseWaybill: {}", warehouseWaybill); |
|
|
|
|
|
|
|
|
|
|
|
if (Objects.isNull(warehouseWaybill)) { |
|
|
|
if (Objects.isNull(warehouseWaybill)) { |
|
|
|
lock.lock(); |
|
|
|
// redis.setEx("dealwithWaybillNo:" + waybillNo, waybillNo, 30L);
|
|
|
|
warehouseWaybill = warehouseWaybillClient.findByWaybillNo(waybillNo); |
|
|
|
//如果新系统中不存在这个运单,那么就去查询老系统的运单数据
|
|
|
|
log.info("#################handleDataToPlatform.warehouseWaybill: {}", warehouseWaybill); |
|
|
|
WayBillEntity wayBillEntity = wayBillClient.getByWaybillNo(waybillNo); |
|
|
|
if (Objects.isNull(warehouseWaybill)) { |
|
|
|
log.info("#################handleDataToPlatform.wayBillEntity: {}", wayBillEntity); |
|
|
|
redis.setEx("dealwithWaybillNo:" + waybillNo, waybillNo, 30L); |
|
|
|
if (Objects.isNull(wayBillEntity)) { |
|
|
|
//如果新系统中不存在这个运单,那么就去查询老系统的运单数据
|
|
|
|
log.warn("##############saveWaybillEntity: 老系统中未找到对应运单waybillNo={}", waybillNo); |
|
|
|
WayBillEntity wayBillEntity = wayBillClient.getByWaybillNo(waybillNo); |
|
|
|
throw new CustomerException("老系统中未找到对应运单"); |
|
|
|
log.info("#################handleDataToPlatform.wayBillEntity: {}", wayBillEntity); |
|
|
|
} |
|
|
|
if (Objects.isNull(wayBillEntity)) { |
|
|
|
String startSite = wayBillEntity.getStartSite();//始发仓名称
|
|
|
|
log.warn("##############saveWaybillEntity: 老系统中未找到对应运单waybillNo={}", waybillNo); |
|
|
|
BasicdataWarehouseEntity starthouse = basicdataWarehouseClient.findByName(startSite); |
|
|
|
throw new CustomerException("老系统中未找到对应运单"); |
|
|
|
String warehouseName = wayBillEntity.getWarehouseName();//目的仓
|
|
|
|
} |
|
|
|
BasicdataWarehouseEntity endhouse = basicdataWarehouseClient.findByName(warehouseName); |
|
|
|
String startSite = wayBillEntity.getStartSite();//始发仓名称
|
|
|
|
Integer number = wayBillEntity.getNumber();//运单总数量
|
|
|
|
BasicdataWarehouseEntity starthouse = basicdataWarehouseClient.findByName(startSite); |
|
|
|
String packname = wayBillEntity.getPackname(); |
|
|
|
String warehouseName = wayBillEntity.getWarehouseName();//目的仓
|
|
|
|
String agent = wayBillEntity.getAgent(); |
|
|
|
BasicdataWarehouseEntity endhouse = basicdataWarehouseClient.findByName(warehouseName); |
|
|
|
|
|
|
|
Integer number = wayBillEntity.getNumber();//运单总数量
|
|
|
|
warehouseWaybill = new WarehouseWaybillEntity(); |
|
|
|
String packname = wayBillEntity.getPackname(); |
|
|
|
warehouseWaybill.setTenantId(TenantNum.HUITONGCODE); |
|
|
|
String agent = wayBillEntity.getAgent(); |
|
|
|
warehouseWaybill.setCreateUser(1714696768639311873L); |
|
|
|
|
|
|
|
warehouseWaybill.setUpdateUser(1714696768639311873L); |
|
|
|
warehouseWaybill = new WarehouseWaybillEntity(); |
|
|
|
warehouseWaybill.setCreateDept(1649331096241836033L); |
|
|
|
warehouseWaybill.setTenantId(TenantNum.HUITONGCODE); |
|
|
|
warehouseWaybill.setWaybillNo(waybillNo); |
|
|
|
warehouseWaybill.setCreateUser(1714696768639311873L); |
|
|
|
warehouseWaybill.setDestinationWarehouseName(warehouseName); |
|
|
|
warehouseWaybill.setUpdateUser(1714696768639311873L); |
|
|
|
warehouseWaybill.setDestinationWarehouseId(Objects.isNull(endhouse) ? null : endhouse.getId()); |
|
|
|
warehouseWaybill.setCreateDept(1649331096241836033L); |
|
|
|
warehouseWaybill.setDepartureWarehouseName(startSite); |
|
|
|
warehouseWaybill.setWaybillNo(waybillNo); |
|
|
|
warehouseWaybill.setDepartureWarehouseId(Objects.isNull(starthouse) ? null : starthouse.getId()); |
|
|
|
warehouseWaybill.setDestinationWarehouseName(warehouseName); |
|
|
|
warehouseWaybill.setCustomerTrain(wayBillEntity.getCarNo()); |
|
|
|
warehouseWaybill.setDestinationWarehouseId(Objects.isNull(endhouse) ? null : endhouse.getId()); |
|
|
|
warehouseWaybill.setBrand(wayBillEntity.getBrand()); |
|
|
|
warehouseWaybill.setDepartureWarehouseName(startSite); |
|
|
|
String sendCompany = wayBillEntity.getSendCompany();//发货单位
|
|
|
|
warehouseWaybill.setDepartureWarehouseId(Objects.isNull(starthouse) ? null : starthouse.getId()); |
|
|
|
String takeCompany = wayBillEntity.getTakeCompany();//收货单位
|
|
|
|
warehouseWaybill.setCustomerTrain(wayBillEntity.getCarNo()); |
|
|
|
BasicdataClientEntity sendClient = basicdataClientClient.findByName(sendCompany); |
|
|
|
warehouseWaybill.setBrand(wayBillEntity.getBrand()); |
|
|
|
BasicdataClientEntity takeClient = basicdataClientClient.findByName(takeCompany); |
|
|
|
String sendCompany = wayBillEntity.getSendCompany();//发货单位
|
|
|
|
if (!Objects.isNull(sendClient)) { |
|
|
|
String takeCompany = wayBillEntity.getTakeCompany();//收货单位
|
|
|
|
Long clientEntityId = sendClient.getId();//基础客户
|
|
|
|
BasicdataClientEntity sendClient = basicdataClientClient.findByName(sendCompany); |
|
|
|
warehouseWaybill.setShipperId(clientEntityId); |
|
|
|
BasicdataClientEntity takeClient = basicdataClientClient.findByName(takeCompany); |
|
|
|
} |
|
|
|
if (!Objects.isNull(sendClient)) { |
|
|
|
if (!Objects.isNull(takeClient)) { |
|
|
|
Long clientEntityId = sendClient.getId();//基础客户
|
|
|
|
Long clientEntityId = takeClient.getId();//基础客户
|
|
|
|
warehouseWaybill.setShipperId(clientEntityId); |
|
|
|
BasicdataStoreBusinessEntity basicdataStoreBusinessEntity = basicdataStoreBusinessClient.findByClientIdAndTypeService(clientEntityId, 3); |
|
|
|
} |
|
|
|
if (!Objects.isNull(basicdataStoreBusinessEntity)) { |
|
|
|
if (!Objects.isNull(takeClient)) { |
|
|
|
warehouseWaybill.setServiceType(Integer.parseInt(basicdataStoreBusinessEntity.getMold())); |
|
|
|
Long clientEntityId = takeClient.getId();//基础客户
|
|
|
|
|
|
|
|
BasicdataStoreBusinessEntity basicdataStoreBusinessEntity = basicdataStoreBusinessClient.findByClientIdAndTypeService(clientEntityId, 3); |
|
|
|
|
|
|
|
if (!Objects.isNull(basicdataStoreBusinessEntity)) { |
|
|
|
|
|
|
|
warehouseWaybill.setServiceType(Integer.parseInt(basicdataStoreBusinessEntity.getMold())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
warehouseWaybill.setConsigneeId(clientEntityId); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
warehouseWaybill.setShipper(sendCompany); |
|
|
|
warehouseWaybill.setConsigneeId(clientEntityId); |
|
|
|
warehouseWaybill.setShipperName(wayBillEntity.getSendPerson()); |
|
|
|
} |
|
|
|
warehouseWaybill.setShipperMobile(wayBillEntity.getSendMobile()); |
|
|
|
warehouseWaybill.setShipper(sendCompany); |
|
|
|
warehouseWaybill.setShipperAddress(wayBillEntity.getSendAddress()); |
|
|
|
warehouseWaybill.setShipperName(wayBillEntity.getSendPerson()); |
|
|
|
warehouseWaybill.setConsignee(takeCompany); |
|
|
|
warehouseWaybill.setShipperMobile(wayBillEntity.getSendMobile()); |
|
|
|
warehouseWaybill.setConsigneeName(wayBillEntity.getTakePerson()); |
|
|
|
warehouseWaybill.setShipperAddress(wayBillEntity.getSendAddress()); |
|
|
|
warehouseWaybill.setConsigneeMobile(wayBillEntity.getTakeMobile()); |
|
|
|
warehouseWaybill.setConsignee(takeCompany); |
|
|
|
warehouseWaybill.setConsigneeAddress(wayBillEntity.getTakeAddress()); |
|
|
|
warehouseWaybill.setConsigneeName(wayBillEntity.getTakePerson()); |
|
|
|
|
|
|
|
warehouseWaybill.setConsigneeMobile(wayBillEntity.getTakeMobile()); |
|
|
|
|
|
|
|
warehouseWaybill.setConsigneeAddress(wayBillEntity.getTakeAddress()); |
|
|
|
// String arriveSite = wayBillEntity.getArriveSite();
|
|
|
|
// String arriveSite = wayBillEntity.getArriveSite();
|
|
|
|
Integer arriveSiteId = wayBillEntity.getArriveSiteId(); |
|
|
|
Integer arriveSiteId = wayBillEntity.getArriveSiteId(); |
|
|
|
String code = wayBillClient.findAreaCodeByArriveSiteId(arriveSiteId); |
|
|
|
String code = wayBillClient.findAreaCodeByArriveSiteId(arriveSiteId); |
|
|
|
// String code = regionFeign.getCode(arriveSite);
|
|
|
|
// String code = regionFeign.getCode(arriveSite);
|
|
|
|
warehouseWaybill.setDestinationCode(code); |
|
|
|
warehouseWaybill.setDestinationCode(code); |
|
|
|
warehouseWaybill.setDestination(wayBillEntity.getArriveSite()); |
|
|
|
warehouseWaybill.setDestination(wayBillEntity.getArriveSite()); |
|
|
|
warehouseWaybill.setGoodsName(packname); |
|
|
|
warehouseWaybill.setGoodsName(packname); |
|
|
|
warehouseWaybill.setTotalCount(number); |
|
|
|
warehouseWaybill.setTotalCount(number); |
|
|
|
warehouseWaybill.setStockCount(1); |
|
|
|
warehouseWaybill.setStockCount(1); |
|
|
|
warehouseWaybill.setWaybillType(1); |
|
|
|
warehouseWaybill.setWaybillType(1); |
|
|
|
warehouseWaybill.setTotalWeight(wayBillEntity.getWeight()); |
|
|
|
warehouseWaybill.setTotalWeight(wayBillEntity.getWeight()); |
|
|
|
warehouseWaybill.setTotalVolume(wayBillEntity.getVolume()); |
|
|
|
warehouseWaybill.setTotalVolume(wayBillEntity.getVolume()); |
|
|
|
warehouseWaybill.setDeliveryMethod(wayBillEntity.getSendType()); |
|
|
|
warehouseWaybill.setDeliveryMethod(wayBillEntity.getSendType()); |
|
|
|
warehouseWaybill.setUrgency(wayBillEntity.getUrgency()); |
|
|
|
warehouseWaybill.setUrgency(wayBillEntity.getUrgency()); |
|
|
|
warehouseWaybill.setReceiptCount(wayBillEntity.getReceiptNum()); |
|
|
|
warehouseWaybill.setReceiptCount(wayBillEntity.getReceiptNum()); |
|
|
|
warehouseWaybill.setReceiptRequirement(wayBillEntity.getReceiptAsk()); |
|
|
|
warehouseWaybill.setReceiptRequirement(wayBillEntity.getReceiptAsk()); |
|
|
|
//--------------2023-07-28-------------
|
|
|
|
//--------------2023-07-28-------------
|
|
|
|
warehouseWaybill.setCollectPay(wayBillEntity.getDPay()); |
|
|
|
warehouseWaybill.setCollectPay(wayBillEntity.getDPay()); |
|
|
|
warehouseWaybill.setReceivedCollectPay(BigDecimal.ZERO); |
|
|
|
warehouseWaybill.setReceivedCollectPay(BigDecimal.ZERO); |
|
|
|
warehouseWaybill.setReplacePrice(wayBillEntity.getReplacePrice()); |
|
|
|
warehouseWaybill.setReplacePrice(wayBillEntity.getReplacePrice()); |
|
|
|
warehouseWaybill.setReceivedReplacePrice(BigDecimal.ZERO); |
|
|
|
warehouseWaybill.setReceivedReplacePrice(BigDecimal.ZERO); |
|
|
|
warehouseWaybill.setReceivedTotalPrice(BigDecimal.ZERO); |
|
|
|
warehouseWaybill.setReceivedTotalPrice(BigDecimal.ZERO); |
|
|
|
warehouseWaybill.setWaybillType(wayBillEntity.getType()); |
|
|
|
warehouseWaybill.setWaybillType(wayBillEntity.getType()); |
|
|
|
warehouseWaybill.setReceivedStatus(0); |
|
|
|
warehouseWaybill.setReceivedStatus(0); |
|
|
|
|
|
|
|
|
|
|
|
warehouseWaybill.setTotalFreight(wayBillEntity.getFreight()); |
|
|
|
warehouseWaybill.setTotalFreight(wayBillEntity.getFreight()); |
|
|
|
warehouseWaybill.setDeliveryFee(wayBillEntity.getDeliveryCost()); |
|
|
|
warehouseWaybill.setDeliveryFee(wayBillEntity.getDeliveryCost()); |
|
|
|
warehouseWaybill.setPickupFee(wayBillEntity.getTakeCost()); |
|
|
|
warehouseWaybill.setPickupFee(wayBillEntity.getTakeCost()); |
|
|
|
warehouseWaybill.setWarehouseManagementFee(wayBillEntity.getWarehouseManagementFee()); |
|
|
|
warehouseWaybill.setWarehouseManagementFee(wayBillEntity.getWarehouseManagementFee()); |
|
|
|
warehouseWaybill.setStorageFee(wayBillEntity.getWarehousingFee()); |
|
|
|
warehouseWaybill.setStorageFee(wayBillEntity.getWarehousingFee()); |
|
|
|
warehouseWaybill.setHandlingFee(wayBillEntity.getPretendCost()); |
|
|
|
warehouseWaybill.setHandlingFee(wayBillEntity.getPretendCost()); |
|
|
|
warehouseWaybill.setOtherFee(wayBillEntity.getOtherFee()); |
|
|
|
warehouseWaybill.setOtherFee(wayBillEntity.getOtherFee()); |
|
|
|
warehouseWaybill.setInsuranceFee(wayBillEntity.getPriceProtectionFee()); |
|
|
|
warehouseWaybill.setInsuranceFee(wayBillEntity.getPriceProtectionFee()); |
|
|
|
warehouseWaybill.setClaimingValue(wayBillEntity.getValue()); |
|
|
|
warehouseWaybill.setClaimingValue(wayBillEntity.getValue()); |
|
|
|
warehouseWaybill.setPayType(wayBillEntity.getPayType() + ""); |
|
|
|
warehouseWaybill.setPayType(wayBillEntity.getPayType() + ""); |
|
|
|
warehouseWaybill.setPayWay(wayBillEntity.getPaymentMethod() + ""); |
|
|
|
warehouseWaybill.setPayWay(wayBillEntity.getPaymentMethod() + ""); |
|
|
|
warehouseWaybill.setXPay(wayBillEntity.getXPay()); |
|
|
|
warehouseWaybill.setXPay(wayBillEntity.getXPay()); |
|
|
|
warehouseWaybill.setDPay(wayBillEntity.getDPay()); |
|
|
|
warehouseWaybill.setDPay(wayBillEntity.getDPay()); |
|
|
|
warehouseWaybill.setHPay(wayBillEntity.getHPay()); |
|
|
|
warehouseWaybill.setHPay(wayBillEntity.getHPay()); |
|
|
|
warehouseWaybill.setYPay(wayBillEntity.getYPay()); |
|
|
|
warehouseWaybill.setYPay(wayBillEntity.getYPay()); |
|
|
|
warehouseWaybill.setThirdOperationFee(wayBillEntity.getThreeHandleFee()); |
|
|
|
warehouseWaybill.setThirdOperationFee(wayBillEntity.getThreeHandleFee()); |
|
|
|
warehouseWaybill.setDeliveryWay(wayBillEntity.getSendType() + ""); |
|
|
|
warehouseWaybill.setDeliveryWay(wayBillEntity.getSendType() + ""); |
|
|
|
warehouseWaybill.setUrgency(wayBillEntity.getUrgency() + ""); |
|
|
|
warehouseWaybill.setUrgency(wayBillEntity.getUrgency() + ""); |
|
|
|
warehouseWaybill.setReceipt(wayBillEntity.getReceiptAsk()); |
|
|
|
warehouseWaybill.setReceipt(wayBillEntity.getReceiptAsk()); |
|
|
|
warehouseWaybill.setReceiptNum(wayBillEntity.getReceiptNum()); |
|
|
|
warehouseWaybill.setReceiptNum(wayBillEntity.getReceiptNum()); |
|
|
|
warehouseWaybill.setTransportType(wayBillEntity.getShippingType() + ""); |
|
|
|
warehouseWaybill.setTransportType(wayBillEntity.getShippingType() + ""); |
|
|
|
warehouseWaybill.setRebate(wayBillEntity.getRebate()); |
|
|
|
warehouseWaybill.setRebate(wayBillEntity.getRebate()); |
|
|
|
|
|
|
|
|
|
|
|
BasicdataClientEntity agentClient = basicdataClientClient.findByName(agent); |
|
|
|
BasicdataClientEntity agentClient = basicdataClientClient.findByName(agent); |
|
|
|
if (!Objects.isNull(agentClient)) { |
|
|
|
if (!Objects.isNull(agentClient)) { |
|
|
|
Long clientEntityId = agentClient.getId();//基础客户
|
|
|
|
Long clientEntityId = agentClient.getId();//基础客户
|
|
|
|
warehouseWaybill.setAgentId(clientEntityId); |
|
|
|
warehouseWaybill.setAgentId(clientEntityId); |
|
|
|
} |
|
|
|
} |
|
|
|
Date date = new Date(); |
|
|
|
Date date = new Date(); |
|
|
|
warehouseWaybill.setAgent(agent); |
|
|
|
warehouseWaybill.setAgent(agent); |
|
|
|
warehouseWaybill.setDocumentMakingTime(wayBillEntity.getPreparationTime()); |
|
|
|
warehouseWaybill.setDocumentMakingTime(wayBillEntity.getPreparationTime()); |
|
|
|
warehouseWaybill.setRemark(wayBillEntity.getMsg()); |
|
|
|
warehouseWaybill.setRemark(wayBillEntity.getMsg()); |
|
|
|
warehouseWaybill.setBatchNo(wayBillEntity.getStartCarsNo()); |
|
|
|
warehouseWaybill.setBatchNo(wayBillEntity.getStartCarsNo()); |
|
|
|
warehouseWaybill.setFreezeStatus(0); |
|
|
|
warehouseWaybill.setFreezeStatus(0); |
|
|
|
warehouseWaybill.setStatus(0); |
|
|
|
warehouseWaybill.setStatus(0); |
|
|
|
warehouseWaybill.setIsDeleted(0); |
|
|
|
warehouseWaybill.setIsDeleted(0); |
|
|
|
warehouseWaybill.setCreateTime(date); |
|
|
|
warehouseWaybill.setCreateTime(date); |
|
|
|
warehouseWaybill.setUpdateTime(date); |
|
|
|
warehouseWaybill.setUpdateTime(date); |
|
|
|
aLong = warehouseWaybillClient.addEnntity(warehouseWaybill); |
|
|
|
aLong = warehouseWaybillClient.addEnntity(warehouseWaybill); |
|
|
|
if (aLong != 0) { |
|
|
|
if (aLong != 0) { |
|
|
|
redis.setEx("dealwithWaybillNoId:" + waybillNo,aLong, 30L); |
|
|
|
redis.setEx("dealwithWaybillNoId:" + waybillNo,aLong, 30L); |
|
|
|
List<WaybillDesEntity> desList = waybillDesClient.getDesList(waybillNo); |
|
|
|
List<WaybillDesEntity> desList = waybillDesClient.getDesList(waybillNo); |
|
|
|
List<WarehouseWayBillDetail> warehouseWayBillDetails = new ArrayList<>(); |
|
|
|
List<WarehouseWayBillDetail> warehouseWayBillDetails = new ArrayList<>(); |
|
|
|
for (WaybillDesEntity waybillDesEntity : desList) { |
|
|
|
for (WaybillDesEntity waybillDesEntity : desList) { |
|
|
|
WarehouseWayBillDetail warehouseWayBillDetail = new WarehouseWayBillDetail(); |
|
|
|
WarehouseWayBillDetail warehouseWayBillDetail = new WarehouseWayBillDetail(); |
|
|
|
warehouseWayBillDetail.setCreateUser(1714696768639311873L); |
|
|
|
warehouseWayBillDetail.setCreateUser(1714696768639311873L); |
|
|
|
warehouseWayBillDetail.setUpdateUser(1714696768639311873L); |
|
|
|
warehouseWayBillDetail.setUpdateUser(1714696768639311873L); |
|
|
|
warehouseWayBillDetail.setCreateDept(1649331096241836033L); |
|
|
|
warehouseWayBillDetail.setCreateDept(1649331096241836033L); |
|
|
|
warehouseWayBillDetail.setWaybillId(aLong); |
|
|
|
warehouseWayBillDetail.setWaybillId(aLong); |
|
|
|
warehouseWayBillDetail.setWaybillNo(waybillNo); |
|
|
|
warehouseWayBillDetail.setWaybillNo(waybillNo); |
|
|
|
String goodsName = waybillDesEntity.getName(); |
|
|
|
String goodsName = waybillDesEntity.getName(); |
|
|
|
BasicdataCategoryEntity categoryEntity = categoryClient.findByName(goodsName); |
|
|
|
BasicdataCategoryEntity categoryEntity = categoryClient.findByName(goodsName); |
|
|
|
if (Objects.isNull(categoryEntity)) { |
|
|
|
if (Objects.isNull(categoryEntity)) { |
|
|
|
categoryEntity = new BasicdataCategoryEntity(); |
|
|
|
categoryEntity = new BasicdataCategoryEntity(); |
|
|
|
categoryEntity.setName(goodsName); |
|
|
|
categoryEntity.setName(goodsName); |
|
|
|
categoryEntity.setType(1); |
|
|
|
categoryEntity.setType(1); |
|
|
|
categoryEntity.setTenantId(TenantNum.HUITONGCODE); |
|
|
|
categoryEntity.setTenantId(TenantNum.HUITONGCODE); |
|
|
|
categoryEntity.setCreateUser(1714696768639311873L); |
|
|
|
categoryEntity.setCreateUser(1714696768639311873L); |
|
|
|
categoryEntity.setUpdateUser(1714696768639311873L); |
|
|
|
categoryEntity.setUpdateUser(1714696768639311873L); |
|
|
|
categoryEntity.setCreateDept(1649331096241836033L); |
|
|
|
categoryEntity.setCreateDept(1649331096241836033L); |
|
|
|
Long categoryId = categoryClient.addReturnId(categoryEntity); |
|
|
|
Long categoryId = categoryClient.addReturnId(categoryEntity); |
|
|
|
warehouseWayBillDetail.setProductId(categoryId); |
|
|
|
warehouseWayBillDetail.setProductId(categoryId); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
warehouseWayBillDetail.setProductId(categoryEntity.getId()); |
|
|
|
warehouseWayBillDetail.setProductId(categoryEntity.getId()); |
|
|
|
} |
|
|
|
|
|
|
|
warehouseWayBillDetail.setProductName(goodsName); |
|
|
|
|
|
|
|
warehouseWayBillDetail.setNum(waybillDesEntity.getNum()); |
|
|
|
|
|
|
|
warehouseWayBillDetail.setPrice(waybillDesEntity.getPrice()); |
|
|
|
|
|
|
|
warehouseWayBillDetail.setVolume(waybillDesEntity.getVolume()); |
|
|
|
|
|
|
|
warehouseWayBillDetail.setWeight(waybillDesEntity.getWeight()); |
|
|
|
|
|
|
|
warehouseWayBillDetail.setSubtotalFreight(waybillDesEntity.getTotalDesPrice()); |
|
|
|
|
|
|
|
warehouseWayBillDetail.setChargeType(waybillDesEntity.getPic()); |
|
|
|
|
|
|
|
warehouseWayBillDetails.add(warehouseWayBillDetail); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
warehouseWaybillDetailClient.addList(warehouseWayBillDetails); |
|
|
|
warehouseWayBillDetail.setProductName(goodsName); |
|
|
|
|
|
|
|
warehouseWayBillDetail.setNum(waybillDesEntity.getNum()); |
|
|
|
|
|
|
|
warehouseWayBillDetail.setPrice(waybillDesEntity.getPrice()); |
|
|
|
|
|
|
|
warehouseWayBillDetail.setVolume(waybillDesEntity.getVolume()); |
|
|
|
|
|
|
|
warehouseWayBillDetail.setWeight(waybillDesEntity.getWeight()); |
|
|
|
|
|
|
|
warehouseWayBillDetail.setSubtotalFreight(waybillDesEntity.getTotalDesPrice()); |
|
|
|
|
|
|
|
warehouseWayBillDetail.setChargeType(waybillDesEntity.getPic()); |
|
|
|
|
|
|
|
warehouseWayBillDetails.add(warehouseWayBillDetail); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
warehouseWaybillDetailClient.addList(warehouseWayBillDetails); |
|
|
|
} else { |
|
|
|
|
|
|
|
warehouseWaybill.setStockCount(warehouseWaybill.getStockCount() + 1); |
|
|
|
|
|
|
|
warehouseWaybill.setUpdateTime(new Date()); |
|
|
|
|
|
|
|
warehouseWaybillClient.updateEntity(warehouseWaybill); |
|
|
|
|
|
|
|
aLong = warehouseWaybill.getId(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
//暂存单与运单的关联
|
|
|
|
//暂存单与运单的关联
|
|
|
|
saveAdvanceData(warehouseWaybill); |
|
|
|
saveAdvanceData(warehouseWaybill); |
|
|
|
// redisLockClient.unLock(lockKey, LockType.FAIR);
|
|
|
|
} else { |
|
|
|
|
|
|
|
log.info("##############我走的新增运单 ================================2"); |
|
|
|
|
|
|
|
warehouseWaybill.setStockCount(warehouseWaybill.getStockCount() + 1); |
|
|
|
|
|
|
|
warehouseWaybill.setUpdateTime(new Date()); |
|
|
|
|
|
|
|
warehouseWaybillClient.updateEntity(warehouseWaybill); |
|
|
|
|
|
|
|
aLong = warehouseWaybill.getId(); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
log.info("##############我走的准备解锁 ================================3"); |
|
|
|
throw new RuntimeException(e); |
|
|
|
redisLockClient.unLock(lockKey, LockType.FAIR); |
|
|
|
}finally { |
|
|
|
log.info("##############我走的解锁 ================================4 {}",aLong); |
|
|
|
lock.unlock(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return aLong; |
|
|
|
return aLong; |
|
|
|
} |
|
|
|
} |
|
|
|