parent
8d52e46d35
commit
ab2c3d0c0c
12 changed files with 319 additions and 0 deletions
@ -0,0 +1,43 @@ |
||||
package org.springblade.job.processor.quality; |
||||
|
||||
import lombok.RequiredArgsConstructor; |
||||
import org.springblade.desk.order.feign.IApsClient; |
||||
import org.springblade.desk.order.pojo.entity.YieldPlan; |
||||
import org.springblade.erpdata.feign.IErpMesRbWoClient; |
||||
import org.springblade.erpdata.pojo.dto.view.MesRbWo; |
||||
import tech.powerjob.worker.core.processor.ProcessResult; |
||||
import tech.powerjob.worker.core.processor.TaskContext; |
||||
import tech.powerjob.worker.core.processor.sdk.BasicProcessor; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
@RequiredArgsConstructor |
||||
public class MesRbWoProcessor implements BasicProcessor { |
||||
|
||||
private final IErpMesRbWoClient mesRbWoClient; |
||||
|
||||
private final IApsClient apsClient; |
||||
|
||||
@Override |
||||
public ProcessResult process(TaskContext taskContext) throws Exception { |
||||
List<MesRbWo> mesRbWoList=mesRbWoClient.getList(null).getData(); |
||||
List<YieldPlan> yieldPlanList=new ArrayList<>(); |
||||
mesRbWoList.forEach(mesRbWo -> { |
||||
YieldPlan yieldPlan=new YieldPlan(); |
||||
yieldPlan.setYpCode(mesRbWo.getWono()); |
||||
yieldPlan.setPartCode(mesRbWo.getPrtno()); |
||||
yieldPlan.setProductType(mesRbWo.getPrtlotno()); |
||||
yieldPlan.setPartName(mesRbWo.getPlndept()); |
||||
yieldPlan.setPlate(mesRbWo.getWoporqty()); |
||||
yieldPlan.setProductIdent(mesRbWo.getWoreqdat()); |
||||
yieldPlan.setUseDept(Long.valueOf(mesRbWo.getPlannerdesc())); |
||||
yieldPlan.setYpQty(Long.valueOf(mesRbWo.getWototqty())); |
||||
yieldPlan.setYpArea(new BigDecimal(mesRbWo.getPrtmdept())); |
||||
yieldPlanList.add(yieldPlan); |
||||
}); |
||||
apsClient.saveList(yieldPlanList); |
||||
return new ProcessResult(true); |
||||
} |
||||
} |
||||
@ -0,0 +1,63 @@ |
||||
/** |
||||
* BladeX Commercial License Agreement |
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p> |
||||
* Use of this software is governed by the Commercial License Agreement |
||||
* obtained after purchasing a license from BladeX. |
||||
* <p> |
||||
* 1. This software is for development use only under a valid license |
||||
* from BladeX. |
||||
* <p> |
||||
* 2. Redistribution of this software's source code to any third party |
||||
* without a commercial license is strictly prohibited. |
||||
* <p> |
||||
* 3. Licensees may copyright their own code but cannot use segments |
||||
* from this software for such purposes. Copyright of this software |
||||
* remains with BladeX. |
||||
* <p> |
||||
* Using this software signifies agreement to this License, and the software |
||||
* must not be used for illegal purposes. |
||||
* <p> |
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is |
||||
* not liable for any claims arising from secondary or illegal development. |
||||
* <p> |
||||
* Author: Chill Zhuang (bladejava@qq.com) |
||||
*/ |
||||
package org.springblade.erpdata.feign; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import org.springblade.core.launch.constant.AppConstant; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.erpdata.pojo.dto.AllocationDTO; |
||||
import org.springblade.erpdata.pojo.dto.view.MesRbWo; |
||||
import org.springframework.cloud.openfeign.FeignClient; |
||||
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Feign接口类 |
||||
* |
||||
* @author Chill |
||||
*/ |
||||
@FeignClient( |
||||
value = AppConstant.APPLICATION_SYSTEM_NAME, |
||||
fallback = IErpMesRbWoClientFallback.class |
||||
) |
||||
public interface IErpMesRbWoClient { |
||||
|
||||
String API_PREFIX = "/feign/erpdata/mesrbwo"; |
||||
String GET_LIST = API_PREFIX + "/getList"; |
||||
|
||||
/** |
||||
* 查询烧结配套信息 |
||||
* |
||||
* @param |
||||
* @param entity |
||||
* @return |
||||
*/ |
||||
@PostMapping(GET_LIST) |
||||
R<List<MesRbWo>> getList(MesRbWo entity); |
||||
|
||||
} |
||||
@ -0,0 +1,22 @@ |
||||
package org.springblade.erpdata.feign; |
||||
|
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.erpdata.pojo.dto.view.MesRbWo; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Feign失败配置 |
||||
* |
||||
* @author lqk |
||||
* @date 2025-12-17 15:13 |
||||
*/ |
||||
@Component |
||||
public class IErpMesRbWoClientFallback implements IErpMesRbWoClient { |
||||
|
||||
@Override |
||||
public R<List<MesRbWo>> getList(MesRbWo entity) { |
||||
return R.fail("获取数据失败"); |
||||
} |
||||
} |
||||
@ -1,10 +1,30 @@ |
||||
package org.springblade.erpdata.pojo.dto.view; |
||||
|
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* 对应ERP中视图 v_mes_rb_wo |
||||
* |
||||
* @author lqk |
||||
* @date 2026-01-16 17:34 |
||||
*/ |
||||
@Data |
||||
public class MesRbWo { |
||||
|
||||
private String wono; |
||||
private String prtno; |
||||
private String prtlotno; |
||||
private String plndept; |
||||
private String woporqty; |
||||
private String woreqdat; |
||||
private String plannerdesc; |
||||
private String wopordat; |
||||
private String remark; |
||||
private String wototqty; |
||||
private String prtmdept; |
||||
private String processline; |
||||
private String warctlrdesc; |
||||
private String kdofplat; |
||||
private String processlinedesc; |
||||
private String prodline; |
||||
} |
||||
|
||||
@ -0,0 +1,62 @@ |
||||
/** |
||||
* BladeX Commercial License Agreement |
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p> |
||||
* Use of this software is governed by the Commercial License Agreement |
||||
* obtained after purchasing a license from BladeX. |
||||
* <p> |
||||
* 1. This software is for development use only under a valid license |
||||
* from BladeX. |
||||
* <p> |
||||
* 2. Redistribution of this software's source code to any third party |
||||
* without a commercial license is strictly prohibited. |
||||
* <p> |
||||
* 3. Licensees may copyright their own code but cannot use segments |
||||
* from this software for such purposes. Copyright of this software |
||||
* remains with BladeX. |
||||
* <p> |
||||
* Using this software signifies agreement to this License, and the software |
||||
* must not be used for illegal purposes. |
||||
* <p> |
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is |
||||
* not liable for any claims arising from secondary or illegal development. |
||||
* <p> |
||||
* Author: Chill Zhuang (bladejava@qq.com) |
||||
*/ |
||||
package org.springblade.erpdata.feign; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import io.swagger.v3.oas.annotations.Hidden; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.tenant.annotation.NonDS; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.erpdata.pojo.dto.AllocationDTO; |
||||
import org.springblade.erpdata.pojo.dto.view.MesRbWo; |
||||
import org.springblade.erpdata.service.IErpDataSearchService; |
||||
import org.springblade.erpdata.service.IErpMesRbWoService; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
import java.util.List; |
||||
|
||||
|
||||
/** |
||||
* 字典服务Feign实现类 |
||||
* |
||||
* @author Chill |
||||
*/ |
||||
@NonDS |
||||
@Hidden |
||||
@RestController |
||||
@AllArgsConstructor |
||||
public class ErpMesRbWoClient implements IErpMesRbWoClient { |
||||
|
||||
private final IErpMesRbWoService erpMesRbWoService; |
||||
|
||||
|
||||
@Override |
||||
public R<List<MesRbWo>> getList(MesRbWo entity) { |
||||
return R.data(erpMesRbWoService.getList(entity)); |
||||
} |
||||
} |
||||
@ -0,0 +1,21 @@ |
||||
package org.springblade.erpdata.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.Mapper; |
||||
import org.springblade.erpdata.pojo.dto.view.MesRbWo; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Mapper 接口 |
||||
* |
||||
* @author lqk |
||||
*/ |
||||
public interface ErpMesRbWoMapper extends Mapper { |
||||
|
||||
/** |
||||
* 从ERP视图中获取要同步的生产计划 |
||||
* |
||||
* @return |
||||
*/ |
||||
List<MesRbWo> getYieldPlanErpList(); |
||||
} |
||||
@ -0,0 +1,9 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace = "org.springblade.erpdata.mapper.ErpMesRbWoMapper"> |
||||
|
||||
<select id = "getYieldPlanErpList" resultType = "org.springblade.erpdata.pojo.dto.view.MesRbWo"> |
||||
SELECT * FROM v_mes_rb_wo WHERE is_deleted = 0 |
||||
</select> |
||||
|
||||
</mapper> |
||||
@ -0,0 +1,22 @@ |
||||
package org.springblade.erpdata.service; |
||||
|
||||
import org.springblade.erpdata.pojo.dto.view.MesRbWo; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* ERP数据查询service |
||||
* |
||||
* @author lqk |
||||
*/ |
||||
public interface IErpMesRbWoService { |
||||
|
||||
/** |
||||
* 查询订单数据 |
||||
* |
||||
* @param entity |
||||
* @return |
||||
*/ |
||||
List<MesRbWo> getList(MesRbWo entity); |
||||
|
||||
} |
||||
@ -0,0 +1,33 @@ |
||||
package org.springblade.erpdata.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import lombok.RequiredArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.erpdata.mapper.ErpDataSearchMapper; |
||||
import org.springblade.erpdata.mapper.ErpMesRbWoMapper; |
||||
import org.springblade.erpdata.pojo.dto.AllocationDTO; |
||||
import org.springblade.erpdata.pojo.dto.view.MesRbWo; |
||||
import org.springblade.erpdata.service.IErpDataSearchService; |
||||
import org.springblade.erpdata.service.IErpMesRbWoService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author lqk |
||||
* @date 2025-11-26 9:39 |
||||
*/ |
||||
@Slf4j |
||||
@RequiredArgsConstructor |
||||
@Service |
||||
public class ErpMesRbWoServiceImpl implements IErpMesRbWoService { |
||||
|
||||
private final ErpMesRbWoMapper mesRbWoMapper; |
||||
|
||||
|
||||
@Override |
||||
public List<MesRbWo> getList(MesRbWo entity) { |
||||
return mesRbWoMapper.getYieldPlanErpList(); |
||||
} |
||||
} |
||||
Loading…
Reference in new issue