From 07ea4571f273cab8f5cc994da00527de7facec5a Mon Sep 17 00:00:00 2001
From: aike <17730485278@139.com>
Date: Wed, 28 Jan 2026 09:29:43 +0800
Subject: [PATCH] =?UTF-8?q?demand:=20=20=20TMS=E7=B3=BB=E7=BB=9F=20-=20?=
=?UTF-8?q?=E6=88=90=E6=9C=AC=E7=AE=A1=E7=90=86=20-=20=E8=BF=90=E5=8D=95?=
=?UTF-8?q?=E5=88=A9=E6=B6=A6=E7=BB=9F=E8=AE=A1=20=E5=8A=9F=E8=83=BD?=
=?UTF-8?q?=E6=8C=89=E9=92=AE=E2=80=9C=E6=89=B9=E9=87=8F=E9=87=8D=E7=AE=97?=
=?UTF-8?q?=E2=80=9D=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../erp/web/emis/EmisCommonController.java | 37 +++++++++++++++++++
.../resources/mapper/EmisWaybillMapper.xml | 4 +-
2 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisCommonController.java b/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisCommonController.java
index f193080a3..ade656057 100644
--- a/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisCommonController.java
+++ b/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisCommonController.java
@@ -45,6 +45,7 @@ import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
+import org.springframework.scheduling.annotation.Async;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
@@ -53,6 +54,9 @@ import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
+import java.time.LocalDateTime;
+import java.time.YearMonth;
+import java.time.format.DateTimeFormatter;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.*;
@@ -1515,6 +1519,39 @@ public class EmisCommonController extends EmisBaseController
}
+ /**
+ * 触发按月份计算运单成本
+ * @return
+ */
+ @GetMapping(value = "/reCalcCostFeeByBillMonth")
+ @Async
+ public AjaxResult reCalcCostFeeByBillMonth(String billMonth)
+ {
+ if(StringUtils.isEmpty(billMonth)){
+ return AjaxResult.error("月份不能为空");
+ }
+
+ String lockKey="reCalcCostFeeByBillMonth";
+ log.info("reCalcCostFeeByBillMonth start");
+
+ // 加锁查询
+ redissonService.lock(lockKey,300);
+ try{
+ EmisWaybill emisWaybill = new EmisWaybill();
+ emisWaybill.getParams().put("billMonth",billMonth.replaceAll("-",""));
+ emisWaybill.getParams().put("blAllScan","1");
+ emisTmsCostFeeService.redoCalcCostFeeWaitWaybill(emisWaybill);
+ }catch(Exception ex){
+ ex.printStackTrace();
+ log.error("reCalcCostFeeByBillMonth exception:"+ex.getMessage());
+ return AjaxResult.error("计算异常:"+ex.getMessage());
+ }
+ log.info("reCalcCostFeeByBillMonth end");
+
+ redissonService.unlock(lockKey);
+ return AjaxResult.success("计算成功");
+ }
+
/**
* 导出进仓单-对接外部
*
diff --git a/emis-biz/src/main/resources/mapper/EmisWaybillMapper.xml b/emis-biz/src/main/resources/mapper/EmisWaybillMapper.xml
index 8f4dab8cd..d154230cb 100644
--- a/emis-biz/src/main/resources/mapper/EmisWaybillMapper.xml
+++ b/emis-biz/src/main/resources/mapper/EmisWaybillMapper.xml
@@ -3586,13 +3586,15 @@
a.del_flag = '0'
AND a.order_status != '0'
AND a.order_status != '2'
- AND a.bl_calc_cost = '0'
and not EXISTS (
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and ewpi.`problem_type` in(151)
)
and DATE_FORMAT(a.send_date,'%Y%m')= #{params.billMonth}
+
+ and a.bl_calc_cost= '0'
+
ORDER BY a.send_date DESC