Procházet zdrojové kódy

B2B商务新增公共询价手动录入型号品牌不能保存的异常的处理

hejq před 7 roky
rodič
revize
83368af93c

+ 6 - 9
src/main/java/com/uas/platform/b2b/service/impl/PurcInquiryServiceImpl.java

@@ -14,7 +14,6 @@ import com.uas.platform.b2b.support.SystemSession;
 import com.uas.platform.b2b.support.UsageBufferedLogger;
 import com.uas.platform.b2b.temporary.model.*;
 import com.uas.platform.b2b.temporary.model.PurcInquiryInfo;
-import com.uas.platform.core.exception.IllegalOperatorException;
 import com.uas.platform.core.logging.BufferedLoggerManager;
 import com.uas.platform.core.model.Constant;
 import com.uas.platform.core.model.PageInfo;
@@ -150,8 +149,8 @@ public class PurcInquiryServiceImpl implements PurcInquiryService {
                                     item.setProduct(product);
                                     item.setProductId(product.getId());
                                 } else {// 导入或手动输入的一般不带有id
-                                    List<Product> products = productDao.findByEnUUAndCode(
-                                            SystemSession.getUser().getEnterprise().getUu(), purcitem.getProdCode());
+                                    List<Product> products = productDao.findByEnUUAndPcmpcodeAndPbrand(
+                                            SystemSession.getUser().getEnterprise().getUu(), purcitem.getCmpCode(), purcitem.getBrand());
                                     if (products.size() > 0) {
                                         product = products.get(0);
                                     }
@@ -169,12 +168,10 @@ public class PurcInquiryServiceImpl implements PurcInquiryService {
                                         product.setCmpUuId(purcitem.getProdCode());
                                         product.setUnit(purcitem.getUnit());
                                         product.setUserUU(SystemSession.getUser().getUserUU());
-//										product.setShipAddr(SystemSession.getUser().getEnterprise().getEnAddress());
                                         // 导入的物料这里没有填写规格
                                         product.setSpec(purcitem.getProdTitle());
                                         product.setCreateTime(new Date());
                                         Long proId = ProductUtils.updateOne(product);
-//                                        item.setProduct(product);
                                         item.setProductId(proId);
                                     }
                                 }
