diff --git a/blade-biz-common/src/main/java/org/springblade/common/enums/BrandEnums.java b/blade-biz-common/src/main/java/org/springblade/common/enums/BrandEnums.java new file mode 100644 index 000000000..b5f53f8a4 --- /dev/null +++ b/blade-biz-common/src/main/java/org/springblade/common/enums/BrandEnums.java @@ -0,0 +1,45 @@ +package org.springblade.common.enums; + +import cn.hutool.core.util.EnumUtil; +import lombok.Getter; + +import java.io.Serializable; + +/** + * 定义工厂枚举 + * + * @author zhaoqiaobo + * @create 2024-03-20 16:08 + */ +@Getter +public enum BrandEnums implements Serializable { + + ZB(1, "志邦"), + SNM(2, "诗尼曼"), + PAN(3, "皮阿诺"), + MTMM(4, "梦天"), + OP(5, "欧派"), + SFY(6, "索菲亚"), + JP(7, "金牌"), + OLO(8, "我乐"), + MHJ(9, "曼好家"), + LINSY(10, "林氏家居"), + ; + + private final Integer code; + private final String value; + + BrandEnums(Integer code, String value) { + this.code = code; + this.value = value; + } + + public static BrandEnums getByCode(Integer code) { + return EnumUtil.getBy(BrandEnums::getCode, code); + } + + public static BrandEnums getByValue(String val) { + return EnumUtil.getBy(BrandEnums::getValue, val); + } + +} diff --git a/blade-biz-common/src/main/java/org/springblade/common/enums/PackageTypeEnums.java b/blade-biz-common/src/main/java/org/springblade/common/enums/PackageTypeEnums.java new file mode 100644 index 000000000..ab0d45c4d --- /dev/null +++ b/blade-biz-common/src/main/java/org/springblade/common/enums/PackageTypeEnums.java @@ -0,0 +1,31 @@ +package org.springblade.common.enums; + +import org.springblade.common.model.IDict; + +/** + * 包件类型枚举 + * + * @author zhaoqiaobo + * @create 2024-03-20 16:08 + */ +public enum PackageTypeEnums implements IDict { + + /** + * 订制品 + */ + CMP(1, "订制品"), + /** + * 零担 + */ + LTL(2, "零担"), + /** + * 库存品 + */ + INV(3, "库存品"), + ; + + PackageTypeEnums(Integer code, String value) { + init(code, value); + } + +} 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 new file mode 100644 index 000000000..bd6a4214a --- /dev/null +++ b/blade-biz-common/src/main/java/org/springblade/common/model/NodeFanoutMsg.java @@ -0,0 +1,59 @@ +package org.springblade.common.model; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springblade.common.constant.WorkNodeEnums; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 节点广播消息 + * 用于节点操作触发消息发送广播通知 + * + * @author zhaoqiaobo + * @create 2024-03-18 0:45 + */ +@Builder +@Data +@NoArgsConstructor +@AllArgsConstructor +public class NodeFanoutMsg implements Serializable { + + /** + * 作业节点 + */ + private WorkNodeEnums node; + + /** + * 操作人 + */ + private String operator; + + /** + * 操作时间 + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") + private Date operatorTime; + + /** + * 当前仓 + */ + private String warehouse; + + /** + * 主单数据 + * {"boId":"业务id","":""} + */ + private Object main; + + /** + * 内容 + */ + private List details; + +} diff --git a/blade-biz-common/src/main/java/org/springblade/common/model/PackageData.java b/blade-biz-common/src/main/java/org/springblade/common/model/PackageData.java new file mode 100644 index 000000000..377731934 --- /dev/null +++ b/blade-biz-common/src/main/java/org/springblade/common/model/PackageData.java @@ -0,0 +1,49 @@ +package org.springblade.common.model; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springblade.common.enums.BrandEnums; +import org.springblade.common.enums.PackageTypeEnums; + +import java.io.Serializable; + +/** + * 提送数据 + * + * @author zhaoqiaobo + * @create 2024-03-18 0:45 + */ +@Builder +@Data +@NoArgsConstructor +@AllArgsConstructor +public class PackageData implements Serializable { + + /** + * 包件码 + */ + private String packageCode; + /** + * 订单号 + */ + private String orderCode; + /** + * 运单号 + */ + private String waybillNumber; + /** + * 数量 + */ + private String number; + /** + * 包件类型 订制品,库存品,零担 + */ + private PackageTypeEnums packageType; + /** + * 品牌 + */ + private BrandEnums brand; + +} diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/ZeroNumVO.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/ZeroNumVO.java new file mode 100644 index 000000000..ba6282ad9 --- /dev/null +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/ZeroNumVO.java @@ -0,0 +1,13 @@ +package com.logpm.trunkline.vo; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ZeroNumVO implements Serializable { + + private String waybillNo; + private Integer num; + +} diff --git a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/controller/AftersalesWorkOrderController.java b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/controller/AftersalesWorkOrderController.java index 72d9df1d2..0242af750 100644 --- a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/controller/AftersalesWorkOrderController.java +++ b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/controller/AftersalesWorkOrderController.java @@ -470,7 +470,7 @@ public class AftersalesWorkOrderController extends BladeController { return R.fail(s.getMessage()); }catch (Exception e){ log.error("客服操作确定修改》》》{}",e.getMessage()); - return R.fail("系统异常!!"); + return R.fail("系统错误:"+e.getMessage()); } } diff --git a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesWorkOrderServiceImpl.java b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesWorkOrderServiceImpl.java index 6de7491c0..6946b04f0 100644 --- a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesWorkOrderServiceImpl.java +++ b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesWorkOrderServiceImpl.java @@ -47,6 +47,7 @@ import org.springblade.common.annotations.LogpmAsync; import org.springblade.common.constant.DictBizConstant; import org.springblade.common.constant.DictTimeoutEnum; import org.springblade.common.constant.aftersales.*; +import org.springblade.common.exception.CustomerException; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.secure.BladeUser; @@ -2405,17 +2406,17 @@ public class AftersalesWorkOrderServiceImpl extends BaseServiceImpl inOrder(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { -// try { + try { Boolean isSuccess = distributionIBusinessPreOrderService.inOrder(ids); return R.data(isSuccess); -// }catch (Exception e){ -// log.error("预入库信息入库失败",e); -// return R.fail(500,e.getMessage()); -// } + }catch (Exception e){ + log.error("预入库信息入库失败",e); + return R.fail(500,e.getMessage()); + } } 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 60daa8e6e..102c8481d 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 @@ -12,6 +12,7 @@ import com.logpm.distribution.vo.app.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; @@ -28,6 +29,7 @@ import java.util.List; */ @RestController @AllArgsConstructor +@Slf4j @RequestMapping("/app/delivery") @Api(value = "配送管理", tags = "配送管理App接口") public class DistributionDeliveryAppController { @@ -142,7 +144,8 @@ public class DistributionDeliveryAppController { msg = distributionDeliveryListService.loadingscan(distrilbutionloadingscanDTO); }catch (Exception e){ - e.printStackTrace(); + msg = R.fail(e.getMessage()); + log.error(e.getMessage()); } return msg; @@ -155,7 +158,13 @@ public class DistributionDeliveryAppController { @ApiOperationSupport(order = 6) @ApiOperation(value = "装车扫描", notes = "传入DistrilbutionloadingscanDTO") public R zeroLoading(@Valid @RequestBody DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) { - R msg = distributionDeliveryListService.zeroLoading(distrilbutionloadingscanDTO); + R msg = null; + try { + msg = distributionDeliveryListService.zeroLoading(distrilbutionloadingscanDTO); + } catch (Exception e) { + msg = R.fail(e.getMessage()); + log.error(e.getMessage()); + } return msg; } @@ -200,7 +209,13 @@ public class DistributionDeliveryAppController { @ApiOperationSupport(order = 8) @ApiOperation(value = "装车扫描(取消)", notes = "传入DistrilbutionloadingscanDTO") public R loadingscanoff(@Valid @RequestBody DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) { - R msg = distributionDeliveryListService.loadingscanoff(distrilbutionloadingscanDTO); + R msg = null; + try { + msg = distributionDeliveryListService.loadingscanoff(distrilbutionloadingscanDTO); + } catch (Exception e) { + msg = R.fail(e.getMessage()); + log.error(e.getMessage()); + } return msg; } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionSignforAppController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionSignforAppController.java index 1fdcfddeb..a89a6b54a 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionSignforAppController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionSignforAppController.java @@ -161,7 +161,10 @@ public class DistributionSignforAppController { orderPackageCodes = orderPackageCodes + "," + packageCode; } } - updownTypeClient.downPackageOrDelTray(orderPackageCodes, myCurrentWarehouse.getId(), "签收下架解托"); + if(StringUtils.isNotBlank(orderPackageCodes)){ + updownTypeClient.downPackageOrDelTray(orderPackageCodes, myCurrentWarehouse.getId(), "签收下架解托"); + } + } return r; diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionDeliveryListController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionDeliveryListController.java index d3ba24c18..0cd669011 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionDeliveryListController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionDeliveryListController.java @@ -487,13 +487,15 @@ public class DistributionDeliveryListController extends BladeController { orderPackageCodes = orderPackageCodes + "," + packageCode; } } - warehouseUpdownTypeClient.downPackageOrDelTray(orderPackageCodes,myCurrentWarehouse.getId(),"签收下架解托"); + if(StringUtils.isNotBlank(orderPackageCodes)){ + warehouseUpdownTypeClient.downPackageOrDelTray(orderPackageCodes,myCurrentWarehouse.getId(),"签收下架解托"); + } } return r; }catch (Exception e){ log.error("#############signforPC:",e); - return R.fail("签收失败"); + return R.fail("签收失败"+e.getMessage()); } } 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 9073ac6df..97614f74b 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 @@ -178,8 +178,14 @@ public class DistributionReservationController extends BladeController { @ApiOperationSupport(order = 4) @ApiOperation(value = "新增", notes = "传入distrbutionReservation") public R autonomouslySave(@Valid @RequestBody DistributionReservationDTO distributionReservationDTO) { - R result = reservationService.insertAutonomouslyReservation(distributionReservationDTO); - return result; + try{ + R result = reservationService.insertAutonomouslyReservation(distributionReservationDTO); + + return result; + }catch (Exception e){ + return R.fail(e.getMessage()); + } + } /** 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 870034671..8f73f4546 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 @@ -324,7 +324,9 @@ public class DistributionSignforController extends BladeController { orderPackageCodes = orderPackageCodes + "," +packageCode; } } - updownTypeClient.downPackageOrDelTray(orderPackageCodes,myCurrentWarehouse.getId(),"文员一键签收下架解托"); + if(StringUtils.isNotBlank(orderPackageCodes)){ + updownTypeClient.downPackageOrDelTray(orderPackageCodes,myCurrentWarehouse.getId(),"文员一键签收下架解托"); + } }catch (Exception e){ log.error("##############oneclick: 更新包件下架状态失败 packageCodes={}",packageCodes); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml index f197e6fb0..4aa8dcb0f 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml @@ -897,7 +897,7 @@ FROM logpm_distribution_stock_article AS ldsa LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldsa.id = ldpl.stock_article_id LEFT JOIN logpm_distribution_parcel_number AS ldpn ON ldpn.parcel_list_id = ldpl.id - WHERE ldsa.id = #{stockArticleId} + WHERE ldsa.id = #{stockArticleId} AND ldpl.is_transfer = 0 + select waybill_no waybillNo, + sum(num) num + from logpm_trunkline_cars_load_scan + where load_id = #{loadId} + and warehouse_id = #{warehouseId} + group by waybill_no + + + diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadScanService.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadScanService.java index 7976a2e59..51913e4ef 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadScanService.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadScanService.java @@ -164,4 +164,6 @@ public interface ITrunklineCarsLoadScanService extends BaseService findAbnormalZeroScanList(Long loadId, Long warehouseId); + + List findZeroStartNum(Long loadId, Long warehouseId); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineWaybillOrderService.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineWaybillOrderService.java index dbe111831..2c32d61b2 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineWaybillOrderService.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineWaybillOrderService.java @@ -25,4 +25,5 @@ public interface ITrunklineWaybillOrderService extends BaseService findZeroStartNum(Long loadId, Long warehouseId) { + return baseMapper.findZeroStartNum(loadId,warehouseId); + } + } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java index ee55cbc4e..8612ae4a3 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java @@ -51,6 +51,7 @@ import com.logpm.warehouse.feign.IWarehouseWaybillDetailClient; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringEscapeUtils; +import org.apache.commons.lang.StringUtils; import org.springblade.common.annotations.RepeatSubmit; import org.springblade.common.constant.*; import org.springblade.common.constant.carsload.CarsLoadLogTypeConstant; @@ -368,6 +369,51 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl zeroNumVOList = trunklineCarsLoadScanService.findZeroStartNum(loadId,warehouseId); + if(CollUtil.isNotEmpty(zeroNumVOList)){ + zeroNumVOList.forEach(zeroNumVO -> { + String waybillNo = zeroNumVO.getWaybillNo(); + Integer num = zeroNumVO.getNum(); + WarehouseWaybillEntity waybill = warehouseWaybillClient.findByWaybillNo(waybillNo); + Integer totalCount = waybill.getTotalCount(); + Integer waybillStatusInt = Integer.parseInt(waybill.getWaybillStatus()); + TrunklineWaybillOrderEntity waybillOrderEntity = trunklineWaybillOrderService.findEntityByWaybillNoAndOrderCode(waybillNo,waybillNo); + if(!Objects.isNull(waybillOrderEntity)){ + Integer handleNumber = waybillOrderEntity.getHandleNumber(); + if(Objects.isNull(handleNumber)){ + handleNumber = 0; + } + int i = handleNumber + num; + if(waybillStatusInt < 30){ + if(totalCount == i){ + waybill.setWaybillStatus("40"); + waybillOrderEntity.setHandleNumber(i); + warehouseWaybillClient.updateEntity(waybill); + trunklineWaybillOrderService.updateById(waybillOrderEntity); + }else{ + waybill.setWaybillStatus("30"); + waybillOrderEntity.setHandleNumber(i); + warehouseWaybillClient.updateEntity(waybill); + trunklineWaybillOrderService.updateById(waybillOrderEntity); + } + }else if(waybillStatusInt == 30){ + if(totalCount == i){ + waybill.setWaybillStatus("40"); + waybillOrderEntity.setHandleNumber(i); + warehouseWaybillClient.updateEntity(waybill); + trunklineWaybillOrderService.updateById(waybillOrderEntity); + }else{ + waybillOrderEntity.setHandleNumber(i); + trunklineWaybillOrderService.updateById(waybillOrderEntity); + } + } + + } + }); + } + //更新关联订单数据的发车数量 trunklineCarsOrderService.updateStartNumByLoadIdAndWarehouseId(loadId, warehouseId); //删除没有装车的计划数据 @@ -755,6 +801,41 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl zeroNumVOList = trunklineCarsLoadScanService.findZeroStartNum(loadId,warehouseId); + if(CollUtil.isNotEmpty(zeroNumVOList)){ + zeroNumVOList.forEach(zeroNumVO -> { + String waybillNo = zeroNumVO.getWaybillNo(); + Integer num = zeroNumVO.getNum(); + WarehouseWaybillEntity waybill = warehouseWaybillClient.findByWaybillNo(waybillNo); + Integer totalCount = waybill.getTotalCount(); + Integer waybillStatusInt = Integer.parseInt(waybill.getWaybillStatus()); + TrunklineWaybillOrderEntity waybillOrderEntity = trunklineWaybillOrderService.findEntityByWaybillNoAndOrderCode(waybillNo,waybillNo); + if(!Objects.isNull(waybillOrderEntity)){ + Integer handleNumber = waybillOrderEntity.getHandleNumber(); + if(waybillStatusInt == 40 || waybillStatusInt == 30){ + if(Objects.isNull(handleNumber)){ + handleNumber = 0; + } + int i = handleNumber - num; + if(i==0){ + waybill.setWaybillStatus("20"); + waybillOrderEntity.setHandleNumber(totalCount); + }else{ + waybill.setWaybillStatus("30"); + waybillOrderEntity.setHandleNumber(i); + } + + warehouseWaybillClient.updateEntity(waybill); + trunklineWaybillOrderService.updateById(waybillOrderEntity); + } + + } + + }); + } + //更新关联订单数据的发车数量 trunklineCarsOrderService.updateStartNumToPlanNumByLoadIdAndWarehouseId(loadId, warehouseId); @@ -1003,6 +1084,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl queryWrapper1 = new QueryWrapper<>(); - queryWrapper1.eq("waybill_no",stockArticleEntity.getWaybillNumber()) - .eq("order_code",stockArticleEntity.getWaybillNumber()); - TrunklineWaybillOrderEntity one = trunklineWaybillOrderService.getOne(queryWrapper1); - if(!Objects.isNull(one)){ - WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillNo(stockArticleEntity.getWaybillNumber()); - Integer totalCount = waybillEntity.getTotalCount(); - Integer waybillStatusInt = Integer.parseInt(waybillEntity.getWaybillStatus()); - if(waybillStatusInt <= 30){ - Integer handleNumber = one.getHandleNumber(); - int total = handleNumber + unloadNum; - if(total < totalCount){ - waybillEntity.setWaybillStatus("50"); - one.setHandleNumber(total); - }else{ - waybillEntity.setWaybillStatus("60"); - one.setHandleNumber(totalCount); - } - warehouseWaybillClient.updateEntity(waybillEntity); - trunklineWaybillOrderService.updateById(one); - } - } - } +// if(isTransfer == 0){ +// //查询零担发车件数 +// List zeroNumVOList = trunklineCarsLoadScanService.findZeroStartNum(loadId,warehouseId); +// if(CollUtil.isNotEmpty(zeroNumVOList)){ +// zeroNumVOList.forEach(zeroNumVO -> { +// String waybillNo = zeroNumVO.getWaybillNo(); +// Integer num = zeroNumVO.getNum(); +// WarehouseWaybillEntity waybill = warehouseWaybillClient.findByWaybillNo(waybillNo); +// Integer totalCount = waybill.getTotalCount(); +// Integer waybillStatusInt = Integer.parseInt(waybill.getWaybillStatus()); +// TrunklineWaybillOrderEntity waybillOrderEntity = trunklineWaybillOrderService.findEntityByWaybillNoAndOrderCode(waybillNo,waybillNo); +// if(!Objects.isNull(waybillOrderEntity)){ +// Integer handleNumber = waybillOrderEntity.getHandleNumber(); +// if(waybillStatusInt <= 40){ +// if(Objects.isNull(handleNumber)){ +// handleNumber = 0; +// } +// int i = handleNumber - num; +// if(i==0){ +// waybill.setWaybillStatus("20"); +// waybillOrderEntity.setHandleNumber(totalCount); +// }else{ +// waybill.setWaybillStatus("30"); +// waybillOrderEntity.setHandleNumber(i); +// } +// +// warehouseWaybillClient.updateEntity(waybill); +// trunklineWaybillOrderService.updateById(waybillOrderEntity); +// } +// +// } +// +// }); +// } +// } } } else { Integer hQuantity = newStockArticleEntity.getHandQuantity() + unloadNum; @@ -1231,38 +1324,77 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl queryWrapper1 = new QueryWrapper<>(); - queryWrapper1.eq("waybill_no",stockArticleEntity.getWaybillNumber()) - .eq("order_code",stockArticleEntity.getWaybillNumber()); - TrunklineWaybillOrderEntity one = trunklineWaybillOrderService.getOne(queryWrapper1); - if(!Objects.isNull(one)){ - Integer totalCount = warehouseWaybillEntity.getTotalCount(); - Integer waybillStatusInt = Integer.parseInt(warehouseWaybillEntity.getWaybillStatus()); - if(waybillStatusInt <= 30){ - Integer handleNumber = one.getHandleNumber(); - int total = handleNumber + unloadNum; - if(total < totalCount){ - warehouseWaybillEntity.setWaybillStatus("50"); - one.setHandleNumber(total); - }else{ - warehouseWaybillEntity.setWaybillStatus("60"); - one.setHandleNumber(totalCount); - } - warehouseWaybillClient.updateEntity(warehouseWaybillEntity); - trunklineWaybillOrderService.updateById(one); - } - } - } +// String waybillNumber = newStockArticleEntity.getWaybillNumber(); +// WarehouseWaybillEntity warehouseWaybillEntity = warehouseWaybillClient.findByWaybillNo(waybillNumber); +// Long destinationWarehouseId = warehouseWaybillEntity.getDestinationWarehouseId(); +// if(warehouseId.equals(destinationWarehouseId)){ +// QueryWrapper queryWrapper1 = new QueryWrapper<>(); +// queryWrapper1.eq("waybill_no",stockArticleEntity.getWaybillNumber()) +// .eq("order_code",stockArticleEntity.getWaybillNumber()); +// TrunklineWaybillOrderEntity one = trunklineWaybillOrderService.getOne(queryWrapper1); +// if(!Objects.isNull(one)){ +// Integer totalCount = warehouseWaybillEntity.getTotalCount(); +// Integer waybillStatusInt = Integer.parseInt(warehouseWaybillEntity.getWaybillStatus()); +// if(waybillStatusInt <= 30){ +// Integer handleNumber = one.getHandleNumber(); +// int total = handleNumber + unloadNum; +// if(total < totalCount){ +// warehouseWaybillEntity.setWaybillStatus("50"); +// one.setHandleNumber(total); +// }else{ +// warehouseWaybillEntity.setWaybillStatus("60"); +// one.setHandleNumber(totalCount); +// } +// warehouseWaybillClient.updateEntity(warehouseWaybillEntity); +// trunklineWaybillOrderService.updateById(one); +// } +// } +// } } } } } }); + + + WarehouseWaybillEntity warehouseWaybillEntity = warehouseWaybillClient.findByWaybillNo(orderCode); + String waybillNo = warehouseWaybillEntity.getWaybillNo(); + Long waybillId = warehouseWaybillEntity.getId(); + int unloadNum = orderCodeList.stream().mapToInt(TrunklineCarsLoadScanEntity::getUnloadNum).sum(); + Long destinationWarehouseId = warehouseWaybillEntity.getDestinationWarehouseId(); + if(warehouseId.equals(destinationWarehouseId)){ + QueryWrapper queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("waybill_no",orderCode) + .eq("order_code",orderCode); + TrunklineWaybillOrderEntity one = trunklineWaybillOrderService.getOne(queryWrapper1); + if(!Objects.isNull(one)){ + Integer handleNumber = one.getHandleNumber(); + Integer totalCount = warehouseWaybillEntity.getTotalCount(); + Integer waybillStatusInt = Integer.parseInt(warehouseWaybillEntity.getWaybillStatus()); + int total = handleNumber + unloadNum; + if(waybillStatusInt < 50){ + if(total != totalCount){ + warehouseWaybillEntity.setWaybillStatus("50"); + one.setHandleNumber(total); + warehouseWaybillClient.updateEntity(warehouseWaybillEntity); + trunklineWaybillOrderService.updateById(one); + }else{ + warehouseWaybillEntity.setWaybillStatus("60"); + one.setHandleNumber(total); + warehouseWaybillClient.updateEntity(warehouseWaybillEntity); + trunklineWaybillOrderService.updateById(one); + } + }else if(waybillStatusInt == 50){ + if(total == totalCount){ + warehouseWaybillEntity.setWaybillStatus("60"); + one.setHandleNumber(total); + warehouseWaybillClient.updateEntity(warehouseWaybillEntity); + trunklineWaybillOrderService.updateById(one); + } + } + } + } }); } @@ -2649,7 +2781,10 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl queryWrapper1 = new QueryWrapper<>(); + queryWrapper1.eq("waybill_id",waybillId) + .eq("order_code",waybillNo); + TrunklineWaybillOrderEntity one = trunklineWaybillOrderService.getOne(queryWrapper1); + if(!Objects.isNull(one)){ + Integer totalCount = waybillEntity.getTotalCount(); + Integer waybillStatusInt = Integer.parseInt(waybillEntity.getWaybillStatus()); + if(waybillStatusInt <= 40){ + Integer handleNumber = one.getHandleNumber(); + int total = handleNumber - num; + if(total == 0){ + waybillEntity.setWaybillStatus("20"); + one.setHandleNumber(total); + }else{ + waybillEntity.setWaybillStatus("30"); + one.setHandleNumber(totalCount); + } + warehouseWaybillClient.updateEntity(waybillEntity); + trunklineWaybillOrderService.updateById(one); + } + } + } } }); } @@ -7279,7 +7441,9 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("waybill_no",waybillNo) + .eq("order_code",orderCode); + return baseMapper.selectOne(queryWrapper); + } } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/TaskQuestController.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/TaskQuestController.java index fbd284ab7..29e548249 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/TaskQuestController.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/TaskQuestController.java @@ -25,6 +25,7 @@ import com.logpm.warehouse.dto.TaskQuestDTO; import com.logpm.warehouse.dto.TaskSearchDTO; import com.logpm.warehouse.entity.TaskQuestEntity; import com.logpm.warehouse.excel.QuestContrastExcel; +import com.logpm.warehouse.excel.QuestContrastPackageExcelVO; import com.logpm.warehouse.excel.TaskQueryDataExcel; import com.logpm.warehouse.excel.TaskQuestExcel; import com.logpm.warehouse.service.ITaskQuestService; @@ -49,13 +50,18 @@ import org.springblade.core.tool.constant.BladeConstant; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.StringUtil; +import org.springblade.system.cache.UserCache; +import org.springblade.system.entity.User; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; +import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; /** * 盘点任务 控制器 @@ -210,6 +216,51 @@ public class TaskQuestController extends BladeController { } + + @GetMapping("/export-allDataWithPackage") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "导出全部数据明细维度", notes = "传入questDetailDTO") + public void exportAllDataWithPackage(QuestDetailDTO questDetailDTO, HttpServletResponse response){ + String questNum = questDetailDTO.getQuestNum(); + List list = taskQuestService.exportAllDataWithPackage(questDetailDTO); + ExcelUtil.export(response, "盘点任务【"+questNum+"】数据" + DateUtil.time(), "盘点明细数据表", list, QuestContrastPackageExcelVO.class); + + } + + + @GetMapping("/export-panDataWithPackage") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "导出已盘数据明细维度", notes = "传入questDetailDTO") + public void exportPanDataWithPackage(QuestDetailDTO questDetailDTO, HttpServletResponse response){ + String questNum = questDetailDTO.getQuestNum(); + List ls = new ArrayList(); + List list = taskQuestService.exportPanDataWithPackage(questDetailDTO); + //提取出list中inventoryUser为空的元素 + List inventoryUserEmptyList = list.stream() + .filter(item -> item.getInventoryUser() == null) + .collect(Collectors.toList()); + + //把list中所有元素通过inventoryUser进行分组 + Map> groupedByInventoryUser = list.stream().filter(item -> !Objects.isNull(item.getInventoryUser())) + .collect(Collectors.groupingBy(QuestContrastPackageExcelVO::getInventoryUser)); + groupedByInventoryUser.keySet().forEach(inventoryUser -> { + List questContrastPackageExcelVOS = groupedByInventoryUser.get(inventoryUser); + User user = UserCache.getUser(inventoryUser); + if(!Objects.isNull(user)){ + questContrastPackageExcelVOS.forEach(questContrastPackageExcelVO -> { + questContrastPackageExcelVO.setInventoryUserStr(user.getName()); + }); + } + + ls.addAll(questContrastPackageExcelVOS); + }); + ls.addAll(inventoryUserEmptyList); + + ExcelUtil.export(response, "盘点任务【"+questNum+"】数据" + DateUtil.time(), "盘点明细数据表", ls, QuestContrastPackageExcelVO.class); + + } + + /** * 导出数据 */ diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/WarehouseWaybillController.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/WarehouseWaybillController.java index 63cf135e8..f6d591937 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/WarehouseWaybillController.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/WarehouseWaybillController.java @@ -402,7 +402,7 @@ public class WarehouseWaybillController extends BladeController { Map> printPreviewVOS = warehouseWaybillService.printBatch(ids, tempId); return R.data(printPreviewVOS); } catch (Exception e) { - throw new RuntimeException(e); + return R.fail(e.getMessage()); } } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/QuestDetailDTO.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/QuestDetailDTO.java index 94613c953..456499d3d 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/QuestDetailDTO.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/QuestDetailDTO.java @@ -53,7 +53,4 @@ public class QuestDetailDTO extends QuestDetailEntity { private String endTime;// 结束时间 - - - } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/excel/QuestContrastPackageExcelVO.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/excel/QuestContrastPackageExcelVO.java new file mode 100644 index 000000000..1e130b94e --- /dev/null +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/excel/QuestContrastPackageExcelVO.java @@ -0,0 +1,109 @@ +package com.logpm.warehouse.excel; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class QuestContrastPackageExcelVO implements Serializable { + + @ColumnWidth(20) + @ExcelProperty(value = "订单号") + private String orderCode; + + @ColumnWidth(20) + @ExcelProperty(value = "运单号") + private String waybillNumber; + + @ColumnWidth(20) + @ExcelProperty(value = "盘点方式") + private String questType; + + @ColumnWidth(20) + @ExcelProperty(value = "盘点对象") + private String questTarget; + + @ColumnWidth(20) + @ExcelProperty(value = "盘点状态") + private String questStatus; + + @ColumnWidth(20) + @ExcelProperty(value = "包件码") + private String orderPackageCode; + + @ColumnWidth(20) + @ExcelProperty(value = "品类名称") + private String categoryName; + + @ColumnWidth(20) + @ExcelProperty(value = "在库数量") + private Integer stockNum; + + @ColumnWidth(20) + @ExcelProperty(value = "物料编码") + private String materialCode; + + @ColumnWidth(20) + @ExcelProperty(value = "物料名称") + private String materialName; + + @ColumnWidth(20) + @ExcelProperty(value = "一级品类") + private String firsts; + + @ColumnWidth(20) + @ExcelProperty(value = "二级品类") + private String seconds; + + @ColumnWidth(20) + @ExcelProperty(value = "三级品类") + private String thirdProduct; + + @ColumnWidth(20) + @ExcelProperty(value = "商场名称") + private String marketName; + + @ColumnWidth(20) + @ExcelProperty(value = "批次号") + private String incomingBatch; + + @ColumnWidth(20) + @ExcelProperty(value = "发站仓名称") + private String sendWarehouseName; + + @ColumnWidth(20) + @ExcelProperty(value = "品牌") + private String brandName; + + @ColumnWidth(20) + @ExcelProperty(value = "原有托盘") + private String trayName; + + @ColumnWidth(20) + @ExcelProperty(value = "原有库位") + private String positionCode; + + @ColumnWidth(20) + @ExcelProperty(value = "新托盘") + private String newTrayName; + + @ColumnWidth(20) + @ExcelProperty(value = "新库位") + private String groundingPositionCode; + + @ColumnWidth(20) + @ExcelProperty(value = "盘点时间") + private Date inventoryTime; + + @ExcelIgnore + private Long inventoryUser; + + @ColumnWidth(20) + @ExcelProperty(value = "盘点人") + private String inventoryUserStr; + +} diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/TaskQuestMapper.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/TaskQuestMapper.java index b860c9ac5..6edcc1f82 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/TaskQuestMapper.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/TaskQuestMapper.java @@ -23,6 +23,7 @@ import com.logpm.warehouse.entity.QuestDetailChildEntity; import com.logpm.warehouse.entity.QuestDetailEntity; import com.logpm.warehouse.entity.TaskQuestEntity; import com.logpm.warehouse.entity.WarehouseTrayEntity; +import com.logpm.warehouse.excel.QuestContrastPackageExcelVO; import com.logpm.warehouse.excel.TaskQueryDataExcel; import com.logpm.warehouse.vo.*; import com.logpm.warehouse.excel.TaskQuestExcel; @@ -198,4 +199,8 @@ public interface TaskQuestMapper extends BaseMapper { List findIsChangeData(@Param("questNum") String questNum); Integer findStockNum(@Param("questDetailId") Long questDetailId, @Param("tableName") String tableName); + + List exportAllDataWithPackage(@Param("param") QuestDetailDTO questDetailDTO); + + List exportPanDataWithPackage(@Param("param") QuestDetailDTO questDetailDTO); } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/TaskQuestMapper.xml b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/TaskQuestMapper.xml index a05695860..d344c263a 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/TaskQuestMapper.xml +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/TaskQuestMapper.xml @@ -707,4 +707,85 @@ + + + + diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/ITaskQuestService.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/ITaskQuestService.java index 873e6b5d4..c963f81d4 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/ITaskQuestService.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/ITaskQuestService.java @@ -26,6 +26,7 @@ import com.logpm.warehouse.entity.QuestDetailChildEntity; import com.logpm.warehouse.entity.QuestDetailEntity; import com.logpm.warehouse.entity.TaskQuestEntity; import com.logpm.warehouse.excel.QuestContrastExcel; +import com.logpm.warehouse.excel.QuestContrastPackageExcelVO; import com.logpm.warehouse.excel.TaskQueryDataExcel; import com.logpm.warehouse.excel.TaskQuestExcel; import com.logpm.warehouse.vo.*; @@ -305,4 +306,8 @@ public interface ITaskQuestService extends BaseService { List findIsChangeData(String questNum); Integer findStockNum(Long questDetailId, String tableName); + + List exportAllDataWithPackage(QuestDetailDTO questDetailDTO); + + List exportPanDataWithPackage(QuestDetailDTO questDetailDTO); } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java index f07e674b0..938ac89a2 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java @@ -39,6 +39,7 @@ import com.logpm.warehouse.dto.TaskQuestDTO; import com.logpm.warehouse.dto.TaskSearchDTO; import com.logpm.warehouse.entity.*; import com.logpm.warehouse.excel.QuestContrastExcel; +import com.logpm.warehouse.excel.QuestContrastPackageExcelVO; import com.logpm.warehouse.excel.TaskQueryDataExcel; import com.logpm.warehouse.excel.TaskQuestExcel; import com.logpm.warehouse.mapper.TaskQuestMapper; @@ -49,7 +50,6 @@ import com.logpm.warehouse.vo.*; import lombok.AllArgsConstructor; import lombok.extern.log4j.Log4j2; import org.jetbrains.annotations.Nullable; -import org.mapstruct.factory.Mappers; import org.springblade.common.cache.CacheNames; import org.springblade.common.constant.RedisKeyConstant; import org.springblade.common.constant.common.IsOrNoConstant; @@ -1009,9 +1009,9 @@ public class TaskQuestServiceImpl extends BaseServiceImpl> listR = userSearchClient.listByUser(String.valueOf(i.getUpdateUser())); if (ObjectUtils.isNotNull(listR.getData())) { @@ -1021,7 +1021,6 @@ public class TaskQuestServiceImpl extends BaseServiceImpl exportAllDataWithPackage(QuestDetailDTO questDetailDTO) { + return baseMapper.exportAllDataWithPackage(questDetailDTO); + } + + @Override + public List exportPanDataWithPackage(QuestDetailDTO questDetailDTO) { + return baseMapper.exportPanDataWithPackage(questDetailDTO); + } + private String getQuestNum(String warehouseCode) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd"); // return "PDRW_" + warehouseCode + "_" + simpleDateFormat.format(new Date()) + String.format("%03d", new Random().nextInt(900) + 100); diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownStockupAreaServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownStockupAreaServiceImpl.java index 603b9530e..21e15c535 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownStockupAreaServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownStockupAreaServiceImpl.java @@ -250,7 +250,7 @@ public class WarehouseUpdownStockupAreaServiceImpl extends BaseServiceImpl 1) { boolean flag = warehouseUpdownStockupAreaEntityList.stream().anyMatch(item -> !item.getAssociationType().equals("3")); if (flag) { - log.error(method + "多条上架记录AssociationValue:{},warehouseId:{}", code, warehouseId); + log.warn(method + "多条上架记录AssociationValue:{},warehouseId:{}", code, warehouseId); throw new RuntimeException("多条上架记录"); } else { - log.info(method + "零担备货库位存在多条上架记录AssociationValue:{},warehouseId:{}", code, warehouseId); + log.warn(method + "零担备货库位存在多条上架记录AssociationValue:{},warehouseId:{}", code, warehouseId); } } WarehouseUpdownStockupAreaEntity warehouseUpdownStockupArea = warehouseUpdownStockupAreaEntityList.get(0); @@ -297,7 +297,7 @@ public class WarehouseUpdownStockupAreaServiceImpl extends BaseServiceImpl iterator = warehouseUpdownStockupAreaEntityList.iterator(); while (iterator.hasNext()){ diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWarehousingEntryServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWarehousingEntryServiceImpl.java index 9296a1a2c..f189b793e 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWarehousingEntryServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWarehousingEntryServiceImpl.java @@ -237,7 +237,7 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl