|
|
@@ -64,21 +64,23 @@ public class MessageListener implements ApplicationListener<SaveReleaseEvent<?,
|
|
|
if (null != item) {
|
|
|
//先取出企业uu
|
|
|
// 产品库存在
|
|
|
- String prodSql = "select distinct pr_enuu enuu from products p left join purc$vendors v " +
|
|
|
- "on v.ve_vendenuu = p.pr_enuu where p.pr_title = '" + item.getProduct().getTitle() + "' " +
|
|
|
- "and v.ve_myenuu = " + item.getInquiry().getEnUU();
|
|
|
+ String prodSql = "select distinct pr_enuu enuu from products where (pr_title = '" + item.getProduct().getTitle() +
|
|
|
+ "' or pr_code = '" + item.getProduct().getCode() + "') and pr_enuu <> " + item.getInquiry().getEnUU();
|
|
|
// 询价单已报价的
|
|
|
String inquirySql = "select distinct id_venduu enuu from purc$inquiryitems d left join purc$inquiry n " +
|
|
|
"on n.in_id = d.id_inid left join products p on p.pr_id = d.id_prid where d.id_status = 201 " +
|
|
|
- "and p.pr_title = '" + item.getProduct().getTitle() + "' and n.in_enuu = " + item.getInquiry().getEnUU();
|
|
|
+ "and (p.pr_title = '" + item.getProduct().getTitle() + "' or p.pr_code = '" + item.getProduct().getCode()
|
|
|
+ +"') and n.in_enuu = " + item.getInquiry().getEnUU();
|
|
|
// 下过采购订单的
|
|
|
String orderSql = "select distinct pu_venduu enuu from purc$orders pu left join purc$orderitems pd " +
|
|
|
"on pu.pu_id = pd.pd_puid left join products p on p.pr_id = pd.pd_prid " +
|
|
|
- "where p.pr_title = '" + item.getProduct().getTitle() + "' and pu.pu_enuu = " + item.getInquiry().getEnUU();
|
|
|
+ "where (p.pr_title = '" + item.getProduct().getTitle() + "' or p.pr_code = '" + item.getProduct().getCode()
|
|
|
+ +"') and pu.pu_enuu = " + item.getInquiry().getEnUU();
|
|
|
// 主动报价过的
|
|
|
String quotationSql = "select distinct qu_enuu enuu from sale$quotation qu left join sale$quotationitem qd" +
|
|
|
" on qu.qu_id = qd.qd_quid left join products p on qd.qd_prid = p.pr_id " +
|
|
|
- "where p.pr_title = '" + item.getProduct().getTitle() + "' and qu.qu_custuu = " + item.getInquiry().getEnUU();
|
|
|
+ "where (p.pr_title = '" + item.getProduct().getTitle() + "' or p.pr_code = '" + item.getProduct().getCode()
|
|
|
+ +"') and qu.qu_custuu = " + item.getInquiry().getEnUU();
|
|
|
List<UserAndEnterprise> prodEnUUs = commonDao.query(prodSql, UserAndEnterprise.class);
|
|
|
List<UserAndEnterprise> inquiryEnUUs = commonDao.query(inquirySql, UserAndEnterprise.class);
|
|
|
List<UserAndEnterprise> orderEnUUs = commonDao.query(orderSql, UserAndEnterprise.class);
|