Browse Source

新增物料时不再进行匹配

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@9757 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
hejq 8 years ago
parent
commit
5505d3d212

+ 89 - 87
src/main/java/com/uas/platform/b2b/service/impl/BaseInfoServiceImpl.java

@@ -396,97 +396,99 @@ public class BaseInfoServiceImpl implements BaseInfoService {
 		}
 		List<Product> products = productDao.findByEnUUAndCode(SystemSession.getUser().getEnterprise().getUu(),
 				prodInfo.getCode());
-		if (prodInfo.getCmpUuId() != null) {
-			Component component = componentDao.findByUuid(prodInfo.getCmpUuId());
-			if (component != null) {
-				prodInfo.setPbranden(component.getBrand().getNameEn());
-				prodInfo.setPbrand(component.getBrand().getNameCn());
-				prodInfo.setKind(component.getKind().getNameCn());
-				prodInfo.setPcmpcode(component.getCode());
-				prodInfo.setKinden(component.getKind().getNameEn());
-				prodInfo.setStandard(Constant.YES);
-			}
-		} else {
-			List<Component> components = componentDao.findByCode(prodInfo.getCmpCode());
-			if (components.size() == 1) { // 存在一个,全部赋值成标准数据
-				Component comp = components.get(0);
-				prodInfo.setKind(comp.getKind().getNameCn());
-				prodInfo.setKinden(comp.getKind().getNameEn());
-				prodInfo.setPbranden(comp.getBrand().getNameEn());
-				prodInfo.setPbrand(comp.getBrand().getNameCn());
-				prodInfo.setPcmpcode(comp.getCode());
-			}
-		}
-		Product product = new Product();
-		if (prodInfo.getCmpUuId() != null) {
-			product = productDao.findByEnUUAndCmpUuId(SystemSession.getUser().getEnterprise().getUu(),
-					prodInfo.getCmpUuId());
-		}
+		// if (prodInfo.getCmpUuId() != null) {
+		// Component component = componentDao.findByUuid(prodInfo.getCmpUuId());
+		// if (component != null) {
+		// prodInfo.setPbranden(component.getBrand().getNameEn());
+		// prodInfo.setPbrand(component.getBrand().getNameCn());
+		// prodInfo.setKind(component.getKind().getNameCn());
+		// prodInfo.setPcmpcode(component.getCode());
+		// prodInfo.setKinden(component.getKind().getNameEn());
+		// prodInfo.setStandard(Constant.YES);
+		// }
+		// } else {
+		// List<Component> components =
+		// componentDao.findByCode(prodInfo.getCmpCode());
+		// if (components.size() == 1) { // 存在一个,全部赋值成标准数据
+		// Component comp = components.get(0);
+		// prodInfo.setKind(comp.getKind().getNameCn());
+		// prodInfo.setKinden(comp.getKind().getNameEn());
+		// prodInfo.setPbranden(comp.getBrand().getNameEn());
+		// prodInfo.setPbrand(comp.getBrand().getNameCn());
+		// prodInfo.setPcmpcode(comp.getCode());
+		// }
+		// }
+		// Product product = new Product();
+		// if (prodInfo.getCmpUuId() != null) {
+		// product =
+		// productDao.findByEnUUAndCmpUuId(SystemSession.getUser().getEnterprise().getUu(),
+		// prodInfo.getCmpUuId());
+		// }
 		if (!CollectionUtils.isEmpty(products)) {
 			map.put("error", "物料已存在");
 			map.put("id", products.get(0).getId());
 		}
