Browse Source

回库任务防止重复提交和扫描

dist.1.3.0
汤建军 4 months ago
parent
commit
90db5a8b01
  1. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml
  2. 8
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseRetentionRecordServiceImpl.java
  3. 8
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseRetentionScanServiceImpl.java

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

@ -2175,8 +2175,8 @@
is_deleted = 0 AND scan_status != 1 ), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM
logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted =
0 ), 0 ) AS loadingQuantity,
IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND
is_deleted = 0 AND scan_status != 1 AND signfor_state = 2), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM
IFNULL(( SELECT SUM( receivedin_quantity ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND
is_deleted = 0 AND scan_status != 1 AND signfor_state = 2), 0 ) + IFNULL(( SELECT SUM( receivedin_quantity ) FROM
logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted =
0 AND signfor_state = 2 ), 0 ) AS signforQuantity,
( SELECT IFNULL( GROUP_CONCAT( stockup_area ), '无备货区' ) FROM logpm_distribution_stock WHERE reservation_id =

8
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseRetentionRecordServiceImpl.java

@ -48,6 +48,7 @@ import org.springblade.common.constant.retention.RetentionTypeConstant;
import org.springblade.common.exception.CustomerException;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
@ -84,6 +85,7 @@ public class WarehouseRetentionRecordServiceImpl extends BaseServiceImpl<Warehou
private final IDistributionReservationClient distributionReservationClient;
private final IDistributionSignforClient distributionSignforClient;
private final IDistributionLoadscanAbnormalClient distributionLoadscanAbnormalClient;
private final BladeRedis redis;
@Override
public IPage<WarehouseRetentionRecordVO> selectWarehouseRetentionRecordPage(IPage<WarehouseRetentionRecordVO> page, WarehouseRetentionRecordVO warehouseRetentionRecord) {
@ -454,6 +456,10 @@ public class WarehouseRetentionRecordServiceImpl extends BaseServiceImpl<Warehou
}
AtomicBoolean saveFlah = new AtomicBoolean(false);
for (WarehouseRetentionScanEntity warehouseRetentionScanEntity : retentionScanEntityList) {
String isLock = redis.get(AuthUtil.getTenantId() + ":warehouse:" + warehouseRetentionScanEntity.getWarehouseId() + ":retentionTaskCode:" + warehouseRetentionScanEntity.getTaskCode() + ":orderPackageCode:" + warehouseRetentionScanEntity.getOrderPackageCode());
if (!isLock.isEmpty()) {
return Resp.scanFail("请勿频繁操作!!!", "请勿频繁操作!!!");
}
switch (warehouseRetentionScanEntity.getConditions()) {
case 1:
//订制品
@ -483,6 +489,7 @@ public class WarehouseRetentionRecordServiceImpl extends BaseServiceImpl<Warehou
break;
}
if (saveFlah.get()) {
redis.del(AuthUtil.getTenantId() + ":warehouse:" + warehouseRetentionScanEntity.getWarehouseId() + ":orderPackageCode:" + warehouseRetentionScanEntity.getOrderPackageCode()+ ":retentionSave:"+warehouseRetentionScanEntity.getTaskCode());
warehouseRetentionScanEntity.setConfirmStatus(true);
warehouseRetentionScanEntity.setRetentionScanUsername(AuthUtil.getNickName());
warehouseRetentionScanEntity.setRetentionScanUserId(AuthUtil.getUserId());
@ -495,6 +502,7 @@ public class WarehouseRetentionRecordServiceImpl extends BaseServiceImpl<Warehou
distributionLoadscanAbnormalClient.completeAbnormal(warehouseRetentionScanEntity.getAbnormalId());
}
}
redis.setEx(AuthUtil.getTenantId() + ":warehouse:" + warehouseRetentionScanEntity.getWarehouseId() + ":retentionTaskCode:" , warehouseRetentionScanEntity.getTaskCode() + ":orderPackageCode:" + warehouseRetentionScanEntity.getOrderPackageCode(),60L);
}
if (saveFlah.get()) {
return Resp.scanSuccess("操作成功", "操作成功");

8
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseRetentionScanServiceImpl.java

@ -42,6 +42,7 @@ import org.springblade.common.constant.common.IsOrNoConstant;
import org.springblade.common.constant.loading.LoadingAbnormalAuditingStatusConstant;
import org.springblade.common.constant.loading.LoadingAbnormalTypeConstant;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
@ -54,6 +55,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
@ -74,6 +76,7 @@ public class WarehouseRetentionScanServiceImpl extends BaseServiceImpl<Warehouse
private IDistributionSignforClient distributionSignforClient;
private IDistributionLoadscanAbnormalClient distributionLoadscanAbnormalClient;
private BladeRedis redis;
// private IWarehouseRetentionRecordService retentionRecordService;
@ -141,6 +144,10 @@ public class WarehouseRetentionScanServiceImpl extends BaseServiceImpl<Warehouse
@Override
public R saveEntity(WarehouseRetentionScanEntity warehouseRetentionScan) {
//进行异常新增
String isLock = redis.get(AuthUtil.getTenantId() + ":warehouse:" + warehouseRetentionScan.getWarehouseId() + ":orderPackageCode:" + warehouseRetentionScan.getOrderPackageCode()+ ":retentionSave:");
if (!Objects.isNull(isLock)){
return Resp.scanFail("请勿频繁操作!!!","请勿频繁操作!!!");
}
DistributionLoadscanAbnormalEntity distributionLoadscanAbnormalEntity = new DistributionLoadscanAbnormalEntity();
distributionLoadscanAbnormalEntity.setDeliveryListId(warehouseRetentionScan.getDeliveryId());
distributionLoadscanAbnormalEntity.setReservationId(warehouseRetentionScan.getReservationId());
@ -161,6 +168,7 @@ public class WarehouseRetentionScanServiceImpl extends BaseServiceImpl<Warehouse
warehouseRetentionScan.setTaskCode(reservationClient.getRetentionMa());
warehouseRetentionScan.setAbnormalId(abnormalId);
this.save(warehouseRetentionScan);
redis.setEx(AuthUtil.getTenantId() + ":warehouse:" + warehouseRetentionScan.getWarehouseId() + ":orderPackageCode:" + warehouseRetentionScan.getOrderPackageCode()+ ":retentionSave:",warehouseRetentionScan.getTaskCode(),60L*3L);
distributionSignforClient.updateIsHaveAbnormalPackage(warehouseRetentionScan.getReservationId());
return R.success("操作成功");
}

Loading…
Cancel
Save