Browse Source

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

yujia 7 years ago
parent
commit
c3c9bdae38

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

@@ -2451,12 +2451,13 @@ public class ProductServiceImpl implements ProductService {
         } else {
             // 物料不存在,新增操作
             productInfo = product;
+            inOutbound = recordInventory(product, null);
         }
         if (null == productInfo.getStandard()) {
             productInfo.setStandard(IntegerConstant.NO_SHORT);
         }
         if (StringUtilB2C.isEmpty(productInfo.getProdNum())) {
-            String code = "PNUM" + StringUtilB2C.getRandomNumber(6);
+            String code = "PNUM" + createNumberService.getTimeNumber("trade$product_import_num", 8);
             productInfo.setProdNum(code);
         }
         // 最小包装数默认为1
@@ -2582,7 +2583,7 @@ public class ProductServiceImpl implements ProductService {
         String type;
         CommodityInOutbound inOutbound;
         // 原库存不存在或者当前库存大于原库存,入库
-        if (existProduct.getErpReserve() == null || product.getErpReserve() > existProduct.getErpReserve()) {
+        if (null == existProduct || existProduct.getErpReserve() == null || product.getErpReserve() > existProduct.getErpReserve()) {
             type = InOutBoundType.OTHER_INBOUND;
             inOutbound = new CommodityInOutbound(type);
             goodsInventory(product.getErpReserve(), type, existProduct.getId());

+ 1 - 1
src/main/java/com/uas/platform/b2c/trade/order/service/impl/PurchaseProductServiceImpl.java

@@ -324,7 +324,7 @@ public class PurchaseProductServiceImpl implements PurchaseProductService {
                 idSet.add(batch.getProductid());
             } else {
                 if (StringUtilB2C.isEmpty(batch.getProductNum())) {
-                    String code = "PNUM" + StringUtilB2C.getRandomNumber(6);
+                    String code = "PNUM" + createNumberService.getTimeNumber("trade$product_import_num", 8);
                     batch.setProductNum(code);
                 }
                 productCodeList.add(batch.getProductNum());

+ 8 - 0
src/main/webapp/resources/js/vendor/app.js

@@ -988,6 +988,14 @@ define([ 'angularAMD', 'ngLocal', 'common/services', 'common/directives', 'commo
 
 			$rootScope.$on('$stateChangeStart', function (event, toState) {
 
+				if($rootScope.singleEntryInfo) {
+					if (confirm('是否放弃本次编辑?')) {
+            $rootScope.singleEntryInfo = false
+					} else {
+            event.preventDefault()
+					}
+				}
+
 				if (toState.name === 'vendor_store_apply' && $rootScope.applyStatus !== 'NONE') {
 					event.preventDefault();
 					$state.go(getToStateName());

+ 18 - 5
src/main/webapp/resources/js/vendor/controllers/forstore/single_entry.js

@@ -83,6 +83,7 @@ define(['app/app', 'jquery-uploadify'], function(app) {
 
     // 品牌change事件
     $scope.onBrandChange = function(brand, index) {
+      $rootScope.singleEntryInfo = true
       $scope.objError.pbranden = false
       if (index === undefined) {
         if (brand === '') {
@@ -118,6 +119,7 @@ define(['app/app', 'jquery-uploadify'], function(app) {
     }
 
     $scope.RegulKindBlur  = function() {
+      $rootScope.singleEntryInfo = true
       $scope.objError.kind = false
     }
 
@@ -127,11 +129,12 @@ define(['app/app', 'jquery-uploadify'], function(app) {
      * @param name    品牌名称
      */
     $scope.RegulonBrandBlur = function(name) {
+      $rootScope.singleEntryInfo = true
       // setTimeout(function() {
         if (name === '') {
           $scope.Regul.BrandList = []
         } else {
-          $scope.Regul.pbranden = $scope.Regul.BrandList.value && $scope.Regul.BrandList.value[0].nameEn || name
+          $scope.Regul.pbranden = $scope.Regul.BrandList && $scope.Regul.BrandList.value && $scope.Regul.BrandList.value[0].nameEn || name
           $scope.Regul.BrandList = []
         }
       // }, 300)
@@ -143,6 +146,7 @@ define(['app/app', 'jquery-uploadify'], function(app) {
     }
 
     $scope.setBrand = function(brand, index) {
+      $rootScope.singleEntryInfo = true
       if (index === undefined) {
         $scope.Regul.pbranden = brand
         $scope.Regul.BrandList = []
@@ -167,6 +171,7 @@ define(['app/app', 'jquery-uploadify'], function(app) {
     ;
 
     $scope.onCodeChange = function(code, index) {
+      $rootScope.singleEntryInfo = true
       $scope.objError.pcmpcode = false
       if (index === undefined) {
         if (code === '') {
@@ -187,22 +192,25 @@ define(['app/app', 'jquery-uploadify'], function(app) {
      * @param name    型号名称
      */
     $scope.RegulonCodeBlur = function(name) {
+      $rootScope.singleEntryInfo = true
       if (name === '') {
         $scope.Regul.CodeList = []
       } else {
         $scope.Regul.pcmpcode = $scope.Regul.CodeList.value && $scope.Regul.CodeList.value[0].pcmpcode || name
-        $scope.Regul.CodeList = []
         $scope.Regul.pbranden = $scope.Regul.CodeList.value && $scope.Regul.CodeList.value[0].pbranden || $scope.Regul.pbranden
         $scope.Regul.spec = $scope.Regul.CodeList.value && $scope.Regul.CodeList.value[0].pbranden || $scope.Regul.spec
         $scope.Regul.kind = $scope.Regul.CodeList.value && $scope.Regul.CodeList.value[0].pbranden || $scope.Regul.kind
+        $scope.Regul.CodeList = []
       }
     }
     $scope.setCode = function(code, index) {
+      $rootScope.singleEntryInfo = true
         $scope.Regul.pcmpcode = code.pcmpcode
-        $scope.Regul.CodeList = []
+
       $scope.Regul.pbranden = code.pbranden
       $scope.Regul.spec = code.spec
       $scope.Regul.kind = code.kind
+      $scope.Regul.CodeList = []
     }
 
     var countLength = function(string) {
@@ -239,6 +247,7 @@ define(['app/app', 'jquery-uploadify'], function(app) {
     }
 
     $scope.setPriceMinPackAmount = function(num) {
+      $rootScope.singleEntryInfo = true
       if (num && num.indexOf('.') > -1) {
         toaster.pop('warning', '提示', '最小包装数不能存在小数点')
         $scope.Regul.minPackQty = 1
@@ -249,6 +258,7 @@ define(['app/app', 'jquery-uploadify'], function(app) {
     }
 
     $scope.setReserve = function(num) {
+      $rootScope.singleEntryInfo = true
       if (num && num.indexOf('.') > -1) {
         toaster.pop('warning', '提示', '库存数量不能存在小数点')
         $scope.Regul.reserve = 1
@@ -259,11 +269,13 @@ define(['app/app', 'jquery-uploadify'], function(app) {
     }
 
     $scope.setOnePrice = function(num) {
+      $rootScope.singleEntryInfo = true
       $scope.Regul.OnePrice = num
       $scope.objError.OnePrice = false
     }
     // 修改规格书
     $scope.onUploadSuccess = function(data) {
+      $rootScope.singleEntryInfo = true
       $scope.Regul.Regulpic = data.path;
       $scope.Regul.Ischange = true
     };
@@ -308,6 +320,7 @@ define(['app/app', 'jquery-uploadify'], function(app) {
         toaster.pop('warning', '提示', '最小包装数未编辑导致无法上架');
         return
       }
+      $rootScope.singleEntryInfo = true
       if (!$scope.Regul.breakUp && $scope.Regul.minBuyQty !== $scope.Regul.minPackQty) {
         if ($scope.Regul.minBuyQty % $scope.Regul.minPackQty !== 0) {
           $scope.Regul.minBuyQty = $scope.Regul.minPackQty
@@ -520,13 +533,13 @@ define(['app/app', 'jquery-uploadify'], function(app) {
         return;
       }
 
-      if ($scope.Regul.minPackQty !== '' && /\D/.test($scope.Regul.minPackQty)) {
+      if ($scope.Regul.minPackQty && /\D/.test($scope.Regul.minPackQty)) {
         toaster.pop('warning','提示', '最小包装数输入不正确')
         $scope.objError.minPackQty = true
         return;
       }
 
-      if ($scope.Regul.OnePrice !== '' && !/^\d+(\.\d+)?$/.test($scope.Regul.OnePrice)) {
+      if ($scope.Regul.OnePrice && !/^\d+(\.\d+)?$/.test($scope.Regul.OnePrice.trim())) {
         toaster.pop('warning','提示', '成本单价输入不正确')
         $scope.objError.OnePrice = true
         return;

+ 2 - 2
src/main/webapp/resources/view/vendor/forstore/single_entry.html

@@ -150,8 +150,8 @@
   <div class="pro_management device">
     <div class="com_tab">
       <ul class="fl" style="width: 100%" ng-if="!isPcbStore">
-        <li ng-class="{'active': tab == 'bathOn'}"><a>导入产品</a></li>
-        <li ng-class="{'active': tab == 'single_entry'}"><a ui-sref="single_entry">单个录入</a></li>
+        <li ng-class="{'active': tab == 'bathOn'}"><a ui-sref="vendor_upload">导入产品</a></li>
+        <li ng-class="{'active': tab == 'single_entry'}"><a >单个录入</a></li>
         <!--<li ng-class="{'active': $$productOn.tab == 'bathOn'}" ng-click="toggleActive('bathOn')"><a href="">导入产品并上架</a></li>-->
         <!--<li ng-class="{'active': $$productOn.tab == 'bathOnPerson'}" ng-click="toggleActive('bathOnPerson')"><a href="">导入产品</a></li>-->
       </ul>