wangyc 8 лет назад
Родитель
Сommit
e24e12a095

+ 3 - 2
src/main/java/com/uas/platform/b2c/external/erp/order/service/impl/B2cOrderServiceImpl.java

@@ -70,9 +70,10 @@ public class B2cOrderServiceImpl implements B2cOrderService {
     public List<B2cOrder> getAllOrder() {
         // 要获取的采购的状态
         SimpleExpression status1 = PredicateUtils.eq("status", Status.TOBEPAID.value(), true);
-//        SimpleExpression status2 = PredicateUtils.eq("status", Status.MONEYRECEIVED.value(), true);
+        SimpleExpression status2 = PredicateUtils.eq("status", Status.UNAVAILABLE_NOPAID.value(), true);
         SimpleExpression status3 = PredicateUtils.eq("status", Status.INBOUND.value(), true);
-        SimpleExpression[] expressions = new SimpleExpression[] { status1, status3 };
+        SimpleExpression status4 = PredicateUtils.eq("status", Status.UNAVAILABLE_PERSONAL.value(), true);
+        SimpleExpression[] expressions = new SimpleExpression[] { status1, status2, status3, status4};
         LogicalExpression purLogical = PredicateUtils.or(expressions);
 
         // 采购单待上传的状态

+ 11 - 2
src/main/java/com/uas/platform/b2c/external/erp/order/service/impl/OrderServiceImpl.java

@@ -11,6 +11,7 @@ import com.uas.platform.b2c.prod.commodity.dao.GoodsHistoryDao;
 import com.uas.platform.b2c.prod.commodity.dao.ProductDao;
 import com.uas.platform.b2c.prod.commodity.model.GoodsHistory;
 import com.uas.platform.b2c.prod.commodity.model.Product;
+import com.uas.platform.b2c.trade.order.dao.OrderDao;
 import com.uas.platform.b2c.trade.order.dao.PurchaseDao;
 import com.uas.platform.b2c.trade.order.model.Purchase;
 import com.uas.platform.b2c.trade.order.service.PurchaseService;
@@ -44,6 +45,9 @@ public class OrderServiceImpl implements OrderService {
 
 	@Autowired
 	private ProductDao productDao;
+
+	@Autowired
+	private OrderDao orderDao;
 	
 	private static final ErpB2cBufferedLogger logger = BufferedLoggerManager.getLogger(ErpB2cBufferedLogger.class);
 
@@ -61,7 +65,9 @@ public class OrderServiceImpl implements OrderService {
 		SimpleExpression status1 = PredicateUtils.eq("status", Status.PAID.value(), true);
 		SimpleExpression status2 = PredicateUtils.eq("status", Status.CONFIRMED.value(), true);
 		SimpleExpression status3 = PredicateUtils.eq("status", Status.TOBECONFIRMED.value(), true);
-		SimpleExpression[] expressions = new SimpleExpression[] { status1, status2, status3 };
+		SimpleExpression status4 = PredicateUtils.eq("status", Status.UNAVAILABLE_NOPAID.value(), true);
+		SimpleExpression status5 = PredicateUtils.eq("status", Status.UNAVAILABLE_PERSONAL.value(), true);
+		SimpleExpression[] expressions = new SimpleExpression[] { status1, status2, status3, status4, status5};
 		LogicalExpression purLogical = PredicateUtils.or(expressions);
 
 		// 采购单待上传的状态
@@ -69,7 +75,6 @@ public class OrderServiceImpl implements OrderService {
 		// uu
 		SimpleExpression sellerUU = PredicateUtils.eq("sellerenuu", SystemSession.getUser().getEnterprise().getUu(),
 				true);
-//		SimpleExpression uasPurcid = PredicateUtils.isNotNull("uasPurcid");
 
 		LogicalExpression statusUUAS = PredicateUtils.and(new SimpleExpression[] { sendStatus, sellerUU});
 		final LogicalExpression allCondition = PredicateUtils.and(new LogicalExpression[] { purLogical, statusUUAS });
@@ -85,6 +90,10 @@ public class OrderServiceImpl implements OrderService {
 		for (Purchase purchase : purcs) {
 			boolean codeExists = false;
 			Order order = ModelConverter.getOrder(purchase);
+//			com.uas.platform.b2c.trade.order.model.Order b2cOrder = orderDao.findOrderByOrderid(purchase.getOrderid());
+//			if (b2cOrder != null) {
+//				b2cOrder.getba
+//			}
 			for (OrderDetail orderDetail : order.getDetails()) {
 				List<GoodsHistory> goodsHistorys = goodsHistoryDao.findByBatchCode(orderDetail.getBatchCode());// 获取上架历史信息
 				if (!CollectionUtils.isEmpty(goodsHistorys)) {

+ 2 - 1
src/main/java/com/uas/platform/b2c/external/erp/order/util/ModelConverter.java

@@ -32,7 +32,7 @@ public class ModelConverter {
     public static Order getOrder(Purchase purchase) {
 		Order order = new Order();
 		order.setCreateTime(purchase.getCreatetime());
-		order.setOrderid(purchase.getPurchaseid());
+		order.setOrderid(purchase.getOrderid());
 		order.setId(purchase.getId());
 		order.setShipAddress(purchase.getJsonAddress());
 		order.setTotal(purchase.getEnsurePrice());
@@ -40,6 +40,7 @@ public class ModelConverter {
 		order.setTaxes(purchase.getTaxes());
 		order.setCurrency(purchase.getCurrency());
 		order.setSendType(purchase.getSendType());
+		order.setFare(purchase.getFare());
 		Set<PurchaseDetail> details = purchase.getPurchaseDetails();
 		if (!CollectionUtils.isEmpty(details)) {
 			List<OrderDetail> orderDetails = new ArrayList<OrderDetail>();

+ 6 - 2
src/main/java/com/uas/platform/b2c/external/erp/prod/service/impl/ProdServiceImpl.java

@@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.CollectionUtils;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -56,9 +57,12 @@ public class ProdServiceImpl implements ProdService {
     }
 
     @Override
-    public String callMatch() {
+    public void callMatch() {
+        loggerOut.info("开始匹配");
+        Date start = new Date();
         productService.matchAll();// 匹配上传的物料
-        return "success";
+        Date end = new Date();
+        loggerOut.info("匹配完成, 历时" + (start.getTime() - end.getTime())/1000 + "秒");
     }
 
     @Override

+ 11 - 1
src/main/java/com/uas/platform/b2c/prod/commodity/controller/ProductController.java

@@ -9,7 +9,6 @@ import com.uas.platform.b2c.prod.commodity.model.Product;
 import com.uas.platform.b2c.prod.commodity.model.ProductDetail;
 import com.uas.platform.b2c.prod.commodity.service.ProductService;
 import com.uas.platform.b2c.prod.commodity.type.ProductConstant;
-import com.uas.platform.b2c.prod.product.component.modal.Component;
 import com.uas.platform.b2c.trade.support.ResultMap;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.model.PageParams;
@@ -235,4 +234,15 @@ public class ProductController {
 	private ResultMap validitionStandard(@RequestBody JSONObject jsonObject) {
 		return productService.validitonStandard(jsonObject);
 	}
+
+	/**
+	 * 保存物料交易详情
+	 * @param productId
+	 * @param goods
+	 * @return
+	 */
+	@RequestMapping(value = "/savedetail/{productId}", method = RequestMethod.POST)
+	public ProductDetail saveDetail(@PathVariable("productId") Long productId, @RequestBody Goods goods) {
+		return productService.saveDetail(productId, goods);
+	}
 }

+ 9 - 1
src/main/java/com/uas/platform/b2c/prod/commodity/service/ProductService.java

@@ -1,10 +1,10 @@
 package com.uas.platform.b2c.prod.commodity.service;
 
 import com.alibaba.fastjson.JSONObject;
+import com.uas.platform.b2c.prod.commodity.model.Goods;
 import com.uas.platform.b2c.prod.commodity.model.Product;
 import com.uas.platform.b2c.prod.commodity.model.ProductDetail;
 import com.uas.platform.b2c.prod.commodity.model.ProductStandardPutOnInfo;
-import com.uas.platform.b2c.prod.product.component.modal.Component;
 import com.uas.platform.b2c.trade.order.model.Purchase;
 import com.uas.platform.b2c.trade.support.ResultMap;
 import com.uas.platform.core.model.PageInfo;
@@ -132,4 +132,12 @@ public interface ProductService {
      * @return
      */
     ResultMap validitonStandard(JSONObject jsonObject);
+
+    /**
+     * 保存物料交易详情
+     * @param productId
+     * @param goods
+     * @return
+     */
+    ProductDetail saveDetail(Long productId, Goods goods);
 }

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

@@ -3,6 +3,7 @@ package com.uas.platform.b2c.prod.commodity.service.impl;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.uas.platform.b2c.advertise.ad.service.RecommendProductService;
+import com.uas.platform.b2c.common.account.service.EnterpriseService;
 import com.uas.platform.b2c.core.constant.IntegerConstant;
 import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.b2c.core.utils.FastjsonUtils;
@@ -124,6 +125,9 @@ public class ProductServiceImpl implements ProductService {
     @Autowired
     private ComponentSubmitDao componentSubmitDao;
 
+    @Autowired
+    private EnterpriseService enterpriseService;
+
     private ConcurrentHashMap<String, Field> sortFields = new ConcurrentHashMap<String, Field>();
 
     @Override
@@ -623,7 +627,7 @@ public class ProductServiceImpl implements ProductService {
             if (product.getCmpUuId() != null) {// 获取当前商城已上架数量(含锁库存)
                 b2cReserve = goodsDao.getSumReserveByEnUUAndUuidAndStatus(SystemSession.getUser().getEnterprise().getUu(), product.getCmpUuId(), Status.AVAILABLE.value());
                 Double lockReserve = orderDetailDao.getSumReserveBySupEnUuAndUuidAndStatus(SystemSession.getUser().getEnterprise().getUu(), product.getCmpUuId(), Status.TOBEPAID.value());
-                b2cReserve = b2cReserve + (lockReserve == null ? 0d :lockReserve);
+                b2cReserve = (b2cReserve == null ? 0d : b2cReserve) + (lockReserve == null ? 0d :lockReserve);
             }
             productDetail.setB2cReserve(b2cReserve);
         }
@@ -666,5 +670,41 @@ public class ProductServiceImpl implements ProductService {
             return ResultMap.success("已存在此器件");
         }
     }
+
+    @Override
+    public ProductDetail saveDetail(Long productId, Goods goods) {
+        Product product = productDao.findOne(productId);
+        if (product == null)
+            throw new IllegalOperatorException("此物料信息不存在,请重新确认");
+        ProductDetail productDetail = productDetailDao.findByProductId(productId);
+        if (productDetail == null)
+            productDetail = new ProductDetail();
+
+        productDetail.setBreakUp(goods.getBreakUp());
+        productDetail.setProduceDate(goods.getProduceDate());
+        productDetail.setProductId(productId);
+        productDetail.setCode(goods.getCode());
+        productDetail.setB2cMaxDelivery(goods.getB2cMaxDelivery());
+        productDetail.setB2cMinDelivery(goods.getB2cMinDelivery());
+        productDetail.setMaxDelivery(goods.getMaxDelivery());
+        productDetail.setMinBuyQty(goods.getMinBuyQty());
+        productDetail.setMinDelivery(goods.getMinDelivery());
+        productDetail.setMinPackQty(goods.getMinPackQty());
+        productDetail.setPackaging(goods.getPackaging());
+
+        String currency = enterpriseService.getCurrencyByRegisterAddress().getData().toString();
+        List<GoodsQtyPrice> qtyPrice = FastjsonUtils.fromJsonArray(goods.getQtyPrice(), GoodsQtyPrice.class);
+        if (!CollectionUtils.isEmpty(qtyPrice)) {
+            if ("RMB".equals(currency)) {
+                productDetail.setPrice(qtyPrice.get(0).getRMBPrice());
+            }
+            if ("USD".equals(currency)) {
+                productDetail.setPrice(qtyPrice.get(0).getUSDPrice());
+            }
+        }
+
+        productDetailDao.save(productDetail);
+        return null;
+    }
 }
 

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/product/brand/controller/BrandSubmitController.java

@@ -183,7 +183,7 @@ public class BrandSubmitController {
 	public ModelMap saveFromUnstandard(@RequestBody String json) {
 		ModelMap map = new ModelMap();
 		logger.log("品牌维护", "通过非标器件申请品牌", "通过非标器件申请品牌");
-		BrandSubmit brandSubmit = brandSubmitService.saveFromUnstandard(json);
+		String brandSubmit = brandSubmitService.saveFromUnstandard(json);
 		if (brandSubmit == null) {
 			map.put("code", 400);
 			map.put("message", "商城已存在相同品牌");

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/product/brand/service/BrandSubmitService.java

@@ -68,6 +68,6 @@ public interface BrandSubmitService {
 	 * @param json
 	 * @return
 	 */
-	public BrandSubmit saveFromUnstandard(String json);
+	public String saveFromUnstandard(String json);
 
 }

+ 37 - 1
src/main/java/com/uas/platform/b2c/prod/product/brand/service/impl/BrandSubmitServiceImpl.java

@@ -334,10 +334,46 @@ public class BrandSubmitServiceImpl implements BrandSubmitService {
 	}
 
 	@Override
-	public BrandSubmit saveFromUnstandard(String json) {
+	public String saveFromUnstandard(String json) {
 		JSONObject jsonObject = FastjsonUtils.parseObject(json);
 //		jsonObject.getObject();
+		String nameEn = jsonObject.getString("nameEn");
+		if (!StringUtils.hasText(nameEn)) {
+			throw new IllegalOperatorException("请填写品牌英文名");
+		}
+		String url = jsonObject.getString("url");
+		String brief = jsonObject.getString("brief");
+		String series = jsonObject.getString("series");
+		String logoUrl = jsonObject.getString("logoUrl");
 
+		List<Brand> brands = brandDao.findByNameEn(nameEn);
+		if (CollectionUtils.isNotEmpty(brands)) {
+			return brands.get(0).getNameEn();
+		} else {
+			if (!StringUtils.hasText(url)) {
+				throw new IllegalOperatorException("请填写品牌官网");
+			}
+			if (!StringUtils.hasText(brief)) {
+				throw new IllegalOperatorException("请填写品牌简介");
+			}
+			if (!StringUtils.hasText(series)) {
+				throw new IllegalOperatorException("请填写主要产品");
+			}
+			if (!StringUtils.hasText(logoUrl)) {
+				throw new IllegalOperatorException("请上传品牌图片");
+			}
+
+			BrandSubmit brandSubmit = new BrandSubmit();
+			brandSubmit.setIsUpdate(0);
+			brandSubmit.setDefineentuu(SystemSession.getUser().getEnterprise().getUu());
+			brandSubmit.setDefineuu(SystemSession.getUser().getUserUU());
+			brandSubmit.setBrief(brief);
+			brandSubmit.setLogoUrl(logoUrl);
+			brandSubmit.setNameEn(nameEn);
+			brandSubmit.setSeries(series);
+			brandSubmit.setUrl(url);
+			brandSubmitDao.save(brandSubmit);
+		}
 		return null;
 	}
 

+ 13 - 6
src/main/webapp/resources/js/common/query/brand.js

@@ -1,6 +1,7 @@
 define([ 'ngResource' ], function() {
-	angular.module('brandServices', [ 'ngResource' ]).factory('BrandsSubmit', ['$resource', function($resource) {
+	angular.module('brandServices', [ 'ngResource' ]).factory('BrandsSubmit', ['$resource', 'BaseService', function($resource, BaseService) {
 		//获取BrandSubmit的分页数据
+		var rootPath = BaseService.getRootPath();
 		return $resource('produce/brandSubmit', {}, {
 			//未审核
 			getUnAudited : {
@@ -15,17 +16,18 @@ define([ 'ngResource' ], function() {
 				params : { _state : 'notAllow'}
 			}
 		});
-	}]).factory('BrandSubmit', ['$resource', function($resource) {
+	}]).factory('BrandSubmit', ['$resource', 'BaseService', function($resource, BaseService) {
 		//对单个BrandSubmit的操作
+		var rootPath = BaseService.getRootPath();
 		return $resource('produce/brandSubmit/:id', {}, {
 			//提交(保存)
 			submit : {
-				url : 'produce/brandSubmit/saveBrandSubmit',
+				url : rootPath + 'produce/brandSubmit/saveBrandSubmit',
 				method : 'POST'
 			},
 			//审核通过
 			valid : {
-				url : 'produce/brandSubmit/audit',
+				url : rootPath + 'produce/brandSubmit/audit',
 				method : 'PUT',
 				params : {
 					valid : true
@@ -33,7 +35,7 @@ define([ 'ngResource' ], function() {
 			},
 			//审核不通过
 			invalid : {
-				url : 'produce/brandSubmit/audit/:id',
+				url : rootPath + 'produce/brandSubmit/audit/:id',
 				method : 'PUT',
 				params : {
 					valid : false
@@ -41,8 +43,13 @@ define([ 'ngResource' ], function() {
 			},
 			// 审核通过信息冲突的更新申请
 			validUpdate : {
-				url : 'produce/brandSubmit/audituUpdate',
+				url : rootPath + 'produce/brandSubmit/audituUpdate',
 				method : 'PUT'
+			},
+			// 非标器件申请品牌
+			unstandardSubmit : {
+				url : rootPath + '/produce/brandSubmit/fromunstandard',
+				method : 'POST'
 			}
 		});
 	}]).factory('BrandVersion', ['$resource', function($resource) {

+ 4 - 0
src/main/webapp/resources/js/common/query/material.js

@@ -51,6 +51,10 @@ define([ 'ngResource' ], function() {
             submitProduct: {
                 url: 'trade/products/validition',
                 method: 'POST'
+            },
+            saveDetail: {
+                url: 'trade/products/savedetail/:productId',
+                method: 'POST'
             }
         });
     }]);

+ 65 - 31
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_materialCtrl.js

@@ -1,13 +1,12 @@
 define([ 'app/app', 'jquery-uploadify' ], function(app) {
 	'use strict';
-	app.register.controller('vendor_materialCtrl', ['$scope', '$rootScope', 'Material', 'toaster', 'ComponentActive', 'Enterprise', '$q', 'NumberService', '$location', '$stateParams', 'Search', '$modal', 'ComponentActiveAPI', function ($scope, $rootScope, Material, toaster, ComponentActive, Enterprise, $q, NumberService, $location, $stateParams, Search, $modal, ComponentActiveAPI) {
+	app.register.controller('vendor_materialCtrl', ['$scope', '$rootScope', 'Material', 'toaster', 'ComponentActive', 'Enterprise', '$q', 'NumberService', '$location', '$stateParams', 'Search', '$modal', 'ComponentActiveAPI', 'BrandSubmit', 'BrandActiveAPI', function ($scope, $rootScope, Material, toaster, ComponentActive, Enterprise, $q, NumberService, $location, $stateParams, Search, $modal, ComponentActiveAPI, BrandSubmit, BrandActiveAPI) {
 		$rootScope.active = 'vendor_material';
 
 		$scope.tab = 'material';
 		$scope.standard_tab = $stateParams.standardParam?$stateParams.standardParam:'standard';
 		$scope.choosedIds = [];
 		$scope.deleteDiv = false;
-		$scope.submitProduct = {};
 
         $scope.param = {
             page : 1,
@@ -481,6 +480,11 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
 				$scope.currenctMaterial = data.content;
 				angular.forEach($scope.currenctMaterial, function (material, index) {
 					material.isChoosed = false;
+					material.submitProduct = {
+						brand: {},
+						commponent: {},
+						kind: {}
+					}
 					//第一个自动展开
 					if (index == 0 && $stateParams.standardParam && ($stateParams.standardParam =='standard' || $stateParams.standardParam =='unstandard')) {
 						material.selected = true;
@@ -516,8 +520,6 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
 		function publishGoods(product) {
 			if (!validateGoods($scope.goods)) return ;
 
-			console.log('product', product);
-			console.log($scope.goods);
 			$scope.goods.breakUp = 1 === $scope.goods.breakUp;
 			$scope.isSelfSupport = 1 === $scope.goods.isSelfSupport;
 			Material.newStockByStandardProduct({ id: product.id, isSelfSupport: $scope.isSelfSupport}, $scope.goods, function (result) {
@@ -532,6 +534,17 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
 			});
 		}
 
+		// 保存物料详细信息
+		$scope.saveDetail = function(material) {
+			console.log('product',$scope.goods);
+			console.log(material);
+			Material.saveDetail({productId: material.id}, $scope.goods, function (data) {
+				toaster.pop('success', '保存成功');
+			}, function (response) {
+				toaster.pop('error', response.data);
+			})
+		};
+
 		/**
 		 * 验证商品信息
 		 *
@@ -1063,8 +1076,12 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
 		};
 
 		// 选择品牌
-		$scope.onAssociateClickBrand = function (brand) {
-			$scope.submitProduct.brand = brand
+		$scope.onAssociateClickBrand = function (material, brand) {
+			BrandActiveAPI.getBrand({uuid: brand.uuid}, {} , function (data) {
+				material.submitProduct.brand = data;
+			}, function (response) {
+				toaster.pop('error', response.data);
+			});
 		};
 
 		// 获取器件联想词
@@ -1078,7 +1095,7 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
 			}
 		};
 		// 选择器件
-		$scope.onAssociateClickCmp = function (cmp) {
+		$scope.onAssociateClickCmp = function (material, cmp) {
 			$scope.submitProduct.component = cmp;
 			ComponentActiveAPI.get({uuid : cmp.uuid}, {}, function(data) {
 				var component = data;
@@ -1098,7 +1115,7 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
 			}
 		};
 
-		$scope.onAssociateClickKind = function (kind) {
+		$scope.onAssociateClickKind = function (material, kind) {
 			$scope.submitProduct.kind = kind;
 		};
 
@@ -1122,40 +1139,57 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
 		};
 
 		// 提交申请
-		$scope.submit = function () {
-			if (typeof $scope.submitProduct.brand == 'undefined' || $scope.submitProduct.brand.nameEn == null) {
+		$scope.submit = function (material) {
+			if (typeof material.submitProduct.brand == 'undefined' || material.submitProduct.brand.nameEn == null) {
 				toaster.pop('warning', '请填写品牌英文名');
 				return;
 			}
-			if (typeof $scope.submitProduct.component == 'undefined' || $scope.submitProduct.component.code == null) {
-				toaster.pop('warning', '请填写原厂型号');
-				return;
-			}
-			if (typeof $scope.submitProduct.website == 'undefined' || $scope.submitProduct.website == null) {
+			if (typeof material.submitProduct.brand.url == 'undefined' || material.submitProduct.brand.url == null) {
 				toaster.pop('warning', '请填写品牌官网');
 				return;
 			}
-			if (typeof $scope.submitProduct.kind == 'undefined' || $scope.submitProduct.kind.id == null) {
-				toaster.pop('warning', '请填写或选择商城已有类目');
-				return;
-			}
-			if ($scope.attachName == '') {
-				toaster.pop('warning', '请填上传规格书');
-				return;
+			if (!material.pbranduuid) { // 品牌申请
+				if (typeof material.submitProduct.brand.brief == 'undefined' || material.submitProduct.brand.brief == null) {
+					toaster.pop('warning', '请填写品牌简介');
+					return;
+				}
+				if (typeof material.submitProduct.brand.series == 'undefined' || material.submitProduct.brand.series == null) {
+					toaster.pop('warning', '请填写主要产品');
+					return;
+				}
+				BrandSubmit.unstandardSubmit({}, material.submitProduct, function (data) {
+					
+				}, function (response) {
+
+				})
 			} else {
-				$scope.submitProduct.attach = $scope.attachName;
-			}
+				toaster.pop('enter component submit');
+				if (typeof material.submitProduct.component == 'undefined' || material.submitProduct.component.code == null) {
+					toaster.pop('warning', '请填写原厂型号');
+					return;
+				}
 
-			Material.submitProduct({}, $scope.submitProduct, function (data) {
-				if (data.data == '已存在此器件') {
-					toaster.pop('info',  '已存在此器件');
+				if (typeof material.submitProduct.kind == 'undefined' || material.submitProduct.kind.id == null) {
+					toaster.pop('warning', '请填写或选择商城已有类目');
+					return;
+				}
+				if ($scope.attachName == '') {
+					toaster.pop('warning', '请填上传规格书');
+					return;
 				} else {
-					toaster.pop('info', data.data);
+					material.submitProduct.attach = $scope.attachName;
 				}
-			}, function (response) {
-				toaster.pop('error', response.data);
-			})
 
+				Material.submitProduct({}, material.submitProduct, function (data) {
+					if (data.data == '已存在此器件') {
+						toaster.pop('info',  '已存在此器件');
+					} else {
+						toaster.pop('info', data.data);
+					}
+				}, function (response) {
+					toaster.pop('error', response.data);
+				})
+			}
 		};
 
 		$scope.attachNameInfo = '';

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

@@ -610,7 +610,7 @@
 								<p class="title">&nbsp;</p>
 								<div class="input-list">
 									<!--<button class="off" ng-click="closeShelArea(material)">取消</button>-->
-									<button class="ok" ng-click="publishGoods(material)" style="margin-bottom: 5px">保存</button>
+									<button class="ok" ng-click="saveDetail(material)" style="margin-bottom: 5px">保存</button>
 									<button class="ok" ng-click="publishGoods(material)">上架</button>
 								</div>
 							</div>

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

@@ -584,33 +584,33 @@
 					<tr class="edit-content" ng-if="material.selected">
 						<td colspan="7">
 							<div class="img">
-								<div image-upload data-src="static/img/vendor/images/upload.png" on-success=""></div>
+								<div image-upload data-src="static/img/vendor/images/upload.png" on-success="" ng-model="material.submitProduct.brand.logoUrl"></div>
 								<span>支持jpg、png</span>
 							</div>
 							<div class="content">
 								<div class="material-form-line">
 									<span>*品牌英文名:</span>
-									<input type="text" class="form-control" name="nameEn" ng-model="submitProduct.brand.nameEn"
-										   placeholder="输入品牌名称,例如:Panasonic" autocomplete="off" typeahead="brand.nameEn for brand in getSimilarBrands($viewValue) | limitTo:2"                                              typeahead-on-select="onAssociateClickBrand($item)"
+									<input type="text" class="form-control" name="nameEn" ng-model="material.submitProduct.brand.nameEn"
+										   placeholder="输入品牌名称,例如:Panasonic" autocomplete="off" typeahead="brand.nameEn for brand in getSimilarBrands($viewValue) | limitTo:2"                                              typeahead-on-select="onAssociateClickBrand(material, $item)"
 										   required autofocus />
 								</div>
 								<div class="material-form-line">
 									<span>*品牌官网:</span>
-									<input type="text" placeholder="请输入品牌官网" class="form-control" ng-model="submitProduct.website">
+									<input type="text" placeholder="请输入品牌官网" class="form-control" ng-model="material.submitProduct.brand.url">
 								</div>
 							</div>
 							<div class="content" ng-if="material.pbranduuid">
 								<div class="material-form-line">
 									<span>*原厂标准型号:</span>
-									<input type="text" name="code" ng-model="submitProduct.component.code" class="form-control"
-										   placeholder="请输入标准原厂型号" typeahead-on-select="onAssociateClickCmp($item)"
+									<input type="text" name="code" ng-model="material.submitProduct.component.code" class="form-control"
+										   placeholder="请输入标准原厂型号" typeahead-on-select="onAssociateClickCmp(material, $item)"
 										   typeahead="component.code for component in getSimilarCmps($viewValue)" autocomplete="off"
 										   required>
 								</div>
 								<div class="material-form-line">
 									<span>*器件分类:</span>
-									<input type="text" class="form-control" name="kindName" ng-model="submitProduct.kind.nameCn"  required
-										   placeholder="请输入或选择分类" autocomplete="off" typeahead-on-select="onAssociateClickKind($item)"
+									<input type="text" class="form-control" name="kindName" ng-model="material.submitProduct.kind.nameCn"  required
+										   placeholder="请输入或选择分类" autocomplete="off" typeahead-on-select="onAssociateClickKind(material, $item)"
 										   typeahead="kind.nameCn for kind in getSimilarKinds($viewValue)"
 										   />
 									<div class="search-more-kind" ng-click="selectKind()">
@@ -633,12 +633,12 @@
 							<div class="content" ng-if="!material.pbranduuid">
 								<div class="material-form-line">
 									<span>*品牌介绍:</span>
-									<textarea class="form-control" required
+									<textarea class="form-control" required ng-model="material.submitProduct.brand.brief"
 										   placeholder="请输入品牌介绍" autocomplete="off"/>
 								</div>
 								<div class="material-form-line">
 									<span>*主要产品:</span>
-									<textarea class="form-control" required
+									<textarea class="form-control" required ng-model="material.submitProduct.brand.series"
 											  placeholder="请输入主要产品" autocomplete="off"/>
 								</div>
 							</div>
@@ -647,7 +647,7 @@
 								<div class="input-list">
 									<button class="ok" ng-click="closeShelArea(material)" style="margin-bottom: 5px">取消</button>
 									<!--<button class="ok" ng-click="publishGoods(material)" style="margin-bottom: 5px">保存</button>-->
-									<button class="ok" ng-click="submit()">提交申请</button>
+									<button class="ok" ng-click="submit(material)">提交申请</button>
 								</div>
 							</div>
 						</td>