From 10a07e84cd5609535307d4df11f836484060683a Mon Sep 17 00:00:00 2001 From: kilo Date: Sat, 9 Sep 2023 11:15:14 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E9=80=81=E8=AE=A1=E5=88=92=E4=B8=80?= =?UTF-8?q?=E9=94=AE=E8=A3=85=E8=BD=A6=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LoadScanSigningStatusConstant.java | 45 ++ .../SignforDriverSigningStatusConstant.java | 49 ++ .../mapper/DistributionDeliveryInfoMapper.xml | 4 +- .../mapper/DistributionReservationMapper.java | 7 + .../mapper/DistributionReservationMapper.xml | 10 + .../service/IDistributionAsyncService.java | 14 + .../impl/DistributionAsyncServiceImpl.java | 57 ++ .../DistributionDeliveryListServiceImpl.java | 7 + .../impl/DistributionSignforServiceImpl.java | 556 +++++++++++++----- 9 files changed, 605 insertions(+), 144 deletions(-) create mode 100644 blade-biz-common/src/main/java/org/springblade/common/constant/loading/LoadScanSigningStatusConstant.java create mode 100644 blade-biz-common/src/main/java/org/springblade/common/constant/signing/SignforDriverSigningStatusConstant.java diff --git a/blade-biz-common/src/main/java/org/springblade/common/constant/loading/LoadScanSigningStatusConstant.java b/blade-biz-common/src/main/java/org/springblade/common/constant/loading/LoadScanSigningStatusConstant.java new file mode 100644 index 000000000..89132c797 --- /dev/null +++ b/blade-biz-common/src/main/java/org/springblade/common/constant/loading/LoadScanSigningStatusConstant.java @@ -0,0 +1,45 @@ +package org.springblade.common.constant.loading; + +/** + * 订单冻结状态枚举 + * 对应码表 freeze_status + * @author pref + */ +public enum LoadScanSigningStatusConstant { + + weiqianshou("未签收",1), + yiqianshou("已签收",2); + + + /** + * 状态 + */ + private String name; + + /** + * 值 + */ + private Integer value; + + + private LoadScanSigningStatusConstant(String name, Integer value) { + this.name = name; + this.value = value; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getValue() { + return value; + } + + public void setValue(Integer value) { + this.value = value; + } +} diff --git a/blade-biz-common/src/main/java/org/springblade/common/constant/signing/SignforDriverSigningStatusConstant.java b/blade-biz-common/src/main/java/org/springblade/common/constant/signing/SignforDriverSigningStatusConstant.java new file mode 100644 index 000000000..8cdf58c67 --- /dev/null +++ b/blade-biz-common/src/main/java/org/springblade/common/constant/signing/SignforDriverSigningStatusConstant.java @@ -0,0 +1,49 @@ +package org.springblade.common.constant.signing; + +/** + * 备货状态枚举 + * 对应码表 + * distribution_signfor_status + * @author pref + */ +public enum SignforDriverSigningStatusConstant { + + daiqianshou("未签收","1"), + bufenqianshou("部分签收","2"), + yiqianshou("已签收","3"); + + + + + /** + * 状态 + */ + private String name; + + /** + * 值 + */ + private String value; + + + private SignforDriverSigningStatusConstant(String name, String value) { + this.name = name; + this.value = value; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryInfoMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryInfoMapper.xml index 10586fd58..d7a1253cc 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryInfoMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryInfoMapper.xml @@ -93,8 +93,8 @@ else '是' END isUrgentName, CASE - WHEN lds.signing_status ='1' THEN '未签收' - else '已签收' + WHEN lds.signing_status ='1' THEN '待审核' + else '已审核' END signingStatus, CASE WHEN lds.driver_signing ='1' THEN '未签收' diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.java index 2abd9cbcd..a9092c073 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.java @@ -158,4 +158,11 @@ public interface DistributionReservationMapper extends BaseMapper selectPackageListByReservationId(@Param("reservationId")Long id); Integer getReservationNumStockSelf(@Param("reservationId") Long reservationId,@Param("stockListId") Long stockListId); + + /** + * 查询客户下的库存品信息 + * @param reservationId + * @return + */ + List selectInventoryListByReservation(@Param("reservationId") Long reservationId); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml index 8a3bbd3d2..1ef3e74b9 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml @@ -645,5 +645,15 @@ from logpm_distribution_delivery_details lddd where lddd.inventory_status in (1,2) and lddd.bill_lading_id = #{reservationId} and lddd.stock_list_id = #{stockListId} + diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java index 144477337..cb034ac04 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java @@ -3,6 +3,7 @@ package com.logpm.distribution.service; import com.logpm.distribution.dto.DistributionStockArticleDTO; import com.logpm.distribution.dto.app.DistrilbutionloadingscanDTO; import com.logpm.distribution.dto.app.StockupDTO; +import com.logpm.distribution.entity.DisStockListDetailEntity; import com.logpm.distribution.entity.DistributionParcelListEntity; /** @@ -133,4 +134,17 @@ public interface IDistributionAsyncService { * 自提签收判断是否完成 */ void getStockUPstate(Long billLadingId); + + /** + * 根据保健维护订单的签收状态 + * @param parcelListEntity + */ + void checkStockArticleSignStatus(DistributionParcelListEntity parcelListEntity); + + /** + * + * @param detailEntity + */ + void checkStockArticleListSigningStatus(DisStockListDetailEntity detailEntity); + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java index d4ab18c04..d06e4241d 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java @@ -14,6 +14,7 @@ import lombok.AllArgsConstructor; import lombok.extern.log4j.Log4j2; import org.springblade.common.constant.Inventory.InventoryLoadingStatusConstant; import org.springblade.common.constant.Inventory.InventoryPackageStatusConstant; +import org.springblade.common.constant.Inventory.InventorySigningStatusConstant; import org.springblade.common.constant.delivery.DeliveryLoadingStatusConstant; import org.springblade.common.constant.delivery.DeliveryStatusConstant; import org.springblade.common.constant.order.OrderReservationStatusConstant; @@ -473,6 +474,62 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService { + } + + @Async + @Override + @Transactional(isolation = Isolation.READ_UNCOMMITTED, rollbackFor = Exception.class) + public void checkStockArticleSignStatus(DistributionParcelListEntity parcelListEntity) { + parcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.yiqianshou.getValue()); + distributionParcelListService.updateById(parcelListEntity); + List parcelListEntityList = distributionParcelListService.getBaseMapper().selectList(Wrappers.query().lambda().eq(DistributionParcelListEntity::getStockArticleId, parcelListEntity.getStockArticleId())); + boolean flag = parcelListEntityList.stream().allMatch(p -> p.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())); + DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(parcelListEntity.getStockArticleId()); + //通过包件的装车状态来维护订单的出库状态 + if (flag){ + //订单状态为已签收 + stockArticleEntity.setOrderStatus(OrderStatusConstant.qianshou.getValue()); + }else { + //订单状态为部分签收 + stockArticleEntity.setOrderStatus(OrderStatusConstant.bufenqianshou.getValue()); + } + distributionStockArticleService.updateById(stockArticleEntity); + } + + @Override + public void checkStockArticleListSigningStatus(DisStockListDetailEntity detailEntity) { + List list = disStockListDetailService.list(Wrappers.query().lambda() + .eq(DisStockListDetailEntity::getReservationId, detailEntity.getReservationId()) + .eq(DisStockListDetailEntity::getStockListId, detailEntity.getStockListId()) + .ne(DisStockListDetailEntity::getStockPackageStatus, ReservationInventoryStatusConstant.quxiao.getValue())); + DistributionReservationStocklistEntity distributionReservationStocklistEntity = distributionReservationStocklistMapper.selectOne(Wrappers.query().lambda() + .eq(DistributionReservationStocklistEntity::getReservationId, detailEntity.getReservationId()) + .eq(DistributionReservationStocklistEntity::getStocklistId, detailEntity.getStockListId()) + .ne(DistributionReservationStocklistEntity::getStockListStatus, ReservationInventoryStatusConstant.quxiao.getValue())); + boolean loadingStatusFlag = list.stream().allMatch(l -> l.getStockLockingStatus().equals(InventoryLoadingStatusConstant.yizhuangche.getValue())); + if (loadingStatusFlag){ + distributionReservationStocklistEntity.setLoadingStatus(ReservationInventoryLoadingStatusConstant.yizhuangche.getValue()); + }else { + loadingStatusFlag = list.stream().allMatch(l -> l.getStockLockingStatus().equals(InventoryLoadingStatusConstant.weizhuangche.getValue())); + if (loadingStatusFlag){ + distributionReservationStocklistEntity.setLoadingStatus(ReservationInventoryLoadingStatusConstant.weizhuangche.getValue()); + }else { + distributionReservationStocklistEntity.setLoadingStatus(ReservationInventoryLoadingStatusConstant.yizhuangche.getValue()); + } + } + boolean signingStatusFlag = list.stream().allMatch(l -> l.getStockLockingStatus().equals(ReservationSigningStatusConstant.yiqianshou.getValue())); + if (signingStatusFlag){ + distributionReservationStocklistEntity.setLoadingStatus(ReservationSigningStatusConstant.yiqianshou.getValue()); + }else { + signingStatusFlag = list.stream().allMatch(l -> l.getStockLockingStatus().equals(ReservationSigningStatusConstant.daiqianshou.getValue())); + if (signingStatusFlag){ + distributionReservationStocklistEntity.setLoadingStatus(ReservationSigningStatusConstant.daiqianshou.getValue()); + }else { + distributionReservationStocklistEntity.setLoadingStatus(ReservationSigningStatusConstant.yiqianshou.getValue()); + } + } + distributionReservationStocklistMapper.updateById(distributionReservationStocklistEntity); + } @Async diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java index b6e19cc93..7cbcc9b3c 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java @@ -959,6 +959,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl implements IDistributionSignforService { private final DistributionLoadscanServiceImpl distributionLoadscanService; @@ -88,6 +101,9 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl selectDistributionSignforPage(IPage page, DistributionSignforVO distributionSignfor) { @@ -113,14 +129,14 @@ public class DistributionSignforServiceImpl extends BaseServiceImplquery().lambda().eq(DistributionDeliveryListEntity::getId, deliveryId)); List list = new ArrayList<>(); - if (Func.equals(deliveryListEntity.getKind(), ServiceConstant.DELIVERLIST_KIND_SELF)){ + if (Func.equals(deliveryListEntity.getKind(), ServiceConstant.DELIVERLIST_KIND_SELF)) { List distributionDeliverySelfEntities = distributionDeliverySelfMapper.selectList(Wrappers.query().lambda().eq(DistributionDeliverySelfEntity::getDeliveryId, deliveryId)); - distributionDeliverySelfEntities.forEach(s->list.add(s.getDriverPhone())); - }else { + distributionDeliverySelfEntities.forEach(s -> list.add(s.getDriverPhone())); + } else { DistributionDeliveryTripartiteEntity tripartiteEntity = distributionDeliveryTripartiteMapper.selectOne(Wrappers.query().lambda().eq(DistributionDeliveryTripartiteEntity::getDeliveryId, deliveryId)); list.add(tripartiteEntity.getDriverPhone()); } - d.setDeliveryDriverPhone(String.join(",",list)); + d.setDeliveryDriverPhone(String.join(",", list)); }); return page.setRecords(distributionSignforVOS); } @@ -172,7 +188,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl { DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(l.getPackageId()); // distributionAsyncService.changeOrderSignforStatus(parcelListEntity); - distributionAsyncService.changeDeliverySignforListStatus(deliveryId,parcelListEntity); + distributionAsyncService.changeDeliverySignforListStatus(deliveryId, parcelListEntity); }); //这里签收还需要进行管乐配送任务的签收状态修改 //查询出这个配送任务的所有订单 @@ -588,22 +604,33 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl 这里一件签收针对的就是制定的任务下的包件和库存品 + // 无效 -- > 直接提示该次操作无效 无效的场景快速点击操作两次签收的动作,司机已经进行了所有的包件签收扫描但是还未进行签收确认的动作 + // 有效 -- > + // 查询该车次任务中装车的包件和库存品 此时一键签收就需要将该车次中的所有包件和库存品都进行签收 +// 此时考虑多种场景: +// 1、存在库存品 库存品未进行备货操作无法进行一件装车,但是对于已备货的库存品可以进行装车 +// 2、多个车次的配送任务进行一件签收状态、在没有进行装车操作的时候 +// 3、对于已经装车的库存品或者包件在一件签收的时候需要进行过滤 + + //2、维护状态 + DistributionReservationEntity reservationEntity = distributionReservationMapper.selectById(distributionSignfor.getReservationId()); + if (Func.isEmpty(reservationEntity)){ + log.error("#############reservationEntity参数错误:{}",reservationEntity); + return R.fail("服务器正忙~~"); + } + + //查询数据 DistributionSignforEntity distributionSignforEntity = baseMapper.selectOne(new QueryWrapper().lambda() .eq(DistributionSignforEntity::getDeliveryId, distributionSignfor.getDeliveryId()) .eq(DistributionSignforEntity::getReservationId, distributionSignfor.getReservationId()) ); - if (distributionSignfor.getIsClerk()) { - if (null != distributionSignforEntity.getSigningType()) { - return R.fail(3010, "已经签收"); - } - } else { - if (null != distributionSignforEntity.getSjsigningTime()) { - return R.fail(3010, "已经签收"); - } - } - //获取当前用户司机 + //获取计划配送用户司机 DistributionDeliveryListEntity distributionDeliveryListEntity = distributionDeliveryListMapper.selectById(distributionSignfor.getDeliveryId()); DistributionDeliverySelfEntity distributionDeliverySelfEntity = null; if (distributionDeliveryListEntity.getKind().equals("1")) { @@ -620,156 +647,401 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl distributionLoadscanEntities = distributionDeliveryListMapper.selectdeliverOne(distributionSignfor.getReservationId(), distributionSignfor.getDeliveryId()); - //查询所有的库存品(拆包) - List distributionLoadscanvnEntitiesopen = distributionDeliveryListMapper.selectdeliverOnevnopen(distributionSignfor.getReservationId(), distributionSignfor.getDeliveryId()); - //将该客户所有的物品上该车辆 - if (distributionLoadscanEntities.size() > 0) { - //配送订单数据 - for (DistributionLoadscanEntity distributionLoadscanEntity : distributionLoadscanEntities) { - //查询该包件是否扫码 - List distributionLoadscanEntitiesflag = distributionLoadscanMapper.selectList(new QueryWrapper().lambda() - .eq(DistributionLoadscanEntity::getDeliveryId, distributionLoadscanEntity.getDeliveryId()) - .eq(DistributionLoadscanEntity::getOrderPackageCode, distributionLoadscanEntity.getOrderPackageCode()) - .ne(DistributionLoadscanEntity::getScanStatus, 1) - ); - if (distributionLoadscanEntitiesflag.size() > 0) { - //有扫码记录 - // 修改该记录 - for (DistributionLoadscanEntity loadscanEntity : distributionLoadscanEntitiesflag) { - if (loadscanEntity.getSignforState() == 2) break; - distributionLoadscanService.update(new UpdateWrapper().lambda() - .eq(DistributionLoadscanEntity::getDeliveryId, distributionLoadscanEntity.getDeliveryId()) - .eq(DistributionLoadscanEntity::getOrderPackageCode, distributionLoadscanEntity.getOrderPackageCode()) - .set(DistributionLoadscanEntity::getSigningTime, simpleDateFormat.format(new Date())) - .set(DistributionLoadscanEntity::getSignforState, 2) - .set(DistributionLoadscanEntity::getReceivedQuantity, 1) - ); - //修改签收数量 - distributionSignforMapper.updateSignforNum(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), loadscanEntity.getPackageNub()); + + + if (Func.equals(distributionSignforEntity.getDriverSigning(), SignforDriverSigningStatusConstant.yiqianshou.getValue())) { + log.error("###############重复签收+{" + distributionSignforEntity + "}"); + return R.fail("签收失败"); + } + BladeUser user = AuthUtil.getUser(); + + //处理库存品 + //查询出该客户下的库存品信息 + List detailEntities = distributionReservationMapper.selectInventoryListByReservation(distributionSignforEntity.getReservationId()); + if (detailEntities.size()>0 && Func.isNotEmpty(detailEntities)){ + boolean flag = detailEntities.stream().allMatch(s -> Func.isNotEmpty(s.getStockPackageCode())); + //只要库存品没有进行备货操作则不能进行一件装车操作 + if (flag){ + //库存品均已备货 + List unLoadingiNventoryList = detailEntities.stream().filter(i -> i.getStockLockingStatus().equals(InventoryLoadingStatusConstant.weizhuangche.getValue())).collect(Collectors.toList()); + if (Func.isNotEmpty(unLoadingiNventoryList) && unLoadingiNventoryList.size()>0) { + for (DisStockListDetailEntity disStockListDetailEntity : unLoadingiNventoryList) { +// --------------------修改库存品包件装车和签收状态—————————————————————————————————————————— + disStockListDetailEntity.setStockLockingStatus(InventoryLoadingStatusConstant.yizhuangche.getValue()); + disStockListDetailEntity.setStockSignfoStatus(InventorySigningStatusConstant.yiqianshou.getValue()); + disStockListDetailService.updateById(disStockListDetailEntity); + + DistributionLoadscaninvnEntity loadscaninvnEntity = new DistributionLoadscaninvnEntity(); + if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverId())) { + loadscaninvnEntity.setDriverId(distributionDeliverySelfEntity.getDriverId()); + } + if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverName())) { + loadscaninvnEntity.setDriverName(distributionDeliverySelfEntity.getDriverName()); + } + if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleId())) { + loadscaninvnEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId()); + } + if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleNub())) { + loadscaninvnEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub()); + } + if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverPhone())) { + loadscaninvnEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone()); + } + loadscaninvnEntity.setLoadingId(distributionDeliverySelfEntity.getId().toString()); + loadscaninvnEntity.setOrderPackageCode(disStockListDetailEntity.getStockPackageCode()); + loadscaninvnEntity.setInventoryId(disStockListDetailEntity.getStockListId()); + loadscaninvnEntity.setDeliveryId(distributionSignforEntity.getDeliveryId()); + loadscaninvnEntity.setReservationId(distributionSignforEntity.getReservationId()); + loadscaninvnEntity.setScanUser(user.getUserName()); + loadscaninvnEntity.setScanTime(new Date()); + loadscaninvnEntity.setPackageNub(disStockListDetailEntity.getNum()); + loadscaninvnEntity.setScanStatus(LoadingStatusConstant.yijianzhuangche.getValue()); + loadscaninvnEntity.setIsInsert(LoadingIsInsertConstant.bulu.getValue()); + loadscaninvnEntity.setScanType("1"); + loadscaninvnEntity.setType(2); + loadscaninvnEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue()); + loadscaninvnEntity.setIsSignfor(1); + loadscaninvnEntity.setReceivedQuantity(disStockListDetailEntity.getNum()); + loadscaninvnEntity.setOneClick(2); + loadscaninvnEntity.setOneQclick(2); + loadscaninvnEntity.setSigningTime(simpleDateFormat.format(new Date())); + loadscaninvnEntity.setMsg("一键签收数据补录"); + distributionLoadscaninvnService.save(loadscaninvnEntity); + Integer i = distributionDeliveryListMapper.updateloadingTimeById(distributionDeliveryListEntity.getId()); //更新签收表的签收数量和装车数量 -// Integer j = distributionSignforMapper.updateSignforByReservationId(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), loadscanEntity.getPackageNub()); - } -// distributionLoadscanService.update() - continue; - }else{ - //没有扫码数据 - //依次插入该装车记录,设置车辆, - if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getDriverId())) { - distributionLoadscanEntity.setDriverId(distributionDeliverySelfEntity.getDriverId()); - } - distributionLoadscanEntity.setDriverName(distributionDeliverySelfEntity.getDriverName()); - distributionLoadscanEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub()); - distributionLoadscanEntity.setScanStatus(LoadingStatusConstant.saomiao.getValue()); - distributionLoadscanEntity.setReceivedQuantity(1); - if (null == distributionLoadscanEntity.getPackageNub()) { - distributionLoadscanEntity.setPackageNub(1); - distributionLoadscanEntity.setLoadedNub(distributionLoadscanEntity.getPackageNub()); - } - distributionLoadscanEntity.setScanType("1"); - distributionLoadscanEntity.setMsg("司机签收"); - if (distributionSignfor.getIsClerk()) { - distributionLoadscanEntity.setMsg("文员签收"); - } -// distributionLoadscanEntity.setOneClick(2); - distributionLoadscanEntity.setSignforState(2); - distributionLoadscanEntity.setOneQclick(2); -// distributionLoadscanEntity.setScanTime(new Date()); - if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getDriverPhone())) { - distributionLoadscanEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone()); + Integer j = distributionSignforMapper.updatesignforByinvn(loadscaninvnEntity.getDeliveryId(), loadscaninvnEntity.getReservationId(), loadscaninvnEntity.getPackageNub()); + //维护预约库存品数据 + //扣减库存 + DistributionStockListEntity stockListEntity = distributionStockListService.getById(disStockListDetailEntity.getStockListId()); + stockListEntity.setQuantityOccupied(stockListEntity.getQuantityOccupied() - loadscaninvnEntity.getPackageNub()); + stockListEntity.setQuantityStock(stockListEntity.getQuantityStock() - loadscaninvnEntity.getPackageNub()); + stockListEntity.setOutboundQuantity(stockListEntity.getOutboundQuantity() + loadscaninvnEntity.getPackageNub()); + distributionStockListService.updateById(stockListEntity); } - if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getVehicleId())) { - distributionLoadscanEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId()); - } - distributionLoadscanEntity.setLoadingId(distributionDeliverySelfEntity.getId().toString()); - distributionLoadscanService.save(distributionLoadscanEntity); } - //查询本车次是否第一次扫码,没有则更新上车时间 -// Integer i = distributionDeliveryListMapper.updateloadingTimeById(distributionDeliveryListEntity.getId()); - //更新签收表的签收数量和装车数量 - Integer j = distributionSignforMapper.updateSignforByReservationId(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), distributionLoadscanEntity.getPackageNub()); + + //库存品扫描记录补充 + for (DisStockListDetailEntity detailEntity : detailEntities) { + if (detailEntity.getStockLockingStatus().equals(InventoryLoadingStatusConstant.yizhuangche.getValue())){ + detailEntity.setStockSignfoStatus(InventorySigningStatusConstant.yiqianshou.getValue()); + disStockListDetailService.updateById(detailEntity); + //查询出对于的装车扫描记录 + List list = distributionLoadscaninvnService.list(Wrappers.query().lambda() + .eq(DistributionLoadscaninvnEntity::getDeliveryId, distributionSignfor.getDeliveryId()) + .eq(DistributionLoadscaninvnEntity::getReservationId, distributionSignfor.getReservationId()) + .eq(DistributionLoadscaninvnEntity::getOrderPackageCode, detailEntity.getStockPackageCode()) + .ne(DistributionLoadscaninvnEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())); + if (list.size()==1){ + //正常进行扫描记录签收修改 + DistributionLoadscaninvnEntity loadscaninvnEntity = list.get(0); + loadscaninvnEntity.setMsg("一键签收数据补录"); + loadscaninvnEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue()); + loadscaninvnEntity.setReceivedQuantity(detailEntity.getNum()); + loadscaninvnEntity.setOneClick(1); + loadscaninvnEntity.setOneQclick(2); + loadscaninvnEntity.setReceivedQuantity(detailEntity.getNum()); + loadscaninvnEntity.setSigningTime(simpleDateFormat.format(new Date())); + distributionLoadscaninvnService.updateById(loadscaninvnEntity); + Integer i = distributionDeliveryListMapper.updateloadingTimeById(distributionDeliveryListEntity.getId()); + Integer j = distributionSignforMapper.updateSignforNum(loadscaninvnEntity.getDeliveryId(), loadscaninvnEntity.getReservationId(), loadscaninvnEntity.getPackageNub()); + }else { + log.error("################库存品未进行备货操作+{}"+list); + //此时说明在同一配送任务下,同一客户出现了相同的库存品包件码 + } + } + //对库存品包件上级的状态维护 + distributionAsyncService.checkStockArticleListSigningStatus(detailEntity); + } + }else { + log.error("################库存品未进行备货操作+{}"+detailEntities); + return R.fail("一键装车失败!!!库存品都备货了!?"); } } - if (distributionLoadscanvnEntitiesopen.size() > 0) { - //库存品数据 - for (DistributionLoadscaninvnEntity distributionLoadscanEntity : distributionLoadscanvnEntitiesopen) { - //查询是否重复扫码 - List distributionLoadscaninvnEntitiesflag = distributionLoadscaninvnMapper.selectList(new QueryWrapper().lambda() - .eq(DistributionLoadscaninvnEntity::getDeliveryId, distributionLoadscanEntity.getDeliveryId()) - .eq(DistributionLoadscaninvnEntity::getOrderPackageCode, distributionLoadscanEntity.getOrderPackageCode()) - .ne(DistributionLoadscaninvnEntity::getScanStatus, 1) - .eq(DistributionLoadscaninvnEntity::getSignforState, 2) - ); - if (distributionLoadscaninvnEntitiesflag.size() > 0) { - // 修改该记录 - for (DistributionLoadscaninvnEntity loadscanEntity : distributionLoadscaninvnEntitiesflag) { - if (loadscanEntity.getSignforState() == 2) break; - distributionLoadscaninvnService.update(new UpdateWrapper().lambda() - .eq(DistributionLoadscaninvnEntity::getDeliveryId, distributionLoadscanEntity.getDeliveryId()) - .eq(DistributionLoadscaninvnEntity::getOrderPackageCode, distributionLoadscanEntity.getOrderPackageCode()) - .set(DistributionLoadscaninvnEntity::getSigningTime, simpleDateFormat.format(new Date())) - .set(DistributionLoadscaninvnEntity::getSignforState, 2) - .set(DistributionLoadscaninvnEntity::getReceivedQuantity, 1) - ); - //更新签收表的签收数量和装车数量 - Integer j = distributionSignforMapper.updateSignforByReservationId(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), loadscanEntity.getPackageNub()); - } -// distributionLoadscanService.update() - continue; + //查询出该签收任务下的客户对应的所有包件和库存品信息 + List parcelListEntityList = distributionReservationMapper.selectPackageListByReservationId(distributionSignforEntity.getReservationId()); + //包件不需要考虑备货、装车直接可进行签收 过滤已装车的包件 + List noLoadingPackage = parcelListEntityList.stream().filter(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue())).collect(Collectors.toList()); + + + for (DistributionParcelListEntity parcelListEntity : parcelListEntityList) { + if (Func.equals(parcelListEntity.getOrderPackageStockupStatus(), OrderPackageStatusConstant.yiqianshou.getValue())) { + continue; + } else if (Func.equals(parcelListEntity.getOrderPackageLoadingStatus(), OrderPackageLoadingStatusConstant.yizhuangche.getValue())) { + //修改包件的状态为出库状态 + parcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.yiqianshou.getValue()); + distributionParcelListService.updateById(parcelListEntity); + //查询出对应的装车扫描信息进行修改 + List list = distributionLoadscanService.list(Wrappers.query().lambda() + .eq(DistributionLoadscanEntity::getPackageId, parcelListEntity.getId()) + .eq(DistributionLoadscanEntity::getDeliveryId, distributionSignforEntity.getDeliveryId()) + .eq(DistributionLoadscanEntity::getReservationId, distributionSignforEntity.getReservationId()) + .ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())); + if (list.size() == 1) { + DistributionLoadscanEntity loadscanEntity = list.get(0); + loadscanEntity.setMsg("一键签收数据补录"); + loadscanEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue()); + loadscanEntity.setReceivedQuantity(parcelListEntity.getQuantity()); + loadscanEntity.setOneClick(1); + loadscanEntity.setOneQclick(2); + loadscanEntity.setReceivedQuantity(parcelListEntity.getQuantity()); + loadscanEntity.setSigningTime(simpleDateFormat.format(new Date())); + distributionLoadscanService.updateById(loadscanEntity); + Integer i = distributionDeliveryListMapper.updateloadingTimeById(distributionDeliveryListEntity.getId()); + Integer j = distributionSignforMapper.updateSignforNum(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), loadscanEntity.getPackageNub()); + } else { + //一个配送任务下,同一个客户出现了相同的包件信息 + log.error("#########相同的包件信息={}" + parcelListEntity.getId()); } - //依次插入该装车记录,设置车辆 - if (null != distributionDeliverySelfEntity.getDriverId()) { - distributionLoadscanEntity.setDriverId(distributionDeliverySelfEntity.getDriverId()); + }else { + log.error("#########包件异常{}" + parcelListEntity.getId()); + } + distributionAsyncService.checkStockArticleSignStatus(parcelListEntity); + } + + + if (Func.isNotEmpty(noLoadingPackage) && noLoadingPackage.size() > 0) { + //存在有未装车的包件信息 + //统计新装车的包件数 + for (DistributionParcelListEntity parcelListEntity : noLoadingPackage) { + parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue()); + parcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.yiqianshou.getValue()); + distributionParcelListService.updateById(parcelListEntity); + DistributionLoadscanEntity loadscanEntity = new DistributionLoadscanEntity(); + loadscanEntity.setPackageId(parcelListEntity.getId()); + loadscanEntity.setOrderPackageCode(parcelListEntity.getOrderPackageCode()); + loadscanEntity.setOrderId(parcelListEntity.getStockArticleId()); + loadscanEntity.setDeliveryId(distributionSignforEntity.getDeliveryId()); + loadscanEntity.setReservationId(distributionSignforEntity.getReservationId()); + loadscanEntity.setScanUser(user.getUserName()); + loadscanEntity.setScanTime(new Date()); + loadscanEntity.setPackageNub(parcelListEntity.getQuantity()); + if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverId())) { + loadscanEntity.setDriverId(distributionDeliverySelfEntity.getDriverId()); } - distributionLoadscanEntity.setDriverName(distributionDeliverySelfEntity.getDriverName()); - distributionLoadscanEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub()); - distributionLoadscanEntity.setScanStatus(LoadingStatusConstant.saomiao.getValue()); - distributionLoadscanEntity.setScanType("1"); - distributionLoadscanEntity.setReceivedQuantity(1); -// distributionLoadscanEntity.setOneClick(2); - distributionLoadscanEntity.setSignforState(2); - distributionLoadscanEntity.setOneQclick(2); - distributionLoadscanEntity.setMsg("司机签收"); - if (distributionSignfor.getIsClerk()) { - distributionLoadscanEntity.setMsg("文员签收"); + if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverName())) { + loadscanEntity.setDriverName(distributionDeliverySelfEntity.getDriverName()); } -// distributionLoadscanEntity.setScanTime(new Date()); - if (null == distributionLoadscanEntity.getPackageNub()) { - distributionLoadscanEntity.setPackageNub(1); - distributionLoadscanEntity.setLoadedNub(distributionLoadscanEntity.getPackageNub()); + if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleId())) { + loadscanEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId()); } - distributionLoadscanEntity.setLoadingId(distributionDeliverySelfEntity.getId().toString()); - distributionLoadscanEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub()); - if (null != distributionDeliverySelfEntity.getDriverPhone()) { - distributionLoadscanEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone()); + if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleNub())) { + loadscanEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub()); } - if (null != distributionDeliverySelfEntity.getVehicleId()) { - distributionLoadscanEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId()); + if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverPhone())) { + loadscanEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone()); } - //查询本车次是否第一次扫码,没有则更新上车时间 -// Integer i = distributionDeliveryListMapper.updateloadingTimeById(distributionDeliveryListEntity.getId()); - //更新签收表的装车数量和签收数量 - Integer j = distributionSignforMapper.updatesignforByinvn(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), distributionLoadscanEntity.getPackageNub()); + loadscanEntity.setLoadingId(distributionDeliverySelfEntity.getId().toString()); + loadscanEntity.setScanStatus(LoadingStatusConstant.yijianzhuangche.getValue()); + loadscanEntity.setIsInsert(LoadingIsInsertConstant.bulu.getValue()); + loadscanEntity.setScanType("1"); + loadscanEntity.setType(2); + loadscanEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue()); + loadscanEntity.setIsSignfor(1); + loadscanEntity.setReceivedQuantity(parcelListEntity.getQuantity()); + loadscanEntity.setOneClick(2); + loadscanEntity.setOneQclick(2); + loadscanEntity.setSigningTime(simpleDateFormat.format(new Date())); + loadscanEntity.setMsg("一键签收数据补录"); + distributionLoadscanService.save(loadscanEntity); + Integer i = distributionDeliveryListMapper.updateloadingTimeById(distributionDeliveryListEntity.getId()); + //更新签收表的签收数量和装车数量 + Integer j = distributionSignforMapper.updateSignforByReservationId(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), loadscanEntity.getPackageNub()); + distributionAsyncService.checkStockArticleSignStatus(parcelListEntity); + +// distributionAsyncService.checkStockArticleSignStatus(parcelListEntity); + //保存完成签收包件装车数量累加 } - distributionLoadscaninvnService.saveBatch(distributionLoadscanvnEntitiesopen); } + //维护客户信息状态 + reservationEntity.setLoadingStatus(ReservationLoadingStatusConstant.yizhuangche.getValue()); + reservationEntity.setSigningStatus(ReservationSigningStatusConstant.yiqianshou.getValue()); + distributionReservationMapper.updateById(reservationEntity); + boolean update = this.update(new UpdateWrapper().lambda() .eq(DistributionSignforEntity::getId, distributionSignforEntity.getId()) .set(StringUtils.isNotBlank(distributionSignfor.getDeliverySignPictures()), DistributionSignforEntity::getDeliverySignPictures, distributionSignfor.getDeliverySignPictures()) .set(StringUtils.isNotBlank(distributionSignfor.getSigningType()), DistributionSignforEntity::getSigningType, distributionSignfor.getSigningType()) - .set(distributionSignfor.getIsClerk(), DistributionSignforEntity::getSigningStatus, 2) + .set(distributionSignfor.getIsClerk(), DistributionSignforEntity::getSigningStatus, 1) + .set(distributionSignfor.getIsClerk(), DistributionSignforEntity::getDriverSigning, 2) .set(distributionSignfor.getIsClerk(), DistributionSignforEntity::getSigningTime, simpleDateFormat.format(new Date())) .set(distributionSignfor.getIsClerk() && StringUtils.isNotBlank(distributionSignfor.getClerkSignRemarks()), DistributionSignforEntity::getSigningStatus, distributionSignfor.getClerkSignRemarks()) .set(!distributionSignfor.getIsClerk() && StringUtils.isNotBlank(distributionSignfor.getDriverRemarks()), DistributionSignforEntity::getDriverRemarks, distributionSignfor.getDriverRemarks()) .set(!distributionSignfor.getIsClerk(), DistributionSignforEntity::getDriverSigning, 2) .set(!distributionSignfor.getIsClerk(), DistributionSignforEntity::getSjsigningTime, simpleDateFormat.format(new Date())) ); - return R.status(update); + return R.status(true); } + +// distributionSignforEntity.setSigningTime(simpleDateFormat.format(new Date())); +// distributionSignforEntity.setSigneeName(user.getUserName()); +// distributionSignforEntity.setDriverSigning(SignforDriverSigningStatusConstant.yiqianshou.getValue()); +// this.updateById(distributionSignforEntity); + + + +// if (distributionSignfor.getIsClerk()) { +// if (null != distributionSignforEntity.getSigningType()) { +// return R.fail(3010, "已经签收"); +// } +// } else { +// if (null != distributionSignforEntity.getSjsigningTime()) { +// return R.fail(3010, "已经签收"); +// } +// } + +// //先查询有数据的 +// List distributionLoadscanEntities = distributionDeliveryListMapper.selectdeliverOne(distributionSignfor.getReservationId(), distributionSignfor.getDeliveryId()); +// //查询所有的库存品(拆包) +// List distributionLoadscanvnEntitiesopen = distributionDeliveryListMapper.selectdeliverOnevnopen(distributionSignfor.getReservationId(), distributionSignfor.getDeliveryId()); +// //将该客户所有的物品上该车辆 +// if (distributionLoadscanEntities.size() > 0) { +// //配送订单数据 +// for (DistributionLoadscanEntity distributionLoadscanEntity : distributionLoadscanEntities) { +// //查询该包件是否扫码 +// List distributionLoadscanEntitiesflag = distributionLoadscanMapper.selectList(new QueryWrapper().lambda() +// .eq(DistributionLoadscanEntity::getDeliveryId, distributionLoadscanEntity.getDeliveryId()) +// .eq(DistributionLoadscanEntity::getOrderPackageCode, distributionLoadscanEntity.getOrderPackageCode()) +// .ne(DistributionLoadscanEntity::getScanStatus, 1) +// ); +// if (distributionLoadscanEntitiesflag.size() > 0) { +// //有扫码记录 +// // 修改该记录 +// for (DistributionLoadscanEntity loadscanEntity : distributionLoadscanEntitiesflag) { +// if (loadscanEntity.getSignforState() == 2) break; +// distributionLoadscanService.update(new UpdateWrapper().lambda() +// .eq(DistributionLoadscanEntity::getDeliveryId, distributionLoadscanEntity.getDeliveryId()) +// .eq(DistributionLoadscanEntity::getOrderPackageCode, distributionLoadscanEntity.getOrderPackageCode()) +// .set(DistributionLoadscanEntity::getSigningTime, simpleDateFormat.format(new Date())) +// .set(DistributionLoadscanEntity::getSignforState, 2) +// .set(DistributionLoadscanEntity::getReceivedQuantity, 1) +// ); +// //修改签收数量 +// distributionSignforMapper.updateSignforNum(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), loadscanEntity.getPackageNub()); +// //更新签收表的签收数量和装车数量 +//// Integer j = distributionSignforMapper.updateSignforByReservationId(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), loadscanEntity.getPackageNub()); +// } +//// distributionLoadscanService.update() +// continue; +// }else{ +// //没有扫码数据 +// //依次插入该装车记录,设置车辆, +// if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getDriverId())) { +// distributionLoadscanEntity.setDriverId(distributionDeliverySelfEntity.getDriverId()); +// } +// distributionLoadscanEntity.setDriverName(distributionDeliverySelfEntity.getDriverName()); +// distributionLoadscanEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub()); +// distributionLoadscanEntity.setScanStatus(LoadingStatusConstant.saomiao.getValue()); +// distributionLoadscanEntity.setReceivedQuantity(1); +// if (null == distributionLoadscanEntity.getPackageNub()) { +// distributionLoadscanEntity.setPackageNub(1); +// distributionLoadscanEntity.setLoadedNub(distributionLoadscanEntity.getPackageNub()); +// } +// distributionLoadscanEntity.setScanType("1"); +// distributionLoadscanEntity.setMsg("司机签收"); +// if (distributionSignfor.getIsClerk()) { +// distributionLoadscanEntity.setMsg("文员签收"); +// } +//// distributionLoadscanEntity.setOneClick(2); +// distributionLoadscanEntity.setSignforState(2); +// distributionLoadscanEntity.setOneQclick(2); +//// distributionLoadscanEntity.setScanTime(new Date()); +// if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getDriverPhone())) { +// distributionLoadscanEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone()); +// } +// if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getVehicleId())) { +// distributionLoadscanEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId()); +// } +// distributionLoadscanEntity.setLoadingId(distributionDeliverySelfEntity.getId().toString()); +// distributionLoadscanService.save(distributionLoadscanEntity); +// } +// //查询本车次是否第一次扫码,没有则更新上车时间 +//// Integer i = distributionDeliveryListMapper.updateloadingTimeById(distributionDeliveryListEntity.getId()); +// //更新签收表的签收数量和装车数量 +// Integer j = distributionSignforMapper.updateSignforByReservationId(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), distributionLoadscanEntity.getPackageNub()); +// +// } +// } +// if (distributionLoadscanvnEntitiesopen.size() > 0) { +// //库存品数据 +// for (DistributionLoadscaninvnEntity distributionLoadscanEntity : distributionLoadscanvnEntitiesopen) { +// //查询是否重复扫码 +// List distributionLoadscaninvnEntitiesflag = distributionLoadscaninvnMapper.selectList(new QueryWrapper().lambda() +// .eq(DistributionLoadscaninvnEntity::getDeliveryId, distributionLoadscanEntity.getDeliveryId()) +// .eq(DistributionLoadscaninvnEntity::getOrderPackageCode, distributionLoadscanEntity.getOrderPackageCode()) +// .ne(DistributionLoadscaninvnEntity::getScanStatus, 1) +// .eq(DistributionLoadscaninvnEntity::getSignforState, 2) +// ); +// if (distributionLoadscaninvnEntitiesflag.size() > 0) { +// // 修改该记录 +// for (DistributionLoadscaninvnEntity loadscanEntity : distributionLoadscaninvnEntitiesflag) { +// if (loadscanEntity.getSignforState() == 2) break; +// distributionLoadscaninvnService.update(new UpdateWrapper().lambda() +// .eq(DistributionLoadscaninvnEntity::getDeliveryId, distributionLoadscanEntity.getDeliveryId()) +// .eq(DistributionLoadscaninvnEntity::getOrderPackageCode, distributionLoadscanEntity.getOrderPackageCode()) +// .set(DistributionLoadscaninvnEntity::getSigningTime, simpleDateFormat.format(new Date())) +// .set(DistributionLoadscaninvnEntity::getSignforState, 2) +// .set(DistributionLoadscaninvnEntity::getReceivedQuantity, 1) +// ); +// //更新签收表的签收数量和装车数量 +// Integer j = distributionSignforMapper.updateSignforByReservationId(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), loadscanEntity.getPackageNub()); +// } +//// distributionLoadscanService.update() +// continue; +// } +// //依次插入该装车记录,设置车辆 +// if (null != distributionDeliverySelfEntity.getDriverId()) { +// distributionLoadscanEntity.setDriverId(distributionDeliverySelfEntity.getDriverId()); +// } +// distributionLoadscanEntity.setDriverName(distributionDeliverySelfEntity.getDriverName()); +// distributionLoadscanEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub()); +// distributionLoadscanEntity.setScanStatus(LoadingStatusConstant.saomiao.getValue()); +// distributionLoadscanEntity.setScanType("1"); +// distributionLoadscanEntity.setReceivedQuantity(1); +//// distributionLoadscanEntity.setOneClick(2); +// distributionLoadscanEntity.setSignforState(2); +// distributionLoadscanEntity.setOneQclick(2); +// distributionLoadscanEntity.setMsg("司机签收"); +// if (distributionSignfor.getIsClerk()) { +// distributionLoadscanEntity.setMsg("文员签收"); +// } +//// distributionLoadscanEntity.setScanTime(new Date()); +// if (null == distributionLoadscanEntity.getPackageNub()) { +// distributionLoadscanEntity.setPackageNub(1); +// distributionLoadscanEntity.setLoadedNub(distributionLoadscanEntity.getPackageNub()); +// } +// distributionLoadscanEntity.setLoadingId(distributionDeliverySelfEntity.getId().toString()); +// distributionLoadscanEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub()); +// if (null != distributionDeliverySelfEntity.getDriverPhone()) { +// distributionLoadscanEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone()); +// } +// if (null != distributionDeliverySelfEntity.getVehicleId()) { +// distributionLoadscanEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId()); +// } +// //查询本车次是否第一次扫码,没有则更新上车时间 +//// Integer i = distributionDeliveryListMapper.updateloadingTimeById(distributionDeliveryListEntity.getId()); +// //更新签收表的装车数量和签收数量 +// Integer j = distributionSignforMapper.updatesignforByinvn(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), distributionLoadscanEntity.getPackageNub()); +// } +// distributionLoadscaninvnService.saveBatch(distributionLoadscanvnEntitiesopen); +// } + +// boolean update = this.update(new UpdateWrapper().lambda() +// .eq(DistributionSignforEntity::getId, distributionSignforEntity.getId()) +// .set(StringUtils.isNotBlank(distributionSignfor.getDeliverySignPictures()), DistributionSignforEntity::getDeliverySignPictures, distributionSignfor.getDeliverySignPictures()) +// .set(StringUtils.isNotBlank(distributionSignfor.getSigningType()), DistributionSignforEntity::getSigningType, distributionSignfor.getSigningType()) +// .set(distributionSignfor.getIsClerk(), DistributionSignforEntity::getSigningStatus, 2) +// .set(distributionSignfor.getIsClerk(), DistributionSignforEntity::getSigningTime, simpleDateFormat.format(new Date())) +// .set(distributionSignfor.getIsClerk() && StringUtils.isNotBlank(distributionSignfor.getClerkSignRemarks()), DistributionSignforEntity::getSigningStatus, distributionSignfor.getClerkSignRemarks()) +// .set(!distributionSignfor.getIsClerk() && StringUtils.isNotBlank(distributionSignfor.getDriverRemarks()), DistributionSignforEntity::getDriverRemarks, distributionSignfor.getDriverRemarks()) +// .set(!distributionSignfor.getIsClerk(), DistributionSignforEntity::getDriverSigning, 2) +// .set(!distributionSignfor.getIsClerk(), DistributionSignforEntity::getSjsigningTime, simpleDateFormat.format(new Date())) +// ); +// return R.status(true); +// } + @Override public R offline(String offlineJson) { @@ -782,7 +1054,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl parcelListEntities = baseMapper.getSignforPackageList(signforEntity.getReservationId()); List parcelListVOS = DistributionParcelListWrapper.build().listVO(parcelListEntities); - parcelListVOS.forEach(p->{ + parcelListVOS.forEach(p -> { DistributionLoadscanEntity distributionLoadscanEntity = distributionLoadscanMapper.selectOne(Wrappers.query().lambda().eq(DistributionLoadscanEntity::getPackageId, p.getId())); if (Func.isNotEmpty(distributionLoadscanEntity)) { //该包件存在扫描记录 @@ -801,13 +1073,13 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl