Browse Source

erp bug处理

wangdy 7 years ago
parent
commit
622272e1ed

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

@@ -1615,8 +1615,8 @@ public class GoodsServiceImpl implements GoodsService {
                 if (StringConstant.ERP.equals(product.getSourceApp())) {
                     List<Goods> goodses = goodsDao.findByProductId(product.getId());
                     Double reserve = productService.getGoodsReserveByErpReserve(product.getErpReserve(), goodses);
-                    reserve = NumberUtil.add(reserve, nowGoods.getReserve());
-                    reserve = NumberUtil.sub(reserve, oldGoods.getReserve());
+                    reserve = NumberUtil.add(reserve, oldGoods.getReserve());
+                    reserve = NumberUtil.sub(reserve, nowGoods.getReserve());
                     if (NumberUtil.compare(reserve, DoubleConstant.zero) < 0) {
                         throw new IllegalOperatorException("总在售库存量超过空闲库存量");
                     }

+ 19 - 0
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_materialCtrl.js

@@ -910,6 +910,25 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
 			}
 		};
 
+        // 一键匹配erp
+        $scope.matchAllForERP = function () {
+            Material.matchNonProduct({}, {}, function (data) {
+                if (data.success) {
+                    $scope.resultFrame = true;
+                    $scope.matchTotal = data.data.total;
+                    $scope.matchSuccess = data.data.success;
+                    $scope.matchFail = data.data.fail;
+                    $scope.standard_tab = 'matchResult';
+                    $scope.param.type = "nStandard";
+                    loadData();
+                } else {
+                    toaster.pop("info", data.message);
+                }
+            }, function (error) {
+                toaster.pop("error", "匹配操作失败!")
+            });
+		}
+
         // 一键添加到个人产品库
         $scope.setAllInPerson = function () {
             if ($scope.chooseAllPage) {

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

@@ -1613,7 +1613,7 @@
 					<a ng-click="download()">批量导出</a>
 				</div>
 				<div class="check fr">
-					<a ng-click="matchAll()" ng-show="!isBatch"><span>一键匹配</span></a>
+					<a ng-click="matchAllForERP()" ng-show="!isBatch"><span>一键匹配</span></a>
 					<a ng-click="enterBatch()" ng-show="!isBatch"><span>批量操作</span></a>
 					<!--<span class="check-btn" ng-show="isBatch">-->
 						<!--<label class="check-active">-->