Showing
10 changed files
with
36 additions
and
65 deletions
| 1 | 1 | package com.lframework.xingyun.sc.controller.shipments; |
| 2 | 2 | |
| 3 | 3 | import com.lframework.xingyun.sc.bo.shipments.plan.ShipmentsPlanDetailBo; |
| 4 | -import com.lframework.xingyun.sc.entity.ShipmentsPlan; | |
| 5 | 4 | import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanService; |
| 6 | 5 | import com.lframework.xingyun.sc.vo.shipments.plan.QueryShipmentsPlanDetailVo; |
| 7 | 6 | import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanDetailService; | ... | ... |
| ... | ... | @@ -75,18 +75,4 @@ public class ShipmentsPlan extends BaseEntity implements BaseDto { |
| 75 | 75 | */ |
| 76 | 76 | @TableField(fill = FieldFill.INSERT_UPDATE) |
| 77 | 77 | private LocalDateTime updateTime; |
| 78 | - | |
| 79 | - /** | |
| 80 | - * 明天发货计划明细 | |
| 81 | - * 非持久化字段 | |
| 82 | - */ | |
| 83 | - @TableField(exist = false) | |
| 84 | - List<ShipmentsPlanDetail> tomoPlanList; | |
| 85 | - | |
| 86 | - /** | |
| 87 | - * 后天发货计划明细 | |
| 88 | - * 非持久化字段 | |
| 89 | - */ | |
| 90 | - @TableField(exist = false) | |
| 91 | - List<ShipmentsPlanDetail> afTomoPlanList; | |
| 92 | 78 | } | ... | ... |
| ... | ... | @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| 4 | 4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| 5 | 5 | import com.github.pagehelper.PageInfo; |
| 6 | 6 | import com.lframework.starter.web.core.components.security.SecurityUtil; |
| 7 | +import com.lframework.xingyun.sc.entity.PurchaseOrderLine; | |
| 7 | 8 | import com.lframework.xingyun.sc.entity.ShipmentsPlanDetail; |
| 8 | 9 | import com.lframework.starter.web.core.impl.BaseMpServiceImpl; |
| 9 | 10 | import com.lframework.starter.web.core.utils.PageResultUtil; |
| ... | ... | @@ -17,7 +18,7 @@ import com.lframework.starter.web.core.utils.PageHelperUtil; |
| 17 | 18 | import com.lframework.starter.common.utils.Assert; |
| 18 | 19 | import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; |
| 19 | 20 | import com.lframework.xingyun.sc.mappers.ShipmentsPlanDetailMapper; |
| 20 | -import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService; | |
| 21 | +import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService; | |
| 21 | 22 | import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanDetailService; |
| 22 | 23 | import com.lframework.xingyun.sc.vo.shipments.plan.CreateShipmentsPlanDetailVo; |
| 23 | 24 | import com.lframework.xingyun.sc.vo.shipments.plan.QueryShipmentsPlanDetailVo; |
| ... | ... | @@ -29,13 +30,15 @@ import org.springframework.transaction.annotation.Transactional; |
| 29 | 30 | import javax.annotation.Resource; |
| 30 | 31 | import java.util.ArrayList; |
| 31 | 32 | import java.util.List; |
| 33 | +import java.util.Map; | |
| 34 | +import java.util.stream.Collectors; | |
| 32 | 35 | |
| 33 | 36 | @Service |
| 34 | 37 | public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsPlanDetailMapper, ShipmentsPlanDetail> implements ShipmentsPlanDetailService { |
| 35 | 38 | |
| 36 | 39 | |
| 37 | 40 | @Resource |
| 38 | - private PurchaseOrderInfoService purchaseOrderInfoService; | |
| 41 | + private PurchaseOrderLineService purchaseOrderLineService; | |
| 39 | 42 | |
| 40 | 43 | @Override |
| 41 | 44 | public PageResult<ShipmentsPlanDetail> query(Integer pageIndex, Integer pageSize, QueryShipmentsPlanDetailVo vo) { |
| ... | ... | @@ -65,21 +68,28 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
| 65 | 68 | @Transactional(rollbackFor = Exception.class) |
| 66 | 69 | @Override |
| 67 | 70 | public void create(CreateShipmentsPlanDetailVo vo) { |
| 68 | - List<String> orderIds = vo.getOrderIds(); | |
| 69 | - if (CollectionUtils.isEmpty(orderIds)) { | |
| 70 | - throw new DefaultClientException("订货单ID不能为空!"); | |
| 71 | + List<String> orderSpecIds = vo.getOrderSpecIds(); | |
| 72 | + if (CollectionUtils.isEmpty(orderSpecIds)) { | |
| 73 | + throw new DefaultClientException("订货单规格ID不能为空!"); | |
| 71 | 74 | } |
| 75 | + List<PurchaseOrderLine> orderLineList = purchaseOrderLineService.listByIds(orderSpecIds); | |
| 76 | + if (CollectionUtils.isEmpty(orderLineList)) { | |
| 77 | + throw new DefaultClientException("订货单规格数据不能为空!"); | |
| 78 | + } | |
| 79 | + Map<String, String> orderIdMap = orderLineList.stream().collect(Collectors.toMap(PurchaseOrderLine::getId, PurchaseOrderLine::getPurchaseOrderId)); | |
| 72 | 80 | // 当前人员id |
| 73 | 81 | String userId = SecurityUtil.getCurrentUser().getId(); |
| 74 | 82 | List<ShipmentsPlanDetail> detailList = new ArrayList<>(); |
| 75 | - for (String orderId : orderIds) { | |
| 83 | + for (String specId : orderSpecIds) { | |
| 76 | 84 | ShipmentsPlanDetail data = new ShipmentsPlanDetail(); |
| 77 | 85 | data.setId(IdUtil.getId()); |
| 78 | 86 | data.setPlanId(vo.getPlanId()); |
| 79 | - data.setOrderId(orderId); | |
| 87 | + data.setOrderId(orderIdMap.get(specId)); | |
| 88 | + data.setOrderSpecId(specId); | |
| 80 | 89 | data.setShipmentsDate(vo.getShipmentDate()); |
| 81 | 90 | data.setCreateById(userId); |
| 82 | 91 | data.setUpdateById(userId); |
| 92 | + data.setDelFlag(false); | |
| 83 | 93 | |
| 84 | 94 | detailList.add(data); |
| 85 | 95 | } | ... | ... |
| ... | ... | @@ -15,10 +15,7 @@ import com.lframework.starter.web.core.annotations.oplog.OpLog; |
| 15 | 15 | import com.lframework.starter.web.core.utils.PageHelperUtil; |
| 16 | 16 | import com.lframework.starter.common.utils.Assert; |
| 17 | 17 | import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; |
| 18 | -import com.lframework.xingyun.sc.entity.ShipmentsPlanDetail; | |
| 19 | 18 | import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanDetailService; |
| 20 | -import com.lframework.xingyun.sc.vo.shipments.plan.QueryShipmentsPlanDetailVo; | |
| 21 | -import org.apache.commons.collections4.CollectionUtils; | |
| 22 | 19 | import org.springframework.transaction.annotation.Transactional; |
| 23 | 20 | import com.lframework.xingyun.sc.mappers.ShipmentsPlanMapper; |
| 24 | 21 | import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanService; |
| ... | ... | @@ -28,8 +25,6 @@ import com.lframework.xingyun.sc.vo.shipments.plan.UpdateShipmentsPlanVo; |
| 28 | 25 | import org.springframework.stereotype.Service; |
| 29 | 26 | |
| 30 | 27 | import javax.annotation.Resource; |
| 31 | -import java.time.LocalDate; | |
| 32 | -import java.util.ArrayList; | |
| 33 | 28 | import java.util.List; |
| 34 | 29 | |
| 35 | 30 | @Service |
| ... | ... | @@ -58,38 +53,7 @@ public class ShipmentsPlanServiceImpl extends BaseMpServiceImpl<ShipmentsPlanMap |
| 58 | 53 | |
| 59 | 54 | @Override |
| 60 | 55 | public ShipmentsPlan findById(String id) { |
| 61 | - ShipmentsPlan plan = getBaseMapper().getById(id); | |
| 62 | - if (plan == null) { | |
| 63 | - throw new DefaultClientException("发货计划不存在!"); | |
| 64 | - } | |
| 65 | - // 获取计划明细 | |
| 66 | - QueryShipmentsPlanDetailVo detailVo = new QueryShipmentsPlanDetailVo(); | |
| 67 | - detailVo.setPlanId(plan.getId()); | |
| 68 | - // 发货日期 | |
| 69 | - List<LocalDate> dateList = new ArrayList<>(); | |
| 70 | - dateList.add(plan.getTomoPreShipDate()); | |
| 71 | - dateList.add(plan.getAfTomoPreShipDate()); | |
| 72 | - detailVo.setShipmentsDateList(dateList); | |
| 73 | - | |
| 74 | - List<ShipmentsPlanDetail> detailList = shipmentsPlanDetailService.query(detailVo); | |
| 75 | - if (CollectionUtils.isEmpty(detailList)) { | |
| 76 | - return plan; | |
| 77 | - } | |
| 78 | - // 根据日期分组 | |
| 79 | - List<ShipmentsPlanDetail> tomorrowPlans = new ArrayList<>(); | |
| 80 | - List<ShipmentsPlanDetail> afterTomorrowPlans = new ArrayList<>(); | |
| 81 | - for (ShipmentsPlanDetail detail : detailList) { | |
| 82 | - LocalDate shipmentsDate = detail.getShipmentsDate(); | |
| 83 | - if (shipmentsDate.equals(plan.getTomoPreShipDate())) { | |
| 84 | - tomorrowPlans.add(detail); | |
| 85 | - } else if (shipmentsDate.equals(plan.getAfTomoPreShipDate())) { | |
| 86 | - afterTomorrowPlans.add(detail); | |
| 87 | - } | |
| 88 | - } | |
| 89 | - plan.setTomoPlanList(tomorrowPlans); | |
| 90 | - plan.setAfTomoPlanList(afterTomorrowPlans); | |
| 91 | - | |
| 92 | - return plan; | |
| 56 | + return getBaseMapper().getById(id); | |
| 93 | 57 | } |
| 94 | 58 | |
| 95 | 59 | @OpLog(type = OtherOpLogType.class, name = "新增发货计划,ID:{}", params = {"#id"}) | ... | ... |
| ... | ... | @@ -26,11 +26,11 @@ public class CreateShipmentsPlanDetailVo implements BaseVo, Serializable { |
| 26 | 26 | private String planId; |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | - * 订货单ID集合 | |
| 29 | + * 订货单规格ID集合 | |
| 30 | 30 | */ |
| 31 | 31 | @ApiModelProperty(value = "订货单ID", required = true) |
| 32 | 32 | @NotEmpty(message = "请输入订货单ID!") |
| 33 | - private List<String> orderIds; | |
| 33 | + private List<String> orderSpecIds; | |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * 发货日期 | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/shipments/plan/QueryShipmentsPlanDetailVo.java
| ... | ... | @@ -7,7 +7,6 @@ import com.lframework.starter.web.core.vo.BaseVo; |
| 7 | 7 | import com.lframework.starter.web.core.components.validation.TypeMismatch; |
| 8 | 8 | import io.swagger.annotations.ApiModelProperty; |
| 9 | 9 | import java.io.Serializable; |
| 10 | -import java.util.List; | |
| 11 | 10 | |
| 12 | 11 | @Data |
| 13 | 12 | public class QueryShipmentsPlanDetailVo extends PageVo implements BaseVo, Serializable { |
| ... | ... | @@ -25,5 +24,5 @@ public class QueryShipmentsPlanDetailVo extends PageVo implements BaseVo, Serial |
| 25 | 24 | */ |
| 26 | 25 | @ApiModelProperty("发货日期") |
| 27 | 26 | @TypeMismatch(message = "发货日期格式有误!") |
| 28 | - private List<LocalDate> shipmentsDateList; | |
| 27 | + private LocalDate shipmentsDate; | |
| 29 | 28 | } | ... | ... |
| ... | ... | @@ -3,7 +3,6 @@ package com.lframework.xingyun.sc.vo.shipments.plan; |
| 3 | 3 | import lombok.Data; |
| 4 | 4 | import com.lframework.starter.web.core.vo.PageVo; |
| 5 | 5 | import com.lframework.starter.web.core.vo.BaseVo; |
| 6 | -import com.lframework.starter.web.core.components.validation.TypeMismatch; | |
| 7 | 6 | import io.swagger.annotations.ApiModelProperty; |
| 8 | 7 | import java.io.Serializable; |
| 9 | 8 | import java.time.LocalDateTime; | ... | ... |
| ... | ... | @@ -36,6 +36,7 @@ |
| 36 | 36 | tb.order_id, |
| 37 | 37 | o.order_no, |
| 38 | 38 | c.name AS customer_name, |
| 39 | + tb.order_spec_id, | |
| 39 | 40 | ol.thickness, |
| 40 | 41 | ol.thickness_tol_pos, |
| 41 | 42 | ol.thickness_tol_neg, |
| ... | ... | @@ -80,6 +81,7 @@ |
| 80 | 81 | id, |
| 81 | 82 | plan_id, |
| 82 | 83 | order_id, |
| 84 | + order_spec_id, | |
| 83 | 85 | parent_id, |
| 84 | 86 | status, |
| 85 | 87 | shipments_date, |
| ... | ... | @@ -96,6 +98,7 @@ |
| 96 | 98 | #{item.id}, |
| 97 | 99 | #{item.planId}, |
| 98 | 100 | #{item.orderId}, |
| 101 | + #{item.orderSpecId}, | |
| 99 | 102 | #{item.parentId}, |
| 100 | 103 | #{item.status}, |
| 101 | 104 | #{item.shipmentsDate}, | ... | ... |
| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 | SELECT |
| 20 | 20 | tb.id, |
| 21 | 21 | tb.workshop_id, |
| 22 | - w.workshop_name, | |
| 22 | + w.name AS workshop_name, | |
| 23 | 23 | tb.status, |
| 24 | 24 | tb.tomo_pre_ship_date, |
| 25 | 25 | tb.af_tomo_pre_ship_date, |
| ... | ... | @@ -40,6 +40,12 @@ |
| 40 | 40 | <if test="vo.status != null and vo.status != ''"> |
| 41 | 41 | AND tb.status = #{vo.status} |
| 42 | 42 | </if> |
| 43 | + <if test="vo.createStartTime != null"> | |
| 44 | + AND tb.create_time >= #{vo.createStartTime} | |
| 45 | + </if> | |
| 46 | + <if test="vo.createEndTime != null"> | |
| 47 | + AND tb.create_time <= #{vo.createEndTime} | |
| 48 | + </if> | |
| 43 | 49 | </where> |
| 44 | 50 | </select> |
| 45 | 51 | ... | ... |