Browse Source

库存品一键装车+一键签收出库调整

training
kilo 1 year ago
parent
commit
4960905cd1
  1. 6
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionLoadscaninvnEntity.java
  2. 11
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.java
  3. 5
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml
  4. 10
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  5. 385
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java

6
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionLoadscaninvnEntity.java

@ -278,6 +278,12 @@ public class DistributionLoadscaninvnEntity extends TenantEntity {
@ApiModelProperty(value = "配送表id")
private Long deliveryId;
/**
* 配送表id
*/
@ApiModelProperty(value = "配送表id")
private Long inventoryPackageId;
/**
* 装车数量
*/

11
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.java

@ -191,7 +191,7 @@ public interface DistributionSignforMapper extends BaseMapper<DistributionSignfo
*/
Integer updateSignforByReservationId(@Param("deliveryId") Long deliveryId,@Param("reservationId") Long reservationId,@Param("packageNub") Integer packageNub);
Integer updatesignforByinvn(@Param("deliveryId") Long deliveryId,@Param("reservationId") Long reservationId,@Param("packageNub") Integer packageNub);
Integer updateLoadAndsignforByinvn(@Param("deliveryId") Long deliveryId,@Param("reservationId") Long reservationId,@Param("packageNub") Integer packageNub);
/**
* 删除预约配送中间白哦
@ -240,4 +240,13 @@ public interface DistributionSignforMapper extends BaseMapper<DistributionSignfo
List<DistributionSignPrintVO> selectSignImgsUrl(@Param("reservationId")Long reservationId);
List<DistributionSignforVO> exportDistributionSignforSigningOwn(@Param("param") DistributionSignforVO distributionSignforVO);
/**
* 修改库存品签收数量
* @param deliveryId
* @param reservationId
* @param packageNub
* @return
*/
Integer updatesignforByinvn(@Param("deliveryId") Long deliveryId,@Param("reservationId") Long reservationId,@Param("packageNub") Integer packageNub);
}

5
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml

