Browse Source

永发 1.ow计算租金接口
2.ow撤销计算租金接口
3.物流报价表结构创建
4.物流报价接口编写及修改
5.代理箱启用需把代理名称带到放箱号中
6.调箱成本接口修改

纪新园 10 months ago
parent
commit
d63aba992d
23 changed files with 1114 additions and 143 deletions
  1. 34 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/dto/QuotationItemDTO.java
  2. 10 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/entity/BoxAdjustmentCost.java
  3. 281 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/entity/QuotationItem.java
  4. 14 2
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/entity/RouteCost.java
  5. 6 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/entity/TradingBox.java
  6. 7 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/entity/TradingBoxType.java
  7. 36 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/vo/QuotationItemVO.java
  8. 4 2
      blade-service/blade-los/src/main/java/org/springblade/los/basic/cur/service/impl/BCurrencyServiceImpl.java
  9. 1 1
      blade-service/blade-los/src/main/java/org/springblade/los/box/controller/BoxAdjustmentCostController.java
  10. 1 1
      blade-service/blade-los/src/main/java/org/springblade/los/box/controller/BoxPoolController.java
  11. 138 0
      blade-service/blade-los/src/main/java/org/springblade/los/box/controller/QuotationItemController.java
  12. 9 0
      blade-service/blade-los/src/main/java/org/springblade/los/box/controller/TradingBoxController.java
  13. 42 0
      blade-service/blade-los/src/main/java/org/springblade/los/box/mapper/QuotationItemMapper.java
  14. 61 0
      blade-service/blade-los/src/main/java/org/springblade/los/box/mapper/QuotationItemMapper.xml
  15. 1 1
      blade-service/blade-los/src/main/java/org/springblade/los/box/mapper/RouteCostMapper.xml
  16. 2 0
      blade-service/blade-los/src/main/java/org/springblade/los/box/service/IBoxAdjustmentCostService.java
  17. 45 0
      blade-service/blade-los/src/main/java/org/springblade/los/box/service/IQuotationItemService.java
  18. 2 0
      blade-service/blade-los/src/main/java/org/springblade/los/box/service/ITradingBoxService.java
  19. 9 8
      blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/BoxAdjustmentCostServiceImpl.java
  20. 34 13
      blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/PutBoxServiceImpl.java
  21. 66 0
      blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/QuotationItemServiceImpl.java
  22. 110 83
      blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/RouteCostServiceImpl.java
  23. 201 32
      blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/TradingBoxServiceImpl.java

+ 34 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/dto/QuotationItemDTO.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.box.dto;
+
+import org.springblade.los.box.entity.QuotationItem;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 报价明细表数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2025-05-06
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class QuotationItemDTO extends QuotationItem {
+	private static final long serialVersionUID = 1L;
+
+}

+ 10 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/entity/BoxAdjustmentCost.java

@@ -16,15 +16,18 @@
  */
 package org.springblade.los.box.entity;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import org.springblade.los.finance.fee.entity.FeeCenter;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.util.Date;
+import java.util.List;
 
 /**
  * 调箱成本实体类
@@ -40,6 +43,7 @@ public class BoxAdjustmentCost implements Serializable {
 	private static final long serialVersionUID = 1L;
 
 	private Long id;
+	private Long pid;
 	/**
 	 * 创建人
 	 */
@@ -126,5 +130,11 @@ public class BoxAdjustmentCost implements Serializable {
 	@ApiModelProperty(value = "合计金额")
 	private BigDecimal totalAmount;
 
+	/**
+	 * 费用中心
+	 */
+	@TableField(exist = false)
+	private List<FeeCenter> feeCenterList;
+
 
 }

+ 281 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/entity/QuotationItem.java

@@ -0,0 +1,281 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.box.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.util.Date;
+
+/**
+ * 报价明细表实体类
+ *
+ * @author BladeX
+ * @since 2025-05-06
+ */
+@Data
+@TableName("logistics_quotation_item")
+@ApiModel(value = "QuotationItem对象", description = "报价明细表")
+public class QuotationItem implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	private Long id;
+	/**
+	 * 父id
+	 */
+	@ApiModelProperty(value = "父id")
+	private Long pid;
+	/**
+	 * 创建人
+	 */
+	@ApiModelProperty(value = "创建人")
+	private Long createUser;
+	/**
+	 * 创建时间
+	 */
+	@ApiModelProperty(value = "创建时间")
+	private Date createTime;
+	/**
+	 * 修改人
+	 */
+	@ApiModelProperty(value = "修改人")
+	private Long updateUser;
+	/**
+	 * 修改时间
+	 */
+	@ApiModelProperty(value = "修改时间")
+	private Date updateTime;
+	/**
+	 * 是否已删除(0 否 1是)
+	 */
+	@ApiModelProperty(value = "是否已删除(0 否 1是)")
+	private Integer isDeleted;
+	/**
+	 * 备注
+	 */
+	@ApiModelProperty(value = "备注")
+	private String remarks;
+	/**
+	 * 创建人
+	 */
+	@ApiModelProperty(value = "创建人")
+	private String createUserName;
+	/**
+	 * 修改人
+	 */
+	@ApiModelProperty(value = "修改人")
+	private String updateUserName;
+	/**
+	 * 排序
+	 */
+	@ApiModelProperty(value = "排序")
+	private Integer sort;
+	/**
+	 * 船公司
+	 */
+	@ApiModelProperty(value = "船公司")
+	private Long shippingCompanyId;
+	/**
+	 * 船公司中文
+	 */
+	@ApiModelProperty(value = "船公司中文")
+	private String shippingCompanyCname;
+	/**
+	 * 船公司英文
+	 */
+	@ApiModelProperty(value = "船公司英文")
+	private String shippingCompanyEname;
+	/**
+	 * 船公司代码
+	 */
+	@ApiModelProperty(value = "船公司代码")
+	private String shippingCompanyCode;
+	/**
+	 * 船公司简称
+	 */
+	@ApiModelProperty(value = "船公司简称")
+	private String shippingCompanyAbbreviation;
+	/**
+	 * 箱型
+	 */
+	@ApiModelProperty(value = "箱型")
+	private String boxType;
+	/**
+	 * 币别
+	 */
+	@ApiModelProperty(value = "币别")
+	private String curCode;
+	/**
+	 * 销售价
+	 */
+	@ApiModelProperty(value = "销售价")
+	private BigDecimal salesPrice;
+	/**
+	 * 成本价
+	 */
+	@ApiModelProperty(value = "成本价")
+	private BigDecimal costPrice;
+	/**
+	 * 起运港
+	 */
+	@ApiModelProperty(value = "起运港")
+	private Long polId;
+	/**
+	 * 起运港中文
+	 */
+	@ApiModelProperty(value = "起运港中文")
+	private String polCname;
+	/**
+	 * 起运港英文
+	 */
+	@ApiModelProperty(value = "起运港英文")
+	private String polEname;
+	/**
+	 * 起运港代码
+	 */
+	@ApiModelProperty(value = "起运港代码")
+	private String polCode;
+	/**
+	 * 目的港
+	 */
+	@ApiModelProperty(value = "目的港")
+	private Long podId;
+	/**
+	 * 目的港中文
+	 */
+	@ApiModelProperty(value = "目的港中文")
+	private String podCname;
+	/**
+	 * 目的港英文
+	 */
+	@ApiModelProperty(value = "目的港英文")
+	private String podEname;
+	/**
+	 * 目的港代码
+	 */
+	@ApiModelProperty(value = "目的港代码")
+	private String podCode;
+	/**
+	 * 船名
+	 */
+	@ApiModelProperty(value = "船名")
+	private Long shipNameId;
+	/**
+	 * 船名中文
+	 */
+	@ApiModelProperty(value = "船名中文")
+	private String shipCname;
+	/**
+	 * 船名英文
+	 */
+	@ApiModelProperty(value = "船名英文")
+	private String shipEname;
+	/**
+	 * 船名代码
+	 */
+	@ApiModelProperty(value = "船名代码")
+	private String shipCode;
+	/**
+	 * 航线
+	 */
+	@ApiModelProperty(value = "航线")
+	private Long airlineId;
+	/**
+	 * 航线中文
+	 */
+	@ApiModelProperty(value = "航线中文")
+	private String airlineCname;
+	/**
+	 * 航线英文
+	 */
+	@ApiModelProperty(value = "航线英文")
+	private String airlineEname;
+	/**
+	 * 航线代码
+	 */
+	@ApiModelProperty(value = "航线代码")
+	private String airlineCode;
+	/**
+	 * 船期
+	 */
+	@ApiModelProperty(value = "船期")
+	private Date shippingDate;
+	/**
+	 * 航班类型  转船/直达
+	 */
+	@ApiModelProperty(value = "航班类型  转船/直达")
+	private String flightType;
+	/**
+	 * 中转港
+	 */
+	@ApiModelProperty(value = "中转港")
+	private Long transitPortId;
+	/**
+	 * 中转港中文
+	 */
+	@ApiModelProperty(value = "中转港中文")
+	private String transitPortCname;
+	/**
+	 * 中转港英文
+	 */
+	@ApiModelProperty(value = "中转港英文")
+	private String transitPortEname;
+	/**
+	 * 中转港代码
+	 */
+	@ApiModelProperty(value = "中转港代码")
+	private String transitPortCode;
+	/**
+	 * 舱位类型  固定/非固定
+	 */
+	@ApiModelProperty(value = "舱位类型  固定/非固定")
+	private String cabinType;
+	/**
+	 * 箱属
+	 */
+	@ApiModelProperty(value = "箱属")
+	private String boxBelongsTo;
+	/**
+	 * 是否合营
+	 */
+	@ApiModelProperty(value = "是否合营")
+	private String whetherJointVenture;
+	/**
+	 * 有效日期启
+	 */
+	@ApiModelProperty(value = "有效日期启")
+	private Date effectiveStartDate;
+	/**
+	 * 有效日期止
+	 */
+	@ApiModelProperty(value = "有效日期止")
+	private Date effectiveEndDate;
+
+	/**
+	 * 租户
+	 */
+	@ApiModelProperty(value = "租户")
+	private String tenantId;
+
+
+}

