Commit 9fab75fda339d11fa0294fa221d0fde237e8102a

Authored by yeqianyong
1 parent 93ab32bd

楚江erp:要车单计划吨位计算逻辑调整

@@ -29,6 +29,7 @@ import org.apache.commons.lang3.BooleanUtils; @@ -29,6 +29,7 @@ import org.apache.commons.lang3.BooleanUtils;
29 import org.springframework.transaction.annotation.Transactional; 29 import org.springframework.transaction.annotation.Transactional;
30 import org.springframework.stereotype.Service; 30 import org.springframework.stereotype.Service;
31 import javax.annotation.Resource; 31 import javax.annotation.Resource;
  32 +import java.math.BigDecimal;
32 import java.time.LocalDate; 33 import java.time.LocalDate;
33 import java.time.LocalTime; 34 import java.time.LocalTime;
34 import java.time.format.DateTimeFormatter; 35 import java.time.format.DateTimeFormatter;
@@ -181,11 +182,10 @@ public class CarRequestPlanServiceImpl extends BaseMpServiceImpl<CarRequestPlanM @@ -181,11 +182,10 @@ public class CarRequestPlanServiceImpl extends BaseMpServiceImpl<CarRequestPlanM
181 ticketVo.setWorkshopId(orderInfo.getWorkshopId()); 182 ticketVo.setWorkshopId(orderInfo.getWorkshopId());
182 ticketVo.setOrderNo(orderInfo.getOrderNo()); 183 ticketVo.setOrderNo(orderInfo.getOrderNo());
183 ticketVo.setOrderingUnit(orderInfo.getOrderingUnit()); 184 ticketVo.setOrderingUnit(orderInfo.getOrderingUnit());
184 - ticketVo.setQuantity(orderInfo.getTotalQuantity());  
185 ticketVo.setShipmentsOrderId(shipmentsOrderInfo.getId()); 185 ticketVo.setShipmentsOrderId(shipmentsOrderInfo.getId());
186 - //外办审核人(草稿要车单审核人) 186 + // 外办审核人(草稿要车单审核人)
187 ticketVo.setExternalAuditor(draftTicket.getExternalAuditor()); 187 ticketVo.setExternalAuditor(draftTicket.getExternalAuditor());
188 - //经营办审核人(发货计划提交人) 188 + // 经营办审核人(发货计划提交人)
189 ticketVo.setBusinessOfficeAuditor(SecurityUtil.getCurrentUser().getId()); 189 ticketVo.setBusinessOfficeAuditor(SecurityUtil.getCurrentUser().getId());
190 ticketVo.setDestination(draftTicket.getDestination()); 190 ticketVo.setDestination(draftTicket.getDestination());
191 ticketVo.setConsignee(draftTicket.getConsignee()); 191 ticketVo.setConsignee(draftTicket.getConsignee());
@@ -197,6 +197,16 @@ public class CarRequestPlanServiceImpl extends BaseMpServiceImpl<CarRequestPlanM @@ -197,6 +197,16 @@ public class CarRequestPlanServiceImpl extends BaseMpServiceImpl<CarRequestPlanM
197 if (CollectionUtil.isEmpty(detailList)) { 197 if (CollectionUtil.isEmpty(detailList)) {
198 continue; 198 continue;
199 } 199 }
  200 + // 计划吨位
  201 + BigDecimal totalQuantity = BigDecimal.ZERO;
  202 + for (ShipmentsPlanDetail detail : detailList) {
  203 + BigDecimal quantity = detail.getQuantity();
  204 + if (quantity == null || !orderInfo.getId().equals(detail.getOrderId())) {
  205 + continue;
  206 + }
  207 + totalQuantity = totalQuantity.add(quantity);
  208 + }
  209 + ticketVo.setQuantity(totalQuantity);
200 // 装货时间处理 210 // 装货时间处理
201 LocalTime minTime = shipmentsOrderInfo.getDetailList().stream() 211 LocalTime minTime = shipmentsOrderInfo.getDetailList().stream()
202 .map(ShipmentsPlanDetail::getShipmentsTime) 212 .map(ShipmentsPlanDetail::getShipmentsTime)