diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/entity/TrunklineAdvanceDetailEntity.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/entity/TrunklineAdvanceDetailEntity.java index fef61c819..e1c252fe6 100644 --- a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/entity/TrunklineAdvanceDetailEntity.java +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/entity/TrunklineAdvanceDetailEntity.java @@ -201,5 +201,15 @@ public class TrunklineAdvanceDetailEntity extends TenantEntity { private String goodsMan; @ApiModelProperty(name = "入库时间") private Date incomingTime; + /** + * 仓库id + */ + @ApiModelProperty(name = "当前所在仓库id", notes = "") + private Long nowWarehouseId; + /** + * 仓库名称 + */ + @ApiModelProperty(name = "当前所在仓库名称", notes = "") + private String nowWarehouseName; } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/CarsLoadController.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/CarsLoadController.java index 836b1eb52..1ed2eec18 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/CarsLoadController.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/CarsLoadController.java @@ -2317,4 +2317,65 @@ public class CarsLoadController { } } + + @ResponseBody + @PostMapping("/findSignOrderPageList") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "查询签收单分页列表", notes = "传入loadCarsDTO") + public R findSignOrderPageList(@RequestBody LoadCarsDTO loadCarsDTO) { + String method = "############findSignOrderPageList: "; + log.info(method + "请求参数{}", loadCarsDTO); + try{ + //当前登录人选择的仓库 + BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); + if(Objects.isNull(myCurrentWarehouse)){ + log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse); + return R.fail(405,"仓库信息为空"); + } + loadCarsDTO.setWarehouseId(myCurrentWarehouse.getId()); + + return carsLoadService.findSignOrderPageList(loadCarsDTO); + }catch (CustomerException e){ + log.error(e.message,e); + return R.fail(e.code,e.message); + }catch (Exception e){ + log.error(method+"系统异常",e); + return R.fail(500,"系统异常"); + } + } + + + + @ResponseBody + @PostMapping("/findSignPhotoList") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "查询签收单图片列表", notes = "传入loadCarsDTO") + public R findSignPhotoList(@RequestBody LoadCarsDTO loadCarsDTO) { + String method = "############findSignPhotoList: "; + log.info(method + "请求参数{}", loadCarsDTO); + Long signOrderId = loadCarsDTO.getSignOrderId(); + try{ + //当前登录人选择的仓库 + BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); + if(Objects.isNull(myCurrentWarehouse)){ + log.warn(method+"仓库信息为空 myCurrentWarehouse={}",myCurrentWarehouse); + return R.fail(405,"仓库信息为空"); + } + loadCarsDTO.setWarehouseId(myCurrentWarehouse.getId()); + if(Objects.isNull(signOrderId)){ + log.warn(method+"签收单id为空 signOrderId={}",signOrderId); + return R.fail(405,"签收单id为空"); + } + + return carsLoadService.findSignPhotoList(loadCarsDTO); + }catch (CustomerException e){ + log.error(e.message,e); + return R.fail(e.code,e.message); + }catch (Exception e){ + log.error(method+"系统异常",e); + return R.fail(500,"系统异常"); + } + } + + } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml index 1a44af87b..118ef57e5 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml @@ -35,7 +35,8 @@ ltad.weight weight, ltad.volume volume, ltad.advance_id advanceId, - ltad.incoming_warehouse_name incomingWarehouseName + ltad.incoming_warehouse_name incomingWarehouseName, + ltad.now_warehouse_name nowWarehouseName from logpm_trunkline_advance_detail ltad left join logpm_trunkline_advance lta on lta.id = ltad.advance_id left join logpm_warehouse_tray_goods lwtg on lwtg.association_value = ltad.order_package_code @@ -220,7 +221,7 @@ select ltad.waybill_id waybillId, ltad.waybill_no waybillNo, - t.warehouse nowWarehouseName, + ltad.now_warehouse_name nowWarehouseName, ltad.train_number trainNumber, ltad.package_status packageStatus, lta.is_gcp isGcp, @@ -250,40 +251,17 @@ lta.create_user_name createUserName, lta.create_time createTime from logpm_trunkline_advance_detail ltad - left join logpm_trunkline_advance lta on lta.id = ltad.advance_id - left join (select ldpl.* from logpm_distribution_parcel_list ldpl - join ( - select pl.order_package_code, - max(pl.update_time) updateTime - from logpm_distribution_parcel_list pl - where 1=1 - - and LOCATE(#{param.orderCode}, pl.order_code) > 0 - - - and pl.waybill_no = #{param.waybillNo} - - - and pl.train_number = #{param.trainNumber} - - - and pl.service_number = #{param.serviceNumber} - - - and LOCATE(#{param.orderPackageCode},pl.order_package_code) > 0 - - group by pl.order_package_code - ) tmax on tmax.order_package_code = ldpl.order_package_code and ldpl.update_time = tmax.updateTime) t on t.order_package_code = ltad.order_package_code - left join logpm_warehouse_tray_goods lwtg on lwtg.association_value = t.order_package_code and lwtg.warehouse_id = t.warehouse_id - left join logpm_warehouse_tray lwt on lwtg.tray_id = lwt.id - left join (select ltcls.* from logpm_trunkline_cars_load_scan ltcls - join ( - select cls.scan_code, - max(cls.update_time) cupdateTime - from logpm_trunkline_cars_load_scan cls - group by cls.scan_code - ) cmax on cmax.scan_code = ltcls.scan_code and cmax.cupdateTime = ltcls.update_time) m on m.scan_code = t.order_package_code - left join logpm_distribution_loadscan ldl on ldl.order_package_code = t.order_package_code and ldl.scan_status != 1 and ldl.is_deleted = 0 + left join logpm_trunkline_advance lta on lta.id = ltad.advance_id + left join logpm_warehouse_tray_goods lwtg on lwtg.association_value = ltad.order_package_code and lwtg.warehouse_id = ltad.now_warehouse_id + left join logpm_warehouse_tray lwt on lwtg.tray_id = lwt.id + left join (select ltcls.* from logpm_trunkline_cars_load_scan ltcls + join ( + select cls.scan_code, + max(cls.update_time) cupdateTime + from logpm_trunkline_cars_load_scan cls + group by cls.scan_code + ) cmax on cmax.scan_code = ltcls.scan_code and cmax.cupdateTime = ltcls.update_time) m on m.scan_code = t.order_package_code + left join logpm_distribution_loadscan ldl on ldl.order_package_code = t.order_package_code and ldl.scan_status != 1 and ldl.is_deleted = 0 left join logpm_distribution_delivery_list lddl on lddl.id = ldl.delivery_id where 1=1 diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml index 439f3e60c..1ca8537e5 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml @@ -398,6 +398,7 @@ left join logpm_warehouse_waybill lww on ltcls.waybill_no = lww.waybill_no where ltcls.load_id = #{loadId} and ltcls.warehouse_id = #{warehouseId} + and ltcls.warehouse_id != ltcls.unload_node_id group by ltcls.order_code, ltcls.waybill_no, ltcls.type, @@ -446,9 +447,9 @@ lww.consignee consignee, lww.consignee_name consigneeName, lww.consignee_mobile consigneeMobile, - ltco.unload_num unloadNum, - 0 planNum, - sum(ltcls.num) smallTotal + IFNULL(ltco.plan_num,0) AS planNum, + sum(case when ltcls.scan_status != 1 then ltcls.num else 0 end) unloadNum, + sum( ltcls.num ) AS smallTota from logpm_trunkline_cars_load_scan ltcls left join logpm_trunkline_cars_order ltco on ltco.order_code = ltcls.order_code and ltco.waybill_no = ltcls.waybill_no and ltco.load_id = ltcls.load_id and ltco.node_id = ltcls.warehouse_id left join logpm_distribution_stock_article ldsa on ldsa.order_code = ltcls.order_code and ldsa.warehouse_id = ltcls.from_warehouse_id diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineLoadSignOrderMapper.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineLoadSignOrderMapper.java index 13d89550e..eb1871b06 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineLoadSignOrderMapper.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineLoadSignOrderMapper.java @@ -24,4 +24,6 @@ public interface TrunklineLoadSignOrderMapper extends BaseMapper findSignOrderDetailList(IPage page, @Param("param") LoadCarsDTO loadCarsDTO); void updateBelongToWarehouse(@Param("signOrderId") Long signOrderId, @Param("warehouseId") Long warehouseId, @Param("warehouseName") String warehouseName); + + IPage findSignOrderPageList(IPage page, @Param("param") LoadCarsDTO loadCarsDTO); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineLoadSignOrderMapper.xml b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineLoadSignOrderMapper.xml index f0492bf19..915fa9162 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineLoadSignOrderMapper.xml +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineLoadSignOrderMapper.xml @@ -85,4 +85,29 @@ where id = #{signOrderId} + + diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/PackageFanoutListener.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/PackageFanoutListener.java new file mode 100644 index 000000000..4833e21d7 --- /dev/null +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/PackageFanoutListener.java @@ -0,0 +1,67 @@ +package com.logpm.trunkline.mq; + +import cn.hutool.json.JSONArray; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.logpm.basicdata.entity.BasicdataWarehouseEntity; +import com.logpm.basicdata.feign.IBasicdataWarehouseClient; +import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; +import com.logpm.trunkline.service.ITrunklineAdvanceDetailService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.common.constant.WorkNodeEnums; +import org.springblade.common.constant.broadcast.FanoutConstants; +import org.springblade.common.exception.CustomerException; +import org.springframework.amqp.core.ExchangeTypes; +import org.springframework.amqp.rabbit.annotation.Exchange; +import org.springframework.amqp.rabbit.annotation.Queue; +import org.springframework.amqp.rabbit.annotation.QueueBinding; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Objects; + +@Slf4j +@Component +@AllArgsConstructor +public class PackageFanoutListener { + + private final ITrunklineAdvanceDetailService advanceDetailService; + private final IBasicdataWarehouseClient warehouseClient; + + @RabbitListener(bindings = @QueueBinding( + value = @Queue(name = FanoutConstants.trunkline.PACKAGNODE.QUEUE.PACKAGE_SIGN), + exchange = @Exchange(name = FanoutConstants.trunkline.PACKAGNODE.EXCHANGE, type = ExchangeTypes.FANOUT) + )) + @Transactional(rollbackFor = Exception.class) + public void packageSignFanout(String msg) { + JSONObject jsonObject = JSONUtil.parseObj(msg); + Integer workNode = jsonObject.getInt("workNode"); + if(WorkNodeEnums.INITIAL_WAREHOUSE_ENTRY.getCode().equals(workNode) + || WorkNodeEnums.UNLOAD_INCOMING_WAREHOUSE.getCode().equals(workNode)){ + Long warehouseId = jsonObject.getLong("warehouseId"); + BasicdataWarehouseEntity warehouseEntity = warehouseClient.getEntityWarehouseId(warehouseId); + if(Objects.isNull(warehouseEntity)){ + log.warn("###########packageSignFanout: 仓库信息不存在 warehouseId={}",warehouseId); + throw new CustomerException(405,"仓库信息不存在"); + } + + JSONArray orderPackageCodes = jsonObject.getJSONArray("orderPackageCodes"); + List orderPackageCodeList = orderPackageCodes.toList(String.class); + + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("now_warehouse_id", warehouseId) + .set("now_warehouse_name", warehouseEntity.getName()) + .in("order_package_code", orderPackageCodeList); + advanceDetailService.update(updateWrapper); + + } + + + } + + +} diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IPackageTrackLogAsyncService.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IPackageTrackLogAsyncService.java index 1d158570d..0bec90e8d 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IPackageTrackLogAsyncService.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IPackageTrackLogAsyncService.java @@ -10,6 +10,6 @@ public interface IPackageTrackLogAsyncService { void addBatchPackageTrackLog(List addPackageTrackLogList, List orderPackageCodes, Integer code); - void sendPackageWorkNodeFanout(List orderPackageCodes,Integer workNodeV); + void sendPackageWorkNodeFanout(List orderPackageCodes,Integer workNode,Long warehouseId); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadService.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadService.java index 634ca90b8..faaef05bd 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadService.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadService.java @@ -214,4 +214,7 @@ public interface ITrunklineCarsLoadService extends BaseService findSignOrderPageList(IPage page, LoadCarsDTO loadCarsDTO); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineWaybillPackageService.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineWaybillPackageService.java index 0b75c8f2c..64746a4c3 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineWaybillPackageService.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineWaybillPackageService.java @@ -13,6 +13,6 @@ public interface ITrunklineWaybillPackageService extends BaseService orderPackageCodes, Integer workNode); + void updatePackageStatus(List orderPackageCodes, Integer workNode,Long warehouseId); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/InComingServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/InComingServiceImpl.java index 4ada06c46..d5058e23f 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/InComingServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/InComingServiceImpl.java @@ -20,6 +20,7 @@ import com.logpm.trunkline.service.*; import com.logpm.trunkline.vo.TrunklineAdvanceVO; import com.logpm.warehouse.entity.WarehouseWaybillEntity; import com.logpm.warehouse.feign.IWarehouseTrayTypeClient; +import com.logpm.warehouse.feign.IWarehouseWaybillClient; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.common.constant.IncomingTypeEnum; @@ -38,6 +39,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.*; +import java.util.function.Function; import java.util.stream.Collectors; @Slf4j @@ -55,6 +57,8 @@ public class InComingServiceImpl implements IInComingService { private final RabbitTemplate rabbitTemplate; private final FactoryDataMessageSender factoryDataMessageSender; private final ISysClient sysClient; + private final IWarehouseWaybillClient warehouseWaybillClient; + private final IOpenOrderAsyncService openOrderAsyncService; @Override @@ -268,6 +272,34 @@ public class InComingServiceImpl implements IInComingService { //2.判断包件和订单是否已经存入在库订单 boolean b = advanceService.saveOrderAndPackages(advanceDetailEntities, warehouseId); if (b) { + + //把advanceDetailEntities通过waybillNo进行分组 + Map> advanceDetailEntityWaybillNoMap = advanceDetailEntities.stream().filter(entity -> StringUtil.isNotBlank(entity.getWaybillNo())).collect(Collectors.groupingBy(TrunklineAdvanceDetailEntity::getWaybillNo)); + + Set waybillNoSet = advanceDetailEntityWaybillNoMap.keySet(); + if(!waybillNoSet.isEmpty()){ + + List waybillEntityList = warehouseWaybillClient.findWaybillBilllByWaybillNos(new ArrayList<>(waybillNoSet)); + //把waybillEntityList转化成waybillNo为key的map + Map waybillEntityMap = waybillEntityList.stream().collect(Collectors.toMap(WarehouseWaybillEntity::getWaybillNo, Function.identity())); + + advanceDetailEntityWaybillNoMap.keySet().forEach(waybillNo -> { + List waybillNoAdvanceDetailEntities = advanceDetailEntityWaybillNoMap.get(waybillNo); + if(!waybillNoAdvanceDetailEntities.isEmpty()){ + WarehouseWaybillEntity waybillEntity = waybillEntityMap.get(waybillNo); + if(!Objects.isNull(waybillEntity)){ + Long departureWarehouseId = waybillEntity.getDepartureWarehouseId(); + if(departureWarehouseId.equals(warehouseId)){ + Integer totalCount = waybillEntity.getTotalCount(); + Integer stockCount = waybillEntity.getStockCount(); + openOrderAsyncService.saveLog(waybillEntity.getId(), waybillEntity.getWaybillNo(), "20", "已入库", "运单入库:"+stockCount+"/"+totalCount+",入库类型:【"+IncomingTypeEnum.getValue(incomingType)+"】,入库时间:"+ CommonUtil.dateToStringGeneral(new Date()), AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, finalWarehouseName); + } + } + } + }); + } + + if (!Objects.isNull(billladingId)) { //先判断该包件是否已经有提货记录了 List noOrderPackageCodes = billladingPackageServicie.findBillladingPackages(orderPackageCodes); @@ -543,8 +575,6 @@ public class InComingServiceImpl implements IInComingService { String tenantId = inComingDTO.getTenantId(); String nickName = inComingDTO.getNickName(); -// DynamicDataSourceContextHolder.push(tenantId); - Integer total = 0; for (Long advanceId : advanceIds) { QueryWrapper queryWrapper = new QueryWrapper<>(); @@ -560,6 +590,22 @@ public class InComingServiceImpl implements IInComingService { List incomingWarehouseNames = advanceDetailService.findIncomingWarehouseName(advanceId); advanceService.updateIncomingWarehouseName(String.join(",", incomingWarehouseNames), advanceId); + //把detailList通过waybillId分组 + Map> map = detailList.stream().filter(t -> Objects.nonNull(t.getWaybillId())).collect(Collectors.groupingBy(TrunklineAdvanceDetailEntity::getWaybillId)); + + Set waybillIdSet = map.keySet(); + + List waybillEntityList = warehouseWaybillClient.findListByWaybillIds(new ArrayList<>(waybillIdSet)); + + waybillEntityList.forEach(wb -> { + Integer totalCount = wb.getTotalCount(); + Integer stockCount = wb.getStockCount(); + openOrderAsyncService.saveLog(waybillEntity.getId(), waybillEntity.getWaybillNo(), "20", "已入库", "运单入库:"+stockCount+"/"+totalCount+",入库类型:【"+IncomingTypeEnum.getValue(incomingType)+"】,入库时间:"+ CommonUtil.dateToStringGeneral(new Date()), AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, warehouseName); + }); + + //把waybillEntityList转化成id为key的Map +// Map waybillEntityMap = waybillEntityList.stream().collect(Collectors.toMap(WarehouseWaybillEntity::getId, Function.identity())); + //存入日志 packageTrackLogAsyncService.addPackageTrackLog(tenantId, userId, deptId, nickName, orderPackageCodes, warehouseId, warehouseName, WorkNodeEnums.INITIAL_WAREHOUSE_ENTRY.getCode(), "包件" + IncomingTypeEnum.getValue(incomingType)); total = total + detailList.size(); diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderAsyncServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderAsyncServiceImpl.java index f459e6378..686ff0acb 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderAsyncServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderAsyncServiceImpl.java @@ -1,6 +1,7 @@ package com.logpm.trunkline.service.impl; import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.logpm.basicdata.entity.BasicdataClientEntity; import com.logpm.basicdata.entity.BasicdataStoreBusinessEntity; import com.logpm.basicdata.feign.IBasicdataClientClient; @@ -64,23 +65,49 @@ public class OpenOrderAsyncServiceImpl implements IOpenOrderAsyncService { @LogpmAsync("asyncExecutor") @Override public void saveLog(Long waybillId, String waybillNo, String trackType, String refer, String operationRemark, String nickName,Long userId,Long warehouseId,String warehouseName) { -// String tenantId = AuthUtil.getTenantId(); -// DynamicDataSourceContextHolder.push(tenantId); - TrunklineWaybillTrackEntity waybillTrackEntity = new TrunklineWaybillTrackEntity(); - waybillTrackEntity.setWarehouseId(warehouseId); - waybillTrackEntity.setWarehouseName(warehouseName); - waybillTrackEntity.setWaybillId(waybillId); - waybillTrackEntity.setWaybillNo(waybillNo); - waybillTrackEntity.setTrackType(trackType); - waybillTrackEntity.setRefer(refer); - waybillTrackEntity.setOperationRemark(operationRemark); - waybillTrackEntity.setCreateUserName(nickName); -// waybillTrackEntity.setTenantId(TenantNum.HUITONGCODE); -// waybillTrackEntity.setCreateUser(userId); -// waybillTrackEntity.setUpdateUser(userId); - waybillTrackEntity.setCheckStatus(1); - waybillTrackEntity.setCheckTime(new Date()); - trunklineWaybillTrackService.save(waybillTrackEntity); + + if("20".equals(trackType)){ + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("warehouse_id",warehouseId) + .eq("waybill_id",waybillId) + .eq("track_type",trackType); + TrunklineWaybillTrackEntity waybillTrackEntity = trunklineWaybillTrackService.getOne(queryWrapper); + if(waybillTrackEntity!=null){ + waybillTrackEntity.setRefer(refer); + waybillTrackEntity.setOperationRemark(operationRemark); + waybillTrackEntity.setCreateUserName(nickName); + waybillTrackEntity.setUpdateTime(new Date()); + trunklineWaybillTrackService.updateById(waybillTrackEntity); + }else{ + waybillTrackEntity = new TrunklineWaybillTrackEntity(); + waybillTrackEntity.setWarehouseId(warehouseId); + waybillTrackEntity.setWarehouseName(warehouseName); + waybillTrackEntity.setWaybillId(waybillId); + waybillTrackEntity.setWaybillNo(waybillNo); + waybillTrackEntity.setTrackType(trackType); + waybillTrackEntity.setRefer(refer); + waybillTrackEntity.setOperationRemark(operationRemark); + waybillTrackEntity.setCreateUserName(nickName); + waybillTrackEntity.setCheckStatus(1); + waybillTrackEntity.setCheckTime(new Date()); + trunklineWaybillTrackService.save(waybillTrackEntity); + } + }else{ + TrunklineWaybillTrackEntity waybillTrackEntity = new TrunklineWaybillTrackEntity(); + waybillTrackEntity.setWarehouseId(warehouseId); + waybillTrackEntity.setWarehouseName(warehouseName); + waybillTrackEntity.setWaybillId(waybillId); + waybillTrackEntity.setWaybillNo(waybillNo); + waybillTrackEntity.setTrackType(trackType); + waybillTrackEntity.setRefer(refer); + waybillTrackEntity.setOperationRemark(operationRemark); + waybillTrackEntity.setCreateUserName(nickName); + waybillTrackEntity.setCheckStatus(1); + waybillTrackEntity.setCheckTime(new Date()); + trunklineWaybillTrackService.save(waybillTrackEntity); + } + + // DynamicDataSourceContextHolder.clear(); } @@ -131,7 +158,7 @@ public class OpenOrderAsyncServiceImpl implements IOpenOrderAsyncService { operationRemark = "干线从"+nodeName+"发车,实际发车时间"+ CommonUtil.dateToStringGeneral(new Date()); saveLog(waybillId,waybillNo,"40",nodeName+"已发车到"+nextWarehouseName,operationRemark,nickName,userId,nodeId,nodeName); } -// DynamicDataSourceContextHolder.clear(); + } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java index 20d5e60f2..91a6a7d7b 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java @@ -641,13 +641,13 @@ public class OpenOrderServiceImpl implements IOpenOrderService { String nickName = AuthUtil.getNickName(); Long userId = AuthUtil.getUserId(); - String createOperationRemark = "创建运单" + waybillNo + ",时间:" + CommonUtil.dateToString(waybillEntity.getCreateTime()); + String createOperationRemark = "创建运单" + waybillNo + ",时间:" + CommonUtil.dateToStringGeneral(new Date()); openOrderAsyncService.saveLog(waybillId, waybillNo, "10", "创建运单", createOperationRemark, nickName, userId, warehouseId, warehouseName); Integer totalCount = waybillEntity.getTotalCount(); Integer stockCount = waybillEntity.getStockCount(); if (totalCount.equals(stockCount)) { - createOperationRemark = "运单入库:" + stockCount + "/" + totalCount + ",入库类型:【批量入库】,入库时间:" + CommonUtil.dateToString(new Date()); + createOperationRemark = "运单入库:" + stockCount + "/" + totalCount + ",入库类型:【开单前已入库】,入库时间:" + CommonUtil.dateToStringGeneral(new Date()); openOrderAsyncService.saveLog(waybillId, waybillNo, "20", "已入库", createOperationRemark, nickName, userId, warehouseId, warehouseName); } @@ -857,13 +857,13 @@ public class OpenOrderServiceImpl implements IOpenOrderService { //异步存入日志 String nickName = AuthUtil.getNickName(); Long userId = AuthUtil.getUserId(); - String createOperationRemark = "创建运单" + waybillNo + ",时间:" + CommonUtil.dateToString(new Date()); + String createOperationRemark = "创建运单" + waybillNo + ",时间:" + CommonUtil.dateToStringGeneral(new Date()); openOrderAsyncService.saveLog(waybillId, waybillNo, "10", "创建运单", createOperationRemark, nickName, userId, warehouseId, warehouseName); Integer totalCount = waybillEntity.getTotalCount(); Integer stockCount = waybillEntity.getStockCount(); if (totalCount.equals(stockCount)) { - createOperationRemark = "运单入库:" + stockCount + "/" + totalCount + ",入库类型:【批量入库】,入库时间:" + CommonUtil.dateToString(waybillEntity.getCreateTime()); + createOperationRemark = "运单入库:" + stockCount + "/" + totalCount + ",入库类型:【零担开单及入库】,入库时间:" + CommonUtil.dateToStringGeneral(waybillEntity.getCreateTime()); openOrderAsyncService.saveLog(waybillId, waybillNo, "20", "已入库", createOperationRemark, nickName, userId, warehouseId, warehouseName); } @@ -2545,7 +2545,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { String nickName = AuthUtil.getNickName(); Long userId = AuthUtil.getUserId(); String waybillNo = warehouseWaybillEntity.getWaybillNo(); - String createOperationRemark = "审核运单" + waybillNo + ",时间:" + CommonUtil.dateToString(new Date()) + ", 审核人:" + AuthUtil.getNickName(); + String createOperationRemark = "审核运单" + waybillNo + ",时间:" + CommonUtil.dateToStringGeneral(new Date()) + ", 审核人:" + AuthUtil.getNickName(); openOrderAsyncService.saveLog(waybillId, waybillNo, "999", "审核运单", createOperationRemark, nickName, userId, warehouseId, warehouseName); return R.success("审核成功"); @@ -2925,13 +2925,13 @@ public class OpenOrderServiceImpl implements IOpenOrderService { String nickName = AuthUtil.getNickName(); Long userId = AuthUtil.getUserId(); - String createOperationRemark = "创建运单" + waybillNo + ",时间:" + CommonUtil.dateToString(new Date()); + String createOperationRemark = "创建运单" + waybillNo + ",时间:" + CommonUtil.dateToStringGeneral(new Date()); openOrderAsyncService.saveLog(waybillId, waybillNo, "10", "创建运单", createOperationRemark, nickName, userId, warehouseId, warehouseName); Integer totalCount = waybillEntity.getTotalCount(); Integer stockCount = waybillEntity.getStockCount(); if (totalCount.equals(stockCount)) { - createOperationRemark = "运单入库:" + stockCount + "/" + totalCount + ",入库类型:【批量入库】,入库时间:" + CommonUtil.dateToString(waybillEntity.getCreateTime()); + createOperationRemark = "运单入库:" + stockCount + "/" + totalCount + ",入库类型:【零担开单及入库】,入库时间:" + CommonUtil.dateToStringGeneral(waybillEntity.getCreateTime()); openOrderAsyncService.saveLog(waybillId, waybillNo, "20", "已入库", createOperationRemark, nickName, userId, warehouseId, warehouseName); } @@ -3065,7 +3065,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { waybillEntities.forEach(waybillEntity -> { - String createOperationRemark = "冻结运单" + waybillEntity.getWaybillNo() + ",时间:" + CommonUtil.dateToString(new Date()); + String createOperationRemark = "冻结运单" + waybillEntity.getWaybillNo() + ",时间:" + CommonUtil.dateToStringGeneral(new Date()); openOrderAsyncService.saveLog(waybillEntity.getId(), waybillEntity.getWaybillNo(), "990", "冻结运单", createOperationRemark, AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, warehouseName); }); @@ -3098,7 +3098,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { distributionParcelListClient.updateUnFreezeStatusByWaybillIds(waybillIds); waybillEntities.forEach(waybillEntity -> { - String createOperationRemark = "解冻运单" + waybillEntity.getWaybillNo() + ",时间:" + CommonUtil.dateToString(new Date()); + String createOperationRemark = "解冻运单" + waybillEntity.getWaybillNo() + ",时间:" + CommonUtil.dateToStringGeneral(new Date()); openOrderAsyncService.saveLog(waybillEntity.getId(), waybillEntity.getWaybillNo(), "991", "解冻运单", createOperationRemark, AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, warehouseName); }); @@ -3159,7 +3159,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService { } waybillList.forEach(waybillEntity -> { - String createOperationRemark = "作废运单" + waybillEntity.getWaybillNo() + ",时间:" + CommonUtil.dateToString(new Date()); + String createOperationRemark = "作废运单" + waybillEntity.getWaybillNo() + ",时间:" + CommonUtil.dateToStringGeneral(new Date()); openOrderAsyncService.saveLog(waybillEntity.getId(), waybillEntity.getWaybillNo(), "1000", "作废运单", createOperationRemark+" 原因:"+abolishReson, AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, warehouseName); }); return R.success("作废成功"); diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/PackageTrackLogAsyncServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/PackageTrackLogAsyncServiceImpl.java index 989645f8c..e83e6c1a5 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/PackageTrackLogAsyncServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/PackageTrackLogAsyncServiceImpl.java @@ -51,23 +51,26 @@ public class PackageTrackLogAsyncServiceImpl implements IPackageTrackLogAsyncSer } warehousePackageTrackLogClient.addLogList(list); - waybillPackageService.updatePackageStatus(orderPackageCodes, workNode); + waybillPackageService.updatePackageStatus(orderPackageCodes, workNode,warehouseId); } @LogpmAsync("asyncExecutor") @Override public void addBatchPackageTrackLog(List addPackageTrackLogList, List orderPackageCodes, Integer workNode) { warehousePackageTrackLogClient.addLogList(addPackageTrackLogList); + WarehousePackageTrackLogEntity warehousePackageTrackLogEntity = addPackageTrackLogList.get(0); + Long warehouseId = warehousePackageTrackLogEntity.getWarehouseId(); - waybillPackageService.updatePackageStatus(orderPackageCodes, workNode); + waybillPackageService.updatePackageStatus(orderPackageCodes, workNode,warehouseId); } @LogpmAsync("asyncExecutor") @Override - public void sendPackageWorkNodeFanout(List orderPackageCodes,Integer workNode) { + public void sendPackageWorkNodeFanout(List orderPackageCodes,Integer workNode,Long warehouseId) { JSONObject jsonObject = new JSONObject(); jsonObject.put("orderPackageCodes",orderPackageCodes); jsonObject.put("workNode",workNode); + jsonObject.put("warehouseId",warehouseId); FanoutMsg build = FanoutMsg.builder().msg(jsonObject.toJSONString()) .exchange(FanoutConstants.trunkline.PACKAGNODE.EXCHANGE).build(); diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java index 9d954b043..d4c6dfc4e 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java @@ -615,6 +615,10 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl pageList = trunklineLoadSignOrderService.finaSignOrderList(page, loadCarsDTO); + List records = pageList.getRecords(); + for (TrunklineLoadSignOrderVO record : records) { + Long id = record.getId(); + List bySignPhotoList = loadSignPhotoService.findBySignPhotoList(id); + record.setSignPhotoList(bySignPhotoList); + } + pageList.setRecords(records); return R.data(pageList); } @@ -4798,7 +4805,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl page = new Page<>(); + page.setCurrent(loadCarsDTO.getPageNum()); + page.setSize(loadCarsDTO.getPageSize()); + + IPage ls = trunklineLoadSignOrderService.findSignOrderPageList(page, loadCarsDTO); + + return R.data(ls); + } + + @Override + public R findSignPhotoList(LoadCarsDTO loadCarsDTO) { + Long signOrderId = loadCarsDTO.getSignOrderId(); + List ls = loadSignPhotoService.findBySignPhotoList(signOrderId); + + return R.data(ls); + } + @Override public R loadingTrayInfo(LoadCarsDTO loadCarsDTO) { log.info("##############loadingTrayInfo: 查询托盘的货物信息"); diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineLoadSignOrderServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineLoadSignOrderServiceImpl.java index a066408dc..259b5b1ea 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineLoadSignOrderServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineLoadSignOrderServiceImpl.java @@ -3,6 +3,7 @@ package com.logpm.trunkline.service.impl; import com.baomidou.mybatisplus.core.metadata.IPage; import com.logpm.trunkline.dto.LoadCarsDTO; import com.logpm.trunkline.entity.TrunklineLoadSignOrderEntity; +import com.logpm.trunkline.entity.TrunklineLoadSignPhotoEntity; import com.logpm.trunkline.mapper.TrunklineLoadSignOrderMapper; import com.logpm.trunkline.service.ITrunklineLoadSignOrderService; import com.logpm.trunkline.vo.SignOrderDetailVO; @@ -48,4 +49,9 @@ public class TrunklineLoadSignOrderServiceImpl extends BaseServiceImpl findSignOrderPageList(IPage page, LoadCarsDTO loadCarsDTO) { + return baseMapper.findSignOrderPageList(page,loadCarsDTO); + } } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillPackageServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillPackageServiceImpl.java index 4986d4508..fbb9aaf5f 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillPackageServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillPackageServiceImpl.java @@ -145,7 +145,7 @@ public class TrunklineWaybillPackageServiceImpl extends BaseServiceImpl orderPackageCodes, Integer workNode) { + public void updatePackageStatus(List orderPackageCodes, Integer workNode,Long warehouseId) { Integer packageStatus = null; if(WorkNodeEnums.INITIAL_WAREHOUSE_DEPART.getCode().equals(workNode)){ @@ -159,31 +159,26 @@ public class TrunklineWaybillPackageServiceImpl extends BaseServiceImpl waybillPackageEntities = new ArrayList<>(); Set waybillIds = new HashSet<>(); - for (String orderPackageCode : orderPackageCodes) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("order_package_code",orderPackageCode) - .eq("is_deleted",0); - List trunklineWaybillPackageEntities = baseMapper.selectList(queryWrapper); - if(trunklineWaybillPackageEntities.isEmpty()){ - continue; - } - TrunklineWaybillPackageEntity waybillPackageEntity = trunklineWaybillPackageEntities.get(0); - - if(Objects.isNull(waybillPackageEntity)){ - continue; - } - waybillPackageEntity.setPackageStatus(packageStatus); - waybillPackageEntities.add(waybillPackageEntity); - waybillIds.add(waybillPackageEntity.getWaybillId()); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.in("order_package_code",orderPackageCodes) + .eq("is_deleted",0); + List trunklineWaybillPackageEntities = baseMapper.selectList(queryWrapper); + if(trunklineWaybillPackageEntities.isEmpty()){ + return; + } + for (TrunklineWaybillPackageEntity trunklineWaybillPackageEntity : trunklineWaybillPackageEntities) { + trunklineWaybillPackageEntity.setPackageStatus(packageStatus); + waybillIds.add(trunklineWaybillPackageEntity.getWaybillId()); } - updateBatchById(waybillPackageEntities); - + updateBatchById(trunklineWaybillPackageEntities); for (Long waybillId : waybillIds) { WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillId(waybillId); @@ -192,7 +187,7 @@ public class TrunklineWaybillPackageServiceImpl extends BaseServiceImpl orderPackageCodes,Long warehouseId); diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java index 4ea83a6ce..0d304e75e 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java @@ -891,11 +891,11 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl updownGoodsEntityQueryWrapper = new QueryWrapper<>(); @@ -904,36 +904,36 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl