Browse Source

优化自提的速度

master
pref_mail@163.com 11 months ago
parent
commit
ef67e9d1ee
  1. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionBillLadingAppController.java
  2. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java
  3. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java
  4. 215
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionBillLadingAppController.java

@ -132,7 +132,7 @@ public class DistributionBillLadingAppController extends BladeController {
@ApiImplicitParam(name = "coding", value = "包条码", required = true),
@ApiImplicitParam(name = "type", value = "类型 2 订单 1 库存品", required = true)
})
public Resp getScan(@ApiIgnore @RequestParam Map<String, Object> distrilbutionBillLading){
public Resp scan(@ApiIgnore @RequestParam Map<String, Object> distrilbutionBillLading){
Resp scan = distrilbutionBillLadingService.getScan(distrilbutionBillLading);
//获取传入类型

4
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java

@ -39,7 +39,7 @@ public interface IDistributionAsyncService {
* @param id
* @return
*/
Boolean getOrderSelfPickup(Long id);
Boolean updateOrderSelfPickup(Long id);
/**
* 修改扫码状态
* @param id
@ -58,7 +58,7 @@ public interface IDistributionAsyncService {
* @param id
* @return
*/
Boolean getBillStock(Long id);
Boolean updateBillStock(Long id);
/**
* 修改订单备货状态

4
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java

@ -157,7 +157,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
@Override
@LogpmAsync("asyncExecutor")
@Transactional(rollbackFor = Exception.class)
public Boolean getOrderSelfPickup(Long id) {
public Boolean updateOrderSelfPickup(Long id) {
DistributionStockArticleEntity entity = new DistributionStockArticleEntity();
entity.setId(id);
entity.setOrderStatus(OrderStatusConstant.qianshou.getValue());
@ -192,7 +192,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
* @return
*/
@Override
public Boolean getBillStock(Long id) {
public Boolean updateBillStock(Long id) {
DistrilbutionBillStockEntity distrilbutionBillStock = new DistrilbutionBillStockVO();
distrilbutionBillStock.setId(id);
distrilbutionBillStock.setConditions("20");

215
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java

@ -1343,27 +1343,27 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
@Override
public DistributionBillLadingExcelDTO exportDistributionBillLadingDetail(Long id) {
String method = "################# 导出配送单明细 #################exportDistributionBillLadingDetail";
if (Objects.isNull(id)){
log.error(method+"ids参数缺失:{}",id);
if (Objects.isNull(id)) {
log.error(method + "ids参数缺失:{}", id);
}
DistributionBillLadingExcelDTO distributionBillLadingExcelDTO = new DistributionBillLadingExcelDTO();
List<DistributionBillOrderExcel> distributionBillOrderExcels = distrilbutionBillStockService.distrilbutionBillDeatilStock(id);
if (!distributionBillOrderExcels.isEmpty()) {
distributionBillLadingExcelDTO.setBillOrderExcelList(distributionBillOrderExcels);
}
List<DistributionBillOrderPackExcel> distributionBillOrderPackExcels = distrilbutionBillStockService.billLadingDetailOrderPackExcel(id);
if (!distributionBillOrderPackExcels.isEmpty()) {
distributionBillLadingExcelDTO.setBillOrderPackExcelList(distributionBillOrderPackExcels);
}
List<DistributionBillInventoryExcel> billInventoryExcelList = distributionDeliveryDetailsService.getBillLadingDetailOrderInventoryExcel(id);
if (billInventoryExcelList.isEmpty()) {
distributionBillLadingExcelDTO.setBillInventoryExcelList(billInventoryExcelList);
}
DistributionBillLadingExcelDTO distributionBillLadingExcelDTO = new DistributionBillLadingExcelDTO();
List<DistributionBillOrderExcel> distributionBillOrderExcels = distrilbutionBillStockService.distrilbutionBillDeatilStock(id);
if (!distributionBillOrderExcels.isEmpty()) {
distributionBillLadingExcelDTO.setBillOrderExcelList(distributionBillOrderExcels);
}
List<DistributionBillOrderPackExcel> distributionBillOrderPackExcels = distrilbutionBillStockService.billLadingDetailOrderPackExcel(id);
if (!distributionBillOrderPackExcels.isEmpty()) {
distributionBillLadingExcelDTO.setBillOrderPackExcelList(distributionBillOrderPackExcels);
}
List<DistributionBillInventoryExcel> billInventoryExcelList = distributionDeliveryDetailsService.getBillLadingDetailOrderInventoryExcel(id);
if (billInventoryExcelList.isEmpty()) {
distributionBillLadingExcelDTO.setBillInventoryExcelList(billInventoryExcelList);
}
return distributionBillLadingExcelDTO;
}
@Override
public R getBillLadingPackageIds(Long id,Long orderId) {
public R getBillLadingPackageIds(Long id, Long orderId) {
List<DistrilbutionBillPackageEntity> list = distrilbutionBillPackageService.list(Wrappers.<DistrilbutionBillPackageEntity>query().lambda()
.eq(DistrilbutionBillPackageEntity::getBillLadingId, id)
.eq(DistrilbutionBillPackageEntity::getStockArticleId, orderId)
@ -2204,7 +2204,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
distrilbutionBillPackageService.update(Wrappers.<DistrilbutionBillPackageEntity>update()
.eq("bill_lading_id", id)
.eq("stock_article_id", i.getStockArticleId())
.apply("packet_bar_status in ( 1 , 3 )")
.apply("packet_bar_status in ( '1' , '3' )")
.set("packet_bar_status", 2)
);
//还原预约包件信息
@ -2342,7 +2342,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
.map(DistrilbutionBillLadingVO::getId) // 假设getId()方法返回提货单ID
.collect(Collectors.toList());
if (billIds.isEmpty()) {
return distrilbutionBillLadingVOIPage;
return distrilbutionBillLadingVOIPage;
}
List<DistributionDeliveryChargeEntity> distributionDeliveryChargeEntityList = distributionDeliveryChargeService.list(Wrappers.<DistributionDeliveryChargeEntity>query().lambda()
.in(DistributionDeliveryChargeEntity::getBillLading, billIds)
@ -2353,8 +2353,8 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
distributionDeliveryChargeEntityList.stream()
.collect(Collectors.groupingBy(DistributionDeliveryChargeEntity::getBillLading));
} else {
groupedEntities = null;
}
groupedEntities = null;
}
List<DistributionPrintEntity> DistributionPrintEntitys = distributionPrintService.list(Wrappers.<DistributionPrintEntity>query().lambda()
.in(DistributionPrintEntity::getBillLadingId, billIds)
@ -2370,15 +2370,15 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
}
records.forEach(i -> {
if(groupedEntities!=null){
List<DistributionDeliveryChargeEntity> list =groupedEntities.get(i.getId());
records.forEach(i -> {
if (groupedEntities != null) {
List<DistributionDeliveryChargeEntity> list = groupedEntities.get(i.getId());
list.forEach(ii -> ii.setCostName(DictBizCache.getValue(DictBizConstant.DELIVERY_COST, ii.getCost())));
i.setList(list);
}
if(groupDistributionPrintEntityEntities!=null){
if (groupDistributionPrintEntityEntities != null) {
List<DistributionPrintEntity> list1 = groupDistributionPrintEntityEntities.get(i.getId());
if(list1!=null){
if (list1 != null) {
int count = (int) list1.stream().filter(ii -> "1".equals(ii.getGenre().toString())).count();
int count1 = (int) list1.stream().filter(ii -> "2".equals(ii.getGenre().toString())).count();
int count2 = (int) list1.stream().filter(ii -> "3".equals(ii.getGenre().toString())).count();
@ -2389,7 +2389,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
}
}
}else{
} else {
i.setPrintState(false);
}
@ -2482,7 +2482,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
Integer planNum = 0; //预约数量
Integer signedNum = 0; //签收数量
Integer inventoryNub = 0; //库存品
if (StringUtils.isNotBlank(stockArticleId)){
if (StringUtils.isNotBlank(stockArticleId)) {
String[] split = stockArticleId.split(",");
for (String s : split) {
if (StringUtil.isBlank(s)) {
@ -2579,25 +2579,33 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
//有可能存在多个订单所以需要拆分
String stockArticleId = main.getStockArticleId();
// Integer orderNum = 0;
// Integer planNum = 0;
// Integer conpleteNum = 0;
// Integer signedNum = 0;
// //查询零担数据
// List<DistributionReservationZeroPackageEntity> listZero = distributionZeroPackageService.list(Wrappers.<DistributionReservationZeroPackageEntity>query().lambda()
// .eq(DistributionReservationZeroPackageEntity::getReservationId, main.getBillLadingId())
// .eq(DistributionReservationZeroPackageEntity::getIsDeleted, 0)
// .in(DistributionReservationZeroPackageEntity::getZeroPackageStatus, "1", "3")
// );
// if (!listZero.isEmpty()) {
// int sum = listZero.stream().mapToInt(DistributionReservationZeroPackageEntity::getQuantity).sum();
// planNum += sum;
// }
String[] split = stockArticleId.split(",");
List<DistrilbutionAppBillLadingOrderVO> l = new ArrayList<>();
List<Long> ids = new ArrayList<>();
for (String s : split) {
ids.add(Long.parseLong(s));
}
QueryWrapper<DistributionParcelListEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.in("stock_article_id", ids)
.eq("is_deleted", 0)
.isNotNull("order_package_code");
if (!StringUtil.isBlank(orderSelfNumbering)) {
queryWrapper.ne("order_self_numbering", orderSelfNumbering);
}
List<DistributionParcelListEntity> list2 = distributionParcelListService.list(queryWrapper);
QueryWrapper<DistributionBillLadingScanEntity> qw = new QueryWrapper<>();
qw.in("stock_article_id", ids)
.eq("is_deleted", 0);
qw.eq("bill_lading_id", main.getBillLadingId());
List<DistributionBillLadingScanEntity> list3 = distributionBillLadingScanService.list(qw);
for (String s : split) {
if (StringUtil.isBlank(s)) {
continue;
@ -2607,14 +2615,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
// orderNum++;
QueryWrapper<DistributionParcelListEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("stock_article_id", Long.parseLong(s))
.eq("is_deleted", 0)
.isNotNull("order_package_code");
if (!StringUtil.isBlank(orderSelfNumbering)) {
queryWrapper.ne("order_self_numbering", orderSelfNumbering);
}
List<DistributionParcelListEntity> list = distributionParcelListService.list(queryWrapper);
List<DistributionParcelListEntity> list = list2.stream().filter(f -> f.getStockArticleId().equals(Long.parseLong(s))).collect(Collectors.toList());
int pn = 0;
if (!list.isEmpty() && ObjectUtils.isNotNull(list.get(0))) {
vo.setOrderSelfNumbering(list.get(0).getOrderCode());
@ -2623,11 +2624,8 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
// planNum = planNum + pn;
}
//通过订单id查询扫描表中有多少数据
QueryWrapper<DistributionBillLadingScanEntity> qw = new QueryWrapper<>();
qw.eq("stock_article_id", Long.parseLong(s))
.eq("is_deleted", 0);
qw.eq("bill_lading_id", main.getBillLadingId());
List<DistributionBillLadingScanEntity> ls = distributionBillLadingScanService.list(qw);
List<DistributionBillLadingScanEntity> ls = list3.stream().filter(f -> f.getStockArticleId().equals(Long.parseLong(s))).collect(Collectors.toList());
int sn = ls.stream().mapToInt(DistributionBillLadingScanEntity::getQuantity).sum();
vo.setSignedNum(sn);
// signedNum = signedNum + sn;
@ -2915,7 +2913,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
//查询提货信息
List<DistrilbutionBillStockEntity> list = distrilbutionBillStockService.list(Wrappers.<DistrilbutionBillStockEntity>query().lambda()
.eq(DistrilbutionBillStockEntity::getBillLadingId, distrilbutionBillLadingEntity.getId())
.eq(DistrilbutionBillStockEntity::getOrderStatus, "1")
.in(DistrilbutionBillStockEntity::getOrderStatus, "1","3")
.or(eq -> eq.eq(DistrilbutionBillStockEntity::getBillLadingId, distrilbutionBillLadingEntity.getId()).eq(DistrilbutionBillStockEntity::getOrderStatus, "3"))
);
list.forEach(i -> {
@ -3185,7 +3183,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
DistrilbutionBillStockEntity one2 = distrilbutionBillStockService.getOne(Wrappers.<DistrilbutionBillStockEntity>query().lambda()
.eq(DistrilbutionBillStockEntity::getBillLadingId, billLadingId)
.apply("order_status in (1 , 3)")
.apply("order_status in ('1' , '3')")
.eq(DistrilbutionBillStockEntity::getStockArticleId, list4.get(0).getStockArticleId())
);
@ -3210,49 +3208,94 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
return Resp.scanFail("当前提货任务,订单不存在!", "当前提货任务,订单不存在!");
} else {
AtomicBoolean n = new AtomicBoolean(false);
// 获取订单的ID
List<Long> ls = list.stream() // 转换为Stream
.map(DistrilbutionBillStockEntity::getStockArticleId) // 提取每个元素的orderId
.collect(Collectors.toList()); // 收集到新的List<String>
List<DistributionStockArticleEntity> distributionStockArticleEntityList = distributionStockArticleService.list(Wrappers.<DistributionStockArticleEntity>query().lambda()
.in(DistributionStockArticleEntity::getId, ls));
List<DistributionParcelListEntity> list1 = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda()
.in(DistributionParcelListEntity::getStockArticleId, ls)
);
List<DistributionBillLadingScanEntity> distributionBillLadingScanEntities = distributionBillLadingScanService.list(Wrappers.<DistributionBillLadingScanEntity>query().lambda()
.in(DistributionBillLadingScanEntity::getStockArticleId, ls)
.eq(DistributionBillLadingScanEntity::getMaterialType, "2")
.eq(DistributionBillLadingScanEntity::getBillLadingId, billLadingId)
);
list.forEach(so -> {
//查询包件信息
List<DistributionParcelListEntity> list1 = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda()
.eq(DistributionParcelListEntity::getStockArticleId, so.getStockArticleId())
.eq(DistributionParcelListEntity::getOrderPackageCode, coding)
);
if (!list1.isEmpty()) {
DistributionParcelListEntity distributionParcelListEntity = null;
for (DistributionParcelListEntity parcelListEntity : list1) {
if (parcelListEntity.getStockArticleId().equals(so.getStockArticleId()) && parcelListEntity.getOrderPackageCode().equals(coding)) {
distributionParcelListEntity = parcelListEntity;
}
}
if (distributionParcelListEntity != null) {
n.set(true);
//查询订单包件数量签收的信息
DistributionStockArticleEntity one = distributionStockArticleService.getOne(Wrappers.<DistributionStockArticleEntity>query().lambda()
.eq(DistributionStockArticleEntity::getId, so.getStockArticleId())
);
List<DistributionBillLadingScanEntity> list2 = distributionBillLadingScanService.list(Wrappers.<DistributionBillLadingScanEntity>query().lambda()
.eq(DistributionBillLadingScanEntity::getStockArticleId, so.getStockArticleId())
.eq(DistributionBillLadingScanEntity::getMaterialType, "2")
.eq(DistributionBillLadingScanEntity::getBillLadingId, billLadingId)
);
DistributionStockArticleEntity one = distributionStockArticleEntityList.stream().filter(s -> s.getId().equals(so.getStockArticleId())).findFirst().orElse(null);
List<DistributionBillLadingScanEntity> list2 = new ArrayList<>();
for (DistributionBillLadingScanEntity distributionBillLadingScanEntity : distributionBillLadingScanEntities) {
if (distributionBillLadingScanEntity.getStockArticleId().equals(so.getStockArticleId())) {
list2.add(distributionBillLadingScanEntity);
}
}
one.setOrderStatus(OrderStatusConstant.bufenqianshou.getValue());
//判断当前签收数 修改订单和备货订单状态
if (one.getTotalNumber().equals(list2.size() + 1)) {
//
DistrilbutionBillStockEntity one1 = null;
DistrilbutionBillStockEntity one1 = distrilbutionBillStockService.getOne(Wrappers.<DistrilbutionBillStockEntity>query().lambda()
.eq(DistrilbutionBillStockEntity::getBillLadingId, billLadingId)
.eq(DistrilbutionBillStockEntity::getStockArticleId, one.getId())
.eq(DistrilbutionBillStockEntity::getConditions, BillLadingStatusConstant.daitihuo.getValue())
);
for (DistrilbutionBillStockEntity distrilbutionBillStockEntity : list) {
if (distrilbutionBillStockEntity.getStockArticleId().equals(so.getStockArticleId()) && distrilbutionBillStockEntity.getConditions().equals(BillLadingStatusConstant.daitihuo.getValue())) {
one1 = distrilbutionBillStockEntity;
}
}
if (one1 != null) {
distributionAsyncService.updateBillStock(one1.getId());
}
one.setOrderStatus(OrderStatusConstant.qianshou.getValue());
//修改订单状态
distributionAsyncService.getOrderSelfPickup(list1.get(0).getId());
// distributionAsyncService.updateOrderSelfPickup(one.getId());
//修改备货订单状态
distributionAsyncService.getBillStock(one1.getId());
}
//修改在库数量
if (ObjectUtils.isNotNull(one.getHandQuantity()) && one.getHandQuantity() > 0) {
int i = one.getHandQuantity() - 1;
int i2 = ObjectUtils.isNull(one.getSigninQuantity()) ? 1 : one.getSigninQuantity() + 1;
distributionStockArticleService.update(Wrappers.<DistributionStockArticleEntity>update()
.eq("id", one.getId())
.set("hand_quantity", i)
.set("signin_quantity", i2)
);
// distributionStockArticleService.update(Wrappers.<DistributionStockArticleEntity>update()
// .eq("id", one.getId())
// .set("hand_quantity", i)
// .set("signin_quantity", i2)
// );
one.setHandQuantity(i);
one.setSigninQuantity(i2);
}
// 修改订单状态
distributionStockArticleService.updateById(one);
//修改包件状态
distributionAsyncService.getSelfPickup(list1.get(0).getId());
distributionBillLadingScan.setParcelListId(list1.get(0).getId());
distributionAsyncService.getSelfPickup(distributionParcelListEntity.getId());
distributionBillLadingScan.setParcelListId(distributionParcelListEntity.getId());
distributionBillLadingScan.setPacketBarCode(String.valueOf(coding));
//订单
distributionBillLadingScan.setStockArticleId(one.getId());
@ -3392,7 +3435,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
//修改订单状态
List<DistrilbutionBillStockEntity> list = distrilbutionBillStockService.list(Wrappers.<DistrilbutionBillStockEntity>query().lambda()
.eq(DistrilbutionBillStockEntity::getBillLadingId, s)
.apply("order_status in ( 1 , 2)")
.apply("order_status in ( '1' , '3')")
// .or(ew -> ew.eq(DistrilbutionBillStockEntity::getBillLadingId, s).apply(DistrilbutionBillStockEntity::getOrderStatus, "2"))
);
if (!list.isEmpty()) {

Loading…
Cancel
Save