Ver código fonte

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

wangcz 7 anos atrás
pai
commit
420eb47205

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

@@ -2418,6 +2418,8 @@ public class ProductServiceImpl implements ProductService {
         product.setPcmpcode(product.getCmpCode());
         product.setKind(product.getProdName());
         product.setSourceApp("B2C");
+        product.setEnUU(enUU);
+        product.setUserUU(userUU);
         product.setCreateTime(new Date(System.currentTimeMillis()));
         // PCB产品做标准判断处理
         if (null != isPcb && Objects.equals(IntegerConstant.YES_SHORT, isPcb)) {
@@ -2440,6 +2442,13 @@ public class ProductServiceImpl implements ProductService {
             // 物料不存在,新增操作
             productInfo = product;
         }
+        if (null == productInfo.getStandard()) {
+            productInfo.setStandard(IntegerConstant.NO_SHORT);
+        }
+        if (StringUtilB2C.isEmpty(productInfo.getProdNum())) {
+            String code = "PNUM" + StringUtilB2C.getRandomNumber(6);
+            productInfo.setProdNum(code);
+        }
         // 最小包装数默认为1
         Double minPackQty = productInfo.getMinPackQty() == null ? DoubleConstant.minReserve : productInfo.getMinPackQty();
         productInfo.setMinPackQty(minPackQty);
@@ -2447,9 +2456,9 @@ public class ProductServiceImpl implements ProductService {
         // 最小起订量默认为最小包装数
         Double minBuyQty = productInfo.getMinOrder() == null ? productInfo.getMinPackQty() : productInfo.getMinOrder();
         productInfo.setMinOrder(minBuyQty);
+        productInfo = productDao.save(productInfo);
         // 设置库存信息
         assignmentGoods(goods, productInfo);
-        productInfo = productDao.save(productInfo);
         // 保存到商城私有库
         ProductPrivate productPrivate = new ProductPrivate(productInfo.getId());
         productPrivate.setAttach(product.getAttachment());
@@ -2675,19 +2684,6 @@ public class ProductServiceImpl implements ProductService {
         goodsService.setGoodsDefault(goods);
         boolean autoPublish = goods.getAutoPublish() == null ? true : goods.getAutoPublish();
         goods.setAutoPublish(autoPublish);
-        final Double minBuyQty = goods.getMinBuyQty();
-        if (CollectionUtils.isNotEmpty(goods.getPrices())) {
-            goods.getPrices().forEach(subPrice -> {
-                // 分段数量不能超过最大数量
-                Double endQty = NumberUtil.compare(subPrice.getEnd(), DoubleConstant.maxReserve) == 1 ? DoubleConstant.maxReserve : subPrice.getEnd();
-                subPrice.setEnd(endQty);
-
-                // 起始数量不能大于最小订购数
-                Double startQty = NumberUtil.compare(minBuyQty, subPrice.getStart()) == 1 ? subPrice.getStart() : minBuyQty;
-                subPrice.setStart(startQty);
-            });
-        }
-        goods.setQtyPrice(JSON.toJSONString(goods.getPrices()));
         StoreIn storeIn = storeInService.findByEnUU(SystemSession.getUser().getEnterprise().getUu());
         if (storeIn != null && storeIn.getStatus() == StoreStatus.OPENED) {
             goods.setStoreid(storeIn.getUuid());

+ 11 - 13
src/main/webapp/resources/js/vendor/controllers/forstore/single_entry.js

@@ -202,21 +202,18 @@ define(['app/app', 'jquery-uploadify'], function(app) {
      * @param name    型号名称
      */
     $scope.RegulonCodeBlur = function(name) {
-      if (name === '') {
-        $scope.Regul.CodeList = []
-      } else {
-        $scope.Regul.pcmpcode = $scope.Regul.CodeList.value && $scope.Regul.CodeList.value[0].code || name
-        $scope.Regul.CodeList = []
-      }
+      setTimeout(function() {
+        if (name === '') {
+          $scope.Regul.CodeList = []
+        } else {
+          $scope.Regul.pcmpcode = $scope.Regul.CodeList.value && $scope.Regul.CodeList.value[0].code || name
+          $scope.Regul.CodeList = []
+        }
+      }, 0)
     }
     $scope.setCode = function(code, index) {
-      if (index === undefined) {
         $scope.Regul.pcmpcode = code
         $scope.Regul.CodeList = []
-      } else {
-        $scope.replaceMaterialList[index].ptrCmpcode = code;
-        $scope.setShowSimilarCodeList(false, index);
-      }
     }
 
     $scope.getSimilarCode = function(keyword, index) {
@@ -272,7 +269,7 @@ define(['app/app', 'jquery-uploadify'], function(app) {
     }
 
     $scope.setReserve = function(num) {
-      if (num.indexOf('.') > -1) {
+      if (num && num.indexOf('.') > -1) {
         toaster.pop('warning', '提示', '库存数量不能存在小数点')
         $scope.Regul.reserve = 1
       } else {
@@ -621,7 +618,8 @@ define(['app/app', 'jquery-uploadify'], function(app) {
         prodName: $scope.Regul.kind, // 名称
         price: $scope.Regul.OnePrice, // 成本单价
         attachment: $scope.Regul.Ischange ? $scope.Regul.Regulpic : '', // 规格书
-        cmpImg: $scope.Regul.RegulImg !== $scope.Regul.iniUrlImg ? $scope.Regul.RegulImg : ''// 图片
+        cmpImg: $scope.Regul.RegulImg !== $scope.Regul.iniUrlImg ? $scope.Regul.RegulImg : '',// 图片
+        packaging: $scope.Regul.packaging // 包装方式
       }
       jsonObject.goods =  {
         minBuyQty: $scope.Regul.minBuyQty, // 最小起订量

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

@@ -178,11 +178,12 @@
           <div class="fl name">
             <span class="red">*</span>品牌:
           </div>
+          <!--ng-blur="RegulonBrandBlur(Regul.pbranden)"-->
           <div class="fl input" style="position: relative">
             <input type="text"
                    ng-change="onBrandChange(Regul.pbranden)"
                    placeholder="请输入品牌名称"
-                   ng-blur="RegulonBrandBlur(Regul.pbranden)"
+
                    ng-model="Regul.pbranden"
                    class="form-control inputText" maxlength="25" ng-class="objError.pbranden ? 'danger' : '' "/>
             <ul class="listUl" ng-show="Regul.BrandList.value.length > 0">
@@ -211,15 +212,16 @@
             <span class="red">*</span>型号:
           </div>
           <div class="fl input" style="position: relative;">
+            <!--ng-blur="RegulonCodeBlur(Regul.pcmpcode)"-->
             <input type="text"
                    ng-change="onCodeChange(Regul.pcmpcode)"
                    placeholder="请输入型号"
-                   ng-blur="RegulonCodeBlur(Regul.pcmpcode)"
+
                    ng-model="Regul.pcmpcode"
                    ng-class="objError.pcmpcode ? 'danger' : '' "
                    class="form-control inputText" maxlength="100"/>
             <ul class="listUl" ng-show="Regul.CodeList.value.length > 0">
-              <li ng-repeat="item in Regul.CodeList.value" ng-click="setCode(item.nameEn)">
+              <li ng-repeat="item in Regul.CodeList.value" ng-click="setCode(item.code)">
                 {{item.code}}
               </li>
             </ul>
@@ -278,7 +280,7 @@
         </div>
         <div class="clearfix w50 fl list">
           <div class="fl name">
-            成本单价({{storeInfo.enType === 'MAINLAND' ? '¥' : '$'}}):
+            成本单价({{(!storeInfo.enType || storeInfo.enType === 'MAINLAND') ? '¥' : '$'}}):
           </div>
           <div class="fl input">
             <!-- 可编辑状态 oninput="if(value.length>6)value=value.slice(0,6)" -->