|
|
@@ -740,7 +740,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
* @param data 物料资料
|
|
|
* @return 保存之后的idList
|
|
|
*/
|
|
|
- @Transactional
|
|
|
+ @Transactional(rollbackFor = SQLException.class)
|
|
|
@Override
|
|
|
public List<Long> update(List<Product> data) {
|
|
|
List<Product> newList = new ArrayList<>();
|
|
|
@@ -780,7 +780,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
@Override
|
|
|
public void updateExisted(List<Product> updateList) {
|
|
|
jdbcTemplate.batchUpdate("update products set pr_enuu=?,pr_useruu=?,pr_code=?,pr_title=?,pr_spec=?,pr_cmpcode=?,pr_brand=?," +
|
|
|
- "pr_unit=?,pr_minorder=?,pr_minpack=?,pr_leadtime=?,pr_ltinstock=?,pr_issale=?,pr_ispurchase=?,pr_sourceapp=?,pr_pcmpcode=?,pr_pbranden=? " +
|
|
|
+ "pr_unit=?,pr_minorder=?,pr_minpack=?,pr_leadtime=?,pr_ltinstock=?,pr_issale=?,pr_ispurchase=?,pr_sourceapp=?,pr_pcmpcode=?,pr_pbranden=?,pr_kind=? " +
|
|
|
"where pr_id=?",
|
|
|
updateList, updateList.size(), new ParameterizedPreparedStatementSetter<Product>() {
|
|
|
@Override
|
|
|
@@ -802,7 +802,8 @@ public class ProductServiceImpl implements ProductService {
|
|
|
ps.setObject(15, product.getSourceApp());
|
|
|
ps.setObject(16, product.getCmpCode());
|
|
|
ps.setObject(17, product.getBrand());
|
|
|
- ps.setLong(18, product.getId());
|
|
|
+ ps.setObject(18, product.getKind());
|
|
|
+ ps.setLong(19, product.getId());
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -815,9 +816,10 @@ public class ProductServiceImpl implements ProductService {
|
|
|
@Override
|
|
|
public List<Long> insertAndReturnKey(final List<Product> newList) {
|
|
|
return jdbcTemplate.batchInsert("insert into products(pr_enuu,pr_useruu,pr_code,pr_title,pr_spec,pr_cmpcode,pr_brand," +
|
|
|
- "pr_unit,pr_minorder,pr_minpack,pr_leadtime,pr_ltinstock,pr_issale,pr_ispurchase,pr_sourceapp,pr_pcmpcode,pr_pbranden) " +
|
|
|
- "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) on duplicate key update pr_useruu=?,pr_title=?,pr_spec=?,pr_cmpcode=?,pr_brand=?," +
|
|
|
- "pr_unit=?,pr_minorder=?,pr_minpack=?,pr_leadtime=?,pr_ltinstock=?,pr_issale=?,pr_ispurchase=?,pr_sourceapp=?,pr_pcmpcode=?,pr_pbranden=?", new BatchPreparedStatementSetter() {
|
|
|
+ "pr_unit,pr_minorder,pr_minpack,pr_leadtime,pr_ltinstock,pr_issale,pr_ispurchase,pr_sourceapp,pr_pcmpcode,pr_pbranden,pr_kind) " +
|
|
|
+ "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) on duplicate key update pr_useruu=?,pr_title=?,pr_spec=?,pr_cmpcode=?,pr_brand=?," +
|
|
|
+ "pr_unit=?,pr_minorder=?,pr_minpack=?,pr_leadtime=?,pr_ltinstock=?,pr_issale=?,pr_ispurchase=?,pr_sourceapp=?,pr_pcmpcode=?," +
|
|
|
+ "pr_pbranden=?,pr_kind=?", new BatchPreparedStatementSetter() {
|
|
|
@Override
|
|
|
public void setValues(PreparedStatement ps, int i) throws SQLException {
|
|
|
Product product = newList.get(i);
|
|
|
@@ -838,22 +840,26 @@ public class ProductServiceImpl implements ProductService {
|
|
|
ps.setObject(15, product.getSourceApp());
|
|
|
ps.setObject(16, product.getCmpCode());
|
|
|
ps.setObject(17, product.getBrand());
|
|
|
+ // 这里将导入的title信息赋值给kind
|
|
|
+ ps.setObject(18, product.getTitle());
|
|
|
+
|
|
|
+ ps.setLong(19, product.getUserUU());
|
|
|
+ ps.setObject(20, product.getTitle());
|
|
|
+ ps.setObject(21, product.getSpec());
|
|
|
+ ps.setObject(22, product.getCmpCode());
|
|
|
+ ps.setObject(23, product.getBrand());
|
|
|
+ ps.setObject(24, product.getUnit());
|
|
|
+ ps.setObject(25, product.getMinOrder());
|
|
|
+ ps.setObject(26, product.getMinPack());
|
|
|
+ ps.setObject(27, product.getLeadTime());
|
|
|
+ ps.setObject(28, product.getLtinstock());
|
|
|
+ ps.setObject(29, product.getIsSale());
|
|
|
+ ps.setObject(30, product.getIsPurchase());
|
|
|
+ ps.setObject(31, product.getSourceApp());
|
|
|
+ ps.setObject(32, product.getCmpCode());
|
|
|
+ ps.setObject(33, product.getBrand());
|
|
|
+ ps.setObject(34, product.getTitle());
|
|
|
|
|
|
- ps.setLong(18, product.getUserUU());
|
|
|
- ps.setObject(19, product.getTitle());
|
|
|
- ps.setObject(20, product.getSpec());
|
|
|
- ps.setObject(21, product.getCmpCode());
|
|
|
- ps.setObject(22, product.getBrand());
|
|
|
- ps.setObject(23, product.getUnit());
|
|
|
- ps.setObject(24, product.getMinOrder());
|
|
|
- ps.setObject(25, product.getMinPack());
|
|
|
- ps.setObject(26, product.getLeadTime());
|
|
|
- ps.setObject(27, product.getLtinstock());
|
|
|
- ps.setObject(28, product.getIsSale());
|
|
|
- ps.setObject(29, product.getIsPurchase());
|
|
|
- ps.setObject(30, product.getSourceApp());
|
|
|
- ps.setObject(31, product.getCmpCode());
|
|
|
- ps.setObject(32, product.getBrand());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -867,7 +873,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
* 更新个人产品库
|
|
|
* @param products 物料信息
|
|
|
*/
|
|
|
- @Transactional
|
|
|
+ @Transactional(rollbackFor = SQLException.class)
|
|
|
@Override
|
|
|
public int updateProductUser(List<Product> products) {
|
|
|
final Date now = new Date();
|
|
|
@@ -1077,8 +1083,7 @@ public class ProductServiceImpl implements ProductService {
|
|
|
info.setPrid(product.getId());
|
|
|
info.setUseruu(productSaler.getEm_uu());
|
|
|
info.setErpid(productSaler.getPs_id());
|
|
|
- info = productUsersDao.save(info);
|
|
|
-// erpLogger.log("ERP个人物料信息同步", "关联物料id:" + info.getPrid(), 1);
|
|
|
+ productUsersDao.save(info);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1098,7 +1103,6 @@ public class ProductServiceImpl implements ProductService {
|
|
|
List<ProductUsers> prods = productUsersDao.findByEnuuAndUseruuAndErpid(productSaler.getEn_uu(), productSaler.getEm_uu(), productSaler.getPs_id());
|
|
|
if (!CollectionUtils.isEmpty(prods)) {
|
|
|
deleteList.addAll(prods);
|
|
|
-// erpLogger.log("ERP删除个人物料信息同步", "关联物料id: " + prod.getPrid(), 1);
|
|
|
}
|
|
|
}
|
|
|
if (!CollectionUtils.isEmpty(deleteList)) {
|