Merge remote-tracking branch 'origin/dev' into test
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.zt.plat.module.contractorder.api.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -185,6 +186,9 @@ public class PurchaseOrderWithDetailsDTO {
|
||||
* 物料类型
|
||||
*/
|
||||
private String mtrlTp;
|
||||
|
||||
/**
|
||||
* 订单类型
|
||||
*/
|
||||
private String splyBsnTp;
|
||||
private List<PrchOrdDtlDTO> orderDetails;
|
||||
}
|
||||
|
||||
@@ -26,4 +26,5 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode CONTRACT_ERP_RCV_DLVY_NOT_EXISTS = new ErrorCode(1_027_000_011, "不存在的收支类型或收支类型为空");
|
||||
ErrorCode CONTRACT_STATUS_NOT_ARCHIVE = new ErrorCode(1_027_000_012, "{}状态合同不允许归档");
|
||||
ErrorCode CONTRACT_STATUS_NOT_SUBMIT_ERP = new ErrorCode(1_027_000_013, "{}状态合同不允许提交ERP");
|
||||
ErrorCode CONTRACT_ORDER_EXISTS = new ErrorCode(1_027_000_014, "关联订单已存在");
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.zt.plat.module.contractorder.enums.contract;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 字典枚举
|
||||
*/
|
||||
@Getter
|
||||
public enum DictEnum {
|
||||
|
||||
/** ERP请求状态 */
|
||||
@@ -60,19 +63,7 @@ public enum DictEnum {
|
||||
*/
|
||||
private final String remark;
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public static DictEnum getByCode(String code, String dictType) {
|
||||
public static DictEnum getByCodeAndType(String code, String dictType) {
|
||||
return DictEnum.valueOf(dictType + "_" +code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ public class ContractController implements BusinessControllerMarker {
|
||||
@PostMapping("/submit/erp")
|
||||
@Operation(summary = "提交ERP")
|
||||
@PreAuthorize("@ss.hasPermission('base:contract:erp')")
|
||||
public CommonResult<Boolean> submitErp(@RequestBody List<Long> ids) {
|
||||
public CommonResult<List<String>> submitErp(@RequestBody List<Long> ids) {
|
||||
return success(contractService.submitErp(ids));
|
||||
}
|
||||
|
||||
|
||||
@@ -38,4 +38,7 @@ public class ContractPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "本币金额;与ERP(HTBWBZJE)对应")
|
||||
private BigDecimal basicAmount;
|
||||
|
||||
@Schema(description = "合同分类(字典:SPLY_BSN_TP)")
|
||||
private String businessType;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.contract;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 合同关联 Response VO")
|
||||
@Data
|
||||
public class RelationRespVO {
|
||||
|
||||
@Schema(description = "上游主键")
|
||||
private Long upId;
|
||||
|
||||
@Schema(description = "下游主键")
|
||||
private Long downId;
|
||||
}
|
||||
@@ -88,6 +88,9 @@ public class PurchaseOrderController implements BusinessControllerMarker {
|
||||
public CommonResult<PurchaseOrderRespVO> getPurchaseOrder(@RequestParam("id") Long id) {
|
||||
PurchaseOrderDO purchaseOrder = purchaseOrderService.getPurchaseOrder(id);
|
||||
PurchaseOrderRespVO purchaseOrderRespVO = BeanUtils.toBean(purchaseOrder, PurchaseOrderRespVO.class);
|
||||
if (purchaseOrderRespVO == null){
|
||||
return success(null);
|
||||
}
|
||||
purchaseOrderService.setOrderDetails(purchaseOrderRespVO);
|
||||
return success(purchaseOrderRespVO);
|
||||
}
|
||||
@@ -124,6 +127,15 @@ public class PurchaseOrderController implements BusinessControllerMarker {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PostMapping("/submit-order-batch")
|
||||
@Operation(summary = "批量提交订单审核")
|
||||
@PreAuthorize("@ss.hasPermission('bse:purchase-order:update')")
|
||||
public CommonResult<Boolean> submitOrder(@RequestBody @Validated @NotEmpty(message = "采购订单id不能为空") List<String> ids) {
|
||||
System.out.println("ids:"+ids);
|
||||
ids.forEach(id -> purchaseOrderService.submitOrder(Long.valueOf(id)));
|
||||
return success(true);
|
||||
}
|
||||
|
||||
//提交ERP订单
|
||||
@PostMapping("/submit-erp061")
|
||||
@Operation(summary = "推送ERP订单", description = "061')")
|
||||
@@ -163,4 +175,19 @@ public class PurchaseOrderController implements BusinessControllerMarker {
|
||||
return purchaseOrderService.getMaterial(orderNo);
|
||||
}
|
||||
|
||||
//关联订单
|
||||
@PostMapping("/link-order")
|
||||
@Operation(summary = "关联订单")
|
||||
public CommonResult<Boolean> linkOrder(@RequestBody @Validated LinkOrderReqVO req){
|
||||
return success(purchaseOrderService.linkOrder(req));
|
||||
}
|
||||
|
||||
@PostMapping("/order-pass-reject")
|
||||
@Operation(summary = "订单审核")
|
||||
public CommonResult<Boolean> orderPassReject(@RequestBody PurchaseorderReqVO reqVO){
|
||||
return success(purchaseOrderService.orderPassReject(reqVO));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.zt.plat.module.contractorder.controller.admin.purchaseorder.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Schema(description = "关联订单请求参数 VO")
|
||||
public class LinkOrderReqVO {
|
||||
@Schema(description = "上游订单号")
|
||||
private Long upOrderId;
|
||||
@Schema(description = "下游订单号")
|
||||
private Long downOrderId;
|
||||
@Schema(description = "关联订单类型")
|
||||
private String linkOrderType;
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public class PrchOrdDtlDetailsRespVO {
|
||||
* 计量单位;推送ERP(必须)
|
||||
*/
|
||||
|
||||
private BigDecimal unt;
|
||||
private String unt;
|
||||
/**
|
||||
* 含税单价;推送ERP(必须)
|
||||
*/
|
||||
|
||||
@@ -67,7 +67,7 @@ public class PrchOrdDtlRespVO {
|
||||
|
||||
@Schema(description = "税码(字典: PRCH_TAX);推送ERP", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("税码(字典: PRCH_TAX);推送ERP")
|
||||
private BigDecimal taxNum;
|
||||
private String taxNum;
|
||||
|
||||
@Schema(description = "是否基于GR的发票校验;推送ERP")
|
||||
@ExcelProperty("是否基于GR的发票校验;推送ERP")
|
||||
|
||||
@@ -130,4 +130,8 @@ public class PurchaseOrderPageReqVO extends PageParam {
|
||||
@Schema(description = "物料类型(字典:MTRL_TP)", example = "2")
|
||||
private String mtrlTp;
|
||||
|
||||
@Schema(description = "订单分类")
|
||||
private String splyBsnTp;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -171,4 +171,29 @@ public class PurchaseOrderRespVO {
|
||||
@Schema(description = "物料类型(字典:MTRL_TP)", example = "2")
|
||||
@ExcelProperty("物料类型(字典:MTRL_TP)")
|
||||
private String mtrlTp;
|
||||
|
||||
@Schema(description = "订单分类", example = "2")
|
||||
@ExcelProperty("订单分类")
|
||||
private String splyBsnTp;
|
||||
|
||||
@Schema(description = "公司名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||
@ExcelProperty("公司名称")
|
||||
private String cpName;
|
||||
|
||||
@Schema(description = "是否提交审核,value为0或1")
|
||||
@ExcelProperty("是否提交审核")
|
||||
private int isPush;
|
||||
|
||||
@Schema(description = "流程实例编号")
|
||||
@ExcelProperty("流程实例编号")
|
||||
private String processInstanceId;
|
||||
|
||||
@Schema(description = "流程当前任务节点id")
|
||||
@ExcelProperty("流程当前任务节点id")
|
||||
private String taskId;
|
||||
|
||||
@Schema(description = " 审批意见")
|
||||
@ExcelProperty(" 审批意见")
|
||||
private String reviewOpinion;
|
||||
|
||||
}
|
||||
|
||||
@@ -158,7 +158,6 @@ public class PurchaseOrderSaveReqVO {
|
||||
|
||||
@Schema(description = "流程实例编号")
|
||||
@ExcelProperty("流程实例编号")
|
||||
@NotEmpty(message = "流程实例编号不能为空")
|
||||
private String processInstanceId;
|
||||
|
||||
@Schema(description = "流程当前任务节点id")
|
||||
@@ -175,4 +174,8 @@ public class PurchaseOrderSaveReqVO {
|
||||
@Schema(description = "物料类别(字典:MTRL_TP)", example = "1")
|
||||
@ExcelProperty("物料类别")
|
||||
private String mtrlTp;
|
||||
|
||||
@Schema(description = "订单分类", example = "2")
|
||||
@ExcelProperty("订单分类")
|
||||
private String splyBsnTp;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.zt.plat.module.contractorder.controller.admin.purchaseorder.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 订单审核请求对象 Request VO")
|
||||
@Data
|
||||
public class PurchaseorderReqVO {
|
||||
|
||||
@Schema(description = "合同主键ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "合同主键ID不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "审批意见", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "审核意见不能为空")
|
||||
private String reviewOpinion;
|
||||
|
||||
@Schema(description = "状态:待推送 WAIT_PUSH,已驳回 REJECTED", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "审核状态不能为空")
|
||||
private String status;
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public class PrchOrdDtlDO extends BusinessBaseDO {
|
||||
* 暂估数量;推送ERP(必须)
|
||||
*/
|
||||
@TableField("QTY")
|
||||
private String qty;
|
||||
private BigDecimal qty;
|
||||
/**
|
||||
* 计量单位;推送ERP(必须)
|
||||
*/
|
||||
|
||||
@@ -250,4 +250,11 @@ public class PurchaseOrderDO extends BusinessBaseDO {
|
||||
*/
|
||||
@TableField("MTRL_TP")
|
||||
private String mtrlTp;
|
||||
|
||||
/**
|
||||
* 订单分类
|
||||
*
|
||||
*/
|
||||
@TableField("SPLY_BSN_TP")
|
||||
private String splyBsnTp;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ public interface ContractMainMapper extends BaseMapperX<ContractMainDO> {
|
||||
.likeIfPresent(ContractMainDO::getPurchaseCompanyName, reqVO.getPurchaseCompanyName())
|
||||
.eqIfPresent(ContractMainDO::getBasicAmount, reqVO.getBasicAmount())
|
||||
.eqIfPresent(ContractMainDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(ContractMainDO::getBusinessType, reqVO.getBusinessType())
|
||||
.orderByDesc(ContractMainDO::getCreateTime));
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,7 @@ public interface PurchaseOrderMapper extends BaseMapperX<PurchaseOrderDO> {
|
||||
.likeIfPresent(PurchaseOrderDO::getErpSalesCompanyName, reqVO.getErpSalesCompanyName())
|
||||
.likeIfPresent(PurchaseOrderDO::getPurchaseOrganizationName, reqVO.getPurchaseOrganizationName())
|
||||
.eqIfPresent(PurchaseOrderDO::getErpStatus, reqVO.getErpStatus())
|
||||
.eqIfPresent(PurchaseOrderDO::getSplyBsnTp, reqVO.getSplyBsnTp())
|
||||
.eqIfPresent(PurchaseOrderDO::getCause, reqVO.getCause())
|
||||
.eqIfPresent(PurchaseOrderDO::getStatus, reqVO.getStatus())
|
||||
.likeIfPresent(PurchaseOrderDO::getPurchaseGroupName, reqVO.getPurchaseGroupName())
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.json.JSONObject;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.module.contractorder.api.dto.contract.ContractRespDTO;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.contract.*;
|
||||
import com.zt.plat.module.contractorder.controller.admin.purchaseorder.vo.LinkOrderReqVO;
|
||||
import com.zt.plat.module.contractorder.dal.dataobject.contract.ContractMainDO;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.core.io.ByteArrayResource;
|
||||
@@ -104,7 +105,7 @@ public interface ContractService {
|
||||
* @param ids 合同ID集合
|
||||
* @return
|
||||
*/
|
||||
Boolean submitErp(List<Long> ids);
|
||||
List<String> submitErp(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 删除合同
|
||||
@@ -162,6 +163,14 @@ public interface ContractService {
|
||||
*/
|
||||
Boolean relation(RelationReqVo reqVo);
|
||||
|
||||
/**
|
||||
* 根据合同ID获得关联合同
|
||||
*
|
||||
* @param id 合同ID
|
||||
* @return 上下游合同ID
|
||||
*/
|
||||
RelationRespVO getRelation(Long id);
|
||||
|
||||
/**
|
||||
* 下载文件
|
||||
*
|
||||
@@ -193,4 +202,13 @@ public interface ContractService {
|
||||
* @return 完结结果
|
||||
*/
|
||||
Boolean complete(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 关联订单;该接口仅供订单关联使用
|
||||
*
|
||||
* @param LinkOrderReqVO 订单信息
|
||||
* @return 结果
|
||||
*/
|
||||
Boolean linkOrder(@Valid LinkOrderReqVO LinkOrderReqVO);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zt.plat.module.contractorder.service.contract;
|
||||
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
@@ -24,6 +25,7 @@ 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.contract.*;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.contract.*;
|
||||
import com.zt.plat.module.contractorder.controller.admin.purchaseorder.vo.LinkOrderReqVO;
|
||||
import com.zt.plat.module.contractorder.dal.dataobject.contract.*;
|
||||
import com.zt.plat.module.contractorder.dal.mysql.contract.*;
|
||||
import com.zt.plat.module.contractorder.enums.*;
|
||||
@@ -704,7 +706,7 @@ public class ContractServiceImpl implements ContractService {
|
||||
|| DictEnum.BSE_CTRT_STS_IN_PROGRESS.getCode().equals(oldContractMainDO.getStatus()))) {
|
||||
|
||||
throw exception(CONTRACT_STATUS_NOT_UPDATE,
|
||||
DictEnum.getByCode(oldContractMainDO.getStatus(), DictTypeConstants.BSE_CTRT_STS).getLabel());
|
||||
DictEnum.getByCodeAndType(oldContractMainDO.getStatus(), DictTypeConstants.BSE_CTRT_STS).getLabel());
|
||||
}
|
||||
|
||||
// 校验合同名称是否重复
|
||||
@@ -728,6 +730,29 @@ public class ContractServiceImpl implements ContractService {
|
||||
// 请求更新的合同信息
|
||||
ContractMainDO newContractMainDO = BeanUtils.toBean(reqVO, ContractMainDO.class);
|
||||
|
||||
// 校验ERP的公司
|
||||
if (StringUtils.isNotEmpty(reqVO.getPurchaseCompanyNumber())
|
||||
|| StringUtils.isNotEmpty(reqVO.getSalesCompanyNumber())) {
|
||||
if (StringUtils.isNotEmpty(reqVO.getPurchaseCompanyNumber())) {
|
||||
ErpCompanyDO erpCompany = erpCompanyService.getErpCompanyByNumber(reqVO.getPurchaseCompanyNumber());
|
||||
if (erpCompany == null) {
|
||||
throw exception(CONTRACT_ERP_COMPANY_PLEASE_BIND, ApiConstants.PURCHASE);
|
||||
} else {
|
||||
newContractMainDO.setErpPurchaseCompanyNumber(erpCompany.getNumber());
|
||||
newContractMainDO.setErpPurchaseCompanyName(erpCompany.getName());
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotEmpty(reqVO.getSalesCompanyNumber())) {
|
||||
ErpCompanyDO erpCompany = erpCompanyService.getErpCompanyByNumber(reqVO.getSalesCompanyNumber());
|
||||
if (erpCompany == null) {
|
||||
throw exception(CONTRACT_ERP_COMPANY_PLEASE_BIND, ApiConstants.SALES);
|
||||
} else {
|
||||
newContractMainDO.setErpSalesCompanyNumber(erpCompany.getNumber());
|
||||
newContractMainDO.setErpSalesCompanyName(erpCompany.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 删除关联信息
|
||||
// 查询合同明细
|
||||
List<ContractDetailDO> detailDOS = contractDetailMapper
|
||||
@@ -950,7 +975,7 @@ public class ContractServiceImpl implements ContractService {
|
||||
String msg = id.toString()
|
||||
+ ":"
|
||||
+ CONTRACT_STATUS_NOT_DELETE.getMsg()
|
||||
.replace("{}", DictEnum.getByCode(contractMainDO.getStatus(), DictTypeConstants.BSE_CTRT_STS).getLabel());
|
||||
.replace("{}", DictEnum.getByCodeAndType(contractMainDO.getStatus(), DictTypeConstants.BSE_CTRT_STS).getLabel());
|
||||
result.add(new JSONObject().putOnce("deleted", false).putOnce("msg", msg));
|
||||
}
|
||||
|
||||
@@ -1030,7 +1055,7 @@ public class ContractServiceImpl implements ContractService {
|
||||
|| DictEnum.BSE_CTRT_STS_WAIT_AUDIT.getCode().equals(contractMainDO.getStatus()))) {
|
||||
|
||||
throw exception(CONTRACT_STATUS_NOT_SUBMIT_APPROVAL,
|
||||
DictEnum.getByCode(contractMainDO.getStatus(), DictTypeConstants.BSE_CTRT_STS).getLabel());
|
||||
DictEnum.getByCodeAndType(contractMainDO.getStatus(), DictTypeConstants.BSE_CTRT_STS).getLabel());
|
||||
}
|
||||
|
||||
// 合同内容校验
|
||||
@@ -1117,7 +1142,7 @@ public class ContractServiceImpl implements ContractService {
|
||||
if (!DictEnum.BSE_CTRT_STS_UNDER_REVIEW.getCode().equals(contractMainDO.getStatus())) {
|
||||
|
||||
throw exception(CONTRACT_STATUS_NOT_APPROVAL,
|
||||
DictEnum.getByCode(contractMainDO.getStatus(), DictTypeConstants.BSE_CTRT_STS).getLabel());
|
||||
DictEnum.getByCodeAndType(contractMainDO.getStatus(), DictTypeConstants.BSE_CTRT_STS).getLabel());
|
||||
}
|
||||
|
||||
// 获取当前流程正在审批的任务节点
|
||||
@@ -1287,7 +1312,9 @@ public class ContractServiceImpl implements ContractService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean submitErp(List<Long> ids) {
|
||||
public List<String> submitErp(List<Long> ids) {
|
||||
|
||||
List<String> results = new ArrayList<>();
|
||||
|
||||
// 遍历合同ID集合
|
||||
ids.forEach(id -> {
|
||||
@@ -1303,30 +1330,47 @@ public class ContractServiceImpl implements ContractService {
|
||||
|| DictEnum.BSE_CTRT_STS_TERMINATED.getCode().equals(contractMainDO.getStatus()))) {
|
||||
|
||||
throw exception(CONTRACT_STATUS_NOT_SUBMIT_ERP,
|
||||
DictEnum.getByCode(contractMainDO.getStatus(), DictTypeConstants.BSE_CTRT_STS).getLabel());
|
||||
DictEnum.getByCodeAndType(contractMainDO.getStatus(), DictTypeConstants.BSE_CTRT_STS).getLabel());
|
||||
}
|
||||
|
||||
// 生成ERP合同映射表
|
||||
ErpContractSaveReqVO erpContractVO = getErpContract(contractMainDO);
|
||||
|
||||
// 调用ERP模块
|
||||
Map<Boolean, String> erpResult = sendToErp(erpContractVO);
|
||||
JSONObject erpResult = sendToErp(erpContractVO);
|
||||
log.info("合同提交ERP结果:{}", erpResult);
|
||||
String result = id
|
||||
+"-"+erpResult.getBool("success")
|
||||
+(erpResult.getBool("success") ? "" : "-" + erpResult.getStr("errMsg"));
|
||||
results.add(result);
|
||||
|
||||
// 更新合同状态
|
||||
if (erpResult.getBool("success")) {
|
||||
contractMainDO.setStatus(DictEnum.BSE_CTRT_STS_IN_PROGRESS.getCode());
|
||||
contractMainDO.setErpStatus(DictEnum.ERP_REQ_STS_FIND.getCode());
|
||||
contractMainMapper.updateById(contractMainDO);
|
||||
} else {
|
||||
contractMainDO.setStatus(DictEnum.BSE_CTRT_STS_PUSH_ERROR.getCode());
|
||||
contractMainDO.setErpStatus(DictEnum.ERP_REQ_STS_RLBK.getCode());
|
||||
// contractMainDO.setCause(erpResult.getStr("errMsg"));
|
||||
contractMainMapper.updateById(contractMainDO);
|
||||
}
|
||||
} else {
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
results.add(id+"-"+"false"+"-"+CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
return results;
|
||||
}
|
||||
|
||||
private Map<Boolean, String> sendToErp(ErpContractSaveReqVO erpContractVO) {
|
||||
Map<Boolean, String> erpResult = new HashMap<>();
|
||||
private JSONObject sendToErp(ErpContractSaveReqVO erpContractVO) {
|
||||
JSONObject erpResult = new JSONObject();
|
||||
try {
|
||||
String result = erpContractService.submitErp(erpContractVO);
|
||||
erpResult.put(true, result);
|
||||
erpResult.putOnce("success", true);
|
||||
} catch (Exception e) {
|
||||
erpResult.put(false, e.getMessage());
|
||||
erpResult.putOnce("success", false);
|
||||
erpResult.putOnce("errMsg", e.getMessage());
|
||||
}
|
||||
|
||||
return erpResult;
|
||||
@@ -1342,6 +1386,32 @@ public class ContractServiceImpl implements ContractService {
|
||||
return insert > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RelationRespVO getRelation(Long id) {
|
||||
|
||||
// 返回结果
|
||||
RelationRespVO resp = new RelationRespVO();
|
||||
|
||||
// 获得上游合同关联
|
||||
SystemRelativityDO upSystemRelativityDO = systemRelativityMapper
|
||||
.selectOne(new LambdaQueryWrapperX<SystemRelativityDO>()
|
||||
.eq(SystemRelativityDO::getDownId, id)
|
||||
);
|
||||
|
||||
// 获得下游合同关联
|
||||
SystemRelativityDO downSystemRelativityDO = systemRelativityMapper
|
||||
.selectOne(new LambdaQueryWrapperX<SystemRelativityDO>()
|
||||
.eq(SystemRelativityDO::getUpId, id)
|
||||
);
|
||||
|
||||
// 上游合同ID
|
||||
if (upSystemRelativityDO != null) resp.setUpId(upSystemRelativityDO.getId());
|
||||
// 下游合同ID
|
||||
if (downSystemRelativityDO != null) resp.setDownId(downSystemRelativityDO.getId());
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<ByteArrayResource> download(List<Long> ids) {
|
||||
try {
|
||||
@@ -1437,7 +1507,7 @@ public class ContractServiceImpl implements ContractService {
|
||||
// 合同状态校验
|
||||
if (!DictEnum.BSE_CTRT_STS_TERMINATED.getCode().equals(contractMainDO.getStatus())) {
|
||||
throw exception(CONTRACT_STATUS_NOT_ARCHIVE,
|
||||
DictEnum.getByCode(contractMainDO.getStatus(), DictTypeConstants.BSE_CTRT_STS).getLabel());
|
||||
DictEnum.getByCodeAndType(contractMainDO.getStatus(), DictTypeConstants.BSE_CTRT_STS).getLabel());
|
||||
}
|
||||
|
||||
// 设置归档状态
|
||||
@@ -1465,7 +1535,7 @@ public class ContractServiceImpl implements ContractService {
|
||||
// 合同状态校验
|
||||
if (!DictEnum.BSE_CTRT_STS_IN_PROGRESS.getCode().equals(contractMainDO.getStatus())) {
|
||||
throw exception(CONTRACT_STATUS_NOT_ARCHIVE,
|
||||
DictEnum.getByCode(contractMainDO.getStatus(), DictTypeConstants.BSE_CTRT_STS).getLabel());
|
||||
DictEnum.getByCodeAndType(contractMainDO.getStatus(), DictTypeConstants.BSE_CTRT_STS).getLabel());
|
||||
}
|
||||
|
||||
// 设置作废状态
|
||||
@@ -1496,7 +1566,7 @@ public class ContractServiceImpl implements ContractService {
|
||||
// 合同状态校验
|
||||
if (!DictEnum.BSE_CTRT_STS_IN_PROGRESS.getCode().equals(contractMainDO.getStatus())) {
|
||||
throw exception(CONTRACT_STATUS_NOT_ARCHIVE,
|
||||
DictEnum.getByCode(contractMainDO.getStatus(), DictTypeConstants.BSE_CTRT_STS).getLabel());
|
||||
DictEnum.getByCodeAndType(contractMainDO.getStatus(), DictTypeConstants.BSE_CTRT_STS).getLabel());
|
||||
}
|
||||
|
||||
// 设置完结状态
|
||||
@@ -1512,6 +1582,20 @@ public class ContractServiceImpl implements ContractService {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean linkOrder(LinkOrderReqVO LinkOrderReqVO) {
|
||||
|
||||
SystemRelativityDO saveDO = new SystemRelativityDO();
|
||||
saveDO.setStatus(DictEnum.BSE_SYS_REL_TP_ORDER.getCode());
|
||||
saveDO.setUpId(LinkOrderReqVO.getUpOrderId());
|
||||
saveDO.setDownId(LinkOrderReqVO.getDownOrderId());
|
||||
//判断订单有没有关联过
|
||||
if (systemRelativityMapper.selectCount(new LambdaQueryWrapper<SystemRelativityDO>().eq(SystemRelativityDO::getUpId, saveDO.getUpId()).eq(SystemRelativityDO::getDownId, saveDO.getDownId()))>0){
|
||||
throw exception(CONTRACT_ORDER_EXISTS);
|
||||
}
|
||||
return systemRelativityMapper.insert(saveDO)>0;
|
||||
}
|
||||
|
||||
private ErpContractSaveReqVO getErpContract(ContractMainDO contractMainDO) {
|
||||
|
||||
ErpContractSaveReqVO erpContractVO = new ErpContractSaveReqVO();
|
||||
|
||||
@@ -82,9 +82,39 @@ public interface PurchaseOrderService {
|
||||
* @return 订单信息
|
||||
*/
|
||||
List<PurchaseOrderDetailsRespVO> getOrderByOrderNo(List<String> orderNo);
|
||||
|
||||
/**
|
||||
* 通过订单编号查询订单信息
|
||||
*
|
||||
* @param purchaseOrderRespVO 订单信息
|
||||
*
|
||||
*/
|
||||
void setOrderDetails(PurchaseOrderRespVO purchaseOrderRespVO);
|
||||
/**
|
||||
* 修改订单状态
|
||||
*
|
||||
* @param reqVO 订单状态
|
||||
*
|
||||
*/
|
||||
void updateOrderStatusByIdOrOrderNo(PurchaseOrderStsReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 获取物料
|
||||
*
|
||||
* @param orderNo 订单号
|
||||
*
|
||||
*/
|
||||
CommonResult<MaterialRespVO> getMaterial(String orderNo);
|
||||
/**
|
||||
* 关联订单
|
||||
*
|
||||
* @param reqVO 关联订单
|
||||
*
|
||||
*/
|
||||
boolean linkOrder(LinkOrderReqVO reqVO);
|
||||
/**
|
||||
* 订单审核通过和不通过
|
||||
*
|
||||
* @param purchaseorderReqVO 采购审核
|
||||
*
|
||||
*/
|
||||
boolean orderPassReject(PurchaseorderReqVO purchaseorderReqVO);
|
||||
}
|
||||
|
||||
@@ -9,17 +9,16 @@ import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
|
||||
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.BpmApprovalDetailReqDTO;
|
||||
import com.zt.plat.module.bpm.api.task.dto.BpmApprovalDetailRespDTO;
|
||||
import com.zt.plat.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
||||
import com.zt.plat.module.bpm.api.task.dto.BpmTaskRespDTO;
|
||||
import com.zt.plat.module.bpm.api.task.dto.*;
|
||||
import com.zt.plat.module.bpm.enums.task.BpmProcessInstanceStatusEnum;
|
||||
import com.zt.plat.module.contractorder.controller.admin.purchaseorder.vo.*;
|
||||
import com.zt.plat.module.contractorder.dal.dataobject.purchaseorder.PrchOrdDtlDO;
|
||||
import com.zt.plat.module.contractorder.dal.dataobject.purchaseorder.PurchaseOrderDO;
|
||||
import com.zt.plat.module.contractorder.dal.mysql.purchaseorder.PrchOrdDtlMapper;
|
||||
import com.zt.plat.module.contractorder.dal.mysql.purchaseorder.PurchaseOrderMapper;
|
||||
import com.zt.plat.module.contractorder.enums.contract.DictEnum;
|
||||
import com.zt.plat.module.contractorder.enums.purchaseorder.PurchaseOrderStatusEnum;
|
||||
import com.zt.plat.module.contractorder.service.contract.ContractService;
|
||||
import com.zt.plat.module.contractorder.util.constants.ProcessDefinitionKeyConstants;
|
||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpOrderSaveReqVO;
|
||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpOrderUpdateReqVO;
|
||||
@@ -36,6 +35,7 @@ import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@@ -77,8 +77,11 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
|
||||
@Resource
|
||||
private SequenceApi sequenceApi;
|
||||
|
||||
@Resource
|
||||
private ContractService contractService;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public PurchaseOrderRespVO createPurchaseOrder(PurchaseOrderSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
PurchaseOrderDO purchaseOrder = BeanUtils.toBean(createReqVO, PurchaseOrderDO.class);
|
||||
@@ -91,7 +94,10 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
|
||||
String orderNumber = generateOrderNumber(purchaseOrder.getMtrlTp());
|
||||
purchaseOrder.setSystemOrderNumber(orderNumber);
|
||||
purchaseOrderMapper.insert(purchaseOrder);
|
||||
// 返回
|
||||
|
||||
if (createReqVO.getPrchOrdDtlSaveReqVOS().isEmpty()){
|
||||
return BeanUtils.toBean(purchaseOrder, PurchaseOrderRespVO.class);
|
||||
}
|
||||
//批量插入订单明细
|
||||
createReqVO.getPrchOrdDtlSaveReqVOS().forEach(prchOrdDtlSaveReqVO -> prchOrdDtlSaveReqVO.setOrdId(purchaseOrder.getId()));
|
||||
List<PrchOrdDtlRespVO> prchOrdDtlRespVOS = prchOrdDtlService.batchCreatePrchOrdDtl(createReqVO.getPrchOrdDtlSaveReqVOS());
|
||||
@@ -101,12 +107,21 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updatePurchaseOrder(PurchaseOrderSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validatePurchaseOrderExists(updateReqVO.getId());
|
||||
// 更新
|
||||
PurchaseOrderDO updateObj = BeanUtils.toBean(updateReqVO, PurchaseOrderDO.class);
|
||||
purchaseOrderMapper.updateById(updateObj);
|
||||
//删除订单明细
|
||||
// prchOrdDtlService.deletePrchOrdDtlListByOrdIds(Collections.singletonList(updateReqVO.getId()));
|
||||
// log.info("删除旧的订单明细成功");
|
||||
// 返回
|
||||
//批量插入订单明细
|
||||
// updateReqVO.getPrchOrdDtlSaveReqVOS().forEach(prchOrdDtlSaveReqVO -> prchOrdDtlSaveReqVO.setOrdId(updateReqVO.getId()));
|
||||
// prchOrdDtlService.batchCreatePrchOrdDtl(updateReqVO.getPrchOrdDtlSaveReqVOS());
|
||||
log.info("更新订单明细成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -127,7 +142,8 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
|
||||
prchOrdDtlService.deletePrchOrdDtlListByOrdIds(ids);
|
||||
|
||||
}
|
||||
private void validatePurchaseOrderNosExists(List<String> orderNos){
|
||||
|
||||
private void validatePurchaseOrderNosExists(List<String> orderNos) {
|
||||
List<PurchaseOrderDO> list = purchaseOrderMapper.selectList(new LambdaQueryWrapper<PurchaseOrderDO>().in(PurchaseOrderDO::getSystemOrderNumber, orderNos));
|
||||
if (CollUtil.isEmpty(list) || list.size() != orderNos.size()) {
|
||||
throw exception(PURCHASE_ORDER_NOT_EXISTS);
|
||||
@@ -226,51 +242,127 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
|
||||
@Override
|
||||
@Transactional
|
||||
public String submitErp061(List<Long> ids) {
|
||||
//通过订单号查询订单
|
||||
// 通过订单号查询订单
|
||||
List<PurchaseOrderWithDetailsVO> purchaseOrderWithDetailsVOS = purchaseOrderMapper.selectOrderByIds(ids);
|
||||
if (!purchaseOrderWithDetailsVOS.isEmpty()) {
|
||||
purchaseOrderWithDetailsVOS.forEach(purchaseOrderWithDetailsVO -> {
|
||||
ErpOrderSaveReqVO erpOrderSaveReqVO = new ErpOrderSaveReqVO();
|
||||
if (purchaseOrderWithDetailsVO.getPurchaseOrder() != null) {
|
||||
erpOrderSaveReqVO.setOrderid(purchaseOrderWithDetailsVO.getPurchaseOrder().getSystemOrderNumber());
|
||||
erpOrderSaveReqVO.setCompCode(purchaseOrderWithDetailsVO.getPurchaseOrder().getCompanyNumber());//公司代码
|
||||
erpOrderSaveReqVO.setVendor(purchaseOrderWithDetailsVO.getPurchaseOrder().getSupplierNumber());// 供应商帐号
|
||||
erpOrderSaveReqVO.setDocType(purchaseOrderWithDetailsVO.getPurchaseOrder().getType());//采购凭证类型
|
||||
erpOrderSaveReqVO.setDocDate(purchaseOrderWithDetailsVO.getPurchaseOrder().getVoucherDate()); //采购凭证日期
|
||||
erpOrderSaveReqVO.setPurchOrg(purchaseOrderWithDetailsVO.getPurchaseOrder().getPurchaseOrganizationCustomsDeclaration());//采购组织
|
||||
erpOrderSaveReqVO.setPurGroup(purchaseOrderWithDetailsVO.getPurchaseOrder().getPurchaseGroup());//采购组
|
||||
erpOrderSaveReqVO.setCurrency(purchaseOrderWithDetailsVO.getPurchaseOrder().getCurrencyNumber()); // 货币码
|
||||
erpOrderSaveReqVO.setExchRate(purchaseOrderWithDetailsVO.getPurchaseOrder().getExchangeRate());//汇率
|
||||
erpOrderSaveReqVO.setZzhth(purchaseOrderWithDetailsVO.getPurchaseOrder().getContractNumber());//纸质合同号
|
||||
erpOrderSaveReqVO.setZxxyh(purchaseOrderWithDetailsVO.getPurchaseOrder().getPaperContractNumber());//小协议号
|
||||
PurchaseOrderDO order = purchaseOrderWithDetailsVO.getPurchaseOrder();
|
||||
erpOrderSaveReqVO.setOrderNo(order.getSystemOrderNumber());
|
||||
// 1. 处理抬头信息(Head)
|
||||
ErpOrderSaveReqVO.Head head = new ErpOrderSaveReqVO.Head();
|
||||
head.setComp_code(order.getCompanyNumber()); // 公司编码 -> 公司代码
|
||||
head.setVendor(order.getSupplierNumber()); // 客商编码 -> 供应商帐号
|
||||
head.setDoc_type(order.getType()); // 订单类型 -> 采购凭证类型
|
||||
head.setDoc_date(order.getVoucherDate() != null ? order.getVoucherDate().toLocalDate() : null); // 凭证日期 -> 采购凭证日期
|
||||
head.setPurch_org(order.getPurchaseOrganizationCustomsDeclaration()); // 采购组织编码 -> 采购组织
|
||||
head.setPur_group(order.getPurchaseGroup()); // 采购组编码 -> 采购组
|
||||
head.setCurrency(order.getCurrencyNumber()); // 货币码 -> 货币码
|
||||
head.setExch_rate(order.getExchangeRate()); // 汇率 -> 汇率
|
||||
erpOrderSaveReqVO.setHead(head);
|
||||
|
||||
// 2. 处理抬头扩展信息(Exte)
|
||||
ErpOrderSaveReqVO.Exte exte = new ErpOrderSaveReqVO.Exte();
|
||||
exte.setZzhth(order.getPaperContractNumber()); // 合同纸质合同号 -> 纸质合同号
|
||||
exte.setZxxyh(order.getAgreementNumber()); // 小协议号 -> 小协议号
|
||||
exte.setZnote(order.getRemark()); // 备注 -> 备注
|
||||
exte.setZlifnr(order.getAgentNumber()); // 代理方编码 -> 代理方
|
||||
erpOrderSaveReqVO.setExte(exte);
|
||||
|
||||
List<JSONObject> actsCtgrDtlList = purchaseOrderWithDetailsVO.getOrderDetails().stream()
|
||||
.map(PrchOrdDtlDO::getActsCtgrDtl).map(JSONObject::parseObject)
|
||||
.toList();
|
||||
JSONArray jsonArray = JSONArray.from(actsCtgrDtlList);
|
||||
erpOrderSaveReqVO.setAccts(jsonArray);
|
||||
// 3. 处理行项目信息(Item)
|
||||
List<PrchOrdDtlDO> details = purchaseOrderWithDetailsVO.getOrderDetails();
|
||||
if (details != null && !details.isEmpty()) {
|
||||
List<ErpOrderSaveReqVO.Item> items = new ArrayList<>();
|
||||
for (PrchOrdDtlDO detail : details) {
|
||||
ErpOrderSaveReqVO.Item item = new ErpOrderSaveReqVO.Item();
|
||||
|
||||
// 3.1 行项目基本信息
|
||||
item.setPo_item(detail.getLineNum() != null ? detail.getLineNum().intValue() : null); // 行项目 -> 行号
|
||||
item.setMaterial(detail.getMtrlNum()); // 物料编码 -> 物料号
|
||||
item.setPlant(detail.getRcvFactNum()); // 收货工厂编码 -> 工厂
|
||||
item.setStge_loc(detail.getRcvWrhNum()); // 收货库位编码 -> 库存地点
|
||||
item.setQuantity(detail.getQty()); // 暂估数量 -> 数量
|
||||
item.setPo_unit(detail.getUnt()); // 计量单位 -> 计量单位
|
||||
item.setNet_price(detail.getInTaxUprc()); // 含税单价 -> 含税单价
|
||||
item.setPrice_unit(detail.getPrcUnt() != null ? detail.getPrcUnt().intValue() : 1); // 价格单位 -> 价格单位
|
||||
item.setTax_code(detail.getTaxNum()); // 税码 -> 税码
|
||||
item.setGr_basediv(detail.getIsGrInv()); // 是否基于GR的发票校验 -> 基于GR的发票校验
|
||||
item.setUnlimited_dlv(detail.getIsUnlRcv()); // 是否允许无限制收货 -> 允许无限制过量交货
|
||||
item.setBatch(detail.getBat()); // 批次 -> 批次
|
||||
item.setAcctasscat(detail.getActsCtgr()); // 科目分配类别 -> 科目分配类别
|
||||
item.setMatl_group(detail.getMtrlCpntNum()); // 物料组编码 -> 物料组
|
||||
item.setShort_text(detail.getShrtTxt()); // 短文本 -> 短文本
|
||||
item.setRet_item(detail.getIsRlbkCgo()); // 退货标识 -> 退货项目标识
|
||||
item.setFree_item(detail.getIsFreeRcv()); // 是否免费收货标识 -> 免费项目标识
|
||||
item.setVendrbatch(String.valueOf(detail.getOutLineNum())); // 外部行项目号 -> 外部行项目号
|
||||
item.setNote_xq(detail.getRmkUnt()); // 备注信息-需求单位 -> 备注信息-需求单位
|
||||
item.setNote_wl(detail.getRmkMtrl()); // 备注信息-物料详细 -> 备注信息-物料详细
|
||||
|
||||
// 处理交货起止日期(格式:YYYYMMDD-YYYYMMDD)
|
||||
StringBuilder vendMat = new StringBuilder();
|
||||
if (detail.getBgnDt() != null) {
|
||||
vendMat.append(detail.getBgnDt().format(DateTimeFormatter.ofPattern("yyyyMMdd")));
|
||||
}
|
||||
vendMat.append("-");
|
||||
if (detail.getDdlDt() != null) {
|
||||
vendMat.append(detail.getDdlDt().format(DateTimeFormatter.ofPattern("yyyyMMdd")));
|
||||
}
|
||||
item.setVend_mat(vendMat.toString());
|
||||
|
||||
// 3.2 行项目扩展信息(Itex)
|
||||
ErpOrderSaveReqVO.Itex itex = new ErpOrderSaveReqVO.Itex();
|
||||
itex.setZmatnr(detail.getSaleMtrlNum()); // 销售物料号 -> 销售物料号
|
||||
itex.setZaufnr(detail.getInOrd()); // 统计型内部订单 -> 统计型内部订单
|
||||
itex.setZpurty(detail.getPrchCtgr()); // 采购类别 -> 采购类别
|
||||
itex.setZmenge(detail.getOrigWet()); // 原料湿重 -> 原料湿重
|
||||
item.setItex(itex);
|
||||
|
||||
// 3.4 委托加工物料信息(Comp) - 简化处理,实际需解析JSON
|
||||
// List<ErpOrderSaveReqVO.Comp> comps = new ArrayList<>();
|
||||
// if (detail.getEnttDtl() != null && !detail.getEnttDtl().isEmpty()) {
|
||||
// // 假设ENTT_DTL是JSON数组,实际需根据具体格式解析
|
||||
// ErpOrderSaveReqVO.Comp comp = new ErpOrderSaveReqVO.Comp();
|
||||
// comp.setSched_line(1); // 计划行号(示例)
|
||||
// comp.setItem_no(1); // 项目编号(示例)
|
||||
// // 其他字段需从JSON中解析:material、plant、entry_quantity等
|
||||
// comps.add(comp);
|
||||
// }
|
||||
// item.setComps(comps);
|
||||
|
||||
items.add(item);
|
||||
}
|
||||
erpOrderSaveReqVO.setItems(items);
|
||||
}
|
||||
if (purchaseOrderWithDetailsVO.getOrderDetails() != null) {
|
||||
purchaseOrderWithDetailsVO.getOrderDetails().forEach(orderDetail -> {
|
||||
erpOrderSaveReqVO.setPoItem(orderDetail.getLineNum()); //行号
|
||||
erpOrderSaveReqVO.setMaterial(orderDetail.getRcvFactNum());//物料号
|
||||
erpOrderSaveReqVO.setQuantity(orderDetail.getQty());// 数量
|
||||
erpOrderSaveReqVO.setPoUnit(orderDetail.getUnt());// 计量单位
|
||||
erpOrderSaveReqVO.setNetPrice(orderDetail.getInTaxUprc());// 含税单价
|
||||
erpOrderSaveReqVO.setActsCtgrDtl(orderDetail.getActsCtgrDtl());
|
||||
});
|
||||
}
|
||||
|
||||
// 4. 推送ERP并处理返回结果
|
||||
String s = erpOrderService.submitOrderToErp061(erpOrderSaveReqVO);
|
||||
log.info("订单推送成功,订单id【{}】", purchaseOrderWithDetailsVO.getPurchaseOrder().getId());
|
||||
String erpId = JSONObject.parseObject(s).get("id").toString();
|
||||
if (erpId != null) {
|
||||
//更新订单
|
||||
int i = purchaseOrderMapper.updateById(new PurchaseOrderDO().setId(purchaseOrderWithDetailsVO.getPurchaseOrder().getId()).setOrderSAPNumber(erpId));
|
||||
if (i > 0) {
|
||||
log.info("更新订单ERPID成功,订单id【{}】", purchaseOrderWithDetailsVO.getPurchaseOrder().getId());
|
||||
log.info("订单推送成功,订单id【{}】", order.getId());
|
||||
|
||||
// 解析ERP返回的ID
|
||||
JSONObject jsonObject = JSONObject.parseObject(s);
|
||||
String erpId = jsonObject.getString("id");
|
||||
if (erpId != null && !erpId.isEmpty()) {
|
||||
// 更新订单的ERP编号
|
||||
PurchaseOrderDO updateDO = new PurchaseOrderDO();
|
||||
updateDO.setId(order.getId());
|
||||
updateDO.setOrderSAPNumber(erpId);
|
||||
int updateCount = purchaseOrderMapper.updateById(updateDO);
|
||||
if (updateCount > 0) {
|
||||
log.info("更新订单ERPID成功,订单id【{}】", order.getId());
|
||||
} else {
|
||||
log.info("订单更新失败,订单id【{}】", purchaseOrderWithDetailsVO.getPurchaseOrder().getId());
|
||||
log.error("订单更新失败,订单id【{}】", order.getId());
|
||||
throw new RuntimeException("订单更新失败");
|
||||
}
|
||||
} else {
|
||||
log.error("ERP返回ID为空,订单id【{}】", order.getId());
|
||||
throw new RuntimeException("ERP返回ID为空");
|
||||
}
|
||||
});
|
||||
//推送后把erp订单id设置到订单里
|
||||
|
||||
return "ERP推送成功";
|
||||
} else {
|
||||
return "订单不存在";
|
||||
@@ -328,27 +420,27 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
|
||||
@Override
|
||||
public void updateOrderStatusByIdOrOrderNo(PurchaseOrderStsReqVO reqVO) {
|
||||
// 校验存在
|
||||
if (reqVO.getIds()!=null){
|
||||
validatePurchaseOrderExists(reqVO.getIds());
|
||||
}
|
||||
if (reqVO.getOrderNos()!=null){
|
||||
validatePurchaseOrderNosExists(reqVO.getOrderNos());
|
||||
}
|
||||
if (reqVO.getIds() != null) {
|
||||
validatePurchaseOrderExists(reqVO.getIds());
|
||||
}
|
||||
if (reqVO.getOrderNos() != null) {
|
||||
validatePurchaseOrderNosExists(reqVO.getOrderNos());
|
||||
}
|
||||
PurchaseOrderStatusEnum byCode = PurchaseOrderStatusEnum.getByCode(reqVO.getSts());
|
||||
if (byCode == null) {
|
||||
throw exception(PURCHASE_ORDER_STATUS_ERROR);
|
||||
}
|
||||
purchaseOrderMapper.update(new LambdaUpdateWrapper<PurchaseOrderDO>().in(reqVO.getOrderNos()!=null,PurchaseOrderDO::getSystemOrderNumber, reqVO.getOrderNos()).in(reqVO.getIds()!=null,PurchaseOrderDO::getId, reqVO.getIds()).set(PurchaseOrderDO::getStatus, reqVO.getSts()));
|
||||
purchaseOrderMapper.update(new LambdaUpdateWrapper<PurchaseOrderDO>().in(reqVO.getOrderNos() != null, PurchaseOrderDO::getSystemOrderNumber, reqVO.getOrderNos()).in(reqVO.getIds() != null, PurchaseOrderDO::getId, reqVO.getIds()).set(PurchaseOrderDO::getStatus, reqVO.getSts()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<MaterialRespVO> getMaterial(String orderNo) {
|
||||
PurchaseOrderDO purchaseOrderDO = purchaseOrderMapper.selectOne(new LambdaQueryWrapper<PurchaseOrderDO>().eq(PurchaseOrderDO::getSystemOrderNumber, orderNo));
|
||||
if (purchaseOrderDO == null){
|
||||
throw exception(PURCHASE_ORDER_NOT_EXISTS);
|
||||
}
|
||||
if (purchaseOrderDO == null) {
|
||||
throw exception(PURCHASE_ORDER_NOT_EXISTS);
|
||||
}
|
||||
String mtrlTp = purchaseOrderDO.getMtrlTp();
|
||||
if ("RAW".equals(mtrlTp)){
|
||||
if ("RAW".equals(mtrlTp)) {
|
||||
//原料
|
||||
MaterialRespVO materialRespVO = new MaterialRespVO();
|
||||
materialRespVO.setMaterialType(mtrlTp);
|
||||
@@ -361,7 +453,7 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
|
||||
materialDetails.setMaterialType(purchaseOrderDO.getMtrlTp());
|
||||
materialRespVO.setMaterialDetails(List.of(materialDetails));
|
||||
return CommonResult.success(materialRespVO);
|
||||
}else {
|
||||
} else {
|
||||
List<PrchOrdDtlDO> detailsByOrderIds = prchOrdDtlService.getDetailsByOrderId(purchaseOrderDO.getId());
|
||||
MaterialRespVO materialRespVO = new MaterialRespVO();
|
||||
materialRespVO.setMaterialType(mtrlTp);
|
||||
@@ -381,6 +473,12 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean linkOrder(LinkOrderReqVO reqVO) {
|
||||
return contractService.linkOrder(reqVO);
|
||||
}
|
||||
|
||||
|
||||
private void setValue(ErpOrderUpdateReqVO erpOrderUpdateReqVO, PurchaseOrderWithDetailsVO purchaseOrderWithDetailsVO) {
|
||||
//head
|
||||
PurchaseOrderDO purchaseOrderDO = purchaseOrderMapper.selectById(purchaseOrderWithDetailsVO.getPurchaseOrder().getId());
|
||||
@@ -410,7 +508,7 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
|
||||
item.setMaterial(prchOrdDtlDO.getRcvFactNum());//物料号
|
||||
item.setPlant(prchOrdDtlDO.getRcvFactNum());//工厂
|
||||
item.setStge_loc(prchOrdDtlDO.getRcvWrhNum());//库位
|
||||
item.setQuantity(prchOrdDtlDO.getQty());// 数量
|
||||
item.setQuantity(String.valueOf(prchOrdDtlDO.getQty()));// 数量
|
||||
item.setPo_unit(prchOrdDtlDO.getUnt());// 计量单位
|
||||
item.setNet_price(prchOrdDtlDO.getInTaxUprc());// 含税单价
|
||||
item.setTax_code(prchOrdDtlDO.getTaxNum());//税码
|
||||
@@ -434,8 +532,57 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
|
||||
});
|
||||
erpOrderUpdateReqVO.setItexs(itexs);
|
||||
}
|
||||
|
||||
private String generateOrderNumber(String materialType) {
|
||||
return sequenceApi.getNextSequence("PURCHASE_ORDER_NUMBER", null, null).getData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean orderPassReject(PurchaseorderReqVO purchaseorderReqVO) {
|
||||
PurchaseOrderDO purchaseOrderDO = purchaseOrderMapper.selectById(purchaseorderReqVO.getId());
|
||||
if (ObjectUtils.isEmpty(purchaseOrderDO)) {
|
||||
throw exception(PURCHASE_ORDER_NOT_EXISTS);
|
||||
}
|
||||
AdminUserRespDTO adminUserRespDTO = adminUserApi.getUser(SecurityFrameworkUtils.getLoginUserId()).getData();
|
||||
// 获取当前流程正在审批的任务节点
|
||||
List<BpmTaskRespDTO> taskList = bpmTaskApi.getTaskListByProcessInstanceId(purchaseOrderDO.getProcessInstanceId()).getData();
|
||||
BpmTaskRespDTO undoTask = taskList.get(taskList.size() - 1);
|
||||
|
||||
// 判断是否流程已经通过、驳回
|
||||
BpmApprovalDetailReqDTO badrDto = new BpmApprovalDetailReqDTO();
|
||||
badrDto.setProcessInstanceId(purchaseOrderDO.getProcessInstanceId()); // 流程实例id
|
||||
badrDto.setTaskId(undoTask.getId()); // 当前审核任务节点id
|
||||
BpmApprovalDetailRespDTO approvalDetail = bpmProcessInstanceApi.getApprovalDetail(SecurityFrameworkUtils.getLoginUserId(), badrDto).getData();
|
||||
//如果审核通过
|
||||
if (BpmProcessInstanceStatusEnum.APPROVE.getStatus().equals(approvalDetail.getStatus())) {
|
||||
purchaseOrderDO.setStatus(PurchaseOrderStatusEnum.TO_SUBMIT_ERP.getCode());
|
||||
} else if (BpmProcessInstanceStatusEnum.REJECT.getStatus().equals(approvalDetail.getStatus())) {
|
||||
//如果审核不通过
|
||||
purchaseOrderDO.setStatus(PurchaseOrderStatusEnum.DRAFT.getCode());
|
||||
}
|
||||
//设置审核意见
|
||||
purchaseOrderDO.setReviewOpinion(purchaseorderReqVO.getReviewOpinion());
|
||||
if (ObjectUtils.isNotEmpty(undoTask)) {
|
||||
purchaseOrderDO.setTaskId(undoTask.getId());
|
||||
}
|
||||
purchaseOrderMapper.updateById(purchaseOrderDO); //更新状态
|
||||
|
||||
// 需要调用bpm 审核接口更新审批中的状态
|
||||
if (DictEnum.BSE_CTRT_STS_WAIT_PUSH.getCode().equals(purchaseorderReqVO.getStatus()) && ObjectUtils.isNotEmpty(undoTask)) {
|
||||
if (approvalDetail.getStatus().equals(BpmProcessInstanceStatusEnum.RUNNING.getStatus())) {
|
||||
BpmTaskApproveReqDTO btarDto = new BpmTaskApproveReqDTO();
|
||||
btarDto.setId(undoTask.getId());
|
||||
btarDto.setReason(purchaseorderReqVO.getReviewOpinion());
|
||||
bpmProcessInstanceApi.approveTask(btarDto);
|
||||
}
|
||||
} else if (DictEnum.BSE_CTRT_STS_REJECTED.getCode().equals(purchaseorderReqVO.getStatus()) && ObjectUtils.isNotEmpty(undoTask)) {
|
||||
if (approvalDetail.getStatus().equals(BpmProcessInstanceStatusEnum.RUNNING.getStatus())) {
|
||||
BpmTaskRejectReqDTO btrrDto = new BpmTaskRejectReqDTO();
|
||||
btrrDto.setId(undoTask.getId());
|
||||
btrrDto.setReason(purchaseorderReqVO.getReviewOpinion());
|
||||
bpmProcessInstanceApi.rejectTask(btrrDto);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,5 +2,5 @@ package com.zt.plat.module.contractorder.util.constants;
|
||||
|
||||
public interface ProcessDefinitionKeyConstants {
|
||||
|
||||
String PURCHASE_ORDER_REVIEW_PROCESS = "purchase_order_review_process";
|
||||
String PURCHASE_ORDER_REVIEW_PROCESS = "purchase_order_review";
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
po.CAUS,
|
||||
po.STS,
|
||||
po.MTRL_TP,
|
||||
po.SPLY_BSN_TP,
|
||||
po.PRCH_GRP_NAME,
|
||||
po.PRCS_INSC_ID,
|
||||
po.RVW_ONN,
|
||||
@@ -159,6 +160,7 @@
|
||||
po.RVW_ONN,
|
||||
po.TSK_NDE_ID,
|
||||
po.IS_PUSH,
|
||||
po.SPLY_BSN_TP,
|
||||
po.CREATE_TIME,
|
||||
po.UPDATE_TIME,
|
||||
po.CREATOR,
|
||||
@@ -274,6 +276,9 @@
|
||||
<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"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="PrchOrdDtlResultMap" type="com.zt.plat.module.contractorder.dal.dataobject.purchaseorder.PrchOrdDtlDO">
|
||||
|
||||
@@ -22,11 +22,17 @@ public class ErpSubmitReqDTO {
|
||||
* "sign": 签名,uuid+srcsys+密码,MD5 32位小写签名,密码另行约定
|
||||
* "req": {具体参数,参见RFC功能列表}
|
||||
*/
|
||||
@Schema(description = "接口编号,必须,参见RFC功能列表,可调用接口编号范围051-900")
|
||||
private String funcnr;
|
||||
@Schema(description = "调用系统业务单据编号,必须,在外部系统唯一,用于关联")
|
||||
private String bskey;
|
||||
@Schema(description = "SAP系统ID, 必须")
|
||||
private String usrid;
|
||||
@Schema(description = "源调用系统ID,必须")
|
||||
private String usrnm;
|
||||
private String sign;
|
||||
// @Schema(description = "签名,uuid+srcsys+密码,MD5 32位小写签名,密码另行约定")
|
||||
// private String sign;
|
||||
@Schema(description = "具体参数,参见RFC功能列表")
|
||||
private Map<String, Object> req;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package com.zt.plat.module.erp.controller.admin.erp.vo;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ERP采购订单保存请求VO
|
||||
@@ -14,168 +18,221 @@ import java.time.LocalDateTime;
|
||||
@Schema(description = "ERP采购订单保存请求参数")
|
||||
public class ErpOrderSaveReqVO {
|
||||
|
||||
@Schema(description = "公司代码")
|
||||
@NotEmpty(message = "公司代码不能为空")
|
||||
private String compCode; // BUKRS CHAR4
|
||||
|
||||
@Schema(description = "供应商帐号")
|
||||
@NotEmpty(message = "供应商帐号不能为空")
|
||||
private String vendor; // LIFNR CHAR10
|
||||
|
||||
@Schema(description = "采购凭证类型")
|
||||
@NotEmpty(message = "采购凭证类型不能为空")
|
||||
private String docType; // BSART CHAR4
|
||||
|
||||
@Schema(description = "采购凭证日期")
|
||||
@NotEmpty(message = "采购凭证日期不能为空")
|
||||
private LocalDateTime docDate; // BEDAT DATS8(格式:YYYYMMDD)
|
||||
|
||||
@Schema(description = "采购组织")
|
||||
@NotEmpty(message = "采购组织不能为空")
|
||||
private String purchOrg; // EKORG CHAR4
|
||||
|
||||
@Schema(description = "采购组")
|
||||
@NotEmpty(message = "采购组不能为空")
|
||||
private String purGroup; // EKGRP CHAR3
|
||||
|
||||
@Schema(description = "货币码")
|
||||
@NotEmpty(message = "货币码不能为空")
|
||||
private String currency; // WAERS CUKY5
|
||||
|
||||
@Schema(description = "汇率")
|
||||
private BigDecimal exchRate; // WKURS DEC9,5
|
||||
@NotEmpty(message = "纸质合同号不能为空(已启用财务共享单位)")
|
||||
private String zzhth; // CHAR60
|
||||
|
||||
|
||||
@Schema(description = "小协议号(绿星链通填入合同名称)")
|
||||
private String zxxyh; // CHAR60
|
||||
@NotEmpty(message = "订单号不能为空")
|
||||
private String orderNo;
|
||||
|
||||
@Schema(description = "备注(绿星链通填入系统采购订单头号)")
|
||||
private String znote; // CHAR60
|
||||
@Valid
|
||||
@NotNull(message = "采购订单抬头信息不能为空")
|
||||
private Head head;
|
||||
|
||||
@Schema(description = "代理方(使用客商编码)")
|
||||
private String zlifnr; // CHAR60
|
||||
@Valid
|
||||
@NotNull(message = "采购订单抬头扩展信息不能为空")
|
||||
private Exte exte;
|
||||
|
||||
@Valid
|
||||
@NotEmpty(message = "采购订单行项目列表不能为空")
|
||||
private List<Item> items;
|
||||
|
||||
@Schema(description = "行号")
|
||||
@NotEmpty(message = "行号不能为空")
|
||||
private Long poItem; // EBELP NUMC5
|
||||
private JSONArray accts; // 科目分配信息(科目分配类别为K或P时使用)
|
||||
@Valid
|
||||
private List<Comp> comps; // 委托加工物料信息(委托加工订单时使用)
|
||||
|
||||
@Schema(description = "物料号")
|
||||
private String material; // MATNR CHAR18
|
||||
@Schema(description = "采购订单抬头信息")
|
||||
@Data
|
||||
public static class Head {
|
||||
@Schema(description = "公司代码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "公司代码不能为空")
|
||||
private String comp_code; // BUKRS CHAR4
|
||||
|
||||
@Schema(description = "工厂")
|
||||
@NotEmpty(message = "工厂不能为空")
|
||||
private String plant; // WERKS CHAR4
|
||||
@Schema(description = "供应商帐号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "供应商帐号不能为空")
|
||||
private String vendor; // LIFNR CHAR10
|
||||
|
||||
@Schema(description = "库存地点")
|
||||
private String stgeLoc; // LGORT CHAR4
|
||||
@Schema(description = "采购凭证类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "采购凭证类型不能为空")
|
||||
private String doc_type; // BSART CHAR4
|
||||
|
||||
@Schema(description = "数量")
|
||||
@NotEmpty(message = "数量不能为空")
|
||||
private String quantity; // MENGE QUAN13,3
|
||||
@Schema(description = "采购凭证日期(YYYY-MM-DD)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "采购凭证日期不能为空")
|
||||
private LocalDate doc_date; // BEDAT DATS8
|
||||
|
||||
@Schema(description = "计量单位")
|
||||
@NotNull(message = "计量单位不能为空")
|
||||
private String poUnit; // MEINS UNIT3
|
||||
@Schema(description = "采购组织", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "采购组织不能为空")
|
||||
private String purch_org; // EKORG CHAR4
|
||||
|
||||
@Schema(description = "含税单价")
|
||||
@NotNull(message = "含税单价不能为空")
|
||||
private BigDecimal netPrice; // NETPR CURR11,2
|
||||
@Schema(description = "采购组", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "采购组不能为空")
|
||||
private String pur_group; // EKGRP CHAR3
|
||||
|
||||
@Schema(description = "价格单位(默认值1,表示以上单价对应的采购单位数量)")
|
||||
private Integer priceUnit; // PEINH DEC5
|
||||
@Schema(description = "货币码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "货币码不能为空")
|
||||
private String currency; // WAERS CUKY5
|
||||
|
||||
@Schema(description = "税码")
|
||||
private String taxCode; // MWSKZ CHAR2
|
||||
@Schema(description = "汇率(保留5位小数)")
|
||||
private BigDecimal exch_rate; // WKURS DEC9,5
|
||||
}
|
||||
|
||||
@Schema(description = "基于GR的发票校验")
|
||||
private String grBasedIv; // WEBRE CHAR1
|
||||
@Schema(description = "采购订单抬头扩展信息")
|
||||
@Data
|
||||
public static class Exte {
|
||||
@Schema(description = "纸质合同号(已启用财务共享单位必填)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "纸质合同号不能为空")
|
||||
private String zzhth; // CHAR60
|
||||
|
||||
@Schema(description = "允许无限制过量交货")
|
||||
private String unlimitedDlv; // UEBTK CHAR1
|
||||
@Schema(description = "小协议号(绿星链通填入合同名称)")
|
||||
private String zxxyh; // CHAR60
|
||||
|
||||
@Schema(description = "批次")
|
||||
private String batch; // CHARG CHAR10
|
||||
@Schema(description = "备注(绿星链通填入系统采购订单头号)")
|
||||
private String znote; // CHAR60
|
||||
|
||||
@Schema(description = "项目类别(委托加工订单时填入L)")
|
||||
private String itemCat; // PSTYP CHAR1(原表CAHR为笔误,按CHAR处理)
|
||||
@Schema(description = "代理方(使用客商编码)")
|
||||
private String zlifnr; // CHAR60
|
||||
}
|
||||
|
||||
@Schema(description = "科目分配类别(固定资产采购:A;服务采购:S-销售服务费、K-成本中心、F-订单)")
|
||||
private String acctassCat; // KNTTP CHAR1
|
||||
@Schema(description = "采购订单行项目信息")
|
||||
@Data
|
||||
public static class Item {
|
||||
@Schema(description = "行号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "行号不能为空")
|
||||
private Integer po_item; // EBELP NUMC5
|
||||
|
||||
@Schema(description = "物料组(服务采购订单必填)")
|
||||
private String matlGroup; // MATKL CHAR9
|
||||
@Schema(description = "物料号")
|
||||
private String material; // MATNR CHAR18
|
||||
|
||||
@Schema(description = "短文本(服务采购订单必填,绿星链通系统必须填入)")
|
||||
private String shortText; // TXZ01 CHAR40
|
||||
@Schema(description = "工厂", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "工厂不能为空")
|
||||
private String plant; // WERKS CHAR4
|
||||
|
||||
@Schema(description = "退货项目标识(退货行项目填X)")
|
||||
private String retItem; // RETPO CHAR1
|
||||
@Schema(description = "库存地点")
|
||||
private String stge_loc; // LGORT CHAR4
|
||||
|
||||
@Schema(description = "免费项目标识(免费行项目填X)")
|
||||
private String freeItem; // UMSON CHAR1
|
||||
@Schema(description = "数量(保留3位小数)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "数量不能为空")
|
||||
private BigDecimal quantity; // MENGE QUAN13,3
|
||||
|
||||
@Schema(description = "外部行项目号(绿星链通必填)")
|
||||
private String vendrBatch; // LICHN CHAR15
|
||||
@Schema(description = "计量单位", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "计量单位不能为空")
|
||||
private String po_unit; // MEINS UNIT3
|
||||
|
||||
@Schema(description = "备注信息-需求单位")
|
||||
private String noteXq; // TDLINE CHAR132
|
||||
@Schema(description = "含税单价(保留2位小数)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "含税单价不能为空")
|
||||
private BigDecimal net_price; // NETPR CURR11,2
|
||||
|
||||
@Schema(description = "备注信息-物料详细")
|
||||
private String noteWl; // TDLINE CHAR132
|
||||
@Schema(description = "价格单位(默认值1)")
|
||||
private Integer price_unit = 1; // PEINH DEC5
|
||||
|
||||
@Schema(description = "交货起止日期(格式:YYYYMMDD-YYYYMMDD)")
|
||||
private String vendMat; // IDNLF CHAR22(原表说明为交货起止日期,按说明定义)
|
||||
@Schema(description = "税码")
|
||||
private String tax_code; // MWSKZ CHAR2
|
||||
|
||||
@Schema(description = "销售物料号(科目分配类别为S时必填)")
|
||||
private String zmatnr;
|
||||
@Schema(description = "基于GR的发票校验(Y/N)")
|
||||
private String gr_basediv; // WEBRE CHAR1(原字段名gr_basediv保持与源数据一致)
|
||||
|
||||
@Schema(description = "统计型内部订单")
|
||||
private String zaufnr;
|
||||
@Schema(description = "允许无限制过量交货(Y/N)")
|
||||
private String unlimited_dlv; // UEBTK CHAR1
|
||||
|
||||
@Schema(description = "采购类别(0-生产性物资类;1-项目投资类)")
|
||||
private String zpurty;
|
||||
@Schema(description = "批次")
|
||||
private String batch; // CHARG CHAR10
|
||||
|
||||
@Schema(description = "原料湿重")
|
||||
private BigDecimal zmenge;
|
||||
@Schema(description = "项目类别(委托加工填L)")
|
||||
private String item_cat; // PSTYP CHAR1
|
||||
|
||||
@Schema(description = "科目分配类别(A-固定资产/S-服务/K-成本中心/F-订单)")
|
||||
private String acctasscat; // KNTTP CHAR1
|
||||
|
||||
@Schema(description = "科目分配的序号(从1开始编号)")
|
||||
@NotEmpty(message = "科目分配的序号不能为空")
|
||||
private String serialNo; // DZEKKN NUMC2
|
||||
@Schema(description = "物料组(服务采购必填)")
|
||||
private String matl_group; // MATKL CHAR9
|
||||
|
||||
@Schema(description = "总账科目编号")
|
||||
private String glAccount; // SAKNR CHAR10
|
||||
@Schema(description = "短文本(服务采购必填)")
|
||||
private String short_text; // TXZ01 CHAR40
|
||||
|
||||
@Schema(description = "成本中心(科目分配类别为F时必填)")
|
||||
private String costcenter; // KOSTL CHAR10
|
||||
@Schema(description = "退货项目标识(X-是)")
|
||||
private String ret_item; // RETPO CHAR1
|
||||
|
||||
@Schema(description = "订单号(科目分配类别为F时必填)")
|
||||
private String orderid; // AUFNR CHAR12
|
||||
@Schema(description = "免费项目标识(X-是)")
|
||||
private String free_item; // UMSON CHAR1
|
||||
|
||||
@Schema(description = "主资产号(科目分配类别为A时必填)")
|
||||
private String assetNo; // ANLN1 CHAR12
|
||||
@Schema(description = "外部行项目号(绿星链通必填)")
|
||||
private String vendrbatch; // LICHN CHAR15
|
||||
|
||||
@Schema(description = "资产子编号(科目分配类别为A时必填,固定值‘0’)")
|
||||
private String subNumber; // ANLN2 CHAR4
|
||||
@Schema(description = "备注信息-需求单位")
|
||||
private String note_xq; // TDLINE CHAR132
|
||||
|
||||
@Schema(description = "备注信息-物料详细")
|
||||
private String note_wl; // TDLINE CHAR132
|
||||
|
||||
@Schema(description = "计划行号(从1开始编号)")
|
||||
private String schedLine; // ETENR NUMC4
|
||||
@Schema(description = "交货起止日期(格式:YYYYMMDD-YYYYMMDD)")
|
||||
private String vend_mat; // IDNLF CHAR22
|
||||
|
||||
@Schema(description = "项目编号(从1开始编号)")
|
||||
private String itemNo; // RSPOS NUMC4
|
||||
@Valid
|
||||
private Itex itex; // 行项目扩展信息
|
||||
|
||||
@Schema(description = "委托加工需求数量")
|
||||
@NotNull(message = "委托加工需求数量不能为空")
|
||||
private BigDecimal entryQuantity; // MENGE QUAN13,3
|
||||
}
|
||||
|
||||
@Schema(description = "组件计量单位(为空时使用基本计量单位)")
|
||||
private String entryUom; // MEINS UNIT3
|
||||
@Schema(description = "行项目扩展信息")
|
||||
@Data
|
||||
public static class Itex {
|
||||
@Schema(description = "销售物料号(科目分配类别为S时必填)")
|
||||
private String zmatnr;
|
||||
|
||||
@Schema(description = " 科目分配详情")
|
||||
private String actsCtgrDtl;
|
||||
@Schema(description = "统计型内部订单")
|
||||
private String zaufnr;
|
||||
|
||||
@Schema(description = "采购类别(0-生产性物资类/1-项目投资类)")
|
||||
private String zpurty;
|
||||
|
||||
@Schema(description = "原料湿重")
|
||||
private BigDecimal zmenge;
|
||||
}
|
||||
|
||||
// @Schema(description = "行项目科目分配信息")
|
||||
// @Data
|
||||
// public static class Acct {
|
||||
// @Schema(description = "科目分配序号(从1开始)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
// @NotNull(message = "科目分配序号不能为空")
|
||||
// private Integer serial_no; // DZEKKN NUMC2
|
||||
//
|
||||
// @Schema(description = "总账科目编号")
|
||||
// private String gl_account; // SAKNR CHAR10
|
||||
//
|
||||
// @Schema(description = "成本中心(科目分配类别为F时必填)")
|
||||
// private String costcenter; // KOSTL CHAR10(源数据为costcenter,保持一致)
|
||||
//
|
||||
// @Schema(description = "订单号(科目分配类别为F时必填)")
|
||||
// private String orderid; // AUFNR CHAR12(源数据为orderid,保持一致)
|
||||
//
|
||||
// @Schema(description = "主资产号(科目分配类别为A时必填)")
|
||||
// private String asset_no; // ANLN1 CHAR12
|
||||
//
|
||||
// @Schema(description = "资产子编号(科目分配类别为A时必填,固定值'0')")
|
||||
// private String sub_number; // ANLN2 CHAR4
|
||||
// }
|
||||
|
||||
@Schema(description = "委托加工物料信息")
|
||||
@Data
|
||||
public static class Comp {
|
||||
@Schema(description = "计划行号(从1开始)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "计划行号不能为空")
|
||||
private Integer sched_line; // ETENR NUMC4
|
||||
|
||||
@Schema(description = "项目编号(从1开始)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "项目编号不能为空")
|
||||
private Integer item_no; // RSPOS NUMC4
|
||||
|
||||
@Schema(description = "加工前物料号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "加工前物料号不能为空")
|
||||
private String material; // MATNR CHAR18
|
||||
|
||||
@Schema(description = "委托加工发货工厂", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "委托加工发货工厂不能为空")
|
||||
private String plant; // PLANT CHAR4
|
||||
|
||||
@Schema(description = "委托加工需求数量(保留3位小数)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "委托加工需求数量不能为空")
|
||||
private BigDecimal entry_quantity; // MENGE QUAN13,3
|
||||
|
||||
@Schema(description = "组件计量单位(为空使用基本计量单位)")
|
||||
private String entry_uom; // MEINS UNIT3
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,25 +26,11 @@ public class ErpOrderServiceImpl implements ErpOrderService {
|
||||
ErpSubmitReqDTO reqDTO = buildBaseReqDTO(createVo, "061");
|
||||
|
||||
Map<String, Object> req = new HashMap<>();
|
||||
Map<String, Object> head = new HashMap<>();
|
||||
// head
|
||||
head.put("comp_code", createVo.getCompCode());
|
||||
head.put("vendor", createVo.getVendor());
|
||||
head.put("doc_type", createVo.getDocType());
|
||||
head.put("doc_date", createVo.getDocDate());
|
||||
head.put("purch_org", createVo.getPurchOrg());
|
||||
head.put("pur_group", createVo.getPurGroup());
|
||||
head.put("currency", createVo.getCurrency());
|
||||
head.put("exch_rate", createVo.getExchRate());
|
||||
req.put("head", head);
|
||||
//exte
|
||||
Map<String, Object> exte = new HashMap<>();
|
||||
exte.put("zzhth", createVo.getZzhth());
|
||||
exte.put("zxxyh", createVo.getZxxyh());
|
||||
exte.put("znote", createVo.getZnote());
|
||||
exte.put("zlifnr", createVo.getZlifnr());
|
||||
req.put("exte", exte);
|
||||
getMaps(createVo, req);
|
||||
req.put("head", createVo.getHead());
|
||||
req.put("item", createVo.getItems());
|
||||
req.put("comp", createVo.getComps());
|
||||
req.put("exte", createVo.getExte());
|
||||
req.put("acct", createVo.getAccts());
|
||||
reqDTO.setReq(req);
|
||||
|
||||
return submitToErp(reqDTO);
|
||||
@@ -53,7 +39,7 @@ public class ErpOrderServiceImpl implements ErpOrderService {
|
||||
private ErpSubmitReqDTO buildBaseReqDTO(ErpOrderSaveReqVO vo, String funcnr) {
|
||||
ErpSubmitReqDTO reqDTO = new ErpSubmitReqDTO();
|
||||
reqDTO.setFuncnr(funcnr);
|
||||
reqDTO.setBskey(vo.getOrderid());
|
||||
reqDTO.setBskey(vo.getOrderNo());
|
||||
reqDTO.setUsrid(String.valueOf(SecurityFrameworkUtils.getLoginUserId()));
|
||||
reqDTO.setUsrnm((SecurityFrameworkUtils.getLoginUserNickname()));
|
||||
return reqDTO;
|
||||
@@ -65,37 +51,6 @@ public class ErpOrderServiceImpl implements ErpOrderService {
|
||||
return response.get("resStr");
|
||||
}
|
||||
|
||||
private void getMaps(ErpOrderSaveReqVO vo, Map<String, Object> req) {
|
||||
List<Map<String, Object>> items = new ArrayList<>();
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("po_item", vo.getPoItem());
|
||||
item.put("material", vo.getMaterial());
|
||||
item.put("plant", vo.getPlant());
|
||||
item.put("stge_loc", vo.getStgeLoc());
|
||||
item.put("quantity", vo.getQuantity());
|
||||
item.put("po_unit", vo.getPoUnit());
|
||||
item.put("net_price", vo.getNetPrice());
|
||||
item.put("price_unit", vo.getPriceUnit());
|
||||
item.put("tax_code", vo.getTaxCode());
|
||||
item.put("gr_based_iv", vo.getGrBasedIv());
|
||||
item.put("unlimited_dlv", vo.getUnlimitedDlv());
|
||||
item.put("batch", vo.getBatch());
|
||||
item.put("item_cat", vo.getItemCat());
|
||||
item.put("acctass_cat", vo.getAcctassCat());
|
||||
item.put("matl_group", vo.getMatlGroup());
|
||||
item.put("short_text", vo.getShortText());
|
||||
item.put("ret_item", vo.getRetItem());
|
||||
item.put("free_item", vo.getFreeItem());
|
||||
item.put("vendr_batch", vo.getVendrBatch());
|
||||
item.put("note_xq", vo.getNoteXq());
|
||||
item.put("note_wl", vo.getNoteWl());
|
||||
item.put("vend_mat", vo.getVendMat());
|
||||
items.add(item);
|
||||
if ("K".equals(vo.getAcctassCat()) || "P".equals(vo.getAcctassCat())) {
|
||||
req.put("acct", vo.getActsCtgrDtl());
|
||||
}
|
||||
req.put("item", items);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String submitOrderToErp062(ErpOrderUpdateReqVO updateVo) {
|
||||
|
||||
@@ -159,13 +159,13 @@ public class ErpProductiveVersionServiceImpl implements ErpProductiveVersionServ
|
||||
JSONObject dataJson = dataArray.getJSONObject(i);
|
||||
if (dataJson != null) {
|
||||
ErpProductiveVersionDO DO = new ErpProductiveVersionDO();
|
||||
DO.setFactoryNumber(dataJson.getString("MATNR") != null ? dataJson.getString("MATNR").trim() : null);
|
||||
DO.setMaterialNumber(dataJson.getString("WERKS") != null ? dataJson.getString("WERKS").trim() : null);
|
||||
DO.setFactoryNumber(dataJson.getString("WERKS") != null ? dataJson.getString("WERKS").trim() : null);
|
||||
DO.setMaterialNumber(dataJson.getString("MATNR") != null ? dataJson.getString("MATNR").trim() : null);
|
||||
DO.setProductiveVersionNumber(dataJson.getString("VERID") != null ? dataJson.getString("VERID").trim() : null);
|
||||
DO.setProductiveVersionName(dataJson.getString("TEXT1"));
|
||||
DO.setBomNumber(dataJson.getString("STLAL"));
|
||||
DO.setBlineGroup(dataJson.getString("PLNNR"));
|
||||
String alnalValue = dataJson.getString("ALNAL");
|
||||
DO.setBlineGroup(dataJson.getString("ALNAL"));
|
||||
String alnalValue = dataJson.getString("PLNNR");
|
||||
// 修复:增加对空字符串的判断
|
||||
DO.setGroupCount(alnalValue != null && !alnalValue.trim().isEmpty() ? Long.valueOf(alnalValue.trim()) : null);
|
||||
String number = dataJson.getString("MATNR").trim() + "-" + dataJson.getString("WERKS").trim() + "-" + dataJson.getString("VERID").trim();
|
||||
|
||||
@@ -107,9 +107,6 @@ public class ErpConfig {
|
||||
requestBody.put("bskey", reqDTO.getBskey());
|
||||
requestBody.put("usrid", reqDTO.getUsrid());
|
||||
requestBody.put("usrnm", reqDTO.getUsrnm());
|
||||
if (reqDTO.getSign() != null) {
|
||||
requestBody.put("sign", reqDTO.getSign());
|
||||
}
|
||||
if (reqDTO.getReq() != null) {
|
||||
requestBody.put("req", reqDTO.getReq());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user