Browse Source

1.bug修复

master
zhenghaoyu 6 months ago
parent
commit
433de65519
  1. 1
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/OrderCodeDataVO.java
  2. 22
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java
  3. 135
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java

1
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/OrderCodeDataVO.java

@ -19,5 +19,6 @@ public class OrderCodeDataVO {
@ApiModelProperty(value = "模板填充内容")
private List<Map<String,Object>> dataList;
private List<String> moldList;
}

22
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java

@ -2480,6 +2480,18 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
}
orderCodeDataVO.setDataList(data);
List<String> moldList = new ArrayList<>();
data.forEach(map -> {
try {
String popHtml = TemplateUtil.popTemplate("订单码", map, html);
moldList.add(popHtml);
} catch (Exception e) {
throw new RuntimeException(e);
}
});
orderCodeDataVO.setMoldList(moldList);
return orderCodeDataVO;
}
@ -2545,6 +2557,16 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
}
orderCodeDataVO.setDataList(data);
List<String> moldList = new ArrayList<>();
data.forEach(map -> {
try {
String popHtml = TemplateUtil.popTemplate("订单码", map, html);
moldList.add(popHtml);
} catch (Exception e) {
throw new RuntimeException(e);
}
});
return orderCodeDataVO;
}

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

@ -4517,76 +4517,81 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
List<TrunklineCarsOrderEntity> carsOrderEntityList = trunklineCarsOrderService.listByIds(carsOrderIdList);
//移除carsOrderEntityList中signNum不为0的元素
carsOrderEntityList.removeIf(e -> e.getSignNum() != 0);
//把carsOrderEntityList通过signOrderId进行分组
Map<Long, List<TrunklineCarsOrderEntity>> collect = carsOrderEntityList.stream().collect(Collectors.groupingBy(TrunklineCarsOrderEntity::getSignOrderId));
Set<Long> signOrderIds = collect.keySet();
List<TrunklineLoadSignOrderEntity> signOrderEntityList = trunklineLoadSignOrderService.listByIds(signOrderIds);
//把signOrderEntityList转化成id为key的Map
Map<Long, TrunklineLoadSignOrderEntity> signOrderEntityMap = signOrderEntityList.stream().collect(Collectors.toMap(TrunklineLoadSignOrderEntity::getId, Function.identity()));
List<TrunklineCarsOrderEntity> updateCarsOrderList = new ArrayList<>();
List<TrunklineLoadSignOrderEntity> updateSignOrderList = new ArrayList<>();
List<Long> delSignOrderList = new ArrayList<>();
Long finalLoadId1 = loadId;
collect.keySet().forEach(signOrderId -> {
List<TrunklineCarsOrderEntity> list = collect.get(signOrderId);
TrunklineLoadSignOrderEntity trunklineLoadSignOrderEntity = signOrderEntityMap.get(signOrderId);
//把list中所有元素的realNum求和
int sumLoading = list.stream().mapToInt(TrunklineCarsOrderEntity::getRealNum).sum();
int sumPlan = list.stream().mapToInt(TrunklineCarsOrderEntity::getPlanNum).sum();
Integer planNum = trunklineLoadSignOrderEntity.getPlanNum();
Integer loadingNum = trunklineLoadSignOrderEntity.getLoadingNum();
Integer signNum = trunklineLoadSignOrderEntity.getSignNum();
if(sumPlan < planNum){
//只是更新不删除
TrunklineLoadSignOrderEntity updateSignOrderEntity = new TrunklineLoadSignOrderEntity();
updateSignOrderEntity.setId(trunklineLoadSignOrderEntity.getId());
int diff = planNum - sumPlan;
updateSignOrderEntity.setPlanNum(diff);
updateSignOrderEntity.setLoadingNum(loadingNum-sumLoading);
if(signNum >= diff){
updateSignOrderEntity.setSignStatus("20");
}else if(signNum == 0){
updateSignOrderEntity.setSignStatus("0");
if(CollUtil.isNotEmpty(carsOrderEntityList)){
//把carsOrderEntityList通过signOrderId进行分组
Map<Long, List<TrunklineCarsOrderEntity>> collect = carsOrderEntityList.stream().collect(Collectors.groupingBy(TrunklineCarsOrderEntity::getSignOrderId));
Set<Long> signOrderIds = collect.keySet();
List<TrunklineLoadSignOrderEntity> signOrderEntityList = trunklineLoadSignOrderService.listByIds(signOrderIds);
//把signOrderEntityList转化成id为key的Map
Map<Long, TrunklineLoadSignOrderEntity> signOrderEntityMap = signOrderEntityList.stream().collect(Collectors.toMap(TrunklineLoadSignOrderEntity::getId, Function.identity()));
List<TrunklineCarsOrderEntity> updateCarsOrderList = new ArrayList<>();
List<TrunklineLoadSignOrderEntity> updateSignOrderList = new ArrayList<>();
List<Long> delSignOrderList = new ArrayList<>();
Long finalLoadId1 = loadId;
collect.keySet().forEach(signOrderId -> {
List<TrunklineCarsOrderEntity> list = collect.get(signOrderId);
TrunklineLoadSignOrderEntity trunklineLoadSignOrderEntity = signOrderEntityMap.get(signOrderId);
//把list中所有元素的realNum求和
int sumLoading = list.stream().mapToInt(TrunklineCarsOrderEntity::getRealNum).sum();
int sumPlan = list.stream().mapToInt(TrunklineCarsOrderEntity::getPlanNum).sum();
Integer planNum = trunklineLoadSignOrderEntity.getPlanNum();
Integer loadingNum = trunklineLoadSignOrderEntity.getLoadingNum();
Integer signNum = trunklineLoadSignOrderEntity.getSignNum();
if(sumPlan < planNum){
//只是更新不删除
TrunklineLoadSignOrderEntity updateSignOrderEntity = new TrunklineLoadSignOrderEntity();
updateSignOrderEntity.setId(trunklineLoadSignOrderEntity.getId());
int diff = planNum - sumPlan;
updateSignOrderEntity.setPlanNum(diff);
updateSignOrderEntity.setLoadingNum(loadingNum-sumLoading);
if(signNum >= diff){
updateSignOrderEntity.setSignStatus("20");
}else if(signNum == 0){
updateSignOrderEntity.setSignStatus("0");
}else{
updateSignOrderEntity.setSignStatus("10");
}
updateSignOrderList.add(updateSignOrderEntity);
}else{
updateSignOrderEntity.setSignStatus("10");
//删除
delSignOrderList.add(signOrderId);
}
updateSignOrderList.add(updateSignOrderEntity);
}else{
//删除
delSignOrderList.add(signOrderId);
}
list.forEach(e -> {
TrunklineCarsOrderEntity carsOrderEntity = new TrunklineCarsOrderEntity();
carsOrderEntity.setId(e.getId());
carsOrderEntity.setOrderCode(e.getOrderCode());
carsOrderEntity.setWaybillNo(e.getWaybillNo());
carsOrderEntity.setLoadId(finalLoadId1);
carsOrderEntity.setNodeId(e.getNodeId());
updateCarsOrderList.add(carsOrderEntity);
});
});
list.forEach(e -> {
TrunklineCarsOrderEntity carsOrderEntity = new TrunklineCarsOrderEntity();
carsOrderEntity.setId(e.getId());
carsOrderEntity.setOrderCode(e.getOrderCode());
carsOrderEntity.setWaybillNo(e.getWaybillNo());
carsOrderEntity.setLoadId(finalLoadId1);
carsOrderEntity.setNodeId(e.getNodeId());
updateCarsOrderList.add(carsOrderEntity);
});
if(CollUtil.isNotEmpty(updateSignOrderList)){
trunklineLoadSignOrderService.updateBatchById(updateSignOrderList);
}
if(CollUtil.isNotEmpty(delSignOrderList)){
trunklineLoadSignOrderService.deleteListBySignOrderIds(delSignOrderList);
}
if(CollUtil.isNotEmpty(updateCarsOrderList)){
//把updateCarsOrderIdList所有的id放入一个List
List<Long> updateCarsOrderIdList = updateCarsOrderList.stream().map(TrunklineCarsOrderEntity::getId).collect(Collectors.toList());
trunklineCarsOrderService.updateNoCustomer(updateCarsOrderIdList);
updateCarsOrderList.forEach(e -> {
Long nodeId = e.getNodeId();
String orderCode = e.getOrderCode();
String waybillNo = e.getWaybillNo();
trunklineCarsLoadScanService.clearSignOrderIdByLoadIdAndWarehouseIdAndOrderCodeAndWaybillNo(finalLoadId1,nodeId,orderCode,waybillNo);
});
if(CollUtil.isNotEmpty(updateSignOrderList)){
trunklineLoadSignOrderService.updateBatchById(updateSignOrderList);
}
if(CollUtil.isNotEmpty(delSignOrderList)){
trunklineLoadSignOrderService.deleteListBySignOrderIds(delSignOrderList);
}
if(CollUtil.isNotEmpty(updateCarsOrderList)){
//把updateCarsOrderIdList所有的id放入一个List
List<Long> updateCarsOrderIdList = updateCarsOrderList.stream().map(TrunklineCarsOrderEntity::getId).collect(Collectors.toList());
trunklineCarsOrderService.updateNoCustomer(updateCarsOrderIdList);
updateCarsOrderList.forEach(e -> {
Long nodeId = e.getNodeId();
String orderCode = e.getOrderCode();
String waybillNo = e.getWaybillNo();
trunklineCarsLoadScanService.clearSignOrderIdByLoadIdAndWarehouseIdAndOrderCodeAndWaybillNo(finalLoadId1,nodeId,orderCode,waybillNo);
});
}
}else{
log.warn("###############updateWaybillOrderIsCustemer: 订单已有签收数据不能移除");
return R.fail(405,"订单已有签收数据,不能移除");
}
}

Loading…
Cancel
Save