+ 14 - 2
blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/entity/RouteCost.java

@@ -103,7 +103,7 @@ public class RouteCost implements Serializable {
 	@ApiModelProperty(value = "业务日期")
 	private Date businessDate;
 	/**
-	 * 业务类型  soc  coc
+	 * 业务类型  soc  coc  BJ:报价单
 	 */
 	@ApiModelProperty(value = "业务类型  soc  coc ")
 	private String businessType;
@@ -360,7 +360,7 @@ public class RouteCost implements Serializable {
 	 */
 	@ApiModelProperty(value = "合作伙伴")
 	@TableField(updateStrategy = FieldStrategy.IGNORED)
-	private Long cooperativePartnerId;
+	private String cooperativePartnerId;
 	/**
 	 * 合作伙伴
 	 */
@@ -518,6 +518,18 @@ public class RouteCost implements Serializable {
 	@ApiModelProperty(value = "限大柜")
 	private String limitBox;
 
+	/**
+	 * 是否合营
+	 */
+	@ApiModelProperty(value = "是否合营")
+	private String whetherJointVenture;
+
+
+	/**
+	 * 报价明细
+	 */
+	@TableField(exist = false)
+	private List<QuotationItem> quotationItemList;
 
 	/**
 	 * 费用明细

+ 6 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/entity/TradingBox.java

@@ -588,6 +588,12 @@ public class TradingBox implements Serializable {
 	@TableField(exist = false)
 	private List<TradingBoxType> boxTypeList;
 
+	/**
+	 * 调箱成本明细
+	 */
+	@TableField(exist = false)
+	private List<BoxAdjustmentCost> boxAdjustmentCostList;
+
 	//请核标识  1买箱 2卖箱
 	@TableField(exist = false)
 	private Integer checkFlag;

+ 7 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/entity/TradingBoxType.java

@@ -16,6 +16,7 @@
  */
 package org.springblade.los.box.entity;
 
+import com.baomidou.mybatisplus.annotation.FieldStrategy;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModel;
@@ -103,5 +104,11 @@ public class TradingBoxType implements Serializable {
 	 */
 	@ApiModelProperty(value = "租户号")
 	private String tenantId;
+	/**
+	 * 出场日期
+	 */
+	@ApiModelProperty(value = "出场日期")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
+	private Date exitDate;
 
 }

+ 36 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/vo/QuotationItemVO.java

@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.box.vo;
+
+import org.springblade.los.box.entity.QuotationItem;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 报价明细表视图实体类
+ *
+ * @author BladeX
+ * @since 2025-05-06
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "QuotationItemVO对象", description = "报价明细表")
+public class QuotationItemVO extends QuotationItem {
+	private static final long serialVersionUID = 1L;
+
+}

+ 4 - 2
blade-service/blade-los/src/main/java/org/springblade/los/basic/cur/service/impl/BCurrencyServiceImpl.java

@@ -102,13 +102,15 @@ public class BCurrencyServiceImpl extends ServiceImpl<CurrencyMapper, BCurrency>
 			List<BCurExrate> bCurExrateListAdd = new ArrayList<>();
 			List<BCurExrate> bCurExrateListUpdate = new ArrayList<>();
 			for (BCurExrate item : bCurrency.getCurExrateList()) {
-				item.setType(bCurrency.getParitiesType());
+				if (item.getId() == null){
+					item.setType(bCurrency.getParitiesType());
+				}
 				item.setCode(bCurrency.getCode());
 				BCurExrate bCurExrate = bCurExrateService.getOne(new LambdaQueryWrapper<BCurExrate>()
 					.eq(BCurExrate::getExrateYear, item.getExrateYear())
 					.eq(ObjectUtils.isNotNull(item.getExrateMonth()), BCurExrate::getExrateMonth, item.getExrateMonth())
 					.eq(ObjectUtils.isNotNull(item.getExrateDay()), BCurExrate::getExrateDay, item.getExrateDay())
-					.eq(BCurExrate::getType, bCurrency.getParitiesType())
+					.eq(BCurExrate::getType, item.getType())
 					.eq(BCurExrate::getCode, item.getCode())
 				);
 				if (bCurExrate != null) {

+ 1 - 1
blade-service/blade-los/src/main/java/org/springblade/los/box/controller/BoxAdjustmentCostController.java

@@ -55,7 +55,7 @@ public class BoxAdjustmentCostController extends BladeController {
 	@ApiOperationSupport(order = 1)
 	@ApiOperation(value = "详情", notes = "传入boxAdjustmentCost")
 	public R<BoxAdjustmentCost> detail(BoxAdjustmentCost boxAdjustmentCost) {
-		BoxAdjustmentCost detail = boxAdjustmentCostService.getOne(Condition.getQueryWrapper(boxAdjustmentCost));
+		BoxAdjustmentCost detail = boxAdjustmentCostService.detail(boxAdjustmentCost);
 		return R.data(detail);
 	}
 

+ 1 - 1
blade-service/blade-los/src/main/java/org/springblade/los/box/controller/BoxPoolController.java

@@ -81,7 +81,7 @@ public class BoxPoolController extends BladeController {
 	@GetMapping("/emptyContainerAppearance/template")
 	public void exportBCountrysTemplate(HttpServletResponse response) {
 		List<EmptyContainerAppearance> list = new ArrayList<>();
-		ExcelUtil.export(response, "导入模板-空箱出场", "空箱出场", list, EmptyContainerAppearance.class);
+		ExcelUtil.export(response, "导入模板", "导入模板", list, EmptyContainerAppearance.class);
 	}
 
 	/**

+ 138 - 0
blade-service/blade-los/src/main/java/org/springblade/los/box/controller/QuotationItemController.java

@@ -0,0 +1,138 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.box.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.web.bind.annotation.*;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.los.box.entity.QuotationItem;
+import org.springblade.los.box.vo.QuotationItemVO;
+import org.springblade.los.box.service.IQuotationItemService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+import java.util.List;
+
+/**
+ * 报价明细表 控制器
+ *
+ * @author BladeX
+ * @since 2025-05-06
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/quotationitem")
+@Api(value = "报价明细表", tags = "报价明细表接口")
+public class QuotationItemController extends BladeController {
+
+	private final IQuotationItemService quotationItemService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入quotationItem")
+	public R<QuotationItem> detail(QuotationItem quotationItem) {
+		QuotationItem detail = quotationItemService.getOne(Condition.getQueryWrapper(quotationItem));
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页 报价明细表
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入quotationItem")
+	public R<IPage<QuotationItem>> list(QuotationItem quotationItem, Query query) {
+		IPage<QuotationItem> pages = quotationItemService.page(Condition.getPage(query), Condition.getQueryWrapper(quotationItem));
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页 报价明细表
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入quotationItem")
+	public R<IPage<QuotationItemVO>> page(QuotationItemVO quotationItem, Query query) {
+		IPage<QuotationItemVO> pages = quotationItemService.selectQuotationItemPage(Condition.getPage(query), quotationItem);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增 报价明细表
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入quotationItem")
+	public R save(@Valid @RequestBody QuotationItem quotationItem) {
+		return R.status(quotationItemService.save(quotationItem));
+	}
+
+	/**
+	 * 修改 报价明细表
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入quotationItem")
+	public R update(@Valid @RequestBody QuotationItem quotationItem) {
+		return R.status(quotationItemService.updateById(quotationItem));
+	}
+
+	/**
+	 * 新增或修改 报价明细表
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入quotationItem")
+	public R submit(@Valid @RequestBody QuotationItem quotationItem) {
+		return R.status(quotationItemService.saveOrUpdate(quotationItem));
+	}
+
+	/**
+	 * 新增或修改 报价明细表
+	 */
+	@PostMapping("/submitList")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入quotationItem")
+	public R submitList(@Valid @RequestBody List<QuotationItem> quotationItemList) {
+		return quotationItemService.submitList(quotationItemList);
+	}
+
+
+	/**
+	 * 删除 报价明细表
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(quotationItemService.removeByIds(Func.toLongList(ids)));
+	}
+
+
+}

+ 9 - 0
blade-service/blade-los/src/main/java/org/springblade/los/box/controller/TradingBoxController.java

@@ -105,6 +105,7 @@ public class TradingBoxController extends BladeController {
 			.like(ObjectUtils.isNotNull(tradingBox.getBoxTypeQuantityTwo()), TradingBox::getBoxTypeQuantityTwo, tradingBox.getBoxTypeQuantityTwo())
 			.eq(ObjectUtils.isNotNull(tradingBox.getBoxClass()), TradingBox::getBoxClass, tradingBox.getBoxClass())
 			.eq(ObjectUtils.isNotNull(tradingBox.getBuxStaus()), TradingBox::getBuxStaus, tradingBox.getBuxStaus())
+			.eq(ObjectUtils.isNotNull(tradingBox.getWhetherEnable()), TradingBox::getWhetherEnable, tradingBox.getWhetherEnable())
 			.eq(ObjectUtils.isNotNull(tradingBox.getDc()), TradingBox::getDc, tradingBox.getDc())
 		;
 		if (ObjectUtils.isNotNull(tradingBox.getEffectiveDate()) && ObjectUtils.isNotNull(tradingBox.getExpiryDate())) {
@@ -326,4 +327,12 @@ public class TradingBoxController extends BladeController {
 		return tradingBoxService.countRent(tradingBox);
 	}
 
+	/**
+	 * OW撤销计算租金
+	 */
+	@GetMapping("/revokeCountRent")
+	public R revokeCountRent(TradingBox tradingBox) {
+		return tradingBoxService.revokeCountRent(tradingBox);
+	}
+
 }

+ 42 - 0
blade-service/blade-los/src/main/java/org/springblade/los/box/mapper/QuotationItemMapper.java

@@ -0,0 +1,42 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.box.mapper;
+
+import org.springblade.los.box.entity.QuotationItem;
+import org.springblade.los.box.vo.QuotationItemVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * 报价明细表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2025-05-06
+ */
+public interface QuotationItemMapper extends BaseMapper<QuotationItem> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param quotationItem
+	 * @return
+	 */
+	List<QuotationItemVO> selectQuotationItemPage(IPage page, QuotationItemVO quotationItem);
+
+}

+ 61 - 0
blade-service/blade-los/src/main/java/org/springblade/los/box/mapper/QuotationItemMapper.xml

@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.los.box.mapper.QuotationItemMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="quotationItemResultMap" type="org.springblade.los.box.entity.QuotationItem">
+        <id column="id" property="id"/>
+        <result column="pid" property="pid"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="remarks" property="remarks"/>
+        <result column="create_user_name" property="createUserName"/>
+        <result column="update_user_name" property="updateUserName"/>
+        <result column="sort" property="sort"/>
+        <result column="shipping_company_id" property="shippingCompanyId"/>
+        <result column="shipping_company_cname" property="shippingCompanyCname"/>
+        <result column="shipping_company_ename" property="shippingCompanyEname"/>
+        <result column="shipping_company_code" property="shippingCompanyCode"/>
+        <result column="shipping_company_abbreviation" property="shippingCompanyAbbreviation"/>
+        <result column="box_type" property="boxType"/>
+        <result column="cur_code" property="curCode"/>
+        <result column="sales_price" property="salesPrice"/>
+        <result column="cost_price" property="costPrice"/>
+        <result column="pol_id" property="polId"/>
+        <result column="pol_cname" property="polCname"/>
+        <result column="pol_ename" property="polEname"/>
+        <result column="pol_code" property="polCode"/>
+        <result column="pod_id" property="podId"/>
+        <result column="pod_cname" property="podCname"/>
+        <result column="pod_ename" property="podEname"/>
+        <result column="pod_code" property="podCode"/>
+        <result column="ship_name_id" property="shipNameId"/>
+        <result column="ship_cname" property="shipCname"/>
+        <result column="ship_ename" property="shipEname"/>
+        <result column="ship_code" property="shipCode"/>
+        <result column="airline_id" property="airlineId"/>
+        <result column="airline_cname" property="airlineCname"/>
+        <result column="airline_ename" property="airlineEname"/>
+        <result column="airline_code" property="airlineCode"/>
+        <result column="shipping_date" property="shippingDate"/>
+        <result column="flight_type" property="flightType"/>
+        <result column="transit_port_id" property="transitPortId"/>
+        <result column="transit_port_cname" property="transitPortCname"/>
+        <result column="transit_port_ename" property="transitPortEname"/>
+        <result column="transit_port_code" property="transitPortCode"/>
+        <result column="cabin_type" property="cabinType"/>
+        <result column="box_belongs_to" property="boxBelongsTo"/>
+        <result column="whether_joint_venture" property="whetherJointVenture"/>
+        <result column="effective_start_date" property="effectiveStartDate"/>
+        <result column="effective_end_date" property="effectiveEndDate"/>
+    </resultMap>
+
+
+    <select id="selectQuotationItemPage" resultMap="quotationItemResultMap">
+        select * from logistics_quotation_item where is_deleted = 0
+    </select>
+
+</mapper>

+ 1 - 1
blade-service/blade-los/src/main/java/org/springblade/los/box/mapper/RouteCostMapper.xml

@@ -94,7 +94,7 @@
         lrc.effective_start_date as effectiveStartDate,
         lrc.effective_end_date as effectiveEndDate,
         lrc.airline_cname as airlineCname,
-        lrc.actual_shipping_company_cname as actualShippingCompanyCname,
+        lrc.shipping_company_cname as actualShippingCompanyCname,
         lrc.business_no as businessNo,
         lrc.create_user_name as createUserName,
         lrc.create_time as createTime,

+ 2 - 0
blade-service/blade-los/src/main/java/org/springblade/los/box/service/IBoxAdjustmentCostService.java

@@ -40,4 +40,6 @@ public interface IBoxAdjustmentCostService extends IService<BoxAdjustmentCost> {
 	IPage<BoxAdjustmentCostVO> selectBoxAdjustmentCostPage(IPage<BoxAdjustmentCostVO> page, BoxAdjustmentCostVO boxAdjustmentCost);
 
 	R submit(BoxAdjustmentCost boxAdjustmentCost);
+
+    BoxAdjustmentCost detail(BoxAdjustmentCost boxAdjustmentCost);
 }

+ 45 - 0
blade-service/blade-los/src/main/java/org/springblade/los/box/service/IQuotationItemService.java

@@ -0,0 +1,45 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.box.service;
+
+import org.springblade.core.tool.api.R;
+import org.springblade.los.box.entity.QuotationItem;
+import org.springblade.los.box.vo.QuotationItemVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+import java.util.List;
+
+/**
+ * 报价明细表 服务类
+ *
+ * @author BladeX
+ * @since 2025-05-06
+ */
+public interface IQuotationItemService extends IService<QuotationItem> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param quotationItem
+	 * @return
+	 */
+	IPage<QuotationItemVO> selectQuotationItemPage(IPage<QuotationItemVO> page, QuotationItemVO quotationItem);
+
+	R submitList(List<QuotationItem> quotationItemList);
+}

+ 2 - 0
blade-service/blade-los/src/main/java/org/springblade/los/box/service/ITradingBoxService.java

@@ -60,4 +60,6 @@ public interface ITradingBoxService extends IService<TradingBox> {
 	TradingBox revoke(TradingBox tradingBox);
 
 	R countRent(TradingBox tradingBox);
+
+	R revokeCountRent(TradingBox tradingBox);
 }

+ 9 - 8
blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/BoxAdjustmentCostServiceImpl.java

@@ -16,20 +16,16 @@
  */
 package org.springblade.los.box.service.impl;
 
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
-import org.springblade.los.basic.business.entity.BusinessType;
-import org.springblade.los.billno.entity.BusinessBillNo;
 import org.springblade.los.box.entity.BoxAdjustmentCost;
-import org.springblade.los.box.vo.BoxAdjustmentCostVO;
 import org.springblade.los.box.mapper.BoxAdjustmentCostMapper;
 import org.springblade.los.box.service.IBoxAdjustmentCostService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.los.box.vo.BoxAdjustmentCostVO;
 import org.springframework.stereotype.Service;
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
 import java.util.Date;
 
@@ -61,7 +57,12 @@ public class BoxAdjustmentCostServiceImpl extends ServiceImpl<BoxAdjustmentCostM
 			boxAdjustmentCost.setUpdateUserName(AuthUtil.getUserName());
 		}
 		this.saveOrUpdate(boxAdjustmentCost);
-		return R.data(boxAdjustmentCost) ;
+		return R.data(boxAdjustmentCost);
+	}
+
+	@Override
+	public BoxAdjustmentCost detail(BoxAdjustmentCost boxAdjustmentCost) {
+		return baseMapper.selectById(boxAdjustmentCost.getId());
 	}
 
 }

