Browse Source

1.干线bug修复

master
zhenghaoyu 5 months ago
parent
commit
aadf78f6c2
  1. 4
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java
  2. 3
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/TrayTypeDataListVO.java
  3. 5
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java
  4. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.java
  5. 9
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml
  6. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java
  7. 5
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java
  8. 209
      blade-service/logpm-patch/src/main/java/com/logpm/patch/jobhandle/SyncOrderInfoToPlatform.java
  9. 5
      blade-service/logpm-patch/src/main/java/com/logpm/patch/mapper/WarehouseMappingDataMapper.java
  10. 12
      blade-service/logpm-patch/src/main/java/com/logpm/patch/mapper/WarehouseMappingDataMapper.xml
  11. 3
      blade-service/logpm-patch/src/main/java/com/logpm/patch/service/IWarehouseMappingDataService.java
  12. 10
      blade-service/logpm-patch/src/main/java/com/logpm/patch/service/impl/WarehouseMappingDataServiceImpl.java
  13. 25
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/CarsLoadController.java
  14. 5
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java
  15. 13
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml
  16. 5
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceDetailService.java
  17. 3
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadService.java
  18. 10
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java
  19. 417
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java
  20. 2
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayTypeMapper.xml
  21. 4
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java

4
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java

@ -312,5 +312,9 @@ public interface IDistributionParcelListClient {
@GetMapping(API_PREFIX + "/findListByOrderPackageCodeAndStatus")
List<DistributionParcelListEntity> findListByOrderPackageCodeAndStatus(@RequestParam String orderPackageCode, @RequestParam String status);
@GetMapping(API_PREFIX + "/findOneByOrderPackageCode")
DistributionParcelListEntity findOneByOrderPackageCode(@RequestParam String orderPackageCode);
}

3
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/TrayTypeDataListVO.java

@ -25,6 +25,9 @@ public class TrayTypeDataListVO implements Serializable {
private Integer orderTotalNum;//订单总件数
private Integer residueNum;//剩余件数
private String consigneeUnit;
private String consigneePerson;
private List<PositionVO> positionList = new ArrayList<>();

5
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java

@ -664,4 +664,9 @@ public class DistributionParcelListClient implements IDistributionParcelListClie
return distributionParcelListService.findListByOrderPackageCodeAndStatus(orderPackageCode,status);
}
@Override
public DistributionParcelListEntity findOneByOrderPackageCode(String orderPackageCode) {
return distributionParcelListService.findOneByOrderPackageCode(orderPackageCode);
}
}

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.java

@ -342,4 +342,6 @@ public interface DistributionParcelListMapper extends BaseMapper<DistributionPar
void deleteListByOrderPackageCodes(@Param("orderPackageCodeList") List<String> orderPackageCodeList,@Param("warehouseId") Long warehouseId);
List<DistributionParcelListEntity> findListByOrderPackageCodeAndStatus(@Param("orderPackageCode") String orderPackageCode, @Param("status") String status);
DistributionParcelListEntity findOneByOrderPackageCode(@Param("orderPackageCode") String orderPackageCode);
}

9
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml

@ -2284,4 +2284,13 @@
and is_deleted = 0
</select>
<select id="findOneByOrderPackageCode" resultType="com.logpm.distribution.entity.DistributionParcelListEntity">
select *
from logpm_distribution_parcel_list
where order_package_code = #{orderPackageCode}
and is_deleted = 0
order By create_time desc
limit 1
</select>
</mapper>

3
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java

@ -316,4 +316,7 @@ public interface IDistributionParcelListService extends BaseService<Distribution
DistributionParcelListEntity findOrderPackageCodeAndStatus(String orderPackageCode, String orderPackageStatus);
List<DistributionParcelListEntity> findListByOrderPackageCodeAndStatus(String orderPackageCode, String status);
DistributionParcelListEntity findOneByOrderPackageCode(String orderPackageCode);
}

5
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java

@ -1600,4 +1600,9 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl<Distribut
public List<DistributionParcelListEntity> findListByOrderPackageCodeAndStatus(String orderPackageCode, String status) {
return baseMapper.findListByOrderPackageCodeAndStatus(orderPackageCode,status);
}
@Override
public DistributionParcelListEntity findOneByOrderPackageCode(String orderPackageCode) {
return baseMapper.findOneByOrderPackageCode(orderPackageCode);
}
}

209
blade-service/logpm-patch/src/main/java/com/logpm/patch/jobhandle/SyncOrderInfoToPlatform.java

