diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionStockupAppController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionStockupAppController.java index 33e60a1e5..2eddc26a6 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionStockupAppController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionStockupAppController.java @@ -36,6 +36,7 @@ import com.logpm.distribution.entity.*; import com.logpm.distribution.mapper.DistributionReservationMapper; import com.logpm.distribution.service.*; import com.logpm.distribution.vo.*; +import com.logpm.trunkline.feign.ITrunklinePackageTrackLogClient; import com.logpm.warehouse.entity.WarehouseUpdownGoodsEntity; import com.logpm.warehouse.feign.*; import io.swagger.annotations.Api; @@ -46,6 +47,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.springblade.common.constant.DictBizConstant; import org.springblade.common.constant.RabbitConstant; +import org.springblade.common.constant.WorkNodeEnums; import org.springblade.common.constant.common.IsOrNoConstant; import org.springblade.common.constant.orderpackage.OrderPackageFreezeStatusConstant; import org.springblade.common.constant.orderpackage.OrderPackageStockupStatusConstant; @@ -60,12 +62,14 @@ import org.springblade.common.utils.CommonUtil; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.log.exception.ServiceException; 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.Func; import org.springblade.core.tool.utils.StringUtil; import org.springblade.system.cache.DictBizCache; import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.transaction.TransactionDefinition; import org.springframework.web.bind.annotation.*; @@ -123,6 +127,7 @@ public class DistributionStockupAppController extends BladeController { private final IWarehouseUpdownStockUpAreaClient warehouseUpdownStockUpAreaClient; private final BladeRedis redis; + private final ITrunklinePackageTrackLogClient trunklinePackageTrackLogClient; /** @@ -1587,6 +1592,13 @@ public class DistributionStockupAppController extends BladeController { switch (integer) { case 1: DistributionStockupEntity distributionStockupEntity = distributionStockupService.getById(stockupDTO.getStockupId()); + + DistributionReservationEntity reservationEntity = distributionReservationService.getById(reservationId); + List aaa = new ArrayList<>(); + if (Func.isEmpty(reservationEntity)){ + log.warn("##################查询预约任务错误:{}",reservationId); + return R.fail("预约信息错误"); + } //正常 //先保存扫码包件信息,后续由队列来出来余下补充信息 DistributionStockEntity entity = new DistributionStockEntity(); @@ -1598,16 +1610,11 @@ public class DistributionStockupAppController extends BladeController { entity.setStockArticle(one.getStockArticleId()); entity.setCoding(packetBarCode); entity.setScanUser(AuthUtil.getUser().getNickName()); -// entity.setStockupArea(stockupArea); entity.setStockupId(stockupId); entity.setStockupId(stockupId); entity.setParcelListId(one.getId()); entity.setStockQuantity(1); // //修改包件备货状态 -// DistributionParcelListEntity parcelListEntity = new DistributionParcelListEntity(); -// parcelListEntity.setId(one.getId()); -// parcelListEntity.setOrderPackageStockupStatus(OrderPackageStockupStatusConstant.yibeihu.getValue()); -// distributionParcelListService.updateById(parcelListEntity); if ("3".equals(distributionStockupEntity.getTypeService())) { entity.setBillLadingId(reservationId); DistributionStockupEntity byId = distributionStockupService.getById(stockupId); @@ -1630,13 +1637,10 @@ public class DistributionStockupAppController extends BladeController { entity.setConditions("0"); entity.setType(2); entity.setOutboundType(distributionStockupEntity.getTypeService()); -// entity.setStockupArea(stockupDTO.getStockupAllocationName()); -// entity.setStockupAreaId(stockupDTO.getStockupAllocationId()); //修改订单备货状态 distributionAsyncService.updateStockArticleStock(one.getStockArticleId()); //修改备货时间 distributionAsyncService.updateStockupDate(stockupDTO); -// dataSourceTransactionManager.commit(transactionStatus);//提交 Map map = new HashMap<>(); map.put("messageId", CommonUtil.getUUID()); @@ -1669,6 +1673,7 @@ public class DistributionStockupAppController extends BladeController { return message; }); //查询是否货位数据是否该下架 + BladeUser user = AuthUtil.getUser(); if (!Func.isEmpty(stockupDTO.getStockupAllocationId())) { JSONObject jsonObject = new JSONObject(); @@ -1680,14 +1685,24 @@ public class DistributionStockupAppController extends BladeController { //进行了备货库位的选择才进行备货库位的上架 warehouseUpdownStockUpAreaClient.upStockUpShelf(jsonObject); entity.setStockupAreaId(stockupDTO.getStockupAllocationId()); + String content = "包件在" + myCurrentWarehouse.getName() + "由" + AuthUtil.getNickName() + "备货上架,操作方式:备货上架同步操作,备货任务号:" + distributionStockupEntity.getStockupCode() + "预约任务号:" + reservationEntity.getReservationCode(); + 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() + "预约任务号:" + reservationEntity.getReservationCode(); + 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); + if (!aaa.isEmpty()) { + trunklinePackageTrackLogClient.addPackageTrackLog(aaa); + } return Resp.scanSuccess(PdaAudioLingoStatus.saomiaochenggong.getName(), audioValue); case 2: //重复扫描 @@ -1713,4 +1728,25 @@ public class DistributionStockupAppController extends BladeController { } + + 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/mapper/DistributionStockupMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockupMapper.xml index 17b249e8d..5bb34f9df 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockupMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockupMapper.xml @@ -1061,7 +1061,7 @@ from logpm_distribution_stockup_info ldsi left join logpm_distribution_stockup lds on lds.id = ldsi.stockup_id and lds.is_deleted = 0 left join logpm_warehouse_goods_area lwga on lwga.id = lds.goods_area_id and lwga.is_deleted = 0 - where ldsi.reservation_id = #{reservationId} + where ldsi.reservation_id = #{reservationId} AND ldsi.stock_status != 4 and ldsi.is_deleted = 0