|
|
@@ -21,7 +21,6 @@ public class PurchaseForecastTask extends AbstractTask {
|
|
|
|
|
|
@TaskMapping(title = "上传采购预测单", fixedDelay = 60000)
|
|
|
public void uploadPurchaseForecasts() {
|
|
|
- uploadProduct();
|
|
|
List<PurchaseForecast> purchaseForecasts = getPurchaseForecastsUpload();
|
|
|
if (!CollectionUtils.isEmpty(purchaseForecasts)) {
|
|
|
ContextHolder.setDataSize(purchaseForecasts.size());
|
|
|
@@ -29,24 +28,6 @@ public class PurchaseForecastTask extends AbstractTask {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 上传物料资料
|
|
|
- */
|
|
|
- private void uploadProduct() {
|
|
|
- final List<Prod> prods = jdbcTemplate.queryForBeanList("select * from (select distinct product.* from product where exists " +
|
|
|
- " (select 1 from purchaseforecastdetail left join vendor on pfd_vendcode=ve_code " +
|
|
|
- " left join purchaseForecast on pfd_pfid=pf_id " +
|
|
|
- " where PF_SENDSTATUS='待上传' and ve_uu is not null and nvl(ve_b2benable,0)=1 and pfd_prodcode=pr_code) " +
|
|
|
- " and pr_statuscode='AUDITED' and nvl(pr_sendstatus,' ')<>'已上传') where rownum <= 500", Prod.class);
|
|
|
- if (!CollectionUtils.isEmpty(prods)) {
|
|
|
- new ProductHandler(prods).run();
|
|
|
- if (prods.size() == DATA_SIZE_LIMIT) {
|
|
|
- // 递归,直到相关物料全部传完
|
|
|
- uploadProduct();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 获取需要上传的采购预测
|
|
|
*
|
|
|
@@ -61,7 +42,8 @@ public class PurchaseForecastTask extends AbstractTask {
|
|
|
List<PurchaseForecastDetail> purchaseForecastDetails = jdbcTemplate.queryForBeanList("select purchaseforecastdetail.*, ve_uu, ve_contact, ve_contactuu from purchaseforecastDetail "
|
|
|
+ "left join vendor on pfd_vendcode=ve_code where pfd_pfid=? and ve_uu is not null and nvl(ve_b2benable,0)=1 ",
|
|
|
PurchaseForecastDetail.class, purchaseForecast.getPf_id());
|
|
|
- if (purchaseForecastDetails.size() > 0) {// 存在有效的明细的单上传,明细都无效的不上传
|
|
|
+ // 存在有效的明细的单上传,明细都无效的不上传
|
|
|
+ if (purchaseForecastDetails.size() > 0) {
|
|
|
purchaseForecast.setPurchaseForecastDetails(purchaseForecastDetails);
|
|
|
forecasts.add(purchaseForecast);
|
|
|
}
|