-		if (product != null && product.getId() != null) {
-			map.put("error", "该器件物料已存在,正在跳转详情页面.....");
-			map.put("id", product.getId());
-		} else {
-			if (CollectionUtils.isEmpty(products)) {
-				prodInfo.setUserUU(SystemSession.getUser().getUserUU());
-				prodInfo.setEnUU(SystemSession.getUser().getEnterprise().getUu());
-				prodInfo.setSourceApp("B2B");
-				prodInfo.setStandard(Constant.NO);
-				// 进行与标准库进行匹配
-				if (prodInfo.getCmpCode() != null && prodInfo.getBrand() != null && prodInfo.getTitle() != null) {
-					List<Component> comps = componentDao.findByCode(prodInfo.getCmpCode());
-					if (!CollectionUtils.isEmpty(comps)) {
-						for (Component cmp : comps) {
-							if (cmp.getBrand().getNameEn().equals(prodInfo.getBrand())
-									&& cmp.getKind().getNameCn().equals(prodInfo.getTitle())) {// 标准物料
-								prodInfo.setPbrand(cmp.getBrand().getNameCn());
-								prodInfo.setPbranden(cmp.getBrand().getNameEn());
-								prodInfo.setKind(cmp.getKind().getNameCn());
-								prodInfo.setKinden(cmp.getKind().getNameEn());
-								prodInfo.setPcmpcode(cmp.getCode());
-								prodInfo.setCmpUuId(cmp.getUuid());
-								prodInfo.setStandard(Constant.YES);
-							} else if (cmp.getBrand().getNameCn().equals(prodInfo.getBrand())
-							&& cmp.getKind().getNameCn().equals(prodInfo.getTitle())) {
-								prodInfo.setPbrand(cmp.getBrand().getNameCn());
-								prodInfo.setPbranden(cmp.getBrand().getNameEn());
-								prodInfo.setKind(cmp.getKind().getNameCn());
-								prodInfo.setKinden(cmp.getKind().getNameEn());
-								prodInfo.setPcmpcode(cmp.getCode());
-								prodInfo.setCmpUuId(cmp.getUuid());
-								prodInfo.setStandard(Constant.YES);
-							} else if (cmp.getBrand().getNameEn().equals(prodInfo.getBrand())
-									&& cmp.getKind().getNameEn().equals(prodInfo.getTitle())) {
-								prodInfo.setPbrand(cmp.getBrand().getNameCn());
-								prodInfo.setPbranden(cmp.getBrand().getNameEn());
-								prodInfo.setKind(cmp.getKind().getNameCn());
-								prodInfo.setKinden(cmp.getKind().getNameEn());
-								prodInfo.setPcmpcode(cmp.getCode());
-								prodInfo.setCmpUuId(cmp.getUuid());
-								prodInfo.setStandard(Constant.YES);
-							}else if (cmp.getBrand().getNameCn().equals(prodInfo.getBrand())
-									&& cmp.getKind().getNameEn().equals(prodInfo.getTitle())) {
-								prodInfo.setPbrand(cmp.getBrand().getNameCn());
-								prodInfo.setPbranden(cmp.getBrand().getNameEn());
-								prodInfo.setKind(cmp.getKind().getNameCn());
-								prodInfo.setKinden(cmp.getKind().getNameEn());
-								prodInfo.setPcmpcode(cmp.getCode());
-								prodInfo.setCmpUuId(cmp.getUuid());
-								prodInfo.setStandard(Constant.YES);
-							}
-						}
-					}
-				} else if (prodInfo.getCmpCode() == null) {
-					prodInfo.setCmpCode(prodInfo.getCode());
-				}
-				prodInfo = productDao.save(prodInfo);
-				map.put("id", prodInfo.getId());
-				map.put("success", "物料添加成功");
-			}
-		}
+//		if (product != null && product.getId() != null) {
+//			map.put("error", "该器件物料已存在,正在跳转详情页面.....");
+//			map.put("id", product.getId());
+//		} else {
+//			if (CollectionUtils.isEmpty(products)) {
+//				prodInfo.setUserUU(SystemSession.getUser().getUserUU());
+//				prodInfo.setEnUU(SystemSession.getUser().getEnterprise().getUu());
+//				prodInfo.setSourceApp("B2B");
+//				prodInfo.setStandard(Constant.NO);
+//				// 进行与标准库进行匹配
+//				if (prodInfo.getCmpCode() != null && prodInfo.getBrand() != null && prodInfo.getTitle() != null) {
+//					List<Component> comps = componentDao.findByCode(prodInfo.getCmpCode());
+//					if (!CollectionUtils.isEmpty(comps)) {
+//						for (Component cmp : comps) {
+//							if (cmp.getBrand().getNameEn().equals(prodInfo.getBrand())
+//									&& cmp.getKind().getNameCn().equals(prodInfo.getTitle())) {// 标准物料
+//								prodInfo.setPbrand(cmp.getBrand().getNameCn());
+//								prodInfo.setPbranden(cmp.getBrand().getNameEn());
+//								prodInfo.setKind(cmp.getKind().getNameCn());
+//								prodInfo.setKinden(cmp.getKind().getNameEn());
+//								prodInfo.setPcmpcode(cmp.getCode());
+//								prodInfo.setCmpUuId(cmp.getUuid());
+//								prodInfo.setStandard(Constant.YES);
+//							} else if (cmp.getBrand().getNameCn().equals(prodInfo.getBrand())
+//							&& cmp.getKind().getNameCn().equals(prodInfo.getTitle())) {
+//								prodInfo.setPbrand(cmp.getBrand().getNameCn());
+//								prodInfo.setPbranden(cmp.getBrand().getNameEn());
+//								prodInfo.setKind(cmp.getKind().getNameCn());
+//								prodInfo.setKinden(cmp.getKind().getNameEn());
+//								prodInfo.setPcmpcode(cmp.getCode());
+//								prodInfo.setCmpUuId(cmp.getUuid());
+//								prodInfo.setStandard(Constant.YES);
+//							} else if (cmp.getBrand().getNameEn().equals(prodInfo.getBrand())
+//									&& cmp.getKind().getNameEn().equals(prodInfo.getTitle())) {
+//								prodInfo.setPbrand(cmp.getBrand().getNameCn());
+//								prodInfo.setPbranden(cmp.getBrand().getNameEn());
+//								prodInfo.setKind(cmp.getKind().getNameCn());
+//								prodInfo.setKinden(cmp.getKind().getNameEn());
+//								prodInfo.setPcmpcode(cmp.getCode());
+//								prodInfo.setCmpUuId(cmp.getUuid());
+//								prodInfo.setStandard(Constant.YES);
+//							}else if (cmp.getBrand().getNameCn().equals(prodInfo.getBrand())
+//									&& cmp.getKind().getNameEn().equals(prodInfo.getTitle())) {
+//								prodInfo.setPbrand(cmp.getBrand().getNameCn());
+//								prodInfo.setPbranden(cmp.getBrand().getNameEn());
+//								prodInfo.setKind(cmp.getKind().getNameCn());
+//								prodInfo.setKinden(cmp.getKind().getNameEn());
+//								prodInfo.setPcmpcode(cmp.getCode());
+//								prodInfo.setCmpUuId(cmp.getUuid());
+//								prodInfo.setStandard(Constant.YES);
+//							}
+//						}
+//					}
+//				} else if (prodInfo.getCmpCode() == null) {
+//					prodInfo.setCmpCode(prodInfo.getCode());
+//				}
+		prodInfo = productDao.save(prodInfo);
+		map.put("id", prodInfo.getId());
+		map.put("success", "物料添加成功");
+		// }
+		// }
 		return map;
 	}
 

