计划管理相关功能实现
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package com.zt.plat.module.contractorder.api;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.module.contractorder.api.dto.order.OrderAndPlanDataReqDTO;
|
||||
import com.zt.plat.module.contractorder.api.dto.order.OrderDTO;
|
||||
import com.zt.plat.module.contractorder.api.dto.order.SalesOrdDtlDTO;
|
||||
import com.zt.plat.module.contractorder.api.dto.order.UpdateOrderLstQtyDTO;
|
||||
@@ -44,4 +46,8 @@ public interface OrderApi {
|
||||
@GetMapping(PREFIX + "/get-salas-order-details-by-id")
|
||||
@Operation(summary = "通过销售订单明细id获取销售订单详情", description = "通过销售订单明细id获取销售订单详情")
|
||||
CommonResult<SalesOrdDtlDTO> getSalesOrderDetailsByOrderId(@RequestParam("id") Long id);
|
||||
|
||||
@PostMapping(PREFIX + "/query-order-plan-data")
|
||||
@Operation(summary = "根据计划和订单的参数查询相关的订单", description = "根据计划和订单的参数查询相关的订单")
|
||||
CommonResult<PageResult<OrderDTO>> queryOrderPlanData(@RequestBody @Valid OrderAndPlanDataReqDTO reqVO);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.zt.plat.module.contractorder.api.dto.order;
|
||||
import com.zt.plat.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.Data;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@Data
|
||||
@Schema(description = "订单和计划数据请求DTO")
|
||||
@Validated
|
||||
public class OrderAndPlanDataReqDTO extends PageParam {
|
||||
//合同编号
|
||||
@Schema(description = "合同编号")
|
||||
private String contractSystemNumber;
|
||||
//纸质合同编号
|
||||
@Schema(description = "纸质合同编号")
|
||||
private String paperContractNumber;
|
||||
//订单号
|
||||
@Schema(description = "订单号")
|
||||
private String orderNumber;
|
||||
//订单分类
|
||||
@Schema(description = "订单分类")
|
||||
//@NotEmpty(message = "订单分类不能为空")
|
||||
private String orderType;
|
||||
//物料编码
|
||||
@Schema(description = "物料编码")
|
||||
private String materialNumber;
|
||||
//物料名称
|
||||
@Schema(description = "物料名称")
|
||||
private String materialName;
|
||||
//客商编码
|
||||
@Schema(description = "客商编码")
|
||||
private String customerNumber;
|
||||
//客商名称
|
||||
@Schema(description = "客商名称")
|
||||
private String customerName;
|
||||
//计划编号
|
||||
@Schema(description = "计划编号")
|
||||
@NotEmpty(message = "计划Id不能为空")
|
||||
private String planId;
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.zt.plat.module.contractorder.api;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.zt.plat.framework.common.exception.ErrorCode;
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
import com.zt.plat.module.contractorder.api.dto.order.*;
|
||||
import com.zt.plat.module.contractorder.dal.dataobject.purchaseorder.PrchOrdDtlDO;
|
||||
@@ -183,6 +184,13 @@ public class OrderApiImpl implements OrderApi {
|
||||
return success(BeanUtils.toBean(salesOrderDetailDOS, SalesOrdDtlDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<PageResult<OrderDTO>> queryOrderPlanData(OrderAndPlanDataReqDTO reqVO) {
|
||||
PageResult<PurchaseOrderDO> pageResult = purchaseOrderService.queryOrderAndPlanData(reqVO);
|
||||
List<OrderDTO> bean = BeanUtils.toBean(pageResult.getList(), OrderDTO.class);
|
||||
return success(new PageResult<>(bean, pageResult.getTotal()));
|
||||
}
|
||||
|
||||
private List<SalesOrderDO> getOrderByIds(List<Long> ids) {
|
||||
return SpringUtil.getBean(SalesOrderMapper.class).selectByIds(ids); // 采购订单与销售订单的
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
||||
|
||||
import com.zt.plat.module.contractorder.api.dto.order.OrderAndPlanDataReqDTO;
|
||||
import com.zt.plat.module.contractorder.controller.admin.purchaseorder.vo.PurchaseOrderPageReqVO;
|
||||
import com.zt.plat.module.contractorder.controller.admin.purchaseorder.vo.PurchaseOrderWithDetailsVO;
|
||||
import com.zt.plat.module.contractorder.dal.dataobject.purchaseorder.PurchaseOrderDO;
|
||||
@@ -71,4 +72,6 @@ public interface PurchaseOrderMapper extends BaseMapperX<PurchaseOrderDO> {
|
||||
List<PurchaseOrderWithDetailsVO> selectOrderByIds(@Param("ids") List<Long> id);
|
||||
|
||||
PurchaseOrderDO selectByOrderId(@Param("orderId") Long orderId);
|
||||
|
||||
List<PurchaseOrderDO> queryOrderAndPlanData(OrderAndPlanDataReqDTO reqDTO);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.zt.plat.module.contractorder.service.purchaseorder;
|
||||
import java.util.*;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.module.contractorder.api.dto.order.OrderAndPlanDataReqDTO;
|
||||
import com.zt.plat.module.contractorder.controller.admin.purchaseorder.vo.*;
|
||||
import com.zt.plat.module.contractorder.controller.admin.salesorder.vo.SalesOrderSaveReqVO;
|
||||
import com.zt.plat.module.contractorder.dal.dataobject.purchaseorder.PurchaseOrderDO;
|
||||
@@ -145,4 +146,12 @@ public interface PurchaseOrderService {
|
||||
* @return 订单详情
|
||||
*/
|
||||
List<PurchaseOrderDO> getOrdersByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 查询订单和计划数据
|
||||
*
|
||||
* @param reqDTO 查询条件
|
||||
* @return 订单和计划数据
|
||||
*/
|
||||
PageResult<PurchaseOrderDO> queryOrderAndPlanData(OrderAndPlanDataReqDTO reqDTO);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.zt.plat.module.bpm.api.task.BpmProcessInstanceApi;
|
||||
import com.zt.plat.module.bpm.api.task.BpmTaskApi;
|
||||
import com.zt.plat.module.bpm.api.task.dto.*;
|
||||
import com.zt.plat.module.bpm.enums.task.BpmProcessInstanceStatusEnum;
|
||||
import com.zt.plat.module.contractorder.api.dto.order.OrderAndPlanDataReqDTO;
|
||||
import com.zt.plat.module.contractorder.api.vo.contract.ContractRespVO;
|
||||
import com.zt.plat.module.contractorder.controller.admin.purchaseorder.vo.*;
|
||||
import com.zt.plat.module.contractorder.dal.dataobject.contract.SystemRelativityDO;
|
||||
@@ -698,6 +699,8 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
|
||||
return purchaseOrderMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor=Exception.class)
|
||||
public boolean orderPassReject(PurchaseorderReqVO purchaseorderReqVO) {
|
||||
@@ -788,4 +791,24 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
|
||||
int number = (int) (Math.random() * 900000 + 100000);
|
||||
return String.valueOf(number);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PurchaseOrderDO> queryOrderAndPlanData(OrderAndPlanDataReqDTO reqDTO) {
|
||||
// 1. 查询所有符合条件的数据
|
||||
List<PurchaseOrderDO> allData = purchaseOrderMapper.queryOrderAndPlanData(reqDTO);
|
||||
|
||||
// 2. 获取分页参数
|
||||
Integer pageSize = reqDTO.getPageSize();
|
||||
Integer pageNum = reqDTO.getPageNo();
|
||||
|
||||
// 3. 计算分页截取的起始/结束索引
|
||||
int startIndex = (pageNum - 1) * pageSize;
|
||||
int endIndex = Math.min(startIndex + pageSize, allData.size());
|
||||
|
||||
// 4. 截取当前页数据(索引越界时返回空列表)
|
||||
List<PurchaseOrderDO> pageData = startIndex >= allData.size()
|
||||
? new ArrayList<>()
|
||||
: allData.subList(startIndex, endIndex);
|
||||
return new PageResult<>(pageData, (long) allData.size());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,17 +237,23 @@
|
||||
|
||||
<select id="selectByOrderId"
|
||||
resultType="com.zt.plat.module.contractorder.dal.dataobject.purchaseorder.PurchaseOrderDO">
|
||||
select * from bse_prch_ord where sys_ord_num =#{orderId};
|
||||
select *
|
||||
from bse_prch_ord
|
||||
where sys_ord_num = #{orderId};
|
||||
</select>
|
||||
|
||||
|
||||
<resultMap id="PurchaseOrderWithDetailsResultMap" type="com.zt.plat.module.contractorder.controller.admin.purchaseorder.vo.PurchaseOrderWithDetailsVO">
|
||||
<resultMap id="PurchaseOrderWithDetailsResultMap"
|
||||
type="com.zt.plat.module.contractorder.controller.admin.purchaseorder.vo.PurchaseOrderWithDetailsVO">
|
||||
<result column="SYS_ORD_NUM" property="systemOrderNumber"/>
|
||||
<association property="purchaseOrder" resultMap="PurchaseOrderResultMap"/>
|
||||
<collection property="orderDetails" ofType="com.zt.plat.module.contractorder.dal.dataobject.purchaseorder.PrchOrdDtlDO" resultMap="PrchOrdDtlResultMap"/>
|
||||
<collection property="orderDetails"
|
||||
ofType="com.zt.plat.module.contractorder.dal.dataobject.purchaseorder.PrchOrdDtlDO"
|
||||
resultMap="PrchOrdDtlResultMap"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="PurchaseOrderResultMap" type="com.zt.plat.module.contractorder.dal.dataobject.purchaseorder.PurchaseOrderDO">
|
||||
<resultMap id="PurchaseOrderResultMap"
|
||||
type="com.zt.plat.module.contractorder.dal.dataobject.purchaseorder.PurchaseOrderDO">
|
||||
<id column="po_id" property="id"/>
|
||||
<result column="ORD_SAP_NUM" property="orderSAPNumber"/>
|
||||
<result column="SYS_ORD_NUM" property="systemOrderNumber"/>
|
||||
@@ -298,7 +304,8 @@
|
||||
<result column="SALE_ACS_NAME" property="saleAcsName"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="PrchOrdDtlResultMap" type="com.zt.plat.module.contractorder.dal.dataobject.purchaseorder.PrchOrdDtlDO">
|
||||
<resultMap id="PrchOrdDtlResultMap"
|
||||
type="com.zt.plat.module.contractorder.dal.dataobject.purchaseorder.PrchOrdDtlDO">
|
||||
<id column="pod_id" property="id"/>
|
||||
<result column="ORD_ID" property="ordId"/>
|
||||
<result column="LINE_NUM" property="lineNum"/>
|
||||
@@ -346,4 +353,98 @@
|
||||
<result column="ELEM_ABBR" property="elemAbbr"/>
|
||||
<result column="ELEM_NAME" property="elemName"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="PlanOrderResultMap"
|
||||
type="com.zt.plat.module.contractorder.dal.dataobject.purchaseorder.PurchaseOrderDO">
|
||||
<id column="ID" property="id"/>
|
||||
<result column="ORD_SAP_NUM" property="orderSAPNumber"/>
|
||||
<result column="SYS_ORD_NUM" property="systemOrderNumber"/>
|
||||
<result column="CPN_NAME" property="cpName"/>
|
||||
<result column="CPN_NUM" property="cpNum"/>
|
||||
<result column="SPLR_NUM" property="supplierNumber"/>
|
||||
<result column="SPLR_NAME" property="supplierName"/>
|
||||
<result column="TP" property="type"/>
|
||||
<result column="VCHR_DT" property="voucherDate"/>
|
||||
<result column="PRCH_ORGZ_CD" property="purchaseOrganizationCustomsDeclaration"/>
|
||||
<result column="RCV_FACT_NAME" property="receiveFactoryName"/>
|
||||
<result column="RCV_FACT_NUM" property="receiveFactoryNumber"/>
|
||||
<result column="RCV_WRH_NAME" property="receiveWarehouseName"/>
|
||||
<result column="RCV_WRH_NUM" property="receiveWarehouseNumber"/>
|
||||
<result column="PRCH_GRP" property="purchaseGroup"/>
|
||||
<result column="CUR_NUM" property="currencyNumber"/>
|
||||
<result column="EXCH_RTE" property="exchangeRate"/>
|
||||
<result column="PPR_CTRT_NUM" property="paperContractNumber"/>
|
||||
<result column="AGR_NUM" property="agreementNumber"/>
|
||||
<result column="RMK" property="remark"/>
|
||||
<result column="MTNG_TP" property="meteringType"/>
|
||||
<result column="AGT_NUM" property="agentNumber"/>
|
||||
<result column="AGT_NAME" property="agentName"/>
|
||||
<result column="CTRT_NUM" property="contractNumber"/>
|
||||
<result column="MTRL_NUM" property="materialNumber"/>
|
||||
<result column="MTRL_NAME" property="materialName"/>
|
||||
<result column="CTRT_NAME" property="contractName"/>
|
||||
<result column="TNT_NUM" property="tenantNumber"/>
|
||||
<result column="ERP_PRCH_CPN_NUM" property="erpPurchaseCompanyNumber"/>
|
||||
<result column="ERP_PRCH_CPN_NAME" property="erpPurchaseCompanyName"/>
|
||||
<result column="ERP_SALE_CPN_NUM" property="erpSalesCompanyNumber"/>
|
||||
<result column="ERP_SALE_CPN_NAME" property="erpSalesCompanyName"/>
|
||||
<result column="PRCH_ORGZ_NAME" property="purchaseOrganizationName"/>
|
||||
<result column="ERP_STS" property="erpStatus"/>
|
||||
<result column="CAUS" property="cause"/>
|
||||
<result column="STS" property="status"/>
|
||||
<result column="PRCH_GRP_NAME" property="purchaseGroupName"/>
|
||||
<result column="PRCS_INSC_ID" property="processInstanceId"/>
|
||||
<result column="RVW_ONN" property="reviewOpinion"/>
|
||||
<result column="TSK_NDE_ID" property="taskId"/>
|
||||
<result column="IS_PUSH" property="isPush"/>
|
||||
<result column="UNT" property="unt"/>
|
||||
<result column="MTRL_TP" property="mtrlTp"/>
|
||||
<result column="SPLY_BSN_TP" property="splyBsnTp"/>
|
||||
<result column="PDT_GRP_CDG" property="pdtGrpCdg"/>
|
||||
<result column="PDT_GRP_NAME" property="pdtGrpName"/>
|
||||
<result column="SALE_ACS_CDG" property="saleAcsCdg"/>
|
||||
<result column="SALE_ACS_NAME" property="saleAcsName"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="queryOrderAndPlanData"
|
||||
parameterType="com.zt.plat.module.contractorder.api.dto.order.OrderAndPlanDataReqDTO"
|
||||
resultMap="PlanOrderResultMap"> <!-- 也可以替换为具体的实体类类型 -->
|
||||
SELECT
|
||||
po.*
|
||||
FROM
|
||||
BSE_PRCH_ORD po
|
||||
INNER JOIN BSE_PLN_ORD_CORR oc ON po.SYS_ORD_NUM = oc.ORD_NUM
|
||||
WHERE
|
||||
po.deleted=0
|
||||
AND oc.deleted=0
|
||||
<if test="orderType != null and orderType != ''">
|
||||
AND po.SPLY_BSN_TP = #{orderType}
|
||||
</if>
|
||||
<if test="materialNumber != null and materialNumber != ''">
|
||||
AND po.MTRL_NUM = #{materialNumber}
|
||||
</if>
|
||||
<if test="materialName != null and materialName != ''">
|
||||
AND po.MTRL_NAME = #{materialName}
|
||||
</if>
|
||||
<if test="customerNumber != null and customerNumber != ''">
|
||||
AND po.ERP_SALE_CPN_NUM = #{customerNumber}
|
||||
</if>
|
||||
<if test="customerName != null and customerName != ''">
|
||||
AND po.ERP_SALE_CPN_NAME = #{customerName}
|
||||
</if>
|
||||
<if test="orderNumber != null and orderNumber != ''">
|
||||
AND po.SYS_ORD_NUM = #{orderNumber}
|
||||
</if>
|
||||
<if test="contractSystemNumber != null and contractSystemNumber != ''">
|
||||
AND po.CTRT_NUM = #{contractSystemNumber}
|
||||
</if>
|
||||
<!-- 纸质合同编号:参数非空时才拼接条件 -->
|
||||
<if test="paperContractNumber != null and paperContractNumber != ''">
|
||||
AND po.PPR_CTRT_NUM = #{paperContractNumber}
|
||||
</if>
|
||||
<if test="planId != null and planId != ''">
|
||||
AND oc.PLN_ID = #{planId}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user