Showing
12 changed files
with
306 additions
and
19 deletions
| @@ -38,12 +38,24 @@ public class GetShipmentsOrderInfoBo extends BaseBo<ShipmentsOrderInfo> { | @@ -38,12 +38,24 @@ public class GetShipmentsOrderInfoBo extends BaseBo<ShipmentsOrderInfo> { | ||
| 38 | private String customerId; | 38 | private String customerId; |
| 39 | 39 | ||
| 40 | /** | 40 | /** |
| 41 | + * 购货单位名称 | ||
| 42 | + */ | ||
| 43 | + @ApiModelProperty("购货单位名称") | ||
| 44 | + private String customerName; | ||
| 45 | + | ||
| 46 | + /** | ||
| 41 | * 厂房ID | 47 | * 厂房ID |
| 42 | */ | 48 | */ |
| 43 | @ApiModelProperty("厂房ID") | 49 | @ApiModelProperty("厂房ID") |
| 44 | private String workshopId; | 50 | private String workshopId; |
| 45 | 51 | ||
| 46 | /** | 52 | /** |
| 53 | + * 厂房名称 | ||
| 54 | + */ | ||
| 55 | + @ApiModelProperty("厂房名称") | ||
| 56 | + private String workshopName; | ||
| 57 | + | ||
| 58 | + /** | ||
| 47 | * 发货日期 | 59 | * 发货日期 |
| 48 | */ | 60 | */ |
| 49 | @ApiModelProperty("发货日期") | 61 | @ApiModelProperty("发货日期") |
| @@ -57,6 +69,12 @@ public class GetShipmentsOrderInfoBo extends BaseBo<ShipmentsOrderInfo> { | @@ -57,6 +69,12 @@ public class GetShipmentsOrderInfoBo extends BaseBo<ShipmentsOrderInfo> { | ||
| 57 | private String deptId; | 69 | private String deptId; |
| 58 | 70 | ||
| 59 | /** | 71 | /** |
| 72 | + * 办事处名称 | ||
| 73 | + */ | ||
| 74 | + @ApiModelProperty("办事处名称") | ||
| 75 | + private String deptName; | ||
| 76 | + | ||
| 77 | + /** | ||
| 60 | * 交货方式 | 78 | * 交货方式 |
| 61 | */ | 79 | */ |
| 62 | @ApiModelProperty("交货方式") | 80 | @ApiModelProperty("交货方式") |
| @@ -2,6 +2,7 @@ package com.lframework.xingyun.sc.controller.shipments; | @@ -2,6 +2,7 @@ package com.lframework.xingyun.sc.controller.shipments; | ||
| 2 | 2 | ||
| 3 | import com.lframework.xingyun.sc.bo.shipments.order.GetShipmentsOrderInfoBo; | 3 | import com.lframework.xingyun.sc.bo.shipments.order.GetShipmentsOrderInfoBo; |
| 4 | import com.lframework.xingyun.sc.bo.shipments.order.QueryShipmentsOrderInfoBo; | 4 | import com.lframework.xingyun.sc.bo.shipments.order.QueryShipmentsOrderInfoBo; |
| 5 | +import com.lframework.xingyun.sc.vo.shipments.order.GenerateShipmentsOrderVo; | ||
| 5 | import com.lframework.xingyun.sc.vo.shipments.order.QueryShipmentsOrderInfoVo; | 6 | import com.lframework.xingyun.sc.vo.shipments.order.QueryShipmentsOrderInfoVo; |
| 6 | import com.lframework.xingyun.sc.service.shipments.ShipmentsOrderInfoService; | 7 | import com.lframework.xingyun.sc.service.shipments.ShipmentsOrderInfoService; |
| 7 | import com.lframework.xingyun.sc.vo.shipments.order.CreateShipmentsOrderInfoVo; | 8 | import com.lframework.xingyun.sc.vo.shipments.order.CreateShipmentsOrderInfoVo; |
| @@ -110,4 +111,17 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { | @@ -110,4 +111,17 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { | ||
| 110 | shipmentsOrderInfoService.deleteById(id); | 111 | shipmentsOrderInfoService.deleteById(id); |
| 111 | return InvokeResultBuilder.success(); | 112 | return InvokeResultBuilder.success(); |
| 112 | } | 113 | } |
| 114 | + | ||
| 115 | + | ||
| 116 | + /** | ||
| 117 | + * 生成发货单和要车相关数据 | ||
| 118 | + */ | ||
| 119 | + @ApiOperation("生成发货单和要车相关数据") | ||
| 120 | + @HasPermission({"shipping-plan-manage:shipping-plan:generate"}) | ||
| 121 | + @PostMapping("/generate") | ||
| 122 | + public InvokeResult<Void> generate(@Valid @RequestBody GenerateShipmentsOrderVo vo) { | ||
| 123 | + // 生成发货单和要车相关数据 | ||
| 124 | + shipmentsOrderInfoService.generate(vo); | ||
| 125 | + return InvokeResultBuilder.success(); | ||
| 126 | + } | ||
| 113 | } | 127 | } |
| @@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.TableName; | @@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.TableName; | ||
| 4 | import com.lframework.starter.web.core.dto.BaseDto; | 4 | import com.lframework.starter.web.core.dto.BaseDto; |
| 5 | import java.time.LocalDate; | 5 | import java.time.LocalDate; |
| 6 | import java.time.LocalDateTime; | 6 | import java.time.LocalDateTime; |
| 7 | +import java.util.List; | ||
| 8 | + | ||
| 7 | import com.baomidou.mybatisplus.annotation.FieldFill; | 9 | import com.baomidou.mybatisplus.annotation.FieldFill; |
| 8 | import com.lframework.starter.web.core.entity.BaseEntity; | 10 | import com.lframework.starter.web.core.entity.BaseEntity; |
| 9 | import com.baomidou.mybatisplus.annotation.TableField; | 11 | import com.baomidou.mybatisplus.annotation.TableField; |
| @@ -92,6 +94,12 @@ public class ShipmentsOrderInfo extends BaseEntity implements BaseDto { | @@ -92,6 +94,12 @@ public class ShipmentsOrderInfo extends BaseEntity implements BaseDto { | ||
| 92 | private String status; | 94 | private String status; |
| 93 | 95 | ||
| 94 | /** | 96 | /** |
| 97 | + * 发货明细数据 | ||
| 98 | + */ | ||
| 99 | + @TableField(exist = false) | ||
| 100 | + private List<ShipmentsPlanDetail> detailList; | ||
| 101 | + | ||
| 102 | + /** | ||
| 95 | * 创建人ID | 103 | * 创建人ID |
| 96 | */ | 104 | */ |
| 97 | @TableField(fill = FieldFill.INSERT) | 105 | @TableField(fill = FieldFill.INSERT) |
| @@ -37,6 +37,11 @@ public class ShipmentsPlanDetail extends BaseEntity implements BaseDto { | @@ -37,6 +37,11 @@ public class ShipmentsPlanDetail extends BaseEntity implements BaseDto { | ||
| 37 | private String planId; | 37 | private String planId; |
| 38 | 38 | ||
| 39 | /** | 39 | /** |
| 40 | + * 发货单ID | ||
| 41 | + */ | ||
| 42 | + private String shipmentOrderId; | ||
| 43 | + | ||
| 44 | + /** | ||
| 40 | * 订货单ID | 45 | * 订货单ID |
| 41 | */ | 46 | */ |
| 42 | private String orderId; | 47 | private String orderId; |
| @@ -53,6 +58,25 @@ public class ShipmentsPlanDetail extends BaseEntity implements BaseDto { | @@ -53,6 +58,25 @@ public class ShipmentsPlanDetail extends BaseEntity implements BaseDto { | ||
| 53 | private String orderNo; | 58 | private String orderNo; |
| 54 | 59 | ||
| 55 | /** | 60 | /** |
| 61 | + * 合同类型 | ||
| 62 | + */ | ||
| 63 | + @TableField(exist = false) | ||
| 64 | + private String contractType; | ||
| 65 | + | ||
| 66 | + /** | ||
| 67 | + * 交货方式 | ||
| 68 | + */ | ||
| 69 | + @TableField(exist = false) | ||
| 70 | + private String deliveryMethod; | ||
| 71 | + | ||
| 72 | + | ||
| 73 | + /** | ||
| 74 | + * 结算方式或期限 | ||
| 75 | + */ | ||
| 76 | + @TableField(exist = false) | ||
| 77 | + private String settlementTerms; | ||
| 78 | + | ||
| 79 | + /** | ||
| 56 | * 客户ID | 80 | * 客户ID |
| 57 | */ | 81 | */ |
| 58 | @TableField(exist = false) | 82 | @TableField(exist = false) |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/shipments/ShipmentsOrderInfoServiceImpl.java
| @@ -3,20 +3,26 @@ package com.lframework.xingyun.sc.impl.shipments; | @@ -3,20 +3,26 @@ package com.lframework.xingyun.sc.impl.shipments; | ||
| 3 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | 3 | 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.utils.*; | ||
| 6 | import com.lframework.starter.web.inner.entity.SysDept; | 7 | import com.lframework.starter.web.inner.entity.SysDept; |
| 7 | import com.lframework.starter.web.inner.service.system.SysDeptService; | 8 | import com.lframework.starter.web.inner.service.system.SysDeptService; |
| 9 | +import com.lframework.xingyun.basedata.entity.Customer; | ||
| 10 | +import com.lframework.xingyun.basedata.entity.Workshop; | ||
| 11 | +import com.lframework.xingyun.basedata.service.customer.CustomerService; | ||
| 12 | +import com.lframework.xingyun.basedata.service.workshop.WorkshopService; | ||
| 8 | import com.lframework.xingyun.sc.entity.ShipmentsOrderInfo; | 13 | import com.lframework.xingyun.sc.entity.ShipmentsOrderInfo; |
| 9 | import com.lframework.starter.web.core.impl.BaseMpServiceImpl; | 14 | import com.lframework.starter.web.core.impl.BaseMpServiceImpl; |
| 10 | -import com.lframework.starter.web.core.utils.PageResultUtil; | ||
| 11 | import com.lframework.starter.web.core.components.resp.PageResult; | 15 | import com.lframework.starter.web.core.components.resp.PageResult; |
| 12 | -import com.lframework.starter.web.core.utils.OpLogUtil; | ||
| 13 | import com.lframework.starter.common.exceptions.impl.DefaultClientException; | 16 | import com.lframework.starter.common.exceptions.impl.DefaultClientException; |
| 14 | -import com.lframework.starter.web.core.utils.IdUtil; | ||
| 15 | import com.lframework.starter.common.utils.ObjectUtil; | 17 | import com.lframework.starter.common.utils.ObjectUtil; |
| 16 | import com.lframework.starter.web.core.annotations.oplog.OpLog; | 18 | import com.lframework.starter.web.core.annotations.oplog.OpLog; |
| 17 | -import com.lframework.starter.web.core.utils.PageHelperUtil; | ||
| 18 | import com.lframework.starter.common.utils.Assert; | 19 | import com.lframework.starter.common.utils.Assert; |
| 19 | import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; | 20 | import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; |
| 21 | +import com.lframework.xingyun.sc.entity.ShipmentsPlan; | ||
| 22 | +import com.lframework.xingyun.sc.entity.ShipmentsPlanDetail; | ||
| 23 | +import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanDetailService; | ||
| 24 | +import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanService; | ||
| 25 | +import com.lframework.xingyun.sc.vo.shipments.order.GenerateShipmentsOrderVo; | ||
| 20 | import org.apache.commons.collections4.CollectionUtils; | 26 | import org.apache.commons.collections4.CollectionUtils; |
| 21 | import org.apache.commons.lang3.StringUtils; | 27 | import org.apache.commons.lang3.StringUtils; |
| 22 | import org.springframework.transaction.annotation.Transactional; | 28 | import org.springframework.transaction.annotation.Transactional; |
| @@ -39,13 +45,12 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr | @@ -39,13 +45,12 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr | ||
| 39 | 45 | ||
| 40 | @Resource | 46 | @Resource |
| 41 | private SysDeptService sysDeptService; | 47 | private SysDeptService sysDeptService; |
| 48 | + @Resource | ||
| 49 | + private ShipmentsPlanDetailService shipmentsPlanDetailService; | ||
| 50 | + @Resource | ||
| 51 | + private ShipmentsPlanService shipmentsPlanService; | ||
| 42 | 52 | ||
| 43 | 53 | ||
| 44 | - | ||
| 45 | - public ShipmentsOrderInfoServiceImpl(SysDeptService sysDeptService) { | ||
| 46 | - this.sysDeptService = sysDeptService; | ||
| 47 | - } | ||
| 48 | - | ||
| 49 | @Override | 54 | @Override |
| 50 | public PageResult<ShipmentsOrderInfo> query(Integer pageIndex, Integer pageSize, QueryShipmentsOrderInfoVo vo) { | 55 | public PageResult<ShipmentsOrderInfo> query(Integer pageIndex, Integer pageSize, QueryShipmentsOrderInfoVo vo) { |
| 51 | Assert.greaterThanZero(pageIndex); | 56 | Assert.greaterThanZero(pageIndex); |
| @@ -106,7 +111,40 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr | @@ -106,7 +111,40 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr | ||
| 106 | 111 | ||
| 107 | @Override | 112 | @Override |
| 108 | public ShipmentsOrderInfo findById(String id) { | 113 | public ShipmentsOrderInfo findById(String id) { |
| 109 | - return getBaseMapper().selectById(id); | 114 | + ShipmentsOrderInfo orderInfo = getBaseMapper().selectById(id); |
| 115 | + // 购货单位 | ||
| 116 | + String customerId = orderInfo.getCustomerId(); | ||
| 117 | + if (StringUtils.isNotBlank(customerId)) { | ||
| 118 | + CustomerService customerService = ApplicationUtil.getBean(CustomerService.class); | ||
| 119 | + Customer customer = customerService.findById(customerId); | ||
| 120 | + orderInfo.setCustomerName(customer == null ? null : customer.getName()); | ||
| 121 | + } | ||
| 122 | + // 厂房 | ||
| 123 | + String workshopId = orderInfo.getWorkshopId(); | ||
| 124 | + if (StringUtils.isNotBlank(workshopId)) { | ||
| 125 | + WorkshopService workshopService = ApplicationUtil.getBean(WorkshopService.class); | ||
| 126 | + Workshop workshop = workshopService.findById(workshopId); | ||
| 127 | + orderInfo.setWorkshopName(workshop == null ? null : workshop.getName()); | ||
| 128 | + } | ||
| 129 | + // 办事处 | ||
| 130 | + String deptId = orderInfo.getDeptId(); | ||
| 131 | + if (StringUtils.isNotBlank(deptId)) { | ||
| 132 | + String[] split = deptId.split(","); | ||
| 133 | + List<SysDept> deptList = sysDeptService.listByIds(Arrays.asList(split)); | ||
| 134 | + StringBuilder builder = new StringBuilder(); | ||
| 135 | + for (SysDept dept : deptList) { | ||
| 136 | + builder.append(dept.getName()).append(","); | ||
| 137 | + } | ||
| 138 | + if (builder.length() > 0) { | ||
| 139 | + builder.deleteCharAt(builder.length() - 1); | ||
| 140 | + } | ||
| 141 | + orderInfo.setDeptName(builder.toString()); | ||
| 142 | + } | ||
| 143 | + // 获取发货单明细数据 | ||
| 144 | + List<ShipmentsPlanDetail> detailList = shipmentsPlanDetailService.listByShipmentOrderId(id); | ||
| 145 | + orderInfo.setDetailList(detailList); | ||
| 146 | + | ||
| 147 | + return orderInfo; | ||
| 110 | } | 148 | } |
| 111 | 149 | ||
| 112 | @OpLog(type = OtherOpLogType.class, name = "新增发货单,ID:{}", params = {"#id"}) | 150 | @OpLog(type = OtherOpLogType.class, name = "新增发货单,ID:{}", params = {"#id"}) |
| @@ -161,4 +199,59 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr | @@ -161,4 +199,59 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr | ||
| 161 | public void deleteById(String id) { | 199 | public void deleteById(String id) { |
| 162 | getBaseMapper().deleteById(id); | 200 | getBaseMapper().deleteById(id); |
| 163 | } | 201 | } |
| 202 | + | ||
| 203 | + @Override | ||
| 204 | + public void generate(GenerateShipmentsOrderVo vo) { | ||
| 205 | + String planId = vo.getPlanId(); | ||
| 206 | + String type = vo.getType(); | ||
| 207 | + if ("AUTO".equals(type)) { | ||
| 208 | + // 根据客户批量生成 | ||
| 209 | + | ||
| 210 | + } else { | ||
| 211 | + List<String> planDetailIds = vo.getPlanDetailIds(); | ||
| 212 | + if (CollectionUtils.isEmpty(planDetailIds)) { | ||
| 213 | + throw new DefaultClientException("发货明细id不能为空!"); | ||
| 214 | + } | ||
| 215 | + List<ShipmentsPlanDetail> detailList = shipmentsPlanDetailService.listByIds(planDetailIds); | ||
| 216 | + if (CollectionUtils.isEmpty(detailList)) { | ||
| 217 | + throw new DefaultClientException("发货明细数据不存在!"); | ||
| 218 | + } | ||
| 219 | + String id = IdUtil.getId(); | ||
| 220 | + String customerId = detailList.get(0).getCustomerId(); | ||
| 221 | + StringBuilder deliveryTypeBuilder = new StringBuilder(); | ||
| 222 | + StringBuilder destinationBuilder = new StringBuilder(); | ||
| 223 | + // 获取城市数据 | ||
| 224 | + | ||
| 225 | + for (ShipmentsPlanDetail detail : detailList) { | ||
| 226 | + if (!customerId.equals(detail.getCustomerId())) { | ||
| 227 | + throw new DefaultClientException("只能选择同一客户下的数据!"); | ||
| 228 | + } | ||
| 229 | + detail.setShipmentOrderId(id); | ||
| 230 | + | ||
| 231 | + deliveryTypeBuilder.append(detail.getDeliveryMethod()).append(","); | ||
| 232 | + } | ||
| 233 | + if (deliveryTypeBuilder.length() > 0) { | ||
| 234 | + deliveryTypeBuilder.setLength(deliveryTypeBuilder.length() - 1); | ||
| 235 | + } | ||
| 236 | + if (destinationBuilder.length() > 0) { | ||
| 237 | + destinationBuilder.setLength(destinationBuilder.length() - 1); | ||
| 238 | + } | ||
| 239 | + // 获取发货计划数据 | ||
| 240 | + ShipmentsPlan plan = shipmentsPlanService.findById(planId); | ||
| 241 | + // 封装发货单数据 | ||
| 242 | + CreateShipmentsOrderInfoVo createVo = new CreateShipmentsOrderInfoVo(); | ||
| 243 | + createVo.setPlanId(planId); | ||
| 244 | + createVo.setCustomerId(customerId); | ||
| 245 | + createVo.setWorkshopId(plan.getWorkshopId()); | ||
| 246 | + createVo.setShipmentsDate(plan.getTomoPreShipDate()); | ||
| 247 | + createVo.setDeliveryType(deliveryTypeBuilder.toString()); | ||
| 248 | + createVo.setDestination(destinationBuilder.toString()); | ||
| 249 | + | ||
| 250 | + create(createVo); | ||
| 251 | + // 更新明细数据 | ||
| 252 | + shipmentsPlanDetailService.setShipmentsOrderId(planDetailIds, id); | ||
| 253 | + // 获取订货单数据 | ||
| 254 | + | ||
| 255 | + } | ||
| 256 | + } | ||
| 164 | } | 257 | } |
| @@ -34,16 +34,14 @@ import com.lframework.xingyun.sc.vo.shipments.plan.QueryShipmentsPlanDetailVo; | @@ -34,16 +34,14 @@ import com.lframework.xingyun.sc.vo.shipments.plan.QueryShipmentsPlanDetailVo; | ||
| 34 | import com.lframework.xingyun.sc.vo.shipments.plan.ShipmentsPlanDetailSplitVo; | 34 | import com.lframework.xingyun.sc.vo.shipments.plan.ShipmentsPlanDetailSplitVo; |
| 35 | import com.lframework.xingyun.sc.vo.shipments.plan.UpdateShipmentsPlanDetailVo; | 35 | import com.lframework.xingyun.sc.vo.shipments.plan.UpdateShipmentsPlanDetailVo; |
| 36 | import org.apache.commons.collections4.CollectionUtils; | 36 | import org.apache.commons.collections4.CollectionUtils; |
| 37 | +import org.apache.commons.lang3.StringUtils; | ||
| 37 | import org.springframework.stereotype.Service; | 38 | import org.springframework.stereotype.Service; |
| 38 | import org.springframework.transaction.annotation.Transactional; | 39 | import org.springframework.transaction.annotation.Transactional; |
| 39 | 40 | ||
| 40 | import javax.annotation.Resource; | 41 | import javax.annotation.Resource; |
| 41 | import java.math.BigDecimal; | 42 | import java.math.BigDecimal; |
| 42 | import java.time.LocalDate; | 43 | import java.time.LocalDate; |
| 43 | -import java.util.ArrayList; | ||
| 44 | -import java.util.HashMap; | ||
| 45 | -import java.util.List; | ||
| 46 | -import java.util.Map; | 44 | +import java.util.*; |
| 47 | import java.util.function.Function; | 45 | import java.util.function.Function; |
| 48 | import java.util.stream.Collectors; | 46 | import java.util.stream.Collectors; |
| 49 | 47 | ||
| @@ -136,8 +134,8 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP | @@ -136,8 +134,8 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP | ||
| 136 | } | 134 | } |
| 137 | 135 | ||
| 138 | LambdaUpdateWrapper<ShipmentsPlanDetail> updateWrapper = Wrappers.lambdaUpdate(ShipmentsPlanDetail.class) | 136 | LambdaUpdateWrapper<ShipmentsPlanDetail> updateWrapper = Wrappers.lambdaUpdate(ShipmentsPlanDetail.class) |
| 139 | - .set(ShipmentsPlanDetail::getShipmentsTime, vo.getShipmentsTime()) | ||
| 140 | - .set(ShipmentsPlanDetail::getCanShipments, vo.getCanShipments()) | 137 | + .set(vo.getShipmentsTime() != null, ShipmentsPlanDetail::getShipmentsTime, vo.getShipmentsTime()) |
| 138 | + .set(vo.getCanShipments() != null, ShipmentsPlanDetail::getCanShipments, vo.getCanShipments()) | ||
| 141 | .eq(ShipmentsPlanDetail::getId, vo.getId()); | 139 | .eq(ShipmentsPlanDetail::getId, vo.getId()); |
| 142 | 140 | ||
| 143 | getBaseMapper().update(updateWrapper); | 141 | getBaseMapper().update(updateWrapper); |
| @@ -167,7 +165,7 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP | @@ -167,7 +165,7 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP | ||
| 167 | } | 165 | } |
| 168 | // 开启分页 | 166 | // 开启分页 |
| 169 | PageHelperUtil.startPage(pageIndex, pageSize); | 167 | PageHelperUtil.startPage(pageIndex, pageSize); |
| 170 | - List<ShipmentsPlanDetail> dataList = getBaseMapper().queryCanShipmentsData(LocalDate.now(), vo); | 168 | + List<ShipmentsPlanDetail> dataList = getBaseMapper().queryCanShipmentsData(vo); |
| 171 | 169 | ||
| 172 | return PageResultUtil.convert(new PageInfo<>(dataList)); | 170 | return PageResultUtil.convert(new PageInfo<>(dataList)); |
| 173 | } | 171 | } |
| @@ -297,6 +295,25 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP | @@ -297,6 +295,25 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP | ||
| 297 | getBaseMapper().delete(updateWrapper); | 295 | getBaseMapper().delete(updateWrapper); |
| 298 | } | 296 | } |
| 299 | 297 | ||
| 298 | + @Override | ||
| 299 | + public List<ShipmentsPlanDetail> listByShipmentOrderId(String shipmentOrderId) { | ||
| 300 | + if (StringUtils.isBlank(shipmentOrderId)) { | ||
| 301 | + return Collections.emptyList(); | ||
| 302 | + } | ||
| 303 | + return getBaseMapper().listByShipmentOrderId(shipmentOrderId); | ||
| 304 | + } | ||
| 305 | + | ||
| 306 | + @Override | ||
| 307 | + public void setShipmentsOrderId(List<String> ids, String shipmentOrderId) { | ||
| 308 | + if (CollectionUtils.isEmpty(ids) || StringUtils.isBlank(shipmentOrderId)) { | ||
| 309 | + return; | ||
| 310 | + } | ||
| 311 | + LambdaUpdateWrapper<ShipmentsPlanDetail> updateWrapper = Wrappers.lambdaUpdate(ShipmentsPlanDetail.class); | ||
| 312 | + updateWrapper.set(ShipmentsPlanDetail::getShipmentOrderId, shipmentOrderId) | ||
| 313 | + .in(ShipmentsPlanDetail::getId, ids); | ||
| 314 | + getBaseMapper().update(updateWrapper); | ||
| 315 | + } | ||
| 316 | + | ||
| 300 | 317 | ||
| 301 | /** | 318 | /** |
| 302 | * 封装发货计划明细数据 | 319 | * 封装发货计划明细数据 |
| @@ -38,5 +38,13 @@ public interface ShipmentsPlanDetailMapper extends BaseMapper<ShipmentsPlanDetai | @@ -38,5 +38,13 @@ public interface ShipmentsPlanDetailMapper extends BaseMapper<ShipmentsPlanDetai | ||
| 38 | * @param vo 查询条件 | 38 | * @param vo 查询条件 |
| 39 | * @return List<ShipmentsPlanDetail> | 39 | * @return List<ShipmentsPlanDetail> |
| 40 | */ | 40 | */ |
| 41 | - List<ShipmentsPlanDetail> queryCanShipmentsData(@Param("shipmentsDate") LocalDate shipmentsDate, @Param("vo") QueryShipmentsPlanDetailVo vo); | 41 | + List<ShipmentsPlanDetail> queryCanShipmentsData(@Param("vo") QueryShipmentsPlanDetailVo vo); |
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * 根据发货单ID查询 | ||
| 45 | + * | ||
| 46 | + * @param shipmentOrderId 发货单ID | ||
| 47 | + * @return List<ShipmentsPlanDetail> | ||
| 48 | + */ | ||
| 49 | + List<ShipmentsPlanDetail> listByShipmentOrderId(String shipmentOrderId); | ||
| 42 | } | 50 | } |
| 1 | package com.lframework.xingyun.sc.service.shipments; | 1 | package com.lframework.xingyun.sc.service.shipments; |
| 2 | 2 | ||
| 3 | import com.lframework.xingyun.sc.vo.shipments.order.CreateShipmentsOrderInfoVo; | 3 | import com.lframework.xingyun.sc.vo.shipments.order.CreateShipmentsOrderInfoVo; |
| 4 | +import com.lframework.xingyun.sc.vo.shipments.order.GenerateShipmentsOrderVo; | ||
| 4 | import com.lframework.xingyun.sc.vo.shipments.order.QueryShipmentsOrderInfoVo; | 5 | import com.lframework.xingyun.sc.vo.shipments.order.QueryShipmentsOrderInfoVo; |
| 5 | import com.lframework.xingyun.sc.vo.shipments.order.UpdateShipmentsOrderInfoVo; | 6 | import com.lframework.xingyun.sc.vo.shipments.order.UpdateShipmentsOrderInfoVo; |
| 6 | import com.lframework.xingyun.sc.entity.ShipmentsOrderInfo; | 7 | import com.lframework.xingyun.sc.entity.ShipmentsOrderInfo; |
| @@ -57,4 +58,11 @@ public interface ShipmentsOrderInfoService extends BaseMpService<ShipmentsOrderI | @@ -57,4 +58,11 @@ public interface ShipmentsOrderInfoService extends BaseMpService<ShipmentsOrderI | ||
| 57 | * @param id 主键ID | 58 | * @param id 主键ID |
| 58 | */ | 59 | */ |
| 59 | void deleteById(String id); | 60 | void deleteById(String id); |
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * 生成发货单 | ||
| 64 | + * | ||
| 65 | + * @param vo 生成条件 | ||
| 66 | + */ | ||
| 67 | + void generate(GenerateShipmentsOrderVo vo); | ||
| 60 | } | 68 | } |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/shipments/ShipmentsPlanDetailService.java
| @@ -80,4 +80,20 @@ public interface ShipmentsPlanDetailService extends BaseMpService<ShipmentsPlanD | @@ -80,4 +80,20 @@ public interface ShipmentsPlanDetailService extends BaseMpService<ShipmentsPlanD | ||
| 80 | * @param ids 主键ID集合 | 80 | * @param ids 主键ID集合 |
| 81 | */ | 81 | */ |
| 82 | void batchDelete(List<String> ids); | 82 | void batchDelete(List<String> ids); |
| 83 | + | ||
| 84 | + /** | ||
| 85 | + * 根据发货单ID查询 | ||
| 86 | + * | ||
| 87 | + * @param shipmentOrderId 发货单ID | ||
| 88 | + * @return List<ShipmentsPlanDetail> | ||
| 89 | + */ | ||
| 90 | + List<ShipmentsPlanDetail> listByShipmentOrderId(String shipmentOrderId); | ||
| 91 | + | ||
| 92 | + /** | ||
| 93 | + * 批量设置发货单ID | ||
| 94 | + * | ||
| 95 | + * @param ids 主键集合 | ||
| 96 | + * @param shipmentOrderId 发货单ID | ||
| 97 | + */ | ||
| 98 | + void setShipmentsOrderId(List<String> ids, String shipmentOrderId); | ||
| 83 | } | 99 | } |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/shipments/order/GenerateShipmentsOrderVo.java
0 → 100644
| 1 | +package com.lframework.xingyun.sc.vo.shipments.order; | ||
| 2 | + | ||
| 3 | +import com.lframework.starter.web.core.vo.BaseVo; | ||
| 4 | +import io.swagger.annotations.ApiModelProperty; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +import javax.validation.constraints.NotBlank; | ||
| 8 | +import java.io.Serializable; | ||
| 9 | +import java.util.List; | ||
| 10 | + | ||
| 11 | +@Data | ||
| 12 | +public class GenerateShipmentsOrderVo implements BaseVo, Serializable { | ||
| 13 | + | ||
| 14 | + private static final long serialVersionUID = 1L; | ||
| 15 | + | ||
| 16 | + /** | ||
| 17 | + * 计划ID | ||
| 18 | + */ | ||
| 19 | + @ApiModelProperty(value = "planId", required = true) | ||
| 20 | + @NotBlank(message = "计划ID不能为空!") | ||
| 21 | + private String planId; | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 生成类型 | ||
| 25 | + * AUTO:自动生成 | ||
| 26 | + * NO_AUTO:手动生成 | ||
| 27 | + */ | ||
| 28 | + @ApiModelProperty(value = "type", required = true) | ||
| 29 | + @NotBlank(message = "生成类型不能为空!") | ||
| 30 | + private String type; | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * 计划明细ID集合 | ||
| 34 | + */ | ||
| 35 | + @ApiModelProperty(value = "状态", required = true) | ||
| 36 | + private List<String> planDetailIds; | ||
| 37 | +} |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/shipments/plan/QueryShipmentsPlanDetailVo.java
| @@ -26,6 +26,7 @@ public class QueryShipmentsPlanDetailVo extends PageVo implements BaseVo, Serial | @@ -26,6 +26,7 @@ public class QueryShipmentsPlanDetailVo extends PageVo implements BaseVo, Serial | ||
| 26 | @ApiModelProperty("发货日期") | 26 | @ApiModelProperty("发货日期") |
| 27 | @TypeMismatch(message = "发货日期格式有误!") | 27 | @TypeMismatch(message = "发货日期格式有误!") |
| 28 | private LocalDate shipmentsDate; | 28 | private LocalDate shipmentsDate; |
| 29 | + private LocalDate shipmentDate; | ||
| 29 | 30 | ||
| 30 | /** | 31 | /** |
| 31 | * 订货单规格ID集合 | 32 | * 订货单规格ID集合 |
| @@ -138,7 +138,7 @@ | @@ -138,7 +138,7 @@ | ||
| 138 | from tbl_purchase_order_line ol | 138 | from tbl_purchase_order_line ol |
| 139 | inner join purchase_order_info o on ol.purchase_order_id = o.id | 139 | inner join purchase_order_info o on ol.purchase_order_id = o.id |
| 140 | left join base_data_customer c on o.ordering_unit = c.id | 140 | left join base_data_customer c on o.ordering_unit = c.id |
| 141 | - where ol.delivery_date >= #{shipmentsDate} | 141 | + where ol.delivery_date >= #{vo.shipmentDate} |
| 142 | <if test="vo.orderSpecIds != null and vo.orderSpecIds.size() > 0"> | 142 | <if test="vo.orderSpecIds != null and vo.orderSpecIds.size() > 0"> |
| 143 | and ol.id not in | 143 | and ol.id not in |
| 144 | <foreach collection="vo.orderSpecIds" open="(" separator="," close=")" item="item"> | 144 | <foreach collection="vo.orderSpecIds" open="(" separator="," close=")" item="item"> |
| @@ -152,4 +152,47 @@ | @@ -152,4 +152,47 @@ | ||
| 152 | AND c.name like concat('%', #{vo.customerName}, '%') | 152 | AND c.name like concat('%', #{vo.customerName}, '%') |
| 153 | </if> | 153 | </if> |
| 154 | </select> | 154 | </select> |
| 155 | + | ||
| 156 | + <select id="listByShipmentOrderId" resultType="com.lframework.xingyun.sc.entity.ShipmentsPlanDetail"> | ||
| 157 | + SELECT | ||
| 158 | + tb.id, | ||
| 159 | + tb.plan_id, | ||
| 160 | + tb.shipment_order_id, | ||
| 161 | + tb.order_id, | ||
| 162 | + o.order_no, | ||
| 163 | + o.ordering_unit AS customer_id, | ||
| 164 | + o.delivery_method, | ||
| 165 | + o.settlement_terms, | ||
| 166 | + sc.type as contract_type, | ||
| 167 | + c.name AS customer_name, | ||
| 168 | + tb.order_spec_id, | ||
| 169 | + ol.thickness, | ||
| 170 | + ol.thickness_tol_pos, | ||
| 171 | + ol.thickness_tol_neg, | ||
| 172 | + ol.width, | ||
| 173 | + ol.width_tol_pos, | ||
| 174 | + ol.width_tol_neg, | ||
| 175 | + ol.length, | ||
| 176 | + ol.length_tol_pos, | ||
| 177 | + ol.length_tol_neg, | ||
| 178 | + ol.quantity, | ||
| 179 | + tb.parent_id, | ||
| 180 | + tb.status, | ||
| 181 | + tb.shipments_date, | ||
| 182 | + tb.shipments_time, | ||
| 183 | + tb.can_shipments, | ||
| 184 | + tb.del_flag, | ||
| 185 | + tb.create_by_id, | ||
| 186 | + tb.update_by_id, | ||
| 187 | + tb.create_time, | ||
| 188 | + tb.update_time | ||
| 189 | + FROM shipments_plan_detail AS tb | ||
| 190 | + INNER JOIN shipments_order_info so ON tb.shipment_order_id = so.id | ||
| 191 | + LEFT JOIN purchase_order_info o ON tb.order_id = o.id | ||
| 192 | + LEFT JOIN tbl_contract_distributor_standard sc ON o.contract_id = sc.id | ||
| 193 | + LEFT JOIN base_data_customer c ON o.ordering_unit = c.id | ||
| 194 | + LEFT JOIN tbl_purchase_order_line ol ON tb.order_spec_id = ol.id | ||
| 195 | + WHERE tb.del_flag = false | ||
| 196 | + AND tb.shipment_order_id = #{shipmentOrderId} | ||
| 197 | + </select> | ||
| 155 | </mapper> | 198 | </mapper> |