|
|
@@ -178,56 +178,71 @@ public class PurchaseProdInOutTask extends AbstractTask {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private final String TYPE_PURC_ACCETP = "采购验收单";
|
|
|
+ private final String TYPE_PURC_RETURN = "采购验退单";
|
|
|
+ private final String TYPE_MAKE_ACCETP = "委外验收单";
|
|
|
+ private final String TYPE_MAKE_RETURN = "委外验退单";
|
|
|
+
|
|
|
@TaskMapping(title = "批量更新采购验收单明细单价", fixedDelay = 60000)
|
|
|
public void uploadUpdatePriceByBatch() {
|
|
|
- List<ProdInOutRefreshPrice> prods = jdbcTemplate.queryForBeanList("select pbu_pdno,pbu_inoutno,pbu_orderprice,pbu_id from PriceBatchUpdate where pbu_piclass = '采购验收单' and pbu_status = '99' and pbu_sendstatus = '待上传' and rownum < 200",
|
|
|
- ProdInOutRefreshPrice.class);
|
|
|
+ List<ProdInOutRefreshPrice> prods = getPriceBatchUpdate(TYPE_PURC_ACCETP);
|
|
|
if (!CollectionUtils.isEmpty(prods)) {
|
|
|
ContextHolder.setDataSize(prods.size());
|
|
|
post("/erp/purchase/prodInOut/refreshPrice", dataWrap(prods));
|
|
|
- // 更新状态
|
|
|
- String idStr = CollectionUtil.getKeyString(prods);
|
|
|
- jdbcTemplate.execute("update PriceBatchUpdate set pbu_sendstatus='已上传' where pbu_id in (" + idStr + ")");
|
|
|
+ updateSendStatus(prods);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@TaskMapping(title = "批量更新采购验退单明细单价", fixedDelay = 60000)
|
|
|
public void uploadUpdatePurcReturnPriceByBatch() {
|
|
|
- List<ProdInOutRefreshPrice> prods = jdbcTemplate.queryForBeanList("select pbu_pdno,pbu_inoutno,pbu_orderprice,pbu_id from PriceBatchUpdate where pbu_piclass = '采购验退单' and pbu_status = '99' and pbu_sendstatus = '待上传' and rownum < 200",
|
|
|
- ProdInOutRefreshPrice.class);
|
|
|
+ List<ProdInOutRefreshPrice> prods = getPriceBatchUpdate(TYPE_PURC_RETURN);
|
|
|
if (!CollectionUtils.isEmpty(prods)) {
|
|
|
ContextHolder.setDataSize(prods.size());
|
|
|
post("/erp/purchase/prodInOut/refreshPrice/purc/return", dataWrap(prods));
|
|
|
- // 更新状态
|
|
|
- String idStr = CollectionUtil.getKeyString(prods);
|
|
|
- jdbcTemplate.execute("update PriceBatchUpdate set pbu_sendstatus='已上传' where pbu_id in (" + idStr + ")");
|
|
|
+ updateSendStatus(prods);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@TaskMapping(title = "批量更新委外验收单明细单价", fixedDelay = 60000)
|
|
|
public void uploadUpdateMakeAcceptPriceByBatch() {
|
|
|
- List<ProdInOutRefreshPrice> prods = jdbcTemplate.queryForBeanList("select pbu_pdno,pbu_inoutno,pbu_orderprice,pbu_id from PriceBatchUpdate where pbu_piclass = '委外验收单' and pbu_status = '99' and pbu_sendstatus = '待上传' and rownum < 200",
|
|
|
- ProdInOutRefreshPrice.class);
|
|
|
+ List<ProdInOutRefreshPrice> prods = getPriceBatchUpdate(TYPE_MAKE_ACCETP);
|
|
|
if (!CollectionUtils.isEmpty(prods)) {
|
|
|
ContextHolder.setDataSize(prods.size());
|
|
|
post("/erp/purchase/prodInOut/refreshPrice/make/accept", dataWrap(prods));
|
|
|
- // 更新状态
|
|
|
- String idStr = CollectionUtil.getKeyString(prods);
|
|
|
- jdbcTemplate.execute("update PriceBatchUpdate set pbu_sendstatus='已上传' where pbu_id in (" + idStr + ")");
|
|
|
+ updateSendStatus(prods);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@TaskMapping(title = "批量更新委外验退单明细单价", fixedDelay = 60000)
|
|
|
public void uploadUpdateMakeReutrnPriceByBatch() {
|
|
|
- List<ProdInOutRefreshPrice> prods = jdbcTemplate.queryForBeanList("select pbu_pdno,pbu_inoutno,pbu_orderprice,pbu_id from PriceBatchUpdate where pbu_piclass = '委外验退单' and pbu_status = '99' and pbu_sendstatus = '待上传' and rownum < 200",
|
|
|
- ProdInOutRefreshPrice.class);
|
|
|
+ List<ProdInOutRefreshPrice> prods = getPriceBatchUpdate(TYPE_MAKE_RETURN);
|
|
|
if (!CollectionUtils.isEmpty(prods)) {
|
|
|
ContextHolder.setDataSize(prods.size());
|
|
|
post("/erp/purchase/prodInOut/refreshPrice/make/return", dataWrap(prods));
|
|
|
- // 更新状态
|
|
|
- String idStr = CollectionUtil.getKeyString(prods);
|
|
|
- jdbcTemplate.execute("update PriceBatchUpdate set pbu_sendstatus='已上传' where pbu_id in (" + idStr + ")");
|
|
|
+ updateSendStatus(prods);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取批量更新单价的待上传的单据
|
|
|
+ *
|
|
|
+ * @param type 单据类型
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ List<ProdInOutRefreshPrice> getPriceBatchUpdate(String type) {
|
|
|
+ String sql = "select pbu_pdNo,pbu_inoutNo,pbu_orderPrice,pbu_id,pbu_taxRate,pd_prodCode,pd_orderDetNo from PriceBatchUpdate " +
|
|
|
+ "left join prodIoDetail on pbu_pdId = pd_id " +
|
|
|
+ "where pbu_piClass = '" + type + "' and pbu_status = '99' and pbu_sendStatus = '待上传' and rowNum < 200";
|
|
|
+ return jdbcTemplate.queryForBeanList(sql, ProdInOutRefreshPrice.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 上传之后更新状态
|
|
|
+ *
|
|
|
+ * @param prods
|
|
|
+ */
|
|
|
+ private void updateSendStatus(List<ProdInOutRefreshPrice> prods) {
|
|
|
+ String idStr = CollectionUtil.getKeyString(prods);
|
|
|
+ jdbcTemplate.execute("update PriceBatchUpdate set pbu_sendstatus='已上传' where pbu_id in (" + idStr + ")");
|
|
|
+ }
|
|
|
}
|