|
|
@@ -685,15 +685,38 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
|
|
|
return map;
|
|
|
}
|
|
|
try {
|
|
|
+ Date now = new Date();
|
|
|
+ List<Product> products = new ArrayList<>();
|
|
|
+ Integer newAmount = 0;
|
|
|
List<SeekPurchaseByBatch> seekPurchaseByBatches = bom.getSeekPurchaseByBatchs();
|
|
|
if (!CollectionUtils.isEmpty(seekPurchaseByBatches)) {
|
|
|
for (SeekPurchaseByBatch batch : seekPurchaseByBatches) {
|
|
|
+ if (null == batch.getId()) {
|
|
|
+ newAmount++;
|
|
|
+ }
|
|
|
if (null == batch.getAmount()) {
|
|
|
batch.setAmount(1d);
|
|
|
}
|
|
|
+ batch.setReleaseDate(now);
|
|
|
+ Product product = new Product();
|
|
|
+ if (CollectionUtils.isEmpty(productDao.findProductByPcmpcodeAndPbrandenAndEnUU(batch.getCode(), batch.getBrand(), SystemSession.getUser().getEnterprise().getUu()))){
|
|
|
+ product.setEnUU(SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ product.setUserUU(SystemSession.getUser().getUserUU());
|
|
|
+ product.setProdNum(System.currentTimeMillis() + StringUtilB2C.getRandomNumber(5));
|
|
|
+ product.setBrand(batch.getBrand());
|
|
|
+ product.setCmpCode(batch.getCode());
|
|
|
+ product.setPbranden(batch.getBrand());
|
|
|
+ product.setPcmpcode(batch.getCode());
|
|
|
+ product.setSpec(batch.getSpec());
|
|
|
+ product.setProdName(batch.getKind());
|
|
|
+ product.setKind(batch.getKind());
|
|
|
+ products.add(product);
|
|
|
+ }
|
|
|
}
|
|
|
seekPurchaseByBatchDao.save(seekPurchaseByBatches);
|
|
|
+ productDao.save(products);
|
|
|
}
|
|
|
+ bom.setAmount(bom.getAmount() + newAmount);
|
|
|
seekPurchaseBomDao.save(bom);
|
|
|
map.put("success", true);
|
|
|
} catch (Exception e) {
|
|
|
@@ -905,7 +928,7 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
|
|
|
newProduct.setReleaseDate(now);
|
|
|
//如果该物料在物料表中不存在,则将新增物料添加到物料表中
|
|
|
Product product = new Product();
|
|
|
- if (!CollectionUtils.isEmpty(productDao.findProductByPcmpcodeAndPbrandenAndEnUU(newProduct.getCode(), newProduct.getBrand(), SystemSession.getUser().getEnterprise().getUu()))){
|
|
|
+ if (CollectionUtils.isEmpty(productDao.findProductByPcmpcodeAndPbrandenAndEnUU(newProduct.getCode(), newProduct.getBrand(), SystemSession.getUser().getEnterprise().getUu()))){
|
|
|
product.setEnUU(SystemSession.getUser().getEnterprise().getUu());
|
|
|
product.setUserUU(SystemSession.getUser().getUserUU());
|
|
|
product.setProdNum(System.currentTimeMillis() + StringUtilB2C.getRandomNumber(5));
|