新增-erp物料查询接口api
This commit is contained in:
@@ -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.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.ErpQueryReqDTO;
|
||||
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.utils.ErpConfig;
|
||||
import jakarta.annotation.Resource;
|
||||
@@ -34,6 +37,9 @@ public class ErpExternalApiImpl implements ErpExternalApi {
|
||||
private ErpConfig erpConfig;
|
||||
@Resource
|
||||
private ErpProductiveVersionService erpProductiveVersionService;
|
||||
@Resource
|
||||
private ErpMaterialService erpMaterialService;
|
||||
|
||||
|
||||
@Override
|
||||
public HashMap<String, String> submitDataToErp(ErpSubmitReqDTO reqDTO) {
|
||||
@@ -52,4 +58,10 @@ public class ErpExternalApiImpl implements ErpExternalApi {
|
||||
String productiveVersionNumber = erpProductiveVersionService.getErpProductiveVersionByFM(reqDTO);
|
||||
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 io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.Data;
|
||||
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 {
|
||||
|
||||
@Schema(description = "公司编号")
|
||||
@NotEmpty(message = "公司编号不能为空")
|
||||
private String companyNumber;
|
||||
|
||||
@Schema(description = "工厂编码")
|
||||
@NotEmpty(message = "公司编号不能为空")
|
||||
private String factoryNumber;
|
||||
|
||||
@Schema(description = "工厂名称", example = "赵六")
|
||||
@@ -27,10 +30,12 @@ public class ErpProductiveOrderPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "基本开始日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@NotEmpty(message = "公司编号不能为空")
|
||||
private LocalDateTime[] startDate;
|
||||
|
||||
@Schema(description = "基本完成日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@NotEmpty(message = "公司编号不能为空")
|
||||
private LocalDateTime[] endDate;
|
||||
|
||||
@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.mybatis.core.mapper.BaseMapperX;
|
||||
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.dal.dataobject.erp.ErpMaterialDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -40,5 +41,11 @@ public interface ErpMaterialMapper extends BaseMapperX<ErpMaterialDO> {
|
||||
|
||||
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
|
||||
private ErpProcessService erpProcessService;
|
||||
@Resource
|
||||
private ErpProductiveOrderService erpProductiveOrderService;
|
||||
@Resource
|
||||
private ErpProductiveVersionService erpProductiveVersionService;
|
||||
@Resource
|
||||
private ErpPurchaseOrganizationService erpPurchaseOrganizationService;
|
||||
@@ -50,6 +52,7 @@ public class ErpJob {
|
||||
erpInternalOrderService.callErpRfcInterface();
|
||||
erpMaterialService.callErpRfcInterface();
|
||||
erpProcessService.callErpRfcInterface();
|
||||
erpProductiveOrderService.callErpRfcInterface();
|
||||
erpProductiveVersionService.callErpRfcInterface();
|
||||
erpPurchaseOrganizationService.callErpRfcInterface();
|
||||
erpSalesOrganizationService.callErpRfcInterface();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.zt.plat.module.erp.service.erp;
|
||||
|
||||
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.ErpMaterialRespVO;
|
||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpMaterialSaveReqVO;
|
||||
@@ -64,4 +65,12 @@ public interface ErpMaterialService {
|
||||
void callErpRfcInterface();
|
||||
|
||||
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.module.api.BaseApi;
|
||||
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.utils.ErpConfig;
|
||||
import com.zt.plat.module.erp.utils.MyRedisConfig;
|
||||
@@ -124,7 +125,7 @@ public class ErpMaterialServiceImpl implements ErpMaterialService {
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 使用IN语句批量查询所有物料编码的数量
|
||||
Integer countMap = erpMaterialMapper.selectByErpMNumbers(downCenterNumbers);
|
||||
Integer countMap = erpMaterialMapper.countByErpMNumbers(downCenterNumbers);
|
||||
if (countMap > 1) {
|
||||
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
|
||||
@Transactional
|
||||
@XxlJob("getErpMaterialTask")
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -230,6 +230,7 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
|
||||
DO.setName(dataJson.getString("LGOBE"));
|
||||
DO.setNumber(dataJson.getString("LGORT").trim());
|
||||
DO.setFactoryNumber(dataJson.getString("WERKS"));
|
||||
DO.setType("ERP");
|
||||
String number = dataJson.getString("WERKS").trim() + "-" + dataJson.getString("LGORT").trim();
|
||||
if (numbers.get(number) != null) {
|
||||
// 更新
|
||||
|
||||
@@ -100,13 +100,16 @@ public class ErpConfig {
|
||||
String url = "http://" + erpAddress + "/api/rfc/post";
|
||||
// 构建请求参数
|
||||
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("srcsys", "DSC");
|
||||
requestBody.put("funcnr", reqDTO.getFuncnr());
|
||||
requestBody.put("bskey", reqDTO.getBskey());
|
||||
requestBody.put("usrid", reqDTO.getUsrid());
|
||||
requestBody.put("usrnm", reqDTO.getUsrnm());
|
||||
//todo 密码另行约定
|
||||
// requestBody.put("sign", StrUtil.(uuid + sapsys + "密码另行约定"));
|
||||
if (reqDTO.getReq() != null) {
|
||||
requestBody.put("req", reqDTO.getReq());
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
WHERE DOWN_CTR_NUM = #{item.downCenterNumber}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="selectMaxCode" resultType="java.lang.String">
|
||||
SELECT MAX(MTRL_CODE) FROM SPLY_ERP_MTRL
|
||||
</select>
|
||||
@@ -41,7 +42,7 @@
|
||||
SELECT * FROM SPLY_ERP_MTRL WHERE MTRL_ID = #{erpMId}
|
||||
</select>
|
||||
|
||||
<select id="selectByErpMNumbers" resultType="java.lang.Integer">
|
||||
<select id="countByErpMNumbers" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*)
|
||||
FROM sply_mtrl_oth
|
||||
WHERE ERP_MTRL_NUM IN
|
||||
|
||||
Reference in New Issue
Block a user