+ 16 - 4
src/main/webapp/resources/tpl/index/baseInfo/productDetail.html

@@ -130,17 +130,29 @@
                 </div>
                 <div class="col-md-2">导入产品名称:</div>
                 <div class="col-md-4">
-                    <input type="text"  ng-model="prodInfo.title" ng-class="{'readonly-pointer': !prodInfo.$editing}" required="true" ng-readonly="!prodInfo.$editing || !editstatus">
+                    <input type="text"  ng-model="prodInfo.title" style="cursor: pointer;" required="true"
+                		ng-change="getSimilarKinds(prodInfo.title)" name="title" ng-focus="onFocus('title')"
+                		typeahead="kind.kindCn for kind in getSimilarKinds($viewValue)"
+						autocomplete="off" typeahead-on-select="onAssociateTitleClick($item, prodInfo)"
+						spellcheck="false" ng-class="{'readonly-pointer': !prodInfo.$editing}"  ng-readonly="!prodInfo.$editing || !editstatus">
                 </div>
             </div>
             <div class="pro-list-tab row">
                 <div class="col-md-2">导入产品型号:</div>
                 <div class="col-md-4">
-                    <input type="text"  ng-model="prodInfo.cmpCode" ng-class="{'readonly-pointer': !prodInfo.$editing}" required="true" ng-readonly="!prodInfo.$editing || !editstatus">
+                    <input type="text"  ng-model="prodInfo.cmpCode" style="cursor: pointer;" required="true"
+                		ng-change="getSimilarComponents(prodInfo.cmpCode)" name="cmpCode" ng-focus="onFocus('cmpCode')"
+                		typeahead="cmp.code for cmp in getSimilarComponents($viewValue)"
+						autocomplete="off" typeahead-on-select="onAssociateCmpClick($item, prodInfo)"
+						spellcheck="false" ng-class="{'readonly-pointer': !prodInfo.$editing}"  ng-readonly="!prodInfo.$editing || !editstatus">
                 </div>
                 <div class="col-md-2">导入品牌:</div>
                 <div class="col-md-4">
-                    <input type="text" ng-model="prodInfo.brand" ng-class="{'readonly-pointer': !prodInfo.$editing}" type="text" placeholder="品牌" style="cursor: pointer;" ng-readonly="!prodInfo.$editing || !editstatus">
+                    <input type="text"  ng-model="prodInfo.brand" style="cursor: pointer;" required="true"
+                		ng-change="getSimilarBrands(prodInfo.brand)" name="brand" ng-focus="onFocus('brand')"
+                		typeahead="brand.brandEn for brand in getSimilarBrands($viewValue)"
+						autocomplete="off" typeahead-on-select="onAssociateBrandClick($item, prodInfo)"
+						spellcheck="false" ng-class="{'readonly-pointer': !prodInfo.$editing}"  ng-readonly="!prodInfo.$editing || !editstatus">
                 </div>
             </div>
             <div class="pro-list-tab row">