@ -3,9 +3,13 @@ package com.logpm.patch.jobhandle;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.logpm.basicdata.entity.BasicdataClientEntity;
import com.logpm.basicdata.entity.BasicdataStoreBusinessEntity;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
import com.logpm.distribution.feign.IDistributionParcelListClient;
import com.logpm.distribution.feign.IDistributionStockArticleClient;
import com.logpm.oldproject.entity.AdvanceDetailEntity;
import com.logpm.oldproject.entity.AdvanceEntity;
@ -51,6 +55,7 @@ public class SyncOrderInfoToPlatform {
private final IOrderSyncRecordService orderSyncRecordService;
private final ISyncOrderInfoService syncOrderInfoService;
private final IDistributionStockArticleClient distributionStockArticleClient;
private final IDistributionParcelListClient distributionParcelListClient;
private final ITrunklineWaybillOrderClient waybillOrderClient;
private final ITrunklineAdvanceClient trunklineAdvanceClient;
@ -1068,4 +1073,208 @@ public class SyncOrderInfoToPlatform {
@XxlJob("syncUnloadData")
public ReturnT<String> syncUnloadData(String param) {
log.info("############syncUnloadData: 同步卸车数据 开始");
List<JSONObject> ls = warehouseMappingDataService.findAllUnloadData();
for (JSONObject json : ls) {
Integer id = json.getInt("id");
String orderPackageCode = json.getStr("orderPackageCode");
try{
log.info("###############syncUnloadData: 当前处理的包件 orderPackageCode={}",orderPackageCode);
TrunklineAdvanceDetailEntity advanceDetailEntity = trunklineAdvanceDetailClient.findEntityByOrderPackageCode(orderPackageCode);
if(Objects.isNull(advanceDetailEntity)){
log.info("############syncUnloadData: 暂存单不存在 orderPackageCode={}",orderPackageCode);
}else{
String packageStatus = advanceDetailEntity.getPackageStatus();
Long incomingWarehouseId = advanceDetailEntity.getIncomingWarehouseId();
String incomeCategoryName = advanceDetailEntity.getIncomeCategoryName();
Long nowWarehouseId = advanceDetailEntity.getNowWarehouseId();
String nowWarehouseName = advanceDetailEntity.getNowWarehouseName();
Long warehouseId = advanceDetailEntity.getWarehouseId();
String warehouseName = advanceDetailEntity.getWarehouseName();
DistributionParcelListEntity distributionParcelListEntity = distributionParcelListClient.findOneByOrderPackageCode(orderPackageCode);
if(packageStatus.equals("0")){
//未入库 判断当前包件入库最后的仓库有无数据
if(!Objects.isNull(distributionParcelListEntity)){
//如果有数据,则把暂存单入库并
advanceDetailEntity.setPackageStatus("1");
Long parcelListWarehouseId = distributionParcelListEntity.getWarehouseId();
String parcelListWarehouse = distributionParcelListEntity.getWarehouse();
//判断当前包件所在仓与导入仓库是否一致,一致则不插入
if(parcelListWarehouseId.equals(warehouseId)){
advanceDetailEntity.setIncomingWarehouseId(parcelListWarehouseId);
advanceDetailEntity.setIncomingWarehouseName(parcelListWarehouse);
}else{
//如果不一致,则把包件插入到入库仓库状态为60
advanceDetailEntity.setIncomingWarehouseId(warehouseId);
advanceDetailEntity.setIncomingWarehouseName(warehouseName);
log.info("#################syncUnloadData 1111 orderPackageCode={}",orderPackageCode);
//更新包件到指定仓并且状态为20
updateParcelListToWarehouse(advanceDetailEntity,warehouseId,"60");
}
advanceDetailEntity.setNowWarehouseId(parcelListWarehouseId);
advanceDetailEntity.setNowWarehouseName(parcelListWarehouse);
}
}else{
//暂存单包件已入库
if(!Objects.isNull(nowWarehouseId)){
//当前所在仓id不为空
if(!Objects.isNull(distributionParcelListEntity)){
//判断当前所包件所在仓有数据
Long warehouseId1 = distributionParcelListEntity.getWarehouseId();
String warehouse = distributionParcelListEntity.getWarehouse();
if(!nowWarehouseId.equals(warehouseId1)){
//判断当前仓库与包件所在仓库是否一致,不一致则判断当前所在仓包件有无入库
DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(orderPackageCode, nowWarehouseId);
if(Objects.isNull(parcelListEntity)){
//未入库
log.info("#################syncUnloadData 22222 orderPackageCode={}",orderPackageCode);
//更新包件到指定仓并且状态为20
updateParcelListToWarehouse(advanceDetailEntity,nowWarehouseId,"20");
}else{
advanceDetailEntity.setNowWarehouseId(warehouseId1);
advanceDetailEntity.setNowWarehouseName(warehouse);
}
}
}else{
if(Objects.isNull(incomingWarehouseId)){
advanceDetailEntity.setIncomingWarehouseId(warehouseId);
advanceDetailEntity.setIncomingWarehouseName(warehouseName);
if(warehouseId.equals(nowWarehouseId)){
log.info("#################syncUnloadData 333333 orderPackageCode={}",orderPackageCode);
//更新包件到指定仓并且状态为20
updateParcelListToWarehouse(advanceDetailEntity,warehouseId,"20");
}else{
log.info("#################syncUnloadData 44444 orderPackageCode={}",orderPackageCode);
//更新包件到指定仓并且状态为20
updateParcelListToWarehouse(advanceDetailEntity,warehouseId,"60");
log.info("#################syncUnloadData 55555 orderPackageCode={}",orderPackageCode);
//更新包件到指定仓并且状态为20
updateParcelListToWarehouse(advanceDetailEntity,nowWarehouseId,"20");
}
}else{
if(nowWarehouseId.equals(incomingWarehouseId)){
log.info("#################syncUnloadData 66666 orderPackageCode={}",orderPackageCode);
//更新包件到指定仓并且状态为20
updateParcelListToWarehouse(advanceDetailEntity,nowWarehouseId,"20");
}else{
log.info("#################syncUnloadData 7777 orderPackageCode={}",orderPackageCode);
//更新包件到指定仓并且状态为20
updateParcelListToWarehouse(advanceDetailEntity,incomingWarehouseId,"60");
log.info("#################syncUnloadData 88888 orderPackageCode={}",orderPackageCode);
//更新包件到指定仓并且状态为20
updateParcelListToWarehouse(advanceDetailEntity,nowWarehouseId,"20");
}
}
}
}else{
if(!Objects.isNull(distributionParcelListEntity)){
Long warehouseId1 = distributionParcelListEntity.getWarehouseId();
String warehouse = distributionParcelListEntity.getWarehouse();
if(Objects.isNull(incomingWarehouseId)){
advanceDetailEntity.setIncomingWarehouseId(warehouseId);
advanceDetailEntity.setIncomingWarehouseName(warehouseName);
advanceDetailEntity.setNowWarehouseId(warehouseId1);
advanceDetailEntity.setNowWarehouseName(warehouse);
log.info("#################syncUnloadData 99999 orderPackageCode={}",orderPackageCode);
//更新包件到指定仓并且状态为20
updateParcelListToWarehouse(advanceDetailEntity,warehouseId,"60");
}else{
advanceDetailEntity.setNowWarehouseId(warehouseId1);
advanceDetailEntity.setNowWarehouseName(warehouse);
if(!incomingWarehouseId.equals(warehouseId1)){
log.info("#################syncUnloadData 000000 orderPackageCode={}",orderPackageCode);
//更新包件到指定仓并且状态为20
updateParcelListToWarehouse(advanceDetailEntity,incomingWarehouseId,"60");
}
}
}else{
if(Objects.isNull(incomingWarehouseId)){
advanceDetailEntity.setIncomingWarehouseId(warehouseId);
advanceDetailEntity.setIncomingWarehouseName(warehouseName);
advanceDetailEntity.setNowWarehouseId(warehouseId);
advanceDetailEntity.setNowWarehouseName(warehouseName);
log.info("#################syncUnloadData aaaaaa orderPackageCode={}",orderPackageCode);
//更新包件到指定仓并且状态为20
updateParcelListToWarehouse(advanceDetailEntity,warehouseId,"20");
}else{
advanceDetailEntity.setIncomingWarehouseId(incomingWarehouseId);
advanceDetailEntity.setIncomingWarehouseName(incomeCategoryName);
advanceDetailEntity.setNowWarehouseId(incomingWarehouseId);
advanceDetailEntity.setNowWarehouseName(incomeCategoryName);
log.info("#################syncUnloadData bbbbbbb orderPackageCode={}",orderPackageCode);
//更新包件到指定仓并且状态为20
updateParcelListToWarehouse(advanceDetailEntity,incomingWarehouseId,"20");
}
}
}
}
}
warehouseMappingDataService.updateSyncUnloadDataStatus(id,1);
}catch (Exception e){
log.warn("###############syncUnloadData: 包件处理失败 orderPackageCode={}", orderPackageCode);
}
}
log.info("############syncUnloadData: 同步卸车数据 完成");
return ReturnT.SUCCESS;
}
private void updateParcelListToWarehouse(TrunklineAdvanceDetailEntity advanceDetailEntity, Long warehouseId, String status) {
String orderPackageCode = advanceDetailEntity.getOrderPackageCode();
String orderCode = advanceDetailEntity.getOrderCode();
if("20".equals(status)){
List<DistributionParcelListEntity> list = distributionParcelListClient.findListByOrderPackageCodeAndStatus(orderPackageCode,"20");
//把list通过warehouseId进行分组
List<DistributionParcelListEntity> updateParceList = new ArrayList<>();
if(CollUtil.isNotEmpty(list)){
list.forEach(distributionParcelListEntity -> {
DistributionParcelListEntity updateEntity = new DistributionParcelListEntity();
updateEntity.setId(distributionParcelListEntity.getId());
updateEntity.setOrderPackageStatus("60");
updateParceList.add(updateEntity);
});
}
distributionParcelListClient.updateList(updateParceList);
}
}
}

5
blade-service/logpm-patch/src/main/java/com/logpm/patch/mapper/WarehouseMappingDataMapper.java

@ -164,5 +164,10 @@ public interface WarehouseMappingDataMapper {
void deletedOrderByWaybillNo(@Param("waybillNo") String waybillNo);
void deletedBalanceOrderByWaybillNo(@Param("waybillNo") String waybillNo);
void updateSyncUnloadDataStatus(@Param("id") Integer id, @Param("status") int status);
List<JSONObject> findAllUnloadData();
}

12
blade-service/logpm-patch/src/main/java/com/logpm/patch/mapper/WarehouseMappingDataMapper.xml

@ -553,5 +553,17 @@
where waybill_no = #{waybillNo}
</delete>
<update id="updateSyncUnloadDataStatus">
update sync_unload_data
set status = #{syncStatus}
where id = #{id}
</update>
<select id="findAllUnloadData" resultType="cn.hutool.json.JSONObject">
select id id,
order_package_code orderPackageCode
from sync_unload_data
where status = 0
</select>
</mapper>

3
blade-service/logpm-patch/src/main/java/com/logpm/patch/service/IWarehouseMappingDataService.java

@ -138,5 +138,8 @@ public interface IWarehouseMappingDataService {
void deleteStatisticsdata(String waybillNo);
void updateSyncUnloadDataStatus(Integer id, int status);
List<JSONObject> findAllUnloadData();
}

10
blade-service/logpm-patch/src/main/java/com/logpm/patch/service/impl/WarehouseMappingDataServiceImpl.java

@ -338,4 +338,14 @@ public class WarehouseMappingDataServiceImpl implements IWarehouseMappingDataSer
warehouseMappingDataMapper.deletedBalanceOrderByWaybillNo(waybillNo);
}
@Override
public void updateSyncUnloadDataStatus(Integer id, int status) {
warehouseMappingDataMapper.updateSyncUnloadDataStatus(id,status);
}
@Override
public List<JSONObject> findAllUnloadData() {
return warehouseMappingDataMapper.findAllUnloadData();
}
}

