Explorar el Código

Merge branch 'dev-mysql' into repeat-excel

# Conflicts:
#	src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ReleaseProductByBatchServiceImpl.java
hulh hace 8 años
padre
commit
9fd8df9301

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/commodity/dao/ProductDao.java

@@ -55,7 +55,7 @@ public interface ProductDao extends JpaSpecificationExecutor<Product>, JpaReposi
      * @return count by enuu and status
      */
     @Query(value = "select count(1) from products p left join product$private pp on pp.pr_id = p.pr_id where " +
-            "p.pr_enuu=:enuu and p.pr_standard = :standard and pp.pr_b2cenabled = :enabled", nativeQuery = true)
+            "p.pr_enuu=:enuu and p.pr_pcmpcode is not null and p.pr_pbranden is not null and p.pr_standard = :standard and pp.pr_b2cenabled = :enabled", nativeQuery = true)
     Integer getCountByEnuuAndStatusAndEnabled(@Param("enuu") Long enuu, @Param("standard") Short standard, @Param("enabled") Integer enabled);
 
     /**

+ 13 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/GoodsServiceImpl.java

@@ -1360,6 +1360,19 @@ public class GoodsServiceImpl implements GoodsService {
 
     private ResultMap putOnGoods(Goods goods) {
         if (goods != null) {
+            if(goods.getProductid() != null) {
+                Product product = productDao.findOne(goods.getProductid());
+                if(product != null) {
+                    if (StringConstant.ERP.equals(product.getSourceApp())) {
+                        List<Goods> goodses = goodsDao.findByProductId(product.getId());
+                        Double reserve = productService.getGoodsReserveByErpReserve(product.getErpReserve(), goodses);
+                        reserve = NumberUtil.sub(reserve, goods.getReserve());
+                        if (NumberUtil.compare(reserve, DoubleConstant.zero) < 0) {
+                            throw new IllegalOperatorException("总在售库存量超过空闲库存量");
+                        }
+                    }
+                }
+            }
             setGoodsDefault(goods);
             ResultMap resultMap = checkGoods(goods);
             if (resultMap.getCode() != CodeType.OK.code()) {

+ 27 - 5
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ReleaseProductByBatchServiceImpl.java

@@ -106,6 +106,9 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 	@Autowired
 	private ProductPrivateDao productPrivateDao;
 
+    @Autowired
+    private ProductPersonDao productPersonDao;
+
 	@Value("#{sys.productServiceIp}")
 	private String productServiceIp;
 
@@ -205,12 +208,28 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 				}
 			}
 		}
-		if (!isAPerson) {
-			resetRepeatData(releaseProductByBatchs, isImport);
-		}
-		commonDao.save(releaseProductByBatchs, ReleaseProductByBatch.class);
 		Long userUU = SystemSession.getUser().getUserUU();
 		Long enUU = SystemSession.getUser().getEnterprise().getUu();
+		List<ReleaseProductByBatch> addList = new ArrayList<>(releaseProductByBatchs.size());
+		addList.addAll(releaseProductByBatchs);
+		resetRepeatData(addList, isAPerson);
+		if (isAPerson) {
+			for (ReleaseProductByBatch releaseProductByBatch : addList) {
+				List<Product> productList = productDao.findByEnUUAndPcmpcodeAndPbrandenAndB2cEnabled(enUU,releaseProductByBatch.getB2cCode(),
+						releaseProductByBatch.getB2cBranden(),IntegerConstant.YES_SHORT);
+				if (!CollectionUtils.isEmpty(productList)) {
+				    List<ProductPerson> productPersonList = productPersonDao.findByProductId(productList.get(0).getId());
+				    if (!CollectionUtils.isEmpty(productPersonList)) {
+                        releaseProductByBatch.setErrmsg(ErrorInfoConstant.REPEAT_INFO.getInfo());
+                        releaseProductByBatch.setReleaseCode(ReleaseStatus.had_exists.value());
+                        releaseProductByBatch.setReleaseStatus(ReleaseStatus.had_exists.getPhrase());
+                        total --;
+                    }
+				}
+			}
+		}
+		commonDao.save(addList, ReleaseProductByBatch.class);
+
 		releaseProductByBatchDao.callValidProcedure(enUU, batch);
 		Integer filter = releaseProductByBatchDao.getCountOfImportFail(userUU, batch, failCode);
 		Integer failure = releaseProductByBatchDao.getCountPublisherUuAndBatchAndReleaseCode(userUU, batch, ReleaseStatus.failure.value());
@@ -257,7 +276,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 	 * @param 	data
 	 * @param 	isImport
 	 */