@@ -491,9 +488,10 @@ public class PurcInquiryServiceImpl implements PurcInquiryService {
                             item.setProduct(product);
                             item.setProductId(product.getId());
                         } else {// 导入或手动输入的一般不带有id
-                            product = productDao.findByEnUUAndCodeAndBrand(
-                                    SystemSession.getUser().getEnterprise().getUu(), purcitem.getProdCode(),
+                            List<Product> productList = productDao.findByEnUUAndPcmpcodeAndPbrand(
+                                    SystemSession.getUser().getEnterprise().getUu(), purcitem.getCmpCode(),
                                     purcitem.getInbrand());
+                            product = CollectionUtils.isEmpty(productList) ? null : productList.get(0);
                             if (product != null) {// 存在直接选择
                                 item.setProduct(product);
                                 item.setProductId(product.getId());
@@ -515,10 +513,9 @@ public class PurcInquiryServiceImpl implements PurcInquiryService {
                                 item.setProdTitle(purcitem.getProdTitle());
                                 item.setSpec(purcitem.getSpec());
                                 item.setCmpCode(purcitem.getCmpCode());
+                                item.setInbrand(purcitem.getInbrand());
                                 if (null != product) {
                                     item.setProductId(proId);
-                                } else {
-                                    throw new IllegalOperatorException("物料保存失败:" + product.getTitle());
                                 }
                             }
                         }

+ 4 - 4
src/main/webapp/resources/js/index/app.js

@@ -4537,7 +4537,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 
         $scope.inquiry.inquiryItems = [];
         var prod = {
-            prodCode: null,
+            cmpCode: null,
             prodTitle: null,
             inbrand: null,
             toDate: null,
@@ -4634,7 +4634,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
         $scope.onAssociateCmpClick = function (cmp, prod) {
             ComponentActiveAPI.get({uuid: cmp.uuid}, {}, function (data) {
                 $scope.component = data;
-                prod.prodCode = data.code;
+                prod.cmpCode = data.code;
                 prod.prodTitle = data.kind.nameCn;
                 prod.inbrand = data.brand.nameCn;
             }, function (res) {
@@ -4670,7 +4670,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
         $scope.add = function () {
             $scope.inquiry.inquiryItems.push(
                 {
-                    prodCode: null,
+                    cmpCode: null,
                     prodTitle: null,
                     unit: 'PCS',
                     ibrand: null,
@@ -4690,7 +4690,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 }
             }
             $scope.inquiry.inquiryItems.push({
-                prodCode: product.code, prodTitle: product.title, spec: product.spec, unit: product.unit,
+                cmpCode: product.cmpCode, prodTitle: product.title, spec: product.spec, unit: product.unit,
                 currency: null, toDate: null, needquantity: null, productId: product.id, inbrand: product.brand
             });
         }

+ 3 - 3
src/main/webapp/resources/tpl/index/purc/pubInquiry_new.html

@@ -1073,7 +1073,7 @@ select.disabled {
                                     <dd ng-repeat="prod in inquiry.inquiryItems" id="li01">
                                         <span>{{$index + 1}}</span>
                                         <span class="com01 wid01 text-center">
-                                        	<input type="text" name="code" ng-model="prod.prodCode" ng-change="getSimilarCodes(prod.prodCode)" ng-focus="onFocus('code')" placeholder="请输入标准原厂型号" typeahead="prod.code for prod in getSimilarCodes($viewValue)" autocomplete="off" typeahead-on-select="onAssociateCmpClick($item, prod)" spellcheck = "false" required>
+                                        	<input type="text" name="code" ng-model="prod.cmpCode" ng-change="getSimilarCodes(prod.cmpCode)" ng-focus="onFocus('code')" placeholder="请输入标准原厂型号" typeahead="prod.code for prod in getSimilarCodes($viewValue)" autocomplete="off" typeahead-on-select="onAssociateCmpClick($item, prod)" spellcheck = "false" required>
                                         </span>
                                         <span class="com01 wid01">
                                         	<input type="text" style="text-align: left;" class="input01" name="kindName" ng-model="prod.prodTitle"  required placeholder="请输入或选择分类" spellcheck = "false" autocomplete="off" />
@@ -1128,7 +1128,7 @@ select.disabled {
 		<table class="block table table-default table-striped" ng-table="tableParams">
 			<thead>
 				<tr class="header">
-					<th width="160px">型号</th>
+					<th width="160px">原厂型号</th>
 					<th width="120px">名称</th>
 					<th>规格</th>
 					<th width="120px">单位</th>
@@ -1149,7 +1149,7 @@ select.disabled {
 			</tbody>
 			<tbody>
 				<tr ng-repeat="product in $data">
-					<td class="text-center" ng-bind="::product.code"></td>
+					<td class="text-center" ng-bind="::product.cmpCode"></td>
 					<td class="text-center" ng-bind="::product.title"></td>
 					<td class="text-center f12" ng-bind="::product.spec"></td>
 					<td class="text-center" ng-bind="::product.unit"></td>

+ 3 - 17
src/main/webapp/resources/tpl/index/purc/purcinquiry_new.html

@@ -1056,7 +1056,7 @@ select.disabled {
 									<dd ng-repeat="prod in inquiry.inquiryItems" id="li01">
 										<span>{{$index + 1}}</span> 
 										<span class="com01 wid01 text-center"> 
-											<input type="text" name="code" ng-model="prod.prodCode" ng-change="getSimilarCodes(prod.prodCode)" ng-focus="onFocus('code')" placeholder="请输入标准原厂型号"
+											<input type="text" name="code" ng-model="prod.cmpCode" ng-change="getSimilarCodes(prod.cmpCode)" ng-focus="onFocus('code')" placeholder="请输入标准原厂型号"
 											typeahead="prod.code for prod in getSimilarCodes($viewValue)" autocomplete="off"
 											typeahead-on-select="onAssociateCmpClick($item, prod)" spellcheck="false" required>
 										</span> 
@@ -1105,10 +1105,6 @@ select.disabled {
                 <div class="row vend-info">
                     <div class="col-xs-12">
                         <div class="info-line col-xs-4"><span>供应商</span><span><input class="tender-input01" ng-model="vendor.enName" type="text" readonly></span></div>
-                        <!-- <div class="col-xs-1" style="width: 60px; margin-left: 20px;">UU</div>
-                        <div class="col-xs-3">
-                            <input ng-model="vendor.uu" type="text" style="width: 200px;" class="tender-input01" readonly>
-                        </div> -->
                         <div class="info-line col-xs-3">
                             <span>币别</span>
                             <span>
@@ -1129,9 +1125,6 @@ select.disabled {
                     </div>
                 </div>
                 <div class="col-xs-12" style="padding: 30px;" ng-if="inquiry.inquiryItems.length>0">
-                   <!--  <div class="col-xs-2 pull-right btn-publish">
-                        <button class="btn" ng-disabled="tenderForm.$invalid " ng-click="save()">保存</button>
-                    </div> -->
                     <div class="col-xs-2 pull-right btn-save">
                         <button class="btn" ng-disabled="tenderForm.$invalid " ng-click="submit()">询价</button>
                     </div>
@@ -1140,13 +1133,6 @@ select.disabled {
         </div>
     </form>
     <div class="pro-add-data02" style="min-height: 500px;" >
-		<!--<div class="pro-search">
-                <div class="search-result fl"><img src="static/img/purc/search01.png"/>搜索“{{tip}}”,为您找到<em>{{total}}</em>个结果</div>
-                <div class="search fr">
-                    <input type="text" placeholder="输入物料关键字查询" ng-model="keyword" ng-search="onSearch(keyword)"/>
-                    <a class="seek" ng-click="onSearch(keyword)">搜索</a>
-                </div>
-            </div>-->
         <div class="pro-search">
             <div class="col-xs-2 search-title fl">我的材料库</div>
             <div class="col-xs-8 fr">
@@ -1160,7 +1146,7 @@ select.disabled {
 		<table class="block table table-default table-striped" ng-table="tableParams">
 			<thead>
 				<tr class="header">
-					<th width="160px">号</th>
+					<th width="160px">原厂型号</th>
 					<th width="120px">名称</th>
 					<th>规格</th>
 					<th width="120px">单位</th>
@@ -1181,7 +1167,7 @@ select.disabled {
 			</tbody>
 			<tbody>
 				<tr ng-repeat="product in $data">
-					<td class="text-center" ng-bind="::product.code"></td>
+					<td class="text-center" ng-bind="::product.cmpCode"></td>
 					<td class="text-center" ng-bind="::product.title"></td>
 					<td class="text-center f12" ng-bind="::product.spec"></td>
 					<td class="text-center" ng-bind="::product.unit"></td>