@ -57,9 +57,12 @@
<update id="updateSignforByReservationId">
UPDATE logpm_distribution_signfor lds set lds.received_quantity = ( lds.received_quantity + #{packageNub} ),lds.loaded_number = ( lds.loaded_number + #{packageNub} ) WHERE lds.is_deleted =0 and lds.reservation_id = #{reservationId} and lds.delivery_id =#{deliveryId}
</update>
<update id="updatesignforByinvn">
<update id="updateLoadAndsignforByinvn">
UPDATE logpm_distribution_signfor lds set lds.loadedin_number = ( lds.loadedin_number + #{packageNub} ),lds.receivedin_quantity = ( lds.receivedin_quantity + #{packageNub} ) WHERE lds.is_deleted =0 and lds.reservation_id = #{reservationId} and lds.delivery_id =#{deliveryId}
</update>
<update id="updatesignforByinvn">
UPDATE logpm_distribution_signfor lds set lds.receivedin_quantity = ( lds.receivedin_quantity + #{packageNub} ) WHERE lds.is_deleted =0 and lds.reservation_id = #{reservationId} and lds.delivery_id =#{deliveryId}
</update>
<delete id="deleteByReservationAndDeliveryId">
DELETE FROM logpm_distribution_signfor
<where>

10
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java

@ -1651,10 +1651,13 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
//存在库存品海为进行装车
for (DisStockListDetailEntity disStockListDetailEntity : stockListDetailEntityList) {
if (disStockListDetailEntity.getStockLockingStatus().equals(InventoryLoadingStatusConstant.weizhuangche.getValue())) {
disStockListDetailEntity.setStockLockingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue());
disStockListDetailService.updateById(disStockListDetailEntity);
DistributionLoadscaninvnEntity loadscaninvnEntity = new DistributionLoadscaninvnEntity();
BladeUser user = AuthUtil.getUser();
// loadscaninvnEntity.setScanUser(user.getUserName());
loadscaninvnEntity.setScanUser(user.getNickName());
loadscaninvnEntity.setInventoryPackageId(disStockListDetailEntity.getId());
loadscaninvnEntity.setDriverName(distributionDeliverySelfEntity.getDriverName());
loadscaninvnEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub());
loadscaninvnEntity.setScanStatus(LoadingStatusConstant.yijianzhuangche.getValue());
@ -2117,6 +2120,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
} else {
List<DisStockListDetailEntity> disStockListDetailEntities = detailEntities.stream().filter(d -> d.getStockPackageCode().equals(barcode)).collect(Collectors.toList());
if (disStockListDetailEntities.size() == 1) {
DisStockListDetailEntity disStockListDetailEntity = disStockListDetailEntities.get(0);
disStockListDetailEntity.setStockLockingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue());
disStockListDetailService.updateById(disStockListDetailEntity);
DistributionLoadscaninvnEntity distributionLoadscaninvnEntity = getDistributionLoadscaninvnEntity(distrilbutionloadingscanDTO, distributionDeliverySelfEntity, disStockListDetailEntities);
distributionLoadscaninvnService.save(distributionLoadscaninvnEntity);
//查询本车次是否第一次扫码,没有则更新上车时间
@ -2143,7 +2149,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
String msg = getLoadingMsg(distrilbutionloadingscanDTO);
return Resp.scanSuccess("扫描成功", msg);
}
/**
* 构建对象
*
@ -2179,6 +2184,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
distributionLoadscaninvnEntity.setInventoryId(disStockListDetailEntities.get(0).getStockListId());
distributionLoadscaninvnEntity.setReservationId(disStockListDetailEntities.get(0).getReservationId());
distributionLoadscaninvnEntity.setOneClick(1);
distributionLoadscaninvnEntity.setInventoryPackageId(disStockListDetailEntities.get(0).getId());
distributionLoadscaninvnEntity.setLoadedNub(disStockListDetailEntities.get(0).getNum());
distributionLoadscaninvnEntity.setDeliveryId(distrilbutionloadingscanDTO.getDeliveryId());
distributionLoadscaninvnEntity.setIsInsert(LoadingIsInsertConstant.zhengchang.getValue());
@ -2332,7 +2338,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
//判断当前登录人是否为司机
List<DistributionAppDeliveryListVO> distributionAppDeliveryListVOS = new ArrayList<>();
boolean delivery = false;
String value1 = DictBizCache.getValue("role_class", "delivery_driver_new");
String value1 = DictBizCache.getValue("role_class", "delivery_driver");
if (roleId.contains(value1)) delivery = true;

385
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java

@ -176,35 +176,36 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
// }
// queryWrapper.eq("warehouse_id",myCurrentWarehouse.getId());
DistributionSignforVO distributionSignforVO = JSON.parseObject(JSON.toJSONString(distributionSignfor), DistributionSignforVO.class);
if(ObjectUtils.isNotNull(o)){
String id= (String) o;
if (ObjectUtils.isNotNull(o)) {
String id = (String) o;
String[] split = id.split(",");
distributionSignforVO.setIds(Arrays.asList(split));
}
List<DistributionSignforVO> distributionSignforList = baseMapper.exportDistributionSignforOwn(distributionSignforVO);
List<DistributionSignforVO> distributionSignforList = baseMapper.exportDistributionSignforOwn(distributionSignforVO);
List<DistributionSignforExcel> list = new ArrayList<>();
distributionSignforList.forEach(d -> {
// distributionSignfor.setTypeName(DictCache.getValue(DictEnum.YES_NO, DistributionSignfor.getType()));
DistributionSignforExcel signforExcel = new DistributionSignforExcel();
BeanUtils.copyProperties(d,signforExcel);
DistributionSignforExcel signforExcel = new DistributionSignforExcel();
BeanUtils.copyProperties(d, signforExcel);
// signforExcel.setConsignee();
String value = DictBizCache.getValue(DictBizConstant.DISTRIBUTION_TYPE, d.getDeliveryType());
signforExcel.setDeliveryTypeName(value);
String value1 = DictBizCache.getValue(DictBizConstant.DISTRIBUTION_SIGNFOR_STATUS, d.getSigningStatus());
signforExcel.setSigningStatusName(value1);
String value2 = DictBizCache.getValue(DictBizConstant.DISTRIBUTION_SIGNFOR_STATUS, d.getDriverSigning());
signforExcel.setDriverSigningName(value2);
String value3 = DictBizCache.getValue(DictBizConstant.ADD_VALUE_SERVE_TYPE, d.getServeType());
signforExcel.setDeliveryWayName(value3);
list.add(signforExcel);
});
return list;
String value = DictBizCache.getValue(DictBizConstant.DISTRIBUTION_TYPE, d.getDeliveryType());
signforExcel.setDeliveryTypeName(value);
String value1 = DictBizCache.getValue(DictBizConstant.DISTRIBUTION_SIGNFOR_STATUS, d.getSigningStatus());
signforExcel.setSigningStatusName(value1);
String value2 = DictBizCache.getValue(DictBizConstant.DISTRIBUTION_SIGNFOR_STATUS, d.getDriverSigning());
signforExcel.setDriverSigningName(value2);
String value3 = DictBizCache.getValue(DictBizConstant.ADD_VALUE_SERVE_TYPE, d.getServeType());
signforExcel.setDeliveryWayName(value3);
list.add(signforExcel);
});
return list;
}
@Override
public List<DistributionSignforOwnExcel> exportDistributionSignforOwn(Map<String, Object> distributionSignfor) {
Object o = distributionSignfor.get("ids");
if(ObjectUtils.isNotNull(o)){
if (ObjectUtils.isNotNull(o)) {
distributionSignfor.remove("ids");
}
// BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse();
@ -218,8 +219,8 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
// }
// queryWrapper.eq("warehouse_id",myCurrentWarehouse.getId());
DistributionSignforVO distributionSignforVO = JSON.parseObject(JSON.toJSONString(distributionSignfor), DistributionSignforVO.class);
if(ObjectUtils.isNotNull(o)){
String id= (String) o;
if (ObjectUtils.isNotNull(o)) {
String id = (String) o;
String[] split = id.split(",");
distributionSignforVO.setIds(Arrays.asList(split));
}
@ -227,21 +228,21 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
List<DistributionSignforVO> distributionSignforList = baseMapper.exportDistributionSignforSigningOwn(distributionSignforVO);
List<DistributionSignforOwnExcel> list = new ArrayList<>();
distributionSignforList.forEach(d ->{
DistributionSignforOwnExcel signforExcel = new DistributionSignforOwnExcel();
BeanUtils.copyProperties(d,signforExcel);
String value = DictBizCache.getValue(DictBizConstant.DISTRIBUTION_TYPE, d.getDeliveryType());
signforExcel.setDeliveryTypeName(value);
String value1 = DictBizCache.getValue(DictBizConstant.DISTRIBUTION_SIGNFOR_STATUS, d.getSigningStatus());
signforExcel.setSigningStatusName(value1);
String value2 = DictBizCache.getValue(DictBizConstant.DISTRIBUTION_SIGNFOR_STATUS, d.getDriverSigning());
signforExcel.setDriverSigningName(value2);
String value3 = DictBizCache.getValue(DictBizConstant.ADD_VALUE_SERVE_TYPE, d.getServeType());
signforExcel.setDeliveryWayName(value3);
list.add(signforExcel);
});
return list;
distributionSignforList.forEach(d -> {
DistributionSignforOwnExcel signforExcel = new DistributionSignforOwnExcel();
BeanUtils.copyProperties(d, signforExcel);
String value = DictBizCache.getValue(DictBizConstant.DISTRIBUTION_TYPE, d.getDeliveryType());
signforExcel.setDeliveryTypeName(value);
String value1 = DictBizCache.getValue(DictBizConstant.DISTRIBUTION_SIGNFOR_STATUS, d.getSigningStatus());
signforExcel.setSigningStatusName(value1);
String value2 = DictBizCache.getValue(DictBizConstant.DISTRIBUTION_SIGNFOR_STATUS, d.getDriverSigning());
signforExcel.setDriverSigningName(value2);
String value3 = DictBizCache.getValue(DictBizConstant.ADD_VALUE_SERVE_TYPE, d.getServeType());
signforExcel.setDeliveryWayName(value3);
list.add(signforExcel);
});
return list;
}
@Override
@ -492,7 +493,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
// }
List<Long> orderIds = reservationStockarticleEntityList.stream().map(DistributionReservationStockarticleEntity::getStockArticleId).collect(Collectors.toList());
if (Func.isNotEmpty(orderIds)){
if (Func.isNotEmpty(orderIds)) {
List<DistributionStockArticleEntity> stockArticleEntities = distributionStockArticleService.listByIds(orderIds);
List<DistributionSignPrintVO> printEntities = baseMapper.selectSignImgsUrl(distributionSignforVO.getReservationId());
distributionSignforVO.setPrintVOList(printEntities);
@ -1254,9 +1255,9 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
List<DistributionStockArticleVO> deliveryStockArticleInfo = distributionDeliveryListMapper.getDeliveryStockArticleInfo(distributionAppDeliveryListVO.getId());
// deliveryStockArticleInfo.forEach();
List<DistributionReservationEntity> distributionReservationEntities = distributionDeliveryListMapper.selectReservationByDeliveryListId(distributionAppDeliveryListVO.getId());
distributionReservationEntities.forEach(r->{
distributionReservationEntities.forEach(r -> {
List<DistributionReservationStockarticleEntity> reservationStockarticleEntityList = distributionReservationMapper.selectStockArticleByReservationId(r.getId());
reservationStockarticleEntityList.forEach(rs->{
reservationStockarticleEntityList.forEach(rs -> {
List<DistributionLoadscanEntity> loadscanEntityList = distributionLoadscanService.list(Wrappers.<DistributionLoadscanEntity>query().lambda()
.eq(DistributionLoadscanEntity::getDeliveryId, distributionAppDeliveryListVO.getId())
.eq(DistributionLoadscanEntity::getOrderId, rs.getStockArticleId())
@ -1265,9 +1266,9 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
.ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())
);
if (Func.isNotEmpty(loadscanEntityList)){
if (Func.isNotEmpty(loadscanEntityList)) {
int loadSum = loadscanEntityList.stream().mapToInt(DistributionLoadscanEntity::getLoadedNub).sum();
if (rs.getReservationNum() == loadSum){
if (rs.getReservationNum() == loadSum) {
ordCount.getAndIncrement();
}
}
@ -1363,6 +1364,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
}
@Override
@Transactional
public R oneclick(DistributionSignforDTO distributionSignfor) {
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse();
if (Objects.isNull(myCurrentWarehouse)) {
@ -1399,7 +1401,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
//获取计划配送用户司机
DistributionDeliveryListEntity distributionDeliveryListEntity = distributionDeliveryListMapper.selectById(distributionSignfor.getDeliveryId());
if (Func.isEmpty(distributionDeliveryListEntity)){
if (Func.isEmpty(distributionDeliveryListEntity)) {
log.error("#############deliveryId参数错误:{}", distributionSignfor.getDeliveryId());
return R.fail("服务器正忙~~");
}
@ -1426,7 +1428,6 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
return R.fail("签收失败");
}
BladeUser user = AuthUtil.getUser();
//处理库存品
//查询出该客户下的库存品信息
List<DisStockListDetailEntity> detailEntities = distributionReservationMapper.selectInventoryListByReservation(distributionSignforEntity.getReservationId());
@ -1434,108 +1435,194 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
boolean flag = detailEntities.stream().allMatch(s -> Func.isNotEmpty(s.getStockPackageCode()));
//只要库存品没有进行备货操作则不能进行一件装车操作
if (flag) {
//库存品均已备货
List<DisStockListDetailEntity> 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();
for (DisStockListDetailEntity detailEntity : detailEntities) {
DistributionLoadscaninvnEntity loadscaninvnEntity = distributionLoadscaninvnService.getOne(Wrappers.<DistributionLoadscaninvnEntity>query().lambda()
.eq(DistributionLoadscaninvnEntity::getReservationId, detailEntity.getReservationId())
.eq(DistributionLoadscaninvnEntity::getInventoryId, detailEntity.getStockListId())
.eq(DistributionLoadscaninvnEntity::getOrderPackageCode, detailEntity.getStockPackageCode())
.eq(DistributionLoadscaninvnEntity::getInventoryPackageId, detailEntity.getId())
.ne(DistributionLoadscaninvnEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())
);
if (Func.isNotEmpty(loadscaninvnEntity)) {
if (!loadscaninvnEntity.getSignforState().equals(LoadScanSigningStatusConstant.yiqianshou.getValue())){
//存在库存品装车数据,这里进行签收状态修改
loadscaninvnEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue());
loadscaninvnEntity.setReceivedQuantity(detailEntity.getNum());
loadscaninvnEntity.setOneClick(1);
loadscaninvnEntity.setOneQclick(2);
loadscaninvnEntity.setSigningUser(user.getNickName());
loadscaninvnEntity.setSigningUserId(user.getUserId());
loadscaninvnEntity.setReceivedQuantity(detailEntity.getNum());
loadscaninvnEntity.setSigningTime(simpleDateFormat.format(new Date()));
distributionLoadscaninvnService.updateById(loadscaninvnEntity);
Integer i = distributionDeliveryListMapper.updateloadingTimeById(distributionDeliveryListEntity.getId());
Integer j = distributionSignforMapper.updatesignforByinvn(loadscaninvnEntity.getDeliveryId(), loadscaninvnEntity.getReservationId(), loadscaninvnEntity.getPackageNub());
}
}else {
//不存在装车数据 这里需要进行装车数据的补录
detailEntity.setStockLockingStatus(InventoryLoadingStatusConstant.yizhuangche.getValue());
detailEntity.setStockSignfoStatus(InventorySigningStatusConstant.yiqianshou.getValue());
disStockListDetailService.updateById(detailEntity);
DistributionLoadscaninvnEntity newLoadscaninvnEntity = new DistributionLoadscaninvnEntity();
if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverId())) {
loadscaninvnEntity.setDriverId(distributionDeliverySelfEntity.getDriverId());
newLoadscaninvnEntity.setDriverId(distributionDeliverySelfEntity.getDriverId());
}
if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverName())) {
loadscaninvnEntity.setDriverName(distributionDeliverySelfEntity.getDriverName());
newLoadscaninvnEntity.setDriverName(distributionDeliverySelfEntity.getDriverName());
}
if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleId())) {
loadscaninvnEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId());
newLoadscaninvnEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId());
}
if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleNub())) {
loadscaninvnEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub());
newLoadscaninvnEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub());
}
if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverPhone())) {
loadscaninvnEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone());
newLoadscaninvnEntity.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.getNickName());
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.setSigningUser(user.getNickName());
loadscaninvnEntity.setSigningUserId(user.getUserId());
loadscaninvnEntity.setSigningTime(simpleDateFormat.format(new Date()));
newLoadscaninvnEntity.setLoadingId(distributionDeliverySelfEntity.getId().toString());
newLoadscaninvnEntity.setOrderPackageCode(detailEntity.getStockPackageCode());
newLoadscaninvnEntity.setInventoryId(detailEntity.getStockListId());
newLoadscaninvnEntity.setDeliveryId(distributionSignforEntity.getDeliveryId());
newLoadscaninvnEntity.setReservationId(distributionSignforEntity.getReservationId());
newLoadscaninvnEntity.setInventoryPackageId(detailEntity.getId());
newLoadscaninvnEntity.setScanUser(user.getNickName());
newLoadscaninvnEntity.setScanTime(new Date());
newLoadscaninvnEntity.setPackageNub(detailEntity.getNum());
newLoadscaninvnEntity.setScanStatus(LoadingStatusConstant.yijianzhuangche.getValue());
newLoadscaninvnEntity.setIsInsert(LoadingIsInsertConstant.bulu.getValue());
newLoadscaninvnEntity.setScanType("1");
newLoadscaninvnEntity.setType(2);
newLoadscaninvnEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue());
newLoadscaninvnEntity.setIsSignfor(1);
newLoadscaninvnEntity.setReceivedQuantity(detailEntity.getNum());
newLoadscaninvnEntity.setOneClick(2);
newLoadscaninvnEntity.setOneQclick(2);
newLoadscaninvnEntity.setSigningUser(user.getNickName());
newLoadscaninvnEntity.setSigningUserId(user.getUserId());
newLoadscaninvnEntity.setSigningTime(simpleDateFormat.format(new Date()));
if (distributionSignfor.getIsClerk()) {
loadscaninvnEntity.setMsg("文员一键签收数据补录");
newLoadscaninvnEntity.setMsg("文员一键签收数据补录");
} else {
loadscaninvnEntity.setMsg("司机一键签收数据补录");
newLoadscaninvnEntity.setMsg("司机一键签收数据补录");
}
distributionLoadscaninvnService.save(loadscaninvnEntity);
distributionLoadscaninvnService.save(newLoadscaninvnEntity);
Integer i = distributionDeliveryListMapper.updateloadingTimeById(distributionDeliveryListEntity.getId());
//更新签收表的签收数量和装车数量
Integer j = distributionSignforMapper.updatesignforByinvn(loadscaninvnEntity.getDeliveryId(), loadscaninvnEntity.getReservationId(), loadscaninvnEntity.getPackageNub());
Integer j = distributionSignforMapper.updateLoadAndsignforByinvn(newLoadscaninvnEntity.getDeliveryId(), newLoadscaninvnEntity.getReservationId(), newLoadscaninvnEntity.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());
DistributionStockListEntity stockListEntity = distributionStockListService.getById(detailEntity.getStockListId());
stockListEntity.setQuantityOccupied(stockListEntity.getQuantityOccupied() - newLoadscaninvnEntity.getPackageNub());
stockListEntity.setQuantityStock(stockListEntity.getQuantityStock() - newLoadscaninvnEntity.getPackageNub());
stockListEntity.setOutboundQuantity(stockListEntity.getOutboundQuantity() + newLoadscaninvnEntity.getPackageNub());
distributionStockListService.updateById(stockListEntity);
}
}
//库存品扫描记录补充
for (DisStockListDetailEntity detailEntity : detailEntities) {
if (detailEntity.getStockLockingStatus().equals(InventoryLoadingStatusConstant.yizhuangche.getValue())) {
detailEntity.setStockSignfoStatus(InventorySigningStatusConstant.yiqianshou.getValue());
disStockListDetailService.updateById(detailEntity);
//查询出对于的装车扫描记录
List<DistributionLoadscaninvnEntity> list = distributionLoadscaninvnService.list(Wrappers.<DistributionLoadscaninvnEntity>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);
if (distributionSignfor.getIsClerk()) {
loadscaninvnEntity.setMsg("文员一键签收数据补录");
} else {
loadscaninvnEntity.setMsg("司机一键签收数据补录");
}
loadscaninvnEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue());
loadscaninvnEntity.setReceivedQuantity(detailEntity.getNum());
loadscaninvnEntity.setOneClick(1);
loadscaninvnEntity.setOneQclick(2);
loadscaninvnEntity.setSigningUser(user.getUserName());
loadscaninvnEntity.setSigningUserId(user.getUserId());
loadscaninvnEntity.setReceivedQuantity(detailEntity.getNum());
loadscaninvnEntity.setSigningTime(simpleDateFormat.format(new Date()));
distributionLoadscaninvnService.updateById(loadscaninvnEntity);
Integer i = distributionDeliveryListMapper.updateloadingTimeById(distributionDeliveryListEntity.getId());
Integer j = distributionSignforMapper.updatesignforByinvn(loadscaninvnEntity.getDeliveryId(), loadscaninvnEntity.getReservationId(), loadscaninvnEntity.getPackageNub());
} else {
log.error("################库存品未进行备货操作+{}" + list);
//此时说明在同一配送任务下,同一客户出现了相同的库存品包件码
}
}
//对库存品包件上级的状态维护
distributionAsyncService.checkStockArticleListSigningStatus(detailEntity);
}
// //库存品均已备货
// List<DisStockListDetailEntity> 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.getNickName());
// 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.setSigningUser(user.getNickName());
// loadscaninvnEntity.setSigningUserId(user.getUserId());
// loadscaninvnEntity.setSigningTime(simpleDateFormat.format(new Date()));
//
// if (distributionSignfor.getIsClerk()) {
// loadscaninvnEntity.setMsg("文员一键签收数据补录");
// } else {
// loadscaninvnEntity.setMsg("司机一键签收数据补录");
// }
// distributionLoadscaninvnService.save(loadscaninvnEntity);
// Integer i = distributionDeliveryListMapper.updateloadingTimeById(distributionDeliveryListEntity.getId());
// //更新签收表的签收数量和装车数量
// 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);
// }
// }
// //库存品扫描记录补充
// for (DisStockListDetailEntity detailEntity : detailEntities) {
// if (detailEntity.getStockLockingStatus().equals(InventoryLoadingStatusConstant.yizhuangche.getValue())) {
// detailEntity.setStockSignfoStatus(InventorySigningStatusConstant.yiqianshou.getValue());
// disStockListDetailService.updateById(detailEntity);
// //查询出对于的装车扫描记录
// List<DistributionLoadscaninvnEntity> list = distributionLoadscaninvnService.list(Wrappers.<DistributionLoadscaninvnEntity>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);
// if (distributionSignfor.getIsClerk()) {
// loadscaninvnEntity.setMsg("文员一键签收数据补录");
// } else {
// loadscaninvnEntity.setMsg("司机一键签收数据补录");
// }
// loadscaninvnEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue());
// loadscaninvnEntity.setReceivedQuantity(detailEntity.getNum());
// loadscaninvnEntity.setOneClick(1);
// loadscaninvnEntity.setOneQclick(2);
// loadscaninvnEntity.setSigningUser(user.getUserName());
// loadscaninvnEntity.setSigningUserId(user.getUserId());
// loadscaninvnEntity.setReceivedQuantity(detailEntity.getNum());
// loadscaninvnEntity.setSigningTime(simpleDateFormat.format(new Date()));
// distributionLoadscaninvnService.updateById(loadscaninvnEntity);
// Integer i = distributionDeliveryListMapper.updateloadingTimeById(distributionDeliveryListEntity.getId());
// Integer j = distributionSignforMapper.updatesignforByinvn(loadscaninvnEntity.getDeliveryId(), loadscaninvnEntity.getReservationId(), loadscaninvnEntity.getPackageNub());
// } else {
// log.error("################库存品未进行备货操作+{}" + list);
// //此时说明在同一配送任务下,同一客户出现了相同的库存品包件码
// }
// }
// //对库存品包件上级的状态维护
// distributionAsyncService.checkStockArticleListSigningStatus(detailEntity);
// }
} else {
log.error("################库存品未进行备货操作+{}" + detailEntities);
return R.fail("一键装车失败!!!库存品都备货了!?");
@ -2222,22 +2309,22 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
switch (conditions) {
case 1:
//订制品
DistributionAddvaluePackageVO addvaluePackageVO = distributionAddvalueMapper.selectAddvaluePackageDetail(p.getPackageId(),distributionAddvalueDTO.getAddvalueId(),distributionAddvalueDTO.getReservationId());
if (Func.isNotEmpty(addvaluePackageVO)){
DistributionAddvaluePackageVO addvaluePackageVO = distributionAddvalueMapper.selectAddvaluePackageDetail(p.getPackageId(), distributionAddvalueDTO.getAddvalueId(), distributionAddvalueDTO.getReservationId());
if (Func.isNotEmpty(addvaluePackageVO)) {
addvaluePackageVOS.add(addvaluePackageVO);
}
break;
case 2:
DistributionAddvaluePackageVO addvalueinventoryPackageVO = distributionAddvalueMapper.selectAddvalueInventoryPackageDetail(p.getPackageId(),distributionAddvalueDTO.getAddvalueId(),distributionAddvalueDTO.getReservationId());
DistributionAddvaluePackageVO addvalueinventoryPackageVO = distributionAddvalueMapper.selectAddvalueInventoryPackageDetail(p.getPackageId(), distributionAddvalueDTO.getAddvalueId(), distributionAddvalueDTO.getReservationId());
//库存品
if (Func.isNotEmpty(addvalueinventoryPackageVO)){
if (Func.isNotEmpty(addvalueinventoryPackageVO)) {
addvaluePackageVOS.add(addvalueinventoryPackageVO);
}
break;
case 3:
DistributionAddvaluePackageVO addvalueZeroPackageVO = distributionAddvalueMapper.selectAddvalueZeroPackageDetail(p.getPackageId(),distributionAddvalueDTO.getAddvalueId(),distributionAddvalueDTO.getReservationId());
DistributionAddvaluePackageVO addvalueZeroPackageVO = distributionAddvalueMapper.selectAddvalueZeroPackageDetail(p.getPackageId(), distributionAddvalueDTO.getAddvalueId(), distributionAddvalueDTO.getReservationId());
//库存品
if (Func.isNotEmpty(addvalueZeroPackageVO)){
if (Func.isNotEmpty(addvalueZeroPackageVO)) {
addvaluePackageVOS.add(addvalueZeroPackageVO);
}
break;
@ -2640,7 +2727,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
DistributionSignforEntity signforEntity = distributionSignforMapper.selectOne(Wrappers.<DistributionSignforEntity>query().lambda().eq(DistributionSignforEntity::getDeliveryId, loadscanEntityList.getDeliveryId()).eq(DistributionSignforEntity::getReservationId, loadscanEntityList.getReservationId()));
BigDecimal loadedNumber = new BigDecimal(signforEntity.getLoadedNumber());
BigDecimal signingNumber = new BigDecimal(signforEntity.getReceivedQuantity());
if (loadscanEntityList.getLoadedNub() < p.getSigningNum()){
if (loadscanEntityList.getLoadedNub() < p.getSigningNum()) {
//这里需要同时维护装车和签收数量
// loadscanEntityList.setLoadedNub(p.getSigningNum());
// loadscanEntityList.setPackageNub(p.getSigningNum());
@ -2746,49 +2833,49 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
}
@Override
public IPage<DistributionAddvaluePackageVO> checkAddValuePackageList(IPage<DistributionAddvaluePackageVO> page,Map<String, Object> addValueDTO) {
public IPage<DistributionAddvaluePackageVO> checkAddValuePackageList(IPage<DistributionAddvaluePackageVO> page, Map<String, Object> addValueDTO) {
String reservationId = (String) addValueDTO.get("reservationId");
if (Func.isEmpty(reservationId)){
if (Func.isEmpty(reservationId)) {
log.error("##################无reservationId");
return null;
}
List<DistributionReservationStockarticleEntity> reservationStockarticleEntityList = distributionReservationMapper.selectStockArticleByReservationId(Long.parseLong(reservationId));
List<DistributionAddvaluePackageVO> addvaluePackageVOS = new ArrayList<>();
if (Func.isNotEmpty(reservationStockarticleEntityList)){
if (Func.isNotEmpty(reservationStockarticleEntityList)) {
List<Long> orderIds = reservationStockarticleEntityList.stream().map(DistributionReservationStockarticleEntity::getStockArticleId).collect(Collectors.toList());
LambdaQueryWrapper<DistributionStockArticleEntity> orderQW = Wrappers.<DistributionStockArticleEntity>query().lambda().in(DistributionStockArticleEntity::getId, orderIds);
if (Func.isNotEmpty(addValueDTO.get("orderCode"))){
if (Func.isNotEmpty(addValueDTO.get("orderCode"))) {
orderQW.like(DistributionStockArticleEntity::getOrderCode, addValueDTO.get("orderCode"));
}
List<DistributionStockArticleEntity> orderList = distributionStockArticleService.list(orderQW);
orderList.forEach(rs->{
if (rs.getIsZero().equals(IsOrNoConstant.no.getValue())){
List<DistributionAddvaluePackageVO> addvaluepackageVO = distributionAddvalueMapper.selectAddvaluePackageVO(Long.parseLong(reservationId),rs.getId(),addValueDTO);
if (Func.isNotEmpty(addvaluepackageVO)){
orderList.forEach(rs -> {
if (rs.getIsZero().equals(IsOrNoConstant.no.getValue())) {
List<DistributionAddvaluePackageVO> addvaluepackageVO = distributionAddvalueMapper.selectAddvaluePackageVO(Long.parseLong(reservationId), rs.getId(), addValueDTO);
if (Func.isNotEmpty(addvaluepackageVO)) {
addvaluePackageVOS.addAll(addvaluepackageVO);
}
}else {
List<DistributionAddvaluePackageVO> addvalueZeroPackageVO = distributionAddvalueMapper.selectAddvalueZeroPackageVO(Long.parseLong(reservationId),rs.getId(),addValueDTO);
if (Func.isNotEmpty(addvalueZeroPackageVO)){
} else {
List<DistributionAddvaluePackageVO> addvalueZeroPackageVO = distributionAddvalueMapper.selectAddvalueZeroPackageVO(Long.parseLong(reservationId), rs.getId(), addValueDTO);
if (Func.isNotEmpty(addvalueZeroPackageVO)) {
addvaluePackageVOS.addAll(addvalueZeroPackageVO);
}
}
});
}
List<DistributionReservationStocklistEntity> distributionReservationStocklistEntities = distributionReservationMapper.selectStockListByReservationId(Long.parseLong(reservationId));
if (Func.isNotEmpty(distributionReservationStocklistEntities)){
if (Func.isNotEmpty(distributionReservationStocklistEntities)) {
List<Long> inventoryIds = distributionReservationStocklistEntities.stream().map(DistributionReservationStocklistEntity::getStocklistId).collect(Collectors.toList());
LambdaQueryWrapper<DistributionStockListEntity> inventoryQW = Wrappers.<DistributionStockListEntity>query().lambda().in(DistributionStockListEntity::getId, inventoryIds);
if (Func.isNotEmpty(addValueDTO.get("materialName"))){
inventoryQW.like(DistributionStockListEntity::getDescriptionGoods,addValueDTO.get("materialName"));
if (Func.isNotEmpty(addValueDTO.get("materialName"))) {
inventoryQW.like(DistributionStockListEntity::getDescriptionGoods, addValueDTO.get("materialName"));
}
if (Func.isNotEmpty(addValueDTO.get("materialCode"))){
inventoryQW.like(DistributionStockListEntity::getCargoNumber,addValueDTO.get("materialCode"));
if (Func.isNotEmpty(addValueDTO.get("materialCode"))) {
inventoryQW.like(DistributionStockListEntity::getCargoNumber, addValueDTO.get("materialCode"));
}
List<DistributionStockListEntity> stockListEntityList = distributionStockListService.list(inventoryQW);
stockListEntityList.forEach(inven->{
List<DistributionAddvaluePackageVO> addvalueinventoryPackageVO = distributionAddvalueMapper.selectAddvalueInventoryPackageVO(Long.parseLong(reservationId),inven.getId(),addValueDTO);
if (Func.isNotEmpty(addvalueinventoryPackageVO)){
stockListEntityList.forEach(inven -> {
List<DistributionAddvaluePackageVO> addvalueinventoryPackageVO = distributionAddvalueMapper.selectAddvalueInventoryPackageVO(Long.parseLong(reservationId), inven.getId(), addValueDTO);
if (Func.isNotEmpty(addvalueinventoryPackageVO)) {
addvaluePackageVOS.addAll(addvalueinventoryPackageVO);
}
});

Loading…
Cancel
Save