排单接口 -- 查询未排单的生产单列表bug修改,api数据导入异常数据回滚

This commit is contained in:
liuzhaotian
2024-05-24 15:03:09 +08:00
parent f247866769
commit 7d14c155a8
10 changed files with 78 additions and 22 deletions
@@ -169,9 +169,12 @@ public class PlateDetialRespVO {
@Schema(description = "加工组名称", requiredMode = Schema.RequiredMode.REQUIRED)
private String processGroupName;
@Schema(description = "开门类型,0 无 1 左 2 右 3 上 4 下", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
private Integer openDoorType;
@Schema(description = "是否有孔", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
private Boolean hasHole;
@@ -6,6 +6,7 @@ import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderModuleRe
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPlatesDetailRespVO;
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRespVO;
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateDetailReqVO;
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateDetailRespVO;
import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO;
import com.cf.imes.module.executor.dal.dataobject.orderItem.OrderItemDO;
import com.cf.imes.module.executor.dal.dataobject.orderModuleExtra.OrderModuleExtraDO;
@@ -31,4 +32,7 @@ public interface OrderItemMapper extends BaseMapperX<OrderItemDO> {
List<PlateRespVO> selectPlateList(PlateDetailReqVO reqVO);
PlateDetailRespVO selectPlateNumList(@Param("orderId") Long orderId);
}
@@ -71,7 +71,7 @@ public interface PlanMapper extends BaseMapperX<PlanDO> {
default PlanDO selectByOrderId(Long orderId) {
return selectOne(new MPJLambdaWrapperX<PlanDO>()
.eqIfPresent(PlanDO::getOrderNos, orderId));
.like(PlanDO::getOrderNos, orderId));
}
}
@@ -90,7 +90,7 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
Set<Long> selectBatchOrderIdsAndGoodsIds(@Param("itemList") List<PlanSaveReqVO.Item> itemList);
PlateDetailRespVO selectPlateNumList(PlateDetailReqVO reqVO);
// PlateDetailRespVO selectPlateNumList(PlateDetailReqVO reqVO);
List<PlateDetialRespVO> selectPlateDetialList(@Param("orderId") Long orderId);
@@ -6,6 +6,8 @@ import com.alibaba.fastjson.JSONObject;
import cn.smallbun.screw.core.util.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants;
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator;
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
import com.cf.imes.module.executor.controller.admin.order.vo.order.*;
@@ -37,11 +39,13 @@ import com.cf.imes.module.executor.util.fileConversion.admin.api.webcad.ApiTypeR
import com.cf.imes.module.executor.util.fileConversion.admin.files.excel.ExcelTypeRealize;
import com.cf.imes.module.system.api.application.ApplicationApi;
import com.cf.imes.module.system.api.user.AdminUserApi;
import com.cf.imes.module.system.enums.ErrorCodeConstants;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.validation.annotation.Validated;
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
@@ -278,6 +282,7 @@ public class OrderServiceImpl implements OrderService {
}
@Override
@Transactional(rollbackFor = Exception.class)
public Long importApiData(String orderNo) {
// 获取token
Long organId = SecurityFrameworkUtils.getLoginUser().getOrganId();
@@ -410,11 +415,15 @@ public class OrderServiceImpl implements OrderService {
goodsDO = (List<GoodsDO>) map.get("goodsDO");
List<PlateGoodDO> plateGoodDOS = (List<PlateGoodDO>) map.get("plateGoodDOLists");
validateCustomOrderNoExists(order.get(0).getCustomOrderNo());
orderInputProcessor.batchInsert(rawGoodsDO, bodyDO, groupDO, partsDO, plateDO, null, itemDO, order.get(0),goodsDO,plateGoodDOS);
List<OrderModelDO> orderModelDOs = BeanUtils.toBean(plateDetail, OrderModelDO.class);
orderModelDOs.forEach(orderModelDO -> orderModelDO.setOrderId(order.get(0).getId()));
orderInputProcessor.batchSaveModel(orderModelDOs);
// System.out.println("plateDO = " + plateDO+ " BeanUtils.toBean(plateDetail, OrderModelDO.class) = " + orderModelDOs);
return order.get(0).getId();
}
@@ -270,7 +270,7 @@ public class PlanServiceImpl implements PlanService {
.eqIfPresent("op.is_door", pageReqVO.getIsDoor())
.betweenIfPresent("op.height", new BigDecimal[]{pageReqVO.getLongMinRang(), pageReqVO.getLongMaxRang()})
.betweenIfPresent("op.width", new BigDecimal[]{pageReqVO.getWidthMinRang(), pageReqVO.getWidthMaxRang()})
.groupBy("a.id","og.id")
.groupBy("a.id","og.id","og.goods_name","og.color","og.material","op.goods_id")
.orderByDesc("a.create_time");
List<Integer> filterTypes = new ArrayList<>();
if (Objects.nonNull(pageReqVO.getHoleThrough()) && pageReqVO.getHoleThrough()) {
@@ -112,7 +112,8 @@ public class PlateServiceImpl implements PlateService {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
// 查询生产单下的大板,余料板,排单状态的信息
PlateDetailRespVO plateDetailRespVO = plateMapper.selectPlateNumList(reqVO);
PlateDetailRespVO plateDetailRespVO = orderItemMapper.selectPlateNumList(reqVO.getOrderId());
// PlateDetailRespVO plateDetailRespVO = plateMapper.selectPlateNumList(reqVO);
plateDetailRespVO.setCompanyId(loginUser.getId());
// PlateRespVO plateRespVO = BeanUtil.toBean(plateDetailRespVO, PlateRespVO.class);
@@ -7,7 +7,7 @@
og.goods_name, og.color, og.material, op.goods_id, count(op.id) as num, sum(op.area) as area
from `order` a
inner join order_plate op on a.id = op.order_id and op.is_cancel = 0
inner join order_goods og on op.goods_id = og.goods_id
inner join order_goods og on op.goods_id = og.id
left join order_item oi on a.id = oi.order_id
left join order_plan_item opi on oi.id = opi.item_id
${ew.customSqlSegment}
@@ -99,4 +99,34 @@
</where>
</select>
<resultMap id="PlateNumListMap" type="com.cf.imes.module.executor.controller.admin.plate.vo.PlateDetailRespVO">
<result property="bigPlateNum" column="bigPlateNum"/>
<result property="planStatus" column="planStatus"/>
<result property="remainPlateNum" column="remainPlateNum"/>
</resultMap>
<select id="selectPlateNumList"
resultMap="PlateNumListMap"
resultType="java.lang.Long">
select distinct
count(distinct og.id) as bigPlateNum,
op.status as planStatus,
sum(orp.count )as remainPlateNum
from order_item oi
join order_plan_item opi on oi.id = opi.item_id
join order_plan op on opi.plan_id = op.id
left join order_remain_plate orp on orp.plan_id = op.id
join order_goods og on oi.order_id = og.order_id
where oi.order_id = #{orderId}
group by planStatus;
</select>
</mapper>
@@ -89,26 +89,35 @@
<resultMap id="PlateNumListMap" type="com.cf.imes.module.executor.controller.admin.plate.vo.PlateDetailRespVO">
<!-- <resultMap id="PlateNumListMap" type="com.cf.imes.module.executor.controller.admin.plate.vo.PlateDetailRespVO">-->
<result property="bigPlateNum" column="bigPlateNum"/>
<result property="planStatus" column="planStatus"/>
<result property="remainPlateNum" column="remainPlateNum"/>
</resultMap>
<select id="selectPlateNumList"
resultMap="PlateNumListMap"
parameterType="com.cf.imes.module.executor.controller.admin.plate.vo.PlateDetailReqVO">
<!--&lt;!&ndash; <result property="bigPlateNum" column="bigPlateNum"/>&ndash;&gt;-->
<!-- <result property="planStatus" column="planStatus"/>-->
<!-- <result property="remainPlateNum" column="remainPlateNum"/>-->
<!-- </resultMap>-->
<!-- <select id="selectPlateNumList"-->
<!-- resultMap="PlateNumListMap"-->
<!-- parameterType="com.cf.imes.module.executor.controller.admin.plate.vo.PlateDetailReqVO">-->
select count(distinct og.id) as bigPlateNum,
op.status as planStatus,
orp.count as remainPlateNum
from order_goods og
left join order_plan op on og.order_id = op.order_nos
left join order_remain_plate orp on op.id = orp.plan_id
where order_id = #{orderId}
group by planStatus,remainPlateNum;
<!--&#45;&#45; select count(distinct og.id) as bigPlateNum,-->
<!--&#45;&#45; op.status as planStatus,-->
<!--&#45;&#45; orp.count as remainPlateNum-->
<!--&#45;&#45; from order_goods og-->
<!--&#45;&#45; left join order_plan op on og.order_id = op.order_nos-->
<!--&#45;&#45; left join order_remain_plate orp on op.id = orp.plan_id-->
<!--&#45;&#45; where order_id = #{orderId}-->
<!--&#45;&#45; group by planStatus,remainPlateNum;-->
<!-- select distinct-->
<!-- op.status as planStatus,-->
<!-- sum(orp.count ) as remainPlateNum-->
<!-- from order_plan op-->
<!-- join order_plan_item opi on op.id = opi.plan_id-->
<!-- join order_item oi on oi.id = opi.item_id-->
<!-- join order_remain_plate orp on op.id = orp.plan_id-->
<!-- where oi.order_id = #{orderId}-->
<!-- group by planStatus;-->
</select>
<!-- </select>-->