Commit 846fd5d58117201da98ee7d27f0cb587609a7363
1 parent
1988335b
楚江erp:1、发货计划列表增加权限控制(经营办发货员、精轧车间计划员);2、发货计划、发货单列表排序调整(按创建时间倒序);3、生成发货单逻辑调整(过滤掉已发货的数据)
Showing
5 changed files
with
52 additions
and
3 deletions
xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/shipments/ShipmentsOrderInfoServiceImpl.java
| @@ -38,6 +38,7 @@ import com.lframework.xingyun.sc.vo.shipments.order.*; | @@ -38,6 +38,7 @@ import com.lframework.xingyun.sc.vo.shipments.order.*; | ||
| 38 | import com.lframework.xingyun.sc.vo.shipments.plan.QueryShipmentsPlanDetailVo; | 38 | import com.lframework.xingyun.sc.vo.shipments.plan.QueryShipmentsPlanDetailVo; |
| 39 | import lombok.extern.slf4j.Slf4j; | 39 | import lombok.extern.slf4j.Slf4j; |
| 40 | import org.apache.commons.collections4.CollectionUtils; | 40 | import org.apache.commons.collections4.CollectionUtils; |
| 41 | +import org.apache.commons.collections4.MapUtils; | ||
| 41 | import org.apache.commons.lang3.StringUtils; | 42 | import org.apache.commons.lang3.StringUtils; |
| 42 | import org.springframework.transaction.annotation.Transactional; | 43 | import org.springframework.transaction.annotation.Transactional; |
| 43 | import com.lframework.xingyun.sc.mappers.ShipmentsOrderInfoMapper; | 44 | import com.lframework.xingyun.sc.mappers.ShipmentsOrderInfoMapper; |
| @@ -249,14 +250,21 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr | @@ -249,14 +250,21 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr | ||
| 249 | // 根据客户批量生成 | 250 | // 根据客户批量生成 |
| 250 | List<ShipmentsPlanDetail> detailList = shipmentsPlanDetailService.listByPlanId(planId); | 251 | List<ShipmentsPlanDetail> detailList = shipmentsPlanDetailService.listByPlanId(planId); |
| 251 | if (CollectionUtils.isEmpty(detailList)) { | 252 | if (CollectionUtils.isEmpty(detailList)) { |
| 252 | - return; | 253 | + throw new DefaultClientException("发货明细数据不存在!"); |
| 253 | } | 254 | } |
| 254 | // 根据客户分组 | 255 | // 根据客户分组 |
| 255 | Map<String, List<ShipmentsPlanDetail>> detailMap = new HashMap<>(); | 256 | Map<String, List<ShipmentsPlanDetail>> detailMap = new HashMap<>(); |
| 256 | for (ShipmentsPlanDetail detail : detailList) { | 257 | for (ShipmentsPlanDetail detail : detailList) { |
| 258 | + // 已发货的直接过滤 | ||
| 259 | + if (StringUtils.isNotBlank(detail.getShipmentOrderId())) { | ||
| 260 | + continue; | ||
| 261 | + } | ||
| 257 | List<ShipmentsPlanDetail> list = detailMap.computeIfAbsent(detail.getCustomerId(), k -> new ArrayList<>()); | 262 | List<ShipmentsPlanDetail> list = detailMap.computeIfAbsent(detail.getCustomerId(), k -> new ArrayList<>()); |
| 258 | list.add(detail); | 263 | list.add(detail); |
| 259 | } | 264 | } |
| 265 | + if (MapUtils.isEmpty(detailMap)) { | ||
| 266 | + throw new DefaultClientException("发货明细数据不存在!"); | ||
| 267 | + } | ||
| 260 | // todo 如果客户很多,则此处需要优化 | 268 | // todo 如果客户很多,则此处需要优化 |
| 261 | for (Map.Entry<String, List<ShipmentsPlanDetail>> entry : detailMap.entrySet()) { | 269 | for (Map.Entry<String, List<ShipmentsPlanDetail>> entry : detailMap.entrySet()) { |
| 262 | List<ShipmentsPlanDetail> value = entry.getValue(); | 270 | List<ShipmentsPlanDetail> value = entry.getValue(); |
| @@ -3,6 +3,9 @@ package com.lframework.xingyun.sc.impl.shipments; | @@ -3,6 +3,9 @@ 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.components.security.SecurityUtil; | ||
| 7 | +import com.lframework.starter.web.inner.entity.SysRole; | ||
| 8 | +import com.lframework.starter.web.inner.service.system.SysRoleService; | ||
| 6 | import com.lframework.xingyun.sc.entity.ShipmentsPlan; | 9 | import com.lframework.xingyun.sc.entity.ShipmentsPlan; |
| 7 | import com.lframework.starter.web.core.impl.BaseMpServiceImpl; | 10 | import com.lframework.starter.web.core.impl.BaseMpServiceImpl; |
| 8 | import com.lframework.starter.web.core.utils.PageResultUtil; | 11 | import com.lframework.starter.web.core.utils.PageResultUtil; |
| @@ -15,7 +18,7 @@ import com.lframework.starter.web.core.annotations.oplog.OpLog; | @@ -15,7 +18,7 @@ import com.lframework.starter.web.core.annotations.oplog.OpLog; | ||
| 15 | import com.lframework.starter.web.core.utils.PageHelperUtil; | 18 | import com.lframework.starter.web.core.utils.PageHelperUtil; |
| 16 | import com.lframework.starter.common.utils.Assert; | 19 | import com.lframework.starter.common.utils.Assert; |
| 17 | import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; | 20 | import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; |
| 18 | -import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService; | 21 | +import org.apache.commons.lang3.StringUtils; |
| 19 | import org.springframework.transaction.annotation.Transactional; | 22 | import org.springframework.transaction.annotation.Transactional; |
| 20 | import com.lframework.xingyun.sc.mappers.ShipmentsPlanMapper; | 23 | import com.lframework.xingyun.sc.mappers.ShipmentsPlanMapper; |
| 21 | import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanService; | 24 | import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanService; |
| @@ -25,6 +28,7 @@ import com.lframework.xingyun.sc.vo.shipments.plan.UpdateShipmentsPlanVo; | @@ -25,6 +28,7 @@ import com.lframework.xingyun.sc.vo.shipments.plan.UpdateShipmentsPlanVo; | ||
| 25 | import org.springframework.stereotype.Service; | 28 | import org.springframework.stereotype.Service; |
| 26 | 29 | ||
| 27 | import javax.annotation.Resource; | 30 | import javax.annotation.Resource; |
| 31 | +import java.util.ArrayList; | ||
| 28 | import java.util.List; | 32 | import java.util.List; |
| 29 | 33 | ||
| 30 | @Service | 34 | @Service |
| @@ -33,12 +37,34 @@ public class ShipmentsPlanServiceImpl extends BaseMpServiceImpl<ShipmentsPlanMap | @@ -33,12 +37,34 @@ public class ShipmentsPlanServiceImpl extends BaseMpServiceImpl<ShipmentsPlanMap | ||
| 33 | 37 | ||
| 34 | 38 | ||
| 35 | @Resource | 39 | @Resource |
| 36 | - private PurchaseOrderLineService orderLineService; | 40 | + private SysRoleService sysRoleService; |
| 37 | 41 | ||
| 38 | @Override | 42 | @Override |
| 39 | public PageResult<ShipmentsPlan> query(Integer pageIndex, Integer pageSize, QueryShipmentsPlanVo vo) { | 43 | public PageResult<ShipmentsPlan> query(Integer pageIndex, Integer pageSize, QueryShipmentsPlanVo vo) { |
| 40 | Assert.greaterThanZero(pageIndex); | 44 | Assert.greaterThanZero(pageIndex); |
| 41 | Assert.greaterThanZero(pageSize); | 45 | Assert.greaterThanZero(pageSize); |
| 46 | + List<String> workshopCodeList = new ArrayList<>(); | ||
| 47 | + // 数据权限控制 | ||
| 48 | + String currentUserId = SecurityUtil.getCurrentUser().getId(); | ||
| 49 | + // 获取当前人所属角色 | ||
| 50 | + List<SysRole> roleList = sysRoleService.getByUserId(currentUserId); | ||
| 51 | + for (SysRole role : roleList) { | ||
| 52 | + String roleCode = role.getCode(); | ||
| 53 | + String workshopCode = ""; | ||
| 54 | + if ("yfcjybfhy".equals(roleCode) || "yfcjzcjjhy".equals(roleCode)) { | ||
| 55 | + workshopCode = "yfc"; | ||
| 56 | + } else if ("efcjybfhy".equals(roleCode) || "efcjzcjjhy".equals(roleCode)) { | ||
| 57 | + workshopCode = "efc"; | ||
| 58 | + } else if ("sfcjybfhy".equals(roleCode) || "sfcjzcjjhy".equals(roleCode)) { | ||
| 59 | + workshopCode = "sfc"; | ||
| 60 | + } else if ("ztfcjybfhy".equals(roleCode) || "ztfcjzcjjhy".equals(roleCode)) { | ||
| 61 | + workshopCode = "ztfc"; | ||
| 62 | + } | ||
| 63 | + if (StringUtils.isNotBlank(workshopCode)) { | ||
| 64 | + workshopCodeList.add(workshopCode); | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | + vo.setWorkshopCodeList(workshopCodeList); | ||
| 42 | // 开启分页 | 68 | // 开启分页 |
| 43 | PageHelperUtil.startPage(pageIndex, pageSize); | 69 | PageHelperUtil.startPage(pageIndex, pageSize); |
| 44 | List<ShipmentsPlan> dataList = this.query(vo); | 70 | List<ShipmentsPlan> dataList = this.query(vo); |
| @@ -6,6 +6,7 @@ import com.lframework.starter.web.core.vo.BaseVo; | @@ -6,6 +6,7 @@ import com.lframework.starter.web.core.vo.BaseVo; | ||
| 6 | import io.swagger.annotations.ApiModelProperty; | 6 | import io.swagger.annotations.ApiModelProperty; |
| 7 | import java.io.Serializable; | 7 | import java.io.Serializable; |
| 8 | import java.time.LocalDateTime; | 8 | import java.time.LocalDateTime; |
| 9 | +import java.util.List; | ||
| 9 | 10 | ||
| 10 | @Data | 11 | @Data |
| 11 | public class QueryShipmentsPlanVo extends PageVo implements BaseVo, Serializable { | 12 | public class QueryShipmentsPlanVo extends PageVo implements BaseVo, Serializable { |
| @@ -19,6 +20,12 @@ public class QueryShipmentsPlanVo extends PageVo implements BaseVo, Serializable | @@ -19,6 +20,12 @@ public class QueryShipmentsPlanVo extends PageVo implements BaseVo, Serializable | ||
| 19 | private String workshopId; | 20 | private String workshopId; |
| 20 | 21 | ||
| 21 | /** | 22 | /** |
| 23 | + * 生产厂编号 | ||
| 24 | + */ | ||
| 25 | + @ApiModelProperty("生产厂编号") | ||
| 26 | + private List<String> workshopCodeList; | ||
| 27 | + | ||
| 28 | + /** | ||
| 22 | * 状态 | 29 | * 状态 |
| 23 | */ | 30 | */ |
| 24 | @ApiModelProperty("状态") | 31 | @ApiModelProperty("状态") |
| @@ -70,6 +70,7 @@ | @@ -70,6 +70,7 @@ | ||
| 70 | AND c.name like concat('%', #{vo.customerName}, '%') | 70 | AND c.name like concat('%', #{vo.customerName}, '%') |
| 71 | </if> | 71 | </if> |
| 72 | </where> | 72 | </where> |
| 73 | + ORDER BY tb.create_time DESC | ||
| 73 | </select> | 74 | </select> |
| 74 | 75 | ||
| 75 | <insert id="batchAdd"> | 76 | <insert id="batchAdd"> |
| @@ -37,6 +37,12 @@ | @@ -37,6 +37,12 @@ | ||
| 37 | <if test="vo.workshopId != null and vo.workshopId != ''"> | 37 | <if test="vo.workshopId != null and vo.workshopId != ''"> |
| 38 | AND tb.workshop_id = #{vo.workshopId} | 38 | AND tb.workshop_id = #{vo.workshopId} |
| 39 | </if> | 39 | </if> |
| 40 | + <if test="vo.workshopCodeList != null and vo.workshopCodeList.size() > 0"> | ||
| 41 | + AND w.code IN | ||
| 42 | + <foreach collection="vo.workshopCodeList" open="(" separator="," close=")" item="item"> | ||
| 43 | + #{item} | ||
| 44 | + </foreach> | ||
| 45 | + </if> | ||
| 40 | <if test="vo.status != null and vo.status != ''"> | 46 | <if test="vo.status != null and vo.status != ''"> |
| 41 | AND tb.status = #{vo.status} | 47 | AND tb.status = #{vo.status} |
| 42 | </if> | 48 | </if> |
| @@ -47,6 +53,7 @@ | @@ -47,6 +53,7 @@ | ||
| 47 | AND tb.create_time <= #{vo.createEndTime} | 53 | AND tb.create_time <= #{vo.createEndTime} |
| 48 | </if> | 54 | </if> |
| 49 | </where> | 55 | </where> |
| 56 | + ORDER BY tb.create_time DESC | ||
| 50 | </select> | 57 | </select> |
| 51 | 58 | ||
| 52 | <select id="getById" resultType="com.lframework.xingyun.sc.entity.ShipmentsPlan"> | 59 | <select id="getById" resultType="com.lframework.xingyun.sc.entity.ShipmentsPlan"> |