Browse Source

更新新增物料方法

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

+ 20 - 0
src/main/java/com/uas/platform/b2b/service/impl/BaseInfoServiceImpl.java

@@ -231,10 +231,13 @@ public class BaseInfoServiceImpl implements BaseInfoService {
 				prodInfo.setBrand(component.getBrand().getNameEn());
 				prodInfo.setPbrand(component.getBrand().getNameEn());
 				prodInfo.setCmpCode(component.getCode());
+				prodInfo.setKind(component.getKind().getNameEn());
+				prodInfo.setPcmpcode(component.getCode());
 				productDao.save(prodInfo);
 				map.put("success", "更新成功");
 			} 
 		}
+		map.put("success", "更新成功");
 		return map;
 	}
 
@@ -254,6 +257,23 @@ public class BaseInfoServiceImpl implements BaseInfoService {
 		}
 		List<Product> products = productDao.findByEnUUAndCode(SystemSession.getUser().getEnterprise().getUu(),
 				prodInfo.getCode());
+		List<Component> components = componentDao.findByCode(prodInfo.getCode());
+		if (components.size() == 1) { // 存在一个,全部赋值成标准数据
+			Component comp = components.get(0);
+			prodInfo.setKind(comp.getKind().getNameEn());
+			prodInfo.setPbrand(comp.getBrand().getNameEn());
+			prodInfo.setPcmpcode(comp.getCode());
+		}
+		if (prodInfo.getCmpUuId() != null) {
+			Component component = componentDao.findByUuid(prodInfo.getCmpUuId());
+			if (component != null) {
+				prodInfo.setBrand(component.getBrand().getNameEn());
+				prodInfo.setPbrand(component.getBrand().getNameEn());
+				prodInfo.setCmpCode(component.getCode());
+				prodInfo.setKind(component.getKind().getNameEn());
+				prodInfo.setPcmpcode(component.getCode());
+			}
+		}
 		Product product = new Product();
 		if (prodInfo.getCmpUuId() != null) {
 			product = productDao.findByEnUUAndCmpUuId(SystemSession.getUser().getEnterprise().getUu(),

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

@@ -92,13 +92,13 @@
                     <div class="fr"><input type="text"  ng-model="prodInfo.title" style="cursor: pointer;" required="true"></div>
                 </dd>
                 <dd>
-                    <div class="fl">产品规格:</div>
-                    <div class="fr"><input type="text"  ng-model="prodInfo.spec" style="cursor: pointer;" required="true"><span>(请填写详细)</span></div>
+                    <div class="fl">产品型号:</div>
+                    <div class="fr"><input type="text"  ng-model="prodInfo.cmpCode" style="cursor: pointer;" required="true" ng-click="selectKind()"><span>(请填写详细)</span></div>
                 </dd>
-                 <dd>
+                <!--  <dd>
                     <div class="fl">原厂型号:</div>
                     <div class="fr"><input type="text" readonly="readonly" placeholder="点击选择原厂型号" style="cursor: pointer;" ng-model="prodInfo.cmpCode"  ng-click="selectKind()"><span>(关联器件原厂型号,不可编辑)</span></div>
-                </dd>
+                </dd> -->
                 <dd>
                     <div class="fl">品牌:</div>
                     <div class="fr"><input type="text" ng-model="prodInfo.brand" placeholder="品牌" style="cursor: pointer;" readonly="readonly"><span>(关联器件物料品牌,不可编辑)</span></div>

+ 5 - 1
src/main/webapp/resources/tpl/index/baseInfo/prodList.html

@@ -270,10 +270,14 @@
                         <a ng-bind="::product.title" ui-sref="sale.productDetail({id:product.id})" target="_self"  title="查看详情" ng-if="product.kind != null"></a>
                     </div>
                 </td>
-                <td class="hover-show text-center" ng-class="{'bg01' : product.cmpUuId != null && product.cmpCode != null , 'bg02' : product.cmpUuId == null && product.cmpCode != null , '': product.cmpCode == null}">
+               <td class="hover-show text-center" ng-class="{'bg01' : product.cmpUuId != null && product.cmpCode != null , 'bg02' : product.cmpUuId == null && product.cmpCode != null , '': product.cmpCode == null}" ng-if="product.pcmpcode == null">
                 	<a href="http://www.usoftmall.com/product#/component/{{product.cmpUuId}}/" title="产品型号" ng-bind="::product.cmpCode"  target="_blank" ng-if="product.cmpUuId != null"></a>
                 	<span title="产品型号" ng-bind="::product.cmpCode" ng-if="product.cmpUuId == null"></span>
                 </td>
+                <td class="hover-show text-center" ng-class="{'bg01' : product.cmpUuId != null && product.cmpCode != null , 'bg02' : product.cmpUuId == null && product.cmpCode != null , '': product.cmpCode == null}" ng-if="product.pcmpcode != null">
+                	<a href="http://www.usoftmall.com/product#/component/{{product.cmpUuId}}/" title="产品型号" ng-bind="::product.pcmpcode"  target="_blank" ng-if="product.cmpUuId != null"></a>
+                	<span title="产品型号" ng-bind="::product.pcmpcode" ng-if="product.cmpUuId == null"></span>
+                </td>
                 <td class="line-h20 text-center" title="{{product.brand}}" ng-bind="::product.brand"></td>
                 <td class="text-center" title="单位" ng-bind="::product.unit"></td>
                 <td class="text-center"><a ui-sref="sale.productDetail({id:product.id})" ng-click="isProductEdit()" target="_self" title="编辑" style="position: relative;top:1px;"><i class="fa fa-lg fa-edit"></i></a>|<a ng-click="deleteById(product.id)"  title="删除"><i class="fa fa-lg fa-trash"></i></a></td>

+ 5 - 5
src/main/webapp/resources/tpl/index/purc/newProdInfo.html

@@ -90,15 +90,15 @@
                 <dd>
                     <div class="fl">产品名称:</div>
                     <div class="fr"><input type="text"  ng-model="prodInfo.title" style="cursor: pointer;" required="true"></div>
-                </dd>
-                <dd>
-                    <div class="fl">产品规格:</div>
-                    <div class="fr"><input type="text"  ng-model="prodInfo.spec" style="cursor: pointer;" required="true"><span>(请填写详细)</span></div>
                 </dd>
                  <dd>
+                    <div class="fl">产品型号:</div>
+                    <div class="fr"><input type="text"  ng-model="prodInfo.cmpCode" style="cursor: pointer;" required="true" ng-click="selectKind()"><span>(请填写详细)</span></div>
+                </dd>
+                <!--  <dd>
                     <div class="fl">原厂型号:</div>
                     <div class="fr"><input type="text" readonly="readonly" placeholder="点击选择原厂型号" style="cursor: pointer;" ng-model="prodInfo.cmpCode"  ng-click="selectKind()"><span>(关联器件原厂型号,不可编辑)</span></div>
-                </dd>
+                </dd> -->
                 <dd>
                     <div class="fl">品牌:</div>
                     <div class="fr"><input type="text" ng-model="prodInfo.brand" placeholder="品牌" style="cursor: pointer;" readonly="readonly"><span>(关联器件物料品牌,不可编辑)</span></div>

+ 5 - 1
src/main/webapp/resources/tpl/index/purc/prodList.html

@@ -251,10 +251,14 @@
                         <a ng-bind="::product.title" ui-sref="purc.productDetail({id:product.id})" target="_self"  title="查看详情" ng-if="product.kind != null"></a>
                     </div>
                 </td>
-               <td class="hover-show text-center" ng-class="{'bg01' : product.cmpUuId != null && product.cmpCode != null , 'bg02' : product.cmpUuId == null && product.cmpCode != null , '': product.cmpCode == null}">
+               <td class="hover-show text-center" ng-class="{'bg01' : product.cmpUuId != null && product.cmpCode != null , 'bg02' : product.cmpUuId == null && product.cmpCode != null , '': product.cmpCode == null}" ng-if="product.pcmpcode == null">
                 	<a href="http://www.usoftmall.com/product#/component/{{product.cmpUuId}}/" title="产品型号" ng-bind="::product.cmpCode"  target="_blank" ng-if="product.cmpUuId != null"></a>
                 	<span title="产品型号" ng-bind="::product.cmpCode" ng-if="product.cmpUuId == null"></span>
                 </td>
+                <td class="hover-show text-center" ng-class="{'bg01' : product.cmpUuId != null && product.cmpCode != null , 'bg02' : product.cmpUuId == null && product.cmpCode != null , '': product.cmpCode == null}" ng-if="product.pcmpcode != null">
+                	<a href="http://www.usoftmall.com/product#/component/{{product.cmpUuId}}/" title="产品型号" ng-bind="::product.pcmpcode"  target="_blank" ng-if="product.cmpUuId != null"></a>
+                	<span title="产品型号" ng-bind="::product.pcmpcode" ng-if="product.cmpUuId == null"></span>
+                </td>
                 <td class="line-h20 text-center" title="{{product.brand}}" ng-bind="::product.brand"></td>
                 <td class="text-center" title="单位" ng-bind="::product.unit"></td>
                  <td class="text-center"><a ui-sref="sale.productDetail({id:product.id})" target="_self" title="编辑" style="position: relative;top:1px;"><i class="fa fa-lg fa-edit"></i></a>|<a ng-click="deleteById(product.id)"  title="删除"><i class="fa fa-lg fa-trash"></i></a></td>