-	private void resetRepeatData(List<ReleaseProductByBatch> data, Boolean isImport) {
+	private void resetRepeatData(List<ReleaseProductByBatch> data, Boolean isImport, boolean isAPerson) {
 		Long enuu = SystemSession.getUser().getEnterprise() != null ? SystemSession.getUser().getEnterprise().getUu() : null;
 		if (enuu == null) {
 			throw new IllegalOperatorException("企业enuu丢失");
@@ -271,6 +290,9 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 				each.setB2cBranden(standardList.get(0).getPbranden());
 				each.setB2cCode(standardList.get(0).getPcmpcode());
 			}
+			if (isAPerson) {
+				continue;
+			}
 			List<Product> productList = productDao.findByEnUUAndPcmpcodeAndPbrandenAndB2cEnabled(enuu, each.getB2cCode(), each.getB2cBranden(), IntegerConstant.YES_SHORT);
 			if (!CollectionUtils.isEmpty(productList)) {
 				List<Goods> goodsList = goodsDao.findRepeatGoodsInProductId(productList.get(0).getId(), each.getProductDate(), each.getPackaging(), each.getMinPackage(), each.getMinBuyQty(), each.getSelfMaxDelivery(), each.getSelfMinDelivery(), each.getUnit());

BIN
src/main/resources/jxls-tpl/trade/releaseByBatchError-person.xls


+ 1 - 1
src/main/resources/prod/sys.properties

@@ -42,7 +42,7 @@ searchUrl=http://10.10.0.76:8081
 # message ip
 messageServiceIp=http://message.ubtob.com/
 # product public ip
-productServiceIp=http://192.168.253.12:24000
+productServiceIp=http://10.10.0.197:8080
 
 # Kafka
 kafka-bootstrap-servers=10.10.100.11:9292,10.10.100.12:9292,10.10.100.13:9292,10.10.100.14:9292,10.10.100.15:9292,10.10.100.16:9292

+ 4 - 1
src/main/webapp/resources/view/vendor/forstore/vendor_material.html

@@ -1589,7 +1589,10 @@
 						</td>
 						<td class="edit">
 							<span name="delete-material" ng-show="!isBatch && !material.exPandOper && !material.addGoodsOper" ng-click="deleteMaterial(material)"><span>删除</span></span>
-							<span ng-show="!isBatch && !material.exPandOper && !material.addGoodsOper" ng-click="showShelfArea(material)"><span>添加产品</span></span>
+							<span ng-show="!isBatch && !material.exPandOper && !material.addGoodsOper" ng-click="showShelfArea(material)">
+								<span ng-if="material.batchCount">添加产品</span>
+								<span ng-if="!material.batchCount">编辑上架</span>
+							</span>
 							<span ng-if="material.batchCount" ng-show="!isBatch && !material.exPandOper && !material.addGoodsOper" ng-click="expandGoods(material)"><span>展开<i class="fa fa-angle-down" style="margin-left:2px;"></i></span></span>
 							<!--收起-->
 							<span ng-show="!isBatch && material.exPandOper" ng-click="disExpandGoods(material)" class="packUp"><span>收起<i class="fa fa-angle-up" style="margin-left:2px;"></i></span></span>

+ 1 - 1
src/main/webapp/resources/view/vendor/forstore/vendor_upload.html

@@ -655,7 +655,7 @@
                         <!--<div><a ng-click="cancelDelete()">取消</a><a ng-click="deleteBatch(deleteId)">确认</a></div>-->
                     <!--</div>-->
                 <!--</div>-->
-                <div class="com-modal-wrap" ng-if="result && result.total != 0 && !hadImport && $$productOn.tab == 'bathOnPerson' && personMedol">
+                <div class="com-modal-wrap" ng-if="result && !hadImport && $$productOn.tab == 'bathOnPerson' && personMedol">
                     <div class="com-del-box com-mall-del-box">
                         <div class="title">
                             <i ng-click="setPersonMedol()"></i>