生产单板件-获得生产单板件接口参数修改

This commit is contained in:
liuzhaotian
2024-05-15 16:02:54 +08:00
parent 5260d7c9a3
commit e4859249d3
11 changed files with 237 additions and 10 deletions
@@ -66,11 +66,12 @@ public class PlateController {
@GetMapping("/get")
@Operation(summary = "获得生产单板件")
@Parameter(name = "id", description = "板件ID", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('executor:plate:query')")
public CommonResult<PlateRespVO> getPlate(@RequestParam("id") Long id) {
PlateDO plate = plateService.getPlate(id);
return success(BeanUtils.toBean(plate, PlateRespVO.class));
public CommonResult<List<PlateRespVO>> getPlate(@Valid PlateDetailReqVO reqVO) {
List<PlateRespVO> plate = plateService.getPlate(reqVO);
return success(plate);
}
@GetMapping("/page")
@@ -0,0 +1,27 @@
package com.cf.imes.module.executor.controller.admin.plate.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "管理后台 - 查询生产单板件对应详细信息")
@Data
public class PlateDetailReqVO {
@Schema(description = "板件 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14195")
private Long plateId;
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11087")
private Long orderId;
@Schema(description = "柜体ID", example = "11087")
private Long bodyId;
}
@@ -0,0 +1,26 @@
package com.cf.imes.module.executor.controller.admin.plate.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "管理后台 - 生产单的大板-余料板等信息")
@Data
public class PlateDetailRespVO {
@Schema(description = "大板数量")
private Long bigPlateNum;
@Schema(description = "余料板数量")
private Long remainPlateNum;
@Schema(description = "排单状态")
private Long planStatus;
@Schema(description = "用户ID")
private Long companyId;
}
@@ -174,6 +174,52 @@ public class PlateRespVO {
@Schema(description = "板材材质")
private String material;
@Schema(description = "柜体名称")
private String bodyName;
@Schema(description = "房间名称")
private String roomName;
@Schema(description = "生产单明细ID")
private Long itemId;
@Schema(description = "加工组ID")
private Long processGroupId;
@Schema(description = "大板数量")
private Long bigPlateNum;
@Schema(description = "余料板数量")
private Long remainPlateNum;
@Schema(description = "品牌")
private String brand;
@Schema(description = "用户ID")
private Long companyId;
@Schema(description = "有纹路")
private String hasTexture;
@Schema(description = "大板长度")
private BigDecimal bigPlateLength;
@Schema(description = "大板宽度")
private BigDecimal bigPlateWidth;
@Schema(description = "规格")
private String spec;
@Schema(description = "排单状态")
private Long planStatus;
@Schema(description = "小板详情列表")
private List<PlateDetailVO> plateDetailList;
@@ -5,6 +5,7 @@ import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderModuleRespVO;
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.PlateRespVO;
import com.cf.imes.module.executor.dal.dataobject.orderItem.OrderItemDO;
import com.cf.imes.module.executor.dal.dataobject.orderModuleExtra.OrderModuleExtraDO;
@@ -27,4 +28,7 @@ public interface OrderItemMapper extends BaseMapperX<OrderItemDO> {
List<OrderPlatesDetailRespVO> selectPartsByOrderId(@Param("orderId") Long orderId);
List<PlateRespVO> selectPlateList(PlateDetailReqVO reqVO);
}
@@ -92,4 +92,6 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
IPage<PlateRespVO> selectProductList(@Param("page") IPage<PlateRespVO> page , @Param("orderId")Long orderId, @Param("roomId")Long roomId , @Param("bodyId")Long bodyId);
Set<Long> selectBatchOrderIdsAndGoodsIds(@Param("itemList") List<PlanSaveReqVO.Item> itemList);
PlateDetailRespVO selectPlateNumList(PlateDetailReqVO reqVO);
}
@@ -41,10 +41,10 @@ public interface PlateService {
/**
* 获得生产单板件
*
* @param id 编号
* @param
* @return 生产单板件
*/
PlateDO getPlate(Long id);
List<PlateRespVO> getPlate(PlateDetailReqVO reqVO);
/**
* 获得生产单板件分页
@@ -1,5 +1,6 @@
package com.cf.imes.module.executor.service.plate;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import co.elastic.clients.elasticsearch.ElasticsearchClient;
@@ -15,6 +16,8 @@ import com.cf.imes.framework.common.exception.ServiceException;
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
import com.cf.imes.framework.es.core.service.ESDocumentService;
import com.cf.imes.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.cf.imes.framework.security.core.LoginUser;
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
import com.cf.imes.module.executor.controller.admin.goods.vo.GoodsSaveReqVO;
import com.cf.imes.module.executor.dal.dataobject.orderItem.OrderItemDO;
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelDO;
@@ -103,8 +106,36 @@ public class PlateServiceImpl implements PlateService {
}
@Override
public PlateDO getPlate(Long id) {
return plateMapper.selectById(id);
public List<PlateRespVO> getPlate(PlateDetailReqVO reqVO) {
// 获取到当前登录用户的信息
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
// 查询生产单下的大板。余料板,排单状态的信息
PlateDetailRespVO plateDetailRespVO = plateMapper.selectPlateNumList(reqVO);
plateDetailRespVO.setCompanyId(loginUser.getId());
// PlateRespVO plateRespVO = BeanUtil.toBean(plateDetailRespVO, PlateRespVO.class);
// 查询生产单下的板材详细信息
List<PlateRespVO> plateRespVOS = orderItemMapper.selectPlateList(reqVO);
// List<PlateRespVO> plateRespVOS2 = plateRespVOS
// .stream()
// .map(item -> BeanUtil.toBean(plateDetailRespVO, PlateRespVO.class))
// .collect(Collectors.toList());
// 将大板等信息循环插入
for (PlateRespVO respVO : plateRespVOS) {
respVO.setCompanyId(plateDetailRespVO.getCompanyId());
respVO.setPlanStatus(plateDetailRespVO.getPlanStatus());
respVO.setBigPlateNum(plateDetailRespVO.getBigPlateNum());
respVO.setRemainPlateNum(plateDetailRespVO.getRemainPlateNum());
}
return plateRespVOS;
}
@Override
@@ -198,6 +229,14 @@ public class PlateServiceImpl implements PlateService {
private List<OrderModelDO> buildRespByPlateIds(Collection<Long> plateIds, String index) {
//
// // 使用Stream API将 Collection<Long> 转换成 Collection<String>
// Collection<String> stringPlateIds = plateIds.stream()
// .map(String::valueOf) // 将Long类型的元素转换成String类型
// .collect(Collectors.toList()); // 收集到一个新的List中
List<FieldValue> fieldValues = plateIds.stream().map(FieldValue::of).toList();
SearchRequest.Builder builder = new SearchRequest.Builder();
builder.index(index);
@@ -42,4 +42,61 @@
RIGHT JOIN `order_parts` p ON i.parts_id = p.id
WHERE i.order_id = #{orderId}
</select>
<resultMap id="PlateListMap" type="com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO">
<result property="color" column="color"/>
<result property="material" column="material"/>
<result property="bodyName" column="bodyName"/>
<result property="roomName" column="roomName"/>
<result property="itemId" column="itemId"/>
<result property="processGroupId" column="processGroupId"/>
<result property="brand" column="brand"/>
<result property="hasTexture" column="hasTexture"/>
<result property="bigPlateLength" column="bigPlateLength"/>
<result property="bigPlateWidth" column="bigPlateWidth"/>
<result property="spec" column="spec"/>
</resultMap>
<select id="selectPlateList"
resultMap="PlateListMap"
parameterType="com.cf.imes.module.executor.controller.admin.plate.vo.PlateDetailReqVO">
select distinct
op.*,
og.color as color,
og.material as material,
ob.name as bodyName,
ob.room_name as roomName,
oi.id as itemId,
oi.group_id as processGroupId,
og.brand as brand,
(case
when p.texture = '' then '是'
else '否' end ) as hasTexture,
og.height as bigPlateLength,
og.width as bigPlateWidth,
og.spec as spec
from order_item oi
join order_plate op on oi.plate_id = op.id
join order_body ob on oi.body_id = ob.id
join order_goods og on op.goods_id = og.id
join plate p on og.goods_id = p.id
<where>
<if test="orderId != null and orderId != ''">
AND oi.order_id = #{orderId}
</if>
<if test="bodyId != null and bodyId != ''">
AND oi.body_id = #{bodyId}
</if>
<if test="plateId != null and plateId != ''">
AND oi.plate_id = #{plateId}
</if>
</where>
</select>
</mapper>
@@ -84,4 +84,31 @@
(#{item.orderId},#{item.goodsId})
</foreach>
</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"
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;
</select>
</mapper>