新增-erp物料查询接口api
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package com.zt.plat.module.erp.api;
|
package com.zt.plat.module.erp.api;
|
||||||
|
|
||||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||||
|
import com.zt.plat.module.erp.api.dto.ErpMaterialDTO;
|
||||||
import com.zt.plat.module.erp.api.dto.ErpProductiveVersionReqDTO;
|
import com.zt.plat.module.erp.api.dto.ErpProductiveVersionReqDTO;
|
||||||
import com.zt.plat.module.erp.api.dto.ErpQueryReqDTO;
|
import com.zt.plat.module.erp.api.dto.ErpQueryReqDTO;
|
||||||
import com.zt.plat.module.erp.api.dto.ErpSubmitReqDTO;
|
import com.zt.plat.module.erp.api.dto.ErpSubmitReqDTO;
|
||||||
@@ -33,4 +34,8 @@ public interface ErpExternalApi {
|
|||||||
@GetMapping(PREFIX + "/queryProductiveVersion")
|
@GetMapping(PREFIX + "/queryProductiveVersion")
|
||||||
@Operation(summary = "生产版本数据查询")
|
@Operation(summary = "生产版本数据查询")
|
||||||
CommonResult<String> getErpProductiveVersionByFM(@Valid @RequestBody ErpProductiveVersionReqDTO reqDTO);
|
CommonResult<String> getErpProductiveVersionByFM(@Valid @RequestBody ErpProductiveVersionReqDTO reqDTO);
|
||||||
|
|
||||||
|
@GetMapping(PREFIX + "/queryMaterial")
|
||||||
|
@Operation(summary = "物料数据查询")
|
||||||
|
CommonResult<ErpMaterialDTO> getErpMaterial(@Valid @RequestBody ErpMaterialDTO reqDTO);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package com.zt.plat.module.erp.api.dto;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - ERP物料数据 Response VO")
|
||||||
|
@Data
|
||||||
|
public class ErpMaterialDTO {
|
||||||
|
|
||||||
|
@Schema(description = "主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "中铜物料编码;系统使用时使用该编码")
|
||||||
|
private String downCenterNumber;
|
||||||
|
|
||||||
|
@Schema(description = "物料编码")
|
||||||
|
private String materialNumber;
|
||||||
|
|
||||||
|
@Schema(description = "中铝物料编码")
|
||||||
|
private String centerNumber;
|
||||||
|
|
||||||
|
@Schema(description = "创建日期")
|
||||||
|
private LocalDateTime createDate;
|
||||||
|
|
||||||
|
@Schema(description = "物料类型", example = "2")
|
||||||
|
private String materialType;
|
||||||
|
|
||||||
|
@Schema(description = "物料大类组")
|
||||||
|
private String materialGroupDate;
|
||||||
|
|
||||||
|
@Schema(description = "外部物料小类组")
|
||||||
|
private String externalMaterialGroupDate;
|
||||||
|
|
||||||
|
@Schema(description = "计量单位编码")
|
||||||
|
private String unit;
|
||||||
|
|
||||||
|
@Schema(description = "计量单位描述")
|
||||||
|
private String unitDescription;
|
||||||
|
|
||||||
|
@Schema(description = "物料类型描述")
|
||||||
|
private String materialTypeDescription;
|
||||||
|
|
||||||
|
@Schema(description = "物料组描述")
|
||||||
|
private String materialGroupDescription;
|
||||||
|
|
||||||
|
@Schema(description = "外部物料小类组描述")
|
||||||
|
private String externalMaterialGroupDescription;
|
||||||
|
|
||||||
|
@Schema(description = "物料名称", example = "李四")
|
||||||
|
private String materialName;
|
||||||
|
|
||||||
|
@Schema(description = "物料长描述")
|
||||||
|
private String materialLengthDescription;
|
||||||
|
|
||||||
|
@Schema(description = "类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@Schema(description = "金属元素缩写")
|
||||||
|
private String abbreviation;
|
||||||
|
|
||||||
|
@Schema(description = "金属元素名称", example = "赵六")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "金属元素编码")
|
||||||
|
private String coding;
|
||||||
|
|
||||||
|
@Schema(description = "品位单位")
|
||||||
|
private String gradeUnit;
|
||||||
|
|
||||||
|
@Schema(description = "小数位数")
|
||||||
|
private Long decimalValue;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,9 +2,12 @@ package com.zt.plat.module.erp.api;
|
|||||||
|
|
||||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||||
|
import com.zt.plat.module.erp.api.dto.ErpMaterialDTO;
|
||||||
import com.zt.plat.module.erp.api.dto.ErpProductiveVersionReqDTO;
|
import com.zt.plat.module.erp.api.dto.ErpProductiveVersionReqDTO;
|
||||||
import com.zt.plat.module.erp.api.dto.ErpQueryReqDTO;
|
import com.zt.plat.module.erp.api.dto.ErpQueryReqDTO;
|
||||||
import com.zt.plat.module.erp.api.dto.ErpSubmitReqDTO;
|
import com.zt.plat.module.erp.api.dto.ErpSubmitReqDTO;
|
||||||
|
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpMaterialRespVO;
|
||||||
|
import com.zt.plat.module.erp.service.erp.ErpMaterialService;
|
||||||
import com.zt.plat.module.erp.service.erp.ErpProductiveVersionService;
|
import com.zt.plat.module.erp.service.erp.ErpProductiveVersionService;
|
||||||
import com.zt.plat.module.erp.utils.ErpConfig;
|
import com.zt.plat.module.erp.utils.ErpConfig;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
@@ -34,6 +37,9 @@ public class ErpExternalApiImpl implements ErpExternalApi {
|
|||||||
private ErpConfig erpConfig;
|
private ErpConfig erpConfig;
|
||||||
@Resource
|
@Resource
|
||||||
private ErpProductiveVersionService erpProductiveVersionService;
|
private ErpProductiveVersionService erpProductiveVersionService;
|
||||||
|
@Resource
|
||||||
|
private ErpMaterialService erpMaterialService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HashMap<String, String> submitDataToErp(ErpSubmitReqDTO reqDTO) {
|
public HashMap<String, String> submitDataToErp(ErpSubmitReqDTO reqDTO) {
|
||||||
@@ -52,4 +58,10 @@ public class ErpExternalApiImpl implements ErpExternalApi {
|
|||||||
String productiveVersionNumber = erpProductiveVersionService.getErpProductiveVersionByFM(reqDTO);
|
String productiveVersionNumber = erpProductiveVersionService.getErpProductiveVersionByFM(reqDTO);
|
||||||
return success(productiveVersionNumber);
|
return success(productiveVersionNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonResult<ErpMaterialDTO> getErpMaterial(ErpMaterialDTO reqDTO) {
|
||||||
|
ErpMaterialDTO dto = erpMaterialService.getErpMaterial(reqDTO);
|
||||||
|
return success(dto);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.zt.plat.module.erp.controller.admin.erp.vo;
|
|||||||
|
|
||||||
import com.zt.plat.framework.common.pojo.PageParam;
|
import com.zt.plat.framework.common.pojo.PageParam;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
@@ -14,9 +15,11 @@ import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
|
|||||||
public class ErpProductiveOrderPageReqVO extends PageParam {
|
public class ErpProductiveOrderPageReqVO extends PageParam {
|
||||||
|
|
||||||
@Schema(description = "公司编号")
|
@Schema(description = "公司编号")
|
||||||
|
@NotEmpty(message = "公司编号不能为空")
|
||||||
private String companyNumber;
|
private String companyNumber;
|
||||||
|
|
||||||
@Schema(description = "工厂编码")
|
@Schema(description = "工厂编码")
|
||||||
|
@NotEmpty(message = "公司编号不能为空")
|
||||||
private String factoryNumber;
|
private String factoryNumber;
|
||||||
|
|
||||||
@Schema(description = "工厂名称", example = "赵六")
|
@Schema(description = "工厂名称", example = "赵六")
|
||||||
@@ -27,10 +30,12 @@ public class ErpProductiveOrderPageReqVO extends PageParam {
|
|||||||
|
|
||||||
@Schema(description = "基本开始日期")
|
@Schema(description = "基本开始日期")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
@NotEmpty(message = "公司编号不能为空")
|
||||||
private LocalDateTime[] startDate;
|
private LocalDateTime[] startDate;
|
||||||
|
|
||||||
@Schema(description = "基本完成日期")
|
@Schema(description = "基本完成日期")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
@NotEmpty(message = "公司编号不能为空")
|
||||||
private LocalDateTime[] endDate;
|
private LocalDateTime[] endDate;
|
||||||
|
|
||||||
@Schema(description = "主产品物料编号")
|
@Schema(description = "主产品物料编号")
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.zt.plat.module.erp.dal.mysql.erp;
|
|||||||
import com.zt.plat.framework.common.pojo.PageResult;
|
import com.zt.plat.framework.common.pojo.PageResult;
|
||||||
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import com.zt.plat.module.erp.api.dto.ErpMaterialDTO;
|
||||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpMaterialPageReqVO;
|
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpMaterialPageReqVO;
|
||||||
import com.zt.plat.module.erp.dal.dataobject.erp.ErpMaterialDO;
|
import com.zt.plat.module.erp.dal.dataobject.erp.ErpMaterialDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
@@ -40,5 +41,11 @@ public interface ErpMaterialMapper extends BaseMapperX<ErpMaterialDO> {
|
|||||||
|
|
||||||
String selectMaxCode();
|
String selectMaxCode();
|
||||||
|
|
||||||
Integer selectByErpMNumbers(List<String> erpMNumber);
|
Integer countByErpMNumbers(List<String> erpMNumber);
|
||||||
|
|
||||||
|
default ErpMaterialDO selectOne(ErpMaterialDTO dto) {
|
||||||
|
return selectOne(new LambdaQueryWrapperX<ErpMaterialDO>()
|
||||||
|
.eq(ErpMaterialDO::getDownCenterNumber, dto.getDownCenterNumber())
|
||||||
|
.last("limit 1"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -30,6 +30,8 @@ public class ErpJob {
|
|||||||
@Resource
|
@Resource
|
||||||
private ErpProcessService erpProcessService;
|
private ErpProcessService erpProcessService;
|
||||||
@Resource
|
@Resource
|
||||||
|
private ErpProductiveOrderService erpProductiveOrderService;
|
||||||
|
@Resource
|
||||||
private ErpProductiveVersionService erpProductiveVersionService;
|
private ErpProductiveVersionService erpProductiveVersionService;
|
||||||
@Resource
|
@Resource
|
||||||
private ErpPurchaseOrganizationService erpPurchaseOrganizationService;
|
private ErpPurchaseOrganizationService erpPurchaseOrganizationService;
|
||||||
@@ -50,6 +52,7 @@ public class ErpJob {
|
|||||||
erpInternalOrderService.callErpRfcInterface();
|
erpInternalOrderService.callErpRfcInterface();
|
||||||
erpMaterialService.callErpRfcInterface();
|
erpMaterialService.callErpRfcInterface();
|
||||||
erpProcessService.callErpRfcInterface();
|
erpProcessService.callErpRfcInterface();
|
||||||
|
erpProductiveOrderService.callErpRfcInterface();
|
||||||
erpProductiveVersionService.callErpRfcInterface();
|
erpProductiveVersionService.callErpRfcInterface();
|
||||||
erpPurchaseOrganizationService.callErpRfcInterface();
|
erpPurchaseOrganizationService.callErpRfcInterface();
|
||||||
erpSalesOrganizationService.callErpRfcInterface();
|
erpSalesOrganizationService.callErpRfcInterface();
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.zt.plat.module.erp.service.erp;
|
package com.zt.plat.module.erp.service.erp;
|
||||||
|
|
||||||
import com.zt.plat.framework.common.pojo.PageResult;
|
import com.zt.plat.framework.common.pojo.PageResult;
|
||||||
|
import com.zt.plat.module.erp.api.dto.ErpMaterialDTO;
|
||||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpMaterialPageReqVO;
|
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpMaterialPageReqVO;
|
||||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpMaterialRespVO;
|
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpMaterialRespVO;
|
||||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpMaterialSaveReqVO;
|
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpMaterialSaveReqVO;
|
||||||
@@ -64,4 +65,12 @@ public interface ErpMaterialService {
|
|||||||
void callErpRfcInterface();
|
void callErpRfcInterface();
|
||||||
|
|
||||||
PageResult<ErpMaterialRespVO> getErpMaterialPageAndOther(ErpMaterialPageReqVO pageReqVO);
|
PageResult<ErpMaterialRespVO> getErpMaterialPageAndOther(ErpMaterialPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得ERP物料数据
|
||||||
|
*
|
||||||
|
* @param DTO
|
||||||
|
* @return ERP物料数据
|
||||||
|
*/
|
||||||
|
ErpMaterialDTO getErpMaterial(ErpMaterialDTO DTO);
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,7 @@ import com.zt.plat.framework.common.util.object.BeanUtils;
|
|||||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import com.zt.plat.module.api.BaseApi;
|
import com.zt.plat.module.api.BaseApi;
|
||||||
import com.zt.plat.module.api.dto.MaterialOtherDTO;
|
import com.zt.plat.module.api.dto.MaterialOtherDTO;
|
||||||
|
import com.zt.plat.module.erp.api.dto.ErpMaterialDTO;
|
||||||
import com.zt.plat.module.erp.dal.dataobject.erp.ErpWarehouseDO;
|
import com.zt.plat.module.erp.dal.dataobject.erp.ErpWarehouseDO;
|
||||||
import com.zt.plat.module.erp.utils.ErpConfig;
|
import com.zt.plat.module.erp.utils.ErpConfig;
|
||||||
import com.zt.plat.module.erp.utils.MyRedisConfig;
|
import com.zt.plat.module.erp.utils.MyRedisConfig;
|
||||||
@@ -124,7 +125,7 @@ public class ErpMaterialServiceImpl implements ErpMaterialService {
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
// 使用IN语句批量查询所有物料编码的数量
|
// 使用IN语句批量查询所有物料编码的数量
|
||||||
Integer countMap = erpMaterialMapper.selectByErpMNumbers(downCenterNumbers);
|
Integer countMap = erpMaterialMapper.countByErpMNumbers(downCenterNumbers);
|
||||||
if (countMap > 1) {
|
if (countMap > 1) {
|
||||||
throw exception(ERP_MATERIAL_OTHER_NOT_ALLOW_DELETE);
|
throw exception(ERP_MATERIAL_OTHER_NOT_ALLOW_DELETE);
|
||||||
}
|
}
|
||||||
@@ -175,6 +176,12 @@ public class ErpMaterialServiceImpl implements ErpMaterialService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ErpMaterialDTO getErpMaterial(ErpMaterialDTO DTO) {
|
||||||
|
ErpMaterialDO erpMaterialDO = erpMaterialMapper.selectOne(DTO);
|
||||||
|
return BeanUtils.toBean(erpMaterialDO, ErpMaterialDTO.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
@XxlJob("getErpMaterialTask")
|
@XxlJob("getErpMaterialTask")
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||||
import com.zt.plat.framework.common.pojo.PageResult;
|
import com.zt.plat.framework.common.pojo.PageResult;
|
||||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||||
|
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpProductiveVersionPageReqVO;
|
||||||
|
import com.zt.plat.module.erp.dal.dataobject.erp.ErpProductiveVersionDO;
|
||||||
import com.zt.plat.module.erp.utils.ErpConfig;
|
import com.zt.plat.module.erp.utils.ErpConfig;
|
||||||
import com.zt.plat.module.erp.utils.MyRedisConfig;
|
import com.zt.plat.module.erp.utils.MyRedisConfig;
|
||||||
import com.zt.plat.module.erp.enums.OftenEnum;
|
import com.zt.plat.module.erp.enums.OftenEnum;
|
||||||
@@ -102,82 +104,88 @@ public class ErpProductiveOrderServiceImpl implements ErpProductiveOrderService
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ErpProductiveOrderDO> getErpProductiveOrderPage(ErpProductiveOrderPageReqVO pageReqVO) {
|
public PageResult<ErpProductiveOrderDO> getErpProductiveOrderPage(ErpProductiveOrderPageReqVO pageReqVO) {
|
||||||
OftenEnum.FuncnrEnum funcnrEnum = OftenEnum.FuncnrEnum.生产订单;
|
return erpProductiveOrderMapper.selectPage(pageReqVO);
|
||||||
String funcnr = funcnrEnum.getFuncnr();
|
|
||||||
Map<String, Object> req = new HashMap<>();
|
|
||||||
|
|
||||||
// 构建查询参数
|
|
||||||
req.put("BUKRS", pageReqVO.getCompanyNumber());
|
|
||||||
req.put("WERKS", pageReqVO.getFactoryNumber());
|
|
||||||
|
|
||||||
// 处理日期参数
|
|
||||||
if (pageReqVO.getStartDate() != null) {
|
|
||||||
req.put("BEGDA", pageReqVO.getStartDate()[0].format(DateTimeFormatter.ofPattern("yyyyMMdd")));
|
|
||||||
}
|
|
||||||
if (pageReqVO.getEndDate() != null) {
|
|
||||||
req.put("ENDDA", pageReqVO.getEndDate()[0].format(DateTimeFormatter.ofPattern("yyyyMMdd")));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 调用ERP接口获取数据
|
//直接从erp查询生产订单
|
||||||
HashMap<String, Object> dataFromERP = erpConfig.fetchDataFromERP(funcnr, req);
|
// @Override
|
||||||
JSONArray dataArray = (JSONArray) dataFromERP.get("E_RESP");
|
// public PageResult<ErpProductiveOrderDO> getErpProductiveOrderPage(ErpProductiveOrderPageReqVO pageReqVO) {
|
||||||
if (dataArray == null || dataArray.isEmpty()) {
|
// OftenEnum.FuncnrEnum funcnrEnum = OftenEnum.FuncnrEnum.生产订单;
|
||||||
// 返回空结果而不是抛出异常
|
// String funcnr = funcnrEnum.getFuncnr();
|
||||||
return new PageResult<>(new ArrayList<>(), 0L);
|
// Map<String, Object> req = new HashMap<>();
|
||||||
}
|
//
|
||||||
|
// // 构建查询参数
|
||||||
List<ErpProductiveOrderDO> list = new ArrayList<>();
|
// req.put("BUKRS", pageReqVO.getCompanyNumber());
|
||||||
for (int i = 0; i < dataArray.size(); i++) {
|
// req.put("WERKS", pageReqVO.getFactoryNumber());
|
||||||
JSONObject dataJson = dataArray.getJSONObject(i);
|
//
|
||||||
if (dataJson != null) {
|
// // 处理日期参数
|
||||||
ErpProductiveOrderDO orderDO = new ErpProductiveOrderDO();
|
// if (pageReqVO.getStartDate() != null) {
|
||||||
|
// req.put("BEGDA", pageReqVO.getStartDate()[0].format(DateTimeFormatter.ofPattern("yyyyMMdd")));
|
||||||
// 基本信息
|
// }
|
||||||
orderDO.setCompanyNumber(dataJson.getString("BUKRS"));
|
// if (pageReqVO.getEndDate() != null) {
|
||||||
orderDO.setFactoryNumber(dataJson.getString("WERKS").trim());
|
// req.put("ENDDA", pageReqVO.getEndDate()[0].format(DateTimeFormatter.ofPattern("yyyyMMdd")));
|
||||||
orderDO.setFactoryName(dataJson.getString("NAME1"));
|
// }
|
||||||
orderDO.setOrderNumber(dataJson.getString("AUFNR"));
|
//
|
||||||
|
// // 调用ERP接口获取数据
|
||||||
// 日期处理
|
// HashMap<String, Object> dataFromERP = erpConfig.fetchDataFromERP(funcnr, req);
|
||||||
String plannedStartDate = dataJson.getString("GLTRP");
|
// JSONArray dataArray = (JSONArray) dataFromERP.get("E_RESP");
|
||||||
String actualStartDate = dataJson.getString("GSTRP");
|
// if (dataArray == null || dataArray.isEmpty()) {
|
||||||
|
// // 返回空结果而不是抛出异常
|
||||||
if (plannedStartDate != null && !plannedStartDate.equals("0000-00-00")) {
|
// return new PageResult<>(new ArrayList<>(), 0L);
|
||||||
try {
|
// }
|
||||||
orderDO.setStartDate(LocalDateTime.parse(plannedStartDate));
|
//
|
||||||
} catch (Exception e) {
|
// List<ErpProductiveOrderDO> list = new ArrayList<>();
|
||||||
// 忽略日期解析错误
|
// for (int i = 0; i < dataArray.size(); i++) {
|
||||||
}
|
// JSONObject dataJson = dataArray.getJSONObject(i);
|
||||||
}
|
// if (dataJson != null) {
|
||||||
|
// ErpProductiveOrderDO orderDO = new ErpProductiveOrderDO();
|
||||||
if (actualStartDate != null && !actualStartDate.equals("0000-00-00")) {
|
//
|
||||||
try {
|
// // 基本信息
|
||||||
orderDO.setEndDate(LocalDateTime.parse(actualStartDate));
|
// orderDO.setCompanyNumber(dataJson.getString("BUKRS"));
|
||||||
} catch (Exception e) {
|
// orderDO.setFactoryNumber(dataJson.getString("WERKS").trim());
|
||||||
// 忽略日期解析错误
|
// orderDO.setFactoryName(dataJson.getString("NAME1"));
|
||||||
}
|
// orderDO.setOrderNumber(dataJson.getString("AUFNR"));
|
||||||
}
|
//
|
||||||
|
// // 日期处理
|
||||||
// 物料和工艺信息
|
// String plannedStartDate = dataJson.getString("GLTRP");
|
||||||
orderDO.setMainMaterialNumber(dataJson.getString("STLBEZ"));
|
// String actualStartDate = dataJson.getString("GSTRP");
|
||||||
orderDO.setUnit(dataJson.getString("GMEIN"));
|
//
|
||||||
orderDO.setMaterialDescription(dataJson.getString("MAKTX"));
|
// if (plannedStartDate != null && !plannedStartDate.equals("0000-00-00")) {
|
||||||
orderDO.setProcessingList(dataJson.getString("L_AFVC"));
|
// try {
|
||||||
orderDO.setProcessingNumber(dataJson.getString("VORNR"));
|
// orderDO.setStartDate(LocalDateTime.parse(plannedStartDate));
|
||||||
orderDO.setProcessingDescription(dataJson.getString("LTXA1"));
|
// } catch (Exception e) {
|
||||||
orderDO.setObjectNumber(dataJson.getString("OBJID"));
|
// // 忽略日期解析错误
|
||||||
orderDO.setWorkCenterNumber(dataJson.getString("ARBPL"));
|
// }
|
||||||
orderDO.setWorkCenterDescription(dataJson.getString("KTEXT"));
|
// }
|
||||||
orderDO.setCostcenterNumber(dataJson.getString("KOSTL"));
|
//
|
||||||
orderDO.setCostcenterName(dataJson.getString("TEXT_C"));
|
// if (actualStartDate != null && !actualStartDate.equals("0000-00-00")) {
|
||||||
|
// try {
|
||||||
list.add(orderDO);
|
// orderDO.setEndDate(LocalDateTime.parse(actualStartDate));
|
||||||
}
|
// } catch (Exception e) {
|
||||||
}
|
// // 忽略日期解析错误
|
||||||
|
// }
|
||||||
// 返回分页结果
|
// }
|
||||||
return new PageResult<>(list, (long) list.size());
|
//
|
||||||
}
|
// // 物料和工艺信息
|
||||||
|
// orderDO.setMainMaterialNumber(dataJson.getString("STLBEZ"));
|
||||||
|
// orderDO.setUnit(dataJson.getString("GMEIN"));
|
||||||
|
// orderDO.setMaterialDescription(dataJson.getString("MAKTX"));
|
||||||
|
// orderDO.setProcessingList(dataJson.getString("L_AFVC"));
|
||||||
|
// orderDO.setProcessingNumber(dataJson.getString("VORNR"));
|
||||||
|
// orderDO.setProcessingDescription(dataJson.getString("LTXA1"));
|
||||||
|
// orderDO.setObjectNumber(dataJson.getString("OBJID"));
|
||||||
|
// orderDO.setWorkCenterNumber(dataJson.getString("ARBPL"));
|
||||||
|
// orderDO.setWorkCenterDescription(dataJson.getString("KTEXT"));
|
||||||
|
// orderDO.setCostcenterNumber(dataJson.getString("KOSTL"));
|
||||||
|
// orderDO.setCostcenterName(dataJson.getString("TEXT_C"));
|
||||||
|
//
|
||||||
|
// list.add(orderDO);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 返回分页结果
|
||||||
|
// return new PageResult<>(list, (long) list.size());
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
|
|||||||
@@ -230,6 +230,7 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
|
|||||||
DO.setName(dataJson.getString("LGOBE"));
|
DO.setName(dataJson.getString("LGOBE"));
|
||||||
DO.setNumber(dataJson.getString("LGORT").trim());
|
DO.setNumber(dataJson.getString("LGORT").trim());
|
||||||
DO.setFactoryNumber(dataJson.getString("WERKS"));
|
DO.setFactoryNumber(dataJson.getString("WERKS"));
|
||||||
|
DO.setType("ERP");
|
||||||
String number = dataJson.getString("WERKS").trim() + "-" + dataJson.getString("LGORT").trim();
|
String number = dataJson.getString("WERKS").trim() + "-" + dataJson.getString("LGORT").trim();
|
||||||
if (numbers.get(number) != null) {
|
if (numbers.get(number) != null) {
|
||||||
// 更新
|
// 更新
|
||||||
|
|||||||
@@ -100,13 +100,16 @@ public class ErpConfig {
|
|||||||
String url = "http://" + erpAddress + "/api/rfc/post";
|
String url = "http://" + erpAddress + "/api/rfc/post";
|
||||||
// 构建请求参数
|
// 构建请求参数
|
||||||
JSONObject requestBody = new JSONObject();
|
JSONObject requestBody = new JSONObject();
|
||||||
requestBody.put("uuid", UUID.randomUUID().toString());
|
String uuid = UUID.randomUUID().toString();
|
||||||
|
requestBody.put("uuid", uuid);
|
||||||
requestBody.put("sapsys", sapsys);
|
requestBody.put("sapsys", sapsys);
|
||||||
requestBody.put("srcsys", "DSC");
|
requestBody.put("srcsys", "DSC");
|
||||||
requestBody.put("funcnr", reqDTO.getFuncnr());
|
requestBody.put("funcnr", reqDTO.getFuncnr());
|
||||||
requestBody.put("bskey", reqDTO.getBskey());
|
requestBody.put("bskey", reqDTO.getBskey());
|
||||||
requestBody.put("usrid", reqDTO.getUsrid());
|
requestBody.put("usrid", reqDTO.getUsrid());
|
||||||
requestBody.put("usrnm", reqDTO.getUsrnm());
|
requestBody.put("usrnm", reqDTO.getUsrnm());
|
||||||
|
//todo 密码另行约定
|
||||||
|
// requestBody.put("sign", StrUtil.(uuid + sapsys + "密码另行约定"));
|
||||||
if (reqDTO.getReq() != null) {
|
if (reqDTO.getReq() != null) {
|
||||||
requestBody.put("req", reqDTO.getReq());
|
requestBody.put("req", reqDTO.getReq());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
WHERE DOWN_CTR_NUM = #{item.downCenterNumber}
|
WHERE DOWN_CTR_NUM = #{item.downCenterNumber}
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="selectMaxCode" resultType="java.lang.String">
|
<select id="selectMaxCode" resultType="java.lang.String">
|
||||||
SELECT MAX(MTRL_CODE) FROM SPLY_ERP_MTRL
|
SELECT MAX(MTRL_CODE) FROM SPLY_ERP_MTRL
|
||||||
</select>
|
</select>
|
||||||
@@ -41,7 +42,7 @@
|
|||||||
SELECT * FROM SPLY_ERP_MTRL WHERE MTRL_ID = #{erpMId}
|
SELECT * FROM SPLY_ERP_MTRL WHERE MTRL_ID = #{erpMId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectByErpMNumbers" resultType="java.lang.Integer">
|
<select id="countByErpMNumbers" resultType="java.lang.Integer">
|
||||||
SELECT COUNT(*)
|
SELECT COUNT(*)
|
||||||
FROM sply_mtrl_oth
|
FROM sply_mtrl_oth
|
||||||
WHERE ERP_MTRL_NUM IN
|
WHERE ERP_MTRL_NUM IN
|
||||||
|
|||||||
Reference in New Issue
Block a user