|
|
@@ -41,9 +41,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* @author lfdc
|
|
|
@@ -495,7 +493,7 @@ public class LogisticsConsignmentService {
|
|
|
/**
|
|
|
* 销售订单-采购订单-获取托运订单数据
|
|
|
*
|
|
|
- * @param id
|
|
|
+ * @param id 销售订单id
|
|
|
* @param page
|
|
|
* @param pageSize
|
|
|
* @return
|
|
|
@@ -512,12 +510,30 @@ public class LogisticsConsignmentService {
|
|
|
} else {
|
|
|
throw new RuntimeException("获取贸易订单下单方式异常!");
|
|
|
}
|
|
|
+ BigDecimal resAmount = orderDetailRes.getAmount();
|
|
|
if (flag) {
|
|
|
+ /**数据展示*/
|
|
|
+ //总数
|
|
|
Long count = getLogisticsOrderCount(id);
|
|
|
Integer newPage = page - 1;
|
|
|
List<LogisticsOrderDTO> list = getLogisticsOrderData(id, newPage, pageSize);
|
|
|
PageResult build = PageResult.build(page, pageSize, count, list);
|
|
|
- httpResult.setData(build);
|
|
|
+ /**数据统计*/
|
|
|
+ //计划量
|
|
|
+ BigDecimal amount = new BigDecimal(NumberConstant.ZERO);
|
|
|
+ for (LogisticsOrderDTO logisticsOrderDTO : list) {
|
|
|
+ amount = amount.add(logisticsOrderDTO.getAmount() == null ? new BigDecimal(NumberConstant.ZERO) : logisticsOrderDTO.getAmount());
|
|
|
+ }
|
|
|
+ //剩余调度量
|
|
|
+ BigDecimal residue = resAmount.subtract(amount);
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("count", count);
|
|
|
+ jsonObject.put("residue", residue);
|
|
|
+ jsonObject.put("amount", amount);
|
|
|
+ Map<String, Object> map = new HashMap<>(NumberConstant.SIXTEEN);
|
|
|
+ map.put("dataList", build);
|
|
|
+ map.put("TableBottom", jsonObject);
|
|
|
+ httpResult.setData(map);
|
|
|
}
|
|
|
return httpResult;
|
|
|
}
|
|
|
@@ -615,7 +631,7 @@ public class LogisticsConsignmentService {
|
|
|
log.info("物流订单单据id:{}", s);
|
|
|
jsonObject.put("message", "单据状态异常或单据不存在");
|
|
|
jsonObject.put("status", HttpStatus.GLOBAL_EXCEPTION_CODE);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
OrderDetailRes orderDetailRes = tradeOrderInfoService.getOrderDetailById(Long.parseLong(s));
|
|
|
UpdateOrderAmountParam param = new UpdateOrderAmountParam();
|
|
|
param.setTOrderId(Long.parseLong(s));
|
|
|
@@ -657,7 +673,7 @@ public class LogisticsConsignmentService {
|
|
|
log.info("物流订单单据id:{}", s);
|
|
|
jsonObject.put("message", "单据状态异常或单据不存在");
|
|
|
jsonObject.put("status", HttpStatus.GLOBAL_EXCEPTION_CODE);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
OrderDetailRes orderDetailRes = tradeOrderInfoService.getOrderDetailById(Long.parseLong(s));
|
|
|
UpdateOrderAmountParam param = new UpdateOrderAmountParam();
|
|
|
param.setTOrderId(Long.parseLong(s));
|