+ 34 - 13
blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/PutBoxServiceImpl.java

@@ -853,7 +853,13 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 									tradingBoxItem.setPolCyCode(corps.getCode());
 									tradingBoxItem.setPolCyCname(corps.getCnName());
 									tradingBoxItem.setPolCyEname(corps.getEnName());
-									tradingBoxItem.setPolStationEmptyContainerExitDate(item.getBoxStatusDate());
+									if (ObjectUtils.isNotNull(item.getBoxStatusDate())) {
+										tradingBoxItem.setRentEndDate(item.getBoxStatusDate());
+										tradingBoxItem.setPolStationEmptyContainerExitDate(item.getBoxStatusDate());
+									} else {
+										tradingBoxItem.setRentEndDate(new Date());
+										tradingBoxItem.setPolStationEmptyContainerExitDate(new Date());
+									}
 									tradingBoxItem.setStatus("待使用");
 								} else {
 									tradingBoxItem = new TradingBoxItem();
@@ -885,7 +891,14 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 									tradingBoxItem.setPolCyCode(corps.getCode());
 									tradingBoxItem.setPolCyCname(corps.getCnName());
 									tradingBoxItem.setPolCyEname(corps.getEnName());
-									tradingBoxItem.setPolStationEmptyContainerExitDate(item.getBoxStatusDate());
+									tradingBoxItem.setActivationDate(tradingBox.getActivationDate());
+									if (ObjectUtils.isNotNull(item.getBoxStatusDate())) {
+										tradingBoxItem.setRentEndDate(item.getBoxStatusDate());
+										tradingBoxItem.setPolStationEmptyContainerExitDate(item.getBoxStatusDate());
+									} else {
+										tradingBoxItem.setRentEndDate(new Date());
+										tradingBoxItem.setPolStationEmptyContainerExitDate(new Date());
+									}
 									tradingBoxItem.setStatus("待使用");
 								}
 							} else {
@@ -917,7 +930,14 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 								tradingBoxItem.setPolCyCode(corps.getCode());
 								tradingBoxItem.setPolCyCname(corps.getCnName());
 								tradingBoxItem.setPolCyEname(corps.getEnName());
-								tradingBoxItem.setPolStationEmptyContainerExitDate(item.getBoxStatusDate());
+								tradingBoxItem.setActivationDate(tradingBox.getActivationDate());
+								if (ObjectUtils.isNotNull(item.getBoxStatusDate())) {
+									tradingBoxItem.setRentEndDate(item.getBoxStatusDate());
+									tradingBoxItem.setPolStationEmptyContainerExitDate(item.getBoxStatusDate());
+								} else {
+									tradingBoxItem.setRentEndDate(new Date());
+									tradingBoxItem.setPolStationEmptyContainerExitDate(new Date());
+								}
 								tradingBoxItem.setStatus("待使用");
 							}
 							tradingBoxItem.setBoxEastId(tradingBox.getPurchaseCompanyId());
@@ -1074,6 +1094,11 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 		}
 		List<String> containerNumberList = archivesList.stream().map(Archives::getContainerNumber)
 			.distinct().collect(Collectors.toList());
+		List<String> containerNumberOwList = archivesList.stream().map(Archives::getContainerNumberOw)
+			.distinct().collect(Collectors.toList());
+		if (!containerNumberOwList.isEmpty()) {
+			containerNumberList.addAll(containerNumberOwList);
+		}
 		List<String> boxType = excelList.stream().map(EmptyContainerAppearance::getBoxType).filter(Objects::nonNull)
 			.distinct().collect(Collectors.toList());
 		List<BCntrTypes> cntrTypesList = bCntrTypesService.list(new LambdaQueryWrapper<BCntrTypes>()
@@ -1243,10 +1268,10 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 				throw new RemoteException("箱号:" + item.getBoxCode() + "未查到数据");
 			}
 			if ("自有箱,OW(放)".contains(archives.getContainerNumberType())) {
-				PutBox putBox = putBoxNewList.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber())
+				PutBox putBox = putBoxNewList.stream().filter(e -> e.getContainerNumber().equals(archives.getContainerNumber())
 					&& e.getPolId().equals(ports.getId()) && e.getPolStationId().equals(corps.getId())).findFirst().orElse(null);
 				if (putBox == null) {
-					throw new RuntimeException("未查到放箱号:" + item.getContainerNumber() + "单据");
+					throw new RuntimeException("未查到放箱号:" + archives.getContainerNumber() + "单据");
 				}
 				//放箱号明细数据处理
 				PutBoxItems putBoxItem;
@@ -1268,7 +1293,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 						putBoxItem.setBoxCondition("新");
 						putBoxItem.setBoxStatus("好");
 						putBoxItem.setPid(putBox.getId());
-						putBoxItem.setContainerNumber(item.getContainerNumber());
+						putBoxItem.setContainerNumber(archives.getContainerNumber());
 						putBoxItem.setBoxCode(item.getBoxCode());
 						putBoxItem.setBoxType(item.getBoxType());
 						putBoxItem.setMblno(item.getMblno());
@@ -1285,7 +1310,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 					putBoxItem.setBoxCondition("新");
 					putBoxItem.setBoxStatus("好");
 					putBoxItem.setPid(putBox.getId());
-					putBoxItem.setContainerNumber(item.getContainerNumber());
+					putBoxItem.setContainerNumber(archives.getContainerNumber());
 					putBoxItem.setBoxCode(item.getBoxCode());
 					putBoxItem.setBoxType(item.getBoxType());
 					putBoxItem.setMblno(item.getMblno());
@@ -1384,9 +1409,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 														  List<TradingBoxItem> tradingBoxItemList, BPorts ports, String status) {
 		PutBox putBoxOld;
 		if ("1".equals(status)) {
-			putBoxOld = putBoxList.stream().filter(e -> e.getContainerNumber().equals(archives.getContainerNumberOw())
-				&& ObjectUtils.isNotNull(e.getPolId()) && e.getPolId().equals(archives.getAddressId())
-				&& ObjectUtils.isNotNull(e.getPolStationId()) && e.getPolStationId().equals(archives.getStationId())).findFirst().orElse(null);
+			putBoxOld = putBoxList.stream().filter(e -> e.getContainerNumber().equals(archives.getContainerNumberOw())).findFirst().orElse(null);
 		} else {
 			putBoxOld = putBoxList.stream().filter(e -> e.getContainerNumber().equals(archives.getContainerNumber())
 				&& ObjectUtils.isNotNull(e.getPolId()) && e.getPolId().equals(archives.getAddressId())
@@ -1445,9 +1468,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 												BCorps corps, List<PutBoxItems> putBoxItemsList, String status) {
 		PutBox putBoxOld;
 		if ("1".equals(status)) {
-			putBoxOld = putBoxList.stream().filter(e -> e.getContainerNumber().equals(archives.getContainerNumberOw())
-				&& ObjectUtils.isNotNull(e.getPolId()) && e.getPolId().equals(archives.getAddressId())
-				&& ObjectUtils.isNotNull(e.getPolStationId()) && e.getPolStationId().equals(archives.getStationId())).findFirst().orElse(null);
+			putBoxOld = putBoxList.stream().filter(e -> e.getContainerNumber().equals(archives.getContainerNumberOw())).findFirst().orElse(null);
 		} else {
 			putBoxOld = putBoxList.stream().filter(e -> e.getContainerNumber().equals(archives.getContainerNumber())
 				&& ObjectUtils.isNotNull(e.getPolId()) && e.getPolId().equals(archives.getAddressId())

+ 66 - 0
blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/QuotationItemServiceImpl.java

@@ -0,0 +1,66 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.box.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.los.box.entity.QuotationItem;
+import org.springblade.los.box.mapper.QuotationItemMapper;
+import org.springblade.los.box.service.IQuotationItemService;
+import org.springblade.los.box.vo.QuotationItemVO;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 报价明细表 服务实现类
+ *
+ * @author BladeX
+ * @since 2025-05-06
+ */
+@Service
+public class QuotationItemServiceImpl extends ServiceImpl<QuotationItemMapper, QuotationItem> implements IQuotationItemService {
+
+	@Override
+	public IPage<QuotationItemVO> selectQuotationItemPage(IPage<QuotationItemVO> page, QuotationItemVO quotationItem) {
+		return page.setRecords(baseMapper.selectQuotationItemPage(page, quotationItem));
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public R submitList(List<QuotationItem> quotationItemList) {
+		for (QuotationItem item : quotationItemList) {
+			if (item.getId() == null) {
+				item.setCreateUser(AuthUtil.getUserId());
+				item.setCreateTime(new Date());
+				item.setCreateUserName(AuthUtil.getUserName());
+				item.setTenantId(AuthUtil.getTenantId());
+			} else {
+				item.setUpdateTime(new Date());
+				item.setUpdateUser(AuthUtil.getUserId());
+				item.setUpdateUserName(AuthUtil.getUserName());
+			}
+		}
+		this.saveOrUpdateBatch(quotationItemList);
+		return R.data(quotationItemList);
+	}
+
+}

+ 110 - 83
blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/RouteCostServiceImpl.java

@@ -29,21 +29,23 @@ import org.springblade.los.basic.business.entity.BusinessType;
 import org.springblade.los.basic.business.service.IBusinessTypeService;
 import org.springblade.los.billno.entity.BusinessBillNo;
 import org.springblade.los.billno.service.IBusinessBillNoService;
-import org.springblade.los.check.dto.LosAuditProecessDTO;
-import org.springblade.los.check.entity.LosAuditPathsActs;
-import org.springblade.los.check.entity.LosAuditPathsLevels;
-import org.springblade.los.check.service.IAuditPathsActsService;
-import org.springblade.los.check.service.IAuditPathsLevelsService;
-import org.springblade.los.check.service.IAuditProecessService;
-import org.springblade.los.excel.RouteCostProfitExcel;
+import org.springblade.los.box.entity.QuotationItem;
 import org.springblade.los.box.entity.RouteCost;
 import org.springblade.los.box.entity.RouteCostFee;
 import org.springblade.los.box.entity.RouteCostItem;
 import org.springblade.los.box.mapper.RouteCostMapper;
+import org.springblade.los.box.service.IQuotationItemService;
 import org.springblade.los.box.service.IRouteCostFeeService;
 import org.springblade.los.box.service.IRouteCostItemService;
 import org.springblade.los.box.service.IRouteCostService;
 import org.springblade.los.box.vo.RouteCostVO;
+import org.springblade.los.check.dto.LosAuditProecessDTO;
+import org.springblade.los.check.entity.LosAuditPathsActs;
+import org.springblade.los.check.entity.LosAuditPathsLevels;
+import org.springblade.los.check.service.IAuditPathsActsService;
+import org.springblade.los.check.service.IAuditPathsLevelsService;
+import org.springblade.los.check.service.IAuditProecessService;
+import org.springblade.los.excel.RouteCostProfitExcel;
 import org.springblade.system.entity.Dept;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -84,6 +86,8 @@ public class RouteCostServiceImpl extends ServiceImpl<RouteCostMapper, RouteCost
 
 	private final IAuditProecessService auditProecessService;
 
+	private final IQuotationItemService quotationItemService;
+
 	@Override
 	public IPage<RouteCostVO> selectRouteCostPage(IPage<RouteCostVO> page, RouteCostVO routeCost) {
 		return page.setRecords(baseMapper.selectRouteCostPage(page, routeCost));
@@ -108,6 +112,11 @@ public class RouteCostServiceImpl extends ServiceImpl<RouteCostMapper, RouteCost
 			.eq(RouteCostItem::getIsDeleted, 0)
 			.eq(RouteCostItem::getPid, detail.getId()));
 		detail.setCostItemList(costItemList.isEmpty() ? new ArrayList<>() : costItemList);
+		List<QuotationItem> quotationItemList = quotationItemService.list(new LambdaQueryWrapper<QuotationItem>()
+			.eq(QuotationItem::getTenantId, AuthUtil.getTenantId())
+			.eq(QuotationItem::getIsDeleted, 0)
+			.eq(QuotationItem::getPid, detail.getId()));
+		detail.setQuotationItemList(quotationItemList.isEmpty() ? new ArrayList<>() : quotationItemList);
 		return detail;
 	}
 
@@ -144,89 +153,107 @@ public class RouteCostServiceImpl extends ServiceImpl<RouteCostMapper, RouteCost
 			routeCost.setUpdateUserName(AuthUtil.getUserName());
 		}
 		this.saveOrUpdate(routeCost);
-		if (ObjectUtils.isNotNull(routeCost.getCostFeeList())) {
-			for (RouteCostFee routeCostFee : routeCost.getCostFeeList()) {
-				if (routeCostFee.getId() == null) {
-					routeCostFee.setPid(routeCost.getId());
-					routeCostFee.setCreateTime(new Date());
-					routeCostFee.setCreateUser(AuthUtil.getUserId());
-					routeCostFee.setCreateUserName(AuthUtil.getUserName());
-				} else {
-					routeCostFee.setUpdateUser(AuthUtil.getUserId());
-					routeCostFee.setUpdateTime(new Date());
-					routeCostFee.setUpdateUserName(AuthUtil.getUserName());
+		if ("COC,SOC".contains(routeCost.getBusinessType())) {
+			if (ObjectUtils.isNotNull(routeCost.getCostFeeList())) {
+				for (RouteCostFee routeCostFee : routeCost.getCostFeeList()) {
+					if (routeCostFee.getId() == null) {
+						routeCostFee.setPid(routeCost.getId());
+						routeCostFee.setCreateTime(new Date());
+						routeCostFee.setCreateUser(AuthUtil.getUserId());
+						routeCostFee.setCreateUserName(AuthUtil.getUserName());
+					} else {
+						routeCostFee.setUpdateUser(AuthUtil.getUserId());
+						routeCostFee.setUpdateTime(new Date());
+						routeCostFee.setUpdateUserName(AuthUtil.getUserName());
+					}
 				}
+				routeCostFeeService.saveOrUpdateBatch(routeCost.getCostFeeList());
 			}
-			routeCostFeeService.saveOrUpdateBatch(routeCost.getCostFeeList());
-		}
-		if (ObjectUtils.isNotNull(routeCost.getCostItemList())) {
-			int days = routeCost.getNavigateDay() + routeCost.getExistStationDay();
-			List<RouteCostFee> costFeeList = routeCost.getCostFeeList();
-			for (RouteCostItem routeCostItem : routeCost.getCostItemList()) {
-				if ("SOC".equals(routeCost.getBusinessType())) {
-					//一程POL杂费成本
-					routeCostItem.setPolCost(computationalCost(costFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
-					//一程POL杂费收入
-					routeCostItem.setPolIncome(computationalIncome(costFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
-					//一程POD杂费成本
-					routeCostItem.setPodCost(computationalCost(costFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
-					//一程POD杂费收入
-					routeCostItem.setPodIncome(computationalIncome(costFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
-					//一程用箱成本
-					if (0 != days && ObjectUtils.isNotNull(routeCostItem.getBoxCost()) &&
-						routeCostItem.getBoxCost().compareTo(new BigDecimal("0.00")) != 0) {
-						BigDecimal boxCost = new BigDecimal(days).multiply(routeCostItem.getBoxCost());
-						routeCostItem.setUseBoxCost(boxCost);
+			if (ObjectUtils.isNotNull(routeCost.getCostItemList())) {
+				int days = routeCost.getNavigateDay() + routeCost.getExistStationDay();
+				List<RouteCostFee> costFeeList = routeCost.getCostFeeList();
+				for (RouteCostItem routeCostItem : routeCost.getCostItemList()) {
+					if ("SOC".equals(routeCost.getBusinessType())) {
+						//一程POL杂费成本
+						routeCostItem.setPolCost(computationalCost(costFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
+						//一程POL杂费收入
+						routeCostItem.setPolIncome(computationalIncome(costFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
+						//一程POD杂费成本
+						routeCostItem.setPodCost(computationalCost(costFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
+						//一程POD杂费收入
+						routeCostItem.setPodIncome(computationalIncome(costFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "0"));
+						//一程用箱成本
+						if (0 != days && ObjectUtils.isNotNull(routeCostItem.getBoxCost()) &&
+							routeCostItem.getBoxCost().compareTo(new BigDecimal("0.00")) != 0) {
+							BigDecimal boxCost = new BigDecimal(days).multiply(routeCostItem.getBoxCost());
+							routeCostItem.setUseBoxCost(boxCost);
+						} else {
+							routeCostItem.setUseBoxCost(new BigDecimal("0.00"));
+						}
+						// 一程成本价 = 一程海运费+一程用箱成本+一程pol杂费+一程pod成本
+						routeCostItem.setCostPrice(routeCostItem.getOceanFreight().add(routeCostItem.getPodCost()).add(routeCostItem.getPolCost())
+							.add(routeCostItem.getUseBoxCost()));
+						//一程合计利润
+						routeCostItem.setTotalProfit(routeCostItem.getSalesPrice().add(routeCostItem.getPolIncome())
+							.add(routeCostItem.getPodIncome()).subtract(routeCostItem.getCostPrice()));
+						if ("转船".equals(routeCost.getFlightType()) && "自转".equals(routeCost.getChangeShipType())) {
+							//二程POL杂费成本
+							routeCostItem.setPolCostTwo(computationalCost(costFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
+							//二程POL杂费收入
+							routeCostItem.setPolIncomeTwo(computationalIncome(costFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
+							//二程POD杂费成本
+							routeCostItem.setPodCostTwo(computationalCost(costFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
+							//二程POD杂费收入
+							routeCostItem.setPodIncomeTwo(computationalIncome(costFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
+							// 二程成本价 = 二程海运费+二程pol杂费+二程pod成本
+							routeCostItem.setCostPriceTwo(routeCostItem.getOceanFreightTwo().add(routeCostItem.getPodCostTwo()).add(routeCostItem.getPolCostTwo()));
+							//二程合计利润
+							routeCostItem.setTotalProfitTwo(routeCostItem.getSalesPriceTwo().add(routeCostItem.getPolIncomeTwo())
+								.add(routeCostItem.getPodIncomeTwo()).subtract(routeCostItem.getCostPriceTwo()));
+						}
+						//合计利润
+						routeCostItem.setProfit(routeCostItem.getTotalProfit().add(routeCostItem.getTotalProfitTwo()));
 					} else {
-						routeCostItem.setUseBoxCost(new BigDecimal("0.00"));
+						//一程合计利润
+						routeCostItem.setTotalProfit(routeCostItem.getSalesPrice().subtract(routeCostItem.getCostPrice()));
+						//合计利润
+						routeCostItem.setProfit(routeCostItem.getTotalProfit());
 					}
-					// 一程成本价 = 一程海运费+一程用箱成本+一程pol杂费+一程pod成本
-					routeCostItem.setCostPrice(routeCostItem.getOceanFreight().add(routeCostItem.getPodCost()).add(routeCostItem.getPolCost())
-						.add(routeCostItem.getUseBoxCost()));
-					//一程合计利润
-					routeCostItem.setTotalProfit(routeCostItem.getSalesPrice().add(routeCostItem.getPolIncome())
-						.add(routeCostItem.getPodIncome()).subtract(routeCostItem.getCostPrice()));
-					if ("转船".equals(routeCost.getFlightType()) && "自转".equals(routeCost.getChangeShipType())) {
-						//二程POL杂费成本
-						routeCostItem.setPolCostTwo(computationalCost(costFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
-						//二程POL杂费收入
-						routeCostItem.setPolIncomeTwo(computationalIncome(costFeeList, "POL", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
-						//二程POD杂费成本
-						routeCostItem.setPodCostTwo(computationalCost(costFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
-						//二程POD杂费收入
-						routeCostItem.setPodIncomeTwo(computationalIncome(costFeeList, "POD", routeCostItem.getBoxType(), routeCostItem.getExrate(), "1"));
-						// 二程成本价 = 二程海运费+二程pol杂费+二程pod成本
-						routeCostItem.setCostPriceTwo(routeCostItem.getOceanFreightTwo().add(routeCostItem.getPodCostTwo()).add(routeCostItem.getPolCostTwo()));
-						//二程合计利润
-						routeCostItem.setTotalProfitTwo(routeCostItem.getSalesPriceTwo().add(routeCostItem.getPolIncomeTwo())
-							.add(routeCostItem.getPodIncomeTwo()).subtract(routeCostItem.getCostPriceTwo()));
+					if (routeCostItem.getId() == null) {
+						routeCostItem.setPid(routeCost.getId());
+						routeCostItem.setCreateTime(new Date());
+						routeCostItem.setCreateUser(AuthUtil.getUserId());
+						routeCostItem.setCreateUserName(AuthUtil.getUserName());
+					} else {
+						routeCostItem.setUpdateUser(AuthUtil.getUserId());
+						routeCostItem.setUpdateTime(new Date());
+						routeCostItem.setUpdateUserName(AuthUtil.getUserName());
 					}
-					//合计利润
-					routeCostItem.setProfit(routeCostItem.getTotalProfit().add(routeCostItem.getTotalProfitTwo()));
-				} else {
-					//一程合计利润
-					routeCostItem.setTotalProfit(routeCostItem.getSalesPrice().subtract(routeCostItem.getCostPrice()));
-					//合计利润
-					routeCostItem.setProfit(routeCostItem.getTotalProfit());
 				}
-				if (routeCostItem.getId() == null) {
-					routeCostItem.setPid(routeCost.getId());
-					routeCostItem.setCreateTime(new Date());
-					routeCostItem.setCreateUser(AuthUtil.getUserId());
-					routeCostItem.setCreateUserName(AuthUtil.getUserName());
-				} else {
-					routeCostItem.setUpdateUser(AuthUtil.getUserId());
-					routeCostItem.setUpdateTime(new Date());
-					routeCostItem.setUpdateUserName(AuthUtil.getUserName());
+				routeCostItemService.saveOrUpdateBatch(routeCost.getCostItemList());
+				routeCost.setProfit20(totalProfit(routeCost.getCostItemList(), "20"));
+				routeCost.setProfit40(totalProfit(routeCost.getCostItemList(), "40"));
+				routeCost.setProfitHc(totalProfit(routeCost.getCostItemList(), "40HC"));
+				routeCost.setOtherProfit(totalProfit(routeCost.getCostItemList(), "other"));
+				routeCost.setTotalProfit(routeCost.getProfit20().add(routeCost.getProfit40()).add(routeCost.getProfitHc()).add(routeCost.getOtherProfit()));
+				this.saveOrUpdate(routeCost);
+			}
+		} else {
+			if (ObjectUtils.isNotNull(routeCost.getQuotationItemList())) {
+				for (QuotationItem item : routeCost.getQuotationItemList()) {
+					if (item.getId() == null) {
+						item.setPid(routeCost.getId());
+						item.setCreateTime(new Date());
+						item.setCreateUser(AuthUtil.getUserId());
+						item.setCreateUserName(AuthUtil.getUserName());
+					} else {
+						item.setUpdateUser(AuthUtil.getUserId());
+						item.setUpdateTime(new Date());
+						item.setUpdateUserName(AuthUtil.getUserName());
+					}
 				}
+				quotationItemService.saveOrUpdateBatch(routeCost.getQuotationItemList());
 			}
-			routeCostItemService.saveOrUpdateBatch(routeCost.getCostItemList());
-			routeCost.setProfit20(totalProfit(routeCost.getCostItemList(), "20"));
-			routeCost.setProfit40(totalProfit(routeCost.getCostItemList(), "40"));
-			routeCost.setProfitHc(totalProfit(routeCost.getCostItemList(), "40HC"));
-			routeCost.setOtherProfit(totalProfit(routeCost.getCostItemList(), "other"));
-			routeCost.setTotalProfit(routeCost.getProfit20().add(routeCost.getProfit40()).add(routeCost.getProfitHc()).add(routeCost.getOtherProfit()));
-			this.saveOrUpdate(routeCost);
 		}
 		return R.data(routeCost);
 	}
@@ -375,7 +402,7 @@ public class RouteCostServiceImpl extends ServiceImpl<RouteCostMapper, RouteCost
 			auditProecessDTO.setCorpsName(declare.getActualShippingCompanyCname());
 			auditProecessDTO.setReferenceNumber(declare.getBusinessNo());
 			auditProecessDTO.setMorderNo(declare.getBusinessNo());
-			Dept dept = deptUtils.getDept(declare.getBelongingCompanyId() + "");
+			Dept dept = deptUtils.getDept(AuthUtil.getDeptId());
 			if (dept != null) {
 				auditProecessDTO.setSalesCompanyId(dept.getId());
 				auditProecessDTO.setSalesCompanyName(dept.getDeptName());

+ 201 - 32
blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/TradingBoxServiceImpl.java

@@ -83,6 +83,8 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
 
 	private final IBFeesService bFeesService;
 
+	private final IBoxAdjustmentCostService boxAdjustmentCostService;
+
 	@Override
 	public TradingBox getDetail(TradingBox tradingBox) {
 		if (tradingBox.getId() == null) {
@@ -121,6 +123,12 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
 				.eq(TradingBoxType::getPid, details.getId());
 			List<TradingBoxType> tradingBoxTypeList = tradingBoxTypeService.list(typeLambdaQueryWrapper);
 			details.setBoxTypeList(tradingBoxTypeList.isEmpty() ? new ArrayList<>() : tradingBoxTypeList);
+			LambdaQueryWrapper<BoxAdjustmentCost> costLambdaQueryWrapper = new LambdaQueryWrapper<>();
+			costLambdaQueryWrapper.eq(BoxAdjustmentCost::getIsDeleted, 0)
+				.eq(BoxAdjustmentCost::getTenantId, AuthUtil.getTenantId())
+				.eq(BoxAdjustmentCost::getPid, details.getId());
+			List<BoxAdjustmentCost> boxAdjustmentCostList = boxAdjustmentCostService.list(costLambdaQueryWrapper);
+			details.setBoxAdjustmentCostList(boxAdjustmentCostList.isEmpty() ? new ArrayList<>() : boxAdjustmentCostList);
 		}
 		return details;
 	}
@@ -181,6 +189,9 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
 		} else if ("CCSQ".equals(tradingBox.getType())) {
 			billNoFormat = "CCSQ";
 			businessTypeCode = "CCSQ";
+		}else if ("DXCB".equals(tradingBox.getType())) {
+			billNoFormat = "DXCB";
+			businessTypeCode = "DXCB";
 		} else {
 			throw new Error("缺少必要参数类型");
 		}
@@ -423,7 +434,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
 		//箱型箱量
 		List<TradingBoxType> boxTypeList = tradingBox.getBoxTypeList();
 		if (ObjectUtils.isNotNull(boxTypeList) && !boxTypeList.isEmpty() &&
-			("ZR".equals(tradingBox.getType()) || "ZC".equals(tradingBox.getType()) || "DL".equals(tradingBox.getType()))) {
+			"ZR,ZC,DL,XGDX,CCSQ".contains(tradingBox.getType())) {
 			//箱号拼接字符串
 			List<String> boxType = boxTypeList.stream().map(TradingBoxType::getBoxType).distinct().collect(Collectors.toList());
 			if (boxTypeList.size() != boxType.size()) {
@@ -433,17 +444,21 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
 			for (TradingBoxType item : boxTypeList) {
 				boxTypeText.append(item.getBoxType()).append("*").append(item.getNumber()).append(",");
 				if (item.getId() == null) {
+					item.setCreateUserName(AuthUtil.getUserName());
 					item.setCreateUser(AuthUtil.getUserId());
 					item.setCreateTime(new Date());
 					item.setTenantId(AuthUtil.getTenantId());
 					item.setPid(tradingBox.getId());
 				} else {
+					item.setUpdateUserName(AuthUtil.getUserName());
 					item.setUpdateUser(AuthUtil.getUserId());
 					item.setUpdateTime(new Date());
 					item.setPid(tradingBox.getId());
 				}
 			}
-			tradingBox.setBoxTypeQuantityOne(boxTypeText.toString());
+			if (!"XGDX,CCSQ".contains(tradingBox.getType())){
+				tradingBox.setBoxTypeQuantityOne(boxTypeText.toString());
+			}
 			tradingBoxTypeService.saveOrUpdateBatch(boxTypeList);
 			tradingBox.setBoxTypeList(boxTypeList);
 		}
@@ -466,6 +481,22 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
 			rentTermService.saveOrUpdateBatch(rentTermList);
 			tradingBox.setRentTermList(rentTermList);
 		}
+		if ("DXCB".equals(tradingBox.getType()) && ObjectUtils.isNotNull(tradingBox.getBoxAdjustmentCostList())
+			&& !tradingBox.getBoxAdjustmentCostList().isEmpty()) {
+			for (BoxAdjustmentCost item : tradingBox.getBoxAdjustmentCostList()) {
+				if (item.getId() == null) {
+					item.setCreateUser(AuthUtil.getUserId());
+					item.setCreateTime(new Date());
+					item.setTenantId(AuthUtil.getTenantId());
+					item.setPid(tradingBox.getId());
+				} else {
+					item.setUpdateUser(AuthUtil.getUserId());
+					item.setUpdateTime(new Date());
+					item.setPid(tradingBox.getId());
+				}
+			}
+			boxAdjustmentCostService.saveOrUpdateBatch(tradingBox.getBoxAdjustmentCostList());
+		}
 		baseMapper.updateById(tradingBox);
 		return tradingBox;
 	}
@@ -1786,6 +1817,8 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
 				putBox.setSysNo((String) clientBillNo.getData());
 				putBox.setBoxEastId(tradingBox.getPurchaseCompanyId() + "");
 				putBox.setBoxEastName(tradingBox.getPurchaseCompanyName());
+				putBox.setAgentId(tradingBox.getPurchaseCompanyId());
+				putBox.setAgentName(tradingBox.getPurchaseCompanyName());
 				putBox.setContainerNumber(detail.getContainerNumber());
 				if ("DL".equals(tradingBox.getType())) {
 					putBox.setBusType("代理箱");
@@ -1897,6 +1930,89 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
 		tradingBox.setUpdateUser(AuthUtil.getUserId());
 		tradingBox.setUpdateUserName(AuthUtil.getUserName());
 		baseMapper.updateById(tradingBox);
+		if ("XGDX".equals(tradingBox.getType()) || "CCSQ".equals(tradingBox.getType())) {
+			List<TradingBoxItem> tradingBoxItemList = tradingBoxItemService.list(new LambdaQueryWrapper<TradingBoxItem>()
+				.eq(TradingBoxItem::getPid, tradingBox.getId())
+				.eq(TradingBoxItem::getTenantId, AuthUtil.getTenantId())
+				.eq(TradingBoxItem::getIsDeleted, 0));
+			if (tradingBoxItemList.isEmpty()) {
+				throw new RuntimeException("调箱明细不能为空");
+			}
+			List<String> boxCode = tradingBoxItemList.stream().map(TradingBoxItem::getCode).collect(Collectors.toList());
+			List<Archives> archivesList = archivesService.list(new LambdaQueryWrapper<Archives>()
+				.eq(Archives::getTenantId, AuthUtil.getTenantId())
+				.eq(Archives::getIsDeleted, 0)
+				.eq(Archives::getStatus, "待使用")
+				.in(Archives::getCode, boxCode));
+			if (archivesList.isEmpty()) {
+				throw new RuntimeException("未查到可调箱");
+			}
+			List<Archives> archivesListNew = new ArrayList<>();
+			List<ArchivesTrajectory> archivesTrajectoryList = new ArrayList<>();
+			for (TradingBoxItem item : tradingBoxItemList) {
+				Archives archives = archivesList.stream().filter(e -> e.getCode().equals(item.getCode())).findFirst().orElse(null);
+				if (archives == null) {
+					throw new RuntimeException("箱号:" + item.getCode() + "未查到或状态不可用");
+				}
+				archives.setNewDate(new Date());
+				archives.setAddressId(Long.parseLong(tradingBox.getPodId()));
+				archives.setAddressCode(tradingBox.getPodCode());
+				archives.setAddressCname(tradingBox.getPodCname());
+				archives.setAddressEname(tradingBox.getPodEname());
+				archives.setStationId(tradingBox.getPodStationId());
+				archives.setStationCode(tradingBox.getPodStationCode());
+				archives.setStationCname(tradingBox.getPodStationCname());
+				archives.setStationEname(tradingBox.getPodStationEname());
+				archives.setUpdateTime(new Date());
+				archives.setUpdateUser(AuthUtil.getUserId());
+				archives.setUpdateUserName(AuthUtil.getUserName());
+				archivesListNew.add(archives);
+				//记录箱轨迹信息
+				ArchivesTrajectory archivesTrajectory = new ArchivesTrajectory();
+				if ("CCSQ".equals(tradingBox.getType())){
+					archivesTrajectory.setStatus("出场申请");
+				}else if ("XGDX".equals(tradingBox.getType())){
+					archivesTrajectory.setStatus("调箱");
+				}else{
+					archivesTrajectory.setStatus("");
+				}
+				archivesTrajectory.setPortId(Long.parseLong(tradingBox.getPodId()));
+				archivesTrajectory.setPortCode(tradingBox.getPodCode());
+				archivesTrajectory.setPortCname(tradingBox.getPodCname());
+				archivesTrajectory.setPortEname(tradingBox.getPodEname());
+				archivesTrajectory.setStationId(tradingBox.getPodStationId());
+				archivesTrajectory.setStationCode(tradingBox.getPodStationCode());
+				archivesTrajectory.setStationCname(tradingBox.getPodStationCname());
+				archivesTrajectory.setStationEname(tradingBox.getPodStationEname());
+				archivesTrajectory.setContainerNumber(item.getContainerNumber());
+				archivesTrajectory.setBoxType(item.getBoxType());
+				archivesTrajectory.setBoxCategory(item.getBoxCategory());
+				archivesTrajectory.setBoxEastId(item.getBoxEastId());
+				archivesTrajectory.setBoxEastName(item.getBoxEastName());
+				archivesTrajectory.setMblno(item.getMblno());
+				archivesTrajectory.setBoxDynamics(item.getBoxDynamics());
+				archivesTrajectory.setNewDate(tradingBox.getRentDate());
+				archivesTrajectory.setCorpId(tradingBox.getPurchaseCompanyId());
+				archivesTrajectory.setCorpName(tradingBox.getPurchaseCompanyName());
+				archivesTrajectory.setContractNo(tradingBox.getContractNo());
+				archivesTrajectory.setBillType(tradingBox.getType());
+				archivesTrajectory.setCode(item.getCode());
+				archivesTrajectory.setPortCname(tradingBox.getAddressCname());
+				archivesTrajectory.setNewDate(new Date());
+				archivesTrajectory.setCreateTime(new Date());
+				archivesTrajectory.setCreateUser(AuthUtil.getUserId());
+				archivesTrajectory.setCreateUserName(AuthUtil.getUserName());
+				archivesTrajectory.setTenantId(AuthUtil.getTenantId());
+				archivesTrajectory.setSrcId(tradingBox.getId());
+				archivesTrajectoryList.add(archivesTrajectory);
+			}
+			if (!archivesListNew.isEmpty()) {
+				archivesService.updateBatchById(archivesListNew);
+			}
+			if (!archivesTrajectoryList.isEmpty()) {
+				archivesTrajectoryService.saveBatch(archivesTrajectoryList);
+			}
+		}
 		return tradingBox;
 	}
 
@@ -1925,9 +2041,7 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
 			.eq(TradingBoxItem::getTenantId, AuthUtil.getTenantId())
 			.eq(TradingBoxItem::getIsDeleted, 0)
 			.eq(TradingBoxItem::getPid, detail.getId())
-			.eq(TradingBoxItem::getWhetherCountRent, "0")
-			.isNotNull(TradingBoxItem::getPolStationEmptyContainerExitDate)
-			.isNotNull(TradingBoxItem::getPodEmptyContainerReturnDate)
+			.lt(TradingBoxItem::getRentEndDate, tradingBox.getRentDate())
 		);
 		if (putBoxItemsList.isEmpty()) {
 			throw new RuntimeException("未查到需计算租金明细");
@@ -1953,20 +2067,20 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
 		BigDecimal exrateC = bCurrencyService.getCnyExrate(new Date(), "USD", "C", "1");
 		List<FeeCenter> feeCenterList = new ArrayList<>();
 		for (TradingBoxItem item : putBoxItemsList) {
-			item.setWhetherCountRent("1");
-			item.setUpdateTime(new Date());
-			item.setUpdateUserName(AuthUtil.getUserName());
-			item.setUpdateUser(AuthUtil.getUserId());
 			FeeCenter feeCenter = new FeeCenter();
 			feeCenter.setBillType("箱东");
-			feeCenter.setCorpId(tradingBox.getPurchaseCompanyId());
-			feeCenter.setCorpCnName(tradingBox.getPurchaseCompanyName());
-			feeCenter.setCorpEnName(tradingBox.getPurchaseCompanyName());
+			feeCenter.setCorpId(detail.getPurchaseCompanyId());
+			feeCenter.setCorpCnName(detail.getPurchaseCompanyName());
+			feeCenter.setCorpEnName(detail.getPurchaseCompanyName());
 			feeCenter.setCreateTime(new Date());
 			feeCenter.setCreateUser(AuthUtil.getUserId());
 			feeCenter.setCreateUserName(AuthUtil.getUserName());
 			feeCenter.setPid(item.getPid());
-			feeCenter.setDc("C");
+			if ("OW(拿)".equals(detail.getType())) {
+				feeCenter.setDc("C");
+			} else {
+				feeCenter.setDc("D");
+			}
 			feeCenter.setFeeId(fees.getId());
 			feeCenter.setFeeCode(fees.getCode());
 			feeCenter.setFeeCnName(fees.getCnName());
@@ -1974,15 +2088,16 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
 			feeCenter.setCurCode(fees.getCurNo());
 			feeCenter.setCntrNo(item.getCode());
 			feeCenter.setUnitNo(item.getBoxType());
-			Instant instant1 = item.getPolStationEmptyContainerExitDate().toInstant();
-			Instant instant2 = item.getPodEmptyContainerReturnDate().toInstant();
+			if (ObjectUtils.isNotNull(item.getPodEmptyContainerReturnDate())
+				&& tradingBox.getRentDate().compareTo(item.getPodEmptyContainerReturnDate()) > 0) {
+				throw new RuntimeException("箱号:" + item.getCode() + "租金计算截止时间大于pod还想日期");
+			}
+			Instant instant1 = item.getRentEndDate().toInstant();
+			Instant instant2 = tradingBox.getRentDate().toInstant();
 			LocalDate date1 = instant1.atZone(ZoneId.systemDefault()).toLocalDate();
 			LocalDate date2 = instant2.atZone(ZoneId.systemDefault()).toLocalDate();
 			Duration duration = Duration.between(date1.atStartOfDay(), date2.atStartOfDay());
-			Calendar calendar = Calendar.getInstance();
-			calendar.setTime(tradingBox.getRentEndDate());
-			calendar.add(Calendar.DAY_OF_MONTH, 1);
-			feeCenter.setStorageDate(item.getPolStationEmptyContainerExitDate());
+			feeCenter.setStorageDate(item.getRentEndDate());
 			feeCenter.setDays(Integer.parseInt(duration.toDays() + ""));
 			Integer days = feeCenter.getDays();
 			int earlySumDays = 0;
@@ -2018,20 +2133,24 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
 			feeCenter.setAmount(amount);
 			feeCenter.setRemarks(text);
 			feeCenter.setQuantity(new BigDecimal("1"));
-			feeCenter.setOutboundDate(item.getPodEmptyContainerReturnDate());
-			feeCenter.setBillNo(tradingBox.getSysNo());
-			feeCenter.setBusinessType(tradingBox.getType());
-			feeCenter.setBillDate(tradingBox.getPurchaseDate());
-			feeCenter.setBillCorpId(tradingBox.getPurchaseCompanyId());
-			feeCenter.setBillCorpCnName(tradingBox.getPurchaseCompanyName());
-			feeCenter.setBillCorpEnName(tradingBox.getPurchaseCompanyName());
-			feeCenter.setBillShortName(tradingBox.getPurchaseCompanyName());
-			feeCenter.setMblno(tradingBox.getContainerNumber());
-			feeCenter.setPolId(tradingBox.getPolId());
-			feeCenter.setPolCode(tradingBox.getPolCode());
-			feeCenter.setPolCnName(tradingBox.getPolCname());
-			feeCenter.setPolEnName(tradingBox.getPolEname());
+			feeCenter.setOutboundDate(tradingBox.getRentDate());
+			feeCenter.setBillNo(detail.getSysNo());
+			feeCenter.setBusinessType(detail.getType());
+			feeCenter.setBillDate(detail.getPurchaseDate());
+			feeCenter.setBillCorpId(detail.getPurchaseCompanyId());
+			feeCenter.setBillCorpCnName(detail.getPurchaseCompanyName());
+			feeCenter.setBillCorpEnName(detail.getPurchaseCompanyName());
+			feeCenter.setBillShortName(detail.getPurchaseCompanyName());
+			feeCenter.setMblno(detail.getContainerNumber());
+			feeCenter.setPolId(detail.getPolId());
+			feeCenter.setPolCode(detail.getPolCode());
+			feeCenter.setPolCnName(detail.getPolCname());
+			feeCenter.setPolEnName(detail.getPolEname());
 			feeCenterList.add(feeCenter);
+			item.setUpdateTime(new Date());
+			item.setUpdateUserName(AuthUtil.getUserName());
+			item.setUpdateUser(AuthUtil.getUserId());
+			item.setRentEndDate(tradingBox.getRentDate());
 		}
 		tradingBoxItemService.updateBatchById(putBoxItemsList);
 		if (!feeCenterList.isEmpty()) {
@@ -2040,4 +2159,54 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
 		return R.data(tradingBox);
 	}
 
+	@Override
+	public R revokeCountRent(TradingBox tradingBox) {
+		TradingBox detail = baseMapper.selectById(tradingBox.getId());
+		List<TradingBoxItem> tradingBoxItemList = tradingBoxItemService.list(new LambdaQueryWrapper<TradingBoxItem>()
+			.eq(TradingBoxItem::getTenantId, AuthUtil.getTenantId())
+			.eq(TradingBoxItem::getIsDeleted, 0)
+			.eq(TradingBoxItem::getPid, detail.getId())
+		);
+		if (tradingBoxItemList.isEmpty()) {
+			throw new RuntimeException("未查到明细");
+		}
+		//获取订单费用信息
+		LambdaQueryWrapper<FeeCenter> tradingBoxFeesLambdaQueryWrapper = new LambdaQueryWrapper<>();
+		tradingBoxFeesLambdaQueryWrapper.eq(FeeCenter::getIsDeleted, 0)
+			.eq(FeeCenter::getPid, tradingBox.getId())
+			.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
+			.eq(FeeCenter::getFeeCode, "BOX-ZJ")
+			.orderByDesc(FeeCenter::getCreateTime);
+		List<FeeCenter> feeCenters = feeCenterService.list(tradingBoxFeesLambdaQueryWrapper);
+		if (feeCenters.isEmpty()) {
+			throw new RuntimeException("未计算过租金,撤销失败");
+		}
+		List<TradingBoxItem> itemList = new ArrayList<>();
+		for (TradingBoxItem item : tradingBoxItemList) {
+			List<FeeCenter> feeCenterList = feeCenters.stream().filter(e -> e.getCntrNo().equals(item.getCode())).collect(Collectors.toList());
+			if (!feeCenterList.isEmpty()) {
+				FeeCenter feeCenter = feeCenterList.get(0);
+				if (1 == feeCenter.getAccStatus()) {
+					throw new RuntimeException("箱型:" + item.getBoxType() + "费用已生成账单,撤销失败");
+				}
+				feeCenterService.removeById(feeCenter.getId());
+				item.setUpdateTime(new Date());
+				item.setUpdateUser(AuthUtil.getUserId());
+				item.setUpdateUserName(AuthUtil.getUserName());
+				item.setCount(item.getCount() - 1);
+				if (feeCenterList.size() == 1) {
+					item.setRentEndDate(item.getPolStationEmptyContainerExitDate());
+				} else {
+					item.setRentEndDate(feeCenter.getStorageDate());
+				}
+				itemList.add(item);
+			}
+		}
+		if (!itemList.isEmpty()) {
+			tradingBoxItemService.updateBatchById(itemList);
+		}
+		tradingBox.setTradingBoxItemsList(tradingBoxItemList);
+		return R.data(tradingBox);
+	}
+
 }