mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-14 05:42:06 +08:00
新增排单-板材分组接口修改
This commit is contained in:
+19
@@ -0,0 +1,19 @@
|
|||||||
|
package com.cf.imes.module.executor.controller.admin.plan.bo;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public class GoodsNum {
|
||||||
|
|
||||||
|
@Schema(description = "生产单ID")
|
||||||
|
private Long orderId;
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "商品数量")
|
||||||
|
private Long goodsNum;
|
||||||
|
|
||||||
|
}
|
||||||
+6
-3
@@ -52,8 +52,6 @@ public class PlanSaveReqVO {
|
|||||||
@Schema(description = "生产单id与商品id 列表",requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "生产单id与商品id 列表",requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
private List<Item> itemList;
|
private List<Item> itemList;
|
||||||
|
|
||||||
@Schema(description = "商品数量")
|
|
||||||
private Long goodsNum;
|
|
||||||
|
|
||||||
@Schema(description = "备注")
|
@Schema(description = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
@@ -69,10 +67,15 @@ public class PlanSaveReqVO {
|
|||||||
@Valid
|
@Valid
|
||||||
@Data
|
@Data
|
||||||
public static class Item {
|
public static class Item {
|
||||||
|
|
||||||
|
@Schema(description = "生产单的商品id")
|
||||||
|
@NotNull
|
||||||
|
private Long id;
|
||||||
|
|
||||||
@Schema(description = "生产单id")
|
@Schema(description = "生产单id")
|
||||||
@NotNull
|
@NotNull
|
||||||
private Long orderId;
|
private Long orderId;
|
||||||
@Schema(description = "商品id")
|
@Schema(description = "板材库大板id")
|
||||||
@NotNull
|
@NotNull
|
||||||
private Long goodsId;
|
private Long goodsId;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
@@ -13,6 +13,7 @@ import com.cf.imes.framework.common.pojo.PageResult;
|
|||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.plan.bo.GoodsNum;
|
||||||
import com.cf.imes.module.executor.controller.admin.plan.bo.OrderIds;
|
import com.cf.imes.module.executor.controller.admin.plan.bo.OrderIds;
|
||||||
import com.cf.imes.module.executor.controller.admin.plan.vo.*;
|
import com.cf.imes.module.executor.controller.admin.plan.vo.*;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.orderGroup.OrderGroupDO;
|
import com.cf.imes.module.executor.dal.dataobject.orderGroup.OrderGroupDO;
|
||||||
@@ -135,4 +136,6 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
|||||||
|
|
||||||
void deletedById(@Param("plateIds") List<Long> plateIds, @Param("organId") Long organId);
|
void deletedById(@Param("plateIds") List<Long> plateIds, @Param("organId") Long organId);
|
||||||
|
|
||||||
|
List<GoodsNum> selectGoodsNum(@Param("orderIds") List<Long> orderIds,@Param("organId") Long organId);
|
||||||
|
|
||||||
}
|
}
|
||||||
+22
-3
@@ -15,6 +15,7 @@ import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|||||||
import com.cf.imes.framework.mybatis.core.query.MPJLambdaWrapperX;
|
import com.cf.imes.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||||
import com.cf.imes.framework.mybatis.core.query.QueryWrapperX;
|
import com.cf.imes.framework.mybatis.core.query.QueryWrapperX;
|
||||||
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderRespVO;
|
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderRespVO;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.plan.bo.GoodsNum;
|
||||||
import com.cf.imes.module.executor.controller.admin.plan.bo.OrderIds;
|
import com.cf.imes.module.executor.controller.admin.plan.bo.OrderIds;
|
||||||
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO;
|
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO;
|
||||||
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
|
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
|
||||||
@@ -107,14 +108,28 @@ public class PlanServiceImpl implements PlanService {
|
|||||||
plan.setIsPay(Boolean.FALSE);
|
plan.setIsPay(Boolean.FALSE);
|
||||||
plan.setSort(0L);
|
plan.setSort(0L);
|
||||||
plan.setPlanNo(identifierGenerator.nextId(null).toString());
|
plan.setPlanNo(identifierGenerator.nextId(null).toString());
|
||||||
String orderNos = itemList.stream().map(i -> i.getOrderId()).distinct().collect(Collectors.toList()).toString();
|
String orderNos = itemList.stream().map(PlanSaveReqVO.Item::getOrderId).distinct().toList().toString();
|
||||||
plan.setOrderNos(orderNos);
|
plan.setOrderNos(orderNos);
|
||||||
planMapper.insert(plan);
|
planMapper.insert(plan);
|
||||||
|
|
||||||
// 修改对应的生产单的状态为 生产中
|
// 修改对应的生产单的状态为 生产中
|
||||||
List<Long> orderIds = JSON.parseArray(orderNos).toJavaList(Long.class);
|
List<Long> orderIds = JSON.parseArray(orderNos).toJavaList(Long.class);
|
||||||
List<OrderDO> orderDOS = orderMapper.selectBatchIds(orderIds).stream().map(m -> m.setStatus(OrderStatusEnum.IN_PRODUCTION.getStatus())).collect(Collectors.toList());
|
|
||||||
orderMapper.updateBatch(orderDOS);
|
List<GoodsNum> goodsNums = plateMapper.selectGoodsNum(orderIds, getUserOrganId());
|
||||||
|
|
||||||
|
for (Long orderId : orderIds) {
|
||||||
|
|
||||||
|
// 传入的生产单的大板数量
|
||||||
|
int size1 = itemList.stream().filter(f -> Objects.equals(f.getOrderId(), orderId)).map(PlanSaveReqVO.Item::getGoodsId).distinct().toList().size();
|
||||||
|
// 当前生产单对应的大板数量
|
||||||
|
List<Long> list = goodsNums.stream().filter(f -> Objects.equals(f.getOrderId(), orderId)).map(GoodsNum::getGoodsNum).toList();
|
||||||
|
|
||||||
|
if(size1 == list.get(0)){
|
||||||
|
OrderDO orderDO = orderMapper.selectById(orderId).setStatus(OrderStatusEnum.IN_PRODUCTION.getStatus());
|
||||||
|
orderMapper.updateById(orderDO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Long planId = plan.getId();
|
Long planId = plan.getId();
|
||||||
|
|
||||||
@@ -426,6 +441,10 @@ public class PlanServiceImpl implements PlanService {
|
|||||||
|
|
||||||
List<Long> orderIds = orderMapper.selectOrderIds(queryWrapperX);
|
List<Long> orderIds = orderMapper.selectOrderIds(queryWrapperX);
|
||||||
|
|
||||||
|
if(orderIds.isEmpty()){
|
||||||
|
return new PageResult<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
List<OrderIds> orderIdsList = plateMapper.selectOrderIds(orderIds,getUserOrganId());
|
List<OrderIds> orderIdsList = plateMapper.selectOrderIds(orderIds,getUserOrganId());
|
||||||
|
|
||||||
|
|||||||
+31
-1
@@ -72,7 +72,7 @@
|
|||||||
and
|
and
|
||||||
op.goods_id in
|
op.goods_id in
|
||||||
<foreach collection="itemList" item="item" open="(" close=")" separator=",">
|
<foreach collection="itemList" item="item" open="(" close=")" separator=",">
|
||||||
(#{item.goodsId})
|
(#{item.id})
|
||||||
</foreach>
|
</foreach>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
@@ -452,4 +452,34 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
order by a.order_id
|
order by a.order_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectGoodsNum" resultType="com.cf.imes.module.executor.controller.admin.plan.bo.GoodsNum">
|
||||||
|
|
||||||
|
|
||||||
|
select distinct
|
||||||
|
a.order_id as orderId,
|
||||||
|
count(distinct c.id) as goodsNum
|
||||||
|
from order_plate a
|
||||||
|
LEFT JOIN order_item oi on a.id = oi.plate_id and a.order_id = oi.order_id and a.organ_id = oi.organ_id
|
||||||
|
LEFT JOIN `orders` b on a.order_id = b.id and a.organ_id = b.organ_id
|
||||||
|
LEFT JOIN order_goods c on a.goods_id = c.id and a.organ_id = c.organ_id
|
||||||
|
left join order_plan_item opi on oi.id = opi.item_id and oi.organ_id = opi.organ_id
|
||||||
|
where
|
||||||
|
c.organ_id = #{organId}
|
||||||
|
and a.is_cancel = 0
|
||||||
|
and b.status = 2
|
||||||
|
and a.deleted = false
|
||||||
|
and opi.item_id is null
|
||||||
|
and c.order_id in
|
||||||
|
<foreach collection="orderIds" item="orderIds" open="(" close=")" separator=",">
|
||||||
|
#{orderIds}
|
||||||
|
</foreach>
|
||||||
|
|
||||||
|
group by orderId
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user