Commit 03532262a2c336b819c487d1d6d67928324a3978
1 parent
0ed6cf11
楚江erp:1、发货计划提交、核对增加数据完整性校验;2、客户开发增加订单吨位、发货吨位数据
Showing
17 changed files
with
200 additions
and
21 deletions
| ... | ... | @@ -937,7 +937,7 @@ alter table sys_data_dic_item modify column name varchar(50) comment '名称'; |
| 937 | 937 | |
| 938 | 938 | create table if not exists customer_visit_record( |
| 939 | 939 | id varchar(32) primary key comment 'ID', |
| 940 | - customer_id varchar(32) not null comment '客户ID', | |
| 940 | + customer_id varchar(32) not null comment '客户开发ID', | |
| 941 | 941 | user_id varchar(32) not null comment '拜访人员ID', |
| 942 | 942 | visit_time date not null comment '拜访时间', |
| 943 | 943 | visit_content varchar(500) comment '拜访内容', | ... | ... |
| ... | ... | @@ -16,11 +16,11 @@ public class CreateCustomerVisitRecordVo implements BaseVo, Serializable { |
| 16 | 16 | private static final long serialVersionUID = 1L; |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | - * 客户ID | |
| 19 | + * 客户开发ID | |
| 20 | 20 | */ |
| 21 | - @ApiModelProperty(value = "客户ID", required = true) | |
| 22 | - @NotBlank(message = "请输入客户ID!") | |
| 23 | - @Length(message = "客户ID最多允许32个字符!") | |
| 21 | + @ApiModelProperty(value = "客户开发ID", required = true) | |
| 22 | + @NotBlank(message = "请输入客户开发ID!") | |
| 23 | + @Length(message = "客户开发ID最多允许32个字符!") | |
| 24 | 24 | private String customerId; |
| 25 | 25 | |
| 26 | 26 | /** | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/customer/develop/GetCustomerDevelopPlanBo.java
| ... | ... | @@ -156,6 +156,18 @@ public class GetCustomerDevelopPlanBo extends BaseBo<CustomerDevelopPlan> implem |
| 156 | 156 | private List<CustomerVisitRecord> visitRecords; |
| 157 | 157 | |
| 158 | 158 | /** |
| 159 | + * 订单吨位 | |
| 160 | + */ | |
| 161 | + @ApiModelProperty("订单吨位") | |
| 162 | + private Double orderQuantity; | |
| 163 | + | |
| 164 | + /** | |
| 165 | + * 发货吨位 | |
| 166 | + */ | |
| 167 | + @ApiModelProperty("发货吨位") | |
| 168 | + private Double shipmentQuantity; | |
| 169 | + | |
| 170 | + /** | |
| 159 | 171 | * 创建人 |
| 160 | 172 | */ |
| 161 | 173 | @ApiModelProperty("创建人") | ... | ... |
| ... | ... | @@ -17,8 +17,11 @@ import com.lframework.xingyun.basedata.service.product.ProductVarietyService; |
| 17 | 17 | import com.lframework.xingyun.basedata.service.workshop.WorkshopService; |
| 18 | 18 | import com.lframework.xingyun.sc.bo.customer.develop.CustomerDevelopPlanStatisticsBo; |
| 19 | 19 | import com.lframework.xingyun.sc.bo.customer.develop.GetCustomerDevelopPlanBo; |
| 20 | +import com.lframework.xingyun.sc.entity.PurchaseOrderInfo; | |
| 20 | 21 | import com.lframework.xingyun.sc.enums.ExportType; |
| 21 | 22 | import com.lframework.xingyun.sc.excel.customer.CustomerDevelopExportTaskWorker; |
| 23 | +import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService; | |
| 24 | +import com.lframework.xingyun.sc.service.shipments.ShipmentsOrderInfoService; | |
| 22 | 25 | import com.lframework.xingyun.sc.vo.customer.develop.QueryCustomerDevelopPlanVo; |
| 23 | 26 | import com.lframework.xingyun.sc.service.customer.CustomerDevelopPlanService; |
| 24 | 27 | import com.lframework.xingyun.sc.vo.customer.develop.CreateCustomerDevelopPlanVo; |
| ... | ... | @@ -44,10 +47,8 @@ import org.springframework.validation.annotation.Validated; |
| 44 | 47 | import org.springframework.web.bind.annotation.*; |
| 45 | 48 | |
| 46 | 49 | import javax.validation.Valid; |
| 47 | -import java.util.ArrayList; | |
| 48 | -import java.util.HashMap; | |
| 49 | -import java.util.List; | |
| 50 | -import java.util.Map; | |
| 50 | +import java.math.BigDecimal; | |
| 51 | +import java.util.*; | |
| 51 | 52 | import java.util.function.Function; |
| 52 | 53 | import java.util.stream.Collectors; |
| 53 | 54 | |
| ... | ... | @@ -77,6 +78,10 @@ public class CustomerDevelopPlanController extends DefaultBaseController { |
| 77 | 78 | private ProductVarietyService productVarietyService; |
| 78 | 79 | @Resource |
| 79 | 80 | private SysUserService sysUserService; |
| 81 | + @Resource | |
| 82 | + private PurchaseOrderInfoService purchaseOrderInfoService; | |
| 83 | + @Resource | |
| 84 | + private ShipmentsOrderInfoService shipmentsOrderInfoService; | |
| 80 | 85 | |
| 81 | 86 | |
| 82 | 87 | /** |
| ... | ... | @@ -271,11 +276,25 @@ public class CustomerDevelopPlanController extends DefaultBaseController { |
| 271 | 276 | if (CollectionUtils.isNotEmpty(userList)) { |
| 272 | 277 | userMap = userList.stream().collect(Collectors.toMap(SysUser::getId, Function.identity())); |
| 273 | 278 | } |
| 279 | + // 获取订货单数据 | |
| 280 | + List<PurchaseOrderInfo> orderInfoList = purchaseOrderInfoService.listByCustomerIds(customerIds); | |
| 281 | + Map<String, List<PurchaseOrderInfo>> orderInfoMap = new HashMap<>(); | |
| 282 | + if (CollectionUtils.isNotEmpty(orderInfoList)) { | |
| 283 | + for (PurchaseOrderInfo orderInfo : orderInfoList) { | |
| 284 | + String orderingUnit = orderInfo.getOrderingUnit(); | |
| 285 | + List<PurchaseOrderInfo> list = orderInfoMap.computeIfAbsent(orderingUnit, k -> new ArrayList<>()); | |
| 286 | + list.add(orderInfo); | |
| 287 | + } | |
| 288 | + } | |
| 289 | + // 获取发货单实际发货量 | |
| 290 | + Map<String, Double> actualNumMap = shipmentsOrderInfoService.statisticsActualNum(customerIds); | |
| 291 | + | |
| 274 | 292 | List<GetCustomerDevelopPlanBo> result = new ArrayList<>(); |
| 275 | 293 | for (CustomerDevelopPlan plan : dataList) { |
| 276 | 294 | GetCustomerDevelopPlanBo data = new GetCustomerDevelopPlanBo(plan); |
| 277 | 295 | // 客户信息 |
| 278 | - Customer customer = customerMap.get(plan.getCustomerId()); | |
| 296 | + String customerId = plan.getCustomerId(); | |
| 297 | + Customer customer = customerMap.get(customerId); | |
| 279 | 298 | data.setCustomer(customer); |
| 280 | 299 | // 厂房信息 |
| 281 | 300 | Workshop workshop = workshopMap.get(plan.getWorkshopId()); |
| ... | ... | @@ -292,6 +311,12 @@ public class CustomerDevelopPlanController extends DefaultBaseController { |
| 292 | 311 | // 责任人 |
| 293 | 312 | SysUser user = userMap.get(plan.getChargeUserId()); |
| 294 | 313 | data.setChargeUserName(user == null ? null : user.getName()); |
| 314 | + // 订货吨位 | |
| 315 | + Double orderQuantity = calculateTotal(orderInfoMap.get(customerId)); | |
| 316 | + data.setOrderQuantity(orderQuantity); | |
| 317 | + // 实发数 | |
| 318 | + Double shipmentQuantity = actualNumMap.get(customerId); | |
| 319 | + data.setShipmentQuantity(shipmentQuantity); | |
| 295 | 320 | |
| 296 | 321 | result.add(data); |
| 297 | 322 | } |
| ... | ... | @@ -329,7 +354,35 @@ public class CustomerDevelopPlanController extends DefaultBaseController { |
| 329 | 354 | // 获取责任人数据 |
| 330 | 355 | SysUser user = sysUserService.findById(chargeUserId); |
| 331 | 356 | data.setChargeUserName(user.getName()); |
| 357 | + // 订货吨位 | |
| 358 | + List<PurchaseOrderInfo> orderInfoList = purchaseOrderInfoService.listByCustomerIds(Collections.singletonList(customerId)); | |
| 359 | + Double orderQuantity = calculateTotal(orderInfoList); | |
| 360 | + data.setOrderQuantity(orderQuantity); | |
| 361 | + // 发货吨位 | |
| 362 | + Map<String, Double> actualNum = shipmentsOrderInfoService.statisticsActualNum(Collections.singletonList(customerId)); | |
| 363 | + data.setShipmentQuantity(actualNum.get(customerId)); | |
| 332 | 364 | |
| 333 | 365 | return data; |
| 334 | 366 | } |
| 367 | + | |
| 368 | + | |
| 369 | + /** | |
| 370 | + * 计算订货吨位 | |
| 371 | + * | |
| 372 | + * @param orderInfoList 订货单集合 | |
| 373 | + * @return Double | |
| 374 | + */ | |
| 375 | + private Double calculateTotal(List<PurchaseOrderInfo> orderInfoList) { | |
| 376 | + if (CollectionUtils.isEmpty(orderInfoList)) { | |
| 377 | + return 0d; | |
| 378 | + } | |
| 379 | + BigDecimal total = BigDecimal.ZERO; | |
| 380 | + for (PurchaseOrderInfo orderInfo : orderInfoList) { | |
| 381 | + BigDecimal totalQuantity = orderInfo.getTotalQuantity(); | |
| 382 | + if (totalQuantity != null) { | |
| 383 | + total = total.add(totalQuantity); | |
| 384 | + } | |
| 385 | + } | |
| 386 | + return total.doubleValue(); | |
| 387 | + } | |
| 335 | 388 | } | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/shipments/ShipmentsPlanController.java
| ... | ... | @@ -85,6 +85,8 @@ public class ShipmentsPlanController extends DefaultBaseController { |
| 85 | 85 | @HasPermission({"shipping-plan-manage:shipping-plan:modify", "shipping-plan-manage:shipping-plan:check"}) |
| 86 | 86 | @PutMapping |
| 87 | 87 | public InvokeResult<Void> update(@Valid UpdateShipmentsPlanVo vo) { |
| 88 | + // 校验数据完整性 | |
| 89 | + shipmentsPlanDetailService.checkDataIntegrity(vo.getId(), vo.getStatus()); | |
| 88 | 90 | shipmentsPlanService.update(vo); |
| 89 | 91 | return InvokeResultBuilder.success(); |
| 90 | 92 | } | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/customer/CustomerDevelopPlanServiceImpl.java
| ... | ... | @@ -146,7 +146,9 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe |
| 146 | 146 | @Override |
| 147 | 147 | public CustomerDevelopPlan findById(String id) { |
| 148 | 148 | CustomerDevelopPlan plan = getBaseMapper().selectById(id); |
| 149 | - | |
| 149 | + if (plan == null) { | |
| 150 | + throw new DefaultClientException("客户开发计划不存在!"); | |
| 151 | + } | |
| 150 | 152 | QueryCustomerVisitRecordVo recordVo = new QueryCustomerVisitRecordVo(); |
| 151 | 153 | recordVo.setCustomerId(id); |
| 152 | 154 | List<CustomerVisitRecord> visitRecordList = customerVisitRecordService.query(recordVo); | ... | ... |
| 1 | 1 | package com.lframework.xingyun.sc.impl.order; |
| 2 | 2 | |
| 3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
| 3 | 4 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| 4 | 5 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| 5 | 6 | import com.github.pagehelper.PageInfo; |
| ... | ... | @@ -555,6 +556,17 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde |
| 555 | 556 | } |
| 556 | 557 | |
| 557 | 558 | @Override |
| 559 | + public List<PurchaseOrderInfo> listByCustomerIds(List<String> customerIds) { | |
| 560 | + if (CollectionUtils.isEmpty(customerIds)) { | |
| 561 | + return Collections.emptyList(); | |
| 562 | + } | |
| 563 | + LambdaQueryWrapper<PurchaseOrderInfo> queryWrapper = Wrappers.lambdaQuery(PurchaseOrderInfo.class); | |
| 564 | + queryWrapper.in(PurchaseOrderInfo::getOrderingUnit, customerIds); | |
| 565 | + | |
| 566 | + return getBaseMapper().selectList(queryWrapper); | |
| 567 | + } | |
| 568 | + | |
| 569 | + @Override | |
| 558 | 570 | public void cleanCacheByKey(Serializable key) { |
| 559 | 571 | |
| 560 | 572 | } | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/shipments/ShipmentsOrderInfoServiceImpl.java
| ... | ... | @@ -256,7 +256,7 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr |
| 256 | 256 | String type = vo.getType(); |
| 257 | 257 | if ("AUTO".equals(type)) { |
| 258 | 258 | // 根据客户批量生成 |
| 259 | - List<ShipmentsPlanDetail> detailList = shipmentsPlanDetailService.listByPlanId(planId); | |
| 259 | + List<ShipmentsPlanDetail> detailList = shipmentsPlanDetailService.listByPlanId(planId, false); | |
| 260 | 260 | if (CollectionUtils.isEmpty(detailList)) { |
| 261 | 261 | throw new DefaultClientException("发货明细数据不存在!"); |
| 262 | 262 | } |
| ... | ... | @@ -420,6 +420,25 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr |
| 420 | 420 | return getBaseMapper().queryByIds(ids); |
| 421 | 421 | } |
| 422 | 422 | |
| 423 | + @Override | |
| 424 | + public Map<String, Double> statisticsActualNum(List<String> customerIds) { | |
| 425 | + if (CollectionUtils.isEmpty(customerIds)) { | |
| 426 | + return Collections.emptyMap(); | |
| 427 | + } | |
| 428 | + List<Map<String, Object>> mapList = getBaseMapper().statisticsActualNum(customerIds); | |
| 429 | + if (CollectionUtils.isEmpty(mapList)) { | |
| 430 | + return Collections.emptyMap(); | |
| 431 | + } | |
| 432 | + Map<String, Double> result = new HashMap<>(); | |
| 433 | + for (Map<String, Object> map : mapList) { | |
| 434 | + String key = (String) map.get("customer_id"); | |
| 435 | + Double value = (Double) map.get("actual_num"); | |
| 436 | + | |
| 437 | + result.put(key, value); | |
| 438 | + } | |
| 439 | + return result; | |
| 440 | + } | |
| 441 | + | |
| 423 | 442 | |
| 424 | 443 | /** |
| 425 | 444 | * 处理批次数据 | ... | ... |
| ... | ... | @@ -32,6 +32,7 @@ import org.springframework.transaction.annotation.Transactional; |
| 32 | 32 | import javax.annotation.Resource; |
| 33 | 33 | import java.math.BigDecimal; |
| 34 | 34 | import java.time.LocalDate; |
| 35 | +import java.time.LocalTime; | |
| 35 | 36 | import java.util.*; |
| 36 | 37 | import java.util.function.Function; |
| 37 | 38 | import java.util.stream.Collectors; |
| ... | ... | @@ -365,11 +366,11 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
| 365 | 366 | } |
| 366 | 367 | |
| 367 | 368 | @Override |
| 368 | - public List<ShipmentsPlanDetail> listByPlanId(String planId) { | |
| 369 | + public List<ShipmentsPlanDetail> listByPlanId(String planId, boolean includePreShipment) { | |
| 369 | 370 | if (StringUtils.isBlank(planId)) { |
| 370 | 371 | return Collections.emptyList(); |
| 371 | 372 | } |
| 372 | - return getBaseMapper().listByPlanId(planId); | |
| 373 | + return getBaseMapper().listByPlanId(planId, includePreShipment); | |
| 373 | 374 | } |
| 374 | 375 | |
| 375 | 376 | @Override |
| ... | ... | @@ -407,6 +408,35 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
| 407 | 408 | return getBaseMapper().selectList(queryWrapper); |
| 408 | 409 | } |
| 409 | 410 | |
| 411 | + @Override | |
| 412 | + public void checkDataIntegrity(String planId, String status) { | |
| 413 | + // 获取明细数据 | |
| 414 | + List<ShipmentsPlanDetail> detailList = listByPlanId(planId, true); | |
| 415 | + if (CollectionUtils.isEmpty(detailList)) { | |
| 416 | + return; | |
| 417 | + } | |
| 418 | + // 校验数据完整性 | |
| 419 | + for (ShipmentsPlanDetail detail : detailList) { | |
| 420 | + LocalTime shipmentsTime = detail.getShipmentsTime(); | |
| 421 | + Boolean canShipments = detail.getCanShipments(); | |
| 422 | + Boolean preShipments = detail.getPreShipments(); | |
| 423 | + if ("CHECKING".equals(status)) { | |
| 424 | + // 提交计划 | |
| 425 | + if (!preShipments && shipmentsTime == null) { | |
| 426 | + throw new DefaultClientException("发货时点不能为空!"); | |
| 427 | + } | |
| 428 | + if (preShipments && canShipments == null) { | |
| 429 | + throw new DefaultClientException("是否可发货不能为空!"); | |
| 430 | + } | |
| 431 | + } else if ("IN_PROGRESS".equals(status)) { | |
| 432 | + // 核对计划 | |
| 433 | + if (!preShipments && canShipments == null) { | |
| 434 | + throw new DefaultClientException("是否可发货不能为空!"); | |
| 435 | + } | |
| 436 | + } | |
| 437 | + } | |
| 438 | + } | |
| 439 | + | |
| 410 | 440 | |
| 411 | 441 | /** |
| 412 | 442 | * 封装发货计划明细数据 | ... | ... |
| ... | ... | @@ -114,9 +114,6 @@ public class ShipmentsPlanServiceImpl extends BaseMpServiceImpl<ShipmentsPlanMap |
| 114 | 114 | .eq(ShipmentsPlan::getId, vo.getId()); |
| 115 | 115 | |
| 116 | 116 | getBaseMapper().update(updateWrapper); |
| 117 | - if ("CHECK".equals(vo.getStatus())) { | |
| 118 | - // 更新订货单规格发货状态 | |
| 119 | - } | |
| 120 | 117 | |
| 121 | 118 | OpLogUtil.setVariable("id", data.getId()); |
| 122 | 119 | OpLogUtil.setExtra(vo); | ... | ... |
| ... | ... | @@ -6,6 +6,7 @@ import com.lframework.xingyun.sc.vo.shipments.order.QueryShipmentsOrderInfoVo; |
| 6 | 6 | import org.apache.ibatis.annotations.Param; |
| 7 | 7 | |
| 8 | 8 | import java.util.List; |
| 9 | +import java.util.Map; | |
| 9 | 10 | |
| 10 | 11 | /** |
| 11 | 12 | * <p> |
| ... | ... | @@ -38,4 +39,12 @@ public interface ShipmentsOrderInfoMapper extends BaseMapper<ShipmentsOrderInfo> |
| 38 | 39 | * @return List<ShipmentsOrderInfo> |
| 39 | 40 | */ |
| 40 | 41 | List<ShipmentsOrderInfo> queryByIds(@Param("ids") List<String> ids); |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 根据客户分组统计实发数 | |
| 45 | + * | |
| 46 | + * @param customerIds 客户ID集合 | |
| 47 | + * @return List<Map<String, Double>> | |
| 48 | + */ | |
| 49 | + List<Map<String, Object>> statisticsActualNum(@Param("customerIds") List<String> customerIds); | |
| 41 | 50 | } | ... | ... |
| ... | ... | @@ -51,10 +51,11 @@ public interface ShipmentsPlanDetailMapper extends BaseMapper<ShipmentsPlanDetai |
| 51 | 51 | /** |
| 52 | 52 | * 根据计划ID查询 |
| 53 | 53 | * |
| 54 | - * @param planId 计划ID | |
| 54 | + * @param planId 计划ID | |
| 55 | + * @param includePreShipment 是否包含预发数据 | |
| 55 | 56 | * @return List<ShipmentsPlanDetail> |
| 56 | 57 | */ |
| 57 | - List<ShipmentsPlanDetail> listByPlanId(@Param("planId") String planId); | |
| 58 | + List<ShipmentsPlanDetail> listByPlanId(@Param("planId") String planId, @Param("includePreShipment") boolean includePreShipment); | |
| 58 | 59 | |
| 59 | 60 | /** |
| 60 | 61 | * 查询 | ... | ... |
| ... | ... | @@ -124,4 +124,12 @@ public interface PurchaseOrderInfoService extends BaseMpService<PurchaseOrderInf |
| 124 | 124 | * @return List<PurchaseOrderInfo> |
| 125 | 125 | */ |
| 126 | 126 | List<PurchaseOrderInfo> queryByIds(List<String> ids); |
| 127 | + | |
| 128 | + /** | |
| 129 | + * 批量获取客户所有订货单数据 | |
| 130 | + * | |
| 131 | + * @param customerIds 客户ID集合 | |
| 132 | + * @return List<PurchaseOrderInfo> | |
| 133 | + */ | |
| 134 | + List<PurchaseOrderInfo> listByCustomerIds(List<String> customerIds); | |
| 127 | 135 | } | ... | ... |
| ... | ... | @@ -5,6 +5,7 @@ import com.lframework.xingyun.sc.entity.ShipmentsOrderInfo; |
| 5 | 5 | import com.lframework.starter.web.core.service.BaseMpService; |
| 6 | 6 | import com.lframework.starter.web.core.components.resp.PageResult; |
| 7 | 7 | import java.util.List; |
| 8 | +import java.util.Map; | |
| 8 | 9 | |
| 9 | 10 | /** |
| 10 | 11 | * 发货单 Service |
| ... | ... | @@ -99,4 +100,12 @@ public interface ShipmentsOrderInfoService extends BaseMpService<ShipmentsOrderI |
| 99 | 100 | * @return List<ShipmentsOrderInfo> |
| 100 | 101 | */ |
| 101 | 102 | List<ShipmentsOrderInfo> queryByIds(List<String> ids); |
| 103 | + | |
| 104 | + /** | |
| 105 | + * 根据客户分组统计实发数 | |
| 106 | + * | |
| 107 | + * @param customerIds 客户ID集合 | |
| 108 | + * @return List<ShipmentsPlanDetail> | |
| 109 | + */ | |
| 110 | + Map<String, Double> statisticsActualNum(List<String> customerIds); | |
| 102 | 111 | } | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/shipments/ShipmentsPlanDetailService.java
| ... | ... | @@ -113,7 +113,7 @@ public interface ShipmentsPlanDetailService extends BaseMpService<ShipmentsPlanD |
| 113 | 113 | * @param planId 计划ID |
| 114 | 114 | * @return List<ShipmentsPlanDetail> |
| 115 | 115 | */ |
| 116 | - List<ShipmentsPlanDetail> listByPlanId(String planId); | |
| 116 | + List<ShipmentsPlanDetail> listByPlanId(String planId, boolean includePreShipment); | |
| 117 | 117 | |
| 118 | 118 | |
| 119 | 119 | /** |
| ... | ... | @@ -130,4 +130,13 @@ public interface ShipmentsPlanDetailService extends BaseMpService<ShipmentsPlanD |
| 130 | 130 | * @return List<ShipmentsPlanDetail> |
| 131 | 131 | */ |
| 132 | 132 | List<ShipmentsPlanDetail> listBySpecIds(List<String> specIds); |
| 133 | + | |
| 134 | + /** | |
| 135 | + * 校验数据完整性 | |
| 136 | + * 仅针对发货时点、是否可发货 | |
| 137 | + * | |
| 138 | + * @param planId 计划ID | |
| 139 | + * @param status 状态 | |
| 140 | + */ | |
| 141 | + void checkDataIntegrity(String planId, String status); | |
| 133 | 142 | } | ... | ... |
| ... | ... | @@ -113,4 +113,15 @@ |
| 113 | 113 | #{item} |
| 114 | 114 | </foreach> |
| 115 | 115 | </select> |
| 116 | + | |
| 117 | + <select id="statisticsActualNum" resultType="java.util.Map"> | |
| 118 | + select o.customer_id,sum(d.actual_shipment_quantity) as actual_num | |
| 119 | + from shipments_order_info o | |
| 120 | + inner join shipments_plan_detail d on o.id = d.shipment_order_id | |
| 121 | + where o.customer_id in | |
| 122 | + <foreach collection="customerIds" open="(" separator="," close=")" item="item"> | |
| 123 | + #{item} | |
| 124 | + </foreach> | |
| 125 | + group by o.customer_id | |
| 126 | + </select> | |
| 116 | 127 | </mapper> | ... | ... |
| ... | ... | @@ -275,7 +275,12 @@ |
| 275 | 275 | ol.quantity, |
| 276 | 276 | c.id as customer_id |
| 277 | 277 | from shipments_plan_detail pd |
| 278 | - inner join shipments_plan p on pd.plan_id = p.id and pd.shipments_date = p.tomo_pre_ship_date | |
| 278 | + <if test="includePreShipment == true"> | |
| 279 | + inner join shipments_plan p on pd.plan_id = p.id | |
| 280 | + </if> | |
| 281 | + <if test="includePreShipment == false"> | |
| 282 | + inner join shipments_plan p on pd.plan_id = p.id and pd.shipments_date = p.tomo_pre_ship_date | |
| 283 | + </if> | |
| 279 | 284 | left join tbl_purchase_order_line ol on pd.order_spec_id = ol.id |
| 280 | 285 | left join purchase_order_info o on pd.order_id = o.id |
| 281 | 286 | left join base_data_customer c on o.ordering_unit = c.id | ... | ... |