@@ -188,7 +200,7 @@
                 	 <input type="text"  ng-model="prodInfo.pbranden" style="cursor: pointer;" required="true"
                 		ng-change="getSimilarBrands(prodInfo.pbranden)" name="pbranden" ng-focus="onFocus('pbranden')"
                 		typeahead="brand.brandEn for brand in getSimilarBrands($viewValue)"
-						autocomplete="off" typeahead-on-select="onAssociateBrandClick($item, prodInfo)"
+						autocomplete="off" typeahead-on-select="onAssociatePBrandClick($item, prodInfo)"
 						spellcheck="false" ng-class="{'readonly-pointer': !prodInfo.$editing}"  ng-readonly="!prodInfo.$editing">
                 </div>
             </div>

+ 20 - 8
src/main/webapp/resources/tpl/index/purc/productDetail.html

@@ -119,28 +119,40 @@
 </style>
 <div class="wrap">
 	<div class="content">
-		<div class="com_head"><span>产品导入</span><span class="fr"><em>录入人:{{user.userName}}</em><time>日期:{{time}}</time></span></div>
+		<div class="com_head"><span>物料导入</span><span class="fr"><em>录入人:{{user.userName}}</em><time>日期:{{time}}</time></span></div>
 		<!--产品资料新增-->
         <div class="pro-add-tab pro-add-data clearfix">
             <div class="com_title01 sty01" style="margin-bottom: 15px;"><span>导入信息<em>*</em></span></div>
             <div class="pro-list-tab row">
-                <div class="col-md-2">导入产品编号:</div>
+                <div class="col-md-2">导入物料编号:</div>
                 <div class="col-md-4">
                     <input type="text" ng-model="prodInfo.code" ng-class="{'readonly-pointer': !prodInfo.$editing}" required="true" readonly>
                 </div>
-                <div class="col-md-2">导入产品名称:</div>
+                <div class="col-md-2">导入物料名称:</div>
                 <div class="col-md-4">
-                    <input type="text"  ng-model="prodInfo.title" ng-class="{'readonly-pointer': !prodInfo.$editing}" required="true" ng-readonly="!prodInfo.$editing && !editstatus">
+                	<input type="text"  ng-model="prodInfo.title" style="cursor: pointer;" required="true"
+                		ng-change="getSimilarKinds(prodInfo.title)" name="title" ng-focus="onFocus('title')"
+                		typeahead="kind.kindCn for kind in getSimilarKinds($viewValue)"
+						autocomplete="off" typeahead-on-select="onAssociateTitleClick($item, prodInfo)"
+						spellcheck="false" ng-class="{'readonly-pointer': !prodInfo.$editing}"  ng-readonly="!prodInfo.$editing || !editstatus">
                 </div>
             </div>
             <div class="pro-list-tab row">
-                <div class="col-md-2">导入产品型号:</div>
+                <div class="col-md-2">导入物料型号:</div>
                 <div class="col-md-4">
-                    <input type="text"  ng-model="prodInfo.cmpCode" ng-class="{'readonly-pointer': !prodInfo.$editing}" required="true" ng-readonly="!prodInfo.$editing && !editstatus">
+                    <input type="text"  ng-model="prodInfo.cmpCode" style="cursor: pointer;" required="true"
+                		ng-change="getSimilarComponents(prodInfo.cmpCode)" name="cmpCode" ng-focus="onFocus('cmpCode')"
+                		typeahead="cmp.code for cmp in getSimilarComponents($viewValue)"
+						autocomplete="off" typeahead-on-select="onAssociateCmpClick($item, prodInfo)"
+						spellcheck="false" ng-class="{'readonly-pointer': !prodInfo.$editing}"  ng-readonly="!prodInfo.$editing || !editstatus">
                 </div>
-                <div class="col-md-2">导入品牌:</div>
+                <div class="col-md-2">导入物料品牌:</div>
                 <div class="col-md-4">
-                    <input type="text" ng-model="prodInfo.brand" ng-class="{'readonly-pointer': !prodInfo.$editing}" type="text" placeholder="品牌" style="cursor: pointer;" ng-readonly="!prodInfo.$editing && !editstatus">
+                	<input type="text"  ng-model="prodInfo.brand" style="cursor: pointer;" required="true"
+                		ng-change="getSimilarBrands(prodInfo.brand)" name="brand" ng-focus="onFocus('brand')"
+                		typeahead="brand.brandEn for brand in getSimilarBrands($viewValue)"
+						autocomplete="off" typeahead-on-select="onAssociateBrandClick($item, prodInfo)"
+						spellcheck="false" ng-class="{'readonly-pointer': !prodInfo.$editing}"  ng-readonly="!prodInfo.$editing || !editstatus">
                 </div>
             </div>
             <div class="pro-list-tab row">