Commit 53d520e3 authored by Smile's avatar Smile

feat:空运出货-取消审批

parent 9452b7e6
...@@ -189,12 +189,14 @@ public enum OrderApprovalTypeResultEnum implements IntArrayValuable { ...@@ -189,12 +189,14 @@ public enum OrderApprovalTypeResultEnum implements IntArrayValuable {
shipment_pass(54,2, "air.shipment.pass"), shipment_pass(54,2, "air.shipment.pass"),
shipment_reject(54,3, "air.shipment.reject"), shipment_reject(54,3, "air.shipment.reject"),
shipment_cancel(54,4, "air.shipment.cancel"), shipment_cancel(54,4, "air.shipment.cancel"),
shipment_noAudit(54,5, "air.shipment.noAudit"),
//出货反审 //出货反审
shipment_back_processing(55,1, "air.shipment.back.processing"), shipment_back_processing(55,1, "air.shipment.back.processing"),
shipment_back_pass(55,2, "air.shipment.back.pass"), shipment_back_pass(55,2, "air.shipment.back.pass"),
shipment_back_reject(55,3, "air.shipment.back.reject"), shipment_back_reject(55,3, "air.shipment.back.reject"),
shipment_back_cancel(55,4, "air.shipment.back.cancel"), shipment_back_cancel(55,4, "air.shipment.back.cancel"),
shipment_back_recall(55,5, "air.shipment.back.recall"),
//撤销清关 //撤销清关
......
...@@ -12,7 +12,8 @@ public enum AirShipmentStatusEnum { ...@@ -12,7 +12,8 @@ public enum AirShipmentStatusEnum {
SHIPMENT_BACK_APPROVAL_ING(176, "出货反审中", "SHIPMENT back approvaling"), SHIPMENT_BACK_APPROVAL_ING(176, "出货反审中", "SHIPMENT back approvaling"),
SHIPMENT_BACK_APPROVAL_SUCCESS(177, "出货反审成功", "SHIPMENT back approval success"), SHIPMENT_BACK_APPROVAL_SUCCESS(177, "出货反审成功", "SHIPMENT back approval success"),
SHIPMENT_BACK_APPROVAL_FAIL(178, "出货反审失败", "SHIPMENT back approval fail") SHIPMENT_BACK_APPROVAL_FAIL(178, "出货反审失败", "SHIPMENT back approval fail"),
SHIPMENT_BACK_RECALL_SUCCESS(179, "出货撤回成功", "SHIPMENT recall success"),
; ;
AirShipmentStatusEnum(int status, String text, String textEn) { AirShipmentStatusEnum(int status, String text, String textEn) {
......
...@@ -28,6 +28,12 @@ public interface BoxAirShipmentService extends IService<BoxAirShipmentDO> { ...@@ -28,6 +28,12 @@ public interface BoxAirShipmentService extends IService<BoxAirShipmentDO> {
*/ */
void updateBoxAirShipment(@Valid BoxAirShipmentUpdateReqVO updateReqVO); void updateBoxAirShipment(@Valid BoxAirShipmentUpdateReqVO updateReqVO);
/**
* 撤回空运出货
* @param updateReqVO 更新信息
*/
void recallBoxAirShipment(@Valid BoxAirShipmentUpdateReqVO updateReqVO);
/** /**
* 删除空运出货 * 删除空运出货
* @param id 编号 * @param id 编号
......
...@@ -7,6 +7,8 @@ import javax.annotation.Resource; ...@@ -7,6 +7,8 @@ import javax.annotation.Resource;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.bpm.enums.BpmProcessInstanceResultEnum; import cn.iocoder.yudao.module.bpm.enums.BpmProcessInstanceResultEnum;
import cn.iocoder.yudao.module.order.enums.OrderApprovalTypeResultEnum;
import cn.iocoder.yudao.module.order.enums.OrderStatusEnum;
import cn.iocoder.yudao.module.shipment.convert.BoxAirShipmentConvert; import cn.iocoder.yudao.module.shipment.convert.BoxAirShipmentConvert;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxAirShipmentDO; import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxAirShipmentDO;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxApprovalDO; import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxApprovalDO;
...@@ -18,7 +20,6 @@ import cn.iocoder.yudao.module.shipment.service.boxApproval.BoxApprovalService; ...@@ -18,7 +20,6 @@ import cn.iocoder.yudao.module.shipment.service.boxApproval.BoxApprovalService;
import cn.iocoder.yudao.module.shipment.service.boxOpLog.BoxOpLogService; import cn.iocoder.yudao.module.shipment.service.boxOpLog.BoxOpLogService;
import cn.iocoder.yudao.module.shipment.vo.boxAirShipment.*; import cn.iocoder.yudao.module.shipment.vo.boxAirShipment.*;
import cn.iocoder.yudao.module.shipment.vo.boxApproval.BoxApprovalCreateReqVO; import cn.iocoder.yudao.module.shipment.vo.boxApproval.BoxApprovalCreateReqVO;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
...@@ -26,6 +27,7 @@ import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO; ...@@ -26,6 +27,7 @@ import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService; import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.order.enums.TargetLogEnum.WITHDRAWAL;
import static cn.iocoder.yudao.module.shipment.enums.ErrorCodeConstants.*; import static cn.iocoder.yudao.module.shipment.enums.ErrorCodeConstants.*;
/** /**
...@@ -59,7 +61,7 @@ public class BoxAirShipmentServiceImpl extends AbstractService<BoxAirShipmentMap ...@@ -59,7 +61,7 @@ public class BoxAirShipmentServiceImpl extends AbstractService<BoxAirShipmentMap
BoxAirShipmentDO boxAirShipment = BoxAirShipmentConvert.INSTANCE.convert(createReqVO); BoxAirShipmentDO boxAirShipment = BoxAirShipmentConvert.INSTANCE.convert(createReqVO);
boxAirShipmentMapper.insert(boxAirShipment); boxAirShipmentMapper.insert(boxAirShipment);
// 返回 // 返回
commitUpdate(createReqVO.getOperateType(),createReqVO.getShipmentId(), createReqVO.getCopyUserId()); commitUpdate(createReqVO.getOperateType(),createReqVO.getShipmentId());
return boxAirShipment.getId(); return boxAirShipment.getId();
} }
...@@ -69,11 +71,19 @@ public class BoxAirShipmentServiceImpl extends AbstractService<BoxAirShipmentMap ...@@ -69,11 +71,19 @@ public class BoxAirShipmentServiceImpl extends AbstractService<BoxAirShipmentMap
this.validateBoxAirShipmentExists(updateReqVO.getId()); this.validateBoxAirShipmentExists(updateReqVO.getId());
// 更新 // 更新
BoxAirShipmentDO updateObj = BoxAirShipmentConvert.INSTANCE.convert(updateReqVO); BoxAirShipmentDO updateObj = BoxAirShipmentConvert.INSTANCE.convert(updateReqVO);
commitUpdate(updateReqVO.getOperateType(),updateReqVO.getShipmentId(), updateReqVO.getCopyUserId()); commitUpdate(updateReqVO.getOperateType(),updateReqVO.getShipmentId());
boxAirShipmentMapper.updateById(updateObj); boxAirShipmentMapper.updateById(updateObj);
} }
private void commitUpdate(Integer operateType, Long shipmentId, String[] copyUserId) { @Override
public void recallBoxAirShipment(BoxAirShipmentUpdateReqVO updateReqVO) {
// 校验存在
this.validateBoxAirShipmentExists(updateReqVO.getId());
// 撤回
commitRecall(updateReqVO.getShipmentId(),updateReqVO.getRemark());
}
private void commitUpdate(Integer operateType, Long shipmentId) {
BoxDO boxDO = boxService.getBox(shipmentId); BoxDO boxDO = boxService.getBox(shipmentId);
if(boxDO == null) { if(boxDO == null) {
throw exception(BOX_NOT_EXISTS); throw exception(BOX_NOT_EXISTS);
...@@ -83,12 +93,77 @@ public class BoxAirShipmentServiceImpl extends AbstractService<BoxAirShipmentMap ...@@ -83,12 +93,77 @@ public class BoxAirShipmentServiceImpl extends AbstractService<BoxAirShipmentMap
AirShipmentStatusEnum shipment = AirShipmentStatusEnum.SHIPMENT; AirShipmentStatusEnum shipment = AirShipmentStatusEnum.SHIPMENT;
if(airShipmentStatus != shipment.getStatus()) { if(airShipmentStatus != shipment.getStatus()) {
createApproval(shipmentId, copyUserId); //出货审核
//createApproval(shipmentId, copyUserId);
createBoxShipment(boxDO, shipmentId);
} }
} }
boxService.updateById(boxDO); boxService.updateById(boxDO);
} }
private void commitRecall(Long shipmentId,String remark) {
BoxDO boxDO = boxService.getBox(shipmentId);
if(boxDO == null) {
throw exception(BOX_NOT_EXISTS);
}
int airShipmentStatus = boxDO.getAirShipmentStatus();
AirShipmentStatusEnum shipment = AirShipmentStatusEnum.SHIPMENT;
if (airShipmentStatus == shipment.getStatus()) {
recallBoxShipment(boxDO, shipmentId,remark);
}
}
//撤回空运出货
private void recallBoxShipment(BoxDO boxDO, Long shipmentId,String remark) {
//返回成功,修改为预装中的状态
boxDO.setSlStatus(SlStatueEnum.NO_SETTLEMENT.getSlStatus());
boxDO.setToWarehouseStatus(TWStatusEnum.NO_TO_WAREHOUSE.getTwStatus());
boxDO.setClStatus(ClStatueEnum.NO_CLEARANCE.getClStatus());
boxDO.setSapStatus(SapStatueEnum.NO_ARRIVE.getSapStatus());
boxDO.setCdStatus(CdStatueEnum.NO_CLEARANCE_DOCUMENTS.getCdStatus());
boxDO.setFlyStatus(FlyStatueEnum.NO_FLYING.getDtStatus());
boxDO.setBlStatus(BlStatueEnum.NO_LADING_BILL.getBlStatus());
boxDO.setDcStatus(DcStatueEnum.UNCUSTOMED.getDcStatus());
boxDO.setCheckoutStatus(AirCheckoutStatusEnum.UNCHECKOUT.getStatus());
boxDO.setAirShipmentStatus(AirShipmentStatusEnum.UNSHIPMENT.getStatus());
boxDO.setShipmentStatusAir(BoxAirStatusEnum.TALLY_COMPLETE.getStatus());
String remarkResult = remark != null && !remark.isEmpty() ? String.format(" 备注【%s】", remark) : "";
String text = AirShipmentStatusEnum.SHIPMENT_BACK_RECALL_SUCCESS.getText() + remarkResult;;
String textEn = AirShipmentStatusEnum.SHIPMENT_BACK_RECALL_SUCCESS.getTextEn() + remarkResult;
//添加操作日志
boxOpLogService.createBoxOpLog(boxDO.getId(), AirShipmentStatusEnum.SHIPMENT_BACK_RECALL_SUCCESS.getStatus(),
text, textEn);
//反审后修改订单为出货状态
boxService.updateOrderStatusByShipmentIdAndTransportType(shipmentId, OrderStatusEnum.SHIPMENT.getValue(), null,
BoxAirStatusEnum.TALLY_COMPLETE.getStatus(), 0, OrderApprovalTypeResultEnum.typeAndResultOf(OrderApprovalTypeResultEnum.shipment_back_recall.getType(), 5).getDesc(), Integer.parseInt(boxDO.getTransportType()));
//反审后清除订单表的提单号
// boxService.clearOrderTidanNo(shipmentId, false);
//业绩变更
boxService.addTargetLog(shipmentId, WITHDRAWAL, new Date());
//删除已到港订单
boxService.deleteArrivalOrderByShipment(shipmentId);
//删除已清关订单
boxService.deleteClearanceOrderByShipment(shipmentId);
boxService.updateById(boxDO);
}
//去掉审核直接出货
private void createBoxShipment(BoxDO boxDO, Long shipmentId) {
boxDO.setAirShipmentStatus(AirShipmentStatusEnum.SHIPMENT.getStatus());
//修改为出货审核后生成提单号
//boxService.generateBillLadingNo(shipmentId, true, false);
//修改订单状态
boxService.updateOrderStatusByShipmentIdAndTransportType(shipmentId, OrderStatusEnum.SHIPMENT.getValue(),
null, BoxAirStatusEnum.AIR_SHIPPED.getStatus(), 0, OrderApprovalTypeResultEnum.typeAndResultOf(OrderApprovalTypeResultEnum.shipment_noAudit.getType(), 5).getDesc(), Integer.parseInt(boxDO.getTransportType()));
boxService.addOrderLogByShipmentId(shipmentId, OrderShipmentLog.AIR_OUT_SHIPMENT, "");
}
private void createApproval(Long shipmentId, String[] copyUserId) { private void createApproval(Long shipmentId, String[] copyUserId) {
BoxApprovalCreateReqVO boxApprovalCreateReqVO = new BoxApprovalCreateReqVO(); BoxApprovalCreateReqVO boxApprovalCreateReqVO = new BoxApprovalCreateReqVO();
boxApprovalCreateReqVO.setShipmentId(shipmentId); boxApprovalCreateReqVO.setShipmentId(shipmentId);
......
...@@ -21,4 +21,8 @@ public class BoxAirShipmentUpdateReqVO extends BoxAirShipmentBaseVO { ...@@ -21,4 +21,8 @@ public class BoxAirShipmentUpdateReqVO extends BoxAirShipmentBaseVO {
@ApiModelProperty(value = "抄送人userId") @ApiModelProperty(value = "抄送人userId")
String[] copyUserId; String[] copyUserId;
@ApiModelProperty(value = "备注")
String remark;
} }
...@@ -49,6 +49,15 @@ public class BoxAirShipmentController { ...@@ -49,6 +49,15 @@ public class BoxAirShipmentController {
return success(true); return success(true);
} }
@PutMapping("/recall")
@ApiOperation("撤回空运出货")
@Idempotent(timeout = 5)
//@PreAuthorize("@ss.hasPermission('ecw:box-air-shipment:update')")
public CommonResult<Boolean> recallBoxAirShipment(@Valid @RequestBody BoxAirShipmentUpdateReqVO updateReqVO) {
boxAirShipmentService.recallBoxAirShipment(updateReqVO);
return success(true);
}
@DeleteMapping("/delete") @DeleteMapping("/delete")
@ApiOperation("删除空运出货") @ApiOperation("删除空运出货")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
......
...@@ -928,6 +928,7 @@ air.shipment.processing=air shipment processing ...@@ -928,6 +928,7 @@ air.shipment.processing=air shipment processing
air.shipment.pass=air shipment pass air.shipment.pass=air shipment pass
air.shipment.reject=air shipment reject air.shipment.reject=air shipment reject
air.shipment.cancel=air shipment cancel air.shipment.cancel=air shipment cancel
air.shipment.noAudit=\u5DF2\u51FA\u8D27
order.status.not.same=order status not same order.status.not.same=order status not same
box.approval.exist=There is a process in the approval process for shipment box.approval.exist=There is a process in the approval process for shipment
...@@ -935,6 +936,7 @@ air.shipment.back.processing=air shipment back processing ...@@ -935,6 +936,7 @@ air.shipment.back.processing=air shipment back processing
air.shipment.back.pass=air shipment back pass air.shipment.back.pass=air shipment back pass
air.shipment.back.reject=air shipment back reject air.shipment.back.reject=air shipment back reject
air.shipment.back.cancel=air shipment back cancel air.shipment.back.cancel=air shipment back cancel
air.shipment.back.recall=\u51FA\u8D27\u64A4\u56DE
shipment.air.status.wait.settled=wait settled shipment.air.status.wait.settled=wait settled
shipment.air.status.settling=settling shipment.air.status.settling=settling
...@@ -1126,4 +1128,4 @@ cargo.uncontrol.order.already.picked=cargo uncontrol order already picked ...@@ -1126,4 +1128,4 @@ cargo.uncontrol.order.already.picked=cargo uncontrol order already picked
order.approval.is.not.exists=Order approval type does not exist order.approval.is.not.exists=Order approval type does not exist
fee.application.not.is.zero=The expense application amount is not 0, and cannot be directly deleted fee.application.not.is.zero=The expense application amount is not 0, and cannot be directly deleted
guan.lian.order.is.approval.in.process=Related order [{}] has approval in progress guan.lian.order.is.approval.in.process=Related order [{}] has approval in progress
\ No newline at end of file
...@@ -930,6 +930,7 @@ air.shipment.processing=\u51FA\u8D27\u5BA1\u6838\u4E2D ...@@ -930,6 +930,7 @@ air.shipment.processing=\u51FA\u8D27\u5BA1\u6838\u4E2D
air.shipment.pass=\u51FA\u8D27\u5BA1\u6838\u901A\u8FC7 air.shipment.pass=\u51FA\u8D27\u5BA1\u6838\u901A\u8FC7
air.shipment.reject=\u51FA\u8D27\u5BA1\u6838\u5931\u8D25 air.shipment.reject=\u51FA\u8D27\u5BA1\u6838\u5931\u8D25
air.shipment.cancel=\u51FA\u8D27\u5BA1\u6838\u53D6\u6D88 air.shipment.cancel=\u51FA\u8D27\u5BA1\u6838\u53D6\u6D88
air.shipment.noAudit=\u5DF2\u51FA\u8D27
consignee.phone.is.not.china=\u6536\u8D27\u4EBA\u624B\u673A\u53F7\u7801\u4E0D\u80FD\u662F\u4E2D\u56FD\u53F7\u7801 consignee.phone.is.not.china=\u6536\u8D27\u4EBA\u624B\u673A\u53F7\u7801\u4E0D\u80FD\u662F\u4E2D\u56FD\u53F7\u7801
order.no.or.bill.lading.no.not.null=\u8BA2\u5355\u53F7\u6216\u63D0\u5355\u53F7\u4E0D\u80FD\u4E3A\u7A7A order.no.or.bill.lading.no.not.null=\u8BA2\u5355\u53F7\u6216\u63D0\u5355\u53F7\u4E0D\u80FD\u4E3A\u7A7A
order.status.not.same=\u8BA2\u5355\u72B6\u6001\u4E0D\u4E00\u81F4 order.status.not.same=\u8BA2\u5355\u72B6\u6001\u4E0D\u4E00\u81F4
...@@ -938,6 +939,7 @@ box.approval.exist=\u51FA\u8D27\u5B58\u5728\u5BA1\u6279\u4E2D\u7684\u6D41\u7A0B ...@@ -938,6 +939,7 @@ box.approval.exist=\u51FA\u8D27\u5B58\u5728\u5BA1\u6279\u4E2D\u7684\u6D41\u7A0B
air.shipment.back.processing=\u51FA\u8D27\u53CD\u5BA1\u4E2D air.shipment.back.processing=\u51FA\u8D27\u53CD\u5BA1\u4E2D
air.shipment.back.pass=\u51FA\u8D27\u53CD\u5BA1\u901A\u8FC7 air.shipment.back.pass=\u51FA\u8D27\u53CD\u5BA1\u901A\u8FC7
air.shipment.back.recall=\u51FA\u8D27\u64A4\u56DE
air.shipment.back.reject=\u51FA\u8D27\u53CD\u5BA1\u5931\u8D25 air.shipment.back.reject=\u51FA\u8D27\u53CD\u5BA1\u5931\u8D25
air.shipment.back.cancel=\u51FA\u8D27\u53CD\u5BA1\u53D6\u6D88 air.shipment.back.cancel=\u51FA\u8D27\u53CD\u5BA1\u53D6\u6D88
shipment.air.status.wait.settled=\u5F85\u7ED3\u7B97 shipment.air.status.wait.settled=\u5F85\u7ED3\u7B97
......
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