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