25
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/CarsLoadController.java

@ -1397,6 +1397,9 @@ public class CarsLoadController {
// }
// loadCarsDTO.setWarehouseId(myCurrentWarehouse.getId());
if(Objects.isNull(loadId)){
log.warn(method+"配载计划id为空 loadId={}",loadId);
return R.fail(400,"配载计划id为空");
@ -1413,6 +1416,28 @@ public class CarsLoadController {
}
@ResponseBody
@PostMapping("/syncUnloadData")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "数据修复", notes = "传入loadCarsDTO")
public R syncUnloadData() {
String method = "############syncUnloadData: ";
try{
carsLoadService.syncUnloadData();
return R.success("success");
}catch (CustomerException e){
log.error(e.message,e);
return R.fail(e.code,e.message);
}catch (Exception e){
log.error(method+"系统异常",e);
return R.fail(500,"系统异常");
}
}
@ResponseBody
@PostMapping("/zeroSuppleList")
@ApiOperationSupport(order = 1)

5
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java

@ -1,5 +1,6 @@
package com.logpm.trunkline.mapper;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.trunkline.dto.AdvanceDTO;
@ -93,4 +94,8 @@ public interface TrunklineAdvanceDetailMapper extends BaseMapper<TrunklineAdvanc
Integer findIncomingNumByAdvanceIds(@Param("advanceIds") List<Long> advanceIds);
List<String> findOrderPackageCodesByAdvanceIds(@Param("advanceIds") List<Long> advanceIds);
List<JSONObject> findAllUnloadData();
void updateSyncUnloadDataStatus(@Param("id") Integer id, @Param("status") int status);
}

13
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml

@ -591,4 +591,17 @@
</foreach>
</select>
<select id="findAllUnloadData" resultType="com.alibaba.fastjson.JSONObject">
select id id,
order_package_code orderPackageCode
from sync_unload_data
where status = 0
</select>
<update id="updateSyncUnloadDataStatus">
update sync_unload_data
set status = #{status}
where id = #{id}
</update>
</mapper>

5
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceDetailService.java

@ -1,5 +1,6 @@
package com.logpm.trunkline.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.distribution.vo.OrderPackgeCodeDataVO;
import com.logpm.trunkline.dto.AdvanceDTO;
@ -110,4 +111,8 @@ public interface ITrunklineAdvanceDetailService extends BaseService<TrunklineAdv
Integer findIncomingNumByAdvanceIds(List<Long> advanceIds);
List<String> findOrderPackageCodesByAdvanceIds(List<Long> advanceIds);
List<JSONObject> findAllUnloadData();
void updateSyncUnloadDataStatus(Integer id, int status);
}

3
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadService.java

@ -272,4 +272,7 @@ public interface ITrunklineCarsLoadService extends BaseService<TrunklineCarsLoad
R syncNoSystemData(Long loadId,Long warehouseId,String warehouseName);
R carsLoadDetailInfoNew(LoadCarsDTO loadCarsDTO);
void syncUnloadData();
}

10
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java

@ -567,4 +567,14 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
public List<String> findOrderPackageCodesByAdvanceIds(List<Long> advanceIds) {
return baseMapper.findOrderPackageCodesByAdvanceIds(advanceIds);
}
@Override
public List<JSONObject> findAllUnloadData() {
return baseMapper.findAllUnloadData();
}
@Override
public void updateSyncUnloadDataStatus(Integer id, int status) {
baseMapper.updateSyncUnloadDataStatus(id,status);
}
}

417
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java

@ -18,13 +18,13 @@ import com.logpm.aftersales.entity.AftersalesAbnormalRecordEntity;
import com.logpm.aftersales.feign.IAftersalesAbnormalRecordClient;
import com.logpm.aftersales.feign.IAftersalesWorkOrderClient;
import com.logpm.aftersales.vo.DealWithAbnormalVO;
import com.logpm.basic.entity.BasicMaterialEntity;
import com.logpm.basic.feign.IBasicMaterialClient;
import com.logpm.basicdata.entity.BasicdataClientEntity;
import com.logpm.basicdata.entity.BasicdataDriverArteryEntity;
import com.logpm.basicdata.entity.BasicdataTrayEntity;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataCodeClient;
import com.logpm.basicdata.feign.IBasicdataDriverArteryClient;
import com.logpm.basicdata.feign.IBasicdataTrayClient;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.basicdata.feign.*;
import com.logpm.distribution.dto.FindParamterDTO;
import com.logpm.distribution.dto.UpdatePackageDTO;
import com.logpm.distribution.entity.DistributionParcelListEntity;
@ -138,6 +138,9 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
private final ITrunklineCarsLoadLinePhotoService carsLoadLinePhotoService;
private final ITrunklineAdvanceService advanceService;
private final BladeRedis bladeRedis;
private final IBasicdataClientClient clientClient;
private final IBasicdataTripartiteMallClient tripartiteMallClient;
private final IBasicMaterialClient basicMaterialClient;
@Override
@ -227,6 +230,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
Integer startCarType = loadCarsDTO.getStartCarType();
Long warehouseId = loadCarsDTO.getWarehouseId();
String fullLoadRate = loadCarsDTO.getFullLoadRate();
String startDate1 = loadCarsDTO.getStartDate();//TODO 加入发车时间
BasicdataWarehouseEntity warehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(warehouseId);
if (Objects.isNull(warehouseEntity)) {
@ -4549,8 +4553,12 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
BigDecimal countTransportCost = carsLoadEntity.getCountTransportCost();
Integer unloadNumber = carsLoadEntity.getUnloadNumber();
BigDecimal freightPrice = countTransportCost.divide(new BigDecimal(unloadNumber),2, RoundingMode.HALF_UP);
BigDecimal freightPrice;
if(!NumberUtil.equals(unloadNumber,0)){
freightPrice = countTransportCost.divide(new BigDecimal(unloadNumber),2, RoundingMode.HALF_UP);
} else {
freightPrice = BigDecimal.ZERO;
}
List<TrunklineCarsLoadLineEntity> loadLineList = trunklineCarsLoadLineService.findListByLoadId(loadId);
@ -4821,6 +4829,391 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
return R.data(trunklineCarsLoadVO);
}
@Override
public void syncUnloadData() {
log.info("############syncUnloadData: 同步卸车数据 开始");
List<JSONObject> ls = trunklineAdvanceDetailService.findAllUnloadData();
for (JSONObject json : ls) {
Integer id = json.getInteger("id");
String orderPackageCode = json.getString("orderPackageCode");
try{
log.info("###############syncUnloadData: 当前处理的包件 orderPackageCode={}",orderPackageCode);
TrunklineAdvanceDetailEntity advanceDetailEntity = trunklineAdvanceDetailService.findEntityByOrderPackageCode(orderPackageCode);
if(Objects.isNull(advanceDetailEntity)){
log.info("############syncUnloadData: 暂存单不存在 orderPackageCode={}",orderPackageCode);
}else{
String packageStatus = advanceDetailEntity.getPackageStatus();
Long incomingWarehouseId = advanceDetailEntity.getIncomingWarehouseId();
String incomeCategoryName = advanceDetailEntity.getIncomeCategoryName();
Long nowWarehouseId = advanceDetailEntity.getNowWarehouseId();
String nowWarehouseName = advanceDetailEntity.getNowWarehouseName();
Long warehouseId = advanceDetailEntity.getWarehouseId();
String warehouseName = advanceDetailEntity.getWarehouseName();
DistributionParcelListEntity distributionParcelListEntity = distributionParcelListClient.findOneByOrderPackageCode(orderPackageCode);
if(packageStatus.equals("0")){
//未入库 判断当前包件入库最后的仓库有无数据
if(!Objects.isNull(distributionParcelListEntity)){
//如果有数据,则把暂存单入库并
advanceDetailEntity.setPackageStatus("1");
Long parcelListWarehouseId = distributionParcelListEntity.getWarehouseId();
String parcelListWarehouse = distributionParcelListEntity.getWarehouse();
//判断当前包件所在仓与导入仓库是否一致,一致则不插入
if(parcelListWarehouseId.equals(warehouseId)){
advanceDetailEntity.setIncomingWarehouseId(parcelListWarehouseId);
advanceDetailEntity.setIncomingWarehouseName(parcelListWarehouse);
}else{
//如果不一致,则把包件插入到入库仓库状态为60
advanceDetailEntity.setIncomingWarehouseId(warehouseId);
advanceDetailEntity.setIncomingWarehouseName(warehouseName);
log.info("#################syncUnloadData 1111 orderPackageCode={}",orderPackageCode);
//更新包件到指定仓并且状态为20
updateParcelListToWarehouse(advanceDetailEntity,warehouseId,"60");
}
advanceDetailEntity.setNowWarehouseId(parcelListWarehouseId);
advanceDetailEntity.setNowWarehouseName(parcelListWarehouse);
}
}else{
//暂存单包件已入库
if(!Objects.isNull(nowWarehouseId)){
//当前所在仓id不为空
if(!Objects.isNull(distributionParcelListEntity)){
//判断当前所包件所在仓有数据
Long warehouseId1 = distributionParcelListEntity.getWarehouseId();
String warehouse = distributionParcelListEntity.getWarehouse();
if(!nowWarehouseId.equals(warehouseId1)){
//判断当前仓库与包件所在仓库是否一致,不一致则判断当前所在仓包件有无入库
DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(orderPackageCode, nowWarehouseId);
if(Objects.isNull(parcelListEntity)){
//未入库
log.info("#################syncUnloadData 22222 orderPackageCode={}",orderPackageCode);
//更新包件到指定仓并且状态为20
updateParcelListToWarehouse(advanceDetailEntity,nowWarehouseId,"20");
}else{
advanceDetailEntity.setNowWarehouseId(warehouseId1);
advanceDetailEntity.setNowWarehouseName(warehouse);
}
}
}else{
if(Objects.isNull(incomingWarehouseId)){
advanceDetailEntity.setIncomingWarehouseId(warehouseId);
advanceDetailEntity.setIncomingWarehouseName(warehouseName);
if(warehouseId.equals(nowWarehouseId)){
log.info("#################syncUnloadData 333333 orderPackageCode={}",orderPackageCode);
//更新包件到指定仓并且状态为20
updateParcelListToWarehouse(advanceDetailEntity,warehouseId,"20");
}else{
log.info("#################syncUnloadData 44444 orderPackageCode={}",orderPackageCode);
//更新包件到指定仓并且状态为20
updateParcelListToWarehouse(advanceDetailEntity,warehouseId,"60");
log.info("#################syncUnloadData 55555 orderPackageCode={}",orderPackageCode);
//更新包件到指定仓并且状态为20
updateParcelListToWarehouse(advanceDetailEntity,nowWarehouseId,"20");
}
}else{
if(nowWarehouseId.equals(incomingWarehouseId)){
log.info("#################syncUnloadData 66666 orderPackageCode={}",orderPackageCode);
//更新包件到指定仓并且状态为20
updateParcelListToWarehouse(advanceDetailEntity,nowWarehouseId,"20");
}else{
log.info("#################syncUnloadData 7777 orderPackageCode={}",orderPackageCode);
//更新包件到指定仓并且状态为20
updateParcelListToWarehouse(advanceDetailEntity,incomingWarehouseId,"60");
log.info("#################syncUnloadData 88888 orderPackageCode={}",orderPackageCode);
//更新包件到指定仓并且状态为20
updateParcelListToWarehouse(advanceDetailEntity,nowWarehouseId,"20");
}
}
}
}else{
if(!Objects.isNull(distributionParcelListEntity)){
Long warehouseId1 = distributionParcelListEntity.getWarehouseId();
String warehouse = distributionParcelListEntity.getWarehouse();
if(Objects.isNull(incomingWarehouseId)){
advanceDetailEntity.setIncomingWarehouseId(warehouseId);
advanceDetailEntity.setIncomingWarehouseName(warehouseName);
advanceDetailEntity.setNowWarehouseId(warehouseId1);
advanceDetailEntity.setNowWarehouseName(warehouse);
log.info("#################syncUnloadData 99999 orderPackageCode={}",orderPackageCode);
//更新包件到指定仓并且状态为20
updateParcelListToWarehouse(advanceDetailEntity,warehouseId,"60");
}else{
advanceDetailEntity.setNowWarehouseId(warehouseId1);
advanceDetailEntity.setNowWarehouseName(warehouse);
if(!incomingWarehouseId.equals(warehouseId1)){
log.info("#################syncUnloadData 000000 orderPackageCode={}",orderPackageCode);
//更新包件到指定仓并且状态为20
updateParcelListToWarehouse(advanceDetailEntity,incomingWarehouseId,"60");
}
}
}else{
if(Objects.isNull(incomingWarehouseId)){
advanceDetailEntity.setIncomingWarehouseId(warehouseId);
advanceDetailEntity.setIncomingWarehouseName(warehouseName);
advanceDetailEntity.setNowWarehouseId(warehouseId);
advanceDetailEntity.setNowWarehouseName(warehouseName);
log.info("#################syncUnloadData aaaaaa orderPackageCode={}",orderPackageCode);
//更新包件到指定仓并且状态为20
updateParcelListToWarehouse(advanceDetailEntity,warehouseId,"20");
}else{
advanceDetailEntity.setIncomingWarehouseId(incomingWarehouseId);
advanceDetailEntity.setIncomingWarehouseName(incomeCategoryName);
advanceDetailEntity.setNowWarehouseId(incomingWarehouseId);
advanceDetailEntity.setNowWarehouseName(incomeCategoryName);
log.info("#################syncUnloadData bbbbbbb orderPackageCode={}",orderPackageCode);
//更新包件到指定仓并且状态为20
updateParcelListToWarehouse(advanceDetailEntity,incomingWarehouseId,"20");
}
}
}
}
}
trunklineAdvanceDetailService.updateSyncUnloadDataStatus(id,1);
}catch (Exception e){
log.warn("###############syncUnloadData: 包件处理失败 orderPackageCode={}", orderPackageCode);
}
}
log.info("############syncUnloadData: 同步卸车数据 完成");
}
private void updateParcelListToWarehouse(TrunklineAdvanceDetailEntity advanceDetailEntity, Long warehouseId, String status) {
String orderPackageCode = advanceDetailEntity.getOrderPackageCode();
String orderCode = advanceDetailEntity.getOrderCode();
String waybillNo = advanceDetailEntity.getWaybillNo();
Long advanceId = advanceDetailEntity.getAdvanceId();
TrunklineAdvanceEntity advanceEntity = advanceService.getById(advanceId);
Integer total = trunklineAdvanceDetailService.findTotalNumByOrderCode(orderCode);
BasicdataWarehouseEntity warehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(warehouseId);
String warehouseName = warehouseEntity.getName();
if("20".equals(status)){
List<DistributionParcelListEntity> list = distributionParcelListClient.findListByOrderPackageCodeAndStatus(orderPackageCode,"20");
//把list通过warehouseId进行分组
List<DistributionParcelListEntity> updateParceList = new ArrayList<>();
if(CollUtil.isNotEmpty(list)){
list.forEach(distributionParcelListEntity -> {
DistributionParcelListEntity updateEntity = new DistributionParcelListEntity();
updateEntity.setId(distributionParcelListEntity.getId());
updateEntity.setOrderPackageStatus("60");
updateParceList.add(updateEntity);
});
}
distributionParcelListClient.updateList(updateParceList);
}
WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillNo(waybillNo);
Date date = new Date();
Long orderId = null;
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient.findStockArticleByOrderCodeAndWarehouseId(orderCode, warehouseId);
if(Objects.isNull(stockArticleEntity)){
stockArticleEntity = new DistributionStockArticleEntity();
stockArticleEntity.setOrderCode(orderCode);
stockArticleEntity.setServiceNumber(advanceEntity.getServiceNum());
stockArticleEntity.setWaybillNumber(waybillNo);
stockArticleEntity.setTotalNumber(total);
stockArticleEntity.setHandQuantity(0);
// stockArticleEntity.setTenantId(TenantNum.HUITONGCODE);// 对应租户ID
stockArticleEntity.setWarehouse(warehouseName);
stockArticleEntity.setWarehouseId(warehouseId);
stockArticleEntity.setBrand(advanceEntity.getBrand());
stockArticleEntity.setDescriptionGoods(advanceEntity.getPackName());
stockArticleEntity.setWarehouseEntryTime(date);
stockArticleEntity.setGenre(1);
String dealerName = advanceEntity.getDealerName();//暂存单经销商名称
stockArticleEntity.setDealerCode(advanceEntity.getDealerCode());
stockArticleEntity.setDealerName(advanceEntity.getDealerName());
stockArticleEntity.setTypeService("1");//默认商配
if (!Objects.isNull(waybillEntity)) {
Long consigneeId = waybillEntity.getConsigneeId();
String consigneeName1 = waybillEntity.getConsignee();
BasicdataClientEntity clientEntity = clientClient.getMallById(consigneeId);
// 如果在入库的时候发现客户信息不存在,则不设置客户信息 默认采用商配
if (!Objects.isNull(clientEntity)) {
stockArticleEntity.setMallId(clientEntity.getId());
stockArticleEntity.setMallName(clientEntity.getClientName());
stockArticleEntity.setMallCode(clientEntity.getClientCode());
stockArticleEntity.setTypeService(clientEntity.getTypeService()+"");
}
String consignee = waybillEntity.getConsignee();
String consigneeName = waybillEntity.getConsigneeName();
String consigneeMobile = waybillEntity.getConsigneeMobile();
String consigneeAddress = waybillEntity.getConsigneeAddress();
stockArticleEntity.setConsigneeUnit(consignee);
stockArticleEntity.setConsigneePerson(consigneeName);
stockArticleEntity.setConsigneeMobile(consigneeMobile);
stockArticleEntity.setConsigneeAddress(consigneeAddress);
} else {
Long clientId = tripartiteMallClient.getClientIdByNameAndBrand(dealerName, advanceEntity.getBrand());
BasicdataClientEntity basicdataClientEntity = clientClient.findEntityById(clientId);
if (!Objects.isNull(basicdataClientEntity)) {
String clientType = basicdataClientEntity.getClientType();
if ("5".equals(clientType)) {
stockArticleEntity.setStoreId(basicdataClientEntity.getId());
stockArticleEntity.setStoreCode(basicdataClientEntity.getClientCode());
stockArticleEntity.setStoreName(basicdataClientEntity.getClientName());
//查询门店的父级商场
Long pid = basicdataClientEntity.getPid();
BasicdataClientEntity pidEntity = clientClient.findEntityById(pid);
if (!Objects.isNull(pidEntity)) {
String pidEntityClientType = pidEntity.getClientType();
if ("2".equals(pidEntityClientType)) {
//商城
stockArticleEntity.setMallId(pidEntity.getId());
stockArticleEntity.setMallName(pidEntity.getClientName());
stockArticleEntity.setMallCode(pidEntity.getClientCode());
stockArticleEntity.setTypeService(pidEntity.getTypeService()+"");
}
}
} else if ("2".equals(clientType)) {
//商城
stockArticleEntity.setMallId(basicdataClientEntity.getId());
stockArticleEntity.setMallName(basicdataClientEntity.getClientName());
stockArticleEntity.setMallCode(basicdataClientEntity.getClientCode());
stockArticleEntity.setTypeService(basicdataClientEntity.getTypeService()+"");
}
}
}
stockArticleEntity.setCustomerName(advanceEntity.getCustomerName());
stockArticleEntity.setCustomerTelephone(advanceEntity.getCustomerPhone());
stockArticleEntity.setCustomerAddress(advanceEntity.getCustomerAddress());
stockArticleEntity.setStockupStatus("10");
stockArticleEntity.setReservationStatus("10");
stockArticleEntity.setOrderStatus("0");
stockArticleEntity.setGroundingStatus("10");
stockArticleEntity.setOrderReceiveStatus("10");
stockArticleEntity.setFreezeStatus("10");
stockArticleEntity.setNotification(2);
stockArticleEntity.setIsHaveData(2);
stockArticleEntity.setTrainNumber(advanceEntity.getTrainNumber());
stockArticleEntity.setSortingQuantity(0);
stockArticleEntity.setDeliveryQuantity(0);
stockArticleEntity.setTransferQuantity(0);
stockArticleEntity.setSigninQuantity(0);
orderId = distributionStockArticleClient.addData(stockArticleEntity);
if(NumberUtil.equals(orderId,0)){
log.warn("################111111: 保存失败");
throw new CustomerException(405,"保存失败");
}
}else{
stockArticleEntity.setGenre(1);
stockArticleEntity.setTotalNumber(total);
orderId = stockArticleEntity.getId();
distributionStockArticleClient.updateEntity(stockArticleEntity);
}
DistributionParcelListEntity parcelList = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(orderPackageCode, warehouseId);
if(Objects.isNull(parcelList)){
parcelList = new DistributionParcelListEntity();
parcelList.setWarehouse(warehouseEntity.getName());
parcelList.setWarehouseId(warehouseId);
parcelList.setIsTransfer(1);
if (!Objects.isNull(waybillEntity)) {
parcelList.setWaybillId(waybillEntity.getId());
parcelList.setWaybillNumber(waybillEntity.getWaybillNo());
parcelList.setSendWarehouseId(waybillEntity.getDepartureWarehouseId());
parcelList.setSendWarehouseName(waybillEntity.getDepartureWarehouseName());
Long destinationWarehouseId = waybillEntity.getDestinationWarehouseId();
parcelList.setAcceptWarehouseId(destinationWarehouseId);
parcelList.setAcceptWarehouseName(waybillEntity.getDestinationWarehouseName());
if (warehouseId.equals(destinationWarehouseId)) {
parcelList.setIsTransfer(0);
}
}
parcelList.setConditions(1);
parcelList.setOrderPackageCode(orderPackageCode);
parcelList.setFirsts(advanceDetailEntity.getFirstPackName());
parcelList.setSecond(advanceDetailEntity.getSecondPackName());
parcelList.setThirdProduct(advanceDetailEntity.getThirdPackName());
parcelList.setQuantity(1);
parcelList.setStockArticleId(orderId);
parcelList.setOrderCode(orderCode);
parcelList.setServiceNumber(advanceDetailEntity.getServiceNum());
parcelList.setTrainNumber(advanceDetailEntity.getTrainNumber());
parcelList.setAdvanceId(advanceId);
Long materialId = advanceDetailEntity.getMaterialId();
String materialCode = advanceDetailEntity.getMaterialCode();
String materialName = advanceDetailEntity.getMaterialName();
if (Objects.isNull(materialId)) {
if (StringUtil.isNotBlank(materialCode) && StringUtil.isNotBlank(materialCode) && StringUtil.isNotBlank(materialName)) {
BasicMaterialEntity materialEntity = basicMaterialClient.findEntityByCodeAndName(materialCode, materialName);
if (!Objects.isNull(materialEntity)) {
parcelList.setMaterialId(materialEntity.getId());
parcelList.setMaterialName(materialEntity.getName());
parcelList.setMaterialCode(materialEntity.getProductCode());
parcelList.setMaterialUnit(materialEntity.getSpecification());
}
}
} else {
BasicMaterialEntity materialOwnId = basicMaterialClient.getMaterialOwnId(materialId);
if (!Objects.isNull(materialOwnId)) {
parcelList.setMaterialId(materialOwnId.getId());
parcelList.setMaterialName(materialOwnId.getName());
parcelList.setMaterialCode(materialOwnId.getProductCode());
parcelList.setMaterialUnit(materialOwnId.getSpecification());
}
}
parcelList.setBrandName(advanceDetailEntity.getBrand());
parcelList.setOrderPackageStatus(status);
parcelList.setOrderPackageFreezeStatus("10");
parcelList.setOrderPackageGroundingStatus("10");
parcelList.setOrderPackageStockupStatus("10");
parcelList.setOrderPackageReservationStatus("10");
parcelList.setOrderPackageLoadingStatus("10");
parcelList.setWarehouseEntryTimeEnd(date);
parcelList.setDealerCode(stockArticleEntity.getDealerCode());
parcelList.setDealerName(stockArticleEntity.getDealerName());
distributionParcelListClient.addReturnId(parcelList);
}
}
@Override
public R carsLoadDetailInfo(LoadCarsDTO loadCarsDTO) {
@ -5288,7 +5681,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
String audio = null;
String orders = null;
if (0 == isZero) {
unloadPackage(loadId, orderPackageCode, warehouseId, 1, "卸分一体 卸车", incomingType,palletName,trayCode);
unloadPackage(loadId, orderPackageCode, warehouseId, 1, "卸分一体 卸车", incomingType, palletName, trayCode);
Map<String, Object> map = new HashMap<>();
map.put("trayType", trayType);
map.put("trayCode", trayCode);
@ -7714,13 +8107,19 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
log.warn("############signLoadScanByIds: 车辆还未发车 loadId={}", loadId);
return R.fail(405, "车辆还未发车");
}
if("90".equals(loadStatus)){
log.warn("############signLoadScanByIds: 车辆已签收 loadStatus={}", loadStatus);
return R.fail(405, "车辆已签收");
}
if(!"40".equals(loadStatus)){
if(!"40".equals(loadStatus)||!"91".equals(loadStatus)){
log.warn("############signLoadScanByIds: 车辆还未到达 loadStatus={}", loadStatus);
return R.fail(405, "车辆还未到达");
}
Integer realLoadingNumber = carsLoadEntity.getRealLoadingNumber();
String deliveryType = carsLoadEntity.getDeliveryType();
@ -10747,7 +11146,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
if(exists){
return R.fail("正在同步中,请勿重复操作");
}else{
bladeRedis.set(key,"1");
bladeRedis.setEx(key,"1",60L);
}

2
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayTypeMapper.xml

@ -62,6 +62,8 @@
select ldsa.id dataId,
ldsa.waybill_number waybillNo,
ldsa.order_code dataCode,
ldsa.consignee_unit consigneeUnit,
ldsa.consignee_person consigneePerson,
ldsa.hand_quantity orderTotalNum
from logpm_distribution_stock_article ldsa
where ldsa.is_deleted = 0

4
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java

@ -1091,7 +1091,7 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(orderPackageCode, warehouseId);
if (Objects.isNull(parcelListEntity)) {
log.warn("##############orderScanOrderPackageCode: 包件不存在 orderPackageCode={} warehouseId={}", orderPackageCode, warehouseId);
return R.fail(2001, "包件不在");
return R.fail(2001, "包件不在当前仓");
}
String orderCode = parcelListEntity.getOrderCode();//订单自编码
Long wid = parcelListEntity.getWarehouseId();
@ -1103,7 +1103,7 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
String orderPackageStatus = parcelListEntity.getOrderPackageStatus();
if (!"20".equals(orderPackageStatus)) {
log.warn("##############orderScanOrderPackageCode: 包件已不在库 orderPackageCode={} warehouseId={}", orderPackageCode, warehouseId);
return R.fail(2001, "包件已不在库");
return R.fail(2001, "包件不在当前仓");
}
// if(conditions.equals(2)){

Loading…
Cancel
Save