|
|
@@ -77,15 +77,53 @@ public class ProductTempDao {
|
|
|
String.class, importId);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 未匹配物料
|
|
|
+ *
|
|
|
+ * @param importId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public List<Product> getNotMatchedProducts(String importId) {
|
|
|
return jdbcTemplate.query("select pr_code code,pr_title title,pr_spec spec,pr_cmpcode cmpCode,pr_brand brand,pr_unit unit,pr_minpack minPack,pr_minorder minOrder,pr_leadtime leadtime,pr_ltinstock ltinstock,pr_enuu enUU,pr_useruu userUU," +
|
|
|
"pr_issale isSale,pr_ispurchase isPurchase,pr_isshow isShow,pr_standard standard,pr_ispubsale isPubsale,pr_sourceapp sourceApp,pr_create_time createTime from products_temp where pr_import_id=? and pr_exist_id is null",
|
|
|
new BeanPropertyRowMapper<Product>(Product.class), importId);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 已匹配物料
|
|
|
+ *
|
|
|
+ * @param importId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public List<Product> getMatchedProducts(String importId) {
|
|
|
- return jdbcTemplate.query("select pr_id id,pr_code code,pr_title title,pr_spec spec,pr_cmpcode cmpCode,pr_brand brand,pr_unit unit,pr_minpack minPack,pr_minorder minOrder,pr_leadtime leadtime,pr_ltinstock ltinstock,pr_enuu enUU,pr_useruu userUU," +
|
|
|
- "pr_issale isSale,pr_ispurchase isPurchase,pr_isshow isShow,pr_standard standard,pr_ispubsale isPubsale,pr_sourceapp sourceApp,pr_create_time createTime from products p where exists (select 1 from products_temp t where t.pr_exist_id=p.pr_id and t.pr_import_id=?)",
|
|
|
+ return jdbcTemplate.query("select p.pr_id id,p.pr_sourceid sourceId,p.pr_erpdate erpDate,p.pr_cmpuuid cmpUuId,p.pr_attachment attachment," +
|
|
|
+ "p.pr_kind kind,p.pr_pbrand pbrand,p.pr_pcmpcode pcmpcode,p.pr_kinden kinden,p.pr_pbranden pbranden,p.pr_matchstatus matchstatus," +
|
|
|
+ "p.pr_matchsize matchsize,p.pr_downloadstatus downloadstatus,p.pr_cmpimg img,p.pr_encapsulation encapsulation,p.pr_tostandard tostandard," +
|
|
|
+ "p.pr_goodsnover goodsnover,p.pr_goodstaxno goodstaxno,p.pr_taxpre taxpre,p.pr_taxprecon taxprecon,p.pr_reserve reserve,p.pr_kindid kindId," +
|
|
|
+ "p.pr_pbrandid pbrandId,p.pr_pbranduuid pbrandUuid,p.pr_packaging packaging,p.pr_manufacturedate manufactureDate,p.pr_maxdelivery maxDelivery," +
|
|
|
+ "p.pr_mindelivery minDelivery,p.pr_isbreakup isBreakUp," +
|
|
|
+ "t.pr_code code,t.pr_title title,t.pr_spec spec,t.pr_cmpcode cmpCode,t.pr_brand brand,t.pr_unit unit,t.pr_minpack minPack,t.pr_minorder minOrder,t.pr_leadtime leadtime,t.pr_ltinstock ltinstock,t.pr_enuu enUU,t.pr_useruu userUU," +
|
|
|
+ "t.pr_issale isSale,t.pr_ispurchase isPurchase,t.pr_isshow isShow,t.pr_standard standard,t.pr_ispubsale isPubsale,t.pr_sourceapp sourceApp,t.pr_create_time createTime " +
|
|
|
+ "from products p,products_temp t where t.pr_exist_id=p.pr_id and t.pr_import_id=?",
|
|
|
+ new BeanPropertyRowMapper<Product>(Product.class), importId);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 全部物料:已匹配+未匹配
|
|
|
+ *
|
|
|
+ * @param importId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<Product> getProducts(String importId) {
|
|
|
+ return jdbcTemplate.query("select p.pr_id id,p.pr_sourceid sourceId,p.pr_erpdate erpDate,p.pr_cmpuuid cmpUuId,p.pr_attachment attachment," +
|
|
|
+ "p.pr_kind kind,p.pr_pbrand pbrand,p.pr_pcmpcode pcmpcode,p.pr_kinden kinden,p.pr_pbranden pbranden,p.pr_matchstatus matchstatus," +
|
|
|
+ "p.pr_matchsize matchsize,p.pr_downloadstatus downloadstatus,p.pr_cmpimg img,p.pr_encapsulation encapsulation,p.pr_tostandard tostandard," +
|
|
|
+ "p.pr_goodsnover goodsnover,p.pr_goodstaxno goodstaxno,p.pr_taxpre taxpre,p.pr_taxprecon taxprecon,p.pr_reserve reserve,p.pr_kindid kindId," +
|
|
|
+ "p.pr_pbrandid pbrandId,p.pr_pbranduuid pbrandUuid,p.pr_packaging packaging,p.pr_manufacturedate manufactureDate,p.pr_maxdelivery maxDelivery," +
|
|
|
+ "p.pr_mindelivery minDelivery,p.pr_isbreakup isBreakUp," +
|
|
|
+ "t.pr_code code,t.pr_title title,t.pr_spec spec,t.pr_cmpcode cmpCode,t.pr_brand brand,t.pr_unit unit,t.pr_minpack minPack,t.pr_minorder minOrder,t.pr_leadtime leadtime,t.pr_ltinstock ltinstock,t.pr_enuu enUU,t.pr_useruu userUU," +
|
|
|
+ "t.pr_issale isSale,t.pr_ispurchase isPurchase,t.pr_isshow isShow,t.pr_standard standard,t.pr_ispubsale isPubsale,t.pr_sourceapp sourceApp,t.pr_create_time createTime " +
|
|
|
+ "from products_temp t left join products p on t.pr_exist_id=p.pr_id where t.pr_import_id=?",
|
|
|
new BeanPropertyRowMapper<Product>(Product.class), importId);
|
|
|
}
|
|
|
|
|
|
@@ -94,6 +132,7 @@ public class ProductTempDao {
|
|
|
}
|
|
|
|
|
|
public List<ProductUsers> getNotMatchedProductUsers(final String importId, final long enUU, final long userUU, List<Long> ids) {
|
|
|
+ // 使用临时表productusers_temp方便操作
|
|
|
jdbcTemplate.batchUpdate("insert into productusers_temp(pu_import_id,pu_date,pu_enuu,pu_useruu,pu_prid) values (?,sysdate,?,?,?)",
|
|
|
ids, ids.size(), new ParameterizedPreparedStatementSetter<Long>() {
|
|
|
@Override
|