Browse Source

Merge remote-tracking branch 'origin/release-201827-wangcz' into release-201827-wangcz

wangcz 7 years ago
parent
commit
b673a0ce78

+ 11 - 1
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/CommodityInOutboundServiceImpl.java

@@ -186,6 +186,7 @@ public class CommodityInOutboundServiceImpl implements CommodityInOutboundServic
             inOutbound.setInOutId(inOutboundId);
             Short i = 1;
             Set<InOutboundDetail> set = new HashSet<>();
+            Set<Product> productSet = new HashSet<>();
             if (CollectionUtils.isNotEmpty(prids)) {
                 List<Product> products = productService.findByProductId(prids);
                 for (InOutboundDetail inOutboundDetail : detaiList) {
@@ -202,12 +203,14 @@ public class CommodityInOutboundServiceImpl implements CommodityInOutboundServic
 
                                 }
                                 product.setErpReserve(NumberUtil.add(product.getErpReserve(), inOutboundDetail.getQty()));
+                                productSet.add(product);
                             } else {
                                 //出库
                                 if (NumberUtil.compare(product.getErpReserve(), DoubleConstant.zero) == 0) {
                                     throw new IllegalOperatorException("型号:" + product.getPcmpcode() + ",品牌:" +product.getPbranden()+"的物料为0,不能做出库");
                                 } else if (NumberUtil.compare(product.getErpReserve(), inOutboundDetail.getQty()) > 0) {
                                     product.setErpReserve(NumberUtil.sub(product.getErpReserve(), inOutboundDetail.getQty()));
+                                    productSet.add(product);
                                 } else {
                                     throw new IllegalOperatorException("型号:" + product.getPcmpcode() + ",品牌:" +product.getPbranden()+"的物料库存数为"+product.getErpReserve() + "出库数是:"+inOutboundDetail.getQty()+"不能做出库");
                                 }
@@ -238,7 +241,14 @@ public class CommodityInOutboundServiceImpl implements CommodityInOutboundServic
             //重新计算成本价、在售产品的库存信息需要更新
             List<Long> pridList = new ArrayList<>();
             pridList.addAll(prids);
-            productService.updateProductsByInBound(pridList);
+            List<Product> productList = new ArrayList<>();
+            productList.addAll(productSet);
+            if (CollectionUtils.isNotEmpty(productList)) {
+                productService.save(productList);
+            }
+            if (CollectionUtils.isNotEmpty(pridList)) {
+                productService.updateProductsByInBound(pridList);
+            }
             return ResultMap.success(commodityInOutbound);
         }
     }

BIN
src/main/resources/jxls-tpl/trade/products.xls


+ 2 - 2
src/main/webapp/resources/js/usercenter/controllers/forstore/order_detail_ctrl.js

@@ -250,9 +250,9 @@ define(['app/app'], function(app) {
         }
         $scope.acceptGoods = $scope.order.signReceive
         $scope.ChooseItem = $scope.sendGoodsList.length > 0 ? $scope.sendGoodsList[0] : ''
-				if ($scope.acceptGoods) {
+				// if ($scope.acceptGoods) {
           getReceiveInfo()
-        }
+        // }
 				// todo 这里需要根据 是否存在已收货数据
 
 				$scope.order.orderHistory = angular.fromJson($scope.order.statushistory);