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