From 43ab208a36e2469597f959fff8e8f855885f06b7 Mon Sep 17 00:00:00 2001 From: "pref_mail@163.com" Date: Thu, 5 Sep 2024 18:29:09 +0800 Subject: [PATCH] =?UTF-8?q?add:=E5=A2=9E=E5=8A=A0=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E7=9A=84=E6=95=B0=E6=8D=AE=E6=8E=A8=E9=80=81?= =?UTF-8?q?=201.=E9=A2=84=E7=BA=A6=202.=E5=A4=87=E8=B4=A7=202.=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E9=A2=84=E7=BA=A6=203.=E9=85=8D=E9=80=81=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E5=88=9B=E5=BB=BA/=E7=BC=96=E8=BE=91=204.=E8=A3=85?= =?UTF-8?q?=E8=BD=A6=205.=E7=AD=BE=E6=94=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/constant/ModuleNameConstant.java | 2 +- .../constant/broadcast/FanoutConstants.java | 51 +- .../common/model/DistributionLoadVO.java | 33 + .../common/model/DistributionSignforVO.java | 23 + .../common/model/DistributionTaskVO.java | 31 + .../common/model/NodeFanoutMsg.java | 5 +- .../common/model/PlanDriverbindCarVO.java | 14 + .../common/model/ReservationVO.java | 66 ++ .../impl/BasicdataClientLogServiceImpl.java | 50 +- .../DistributionDeliveryAppController.java | 11 +- .../api/DistributionStockupAppController.java | 709 +--------------- .../DistributionReservationController.java | 7 +- .../DistributionSignforController.java | 4 +- .../DistributionDeliveryListMapper.java | 15 +- .../mapper/DistributionDeliveryListMapper.xml | 32 + .../receiver/report/PlanReportListener.java | 4 +- .../IDistributionDeliveryListService.java | 7 + .../service/IDistributionNodeWorkService.java | 20 +- .../service/IDistributionStockupService.java | 13 + .../DistributionDeliveryListServiceImpl.java | 478 +++++++++-- .../impl/DistributionNodeWorkServiceImpl.java | 167 +--- .../DistributionReservationServiceImpl.java | 165 +++- .../impl/DistributionSignforServiceImpl.java | 181 +++- .../impl/DistributionStockupServiceImpl.java | 802 +++++++++++++++++- 24 files changed, 1899 insertions(+), 991 deletions(-) create mode 100644 blade-biz-common/src/main/java/org/springblade/common/model/DistributionLoadVO.java create mode 100644 blade-biz-common/src/main/java/org/springblade/common/model/DistributionSignforVO.java create mode 100644 blade-biz-common/src/main/java/org/springblade/common/model/DistributionTaskVO.java create mode 100644 blade-biz-common/src/main/java/org/springblade/common/model/PlanDriverbindCarVO.java create mode 100644 blade-biz-common/src/main/java/org/springblade/common/model/ReservationVO.java diff --git a/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java b/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java index d60420fe5..4708feb7c 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java +++ b/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java @@ -9,7 +9,7 @@ public interface ModuleNameConstant { /** * 如果不需要 "" */ - public static final String DEVAUTH =""; + public static final String DEVAUTH ="-pref"; /** * 工厂对接服务名称 diff --git a/blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java b/blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java index 17f6b6a08..ef7dc6d9d 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java +++ b/blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java @@ -154,14 +154,35 @@ public abstract class FanoutConstants { // } + } + + /** + * 预约 + */ + public interface reservation { + + // 自主预约 + interface OwnReservation { + String EXCHANGE = "fanout.reservation.own" + ModuleNameConstant.DEVAUTH; + + interface QUEUE { + + } + } + + + } + + + /** * 配送 */ public interface distribution { // 配送计划 - interface plan { + interface DeliveryAndPlan { String EXCHANGE = "fanout.distribution.plan" + ModuleNameConstant.DEVAUTH; // main: {"distributionCompany":"承运商", "driverName":"司机姓名", "id":"任务ID", "kind":"任务类型 1-自主 2-外协", "taskTime":"任务时间", "trainNumber":"车次号","type":"配送类型 1商配 2市配", "vehicleName":"车牌号"} @@ -172,9 +193,35 @@ public abstract class FanoutConstants { // 备货节点 interface stock { + String EXCHANGE = "fanout.distribution.stock" + ModuleNameConstant.DEVAUTH; - // main: {"distributionCompany":"承运商", "driverName":"司机姓名", "id":"任务ID", "kind":"任务类型 1-自主 2-外协", "taskTime":"任务时间", "trainNumber":"车次号","type":"配送类型 1商配 2市配", "vehicleName":"车牌号"} + // main: {"id":"备货任务ID", "stockupCode":"备货编码", "typeService":"服务类型 1 商 2 市 3 自", "stockupDate":"备货时间"} + interface QUEUE { + + } + } + + // 装车节点 + interface DeliveryAndLoading { + + String EXCHANGE = "fanout.distribution.load" + ModuleNameConstant.DEVAUTH; + + // main: {"id":"备货任务ID", "stockupCode":"备货编码", "typeService":"服务类型 1 商 2 市 3 自", "stockupDate":"备货时间"} + interface QUEUE { + + } + } + + + /** + * 签收 + */ + interface DeliveryAndSignfor { + + String EXCHANGE = "fanout.distribution.signfor2" + ModuleNameConstant.DEVAUTH; + + // main: {"id":"备货任务ID", "stockupCode":"备货编码", "typeService":"服务类型 1 商 2 市 3 自", "stockupDate":"备货时间"} interface QUEUE { } diff --git a/blade-biz-common/src/main/java/org/springblade/common/model/DistributionLoadVO.java b/blade-biz-common/src/main/java/org/springblade/common/model/DistributionLoadVO.java new file mode 100644 index 000000000..bed12b748 --- /dev/null +++ b/blade-biz-common/src/main/java/org/springblade/common/model/DistributionLoadVO.java @@ -0,0 +1,33 @@ +package org.springblade.common.model; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 装车/签收VO + */ +@Data +public class DistributionLoadVO implements Serializable { + + /** + * 装车表ID + */ + private Long id; + + /** + * 司机名 + */ + private String driverName; + /** + * 车牌号 + */ + private String vehicleName; + + /** + * 预约单号 + */ + private String reservationCode; + + +} diff --git a/blade-biz-common/src/main/java/org/springblade/common/model/DistributionSignforVO.java b/blade-biz-common/src/main/java/org/springblade/common/model/DistributionSignforVO.java new file mode 100644 index 000000000..627567e43 --- /dev/null +++ b/blade-biz-common/src/main/java/org/springblade/common/model/DistributionSignforVO.java @@ -0,0 +1,23 @@ +package org.springblade.common.model; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class DistributionSignforVO implements Serializable { + /** + * 司机名 + */ + private String driverName; + /** + * 车牌号 + */ + private String vehicleName; + + /** + * 预约单号 + */ + private String reservationCode; + +} diff --git a/blade-biz-common/src/main/java/org/springblade/common/model/DistributionTaskVO.java b/blade-biz-common/src/main/java/org/springblade/common/model/DistributionTaskVO.java new file mode 100644 index 000000000..b521aba0d --- /dev/null +++ b/blade-biz-common/src/main/java/org/springblade/common/model/DistributionTaskVO.java @@ -0,0 +1,31 @@ +package org.springblade.common.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 配送计划 + */ +@Data +public class DistributionTaskVO implements Serializable { + private String distributionCompany; + + private Long id; + private String kind; + private String taskTime; + private String trainNumber; + private String type; + /** + * 司机名 + */ + private String driverName; + /** + * 车牌号 + */ + private String vehicleName; + + private List planDriverbindCars; +} diff --git a/blade-biz-common/src/main/java/org/springblade/common/model/NodeFanoutMsg.java b/blade-biz-common/src/main/java/org/springblade/common/model/NodeFanoutMsg.java index e9c1105cb..d6f609962 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/model/NodeFanoutMsg.java +++ b/blade-biz-common/src/main/java/org/springblade/common/model/NodeFanoutMsg.java @@ -23,7 +23,7 @@ import java.util.List; @Data @NoArgsConstructor @AllArgsConstructor -public class NodeFanoutMsg implements Serializable { +public class NodeFanoutMsg implements Serializable { /** * 作业节点 @@ -50,6 +50,7 @@ public class NodeFanoutMsg implements Serializable { * 当前仓 */ private String warehouse; + /** * 当前仓ID */ @@ -66,7 +67,7 @@ public class NodeFanoutMsg implements Serializable { * 主单数据 * {"boId":"业务id","":""} */ - private Object main; + private T main; /** * 内容 diff --git a/blade-biz-common/src/main/java/org/springblade/common/model/PlanDriverbindCarVO.java b/blade-biz-common/src/main/java/org/springblade/common/model/PlanDriverbindCarVO.java new file mode 100644 index 000000000..0a4cd9cb2 --- /dev/null +++ b/blade-biz-common/src/main/java/org/springblade/common/model/PlanDriverbindCarVO.java @@ -0,0 +1,14 @@ +package org.springblade.common.model; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class PlanDriverbindCarVO implements Serializable { + + private String driverName; + + private String carPlate; + +} diff --git a/blade-biz-common/src/main/java/org/springblade/common/model/ReservationVO.java b/blade-biz-common/src/main/java/org/springblade/common/model/ReservationVO.java new file mode 100644 index 000000000..bbb7e4459 --- /dev/null +++ b/blade-biz-common/src/main/java/org/springblade/common/model/ReservationVO.java @@ -0,0 +1,66 @@ +package org.springblade.common.model; + + +import lombok.Data; + +import java.util.Date; + +/** + * 预约作业节点VO + */ +@Data +public class ReservationVO { + + private Long id; + + /** + * 预约单号 + */ + private String reservationCode; + + + /** + * 预约时间 + */ + private Date reservationDate; + + /** + * 收货人 + */ + private String consignee; + /** + * 收件地址 + */ + private String deliveryAddress; + + /** + * 收件电话 + */ + private String deliveryPhone; + + /** + * 商场名称 + */ + private String mallName; + + + /** + * 门店名称 + */ + private String storeName; + + /** + * 仓库名称 + */ + private String warehouseName; + + + /** + * 配送类型;1-商配、2-市配 + */ + private String deliveryType; + + + + +} diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataClientLogServiceImpl.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataClientLogServiceImpl.java index e10e8915c..a1471df8b 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataClientLogServiceImpl.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataClientLogServiceImpl.java @@ -16,59 +16,15 @@ */ package com.logpm.basicdata.service.impl; -import cn.hutool.core.collection.CollUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.Wrapper; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; -import com.baomidou.mybatisplus.core.toolkit.StringUtils; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.logpm.basic.entity.BasicTenantCodeEntity; -import com.logpm.basic.feign.IBasicTenantCodeClient; -import com.logpm.basicdata.entity.*; -import com.logpm.basicdata.excel.BasicdataClientExcel; +import com.logpm.basicdata.entity.BasicdataClientLogEntity; import com.logpm.basicdata.mapper.BasicdataClientLogMapper; -import com.logpm.basicdata.mapper.BasicdataClientMapper; -import com.logpm.basicdata.service.*; -import com.logpm.basicdata.vo.BasicdataClientVO; -import com.logpm.basicdata.vo.ClientInfoVO; +import com.logpm.basicdata.service.IBasicdataClientLogService; import lombok.extern.slf4j.Slf4j; -import org.springblade.common.constant.DictBizConstant; -import org.springblade.common.constant.RedisKeyConstant; -import org.springblade.common.constant.basiccode.BasicCodeShowConstant; -import org.springblade.common.constant.basiccode.BasicCodeTypeConstant; -import org.springblade.common.model.dto.NameDTO; -import org.springblade.core.excel.util.ExcelUtil; -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; -import org.springblade.core.tool.utils.BeanUtil; -import org.springblade.core.tool.utils.Func; -import org.springblade.core.tool.utils.ObjectUtil; -import org.springblade.system.cache.DictBizCache; -import org.springblade.system.entity.DictBiz; -import org.springblade.system.feign.IRegionFeign; -import org.springblade.system.feign.IUserClient; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.InitBinder; -import org.springframework.web.multipart.MultipartFile; import javax.annotation.PostConstruct; -import java.security.NoSuchAlgorithmException; -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.function.Predicate; -import java.util.stream.Collectors; - -import static org.springblade.common.constant.DictBizConstant.OPEN_ORDER_PAY_WAY; +import java.util.List; /** * 基础客户表 服务实现类 diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionDeliveryAppController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionDeliveryAppController.java index 0eafb8cca..1cfb6b602 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionDeliveryAppController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionDeliveryAppController.java @@ -258,16 +258,7 @@ public class DistributionDeliveryAppController { return msg; } -// /** -// * 配送管理 配送库存品装车 -// */ -// @PostMapping("/loadinginventoryDe") -// @ApiOperationSupport(order = 7) -// @ApiOperation(value = "库存品装车", notes = "传入DistrilbutionloadingscanDTO") -// public R loadinginventoryDe(@Valid @RequestBody DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) { -// R msg = distributionDeliveryListService.loadinginventoryDe(distrilbutionloadingscanDTO); -// return msg; -// } + /** * 配送管理 装车扫描(取消) diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionStockupAppController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionStockupAppController.java index 3d52491c5..006b75fda 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionStockupAppController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionStockupAppController.java @@ -59,6 +59,7 @@ import org.springblade.common.constant.reservation.ReservationSigningStatusConst import org.springblade.common.constant.stockup.StockupTypeStatusConstant; import org.springblade.common.enums.BizOperationEnums; import org.springblade.common.enums.PackageTypeEnums; +import org.springblade.common.exception.CustomerException; import org.springblade.common.model.NodeFanoutMsg; import org.springblade.common.model.PackageData; import org.springblade.common.utils.CommonUtil; @@ -746,8 +747,6 @@ public class DistributionStockupAppController extends BladeController { } - - //todo 这里代码没有写完 等TJJ 和CYZ 空了来写 @ResponseBody @PostMapping("/updateStockup") @@ -1006,32 +1005,20 @@ public class DistributionStockupAppController extends BladeController { @ApiOperation(value = "备货扫描", notes = "传入stockupDTO") public R stockupScan(@RequestBody StockupDTO stockupDTO) { Integer scanType = stockupDTO.getScanType();//扫码类型 1 包件 2库存品 -//手动 -// TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); -// try{ - //设置lockey String lockKey = "Lock:" + stockupDTO.getPacketBarCode() + stockupDTO.getStockupId(); log.info("#################stockupScan:获取redisson对象开始"); -// RLock lock = redisson.getLock(lockKey); -// if (lock.isLocked()) { -// String audioValue2 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.chongfusaomiao.getValue()); -// return Resp.scanFail(PdaAudioLingoStatus.chongfusaomiao.getName(), audioValue2); -// } -// lock.lock(5, TimeUnit.SECONDS); if (redis.exists(lockKey)) { String audioValue2 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.chongfusaomiao.getValue()); return Resp.scanFail(PdaAudioLingoStatus.chongfusaomiao.getName(), audioValue2); } redis.setEx(lockKey, stockupDTO.getPacketBarCode() + stockupDTO.getStockupId(), 5L); - if (scanType == 1) { //包件 - return stockupScanByCustom(stockupDTO); - + return distributionStockupService.stockupScanByCustom(stockupDTO); } else if (scanType == 2) { //库存平 - R fail = stockupScanByStock(stockupDTO); + R fail = distributionStockupService.stockupScanByStock(stockupDTO); if (fail != null) { return fail; } @@ -1043,695 +1030,5 @@ public class DistributionStockupAppController extends BladeController { } - /** - * 库存品扫码 - * - * @param stockupDTO - * @return - */ - @Nullable - private R stockupScanByStock(StockupDTO stockupDTO) { - //库存品扫描 - Long reservationId = stockupDTO.getReservationId(); - Long stockListId = stockupDTO.getStockListId(); - String packetBarCode = stockupDTO.getPacketBarCode(); -// String stockupArea = stockupDTO.getStockupArea();//备货区 - Long stockupId = stockupDTO.getStockupId();//备货区 - Long allocationId = stockupDTO.getAllocationId();//备货区 - Integer stockPrint = stockupDTO.getStockPrint(); // 库存 - BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); - if (Func.isEmpty(myCurrentWarehouse)) { - return R.data(403, "未授权!!!"); - } - if (StringUtil.isBlank(packetBarCode)) { - log.warn("##################stockupScan: 库存品扫码,包件码为空"); - return R.fail("库存品扫码:包件码不能为空"); - } - - if (ObjectUtils.isNull(stockupId)) { - log.warn("##################stockupScan: 库存品扫码,备货区为空"); - return R.fail("库存品扫码:备货任务ID不能为空"); - } -// if (Objects.isNull(stockListId)) { -// log.warn("##################stockupScan: 库存品扫码,库存品id为空"); -// return R.fail("库存品扫码:库存品id不能为空"); -// } - if (Objects.isNull(reservationId)) { - log.warn("##################stockupScan: 库存品扫码,预约单id为空"); - return R.fail("库存品扫码:预约单id不能为空"); - } - if (Objects.isNull(stockPrint)) { - log.warn("##################stockupScan: 库存品扫码,类型为空"); - return R.fail("库存品扫码:类型不能为空"); - } - if (Objects.isNull(allocationId)) { - log.warn("##################allocationId: 货位ID为空!"); - return R.fail("货位ID不能为空"); - } - //判断是否可以继续备货 - DistributionStockListEntity byId = null; -// if (ObjectUtils.isNull(stockListId)) { - // 通过扫码的二维码 查询其对应的库存存信息 - if (stockupDTO.getStockPrint() == 1) { - //1 原有包条 - byId = distributionStockListService.selectStockInforByOrderPackageCode(stockupDTO.getPacketBarCode()); - } else { - - // 判断stockupDTO.getMallName() 是否存在 - if (ObjectUtils.isNull(stockupDTO.getMallName()) || "null".equals(stockupDTO.getMallName())) { - // 查询出来 重新复制 - DistributionStockListEntity byId1 = distributionStockListService.getById(stockupDTO.getStockListId()); - log.info("##################stockupScan: 库存品扫码,库存品id{}",byId1); - if (!ObjectUtils.isNull(byId1)) { - stockupDTO.setMallName(byId1.getMarketName()); - } - } - - // 2打印处理的扫码 - // 查询当前库位上最早入库的指定物料库存品 - byId = disStockOrdercodeRecoService.selectStockOrdercodeRecoListByCode(stockupDTO.getCargoNumber(), stockupDTO.getAllocationId(), stockupDTO.getMallName()); - - // 需要判断当前这个找到的备货批次和计划的批次是否一直,如果不一致 就需要新增一个预约备货记录 扣减当前的数量 -// updateStockOrdercodeRecoS(reservationId,byId); - - if (Func.isEmpty(byId)) { - return Resp.scanFail("当前库位无此物料库存品", "当前库位无此物料库存品"); - } - //判断当前库位上满足条件的库存品是否存在于预约计划中,如果不存在则需要对预约计划进行修改 - List reservationStocklistEntityList = distributionReservationMapper.selectInventoryListByIdAndMateriel(stockupDTO.getReservationId(), stockupDTO.getCargoNumber()); - if (Func.isNotEmpty(reservationStocklistEntityList)) { - DistributionStockListEntity finalById = byId; - boolean flag = reservationStocklistEntityList.stream() - .map(DistributionReservationStocklistEntity::getStocklistId) - .anyMatch(s -> s.equals(finalById.getId())); - if (!flag) { - DistributionReservationStocklistEntity rs = new DistributionReservationStocklistEntity(); - rs.setReservationNum(1); - rs.setStockListStatus(ReservationOrderStatusConstant.zengjia.getValue()); - rs.setReservationId(stockupDTO.getReservationId()); - rs.setRealityNum(0); - rs.setUnit(byId.getCargoUnit()); - rs.setLoadingStatus(ReservationLoadingStatusConstant.daizhuangche.getValue()); - rs.setSigningStatus(ReservationSigningStatusConstant.daiqianshou.getValue()); - rs.setStocklistId(byId.getId()); - distributionReservationStocklistService.save(rs); - - DistributionStockListEntity stockListEntity = distributionStockListService.getById(byId.getId()); - stockListEntity.setQuantityOccupied(stockListEntity.getQuantityOccupied() + 1); - distributionStockListService.updateById(stockListEntity); - - //原来对应的需要进行计划减少 - //收集满足修改条件的计划库存品 - List reservationStocklistEntities = new ArrayList<>(); - for (DistributionReservationStocklistEntity reservationStocklistEntity : reservationStocklistEntityList) { - if (reservationStocklistEntity.getReservationNum() >= reservationStocklistEntity.getRealityNum() && reservationStocklistEntity.getReservationNum() > 0) { - reservationStocklistEntities.add(reservationStocklistEntity); - } - } - if (Func.isEmpty(reservationStocklistEntities)) { - return R.fail("该物料库存品备货已完成"); - } - DistributionReservationStocklistEntity reservationStocklistEntity = reservationStocklistEntities.get(0); - int oldRsNum = reservationStocklistEntity.getReservationNum() - 1; - if (oldRsNum < 0) { - return R.fail("操作数据错误"); - } - reservationStocklistEntity.setReservationNum(oldRsNum); - if (reservationStocklistEntity.getReservationNum() == 0) { - reservationStocklistEntity.setStockListStatus(ReservationOrderStatusConstant.quxiao.getValue()); - } - distributionReservationStocklistService.updateById(reservationStocklistEntity); - - //维护老的的冻结数量 - DistributionStockListEntity oldStockList = distributionStockListService.getById(reservationStocklistEntity.getStocklistId()); - oldStockList.setQuantityOccupied(oldStockList.getQuantityOccupied() - 1); - distributionStockListService.updateById(oldStockList); - - - //查询对应的包件进行修改 - List stockListDetailEntities = disStockListDetailService.list(Wrappers.query().lambda() - .eq(DisStockListDetailEntity::getReservationId, stockupDTO.getReservationId()) - .eq(DisStockListDetailEntity::getStockListId, oldStockList.getId()) - .ne(DisStockListDetailEntity::getStockPackageStatus, ReservationPackageStatusConstant.quxiao.getValue()) - ); - DisStockListDetailEntity disStockListDetailEntity = stockListDetailEntities.stream().filter(s -> Func.isBlank(s.getStockPackageCode())).collect(Collectors.toList()).get(0); - disStockListDetailEntity.setStockListId(rs.getStocklistId()); -// disStockListDetailEntity.setStockStatus(OrderPackageStockupStatusConstant.yibeihu.getValue()); - disStockListDetailService.updateById(disStockListDetailEntity); - } else { - //判断是否是为增加库存品进行数据维护 - DistributionStockListEntity finalById1 = byId; - DistributionReservationStocklistEntity reservationStocklistEntity = reservationStocklistEntityList.stream().filter(f -> f.getStocklistId().equals(finalById1.getId())).collect(Collectors.toList()).get(0); - //因为新增库存品的时候会完成扫描 此时的增加数和备货数量时一样的 - if (reservationStocklistEntity.getStockListStatus().equals(ReservationOrderStatusConstant.zengjia.getValue()) && Objects.equals(reservationStocklistEntity.getReservationNum(), reservationStocklistEntity.getRealityNum())) { - List oldRS = distributionReservationMapper.selectStockListByReservationIdAndCargoNumber(reservationStocklistEntity.getReservationId(), stockupDTO.getCargoNumber(), reservationStocklistEntity.getStocklistId()); - //收集满足条件的库存品 - List rs = new ArrayList<>(); - for (DistributionReservationStocklistEntity oldR : oldRS) { - if (oldR.getReservationNum() >= oldR.getRealityNum() && oldR.getReservationNum() > 0) { - rs.add(oldR); - } - } - if (Func.isEmpty(rs)) { - //不存在还需要进行备货的库存品 - return R.fail("该物料库存品备货已完成"); - } - DistributionReservationStocklistEntity oldReservationStockList = rs.get(0); - int oldReservationNum = oldReservationStockList.getReservationNum() - 1; - - oldReservationStockList.setReservationNum(oldReservationNum); - if (oldReservationNum == 0) { - oldReservationStockList.setStockListStatus(ReservationOrderStatusConstant.quxiao.getValue()); - } - distributionReservationStocklistService.updateById(oldReservationStockList); - //修改对应库存品数量 - DistributionStockListEntity stockListEntity = distributionStockListService.getById(oldReservationStockList.getStocklistId()); - stockListEntity.setQuantityOccupied(stockListEntity.getQuantityOccupied() - 1); - distributionStockListService.updateById(stockListEntity); - - - //找出对库存品包件信息进行包件的修改 - List oldRsPack = disStockListDetailService.list(Wrappers.query().lambda() - .eq(DisStockListDetailEntity::getReservationId, oldReservationStockList.getReservationId()) - .eq(DisStockListDetailEntity::getStockListId, oldReservationStockList.getStocklistId()) - .ne(DisStockListDetailEntity::getStockPackageStatus, ReservationPackageStatusConstant.quxiao.getValue()) - ); - if (Func.isEmpty(oldRsPack)) { - return R.fail("该物料库存品备货已完成"); - } - List collect = oldRsPack.stream().filter(f -> Func.isBlank(f.getStockPackageCode())).collect(Collectors.toList()); - DisStockListDetailEntity disStockListDetailEntity = collect.get(0); - disStockListDetailEntity.setStockListId(reservationStocklistEntity.getStocklistId()); -// disStockListDetailEntity.setStockStatus(OrderPackageStockupStatusConstant.yibeihu.getValue()); - disStockListDetailService.updateById(disStockListDetailEntity); - - reservationStocklistEntity.setReservationNum(reservationStocklistEntity.getReservationNum() + 1); - distributionReservationStocklistService.updateById(reservationStocklistEntity); - - - //维护库存品在库数量 - DistributionStockListEntity newStockList = distributionStockListService.getById(reservationStocklistEntity.getStocklistId()); - newStockList.setQuantityOccupied(newStockList.getQuantityOccupied() + 1); - distributionStockListService.updateById(newStockList); - } - } - //当前库位最先入库的批次和计划批次一致 - } - } - if (Func.isNotEmpty(byId)) { - stockupDTO.setStockListId(byId.getId()); - } - -// } else { -// byId = distributionStockListService.getById(stockListId); -// } - - List locationInformation; - if ("2".equals(byId.getSourceType())) { - //导入 - WarehouseUpdownGoodsEntity warehouseUpdownGoodsEntity = new WarehouseUpdownGoodsEntity(); - warehouseUpdownGoodsEntity.setAllocationId(stockupDTO.getAllocationId()); - warehouseUpdownGoodsEntity.setIncomingBatch(byId.getIncomingBatch()); - warehouseUpdownGoodsEntity.setMarketId(byId.getMarketId()); - warehouseUpdownGoodsEntity.setAssociationId(byId.getMaterialId()); - warehouseUpdownGoodsEntity.setAssociationValue(byId.getCargoNumber()); - warehouseUpdownGoodsEntity.setAssociationType("4"); - warehouseUpdownGoodsEntity.setWarehouseId(byId.getWarehouseId()); - locationInformation = warehouseUpdownGoodsClient.getLocationStockListInformation(warehouseUpdownGoodsEntity); - if (locationInformation.isEmpty()) { - return Resp.scanFail("当前货位的库存品已为零,请更换货位继续!!", "当前货位的库存品已为零,请更换货位继续!!"); - } - } else { - // 读取码表上的配置项 是否开启验证批次号 - String isCheckIncomingBatch = DictBizCache.getValue("isCheckIncomingBatch", "isCheckIncomingBatch"); - List list = distributionParcelListService.list(Wrappers.query().lambda() - .eq(DistributionParcelListEntity::getOrderPackageCode, packetBarCode) - .eq(DistributionParcelListEntity::getOrderCode, byId.getIncomingBatch()) - .eq(DistributionParcelListEntity::getWarehouseId, byId.getWarehouseId()) - ); - - //查询包件信息 - if (ObjectUtils.isNotNull(list) && list.size() > 1) { - return Resp.scanFail("查询到重复包条信息!!", "查询到重复包条信息!!"); - } - if (ObjectUtils.isNull(list)) { - return Resp.scanFail("没有查询到包件信息!", "没有查询到包件信息 ! "); - } - - log.info(">>>>> obj {}", list.get(0).getConditions()); - DistributionParcelListEntity distributionParcelListEntity = list.get(0); - - - if (2 != distributionParcelListEntity.getConditions()) { - return Resp.scanFail("当前包件不是库存品,无法备货!!", "当前包件不是库存品,无法备货!!"); - } - - - WarehouseUpdownGoodsEntity warehouseUpdownGoodsEntity = new WarehouseUpdownGoodsEntity(); - warehouseUpdownGoodsEntity.setAllocationId(stockupDTO.getAllocationId()); - warehouseUpdownGoodsEntity.setAssociationId(list.get(0).getId()); - warehouseUpdownGoodsEntity.setAssociationType("3"); - warehouseUpdownGoodsEntity.setWarehouseId(byId.getWarehouseId()); - locationInformation = warehouseUpdownGoodsClient.getLocationStockListInformation(warehouseUpdownGoodsEntity); - if (locationInformation.isEmpty()) { - return Resp.scanFail("当前货位没有该包件信息!!", "当前货位没有该包件信息!!"); - } - } - //有数数据校验 修改库存品数据 - if ("1".equals(byId.getSourceType())) { - R r1 = distributionStockupService.handlingPackages(stockupDTO); - if (r1.getCode() != 200) { - Resp.scanFail(r1.getMsg(), r1.getMsg()); - } - } - Integer i = distributionStockupService.selectPackagePrint(stockupDTO); - switch (i) { - case 1: - //绑定 - Integer integer = distributionStockupService.selectPackage(stockupDTO); - switch (integer) { - case 1: - DistributionStockupEntity stockupEntity = distributionStockupService.getById(stockupDTO.getStockupId()); - //先保存扫码包件信息,后续由队列来出来余下补充信息 - DistributionStockEntity entity = new DistributionStockEntity(); - entity.setCoding(packetBarCode); - DistributionStockupEntity byId1 = distributionStockupService.getById(stockupId); - entity.setStockupArea(byId1.getStockupArea()); - entity.setStockupId(stockupId); - entity.setStockQuantity(1); - entity.setScanUser(AuthUtil.getUser().getNickName()); - if ("3".equals(stockupEntity.getTypeService())) { - entity.setBillLadingId(reservationId); - } else { - entity.setReservationId(reservationId); - } - entity.setReservationId(reservationId); - entity.setStockListId(stockupDTO.getStockListId()); - //添加物料信息 -// DistributionStockListEntity byId = iDistributionStockListService.getById(stockListId); - if (ObjectUtils.isNotNull(byId.getMarketId())) { - entity.setMarketId(byId.getMarketId()); - entity.setMaterialId(byId.getMaterialId()); -// WarehouseUpdownGoodsEntity warehouseUpdownGoodsEntity = new WarehouseUpdownGoodsEntity(); -// warehouseUpdownGoodsEntity.setAllocationId(stockupDTO.getAllocationId()); -// warehouseUpdownGoodsEntity.setIncomingBatch(byId.getIncomingBatch()); -// warehouseUpdownGoodsEntity.setMarketId(byId.getMarketId()); -// warehouseUpdownGoodsEntity.setAssociationType("4"); -// WarehouseUpdownGoodsEntity locationInformation = warehouseUpdownGoodsClient.getLocationStockListInformation(warehouseUpdownGoodsEntity); - if (!locationInformation.isEmpty()) { - if ("2".equals(byId.getSourceType())) { - //导入下架 - entity.setAllocationTitle(locationInformation.get(0).getPositionCode()); - entity.setAllocationId(stockupDTO.getAllocationId()); - //todo 待下架操作 - JSONObject jsonObject = new JSONObject(); - jsonObject.put("marketId", byId.getMarketId()); - jsonObject.put("materialCode", byId.getCargoNumber()); - jsonObject.put("warehouseId", byId.getWarehouseId()); - jsonObject.put("incomingBatch", byId.getIncomingBatch()); - jsonObject.put("enterNum", 1); - jsonObject.put("allocationId", stockupDTO.getAllocationId()); - jsonObject.put("remark", "备货无数据库存品下架"); - List list = new ArrayList<>(); - list.add(jsonObject); - R r = warehouseUpdownTypeClient.downStock(list); - if (r.getCode() != 200) { - log.debug("##########" + r.getMsg()); -// return Resp.scanFail("下架失败,请联系管理员!!", "下架失败,请联系管理员!!"); - } - } else { - R r = warehouseUpdownTypeClient.downPackage(packetBarCode, byId.getWarehouseId(), "备货下架包件"); - if (r.getCode() != 200) { - log.debug("##########" + r.getMsg()); -// return Resp.scanFail("下架失败,请联系管理员!!", "下架失败,请联系管理员!!"); - } - } - } else { - return Resp.scanFail("本货位的物料已为0,请更换货位继续!!", "本货位的物料已为0,请更换货位继续!!"); - } - } else { - return Resp.scanFail("物料信息查询失败,请联系管理员!!", "物料信息查询失败,请联系管理员!!"); - } - entity.setConditions("0"); - entity.setType(2); - entity.setAllocationId(stockupDTO.getAllocationId()); - entity.setOutboundType(stockupEntity.getTypeService()); -// entity.setStockupAreaId(stockupDTO.getStockupAllocationId()); -// entity.setStockupArea(stockupDTO.getStockupAllocationName()); -// //修改备货时间 - distributionAsyncService.updateStockupStockListDate(stockupDTO); -// dataSourceTransactionManager.commit(transactionStatus);//提交 - - Map map = new HashMap<>(); - map.put("messageId", CommonUtil.getUUID()); - map.put("scanType", stockupDTO.getScanType()); - map.put("logId", entity.getId()); - map.put("messageData", entity); - map.put("createTime", System.currentTimeMillis()); - - - // 完成对扫描库存品信息的数量维护 - - // 根据当前扫码对象查询得到当前的扫码对象的库存品信息 - - - //将消息携带绑定键值 - rabbitTemplate.convertAndSend(RabbitConstant.STOCKUP_SCAN_EXCHANGE, RabbitConstant.STOCKUP_SCAN_ROUTING, map); - String audioValue = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.saomiaochenggong.getValue()); - - //进行备货库位上架 - if (!Func.isEmpty(stockupDTO.getStockupAllocationId())) { - JSONObject jsonObject = new JSONObject(); - jsonObject.put("warehouseId", myCurrentWarehouse.getId()); - jsonObject.put("code", packetBarCode); - jsonObject.put("stockUpAllocationId", stockupDTO.getStockupAllocationId()); - jsonObject.put("type", 2); - jsonObject.put("num", 1); - warehouseUpdownStockUpAreaClient.upStockUpShelf(jsonObject); - entity.setStockupAreaId(stockupDTO.getStockupAllocationId()); - } - entity.setTenantId(AuthUtil.getTenantId()); - distributionStockService.save(entity); - //这里尝试修改备货库存品包件的备货状态 - boolean update = distributionParcelListService.update(Wrappers.update().lambda() - .eq(DistributionParcelListEntity::getOrderPackageCode, entity.getCoding()) - .eq(DistributionParcelListEntity::getWarehouseId, myCurrentWarehouse.getId()) - .eq(DistributionParcelListEntity::getConditions, "2") - .eq(DistributionParcelListEntity::getMaterialId, entity.getMaterialId()) - .eq(entity.getStockArticle() != null,DistributionParcelListEntity::getStockArticleId, entity.getStockArticle()) - .set(DistributionParcelListEntity::getOrderPackageStockupStatus, OrderPackageStockupStatusConstant.yibeihu.getValue()) - ); - - // todo 这里需要完善 - // 备货作业节点 -// NodeFanoutMsg nodeFanoutMsg = sendStockUpNodeData(distributionStockupEntity, parcelListEntity); -// if(ObjectUtils.isNotNull(nodeFanoutMsg)){ -// distributionNodeWorkService.planStock(nodeFanoutMsg,user); -// } - - - //扫码成功 - return Resp.scanSuccess(PdaAudioLingoStatus.saomiaochenggong.getName(), audioValue); - case 2: - //重复扫描 - String audioValue2 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.chongfusaomiao.getValue()); - return Resp.scanFail(PdaAudioLingoStatus.chongfusaomiao.getName(), audioValue2); - case 3: - //包件不存在 - String audioValue3 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.baojianbucunzai.getValue()); - return Resp.scanFail(PdaAudioLingoStatus.baojianbucunzai.getName(), audioValue3); - - case 4: - //操作失败 - String audioValue4 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.caozuoshibai.getValue()); - return Resp.scanFail(PdaAudioLingoStatus.caozuoshibai.getName(), audioValue4); - case 5: - //窜货 - String audioValue5 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.cuanhuo.getValue()); - return Resp.scanFail(PdaAudioLingoStatus.cuanhuo.getName(), audioValue5); - case 6: - //已完成 - String audioValue6 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.yiwancheng.getValue()); - return Resp.scanFail(PdaAudioLingoStatus.yiwancheng.getName(), audioValue6); - case 7: - //包条码不存在 - String audioValue7 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.baotiaomabucunzai.getValue()); - return Resp.scanFail(PdaAudioLingoStatus.baotiaomabucunzai.getName(), audioValue7); - default: - log.warn("###备货扫描:未知错误"); - return Resp.scanFail(PdaAudioLingoStatus.weizhicuowu.getName(), PdaAudioLingoStatus.weizhicuowu.getName()); - } - case 7: - //包条码不存在 - String audioValue7 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.baotiaomabucunzai.getValue()); - return Resp.scanFail(PdaAudioLingoStatus.baotiaomabucunzai.getName(), audioValue7); - case 8: - //条码已使用 - String audioValue8 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.baotiaomayishiyong.getValue()); - return Resp.scanFail(PdaAudioLingoStatus.baotiaomayishiyong.getName(), audioValue8); - case 9: - //"没有待绑定的库存品信息!" - String audioValue9 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.meiyou.getValue()); - return Resp.scanFail(PdaAudioLingoStatus.meiyou.getName(), audioValue9); - case 10: - //"没有待绑定的库存品信息!" - return Resp.scanFail("该包件与备货物料不匹配!", "该包件与备货物料不匹配!"); - } - return null; - } - - /** - * 扫描定制品信息 - * - * @param stockupDTO - * @return - */ - @NotNull - private R stockupScanByCustom(StockupDTO stockupDTO) { - - BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); - //包件扫描 - String orderCode = stockupDTO.getOrderCode();//订单自编号 - String packetBarCode = stockupDTO.getPacketBarCode();//包件码 - Long stockupId = stockupDTO.getStockupId();//备货任务ID - Long reservationId = stockupDTO.getReservationId();//预约单id -// Long stockUpAllocationId = stockupDTO.getStockupAllocationId();//备货库位ID - if (Objects.isNull(myCurrentWarehouse)) { - log.warn("##################stockupScan: 未选择仓库,订单自编号为空"); - return R.fail(403, "未授权!!"); - } - if (StringUtil.isBlank(orderCode)) { - log.warn("##################stockupScan: 包件扫码,订单自编号为空"); - return R.fail("包件扫码:订单自编号不能为空"); - } - if (StringUtil.isBlank(packetBarCode)) { - log.warn("##################stockupScan: 包件扫码,包件码为空"); - return R.fail("包件扫码:包件码不能为空"); - } - if (ObjectUtils.isNull(stockupId)) { - log.warn("##################stockupId: 包件扫码,备货区为空"); - return R.fail("包件扫码:备货任务ID不能为空"); - } - if (Objects.isNull(reservationId)) { - log.warn("##################stockupScan: 包件扫码,预约单id为空"); - return R.fail("包件扫码:预约单id不能为空"); - } -// if (Objects.isNull(stockUpAllocationId)) { -// log.warn("##################stockupScan: 备货库位不存在,stockUpAllocationId:{}",stockUpAllocationId); -// return Resp.scanFail("请扫描备货库位","请扫描备货库位"); -// } - - Integer integer = distributionStockupService.selectPackage(stockupDTO); - switch (integer) { - case 1: - DistributionStockupEntity distributionStockupEntity = distributionStockupService.getById(stockupDTO.getStockupId()); - - List aaa = new ArrayList<>(); - //正常 - //先保存扫码包件信息,后续由队列来出来余下补充信息 - DistributionStockEntity entity = new DistributionStockEntity(); - DistributionParcelListEntity one = distributionParcelListService.getOne(Wrappers.query().lambda() - .eq(DistributionParcelListEntity::getOrderPackageCode, stockupDTO.getPacketBarCode()) - .eq(DistributionParcelListEntity::getWarehouseId, myCurrentWarehouse.getId()) - ); - entity.setOrderSelfNumbering(one.getOrderCode()); - entity.setStockArticle(one.getStockArticleId()); - entity.setCoding(packetBarCode); - entity.setScanUser(AuthUtil.getUser().getNickName()); - entity.setStockupId(stockupId); - entity.setStockupId(stockupId); - entity.setParcelListId(one.getId()); - entity.setStockQuantity(1); -// //修改包件备货状态 - if ("3".equals(distributionStockupEntity.getTypeService())) { - entity.setBillLadingId(reservationId); - DistributionStockupEntity byId = distributionStockupService.getById(stockupId); - entity.setStockupArea(byId.getStockupArea()); - } else { - entity.setReservationId(reservationId); - } - if (ObjectUtils.isNotNull(stockupDTO.getAllocationId())) { -// warehouseUpdownGoodsClient.selectMsgBywrap(); - WarehouseUpdownGoodsEntity warehouseUpdownGoodsEntity = new WarehouseUpdownGoodsEntity(); - warehouseUpdownGoodsEntity.setAllocationId(stockupDTO.getAllocationId()); - warehouseUpdownGoodsEntity.setAssociationValue(stockupDTO.getPacketBarCode()); - warehouseUpdownGoodsEntity.setWarehouseId(distributionStockupEntity.getWarehouseId()); - WarehouseUpdownGoodsEntity locationInformation = warehouseUpdownGoodsClient.getLocationInformation(warehouseUpdownGoodsEntity); - if (ObjectUtils.isNotNull(locationInformation)) { - entity.setAllocationTitle(locationInformation.getPositionCode()); - } - entity.setAllocationId(stockupDTO.getAllocationId()); - } - entity.setConditions("0"); - entity.setType(2); - entity.setOutboundType(distributionStockupEntity.getTypeService()); - //修改订单备货状态 - distributionAsyncService.updateStockArticleStock(one.getStockArticleId()); - //修改备货时间 - distributionAsyncService.updateStockupDate(stockupDTO); - - Map map = new HashMap<>(); - map.put("messageId", CommonUtil.getUUID()); - map.put("scanType", stockupDTO.getScanType()); - map.put("stockupId", stockupDTO.getStockupId()); - map.put("logId", entity.getId()); - map.put("messageData", entity); - map.put("createTime", System.currentTimeMillis()); - //将消息携带绑定键值 - rabbitTemplate.convertAndSend(RabbitConstant.STOCKUP_SCAN_EXCHANGE, RabbitConstant.STOCKUP_SCAN_ROUTING, map); - - //查询是否货位数据是否该下架 - Map mapState = new HashMap<>(); - mapState.put("messageId", CommonUtil.getUUID()); - mapState.put("scanType", stockupDTO.getScanType()); - mapState.put("stockupId", stockupDTO.getStockupId()); - mapState.put("typeService", stockupDTO.getTypeService()); - mapState.put("reservationId", stockupDTO.getReservationId()); - mapState.put("logId", entity.getId()); - mapState.put("messageData", entity); - mapState.put("warehouseId", myCurrentWarehouse.getId()); - mapState.put("createTime", System.currentTimeMillis()); - String audioValue = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.saomiaochenggong.getValue()); - - log.info(">>>>>>>>>>>>>>>>>>>> 对扫码的包件进行下架"); - //将消息携带绑定键值 - rabbitTemplate.convertAndSend(RabbitConstant.STOCKUP_STATE_UPDATE_EXCHANGE, RabbitConstant.STOCKUP_STATE_UPDATE_ROUTING, mapState, message -> { - message.getMessageProperties() - .setHeader("x-delay", 3000); - return message; - }); - //查询是否货位数据是否该下架 - BladeUser user = AuthUtil.getUser(); - - if (!Func.isEmpty(stockupDTO.getStockupAllocationId())) { - JSONObject jsonObject = new JSONObject(); - jsonObject.put("warehouseId", myCurrentWarehouse.getId()); - jsonObject.put("code", packetBarCode); - jsonObject.put("stockUpAllocationId", stockupDTO.getStockupAllocationId()); - jsonObject.put("type", 1); - jsonObject.put("num", 1); - //进行了备货库位的选择才进行备货库位的上架 - warehouseUpdownStockUpAreaClient.upStockUpShelf(jsonObject); - entity.setStockupAreaId(stockupDTO.getStockupAllocationId()); - String content = "包件在" + myCurrentWarehouse.getName() + "由" + AuthUtil.getNickName() + "备货上架,操作方式:备货上架同步操作,备货任务号:" + distributionStockupEntity.getStockupCode() ; - JSONObject js = handleLogJSONObject(myCurrentWarehouse, user, entity.getCoding(), content, WorkNodeEnums.STOCKING_OPERATION.getCode()); - aaa.add(js); - } - distributionStockService.save(entity); - //增加备货扫描节点 - String content = "包件在" + myCurrentWarehouse.getName() + "由" + AuthUtil.getNickName() + "备货作业,备货任务号:" + distributionStockupEntity.getStockupCode() ; - JSONObject js = handleLogJSONObject(myCurrentWarehouse, user, entity.getCoding(), content, WorkNodeEnums.STOCKING_OPERATION.getCode()); - aaa.add(js); - - //修改包件备货状态 - DistributionParcelListEntity parcelListEntity = new DistributionParcelListEntity(); - parcelListEntity.setId(entity.getParcelListId()); - parcelListEntity.setOrderPackageStockupStatus(OrderPackageStockupStatusConstant.yibeihu.getValue()); - distributionParcelListService.updateById(parcelListEntity); - trunklinePackageTrackLogClient.addPackageTrackLog(aaa); - parcelListEntity = distributionParcelListService.getById(entity.getParcelListId()); - // 备货作业节点 - NodeFanoutMsg nodeFanoutMsg = sendStockUpNodeData(distributionStockupEntity, parcelListEntity); - if(ObjectUtils.isNotNull(nodeFanoutMsg)){ - distributionNodeWorkService.planStock(nodeFanoutMsg,user); - } - - return Resp.scanSuccess(PdaAudioLingoStatus.saomiaochenggong.getName(), audioValue); - case 2: - //重复扫描 - String audioValue2 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.chongfusaomiao.getValue()); - return Resp.scanFail(PdaAudioLingoStatus.chongfusaomiao.getName(), audioValue2); - case 3: - //包件不存在 - String audioValue3 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.baotiaomabucunzai.getValue()); - return Resp.scanFail(PdaAudioLingoStatus.baotiaomabucunzai.getName(), audioValue3); - - case 4: - //操作失败 - String audioValue4 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.caozuoshibai.getValue()); - return Resp.scanFail(PdaAudioLingoStatus.caozuoshibai.getName(), audioValue4); - case 5: - //窜货 - String audioValue5 = DictBizCache.getValue(DictBizConstant.PDA_AUDIO, PdaAudioLingoStatus.buzai.getValue()); - return Resp.scanFail(PdaAudioLingoStatus.buzai.getName(), audioValue5); - default: - log.warn("###备货扫描:未知错误"); - return Resp.scanFail(PdaAudioLingoStatus.weizhicuowu.getName(), PdaAudioLingoStatus.weizhicuowu.getName()); - } - } - - private NodeFanoutMsg sendStockUpNodeData(DistributionStockupEntity distributionStockupEntity, DistributionParcelListEntity parcelListEntity) { - try { - BladeUser user = AuthUtil.getUser(); - NodeFanoutMsg nodeFanoutMsg = new NodeFanoutMsg(); - nodeFanoutMsg.setBizOperation(BizOperationEnums.ADD); - nodeFanoutMsg.setNode(WorkNodeEnums.STOCKING_OPERATION); - BasicdataWarehouseEntity entityWarehouse = basicdataWarehouseClient.getEntityWarehouseId(distributionStockupEntity.getWarehouseId()); - if(entityWarehouse != null){ - nodeFanoutMsg.setWarehouse(entityWarehouse.getName()); - } - nodeFanoutMsg.setWarehouseId(distributionStockupEntity.getWarehouseId()); - nodeFanoutMsg.setOperator(user.getTenantId()); - nodeFanoutMsg.setOperatorTime(distributionStockupEntity.getCreateTime()); - - JSONObject jsonObject = new JSONObject(); - jsonObject.put("id", distributionStockupEntity.getId()); - jsonObject.put("stockupCode", distributionStockupEntity.getStockupCode()); - jsonObject.put("typeService", distributionStockupEntity.getTypeService()); - jsonObject.put("stockupDate", distributionStockupEntity.getStockupDate()); - - String jsonString = jsonObject.toJSONString(); - nodeFanoutMsg.setMain(jsonString); - nodeFanoutMsg.setTenantId(AuthUtil.getTenantId()); - - List packageDataList = new ArrayList<>(); - - PackageData packageData = getPackageData(parcelListEntity); - - packageDataList.add(packageData); - nodeFanoutMsg.setDetails(packageDataList); - return nodeFanoutMsg; - } catch (Exception e) { - log.error("备货扫描:发送备货节点消息失败", e); - } - return null; - - } - - @NotNull - private static PackageData getPackageData(DistributionParcelListEntity parcelListEntity) { - PackageData packageData = new PackageData(); - - packageData.setWaybillNumber(parcelListEntity.getWaybillNumber()); - packageData.setBrand(parcelListEntity.getBrandName()); - packageData.setPackageCode(parcelListEntity.getOrderPackageCode()); - packageData.setMaterialCode(parcelListEntity.getMaterialCode()); - packageData.setMaterialName(parcelListEntity.getMaterialName()); - packageData.setNumber(1); - packageData.setOrderCode(parcelListEntity.getOrderCode()); - packageData.setPackageType(PackageTypeEnums.CMP); - return packageData; - } - - - private JSONObject handleLogJSONObject(BasicdataWarehouseEntity warehouse, BladeUser user, String orderPackageCode, String content, Integer node) { - JSONObject trunklinePackageTrackLog = new JSONObject(); - trunklinePackageTrackLog.put("tenantId", user.getTenantId()); - trunklinePackageTrackLog.put("createTime", new Date()); - trunklinePackageTrackLog.put("createUser", user.getUserId()); - trunklinePackageTrackLog.put("updateUser", user.getUserId()); - trunklinePackageTrackLog.put("updateTime", new Date()); - trunklinePackageTrackLog.put("isDeleted", 0); - trunklinePackageTrackLog.put("status", 1); - trunklinePackageTrackLog.put("createDept", warehouse.getDepartment()); - trunklinePackageTrackLog.put("orderPackageCode", orderPackageCode); - trunklinePackageTrackLog.put("warehouseId", warehouse.getId()); - trunklinePackageTrackLog.put("warehouseName", warehouse.getName()); - trunklinePackageTrackLog.put("workNode", node); - trunklinePackageTrackLog.put("content", content); - trunklinePackageTrackLog.put("operator", user.getNickName()); - return trunklinePackageTrackLog; - } - } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionReservationController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionReservationController.java index 295386065..d023c1d35 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionReservationController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionReservationController.java @@ -323,7 +323,12 @@ public class DistributionReservationController extends BladeController { @ApiOperationSupport(order = 7) @ApiOperation(value = "取消预约") public R cancelReservation(@RequestBody DistributionReservationDTO reservationDTO) { - boolean result = reservationService.cancelReservation(reservationDTO); + boolean result = false; + try { + result = reservationService.cancelReservation(reservationDTO); + } catch (Exception e) { + return R.fail(e.getMessage()); + } return R.status(result); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java index 10cf28b2a..a502b7b49 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java @@ -338,7 +338,7 @@ public class DistributionSignforController extends BladeController { } /** - * 签收管理 修改 + * 签收管理 复核 */ @PostMapping("/update") @ApiOperationSupport(order = 5) @@ -356,6 +356,8 @@ public class DistributionSignforController extends BladeController { distributionSignforService.updateSign(distributionSignforDTO); distributionDeliveryListService.maintenanceDeliveryInfo(distributionSignfor.getDeliveryId()); distributionStockupInfoService.maintenanceStockUp(distributionSignfor.getReservationId(),1); + + } // return R.status(distributionSignforService.updateById(distributionSignfor)); return r; diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.java index 1258963d9..35693d3af 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.java @@ -291,7 +291,6 @@ public interface DistributionDeliveryListMapper extends BaseMapper getPackageByDeliveryAndOrderId(@Param("deliveryId") Long deliveryId,@Param("orderId") Long orderId,@Param("warehouseId") Long warehouseId); @@ -569,6 +563,15 @@ public interface DistributionDeliveryListMapper extends BaseMapper> getBroadcastDataByZeroOrder(@Param("deliveryId")Long deliveryId,@Param("warehouseId") Long warehouseId); + /** + * 配送计划内的零担查询 + * @param deliveryId 配送ID + * @param warehouseId 仓库Io + * @param parcelListId 零担包件ID + * @return + */ + Map getBroadcastDataByZeroOrderAndParcId(@Param("deliveryId")Long deliveryId,@Param("warehouseId") Long warehouseId,@Param("parcelListId") Long parcelListId); + /** * 查询计划中的包件信息 * @param orderPackageCode diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml index 0659ef16a..bdeec201b 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml @@ -2597,6 +2597,38 @@ AND ldrzp.zero_package_status != 2 AND lddl.tenant_id = '627683' + + +