Commit d67164f7 authored by zhengyi's avatar zhengyi

完善出货阶段的订单修改逻辑

parent 9f058cbe
......@@ -404,4 +404,17 @@ public interface ErrorCodeConstants {
ErrorCode ORDER_CARGO_CONTROL_LIMIT_UPDATE_CONSIGNEE_INFO = new ErrorCode(1004001156, "order.cargo.control.limit.update.consignee.info");
ErrorCode ORDER_CARGO_CONTROL_CONSIGNEE_LIMIT_UPDATE_APPLYING = new ErrorCode(1004001157, "order.cargo.control.consignee.limit.update.applying");
ErrorCode ORDER_CARGO_CONTROL_OVERSEAS_WAREHOUSE_UPDATE_APPLYING = new ErrorCode(1004001158, "order.cargo.control.overseas.warehouse.update.applying");
ErrorCode ORDER_EXISTS_PICKUP_NOT_CARGO_CONTROL = new ErrorCode(1004001159, "order.exists.pickup.not.cargo.control");
ErrorCode ORDER_EXISTS_PICK_NOT_CANCEL_CARGO_CONTROL = new ErrorCode(1004001160, "order.exists.pick.not.cancel.cargo.control");
ErrorCode ORDER_OVERSEAS_WAREHOUSE_UPDATE_NEED_APPLY = new ErrorCode(1004001161, "order.overseas.warehouse.update.need.applying");
ErrorCode NOT_UPDATE_DEST_COUNTRY = new ErrorCode(1004001162, "order.not.update.dest.country");
ErrorCode NOT_UPDATE_DEPARTURE = new ErrorCode(1004001163, "order.not.update.departure");
ErrorCode NOT_UPDATE_TRANSPORT = new ErrorCode(1004001164, "order.not.update.transport");
ErrorCode ORDER_PRE_INSTALLATION_UNPACKAGED_CONTAINER_NOT_UPDATE = new ErrorCode(1004001165, "order.pre.installation.unpackaged.container.not.update");
// /空运订单分拣未出货, 锁定订单信息无法修改
ErrorCode ORDER_SORTING_NOT_SHIPMENT_NOT_UPDATE = new ErrorCode(1004001166, "order.sorting.not.shipment.not.update");
}
......@@ -102,6 +102,8 @@ import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receivable.ReceivableDO;
import cn.iocoder.yudao.module.wealth.enums.BoxAirStatusEnum;
import cn.iocoder.yudao.module.wealth.enums.BoxStatusEnum;
import cn.iocoder.yudao.module.wealth.service.receivable.ReceivableService;
import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableQueryVO;
......@@ -1796,7 +1798,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
throw exception(TRANSPORT_AND_LINE_NOT_AGREEMENT);
}
// 执行订单审批申请业务
this.orderAuditApplyUpdate(updateReqVO, vo, logisticsInfoDto, dictDataRespDTO);
this.orderAuditApplyUpdate(updateReqVO, vo, logisticsInfoDto, dictDataRespDTO, false);
}
@Override
......@@ -1853,26 +1855,32 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
*/
// 海运订单预装未装柜/空运订单分拣未出货, 锁定订单信息无法修改
if (vo.getShipmentState() == 0 || vo.getShipmentState() == 305 || vo.getShipmentState() == 307) {
// throw exception(ORDER_PRE_INSTALLATION_NOT_UPDATE);
if (vo.getTransportId() == TransportTypeShortEnum.SEA_CONTAINER.getValue()) {
throw exception(ORDER_PRE_INSTALLATION_UNPACKAGED_CONTAINER_NOT_UPDATE);
}else {
// TODO 当前不是海运就是空运
throw exception(ORDER_SORTING_NOT_SHIPMENT_NOT_UPDATE);
}
}
// 不允许修改运输方式
if (updateReqVO.getTransportId() != vo.getTransportId()) {
// throw exception(NOT_UPDATE_TRANSPORT);
throw exception(NOT_UPDATE_TRANSPORT);
}
// TODO 这里需要优化查询,这里查询了后面调用不建议重复查询,后面做优化
LogisticsInfoDto logisticsInfoDto = warehouseLineMapper.getStartInfoAndDestInfoByLineId(updateReqVO.getLineId());
LogisticsInfoDto orgLogisticsInfoDto = warehouseLineMapper.getStartInfoAndDestInfoByLineId(vo.getLineId());
// 不允许修改始发地
if (!Objects.equals(logisticsInfoDto.getStartCityId(), updateReqVO.getDepartureId())) {
// throw exception(NOT_UPDATE_DEPARTURE);
throw exception(NOT_UPDATE_DEPARTURE);
}
// 不允许修改目的国
if (!Objects.equals(logisticsInfoDto.getDestCountryId(), orgLogisticsInfoDto.getDestCountryId())) {
// throw exception(NOT_UPDATE_DEST_COUNTRY);
throw exception(NOT_UPDATE_DEST_COUNTRY);
}
// 海外仓业务变动申请
if (!vo.getType().contains("2") && updateReqVO.getType().contains("2")){
// TODO 订单如果转海外仓需要单独申请, 订单如果是海外仓改为非海外仓呢?
throw exception(ORDER_OVERSEAS_WAREHOUSE_UPDATE_NEED_APPLY);
}
// 当是否控货从是修改成否,需校验订单是否有放货记录状态≠已取消,有则弹出提示“订单已放货,无法修改为不控货”
if (vo.getIsCargoControl() && !updateReqVO.getIsCargoControl()){
......@@ -1882,7 +1890,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
.in(OrderCargoControlPickDO::getStatus, 1,2,3,4,5,6));
if(pickCount > 0){
// 订单存在放货记录,不能取消控货
// throw exception(ORDER_EXISTS_PICK_NOT_CANCEL_CARGO_CONTROL);
throw exception(ORDER_EXISTS_PICK_NOT_CANCEL_CARGO_CONTROL);
}
}
// 当是否控货从否修改成是,校验订单是否有提货记录,有则弹出提示“订单已有提货记录,无法修改成控货”
......@@ -1892,11 +1900,11 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
.eq(OrderPickupDO::getOrderId, vo.getOrderNo()));
if(pickupCount > 0){
// 订单存在提货记录,不能进行控货
// throw exception(ORDER_EXISTS_PICKUP_NOT_CARGO_CONTROL);
throw exception(ORDER_EXISTS_PICKUP_NOT_CARGO_CONTROL);
}
}
// 执行订单审批申请业务
this.orderAuditApplyUpdate(updateReqVO, vo, logisticsInfoDto, dictDataRespDTO);
this.orderAuditApplyUpdate(updateReqVO, vo, logisticsInfoDto, dictDataRespDTO, true);
}
......@@ -1908,7 +1916,26 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
* @param logisticsInfoDto
*/
private void orderAuditApplyUpdate(OrderUpdateReqVO updateReqVO, OrderBackVO vo, LogisticsInfoDto logisticsInfoDto,
DictDataRespDTO dictDataRespDTO) {
DictDataRespDTO dictDataRespDTO, boolean isShipment) {
String statusName = "";
if (isShipment){
if (!Objects.equals(vo.getTransportId(), TransportTypeShortEnum.AIR_FREIGHT_LINE.getValue()) && !Objects.equals(vo.getTransportId(), TransportTypeShortEnum.AIR_SEA_COMBINED_TRANSPORT.getValue())) {
statusName = OrderStatusEnum.valueOf(vo.getStatus()).getNameZh();
} else {
if (vo.getStatus().equals(OrderStatusEnum.IN_SHIPPING.getValue())) {
// 此状态为状态13的空运转义状态,当运输方式为空运时,状态13为已起飞, 订单日志信息单独更新
statusName = OrderStatusEnum.HAS_TAKEN_OFF.getNameZh();
}
if (vo.getStatus().equals(OrderStatusEnum.SHIPMENT.getValue()) && vo.getShipmentState().equals(BoxAirStatusEnum.WAREHOUSED)) {
// 此状态为状态32的空运转义状态,当运输方式为空运时,状态32为,出货子状态为出仓, 订单实时状态为出仓
statusName = OrderStatusEnum.WAREHOUSED.getNameZh();
}
if (vo.getStatus().equals(OrderStatusEnum.UNLOADED_CABINET.getValue()) && vo.getShipmentState().equals(BoxAirStatusEnum.TO_WAREHOUSED)) {
// 此状态为空运到仓状态
statusName = OrderStatusEnum.WAREHOUSED.getNameZh();
}
}
}
OrderApprovalDO orderApprovalDO;
OrderDO updateObj = OrderConvert.INSTANCE.convert(updateReqVO);
if (updateReqVO.getIsExternalWarehouse() && StringUtils.isNotBlank(updateReqVO.getType()) && updateReqVO.getType().contains("1")) {
......@@ -1939,7 +1966,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
vo.setCcIds(updateReqVO.getCcIds());
vo.setApplyType(ORDER_UPDATE.getValue());
List<ApplyInfoVO> applyInfoList = new ArrayList<>();
LinkedList<ApplyInfoVO> applyInfoList = new LinkedList<>();
// 通用信息比较
this.compareGenericForms(updateReqVO, vo, applyInfoList);
// 空运信息比较
......@@ -2090,9 +2117,18 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
}
// 处理完订单相关的所有业务后,如果有待审批的订单修改内容,则创建待审批任务
if (CollectionUtil.isNotEmpty(applyInfoList)) {
// 订单修改审批提交不允许在出货阶段进行
if (vo.getStatus() > 10 && vo.getStatus() < 19) {
throw exception(ORDER_UPDATE_APPROVAL_MUST_BE_WAREHOUSE_IN);
if (!isShipment) {
// 2024-09-11 重新修正,出货阶段有单独的修改审批业务需要走
// 订单修改审批提交不允许在出货阶段进行
if (vo.getStatus() > 10 && vo.getStatus() < 19) {
throw exception(ORDER_UPDATE_APPROVAL_MUST_BE_WAREHOUSE_IN);
}
}
if (isShipment){
// TODO 出货阶段的修改,需要将当前订单状态值标出,放首位
ApplyInfoVO applyInfoVO = new ApplyInfoVO();
applyInfoVO.setName(statusName);
applyInfoList.addFirst(applyInfoVO);
}
// 订单有修改则执行修改审批任务
vo.setApplyInfoList(applyInfoList);
......
......@@ -279,3 +279,14 @@ customer.deleted.not.exists=
customer.saved.customer.service.is.null=
customer.deleted.customer.service.is.null=
customer.merge.customer.service.not.same=
order.exists.pickup.not.cargo.control=
order.exists.pick.not.cancel.cargo.control=
order.overseas.warehouse.update.need.applying=
order.not.update.dest.country=
order.not.update.departure=
order.not.update.transport=
order.pre.installation.unpackaged.container.not.update=
order.sorting.not.shipment.not.update=
......@@ -1086,3 +1086,14 @@ customer.deleted.not.exists=customer deleted not exists
customer.saved.customer.service.is.null=customer saved customer service is null
customer.deleted.customer.service.is.null=customer merged customer service is null
customer.merge.customer.service.not.same=tow customer's customer serivce not same
order.exists.pickup.not.cargo.control=The order has a delivery record and cannot be controlled
order.exists.pick.not.cancel.cargo.control=There is a release record for the order, and the control cannot be cancelled
order.overseas.warehouse.update.need.applying=Order overseas warehouse modification requires separate application
order.not.update.dest.country=Not allowed to modify the destination country
order.not.update.departure=Not allowed to modify the origin location
order.not.update.transport=No modification of transportation method allowed
order.pre.installation.unpackaged.container.not.update=Order pre installed without container, order information cannot be modified
order.sorting.not.shipment.not.update=Order sorting not shipped, order information cannot be modified
\ No newline at end of file
......@@ -1085,4 +1085,14 @@ customer.saved.not.exists=\u4FDD\u7559\u5BA2\u6237\u4E0D\u5B58\u5728
customer.deleted.not.exists=\u88AB\u5408\u5E76\u5BA2\u6237\u4E0D\u5B58\u5728
customer.saved.customer.service.is.null=\u88AB\u4FDD\u7559\u5BA2\u6237\u7684\u5BA2\u6237\u7ECF\u7406\u4E3A\u7A7A
customer.deleted.customer.service.is.null=\u88AB\u5408\u5E76\u7684\u5BA2\u6237\u7684\u5BA2\u6237\u7ECF\u7406\u4E3A\u7A7A
customer.merge.customer.service.not.same=\u4E24\u5BA2\u6237\u7684\u5BA2\u6237\u7ECF\u7406\u4E0D\u4E00\u81F4
\ No newline at end of file
customer.merge.customer.service.not.same=\u4E24\u5BA2\u6237\u7684\u5BA2\u6237\u7ECF\u7406\u4E0D\u4E00\u81F4
order.exists.pickup.not.cargo.control=\u8ba2\u5355\u5b58\u5728\u63d0\u8d27\u8bb0\u5f55\uff0c\u4e0d\u80fd\u8fdb\u884c\u63a7\u8d27
order.exists.pick.not.cancel.cargo.control=\u8ba2\u5355\u5b58\u5728\u653e\u8d27\u8bb0\u5f55\uff0c\u4e0d\u80fd\u53d6\u6d88\u63a7\u8d27
order.overseas.warehouse.update.need.applying=\u8ba2\u5355\u6d77\u5916\u4ed3\u4fee\u6539\u9700\u8981\u5355\u72ec\u7533\u8bf7
order.not.update.dest.country=\u4e0d\u5141\u8bb8\u4fee\u6539\u76ee\u7684\u56fd
order.not.update.departure=\u4e0d\u5141\u8bb8\u4fee\u6539\u59cb\u53d1\u5730
order.not.update.transport=\u4e0d\u5141\u8bb8\u4fee\u6539\u8fd0\u8f93\u65b9\u5f0f
order.pre.installation.unpackaged.container.not.update=\u8ba2\u5355\u9884\u88c5\u672a\u88c5\u67dc, \u8ba2\u5355\u4fe1\u606f\u65e0\u6cd5\u4fee\u6539
order.sorting.not.shipment.not.update=\u8ba2\u5355\u5206\u62e3\u672a\u51fa\u8d27, \u8ba2\u5355\u4fe1\u606f\u65e0\u6cd5\u4fee\u6539
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment