|
|
|
@ -230,25 +230,51 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
|
|
|
|
|
basicdataFreightApiVO.setDestination(openOrderVO.getDestinationCode()); |
|
|
|
|
basicdataFreightApiVO.setArrivalWarehouse(openOrderVO.getDestinationWarehouseId() + ""); |
|
|
|
|
|
|
|
|
|
for (AdvanceDetailGoodsVO advanceDetailGoodsVO : goodsList) { |
|
|
|
|
String goodsName = advanceDetailGoodsVO.getGoodsName(); |
|
|
|
|
BasicdataCategoryEntity basicdataCategoryEntity = basicdataCategoryClient.findByName(goodsName); |
|
|
|
|
Long goodsId = null; |
|
|
|
|
if (Objects.isNull(basicdataCategoryEntity)) { |
|
|
|
|
basicdataCategoryEntity = new BasicdataCategoryEntity(); |
|
|
|
|
basicdataCategoryEntity.setType(1); |
|
|
|
|
basicdataCategoryEntity.setName(goodsName); |
|
|
|
|
goodsId = basicdataCategoryClient.addReturnId(basicdataCategoryEntity); |
|
|
|
|
} else { |
|
|
|
|
goodsId = basicdataCategoryEntity.getId(); |
|
|
|
|
if(goodsList.isEmpty()){ |
|
|
|
|
List<AdvanceDetailGoodsVO> ls = new ArrayList<>(); |
|
|
|
|
//把list中的元素通过packName分组如果pickName为空则换为"其他"
|
|
|
|
|
Map<String, List<TrunklineAdvanceEntity>> groupedEntities = list.stream() |
|
|
|
|
.collect(Collectors.groupingBy(entity -> { |
|
|
|
|
String packName = entity.getPackName(); |
|
|
|
|
return packName != null ? packName : "其他"; |
|
|
|
|
})); |
|
|
|
|
|
|
|
|
|
groupedEntities.keySet().forEach(packName -> { |
|
|
|
|
int total; |
|
|
|
|
List<TrunklineAdvanceEntity> advanceEntityList = groupedEntities.get(packName); |
|
|
|
|
total = advanceEntityList.stream().mapToInt(TrunklineAdvanceEntity::getTotalNum).sum(); |
|
|
|
|
AdvanceDetailGoodsVO advanceDetailGoodsVO = new AdvanceDetailGoodsVO(); |
|
|
|
|
advanceDetailGoodsVO.setChargeType(1); |
|
|
|
|
advanceDetailGoodsVO.setGoodsName(packName); |
|
|
|
|
advanceDetailGoodsVO.setNum(total); |
|
|
|
|
advanceDetailGoodsVO.setVolume(BigDecimal.ZERO); |
|
|
|
|
advanceDetailGoodsVO.setWeight(BigDecimal.ZERO); |
|
|
|
|
ls.add(advanceDetailGoodsVO); |
|
|
|
|
}); |
|
|
|
|
goodsList = new ArrayList<>(ls); |
|
|
|
|
}else{ |
|
|
|
|
for (AdvanceDetailGoodsVO advanceDetailGoodsVO : goodsList) { |
|
|
|
|
String goodsName = advanceDetailGoodsVO.getGoodsName(); |
|
|
|
|
BasicdataCategoryEntity basicdataCategoryEntity = basicdataCategoryClient.findByName(goodsName); |
|
|
|
|
Long goodsId = null; |
|
|
|
|
if (Objects.isNull(basicdataCategoryEntity)) { |
|
|
|
|
basicdataCategoryEntity = new BasicdataCategoryEntity(); |
|
|
|
|
basicdataCategoryEntity.setType(1); |
|
|
|
|
basicdataCategoryEntity.setName(goodsName); |
|
|
|
|
goodsId = basicdataCategoryClient.addReturnId(basicdataCategoryEntity); |
|
|
|
|
} else { |
|
|
|
|
goodsId = basicdataCategoryEntity.getId(); |
|
|
|
|
} |
|
|
|
|
advanceDetailGoodsVO.setGoodsId(goodsId); |
|
|
|
|
basicdataFreightApiVO.setCategory(goodsId + ""); |
|
|
|
|
List<BasicdataFreightDetailEntity> pirceList = basicdataFreightClient.pirce(basicdataFreightApiVO); |
|
|
|
|
JSONArray price = JSONArray.parseArray(JSON.toJSONString(pirceList)); |
|
|
|
|
advanceDetailGoodsVO.setArrPirce(price); |
|
|
|
|
} |
|
|
|
|
advanceDetailGoodsVO.setGoodsId(goodsId); |
|
|
|
|
basicdataFreightApiVO.setCategory(goodsId + ""); |
|
|
|
|
List<BasicdataFreightDetailEntity> pirceList = basicdataFreightClient.pirce(basicdataFreightApiVO); |
|
|
|
|
JSONArray price = JSONArray.parseArray(JSON.toJSONString(pirceList)); |
|
|
|
|
advanceDetailGoodsVO.setArrPirce(price); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
openOrderVO.setGoodsList(goodsList); |
|
|
|
|
|
|
|
|
|
//查询支付方式
|
|
|
|
@ -2127,7 +2153,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
|
|
|
|
|
advanceEntity.setLegacyStatus("1"); |
|
|
|
|
} |
|
|
|
|
advanceEntity.setHasPackage(0); |
|
|
|
|
advanceEntity.setCreateUserName(AuthUtil.getUserName()); |
|
|
|
|
advanceEntity.setCreateUserName(AuthUtil.getNickName()); |
|
|
|
|
list.add(advanceEntity); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
@ -2731,7 +2757,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
|
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
@Override |
|
|
|
|
public R abolishWaybill(List<Long> waybillIds, Long warehouseId, String warehouseName) { |
|
|
|
|
public R abolishWaybill(List<Long> waybillIds, Long warehouseId, String warehouseName, String abolishReson) { |
|
|
|
|
List<WarehouseWaybillEntity> waybillList = warehouseWaybillClient.findListByWaybillIds(waybillIds); |
|
|
|
|
List<WarehouseWaybillEntity> waybillEntities = warehouseWaybillClient.findListByWaybillIds(waybillIds); |
|
|
|
|
waybillList.forEach(waybillEntity -> { |
|
|
|
@ -2785,7 +2811,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
|
|
|
|
|
|
|
|
|
|
waybillEntities.forEach(waybillEntity -> { |
|
|
|
|
String createOperationRemark = "作废运单" + waybillEntity.getWaybillNo() + ",时间:" + CommonUtil.dateToString(new Date()); |
|
|
|
|
openOrderAsyncService.saveLog(waybillEntity.getId(), waybillEntity.getWaybillNo(), "1000", "作废运单", createOperationRemark, AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, warehouseName); |
|
|
|
|
openOrderAsyncService.saveLog(waybillEntity.getId(), waybillEntity.getWaybillNo(), "1000", "作废运单", createOperationRemark+" 原因:"+abolishReson, AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, warehouseName); |
|
|
|
|
}); |
|
|
|
|
return R.success("作废成功"); |
|
|
|
|
} |
|
|
|
|